import{an as g,u as $,_ as D,d as h,a0 as C,Q as U,e as O,w as l,b as c,o as A,g as a,i as _,t as k}from"./app-CgV11GBz.js";import{a as I}from"./apiAdmin-CiAsr8eb.js";import{U as w}from"./Upload-CYrHetkO.js";import{S as E}from"./SaveOutlined-NNV7kkji.js";import{P as T}from"./index-B7-RTJOc.js";import{M as B}from"./index-CNlVDwHo.js";import{F as M,_ as q}from"./index-DX5UyTUL.js";import{I as F}from"./index-CJx7RGCD.js";import{B as L}from"./useFlexGapSupport-CWWB0EO1.js";import{_ as N,a as P}from"./index-CyQQxPex.js";const Z=()=>{const e=g("langs?fields=id,xid,name,image,image_url,key,enabled"),n=g("langs"),{t:o}=$(),r={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"}],u=[{key:"name",value:o("langs.name")}];return{url:e,addEditUrl:n,initData:r,columns:s,filterableColumns:u}},V=h({props:["formData","data","visible","url","addEditType","pageTitle","successMessage"],components:{PlusOutlined:T,LoadingOutlined:C,SaveOutlined:E,Upload:w},setup(e,{emit:n}){const{addEditRequestAdmin:o,loading:r,rules:s}=I(),u=U();return{loading:r,rules:s,onClose:()=>{s.value={},n("closed")},onSubmit:()=>{o({url:e.url,data:e.formData,successMessage:e.successMessage,success:d=>{n("addEditSuccess",d.xid),u.updateAllLangsAction()}})},drawerWidth:window.innerWidth<=991?"90%":"45%"}}});function W(e,n,o,r,s,u){const i=F,m=q,d=P,p=N,y=c("Upload"),b=M,v=c("SaveOutlined"),f=L,S=B;return A(),O(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(b,{layout:"vertical"},{default:l(()=>[a(p,{gutter:16},{default:l(()=>[a(d,{xs:24,sm:24,md:24,lg:24},{default:l(()=>[a(m,{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(i,{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(m,{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(i,{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(m,{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(y,{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 x=D(V,[["render",W]]);export{x as A,Z as f};
