1"use strict";(self["webpackChunkclient"]=self["webpackChunkclient"]||[]).push([[1348],{51348:function(e,t,i){i.r(t),i.d(t,{default:function(){return Je}});var s=i(20641),a=i(90033),l=i(53751);const o={class:"o-mediumwidth"},d={key:0},n={class:"level mb-5"},r={class:"level-left"},u={class:"level-item"},c={class:"title"},m={class:"card p-5"},p={class:"mt-4"},g={key:0,class:"has-text-centered p-5"},h={class:"builder-headers"},f={class:"section-header mb-0"},b={class:"section-header mb-0"},v={class:"two-panel-layout"},F={class:"left-panel"},k={class:"available-fields-scroll"},y=["draggable","onDragstart","onClick"],C={class:"is-flex is-align-items-center is-justify-content-space-between"},$={class:"is-flex is-align-items-center"},L={class:"icon is-small mr-2"},_={key:0,class:"tag is-light is-rounded is-small"},x={class:"available-fields-scroll"},S={class:"is-flex is-justify-content-flex-end mb-3"},w={class:"icon is-small"},T=["draggable","onDragstart","onClick"],V={class:"is-flex is-align-items-center is-justify-content-space-between"},D={class:"is-flex is-align-items-center"},I={class:"icon is-small mr-2"},E={class:"tag is-info is-light is-rounded is-small ml-2"},U={class:"is-flex is-align-items-center"},O={key:0,class:"tag is-light is-rounded is-small mr-2"},A=["onClick"],R=["onClick"],X={key:0,class:"has-text-grey has-text-centered p-4"},B={class:"right-panel"},M={key:0,class:"empty-state p-6 has-text-centered has-text-grey"},q={class:"icon is-large mb-3"},Q=["onDragstart","onDrop"],j={class:"is-flex is-align-items-center field-row"},K={class:"icon is-small drag-handle mr-3"},W={class:"has-text-weight-semibold"},H={key:0,class:"tag is-info is-light is-rounded is-small ml-2"},P={class:"ml-auto is-flex is-align-items-center"},z=["onClick"],G={class:"icon is-small"},Y={class:"mt-4 is-flex is-justify-content-flex-end"},J={class:"mt-4"},N={class:"section-header"},Z={class:"setting-row"},ee={class:"has-text-weight-semibold"},te={class:"setting-description"},ie={class:"setting-row"},se={class:"has-text-weight-semibold"},ae={class:"setting-description"},le={class:"section-header mt-5"},oe={class:"mt-4"},de={class:"section-header"},ne={class:"setting-row"},re={class:"has-text-weight-semibold"},ue={class:"section-header mt-5"},ce={class:"field has-addons"},me={class:"control is-expanded"},pe={class:"control"},ge={class:"field has-addons"},he={class:"control is-expanded"},fe={class:"control"},be={class:"section-header mt-5"};function ve(e,t,i,ve,Fe,ke){const ye=(0,s.g2)("b-loading"),Ce=(0,s.g2)("MobileViewHeader"),$e=(0,s.g2)("font-awesome-icon"),Le=(0,s.g2)("b-tab-item"),_e=(0,s.g2)("b-tabs"),xe=(0,s.g2)("b-checkbox"),Se=(0,s.g2)("b-button"),we=(0,s.g2)("b-switch"),Te=(0,s.g2)("b-input"),Ve=(0,s.g2)("b-field"),De=(0,s.g2)("b-colorpicker"),Ie=(0,s.g2)("EventCustomFieldCreateModal");return(0,s.uX)(),(0,s.CE)("section",o,[(0,s.bF)(ye,{modelValue:Fe.isLoading,"onUpdate:modelValue":t[0]||(t[0]=e=>Fe.isLoading=e),"is-full-page":!1},null,8,["modelValue"]),Fe.item&&e.isGrantedOwner(Fe.item)&&Fe.item.requiresRegistrationForm?((0,s.uX)(),(0,s.CE)("div",d,[(0,s.bF)(Ce,{title:e.$t("Registration form"),"back-route":{name:"EventShow",params:{item:Fe.itemUuid}}},null,8,["title","back-route"]),(0,s.Lk)("div",n,[(0,s.Lk)("div",r,[(0,s.Lk)("div",u,[(0,s.Lk)("h2",c,(0,a.v_)(e.$t("Registration form")),1)])])]),(0,s.Lk)("div",m,[Fe.item.settings?((0,s.uX)(),(0,s.Wv)(_e,{key:0,modelValue:Fe.activeTab,"onUpdate:modelValue":[t[14]||(t[14]=e=>Fe.activeTab=e),ke.onOuterTabChange],class:"tabs-pill",animated:!1},{default:(0,s.k6)(()=>[(0,s.bF)(Le,{label:e.$t("Form fields")},{default:(0,s.k6)(()=>[(0,s.Lk)("div",p,[Fe.isLoadingForm?((0,s.uX)(),(0,s.CE)("div",g,[(0,s.bF)(ye,{"is-full-page":!1,active:!0})])):((0,s.uX)(),(0,s.CE)(s.FK,{key:1},[(0,s.Lk)("div",h,[(0,s.Lk)("div",f,(0,a.v_)(e.$t("available_fields")),1),(0,s.Lk)("div",b,(0,a.v_)(e.$t("form_fields")),1)]),(0,s.Lk)("div",v,[(0,s.Lk)("div",F,[(0,s.bF)(_e,{modelValue:Fe.availableFieldsTab,"onUpdate:modelValue":[t[2]||(t[2]=e=>Fe.availableFieldsTab=e),ke.onInnerTabChange],class:"tabs-pill available-fields-tabs",animated:!1},{default:(0,s.k6)(()=>[(0,s.bF)(Le,{label:e.$t("standard_fields")},{default:(0,s.k6)(()=>[(0,s.Lk)("div",k,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(Fe.availableStandardFieldsList,t=>((0,s.uX)(),(0,s.CE)("div",{key:t.key,class:(0,a.C4)(["card p-3 mb-2 available-field",{"is-disabled":ke.isFieldInForm(t)}]),draggable:!ke.isFieldInForm(t),onDragstart:e=>ke.onDragStartAvailable(e,t,"standard"),onClick:e=>ke.clickAddStandardField(t)},[(0,s.Lk)("div",C,[(0,s.Lk)("div",$,[(0,s.Lk)("span",L,[(0,s.bF)($e,{icon:"fa-light fa-plus"}
1)]),(0,s.Lk)("span",null,(0,a.v_)(e.$t(t.label)),1)]),ke.isFieldInForm(t)?((0,s.uX)(),(0,s.CE)("span",_,(0,a.v_)(e.$t("in form")),1)):(0,s.Q3)("",!0)])],42,y))),128))])]),_:1},8,["label"]),(0,s.bF)(Le,{label:e.$t("custom_fields")},{default:(0,s.k6)(()=>[(0,s.Lk)("div",x,[(0,s.Lk)("div",S,[(0,s.Lk)("button",{type:"button",class:"button is-small is-light is-rounded",onClick:t[1]||(t[1]=(...e)=>ke.openCreateCustomField&&ke.openCreateCustomField(...e))},[(0,s.Lk)("span",w,[(0,s.bF)($e,{icon:"fa-light fa-plus"})]),(0,s.Lk)("span",null,(0,a.v_)(e.$t("Create")),1)])]),((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(Fe.customFields,t=>((0,s.uX)(),(0,s.CE)("div",{key:"custom-"+t.id,class:(0,a.C4)(["card p-3 mb-2 available-field",{"is-disabled":ke.isCustomFieldInForm(t)}]),draggable:!ke.isCustomFieldInForm(t),onDragstart:e=>ke.onDragStartAvailable(e,t,"custom"),onClick:e=>ke.clickAddCustomField(t)},[(0,s.Lk)("div",V,[(0,s.Lk)("div",D,[(0,s.Lk)("span",I,[(0,s.bF)($e,{icon:"fa-light fa-plus"})]),(0,s.Lk)("span",null,(0,a.v_)(t.name),1),(0,s.Lk)("span",E,(0,a.v_)(t.fieldType),1)]),(0,s.Lk)("div",U,[ke.isCustomFieldInForm(t)?((0,s.uX)(),(0,s.CE)("span",O,(0,a.v_)(e.$t("in form")),1)):(0,s.Q3)("",!0),(0,s.Lk)("button",{type:"button",class:"edit-field-btn",onClick:(0,l.D$)(e=>ke.editCustomField(t),["stop"])},[(0,s.bF)($e,{icon:"fa-light fa-pen"})],8,A),(0,s.Lk)("button",{type:"button",class:"delete-field-btn",onClick:(0,l.D$)(e=>ke.deleteCustomField(t),["stop"])},[(0,s.bF)($e,{icon:"fa-light fa-trash"})],8,R)])])],42,T))),128)),0===Fe.customFields.length?((0,s.uX)(),(0,s.CE)("p",X,(0,a.v_)(e.$t("no_custom_fields")),1)):(0,s.Q3)("",!0)])]),_:1},8,["label"])]),_:1},8,["modelValue","onUpdate:modelValue"])]),(0,s.Lk)("div",B,[(0,s.Lk)("div",{class:"form-fields-container",onDragover:t[5]||(t[5]=(0,l.D$)(()=>{},["prevent"])),onDrop:t[6]||(t[6]=e=>ke.onDropToForm(e))},[0===Fe.formConfig.fields.length?((0,s.uX)(),(0,s.CE)("div",M,[(0,s.Lk)("span",q,[(0,s.bF)($e,{icon:"fa-light fa-arrow-left",size:"2x"})]),(0,s.Lk)("p",null,(0,a.v_)(e.$t("drag_fields_here")),1)])):(0,s.Q3)("",!0),((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(Fe.formConfig.fields,(i,o)=>((0,s.uX)(),(0,s.CE)("div",{key:ke.getFieldKey(i),class:"card px-3 py-2 mb-2 form-field",draggable:"true",onDragstart:e=>ke.onDragStartForm(e,o),onDragover:t[3]||(t[3]=(0,l.D$)(()=>{},["prevent"])),onDrop:(0,l.D$)(e=>ke.onDropReorder(e,o),["stop"]),onDragend:t[4]||(t[4]=(...e)=>ke.onDragEnd&&ke.onDragEnd(...e))},[(0,s.Lk)("div",j,[(0,s.Lk)("span",K,[(0,s.bF)($e,{icon:"fa-light fa-bars"})]),(0,s.Lk)("span",W,(0,a.v_)(ke.getFieldLabel(i)),1),"custom"===i.type?((0,s.uX)(),(0,s.CE)("span",H,(0,a.v_)(ke.getCustomFieldType(i)),1)):(0,s.Q3)("",!0),(0,s.Lk)("span",P,[(0,s.bF)(xe,{modelValue:i.mandatory,"onUpdate:modelValue":e=>i.mandatory=e,disabled:ke.isAlwaysRequired(i),size:"is-small",class:"mr-3"},{default:(0,s.k6)(()=>[(0,s.eW)((0,a.v_)(e.$t("required")),1)]),_:1},8,["modelValue","onUpdate:modelValue","disabled"]),ke.canRemoveField(i)?((0,s.uX)(),(0,s.CE)("button",{key:0,type:"button",class:"button is-small is-light is-rounded",onClick:e=>ke.removeField(o)},[(0,s.Lk)("span",G,[(0,s.bF)($e,{icon:"fa-light fa-times"})])],8,z)):(0,s.Q3)("",!0)])])],40,Q))),128))],32),(0,s.Lk)("div",Y,[(0,s.bF)(Se,{type:"is-primary",class:"is-rounded",loading:Fe.isSavingForm,onClick:ke.saveFormConfig},{default:(0,s.k6)(()=>[(0,s.eW)((0,a.v_)(e.$t("save_changes")),1)]),_:1},8,["loading","onClick"])])])])],64))])]),_:1},8,["label"]),(0,s.bF)(Le,{label:e.$t("Settings")},{default:(0,s.k6)(()=>[(0,s.Lk)("div",J,[(0,s.Lk)("div",N,(0,a.v_)(e.$t("Registration Options")),1),(0,s.Lk)("div",Z,[(0,s.Lk)("div",null,[(0,s.Lk)("div",ee,(0,a.v_)(e.$t("Disable newsletter subscription")),1),(0,s.Lk)("div",te,(0,a.v_)(e.$t("Hide the newsletter subscription checkbox from the registration form")),1)]),(0,s.bF)(we,{modelValue:Fe.item.settings.disableSubscribe,"onUpdate:modelValue":[t[7]||(t[7]=e=>Fe.item.settings.disableSubscribe=e),e.saveSettings]},null,8,["modelValue","onUpdate:modelValue"])]),(0,s.Lk)("div",ie,[(0,s.Lk)("div",null,[(0,s.Lk)("div",se,(0,a.v_)(e.$t("Disable register checkbox")),1),(0,s.Lk)("div",ae,(0,a.v_)(e.$t("Hide the account creation checkbox from the registration form")),1)]),(0,s.bF)(we,{modelValue:Fe.item.settings.disableRegister,"onUpdate:modelValue":[t[8]||(t[8]=e=>Fe.item.settings.disableRegister=e),e.saveSettings]},null,8,["modelValue","onUpdate:modelValue"])]),(0,s.Lk)("div",le,(0,a.v_)(e.$t("Custom Content")),1),(0,s.bF)(Ve,{label:e.$t("Custom text at bottom of registration form")},{default:(0,s.k6)(()=>[(0,s.bF)(Te,{modelValue:Fe.item.registrationFormText,"onUpdate:modelValue":t[9]||(t[9]=e=>Fe.item.registrationFormText=e),type:"textarea",rows:"3",placeholder:e.$t("Enter custom text that will appear before the consent checkboxes"),onBlur:e.saveSettings},null,8,["modelValue","placeholder","onBlur"])]),_:1},8,["label"])])]),_:1},8,["label"]),(0,s.bF)(Le,{label:e.$t("Appearance")},{default:(0,s.k6)(()=>[(0,s.Lk)("div",oe,[(0,s.Lk)("div",de,(0,a.v_)(e.$t("Display")),1),(0,s.Lk)("div",ne,[(0,s.Lk)("div",null,[(0,s.Lk)("div",re,(0,a.v_)(e.$t("Display title")),1)]),(0,s.bF)(we,{modelValue:Fe.item.settings.showTitle,"onUpdate:modelValue":[t[10]||(t[10]=e=>Fe.item.settings.showTitle=e),e.saveSettings]},null,8,["modelValue","onUpdate:modelValue"])]),(0,s.Lk)("div",ue,(0,a.v_)(e.$t("Colors")),1),(0,s.bF)(Ve,{label:e.$t("Selected color"),class:"mb-4"},{default:(0,s.k6)(()=>[(0,s.Lk)("div",ce,[(0,s.Lk)("div",me,[(0,s.bF)(Te,{modelValue:Fe.item.settings.colorSelection,"onUpdate:modelValue":t[11]||(t[11]=e=>Fe.item.settings.colorSelection=e),value:Fe.item.settings.colorSelection||"#FFE089",placeholder:"#FFE089",onBlur:e.saveSettings},null,8,["modelValue","value","onBlur"])]),(0,s.Lk)("div",pe,[(0,s.bF)(De,{representation:"square","native-value":Fe.item.settings.colorSelection||"#FFE089","color-formatter":ke.colorFormatter,"onUpdate:modelValue":ke.updateColorSelection},{trigger:(0,s.k6)(()=>[(0,s.Lk)("button",{type:"button",class:"button",style:(0,a.Tr)({backgroundColor:Fe.item.settings.colorSelection||"#FFE089",width:"40px",height:"40px",border:"1px solid var(--orgo-border-medium)"})},null,4)]),_:1},8,["native-value","color-formatter","onUpdate:modelValue"])])])]),_:1},8,["label"]),(0,s.bF)(Ve,{label:e.$t("Button color"),class:"mb-4"},{default:(0,s.k6)(()=>[(0,s.Lk)("div",ge,[(0,s.Lk)("div",he,[(0,s.bF)(Te,{modelValue:Fe.item.settings.colorButton,"onUpdate:modelValue":t[12]||(t[12]=e=>Fe.item.settings.colorButton=e),value:Fe.item.settings.colorButton||"#3173EE",placeholder:"#3173EE",onBlur:e.saveSettings},null,8,["modelValue","value","onBlur"])]),(0,s.Lk)("div",fe,[(0,s.bF)(De,{representation:"square","native-value":Fe.item.settings.colorButton||"#3173EE","color-formatter":ke.colorFormatter,"onUpdate:modelValue":ke.updateColorButton},{trigger:(0,s.k6)(()=>[(0,s.Lk)("button",{type:"button",class:"button",style:(0,a.Tr)({backgroundColor:Fe.item.settings.colorButton||"#3173EE",width:"40px",height:"40px",border:"1px solid var(--orgo-border-medium)"})},null,4)]),_:1},8,["native-value","color-formatter","onUpdate:modelValue"])])])]),_:1},8,["label"]),(0,s.Lk)("div",be,(0,a.v_)(e.$t("Layout")),1),(0,s.bF)(Ve,{label:e.$t("Hero image border radius")},{default:(0,s.k6)(()=>[(0,s.bF)(Te,{modelValue:Fe.item.settings.heroRadius,"onUpdate:modelValue":t[13]||(t[13]=e=>Fe.item.settings.heroRadius=e),placeholder:"14px",onBlur:e.saveSettings},null,8,["modelValue","onBlur"])]),_:1},8,["label"])])]),_:1},8,["label"])]),_:1},8,["modelValue","onUpdate:modelValue"])):(0,s.Q3)("",!0)]),(0,s.bF)(Ie,{active:Fe.showCustomFieldModal,"event-uuid":Fe.itemUuid,"custom-field":Fe.editingCustomField,onClose:ke.closeCustomFieldModal,onCreated:ke.onCustomFieldCreated,onUpdated:ke.onCustomFieldUpdated},null,8,["active","event-uuid","custom-field","onClose","onCreated","onUpdated"])])):(0,s.Q3)("",!0)])}i(44114),i(18111),i(22489),i(20116),i(61701),i(13579);var Fe=i(40834),ke=i(38221),ye=i.n(ke),Ce=i(81084);const $e={class:"modal-card custom-field-modal"},Le={class:"modal-card-head"},_e={class:"modal-card-title"},xe={class:"modal-card-body"},Se={value:"input"},we={value:"textarea"},Te={value:"dropdown"},Ve={value:"radio"},De={value:"checkboxes"},Ie={value:"date"},Ee={value:"boolean"},Ue={key:0,class:"options-section mt-4"},Oe={class:"label"},Ae={class:"options-list"},Re=["draggable","onDragstart","onDrop"],Xe={class:"option-grip"},Be=["disabled","onClick"],Me={class:"icon is-small"},qe={class:"icon is-small"},Qe={class:"modal-card-foot"};function je(e,t,i,o,d,n){const r=(0,s.g2)("b-input"),u=(0,s.g2)("b-field"),c=(0,s.g2)("b-select"),m=(0,s.g2)("font-awesome-icon"),p=(0,s.g2)("b-button"),g=(0,s.g2)("b-modal");return(0,s.uX)(),(0,s.Wv)(g,{"model-value":i.active,"has-modal-card":"","trap-focus":"","append-to-body":"","onUpdate:modelValue":t[9]||(t[9]=t=>e.$emit("close"))},{default:(0,s.k6)(()=>[(0,s.Lk)("div",$e,[(0,s.Lk)("header",Le,[(0,s.Lk)("p",_e,(0,a.v_)(n.isEditMode?e.$t("edit_custom_field"):e.$t("create_custom_field")),1),(0,s.Lk)("button",{type:"button",class:"delete",onClick:t[0]||(t[0]=t=>e.$emit("close"))})]),(0,s.Lk)("section",xe,[(0,s.bF)(u,{label:e.$t("field_name")},{default:(0,s.k6)(()=>[(0,s.bF)(r,{modelValue:d.name,"onUpdate:modelValue":t[1]||(t[1]=e=>d.name=e),placeholder:e.$t("Enter field name"),required:""},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,s.bF)(u,{label:e.$t("field_type"),class:"mt-4"},{default:(0,s.k6)(()=>[(0,s.bF)(c,{modelValue:d.fieldType,"onUpdate:modelValue":[t[2]||(t[2]=e=>d.fieldType=e),n.handleFieldTypeChange],expanded:""},{default:(0,s.k6)(()=>[(0,s.Lk)("option",Se,(0,a.v_)(e.$t("field_type_input")),1),(0,s.Lk)("option",we,(0,a.v_)(e.$t("field_type_textarea")),1),(0,s.Lk)("option",Te,(0,a.v_)(e.$t("field_type_dropdown")),1),(0,s.Lk)("option",Ve,(0,a.v_)(e.$t("field_type_radio")),1),(0,s.Lk)("option",De,(0,a.v_)(e.$t("field_type_checkboxes")),1),(0,s.Lk)("option",Ie,(0,a.v_)(e.$t("field_type_date")),1),(0,s.Lk)("option",Ee,(0,a.v_)(e.$t("field_type_boolean")),1)]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:1},8,["label"]),n.showOptions?((0,s.uX)(),(0,s.CE)("div",Ue,[(0,s.Lk)("label",Oe,(0,a.v_)(e.$t("Options")),1),(0,s.Lk)("div",Ae,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(d.options,
1(i,a)=>((0,s.uX)(),(0,s.CE)("div",{key:a,class:"option-item",draggable:!d.isInputFocused,onDragstart:e=>n.onDragStart(a),onDragover:t[5]||(t[5]=(0,l.D$)(()=>{},["prevent"])),onDrop:e=>n.onDrop(a),onDragend:t[6]||(t[6]=(...e)=>n.onDragEnd&&n.onDragEnd(...e))},[(0,s.Lk)("span",Xe,[(0,s.bF)(m,{icon:"fa-light fa-bars"})]),(0,s.bF)(r,{modelValue:d.options[a],"onUpdate:modelValue":e=>d.options[a]=e,placeholder:e.$t("Option")+" "+(a+1),expanded:"",onFocus:t[3]||(t[3]=e=>d.isInputFocused=!0),onBlur:t[4]||(t[4]=e=>d.isInputFocused=!1)},null,8,["modelValue","onUpdate:modelValue","placeholder"]),(0,s.Lk)("button",{type:"button",class:"button is-light is-small is-rounded remove-option-btn",disabled:d.options.length<=2,onClick:e=>n.removeOption(a)},[(0,s.Lk)("span",Me,[(0,s.bF)(m,{icon:"fa-light fa-xmark"})])],8,Be)],40,Re))),128))]),(0,s.Lk)("button",{type:"button",class:"button is-light is-small is-rounded mt-3",onClick:t[7]||(t[7]=(...e)=>n.addOption&&n.addOption(...e))},[(0,s.Lk)("span",qe,[(0,s.bF)(m,{icon:"fa-light fa-plus"})]),(0,s.Lk)("span",null,(0,a.v_)(e.$t("Add Option")),1)])])):(0,s.Q3)("",!0)]),(0,s.Lk)("footer",Qe,[(0,s.bF)(p,{class:"is-rounded",onClick:t[8]||(t[8]=t=>e.$emit("close"))},{default:(0,s.k6)(()=>[(0,s.eW)((0,a.v_)(e.$t("cancel")),1)]),_:1}),(0,s.bF)(p,{type:"is-primary",class:"is-rounded",loading:d.isSaving,disabled:!n.isValid,onClick:n.save},{default:(0,s.k6)(()=>[(0,s.eW)((0,a.v_)(n.isEditMode?e.$t("save_changes"):e.$t("create")),1)]),_:1},8,["loading","disabled","onClick"])])])]),_:1},8,["model-value"])}var Ke={name:"EventCustomFieldCreateModal",props:{active:{type:Boolean,default:!1},eventUuid:{type:String,required:!0},customField:{type:Object,default:null}},emits:["close","created","updated"],data(){return{name:"",fieldType:"input",options:["",""],isSaving:!1,isInputFocused:!1,draggingIndex:null}},computed:{isEditMode(){return!!this.customField},showOptions(){return["dropdown","radio","checkboxes"].includes(this.fieldType)},validOptions(){return this.options.filter(e=>e.trim().length>0)},isValid(){return!!this.name.trim()&&!(this.showOptions&&this.validOptions.length<2)}},watch:{active(e){e&&(this.customField?this.populateFromCustomField():this.reset())}},methods:{reset(){this.name="",this.fieldType="input",this.options=["",""],this.isInputFocused=!1,this.draggingIndex=null},populateFromCustomField(){this.name=this.customField.name||"",this.fieldType=this.customField.fieldType||"input";const e=this.customField.fieldOptions?.options;e&&"object"===typeof e?this.options=Object.values(e):Array.isArray(this.customField.options)&&this.customField.options.length>0?this.options=[...this.customField.options]:this.options=["",""],this.isInputFocused=!1,this.draggingIndex=null},handleFieldTypeChange(){this.showOptions&&this.options.length<2&&(this.options=["",""])},addOption(){this.options.push("")},removeOption(e){this.options.length<=2||this.options.splice(e,1)},onDragStart(e){this.isInputFocused||(this.draggingIndex=e)},onDragEnd(){this.draggingIndex=null},onDrop(e){if(null===this.draggingIndex||this.draggingIndex===e)return;const t=this.options[this.draggingIndex];this.options.splice(this.draggingIndex,1),this.options.splice(e,0,t),this.draggingIndex=null},save(){this.isValid&&(this.isEditMode?this.update():this.create())},create(){this.isSaving=!0;const e={name:this.name.trim(),fieldType:this.fieldType};this.showOptions&&(e.options=this.validOptions),this.$http.plain.post(`/events/${this.eventUuid}/custom-fields`,e).then(e=>{this.$emit("created",e.data),this.$buefy.toast.open({message:this.$t("custom_field_created"),type:"is-success"})}).catch(e=>{console.log(e),this.$buefy.toast.open({message:e.response?.data?.message||this.$t("error_creating"),type:"is-danger"})}).finally(()=>{this.isSaving=!1})},update(){this.isSaving=!0;const e={name:this.name.trim(),fieldType:this.fieldType};this.showOptions&&(e.options=this.validOptions),this.$http.plain.patch(`/events/${this.eventUuid}/custom-fields/${this.customField.id}`,e).then(e=>{this.$emit("updated",e.data),this.$buefy.toast.open({message:this.$t("custom_field_updated"),type:"is-success"})}).catch(e=>
1{console.log(e),this.$buefy.toast.open({message:e.response?.data?.message||this.$t("error_saving"),type:"is-danger"})}).finally(()=>{this.isSaving=!1})}}},We=i(66262);const He=(0,We.A)(Ke,[["render",je],["__scopeId","data-v-f754b0e6"]]);var Pe=He,ze=i(28994),Ge={name:"EventRegistrationForm",components:{MobileViewHeader:Ce.A,EventCustomFieldCreateModal:Pe},mixins:[ze.A],data(){return{itemUuid:this.$route.params.item,item:null,isLoading:!1,isLoadingForm:!1,isSavingForm:!1,activeTab:0,availableFieldsTab:0,availableStandardFields:{},availableStandardFieldsList:[],customFields:[],formConfig:{fields:[]},draggingIndex:null,dragType:null,draggedField:null,showCustomFieldModal:!1,editingCustomField:null}},computed:{...(0,Fe.L8)(["user","isGrantedOwner","tenant"])},created(){this.retrieve(),this.saveSettings=ye()(this._saveSettings,500)},methods:{onOuterTabChange(){this.$nextTick(()=>{this.initAllPillIndicators(),this.slidePills()})},onInnerTabChange(){this.$nextTick(()=>{this.slidePills()})},retrieve(){this.isLoading=!0,this.$http.plain.get("/events/"+this.itemUuid).then(e=>{e.data.unit&&(e.data.unit=e.data.unit["@id"]),e.data.type&&(e.data.type=e.data.type["@id"]),e.data.customStatus&&(e.data.customStatus=e.data.customStatus["@id"]),e.data.allowedUserType&&(e.data.allowedUserType=e.data.allowedUserType["@id"]),e.data.settings||(e.data.settings={tenantLogo:!0,showTitle:!0,heroRadius:null,colorSelection:null,disableSubscribe:!1,disableRegister:!1,lightThemeOnly:!1,colorButton:null,isThankYouSingular:!1,enableSpeakers:!1,allowSendLinksLater:!1}),this.item=e.data,this.fetchFormData()}).catch(e=>console.error(e)).finally(()=>{this.isLoading=!1})},fetchFormData(){this.isLoadingForm=!0,this.$http.plain.get(`/events/${this.itemUuid}/registration-form`).then(e=>{this.applyFormData(e.data)}).catch(e=>console.error(e)).finally(()=>{this.isLoadingForm=!1,this.$nextTick(()=>{this.initAllPillIndicators()})})},applyFormData(e){this.availableStandardFields=e.availableStandardFields||{},this.availableStandardFieldsList=Object.entries(e.availableStandardFields||{}).map(([e,t])=>({key:e,label:t.label,type:"standard",alwaysRequired:t.alwaysRequired||!1})),this.customFields=e.customFields||[],this.formConfig=e.formConfig||{fields:[]},this.formConfig.fields=(this.formConfig.fields||[]).map(e=>({...e,mandatory:e.mandatory??!1}))},isFieldInForm(e){return this.formConfig.fields.some(t=>"standard"===t.type&&t.key===e.key)},isCustomFieldInForm(e){return this.formConfig.fields.some(t=>"custom"===t.type&&t.customFieldId===e.id)},clickAddStandardField(e){this.isFieldInForm(e)||this.formConfig.fields.push({type:"standard",key:e.key,mandatory:e.alwaysRequired||!1})},clickAddCustomField(e){this.isCustomFieldInForm(e)||this.formConfig.fields.push({type:"custom",customFieldId:e.id,mandatory:!1})},getFieldLabel(e){if("standard"===e.type){const t=this.availableStandardFields[e.key];return t?.label?this.$t(t.label):e.key}const t=this.customFields.find(t=>t.id===e.customFieldId);return t?.name||this.$t("custom_field")},getCustomFieldType(e){if("custom"!==e.type)return"";const t=this.customFields.find(t=>t.id===e.customFieldId);return t?t.fieldType:""},getFieldKey(e){return"standard"===e.type?`standard-${e.key}`:`custom-${e.customFieldId}`},isAlwaysRequired(e){return"standard"===e.type&&["email","name"].includes(e.key)},canRemoveField(e){return!("standard"===e.type&&["email","name"].includes(e.key))},removeField(e){this.formConfig.fields.splice(e,1)},onDragStartAvailable(e,t,i){this.dragType=i,this.draggedField=t,e.dataTransfer.effectAllowed="copy"},onDragStartForm(e,t){this.dragType="reorder",this.draggingIndex=t,e.dataTransfer.effectAllowed="move"},onDragEnd(){this.draggingIndex=null,this.dragType=null,this.draggedField=null},onDropToForm(e){e.preventDefault(),"standard"===this.dragType&&this.draggedField?this.clickAddStandardField(this.draggedField):"custom"===this.dragType&&this.draggedField&&this.clickAddCustomField(this.draggedField),this.onDragEnd()},onDropReorder(e,t){if(e.preventDefault(),"standard"===this.dragType&&this.draggedField)return this.isFieldInForm(this.draggedField)||this.formConfig.fields.splice(t,0,{type:"standard",key:this.draggedField.key,mandatory:this.draggedField.alwaysRequired||!1}),void this.onDragEnd();
1if("custom"===this.dragType&&this.draggedField)return this.isCustomFieldInForm(this.draggedField)||this.formConfig.fields.splice(t,0,{type:"custom",customFieldId:this.draggedField.id,mandatory:!1}),void this.onDragEnd();if("reorder"===this.dragType&&null!==this.draggingIndex&&this.draggingIndex!==t){const e=this.formConfig.fields[this.draggingIndex];this.formConfig.fields.splice(this.draggingIndex,1);const i=this.draggingIndex<t?t-1:t;this.formConfig.fields.splice(i,0,e)}this.onDragEnd()},saveFormConfig(){this.isSavingForm=!0;const e={fields:this.formConfig.fields.map((e,t)=>({type:e.type,key:"standard"===e.type?e.key:void 0,customFieldId:"custom"===e.type?e.customFieldId:void 0,mandatory:e.mandatory,position:t}))};this.$http.plain.patch(`/events/${this.itemUuid}/registration-form`,e).then(()=>{this.$buefy.toast.open({message:this.$t("form_saved"),type:"is-success"})}).catch(e=>{console.error(e),this.$buefy.toast.open({message:e.response?.data?.message||this.$t("error_saving"),type:"is-danger"})}).finally(()=>{this.isSavingForm=!1})},openCreateCustomField(){this.editingCustomField=null,this.showCustomFieldModal=!0},editCustomField(e){this.editingCustomField=e,this.showCustomFieldModal=!0},closeCustomFieldModal(){this.showCustomFieldModal=!1,this.editingCustomField=null},onCustomFieldCreated(e){this.customFields.push(e),this.closeCustomFieldModal()},onCustomFieldUpdated(e){const t=this.customFields.findIndex(t=>t.id===e.id);-1!==t&&this.customFields.splice(t,1,e),this.closeCustomFieldModal()},deleteCustomField(e){this.$buefy.dialog.confirm({title:this.$t("Delete custom field"),message:this.$t("Are you sure you want to delete this custom field? This action cannot be undone."),confirmText:this.$t("Delete"),cancelText:this.$t("cancel"),type:"is-danger",onConfirm:()=>{this.$http.plain.delete(`/events/${this.itemUuid}/custom-fields/${e.id}`).then(()=>{const t=this.customFields.findIndex(t=>t.id===e.id);-1!==t&&this.customFields.splice(t,1),this.formConfig.fields=this.formConfig.fields.filter(t=>!("custom"===t.type&&t.customFieldId===e.id)),this.$buefy.toast.open({message:this.$t("Custom field deleted"),type:"is-success"})}).catch(e=>{console.error(e),this.$buefy.toast.open({message:e.response?.data?.message||this.$t("Error deleting custom field"),type:"is-danger"})})}})},_saveSettings(){this.isLoading=!0;const e={registrationFormText:this.item.registrationFormText,settings:this.item.settings};this.$http.plain.patch("/events/"+this.itemUuid,e).then(()=>{this.$buefy.toast.open({message:this.$t("updatedSuccessfully"),type:"is-success",duration:1500}),window.dispatchEvent(new CustomEvent("event-updated",{detail:{uuid:this.itemUuid}}))}).catch(e=>{console.error(e),this.$buefy.toast.open({message:e.response?.data?.detail||this.$t("An error occurred"),type:"is-danger"})}).finally(()=>{this.isLoading=!1})},colorFormatter(e){return e.toString("hex")},updateColorSelection(e){this.item.settings.colorSelection=e.toString("hex"),this.saveSettings()},updateColorButton(e){this.item.settings.colorButton=e.toString("hex"),this.saveSettings()}}};const Ye=(0,We.A)(Ge,[["render",ve],["__scopeId","data-v-6e659b8d"]]);var Je=Ye}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.