| @@ -1 +1,5 @@ | ||
| 1 | -var qe=Object.defineProperty;var Fe=(l,t,s)=>t in l?qe(l,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):l[t]=s;var Ee=(l,t,s)=>Fe(l,typeof t!="symbol"?t+"":t,s);import{h as T,l as Z,v as ae,i as ye,r as M,c as N,o as a,w as d,d as e,e as m,a as o,u as h,n as Q,F as W,t as n,b as y,g as G,f as $,q as Oe,k as Ue,K as ze,z as We,G as He}from"./vue.esm-bundler.js?ver=1.6.0";import{_ as be}from"./_plugin-vue_export-helper.js?ver=1.6.0";import{B as Ze}from"./Badge.js?ver=1.6.0";import{_ as Ke}from"./Empty.js?ver=1.6.0";import{b as Qe}from"./common.js?ver=1.6.0";import{I as Ce}from"./IconButton.js?ver=1.6.0";import{_ as F}from"./DynamicIcon.js?ver=1.6.0";import{t as p,a as pe}from"./Translator.js?ver=1.6.0";import{_ as Ge,b as fe,C as ve,a as he}from"./CardBody.js?ver=1.6.0";import{_ as Ne}from"./UserCan.js?ver=1.6.0";import{A as Ye}from"./Arr.js?ver=1.6.0";import{A as Je}from"./Asset.js?ver=1.6.0";import{n as D}from"./Notify.js?ver=1.6.0";import{R as te}from"./Rest.js?ver=1.6.0";import{E as Xe,f as Be}from"./index.js?ver=1.6.0";import{_ as H,a as we}from"./AddressComponent2.js?ver=1.6.0";import{L as De,u as et}from"./NotFound.js?ver=1.6.0";import{f as tt}from"./productService.js?ver=1.6.0";const st={class:"fct-customer-edit-modal"},lt={class:"fct-compact-form"},at={class:"form-heading"},ot={class:"fct-compact-form fct-customer-address-section"},nt={key:0,class:"mt-5"},dt={key:1,class:"form-error-wrap"},it={class:"dialog-footer"},rt={__name:"NewCustomerModal",props:{customer_id:{type:[String,Number],default:null},customer:{type:Object,default:()=>({})},customerModalInfos:{type:Object,default:()=>({})}},emits:["close-modal","select-new-customer","update:customerModal"],setup(l,{emit:t}){const s=t,c=l,v=T({}),i=T(!1),_=T({}),b=window.fluentCartAdminApp,L=()=>{s("close-modal")},S=()=>{i.value=!0,v.value.wp_user=c.customerModalInfos.manageWpUser,te.post("customers/",{...v.value}).then(g=>{s("select-new-customer",g.data),s("update:customerModal",!1),D.success(g.message),_.value={}}).catch(g=>{var k;g.status_code=="422"?(D.validationErrors(g),_.value=g.data):D.error((k=g.data)==null?void 0:k.message)}).finally(()=>{i.value=!1})},A=()=>{i.value=!0,v.value.wp_user=c.customerModalInfos.manageWpUser,te.put("customers/"+c.customer_id,{...v.value}).then(g=>{s("select-new-customer",g.data),s("update:customerModal",!1),D.success(g.message),_.value={}}).catch(g=>{var k;g.status_code=="422"?(D.validationErrors(g),_.value=g.data):D.error((k=g.data)==null?void 0:k.message)}).finally(()=>{i.value=!1})},x=Z(()=>c.customerModalInfos.action==="create"?p("Create as wordpress user"):p("Update wordpress user profile")),U=Z(()=>c.customerModalInfos.action==="edit"?p("Update Customer"):p("Create Customer")),P=Z(()=>{const g={};for(const k in _.value){const C=_.value[k];g[k]=Array.isArray(C)?C:Object.values(C)}return g});return ae(()=>c.customer,g=>{v.value={id:g.id,email:g.email,full_name:g.full_name,first_name:g.first_name,last_name:g.last_name,state:g.state,city:g.city,country:g.country,postcode:g.postcode,country_name:g.country_name,contact_id:g.contact_id,user_id:g.user_id,wp_user:g.wp_user}},{deep:!0}),ye(()=>{v.value={id:c.customer.id,email:c.customer.email,full_name:c.customer.full_name,first_name:c.customer.first_name,last_name:c.customer.last_name,state:c.customer.state,city:c.customer.city,country:c.customer.country,postcode:c.customer.postcode,country_name:c.customer.country_name,contact_id:c.customer.contact_id,user_id:c.customer.user_id,wp_user:c.customer.wp_user}}),(g,k)=>{const C=M("el-checkbox"),j=M("el-button"),O=M("el-dialog");return a(),N(O,{modelValue:l.customerModalInfos.showModal,"onUpdate:modelValue":k[8]||(k[8]=u=>l.customerModalInfos.showModal=u),title:l.customerModalInfos.title,onClose:k[9]||(k[9]=()=>{_.value={}})},{default:d(()=>[e("div",st,[e("div",lt,[h(b).is_full_name_required?(a(),N(H,{key:0,label:h(p)("Full Name *"),modelValue:v.value.full_name,"onUpdate:modelValue":k[0]||(k[0]=u=>v.value.full_name=u),class:Q(_.value.full_name?"is-error":"")},null,8,["label","modelValue","class"])):(a(),m(W,{key:1},[o(H,{label:h(p)("First Name *"),modelValue:v.value.first_name,"onUpdate:modelValue":k[1]||(k[1]=u=>v.value.first_name=u),class:Q(_.value.first_name?"is-error":"")},null,8,["label","modelValue","class"]),o(H,{label:h(p)("Last Name"),modelValue:v.value.last_name,"onUpdate:modelValue":k[2]||(k[2]=u=>v.value.last_name=u),class:Q(_.value.last_name?"is-error":"")},null,8,["label","modelValue","class"])],64)),o(H,{type:"email",label:h(p)("Email *"),modelValue:v.value.email,"onUpdate:modelValue":k[3]||(k[3]=u=>v.value.email=u),disabled:l.customer.user_id&&l.customer.user_id!=0,class:Q(_.value.email?"is-error":"")},null,8,["label","modelValue","disabled","class"])]),e("h4",at,n(h(p)("Address")),1),e("div",ot,[o(we,{modelValue:v.value,"onUpdate:modelValue":k[4]||(k[4]=u=>v.value=u),validationErrors:_.value},null,8,["modelValue","validationErrors"]),l.customerModalInfos.action==="create"?(a(),m("div",nt,[o(C,{"true-value":"yes","false-value":"no",modelValue:l.customerModalInfos.manageWpUser,"onUpdate:modelValue":k[5]||(k[5]=u=>l.customerModalInfos.manageWpUser=u)},{default:d(()=>[o(De,{title:x.value,content:h(p)("We will create a new user for this customer. If a user with the same email already exists, we will associate the customer with that existing user.")},null,8,["title","content"])]),_:1},8,["modelValue"])])):y("",!0),Object.keys(_.value).length?(a(),m("div",dt,[(a(!0),m(W,null,G(P.value,(u,B)=>(a(),m("p",{key:B},[(a(!0),m(W,null,G(u,q=>(a(),m("span",{key:q},n(q),1))),128))]))),128))])):y("",!0)]),e("div",it,[o(j,{onClick:L},{default:d(()=>[$(n(h(p)("Cancel")),1)]),_:1}),l.customerModalInfos.action==="edit"?(a(),N(j,{key:0,loading:i.value,type:"primary",onClick:k[6]||(k[6]=u=>A())},{default:d(()=>[$(n(U.value),1)]),_:1},8,["loading"])):(a(),N(j,{key:1,type:"primary",loading:i.value,onClick:k[7]||(k[7]=u=>S())},{default:d(()=>[$(n(U.value),1)]),_:1},8,["loading"]))])])]),_:1},8,["modelValue","title"])}}},ut={name:"OrderUpDownIndicator",props:{order:{type:Object,required:!0}},data(){var l,t;return{upgradeToId:((l=this.order.config)==null?void 0:l.upgraded_to)||null,upgradeFromId:((t=this.order.config)==null?void 0:t.upgraded_from)||null}}},ct={key:0,class:"ml-2"};function mt(l,t,s,c,v,i){const _=M("el-icon"),b=M("el-button"),L=M("router-link"),S=M("el-tooltip");return v.upgradeFromId||v.upgradeToId?(a(),m("span",ct,[v.upgradeFromId?(a(),N(S,{key:0,trigger:"click"},{content:d(()=>[$(n(l.$t("This order has been upgraded from"))+" ",1),o(L,{to:{name:"view_order",params:{order_id:v.upgradeFromId}}},{default:d(()=>[e("strong",null,"#"+n(v.upgradeFromId),1)]),_:1},8,["to"])]),default:d(()=>[o(b,{text:""},{default:d(()=>[o(_,null,{default:d(()=>t[0]||(t[0]=[e("svg",{viewBox:"0 0 24 24",width:"24",height:"24",color:"currentColor",fill:"none"},[e("defs"),e("path",{fill:"currentColor",d:"M11.943,1.75 L12.057,1.75 C14.248,1.75 15.969,1.75 17.312,1.931 C18.689,2.116 19.781,2.503 20.639,3.361 C21.497,4.219 21.884,5.311 22.069,6.688 C22.25,8.031 22.25,9.752 22.25,11.943 L22.25,12.057 C22.25,14.248 22.25,15.969 22.069,17.312 C21.884,18.689 21.497,19.781 20.639,20.639 C19.781,21.497 18.689,21.884 17.312,22.069 C15.969,22.25 14.248,22.25 12.057,22.25 L11.943,22.25 C9.752,22.25 8.031,22.25 6.688,22.069 C5.311,21.884 4.219,21.497 3.361,20.639 C2.503,19.781 2.116,18.689 1.931,17.312 C1.75,15.969 1.75,14.248 1.75,12.057 L1.75,11.943 C1.75,9.752 1.75,8.031 1.931,6.688 C2.116,5.311 2.503,4.219 3.361,3.361 C4.219,2.503 5.311,2.116 6.688,1.931 C8.031,1.75 9.752,1.75 11.943,1.75 L11.943,1.75 Z M4.422,4.422 C3.889,4.955 3.58,5.678 3.417,6.888 C3.252,8.12 3.25,9.74 3.25,12 C3.25,14.26 3.252,15.88 3.417,17.112 C3.58,18.322 3.889,19.045 4.422,19.578 C4.955,20.111 5.678,20.42 6.888,20.583 C8.12,20.748 9.74,20.75 12,20.75 C14.26,20.75 15.88,20.748 17.112,20.583 C18.322,20.42 19.045,20.111 19.578,19.578 C20.111,19.045 20.42,18.322 20.583,17.112 C20.748,15.88 20.75,14.26 20.75,12 C20.75,9.74 20.748,8.12 20.583,6.888 C20.42,5.678 20.111,4.955 19.578,4.422 C19.045,3.889 18.322,3.58 17.112,3.417 C15.88,3.252 14.26,3.25 12,3.25 C9.74,3.25 8.12,3.252 6.888,3.417 C5.678,3.58 4.955,3.889 4.422,4.422 Z M10.038,11.023 C9.749,11.32 9.274,11.326 8.977,11.038 C8.68,10.749 8.673,10.274 8.962,9.977 C9.051,9.886 9.197,9.704 9.41,9.433 L9.457,9.373 C9.647,9.131 9.87,8.847 10.099,8.576 C10.346,8.285 10.621,7.983 10.897,7.749 C11.035,7.631 11.19,7.515 11.358,7.425 C11.519,7.339 11.742,7.25 12,7.25 C12.258,7.25 12.481,7.339 12.642,7.425 C12.81,7.515 12.965,7.631 13.103,7.749 C13.379,7.983 13.654,8.285 13.901,8.576 C14.13,8.847 14.353,9.131 14.543,9.373 L14.543,9.373 L14.59,9.433 C14.804,9.704 14.949,9.886 15.038,9.977 C15.326,10.274 15.32,10.749 15.023,11.038 C14.726,11.326 14.251,11.32 13.962,11.023 C13.805,10.861 13.603,10.604 13.411,10.359 L13.366,10.302 C13.173,10.057 12.967,9.794 12.756,9.545 L12.75,9.538 L12.75,16 C12.75,16.414 12.414,16.75 12,16.75 C11.586,16.75 11.25,16.414 11.25,16 L11.25,9.538 L11.244,9.545 C11.033,9.794 10.827,10.057 10.634,10.302 L10.634,10.302 L10.589,10.359 C10.397,10.604 10.195,10.861 10.038,11.023 Z"})],-1)])),_:1,__:[0]})]),_:1})]),_:1})):y("",!0),v.upgradeToId?(a(),N(S,{key:1,trigger:"click"},{content:d(()=>[$(n(l.$t("This order has been upgraded to"))+" ",1),o(L,{to:{name:"view_order",params:{order_id:v.upgradeToId}}},{default:d(()=>[e("strong",null,"#"+n(v.upgradeToId),1)]),_:1},8,["to"])]),default:d(()=>[o(b,{text:""},{default:d(()=>[o(_,null,{default:d(()=>t[1]||(t[1]=[e("svg",{viewBox:"0 0 24 24",width:"24",height:"24",color:"currentColor",fill:"none"},[e("defs"),e("path",{fill:"currentColor",d:"M3.367,20.63 C1.756,19.02 1.756,16.672 1.756,11.995 L1.756,11.995 C1.756,7.317 1.756,4.97 3.367,3.359 C4.976,1.75 7.324,1.75 12.002,1.75 C16.68,1.75 19.026,1.75 20.637,3.359 C22.247,4.97 22.247,7.318 22.247,11.996 C22.247,16.674 22.247,19.022 20.637,20.631 C19.026,22.242 16.678,22.242 12,22.242 L12.003,22.241 C7.326,22.241 4.976,22.241 3.367,20.63 Z M4.427,4.418 C3.256,5.59 3.256,7.73 3.256,11.994 L3.256,11.995 C3.256,16.259 3.256,18.399 4.427,19.569 C5.597,20.741 7.738,20.741 12.003,20.741 C16.269,20.741 18.408,20.741 19.58,19.569 C20.75,18.399 20.75,16.259 20.75,11.993 L20.75,11.993 C20.75,7.727 20.75,5.588 19.58,4.417 C18.408,3.247 16.268,3.247 12.005,3.247 L12.003,3.248 C7.739,3.248 5.599,3.248 4.427,4.418 Z M12.024,8.951 C12.121,9.047 12.306,9.198 12.578,9.415 L12.654,9.476 L12.654,9.476 C12.894,9.667 13.172,9.888 13.437,10.117 C13.727,10.367 14.029,10.648 14.262,10.932 C14.432,11.139 14.661,11.456 14.726,11.834 C14.729,11.85 14.732,11.866 14.734,11.883 C14.741,11.94 14.745,11.999 14.745,12.059 C14.744,12.083 14.743,12.106 14.74,12.13 C14.693,12.568 14.41,12.933 14.199,13.168 C13.96,13.435 13.661,13.696 13.375,13.93 C13.152,14.112 12.918,14.292 12.71,14.452 C12.651,14.497 12.594,14.541 12.541,14.582 C12.277,14.786 12.109,14.923 12.027,15.007 C11.739,15.305 11.264,15.312 10.967,15.024 C10.669,14.735 10.662,14.26 10.95,13.963 C11.121,13.787 11.382,13.582 11.623,13.396 C11.684,13.349 11.745,13.302 11.807,13.254 C12.012,13.097 12.222,12.935 12.427,12.768 L12.483,12.722 L6.995,12.715 C6.581,12.715 6.246,12.379 6.246,11.964 C6.247,11.55 6.583,11.215 6.997,11.215 L12.422,11.222 C12.191,11.024 11.949,10.832 11.718,10.648 L11.718,10.648 L11.643,10.588 C11.396,10.391 11.134,10.181 10.965,10.012 C10.672,9.72 10.671,9.245 10.964,8.952 C11.257,8.659 11.731,8.658 12.024,8.951 Z M17.754,8.001 L17.745,15.993 C17.744,16.407 17.408,16.743 16.994,16.742 C16.58,16.742 16.244,16.405 16.245,15.991 L16.254,7.999 C16.255,7.585 16.591,7.25 17.005,7.25 C17.419,7.25 17.755,7.587 17.754,8.001 Z"})],-1)])),_:1,__:[1]})]),_:1})]),_:1})):y("",!0)])):y("",!0)}const ka=be(ut,[["render",mt]]);class Pe{static copyModern(t){return navigator.clipboard.writeText(t)}static copyLegacy(t){const s=document.createElement("textarea");s.value=t,s.setAttribute("readonly",""),s.style.position="absolute",s.style.left="-9999px",document.body.appendChild(s),s.select();try{return document.execCommand("copy"),s.remove(),Promise.resolve()}catch{return s.remove(),Promise.reject(new Error(p("Failed to copy text")))}}static async copy(t,s={}){const v={...{showNotification:!0,duration:2e3},...s};v.successMessage=v.successMessage||p("Copied to clipboard"),v.errorMessage=v.successMessage||p("Copied to clipboard");try{return navigator.clipboard&&window.isSecureContext?await this.copyModern(t):await this.copyLegacy(t),v.showNotification&&D.success(v.successMessage),!0}catch{return v.showNotification&&Xe.alert(t,p("Please copy this text: "),{confirmButtonText:p("Close")}),!1}}static copyElement(t,s={}){if(!t)throw new Error(p("Element not provided"));const c=t.textContent||t.value||"";return this.copy(c,s)}}const pt={class:"fct-copy-wrap"},_t={key:0,class:"fct-copy-basic"},ft={key:1,class:"fct-copy-basic-wrap"},vt={class:"fct-copy-basic"},ht={key:2,class:"fct-copy-advanced flex"},gt=["value","placeholder"],yt=["disabled"],me={__name:"CopyToClipboard",props:{showMode:{type:String,default:""},tooltipText:{type:String,default:p("Copy")},text:[String,Number],placeholder:String,buttonText:{type:String,default:p("Copy")},tooltipContent:{type:String,default:""},placement:{type:String,default:"top-end"}},setup(l){const t=l,s=T(t.text),c=T(null),v=i=>{i.preventDefault();const _=s.value;Pe.copy(_)};return ae(()=>t.text,i=>{s.value=i},{deep:!0}),(i,_)=>{const b=M("el-button"),L=M("el-tooltip");return a(),m("div",pt,[l.showMode==="basic_copy_btn"?(a(),m("div",_t,[e("span",{ref_key:"copyTooltip",ref:c,class:"copy-tooltip"},n(l.tooltipText),513),e("button",{class:"fct-copy-btn",onClick:v},_[0]||(_[0]=[e("svg",{viewBox:"0 0 20 20","aria-hidden":"true",width:"20",height:"20"},[e("path",{"fill-rule":"evenodd",d:"M6.515 4.75a2 2 0 0 1 1.985-1.75h3a2 2 0 0 1 1.985 1.75h.265a2.25 2.25 0 0 1 2.25 2.25v7.75a2.25 2.25 0 0 1-2.25 2.25h-7.5a2.25 2.25 0 0 1-2.25-2.25v-7.75a2.25 2.25 0 0 1 2.25-2.25h.265Zm1.985-.25h3a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5Zm-1.987 1.73.002.02h-.265a.75.75 0 0 0-.75.75v7.75c0 .414.336.75.75.75h7.5a.75.75 0 0 0 .75-.75v-7.75a.75.75 0 0 0-.75-.75h-.265a2 2 0 0 1-1.985 1.75h-3a2 2 0 0 1-1.987-1.77Z"})],-1)]))])):l.showMode==="icon_with_text"?(a(),m("div",ft,[e("div",vt,[e("span",{ref_key:"copyTooltip",ref:c,class:"copy-tooltip"},n(l.tooltipText),513),o(b,{class:"fct-copy-text-btn",text:"",onClick:v},{default:d(()=>[o(F,{name:"Copy"}),$(" "+n(l.buttonText),1)]),_:1})]),l.tooltipContent?(a(),N(L,{key:0,"popper-class":"fct-tooltip",content:l.tooltipContent,placement:l.placement,"show-after":400,"hide-after":0},{default:d(()=>[e("span",null,[o(F,{name:"InformationFill",class:"w-4.5 h-4.5"})])]),_:1},8,["content","placement"])):y("",!0)])):(a(),m("div",ht,[e("input",{type:"text",class:"w-full",readonly:"",value:s.value,placeholder:l.placeholder},null,8,gt),e("span",{ref_key:"copyTooltip",ref:c,hidden:"",class:"copy-tooltip"},n(i.$t("Copied!")),513),e("button",{class:"fct-copy-btn flex",onClick:v,disabled:!s.value},[o(F,{name:"Copy"}),$(" "+n(i.$t("Copy")),1)],8,yt)]))])}}},_e=class _e{static emptyImage(t=!1){return _e.assetUrl()+(t?"images/empty-image-dark.svg":"images/empty-image.svg")}};Ee(_e,"assetUrl",()=>Je.url());let ge=_e;const bt={components:{DynamicIcon:F},props:{product:{type:Object},hideProductId:{type:Boolean,default:!1},hideViewIcon:{type:Boolean,default:!1},hideImage:{type:Boolean,default:!1}},data(){return{}},methods:{translate:p,translateNumber:pe,getImage(l,t=!1){return Ye.get(l,"featured_media.url")??ge.emptyImage(t)}}},Ct={class:"fct-product-info-card w-full"},wt={key:0,class:"fct-product-info-media"},kt=["src","alt"],At=["src","alt"],$t={class:"fct-product-info-details"},Mt={class:"fct-product-info-name"},Lt={class:"product-name"},xt={class:"product-name-inner"},It=["href"],Vt={key:0,class:"product-id"},Tt={key:1,class:"product-sub-name"};function St(l,t,s,c,v,i){var b,L,S,A,x,U,P,g,k;const _=M("DynamicIcon");return a(),m("div",Ct,[s.hideImage?y("",!0):(a(),m("div",wt,[e("span",null,[e("img",{class:"block dark:hidden",src:i.getImage((b=s.product)==null?void 0:b.detail),alt:(L=s.product)==null?void 0:L.post_title},null,8,kt),e("img",{class:"hidden dark:block",src:i.getImage((S=s.product)==null?void 0:S.detail,!0),alt:(A=s.product)==null?void 0:A.post_title},null,8,At)])])),e("div",$t,[e("div",Mt,[e("span",Lt,[e("span",xt,n(((x=s.product)==null?void 0:x.post_title)||i.translate("No Name")),1),s.hideViewIcon?y("",!0):(a(),m("a",{key:0,class:"view-link right-1",target:"_blank",href:(U=s.product)==null?void 0:U.view_url,onClick:t[0]||(t[0]=Oe(()=>{},["stop"]))},[o(_,{class:"w-5 h-5",name:"Eye"})],8,It))]),s.hideProductId?y("",!0):(a(),m("span",Vt," #"+n(i.translateNumber((P=s.product)==null?void 0:P.ID)),1)),(g=s.product)!=null&&g.variation_title?(a(),m("span",Tt," – "+n((k=s.product)==null?void 0:k.variation_title),1)):y("",!0)])])])}const Et=be(bt,[["render",St]]),Ot={name:"LicenseTable",components:{ProductInfo:Et,UserCan:Ne,RouteCell:Ge,DynamicIcon:F,IconButton:Ce,CopyToClipboard:me,Empty:Ke,Badge:Ze},props:{licenses:{type:Array,required:!0},columns:{type:Array,default(){return["product","order_id","customer","date"]}}},computed:{Clipboard(){return Pe},formattedLicense(){return this.licenses.map(l=>{var t;return{...l,product:{...l.product,variation_title:((t=l.product_variant)==null?void 0:t.variation_title)||"n/a"}}})}},methods:{translate:p,formatDate:Qe,translateNumber:pe,getProductName(l){var t,s;return(t=l==null?void 0:l.product)!=null&&t.post_title?(s=l==null?void 0:l.product)==null?void 0:s.post_title:"n/a"},getProductVariationName(l){var t,s;return(t=l==null?void 0:l.product_variant)!=null&&t.variation_title?(s=l==null?void 0:l.product_variant)==null?void 0:s.variation_title:"n/a"}}},Ut={class:"fct_licenses_table hide-on-mobile"},Nt={class:"fct-license-key-wrap flex flex-col"},Bt={class:"fct-license-key max-w-full pr-1"},Dt={class:"fct-license-key-inner pr-2"},Pt={key:0},jt={key:1},Rt={class:"fct_licenses_table_mobile"},qt={class:"fct-table-mobile-wrap"},Ft=["onClick"],zt={class:"fct-table-mobile-header-left"},Wt={class:"fct-table-status-col"},Ht={class:"fct-table-activations-col"},Zt={class:"fct-table-mobile-body"},Kt=["onClick"],Qt={class:"fct-license-key-wrap has-bg"},Gt={class:"fct-license-key"},Yt={class:"fct-license-key-inner pr-2"};function Jt(l,t,s,c,v,i){const _=M("Badge"),b=M("router-link"),L=M("DynamicIcon"),S=M("el-tooltip"),A=M("el-table-column"),x=M("ProductInfo"),U=M("RouteCell"),P=M("Empty"),g=M("el-table"),k=M("UserCan");return a(),N(k,{permission:"licenses/view"},{default:d(()=>[e("div",Ut,[o(g,{data:i.formattedLicense,class:"w-full compact-table"},{empty:d(()=>[o(P,{icon:"Empty/ListView","has-dark":!0,text:i.translate("No Licenses found based on your filter")},null,8,["text"])]),default:d(()=>[o(A,{label:i.translate("License Key"),width:200},{default:d(C=>{var j;return[e("div",Nt,[e("span",null,[(a(),N(_,{status:C.row.status,key:C.row.id},null,8,["status"]))]),e("span",Bt,[e("span",Dt,[o(b,{class:"link",to:{name:"view_license",params:{license_id:(j=C.row)==null?void 0:j.id}}},{default:d(()=>[$(n(C.row.license_key),1)]),_:2},1032,["to"])]),o(S,{content:C.row.license_key,placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[o(L,{class:"cursor-pointer p-1 w-6 h-6 flex-none",name:"Copy",onClick:()=>{i.Clipboard.copy(C.row.license_key,{successMessage:i.translate("License Key copied to clipboard"),errorMessage:i.translate("Failed to copy License Key")})}},null,8,["onClick"])]),_:2},1032,["content"])])])]}),_:1},8,["label"]),s.columns.indexOf("product")!==-1?(a(),N(A,{key:0,width:200,label:i.translate("Product")},{default:d(C=>{var j;return[o(U,{class:"link block hover:no-underline",to:{name:"view_license",params:{license_id:(j=C.row)==null?void 0:j.id}}},{default:d(()=>[o(x,{product:C.row.product,hideProductId:!0,hideViewIcon:!0,hideImage:!0},null,8,["product"])]),_:2},1032,["to"])]}),_:1},8,["label"])):y("",!0),s.columns.indexOf("order_id")!==-1?(a(),N(A,{key:1,width:80,label:i.translate("Order ID")},{default:d(C=>[o(U,{class:"link order_id block hover:no-underline relative w-full",to:{name:"view_order",params:{order_id:C.row.order_id}}},{default:d(()=>[o(b,{class:"link absolute left-1/2 top-1/2 translate-x-[calc(-50%-16px)] translate-y-[-50%]",to:{name:"view_order",params:{order_id:C.row.order_id}}},{default:d(()=>[$(" #"+n(C.row.order_id),1)]),_:2},1032,["to"])]),_:2},1032,["to"])]),_:1},8,["label"])):y("",!0),s.columns.indexOf("customer")!==-1?(a(),N(A,{key:2,width:100,label:i.translate("Customer")},{default:d(C=>[o(b,{class:"link",to:{name:"view_customer",params:{customer_id:C.row.customer_id}}},{default:d(()=>{var j,O;return[$(n(((O=(j=C.row)==null?void 0:j.customer)==null?void 0:O.full_name)||i.translate("No Name")),1)]}),_:2},1032,["to"])]),_:1},8,["label"])):y("",!0),o(A,{width:90,label:i.translate("Activations")},{default:d(C=>{var j;return[o(U,{class:"link block hover:no-underline relative w-full",to:{name:"view_license",params:{license_id:(j=C.row)==null?void 0:j.id}}},{default:d(()=>[$(n(i.translateNumber(C.row.activation_count))+" / "+n(C.row.limit==0?"Unlimited":C.row.limit),1)]),_:2},1032,["to"])]}),_:1},8,["label"]),s.columns.indexOf("date")!==-1?(a(),N(A,{key:3,width:140,label:i.translate("Date")},{default:d(C=>{var j;return[o(U,{class:"block hover:no-underline w-full",to:{name:"view_license",params:{license_id:(j=C.row)==null?void 0:j.id}}},{default:d(()=>[e("div",null,[e("span",null,n(i.formatDate(C.row.created_at)),1),t[0]||(t[0]=e("span",{class:"text-gray-300 px-2"},"–",-1)),C.row.expiration_date?(a(),m("span",Pt,n(i.formatDate(C.row.expiration_date)),1)):(a(),m("span",jt,n(i.translate("Lifetime")),1))])]),_:2},1032,["to"])]}),_:1},8,["label"])):y("",!0)]),_:1},8,["data"])]),e("div",Rt,[e("div",qt,[(a(!0),m(W,null,G(i.formattedLicense,(C,j)=>(a(),m("div",{key:j,class:"fct-table-mobile-row"},[e("div",{class:"fct-table-mobile-header",onClick:O=>l.$router.push({name:"view_license",params:{license_id:C==null?void 0:C.id}})},[e("div",zt,[e("div",Wt,[(a(),N(_,{status:C.status,key:C.id},null,8,["status"]))]),e("div",Ht,n(C.activation_count)+" / "+n(C.limit==0?"Unlimited":C.limit),1)])],8,Ft),e("div",Zt,[e("div",{class:"fct-table-product-col",onClick:O=>l.$router.push({name:"view_license",params:{license_id:C==null?void 0:C.id}})},[o(x,{product:C.product,hideProductId:!0,hideViewIcon:!0,hideImage:!0},null,8,["product"])],8,Kt),e("div",Qt,[e("div",Gt,[e("div",Yt,[o(b,{class:"link",to:{name:"view_license",params:{license_id:C==null?void 0:C.id}}},{default:d(()=>[$(n(C.license_key),1)]),_:2},1032,["to"])]),o(L,{class:"cursor-pointer p-1 w-6 h-6",name:"Copy",onClick:()=>{i.Clipboard.copy(C.license_key,{successMessage:i.translate("License Key copied to clipboard"),errorMessage:i.translate("Failed to copy License Key")})}},null,8,["onClick"])])])])]))),128))])])]),_:1})}const Aa=be(Ot,[["render",Jt]]),Xt={class:"fct_edit_customer_popup"},es={key:0,class:"fct-customer-address-business-details"},ts={class:"fct-customer-address-business-details-title"},ss={class:"form-error-wrap"},ls=["innerHTML"],as={class:"dialog-footer"},je=Object.assign({name:"AddOrEditAddressModal"},{__name:"AddOrEditAddressModal",props:["customer_id","modalAction","address","showAddressModal","order_id","customerAddressModalInfos","showSetAsAlsoCheckbox","closing_modal","showBusinessDetailsSection"],emits:["close-modal","update:refresh-address"],setup(l,{emit:t}){const s=l,c=t;T([]);const v=T(!1),i=T({}),_=T(!1),b=T(!1),L=T(!1);T(null);function S(O={}){return{label:"",name:"",email:"",company_name:"",vat_number:"",legal_registration_id:"",phone:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",...O??{}}}const A=T(S(s.address)),x=Ue().ctx,U=Z(()=>{var O;return((O=window.fluentCartAdminApp)==null?void 0:O.business_details)||{}}),P=Z(()=>{var O,u,B,q;return!!s.showBusinessDetailsSection&&((O=s.modalAction)==null?void 0:O.type)==="billing"&&(((u=U.value.company_name)==null?void 0:u.enabled)||((B=U.value.vat_number)==null?void 0:B.enabled)||((q=U.value.legal_registration_id)==null?void 0:q.enabled))});et().onSave(()=>{s.showAddressModal&&["billing","shipping"].includes(s.modalAction.type)&&(s.modalAction.action==="edit"&&x.address.id!==""?j():s.modalAction.action==="create"&&C())});const k=O=>{let u="";for(const B in O){const q=O[B],V=Object.values(q);u+=V+" </br>"}return u},C=()=>{_.value=!0;let O={type:s.modalAction.type,customer_id:s.customer_id,order_id:s.order_id??null},u={...A.value,...O};u.sync=L.value,te.post("customers/"+s.customer_id+"/address",{...u}).then(B=>{c("update:refresh-address",!1,B.data),D.success(B.message),i.value={}}).catch(B=>{var q;B.status_code=="422"?(D.validationErrors(B),i.value=B.data):D.error((q=B.data)==null?void 0:q.message)}).finally(()=>{v.value=!1,_.value=!1})},j=()=>{b.value=!0;let u={...{type:s.modalAction.type,customer_id:s.customer_id,is_primary:s.address.is_primary,id:s.address.id,order_id:s.order_id&&s.address.is_primary==1?s.order_id:null},...A.value};te.put("customers/"+s.customer_id+"/address",{...u}).then(B=>{L.value,c("update:refresh-address",!1,B.data),D.success(B.message),i.value={}}).catch(B=>{var q;B.status_code=="422"?(D.validationErrors(B),i.value=B):D.error((q=B.data)==null?void 0:q.message)}).finally(()=>{v.value=!1,b.value=!1})};return ae(()=>s.closing_modal,(O,u)=>{O&&(i.value={})}),ae(()=>s.address,O=>{A.value=S(O)},{deep:!0,immediate:!0}),ae(()=>s.showAddressModal,O=>{O||(A.value=S({}),i.value={})}),(O,u)=>{const B=M("el-form"),q=M("el-checkbox"),V=M("el-button");return a(),m("div",Xt,[o(B,{"label-position":"top",class:"fct-compact-form","require-asterisk-position":"right"},{default:d(()=>{var Y,oe,se,le,J,X;return[o(H,{label:h(p)("Address Label"),class:Q(i.value.hasOwnProperty("label")?"is-error":""),modelValue:A.value.label,"onUpdate:modelValue":u[0]||(u[0]=R=>A.value.label=R)},null,8,["label","class","modelValue"]),o(H,{label:h(p)("Name"),required:"",class:Q(i.value.hasOwnProperty("name")?"is-error":""),modelValue:A.value.name,"onUpdate:modelValue":u[1]||(u[1]=R=>A.value.name=R)},null,8,["label","class","modelValue"]),o(H,{label:h(p)("Email"),required:"",class:Q(i.value.hasOwnProperty("email")?"is-error":""),modelValue:A.value.email,"onUpdate:modelValue":u[2]||(u[2]=R=>A.value.email=R)},null,8,["label","class","modelValue"]),o(H,{label:h(p)("Phone"),required:"",class:Q(i.value.hasOwnProperty("phone")?"is-error":""),modelValue:A.value.phone,"onUpdate:modelValue":u[3]||(u[3]=R=>A.value.phone=R)},null,8,["label","class","modelValue"]),o(we,{use_additional_address_fields:"",modelValue:A.value,"onUpdate:modelValue":u[4]||(u[4]=R=>A.value=R),validationErrors:i.value},null,8,["modelValue","validationErrors"]),P.value?(a(),m("div",es,[e("h3",ts,n(h(p)("Business Details")),1),(Y=U.value.company_name)!=null&&Y.enabled?(a(),N(H,{key:0,label:h(p)("Company Name"),required:(oe=U.value.company_name)==null?void 0:oe.required,class:Q(i.value.hasOwnProperty("company_name")?"is-error":""),modelValue:A.value.company_name,"onUpdate:modelValue":u[5]||(u[5]=R=>A.value.company_name=R)},null,8,["label","required","class","modelValue"])):y("",!0),(se=U.value.vat_number)!=null&&se.enabled?(a(),N(H,{key:1,label:h(p)("VAT/GST/Tax Number"),required:(le=U.value.vat_number)==null?void 0:le.required,class:Q(i.value.hasOwnProperty("vat_number")?"is-error":""),modelValue:A.value.vat_number,"onUpdate:modelValue":u[6]||(u[6]=R=>A.value.vat_number=R)},null,8,["label","required","class","modelValue"])):y("",!0),(J=U.value.legal_registration_id)!=null&&J.enabled?(a(),N(H,{key:2,label:h(p)("Legal Registration ID"),required:(X=U.value.legal_registration_id)==null?void 0:X.required,class:Q(i.value.hasOwnProperty("legal_registration_id")?"is-error":""),modelValue:A.value.legal_registration_id,"onUpdate:modelValue":u[7]||(u[7]=R=>A.value.legal_registration_id=R)},null,8,["label","required","class","modelValue"])):y("",!0)])):y("",!0)]}),_:1}),e("div",ss,[e("p",{class:"form-error-text",innerHTML:k(i.value)},null,8,ls)]),e("div",as,[(l.showSetAsAlsoCheckbox,y("",!0)),l.address.id?(a(),N(V,{key:1,type:"primary",onClick:u[9]||(u[9]=Y=>j()),loading:b.value,disabled:b.value},{default:d(()=>[$(n(h(p)("Update Address")),1)]),_:1},8,["loading","disabled"])):(a(),N(V,{key:2,type:"primary",onClick:u[10]||(u[10]=Y=>C()),loading:_.value,disabled:_.value},{default:d(()=>[$(n(h(p)("Add Address")),1)]),_:1},8,["loading","disabled"]))])])}}}),os={class:"fct-manage-address-modal"},ns={key:1,class:"fct-manage-address-wrap"},ds=["onClick"],is={class:"fct-address-action absolute top-0 right-0 pt-2"},rs={class:"more-btn"},us={key:0,class:"empty-text"},cs={key:2,class:"edit_address"},ms={key:3,class:"dialog-footer"},ps={name:"ManageAddressModal",props:["showAddressModal","customer_id","modalAction","order_id","showBusinessDetailsSection"],expose:["editAddress"],data(){return{manageAddress:[],address:{},loading:!0,isEditAddress:!1,selectedAddressIndex:null}},computed:{showModal:{get(){return this.showAddressModal},set(l){this.$emit("update:showAddressModal",l)}}},methods:{handleAddressCommand(l){l.action==="edit"?this.editAddress(l.data):l.action==="use"?this.$emit("onAddressSelected",l.data):l.action==="set-as-also"?this.setAsAlso(l.data):l.action==="default"?this.setAddressPrimary(l.data):l.action==="remove"&&this.$confirm(this.$t("Are you sure you want to delete this address?"),this.$t("Warning"),{confirmButtonText:this.$t("Yes, Delete!"),cancelButtonText:this.$t("Cancel"),cancelButtonClass:"el-button--small",confirmButtonClass:"el-button--small",type:"warning"}).then(()=>{this.removeAddress(l.data)}).catch(()=>{})},emitAddNewAddress(l,t=[]){this.$emit("addNewAddress",l,"create",t)},emitAddressSelected(){this.showModal=!1,this.$emit("onAddressSelected",this.manageAddress[this.selectedAddressIndex])},editAddress(l){this.address=l,this.isEditAddress=!0},removeAddress(l){let t=l.id;this.$del("customers/"+this.customer_id+"/address",{address:l}).then(s=>{this.getAddresses(),this.$emit("refresh-address"),this.handleSuccess(s.message),t===this.selectedAddressIndex&&(this.selectedAddressIndex=null)}).catch(s=>{var c;s.status_code=="422"?D.validationErrors(s):D.error((c=s.data)==null?void 0:c.message)}).finally(()=>{this.loading=!1})},setAddressPrimary(l){this.$post("customers/"+this.customer_id+"/address/make-primary",{addressId:l.id,type:l.type}).then(t=>{this.$emit("refresh-address"),this.getAddresses(),this.handleSuccess(t.message)}).catch(t=>{var s;t.status_code=="422"?D.validationErrors(t):D.error((s=t.data)==null?void 0:s.message)}).finally(()=>{this.loading=!1})},getTitle(){return this.modalAction.type==="billing"?this.$t("Manage billing address"):this.$t("Manage shipping address")},fetchAddresses(){this.getAddresses(this.modalAction.type)},getAddresses(l="billing"){this.loading=!0,this.selectedOrders=[],this.$get("customers/"+this.customer_id+"/address",{type:this.modalAction.type}).then(t=>{this.manageAddress=t.addresses}).catch(t=>{this.handleError(t)}).finally(()=>{this.loading=!1})},updateAddress(){this.fetchAddresses(),this.$emit("refresh-address")},setAsAlso(l){const t=this.modalAction.type==="billing"?"shipping":"billing",s={...l,type:t,customer_id:this.customer_id,is_primary:0};delete s.id,delete s.created_at,delete s.updated_at,this.emitAddNewAddress(t,s)}}},_s=Object.assign(ps,{setup(l){return(t,s)=>{const c=M("el-skeleton"),v=M("el-tag"),i=M("el-dropdown-item"),_=M("el-dropdown-menu"),b=M("el-dropdown"),L=M("el-icon"),S=M("el-button"),A=M("el-dialog");return a(),m("div",os,[o(A,{modelValue:t.showModal,"onUpdate:modelValue":s[5]||(s[5]=x=>t.showModal=x),onClose:s[6]||(s[6]=()=>{t.selectedAddressIndex=null,t.isEditAddress=!1}),onOpen:t.fetchAddresses,title:t.getTitle(),"append-to-body":!0,"modal-class":"fct-manage-order-address-modal"},{default:d(()=>[t.loading?(a(),N(c,{key:0,animated:"",rows:4})):y("",!0),!t.loading&&!t.isEditAddress?(a(),m("div",ns,[(a(!0),m(W,null,G(t.manageAddress,(x,U)=>(a(),m("div",{class:"fct-manage-address-block-wrap",key:x.id},[e("div",{class:Q(`cursor-pointer fct-manage-address-block ${x.is_primary==="1"?"default-address":""} ${U===t.selectedAddressIndex?"selected":""} `),onClick:()=>{t.selectedAddressIndex=U}},[x.is_primary==="1"?(a(),N(v,{key:0,type:"info",round:""},{default:d(()=>[$(n(t.$t("Default")),1)]),_:1})):y("",!0),e("p",null,[e("strong",null,n(x.name),1),$(" "+n(t.getOrderAddress(x,"",!0)),1)])],10,ds),e("div",is,[o(b,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:t.handleAddressCommand},{dropdown:d(()=>[o(_,null,{default:d(()=>[o(i,{command:{action:"edit",data:x}},{default:d(()=>[$(n(t.$t("Edit")),1)]),_:2},1032,["command"]),o(i,{command:{action:"use",data:x}},{default:d(()=>[$(n(t.$t("Use this address")),1)]),_:2},1032,["command"]),o(i,{command:{action:"set-as-also",data:x}},{default:d(()=>[$(n(l.modalAction.type==="billing"?t.$t("Copy to Shipping"):t.$t("Copy to Billing")),1)]),_:2},1032,["command"]),x.is_primary!=="1"?(a(),m(W,{key:0},[o(i,{command:{action:"default",data:x}},{default:d(()=>[$(n(t.$t("Set as default")),1)]),_:2},1032,["command"]),o(i,{command:{action:"remove",data:x},class:"item-destructive"},{default:d(()=>[$(n(t.$t("Delete")),1)]),_:2},1032,["command"])],64)):y("",!0)]),_:2},1024)]),default:d(()=>[e("span",rs,[o(F,{name:"More"})])]),_:2},1032,["onCommand"])])]))),128)),t.manageAddress.length==0?(a(),m("div",us,n(l.modalAction.type==="billing"?t.$t("No billing address found."):t.$t("No shipping address found.")),1)):y("",!0)])):y("",!0),t.isEditAddress?(a(),m("div",cs,[o(S,{text:"",onClick:s[0]||(s[0]=()=>t.isEditAddress=!1),style:{"margin-bottom":"16px"}},{default:d(()=>[o(L,null,{default:d(()=>[o(h(Be))]),_:1}),$(" "+n(t.$t("Manage address")),1)]),_:1}),o(je,{"onUpdate:refreshAddress":s[1]||(s[1]=x=>{t.isEditAddress=x,t.updateAddress()}),customer_id:l.customer_id,modalAction:l.modalAction,address:t.address,showAddressModal:t.isEditAddress,order_id:l.order_id,showBusinessDetailsSection:l.showBusinessDetailsSection,onCloseModal:s[2]||(s[2]=x=>t.showModal=!1)},null,8,["customer_id","modalAction","address","showAddressModal","order_id","showBusinessDetailsSection"])])):y("",!0),t.isEditAddress?y("",!0):(a(),m("div",ms,[t.selectedAddressIndex!=null?(a(),N(S,{key:0,onClick:s[3]||(s[3]=x=>t.emitAddressSelected())},{default:d(()=>[o(F,{name:"LocationPin"}),$(" "+n(t.$t("Use this address")),1)]),_:1})):y("",!0),o(S,{onClick:s[4]||(s[4]=x=>t.emitAddNewAddress(l.modalAction.type)),type:"primary"},{default:d(()=>[$(n(t.$t("Add new address")),1)]),_:1})]))]),_:1},8,["modelValue","onOpen","title"])])}}}),fs={class:"fct-term-container"},vs={class:"fct-term-input-wrap"},hs={key:0,class:"fct-term-search-result-button-wrap mb-1.5"},gs={class:"search-text"},ys={key:1,class:"fct-term-search-result-list is-scrollable"},bs=["value","checked","onChange"],Cs={key:2,class:"empty-text"},ws={key:0,class:"fct-term-selected-list"},ks={class:"fct-term-selected"},As={class:"text"},$s={class:"fct-term-list-header"},Ms={class:"fct-term-input-inline-wrap"},Ls={key:0,class:"fct-term-list-header-button-wrap"},xs={class:"search-text"},Is={class:"fct-term-list-wrap is-scrollable"},Vs={key:0,class:"fct-term-list newly-added-list"},Ts={class:"title"},Ss={class:"fct-term-label"},Es=["value","checked","onChange"],Os={key:1,class:"fct-term-list to-add-list"},Us={class:"title"},Ns={class:"fct-term-label"},Bs=["value","checked","onChange"],Ds={key:2,class:"fct-term-list available-list"},Ps={class:"title"},js={class:"fct-term-label"},Rs=["value","checked","onChange"],qs={key:3,class:"empty-text"},Fs={class:"dialog-footer"},Re={__name:"Modal",props:{bindToType:{type:String},bindToId:{type:[String,Number]},selected_labels:{type:Array,default:[]},labelModalIsOpen:{type:Boolean,default:!1},shouldEnableEditing:{type:Boolean,default:!0}},emits:["update:update-label","close-label-modal"],setup(l,{emit:t}){const s=Ue().ctx,c=l,v=t,i=T([]),_=T([]),b=T([]),L=T(),S=T(""),A=T([]),x=T([]),U=T(!1),P=T(!1),g=T(c.labelModalIsOpen),k=T("");ae(()=>c.labelModalIsOpen,f=>{g.value=f,f&&(b.value=[...i.value])});const C=f=>{f.stopPropagation(),f.preventDefault(),O()},j=()=>{s.$get("labels").then(f=>{A.value=f.labels,i.value=c.selected_labels}).catch(f=>{var E;f.status_code=="422"?D.validationErrors(f):D.error((E=f.data)==null?void 0:E.message)}).finally(()=>{})},O=(f="")=>{const E=S.value||k.value;s.$post("labels",{value:E,bind_to_type:c.bindToType,bind_to_id:c.bindToId}).then(r=>{S.value="",k.value="",A.value.push(r.data),f!=="insideModal"?i.value.push(r.data.id):_.value.push(r.data.id),v("update:update-label",i.value)}).catch(r=>{D.error(r)})};ae(S,f=>{f?(f=f.trim(),x.value=A.value.filter(E=>E.value.toLowerCase().includes(f.toLowerCase())),U.value=!0):(x.value=[],U.value=!1)});const u=f=>{const E=i.value.indexOf(f);E===-1?i.value.push(f):i.value.splice(E,1),v("update:update-label",i.value)},B=f=>{const E=b.value.indexOf(f);E===-1?b.value.push(f):b.value.splice(E,1)},q=f=>{const E=_.value.indexOf(f);E===-1?_.value.push(f):_.value.splice(E,1)},V=()=>{i.value=[...b.value,..._.value],_.value=[],v("update:update-label",i.value),R()},Y=f=>{const E=i.value.indexOf(f);E!==-1&&(i.value.splice(E,1),v("update:update-label",i.value))},oe=f=>{U.value&&!L.value.$el.contains(f.target)&&!P.value.contains(f.target)&&(U.value=!1,S.value="")},se=Z(()=>A.value.filter(f=>i.value.includes(f.id))),le=Z(()=>A.value.filter(f=>_.value.includes(f.id))),J=Z(()=>A.value.filter(f=>b.value.includes(f.id)).filter(f=>f.value.toLowerCase().includes(k.value.trim().toLowerCase()))),X=Z(()=>A.value.filter(f=>!b.value.includes(f.id)).filter(f=>!_.value.includes(f.id)).filter(f=>f.value.toLowerCase().includes(k.value.trim().toLowerCase())).sort((f,E)=>f.value.localeCompare(E.value))),R=()=>{v("close-label-modal")},de=Z(()=>{const f=k.value.trim().toLowerCase(),E=S.value.trim().toLowerCase();return(f||E)===""||x.value.some(r=>r.value.toLowerCase()===f||r.value.toLowerCase()===E)||J.value.some(r=>r.value.toLowerCase()===f||r.value.toLowerCase()===E)||X.value.some(r=>r.value.toLowerCase()===f||r.value.toLowerCase()===E)});return ye(()=>{j(),document.addEventListener("click",oe)}),ze(()=>{document.removeEventListener("click",oe)}),(f,E)=>{const r=M("el-input"),w=M("el-button"),z=M("el-dialog");return a(),m("div",fs,[e("div",vs,[l.shouldEnableEditing?(a(),N(r,{key:0,ref_key:"inputRef",ref:L,modelValue:S.value,"onUpdate:modelValue":E[0]||(E[0]=I=>S.value=I),onKeydown:We(C,["enter"])},null,8,["modelValue"])):y("",!0),U.value?(a(),m("div",{key:1,class:"fct-term-search-result",ref_key:"suggestionsRef",ref:P,style:He(S.value==""?"display: none":"")},[S.value!==""&&!de.value?(a(),m("div",hs,[o(w,{type:"info",plain:"",onClick:O,size:"small"},{default:d(()=>[o(F,{name:"PlusCircle"}),$(" "+n(f.$t("Add"))+" ",1),e("span",gs,'"'+n(S.value)+'"',1)]),_:1})])):y("",!0),x.value.length>0?(a(),m("ul",ys,[(a(!0),m(W,null,G(x.value,(I,ee)=>(a(),m("li",{key:ee},[e("label",null,[e("input",{type:"checkbox",value:I.id,checked:i.value.includes(I.id),onChange:ne=>u(I.id)},null,40,bs),$(" "+n(I.value),1)])]))),128))])):y("",!0),x.value.length===0?(a(),m("p",Cs,n(f.$t("No labels found.")),1)):y("",!0)],4)):y("",!0)]),se.value.length>0?(a(),m("ul",ws,[(a(!0),m(W,null,G(se.value,I=>(a(),m("li",{key:I.id},[e("div",ks,[e("div",As,n(I.value),1),l.shouldEnableEditing?(a(),N(F,{key:0,name:"Cross",onClick:ee=>Y(I.id)},null,8,["onClick"])):y("",!0)])]))),128))])):y("",!0),o(z,{"before-close":R,"append-to-body":!0,width:"45%",modelValue:g.value,"onUpdate:modelValue":E[3]||(E[3]=I=>g.value=I),title:f.$t("Add labels"),class:"fct-add-labels-modal"},{default:d(()=>[e("div",$s,[e("div",Ms,[o(r,{modelValue:k.value,"onUpdate:modelValue":E[1]||(E[1]=I=>k.value=I),placeholder:f.$t("Search to find or create labels")},{prefix:d(()=>[o(F,{name:"Search"})]),_:1},8,["modelValue","placeholder"])]),k.value!==""&&!de.value?(a(),m("div",Ls,[o(w,{type:"info",plain:"",onClick:E[2]||(E[2]=I=>O("insideModal")),size:"small"},{default:d(()=>[o(F,{name:"PlusCircle"}),$(" "+n(f.$t("Add"))+" ",1),e("span",xs,'"'+n(k.value)+'"',1)]),_:1})])):y("",!0)]),e("div",Is,[le.value.length>0?(a(),m("ul",Vs,[e("li",Ts,n(f.$t("Newly added")),1),(a(!0),m(W,null,G(le.value,I=>(a(),m("li",{key:I.id},[e("label",Ss,[e("input",{type:"checkbox",value:I.id,checked:_.value.includes(I.id),onChange:ee=>q(I.id)},null,40,Es),$(" "+n(I.value),1)])]))),128))])):y("",!0),J.value.length>0?(a(),m("ul",Os,[e("li",Us,n(f.$t("To add")),1),(a(!0),m(W,null,G(J.value,I=>(a(),m("li",{key:I.id},[e("label",Ns,[e("input",{type:"checkbox",value:I.id,checked:b.value.includes(I.id),onChange:ee=>B(I.id)},null,40,Bs),$(" "+n(I.value),1)])]))),128))])):y("",!0),X.value.length>0?(a(),m("ul",Ds,[e("li",Ps,n(f.$t("Available")),1),(a(!0),m(W,null,G(X.value,I=>(a(),m("li",{key:I.id},[e("label",js,[e("input",{type:"checkbox",value:I.id,checked:b.value.includes(I.id),onChange:ee=>B(I.id)},null,40,Rs),$(" "+n(I.value),1)])]))),128))])):y("",!0),J.value.length===0&&X.value.length===0&&le.value.length===0?(a(),m("p",qs,n(f.$t("No labels found.")),1)):y("",!0)]),e("div",Fs,[o(w,{onClick:R},{default:d(()=>[$(n(f.$t("Cancel")),1)]),_:1}),o(w,{type:"primary",onClick:V},{default:d(()=>[$(n(f.$t("Done")),1)]),_:1})])]),_:1},8,["modelValue","title"])])}}},zs={class:"fct-admin-sidebar-item"},Ws={name:"Labels",components:{IconButton:Ce,LabelModal:Re,DynamicIcon:F},props:{bindToType:{type:String},bindToId:{type:[String,Number]},selectedLabels:{type:Array,default:()=>[]},shouldEnableEditing:{type:Boolean,default:!0}},data(){return{labelModalIsOpen:!1}},mounted(){},methods:{openLabelModal(){this.labelModalIsOpen=!0},updateLabel(l){this.bindToId&&this.bindToType&&this.$post("labels/update-label-selections",{bind_to_type:this.bindToType,bind_to_id:this.bindToId,selectedLabels:l}).then(t=>{D.success(t.message)}).catch(t=>{D.error(t.message)}),this.$emit("update:update-label",l)},closeLabel(){this.labelModalIsOpen=!1}}},$a=Object.assign(Ws,{setup(l){return(t,s)=>(a(),N(Ne,{permission:"labels/manage"},{default:d(()=>[e("div",null,[o(fe,null,{default:d(()=>[o(ve,{title:t.$t("Labels"),border_bottom:"",title_size:"small"},{action:d(()=>[l.shouldEnableEditing?(a(),N(Ce,{key:0,size:"x-small",bg:"transparent",tag:"button",border:"transparent",onClick:t.openLabelModal},{default:d(()=>[o(F,{name:"Edit"})]),_:1},8,["onClick"])):y("",!0)]),_:1},8,["title"]),o(he,null,{default:d(()=>[e("div",zs,[o(Re,{bindToType:l.bindToType,bindToId:l.bindToId,labelModalIsOpen:t.labelModalIsOpen,selected_labels:l.selectedLabels,shouldEnableEditing:l.shouldEnableEditing,"onUpdate:updateLabel":t.updateLabel,onCloseLabelModal:s[0]||(s[0]=c=>t.labelModalIsOpen=!1)},null,8,["bindToType","bindToId","labelModalIsOpen","selected_labels","shouldEnableEditing","onUpdate:updateLabel"])])]),_:1})]),_:1})])]),_:1}))}}),Hs={class:"fct-customer-edit-modal"},Zs={key:1,class:"fct-form-group"},Ks={class:"label"},Qs={style:{display:"flex","align-items":"center",gap:"10px"}},Gs={class:"select-use-option"},Ys={class:"fct-compact-form"},Js={class:"form-heading"},Xs={class:"fct-compact-form fct-customer-address-section"},el={style:{"margin-top":"20px"}},tl={class:"form-error-wrap"},sl={class:"form-error-text"},ll={class:"dialog-footer"},al={key:3,class:"dialog-footer"},ol={__name:"ChangeOrderCustomer",props:{orderId:{type:[String,Number],default:null,required:!0}},setup(l){const t=l,s=T(null),c=T([]),v=T(!1),i=T(!1),_=T({}),b=T({id:"",email:"",full_name:"",state:"",city:"",country:"",postcode:"",country_name:"",contact_id:"",user_id:"",wp_user:""}),L=P=>{if(!P){c.value=[];return}te.get("customers/",{search:P}).then(g=>{c.value=g.customers.data}).finally(()=>{})},S=()=>{if(!s.value){D.error(p("Please select a customer"));return}te.post("orders/"+t.orderId+"/change-customer",{customer_id:s.value}).then(P=>{D.success(P.message),setTimeout(()=>{window.location.reload()},300)}).catch(P=>{if(P.message)return D.error(P.message)}).finally(()=>{})},A=()=>{te.post("orders/"+t.orderId+"/create-and-change-customer",b.value).then(P=>{D.success(P.message),setTimeout(()=>{window.location.reload()},300),_.value={},i.value=!1}).catch(P=>{if(P.message)return D.error(P.message);_.value=P}).finally(()=>{})},x=()=>{i.value=!0},U=()=>{i.value=!1};return(P,g)=>{const k=M("el-button"),C=M("el-option"),j=M("el-select"),O=M("el-checkbox");return a(),m("div",Hs,[i.value?(a(),m("div",{key:0,onClick:U,style:{"margin-bottom":"10px"}},[o(k,{text:"",style:{"margin-top":"0"}},{default:d(()=>[o(F,{name:"ArrowLeft"}),$(" "+n(h(p)("Back")),1)]),_:1})])):y("",!0),i.value?y("",!0):(a(),m("div",Zs,[e("label",Ks,[$(n(h(p)("Select Customer"))+" ",1),o(k,{text:"",class:"fct-create-customer-btn",onClick:Oe(x,["prevent"])},{default:d(()=>[o(F,{name:"Plus"}),$(" "+n(h(p)("Add New Customer")),1)]),_:1})]),e("div",Qs,[o(j,{modelValue:s.value,"onUpdate:modelValue":g[0]||(g[0]=u=>s.value=u),remote:!0,"remote-method":L,loading:v.value,filterable:"",clearable:"",placeholder:h(p)("Type to search user"),style:{width:"100%"}},{default:d(()=>[(a(!0),m(W,null,G(c.value,u=>(a(),N(C,{key:u.id,label:u.full_name,value:u.id},{default:d(()=>[e("div",Gs,[e("span",null,n(u.full_name),1),e("span",null,n(u.email),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","loading","placeholder"])])])),i.value?(a(),m(W,{key:2},[e("div",Ys,[o(H,{label:h(p)("Full Name"),modelValue:b.value.full_name,"onUpdate:modelValue":g[1]||(g[1]=u=>b.value.full_name=u)},null,8,["label","modelValue"]),o(H,{label:h(p)("Email"),modelValue:b.value.email,"onUpdate:modelValue":g[2]||(g[2]=u=>b.value.email=u)},null,8,["label","modelValue"])]),e("h4",Js,n(h(p)("Address")),1),e("div",Xs,[o(we,{modelValue:b.value,"onUpdate:modelValue":g[3]||(g[3]=u=>b.value=u)},null,8,["modelValue"]),e("div",el,[o(O,{"true-value":"yes","false-value":"no",modelValue:b.value.wp_user,"onUpdate:modelValue":g[4]||(g[4]=u=>b.value.wp_user=u)},{default:d(()=>[o(De,{title:h(p)("Create as wordpress user"),content:h(p)("We will create a new user for this customer. If a user with the same email already exists, we will associate the customer with that existing user.")},null,8,["title","content"])]),_:1},8,["modelValue"])]),e("div",tl,[(a(!0),m(W,null,G(_.value,u=>(a(),m("p",sl,n(u.required),1))),256))])]),e("div",ll,[o(k,{onClick:g[5]||(g[5]=u=>P.$emit("close"))},{default:d(()=>[$(n(h(p)("Cancel")),1)]),_:1}),o(k,{type:"primary",onClick:A},{default:d(()=>[$(n(h(p)("Create & Attach Customer")),1)]),_:1})])],64)):y("",!0),i.value?y("",!0):(a(),m("div",al,[o(k,{type:"primary",onClick:S},{default:d(()=>[$(n(h(p)("Create & Attach Customer")),1)]),_:1})]))])}}},nl={class:"fct-admin-sidebar"},dl={class:"more-btn"},il={key:0,class:"fct-admin-sidebar-item"},rl={class:"name"},ul={class:"email"},cl={class:"fct-admin-sidebar-item"},ml={class:"fct-profile-card"},pl=["src","alt"],_l={key:0,class:"fct-profile-details"},fl={class:"title"},vl={class:"text"},hl={key:0},gl={class:"text"},yl={key:0,class:"user-info mt-2"},bl=["href"],Cl={class:"fct-admin-sidebar-item mt-5"},wl={class:"fct-contact-info-list"},kl={class:"flex items-center justify-between gap-2"},Al=["href"],$l={class:"fct-admin-sidebar-item mt-5"},Ml={class:"sidebar-title"},Ll={key:0,class:"fct-address-copy-wrap"},xl={class:"text"},Il={key:0,class:"pr-1"},Vl=["innerHTML"],Tl={key:1,class:"mt-3"},Sl={class:"pr-1"},El=["href"],Ol={key:1,class:"no-address-text"},Ul={class:"fct-admin-sidebar-item mt-5"},Nl={class:"sidebar-title"},Bl={key:0,class:"fct-address-copy-wrap"},Dl={class:"text"},Pl={key:0},jl=["innerHTML"],Rl={key:1,class:"mt-3"},ql={class:"pr-1"},Fl=["href"],zl={key:1,class:"no-address-text"},Wl={class:"fct-admin-sidebar-item"},Hl={class:"flex flex-col gap-2"},Zl={key:0,class:"flex items-baseline gap-1"},Kl={class:"shrink-0"},Ql={key:1,class:"flex items-baseline gap-1"},Gl={class:"shrink-0"},Yl={key:2,class:"flex items-baseline gap-1"},Jl={class:"shrink-0"},Xl={class:"flex items-baseline gap-1"},ea={class:"shrink-0"},ta={key:3},sa={class:"block"},la={class:"fluent-cart-admin-pages"},Ma={__name:"OrderCustomerInformation",props:{order:{type:Object,default:null},subscription:{type:Object,default:null},shouldEnableEditing:{type:Boolean,default:!0}},emits:["onAddressSelected","onAddressRemove","onOrderUpdated"],setup(l,{emit:t}){var R,de,f,E;const s=l,c=Z(()=>s.order||s.subscription||{}),v=Z(()=>s.order?s.order.id:s.subscription?s.subscription.parent_order_id:null),i=T([]),_=T((de=(R=c.value)==null?void 0:R.customer)!=null&&de.id?c.value.customer:null),b=T((f=c.value)!=null&&f.billing_address?c.value.billing_address:null),L=T((E=c.value)!=null&&E.shipping_address?c.value.shipping_address:null),S=t,A=T(!1),x=r=>{r==="remove_customer"&&U(),r==="change_customer"?A.value=!0:r==="edit_customer"?B("edit"):r==="manage_billing_address"?Y("billing"):r==="manage_shipping_address"&&Y("shipping")},U=()=>{c.value.customer_id="",c.value.customer={},_.value=null,b.value=null,L.value=null,S("onAddressRemove"),setTimeout(()=>{se()},50)},P=(r,w)=>{te.get("customers/",{search:r,with:["shipping_address","billing_address"]}).then(z=>{let I=z.customers.data;i.value=I;let ee=I.map(ue=>({id:ue.id,value:ue.full_name,email:ue.email})),ne=jQuery(".fct-customer-autocomplete-dropdown"),ie=jQuery(".el-autocomplete-suggestion__list"),re="empty-text";I.length<1?ne.length>0&&(ne.addClass("is-empty-customer"),ie.children(`.${re}`).length||ie.prepend(`<li class="${re}">No customer found.</li>`)):ne.length>0&&(ne.removeClass("is-empty-customer"),ie.children(`.${re}`).remove()),w(ee)}).catch(z=>{D.error(z)})},g=r=>{const w=i.value.find(z=>z.id===r.id)??null;k(w)},k=r=>{_.value=r,c.value.customer=r,c.value.customer_id=r.id,_.value!==null&&(C(),j())},C=()=>{const r=_.value.billing_address;r&&(Array.isArray(r)&&r.length>0?(b.value=r[0],b.value=r.find(w=>w.is_primary.toString()==="1")??b.value):b.value=null,S("onAddressSelected",b.value))},j=()=>{const r=_.value.shipping_address;r&&(Array.isArray(r)&&r.length>0?(L.value=r[0],L.value=r.find(w=>w.is_primary.toString()==="1")??L.value):L.value=null,S("onAddressSelected",L.value))},O=r=>{if(r){if(!v.value){r.type==="shipping"?L.value=r:b.value=r,V.value.showModal=!1,S("onAddressSelected",r);return}te.post(`orders/${v.value}/update-address-id`,{address_id:r.id,address_type:r.type}).then(w=>{D.success(w.message),r.type==="shipping"?L.value=r:b.value=r,V.value.showModal=!1,S("onAddressSelected",r),w.order&&S("onOrderUpdated",w.order)}).catch(w=>{D.error(w)})}},u=T({showModal:!1,action:"create",title:p("Create New Customer"),customer:{},manageWpUser:"yes"}),B=(r="create")=>{const w=u.value;w.showModal=!0,w.action=r==="create"?"create":"edit",w.title=r==="create"?p("Create New Customer"):p("Edit Customer Information"),w.customer_id=r==="create"?null:_.value.id,w.customer=r==="create"?{}:_.value,w.manageWpUser=r==="create"?"yes":_.value.user_id==="0"?"no":"yes",u.value=w},q=T(!0),V=T({showManageAddressModal:!1,showModal:!1,modalAction:{type:"billing",action:"create"},title:"",customer_id:"",address_id:"",address:{},address_mock:{name:"",phone:"",email:"",company_name:"",vat_number:"",legal_registration_id:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",is_primary:"0"}}),Y=(r="billing",w="edit")=>{V.value.showManageAddressModal=!0,V.value.modalAction.type=r,V.value.modalAction.action=w},oe=(r="billing",w="create",z={})=>{Object.keys(z).length>0?(V.value.address={...z},q.value=!1):V.value.address={...V.value.address_mock},V.value.showModal=!0,V.value.modalAction.type=r,V.value.modalAction.action=w,V.value.showManageAddressModal=!1},se=()=>{let r=jQuery(".el-autocomplete-suggestion__wrap");if(r.length>0){let w=jQuery('<div class="fct-create-customer-button-wrap"><button class="el-button el-button--info el-button--small is-plain"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none"><path d="M1.5 7H12.5M7 1.5V12.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg> Create a new customer</button></div>').on("click",()=>{B()});r.prepend(w)}},le=()=>V.value.modalAction.action==="create"?V.value.modalAction.type==="billing"?p("Add new billing address"):p("Add new shipping Address"):V.value.modalAction.type==="billing"?p("Edit billing address"):p("Edit shipping address"),J=(r,w)=>{V.value.modalAction.type==="billing"?b.value=w:L.value=w,V.value.showModal=r,V.value.showManageAddressModal=!0,O(w)},X=Z(()=>{const r=c.value&&c.value.business_info;return r?!!(r.company_name||r.tax_number||r.legal_registration_id):!1});return ae(()=>c.value,(r,w)=>{r.customer_id!==w.customer_id&&U()}),ye(()=>{se()}),(r,w)=>{var Ae;const z=M("el-dropdown-item"),I=M("el-dropdown-menu"),ee=M("el-dropdown"),ne=M("el-autocomplete"),ie=M("router-link"),re=M("el-icon"),ue=M("el-button"),ke=M("el-dialog");return a(),m(W,null,[e("div",nl,[o(fe,null,{default:d(()=>[o(ve,{title:h(p)("Customer Information"),title_size:"small",border_bottom:""},{action:d(()=>[_.value&&l.shouldEnableEditing?(a(),N(ee,{key:0,trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:x},{dropdown:d(()=>[o(I,null,{default:d(()=>[o(z,{command:"edit_customer"},{default:d(()=>[$(n(h(p)("Edit customer information")),1)]),_:1}),o(z,{command:"manage_shipping_address"},{default:d(()=>[$(n(h(p)("Manage shipping address")),1)]),_:1}),o(z,{command:"manage_billing_address"},{default:d(()=>[$(n(h(p)("Manage billing address")),1)]),_:1}),v.value?(a(),N(z,{key:0,command:"change_customer"},{default:d(()=>[$(n(h(p)("Change customer")),1)]),_:1})):y("",!0),v.value?y("",!0):(a(),N(z,{key:1,command:"remove_customer"},{default:d(()=>[$(n(h(p)("Remove customer")),1)]),_:1}))]),_:1})]),default:d(()=>[e("span",dl,[o(F,{name:"More"})])]),_:1})):y("",!0)]),_:1},8,["title"]),o(he,null,{default:d(()=>{var K,$e,Me,Le,xe,Ie,Ve,Te,Se;return[_.value===null?(a(),m("div",il,[o(ne,{"popper-class":"fct-customer-autocomplete-dropdown",clearable:"",modelValue:c.value.customer.full_name,"onUpdate:modelValue":w[0]||(w[0]=ce=>c.value.customer.full_name=ce),"fetch-suggestions":P,placeholder:h(p)("Search or create a customer"),disabled:!1,onSelect:g},{prefix:d(()=>[o(F,{name:"Search"})]),default:d(ce=>[e("span",rl,n(ce.item.value),1),e("span",ul,n(ce.item.email),1)]),_:1},8,["modelValue","placeholder"])])):(a(),m(W,{key:1},[e("div",cl,[e("div",ml,[e("div",{class:"fct-profile-image cursor-pointer",onClick:w[1]||(w[1]=ce=>r.$router.push({name:"view_customer",params:{customer_id:_.value.id}}))},[e("img",{src:_.value.photo,alt:(K=_.value)==null?void 0:K.full_name},null,8,pl)]),_.value.id?(a(),m("div",_l,[e("div",fl,[o(ie,{to:{name:"view_customer",params:{customer_id:_.value.id}}},{default:d(()=>[$(n(_.value.full_name),1)]),_:1},8,["to"])]),e("span",vl,[_.value.purchase_count>0?(a(),m("span",hl,n(h(pe)(_.value.purchase_count)),1)):y("",!0),$(" "+n(r.$n("Order","Orders",_.value.purchase_count??0,"No Order")),1)]),e("span",gl,n(h(tt)(($e=_.value)==null?void 0:$e.ltv,!0))+" "+n(h(p)("Lifetime Value")),1)])):y("",!0)]),c.value.customer.user_link?(a(),m("div",yl,[$(n(h(p)("WP User:"))+" ",1),e("a",{href:c.value.customer.user_link,target:"_blank",class:"inline-flex items-center gap-1 dark:text-gray-100 text-primary-500 focus:shadow-none hover:!underline"},[$(" #"+n(h(pe)(c.value.customer.user_id))+" ",1),o(F,{name:"Redirect",class:"w-2.5 h-2.5 text-primary-500 dark:text-gray-200"})],8,bl)])):y("",!0)]),e("div",Cl,[e("ul",wl,[e("li",null,[e("div",kl,[e("a",{class:"text",href:"mailto:"+((Me=c.value.customer)==null?void 0:Me.email)},n(_.value.email),9,Al),o(me,{text:_.value.email,showMode:"basic_copy_btn",tooltipText:h(p)("Copy email")},null,8,["text","tooltipText"])])])])]),e("div",$l,[e("h4",Ml,n(h(p)("Shipping Address")),1),L.value!=null?(a(),m("div",Ll,[e("span",xl,[L.value.name?(a(),m("strong",Il,n(L.value.name),1)):y("",!0),e("span",{class:"break-all",innerHTML:r.getOrderAddress({...L.value},"shipping",!0)},null,8,Vl),(Ie=(xe=(Le=L.value)==null?void 0:Le.meta)==null?void 0:xe.other_data)!=null&&Ie.phone?(a(),m("span",Tl,[e("strong",Sl,n(h(p)("Phone"))+":",1),e("a",{href:"tel:"+L.value.meta.other_data.phone,class:"text-system-mid dark:text-gray-50 hover:underline"},n(L.value.meta.other_data.phone),9,El)])):y("",!0)]),o(me,{text:r.getOrderAddress({...L.value},"shipping"),showMode:"basic_copy_btn",tooltipText:h(p)("Copy address")},null,8,["text","tooltipText"])])):(a(),m("p",Ol,n(h(p)("No shipping address provided")),1))]),e("div",Ul,[e("h4",Nl,n(h(p)("Billing Address")),1),b.value!=null?(a(),m("div",Bl,[e("div",Dl,[b.value.name?(a(),m("strong",Pl,n(b.value.name),1)):y("",!0),e("span",{class:"break-all",innerHTML:r.getOrderAddress({...b.value},"billing",!0)},null,8,jl),(Se=(Te=(Ve=b.value)==null?void 0:Ve.meta)==null?void 0:Te.other_data)!=null&&Se.phone?(a(),m("span",Rl,[e("strong",ql,n(h(p)("Phone"))+":",1),e("a",{href:"tel:"+b.value.meta.other_data.phone,class:"text-system-mid dark:text-gray-50 hover:underline"},n(b.value.meta.other_data.phone),9,Fl)])):y("",!0)]),o(me,{text:r.getOrderAddress({...b.value},"billing"),showMode:"basic_copy_btn",tooltipText:h(p)("Copy address")},null,8,["text","tooltipText"])])):(a(),m("p",zl,n(h(p)("No shipping address provided")),1))])],64))]}),_:1})]),_:1}),X.value?(a(),N(fe,{key:0,class:"mt-4"},{default:d(()=>[o(ve,{title:h(p)("Business Information"),title_size:"small",border_bottom:""},null,8,["title"]),o(he,null,{default:d(()=>[e("div",Wl,[e("div",Hl,[c.value.business_info.company_name?(a(),m("div",Zl,[e("strong",Kl,n(h(p)("Company"))+":",1),e("span",null,n(c.value.business_info.company_name),1)])):y("",!0),c.value.business_info.tax_number?(a(),m("div",Ql,[e("strong",Gl,n(h(p)("VAT/Tax ID"))+":",1),e("span",null,n(c.value.business_info.tax_number),1)])):y("",!0),c.value.business_info.legal_registration_id?(a(),m("div",Yl,[e("strong",Jl,n(h(p)("Reg. ID"))+":",1),e("span",null,n(c.value.business_info.legal_registration_id),1)])):y("",!0),e("div",Xl,[e("strong",ea,n(h(p)("Charge Reversed"))+":",1),e("span",null,n(c.value.is_reverse_charge_tax_order?h(p)("Yes"):h(p)("No")),1)]),c.value.business_info.reverse_charge_declaration?(a(),m("div",ta,[e("strong",sa,n(h(p)("Reverse Charge Declaration"))+":",1),e("span",null,n(c.value.business_info.reverse_charge_declaration),1)])):y("",!0)])])]),_:1})]),_:1})):y("",!0)]),o(rt,{onSelectNewCustomer:w[2]||(w[2]=K=>{k(K),u.value.showModal=!1}),customerModalInfos:u.value,customer_id:u.value.customer_id,customer:u.value.customer,onCloseModal:w[3]||(w[3]=K=>u.value.showModal=!1)},null,8,["customerModalInfos","customer_id","customer"]),o(_s,{modalAction:V.value.modalAction,onOnAddressSelected:O,"onUpdate:showAddressModal":w[4]||(w[4]=K=>V.value.showManageAddressModal=K),showAddressModal:V.value.showManageAddressModal,customer_id:(Ae=_.value)==null?void 0:Ae.id,order_id:v.value,showBusinessDetailsSection:!0,onAddNewAddress:oe},null,8,["modalAction","showAddressModal","customer_id","order_id"]),o(ke,{"show-close":!0,modelValue:V.value.showModal,"onUpdate:modelValue":w[7]||(w[7]=K=>V.value.showModal=K),"append-to-body":!0,title:le()},{default:d(()=>[e("div",la,[o(ue,{text:"",onClick:w[5]||(w[5]=()=>{V.value.showManageAddressModal=!0,V.value.showModal=!1}),class:"mb-4"},{default:d(()=>[o(re,null,{default:d(()=>[o(h(Be))]),_:1}),$(" "+n(r.$t("Manage address")),1)]),_:1}),o(je,{"onUpdate:refreshAddress":J,customerAddressModalInfos:V.value,customer_id:_.value.id,modalAction:V.value.modalAction,address:V.value.address,showAddressModal:V.value.showModal,showSetAsAlsoCheckbox:q.value,showBusinessDetailsSection:!0,order_id:v.value,onCloseModal:w[6]||(w[6]=()=>{V.value.showModal=!1,V.value.showManageAddressModal=!0})},null,8,["customerAddressModalInfos","customer_id","modalAction","address","showAddressModal","showSetAsAlsoCheckbox","order_id"])])]),_:1},8,["modelValue","title"]),v.value?(a(),N(ke,{key:0,modelValue:A.value,"onUpdate:modelValue":w[9]||(w[9]=K=>A.value=K),title:r.$t("Change Customer")},{default:d(()=>[o(ol,{"order-id":v.value,onClose:w[8]||(w[8]=K=>A.value=!1)},null,8,["order-id"])]),_:1},8,["modelValue","title"])):y("",!0)],64)}}};export{Pe as C,Aa as L,ka as O,Et as P,rt as _,me as a,je as b,_s as c,$a as d,Ma as e,ol as f}; | |
| 1 | +var We=Object.defineProperty;var Je=(e,l,t)=>l in e?We(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t;var Oe=(e,l,t)=>Je(e,typeof l!="symbol"?l+"":l,t);import{h as E,l as z,v as ce,i as Se,r as M,c as B,o as a,w as d,d as s,e as m,a as r,u as c,n as X,F as Y,t as o,b as g,g as ae,f as L,q as Me,M as Ue,k as Be,z as Ke,G as He}from"./vue.esm-bundler.js?ver=1.6.6";import{e as Ze,E as Qe,f as De}from"./index.js?ver=1.6.6";import{t as n,A as Ye,a as Ce}from"./Translator.js?ver=1.6.6";import{_ as Ge}from"./Animation.js?ver=1.6.6";import{P as Xe,B as et}from"./Badge.js?ver=1.6.6";import{R as ie}from"./Rest.js?ver=1.6.6";import{n as W}from"./Notify.js?ver=1.6.6";import{_ as Le}from"./_plugin-vue_export-helper.js?ver=1.6.6";import{_ as tt}from"./Empty.js?ver=1.6.6";import{b as st}from"./common.js?ver=1.6.6";import{I as Ee}from"./IconButton.js?ver=1.6.6";import{_ as ee}from"./DynamicIcon.js?ver=1.6.6";import{_ as lt,C as ke,a as xe,b as Ae}from"./CardBody.js?ver=1.6.6";import{_ as je}from"./UserCan.js?ver=1.6.6";import{A as at}from"./Arr.js?ver=1.6.6";import{A as ot}from"./Asset.js?ver=1.6.6";import{_ as le,a as Ve}from"./AddressComponent2.js?ver=1.6.6";import{L as Fe,u as nt}from"./NotFound.js?ver=1.6.6";import{f as rt}from"./productService.js?ver=1.6.6";const it={class:"fct-customer-edit-modal"},dt={class:"fct-compact-form"},ut={class:"form-heading"},ct={class:"fct-compact-form fct-customer-address-section"},mt={key:0,class:"mt-5"},pt={key:1,class:"form-error-wrap"},ft={class:"dialog-footer"},vt={__name:"NewCustomerModal",props:{customer_id:{type:[String,Number],default:null},customer:{type:Object,default:()=>({})},customerModalInfos:{type:Object,default:()=>({})}},emits:["close-modal","select-new-customer","update:customerModal"],setup(e,{emit:l}){const t=l,u=e,v=E({}),i=E(!1),p=E({}),w=window.fluentCartAdminApp,x=()=>{t("close-modal")},T=()=>{i.value=!0,v.value.wp_user=u.customerModalInfos.manageWpUser,ie.post("customers/",{...v.value}).then(y=>{t("select-new-customer",y.data),t("update:customerModal",!1),W.success(y.message),p.value={}}).catch(y=>{var _;y.status_code=="422"?(W.validationErrors(y),p.value=y.data):W.error((_=y.data)==null?void 0:_.message)}).finally(()=>{i.value=!1})},k=()=>{i.value=!0,v.value.wp_user=u.customerModalInfos.manageWpUser,ie.put("customers/"+u.customer_id,{...v.value}).then(y=>{t("select-new-customer",y.data),t("update:customerModal",!1),W.success(y.message),p.value={}}).catch(y=>{var _;y.status_code=="422"?(W.validationErrors(y),p.value=y.data):W.error((_=y.data)==null?void 0:_.message)}).finally(()=>{i.value=!1})},I=z(()=>u.customerModalInfos.action==="create"?n("Create as wordpress user"):n("Update wordpress user profile")),$=z(()=>u.customerModalInfos.action==="edit"?n("Update Customer"):n("Create Customer")),q=z(()=>{const y={};for(const _ in p.value){const b=p.value[_];y[_]=Array.isArray(b)?b:Object.values(b)}return y});return ce(()=>u.customer,y=>{v.value={id:y.id,email:y.email,full_name:y.full_name,first_name:y.first_name,last_name:y.last_name,state:y.state,city:y.city,country:y.country,postcode:y.postcode,country_name:y.country_name,contact_id:y.contact_id,user_id:y.user_id,wp_user:y.wp_user}},{deep:!0}),Se(()=>{v.value={id:u.customer.id,email:u.customer.email,full_name:u.customer.full_name,first_name:u.customer.first_name,last_name:u.customer.last_name,state:u.customer.state,city:u.customer.city,country:u.customer.country,postcode:u.customer.postcode,country_name:u.customer.country_name,contact_id:u.customer.contact_id,user_id:u.customer.user_id,wp_user:u.customer.wp_user}}),(y,_)=>{const b=M("el-checkbox"),j=M("el-button"),U=M("el-dialog");return a(),B(U,{modelValue:e.customerModalInfos.showModal,"onUpdate:modelValue":_[8]||(_[8]=C=>e.customerModalInfos.showModal=C),title:e.customerModalInfos.title,onClose:_[9]||(_[9]=()=>{p.value={}})},{default:d(()=>[s("div",it,[s("div",dt,[c(w).is_full_name_required?(a(),B(le,{key:0,label:c(n)("Full Name *"),modelValue:v.value.full_name,"onUpdate:modelValue":_[0]||(_[0]=C=>v.value.full_name=C),class:X(p.value.full_name?"is-error":"")},null,8,["label","modelValue","class"])):(a(),m(Y,{key:1},[r(le,{label:c(n)("First Name *"),modelValue:v.value.first_name,"onUpdate:modelValue":_[1]||(_[1]=C=>v.value.first_name=C),class:X(p.value.first_name?"is-error":"")},null,8,["label","modelValue","class"]),r(le,{label:c(n)("Last Name"),modelValue:v.value.last_name,"onUpdate:modelValue":_[2]||(_[2]=C=>v.value.last_name=C),class:X(p.value.last_name?"is-error":"")},null,8,["label","modelValue","class"])],64)),r(le,{type:"email",label:c(n)("Email *"),modelValue:v.value.email,"onUpdate:modelValue":_[3]||(_[3]=C=>v.value.email=C),disabled:e.customer.user_id&&e.customer.user_id!=0,class:X(p.value.email?"is-error":"")},null,8,["label","modelValue","disabled","class"])]),s("h4",ut,o(c(n)("Address")),1),s("div",ct,[r(Ve,{modelValue:v.value,"onUpdate:modelValue":_[4]||(_[4]=C=>v.value=C),validationErrors:p.value},null,8,["modelValue","validationErrors"]),e.customerModalInfos.action==="create"?(a(),m("div",mt,[r(b,{"true-value":"yes","false-value":"no",modelValue:e.customerModalInfos.manageWpUser,"onUpdate:modelValue":_[5]||(_[5]=C=>e.customerModalInfos.manageWpUser=C)},{default:d(()=>[r(Fe,{title:I.value,content:c(n)("We will create a new user for this customer. If a user with the same email already exists, we will associate the customer with that existing user.")},null,8,["title","content"])]),_:1},8,["modelValue"])])):g("",!0),Object.keys(p.value).length?(a(),m("div",pt,[(a(!0),m(Y,null,ae(q.value,(C,S)=>(a(),m("p",{key:S},[(a(!0),m(Y,null,ae(C,Q=>(a(),m("span",{key:Q},o(Q),1))),128))]))),128))])):g("",!0)]),s("div",ft,[r(j,{onClick:x},{default:d(()=>[L(o(c(n)("Cancel")),1)]),_:1}),e.customerModalInfos.action==="edit"?(a(),B(j,{key:0,loading:i.value,type:"primary",onClick:_[6]||(_[6]=C=>k())},{default:d(()=>[L(o($.value),1)]),_:1},8,["loading"])):(a(),B(j,{key:1,type:"primary",loading:i.value,onClick:_[7]||(_[7]=C=>T())},{default:d(()=>[L(o($.value),1)]),_:1},8,["loading"]))])])]),_:1},8,["modelValue","title"])}}},_t={key:1,class:"fct-export-loading"},ht={class:"fct-export-loading-grid"},gt={key:3,class:"fct-export-dialog-content"},yt={class:"fct-export-section"},bt={class:"fct-export-section-heading"},Ct={class:"fct-export-label"},wt={class:"fct-export-section-hint"},kt={class:"fct-export-section"},xt={class:"fct-export-section-heading"},At={class:"fct-export-label"},$t={class:"fct-export-format-options"},St=["aria-pressed","onClick"],Mt={class:"fct-export-format-name"},Lt={class:"fct-export-format-description"},Et={key:0,class:"fct-export-section fct-csv-columns-section"},Vt={class:"fct-export-selection-heading"},It={class:"fct-export-selection-heading-left"},Tt={class:"fct-export-label"},Ot={class:"fct-export-selection-count"},Pt={class:"fct-export-columns-wrap"},Nt={class:"fct-export-columns-grid"},Ut={key:1,class:"fct-export-section fct-json-modules-section"},Bt={class:"fct-export-selection-heading"},Dt={class:"fct-export-selection-heading-left"},jt={class:"fct-export-label"},Ft={class:"fct-export-selection-count"},Rt={class:"fct-export-modules"},qt=["onClick"],zt={key:0,class:"fct-export-required"},Wt={class:"fct-export-memory-note"},Jt={key:4,class:"fct-export-progress-section",role:"status","aria-live":"polite"},Kt={class:"fct-export-progress-title"},Ht={class:"fct-export-progress-meta"},Zt={class:"fct-export-progress-text"},Qt={class:"fct-export-progress-percentage"},Yt={class:"fct-export-progress-note"},Gt={key:5,class:"fct-export-error-section"},Xt={key:6,class:"fct-export-complete-section"},es={class:"dialog-footer"},bo=Object.assign({name:"ExportDialog"},{__name:"ExportDialog",props:{modelValue:{type:Boolean,default:!1},title:{type:String,default:""},selectedCount:{type:Number,default:0},currentPageCount:{type:Number,default:0},totalCount:{type:Number,default:0},itemLabelSingular:{type:String,default:""},itemLabelPlural:{type:String,default:""},hasActiveFilter:{type:Boolean,default:!1},exportState:{type:Object,required:!0}},emits:["update:modelValue","export"],setup(e,{emit:l}){const t=e,u=l,v=E("current_page"),i=E("csv"),p=E(new Set),w=E(new Set),x=z({get(){return t.modelValue},set(F){u("update:modelValue",F)}}),T=z(()=>t.exportState.schema.value||{formats:[],csv_columns:[],json_modules:[]}),k=z(()=>T.value.formats||[]),I=z(()=>T.value.csv_columns||[]),$=z(()=>T.value.json_modules||[]),q=z(()=>p.value.size),y=z(()=>w.value.size),_=z(()=>I.value.length>0&&q.value===I.value.length),b=z(()=>q.value>0&&!_.value),j=z(()=>i.value==="csv"),U=z(()=>i.value==="json"),C=z(()=>t.exportState.isProActive&&!t.exportState.isSchemaLoading.value&&T.value.entity&&!t.exportState.isExporting.value&&!t.exportState.isComplete.value&&!t.exportState.hasError.value),S=z(()=>j.value?q.value===0:y.value===0),Q=z(()=>{const F=v.value==="current_page"&&!t.currentPageCount||v.value==="selected"&&!t.selectedCount||v.value==="search_results"&&!se.value;return t.exportState.isExporting.value||S.value||F}),P=z(()=>t.itemLabelSingular||n("item")),te=z(()=>t.itemLabelPlural||n("items")),se=z(()=>t.hasActiveFilter?t.totalCount:0),O=z(()=>typeof window.showSaveFilePicker=="function"),K=F=>F===1?P.value:te.value,Z=z(()=>{const F=n("All %s",te.value);return t.hasActiveFilter?n("%1$s (%2$s)",F,n("filter applied")):F}),D=z(()=>n("%1$s %2$s matching the current view",se.value,K(se.value))),H=F=>F.value==="json"?n("JSON preserves selected database modules and their related rows."):n("CSV creates one row per record and works well in spreadsheet apps."),de=()=>{var F;i.value=((F=k.value[0])==null?void 0:F.value)||"csv",p.value=new Set(I.value.filter(R=>R.default_selected).map(R=>R.key)),w.value=new Set($.value.filter(R=>R.default_selected||R.required).map(R=>R.key))},h=F=>{const R=new Set(p.value);R.has(F)?R.delete(F):R.add(F),p.value=R},V=F=>{if(F.required)return;const R=new Set(w.value);R.has(F.key)?R.delete(F.key):R.add(F.key),w.value=R},f=()=>{p.value=new Set(I.value.map(F=>F.key))},A=()=>{p.value=new Set},G=F=>{F?f():A()};ce(()=>t.modelValue,F=>{F&&(v.value=t.currentPageCount?"current_page":"all",t.exportState.isExporting.value||t.exportState.resetState(),t.exportState.loadSchema().then(()=>{t.exportState.isExporting.value||de()}).catch(()=>{}))});const N=()=>{S.value||v.value==="search_results"&&!se.value||u("export",{scope:v.value,format:i.value,columns:Array.from(p.value),modules:Array.from(w.value)})},ne=()=>{t.exportState.isExporting.value&&t.exportState.cancelExport(),x.value=!1},ue=()=>{t.exportState.isExporting.value?t.exportState.cancelExport():x.value=!1};return(F,R)=>{const re=M("el-alert"),me=M("el-option"),he=M("el-select"),oe=M("el-icon"),pe=M("el-checkbox"),ge=M("el-progress"),ve=M("el-button"),ye=M("el-dialog");return a(),B(ye,{modelValue:x.value,"onUpdate:modelValue":R[2]||(R[2]=J=>x.value=J),title:e.title||c(n)("Export"),"append-to-body":!0,"close-on-click-modal":!e.exportState.isExporting.value,"close-on-press-escape":!e.exportState.isExporting.value,class:"fct-export-dialog",onClose:ne},{footer:d(()=>[s("div",es,[r(ve,{onClick:ue},{default:d(()=>[L(o(e.exportState.isExporting.value?c(n)("Cancel export"):c(n)("Close")),1)]),_:1}),C.value?(a(),B(ve,{key:0,type:"primary",disabled:Q.value,onClick:N},{default:d(()=>[L(o(c(n)("Export file")),1)]),_:1},8,["disabled"])):g("",!0)])]),default:d(()=>[e.exportState.isProActive?e.exportState.isSchemaLoading.value?(a(),m("div",_t,[R[3]||(R[3]=s("div",{class:"fct-export-loading-line"},null,-1)),R[4]||(R[4]=s("div",{class:"fct-export-loading-line is-short"},null,-1)),s("div",ht,[(a(),m(Y,null,ae(6,J=>s("div",{key:J,class:"fct-export-loading-option"})),64))])])):e.exportState.schemaError.value?(a(),B(re,{key:2,title:e.exportState.schemaError.value,type:"error",closable:!1,"show-icon":""},null,8,["title"])):g("",!0):(a(),B(Xe,{key:0,title:c(n)("Advanced data export is a Pro feature"),text:c(n)("Export configurable CSV files or schema-rich JSON data directly from your browser."),placement:"feature_lock_data_export"},null,8,["title","text"])),C.value?(a(),m("div",gt,[s("section",yt,[s("div",bt,[s("span",Ct,[L(o(c(n)("Records to export"))+" ",1),s("span",wt," ("+o(c(n)("Choose which records to include"))+") ",1)])]),r(he,{modelValue:v.value,"onUpdate:modelValue":R[0]||(R[0]=J=>v.value=J),class:"fct-export-options"},{default:d(()=>[r(me,{value:"current_page",disabled:!e.currentPageCount,label:e.currentPageCount?`${c(n)("Current page")} (${e.currentPageCount} ${K(e.currentPageCount)})`:c(n)("Current page")},null,8,["disabled","label"]),r(me,{value:"all",label:Z.value},null,8,["label"]),r(me,{value:"selected",disabled:!e.selectedCount,label:`${c(n)("Selected")} (${e.selectedCount} ${K(e.selectedCount)})`},null,8,["disabled","label"]),r(me,{value:"search_results",disabled:!se.value,label:D.value},null,8,["disabled","label"])]),_:1},8,["modelValue"])]),s("section",kt,[s("div",xt,[s("span",At,o(c(n)("File format")),1)]),s("div",$t,[(a(!0),m(Y,null,ae(k.value,J=>(a(),m("button",{key:J.value,type:"button",class:X(["fct-export-format-card",{"is-selected":i.value===J.value}]),"aria-pressed":i.value===J.value,onClick:fe=>i.value=J.value},[s("span",Mt,o(J.label),1),s("span",Lt,o(H(J)),1),r(oe,{class:"fct-export-format-check"},{default:d(()=>[r(c(Ze))]),_:1})],10,St))),128))])]),j.value?(a(),m("section",Et,[s("div",Vt,[s("div",It,[s("span",Tt,o(c(n)("CSV columns")),1),s("span",Ot," ("+o(c(n)("%1$s of %2$s selected",q.value,I.value.length))+") ",1)])]),s("div",Pt,[r(pe,{"model-value":_.value,indeterminate:b.value,disabled:!I.value.length,onChange:G},{default:d(()=>[L(o(c(n)("Select all")),1)]),_:1},8,["model-value","indeterminate","disabled"]),s("div",Nt,[(a(!0),m(Y,null,ae(I.value,J=>(a(),B(pe,{key:J.key,"model-value":p.value.has(J.key),onChange:fe=>h(J.key)},{default:d(()=>[L(o(J.label),1)]),_:2},1032,["model-value","onChange"]))),128))])])])):g("",!0),U.value?(a(),m("section",Ut,[s("div",Bt,[s("div",Dt,[s("span",jt,o(c(n)("Data modules")),1),s("span",Ft," ("+o(c(n)("%s selected",y.value))+") ",1)])]),s("div",Rt,[(a(!0),m(Y,null,ae($.value,J=>(a(),m("div",{key:J.key,class:X(["fct-export-module",{"is-selected":w.value.has(J.key),"is-required":J.required}]),onClick:fe=>V(J)},[r(pe,{"model-value":w.value.has(J.key),disabled:J.required,onClick:R[1]||(R[1]=Me(()=>{},["stop"])),onChange:fe=>V(J)},{default:d(()=>[L(o(J.label)+" ",1),J.required?(a(),m("small",zt,o(c(n)("Required")),1)):g("",!0)]),_:2},1032,["model-value","disabled","onChange"]),s("span",null,o(J.description),1)],10,qt))),128))]),T.value.sensitive_values_redacted?(a(),B(re,{key:0,title:c(n)("Authentication hashes, payment tokens, and other credentials are excluded or redacted from JSON exports."),type:"info",closable:!1,"show-icon":""},null,8,["title"])):g("",!0)])):g("",!0),S.value?(a(),B(re,{key:2,title:j.value?c(n)("Select at least one CSV column"):c(n)("Select at least one data module"),type:"warning",closable:!1,"show-icon":""},null,8,["title"])):g("",!0),s("p",Wt,o(O.value?c(n)("Large exports are written to disk batch by batch to keep browser memory low."):c(n)("This browser prepares the final download in memory. For very large exports, use a Chromium-based browser for direct-to-disk writing.")),1)])):g("",!0),e.exportState.isExporting.value?(a(),m("div",Jt,[s("div",Kt,o(c(n)("Exporting %s",te.value)),1),s("div",Ht,[s("span",Zt,o(e.exportState.progress.value.total?c(n)("%1$s of %2$s records written",e.exportState.progress.value.fetched,e.exportState.progress.value.total):c(n)("%s records written",e.exportState.progress.value.fetched)),1),s("span",Qt,o(e.exportState.progress.value.percentage)+"% ",1)]),r(Ge,{visible:!0,fade:"",duration:300},{default:d(()=>[r(ge,{percentage:e.exportState.progress.value.percentage,"stroke-width":6,striped:"","striped-flow":"","show-text":!1,class:"fct-export-progress-bar"},null,8,["percentage"])]),_:1}),s("p",Yt,o(e.exportState.writerMode.value==="direct"?c(n)("Writing each completed batch directly to your file."):c(n)("Keeping each response batch small while preparing the download.")),1)])):g("",!0),e.exportState.hasError.value?(a(),m("div",Gt,[r(re,{title:e.exportState.errorMessage.value||c(n)("Export failed"),type:"error",closable:!1,"show-icon":""},null,8,["title"])])):g("",!0),e.exportState.isComplete.value?(a(),m("div",Xt,[r(re,{title:c(n)("Export completed successfully"),description:c(n)("%s records exported",e.exportState.progress.value.fetched),type:"success",closable:!1,"show-icon":""},null,8,["title","description"])])):g("",!0)]),_:1},8,["modelValue","title","close-on-click-modal","close-on-press-escape"])}}}),ts=new TextEncoder,ss=64*1024*1024,ls=e=>/^[\x00-\x20]*[=+\-@]/.test(e)?"'"+e:e,Pe=e=>e==null?"":(typeof e=="object"&&(e=JSON.stringify(e)),e=ls(String(e)),e.includes(",")||e.includes('"')||e.includes(` | |
| 2 | +`)||e.includes("\r")?'"'+e.replace(/"/g,'""')+'"':e);class as{constructor(l){this.filename=l.filename,this.format=l.format,this.entity=l.entity,this.schemaVersion=l.schemaVersion,this.columns=l.columns||[],this.modules=l.modules||[],this.memoryLimitMessage=l.memoryLimitMessage||"Export exceeds the safe in-memory limit.",this.parts=[],this.memoryBytes=0,this.writable=null,this.isFirstJsonRecord=!0,this.mode="memory"}open(){if(typeof window.showSaveFilePicker!="function")return Promise.resolve(this);const l=this.format==="json"?"application/json":"text/csv",t="."+this.format;return window.showSaveFilePicker({suggestedName:this.filename,types:[{description:this.format==="json"?"JSON file":"CSV file",accept:{[l]:[t]}}]}).then(u=>u.createWritable()).then(u=>(this.writable=u,this.mode="direct",this)).catch(u=>Promise.reject(u))}start(){if(this.format==="csv"){const u=this.columns.map(v=>Pe(v.label));return this.write("\uFEFF"+u.join(",")+`\r | |
| 3 | +`)}const l={schema_version:this.schemaVersion,entity:this.entity,modules:this.modules},t=JSON.stringify(l).slice(0,-1)+',"records":[';return this.write(t)}writeRecords(l){if(this.format==="csv"){const u=l.map(v=>this.columns.map(i=>Pe(v[i.key])).join(",")).join(`\r | |
| 4 | +`);return this.write(u?u+`\r | |
| 5 | +`:"")}const t=[];return l.forEach(u=>{this.isFirstJsonRecord||t.push(","),t.push(JSON.stringify(u)),this.isFirstJsonRecord=!1}),this.write(t.join(""))}close(){return(this.format==="json"?this.write("]}"):Promise.resolve()).then(()=>{if(this.writable)return this.writable.close();const t=this.format==="json"?"application/json;charset=utf-8":"text/csv;charset=utf-8",u=new Blob(this.parts,{type:t}),v=URL.createObjectURL(u),i=document.createElement("a");return i.href=v,i.download=this.filename,document.body.appendChild(i),i.click(),i.remove(),window.setTimeout(()=>URL.revokeObjectURL(v),1e3),this.parts=[],this.memoryBytes=0,Promise.resolve()})}abort(){return this.parts=[],this.memoryBytes=0,this.writable&&typeof this.writable.abort=="function"?this.writable.abort().catch(()=>{}):Promise.resolve()}write(l){if(!l)return Promise.resolve();const t=ts.encode(l);return this.writable?this.writable.write(t):this.memoryBytes+t.byteLength>ss?Promise.reject(new Error(this.memoryLimitMessage)):(this.parts.push(t),this.memoryBytes+=t.byteLength,Promise.resolve())}}const Ne=()=>({fetched:0,total:0,percentage:0,batches:0});function Co(e){const l=E(null),t=E(!1),u=E(""),v=E(!1),i=E(!1),p=E(!1),w=E(!1),x=E(""),T=E(""),k=E(Ne()),I=!!Ye.get("app_config.isProActive");let $=null,q=null,y=!1;const _=()=>{v.value=!1,i.value=!1,p.value=!1,w.value=!1,x.value="",T.value="",k.value=Ne()},b=()=>!I||l.value||t.value?Promise.resolve(l.value):(t.value=!0,u.value="",ie.get(`data-export/${e.entity}/schema`).then(O=>(l.value=O.export,l.value)).catch(O=>{var K;return u.value=((K=O==null?void 0:O.data)==null?void 0:K.message)||n("Unable to load export options."),Promise.reject(O)}).finally(()=>{t.value=!1})),j=()=>{v.value&&(i.value=!0,q==null||q.abort())},U=O=>{const K=new Date,Z=[K.getFullYear(),String(K.getMonth()+1).padStart(2,"0"),String(K.getDate()).padStart(2,"0")].join("-");return`${e.filenamePrefix}-${Z}.${O}`},C=O=>{const K={...O||{}};return["page","per_page","with","select","include_ids","query_timestamp"].forEach(Z=>delete K[Z]),K},S=O=>{const K=O.records.length,Z=k.value.total||Number(O.total||0),D=k.value.fetched+K;k.value={fetched:D,total:Z,percentage:Z?Math.min(100,Math.round(D/Z*100)):0,batches:k.value.batches+1}},Q=O=>{var D;const K=((D=O==null?void 0:O.data)==null?void 0:D.message)||(O==null?void 0:O.message)||n("Export failed. Please try again.");return($?$.abort():Promise.resolve()).finally(()=>{q=null,w.value=!0,x.value=K,v.value=!1,$=null})},P=()=>($?$.abort():Promise.resolve()).finally(()=>{q=null,v.value=!1,$=null,W.info(n("Export cancelled"))}),te=async(O,K)=>{var H;let Z=0,D=K;for(;;){if(i.value){await P();return}const de={format:O.format,scope:O.scope,ids:O.ids||[],columns:O.columns||[],modules:O.modules||[],filters:C(O.scope==="all"?e.buildAllParams():e.buildParams()),cursor:Z,max_records:D};q=new AbortController;const h=await ie.post(`data-export/${e.entity}/batch`,de,null,{signal:q.signal});q=null;const V=h==null?void 0:h.export;if(!V||!Array.isArray(V.records))throw new Error(n("The export response was invalid."));if(i.value){await P();return}if(!V.records.length&&!k.value.fetched){await $.abort(),$=null,v.value=!1,W.info(n("No data to export"));return}if(await $.writeRecords(V.records),S(V),k.value.total&&k.value.fetched>=k.value.total||!V.has_more||!V.cursor||!V.records.length){await $.close(),$=null,v.value=!1,p.value=!0,k.value.percentage=100;return}Z=V.cursor,D=Number(((H=V.batch)==null?void 0:H.next_max)||D)}},se=O=>{if(_(),!l.value)return w.value=!0,x.value=n("Export options are not available."),Promise.resolve();const K=l.value.csv_columns.filter(D=>O.columns.includes(D.key)),Z=l.value.json_modules.filter(D=>O.modules.includes(D.key)||D.required).map(D=>D.key);return $=new as({filename:U(O.format),format:O.format,entity:e.entity,schemaVersion:l.value.schema_version,columns:K,modules:Z,memoryLimitMessage:n("This export exceeds the 64 MB safe in-memory limit. Use a Chromium-based browser to write the file directly to disk.")}),v.value=!0,$.open().then(D=>(T.value=D.mode,D.start())).then(()=>{var H;const D=Number(((H=l.value.batching)==null?void 0:H.initial_records)||500);return te(O,D)}).catch(D=>D&&D.name==="AbortError"?(q=null,y?Promise.resolve($==null?void 0:$.abort()).finally(()=>{$=null,v.value=!1}):P()):Q(D))};return Ue(()=>{y=!0,i.value=!0,q==null||q.abort(),$==null||$.abort(),$=null}),{schema:l,isSchemaLoading:t,schemaError:u,isProActive:I,isExporting:v,isCancelled:i,isComplete:p,hasError:w,errorMessage:x,writerMode:T,progress:k,loadSchema:b,startExport:se,cancelExport:j,resetState:_}}const os={name:"OrderUpDownIndicator",props:{order:{type:Object,required:!0}},data(){var e,l;return{upgradeToId:((e=this.order.config)==null?void 0:e.upgraded_to)||null,upgradeFromId:((l=this.order.config)==null?void 0:l.upgraded_from)||null}}},ns={key:0,class:"ml-2"};function rs(e,l,t,u,v,i){const p=M("el-icon"),w=M("el-button"),x=M("router-link"),T=M("el-tooltip");return v.upgradeFromId||v.upgradeToId?(a(),m("span",ns,[v.upgradeFromId?(a(),B(T,{key:0,trigger:"click"},{content:d(()=>[L(o(e.$t("This order has been upgraded from"))+" ",1),r(x,{to:{name:"view_order",params:{order_id:v.upgradeFromId}}},{default:d(()=>[s("strong",null,"#"+o(v.upgradeFromId),1)]),_:1},8,["to"])]),default:d(()=>[r(w,{text:""},{default:d(()=>[r(p,null,{default:d(()=>l[0]||(l[0]=[s("svg",{viewBox:"0 0 24 24",width:"24",height:"24",color:"currentColor",fill:"none"},[s("defs"),s("path",{fill:"currentColor",d:"M11.943,1.75 L12.057,1.75 C14.248,1.75 15.969,1.75 17.312,1.931 C18.689,2.116 19.781,2.503 20.639,3.361 C21.497,4.219 21.884,5.311 22.069,6.688 C22.25,8.031 22.25,9.752 22.25,11.943 L22.25,12.057 C22.25,14.248 22.25,15.969 22.069,17.312 C21.884,18.689 21.497,19.781 20.639,20.639 C19.781,21.497 18.689,21.884 17.312,22.069 C15.969,22.25 14.248,22.25 12.057,22.25 L11.943,22.25 C9.752,22.25 8.031,22.25 6.688,22.069 C5.311,21.884 4.219,21.497 3.361,20.639 C2.503,19.781 2.116,18.689 1.931,17.312 C1.75,15.969 1.75,14.248 1.75,12.057 L1.75,11.943 C1.75,9.752 1.75,8.031 1.931,6.688 C2.116,5.311 2.503,4.219 3.361,3.361 C4.219,2.503 5.311,2.116 6.688,1.931 C8.031,1.75 9.752,1.75 11.943,1.75 L11.943,1.75 Z M4.422,4.422 C3.889,4.955 3.58,5.678 3.417,6.888 C3.252,8.12 3.25,9.74 3.25,12 C3.25,14.26 3.252,15.88 3.417,17.112 C3.58,18.322 3.889,19.045 4.422,19.578 C4.955,20.111 5.678,20.42 6.888,20.583 C8.12,20.748 9.74,20.75 12,20.75 C14.26,20.75 15.88,20.748 17.112,20.583 C18.322,20.42 19.045,20.111 19.578,19.578 C20.111,19.045 20.42,18.322 20.583,17.112 C20.748,15.88 20.75,14.26 20.75,12 C20.75,9.74 20.748,8.12 20.583,6.888 C20.42,5.678 20.111,4.955 19.578,4.422 C19.045,3.889 18.322,3.58 17.112,3.417 C15.88,3.252 14.26,3.25 12,3.25 C9.74,3.25 8.12,3.252 6.888,3.417 C5.678,3.58 4.955,3.889 4.422,4.422 Z M10.038,11.023 C9.749,11.32 9.274,11.326 8.977,11.038 C8.68,10.749 8.673,10.274 8.962,9.977 C9.051,9.886 9.197,9.704 9.41,9.433 L9.457,9.373 C9.647,9.131 9.87,8.847 10.099,8.576 C10.346,8.285 10.621,7.983 10.897,7.749 C11.035,7.631 11.19,7.515 11.358,7.425 C11.519,7.339 11.742,7.25 12,7.25 C12.258,7.25 12.481,7.339 12.642,7.425 C12.81,7.515 12.965,7.631 13.103,7.749 C13.379,7.983 13.654,8.285 13.901,8.576 C14.13,8.847 14.353,9.131 14.543,9.373 L14.543,9.373 L14.59,9.433 C14.804,9.704 14.949,9.886 15.038,9.977 C15.326,10.274 15.32,10.749 15.023,11.038 C14.726,11.326 14.251,11.32 13.962,11.023 C13.805,10.861 13.603,10.604 13.411,10.359 L13.366,10.302 C13.173,10.057 12.967,9.794 12.756,9.545 L12.75,9.538 L12.75,16 C12.75,16.414 12.414,16.75 12,16.75 C11.586,16.75 11.25,16.414 11.25,16 L11.25,9.538 L11.244,9.545 C11.033,9.794 10.827,10.057 10.634,10.302 L10.634,10.302 L10.589,10.359 C10.397,10.604 10.195,10.861 10.038,11.023 Z"})],-1)])),_:1,__:[0]})]),_:1})]),_:1})):g("",!0),v.upgradeToId?(a(),B(T,{key:1,trigger:"click"},{content:d(()=>[L(o(e.$t("This order has been upgraded to"))+" ",1),r(x,{to:{name:"view_order",params:{order_id:v.upgradeToId}}},{default:d(()=>[s("strong",null,"#"+o(v.upgradeToId),1)]),_:1},8,["to"])]),default:d(()=>[r(w,{text:""},{default:d(()=>[r(p,null,{default:d(()=>l[1]||(l[1]=[s("svg",{viewBox:"0 0 24 24",width:"24",height:"24",color:"currentColor",fill:"none"},[s("defs"),s("path",{fill:"currentColor",d:"M3.367,20.63 C1.756,19.02 1.756,16.672 1.756,11.995 L1.756,11.995 C1.756,7.317 1.756,4.97 3.367,3.359 C4.976,1.75 7.324,1.75 12.002,1.75 C16.68,1.75 19.026,1.75 20.637,3.359 C22.247,4.97 22.247,7.318 22.247,11.996 C22.247,16.674 22.247,19.022 20.637,20.631 C19.026,22.242 16.678,22.242 12,22.242 L12.003,22.241 C7.326,22.241 4.976,22.241 3.367,20.63 Z M4.427,4.418 C3.256,5.59 3.256,7.73 3.256,11.994 L3.256,11.995 C3.256,16.259 3.256,18.399 4.427,19.569 C5.597,20.741 7.738,20.741 12.003,20.741 C16.269,20.741 18.408,20.741 19.58,19.569 C20.75,18.399 20.75,16.259 20.75,11.993 L20.75,11.993 C20.75,7.727 20.75,5.588 19.58,4.417 C18.408,3.247 16.268,3.247 12.005,3.247 L12.003,3.248 C7.739,3.248 5.599,3.248 4.427,4.418 Z M12.024,8.951 C12.121,9.047 12.306,9.198 12.578,9.415 L12.654,9.476 L12.654,9.476 C12.894,9.667 13.172,9.888 13.437,10.117 C13.727,10.367 14.029,10.648 14.262,10.932 C14.432,11.139 14.661,11.456 14.726,11.834 C14.729,11.85 14.732,11.866 14.734,11.883 C14.741,11.94 14.745,11.999 14.745,12.059 C14.744,12.083 14.743,12.106 14.74,12.13 C14.693,12.568 14.41,12.933 14.199,13.168 C13.96,13.435 13.661,13.696 13.375,13.93 C13.152,14.112 12.918,14.292 12.71,14.452 C12.651,14.497 12.594,14.541 12.541,14.582 C12.277,14.786 12.109,14.923 12.027,15.007 C11.739,15.305 11.264,15.312 10.967,15.024 C10.669,14.735 10.662,14.26 10.95,13.963 C11.121,13.787 11.382,13.582 11.623,13.396 C11.684,13.349 11.745,13.302 11.807,13.254 C12.012,13.097 12.222,12.935 12.427,12.768 L12.483,12.722 L6.995,12.715 C6.581,12.715 6.246,12.379 6.246,11.964 C6.247,11.55 6.583,11.215 6.997,11.215 L12.422,11.222 C12.191,11.024 11.949,10.832 11.718,10.648 L11.718,10.648 L11.643,10.588 C11.396,10.391 11.134,10.181 10.965,10.012 C10.672,9.72 10.671,9.245 10.964,8.952 C11.257,8.659 11.731,8.658 12.024,8.951 Z M17.754,8.001 L17.745,15.993 C17.744,16.407 17.408,16.743 16.994,16.742 C16.58,16.742 16.244,16.405 16.245,15.991 L16.254,7.999 C16.255,7.585 16.591,7.25 17.005,7.25 C17.419,7.25 17.755,7.587 17.754,8.001 Z"})],-1)])),_:1,__:[1]})]),_:1})]),_:1})):g("",!0)])):g("",!0)}const wo=Le(os,[["render",rs]]);class Re{static copyModern(l){return navigator.clipboard.writeText(l)}static copyLegacy(l){const t=document.createElement("textarea");t.value=l,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t),t.select();try{return document.execCommand("copy"),t.remove(),Promise.resolve()}catch{return t.remove(),Promise.reject(new Error(n("Failed to copy text")))}}static async copy(l,t={}){const v={...{showNotification:!0,duration:2e3},...t};v.successMessage=v.successMessage||n("Copied to clipboard"),v.errorMessage=v.successMessage||n("Copied to clipboard");try{return navigator.clipboard&&window.isSecureContext?await this.copyModern(l):await this.copyLegacy(l),v.showNotification&&W.success(v.successMessage),!0}catch{return v.showNotification&&Qe.alert(l,n("Please copy this text: "),{confirmButtonText:n("Close")}),!1}}static copyElement(l,t={}){if(!l)throw new Error(n("Element not provided"));const u=l.textContent||l.value||"";return this.copy(u,t)}}const is={class:"fct-copy-wrap"},ds={key:0,class:"fct-copy-basic"},us={key:1,class:"fct-copy-basic-wrap"},cs={class:"fct-copy-basic"},ms={key:2,class:"fct-copy-advanced flex"},ps=["value","placeholder"],fs=["disabled"],be={__name:"CopyToClipboard",props:{showMode:{type:String,default:""},tooltipText:{type:String,default:n("Copy")},text:[String,Number],placeholder:String,buttonText:{type:String,default:n("Copy")},tooltipContent:{type:String,default:""},placement:{type:String,default:"top-end"}},setup(e){const l=e,t=E(l.text),u=E(null),v=i=>{i.preventDefault();const p=t.value;Re.copy(p)};return ce(()=>l.text,i=>{t.value=i},{deep:!0}),(i,p)=>{const w=M("el-button"),x=M("el-tooltip");return a(),m("div",is,[e.showMode==="basic_copy_btn"?(a(),m("div",ds,[s("span",{ref_key:"copyTooltip",ref:u,class:"copy-tooltip"},o(e.tooltipText),513),s("button",{class:"fct-copy-btn",onClick:v},p[0]||(p[0]=[s("svg",{viewBox:"0 0 20 20","aria-hidden":"true",width:"20",height:"20"},[s("path",{"fill-rule":"evenodd",d:"M6.515 4.75a2 2 0 0 1 1.985-1.75h3a2 2 0 0 1 1.985 1.75h.265a2.25 2.25 0 0 1 2.25 2.25v7.75a2.25 2.25 0 0 1-2.25 2.25h-7.5a2.25 2.25 0 0 1-2.25-2.25v-7.75a2.25 2.25 0 0 1 2.25-2.25h.265Zm1.985-.25h3a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5Zm-1.987 1.73.002.02h-.265a.75.75 0 0 0-.75.75v7.75c0 .414.336.75.75.75h7.5a.75.75 0 0 0 .75-.75v-7.75a.75.75 0 0 0-.75-.75h-.265a2 2 0 0 1-1.985 1.75h-3a2 2 0 0 1-1.987-1.77Z"})],-1)]))])):e.showMode==="icon_with_text"?(a(),m("div",us,[s("div",cs,[s("span",{ref_key:"copyTooltip",ref:u,class:"copy-tooltip"},o(e.tooltipText),513),r(w,{class:"fct-copy-text-btn",text:"",onClick:v},{default:d(()=>[r(ee,{name:"Copy"}),L(" "+o(e.buttonText),1)]),_:1})]),e.tooltipContent?(a(),B(x,{key:0,"popper-class":"fct-tooltip",content:e.tooltipContent,placement:e.placement,"show-after":400,"hide-after":0},{default:d(()=>[s("span",null,[r(ee,{name:"InformationFill",class:"w-4.5 h-4.5"})])]),_:1},8,["content","placement"])):g("",!0)])):(a(),m("div",ms,[s("input",{type:"text",class:"w-full",readonly:"",value:t.value,placeholder:e.placeholder},null,8,ps),s("span",{ref_key:"copyTooltip",ref:u,hidden:"",class:"copy-tooltip"},o(i.$t("Copied!")),513),s("button",{class:"fct-copy-btn flex",onClick:v,disabled:!t.value},[r(ee,{name:"Copy"}),L(" "+o(i.$t("Copy")),1)],8,fs)]))])}}},we=class we{static emptyImage(l=!1){return we.assetUrl()+(l?"images/empty-image-dark.svg":"images/empty-image.svg")}};Oe(we,"assetUrl",()=>ot.url());let $e=we;const vs={components:{DynamicIcon:ee},props:{product:{type:Object},hideProductId:{type:Boolean,default:!1},hideViewIcon:{type:Boolean,default:!1},hideImage:{type:Boolean,default:!1}},data(){return{}},methods:{translate:n,translateNumber:Ce,getImage(e,l=!1){return at.get(e,"featured_media.url")??$e.emptyImage(l)}}},_s={class:"fct-product-info-card w-full"},hs={key:0,class:"fct-product-info-media"},gs=["src","alt"],ys=["src","alt"],bs={class:"fct-product-info-details"},Cs={class:"fct-product-info-name"},ws={class:"product-name"},ks={class:"product-name-inner"},xs=["href"],As={key:0,class:"product-id"},$s={key:1,class:"product-sub-name"};function Ss(e,l,t,u,v,i){var w,x,T,k,I,$,q,y,_;const p=M("DynamicIcon");return a(),m("div",_s,[t.hideImage?g("",!0):(a(),m("div",hs,[s("span",null,[s("img",{class:"block dark:hidden",src:i.getImage((w=t.product)==null?void 0:w.detail),alt:(x=t.product)==null?void 0:x.post_title},null,8,gs),s("img",{class:"hidden dark:block",src:i.getImage((T=t.product)==null?void 0:T.detail,!0),alt:(k=t.product)==null?void 0:k.post_title},null,8,ys)])])),s("div",bs,[s("div",Cs,[s("span",ws,[s("span",ks,o(((I=t.product)==null?void 0:I.post_title)||i.translate("No Name")),1),t.hideViewIcon?g("",!0):(a(),m("a",{key:0,class:"view-link right-1",target:"_blank",href:($=t.product)==null?void 0:$.view_url,onClick:l[0]||(l[0]=Me(()=>{},["stop"]))},[r(p,{class:"w-5 h-5",name:"Eye"})],8,xs))]),t.hideProductId?g("",!0):(a(),m("span",As," #"+o(i.translateNumber((q=t.product)==null?void 0:q.ID)),1)),(y=t.product)!=null&&y.variation_title?(a(),m("span",$s," – "+o((_=t.product)==null?void 0:_.variation_title),1)):g("",!0)])])])}const Ms=Le(vs,[["render",Ss]]),Ls={name:"LicenseTable",components:{ProductInfo:Ms,UserCan:je,RouteCell:lt,DynamicIcon:ee,IconButton:Ee,CopyToClipboard:be,Empty:tt,Badge:et},props:{licenses:{type:Array,required:!0},columns:{type:Array,default(){return["product","order_id","customer","date"]}}},computed:{Clipboard(){return Re},formattedLicense(){return this.licenses.map(e=>{var l;return{...e,product:{...e.product,variation_title:((l=e.product_variant)==null?void 0:l.variation_title)||"n/a"}}})}},methods:{translate:n,formatDate:st,translateNumber:Ce,getProductName(e){var l,t;return(l=e==null?void 0:e.product)!=null&&l.post_title?(t=e==null?void 0:e.product)==null?void 0:t.post_title:"n/a"},getProductVariationName(e){var l,t;return(l=e==null?void 0:e.product_variant)!=null&&l.variation_title?(t=e==null?void 0:e.product_variant)==null?void 0:t.variation_title:"n/a"}}},Es={class:"fct_licenses_table hide-on-mobile"},Vs={class:"fct-license-key-wrap flex flex-col"},Is={class:"fct-license-key max-w-full pr-1"},Ts={class:"fct-license-key-inner pr-2"},Os={key:0},Ps={key:1},Ns={class:"fct_licenses_table_mobile"},Us={class:"fct-table-mobile-wrap"},Bs=["onClick"],Ds={class:"fct-table-mobile-header-left"},js={class:"fct-table-status-col"},Fs={class:"fct-table-activations-col"},Rs={class:"fct-table-mobile-body"},qs=["onClick"],zs={class:"fct-license-key-wrap has-bg"},Ws={class:"fct-license-key"},Js={class:"fct-license-key-inner pr-2"};function Ks(e,l,t,u,v,i){const p=M("Badge"),w=M("router-link"),x=M("DynamicIcon"),T=M("el-tooltip"),k=M("el-table-column"),I=M("ProductInfo"),$=M("RouteCell"),q=M("Empty"),y=M("el-table"),_=M("UserCan");return a(),B(_,{permission:"licenses/view"},{default:d(()=>[s("div",Es,[r(y,{data:i.formattedLicense,class:"w-full compact-table"},{empty:d(()=>[r(q,{icon:"Empty/ListView","has-dark":!0,text:i.translate("No Licenses found based on your filter")},null,8,["text"])]),default:d(()=>[r(k,{label:i.translate("License Key"),width:200},{default:d(b=>{var j;return[s("div",Vs,[s("span",null,[(a(),B(p,{status:b.row.status,key:b.row.id},null,8,["status"]))]),s("span",Is,[s("span",Ts,[r(w,{class:"link",to:{name:"view_license",params:{license_id:(j=b.row)==null?void 0:j.id}}},{default:d(()=>[L(o(b.row.license_key),1)]),_:2},1032,["to"])]),r(T,{content:b.row.license_key,placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[r(x,{class:"cursor-pointer p-1 w-6 h-6 flex-none",name:"Copy",onClick:()=>{i.Clipboard.copy(b.row.license_key,{successMessage:i.translate("License Key copied to clipboard"),errorMessage:i.translate("Failed to copy License Key")})}},null,8,["onClick"])]),_:2},1032,["content"])])])]}),_:1},8,["label"]),t.columns.indexOf("product")!==-1?(a(),B(k,{key:0,width:200,label:i.translate("Product")},{default:d(b=>{var j;return[r($,{class:"link block hover:no-underline",to:{name:"view_license",params:{license_id:(j=b.row)==null?void 0:j.id}}},{default:d(()=>[r(I,{product:b.row.product,hideProductId:!0,hideViewIcon:!0,hideImage:!0},null,8,["product"])]),_:2},1032,["to"])]}),_:1},8,["label"])):g("",!0),t.columns.indexOf("order_id")!==-1?(a(),B(k,{key:1,width:80,label:i.translate("Order ID")},{default:d(b=>[r($,{class:"link order_id block hover:no-underline relative w-full",to:{name:"view_order",params:{order_id:b.row.order_id}}},{default:d(()=>[r(w,{class:"link absolute left-1/2 top-1/2 translate-x-[calc(-50%-16px)] translate-y-[-50%]",to:{name:"view_order",params:{order_id:b.row.order_id}}},{default:d(()=>[L(" #"+o(b.row.order_id),1)]),_:2},1032,["to"])]),_:2},1032,["to"])]),_:1},8,["label"])):g("",!0),t.columns.indexOf("customer")!==-1?(a(),B(k,{key:2,width:100,label:i.translate("Customer")},{default:d(b=>[r(w,{class:"link",to:{name:"view_customer",params:{customer_id:b.row.customer_id}}},{default:d(()=>{var j,U;return[L(o(((U=(j=b.row)==null?void 0:j.customer)==null?void 0:U.full_name)||i.translate("No Name")),1)]}),_:2},1032,["to"])]),_:1},8,["label"])):g("",!0),r(k,{width:90,label:i.translate("Activations")},{default:d(b=>{var j;return[r($,{class:"link block hover:no-underline relative w-full",to:{name:"view_license",params:{license_id:(j=b.row)==null?void 0:j.id}}},{default:d(()=>[L(o(i.translateNumber(b.row.activation_count))+" / "+o(b.row.limit==0?"Unlimited":b.row.limit),1)]),_:2},1032,["to"])]}),_:1},8,["label"]),t.columns.indexOf("date")!==-1?(a(),B(k,{key:3,width:140,label:i.translate("Date")},{default:d(b=>{var j;return[r($,{class:"block hover:no-underline w-full",to:{name:"view_license",params:{license_id:(j=b.row)==null?void 0:j.id}}},{default:d(()=>[s("div",null,[s("span",null,o(i.formatDate(b.row.created_at)),1),l[0]||(l[0]=s("span",{class:"text-gray-300 px-2"},"–",-1)),b.row.expiration_date?(a(),m("span",Os,o(i.formatDate(b.row.expiration_date)),1)):(a(),m("span",Ps,o(i.translate("Lifetime")),1))])]),_:2},1032,["to"])]}),_:1},8,["label"])):g("",!0)]),_:1},8,["data"])]),s("div",Ns,[s("div",Us,[(a(!0),m(Y,null,ae(i.formattedLicense,(b,j)=>(a(),m("div",{key:j,class:"fct-table-mobile-row"},[s("div",{class:"fct-table-mobile-header",onClick:U=>e.$router.push({name:"view_license",params:{license_id:b==null?void 0:b.id}})},[s("div",Ds,[s("div",js,[(a(),B(p,{status:b.status,key:b.id},null,8,["status"]))]),s("div",Fs,o(b.activation_count)+" / "+o(b.limit==0?"Unlimited":b.limit),1)])],8,Bs),s("div",Rs,[s("div",{class:"fct-table-product-col",onClick:U=>e.$router.push({name:"view_license",params:{license_id:b==null?void 0:b.id}})},[r(I,{product:b.product,hideProductId:!0,hideViewIcon:!0,hideImage:!0},null,8,["product"])],8,qs),s("div",zs,[s("div",Ws,[s("div",Js,[r(w,{class:"link",to:{name:"view_license",params:{license_id:b==null?void 0:b.id}}},{default:d(()=>[L(o(b.license_key),1)]),_:2},1032,["to"])]),r(x,{class:"cursor-pointer p-1 w-6 h-6",name:"Copy",onClick:()=>{i.Clipboard.copy(b.license_key,{successMessage:i.translate("License Key copied to clipboard"),errorMessage:i.translate("Failed to copy License Key")})}},null,8,["onClick"])])])])]))),128))])])]),_:1})}const ko=Le(Ls,[["render",Ks]]),Hs={class:"fct_edit_customer_popup"},Zs={key:0,class:"fct-customer-address-business-details"},Qs={class:"fct-customer-address-business-details-title"},Ys={class:"form-error-wrap"},Gs=["innerHTML"],Xs={class:"dialog-footer"},qe=Object.assign({name:"AddOrEditAddressModal"},{__name:"AddOrEditAddressModal",props:["customer_id","modalAction","address","showAddressModal","order_id","customerAddressModalInfos","showSetAsAlsoCheckbox","closing_modal","showBusinessDetailsSection"],emits:["close-modal","update:refresh-address"],setup(e,{emit:l}){const t=e,u=l;E([]);const v=E(!1),i=E({}),p=E(!1),w=E(!1),x=E(!1);E(null);function T(U={}){return{label:"",name:"",email:"",company_name:"",vat_number:"",legal_registration_id:"",phone:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",...U??{}}}const k=E(T(t.address)),I=Be().ctx,$=z(()=>{var U;return((U=window.fluentCartAdminApp)==null?void 0:U.business_details)||{}}),q=z(()=>{var U,C,S,Q;return!!t.showBusinessDetailsSection&&((U=t.modalAction)==null?void 0:U.type)==="billing"&&(((C=$.value.company_name)==null?void 0:C.enabled)||((S=$.value.vat_number)==null?void 0:S.enabled)||((Q=$.value.legal_registration_id)==null?void 0:Q.enabled))});nt().onSave(()=>{t.showAddressModal&&["billing","shipping"].includes(t.modalAction.type)&&(t.modalAction.action==="edit"&&I.address.id!==""?j():t.modalAction.action==="create"&&b())});const _=U=>{let C="";for(const S in U){const Q=U[S],P=Object.values(Q);C+=P+" </br>"}return C},b=()=>{p.value=!0;let U={type:t.modalAction.type,customer_id:t.customer_id,order_id:t.order_id??null},C={...k.value,...U};C.sync=x.value,ie.post("customers/"+t.customer_id+"/address",{...C}).then(S=>{u("update:refresh-address",!1,S.data),W.success(S.message),i.value={}}).catch(S=>{var Q;S.status_code=="422"?(W.validationErrors(S),i.value=S.data):W.error((Q=S.data)==null?void 0:Q.message)}).finally(()=>{v.value=!1,p.value=!1})},j=()=>{w.value=!0;let C={...{type:t.modalAction.type,customer_id:t.customer_id,is_primary:t.address.is_primary,id:t.address.id,order_id:t.order_id&&t.address.is_primary==1?t.order_id:null},...k.value};ie.put("customers/"+t.customer_id+"/address",{...C}).then(S=>{x.value,u("update:refresh-address",!1,S.data),W.success(S.message),i.value={}}).catch(S=>{var Q;S.status_code=="422"?(W.validationErrors(S),i.value=S):W.error((Q=S.data)==null?void 0:Q.message)}).finally(()=>{v.value=!1,w.value=!1})};return ce(()=>t.closing_modal,(U,C)=>{U&&(i.value={})}),ce(()=>t.address,U=>{k.value=T(U)},{deep:!0,immediate:!0}),ce(()=>t.showAddressModal,U=>{U||(k.value=T({}),i.value={})}),(U,C)=>{const S=M("el-form"),Q=M("el-checkbox"),P=M("el-button");return a(),m("div",Hs,[r(S,{"label-position":"top",class:"fct-compact-form","require-asterisk-position":"right"},{default:d(()=>{var te,se,O,K,Z,D;return[r(le,{label:c(n)("Address Label"),class:X(i.value.hasOwnProperty("label")?"is-error":""),modelValue:k.value.label,"onUpdate:modelValue":C[0]||(C[0]=H=>k.value.label=H)},null,8,["label","class","modelValue"]),r(le,{label:c(n)("Name"),required:"",class:X(i.value.hasOwnProperty("name")?"is-error":""),modelValue:k.value.name,"onUpdate:modelValue":C[1]||(C[1]=H=>k.value.name=H)},null,8,["label","class","modelValue"]),r(le,{label:c(n)("Email"),required:"",class:X(i.value.hasOwnProperty("email")?"is-error":""),modelValue:k.value.email,"onUpdate:modelValue":C[2]||(C[2]=H=>k.value.email=H)},null,8,["label","class","modelValue"]),r(le,{label:c(n)("Phone"),required:"",class:X(i.value.hasOwnProperty("phone")?"is-error":""),modelValue:k.value.phone,"onUpdate:modelValue":C[3]||(C[3]=H=>k.value.phone=H)},null,8,["label","class","modelValue"]),r(Ve,{use_additional_address_fields:"",modelValue:k.value,"onUpdate:modelValue":C[4]||(C[4]=H=>k.value=H),validationErrors:i.value},null,8,["modelValue","validationErrors"]),q.value?(a(),m("div",Zs,[s("h3",Qs,o(c(n)("Business Details")),1),(te=$.value.company_name)!=null&&te.enabled?(a(),B(le,{key:0,label:c(n)("Company Name"),required:(se=$.value.company_name)==null?void 0:se.required,class:X(i.value.hasOwnProperty("company_name")?"is-error":""),modelValue:k.value.company_name,"onUpdate:modelValue":C[5]||(C[5]=H=>k.value.company_name=H)},null,8,["label","required","class","modelValue"])):g("",!0),(O=$.value.vat_number)!=null&&O.enabled?(a(),B(le,{key:1,label:c(n)("VAT/GST/Tax Number"),required:(K=$.value.vat_number)==null?void 0:K.required,class:X(i.value.hasOwnProperty("vat_number")?"is-error":""),modelValue:k.value.vat_number,"onUpdate:modelValue":C[6]||(C[6]=H=>k.value.vat_number=H)},null,8,["label","required","class","modelValue"])):g("",!0),(Z=$.value.legal_registration_id)!=null&&Z.enabled?(a(),B(le,{key:2,label:c(n)("Legal Registration ID"),required:(D=$.value.legal_registration_id)==null?void 0:D.required,class:X(i.value.hasOwnProperty("legal_registration_id")?"is-error":""),modelValue:k.value.legal_registration_id,"onUpdate:modelValue":C[7]||(C[7]=H=>k.value.legal_registration_id=H)},null,8,["label","required","class","modelValue"])):g("",!0)])):g("",!0)]}),_:1}),s("div",Ys,[s("p",{class:"form-error-text",innerHTML:_(i.value)},null,8,Gs)]),s("div",Xs,[(e.showSetAsAlsoCheckbox,g("",!0)),e.address.id?(a(),B(P,{key:1,type:"primary",onClick:C[9]||(C[9]=te=>j()),loading:w.value,disabled:w.value},{default:d(()=>[L(o(c(n)("Update Address")),1)]),_:1},8,["loading","disabled"])):(a(),B(P,{key:2,type:"primary",onClick:C[10]||(C[10]=te=>b()),loading:p.value,disabled:p.value},{default:d(()=>[L(o(c(n)("Add Address")),1)]),_:1},8,["loading","disabled"]))])])}}}),el={class:"fct-manage-address-modal"},tl={key:1,class:"fct-manage-address-wrap"},sl=["onClick"],ll={class:"fct-address-action absolute top-0 right-0 pt-2"},al={class:"more-btn"},ol={key:0,class:"empty-text"},nl={key:2,class:"edit_address"},rl={key:3,class:"dialog-footer"},il={name:"ManageAddressModal",props:["showAddressModal","customer_id","modalAction","order_id","showBusinessDetailsSection"],expose:["editAddress"],data(){return{manageAddress:[],address:{},loading:!0,isEditAddress:!1,selectedAddressIndex:null}},computed:{showModal:{get(){return this.showAddressModal},set(e){this.$emit("update:showAddressModal",e)}}},methods:{handleAddressCommand(e){e.action==="edit"?this.editAddress(e.data):e.action==="use"?this.$emit("onAddressSelected",e.data):e.action==="set-as-also"?this.setAsAlso(e.data):e.action==="default"?this.setAddressPrimary(e.data):e.action==="remove"&&this.$confirm(this.$t("Are you sure you want to delete this address?"),this.$t("Warning"),{confirmButtonText:this.$t("Yes, Delete!"),cancelButtonText:this.$t("Cancel"),cancelButtonClass:"el-button--small",confirmButtonClass:"el-button--small",type:"warning"}).then(()=>{this.removeAddress(e.data)}).catch(()=>{})},emitAddNewAddress(e,l=[]){this.$emit("addNewAddress",e,"create",l)},emitAddressSelected(){this.showModal=!1,this.$emit("onAddressSelected",this.manageAddress[this.selectedAddressIndex])},editAddress(e){this.address=e,this.isEditAddress=!0},removeAddress(e){let l=e.id;this.$del("customers/"+this.customer_id+"/address",{address:e}).then(t=>{this.getAddresses(),this.$emit("refresh-address"),this.handleSuccess(t.message),l===this.selectedAddressIndex&&(this.selectedAddressIndex=null)}).catch(t=>{var u;t.status_code=="422"?W.validationErrors(t):W.error((u=t.data)==null?void 0:u.message)}).finally(()=>{this.loading=!1})},setAddressPrimary(e){this.$post("customers/"+this.customer_id+"/address/make-primary",{addressId:e.id,type:e.type}).then(l=>{this.$emit("refresh-address"),this.getAddresses(),this.handleSuccess(l.message)}).catch(l=>{var t;l.status_code=="422"?W.validationErrors(l):W.error((t=l.data)==null?void 0:t.message)}).finally(()=>{this.loading=!1})},getTitle(){return this.modalAction.type==="billing"?this.$t("Manage billing address"):this.$t("Manage shipping address")},fetchAddresses(){this.getAddresses(this.modalAction.type)},getAddresses(e="billing"){this.loading=!0,this.selectedOrders=[],this.$get("customers/"+this.customer_id+"/address",{type:this.modalAction.type}).then(l=>{this.manageAddress=l.addresses}).catch(l=>{this.handleError(l)}).finally(()=>{this.loading=!1})},updateAddress(){this.fetchAddresses(),this.$emit("refresh-address")},setAsAlso(e){const l=this.modalAction.type==="billing"?"shipping":"billing",t={...e,type:l,customer_id:this.customer_id,is_primary:0};delete t.id,delete t.created_at,delete t.updated_at,this.emitAddNewAddress(l,t)}}},dl=Object.assign(il,{setup(e){return(l,t)=>{const u=M("el-skeleton"),v=M("el-tag"),i=M("el-dropdown-item"),p=M("el-dropdown-menu"),w=M("el-dropdown"),x=M("el-icon"),T=M("el-button"),k=M("el-dialog");return a(),m("div",el,[r(k,{modelValue:l.showModal,"onUpdate:modelValue":t[5]||(t[5]=I=>l.showModal=I),onClose:t[6]||(t[6]=()=>{l.selectedAddressIndex=null,l.isEditAddress=!1}),onOpen:l.fetchAddresses,title:l.getTitle(),"append-to-body":!0,"modal-class":"fct-manage-order-address-modal"},{default:d(()=>[l.loading?(a(),B(u,{key:0,animated:"",rows:4})):g("",!0),!l.loading&&!l.isEditAddress?(a(),m("div",tl,[(a(!0),m(Y,null,ae(l.manageAddress,(I,$)=>(a(),m("div",{class:"fct-manage-address-block-wrap",key:I.id},[s("div",{class:X(`cursor-pointer fct-manage-address-block ${I.is_primary==="1"?"default-address":""} ${$===l.selectedAddressIndex?"selected":""} `),onClick:()=>{l.selectedAddressIndex=$}},[I.is_primary==="1"?(a(),B(v,{key:0,type:"info",round:""},{default:d(()=>[L(o(l.$t("Default")),1)]),_:1})):g("",!0),s("p",null,[s("strong",null,o(I.name),1),L(" "+o(l.getOrderAddress(I,"",!0)),1)])],10,sl),s("div",ll,[r(w,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:l.handleAddressCommand},{dropdown:d(()=>[r(p,null,{default:d(()=>[r(i,{command:{action:"edit",data:I}},{default:d(()=>[L(o(l.$t("Edit")),1)]),_:2},1032,["command"]),r(i,{command:{action:"use",data:I}},{default:d(()=>[L(o(l.$t("Use this address")),1)]),_:2},1032,["command"]),r(i,{command:{action:"set-as-also",data:I}},{default:d(()=>[L(o(e.modalAction.type==="billing"?l.$t("Copy to Shipping"):l.$t("Copy to Billing")),1)]),_:2},1032,["command"]),I.is_primary!=="1"?(a(),m(Y,{key:0},[r(i,{command:{action:"default",data:I}},{default:d(()=>[L(o(l.$t("Set as default")),1)]),_:2},1032,["command"]),r(i,{command:{action:"remove",data:I},class:"item-destructive"},{default:d(()=>[L(o(l.$t("Delete")),1)]),_:2},1032,["command"])],64)):g("",!0)]),_:2},1024)]),default:d(()=>[s("span",al,[r(ee,{name:"More"})])]),_:2},1032,["onCommand"])])]))),128)),l.manageAddress.length==0?(a(),m("div",ol,o(e.modalAction.type==="billing"?l.$t("No billing address found."):l.$t("No shipping address found.")),1)):g("",!0)])):g("",!0),l.isEditAddress?(a(),m("div",nl,[r(T,{text:"",onClick:t[0]||(t[0]=()=>l.isEditAddress=!1),style:{"margin-bottom":"16px"}},{default:d(()=>[r(x,null,{default:d(()=>[r(c(De))]),_:1}),L(" "+o(l.$t("Manage address")),1)]),_:1}),r(qe,{"onUpdate:refreshAddress":t[1]||(t[1]=I=>{l.isEditAddress=I,l.updateAddress()}),customer_id:e.customer_id,modalAction:e.modalAction,address:l.address,showAddressModal:l.isEditAddress,order_id:e.order_id,showBusinessDetailsSection:e.showBusinessDetailsSection,onCloseModal:t[2]||(t[2]=I=>l.showModal=!1)},null,8,["customer_id","modalAction","address","showAddressModal","order_id","showBusinessDetailsSection"])])):g("",!0),l.isEditAddress?g("",!0):(a(),m("div",rl,[l.selectedAddressIndex!=null?(a(),B(T,{key:0,onClick:t[3]||(t[3]=I=>l.emitAddressSelected())},{default:d(()=>[r(ee,{name:"LocationPin"}),L(" "+o(l.$t("Use this address")),1)]),_:1})):g("",!0),r(T,{onClick:t[4]||(t[4]=I=>l.emitAddNewAddress(e.modalAction.type)),type:"primary"},{default:d(()=>[L(o(l.$t("Add new address")),1)]),_:1})]))]),_:1},8,["modelValue","onOpen","title"])])}}}),ul={class:"fct-term-container"},cl={class:"fct-term-input-wrap"},ml={key:0,class:"fct-term-search-result-button-wrap mb-1.5"},pl={class:"search-text"},fl={key:1,class:"fct-term-search-result-list is-scrollable"},vl=["value","checked","onChange"],_l={key:2,class:"empty-text"},hl={key:0,class:"fct-term-selected-list"},gl={class:"fct-term-selected"},yl={class:"text"},bl={class:"fct-term-list-header"},Cl={class:"fct-term-input-inline-wrap"},wl={key:0,class:"fct-term-list-header-button-wrap"},kl={class:"search-text"},xl={class:"fct-term-list-wrap is-scrollable"},Al={key:0,class:"fct-term-list newly-added-list"},$l={class:"title"},Sl={class:"fct-term-label"},Ml=["value","checked","onChange"],Ll={key:1,class:"fct-term-list to-add-list"},El={class:"title"},Vl={class:"fct-term-label"},Il=["value","checked","onChange"],Tl={key:2,class:"fct-term-list available-list"},Ol={class:"title"},Pl={class:"fct-term-label"},Nl=["value","checked","onChange"],Ul={key:3,class:"empty-text"},Bl={class:"dialog-footer"},ze={__name:"Modal",props:{bindToType:{type:String},bindToId:{type:[String,Number]},selected_labels:{type:Array,default:[]},labelModalIsOpen:{type:Boolean,default:!1},shouldEnableEditing:{type:Boolean,default:!0}},emits:["update:update-label","close-label-modal"],setup(e,{emit:l}){const t=Be().ctx,u=e,v=l,i=E([]),p=E([]),w=E([]),x=E(),T=E(""),k=E([]),I=E([]),$=E(!1),q=E(!1),y=E(u.labelModalIsOpen),_=E("");ce(()=>u.labelModalIsOpen,h=>{y.value=h,h&&(w.value=[...i.value])});const b=h=>{h.stopPropagation(),h.preventDefault(),U()},j=()=>{t.$get("labels").then(h=>{k.value=h.labels,i.value=u.selected_labels}).catch(h=>{var V;h.status_code=="422"?W.validationErrors(h):W.error((V=h.data)==null?void 0:V.message)}).finally(()=>{})},U=(h="")=>{const V=T.value||_.value;t.$post("labels",{value:V,bind_to_type:u.bindToType,bind_to_id:u.bindToId}).then(f=>{T.value="",_.value="",k.value.push(f.data),h!=="insideModal"?i.value.push(f.data.id):p.value.push(f.data.id),v("update:update-label",i.value)}).catch(f=>{W.error(f)})};ce(T,h=>{h?(h=h.trim(),I.value=k.value.filter(V=>V.value.toLowerCase().includes(h.toLowerCase())),$.value=!0):(I.value=[],$.value=!1)});const C=h=>{const V=i.value.indexOf(h);V===-1?i.value.push(h):i.value.splice(V,1),v("update:update-label",i.value)},S=h=>{const V=w.value.indexOf(h);V===-1?w.value.push(h):w.value.splice(V,1)},Q=h=>{const V=p.value.indexOf(h);V===-1?p.value.push(h):p.value.splice(V,1)},P=()=>{i.value=[...w.value,...p.value],p.value=[],v("update:update-label",i.value),H()},te=h=>{const V=i.value.indexOf(h);V!==-1&&(i.value.splice(V,1),v("update:update-label",i.value))},se=h=>{$.value&&!x.value.$el.contains(h.target)&&!q.value.contains(h.target)&&($.value=!1,T.value="")},O=z(()=>k.value.filter(h=>i.value.includes(h.id))),K=z(()=>k.value.filter(h=>p.value.includes(h.id))),Z=z(()=>k.value.filter(h=>w.value.includes(h.id)).filter(h=>h.value.toLowerCase().includes(_.value.trim().toLowerCase()))),D=z(()=>k.value.filter(h=>!w.value.includes(h.id)).filter(h=>!p.value.includes(h.id)).filter(h=>h.value.toLowerCase().includes(_.value.trim().toLowerCase())).sort((h,V)=>h.value.localeCompare(V.value))),H=()=>{v("close-label-modal")},de=z(()=>{const h=_.value.trim().toLowerCase(),V=T.value.trim().toLowerCase();return(h||V)===""||I.value.some(f=>f.value.toLowerCase()===h||f.value.toLowerCase()===V)||Z.value.some(f=>f.value.toLowerCase()===h||f.value.toLowerCase()===V)||D.value.some(f=>f.value.toLowerCase()===h||f.value.toLowerCase()===V)});return Se(()=>{j(),document.addEventListener("click",se)}),Ue(()=>{document.removeEventListener("click",se)}),(h,V)=>{const f=M("el-input"),A=M("el-button"),G=M("el-dialog");return a(),m("div",ul,[s("div",cl,[e.shouldEnableEditing?(a(),B(f,{key:0,ref_key:"inputRef",ref:x,modelValue:T.value,"onUpdate:modelValue":V[0]||(V[0]=N=>T.value=N),onKeydown:Ke(b,["enter"])},null,8,["modelValue"])):g("",!0),$.value?(a(),m("div",{key:1,class:"fct-term-search-result",ref_key:"suggestionsRef",ref:q,style:He(T.value==""?"display: none":"")},[T.value!==""&&!de.value?(a(),m("div",ml,[r(A,{type:"info",plain:"",onClick:U,size:"small"},{default:d(()=>[r(ee,{name:"PlusCircle"}),L(" "+o(h.$t("Add"))+" ",1),s("span",pl,'"'+o(T.value)+'"',1)]),_:1})])):g("",!0),I.value.length>0?(a(),m("ul",fl,[(a(!0),m(Y,null,ae(I.value,(N,ne)=>(a(),m("li",{key:ne},[s("label",null,[s("input",{type:"checkbox",value:N.id,checked:i.value.includes(N.id),onChange:ue=>C(N.id)},null,40,vl),L(" "+o(N.value),1)])]))),128))])):g("",!0),I.value.length===0?(a(),m("p",_l,o(h.$t("No labels found.")),1)):g("",!0)],4)):g("",!0)]),O.value.length>0?(a(),m("ul",hl,[(a(!0),m(Y,null,ae(O.value,N=>(a(),m("li",{key:N.id},[s("div",gl,[s("div",yl,o(N.value),1),e.shouldEnableEditing?(a(),B(ee,{key:0,name:"Cross",onClick:ne=>te(N.id)},null,8,["onClick"])):g("",!0)])]))),128))])):g("",!0),r(G,{"before-close":H,"append-to-body":!0,width:"45%",modelValue:y.value,"onUpdate:modelValue":V[3]||(V[3]=N=>y.value=N),title:h.$t("Add labels"),class:"fct-add-labels-modal"},{default:d(()=>[s("div",bl,[s("div",Cl,[r(f,{modelValue:_.value,"onUpdate:modelValue":V[1]||(V[1]=N=>_.value=N),placeholder:h.$t("Search to find or create labels")},{prefix:d(()=>[r(ee,{name:"Search"})]),_:1},8,["modelValue","placeholder"])]),_.value!==""&&!de.value?(a(),m("div",wl,[r(A,{type:"info",plain:"",onClick:V[2]||(V[2]=N=>U("insideModal")),size:"small"},{default:d(()=>[r(ee,{name:"PlusCircle"}),L(" "+o(h.$t("Add"))+" ",1),s("span",kl,'"'+o(_.value)+'"',1)]),_:1})])):g("",!0)]),s("div",xl,[K.value.length>0?(a(),m("ul",Al,[s("li",$l,o(h.$t("Newly added")),1),(a(!0),m(Y,null,ae(K.value,N=>(a(),m("li",{key:N.id},[s("label",Sl,[s("input",{type:"checkbox",value:N.id,checked:p.value.includes(N.id),onChange:ne=>Q(N.id)},null,40,Ml),L(" "+o(N.value),1)])]))),128))])):g("",!0),Z.value.length>0?(a(),m("ul",Ll,[s("li",El,o(h.$t("To add")),1),(a(!0),m(Y,null,ae(Z.value,N=>(a(),m("li",{key:N.id},[s("label",Vl,[s("input",{type:"checkbox",value:N.id,checked:w.value.includes(N.id),onChange:ne=>S(N.id)},null,40,Il),L(" "+o(N.value),1)])]))),128))])):g("",!0),D.value.length>0?(a(),m("ul",Tl,[s("li",Ol,o(h.$t("Available")),1),(a(!0),m(Y,null,ae(D.value,N=>(a(),m("li",{key:N.id},[s("label",Pl,[s("input",{type:"checkbox",value:N.id,checked:w.value.includes(N.id),onChange:ne=>S(N.id)},null,40,Nl),L(" "+o(N.value),1)])]))),128))])):g("",!0),Z.value.length===0&&D.value.length===0&&K.value.length===0?(a(),m("p",Ul,o(h.$t("No labels found.")),1)):g("",!0)]),s("div",Bl,[r(A,{onClick:H},{default:d(()=>[L(o(h.$t("Cancel")),1)]),_:1}),r(A,{type:"primary",onClick:P},{default:d(()=>[L(o(h.$t("Done")),1)]),_:1})])]),_:1},8,["modelValue","title"])])}}},Dl={class:"fct-admin-sidebar-item"},jl={name:"Labels",components:{IconButton:Ee,LabelModal:ze,DynamicIcon:ee},props:{bindToType:{type:String},bindToId:{type:[String,Number]},selectedLabels:{type:Array,default:()=>[]},shouldEnableEditing:{type:Boolean,default:!0}},data(){return{labelModalIsOpen:!1}},mounted(){},methods:{openLabelModal(){this.labelModalIsOpen=!0},updateLabel(e){this.bindToId&&this.bindToType&&this.$post("labels/update-label-selections",{bind_to_type:this.bindToType,bind_to_id:this.bindToId,selectedLabels:e}).then(l=>{W.success(l.message)}).catch(l=>{W.error(l.message)}),this.$emit("update:update-label",e)},closeLabel(){this.labelModalIsOpen=!1}}},xo=Object.assign(jl,{setup(e){return(l,t)=>(a(),B(je,{permission:"labels/manage"},{default:d(()=>[s("div",null,[r(Ae,null,{default:d(()=>[r(ke,{title:l.$t("Labels"),border_bottom:"",title_size:"small"},{action:d(()=>[e.shouldEnableEditing?(a(),B(Ee,{key:0,size:"x-small",bg:"transparent",tag:"button",border:"transparent",onClick:l.openLabelModal},{default:d(()=>[r(ee,{name:"Edit"})]),_:1},8,["onClick"])):g("",!0)]),_:1},8,["title"]),r(xe,null,{default:d(()=>[s("div",Dl,[r(ze,{bindToType:e.bindToType,bindToId:e.bindToId,labelModalIsOpen:l.labelModalIsOpen,selected_labels:e.selectedLabels,shouldEnableEditing:e.shouldEnableEditing,"onUpdate:updateLabel":l.updateLabel,onCloseLabelModal:t[0]||(t[0]=u=>l.labelModalIsOpen=!1)},null,8,["bindToType","bindToId","labelModalIsOpen","selected_labels","shouldEnableEditing","onUpdate:updateLabel"])])]),_:1})]),_:1})])]),_:1}))}}),Fl={class:"fct-customer-edit-modal"},Rl={key:1,class:"fct-form-group"},ql={class:"label"},zl={style:{display:"flex","align-items":"center",gap:"10px"}},Wl={class:"select-use-option"},Jl={class:"fct-compact-form"},Kl={class:"form-heading"},Hl={class:"fct-compact-form fct-customer-address-section"},Zl={style:{"margin-top":"20px"}},Ql={class:"form-error-wrap"},Yl={class:"form-error-text"},Gl={class:"dialog-footer"},Xl={key:3,class:"dialog-footer"},ea={__name:"ChangeOrderCustomer",props:{orderId:{type:[String,Number],default:null,required:!0}},setup(e){const l=e,t=E(null),u=E([]),v=E(!1),i=E(!1),p=E({}),w=window.fluentCartAdminApp||{},x=E({id:"",email:"",full_name:"",first_name:"",last_name:"",state:"",city:"",country:"",postcode:"",country_name:"",contact_id:"",user_id:"",wp_user:""}),T=y=>{if(!y){u.value=[];return}ie.get("customers/",{search:y}).then(_=>{u.value=_.customers.data}).finally(()=>{})},k=()=>{if(!t.value){W.error(n("Please select a customer"));return}ie.post("orders/"+l.orderId+"/change-customer",{customer_id:t.value}).then(y=>{W.success(y.message),setTimeout(()=>{window.location.reload()},300)}).catch(y=>{var _;W.error((_=y.data)==null?void 0:_.message)}).finally(()=>{})},I=()=>{ie.post("orders/"+l.orderId+"/create-and-change-customer",x.value).then(y=>{W.success(y.message),setTimeout(()=>{window.location.reload()},300),p.value={},i.value=!1}).catch(y=>{var _;y.status_code=="422"?(W.validationErrors(y),p.value=y.data):W.error((_=y.data)==null?void 0:_.message)}).finally(()=>{})},$=()=>{i.value=!0},q=()=>{i.value=!1};return(y,_)=>{const b=M("el-button"),j=M("el-option"),U=M("el-select"),C=M("el-checkbox");return a(),m("div",Fl,[i.value?(a(),m("div",{key:0,onClick:q,style:{"margin-bottom":"10px"}},[r(b,{text:"",style:{"margin-top":"0"}},{default:d(()=>[r(ee,{name:"ArrowLeft"}),L(" "+o(c(n)("Back")),1)]),_:1})])):g("",!0),i.value?g("",!0):(a(),m("div",Rl,[s("label",ql,[L(o(c(n)("Select Customer"))+" ",1),r(b,{text:"",class:"fct-create-customer-btn",onClick:Me($,["prevent"])},{default:d(()=>[r(ee,{name:"Plus"}),L(" "+o(c(n)("Add New Customer")),1)]),_:1})]),s("div",zl,[r(U,{modelValue:t.value,"onUpdate:modelValue":_[0]||(_[0]=S=>t.value=S),remote:!0,"remote-method":T,loading:v.value,filterable:"",clearable:"",placeholder:c(n)("Type to search user"),style:{width:"100%"}},{default:d(()=>[(a(!0),m(Y,null,ae(u.value,S=>(a(),B(j,{key:S.id,label:S.full_name,value:S.id},{default:d(()=>[s("div",Wl,[s("span",null,o(S.full_name),1),s("span",null,o(S.email),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","loading","placeholder"])])])),i.value?(a(),m(Y,{key:2},[s("div",Jl,[c(w).is_full_name_required?(a(),B(le,{key:0,label:c(n)("Full Name *"),modelValue:x.value.full_name,"onUpdate:modelValue":_[1]||(_[1]=S=>x.value.full_name=S),class:X(p.value.full_name?"is-error":"")},null,8,["label","modelValue","class"])):(a(),m(Y,{key:1},[r(le,{label:c(n)("First Name *"),modelValue:x.value.first_name,"onUpdate:modelValue":_[2]||(_[2]=S=>x.value.first_name=S),class:X(p.value.first_name?"is-error":"")},null,8,["label","modelValue","class"]),r(le,{label:c(n)("Last Name"),modelValue:x.value.last_name,"onUpdate:modelValue":_[3]||(_[3]=S=>x.value.last_name=S),class:X(p.value.last_name?"is-error":"")},null,8,["label","modelValue","class"])],64)),r(le,{label:c(n)("Email *"),modelValue:x.value.email,"onUpdate:modelValue":_[4]||(_[4]=S=>x.value.email=S),class:X(p.value.email?"is-error":"")},null,8,["label","modelValue","class"])]),s("h4",Kl,o(c(n)("Address")),1),s("div",Hl,[r(Ve,{modelValue:x.value,"onUpdate:modelValue":_[5]||(_[5]=S=>x.value=S)},null,8,["modelValue"]),s("div",Zl,[r(C,{"true-value":"yes","false-value":"no",modelValue:x.value.wp_user,"onUpdate:modelValue":_[6]||(_[6]=S=>x.value.wp_user=S)},{default:d(()=>[r(Fe,{title:c(n)("Create as wordpress user"),content:c(n)("We will create a new user for this customer. If a user with the same email already exists, we will associate the customer with that existing user.")},null,8,["title","content"])]),_:1},8,["modelValue"])]),s("div",Ql,[(a(!0),m(Y,null,ae(p.value,S=>(a(),m("p",Yl,o(S.required),1))),256))])]),s("div",Gl,[r(b,{onClick:_[7]||(_[7]=S=>y.$emit("close"))},{default:d(()=>[L(o(c(n)("Cancel")),1)]),_:1}),r(b,{type:"primary",onClick:I},{default:d(()=>[L(o(c(n)("Create & Attach Customer")),1)]),_:1})])],64)):g("",!0),i.value?g("",!0):(a(),m("div",Xl,[r(b,{type:"primary",onClick:k},{default:d(()=>[L(o(c(n)("Create & Attach Customer")),1)]),_:1})]))])}}},ta={class:"fct-admin-sidebar"},sa={class:"more-btn"},la={key:0,class:"fct-admin-sidebar-item"},aa={class:"name"},oa={class:"email"},na={class:"fct-admin-sidebar-item"},ra={class:"fct-profile-card"},ia=["src","alt"],da={key:0,class:"fct-profile-details"},ua={class:"title"},ca={class:"text"},ma={key:0},pa={class:"text"},fa={key:0,class:"user-info mt-2"},va=["href"],_a={class:"fct-admin-sidebar-item mt-5"},ha={class:"fct-contact-info-list"},ga={class:"flex items-center justify-between gap-2"},ya=["href"],ba={class:"fct-admin-sidebar-item mt-5"},Ca={class:"sidebar-title"},wa={key:0,class:"fct-address-copy-wrap"},ka={class:"text"},xa={key:0,class:"pr-1"},Aa=["innerHTML"],$a={key:1,class:"mt-3"},Sa={class:"pr-1"},Ma=["href"],La={key:1,class:"no-address-text"},Ea={class:"fct-admin-sidebar-item mt-5"},Va={class:"sidebar-title"},Ia={key:0,class:"fct-address-copy-wrap"},Ta={class:"text"},Oa={key:0},Pa=["innerHTML"],Na={key:1,class:"mt-3"},Ua={class:"pr-1"},Ba=["href"],Da={key:1,class:"no-address-text"},ja={class:"fct-admin-sidebar-item"},Fa={class:"flex flex-col gap-2"},Ra={key:0,class:"flex items-baseline gap-1"},qa={class:"shrink-0"},za={key:1,class:"flex items-baseline gap-1"},Wa={class:"shrink-0"},Ja={key:2,class:"flex items-baseline gap-1"},Ka={class:"shrink-0"},Ha={class:"flex items-baseline gap-1"},Za={class:"shrink-0"},Qa={key:3},Ya={class:"block"},Ga={class:"fluent-cart-admin-pages"},Ao={__name:"OrderCustomerInformation",props:{order:{type:Object,default:null},subscription:{type:Object,default:null},shouldEnableEditing:{type:Boolean,default:!0}},emits:["onAddressSelected","onAddressRemove","onOrderUpdated"],setup(e,{emit:l}){var H,de,h,V;const t=e,u=z(()=>t.order||t.subscription||{}),v=z(()=>t.order?t.order.id:t.subscription?t.subscription.parent_order_id:null),i=E([]),p=E((de=(H=u.value)==null?void 0:H.customer)!=null&&de.id?u.value.customer:null),w=E((h=u.value)!=null&&h.billing_address?u.value.billing_address:null),x=E((V=u.value)!=null&&V.shipping_address?u.value.shipping_address:null),T=l,k=E(!1),I=f=>{f==="remove_customer"&&$(),f==="change_customer"?k.value=!0:f==="edit_customer"?S("edit"):f==="manage_billing_address"?te("billing"):f==="manage_shipping_address"&&te("shipping")},$=()=>{u.value.customer_id="",u.value.customer={},p.value=null,w.value=null,x.value=null,T("onAddressRemove"),setTimeout(()=>{O()},50)},q=(f,A)=>{ie.get("customers/",{search:f,with:["admin_customer_search"]}).then(G=>{let N=G.customers.data;i.value=N;let ne=N.map(re=>({id:re.id,value:re.full_name,email:re.email})),ue=jQuery(".fct-customer-autocomplete-dropdown"),F=jQuery(".el-autocomplete-suggestion__list"),R="empty-text";N.length<1?ue.length>0&&(ue.addClass("is-empty-customer"),F.children(`.${R}`).length||F.prepend(`<li class="${R}">No customer found.</li>`)):ue.length>0&&(ue.removeClass("is-empty-customer"),F.children(`.${R}`).remove()),A(ne)}).catch(G=>{W.error(G)})},y=f=>{const A=i.value.find(G=>G.id===f.id)??null;_(A)},_=f=>{p.value=f,u.value.customer=f,u.value.customer_id=f.id,p.value!==null&&(b(),j())},b=()=>{const f=p.value.billing_address;f&&(Array.isArray(f)&&f.length>0?(w.value=f[0],w.value=f.find(A=>A.is_primary.toString()==="1")??w.value):w.value=null,T("onAddressSelected",w.value))},j=()=>{const f=p.value.shipping_address;f&&(Array.isArray(f)&&f.length>0?(x.value=f[0],x.value=f.find(A=>A.is_primary.toString()==="1")??x.value):x.value=null,T("onAddressSelected",x.value))},U=f=>{if(f){if(!v.value){f.type==="shipping"?x.value=f:w.value=f,P.value.showModal=!1,T("onAddressSelected",f);return}ie.post(`orders/${v.value}/update-address-id`,{address_id:f.id,address_type:f.type}).then(A=>{W.success(A.message),f.type==="shipping"?x.value=f:w.value=f,P.value.showModal=!1,T("onAddressSelected",f),A.order&&T("onOrderUpdated",A.order)}).catch(A=>{W.error(A)})}},C=E({showModal:!1,action:"create",title:n("Create New Customer"),customer:{},manageWpUser:"yes"}),S=(f="create")=>{const A=C.value;A.showModal=!0,A.action=f==="create"?"create":"edit",A.title=f==="create"?n("Create New Customer"):n("Edit Customer Information"),A.customer_id=f==="create"?null:p.value.id,A.customer=f==="create"?{}:p.value,A.manageWpUser=f==="create"?"yes":p.value.user_id==="0"?"no":"yes",C.value=A},Q=E(!0),P=E({showManageAddressModal:!1,showModal:!1,modalAction:{type:"billing",action:"create"},title:"",customer_id:"",address_id:"",address:{},address_mock:{name:"",phone:"",email:"",company_name:"",vat_number:"",legal_registration_id:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",is_primary:"0"}}),te=(f="billing",A="edit")=>{P.value.showManageAddressModal=!0,P.value.modalAction.type=f,P.value.modalAction.action=A},se=(f="billing",A="create",G={})=>{Object.keys(G).length>0?(P.value.address={...G},Q.value=!1):P.value.address={...P.value.address_mock},P.value.showModal=!0,P.value.modalAction.type=f,P.value.modalAction.action=A,P.value.showManageAddressModal=!1},O=()=>{let f=jQuery(".el-autocomplete-suggestion__wrap");if(f.length>0){let A=jQuery('<div class="fct-create-customer-button-wrap"><button class="el-button el-button--info el-button--small is-plain"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none"><path d="M1.5 7H12.5M7 1.5V12.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg> Create a new customer</button></div>').on("click",()=>{S()});f.prepend(A)}},K=()=>P.value.modalAction.action==="create"?P.value.modalAction.type==="billing"?n("Add new billing address"):n("Add new shipping Address"):P.value.modalAction.type==="billing"?n("Edit billing address"):n("Edit shipping address"),Z=(f,A)=>{P.value.modalAction.type==="billing"?w.value=A:x.value=A,P.value.showModal=f,P.value.showManageAddressModal=!0,U(A)},D=z(()=>{const f=u.value&&u.value.business_info;return f?!!(f.company_name||f.tax_number||f.legal_registration_id):!1});return ce(()=>u.value,(f,A)=>{f.customer_id!==A.customer_id&&$()}),Se(()=>{O()}),(f,A)=>{var he;const G=M("el-dropdown-item"),N=M("el-dropdown-menu"),ne=M("el-dropdown"),ue=M("el-autocomplete"),F=M("router-link"),R=M("el-icon"),re=M("el-button"),me=M("el-dialog");return a(),m(Y,null,[s("div",ta,[r(Ae,null,{default:d(()=>[r(ke,{title:c(n)("Customer Information"),title_size:"small",border_bottom:""},{action:d(()=>[p.value&&e.shouldEnableEditing?(a(),B(ne,{key:0,trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:I},{dropdown:d(()=>[r(N,null,{default:d(()=>[r(G,{command:"edit_customer"},{default:d(()=>[L(o(c(n)("Edit customer information")),1)]),_:1}),r(G,{command:"manage_shipping_address"},{default:d(()=>[L(o(c(n)("Manage shipping address")),1)]),_:1}),r(G,{command:"manage_billing_address"},{default:d(()=>[L(o(c(n)("Manage billing address")),1)]),_:1}),v.value?(a(),B(G,{key:0,command:"change_customer"},{default:d(()=>[L(o(c(n)("Change customer")),1)]),_:1})):g("",!0),v.value?g("",!0):(a(),B(G,{key:1,command:"remove_customer"},{default:d(()=>[L(o(c(n)("Remove customer")),1)]),_:1}))]),_:1})]),default:d(()=>[s("span",sa,[r(ee,{name:"More"})])]),_:1})):g("",!0)]),_:1},8,["title"]),r(xe,null,{default:d(()=>{var oe,pe,ge,ve,ye,J,fe,Ie,Te;return[p.value===null?(a(),m("div",la,[r(ue,{"popper-class":"fct-customer-autocomplete-dropdown",clearable:"",modelValue:u.value.customer.full_name,"onUpdate:modelValue":A[0]||(A[0]=_e=>u.value.customer.full_name=_e),"fetch-suggestions":q,placeholder:c(n)("Search or create a customer"),disabled:!1,onSelect:y},{prefix:d(()=>[r(ee,{name:"Search"})]),default:d(_e=>[s("span",aa,o(_e.item.value),1),s("span",oa,o(_e.item.email),1)]),_:1},8,["modelValue","placeholder"])])):(a(),m(Y,{key:1},[s("div",na,[s("div",ra,[s("div",{class:"fct-profile-image cursor-pointer",onClick:A[1]||(A[1]=_e=>f.$router.push({name:"view_customer",params:{customer_id:p.value.id}}))},[s("img",{src:p.value.photo,alt:(oe=p.value)==null?void 0:oe.full_name},null,8,ia)]),p.value.id?(a(),m("div",da,[s("div",ua,[r(F,{to:{name:"view_customer",params:{customer_id:p.value.id}}},{default:d(()=>[L(o(p.value.full_name),1)]),_:1},8,["to"])]),s("span",ca,[p.value.purchase_count>0?(a(),m("span",ma,o(c(Ce)(p.value.purchase_count)),1)):g("",!0),L(" "+o(f.$n("Order","Orders",p.value.purchase_count??0,"No Order")),1)]),s("span",pa,o(c(rt)((pe=p.value)==null?void 0:pe.ltv,!0))+" "+o(c(n)("Lifetime Value")),1)])):g("",!0)]),u.value.customer.user_link?(a(),m("div",fa,[L(o(c(n)("WP User:"))+" ",1),s("a",{href:u.value.customer.user_link,target:"_blank",class:"inline-flex items-center gap-1 dark:text-gray-100 text-primary-500 focus:shadow-none hover:!underline"},[L(" #"+o(c(Ce)(u.value.customer.user_id))+" ",1),r(ee,{name:"Redirect",class:"w-2.5 h-2.5 text-primary-500 dark:text-gray-200"})],8,va)])):g("",!0)]),s("div",_a,[s("ul",ha,[s("li",null,[s("div",ga,[s("a",{class:"text",href:"mailto:"+((ge=u.value.customer)==null?void 0:ge.email)},o(p.value.email),9,ya),r(be,{text:p.value.email,showMode:"basic_copy_btn",tooltipText:c(n)("Copy email")},null,8,["text","tooltipText"])])])])]),s("div",ba,[s("h4",Ca,o(c(n)("Shipping Address")),1),x.value!=null?(a(),m("div",wa,[s("span",ka,[x.value.name?(a(),m("strong",xa,o(x.value.name),1)):g("",!0),s("span",{class:"break-all",innerHTML:f.getOrderAddress({...x.value},"shipping",!0)},null,8,Aa),(J=(ye=(ve=x.value)==null?void 0:ve.meta)==null?void 0:ye.other_data)!=null&&J.phone?(a(),m("span",$a,[s("strong",Sa,o(c(n)("Phone"))+":",1),s("a",{href:"tel:"+x.value.meta.other_data.phone,class:"text-system-mid dark:text-gray-50 hover:underline"},o(x.value.meta.other_data.phone),9,Ma)])):g("",!0)]),r(be,{text:f.getOrderAddress({...x.value},"shipping"),showMode:"basic_copy_btn",tooltipText:c(n)("Copy address")},null,8,["text","tooltipText"])])):(a(),m("p",La,o(c(n)("No shipping address provided")),1))]),s("div",Ea,[s("h4",Va,o(c(n)("Billing Address")),1),w.value!=null?(a(),m("div",Ia,[s("div",Ta,[w.value.name?(a(),m("strong",Oa,o(w.value.name),1)):g("",!0),s("span",{class:"break-all",innerHTML:f.getOrderAddress({...w.value},"billing",!0)},null,8,Pa),(Te=(Ie=(fe=w.value)==null?void 0:fe.meta)==null?void 0:Ie.other_data)!=null&&Te.phone?(a(),m("span",Na,[s("strong",Ua,o(c(n)("Phone"))+":",1),s("a",{href:"tel:"+w.value.meta.other_data.phone,class:"text-system-mid dark:text-gray-50 hover:underline"},o(w.value.meta.other_data.phone),9,Ba)])):g("",!0)]),r(be,{text:f.getOrderAddress({...w.value},"billing"),showMode:"basic_copy_btn",tooltipText:c(n)("Copy address")},null,8,["text","tooltipText"])])):(a(),m("p",Da,o(c(n)("No shipping address provided")),1))])],64))]}),_:1})]),_:1}),D.value?(a(),B(Ae,{key:0,class:"mt-4"},{default:d(()=>[r(ke,{title:c(n)("Business Information"),title_size:"small",border_bottom:""},null,8,["title"]),r(xe,null,{default:d(()=>[s("div",ja,[s("div",Fa,[u.value.business_info.company_name?(a(),m("div",Ra,[s("strong",qa,o(c(n)("Company"))+":",1),s("span",null,o(u.value.business_info.company_name),1)])):g("",!0),u.value.business_info.tax_number?(a(),m("div",za,[s("strong",Wa,o(c(n)("VAT/Tax ID"))+":",1),s("span",null,o(u.value.business_info.tax_number),1)])):g("",!0),u.value.business_info.legal_registration_id?(a(),m("div",Ja,[s("strong",Ka,o(c(n)("Reg. ID"))+":",1),s("span",null,o(u.value.business_info.legal_registration_id),1)])):g("",!0),s("div",Ha,[s("strong",Za,o(c(n)("Charge Reversed"))+":",1),s("span",null,o(u.value.is_reverse_charge_tax_order?c(n)("Yes"):c(n)("No")),1)]),u.value.business_info.reverse_charge_declaration?(a(),m("div",Qa,[s("strong",Ya,o(c(n)("Reverse Charge Declaration"))+":",1),s("span",null,o(u.value.business_info.reverse_charge_declaration),1)])):g("",!0)])])]),_:1})]),_:1})):g("",!0)]),r(vt,{onSelectNewCustomer:A[2]||(A[2]=oe=>{_(oe),C.value.showModal=!1}),customerModalInfos:C.value,customer_id:C.value.customer_id,customer:C.value.customer,onCloseModal:A[3]||(A[3]=oe=>C.value.showModal=!1)},null,8,["customerModalInfos","customer_id","customer"]),r(dl,{modalAction:P.value.modalAction,onOnAddressSelected:U,"onUpdate:showAddressModal":A[4]||(A[4]=oe=>P.value.showManageAddressModal=oe),showAddressModal:P.value.showManageAddressModal,customer_id:(he=p.value)==null?void 0:he.id,order_id:v.value,showBusinessDetailsSection:!0,onAddNewAddress:se},null,8,["modalAction","showAddressModal","customer_id","order_id"]),r(me,{"show-close":!0,modelValue:P.value.showModal,"onUpdate:modelValue":A[7]||(A[7]=oe=>P.value.showModal=oe),"append-to-body":!0,title:K()},{default:d(()=>[s("div",Ga,[r(re,{text:"",onClick:A[5]||(A[5]=()=>{P.value.showManageAddressModal=!0,P.value.showModal=!1}),class:"mb-4"},{default:d(()=>[r(R,null,{default:d(()=>[r(c(De))]),_:1}),L(" "+o(f.$t("Manage address")),1)]),_:1}),r(qe,{"onUpdate:refreshAddress":Z,customerAddressModalInfos:P.value,customer_id:p.value.id,modalAction:P.value.modalAction,address:P.value.address,showAddressModal:P.value.showModal,showSetAsAlsoCheckbox:Q.value,showBusinessDetailsSection:!0,order_id:v.value,onCloseModal:A[6]||(A[6]=()=>{P.value.showModal=!1,P.value.showManageAddressModal=!0})},null,8,["customerAddressModalInfos","customer_id","modalAction","address","showAddressModal","showSetAsAlsoCheckbox","order_id"])])]),_:1},8,["modelValue","title"]),v.value?(a(),B(me,{key:0,modelValue:k.value,"onUpdate:modelValue":A[9]||(A[9]=oe=>k.value=oe),title:f.$t("Change Customer")},{default:d(()=>[r(ea,{"order-id":v.value,onClose:A[8]||(A[8]=oe=>k.value=!1)},null,8,["order-id"])]),_:1},8,["modelValue","title"])):g("",!0)],64)}}};export{Re as C,ko as L,wo as O,Ms as P,bo as _,vt as a,be as b,qe as c,dl as d,xo as e,Ao as f,ea as g,Co as u}; | |