text: "use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2094],{42094:(e,t,o)=>{o.r(t),o.d(t,{default:()=>O});var a=o(70821),l={class:"card"},n=(0,a.createElementVNode)("h4",null,"Management Menu",-1),r={class:"card-body"},s={class:"field grid"},d=(0,a.createElementVNode)("label",{style:{width:"120px"}},"Menu ID",-1),c={class:"col-3 md-6"},i={class:"field grid"},u=(0,a.createElementVNode)("label",{style:{width:"120px"}},"Menu Name",-1),m={class:"col-3 md-6"},p={key:0,class:"p-error"},V={class:"field grid"},h=(0,a.createElementVNode)("label",{style:{width:"120px"}},"Menu Deskripsi",-1),N={class:"col-3 md-6"},k={key:0,class:"p-error"},f={class:"field grid"},y=(0,a.createElementVNode)("label",{style:{width:"120px"}},"Menu Display",-1),v={class:"col-3 md-6"},E={key:0,class:"p-error"},g={class:"field grid"},_=(0,a.createElementVNode)("label",{style:{width:"120px"}},"Controller",-1),C={class:"col-3 md-6"},M={key:0,class:"p-error"},b={class:"field grid"},B=(0,a.createElementVNode)("label",{style:{width:"120px"}},"Action",-1),S={class:"col-3 md-6"},w={class:"field grid"},x=(0,a.createElementVNode)("label",{style:{width:"120px"}},"Menu Status",-1),U={class:"col-3 md-6"},D={key:0,class:"p-error"},z={class:"field grid"},A=(0,a.createElementVNode)("label",{style:{width:"120px"}},"Menu Type",-1),T={class:"col-3 md-6"},$={key:0,class:"p-error"},L={class:"field grid"},I=(0,a.createElementVNode)("label",{style:{width:"120px"}},"Module Name",-1),P={class:"col-3 md-6"},F={key:0,class:"p-error"},j={class:"field grid"},q=(0,a.createElementVNode)("label",{style:{width:"120px"}},"Parent ID",-1),G={class:"col-3 md-6"},H={key:0,class:"p-error"},J={class:"form-group"};const K={data:function(){return{errors:[],menu:[],modul:[],parent:[],stat:[{nama:"Aktif",code:"T"},{nama:"Tidak Aktif",code:"F"}],type:[{nama:"Node",code:"N"},{nama:"Leaf",code:"L"}],token:localStorage.getItem("token"),checkname:[],checkto:[],id:localStorage.getItem("id")}},created:function(){this.cekUser()},methods:{cekUser:function(){var e=this;this.id?this.axios.get("/api/cek-user/"+this.id,{headers:{Authorization:"Bearer "+this.token}}).then((function(t){e.checkto=t.data.map((function(e){return e.to})),e.checkname=t.data.map((function(e){return e.name})),e.checkname.includes("Menu")||e.checkto.includes("/mng-menu")?(e.getModul(),e.getParent(),e.getMenu()):e.$router.push("/access")})):this.$router.push("/login")},getMenu:function(){var e=this;this.axios.get("/api/edit-menu/"+this.$route.params.code,{headers:{Authorization:"Bearer "+this.token}}).then((function(t){e.menu=t.data}))},getModul:function(){var e=this;this.axios.get("/api/get-module",{headers:{Authorization:"Bearer "+this.token}}).then((function(t){e.modul=t.data})).catch((function(t){401==t.response.status&&(e.$toast.add({severity:"error",summary:"Error",detail:"Sesi Login Expired"}),localStorage.clear(),localStorage.setItem("Expired","true"),setTimeout((function(){return e.$router.push("/login")}),2e3))}))},getParent:function(){var e=this;this.axios.get("/api/get-parent",{headers:{Authorization:"Bearer "+this.token}}).then((function(t){e.parent=t.data}))},UpdateMenu:function(){var e=this;this.errors=[],this.axios.put("/api/update-menu/"+this.$route.params.code,this.menu,{headers:{Authorization:"Bearer "+this.token}}).then((function(){e.$toast.add({severity:"success",summary:"Success Message",detail:"Success Update"}),setTimeout((function(){return e.$router.push("/mng-menu")}),1e3)})).catch((function(t){422==t.response.status&&(e.errors=t.response.data.errors)}))}},render:function(e,t,o,K,O,Q){var R=(0,a.resolveComponent)("Toast"),W=(0,a.resolveComponent)("Toolbar"),X=(0,a.resolveComponent)("InputText"),Y=(0,a.resolveComponent)("Dropdown"),Z=(0,a.resolveComponent)("Button");return(0,a.openBlock)(),(0,a.createElementBlock)("div",null,[(0,a.createVNode)(R),(0,a.createElementVNode)("div",l,[(0,a.createVNode)(W,{class:"mb-4"},{start:(0,a.withCtx)((function(){return[n]})),_:1}),(0,a.createElementVNode)("div",r,[(0,a.createElementVNode)("form",{onSubmit:t[11]||(t[11]=(0,a.withModifiers)((function(){return Q.UpdateMenu&&Q.UpdateMenu.apply(Q,arguments)}),["prevent"]))},[(0,a.createElementVNode)("div",s,[d,(0,a.createElementVNode)("div",c,[(0,a.createVNode)(X,{modelValue:O.menu.menu_id,"onUpdate:modelValue":t[0]||(t[0]=function(e){return O.menu.menu_id=e}),disabled:""},null,8,["modelValue"])])]),(0,a.createElementVNode)("div",i,[u,(0,a.createElementVNode)("div",m,[(0,a.createVNode)(X,{modelValue:O.menu.menu_name,"onUpdate:modelValue":t[1]||(t[1]=function(e){return O.menu.menu_name=e}),placeholder:"Masukan Menu Name",class:(0,a.normalizeClass)({"p-invalid":O.errors.menu_name}),autofocus:""},null,8,["modelValue","class"]),O.errors.menu_name?((0,a.openBlock)(),(0,a.createElementBlock)("small",p,(0,a.toDisplayString)(O.errors.menu_name[0]),1)):(0,a.createCommentVNode)("",!0)])]),(0,a.createElementVNode)("div",V,[h,(0,a.createElementVNode)("div",N,[(0,a.createVNode)(X,{modelValue:O.menu.menu_desc,"onUpdate:modelValue":t[2]||(t[2]=function(e){return O.menu.menu_desc=e}),placeholder:"Masukan Menu Deskripsi",class:(0,a.normalizeClass)({"p-invalid":O.errors.menu_desc})},null,8,["modelValue","class"]),O.errors.menu_desc?((0,a.openBlock)(),(0,a.createElementBlock)("small",k,(0,a.toDisplayString)(O.errors.menu_desc[0]),1)):(0,a.createCommentVNode)("",!0)])]),(0,a.createElementVNode)("div",f,[y,(0,a.createElementVNode)("div",v,[(0,a.createVNode)(X,{modelValue:O.menu.menu_display,"onUpdate:modelValue":t[3]||(t[3]=function(e){return O.menu.menu_display=e}),placeholder:"Masukan Menu Display",class:(0,a.normalizeClass)({"p-invalid":O.errors.menu_display})},null,8,["modelValue","class"]),O.errors.menu_display?((0,a.openBlock)(),(0,a.createElementBlock)("small",E,(0,a.toDisplayString)(O.errors.menu_display[0]),1)):(0,a.createCommentVNode)("",!0)])]),(0,a.createElementVNode)("div",g,[_,(0,a.createElementVNode)("div",C,[(0,a.createVNode)(X,{modelValue:O.menu.controller,"onUpdate:modelValue":t[4]||(t[4]=function(e){return O.menu.controller=e}),placeholder:"Masukan Controller",class:(0,a.normalizeClass)({"p-invalid":O.errors.controller})},null,8,["modelValue","class"]),O.errors.controller?((0,a.openBlock)(),(0,a.createElementBlock)("small",M,(0,a.toDisplayString)(O.errors.controller[0]),1)):(0,a.createCommentVNode)("",!0)])]),(0,a.createElementVNode)("div",b,[B,(0,a.createElementVNode)("div",S,[(0,a.createVNode)(X,{modelValue:O.menu.action,"onUpdate:modelValue":t[5]||(t[5]=function(e){return O.menu.action=e}),placeholder:"Masukan Action"},null,8,["modelValue"])])]),(0,a.createElementVNode)("div",w,[x,(0,a.createElementVNode)("div",U,[(0,a.createVNode)(Y,{modelValue:O.menu.menu_stat,"onUpdate:modelValue":t[6]||(t[6]=function(e){return O.menu.menu_stat=e}),options:O.stat,showClear:!0,optionLabel:"nama",optionValue:"code",placeholder:"Select A Status",class:(0,a.normalizeClass)({"p-invalid":O.errors.menu_stat})},null,8,["modelValue","options","class"]),O.errors.menu_stat?((0,a.openBlock)(),(0,a.createElementBlock)("small",D,(0,a.toDisplayString)(O.errors.menu_stat[0]),1)):(0,a.createCommentVNode)("",!0)])]),(0,a.createElementVNode)("div",z,[A,(0,a.createElementVNode)("div",T,[(0,a.createVNode)(Y,{modelValue:O.menu.menu_type,"onUpdate:modelValue":t[7]||(t[7]=function(e){return O.menu.menu_type=e}),options:O.type,showClear:!0,optionLabel:"nama",optionValue:"code",placeholder:"Select A Menu Type",class:(0,a.normalizeClass)({"p-invalid":O.errors.menu_type})},null,8,["modelValue","options","class"]),O.errors.menu_type?((0,a.openBlock)(),(0,a.createElementBlock)("small",$,(0,a.toDisplayString)(O.errors.menu_type[0]),1)):(0,a.createCommentVNode)("",!0)])]),(0,a.createElementVNode)("div",L,[I,(0,a.createElementVNode)("div",P,[(0,a.createVNode)(Y,{modelValue:O.menu.mod_id,"onUpdate:modelValue":t[8]||(t[8]=function(e){return O.menu.mod_id=e}),options:O.modul,showClear:!0,optionLabel:"name",optionValue:"code",placeholder:"Select A Module",class:(0,a.normalizeClass)({"p-invalid":O.errors.mod_id})},null,8,["modelValue","options","class"]),O.errors.mod_id?((0,a.openBlock)(),(0,a.createElementBlock)("small",F,(0,a.toDisplayString)(O.errors.mod_id[0]),1)):(0,a.createCommentVNode)("",!0)])]),(0,a.createElementVNode)("div",j,[q,(0,a.createElementVNode)("div",G,[(0,a.createVNode)(Y,{modelValue:O.menu.parent_id,"onUpdate:modelValue":t[9]||(t[9]=function(e){return O.menu.parent_id=e}),options:O.parent,showClear:!0,optionLabel:"name",optionValue:"code",placeholder:"Select A Parent",class:(0,a.normalizeClass)({"p-invalid":O.errors.parent_id})},null,8,["modelValue","options","class"]),O.errors.parent_id?((0,a.openBlock)(),(0,a.createElementBlock)("small",H,(0,a.toDisplayString)(O.errors.parent_id[0]),1)):(0,a.createCommentVNode)("",!0)])]),(0,a.createElementVNode)("div",J,[(0,a.createVNode)(Z,{class:"p-button-rounded p-button-primary mr-2",icon:"pi pi-check",label:"Simpan",type:"submit"}),(0,a.createVNode)(Z,{label:"Cancel",class:"p-button-rounded p-button-secondary mr-2",icon:"pi pi-times",onClick:t[10]||(t[10]=function(t){return e.$router.push("/mng-menu")})})])],32)])])])}},O=K}}]);