2 lines
22 KiB
JavaScript
2 lines
22 KiB
JavaScript
|
import{a as r,c as h,S as g,_ as G}from"./main-9b36f05f.js";import{r as $,_ as S,a as D,b as V,c as L}from"./robika-0d07fc15.js";import{r as U}from"./recList-3e892c5b.js";import{A as N}from"./archiveUpload-31fb560b.js";import{n as O}from"./notes-77134a25.js";import{h as T,r as B,a as p,o as l,s as n,e as t,u as i,au as R,ao as m,d,c as P,A as v,t as e,b as c,B as C,ar as A,ab as a,w as b,F as k,C as W}from"./vendor-adef9cb4.js";const j=T({name:"viewInvoice",components:{ArchiveUpload:N,rec:$,recList:U,notes:O},watch:{"PayWindowsState.submited"(o,s){this.PayWindowsState.submited=!1,o&&(this.loadData(),this.recModal.hide())},"recListWindowsState.submited"(o,s){this.recListWindowsState.submited=!1,o&&this.loadData()}},data:()=>({printOptions:{pays:!0,note:!0,bidInfo:!0,taxInfo:!0,discountInfo:!0,paper:"A4-L"},notes:{count:0},PayWindowsState:{submited:!1},recListWindowsState:{submited:!1},recModal:{},recListModal:{},loading:B(!0),shortlink_url:"",copy_label:"کپی",send_message_label:"ارسال",bid:{legal_name:""},item:{doc:{id:0,date:null,code:null,des:"",amount:0,profit:0},relatedDocs:[],rows:[]},person:{nikename:null,mobile:""},commoditys:[],totalRec:0,totalDiscount:0,totalTax:0,transferCost:0,discountAll:0,mobileHeaders:[{text:"کالا",value:"commodity.name"},{text:"تعداد",value:"count"},{text:"مبلغ کل",value:"sumTotal"}]}),setup(){},methods:{copyToCliboard(){navigator.clipboard.writeText(this.shortlink_url),this.copy_label="کپی شد !"},loadData(){this.loading=!0,this.commoditys=[],r.post("/api/accounting/doc/get",{code:this.$route.params.id}).then(o=>{this.item=o.data,this.item.doc.shortlink!=null?this.shortlink_url=h()+"/sl/sell/"+localStorage.getItem("activeBid")+"/"+this.item.doc.shortlink:this.shortlink_url=h()+"/sl/sell/"+localStorage.getItem("activeBid")+"/"+this.item.doc.id,o.data.relatedDocs.forEach(s=>{this.totalRec+=parseInt(s.amount)})}),r.post("/api/sell/get/info/"+this.$route.params.id).then(o=>{this.person=o.data.person,this.discountAll=o.data.discountAll,this.transferCost=o.data.transferCost,this.item.doc.profit=o.data.profit,o.data.rows.forEach(s=>{s.commodity!=null&&(this.totalTax+=parseInt(s.tax),this.totalDiscount+=parseInt(s.discount),this.commoditys.push({commodity:s.commodity,count:s.commodity_count,price:parseInt((parseInt(s.bs)-parseInt(s.tax)+parseInt(s.discount))/parseFloat(s.commodity_count)),bs:s.bs,bd:s.bd,id:s.commodity.id,des:s.des,discount:s.discount,tax:s.tax,sumWithoutTax:s.bs-s.tax,sumTotal:s.bs,table:53}))})}),r.post("/api/business/get/info/"+localStorage.getItem("activeBid")).then(o=>{this.bid=o.data,this.loading=!1}),r.post("/api/printers/options/info").then(o=>{this.isLoading=!1,this.printOptions=o.data.sell})},sendSMS(){this.loading=!0,new RegExp("^(\\+98|0)?9\\d{9}$").test(this.person.mobile)?(this.send_message_label="در حال ارسال...",r.post("/api/sms/send/sell-invoice/"+this.item.doc.id+"/"+this.person.mobile).then(s=>{s.data.result==2?(g.fire({text:"اعتبار سرویس پیامک کافی نیست.",icon:"error",confirmButtonText:"قبول"}),this.send_message_label="ارسال"):s.data.result==1&&(g.fire({text:"پیامک اطلاع رسانی ارسال شد.",icon:"success",confirmButtonText:"قبول"}),this.send_message_label="ارسال شد!"),this.loading=!1})):(g.fire({text:"شماره موبایل وارد شده نا معتبر است.",icon:"error",confirmButtonText:"قبول"}),this.loading=!1)},printInvoice(o=!0,s=!0){r.post("/api/sell/print/invoice",{code:this.$route.params.id,pdf:o,printers:s,printOptions:this.printOptions}).then(y=>{this.printID=y.data.id,window.open(this.$API_URL+"/front/print/"+this.printID,"_blank","noreferrer")})}},mounted(){this.loadData(),this.recModal=new bootstrap.Modal(document.getElementById("rec-modal")),this.recListModal=new bootstrap.Modal(document.getElementById("rec-list-modal"))}});const H={class:"modal fade",id:"printModal","data-bs-backdrop":"static","data-bs-keyboard":"false",tabindex:"-1","aria-labelledby":"printModalLabel","aria-hidden":"true"},q={class:"modal-dialog"},J={class:"modal-conte
|