"use strict";(globalThis.webpackChunkwp_event_solution=globalThis.webpackChunkwp_event_solution||[]).push([[458],{2959(e,t,a){a.d(t,{A:()=>E});var n=a(51609),l=a(27723),r=a(17437),i=a(38181),s=a(54861),d=a(60742),o=a(51643),c=a(36492),m=a(67313),u=a(74353),_=a.n(u),p=a(5019),v=a(10012),g=a(6836);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?.toLowerCase()?.replace(/\s+/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))))}},14458(e,t,a){a.r(t),a.d(t,{default:()=>v});var n=a(51609),l=a(56427),r=a(92911),i=a(47767),s=a(54725),d=a(7638),o=a(75093),c=a(18062),m=a(27154),u=a(97439),_=a(69815),p=a(90950);const v=function(e){const{id:t}=(0,i.useParams)(),a=!!t,v=(0,i.useNavigate)();return _.default.div`
		@media ( max-width: 560px ) {
			display: none;
			border: 1px solid red;
		}
	`,(0,n.createElement)(p.ff,null,(0,n.createElement)(l.Fill,{name:m.PRIMARY_HEADER_NAME},(0,n.createElement)(r.A,{justify:"space-between",align:"center"},(0,n.createElement)(r.A,{align:"center",gap:16},(0,n.createElement)(d.Ay,{variant:d.Vt,icon:(0,n.createElement)(s.AngleLeftIcon,null),sx:{height:"36px",width:"36px",backgroundColor:"#fafafa",borderColor:"transparent",lineHeight:"1"},onClick:()=>{v("/attendees")}}),(0,n.createElement)(c.A,{title:a?"Attendees Details":"New Attendee"})))),(0,n.createElement)(u.A,null),(0,n.createElement)(o.FloatingHelpButton,null))}},82833(e,t,a){a.d(t,{A:()=>_});var n=a(51609),l=a(27723),r=a(86087),i=a(18537),s=a(16370),d=a(60742),o=a(47152),c=a(36492),m=a(10012),u=a(2959);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})))}},89833(e,t,a){a.d(t,{A:()=>s});var n=a(51609),l=a(82654),r=a(69815);a(7638);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"}))})},90950(e,t,a){a.d(t,{MG:()=>i,ff:()=>l,sC:()=>r});var n=a(69815);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;
	}
`},97439(e,t,a){a.d(t,{A:()=>y});var n=a(51609),l=a(29491),r=a(47143),i=a(86087),s=a(52619),d=a(27723),o=a(92911),c=a(60742),m=a(428),u=a(67313),_=a(47767),p=a(7638),v=a(64282),g=a(89833),x=a(82833),f=a(90950);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.getEventList(),isLoading:t.isResolving("getEventList"),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),L=l&&l?.extra_fields,T=l&&"on"===l?.reg_require_phone,C=l&&"on"===l?.reg_require_email,P=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:L,isInEditMode:N,isPhoneRequired:T,isEmailRequired:C,defaultExtraFields:P,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"))))))})}}]);