File: /var/www/html/public/static/js/hookInvoice-legacy-db40bdd4.js
System.register(["./po-legacy-3a05f0ff.js","./fabric-legacy-b65491d9.js","./vue-router-legacy-a12307c3.js","./message-legacy-10af7c73.js","./index-legacy-42c17c53.js","./runtime-core.esm-bundler-legacy-c5df00b7.js","./index-legacy-dd4862fc.js","./preload-helper-legacy-f8638e03.js","./vue-i18n.runtime.esm-bundler-legacy-720876b1.js","./index-legacy-c9e20962.js","./_commonjsHelpers-legacy-5498c249.js","./utils-legacy-c0023c33.js","./focus-trap-legacy-631b7396.js","./error-legacy-e98f9e58.js"],(function(e,i){"use strict";var t,a,n,c,o,s,r,l,u,d,_,m,g,v,p,h,f,b,y,w,C,I,D,x,A,k,N,S,j;return{setters:[e=>{t=e.InvoiceListWeb,a=e.yuyueFDF,n=e.newInvoiceWeb,c=e.invoicePdfWeb,o=e.sendEmailWeb,s=e.base64image,r=e.invoiceDetailWeb,l=e.getLicenceServiceWeb,u=e.invoicePaymentWeb,d=e.prePaidWeb,_=e.AccountListWeb,m=e.updateShowNumber,g=e.getClinicsListByTherapistWeb,v=e.setInvoicePaidWeb,p=e.getNoInvoiceBookingsDateWeb,h=e.InvoiceExportWeb,f=e.NeedPaymentInvoiceListWeb,b=e.ServiceCombinaByServiceNameWeb,y=e.getInvoiceNumberWeb,w=e.deleteInvoiceWeb,C=e.getCheckMembersWeb},e=>{I=e.f},e=>{D=e.d,x=e.u},e=>{A=e.b7},e=>{k=e.o},e=>{N=e.r,S=e.A,j=e.o},null,null,null,null,null,null,null,null],execute:function(){e("useEqu",(function(e){const{query:i,params:P}=D(),E=x();D();const L=N({}),W=N(""),T=N(!1),F=N(!1),O=N(!1),B=N(!1),M=N(null),q=N(""),V=N(""),Y=N(""),R=N(""),H=N([]),K=N([]),z=N("");let U=null;const $=N(""),G=N(!1),X=N(!1),Q=N(!1),J=N(!1),Z=N(!1),ee=N(!1),ie=N(!1),te=N(!1),ae=N(!1),ne=N(!1),ce=N(""),oe=N(1),se=N(""),re=N([]),le=N([]),ue=N([]),de=N([]),_e=N([]),me=N([]),ge=N([]),ve=N([]),pe=N([]),he=N(!1),fe=N(!1),be=S({}),ye=S({}),we=S({}),Ce=S({}),Ie=S({}),De=S({}),xe=S({}),Ae=S({}),ke=S({}),Ne=S({}),Se=S({}),je=S({}),Pe=S({}),Ee=S({}),Le=S({}),We=S({}),Te=S({}),Fe=S({}),Oe=S({}),Be=S({}),Me=S({signal_url:"",form_type:"",note_id:"",service:"",service_id:""}),qe=S({Invoice_Charge_Number:"",Customer_Name:"",Invoice_Total_Charge:"",Has_Paid_Amount:"",Need_Charge_Amount:"",Total_Paid_Amount:"",customer_id:"",customer_name:"",invoice_id:""}),Ve=S({service_id:"",invoice_type:"normal",loacation_id:"",loacation_name:"",Client_name:"",Client_id:"",date:"",description_type:"",description_type1:"",Invoice_Number:"",hstValue:0,total:0,include_tax:"N",is_tax:"Y",is_tax1:!0,r_ac_name:"",r_ac_register:"",name1:"",rmt_register:"",signal_image:"",signal_desc:"",receive:"",invoice_due_date:"",customArr:"",fileName:"",email_content:"",file_path:"",is_web:1,name:"",licence_number:"",licence_name:"",licence_title:"",description:"",amount1:"",booking_order_no:"",bookingorder_id:"",Invoice_Charge_Number:"",Customer_Name:"",Invoice_Total_Charge:"",Has_Paid_Amount:"",Need_Charge_Amount:"",chapter_image:"",is_use_chapter:"",is_Match:-1,is_Match_id:"",today:"",files:[],files1:[],fileView:[]}),Ye=S({name:"",id:""}),Re=S({name:"",id:"",r_ac_name:"",r_ac_register:"",name1:"",rmt_register:""}),He=S({name:"",customer_id:"",pay_amount:"",pay_method:"",cheque_number:"",content:"",invoice_id:"",account_id:"",time:"",other:""}),Ke=N([{value:"normal",text:"Normal"},{value:"outside",text:"Outside"},{value:"third_Pay",text:"Third Pay"},{value:"gift",text:"Gift"}]),ze=N([{value:"Y",text:"Y"},{value:"N",text:"N"}]),Ue=N([{id:1,price:0,spend_time:"",treatment_date:"",booking_order_no:"",booking_id:""}]),$e=N([{id:1,text:"Paypal",value:"Paypal"},{id:2,text:"VISA",value:"VISA"},{id:3,text:"MasterCard",value:"MasterCard"},{id:4,text:"AMERICAN_EXPRESS",value:"AMERICAN_EXPRESS"},{id:5,text:"Cheque",value:"Cheque"},{id:6,text:"BankTransfer",value:"BankTransfer"},{id:7,text:"Cash",value:"Cash"},{id:8,text:"Other",value:"Other"}]),Ge=N([{value:"Massage",text:"Massage"},{value:"Acupuncture",text:"Acupuncture"}]);S({destination_comp:"",state:"",city:"",address:"",phone:"",contact:"",customer_id:""});const Xe=S({}),Qe=S({qo_item_str:"",name:"",address:"",way:"",shipping:[],itemsDetail:[],trackingNo:"",courier:"",comment:""}),Je=S({total:0,pageSize:10,currentPage:1,background:!0,pageSizes:[10,25,50,100]}),Ze=S({order_key:"",material_key:"",truck_key:"",truck_id:"",comment:"",show:"",searchKey:"",date:"",amountBegin:"",amountEnd:"",show_number:!0,clinic_id:"",therapists_id:"",is_batch_invoice:"",invoice_id_list:[],sub_amount:"",sub_pay_amount:"",export:"N"});async function ei(i){Ze.export="N","Y"==i&&(Ze.export=i),$.value=localStorage.getItem("type");let n="";1==$.value&&(n="therapists"),G.value=!0;const{data:c}=await t(Object.assign(be,{searchKey:Ze.searchKey,amountBegin:Ze.amountBegin,amountEnd:Ze.amountEnd,invoiceDate:Ze.date,clinic_id:Ze.clinic_id,therapists_id:Ze.therapists_id,role:n,options:W,customer_id:e.customer_id,pageSize:Je.pageSize,page:Je.currentPage,export:Ze.export}));1==c.code?(G.value=!1,"N"==Ze.export?(re.value=c.data,Ze.show_number=c.config.show_number,Ze.is_batch_invoice=c.is_batch_invoice,Je.total=c.total,Ze.sub_amount=c.sub_amount,Ze.sub_pay_amount=c.sub_pay_amount):(A({type:"success",message:"Export Success"}),window.open(a+c.first_name.replace("var/www/html/public","")))):G.value=!1}function ii(){Ue.value=[];const i={id:Ue.value.length+1,price:0,spend_time:"",treatment_date:Ve.today,booking_order_no:"",booking_id:""};Ve.date=Ve.today,Ue.value.push(i),li(1),e.customer_id&&(Ve.Client_name=e.customer_name,Ve.Client_id=e.customer_id),Ve.files=[],Ve.files1=[],Z.value=!0}async function ti(e,i){Ve.Invoice_Number="",G.value=!0;let t=e.service_id;1==i&&(t=e.id);const{data:a}=await y(Object.assign(ye,{clinic_id:"",service_id:t,invoice_date:Ve.date}));1==a.code&&(1==i?K.value.forEach(((i,t)=>{e.service_name==i.service_name&&(i.invoice_number=a.invoice_number)})):e.invoice_number=a.invoice_number),G.value=!1}function ai(e){const i=Ue.value.findIndex((i=>i.id===e.id));-1!==i&&Ue.value.splice(i,1),Ue.value.forEach(((e,i)=>{e.id=i+1})),ci()}function ni(e,i){Ve.is_tax=e?"Y":"N",ci(i)}function ci(e){let i=0;e.service_detail.forEach(((e,t)=>{""!=e.price&&(i=parseFloat(i)+parseFloat(e.price))})),e.is_tax?"N"==e.include_tax?(e.hstValue=Math.round(.13*parseFloat(i)*100)/100,e.total=Math.round(1.13*parseFloat(i)*100)/100):"Y"==e.include_tax&&(e.hstValue=Math.round(parseFloat(i)/1.13*.13*100)/100,e.total=Math.round(100*parseFloat(i))/100):(e.hstValue=0,e.total=Math.round(100*parseFloat(i))/100)}async function oi(e){const{data:i}=await w(Object.assign(we,{invoice_id:e.id}));1==i.code&&(ei(),A({type:"success",message:i.msg}))}function si(){U.renderAll()}async function ri(e){const{data:i}=await s(Object.assign(xe,{note_id:"",signal_url:"signal_url1",form_type:"invoice",base64code:q.value,yuyueFDF:a}));1==i.code&&(Ve.signal_image=i.file_path,Q.value=!1)}async function li(e){const{data:i}=await l(Object.assign(ke,{customer_id:Ve.Client_id,is_licence:!1}));1==i.code?(me.value=i.data,me.value.length>0&&1==e&&(Ve.description_type=me.value[0].value,vi(Ve.description_type),Ve.service_id=me.value[0].id,pe.value=me.value[0].during_price_json),ve.value=me.value):A({type:"error",message:i.msg})}async function ui(){const{data:e}=await C(Object.assign(Ne,{customer_id:He.customer_id}));if(1==e.code){_e.value=e.data;let i=Ve.Need_Charge_Amount;_e.value.forEach(((e,t)=>{const a=Math.min(e.remain_amount,i);a>0&&(e.paid_amount=a,i=parseFloat((i-a).toFixed(2)))})),ie.value=!0}else A({type:"error",message:e.msg})}function di(){const e=new Date,i=e.getFullYear(),t=("0"+(e.getMonth()+1)).slice(-2),a=("0"+e.getDate()).slice(-2);He.time=i+"-"+t+"-"+a}async function _i(){const{data:e}=await _(Object.assign(We,{clinic_id:"",role:"therapists",searchKey:""}));1==e.code&&(ue.value=e.data)}function mi(){E.push({path:"/crm/yuyue/licence",query:{invoceService:1}})}function gi(e){const i={Invoice_Charge_Number:e.invoice_id_arr,Customer_Name:"",Invoice_Total_Charge:"",Has_Paid_Amount:"",Need_Charge_Amount:"",Total_Paid_Amount:e.need_amount_sum,invoice_id:"",customer_id:e.customer_id,customer_name:e.customer_name};oe.value=6,qe.value=i,F.value=!0}async function vi(e){let i="";me.value.forEach(((t,a)=>{t.value==e&&(i=t.id,Ve.signal_desc=t.sinal_desc_arr,Ve.signal_image=t.sinal_image_arr)}));const{data:t}=await b(Object.assign(Be,{role:"therapists",clinic_id:"",service_id:i,service_name:e,customer_id:Ve.Client_id}));1==t.code?(K.value=t.data,K.value.forEach(((e,i)=>{e.service_detail.forEach(((e,i)=>{e.treatment_date=e.treatment_date.substring(0,10)})),ni(e.is_tax,e),ti(e)}))):A({type:"error",message:t.msg}),B.value=!1}function pi(e){const i=K.value.findIndex((i=>i.service_name===e.service_name));-1!==i&&K.value.splice(i,1)}return j((()=>{U=new I.fabric.Canvas(M.value,{isDrawingMode:!0}),function(){const e=new Date,t=e.getFullYear(),a=("0"+(e.getMonth()+1)).slice(-2),n=("0"+e.getDate()).slice(-2);Ve.date=t+"-"+a+"-"+n,Ue.value[0].treatment_date=t+"-"+a+"-"+n,Ve.invoice_due_date=t+"-"+a+"-"+n,Ve.today=t+"-"+a+"-"+n,1==i.help&&ii()}(),$.value=localStorage.getItem("type"),async function(){G.value=!0;const{data:e}=await g(Object.assign(Ee,{searchKey:"",is_therapistInvoice:"Y"}));1==e.code&&(de.value=e.data),G.value=!1}()})),{searchDetail:Ze,btnSearchPart:function(){ei()},loading:G,small:ne,selectList:["勾选列","Invoice #","Files","Customer Name","Invoice Date","Total ($)","Paid Amount $","Split Rate","Split Amount","Withdraw Amount","Service Name","Location","Booking #","PAID IN FULL","Origin","Action"],columns:[{type:"selection",width:55,align:"left",hide:({checkList:e})=>!e.includes("勾选列")},{label:"序号列",type:"index",width:70,align:"left",hide:({checkList:e})=>!e.includes("序号列")},{label:"Invoice #",prop:"invoice_number",minWidth:120,align:"left",hide:({checkList:e})=>!e.includes("Invoice #")},{label:"Files",prop:"file",minWidth:50,slot:"files",hide:({checkList:e})=>!e.includes("Files")},{label:"Customer Name",slot:"Customer",minWidth:100,align:"left",hide:({checkList:e})=>!e.includes("Customer Name")},{label:"Invoice Date",prop:"invoice_date_standard",minWidth:92,hide:({checkList:e})=>!e.includes("Invoice Date")},{label:"Total ($)",prop:"total_amount",minWidth:85,align:"right",hide:({checkList:e})=>!e.includes("Total ($)")},{label:"Paid Amount $",prop:"pay_amount",minWidth:105,align:"right",hide:({checkList:e})=>!e.includes("Paid Amount $")},{label:"Service Name",prop:"description_type",minWidth:100,align:"left",hide:({checkList:e})=>!e.includes("Service Name")},{label:"Location",prop:"company_comp_name",minWidth:100,align:"left",hide:({checkList:e})=>!e.includes("Location")},{label:"Booking #",prop:"customer_product_code",minWidth:90,slot:"Booking",align:"left",hide:({checkList:e})=>!e.includes("Booking #")},{label:"PAID IN FULL",prop:"IsPaid",minWidth:100,slot:"IsPaid",hide:({checkList:e})=>!e.includes("PAID IN FULL")},{label:"Split Rate",prop:"split_rate",minWidth:80,align:"right",hide:({checkList:e})=>!e.includes("Split Rate")},{label:"Split Amount",prop:"split_amount",minWidth:100,align:"right",hide:({checkList:e})=>!e.includes("Split Amount")},{label:"Withdraw Amount",prop:"has_withdraw_amount",minWidth:100,align:"right",hide:({checkList:e})=>!e.includes("Withdraw Amount")},{label:"Origin",prop:"clinic_name",slot:"Origin",minWidth:100,align:"left",hide:({checkList:e})=>!e.includes("Origin")},{label:"Action",fixed:"right",width:200,slot:"operation",align:"left",hide:({checkList:e})=>!e.includes("Action")}],pagination:Je,handleSizeChange:function(e){Je.pageSize=e,ei()},handleCurrentChange:function(e){Je.currentPage=e,ei()},PartList:re,order_date:ce,deliverDialog:Z,selectClick:function(e){Ze.invoice_id_list=[],e.forEach(((e,i)=>{Ze.invoice_id_list.push(e.id)}))},deliverDataArr:Qe,btnDeliverConfirm:async function(){G.value=!0;let e="";e="outside"==Ve.invoice_type?Ve.description_type1:Ve.description_type;const{data:i}=await n(Object.assign(Xe,{customer_id:Ve.Client_id,company_id:Ve.loacation_id,invoice_type:Ve.invoice_type,invoice_date:Ve.date,invoice_due_date:Ve.invoice_due_date,is_tax:Ve.is_tax,description_type:e,signal_image:Ve.signal_image,items:Ue,include_tax:Ve.include_tax,receive_message:Ve.receive,note_id:"",signal_desc:Ve.signal_desc,origin:"new",files:Ve.files,combina_service_arr:K.value}));1==i.code?(ei(),Z.value=!1,A({type:"success",message:i.msg}),G.value=!1):(A({type:"error",message:i.msg}),G.value=!1)},getBooking:function(e){return e.assocInfo.booking.length>0?e.assocInfo.booking[0].booking_order_no:""},getNote:function(e){return e.assocInfo.note.length>0?e.assocInfo.note[0].id:""},addForm:Ve,InvoiceType:Ke,btnAdd:ii,descriptionData:Ge,items:Ue,during_price_array:pe,AddItem:function(e){const i={booking_id:"",booking_no:"",during_price_json:e.service_detail[0].during_price_json,id:e.service_detail.length+1,price:e.service_detail[e.service_detail.length-1].price,spend_time:e.service_detail[e.service_detail.length-1].spend_time,treatment_date:e.service_detail[0].treatment_date};e.service_detail.push(i),ci(e)},onDelete:e=>{k.confirm("Are you sure you want to delete this item ?",{confirmButtonText:"confirm",cancelButtonText:"cancel",type:"warning"}).then((()=>{ai(e)})).catch((()=>{A({type:"info",message:"Canceled"})}))},taxData:ze,onIs_tax:ni,IncludeTax:function(e,i){ci(i)},duringPrice:function(e,i,t){t.spend_time=e,t.during_price_json.forEach(((i,a)=>{i.value==e&&(t.price=i.price)})),ci(i)},onSelectLocation:function(){he.value=!0},locationDialog:he,ClientDialog:fe,eventIsNumlocation:function(){Ve.loacation_name=Re.name,Ve.loacation_id=Re.id,Ve.r_ac_name=Re.r_ac_name,Ve.r_ac_register=Re.r_ac_register,Ve.name1=Re.name1,Ve.rmt_register=Re.rmt_register},eventIsNum:function(){Ve.Client_id=Ye.id,Ve.Client_name=Ye.name,vi(Ve.description_type)},onSelClient:function(){fe.value=!0},ClientData:Ye,locationData:Re,btnDelInvoice:e=>{k.confirm("Are you sure you want to delete this item ?",{confirmButtonText:"confirm",cancelButtonText:"cancel",type:"warning"}).then((()=>{oi(e)})).catch((()=>{A({type:"info",message:"Canceled"})}))},sandEmailDialog:ae,btnSendEmail:async function(e){Ve.customArr=e;const{data:i}=await c(Object.assign(Ce,{invoice_id:e.id}));1==i.code&&(ae.value=!0,Ve.fileName=i.file_path.replace("/var/www/html/public/pdf/",""),Ve.file_path=i.file_path,Ve.email_content=i.data.config.emailconfig.email_content)},onSend:async function(){const{data:e}=await o(Object.assign(Ie,{invoice_id:Ve.customArr.id,file_path:Ve.file_path,emailContent:Ve.email_content,show_number:Ze.show_number}));1==e.code&&(A({type:"success",message:e.msg}),ae.value=!1)},btnPrintPDF:async function(e){const{data:i}=await c(Object.assign(De,{invoice_id:e.id,show_number:Ze.show_number}));1==i.code?window.open(a+i.file_path.replace("var/www/html/public","")):A({type:"error",message:i.msg})},onPrice:ci,openAutograph:function(){Me.signal_url="signal_url1",Me.form_type="invoice",Me.note_id="",Me.service=Ve.description_type,Me.service_id=Ve.service_id,Q.value=!0},signatureCanvas:M,signatureDataUrl:q,saveSignature:()=>{si(),q.value=U.toDataURL({format:"png"}),ri()},clearSignature:function(){U.clear(),q.value=""},autographDialog:Q,signalData:Me,eventSignal:function(){let e="";li(2),Ve.signal_image=V.value,Ve.signal_image&&(e=Ve.signal_image.replace(a+"/images/","").substring(0,6),Ve.is_web="fabric"==e?2:1)},handleValueFromChild:e=>{Ve.signal_image=e},signalUrl:V,InvoiceDetailDialog:J,btnDetail:async function(e){ge.value=[],Y.value="",R.value="",z.value="",Ve.chapter_image="",Ve.is_use_chapter="",se.value="",Ve.fileView=e.file;let i="";J.value=!0,Ve.customArr=e;const{data:t}=await r(Object.assign(Ae,{invoice_id:e.id}));1==t.code&&(ge.value=t.data[0].detail,Y.value=t.data[0].company_info,R.value=t.data[0].info,z.value=t.data[0].customer_info,Ve.chapter_image=t.data[0].config.chapter_image,Ve.is_use_chapter=t.data[0].config.is_use_chapter,t.data[0].info.signal_image&&(i=t.data[0].info.signal_image.replace(a+"/images/","").substring(0,6),Ve.is_web="fabric"==i?2:1),se.value=t.data[0].licence,J.value=!0)},detailInfo:ge,company_info:Y,info:R,type:$,customer_info:z,addServiceData:me,changeServic:function(e){ve.value.forEach(((i,t)=>{i.service_name==e&&(Ve.licence_number=i.licence_number,Ve.licence_name=i.licence_name,Ve.name=i.name,Ve.description=i.description,Ve.licence_title=i.licence_title,pe.value=i.during_price_json,Ve.signal_desc=i.sinal_desc_arr,Ve.signal_image=i.sinal_image_arr,Ve.service_id=i.id,ti())}));let i="",t="";pe.value.forEach(((e,a)=>{e.default&&(i=e.duration,t=e.price)})),Ue.value.forEach(((e,a)=>{e.spend_time=i,e.price=t})),(""==i||""==t)&&Ue.value.forEach(((e,i)=>{e.spend_time=0,e.price=0})),ci()},licenceDetail:se,CollectionDialog:ie,btnCollection:function(e){const i={Invoice_Charge_Number:e.invoice_number,Customer_Name:e.customer_first_name?e.customer_first_name+e.customer_last_name:e.customer_show,Invoice_Total_Charge:e.total_amount,Has_Paid_Amount:e.pay_amount,Need_Charge_Amount:e.need_charge_amount,Total_Paid_Amount:"",customer_id:e.customer_id,customer_name:e.customer_first_name?e.customer_first_name+e.customer_last_name:e.customer_show,invoice_id:e.id};return oe.value=1,qe.value=i,void(F.value=!0)},CollectionData:_e,bookingPaymentConfirm:async function(){const{data:e}=await u(Object.assign(Se,{invoice_id:He.invoice_id,pay_amount_details:_e.value}));1==e.code?(ei(),ie.value=!1):A({type:"error",message:e.msg})},addCollectionDialog:te,AddCollect:function(){di(),_i(),te.value=!0},collectionArr:He,btncollectionConfirm:async function(){if(G.value=!0,"Cheque"!=He.pay_method&&(He.cheque_number=""),"Cheque"==He.pay_method&&""==He.cheque_number)return A({type:"error",message:"Please enter cheque number"}),void(G.value=!1);let e="";if("Other"==He.pay_method){if(""==He.other)return A({type:"error",message:"Please enter pay method"}),void(G.value=!1);e=He.other}else e=He.pay_method;const{data:i}=await d(Object.assign(je,{customer_id:He.customer_id,pay_amount:He.pay_amount,pay_method:e,cheque_number:He.cheque_number,content:He.content,collection_time:He.time,account_id:He.account_id}));1==i.code?(ui(),A({type:"success",message:i.msg}),te.value=!1,G.value=!1):(A({type:"error",message:i.msg}),G.value=!1)},btnShowNumber:async function(e){const{data:i}=await m(Object.assign(Pe,{show_number:Ze.show_number}));A({type:"success",message:i.msg})},disabledBeforeToday:function(e){const i=new Date;return i.setHours(0,0,0,0),e.getTime()>i.getTime()},onSearch:function(){ei()},clinicData:de,onClinicData:function(e){null==e&&(Ze.clinic_id="")},btnIsPaid:async function(e,i){const{data:t}=await v(Object.assign(Le,{invoice_id:i.id,is_paid:e}));1==t.code&&ei(),A({type:"success",message:t.msg})},btnGuide:function(){E.push({path:"/crm/yuyue/licence",query:{invoceGuide:1}})},btnService:()=>{k.confirm("Invoicing requires services with licence",{confirmButtonText:"Go add",cancelButtonText:"cancel",type:"warning"}).then((()=>{mi()})).catch((()=>{A({type:"info",message:"Canceled"})}))},payMethodData:$e,AccountData:ue,isShowFilter:T,btnFilterQuery:function(){T.value=!T.value},optionsFilter:L,eventFilter:function(){L.value&&(W.value=L.value.value,ei())},getNoInvoiceBookings:async function(e,i){Ve.is_Match=-1,Ve.is_Match_id=e.id;const{data:t}=await p(Object.assign(Te,{customer_id:Ve.Client_id,date:i.treatment_date?i.treatment_date.substring(0,10):"",itemData:e.service_detail,service_name:e.service_name,clinic_id:"",therapist_id:"",company_id:Ve.loacation_id}));1==t.code?t.data.length>0?(le.value=t.data,ee.value=!0):A({type:"info",message:"There are no matching Booking available"}):A({type:"error",message:t.msg})},MatchData:le,MatchDialog:ee,selectedTr:function(e,i){K.value.forEach(((i,t)=>{i.service_detail.forEach(((i,t)=>{i.booking_order_no=e.booking_order_no,i.booking_id=e.booking_id,i.spend_time=Number(e.duration),i.price=e.amount}))})),ee.value=!1},btnMatchConfirm:function(){},onSelectItemDate:function(e){const i=[];Ue.value.forEach(((e,t)=>{i.push(new Date(e.treatment_date).getTime())}));const t=Math.max(...i);Ue.value.forEach(((e,i)=>{t==new Date(e.treatment_date).getTime()&&t>new Date(Ve.date).getTime()&&(Ve.date=e.treatment_date)}))},btnExport:async function(){O.value=!0;const{data:i}=await h(Object.assign(Fe,{searchKey:Ze.searchKey,clinic_id:Ze.clinic_id,therapists_id:Ze.therapists_id,role:"therapists",options:W,customer_id:e.customer_id}));1==i.code?(O.value=!1,A({type:"success",message:i.msg}),window.open(a+i.file_path.replace("var/www/html/public",""))):O.value=!1},loading1:O,btnAddCharge:function(){const i={Invoice_Charge_Number:"",Customer_Name:"",Invoice_Total_Charge:"",Has_Paid_Amount:"",Need_Charge_Amount:"",Total_Paid_Amount:"",invoice_id:"",customer_id:e.customer_id,customer_name:e.customer_name};oe.value=2,qe.value=i,F.value=!0},ChargeDialog:F,ChargeArr:qe,eventCharge:function(){ei()},str1:oe,btnBatchPayment:async function(){Ve.Invoice_Number="",B.value=!0;const{data:e}=await f(Object.assign(Oe,{invoice_id_list:Ze.invoice_id_list}));1==e.code?gi(e.data):A({type:"error",message:e.msg}),B.value=!1},loading2:B,uploadSlotFile1:function(e,i,t){1==e.code?(Ve.files.push(a+e.data.file_path.replace("var/www/html/public/","")),Ve.files1.push(e.data.file_name)):A({type:"error",message:e.data.msg})},btnFile:function(e){e.length&&(H.value=e,X.value=!0)},onFile:function(e){window.open(e)},fileDialog:X,fileArr:H,ServiceInvoice:K,changeServiceCombina:vi,onDeleteService:e=>{k.confirm("Are you sure you want to delete this item ?",{confirmButtonText:"confirm",cancelButtonText:"cancel",type:"warning"}).then((()=>{pi(e)})).catch((()=>{A({type:"info",message:"Canceled"})}))},changeServiceItem:function(e,i){let t=1;me.value.forEach(((a,n)=>{e==a.service_name&&(ti(a,1),i.licence_name=a.licence_name,i.licence_description=a.description,i.licence_title=a.licence_title,i.licence_number=a.licence_number,a.during_price_json.length>0?a.during_price_json.forEach(((e,n)=>{e.default?(t=2,i.service_detail.forEach(((i,t)=>{i.price=e.price,i.spend_time=e.duration})),ci(i)):1==t&&(i.service_detail.forEach(((e,i)=>{e.price=a.during_price_json[0].price,e.spend_time=a.during_price_json[0].duration})),ci(i))})):(i.service_detail.forEach(((e,i)=>{e.price=0,e.spend_time=0})),ci(i)))}))},onDeleteI:function(e,i){const t=e.service_detail.findIndex((e=>e.id===i.id));-1!==t&&e.service_detail.splice(t,1),e.service_detail.forEach(((e,i)=>{e.id=i+1})),ci(e)},loadPartList:ei,invoiceDate:function(e){K.value.forEach(((e,i)=>{ti(e)}))}}}))}}}));