import{p as h,Y as x,u as E,V as M,ak as g,ay as F,b5 as c}from"./app-BOG5ezKh.js";const S=()=>{const o=h(!1),n=h({}),{t:l}=x(),q=E(),R=M(()=>q.state.front.warehouseSlug);return{loading:o,rules:n,addEditRequestFront:s=>{o.value=!0;const{url:i,data:m,success:f}=s;var t={};g(m,function(r,e){r==null?t[e]=null:t[e]=r}),t.warehouse=R.value,axiosFront.post(i,t).then(r=>{s.successMessage&&F.success({placement:"bottomRight",message:l("common.success"),description:s.successMessage}),f(r.data),o.value=!1,n.value={}}).catch(r=>{var e=r.data;const p=r.status;var d={};if(p==422){if(e.error&&typeof e.error.details<"u")for(var u=Object.keys(e.error.details),a=0;a<u.length;a++){var v=u[a].replace(".","\\.");d[v]={required:!0,message:e.error.details[u[a]][0]}}n.value=d,c.error(l("common.fix_errors"))}e&&e.message&&(c.error(e.message),e={error:{...e}}),s.error&&s.error(e),o.value=!1})},addEditFileRequestFront:s=>{o.value=!0;const{url:i,data:m,success:f}=s,t=new FormData;g(m,function(r,e){r==null?t.append(e,null):t.append(e,r.originFileObj)}),axiosAdmin.post(i,t,{headers:{"Content-Type":"multipart/form-data"}}).then(r=>{s.successMessage&&F.success({placement:"bottomRight",message:l("common.success"),description:s.successMessage}),f(r.data),o.value=!1,n.value={}}).catch(r=>{var e=r.data;const p=r.status;var d={};if(p==422){if(e.error&&typeof e.error.details<"u")for(var u=Object.keys(e.error.details),a=0;a<u.length;a++){var v=u[a].replace(".","\\.");d[v]={required:!0,message:e.error.details[u[a]][0]}}n.value=d,c.error(l("common.fix_errors"))}e&&e.message&&(c.error(e.message),e={error:{...e}}),s.error&&s.error(e),o.value=!1})}}};export{S as a};
