import{au as g,Y as $,_ as h,d as D,aU as C,Q as U,u as w,r as c,f as O,o as E,w as l,a,F as I,e as A,b as T,j as B,I as M,B as j,l as _,t as k,X as q}from"./app-BOG5ezKh.js";import{a as F}from"./apiAdmin-DBoC2A9r.js";import{U as L}from"./Upload-DYH4JnXM.js";import{S as N}from"./SaveOutlined-BfejBXOc.js";const Y=()=>{const e=g("langs?fields=id,xid,name,image,image_url,key,enabled"),n=g("langs"),{t}=$(),u={name:"",key:"",image:void 0,image_url:void 0,enabled:!0},s=[{title:t("langs.name"),dataIndex:"name"},{title:t("langs.key"),dataIndex:"key"},{title:t("langs.enabled"),dataIndex:"enabled"},{title:t("common.action"),dataIndex:"action"}],i=[{key:"name",value:t("langs.name")}];return{url:e,addEditUrl:n,initData:u,columns:s,filterableColumns:i}},V=D({props:["formData","data","visible","url","addEditType","pageTitle","successMessage"],components:{PlusOutlined:U,LoadingOutlined:C,SaveOutlined:N,Upload:L},setup(e,{emit:n}){const{addEditRequestAdmin:t,loading:u,rules:s}=F(),i=w();return{loading:u,rules:s,onClose:()=>{s.value={},n("closed")},onSubmit:()=>{t({url:e.url,data:e.formData,successMessage:e.successMessage,success:d=>{n("addEditSuccess",d.xid),i.dispatch("auth/updateAllLangs")}})},drawerWidth:window.innerWidth<=991?"90%":"45%"}}});function W(e,n,t,u,s,i){const m=M,r=B,d=T,p=A,y=c("Upload"),v=I,b=c("SaveOutlined"),f=j,S=q;return E(),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(b)]),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(v,{layout:"vertical"},{default:l(()=>[a(p,{gutter:16},{default:l(()=>[a(d,{xs:24,sm:24,md:24,lg:24},{default:l(()=>[a(r,{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]=o=>e.formData.name=o),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(r,{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]=o=>e.formData.key=o),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(r,{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]=o=>{e.formData.image=o.file,e.formData.image_url=o.file_url})},null,8,["formData"])]),_:1},8,["label","help","validateStatus"])]),_:1})]),_:1})]),_:1})]),_:1},8,["open","title","onOk"])}const z=h(V,[["render",W],["__file","/Users/rajeshkumawat/sites/stockifly/resources/js/main/views/common/settings/translations/langs/AddEdit.vue"]]);export{z as A,Y as f};
