import{b as C}from"./vendor-vue-runtime-dom-B2rky8vu.js";import{_ as N}from"./Button.vue_vue_type_style_index_0_lang-CxqKrtR4.js";import{f as V}from"./fieldsStore-CQRN0FvQ.js";import{u as w}from"./translationsStore-D6vLzgNA.js";import{d as B,e as D,f as e,i as s,x as o,t as u,F as m,z as _,B as I,j as S,r as E}from"./vendor-vue-runtime-core-DwK6Ry68.js";import{r as v,u as t}from"./vendor-vue-reactivity-CheHbvBM.js";import{t as c}from"./vendor-vue-shared-DrzsEcag.js";import{_ as F}from"./vendor-vue3-html2pdf-KR020wX8.js";const H={class:"ccb-promocodes",style:{width:"100%"}},L={class:"ccb-promocodes__labels"},$={class:"ccb-promocodes__labels--info"},j={key:0,class:"ccb-required-tooltip"},q={class:"ccb-promocodes__labels--toggle"},z={key:0,class:"ccb-promocodes__input"},A={class:"ccb-promocodes__input--wrapper"},M={key:1,class:"ccb-promocodes__list"},U={key:0,class:"ccb-promocodes__list-title"},G=["onClick"],J=B({__name:"Promocode",setup(K){const{promocodes:g,applyPromocode:y,removePromocode:b,originalPromocodes:x}=V(),a=v(""),r=v(""),i=v(!0),l=w(),k=()=>{i.value=!i.value},p=D(()=>g.value),h=()=>{a.value.length&&(x.value.includes(a.value)?p.value.includes(a.value)?p.value.includes(a.value)&&(r.value="already_exist"):(y(a.value),a.value=""):r.value="promocode_not_exist")},T=f=>{b(f),r.value=""};return(f,n)=>(s(),e("div",H,[o("div",L,[o("div",$,c(t(l).getTranslations.havePromoCode),1),r.value!==""?(s(),e("div",j,[r.value==="already_exist"?(s(),e(m,{key:0},[_(c(t(l).getTranslations.promoCodeIsApplied),1)],64)):r.value==="promocode_not_exist"?(s(),e(m,{key:1},[_(c(t(l).getTranslations.promoCodeNotExist),1)],64)):u("",!0)])):u("",!0),o("div",q,[_(c(t(l).getTranslations.promoCode)+" ",1),o("span",{onClick:k},c(i.value?t(l).getTranslations.hide:t(l).getTranslations.show),1)])]),i.value?(s(),e("div",z,[o("div",A,[I(o("input",{"onUpdate:modelValue":n[0]||(n[0]=d=>a.value=d),type:"text",onInput:n[1]||(n[1]=d=>r.value="")},null,544),[[C,a.value]])]),o("div",null,[S(t(N),{type:"success","on-click":h,text:t(l).getTranslations.apply},null,8,["text"])])])):u("",!0),i.value?(s(),e("div",M,[p.value.length?(s(),e("div",U,c(t(l).getTranslations.appliedPromoCodes)+": ",1)):u("",!0),(s(!0),e(m,null,E(p.value,(d,P)=>(s(),e("div",{key:d,class:"ccb-promocodes__list--item"},[o("span",null,c(d),1),o("span",{class:"action",onClick:()=>T(P)},n[2]||(n[2]=[o("i",{class:"ccb-icon-close"},null,-1)]),8,G)]))),128))])):u("",!0)]))}}),eo=F(J,[["__scopeId","data-v-5dfc235a"]]);export{eo as P};
//# sourceMappingURL=Promocode-Z4DoJYJW.js.map
