import{d as U,s as F,r as d,M as L,f as I,g as x,i as a,w as s,I as B,h as i,Y as j,L as k,E as C,j as n,F as T,C as M,x as E,l as y,k as f,aa as P,A as w,y as $,Z as H,dj as Y,dk as Z,a4 as z,_ as G}from"./index-N7CMQwFv.js";import{V as S}from"./VRow-CGgRlzLk.js";import{V as u}from"./VCol-xRADuXqd.js";import{V as J}from"./VAutocomplete-B-jGSTKg.js";/* empty css              */import"./VSelect-CAAOHY78.js";import"./VList-BYq4u0VJ.js";import"./VMenu-Dbaxs5uG.js";import"./VChip-iaVLrPY0.js";import"./VSlideGroup-BGEgBoXK.js";import"./filter-D7iDI7IV.js";const K={class:"btn-footer d-flex"},Q={class:"btn-cancel"},W={class:"btn-save ml-5"},X=U({__name:"vatOss",props:["activeTab"],setup(h){const A=h,p=F(),l=d({ioss:"",vatItems:[{countryId:null,vatIdNumber:""}]}),m=d(!1),D=t=>{l.value.vatItems.splice(t,1),c.value-=1},c=d(1),O=()=>{l.value.vatItems.push({countryId:null,vatIdNumber:""}),c.value+=1},V=d(!1),_=async()=>{Z().then(t=>{t.data&&(l.value=t.data,c.value=t.data.vatItems.length)}).catch(t=>{})},N=async t=>{if(!(await t).valid)return;if(!m.value){p.changeSnackbar({color:"#ff4c51",location:"top",variant:"elevated",text:"Please agree to the value-added tax terms !",visible:!0});return}const r=l.value;Y(r).then(o=>{p.changeSnackbar({color:"#7367f0",location:"top",variant:"elevated",text:"Set Successful !",visible:!0})})},g=d([]),q=async()=>{const t=await z();g.value=t.data.countryInfoList};L(()=>A.activeTab,t=>{t==4&&(_(),q())},{immediate:!0});const b={required:t=>!!t||"IOSS is required.",countryRequired:t=>!!t||"Country is required.",vatIdRequired:t=>!!t||"VAT ID number is required."},R=async()=>{await _(),p.changeSnackbar({color:"#7367f0",location:"top",variant:"elevated",text:"Reset Successful !",visible:!0})};return(t,e)=>(I(),x(T,null,[a($,{class:"vatOss-box pa-5"},{default:s(()=>[a(B,{class:"pa-0"},{default:s(()=>[e[8]||(e[8]=i("div",{class:"text-title"}," Tax ",-1)),e[9]||(e[9]=i("div",{class:"mt-5 mb-5 text-payment-title"}," Submit IOSS ",-1)),a(j,{ref:"refForm",onSubmit:k(N,["prevent"])},{default:s(()=>[a(S,null,{default:s(()=>[a(u,{md:"6",cols:"12"},{default:s(()=>[a(C,{modelValue:n(l).ioss,"onUpdate:modelValue":e[0]||(e[0]=r=>n(l).ioss=r),label:"IOSS",variant:"outlined",rules:[b.required]},null,8,["modelValue","rules"])]),_:1}),a(u,{cols:"12"},{default:s(()=>e[4]||(e[4]=[i("div",{class:"text-payment-title"}," Submit VAT ",-1)])),_:1,__:[4]})]),_:1}),(I(!0),x(T,null,M(n(c),(r,o)=>(I(),E(S,{key:o},{default:s(()=>[a(u,{md:"6",cols:"12"},{default:s(()=>[a(J,{modelValue:n(l).vatItems[o].countryId,"onUpdate:modelValue":v=>n(l).vatItems[o].countryId=v,label:"Country","auto-select-first":!0,items:n(g),"item-title":"enName","item-value":"id","return-object":!1,variant:"outlined",rules:[b.countryRequired]},null,8,["modelValue","onUpdate:modelValue","items","rules"])]),_:2},1024),a(u,{md:"6",cols:"12"},{default:s(()=>[a(C,{modelValue:n(l).vatItems[o].vatIdNumber,"onUpdate:modelValue":v=>n(l).vatItems[o].vatIdNumber=v,label:"VAT ID Number",rules:[b.vatIdRequired],variant:"outlined","append-icon":"custom-delete-bin-line","onClick:append":v=>D(o)},null,8,["modelValue","onUpdate:modelValue","rules","onClick:append"])]),_:2},1024)]),_:2},1024))),128)),a(S,null,{default:s(()=>[a(u,{md:"12",cols:"12"},{default:s(()=>[a(y,{"prepend-icon":"custom-add-line",variant:"outlined",height:"42px",width:"291px",color:"#6D788D",onClick:O},{default:s(()=>e[5]||(e[5]=[f(" Add VAT ID for another country ")])),_:1,__:[5]})]),_:1}),a(u,{md:"8",cols:"12"},{default:s(()=>[a(P,{modelValue:n(m),"onUpdate:modelValue":e[1]||(e[1]=r=>w(m)?m.value=r:null),label:"Here by I confirm that the provided VAT ID / IOSS number is assigned to my business and should be used going forward to identify my business for the billing and tax reporting purposes. VAT ID /IOSS will be used for the stores owned by this account"},null,8,["modelValue"])]),_:1}),a(u,{md:"6",cols:"12"},{default:s(()=>[i("div",K,[i("div",Q,[a(y,{variant:"outlined",color:"#6D788D",height:"42px",onClick:k(R,["stop"])},{default:s(()=>e[6]||(e[6]=[f(" Reset ")])),_:1,__:[6]})]),i("div",W,[a(y,{class:"text-none text-subtitle-1",color:"#000000",height:"42px",variant:"flat",type:"submit",onClick:e[2]||(e[2]=r=>{var o;return(o=t.refForm)==null?void 0:o.validate()})},{default:s(()=>e[7]||(e[7]=[f(" Save ")])),_:1,__:[7]})])])]),_:1})]),_:1})]),_:1},512)]),_:1,__:[8,9]})]),_:1}),a(H,{modelValue:n(V),"onUpdate:modelValue":e[3]||(e[3]=r=>w(V)?V.value=r:null),location:"top",variant:"flat",color:"error"},{default:s(()=>e[10]||(e[10]=[f(" Must retain a VAT ")])),_:1,__:[10]},8,["modelValue"])],64))}}),me=G(X,[["__scopeId","data-v-f70305a4"]]);export{me as default};