import{r as T,l as B}from"./fieldsStore-CNpVuoPu.js";import{u as I}from"./translationsStore-D6vLzgNA.js";import{_ as N}from"./RequiredHint.vue_vue_type_style_index_0_lang-DGTCbwUk.js";import{d as O,e as u,f as d,i,x as s,k as R,t as h,z as S,F as w,r as z}from"./vendor-vue-runtime-core-DwK6Ry68.js";import{t as $,u as t}from"./vendor-vue-reactivity-CheHbvBM.js";import{t as v,a as k}from"./vendor-vue-shared-DrzsEcag.js";import{_ as D}from"./vendor-vue3-html2pdf-KR020wX8.js";import"./vendor-pinia-BSPefQhS.js";import"./settingsStore-8bwiLMEn.js";import"./convert-case-to-camel-case.utils-CK5dBN7n.js";import"./appStore-CFAkQG2b.js";import"./vendor-moment-Cv92BTSA.js";import"./vendor-bootstrap-CCU-90um.js";import"./vendor-jspdf-UFhKzYHA.js";import"./vendor-php-date-formatter-DSpPwBF8.js";import"./callbackStore-BhxBUA6V.js";import"./vendor-html2pdf.js-B-tok4Ns.js";import"./vendor-html2canvas-BfYXEYrK.js";import"./vendor-vue-runtime-dom-B2rky8vu.js";const E={class:"ccb-order-field__wrapper"},L={class:"ccb-order-field__title"},M={class:"ccb-order-field__label"},W={key:0,class:"ccb-order-required-mark"},j=["for"],A=["id","name","value","checked","onChange"],G={class:"ccb-checkbox-label"},H=O({__name:"OrderCheckbox",props:{field:{}},setup(x){const g=x,{field:e}=$(g),{checkFieldRequired:q}=T(),C=I(),p=u(()=>e.value.required?q(e.value):!1),m=u(()=>e.value.selectedIdx||[]),F=u(()=>Math.random().toString(36).substring(2,15)),V=n=>{var _,f,b;let a=e.value.selectedIdx||[];m.value.includes(n)?a=((_=e.value.selectedIdx)==null?void 0:_.filter(o=>o!==n))||[]:a.push(n);let c=[];const l=((b=(f=e.value)==null?void 0:f.attributes)==null?void 0:b.options)||[];for(let o=0;o<l.length;o++){const y=l[o];a.includes(o)&&c.push(y.optionText||"")}const{updateValue:r}=B();e.value.value=c,r(e.value.id,e.value.value,a)};return(n,a)=>{var c;return i(),d("div",{class:k(["ccb-order-field ccb-order-checkbox",{[`ccb-col-${t(e).fieldWidth}`]:!0,"ccb-order-field--required":p.value}])},[s("div",E,[s("div",L,[p.value?(i(),R(N,{key:0,text:t(C).getTranslations.requiredField},null,8,["text"])):h("",!0),s("label",M,[S(v(t(e).label)+" ",1),t(e).required?(i(),d("span",W,"*")):h("",!0)])]),s("div",{class:k(["ccb-default-checkbox",{[((c=t(e).attributes)==null?void 0:c.display)||""]:!0}])},[(i(!0),d(w,null,z(t(e).attributes.options,(l,r)=>(i(),d("label",{for:t(e).id+"order_checkbox_"+r,key:r},[s("input",{type:"checkbox",id:t(e).id+"order_checkbox_"+r,name:F.value,value:l.optionText,checked:m.value.includes(r),onChange:()=>V(r)},null,40,A),s("span",G,v(l.optionText),1)],8,j))),128))],2)])],2)}}}),ue=D(H,[["__scopeId","data-v-4cb03ba0"]]);export{ue as default};
//# sourceMappingURL=OrderCheckbox-B-bLGtvR.js.map
