import{a as h,S as a,_ as c}from"./main-9b36f05f.js";import{h as C,r as y,a as k,o as d,s as v,e as t,d as o,b as g,w as m,u as i,as as l,t as A,c as p,A as b,ao as B}from"./vendor-adef9cb4.js";const $=C({name:"modalNew",components:{},watch:{"item.type"(u,e){u=="sell"?(this.$data.item.title="فروش",this.$data.item.removeBeforeTicketsEnable=!0):u=="buy"?(this.$data.item.title="خرید",this.$data.item.removeBeforeTicketsEnable=!0):u=="rfbuy"?(this.$data.item.title="برگشت از خرید",this.$data.item.removeBeforeTicketsEnable=!0):u=="rfsell"?(this.$data.item.title="برگشت از فروش",this.$data.item.removeBeforeTicketsEnable=!0):u=="wastage"?(this.$data.item.title="ضایعات",this.$data.item.removeBeforeTicketsEnable=!1,this.$data.item.removeBeforeTickets=!1):u=="used"&&(this.$data.item.title="مصرف مستقیم",this.$data.item.removeBeforeTicketsEnable=!1,this.$data.item.removeBeforeTickets=!1)}},data:()=>({loading:y(!1),storerooms:[],item:{storeroom:null,type:"sell",title:"فروش",docSell:null,docBuy:null,removeBeforeTickets:!0,removeBeforeTicketsEnable:!0},buys:[],sells:[],rfsells:[],rfbuys:[]}),methods:{loadData(){this.loading=!0,h.post("/api/storeroom/list").then(u=>{this.storerooms=u.data.data,this.storerooms.forEach(e=>{e.name=e.name+" انباردار : "+e.manager}),this.storerooms.length!=0&&(this.item.storeroom=this.storerooms[0]),this.loading=!1}),h.post("/api/storeroom/docs/get").then(u=>{this.buys=u.data.buys,this.sells=u.data.sells,this.rfsells=u.data.rfsells,this.rfbuys=u.data.rfbuys})},submit(){this.loading=!0,this.item.storeroom==null?a.fire({text:"انبار انتخاب نشده است.",icon:"error",confirmButtonText:"قبول"}).then(u=>{this.loading=!1}):this.item.type=="sell"&&this.item.docSell==null?a.fire({text:"فاکتور فروش انتخاب نشده است.",icon:"error",confirmButtonText:"قبول"}).then(u=>{this.loading=!1}):this.item.type=="buy"&&this.item.docBuy==null?a.fire({text:"فاکتور خرید انتخاب نشده است.",icon:"error",confirmButtonText:"قبول"}).then(u=>{this.loading=!1}):this.item.type=="rfbuy"&&this.item.docRfbuy==null?a.fire({text:"فاکتور برگشت از خرید انتخاب نشده است.",icon:"error",confirmButtonText:"قبول"}).then(u=>{this.loading=!1}):this.item.type=="rfsell"&&this.item.docRfsell==null?a.fire({text:"فاکتور برگشت از خرید انتخاب نشده است.",icon:"error",confirmButtonText:"قبول"}).then(u=>{this.loading=!1}):this.item.type=="sell"?this.$router.push({name:"storeroom_new_ticket_sell",params:{doc:this.item.docSell.code,storeID:this.item.storeroom.id}}):this.item.type=="buy"?this.$router.push({name:"storeroom_new_ticket_buy",params:{doc:this.item.docBuy.code,storeID:this.item.storeroom.id}}):this.item.type=="rfbuy"?this.$router.push({name:"storeroom_new_ticket_rfbuy",params:{doc:this.item.docRfbuy.code,storeID:this.item.storeroom.id}}):this.item.type=="rfsell"&&this.$router.push({name:"storeroom_new_ticket_rfsell",params:{doc:this.item.docRfsell.code,storeID:this.item.storeroom.id}})}},beforeMount(){this.loadData()}}),V={class:"block block-content-full"},T={id:"fixed-header",class:"block-header block-header-default bg-gray-light pt-2 pb-1"},w={class:"block-title text-primary-dark"},D={class:"block-options"},F=["disabled"],E={class:"block-content pt-1 pb-3"},U={class:"row content"},R={class:"col-sm-12 col-md-12"},S={class:"row mt-4"},N={class:"col-sm-12 col-md-6 mt-2"},I={class:"form-control mb-2"},M={class:"col-sm-12 col-md-6 mt-2"},x={class:"form-check mt-3"},j={class:"form-check"},q={class:"form-check"},z={class:"form-check"},G={class:"form-check d-none"},H={class:"form-check d-none"},J={class:"col-sm-12 col-md-12 mt-2"},K={class:"rounded-2 border border-secondary bg-danger-light p-2"},L={class:"form-check mt-2 ms-3"},O=["disabled"];function P(u,e,Q,W,X,Y){const r=k("v-cob");return d(),v("div",V,[t("div",T,[t("h3",w,[t("button",{onClick:e[0]||(e[0]=s=>u.$router.back()),type:"button",class:"float-start d-none d-sm-none d-md-block btn btn-sm btn-link text-warning"},e[14]||(e[14]=[t("i",{class:"fa fw-bold fa-arrow-right"},null,-1)])),e[15]||(e[15]=t("i",{class:"fa fa-file-circle-plus"},null,-1)),e[16]||(e[16]=o(" حواله انبار جدید "))]),t("div",D,[t("button",{disabled:this.loading,onClick:e[1]||(e[1]=s=>u.submit()),type:"button",class:"btn btn-sm btn-alt-primary"},e[17]||(e[17]=[t("i",{class:"fa fa-save me-2"},null,-1),o(" ثبت ")]),8,F)])]),t("div",E,[t("div",U,[t("div",R,[e[32]||(e[32]=t("b",{class:"alert alert-light"},"نوع حواله انبار را انتخاب کنید ",-1)),t("div",S,[t("div",N,[t("div",I,[e[19]||(e[19]=t("label",{class:"form-label"},"انبار",-1)),g(r,{dir:"rtl",options:u.storerooms,label:"name",modelValue:u.item.storeroom,"onUpdate:modelValue":e[2]||(e[2]=s=>u.item.storeroom=s)},{"no-options":m(({search:s,searching:n,loading:f})=>e[18]||(e[18]=[o(" نتیجه‌ای یافت نشد! ")])),_:1},8,["options","modelValue"])])]),t("div",M,[e[26]||(e[26]=t("b",{class:"mb-3 pb-3"},"نوع حواله انبار",-1)),t("div",x,[i(t("input",{"onUpdate:modelValue":e[3]||(e[3]=s=>this.item.type=s),value:"sell",class:"form-check-input",type:"radio"},null,512),[[l,this.item.type]]),e[20]||(e[20]=t("label",{class:"form-check-label"}," حواله برای فاکتور فروش ",-1))]),t("div",j,[i(t("input",{"onUpdate:modelValue":e[4]||(e[4]=s=>this.item.type=s),value:"buy",class:"form-check-input",type:"radio"},null,512),[[l,this.item.type]]),e[21]||(e[21]=t("label",{class:"form-check-label"}," حواله برای فاکتور خرید ",-1))]),t("div",null,[t("div",q,[i(t("input",{"onUpdate:modelValue":e[5]||(e[5]=s=>this.item.type=s),value:"rfbuy",class:"form-check-input",type:"radio"},null,512),[[l,this.item.type]]),e[22]||(e[22]=t("label",{class:"form-check-label"}," حواله برای فاکتور برگشت از خرید ",-1))]),t("div",z,[i(t("input",{"onUpdate:modelValue":e[6]||(e[6]=s=>this.item.type=s),value:"rfsell",class:"form-check-input",type:"radio"},null,512),[[l,this.item.type]]),e[23]||(e[23]=t("label",{class:"form-check-label"}," حواله برای فاکتور برگشت از فروش ",-1))]),t("div",G,[i(t("input",{"onUpdate:modelValue":e[7]||(e[7]=s=>this.item.type=s),value:"wastage",class:"form-check-input",type:"radio"},null,512),[[l,this.item.type]]),e[24]||(e[24]=t("label",{class:"form-check-label"}," ضایعات ",-1))]),t("div",H,[i(t("input",{"onUpdate:modelValue":e[8]||(e[8]=s=>this.item.type=s),value:"used",class:"form-check-input",type:"radio"},null,512),[[l,this.item.type]]),e[25]||(e[25]=t("label",{class:"form-check-label"}," مصرف مستقیم ",-1))])])]),t("div",J,[t("div",K,[t("span",null,"فاکتور "+A(u.item.title),1),this.item.type=="buy"?(d(),p(r,{key:0,dir:"rtl",options:u.buys,label:"des",modelValue:u.item.docBuy,"onUpdate:modelValue":e[9]||(e[9]=s=>u.item.docBuy=s),class:"bg-white"},{"no-options":m(({search:s,searching:n,loading:f})=>e[27]||(e[27]=[o(" نتیجه‌ای یافت نشد! ")])),_:1},8,["options","modelValue"])):b("",!0),this.item.type=="sell"?(d(),p(r,{key:1,dir:"rtl",options:u.sells,label:"des",modelValue:u.item.docSell,"onUpdate:modelValue":e[10]||(e[10]=s=>u.item.docSell=s),class:"bg-white"},{"no-options":m(({search:s,searching:n,loading:f})=>e[28]||(e[28]=[o(" نتیجه‌ای یافت نشد! ")])),_:1},8,["options","modelValue"])):b("",!0),this.item.type=="rfsell"?(d(),p(r,{key:2,dir:"rtl",options:u.rfsells,label:"des",modelValue:u.item.docRfsell,"onUpdate:modelValue":e[11]||(e[11]=s=>u.item.docRfsell=s),class:"bg-white"},{"no-options":m(({search:s,searching:n,loading:f})=>e[29]||(e[29]=[o(" نتیجه‌ای یافت نشد! ")])),_:1},8,["options","modelValue"])):b("",!0),this.item.type=="rfbuy"?(d(),p(r,{key:3,dir:"rtl",options:u.rfbuys,label:"des",modelValue:u.item.docRfbuy,"onUpdate:modelValue":e[12]||(e[12]=s=>u.item.docRfbuy=s),class:"bg-white"},{"no-options":m(({search:s,searching:n,loading:f})=>e[30]||(e[30]=[o(" نتیجه‌ای یافت نشد! ")])),_:1},8,["options","modelValue"])):b("",!0),t("div",L,[i(t("input",{disabled:!u.item.removeBeforeTicketsEnable,"onUpdate:modelValue":e[13]||(e[13]=s=>this.item.removeBeforeTickets=s),class:"form-check-input",type:"checkbox"},null,8,O),[[B,this.item.removeBeforeTickets]]),e[31]||(e[31]=t("label",{class:"form-check-label"}," حذف حواله‌های انباری که قبلا برای این فاکتور صادر شده است. ",-1))])])])])])])])])}const ee=c($,[["render",P]]);export{ee as default};