(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-c8788574"],{"079d":function(e,t,s){"use strict";s("9950")},"480b":function(e,t,s){},"4bd9":function(e,t,s){},"5d16":function(e,t,s){"use strict";s.r(t);var r=s("f2bf");const a={key:0,class:"text-start"},c={class:"text-lg mb-5"},o={class:"mb-5"},n=["placeholder","disabled"],l={key:1},d={class:"text-lg mb-5"},i={class:"border-b m-5 text-base text-start flex items-center gap-2"},m=["placeholder","disabled"],b={class:"relative inline-block text-left w-full"},h=Object(r["createElementVNode"])("div",{class:"border-t-2 border-s-2 border-e-2 w-full h-5 mb-2"},null,-1),p={class:"border-b m-5 text-base text-start flex items-start gap-2"},u=["name","id","onUpdate:modelValue","placeholder","onBlur","disabled"],O={class:"ml-auto flex gap-2"},j=["onClick"],v={class:"m-5 mb-2 text-start text-base font-bold"},f=["name","id","onUpdate:modelValue","placeholder","onBlur","disabled"],g={class:"flex items-center gap-2 ms-auto"},w=["onClick"],$=["onClick"],y={class:"w-540 max-w-full flex flex-col bg-white p-8 rounded-lg shadow border"},k=["name","placeholder"],C=["name","placeholder"],B=["disabled","onClick"],E=["onClick"],_={class:"w-540 max-w-full flex flex-col bg-white p-8 rounded-lg shadow border"},N=["placeholder","disabled"],V=["placeholder"],A=["placeholder"],x=["disabled","onClick"],T=Object(r["createElementVNode"])("div",{class:"border-b-2 border-s-2 border-e-2 w-full h-5 mb-2"},null,-1),F={key:2},S={class:"text-start text-lg mb-5"},D=["placeholder"],L=["placeholder"],U={key:3},I={key:4,class:"flex items-center gap-2 p-2 bg-white border rounded shadow-md fixed end-5 bottom-5 z-10"};function M(e,t,s,M,R,q){const P=Object(r["resolveComponent"])("PageTitle"),z=Object(r["resolveComponent"])("Tab"),W=Object(r["resolveComponent"])("FieldWrapper"),K=Object(r["resolveComponent"])("VueMultiselect"),J=Object(r["resolveComponent"])("Modal"),Y=Object(r["resolveComponent"])("Payments"),Q=Object(r["resolveComponent"])("IndicatorIcon");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",null,[Object(r["createVNode"])(P,{title:"settings.title",subtitle:"settings.subtitle"}),Object(r["createVNode"])(z,{class:"mb-5",tabItems:e.tabItems,activeTab:e.activeTab,onTabChanged:e.changedTab},null,8,["tabItems","activeTab","onTabChanged"]),e.activeTab===e.tabItems[0]?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",a,[Object(r["createElementVNode"])("h3",c,Object(r["toDisplayString"])(e.$t("settings.userData")),1),Object(r["createElementVNode"])("div",o,[Object(r["createElementVNode"])("b",null,Object(r["toDisplayString"])(e.$t("settings.accountEmail"))+":",1),Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.$store.state.loggedUser?e.$store.state.loggedUser.email:""),1)]),Object(r["createVNode"])(W,{class:"w-540 max-w-full",label:"company",name:"company",errors:e.v$.user.company.$errors},{default:Object(r["withCtx"])(()=>[Object(r["withDirectives"])(Object(r["createElementVNode"])("input",{name:"company",id:"company",type:"text",class:Object(r["normalizeClass"])([{error:e.v$.user.company.$error},"focus:shadow"]),"onUpdate:modelValue":t[0]||(t[0]=t=>e.user.company=t),placeholder:e.$t("company_placeholder"),onBlur:t[1]||(t[1]=(...t)=>e.v$.user.company.$touch&&e.v$.user.company.$touch(...t)),disabled:e.isLoading},null,42,n),[[r["vModelText"],e.user.company]])]),_:1},8,["errors"])])):Object(r["createCommentVNode"])("",!0),e.activeTab===e.tabItems[1]?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",l,[Object(r["createElementVNode"])("h3",d,Object(r["toDisplayString"])(e.$t("settings.branches")),1),Object(r["createElementVNode"])("div",i,[Object(r["createVNode"])(W,{label:"settings.addBranchLabel",name:"name",errors:e.v$.addBranchForm&&e.v$.addBranchForm.name?e.v$.addBranchForm.name.$errors:[]},{default:Object(r["withCtx"])(()=>[Object(r["withDirectives"])(Object(r["createElementVNode"])("input",{name:"name",id:"name",type:"text",class:Object(r["normalizeClass"])([{error:e.v$.addBranchForm&&e.v$.addBranchForm.name&&e.v$.addBranchForm.name.$error},"focus:shadow w-full"]),"onUpdate:modelValue":t[2]||(t[2]=t=>e.addBranchForm.name=t),placeholder:e.$t("settings.branchName_placeholder"),onBlur:t[3]||(t[3]=t=>e.v$.addBranchForm&&e.v$.addBranchForm.name?e.v$.addBranchForm.name.$touch:null),disabled:e.isLoading},null,42,m),[[r["vModelText"],e.addBranchForm.name]])]),_:1},8,["errors"]),Object(r["createVNode"])(W,{label:"settings.selectCard",name:"cardMultiselect"},{default:Object(r["withCtx"])(()=>[Object(r["createElementVNode"])("div",b,[Object(r["createVNode"])(K,{modelValue:e.addBranchForm.card,"onUpdate:modelValue":t[4]||(t[4]=t=>e.addBranchForm.card=t),options:e.cards,"custom-label":e.cardLabel,"track-by":"_id",deselectLabel:e.$t("deselect"),selectedLabel:e.$t("selected"),selectLabel:e.$t("select"),placeholder:e.$t("selectOption"),"preselect-first":!1},{noResult:Object(r["withCtx"])(()=>[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.$t("NoOptionsMatching")),1)]),noOptions:Object(r["withCtx"])(()=>[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.$t("NoOptionsAvailable")),1)]),_:1},8,["modelValue","options","custom-label","deselectLabel","selectedLabel","selectLabel","placeholder"])])]),_:1}),Object(r["createElementVNode"])("button",{class:"secondary mt-3",onClick:t[5]||(t[5]=t=>e.addBranch())},Object(r["toDisplayString"])(e.$t("settings.addBranch")),1)]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.user.branches,(s,a)=>(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{class:"mb-10",key:a},[h,Object(r["createElementVNode"])("div",p,[Object(r["createVNode"])(W,{label:"settings.branchName",name:"branchName-"+s._id,errors:e.v$.user.branches[a]?e.v$.user.branches[a].name.$errors:[]},{default:Object(r["withCtx"])(()=>[Object(r["withDirectives"])(Object(r["createElementVNode"])("input",{name:"branchName-"+s._id,id:"branchName-"+s._id,type:"text",class:Object(r["normalizeClass"])([{error:e.v$.user.branches[a]&&e.v$.user.branches[a].name.$error},"focus:shadow"]),"onUpdate:modelValue":e=>s.name=e,placeholder:e.$t("settings.branchName_placeholder"),onBlur:t=>e.v$.user.branches[a]?e.v$.user.branches[a].name.$touch:null,disabled:e.isLoading},null,42,u),[[r["vModelText"],s.name]])]),_:2},1032,["name","errors"]),Object(r["createElementVNode"])("div",O,[Object(r["createElementVNode"])("button",{class:"danger mt-2",onClick:t=>e.deleteBranch(String(s._id))},Object(r["toDisplayString"])(e.$t("settings.deleteBranch")),9,j)])]),Object(r["createElementVNode"])("div",v,Object(r["toDisplayString"])(e.$t("settings.accesses")),1),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(s.accesses,(c,o)=>(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{key:o,class:"border rounded mx-5 mb-2 p-2 text-base flex items-start gap-2"},[e.v$.user.branches[a]&&e.v$.user.branches[a].accesses[o]?(Object(r["openBlock"])(),Object(r["createBlock"])(W,{key:0,name:"email-"+c._id,errors:e.v$.user.branches[a].accesses[o].email.$errors},{default:Object(r["withCtx"])(()=>[Object(r["withDirectives"])(Object(r["createElementVNode"])("input",{name:"email-"+c._id,id:"email-"+c._id,type:"email",class:Object(r["normalizeClass"])([{error:e.v$.user.branches[a].accesses[o].email.$error},"focus:shadow"]),"onUpdate:modelValue":e=>c.email=e,placeholder:e.$t("auth.email_placeholder"),onBlur:e.v$.user.branches[a].accesses[o].email.$touch,disabled:e.isLoading},null,42,f),[[r["vModelText"],c.email]])]),_:2},1032,["name","errors"])):Object(r["createCommentVNode"])("",!0),Object(r["createElementVNode"])("div",g,[Object(r["createElementVNode"])("button",{class:"primary",onClick:t=>e.showResetModal=c._id},Object(r["toDisplayString"])(e.$t("auth.reset")),9,w),Object(r["createElementVNode"])("button",{class:"secondary",onClick:t=>e.deleteAccess(String(c._id),String(s._id))},Object(r["toDisplayString"])(e.$t("delete")),9,$)]),e.showResetModal&&e.showResetModal===c._id?(Object(r["openBlock"])(),Object(r["createBlock"])(J,{key:1,title:"auth.reset_header",onClosed:t[10]||(t[10]=t=>e.cancelResetAccess())},{footer:Object(r["withCtx"])(()=>[Object(r["createElementVNode"])("button",{type:"button",class:"primary",disabled:e.v$.resetAccessForm.invalid,onClick:t=>e.resetAccess(String(c._id),String(s._id))},Object(r["toDisplayString"])(e.$t("reset.submit")),9,B)]),default:Object(r["withCtx"])(()=>[Object(r["createElementVNode"])("form",y,[Object(r["createVNode"])(W,{label:"auth.password",name:"password-"+c._id,errors:e.v$.resetAccessForm.password.$errors,hint:`${e.$t("register.password_length")} ${e.$t("register.password_not_strong")}`},{default:Object(r["withCtx"])(()=>[Object(r["withDirectives"])(Object(r["createElementVNode"])("input",{name:"password-"+c._id,type:"password",class:Object(r["normalizeClass"])([{error:e.v$.resetAccessForm.password.$error},"focus:shadow"]),"onUpdate:modelValue":t[6]||(t[6]=t=>e.resetAccessForm.password=t),placeholder:e.$t("auth.password_placeholder"),onBlur:t[7]||(t[7]=(...t)=>e.v$.resetAccessForm.password.$touch&&e.v$.resetAccessForm.password.$touch(...t))},null,42,k),[[r["vModelText"],e.resetAccessForm.password]])]),_:2},1032,["name","errors","hint"]),Object(r["createVNode"])(W,{label:"auth.password_confirm",name:"passwordConfirm-"+c._id,errors:e.v$.resetAccessForm.password_confirm.$errors,hint:`${e.$t("register.password_length")} ${e.$t("register.password_not_strong")}`},{default:Object(r["withCtx"])(()=>[Object(r["withDirectives"])(Object(r["createElementVNode"])("input",{name:"passwordConfirm-"+c._id,type:"password",class:Object(r["normalizeClass"])([{error:e.v$.resetAccessForm.password_confirm.$error},"focus:shadow"]),"onUpdate:modelValue":t[8]||(t[8]=t=>e.resetAccessForm.password_confirm=t),placeholder:e.$t("auth.password_confirm_placeholder"),onBlur:t[9]||(t[9]=(...t)=>e.v$.resetAccessForm.password_confirm.$touch&&e.v$.resetAccessForm.password_confirm.$touch(...t))},null,42,C),[[r["vModelText"],e.resetAccessForm.password_confirm]])]),_:2},1032,["name","errors","hint"])])]),_:2},1024)):Object(r["createCommentVNode"])("",!0)]))),128)),Object(r["createElementVNode"])("button",{class:"primary m-2",onClick:t=>e.showAddAccessModal=s._id},Object(r["toDisplayString"])(e.$t("settings.addAccess")),9,E),e.showAddAccessModal&&e.showAddAccessModal===s._id?(Object(r["openBlock"])(),Object(r["createBlock"])(J,{key:0,title:"settings.add_access",onClosed:t[17]||(t[17]=t=>e.cancelAddAccess())},{footer:Object(r["withCtx"])(()=>[Object(r["createElementVNode"])("button",{type:"button",class:"primary",disabled:e.v$.addAccessForm.invalid,onClick:t=>e.addAccess(String(s._id))},Object(r["toDisplayString"])(e.$t("add")),9,x)]),default:Object(r["withCtx"])(()=>[Object(r["createElementVNode"])("form",_,[Object(r["createVNode"])(W,{label:"auth.email",name:"email-new",errors:e.v$.addAccessForm.accessEmail.$errors},{default:Object(r["withCtx"])(()=>[Object(r["withDirectives"])(Object(r["createElementVNode"])("input",{name:"email-new",id:"email-new",type:"email",class:Object(r["normalizeClass"])([{error:e.v$.addAccessForm.accessEmail.$error},"focus:shadow"]),"onUpdate:modelValue":t[11]||(t[11]=t=>e.addAccessForm.accessEmail=t),placeholder:e.$t("auth.email_placeholder"),onBlur:t[12]||(t[12]=(...t)=>e.v$.addAccessForm.accessEmail.$touch&&e.v$.addAccessForm.accessEmail.$touch(...t)),disabled:e.isLoading},null,42,N),[[r["vModelText"],e.addAccessForm.accessEmail]])]),_:1},8,["errors"]),Object(r["createVNode"])(W,{label:"auth.password",name:"password-new",errors:e.v$.addAccessForm.password.$errors,hint:`${e.$t("register.password_length")} ${e.$t("register.password_not_strong")}`},{default:Object(r["withCtx"])(()=>[Object(r["withDirectives"])(Object(r["createElementVNode"])("input",{name:"password-new",type:"password",class:Object(r["normalizeClass"])([{error:e.v$.addAccessForm.password.$error},"focus:shadow"]),"onUpdate:modelValue":t[13]||(t[13]=t=>e.addAccessForm.password=t),placeholder:e.$t("auth.password_placeholder"),onBlur:t[14]||(t[14]=(...t)=>e.v$.addAccessForm.password.$touch&&e.v$.addAccessForm.password.$touch(...t))},null,42,V),[[r["vModelText"],e.addAccessForm.password]])]),_:1},8,["errors","hint"]),Object(r["createVNode"])(W,{label:"auth.password_confirm",name:"passwordConfirm-new",errors:e.v$.addAccessForm.password_confirm.$errors,hint:`${e.$t("register.password_length")} ${e.$t("register.password_not_strong")}`},{default:Object(r["withCtx"])(()=>[Object(r["withDirectives"])(Object(r["createElementVNode"])("input",{name:"passwordConfirm-new",type:"password",class:Object(r["normalizeClass"])([{error:e.v$.addAccessForm.password_confirm.$error},"focus:shadow"]),"onUpdate:modelValue":t[15]||(t[15]=t=>e.addAccessForm.password_confirm=t),placeholder:e.$t("auth.password_confirm_placeholder"),onBlur:t[16]||(t[16]=(...t)=>e.v$.addAccessForm.password_confirm.$touch&&e.v$.addAccessForm.password_confirm.$touch(...t))},null,42,A),[[r["vModelText"],e.addAccessForm.password_confirm]])]),_:1},8,["errors","hint"])])]),_:2},1024)):Object(r["createCommentVNode"])("",!0),T]))),128))])):Object(r["createCommentVNode"])("",!0),e.activeTab===e.tabItems[2]?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",F,[Object(r["createElementVNode"])("h3",S,Object(r["toDisplayString"])(e.$t("settings.resetTitle")),1),Object(r["createElementVNode"])("form",{onSubmit:t[22]||(t[22]=Object(r["withModifiers"])((...t)=>e.reset&&e.reset(...t),["prevent"])),class:"w-540 max-w-full"},[Object(r["createVNode"])(W,{label:"settings.password",name:"password",errors:e.v$.resetForm.password.$errors,hint:`${e.$t("register.password_length")} ${e.$t("register.password_not_strong")}`},{default:Object(r["withCtx"])(()=>[Object(r["withDirectives"])(Object(r["createElementVNode"])("input",{name:"password",type:"password",class:Object(r["normalizeClass"])([{error:e.v$.resetForm.password.$error},"focus:shadow"]),"onUpdate:modelValue":t[18]||(t[18]=t=>e.resetForm.password=t),placeholder:e.$t("auth.password_placeholder"),onBlur:t[19]||(t[19]=(...t)=>e.v$.resetForm.password.$touch&&e.v$.resetForm.password.$touch(...t))},null,42,D),[[r["vModelText"],e.resetForm.password]])]),_:1},8,["errors","hint"]),Object(r["createVNode"])(W,{label:"auth.password_confirm",name:"passwordConfirm",errors:e.v$.resetForm.password_confirm.$errors,hint:`${e.$t("register.password_length")} ${e.$t("register.password_not_strong")}`},{default:Object(r["withCtx"])(()=>[Object(r["withDirectives"])(Object(r["createElementVNode"])("input",{name:"passwordConfirm",type:"password",class:Object(r["normalizeClass"])([{error:e.v$.resetForm.password_confirm.$error},"focus:shadow"]),"onUpdate:modelValue":t[20]||(t[20]=t=>e.resetForm.password_confirm=t),placeholder:e.$t("auth.password_confirm_placeholder"),onBlur:t[21]||(t[21]=(...t)=>e.v$.resetForm.password_confirm.$touch&&e.v$.resetForm.password_confirm.$touch(...t))},null,42,L),[[r["vModelText"],e.resetForm.password_confirm]])]),_:1},8,["errors","hint"])],32)])):Object(r["createCommentVNode"])("",!0),e.activeTab===e.tabItems[3]?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",U,[Object(r["createVNode"])(Y)])):Object(r["createCommentVNode"])("",!0),e.activeTab!==e.tabItems[3]?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",I,[Object(r["createElementVNode"])("button",{class:"primary",onClick:t[23]||(t[23]=t=>e.activeTab!==e.tabItems[2]?e.save():e.reset())},[e.isLoading?(Object(r["openBlock"])(),Object(r["createBlock"])(Q,{key:0,class:"animate-spin -ml-1 mr-3 h-5 w-5 text-white"})):Object(r["createCommentVNode"])("",!0),Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.activeTab!==e.tabItems[2]?e.$t("settings.save"):e.$t("auth.reset")),1)]),e.activeTab!==e.tabItems[2]?(Object(r["openBlock"])(),Object(r["createElementBlock"])("button",{key:0,class:"secondary",onClick:t[24]||(t[24]=(...t)=>e.cancel&&e.cancel(...t))},[e.isLoading?(Object(r["openBlock"])(),Object(r["createBlock"])(Q,{key:0,class:"animate-spin -ml-1 mr-3 h-5 w-5 text-white"})):Object(r["createCommentVNode"])("",!0),Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.$t("cancel")),1)])):Object(r["createCommentVNode"])("",!0)])):Object(r["createCommentVNode"])("",!0)])}s("14d9");var R=s("5502"),q=s("25a0"),P=s("032f"),z=s("633c"),W=s("a3f9"),K=s("28dc");const J={class:"border-borderColor border-b-2 text-textHeaderColor text-lg"},Y={class:"flex bg-transparent tab"},Q=["onClick"];function H(e,t,s,a,c,o){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",J,[Object(r["createElementVNode"])("ul",Y,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.items,(t,s)=>(Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{key:s,class:Object(r["normalizeClass"])(["pb-2 me-12 relative cursor-pointer hover:text-primary hover:border-primary",s===e.activeItem?"tab-active":""]),onClick:t=>e.changeActive(s)},Object(r["toDisplayString"])(e.$t(t)),11,Q))),128))])])}var G=Object(r["defineComponent"])({name:"Tab",props:{tabItems:Array,activeTab:String},setup(e,{emit:t}){const s=Object(r["ref"])(e.tabItems||[]),a=Object(r["ref"])(0),c=e=>{a.value=e,t("tabChanged",s.value[e])};return{items:s,changeActive:c,activeItem:a}},beforeMount(){this.activeTab&&(this.activeItem=this.tabItems.indexOf(this.activeTab))}}),X=(s("7962"),s("d959")),Z=s.n(X);const ee=Z()(G,[["render",H]]);var te=ee,se=s("5971"),re=s("7f4f");const ae={class:"text-lg mb-5"},ce={key:0,class:"border rounded mb-5 text-xl text-start p-2"},oe={class:"font-bold"},ne=["onClick"],le={class:"border rounded mb-5 p-2"},de={class:"text-lg"},ie={class:"list-decimal"};function me(e,t,s,a,c,o){const n=Object(r["resolveComponent"])("multiselect"),l=Object(r["resolveComponent"])("FieldWrapper"),d=Object(r["resolveComponent"])("StripeElement"),i=Object(r["resolveComponent"])("StripeElements"),m=Object(r["resolveComponent"])("Modal");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",null,[Object(r["createElementVNode"])("h3",ae,Object(r["toDisplayString"])(e.$t("settings.paymentsTitle")),1),e.branchesUnlinked&&e.branchesUnlinked.length>0?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",ce,[Object(r["createElementVNode"])("h3",oe,Object(r["toDisplayString"])(e.$t("settings.unlinkedBranches")),1),Object(r["createElementVNode"])("ol",null,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.branchesUnlinked,(e,t)=>(Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{class:"p-2 ms-5 list-decimal",key:t},Object(r["toDisplayString"])(e.name),1))),128))])])):Object(r["createCommentVNode"])("",!0),Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("h3",null,Object(r["toDisplayString"])(e.$t("settings.yourCards")),1),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.cards,(t,s)=>(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{class:"border rounded mb-5 p-2",key:s},[Object(r["createElementVNode"])("div",null,"**** **** **** "+Object(r["toDisplayString"])(t.last4),1),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{label:"settings.paymentsBranches",name:"paymentsBranches"},{default:Object(r["withCtx"])(()=>[Object(r["createVNode"])(n,{multiple:!0,closeOnSelect:!1,options:e.$store.state.branches,modelValue:t.branches,"onUpdate:modelValue":e=>t.branches=e,onSelect:s=>e.setBranchToAdd(s,t),trackBy:"_id",label:"name",id:"paymentsBranches",placeholder:e.$t("selectOption"),deselectLabel:e.$t("deselect"),selectedLabel:e.$t("selected"),selectLabel:e.$t("select")},null,8,["options","modelValue","onUpdate:modelValue","onSelect","placeholder","deselectLabel","selectedLabel","selectLabel"])]),_:2},1024)]),Object(r["createElementVNode"])("button",{type:"button",class:"danger",onClick:s=>e.removeCard(t)},Object(r["toDisplayString"])(e.$t("remove")),9,ne)]))),128)),Object(r["createElementVNode"])("div",le,[e.stripeLoaded?(Object(r["openBlock"])(),Object(r["createBlock"])(i,{key:0,class:"mb-3 p-2",ref:"elms","stripe-key":e.stripeKey,"instance-options":e.instanceOptions,"elements-options":e.elementsOptions},{default:Object(r["withCtx"])(({elements:t})=>[Object(r["createVNode"])(d,{ref:"card",elements:t,options:e.cardOptions},null,8,["elements","options"])]),_:1},8,["stripe-key","instance-options","elements-options"])):Object(r["createCommentVNode"])("",!0),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{label:"settings.paymentsBranches",name:"paymentsBranches"},{default:Object(r["withCtx"])(()=>[Object(r["createVNode"])(n,{multiple:!0,taggable:!0,closeOnSelect:!1,modelValue:e.branchesToAdd,"onUpdate:modelValue":t[0]||(t[0]=t=>e.branchesToAdd=t),onSelect:t[1]||(t[1]=t=>e.setBranchToAdd(t,null)),options:e.$store.state.branches,label:"name",trackBy:"_id",id:"paymentsBranches",deselectLabel:e.$t("deselect"),selectedLabel:e.$t("selected"),selectLabel:e.$t("select"),placeholder:e.$t("selectOption")},null,8,["modelValue","options","deselectLabel","selectedLabel","selectLabel","placeholder"])]),_:1})]),Object(r["createElementVNode"])("button",{type:"button",class:"primary",onClick:t[2]||(t[2]=(...t)=>e.prepareToSaveCard&&e.prepareToSaveCard(...t))},Object(r["toDisplayString"])(e.$t("save")),1)])]),e.removeBranchConfirmation?(Object(r["openBlock"])(),Object(r["createBlock"])(m,{key:1,title:"settings.removeBranchConfirmation",onClosed:e.clearRemoving},{footer:Object(r["withCtx"])(()=>[Object(r["createElementVNode"])("button",{type:"button",class:"primary",onClick:t[3]||(t[3]=(...t)=>e.removeBranch&&e.removeBranch(...t))},Object(r["toDisplayString"])(e.$t("yes")),1)]),_:1},8,["onClosed"])):Object(r["createCommentVNode"])("",!0),e.showCantRemoveCardModal?(Object(r["openBlock"])(),Object(r["createBlock"])(m,{key:2,title:"settings.cantRemoveCard",hideCancel:!0,onClosed:t[5]||(t[5]=t=>e.showCantRemoveCardModal=!1)},{footer:Object(r["withCtx"])(()=>[Object(r["createElementVNode"])("button",{type:"button",class:"primary",onClick:t[4]||(t[4]=t=>e.showCantRemoveCardModal=!1)},Object(r["toDisplayString"])(e.$t("ok")),1)]),default:Object(r["withCtx"])(()=>[Object(r["createElementVNode"])("div",de,Object(r["toDisplayString"])(e.$t("settings.assignBranchesToAnotherCard")),1)]),_:1})):Object(r["createCommentVNode"])("",!0),e.addBranchConfirmation?(Object(r["openBlock"])(),Object(r["createBlock"])(m,{key:3,title:"settings.addBranchConfirmation",onClosed:e.clearAdding},{footer:Object(r["withCtx"])(()=>[Object(r["createElementVNode"])("button",{type:"button",class:"primary",onClick:t[6]||(t[6]=(...t)=>e.addBranch&&e.addBranch(...t))},Object(r["toDisplayString"])(e.$t("yes")),1)]),_:1},8,["onClosed"])):Object(r["createCommentVNode"])("",!0),e.askLinkedList&&e.askLinkedList.length>0?(Object(r["openBlock"])(),Object(r["createBlock"])(m,{key:4,title:"settings.saveCardConfirmation",onClosed:t[8]||(t[8]=t=>e.askLinkedList=[])},{footer:Object(r["withCtx"])(()=>[Object(r["createElementVNode"])("button",{type:"button",class:"primary",onClick:t[7]||(t[7]=(...t)=>e.saveCard&&e.saveCard(...t))},Object(r["toDisplayString"])(e.$t("yes")),1)]),default:Object(r["withCtx"])(()=>[Object(r["createElementVNode"])("ol",ie,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.askLinkedList,(e,t)=>(Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{class:"text-xl p-2 ms-5 text-left",key:t},Object(r["toDisplayString"])(e.name),1))),128))])]),_:1})):Object(r["createCommentVNode"])("",!0)])}var be=s("aa45"),he="https://js.stripe.com/v3",pe=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,ue="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",Oe=function(){for(var e=document.querySelectorAll('script[src^="'.concat(he,'"]')),t=0;t element.");return r.appendChild(s),s},ve=function(e,t){e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",version:"1.54.0",startTime:t})},fe=null,ge=function(e){return null!==fe||(fe=new Promise((function(t,s){if("undefined"!==typeof window&&"undefined"!==typeof document)if(window.Stripe&&e&&console.warn(ue),window.Stripe)t(window.Stripe);else try{var r=Oe();r&&e?console.warn(ue):r||(r=je(e)),r.addEventListener("load",(function(){window.Stripe?t(window.Stripe):s(new Error("Stripe.js not available"))})),r.addEventListener("error",(function(){s(new Error("Failed to load Stripe.js"))}))}catch(a){return void s(a)}else t(null)}))),fe},we=function(e,t,s){if(null===e)return null;var r=e.apply(void 0,t);return ve(r,s),r},$e=Promise.resolve().then((function(){return ge(null)})),ye=!1;$e["catch"]((function(e){ye||console.warn(e)}));var ke=function(){for(var e=arguments.length,t=new Array(e),s=0;s{try{if(!window.Stripe)throw new Error(Ce.STRIPE_NOT_LOADED);const s=window.Stripe(e,t);return s}catch(s){return console.error(s),s}},Ee=(e,t)=>{try{if(!e)throw new Error(Ce.INSTANCE_NOT_DEFINED);const s=e.elements(t);return s}catch(s){return console.error(s),s}},_e=(e,t,s)=>{try{if(!e)throw new Error(Ce.ELEMENTS_NOT_DEFINED);if(!t)throw new Error(Ce.ELEMENT_TYPE_NOT_DEFINED);const r=e.create(t,s);return r}catch(r){return console.error(r),r}};var Ne=(e,t)=>{const s=e.__vccOpts||e;for(const[r,a]of t)s[r]=a;return s};const Ve=Object(r["defineComponent"])({name:"StripeElement",props:{elements:{type:Object,required:!0},type:{type:String,default:()=>"card"},options:{type:Object,default:()=>({})}},setup(e,{emit:t}){const s=Object(r["ref"])(document.createElement("div")),a=Object(r["ref"])(),c=Object(r["ref"])(),{elements:o,type:n,options:l}=Object(r["toRefs"])(e);return Object(r["onMounted"])(()=>{const e=()=>{a.value=_e(o.value,n.value,l.value),a.value.mount(s.value),c.value.appendChild(s.value)},r=(e,s)=>{t(e,s)},d=()=>{const e=["change","ready","focus","blur","click","escape"];e.forEach(e=>{a.value.on(e,r.bind(null,e))})};try{e(),d()}catch(i){console.error(i)}}),Object(r["onBeforeUnmount"])(()=>{var e,t;null==(e=a.value)||e.unmount(),null==(t=a.value)||t.destroy()}),Object(r["watch"])(l,()=>{var t;null==(t=a.value)||t.update(e.options)}),{stripeElement:a,domElement:s,mountPoint:c}}}),Ae={ref:"mountPoint"};function xe(e,t,s,a,c,o){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Ae,null,512)}var Te=Ne(Ve,[["render",xe]]);const Fe=Object(r["defineComponent"])({name:"StripeElements",props:{stripeKey:{type:String,required:!0},instanceOptions:{type:Object,default:()=>({})},elementsOptions:{type:Object,default:()=>({})}},setup(e){const{stripeKey:t,instanceOptions:s,elementsOptions:a}=Object(r["toRefs"])(e),c=Object(r["ref"])(),o=Object(r["ref"])(),n=Object(r["computed"])(()=>!!o.value&&Object.keys(o.value).length>0);return Object(r["onMounted"])(()=>{c.value=Be(t.value,s.value),o.value=Ee(c.value,a.value)}),Object(r["watch"])(a,()=>{var e;null==(e=o.value)||e.update(a.value)}),{elements:o,instance:c,elementsUsable:n}}}),Se={key:0};function De(e,t,s,a,c,o){return e.elementsUsable?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Se,[Object(r["renderSlot"])(e.$slots,"default",{instance:e.instance,elements:e.elements})])):Object(r["createCommentVNode"])("",!0)}var Le=Ne(Fe,[["render",De]]),Ue=Object(r["defineComponent"])({name:"Payments",components:{FieldWrapper:K["a"],Modal:re["a"],Multiselect:be["a"],StripeElements:Le,StripeElement:Te},data:function(){return{branchesToAdd:[],stripeLoaded:!1,stripeKey:"pk_live_51NIzttFtSSn7AWaD8uSjcfRMpqmqbKkh4vxRCgTMbBpwnCOwSrmrbRX427f12M6q0pCyiekd3yGQ0mhyFLKYZqfC00bcWs7aBF",instanceOptions:{},elementsOptions:{},cardOptions:{},removeBranchConfirmation:!1,addBranchConfirmation:!1,cardToRemoveBranch:null,cardToAddBranch:null,branchToRemove:null,branchToAdd:null,askLinkedList:[],showCantRemoveCardModal:!1}},beforeMount(){const e=ke(this.stripeKey);e.then(()=>{this.stripeLoaded=!0})},computed:{cards(){return this.$store.state.cards.map(e=>(e.branches=this.$store.state.branches.filter(t=>e.branchesIds.indexOf(t._id)>=0),e.branches&&0!==e.branches.length||(e.branches=[]),e))},branchesUnlinked(){return this.$store.state.branches.filter(e=>!this.cards.find(t=>t.branchesIds.indexOf(e._id)>=0))}},methods:{prepareToSaveCard(){this.branchesToAdd.forEach(e=>{const t=this.branchesUnlinked.find(t=>t._id===e._id);t||this.askLinkedList.push(e)}),0===this.askLinkedList.length&&this.saveCard()},saveCard(){if(this.$refs){const e=this.$refs.card.stripeElement,t=this.$refs.elms;t.instance.createToken(e).then(t=>{t.token&&(this.$store.dispatch("addCardDetails",{tokenId:t.token.id,last4:t.token.card.last4,branchesIds:this.branchesToAdd.map(e=>e._id)}),e.clear(),this.branchesToAdd=[])})}},removeCard(e){0===e.branchesIds.length?this.$store.dispatch("deleteCard",e._id):this.showCantRemoveCardModal=!0},setBranchToAdd(e,t){this.cardToAddBranch=t,this.branchToAdd=e;const s=this.branchesUnlinked.find(t=>t._id===e._id);if(!t){const t=this.branchesToAdd.indexOf(e);t>=0&&this.branchesToAdd.splice(t,1)}s?this.addBranch():this.addBranchConfirmation=!0},setBranchToRemove(e,t){this.cardToRemoveBranch=t,this.branchToRemove=e,this.removeBranchConfirmation=!0},addBranch(){let e;e=this.cardToAddBranch?this.cardToAddBranch.branchesIds:this.branchesToAdd,this.branchToAdd&&(this.cards.forEach(e=>{var t;const s=e.branchesIds.indexOf(null===(t=this.branchToAdd)||void 0===t?void 0:t._id);s>=0&&e.branchesIds.splice(s,1)}),this.cardToAddBranch?e.push(this.branchToAdd._id):e.push(this.branchToAdd)),this.addBranchConfirmation=!1,this.cardToAddBranch&&this.$store.dispatch("updateCard",{_id:this.cardToAddBranch._id,branchesIds:e})},clearAdding(){this.cardToAddBranch=null,this.branchToAdd=null,this.addBranchConfirmation=!1},removeBranch(){if(this.cardToRemoveBranch&&this.branchToRemove){const e=this.cardToRemoveBranch.branchesIds.indexOf(this.branchToRemove._id);e>=0&&this.cardToRemoveBranch.branchesIds.splice(e,1)}this.removeBranchConfirmation=!1},clearRemoving(){this.cardToRemoveBranch=null,this.branchToRemove=null,this.removeBranchConfirmation=!1}}});s("fd45");const Ie=Z()(Ue,[["render",me]]);var Me=Ie,Re=Object(r["defineComponent"])({name:"Settings",components:{PageTitle:W["a"],FieldWrapper:K["a"],IndicatorIcon:se["default"],Tab:te,Modal:re["a"],Payments:Me,VueMultiselect:be["a"]},setup:()=>{const e=Object(R["b"])();return e.commit("setVuelidateExternalResults",{}),{v$:Object(q["a"])({$externalResults:Object(r["reactive"])(e.state.vuelidateExternalResults),$autoDirty:!0})}},data:function(){return{tabItems:["settings.userData","settings.branches","settings.reset","settings.payments"],selectedCard:null,activeTab:"settings.userData",showResetModal:void 0,showAddAccessModal:void 0,user:{company:"",branches:[]},isLoading:!1,resetForm:{password:"",password_confirm:""},resetAccessForm:{password:"",password_confirm:""},addAccessForm:{accessEmail:"",password:"",password_confirm:""},addBranchForm:{name:"",card:{last4:"",_id:""}}}},validations:function(){return{user:{company:{required:z["f"]},branches:this.getBranchesValidations},resetForm:{password:{required:z["f"]},password_confirm:{required:z["f"],sameAs:Object(z["g"])(this.resetForm.password)}},resetAccessForm:{password:{required:z["f"]},password_confirm:{required:z["f"],sameAs:Object(z["g"])(this.resetAccessForm.password)}},addAccessForm:{accessEmail:{required:z["f"],email:z["a"]},password:{required:z["f"]},password_confirm:{required:z["f"],sameAs:Object(z["g"])(this.addAccessForm.password)}},addBranchForm:{name:{required:z["f"]}}}},beforeMount(){this.fillData(),this.$store.dispatch("getLoggedUser").then(()=>this.fillBranches()),this.$store.dispatch("getCardsDetails"),this.$route.query.section&&(this.activeTab="settings."+this.$route.query.section),this.initActiveTab(),this.$store.state.loggedUser&&this.$store.state.loggedUser.branches&&this.$store.state.loggedUser.branches.length>0&&0===this.$store.state.loggedUser.branches[this.$store.state.loggedUser.branches.length-1].name.indexOf(this.$store.state.loggedUser.companyName+"-")?this.addBranchForm.name=this.$store.state.loggedUser.companyName+"-":this.addBranchForm.name=""},computed:{cards(){return this.$store.state.cards.map(e=>(e.branches=this.$store.state.branches.filter(t=>e.branchesIds.indexOf(t._id)>=0),e.branches&&0!==e.branches.length||(e.branches=[]),e))},getBranchesValidations(){return this.$store.state.loggedUser&&this.$store.state.loggedUser.branches?this.$store.state.loggedUser.branches.map(e=>({name:{required:z["f"]},accesses:e.accesses.map(()=>({email:{required:z["f"],email:z["a"]}}))})):[]}},methods:{fillData(){this.user.company=this.$store.state.loggedUser?this.$store.state.loggedUser.companyName:""},cardLabel({last4:e}){return e?"**** **** **** "+e:""},fillBranches(){this.user.branches=this.$store.state.loggedUser&&this.$store.state.loggedUser.branches?JSON.parse(JSON.stringify(this.$store.state.loggedUser.branches)):[]},async save(){const e=this.activeTab===this.tabItems[0]?"company":"branches",t=await this.v$.user[e].$validate();t&&(this.activeTab===this.tabItems[0]?this.$store.state.loggedUser.companyName=this.user.company:this.$store.state.loggedUser.branches=JSON.parse(JSON.stringify(this.user.branches)),this.isLoading=!0,await this.$store.dispatch("updateUser").then(()=>{this.isLoading=!1,this.v$.user[e].$reset(),this.fillData(),this.fillBranches()}).catch(()=>{this.isLoading=!1}))},cancel(){this.fillData(),this.fillBranches()},async reset(){const e=await this.v$.resetForm.$validate(),t=P["a"].getCookie("token");e&&t&&this.$store.dispatch("reset",{email:this.$store.state.loggedUser.email,token:t,...this.resetForm}).then(()=>this.$store.dispatch("logout"))},cancelResetAccess(){this.resetAccessForm.password="",this.resetAccessForm.password_confirm="",this.showResetModal=void 0,this.v$.resetAccessForm.$reset()},async resetAccess(e,t){const s=await this.v$.resetAccessForm.$validate(),r=P["a"].getCookie("token");s&&r&&this.$store.dispatch("resetAccess",{_id:e,branch_id:t,...this.resetAccessForm}).then(()=>{this.cancelResetAccess()})},deleteAccess(e,t){this.$store.dispatch("deleteAccess",{access_id:e,branch_id:t}).then(()=>this.cancel())},cancelAddAccess(){this.addAccessForm.accessEmail="",this.addAccessForm.password="",this.addAccessForm.password_confirm="",this.showAddAccessModal=void 0,this.v$.addAccessForm.$reset(),this.cancel()},async addAccess(e){const t=await this.v$.addAccessForm.$validate(),s=P["a"].getCookie("token");t&&s&&this.$store.dispatch("addAccess",{branch_id:e,...this.addAccessForm}).then(()=>this.cancelAddAccess())},async addBranch(){const e=await this.v$.addBranchForm.$validate(),t=P["a"].getCookie("token");e&&t&&(await this.$store.dispatch("addBranch",{name:this.addBranchForm.name,cardId:this.addBranchForm.card._id}),this.$store.state.loggedUser&&this.$store.state.loggedUser.branches&&this.$store.state.loggedUser.branches.length>0&&0===this.$store.state.loggedUser.branches[this.$store.state.loggedUser.branches.length-1].name.indexOf(this.$store.state.loggedUser.companyName+"-")?this.addBranchForm.name=this.$store.state.loggedUser.companyName+"-":this.addBranchForm.name="",this.v$.addBranchForm.$reset(),this.fillBranches())},deleteBranch(e){this.$store.dispatch("deleteBranch",{_id:e}).then(()=>this.cancel())},changedTab(e){"settings.payments"!==e&&"settings.branches"!==e||this.$store.dispatch("getCardsDetails"),this.activeTab=e,this.updateSectionQueryParam(e)},updateSectionQueryParam(e){this.$router.push({path:"/app/settings",query:{section:e}})},initActiveTab(){const e=this.$route.query.section;this.activeTab=e?e.toString():this.tabItems[0]}}});const qe=Z()(Re,[["render",M]]);t["default"]=qe},7962:function(e,t,s){"use strict";s("480b")},"7f4f":function(e,t,s){"use strict";var r=s("f2bf");const a={class:"p-5 text-2xl flex items-center gap-2"},c={key:0,class:"mt-2"},o={class:"p-5 max-w-screen"},n={class:"p-5 flex items-center gap-2"};function l(e,t,s,l,d,i){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{class:"overflow-auto background fixed top-0 start-0 z-50 w-screen max-w-screen h-screen flex items-start justify-center",onClick:t[3]||(t[3]=t=>e.close(t))},[Object(r["createElementVNode"])("div",{class:"border rounded bg-white",onClick:t[2]||(t[2]=t=>e.windowClicked(t))},[Object(r["createElementVNode"])("div",a,[Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("b",null,Object(r["toDisplayString"])(e.$t(e.title)),1)]),e.subtitle?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",c,Object(r["toDisplayString"])(e.$t(e.subtitle)),1)):Object(r["createCommentVNode"])("",!0)]),Object(r["createElementVNode"])("div",{class:"ms-auto cursor-pointer",onClick:t[0]||(t[0]=t=>e.$emit("closed"))},"✕")]),Object(r["createElementVNode"])("div",o,[Object(r["renderSlot"])(e.$slots,"default")]),Object(r["createElementVNode"])("div",n,[Object(r["renderSlot"])(e.$slots,"footer"),e.hideCancel?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("button",{key:0,class:"secondary",onClick:t[1]||(t[1]=t=>e.$emit("closed"))},Object(r["toDisplayString"])(e.$t("cancel")),1))])])])}var d=Object(r["defineComponent"])({name:"PageTitle",props:{title:{type:String,default:""},subtitle:{type:String,default:null},hideCancel:{type:Boolean,default:!1}},emits:["closed"],methods:{windowClicked(e){e.windowClicked=!0},close(e){e.windowClicked||this.$emit("closed")}}}),i=(s("079d"),s("d959")),m=s.n(i);const b=m()(d,[["render",l]]);t["a"]=b},9950:function(e,t,s){},a3f9:function(e,t,s){"use strict";var r=s("f2bf");const a={class:"title text-start mb-10"},c={class:"text-black font-bold text-3xl"},o={key:0,class:"text-lg text-textHeaderColor mt-2"};function n(e,t,s,n,l,d){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",a,[Object(r["createElementVNode"])("h1",c,Object(r["toDisplayString"])(e.$t(e.title)),1),e.subtitle?(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",o,Object(r["toDisplayString"])(e.$t(e.subtitle)),1)):Object(r["createCommentVNode"])("",!0)])}var l=Object(r["defineComponent"])({name:"PageTitle",props:{title:{type:String,default:""},subtitle:String}}),d=s("d959"),i=s.n(d);const m=i()(l,[["render",n]]);t["a"]=m},fd45:function(e,t,s){"use strict";s("4bd9")}}]); //# sourceMappingURL=chunk-c8788574.3caba50c.js.map