File: /var/www/html/public/static/js/hookInvoice2-05941c28.js
import{InvoiceListWeb as ht,yuyueFDF as y,newInvoiceWeb as vt,invoicePdfWeb as ve,sendEmailWeb as bt,base64image as yt,invoiceDetailWeb as wt,getLicenceServiceWeb as Ct,invoicePaymentWeb as At,prePaidWeb as It,AccountListWeb as xt,updateShowNumber as Dt,getManagerClinicsListWeb as St,getManageTherapistWeb as Nt,setInvoicePaidWeb as Tt,getNoInvoiceBookingsDateWeb as Pt,InvoiceExportWeb as Et,NeedPaymentInvoiceListWeb as Wt,ServiceCombinaByServiceNameWeb as kt,getInvoiceNumberWeb as jt,deleteInvoiceWeb as Ot,getCheckMembersWeb as Ft,saveDefaultTaxWeb as Mt}from"./po-53124e2d.js";import{f as Bt}from"./fabric-bb3851e7.js";import{d as be,u as Lt}from"./vue-router-a383d220.js";import{b7 as r}from"./message-2472a54a.js";import{o as D}from"./index-81e4a901.js";import{r as o,A as s,o as qt}from"./runtime-core.esm-bundler-6128546f.js";import"./index-912f0f0b.js";import"./preload-helper-78dc9057.js";import"./vue-i18n.runtime.esm-bundler-6949bcab.js";import"./index-b7f916e1.js";import"./_commonjsHelpers-87174ba5.js";import"./utils-2ab4f76a.js";import"./focus-trap-53f1c6ab.js";import"./error-78e43d3e.js";function ta(h){const{query:ye,params:Vt}=be(),we=Lt();be();const p=o([]),ie=o(null),S=o(""),N=o(1),te=o(""),F=o({}),M=o(""),B=o(""),L=o(""),q=o("");let T=null;const ae=o(""),_=o(!1),A=o(!1),P=o(!1),ne=o(!1),E=o(!1),V=o(!1),R=o(!1),Y=o(!1),z=o(!1),H=o(!1),K=o(!1),U=o(!1),$=o(!1),Ce=o(!1),Ae=o(""),J=o(""),oe=o(""),ce=o([]),se=o([]),Ie=o([]),re=o([]),le=o([]),W=o([]),v=o([]),G=o([]),de=o([]),ue=o([]),X=o([]),I=o([]),_e=o(!1),me=o(!1),xe=s({}),De=s({}),Se=s({}),Ne=s({}),Te=s({}),Pe=s({}),Ee=s({}),We=s({}),ke=s({}),je=s({}),Oe=s({}),Fe=s({}),Me=s({}),Be=s({}),Le=s({});s({});const qe=s({}),Ve=s({}),Re=s({}),Ye=s({}),ze=s({}),He=s({}),Ke=s({}),w=s({signal_url:"",form_type:"",note_id:"",service:"",service_id:""}),t=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:"",Clinic_id:"",Therapist:"",chapter_image:"",is_use_chapter:"",is_Match:-1,is_Match_id:"",today:"",files:[],files1:[],fileView:[]}),k=s({name:"",id:"",clinic_id:""}),b=s({name:"",id:"",r_ac_name:"",r_ac_register:"",name1:"",rmt_register:""}),j=s({Invoice_Charge_Number:"",Customer_Name:"",Invoice_Total_Charge:"",Has_Paid_Amount:"",Need_Charge_Amount:"",Total_Paid_Amount:"",customer_id:"",customer_name:""}),d=s({name:"",customer_id:"",pay_amount:"",pay_method:"",cheque_number:"",content:"",invoice_id:"",account_id:"",time:"",other:""}),Ue=o([{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"}]),$e=o([{value:"normal",text:"Normal"},{value:"outside",text:"Outside"},{value:"third_Pay",text:"Third Pay"},{value:"gift",text:"Gift"}]),Je=o([{value:"Y",text:"Y"},{value:"N",text:"N"}]),m=o([{id:1,price:0,spend_time:"",treatment_date:"",booking_order_no:"",booking_id:""}]),Ge=o([{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:""}),C=s({total:0,pageSize:10,currentPage:1,background:!0,pageSizes:[10,25,50,100]}),Ze=[{type:"selection",width:55,align:"left",hide:({checkList:e})=>!e.includes("勾选列")},{label:"序号列",type:"index",width:70,hide:({checkList:e})=>!e.includes("序号列")},{label:"Invoice #",prop:"invoice_number",minWidth:100,align:"left",hide:({checkList:e})=>!e.includes("Invoice #")},{label:"Files",prop:"file",minWidth:50,slot:"files",hide:({checkList:e})=>!e.includes("Files")},{label:"Therapist",prop:"therapist_name",minWidth:100,align:"left",hide:({checkList:e})=>!e.includes("Therapist")},{label:"Customer Name",slot:"Customer",minWidth:100,align:"left",hide:({checkList:e})=>!e.includes("Customer Name")},{label:"Invoice Date",prop:"invoice_date_standard",minWidth:100,hide:({checkList:e})=>!e.includes("Invoice Date")},{label:"Total ($)",prop:"total_amount",minWidth:80,align:"right",hide:({checkList:e})=>!e.includes("Total ($)")},{label:"Paid Amount $",prop:"pay_amount",minWidth:110,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:90,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:"Action",fixed:"right",width:200,slot:"operation",align:"left",hide:({checkList:e})=>!e.includes("Action")}],ei=["勾选列","Invoice #","Files","Therapist","Customer Name","Invoice Date","Total ($)","Paid Amount $","Service Name","Location","Booking #","PAID IN FULL","Split Rate","Split Amount","Withdraw Amount","Action"],c=s({order_key:"",material_key:"",truck_key:"",truck_id:"",comment:"",show:"",searchKey:"",date:"",amountBegin:"",amountEnd:"",show_number:!0,therapists_id:"",type:"",role:"",is_batch_invoice:"",invoice_id_list:[],sub_amount:"",sub_pay_amount:"",export:"N",show_all:!1,privcat:""});function ii(){f()}function ti(e){C.pageSize=e,f()}function ai(e){C.currentPage=e,f()}async function f(e){c.export="N",e=="Y"&&(c.export=e),t.Clinic_id=c.clinic_id,_.value=!0;const{data:i}=await ht(Object.assign(xe,{searchKey:c.searchKey,amountBegin:c.amountBegin,amountEnd:c.amountEnd,invoiceDate:c.date,role:"clinic",clinic_id:c.clinic_id,therapists_id:c.therapists_id,options:M,customer_id:h.customer_id,pageSize:C.pageSize,page:C.currentPage,export:c.export,show_all:c.show_all}));i.code==1?(_.value=!1,c.export=="N"?(ce.value=i.data,c.privcat=i.privcat,c.show_number=i.config.show_number,c.is_batch_invoice=i.is_batch_invoice,c.sub_amount=i.sub_amount,c.sub_pay_amount=i.sub_pay_amount,pe()):(r({type:"success",message:"Export Success"}),window.open(y+i.first_name.replace("var/www/html/public","")))):_.value=!1,C.total=i.total}function ni(e){return e.assocInfo.booking.length>0?e.assocInfo.booking[0].booking_order_no:""}function oi(e){return e.assocInfo.note.length>0?e.assocInfo.note[0].id:""}function fe(){p.value=[],t.Client_name="",t.Client_id="",t.signal_desc="",t.signal_image="",t.Invoice_Number="",m.value=[];const e={id:m.value.length+1,price:0,spend_time:"",treatment_date:t.today,booking_order_no:"",booking_id:""};m.value.push(e),t.date=t.today,h.customer_id&&(t.Client_name=h.customer_name,t.Client_id=h.customer_id),t.files=[],t.files1=[],z.value=!0}async function O(e,i){t.Invoice_Number="",_.value=!0;let n=e.service_id;i==1&&(n=e.id);const{data:a}=await jt(Object.assign(De,{clinic_id:"",service_id:n,invoice_date:t.date}));a.code==1&&(i==1?p.value.forEach((l,u)=>{e.service_name==l.service_name&&(l.invoice_number=a.invoice_number)}):e.invoice_number=a.invoice_number),_.value=!1}function ci(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),g(e)}function si(e){const i=m.value.findIndex(n=>n.id===e.id);i!==-1&&m.value.splice(i,1),m.value.forEach((n,a)=>{n.id=a+1}),g()}const ri=e=>{D.confirm("Are you sure you want to delete this item ?",{confirmButtonText:"confirm",cancelButtonText:"cancel",type:"warning"}).then(()=>{si(e)}).catch(()=>{r({type:"info",message:"Canceled"})})};function ge(e,i){e?t.is_tax="Y":t.is_tax="N",g(i)}function li(e,i){g(i)}function g(e){let i=0;e.service_detail.forEach((n,a)=>{n.price!=""&&(i=parseFloat(i)+parseFloat(n.price))}),e.is_tax?e.include_tax=="N"?(e.hstValue=Math.round(parseFloat(i)*.13*100)/100,e.total=Math.round(parseFloat(i)*1.13*100)/100):e.include_tax=="Y"&&(e.hstValue=Math.round(parseFloat(i)/1.13*.13*100)/100,e.total=Math.round(parseFloat(i)*100)/100):(e.hstValue=0,e.total=Math.round(parseFloat(i)*100)/100)}function di(e,i,n){n.spend_time=e,n.during_price_json.forEach((a,l)=>{a.value==e&&(n.price=a.price)}),g(i)}function ui(){const e=new Date,i=e.getFullYear(),n=("0"+(e.getMonth()+1)).slice(-2),a=("0"+e.getDate()).slice(-2);t.date=i+"-"+n+"-"+a,m.value[0].treatment_date=i+"-"+n+"-"+a,t.invoice_due_date=i+"-"+n+"-"+a,t.today=i+"-"+n+"-"+a,ye.help==1&&fe()}function _i(){_e.value=!0}function mi(){t.loacation_name=b.name,t.loacation_id=b.id,t.r_ac_name=b.r_ac_name,t.r_ac_register=b.r_ac_register,t.name1=b.name1,t.rmt_register=b.rmt_register}function fi(){t.Client_id=k.id,t.Client_name=k.name,Z(t.description_type)}function gi(){if(t.Clinic_id==""||t.Clinic_id==null){r({type:"error",message:"Please choose a clinic"});return}k.clinic_id=t.Clinic_id,me.value=!0}async function pi(){_.value=!0;let e="";t.invoice_type=="outside"?e=t.description_type1:e=t.description_type;const{data:i}=await vt(Object.assign(Xe,{customer_id:t.Client_id,company_id:t.loacation_id,invoice_type:t.invoice_type,invoice_date:t.date,invoice_due_date:t.invoice_due_date,is_tax:t.is_tax,description_type:e,signal_image:t.signal_image,items:m,include_tax:t.include_tax,invoice_number:t.Invoice_Number,receive_message:t.receive,note_id:"",signal_desc:t.signal_desc,clinics_id:t.Clinic_id,Therapists_id:t.Therapist,origin:"new",files:t.files,combina_service_arr:p.value}));i.code==1?(f(),z.value=!1,r({type:"success",message:i.msg}),_.value=!1):(r({type:"error",message:i.msg}),_.value=!1)}async function hi(e){const{data:i}=await Ot(Object.assign(Se,{invoice_id:e.id}));i.code==1&&(f(),r({type:"success",message:i.msg}))}const vi=e=>{D.confirm("Are you sure you want to delete this item ?",{confirmButtonText:"confirm",cancelButtonText:"cancel",type:"warning"}).then(()=>{hi(e)}).catch(()=>{r({type:"info",message:"Canceled"})})};async function bi(e){t.customArr=e;const{data:i}=await ve(Object.assign(Ne,{invoice_id:e.id}));i.code==1&&(U.value=!0,t.fileName=i.file_path.replace("/var/www/html/public/pdf/",""),t.file_path=i.file_path,t.email_content=i.data.config.emailconfig.email_content)}async function yi(){const{data:e}=await bt(Object.assign(Te,{invoice_id:t.customArr.id,file_path:t.file_path,emailContent:t.email_content,show_number:c.show_number}));e.code==1&&(r({type:"success",message:e.msg}),U.value=!1)}async function wi(e){const{data:i}=await ve(Object.assign(Pe,{invoice_id:e.id,show_number:c.show_number}));i.code==1?window.open(y+i.file_path.replace("var/www/html/public","")):r({type:"error",message:i.msg})}function Ci(){w.signal_url="signal_url1",w.form_type="invoice",w.note_id="",w.service=t.description_type,w.service_id=t.service_id,R.value=!0}function Ai(){T.clear(),S.value=""}const Ii=()=>{xi(),S.value=T.toDataURL({format:"png"}),Si()};function xi(){T.renderAll()}function Di(){T=new Bt.fabric.Canvas(ie.value,{isDrawingMode:!0})}async function Si(e){const{data:i}=await yt(Object.assign(Ee,{note_id:"",signal_url:"signal_url1",form_type:"invoice",base64code:S.value,yuyueFDF:y}));i.code==1&&(Q(2),t.signal_image=i.file_path,R.value=!1)}function Ni(){let e="";Q(2),t.signal_image=te.value,t.signal_image&&(e=t.signal_image.replace(y+"/images/","").substring(0,6),e=="fabric"?t.is_web=2:t.is_web=1)}const Ti=e=>{t.signal_image=e};async function Pi(e){G.value=[],B.value="",L.value="",q.value="",t.chapter_image="",t.is_use_chapter="",J.value="",t.fileView=e.file;let i="";Y.value=!0,t.customArr=e;const{data:n}=await wt(Object.assign(We,{invoice_id:e.id}));n.code==1&&(G.value=n.data[0].detail,B.value=n.data[0].company_info,L.value=n.data[0].info,q.value=n.data[0].customer_info,t.chapter_image=n.data[0].config.chapter_image,t.is_use_chapter=n.data[0].config.is_use_chapter,n.data[0].info.signal_image&&(i=n.data[0].info.signal_image.replace(y+"/images/","").substring(0,6),i=="fabric"?t.is_web=2:t.is_web=1),J.value=n.data[0].licence,Y.value=!0)}async function Q(e){const{data:i}=await Ct(Object.assign(ke,{clinics_id:t.Clinic_id,Therapists_id:t.Therapist,role:c.role,clinic_id:oe,customer_id:t.Client_id,is_licence:!1}));i.code==1?(v.value=JSON.parse(JSON.stringify(i.data)),v.value.length>0?(e==1&&(t.description_type=v.value[0].service_name,Z(t.description_type),t.service_id=v.value[0].id,I.value=v.value[0].during_price_json),X.value=JSON.parse(JSON.stringify(i.data))):(t.description_type="",X.value=[],I.value=[],m.value.forEach((n,a)=>{n.price=0,n.spend_time=""}),t.hstValue=0,t.total=0)):r({type:"error",message:i.msg})}function Ei(e){X.value.forEach((a,l)=>{a.service_name==e&&(t.licence_number=a.licence_number,t.licence_name=a.licence_name,t.name=a.name,t.description=a.description,t.licence_title=a.licence_title,I.value=a.during_price_json,t.signal_desc=a.sinal_desc_arr,t.signal_image=a.sinal_image_arr,t.service_id=a.id,O())});let i="",n="";v.value.forEach((a,l)=>{e==a.service_name&&a.during_price_json.forEach((u,ee)=>{u.default&&(i=u.price,n=u.duration)})}),m.value.forEach((a,l)=>{i||n?(a.price=i,a.duration=n,a.spend_time=n,a.value=n):(a.price=0,a.duration=0,a.value=0,a.spend_time=0)}),g()}function Wi(){const e={Invoice_Charge_Number:"",Customer_Name:"",Invoice_Total_Charge:"",Has_Paid_Amount:"",Need_Charge_Amount:"",Total_Paid_Amount:"",customer_id:h.customer_id,customer_name:h.customer_name};N.value=2,j.value=e,P.value=!0}function ki(e){const i={Invoice_Charge_Number:e.invoice_number,Customer_Name:e.customer_first_name+e.customer_last_name,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:h.customer_name?h.customer_name:e.customer_first_name+e.customer_last_name,invoice_id:e.id};N.value=1,j.value=i,P.value=!0}async function ji(){const{data:e}=await Ft(Object.assign(je,{customer_id:d.customer_id}));if(e.code==1){W.value=e.data;let i=t.Need_Charge_Amount;W.value.forEach((n,a)=>{const l=Math.min(n.remain_amount,i);l>0&&(n.paid_amount=l,i=parseFloat((i-l).toFixed(2)))}),H.value=!0}else r({type:"error",message:e.msg})}async function Oi(){const{data:e}=await At(Object.assign(Oe,{invoice_id:d.invoice_id,pay_amount_details:W.value}));e.code==1?(f(),H.value=!1):r({type:"error",message:e.msg})}async function Fi(){if(_.value=!0,d.pay_method!="Cheque"&&(d.cheque_number=""),d.pay_method=="Cheque"&&d.cheque_number==""){r({type:"error",message:"Please enter cheque number"}),_.value=!1;return}let e="";if(d.pay_method=="Other"){if(d.other==""){r({type:"error",message:"Please enter pay method"}),_.value=!1;return}e=d.other}else e=d.pay_method;const{data:i}=await It(Object.assign(Fe,{customer_id:d.customer_id,pay_amount:d.pay_amount,pay_method:e,cheque_number:d.cheque_number,content:d.content,collection_time:d.time,account_id:d.account_id}));i.code==1?(ji(),r({type:"success",message:i.msg}),K.value=!1,_.value=!1):(r({type:"error",message:i.msg}),_.value=!1)}function Mi(){Bi(),Li(),K.value=!0}function Bi(){const e=new Date,i=e.getFullYear(),n=("0"+(e.getMonth()+1)).slice(-2),a=("0"+e.getDate()).slice(-2);d.time=i+"-"+n+"-"+a}async function Li(){const{data:e}=await xt(Object.assign(Ve,{clinic_id:c.clinic_id,role:"clinic",searchKey:""}));e.code==1&&(de.value=e.data)}async function qi(e){const{data:i}=await Dt(Object.assign(Me,{show_number:c.show_number}));r({type:"success",message:i.msg})}async function Vi(){const{data:e}=await St(Object.assign(Be,{cliniic_name:"",pageSize:1e3,page:1}));e.code==1&&(le.value=e.data)}function Ri(e){pe()}async function pe(){const{data:e}=await Nt(Object.assign(Le,{clinics_id:t.Clinic_id}));e.code==1?(re.value=e.data,e.data.length>0&&(t.Therapist=Number(e.data[0].id),he())):r({type:"error",message:e.msg})}function he(){t.signal_desc="",t.signal_image="",t.licence_number="",t.licence_name="",t.name="",t.description="",t.licence_title="",I.value=[],t.service_id="",Q(1)}function Yi(e){const i=new Date;return i.setHours(0,0,0,0),e.getTime()>i.getTime()}function zi(e){e==null&&(c.therapists_id="")}async function Hi(e,i){const{data:n}=await Tt(Object.assign(qe,{invoice_id:i.id,is_paid:e}));n.code==1&&f(),r({type:"success",message:n.msg})}const Ki=()=>{if(t.Therapist==""||t.Therapist==null){r({type:"error",message:"Please select therapist"});return}D.confirm("Invoicing requires the therapist to provide licence services",{confirmButtonText:"Go add",cancelButtonText:"cancel",type:"warning"}).then(()=>{Ui()}).catch(()=>{r({type:"info",message:"Canceled"})})};function Ui(){we.push({path:"/crm/yuyue/clinic/employee",query:{invoceService:1}})}function $i(){$.value=!$.value}function Ji(){F.value&&(M.value=F.value.value,f())}async function Gi(e,i){t.is_Match=-1,t.is_Match_id=e.id;const{data:n}=await Pt(Object.assign(Re,{customer_id:t.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:t.loacation_id}));n.code==1?n.data.length>0?(se.value=n.data,V.value=!0):r({type:"info",message:"There are no matching Booking available"}):r({type:"error",message:n.msg})}function Xi(e){const i=[];m.value.forEach((a,l)=>{i.push(new Date(a.treatment_date).getTime())});const n=Math.max(...i);m.value.forEach((a,l)=>{n==new Date(a.treatment_date).getTime()&&n>new Date(t.date).getTime()&&(t.date=a.treatment_date)})}async function Qi(){E.value=!0;const{data:e}=await Et(Object.assign(Ye,{searchKey:c.searchKey,role:"clinic",clinic_id:c.clinic_id,therapists_id:c.therapists_id,options:M,customer_id:h.customer_id}));e.code==1?(E.value=!1,r({type:"success",message:e.msg}),window.open(y+e.file_path.replace("var/www/html/public",""))):E.value=!1}function Zi(){f()}function et(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};N.value=6,j.value=i,P.value=!0}function it(e){c.invoice_id_list=[],e.forEach((i,n)=>{c.invoice_id_list.push(i.id)})}async function tt(){t.Invoice_Number="",A.value=!0;const{data:e}=await Wt(Object.assign(ze,{invoice_id_list:c.invoice_id_list}));e.code==1?et(e.data):r({type:"error",message:e.msg}),A.value=!1}function at(e,i){return!1}function nt(e,i,n){e.code==1?(t.files.push(y+e.data.file_path.replace("var/www/html/public/","")),t.files1.push(e.data.file_name)):r({type:"error",message:e.data.msg})}function ot(e){e.length&&(ue.value=e,ne.value=!0)}function ct(e){window.open(e)}async function Z(e){let i="";v.value.forEach((a,l)=>{a.value==e&&(i=a.id,t.signal_desc=a.sinal_desc_arr,t.signal_image=a.sinal_image_arr)});const{data:n}=await kt(Object.assign(He,{role:"clinic",clinic_id:c.clinic_id,service_id:i,service_name:e,customer_id:t.Client_id}));n.code==1?(p.value=n.data,p.value.forEach((a,l)=>{a.service_detail.forEach((u,ee)=>{u.treatment_date=u.treatment_date.substring(0,10)}),ge(a.is_tax,a),O(a)})):r({type:"error",message:n.msg}),A.value=!1}function st(e){const i=p.value.findIndex(n=>n.service_name===e.service_name);i!==-1&&p.value.splice(i,1)}const rt=e=>{D.confirm("Are you sure you want to delete this item ?",{confirmButtonText:"confirm",cancelButtonText:"cancel",type:"warning"}).then(()=>{st(e)}).catch(()=>{r({type:"info",message:"Canceled"})})};function lt(e,i){p.value.forEach((n,a)=>{n.service_detail.forEach((l,u)=>{l.booking_order_no=e.booking_order_no,l.booking_id=e.booking_id,l.spend_time=Number(e.duration),l.price=e.amount})}),V.value=!1}function dt(e,i){let n=1;v.value.forEach((a,l)=>{e==a.service_name&&(O(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((u,ee)=>{u.default?(n=2,i.service_detail.forEach((x,pt)=>{x.price=u.price,x.spend_time=u.duration}),g(i)):n==1&&(i.service_detail.forEach((x,pt)=>{x.price=a.during_price_json[0].price,x.spend_time=a.during_price_json[0].duration}),g(i))}):(i.service_detail.forEach((u,ee)=>{u.price=0,u.spend_time=0}),g(i)))})}function ut(e,i){const n=e.service_detail.findIndex(a=>a.id===i.id);n!==-1&&e.service_detail.splice(n,1),e.service_detail.forEach((a,l)=>{a.id=l+1}),g(e)}function _t(e){p.value.forEach((i,n)=>{O(i)})}async function mt(e){const{data:i}=await Mt(Object.assign(Ke,{is_tax:e.is_tax,include_tax:e.include_tax,service_name:e.service_name,service_id:e.service_id}));i.code==0?r({type:"success",message:i.msg}):r({type:"error",message:i.msg}),A.value=!1}const ft=e=>{D.confirm("Do you want to change the current tax configuration to the default service configuration ?",{confirmButtonText:"confirm",cancelButtonText:"cancel",type:"warning"}).then(()=>{mt(e)}).catch(()=>{r({type:"info",message:"Canceled"})})};function gt(e){f()}return qt(()=>{c.clinic_id=localStorage.getItem("clinicIdOverall"),Di(),ui(),Vi(),ae.value=localStorage.getItem("type"),oe.value=localStorage.getItem("clinicIdOverall"),c.type=localStorage.getItem("type"),c.type==2&&(c.role="clinic"),c.type==1&&(c.role="therapists")}),{searchDetail:c,btnSearchPart:ii,loading:_,small:Ce,selectList:ei,columns:Ze,pagination:C,handleSizeChange:ti,handleCurrentChange:ai,PartList:ce,order_date:Ae,deliverDialog:z,selectClick:it,deliverDataArr:Qe,btnDeliverConfirm:pi,getBooking:ni,getNote:oi,addForm:t,InvoiceType:$e,btnAdd:fe,descriptionData:Ge,items:m,during_price_array:I,AddItem:ci,onDelete:ri,taxData:Je,onIs_tax:ge,IncludeTax:li,duringPrice:di,onSelectLocation:_i,locationDialog:_e,ClientDialog:me,eventIsNumlocation:mi,eventIsNum:fi,onSelClient:gi,ClientData:k,locationData:b,btnDelInvoice:vi,sandEmailDialog:U,btnSendEmail:bi,onSend:yi,btnPrintPDF:wi,onPrice:g,openAutograph:Ci,signatureCanvas:ie,signatureDataUrl:S,saveSignature:Ii,clearSignature:Ai,autographDialog:R,signalData:w,eventSignal:Ni,handleValueFromChild:Ti,signalUrl:te,InvoiceDetailDialog:Y,btnDetail:Pi,detailInfo:G,company_info:B,info:L,type:ae,customer_info:q,addServiceData:v,changeServic:Ei,licenceDetail:J,CollectionDialog:H,btnCollection:ki,CollectionData:W,bookingPaymentConfirm:Oi,addCollectionDialog:K,AddCollect:Mi,collectionArr:d,btncollectionConfirm:Fi,btnShowNumber:qi,ClinicsList:le,btnClinic:Ri,TherapistDate:re,onTherapist:he,disabledBeforeToday:Yi,Therapists:Ie,onTherapistSelect:zi,btnIsPaid:Hi,btnService:Ki,payMethodData:Ue,AccountData:de,isShowFilter:$,btnFilterQuery:$i,optionsFilter:F,eventFilter:Ji,getNoInvoiceBookings:Gi,MatchData:se,MatchDialog:V,selectedTr:lt,onSelectItemDate:Xi,btnExport:Qi,loading1:E,btnAddCharge:Wi,ChargeDialog:P,ChargeArr:j,eventCharge:Zi,str1:N,loading2:A,btnBatchPayment:tt,selectableStatus:at,uploadSlotFile1:nt,btnFile:ot,onFile:ct,fileDialog:ne,fileArr:ue,ServiceInvoice:p,changeServiceCombina:Z,onDeleteService:rt,changeServiceItem:dt,onDeleteI:ut,loadPartList:f,invoiceDate:_t,btnSaveDefault:ft,btnShowAll:gt}}export{ta as useEqu};