import{_ as D,d as $,aU as y,Q as C,m as U,r as g,f as h,o as w,w as o,a as l,F as O,e as E,b as I,j as T,I as A,B,l as c,t as b,X as M,Y as j}from"./app-BOG5ezKh.js";import{a as q}from"./apiAdmin-DBoC2A9r.js";import{U as F}from"./Upload-DYH4JnXM.js";import{S as N}from"./SaveOutlined-BfejBXOc.js";const V=$({props:["formData","data","visible","url","addEditType","pageTitle","successMessage"],components:{PlusOutlined:C,LoadingOutlined:y,SaveOutlined:N,Upload:F},setup(e,{emit:a}){const{addEditRequestAdmin:u,loading:d,rules:t}=q(),{slugify:p}=U();return{loading:d,rules:t,onClose:()=>{t.value={},a("closed")},onSubmit:()=>{u({url:e.url,data:e.formData,successMessage:e.successMessage,success:s=>{a("addEditSuccess",s.xid)}})},slugify:p,drawerWidth:window.innerWidth<=991?"90%":"45%"}}});function W(e,a,u,d,t,p){const m=A,r=T,s=I,i=E,_=g("Upload"),v=O,S=g("SaveOutlined"),f=B,k=M;return w(),h(k,{open:e.visible,closable:!1,centered:!0,title:e.pageTitle,onOk:e.onSubmit},{footer:o(()=>[l(f,{key:"submit",type:"primary",loading:e.loading,onClick:e.onSubmit},{icon:o(()=>[l(S)]),default:o(()=>[c(" "+b(e.addEditType=="add"?e.$t("common.create"):e.$t("common.update")),1)]),_:1},8,["loading","onClick"]),l(f,{key:"back",onClick:e.onClose},{default:o(()=>[c(b(e.$t("common.cancel")),1)]),_:1},8,["onClick"])]),default:o(()=>[l(v,{layout:"vertical"},{default:o(()=>[l(i,{gutter:16},{default:o(()=>[l(s,{xs:24,sm:24,md:24,lg:24},{default:o(()=>[l(r,{label:e.$t("brand.name"),name:"name",help:e.rules.name?e.rules.name.message:null,validateStatus:e.rules.name?"error":null,class:"required"},{default:o(()=>[l(m,{value:e.formData.name,"onUpdate:value":a[0]||(a[0]=n=>e.formData.name=n),placeholder:e.$t("common.placeholder_default_text",[e.$t("brand.name")]),onKeyup:a[1]||(a[1]=n=>e.formData.slug=e.slugify(n.target.value))},null,8,["value","placeholder"])]),_:1},8,["label","help","validateStatus"])]),_:1})]),_:1}),l(i,{gutter:16},{default:o(()=>[l(s,{xs:24,sm:24,md:24,lg:24},{default:o(()=>[l(r,{label:e.$t("brand.slug"),name:"slug",help:e.rules.slug?e.rules.slug.message:null,validateStatus:e.rules.slug?"error":null,class:"required"},{default:o(()=>[l(m,{value:e.formData.slug,"onUpdate:value":a[2]||(a[2]=n=>e.formData.slug=n),placeholder:e.$t("common.placeholder_default_text",[e.$t("brand.slug")])},null,8,["value","placeholder"])]),_:1},8,["label","help","validateStatus"])]),_:1})]),_:1}),l(i,{gutter:16},{default:o(()=>[l(s,{xs:24,sm:24,md:24,lg:24},{default:o(()=>[l(r,{label:e.$t("brand.logo"),name:"logo",help:e.rules.logo?e.rules.logo.message:null,validateStatus:e.rules.logo?"error":null},{default:o(()=>[l(_,{formData:e.formData,folder:"brand",onOnFileUploaded:a[3]||(a[3]=n=>{e.formData.image=n.file,e.formData.image_url=n.file_url})},null,8,["formData"])]),_:1},8,["label","help","validateStatus"])]),_:1})]),_:1})]),_:1})]),_:1},8,["open","title","onOk"])}const R=D(V,[["render",W],["__file","/Users/rajeshkumawat/sites/stockifly/resources/js/main/views/product-manager/brands/AddEdit.vue"]]),X=()=>{const e="brands",{t:a}=j(),u={name:"",slug:"",image:void 0,image_url:void 0},d=[{title:a("brand.name"),dataIndex:"name",sorter:!0},{title:a("brand.logo"),dataIndex:"image_url"},{title:a("common.action"),dataIndex:"action"}],t=[{key:"name",value:a("brand.name")}];return{addEditUrl:e,initData:u,columns:d,filterableColumns:t}};export{R as A,X as f};
