File: /var/www/html/public/static/js/hookLocationConfig-4a0572b2.js
import{getCompanyListWeb as We,addCompanyWeb as je,getInvoiceConfigWeb as Be,updateInvoiceConfigWeb as Oe,updateEmailConfigWeb as Ne,sendEmailTestWeb as Re,getUserInfoWeb as Ue,CreateCompanyUserWeb as Le,deleteCompanyWeb as Ye,setCompanyDefault as qe}from"./po-dbdb2684.js";import{d as W,u as Me}from"./vue-router-a383d220.js";import{b7 as a}from"./message-2472a54a.js";import{o as j}from"./index-81e4a901.js";import{A as s,r as n,o as ze}from"./runtime-core.esm-bundler-6128546f.js";import"./index-f0216e7e.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 at(){const{query:B,params:Ge}=W(),O=Me(),_=s({step:"",invoceGuide:5});W();const c=n(!1),p=n(!0),N=n(null);n({start:0,end:0});const R=n(!1),b=n(!1),f=n(!1),U=n(!1),L=n(""),S=n(""),Y=n(""),v=n(""),w=n(""),k=n("");n("");const x=n([]),g=n([]),q=s({}),M=s({}),y=s({tableIndex:0,note:"",during:""}),z=n([{id:1,value:"day",text:"Day",is_Selected:0},{id:2,value:"week",text:"Week",is_Selected:0},{id:3,value:"month",text:"Month",is_Selected:0},{id:4,value:"year",text:"Year",is_Selected:0}]),m=s({company_name:"",first_name:"",last_name:"",phone:"",email:"",address:"",state:"Ontraio",city:"",hst:"",r_ac:"",rmt_register:"",country:"Canada",postal:"L3S 0E2",company_id:"",number_companyname:"",limit_times:"",time_frequen:""}),o=s({smtp_serverv:"",smtp_port:"",from_email:"",email_password:"",comment:"Attached is the invoice for your therapy session at {Your company name}. Thank you for choosing us for your treatment. If you have any concerns or discomfort, feel free to contact us anytime.",comment1:"Attached is the invoice for your therapy session at {Your company name}. Thank you for choosing us for your treatment. If you have any concerns or discomfort, feel free to contact us anytime.",text:"Please write variables in the position where you need to add a name. company name: {{ company_name }} , company phone number: {{ company_phone }}",checked:!1,is_public:"N",flag:!0,msgCorrect:"",msgError:"",cursorStart:-1,selectionStart:"",selectionEnd:"",booking_desc:"Thanks for booking on {{service_date}}, at{{begin_time}} with therapist {{therapist_name}}. Please complete your health history at the following link before your appointment. Ignore if already done.",booking_desc3:"Thanks for booking on {{service_date}}, at{{begin_time}} with therapist {{therapist_name}}. Please complete your health history at the following link before your appointment. Ignore if already done.",booking_desc1:"Thanks for booking on {{service_date}}, at{{begin_time}} with therapist {{therapist_name}}. Please complete your health history at the following link before your appointment. Ignore if already done.",service_date:"",therapist_name:""});s({destination_comp:"",state:"",city:"",address:"",phone:"",contact:"",customer_id:""});const G=s({}),D=s({}),K=s({}),H=s({}),V=s({}),$=s({}),J=s({}),F=s({qo_item_str:"",name:"",address:"",way:"",shipping:[],itemsDetail:[],trackingNo:"",courier:"",comment:""}),C=s({total:0,pageSize:10,currentPage:1,background:!0,currentPage:1,pageSizes:[10,25,50,100]}),Q=n([{name:"Practice Location",id:1},{name:"Setup",id:2},{name:"Email Config",id:3}]),X=[{type:"selection",width:55,align:"left",hide:({checkList:e})=>!e.includes("勾选列")},{label:"序号列",type:"index",width:70,hide:({checkList:e})=>!e.includes("序号列")},{label:"Company",prop:"company_name",minWidth:100,hide:({checkList:e})=>!e.includes("Company")},{label:"HST#",prop:"hst",minWidth:100,hide:({checkList:e})=>!e.includes("HST#")},{label:"Name",prop:"first_name",minWidth:100,hide:({checkList:e})=>!e.includes("Name")},{label:"Postal",prop:"postal",minWidth:100,hide:({checkList:e})=>!e.includes("Postal")},{label:"Phone",prop:"phone",minWidth:150,slot:"slotAction",hide:({checkList:e})=>!e.includes("Phone")},{label:"Email",prop:"email",minWidth:120,hide:({checkList:e})=>!e.includes("Email")},{label:"Address",prop:"address",minWidth:120,hide:({checkList:e})=>!e.includes("Address")},{label:"City",prop:"city",minWidth:120,hide:({checkList:e})=>!e.includes("City")},{label:"Province",prop:"state",minWidth:120,hide:({checkList:e})=>!e.includes("Province")},{label:"Available times",prop:"city",minWidth:120,slot:"Availablenumber",hide:({checkList:e})=>!e.includes("Available times")},{label:"User Info",prop:"city",minWidth:190,slot:"UserInfo",hide:({checkList:e})=>!e.includes("User Info")},{label:"Default",prop:"city",minWidth:60,fixed:"right",slot:"Default",hide:({checkList:e})=>!e.includes("Default")},{label:"Action",fixed:"right",width:200,slot:"operation",hide:({checkList:e})=>!e.includes("Action")||S.value==6}],Z=["勾选列","Company","HST#","Name","Postal","Phone","Email","Address","City","Province","Available times","User Info","Default","Action"],P=s({order_key:"",material_key:"",truck_key:"",truck_id:"",comment:"",show:"",searchKey:""});function ee(){i()}function te(e){C.pageSize=e,i()}function oe(e){C.currentPage=e,i()}async function i(){c.value=!0;const{data:e}=await We(Object.assign(q,{searchKey:P.searchKey,Therapist_id:L.value}));x.value=e.data,c.value=!1}function ne(e){y.tableIndex=e}function ae(){Object.keys(m).map(e=>{m[e]=""}),f.value=!0}async function se(){const{data:e}=await je(Object.assign(G,{data_row:m}));e.code==1?(i(),f.value=!1,a({type:"success",message:e.msg})):a({type:"error",message:e.msg})}function ie(e){Object.keys(e).map(t=>{m[t]=e[t]}),f.value=!0}async function re(e){const{data:t}=await Ye(Object.assign(D,{company_id:e.id}));t.code==1?(i(),a({type:"success",message:t.msg})):a({type:"error",message:t.msg})}const ce=e=>{j.confirm("Are you sure you want to delete this location",{confirmButtonText:"confirm",cancelButtonText:"cancel",type:"warning"}).then(()=>{re(e)}).catch(()=>{a({type:"info",message:"Canceled"})})};async function me(e){const{data:t}=await Be(Object.assign(K,{}));t.code==1?(v.value=t.data,g.value=t.data.during_price,o.smtp_serverv=t.data.emailconfig.smtp_serverv,o.smtp_port=t.data.emailconfig.smtp_port,o.from_email=t.data.emailconfig.from_email,o.email_password=t.data.emailconfig.email_password,o.is_public=t.data.emailconfig.is_public,k.value=t.data.companyInfo[0].company_name,w.value=t.data.companyInfo[0].phone,t.data.emailconfig.is_public=="Y"?o.checked=!0:o.checked=!1,t.data.emailconfig.message?(o.comment=t.data.emailconfig.message,h()):o.comment="Attached is the invoice for your therapy session at  {{company_name}} . Thank you for choosing us for your treatment. If you have any concerns or discomfort, feel free to contact us anytime.",t.data.emailconfig.booking_message?(o.booking_desc=t.data.emailconfig.booking_message,l()):o.booking_desc=o.booking_desc3):a({type:"error",message:t.msg})}async function le(e){const{data:t}=await Oe(Object.assign(H,{date_row:v,action:"config",during_price:g}));t.code==1?a({type:"success",message:t.msg}):a({type:"error",message:t.msg})}function de(){b.value=!0}function ue(){if(y.during==""){a({type:"info",message:"Please Enter During Value"});return}let e={during:y.during,price:0};g.value.push(e),b.value=!1}function pe(e){e?o.is_public="Y":o.is_public="N"}function fe(){o.comment="Attached is the invoice for your therapy session at  {{company_name}} . Thank you for choosing us for your treatment. If you have any concerns or discomfort, feel free to contact us anytime.",h(o.comment)}function ge(e){const t=document.getElementById("inputRefId"),r=t.selectionStart,d=t.selectionEnd;setTimeout(()=>{const u=e,A=o.comment.substring(0,r),E=o.comment.substring(d),I=A+u+E;o.comment=I,h()},500)}function ye(e){const t=document.getElementById("bookingId"),r=t.selectionStart,d=t.selectionEnd;setTimeout(()=>{const u=e,A=o.booking_desc.substring(0,r),E=o.booking_desc.substring(d),I=A+u+E;o.booking_desc=I,l()},500)}function h(e){var t=o.comment;t=t.replace(new RegExp("{{company_phone}}","g"),w.value),t=t.replace(new RegExp("{{company_name}}","g"),k.value),o.comment1=t}function l(e){var t=o.booking_desc;t=t.replace(new RegExp("{{service_date}}","g"),o.service_date),t=t.replace(new RegExp("{{begin_time}}","g"),"14:00"),t=t.replace(new RegExp("{{therapist_name}}","g"),o.therapist_name),o.booking_desc1=t}function he(e){}async function T(e){c.value=!0;const{data:t}=await Ne(Object.assign(M,{smtp_serverv:o.smtp_serverv,smtp_port:o.smtp_port,from_email:o.from_email,email_password:o.email_password,is_public:o.is_public,message:o.comment,booking_message:o.booking_desc}));t.code==1&&e==2&&a({type:"success",message:t.msg})}function _e(){if(o.is_public=="N"){var e=document.getElementById("ps");p.value?(e.type="text",p.value=!1):(e.type="password",p.value=!0)}}async function be(){o.msgCorrect="",o.msgError="",c.value=!0;const{data:e}=await Re(Object.assign(V,{smtp_serverv:o.smtp_serverv,smtp_port:o.smtp_port,from_email:o.from_email,email_password:o.email_password}));e.code==1?(o.msgCorrect=e.result,o.msgError="",T(1)):(o.msgError=e.error,o.msgCorrect="")}function ve(e){}function we(){o.booking_desc=o.booking_desc3,l(o.booking_desc)}function ke(){const e=new Date,t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),d=String(e.getDate()).padStart(2,"0"),u=`${t}-${r}-${d}`;o.service_date=u,setTimeout(()=>{l(o.booking_desc)},500)}async function Ce(){const{data:e}=await Ue(Object.assign($,{}));e.code==0?o.therapist_name=e.data.firstName+e.data.lastName:a({type:"error",message:e.msg})}async function Ae(e){const{data:t}=await qe(Object.assign(D,{company_id:e.id}));t.code==1?(i(),a({type:"success",message:t.msg})):a({type:"error",message:t.msg})}const Ee=e=>{j.confirm("Are you sure you want to set this address as the default value",{confirmButtonText:"confirm",cancelButtonText:"cancel",type:"warning"}).then(()=>{Ae(e)}).catch(()=>{a({type:"info",message:"Canceled"})})};function Ie(){B.invoceGuide==3&&(_.step=3)}function Se(){_.step=""}function xe(){localStorage.setItem("invoceGuide",""),O.push({path:"/crm/yuyue/invoiceConfig",query:{invoceGuide:4}})}async function De(e){const{data:t}=await Le(Object.assign(J,{company_id:e.id}));t.code==1?(i(),a({type:"success",message:t.msg})):a({type:"error",message:t.msg})}async function Pe(e){let t="Join Key : "+e.join_key+`
UserId : `+e.sub_user_id+`
Password : `+e.sub_user_password;try{await navigator.clipboard.writeText(t),a({type:"success",message:"The text has been copied to the clipboard!"})}catch(r){console.error("copy failed : ",r),a({type:"error",message:"Copy failed, please manually copy"})}}function Te(e){return CryptoJS.AES.encrypt(e).toString()}return ze(()=>{S.value=localStorage.getItem("type"),i(),me(),Ie(),ke(),Ce()}),{searchDetail:P,btnSearchPart:ee,loading:c,small:U,selectList:Z,columns:X,pagination:C,handleSizeChange:te,handleCurrentChange:oe,PartList:x,order_date:Y,deliverDialog:R,deliverDataArr:F,btnDeliverConfirm:se,locationData:Q,itemArr:y,onSituationArr:ne,addLocationDialog:f,btnAdd:ae,locationArr:m,EditLocation:ie,btnDellocation:ce,during_price:g,onUpdate:le,configData:v,addDuring:de,addDuringDialog:b,addDuringConfirm:ue,EmailConfig:o,onCheckbox:pe,onEmailConfig:T,showEye:_e,flag:p,onEmailTest:be,onRestore1:fe,giveName:ge,onBlur:he,inputRef:N,company_phone:w,company_name:k,displayBraces:ve,getComment1:h,onRestoreBooking:we,giveNameB:ye,getCommentB:l,defaultAdress:Ee,processArr:_,onCancel:Se,onNext:xe,LimitTimes:z,btnCreateUser:De,btnCopy:Pe,btnPassword:Te}}export{at as useEqu};