import{ref as e}from"vue";import{defineStore as L}from"pinia";import{b as S,k as $}from"../server.mjs";import"klona";import"defu";import"#internal/nuxt/paths";const F=L("career",()=>{const{locale:m}=S(),{$axios:c}=$(),r=e({}),o=e(!1),n=e(!0),l=e(!1);let i=e();const v=e(!1),u=e([]);let p=e(),d=e(1),f=e();async function g(s,a,w,y){o.value=!0;try{let t=new FormData;if(t.append("name",s.name),t.append("phone",`+966${s.phone}`),t.append("email",s.email),t.append("cv",s.cv),(await c.post(`career/store/${w}`,t)).status>=200){o.value=!1,r.value=void 0,y=null,i.value=!1;const C=await import("mosha-vue-toastify"),{createToast:x}=C;x(m.value=="ar"?"تم التواصل بنجاح ":"Communication was successful",{toastBackgroundColor:"#00A0B4",position:"top-right",type:"success",transition:"bounce",showIcon:"true",timeout:3e3}),a({values:{email:"",name:"",cv:"",phone:""},errors:{}})}}catch(t){t.response&&(o.value=!1,r.value=t.response.data.errors)}}async function h(s){l.value=!0;try{const a=await c.get("career",{params:{page:s}});a.status>=200&&(n.value=!1,u.value=[...u.value,...a.data.data],p.value=a.data.meta.total,f.value=a.data.meta.per_page,l.value=!1)}catch(a){a.response&&(n.value=!1)}}return{errors:r,isLoading:o,pendingState:v,isLoading2:n,getContact:g,careers:u,total:p,isLoading3:l,per_page:f,page:d,active:i,getCareer:h}});export{F as u};
