import{d as g,o as e,a as u,w as p,f,t as m,b as k,z as R,C as j,j as a,F as B,X as A,k as h,i as C,D as F,q as T,H as I,E as b,J as r,n as $,c as y,x as z,e as d,at as H,au as J,av as O}from"./index.29cf2edd.js";/* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              */import{_ as P}from"./Status.120e28ab.js";/* empty css              */import{f as L}from"./filters.69c883c5.js";import{_ as W}from"./SingleUploader.2fcaa0e4.js";/* empty css              */const N=g({__name:"YesNo",props:{value:{type:Boolean,required:!0}},setup(i){return(v,_)=>{const s=j;return e(),u(s,{color:k(R)(k(L).truefalse(i.value))},{default:p(()=>[f(m(k(L).truefalse(i.value)),1)]),_:1},8,["color"])}}}),X={key:0},Y={key:1},G=g({__name:"Lang",props:{langs:{type:Object,required:!0},showRelatedLangName:{type:Boolean,default:!1}},setup(i){return(v,_)=>(e(),a("div",null,[i.showRelatedLangName?(e(),a("div",X,m(i.langs.la),1)):(e(),a("div",Y,[(e(!0),a(B,null,A(i.langs,(s,o)=>(e(),a("div",null,[h("strong",null,m(o.toUpperCase()),1),f(": "+m(s),1)]))),256))]))]))}}),K=["src"],Q={key:5,class:"editable-row-operations"},Z={key:0},ee=f("Save"),te=h("a",null,"Cancel",-1),ae={key:1},ne=["onClick"],ge=g({__name:"AppMenu",setup(i){const v=[{title:"ID",dataIndex:"id",key:"id"},{title:"Icon",dataIndex:"icon",key:"icon"},{title:"Name",dataIndex:"name",key:"name"},{title:"URL",dataIndex:"url",key:"url"},{title:"Position",dataIndex:"position",key:"position"},{title:"Status",dataIndex:"status",key:"status"},{title:"Is WebView",dataIndex:"iswebview",key:"iswebview"},{title:"Is Login",dataIndex:"islogin",key:"islogin"},{title:"Active",key:"action"}];let _=C(),s=C();const o=F({});T(()=>{x()});const x=async()=>{I(),b.getMenus().then(t=>{r();const l=t.data;_.value=l.menus}).catch(t=>{r(),$.error(t.message)})},D=t=>{I(),b.updateMenu(o[s.value]).then(l=>{r(),$.success("Saved"),s.value=void 0,delete o[t],x()}).catch(l=>{r(),console.log(l)})},S=t=>{s.value=void 0,delete o[t]},M=t=>{s.value=t,o[t]=H(_.value.filter(l=>t===l.id)[0])},U=t=>{o[s.value].icon=t};return(t,l)=>{const V=J,q=O,E=z;return e(),a("div",null,[y(E,{columns:v,"data-source":k(_)},{bodyCell:p(({column:c,text:se,record:n})=>[c.key==="icon"?(e(),a(B,{key:0},[o[n.id]?(e(),u(W,{key:0,text:"Upload Icon",onUpload:U})):(e(),a("img",{key:1,src:n.icon,width:"40"},null,8,K))],64)):d("",!0),c.key==="name"?(e(),u(G,{key:1,langs:n.name},null,8,["langs"])):d("",!0),c.key==="status"?(e(),u(P,{key:2,status:n.status},null,8,["status"])):d("",!0),c.key==="iswebview"?(e(),u(N,{key:3,value:!!n.iswebview},null,8,["value"])):d("",!0),c.key==="islogin"?(e(),u(N,{key:4,value:n.islogin},null,8,["value"])):c.key==="action"?(e(),a("div",Q,[o[n.id]?(e(),a("span",Z,[y(V,{onClick:w=>D(n.id),style:{"padding-right":"5px"}},{default:p(()=>[ee]),_:2},1032,["onClick"]),y(q,{title:"Sure to cancel?",onConfirm:w=>S(n.id)},{default:p(()=>[te]),_:2},1032,["onConfirm"])])):(e(),a("span",ae,[h("a",{onClick:w=>M(n.id)},"Edit",8,ne)]))])):d("",!0)]),_:1},8,["data-source"])])}}});export{ge as default};
