"use strict";(globalThis.webpackChunkwp_event_solution=globalThis.webpackChunkwp_event_solution||[]).push([[458],{502959(e,t,a){a.d(t,{A:()=>E});var n=a(951609),l=a(527723),r=a(17437),i=a(938181),s=a(954861),d=a(760742),o=a(451643),c=a(236492),m=a(167313),u=a(974353),_=a.n(u),p=a(205019),v=a(110012),g=a(406836);const{Text:x,Title:f}=m.A,E=function(e){const{extraFields:t,parentKey:a}=e;return(0,n.createElement)("div",{className:"etn-extra-fields-container"},(0,n.createElement)(r.mL,{styles:r.AH`
					.etn-extra-form-field {
						.ant-form-item-extra {
							font-size: 14px;
							font-style: italic;
							margin-bottom: 10px;
							letter-spacing: 0.5px;
						}
					}
				`}),t?.map((e,t,r)=>(0,n.createElement)("div",{className:"etn-extra-form-field",key:t},function(e,t){const r=e?.label?.trim()?.toLowerCase()?.replace(/[^\w\s]/g,"")?.replace(/\s+/g,"_")?.replace(/_+/g,"_")?.replace(/^_|_$/g,""),m=e?.id||t,u=a?["attendees",a,"extra_fields",`${r}_${m}`]:["extra_fields",`${r}_${m}`];switch(e?.field_type){case"text":return(0,n.createElement)(v.ks,{label:e?.label,name:u,placeholder:(0,l.__)(`${e?.placeholder_text||""}`,"eventin"),size:"large",type:"text",required:e?.required,extra:e?.additional_text,rules:[{required:e?.required,message:(0,l.__)(`${e?.label} is required!`,"eventin")}]});case"textarea":return(0,n.createElement)(v.No,{label:e?.label,name:u,placeholder:e?.placeholder_text||"",type:"textarea",extra:e?.additional_text,rows:3,cols:50,required:e?.required,className:"etn-extra-field-text-area",rules:[{required:e?.required,message:(0,l.__)(`${e?.label} is required!`,"eventin")}]});case"number":return(0,n.createElement)(d.A.Item,{label:e?.label,name:u,placeholder:e?.placeholder_text||"",extra:e?.additional_text,rules:[{required:e?.required,message:(0,l.__)(`${e?.label} is required!`,"eventin")}],required:e?.required},(0,n.createElement)(p.A,{placeholder:e?.placeholder_text||"",className:"etn-extra-field-number"}));case"select":return(0,n.createElement)(d.A.Item,{label:e?.label,name:u,extra:e?.additional_text,rules:[{required:e?.required,message:(0,l.__)(`${e?.label} is required!`,"eventin")}],required:e?.required},(0,n.createElement)(c.A,{placeholder:e?.placeholder_text||"",size:"large",options:e?.field_options,allowClear:!0,className:"etn-extra-field-select"}));case"radio":return(0,n.createElement)(d.A.Item,{label:e?.label,name:u,extra:e?.additional_text,rules:[{required:e?.required,message:(0,l.__)(`${e?.label} is required!`,"eventin")}]},(0,n.createElement)(o.Ay.Group,{className:"etn-radio-group"},e?.field_options?e?.field_options?.map((e,t)=>(0,n.createElement)(o.Ay,{key:t,value:e.value},e.value)):null));case"checkbox":return(0,n.createElement)(d.A.Item,{label:e?.label,name:u,extra:e?.additional_text,rules:[{required:e?.required,message:(0,l.__)(`${e?.label} is required!`,"eventin")}]},(0,n.createElement)(i.A.Group,{className:"etn-checkbox-group"},e?.field_options?.map((e,t)=>(0,n.createElement)(i.A,{key:t,value:e?.value},e?.value))));case"date":return(0,n.createElement)(d.A.Item,{label:e?.label,name:u,getValueProps:e=>({value:e?_()(e):null}),normalize:e=>e?_()(e).format("YYYY-MM-DD"):e,extra:e?.additional_text,rules:[{required:e?.required,message:(0,l.__)(`${e?.label} is required!`,"eventin")}]},(0,n.createElement)(s.A,{size:"large",style:{width:"100%"},format:(0,g.getDateFormat)()}));default:return null}}(e,t))))}},489833(e,t,a){a.d(t,{A:()=>s});var n=a(951609),l=a(182654),r=a(769815);a(607638);const i=r.default.div`
	.ant-alert-message {
		font-size: 14px;
		color: #020617;
		font-weight: 500;
	}
	.ant-alert-description {
		font-size: 12px;
		color: #747474;
	}
`,s=(r.default.div`
	@media only screen and ( max-width: 520px ) {
		display: none;
	}
`,e=>{const{title:t,description:a=null}=e;return(0,n.createElement)(i,null,(0,n.createElement)(l.A,{style:{border:"1px solid #FF4D4F",backgroundColor:"#FFFAFA",marginTop:"20px"},message:t,description:a,type:"warning"}))})},882833(e,t,a){a.d(t,{A:()=>_});var n=a(951609),l=a(527723),r=a(986087),i=a(18537),s=a(16370),d=a(760742),o=a(747152),c=a(236492),m=a(110012),u=a(502959);const _=e=>{const{form:t,eventList:a,attendeeExtraFields:_,isInEditMode:p,isPhoneRequired:v,isEmailRequired:g,defaultExtraFields:x,setIsSeatPlanEvent:f}=e,[E,A]=(0,r.useState)(null),[h,b]=(0,r.useState)(_||[]),y=d.A.useWatch("etn_event_id",{form:t,preserve:!0}),k=d.A.useWatch("attendee_seat",{form:t,preserve:!0}),q=a&&a?.items.map(e=>({value:e.id,label:(0,i.decodeEntities)(e.title)})),w=E?.ticket_variations&&E?.ticket_variations?.map(e=>({value:e?.etn_ticket_name,label:e?.etn_ticket_name})),F=Boolean(E?.seat_plan);return f(!(p||!F)),(0,r.useEffect)(()=>{y?a?.items?.forEach(e=>{if(e.id==y){A(e);const t=e?.extra_fields;b(t&&t.length>0?t:_||[])}}):b(_||[])},[y,a,_]),(0,n.createElement)(o.A,{gutter:[16,0]},!p&&(0,n.createElement)(s.A,{xs:24,md:24},(0,n.createElement)(d.A.Item,{label:(0,l.__)("Select Event","eventin"),name:"etn_event_id",rules:[{required:!0,message:(0,l.__)("Please select event","eventin")}]},(0,n.createElement)(c.A,{options:q,showSearch:!0,optionFilterProp:"label",size:"large",placeholder:(0,l.__)("Select Event","eventin"),allowClear:!0,onChange:()=>t.setFieldsValue({ticket_name:null,etn_ticket_price:null})}))),Array.isArray(x)?(0,n.createElement)(n.Fragment,null,x?.map(e=>{if(e?.show)return(0,n.createElement)(s.A,{xs:24,md:24},(0,n.createElement)(m.ks,{key:e.name,label:e.label,name:e.name,rules:[{required:e.required,message:e.label+(0,l.__)(" is required!","eventin")},"etn_phone"===e.name&&{pattern:new RegExp(/^[+]?[\d\s()-]+$/),message:(0,l.__)("Please enter a valid phone number","eventin")}].filter(Boolean),required:e.required,placeholder:e.placeholder_text,size:"large"}))})):(0,n.createElement)(n.Fragment,null,(0,n.createElement)(s.A,{xs:24,md:24},(0,n.createElement)(m.ks,{label:(0,l.__)("Full name","eventin"),name:"etn_name",rules:[{required:!0,message:(0,l.__)("Full name is required!","eventin")}],required:!0,placeholder:(0,l.__)("Name of the attendee","eventin"),size:"large"})),g&&(0,n.createElement)(s.A,{xs:24,md:12},(0,n.createElement)(m.ks,{label:(0,l.__)("Email","eventin"),name:"etn_email",placeholder:(0,l.__)("Enter your email","eventin"),size:"large",rules:[{type:"email",required:!0,message:(0,l.__)("Enter Valid Email!","eventin")}],required:!0})),v&&(0,n.createElement)(s.A,{xs:24,md:12},(0,n.createElement)(m.ks,{label:(0,l.__)("Phone","eventin"),name:"etn_phone",placeholder:(0,l.__)("+01234567490","eventin"),rules:[{required:!0,message:(0,l.__)("Phone is Required!","eventin")},{pattern:new RegExp(/^[+]?[\d\s()-]+$/),message:(0,l.__)("Please enter a valid phone number","eventin")}],required:!0}))),p&&(0,n.createElement)(s.A,{xs:24,md:12},(0,n.createElement)(m.ks,{label:(0,l.__)("Ticket ID","eventin"),name:"etn_unique_ticket_id",size:"large",readOnly:!0,disabled:!0})),(0,n.createElement)(s.A,{xs:24,md:12},p?(0,n.createElement)(m.ks,{label:k?(0,l.__)("Seat Name","eventin"):(0,l.__)("Ticket Name","eventin"),name:k?"attendee_seat":"ticket_name",size:"large",readOnly:!0,disabled:!0}):(0,n.createElement)(d.A.Item,{label:(0,l.__)("Ticket Name","eventin"),name:"ticket_name"},(0,n.createElement)(c.A,{options:w,size:"large",showSearch:!0,optionFilterProp:"label",placeholder:(0,l.__)("Select a Ticket"),onSelect:e=>{E?.ticket_variations?.map(a=>{a.etn_ticket_name===e&&t.setFieldsValue({etn_ticket_price:a.etn_ticket_price,ticket_slug:a.etn_ticket_slug})})},filterOption:(e,t)=>t?.label?.toLowerCase()?.includes(e?.toLowerCase())}))),!p&&(0,n.createElement)(s.A,{xs:24,md:12},(0,n.createElement)(m.ks,{label:(0,l.__)("Ticket Price","eventin"),name:"etn_ticket_price",size:"large",placeholder:(0,l.__)("Ticket Price","eventin"),readOnly:!0})),(0,n.createElement)(s.A,{xs:24,md:12},(0,n.createElement)(d.A.Item,{label:(0,l.__)("Ticket Status","eventin"),name:"etn_attendeee_ticket_status"},(0,n.createElement)(c.A,{options:[{label:(0,l.__)("Unused","eventin"),value:"unused"},{label:(0,l.__)("Used","eventin"),value:"used"}],size:"large",placeholder:(0,l.__)("Select Ticket Status","eventin")}))),(0,n.createElement)(s.A,{xs:24,md:12},(0,n.createElement)(d.A.Item,{label:(0,l.__)("Payment Status","eventin"),name:"etn_status"},(0,n.createElement)(c.A,{options:[{label:(0,l.__)("Success","eventin"),value:"success"},{label:(0,l.__)("Failed","eventin"),value:"failed"}],size:"large",placeholder:(0,l.__)("Select Payment Status","eventin")}))),(0,n.createElement)(s.A,{xs:24,md:24},(0,n.createElement)(u.A,{extraFields:h})))}},297439(e,t,a){a.d(t,{A:()=>y});var n=a(951609),l=a(929491),r=a(547143),i=a(986087),s=a(152619),d=a(527723),o=a(892911),c=a(760742),m=a(900428),u=a(167313),_=a(247767),p=a(607638),v=a(864282),g=a(489833),x=a(882833),f=a(890950);const{Title:E,Text:A}=u.A,h=(0,r.withDispatch)(e=>{const t=e("eventin/global");return{refreshAttendeesList:()=>t.invalidateResolution("getAttendeesList")}}),b=(0,r.withSelect)(e=>{const t=e("eventin/global");return{settings:t.getSettings(),isSettingsLoading:t.isResolving("getSettings"),eventList:t.getAllEvents(),isLoading:t.isResolving("getAllEvents"),refreshAttendeesList:()=>t.invalidateResolution("getAttendeesList")}}),y=(0,l.compose)([b,h])(function(e){const{isLoading:t,isSettingsLoading:a,settings:l,eventList:r,refreshAttendeesList:u}=e,[h]=c.A.useForm(),{id:b}=(0,_.useParams)(),y=(0,_.useNavigate)(),[k,q]=(0,i.useState)(!1),[w,F]=(0,i.useState)(!1),[S,z]=(0,i.useState)(!1),T=l&&l?.extra_fields,C=l&&"on"===l?.reg_require_phone,P=l&&"on"===l?.reg_require_email,L=l&&l?.default_extra_fields,N=!!b;return(0,i.useEffect)(()=>{b&&(F(!0),v.A.attendees.singleAttendee(b).then(e=>{let t={...e,extra_fields:Array.isArray(e?.extra_fields)?{}:e?.extra_fields};h.setFieldsValue(t)}).finally(()=>{F(!1)}))},[]),(0,n.createElement)(f.sC,{className:"eventin-edit-attendee-form-wrapper"},(0,n.createElement)(f.MG,{className:"eventin-edit-attendee-form-container"},(0,n.createElement)("div",{style:{marginBottom:"40px"}},(0,n.createElement)(E,{level:3,style:{fontWeight:600,margin:"0 0 8px 0",fontSize:"26px",lineHeight:"32px",color:"#111827"}},N?(0,d.__)("Update attendee profile","eventin"):(0,d.__)("Create new attendee profile","eventin")),(0,n.createElement)(A,{style:{fontSize:"14px",color:"#6B7280",display:"block"}},(0,d.__)("Add or update an attendee by filling out the details below.","eventin"))),w?(0,n.createElement)(o.A,{justify:"center",align:"center",style:{minHeight:"320px"}},(0,n.createElement)(m.A,null)):(0,n.createElement)(c.A,{layout:"vertical",form:h,scrollToFirstError:!0,size:"large",onFinish:async()=>{q(!0);try{await h.validateFields();const e=h.getFieldsValue(!0);if(N){const t=await v.A.attendees.updateAttendee(b,e);if(!t?.id)throw new Error("Couldn't update attendee properly!");y("/attendees"),u(),(0,s.doAction)("eventin_notification",{type:"success",message:(0,d.__)("Successfully updated the attendee!","eventin")})}else{const t=await v.A.attendees.createAttendee(e);if(!t?.id)throw new Error("Couldn't create attendee properly!");u(),y("/attendees"),(0,s.doAction)("eventin_notification",{type:"success",message:(0,d.__)("Successfully created the attendee!","eventin")})}}catch(e){(0,s.doAction)("eventin_notification",{type:"error",message:e.message})}finally{q(!1)}}},(0,n.createElement)(x.A,{form:h,eventList:r,attendeeExtraFields:T,isInEditMode:N,isPhoneRequired:C,isEmailRequired:P,defaultExtraFields:L,setIsSeatPlanEvent:z}),S&&(0,n.createElement)(g.A,{title:(0,d.__)("You can't add an attendee to a seat plan event ","eventin"),description:(0,d.__)("This is a seat plan event. You can only add attendees to a non-seat plan event","eventin")}),(0,n.createElement)(o.A,{gap:12,justify:"end",style:{marginTop:"20px"}},(0,n.createElement)(p.Ay,{variant:p.Vt,htmlType:"reset",onClick:()=>y(-1),sx:{color:"#262626",padding:"8px 24px"}},(0,d.__)("Cancel","eventin")),(0,n.createElement)(p.Ay,{variant:p.zB,loading:k,htmlType:"submit",disabled:S,sx:{}},N?(0,d.__)("Update Attendee","eventin"):(0,d.__)("Add Attendee","eventin"))))))})},214458(e,t,a){a.r(t),a.d(t,{default:()=>g});var n=a(951609),l=a(956427),r=a(527723),i=a(892911),s=a(247767),d=a(354725),o=a(607638),c=a(75093),m=a(818062),u=a(327154),_=a(297439),p=a(769815),v=a(890950);const g=function(e){const{id:t}=(0,s.useParams)(),a=!!t,g=(0,s.useNavigate)();return p.default.div`
		@media ( max-width: 560px ) {
			display: none;
			border: 1px solid red;
		}
	`,(0,n.createElement)(v.ff,null,(0,n.createElement)(l.Fill,{name:u.PRIMARY_HEADER_NAME},(0,n.createElement)(i.A,{justify:"space-between",align:"center"},(0,n.createElement)(i.A,{align:"center",gap:16},(0,n.createElement)(o.Ay,{variant:o.Vt,icon:(0,n.createElement)(d.AngleLeftIcon,null),sx:{height:"36px",width:"36px",backgroundColor:"#fafafa",borderColor:"transparent",lineHeight:"1"},onClick:()=>{g("/attendees")}}),(0,n.createElement)(m.A,{title:a?(0,r.__)("Attendees Details","eventin"):(0,r.__)("New Attendee","eventin")})))),(0,n.createElement)(_.A,null),(0,n.createElement)(c.FloatingHelpButton,null))}},890950(e,t,a){a.d(t,{MG:()=>i,ff:()=>l,sC:()=>r});var n=a(769815);const l=n.default.div`
	background: #f3f5f7;
	min-height: calc( 100vh - 60px );
	padding-top: 30px;
`,r=n.default.div`
	background: #ffffff;
	border: 1px solid #e1e4e9;
	border-radius: 8px;
	padding: 20px;
	margin: 30px;
	margin-top: 0;
	@media ( max-width: 768px ) {
		padding: 10px;
		margin: 5px;
	}
`,i=n.default.div`
	max-width: 900px;
	padding: 20px 40px;
	margin: 0 auto;
	@media ( max-width: 768px ) {
		padding: 10px;
	}
`}}]);