import{bc as c,b as $,_ as D,x as h,Z as C,$ as U,u as O,e as g,o as w,f as E,w as l,c as a,i as _,t as k,a0 as I,a1 as T,n as A,v as B,a8 as M,B as q,al as F}from"./app-DGDivIsO.js";import{a as L}from"./apiAdmin-D4J8O5cP.js";import{U as N}from"./Upload-DinpFMlS.js";import{S as V}from"./SaveOutlined-saF8VQQc.js";const G=()=>{const e=c("langs?fields=id,xid,name,image,image_url,key,enabled"),n=c("langs"),{t:o}=$(),u={name:"",key:"",image:void 0,image_url:void 0,enabled:!0},s=[{title:o("langs.name"),dataIndex:"name"},{title:o("langs.key"),dataIndex:"key"},{title:o("langs.enabled"),dataIndex:"enabled"},{title:o("common.action"),dataIndex:"action"}],r=[{key:"name",value:o("langs.name")}];return{url:e,addEditUrl:n,initData:u,columns:s,filterableColumns:r}},W=h({props:["formData","data","visible","url","addEditType","pageTitle","successMessage"],components:{PlusOutlined:C,LoadingOutlined:U,SaveOutlined:V,Upload:N},setup(e,{emit:n}){const{addEditRequestAdmin:o,loading:u,rules:s}=L(),r=O();return{loading:u,rules:s,onClose:()=>{s.value={},n("closed")},onSubmit:()=>{o({url:e.url,data:e.formData,successMessage:e.successMessage,success:d=>{n("addEditSuccess",d.xid),r.dispatch("auth/updateAllLangs")}})},drawerWidth:window.innerWidth<=991?"90%":"45%"}}});function P(e,n,o,u,s,r){const m=I,i=T,d=A,p=B,b=g("Upload"),y=M,v=g("SaveOutlined"),f=q,S=F;return w(),E(S,{open:e.visible,closable:!1,centered:!0,title:e.pageTitle,onOk:e.onSubmit},{footer:l(()=>[a(f,{key:"submit",type:"primary",loading:e.loading,onClick:e.onSubmit},{icon:l(()=>[a(v)]),default:l(()=>[_(" "+k(e.addEditType=="add"?e.$t("common.create"):e.$t("common.update")),1)]),_:1},8,["loading","onClick"]),a(f,{key:"back",onClick:e.onClose},{default:l(()=>[_(k(e.$t("common.cancel")),1)]),_:1},8,["onClick"])]),default:l(()=>[a(y,{layout:"vertical"},{default:l(()=>[a(p,{gutter:16},{default:l(()=>[a(d,{xs:24,sm:24,md:24,lg:24},{default:l(()=>[a(i,{label:e.$t("langs.name"),name:"name",help:e.rules.name?e.rules.name.message:null,validateStatus:e.rules.name?"error":null,class:"required"},{default:l(()=>[a(m,{value:e.formData.name,"onUpdate:value":n[0]||(n[0]=t=>e.formData.name=t),placeholder:e.$t("common.placeholder_default_text",[e.$t("langs.name")])},null,8,["value","placeholder"])]),_:1},8,["label","help","validateStatus"])]),_:1})]),_:1}),a(p,{gutter:16},{default:l(()=>[a(d,{xs:24,sm:24,md:24,lg:24},{default:l(()=>[a(i,{label:e.$t("langs.key"),name:"key",help:e.rules.key?e.rules.key.message:null,validateStatus:e.rules.key?"error":null,class:"required"},{default:l(()=>[a(m,{value:e.formData.key,"onUpdate:value":n[1]||(n[1]=t=>e.formData.key=t),placeholder:e.$t("common.placeholder_default_text",[e.$t("langs.key")])},null,8,["value","placeholder"])]),_:1},8,["label","help","validateStatus"])]),_:1})]),_:1}),a(p,null,{default:l(()=>[a(d,{span:24},{default:l(()=>[a(i,{label:e.$t("langs.flag"),name:"image",help:e.rules.image?e.rules.image.message:null,validateStatus:e.rules.image?"error":null},{default:l(()=>[a(b,{formData:e.formData,folder:"langs",onOnFileUploaded:n[2]||(n[2]=t=>{e.formData.image=t.file,e.formData.image_url=t.file_url})},null,8,["formData"])]),_:1},8,["label","help","validateStatus"])]),_:1})]),_:1})]),_:1})]),_:1},8,["open","title","onOk"])}const H=D(W,[["render",P]]);export{H as A,G as f};
