1"use strict";(self.webpackChunkbcn2020=self.webpackChunkbcn2020||[]).push([[9597],{45142:(e,t,n)=>{n.d(t,{Hm:()=>r,YA:()=>s,j:()=>a,oV:()=>o});const a={hasSettingsManagerRole:"sienna",hasCatalogOrderManagerRole:"olivedrab",hasCompanyUserAccountManagerRole:"orangered",hasGeneralAdminRole:"teal",hasImpersonatorRole:"midnightblue",hasMonthlyReportEditorRole:"maroon",hasTransactionCreatorRole:"darkviolet",hasEventAdminRole:"crimson",hasSysAdminRole:"blue",hasHomePageManagerRole:"darkgreen"},o={hasSettingsManagerRole:"administration",hasCatalogOrderManagerRole:"catalog",hasCompanyUserAccountManagerRole:"company users",hasGeneralAdminRole:"general",hasImpersonatorRole:"impersonate",hasMonthlyReportEditorRole:"monthly reports",hasTransactionCreatorRole:"transactions",hasEventAdminRole:"event admin",hasSysAdminRole:"system admin",hasHomePageManagerRole:"home page"},s={hasSettingsManagerRole:"Can add/edit administrator accounts",hasTransactionCreatorRole:"Can create manual transactions",hasCatalogOrderManagerRole:"Can accept/cancel catalog orders",hasCompanyUserAccountManagerRole:"Can add/remove company user accounts",hasGeneralAdminRole:"General admin",hasImpersonatorRole:"Can impersonate company users",hasMonthlyReportEditorRole:"Can edit and process monthly reports",hasEventAdminRole:"Can modify data in the events area",hasSysAdminRole:"Can send messages to all logged in users",hasHomePageManagerRole:"Can manage home page hero images"},r={hasCatalogOrderManagerRole:"Catalog Order Manager",hasCompanyUserAccountManagerRole:"Company User Account Manager",hasGeneralAdminRole:"General Admin",hasImpersonatorRole:"Impersonator",hasMonthlyReportEditorRole:"Monthly Report Editor",hasSettingsManagerRole:"Administration",hasTransactionCreatorRole:"Transaction Creator",hasEventAdminRole:"Event Admin",hasSysAdminRole:"System Admin",hasHomePageManagerRole:"Home Page Manager"}},815:(e,t,n)=>{n.d(t,{Y:()=>v});var a=n(29439),o=n(72791),s=n(52174),r=n(11135),i=n(20890),l=n(24518),d=n(66616),c=n(58003),u=n(17508),p=n(81844),m=n(36721),h=n(80184);const v=(0,c.EN)(e=>{const t=o.useState(),n=(0,a.Z)(t,2),c=n[0],v=n[1],g=(0,s.Z)(e=>(0,r.Z)({root:{display:"grid",alignItems:"center",gridTemplateColumns:"1fr",marginBottom:e.spacing(2)},img:{margin:"0 auto"},details:{padding:e.spacing(2)},productName:{fontWeight:"bold",fontSize:14,color:e.palette.grey[800]},modelNumber:{color:e.palette.grey[500]},salesCopy:{marginTop:e.spacing(2),color:e.palette.grey[700]},cost:{color:e.palette.grey[700],fontSize:16,fontWeight:"bold"},costHost:{textAlign:"center",padding:e.spacing(2,0),display:"flex",alignItems:"center",justifyContent:"space-around",borderColor:"gainsboro",borderWidth:"1px 0 1px 0",borderStyle:"solid",marginTop:e.spacing(2)},costCaption:{color:e.palette.grey[700],fontSize:"smaller",textTransform:"uppercase",marginBottom:0,display:"block"},brand:{cursor:"pointer",color:e.palette.grey[500]},categoryPath:{display:"inline-flex",color:e.palette.secondary.light,fontSize:"10pt","& > :first-child":{marginLeft:0}}
1,category:{margin:"0 .5em",cursor:"pointer"},adminInfo:{color:"blue"},addToCartButton:{},viewDetailsButton:{},productDetails:{paddingBottom:e.spacing(2)},clubPoints:{display:"inline-block",marginRight:e.spacing(3)}}))(),y=e.product;o.useEffect(()=>()=>{v(void 0)},[]);return(0,h.jsx)(p.D,{title:"Product Details",handleClose:e.handleClose,children:(0,h.jsxs)("div",{className:g.root,children:[(()=>{if(c){const t=e.product.options.find(e=>e.id===c);if(!t)throw Error("Could not find option with id ".concat(c));return(0,h.jsx)("img",{className:g.img,src:t.image,alt:t.size})}return(0,h.jsx)("img",{className:g.img,src:e.product.imageUrl,alt:e.product.productName})})(),(0,h.jsxs)("div",{className:g.productDetails,children:[(0,h.jsx)(i.Z,{className:g.brand,variant:"caption",children:y.brand}),(0,h.jsx)(i.Z,{className:g.productName,variant:"h5",children:y.productName}),(0,h.jsxs)("div",{className:g.modelNumber,children:["Model: ",y.model]}),(0,h.jsx)(d.j,{context:"Catalog",productId:e.product.id,selectedOptionId:c,setSelectedOptionId:v,options:y.options}),(0,h.jsxs)("div",{className:g.costHost,children:[(0,h.jsxs)("span",{className:g.clubPoints,children:[(0,h.jsx)(i.Z,{className:g.cost,variant:"h5",children:y.points?(0,u.uf)(y.points):"???"}),(0,h.jsx)(i.Z,{className:g.costCaption,children:(0,m.eM)()})]}),(0,h.jsx)(l.Z,{className:g.addToCartButton,disabled:void 0===y.points,onClick:()=>{if(y.options.length>0&&!c){alert("Please select an option");const t=document.getElementById("".concat(e.product.id,"+options"));return void(t&&t.focus())}const t=e.product.options.find(e=>e.id===c);e.onAddToCart(e.product,t)},variant:"contained",color:"secondary",children:"Add to Cart"})]}),(0,h.jsx)("div",{className:g.salesCopy,children:y.salesCopy})]})]})})})},89597:(e,t,n)=>{n.r(t),n.d(t,{Root:()=>fn});var a=n(72791),o=n(66708),s=n(77257),r=n(29439),i=n(4708),l=n(1413),d=n(99023),c=n(55931),u=n(58003),p=n(92506),m=n(76329),h=n(52174),v=n(11135),g=n(62850),y=n(11895),b=n(48550),f=n(7399),x=n(80184);const j=e=>{const t=e.brands.map(e=>({label:e.name,value:e.id})),n=e.value?t.find(t=>t.value===e.value):null,a=n=>{const a=e.value?t.find(t=>t.value===e.value).label:"",o=t.find(e=>e.label===n);if(o)e.handleOptionSelected(o);else{a!==n&&e.handleRawTextSelected(n)}};return(0,x.jsx)(f.Z,{value:n,freeSolo:!0,onInputChange:e=>{a(e.target.value)},onChange:(t,n)=>{n&&"object"===typeof n?e.handleOptionSelected(n):"string"===typeof n&&a(n)},renderInput:e=>(0,x.jsx)(b.Z,(0,l.Z)((0,l.Z)({},e),{},{variant:"outlined",onKeyDown:e=>"Enter"!==e.key||(e.preventDefault(),e.stopPropagation(),!1),margin:"dense",label:"Select Brand",fullWidth:!0})),options:t,getOptionLabel:e=>{var t,n;return"string"===typeof e?e:"string"===typeof e.label?e.label:null!==(t=null===(n=e.label)||void 0===n?void 0:n.label)&&void 0!==t?t:""},loading:!1})};var C=n(81844);const Z=e=>{const t=(0,h.Z)(e=>(0,v.Z)({root:{minWidth:300}}))();a.useEffect(()=>{g.n.ensureBrandsFetched()},[]);const n=async(t,n)=>{const a={brandId:t.brandId,brandName:t.brandName,companyId:e.companyId};try{await e.handleSubmit(a)}catch(o){(0,m.V)(o)}n.setSubmitting(!1)},o={brandId:""},r=(e,t)=>(0,x.jsx)(j,{handleOptionSelected:t=>((e,t)=>{t.setFieldValue("brandId",e.value),t.setFieldValue("brandName",void 0)})(t,e),handleRawTextSelected:t=>((e,t)=>{t.setFieldValue("brandId",void 0),t.setFieldValue("brandName",e)}
1)(t,e),value:e.values.brandId,error:e.errors.brandId,touched:e.touched.brandId,brands:t});return(0,x.jsx)(s.Qj,{render:()=>{const a=g.n.getEnum("brands");return g.n.isLoading("brands")?(0,x.jsx)("div",{}):(0,x.jsx)("div",{className:t.root,children:(0,x.jsx)(p.J9,{initialValues:o,onSubmit:n,children:t=>(0,x.jsx)(C.D,{handleClose:e.handleCancel,title:"Add Brand",disableSaveButton:t.isSubmitting||y.R.isBusy,handleSave:()=>t.submitForm(),children:r(t,a)})})})}})};class w extends a.Component{constructor(){super(...arguments),this.render=()=>(0,x.jsx)(Z,{companyId:y.R.details.id,companyBrands:y.R.details?y.R.details.brands:[],handleSubmit:this.handleSubmit,handleCancel:this.props.handleClose}),this.handleSubmit=async e=>{await y.R.createBrand(e),e.brandName&&await g.n.ensureBrandsFetched(!0),this.props.handleClose()}}}const S=(0,u.EN)(w);var N=n(20890),P=n(8007),E=n(61889),I=n(85523),D=n(94454),T=n(24375),A=n(87405),O=n(68096),k=n(47071),R=n(73237);const M=e=>{a.useEffect(()=>{g.n.ensurePhoneNumberTypesFetched(),g.n.ensureRelationTypesFetched()},[]);const t=(0,h.Z)(e=>(0,v.Z)({contactFormRoot:{},heading:{margin:e.spacing(1,0),color:e.palette.primary.dark,fontWeight:"bold"},warning:{color:e.palette.secondary.dark},error:{color:e.palette.error.main,fontWeight:"bold"}})),n={altName:"",lastName:"",firstName:"",companyId:e.companyId,email:{emailAddress:"",main:!0},phone:{extension:"",number:""},isEmployee:!1,title:""},o=e=>{var t,n,a,o,s,r;return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(E.ZP,{item:!0,xs:12,sm:4,children:(0,x.jsx)(b.Z,{name:"firstName",label:"First Name",margin:"dense",variant:"outlined",helperText:e.touched.firstName&&(null===(t=e.errors)||void 0===t?void 0:t.firstName),error:Boolean(e.touched.firstName&&(null===(n=e.errors)||void 0===n?void 0:n.firstName)),fullWidth:!0,onChange:e.handleChange,onBlur:e.handleBlur})}),(0,x.jsx)(E.ZP,{item:!0,xs:12,sm:4,children:(0,x.jsx)(b.Z,{name:"lastName",label:"Last Name",margin:"dense",variant:"outlined",helperText:e.touched.lastName&&(null===(a=e.errors)||void 0===a?void 0:a.lastName),error:Boolean(e.touched.lastName&&(null===(o=e.errors)||void 0===o?void 0:o.lastName)),fullWidth:!0,onChange:e.handleChange,onBlur:e.handleBlur})}),(0,x.jsx)(E.ZP,{item:!0,xs:12,sm:4,children:(0,x.jsx)(b.Z,{name:"altName",label:"Preferred Name",margin:"dense",variant:"outlined",fullWidth:!0,helperText:null===(s=e.errors)||void 0===s?void 0:s.altName,error:Boolean(null===(r=e.errors)||void 0===r?void 0:r.altName),onChange:e.handleChange,onBlur:e.handleBlur})})]})},r=e=>(0,x.jsx)(E.ZP,{item:!0,xs:12,children:(0,x.jsx)(N.Z,{className:c.heading,style:{gridColumn:"1 / 13"},children:e})}),i=e=>{var t,n;return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(E.ZP,{item:!0,xs:12,sm:4,children:(0,x.jsx)(b.Z,{name:"title",label:"Title",margin:"dense",variant:"outlined",helperText:null===(t=e.errors)||void 0===t?void 0:t.title,error:Boolean(null===(n=e.errors)||void 0===n?void 0:n.title),fullWidth:!0,onChange:e.handleChange,onBlur:e.handleBlur})}),(0,x.jsx)(E.ZP,{item:!0,xs:12,sm:4,children:(0,x.jsx)(I.Z,{control:(0,x.jsx)(D.Z,{checked:e.values.isEmployee,onChange:t=>e.setFieldValue("isEmployee",t.target.checked),size:"small"}),label:"Is Employee"})})]})},l=e=>{var t,n,a,o,s,r,i,l;return(0,x.jsxs)(E.ZP,{container:!0,alignItems:"center",spacing:1,children:[(0,x.jsx)(E.ZP,{item:!0,xs:4,children:(0,x.jsxs)(O.Z,{fullWidth:!0,children:[(0,x.jsx)(T.z,{error:Boolean(null!==(t=null===(n=e.errors.phone)||void 0===n?void 0:n.number)&&void 0!==t?t:""),name:"phone.number",type:"text",label:"Number",onChange:e.handleChange,onBlur:e.handleBlur,value:e.values.phone.number,placeholder:"Number"}),(0,x.jsx)(p.Bc,{className:c.error,component:k.Z,name:"phone.number"})]})}),(0,x.jsx)(E.ZP,{item:!0,xs:2,children:(0,x.jsx)(b.Z,{fullWidth:!0,type:"text",variant:"outlined",margin:"dense",label:"Ext",placeholder:"Ext",name:"phone.extension",onChange:e.handleChange,onBlur:e.handleBlur,value:null!==(a=e.values.phone.extension)&&void 0!==a?a:""})}),(0,x.jsx)(E.ZP,{item:!0,xs:5,children:(0,x.jsxs)(O.Z,{fullWidth:!0,children:[(0,x.jsx)(A.Z,{error:Boolean(null===(o=e.errors)||void 0===o||null===(s=o.phone)||void 0===s?void 0:s.type),handleBlur:e.handleBlur,value:null!==(r=null===(i=e.values.phone)||void 0===i?void 0:i.type)&&void 0!==r?r:null,onChange:t=>{e.setFieldValue("phone.type",t)}}),(0,x.jsx)("div",{children:null===(l=e.errors.phone)||void 0===l?void 0:l.type}),(0,x.jsx)(p.Bc,{component:k.Z,className:c.error,name:"phone.type"})]})})]})},d=e=>{var t,n,a,o,s;return(0,x.jsxs)(E.ZP,{alignItems:"center",container:!0,spacing:1,children:[(0,x.jsx)(E.ZP,{item:!0,xs:12,sm:5,children:(0,x.jsx)(O.Z,{fullWidth:!0,children:(0,x.jsx)(b.Z,{margin:"dense",variant:"outlined",error:Boolean(e.touched.email&&(null===(t=e.errors.email)||void 0===t?void 0:t.emailAddress)),name:"email.emailAddress",type:"email",label:"Address",helperText:e.touched.email&&(null===(n=e.errors.email)||void 0===n?void 0:n.emailAddress),onChange:e.handleChange,onBlur:e.handleBlur,value:null!==(a=e.values.email.emailAddress)&&void 0!==a?a:"",placeholder:"Address"})})}),(0,x.jsx)(E.ZP,{item:!0,xs:6,sm:4,children:(0,x.jsx)(O.Z,{style:{width:"100%"},children:(0,x.jsx)(R.L,{error:Boolean(null===(o=e.errors.email)||void 0===o?void 0:o.type),handleBlur:e.handleBlur,onChange:t=>{e.setFieldValue("email.type",t)},value:null!==(s=e.values.email.type)&&void 0!==s?s:null})})})]})},c=t();return(0,x.jsx)(s.Qj,{render:()=>{if(g.n.isLoading("relationTypes"))return(0,x.jsx)("div",{});const t=P.Ry().shape({firstName:P.Z_().required("First Name is required"),lastName:P.Z_(),phone:P.Ry().shape({extension:P.Z_(),number:P.Z_(),type:P.nK().oneOf(["Home","Work","Cell","Direct","Other"])}),email:P.Ry().shape({type:P.Z_(),emailAddress:P.Z_().email("Must be a valid email address"),main:P.Xg()})});return(0,x.jsx)(p.J9,{onSubmit:t=>{e.handleSubmit(t)}
1,validationSchema:t,initialValues:n,validate:e=>{const t={};return e.phone.number&&!e.phone.type&&(t.phone={type:"Please select a type"}),t},children:t=>(0,x.jsx)("div",{className:c.contactFormRoot,children:(0,x.jsx)(C.D,{handleClose:e.handleCancel,title:"Add Contact",disableSaveButton:t.isSubmitting||e.isSaving,handleSave:t.submitForm,children:(0,x.jsxs)(E.ZP,{container:!0,spacing:2,alignItems:"center",children:[o(t),i(t),r("Phone Number"),l(t),r("Email"),d(t)]})})})})}})};class F extends a.Component{constructor(){super(...arguments),this.render=()=>(0,x.jsx)(M,{isSaving:y.R.isSavingContact,companyId:this.props.companyId,handleSubmit:this.handleSubmit,handleCancel:this.props.handleClose}),this.handleSubmit=async e=>{try{e.companyId=this.props.companyId;const t=await y.R.createContact(e);this.props.savedCallback(t)}catch(t){console.error(t)}finally{this.props.handleClose()}}}}const B=(0,u.EN)(F),L=e=>{a.useEffect(()=>{g.n.ensureCategoriesFetched()},[]);const t=()=>{var t;return null!==(t=e.onlyAvailableOptions)&&void 0!==t?t:g.n.getEnum("categories").map(e=>({value:e.id,label:e.name}))};return(0,x.jsx)(s.Qj,{render:()=>g.n.isLoading("categories")?(0,x.jsx)("div",{}):(0,x.jsx)(f.Z,{disabled:e.disabled,options:t(),loading:!1,onChange:(t,n)=>e.onChanged(n),value:e.value,noOptionsText:e.noOptionsText,isOptionEqualToValue:(e,t)=>e.value===t.value,getOptionLabel:e=>"string"===typeof e?e:"string"===typeof e.label?e.label:e.label.label,renderOption:(t,n)=>e.renderOption?(0,x.jsx)("li",(0,l.Z)((0,l.Z)({},t),{},{children:e.renderOption(n)})):(0,x.jsx)("li",(0,l.Z)((0,l.Z)({},t),{},{children:n.label})),renderInput:t=>(0,x.jsx)(b.Z,(0,l.Z)((0,l.Z)({},t),{},{variant:"outlined",error:e.hasError,label:e.hideLabel?void 0:"Category",placeholder:"Select category",style:{margin:0},InputProps:(0,l.Z)({},t.InputProps),margin:"dense"}))})})};var z=n(17960),U=n(7585);var G=n(13239),V=n(8696),W=n(32331),q=n(63733);const H=(0,h.Z)(e=>(0,v.Z)({companyTypes:{display:"inline-block",marginLeft:e.spacing(1),fontSize:"smaller",color:"white",padding:e.spacing(0,1),borderRadius:"10px"},sponsor:{backgroundColor:W.o.sponsor},competitor:{backgroundColor:W.o.competitor},prospect:{backgroundColor:W.o.prospect},member:{backgroundColor:W.o.member}})),Y=e=>{var t,n,o;const s=a.useState(null!==(t=e.onlyAvailableOptions)&&void 0!==t?t:[]),i=(0,r.Z)(s,2),d=i[0],c=i[1],u=a.useState(!1),p=(0,r.Z)(u,2),m=p[0],h=p[1],v=a.useState(""),g=(0,r.Z)(v,2),y=g[0],j=g[1],C=(0,V.Nr)(y,500),Z=e.searchCompanyTypes,w=e.optionsFilter,S=H();a.useEffect(()=>{if(C&&!e.onlyAvailableOptions){const t=async t=>{var n,a;const o=null!==(n=null===(a=e.searchCompanyTypes)||void 0===a?void 0:a.current)&&void 0!==n?n:[],s="Sponsor"===e.currentUserType&&o.includes("Member"),r="Member"===e.currentUserType&&o.includes("Sponsor");let i;if(h(!0),"Admin"===e.currentUserType){const e=await U.C.admin.search.unifiedSearch({search:t,activeOnly:!0,includeContacts:!1,companyTypes:o});i={companies:e.companies.map(e=>({id:e.id,name:e.name,identifier:e.identifier.toString(),computedBalance:e.computedBalance,companyType:e.companyType,isActive:e.isActive,searchScore:e.searchScore})),searchTerm:e.searchTerm}}else s?i=await U.C.sponsors.purchasers.search(t):r&&(i=await U.C.shared.sponsors.searchSponsors(t));if(i){if(i.searchTerm===C){let e=i.companies.map(e=>({value:e.id,label:"".concat(e.name," (").concat(e.identifier,")"),computedBalance:e.computedBalance,companyType:e.companyType}));w&&(e=w(e)),window.setTimeout(()=>{c(e),h(!1)},100),c(e),h(!1)}}else h(!1)};t(C)}},[C,Z,w,e.onlyAvailableOptions,e.currentUserType,e.searchCompanyTypes]);const N=null!==(n=e.noRecordsText)&&void 0!==n?n:"No companies found";return(0,x.jsxs)(O.Z,{fullWidth:!0,variant:"filled",className:null!==(o=e.className)&&void 0!==o?o:"",children:[(0,x.jsx)(f.Z,{value:e.value,noOptionsText:y?N:"Type to search",onInputChange:t=>{if(!t)return;e.onlyAvailableOptions||c([]);const n=t.currentTarget.value||"";j(n)},options:d,loading:m,onBlur:e.onBlur,loadingText:"Searching companies...",isOptionEqualToValue:(e,t)=>e===t,renderOption:(e,t)=>t.companyType?(0,x.jsxs)("li",(0,l.Z)((0,l.Z)({},e),{},{children:[(0,x.jsx)("span",{children:t.label}),(0,x.jsx)("span",{className:(0,q.Z)(S.companyTypes,{[S.competitor]:"Competitor"===t.companyType,[S.sponsor]:"Sponsor"===t.companyType,[S.member]:"Member"===t.companyType,[S.prospect]:"Prospect"===t.companyType}),children:t.companyType})]})):(0,x.jsx)("li",(0,l.Z)((0,l.Z)({},e),{},{children:t.label})),getOptionLabel:e=>"string"===typeof e?e:"string"===typeof e.label?e.label:e.label.label,onChange:(t,n)=>(e.onlyAvailableOptions||c([]),e.onChange(n)),renderInput:t=>(0,x.jsx)(b.Z,(0,l.Z)((0,l.Z)({},t),{},{variant:"outlined",error:Boolean(e.errorMessage),label:e.label,style:{margin:0},InputProps:(0,l.Z)((0,l.Z)({},t.InputProps),{},{endAdornment:(0,x.jsxs)(a.Fragment,{children:[m?(0,x.jsx)(G.Z,{color:"inherit",size:20}):null,t.InputProps.endAdornment]})}),margin:"dense"}))}),(0,x.jsx)(k.Z,{variant:"standard",className:e.errorClassName,children:e.errorMessage})]})};var _=n(32856);const K=e=>(0,x.jsx)(b.Z,{variant:"outlined",id:"rateDesc",margin:"dense",label:"Rate Description",fullWidth:!0,value:e.value,onChange:e.handleChange,error:e.touched&&Boolean(e.error),name:"rateDesc",placeholder:"Rate Description",helperText:e.touched&&e.error});var Q=n(81579);const J=e=>(0,x.jsx)(b.Z,{variant:"outlined",id:"rate",margin:"dense",label:"Rate",fullWidth:!0,value:e.value,onChange:e.handleChange,error:e.touched&&Boolean(e.error),name:"rate",placeholder:"Rate",inputProps:{min:"1",step:"1"},InputProps:{inputComponent:Q.U,inputProps:{allowNegative:!1,prefix:"",decimalScale:0}},helperText:e.touched&&e.error}),$=e=>(0,x.jsx)(I.Z,{label:"Show On Internet",checked:e.value,control:(0,x.jsx)(D.Z,{checked:e.value,onChange:e.handleChange,name:"showOnInternet"})}),X=e=>(0,x.jsx)(I.Z,{label:"Show On Report",checked:e.value,control:(0,x.jsx)(D.Z,{checked:e.value,onChange:e.handleChange,name:"showOnReport"})}),ee=e=>(0,x.jsx)(I.Z,{label:"Is Primary",checked:e.value,control:(0,x.jsx)(D.Z,{checked:e.value,onChange:e.handleChange,name:"isPrimary"})});var te=n(23786);const ne=e=>(0,x.jsx)(O.Z,{fullWidth:!0,children:(0,x.jsx)(b.Z,{select:!0,variant:"outlined",margin:"dense",label:"Units",error:e.touched&&Boolean(e.error),name:"unitId",onChange:e.handleChange,value:e.value,helperText:e.touched&&e.error,children:e.units.map(e=>(0,x.jsx)(te.Z,{value:e.id,children:e.description},e.id))})}),ae=e=>{var t,n,o,r,i,l,d,c;a.useEffect(()=>{g.n.ensureCategoriesFetched(),g.n.ensureUnitsFetched()},[]);const u=async(t,n)=>{var a;const o={id:null===(a=e.companyCategory)||void 0===a?void 0:a.id,categoryId:t.categoryId,rate:t.rate,rateDesc:t.rateDesc,showOnInternet:t.showOnInternet,showOnReport:t.showOnReport,companyId:e.companyId,isPrimary:t.isPrimary,unitId:t.unitId};try{await e.handleSubmit(o)}catch(s){(0,m.V)(s)}n.setSubmitting(!1)},h=e.companyCategory,v=(e,t)=>
1(0,x.jsx)(_.x,{name:"categoryId",label:"Category",value:e.values.categoryId,error:e.errors.categoryId,touched:e.touched.categoryId,handleChange:e.handleChange,categories:t}),b=e=>(0,x.jsx)(J,{value:e.values.rate,error:e.errors.rate,touched:e.touched.rate,handleChange:e.handleChange}),f=e=>(0,x.jsx)(K,{value:e.values.rateDesc,touched:e.touched.rateDesc,error:e.errors.rateDesc,handleChange:e.handleChange}),j=(e,t)=>(0,x.jsx)(ne,{units:t,handleChange:e.handleChange,touched:e.touched.unitId,error:e.errors.unitId,value:e.values.unitId}),Z=e=>(0,x.jsx)($,{value:e.values.showOnInternet,handleChange:e.handleChange}),w=e=>(0,x.jsx)(X,{value:e.values.showOnReport,handleChange:e.handleChange}),S=e=>(0,x.jsx)(ee,{value:e.values.isPrimary,handleChange:e.handleChange}),N={categoryId:null!==(t=null===h||void 0===h||null===(n=h.category)||void 0===n?void 0:n.id)&&void 0!==t?t:"",rate:h?h.rate:1,rateDesc:null!==(o=null===h||void 0===h?void 0:h.rateDesc)&&void 0!==o?o:"",showOnInternet:null===(r=null===h||void 0===h?void 0:h.showOnInternet)||void 0===r||r,showOnReport:null===(i=null===h||void 0===h?void 0:h.showOnReport)||void 0===i||i,isPrimary:!!(null!==(l=null===h||void 0===h?void 0:h.isPrimary)&&void 0!==l?l:0===e.existingCategoryCount),unitId:null!==(d=null===h||void 0===h||null===(c=h.unit)||void 0===c?void 0:c.id)&&void 0!==d?d:""};return(0,x.jsx)(s.Qj,{render:()=>{const t=g.n.getEnum("categories"),n=g.n.getEnum("units");return g.n.isLoading("categories")||g.n.isLoading("units")?(0,x.jsx)("div",{}):(0,x.jsx)(p.J9,{initialValues:N,onSubmit:u,children:a=>(0,x.jsx)(p.l0,{children:(0,x.jsx)(C.D,{handleClose:e.handleCancel,title:"add"===e.formType?"Add Category":"Update Category",disableSaveButton:a.isSubmitting||y.R.isBusy,handleSave:()=>a.submitForm(),children:(0,x.jsxs)(E.ZP,{alignItems:"center",container:!0,spacing:1,children:[(0,x.jsx)(E.ZP,{item:!0,xs:12,children:v(a,t)}),(0,x.jsx)(E.ZP,{item:!0,xs:6,children:b(a)}),(0,x.jsx)(E.ZP,{item:!0,xs:6,children:j(a,n)}),(0,x.jsx)(E.ZP,{item:!0,xs:12,children:f(a)}),(0,x.jsx)(E.ZP,{item:!0,xs:12,sm:6,lg:4,children:Z(a)}),(0,x.jsx)(E.ZP,{item:!0,xs:12,sm:6,lg:4,children:w(a)}),(0,x.jsx)(E.ZP,{item:!0,xs:12,sm:6,lg:4,children:S(a)})]})})})})}})};class oe extends a.Component{constructor(){super(...arguments),this.render=()=>(0,x.jsx)(ae,{existingCategoryCount:this.props.existingCategoryCount,companyId:y.R.details.id,formType:"add",handleSubmit:this.handleSubmit,handleCancel:this.props.handleClose}),this.handleSubmit=async e=>{await y.R.createCategory(e),this.props.handleClose()}}}const se=(0,u.EN)(oe),re=e=>(0,x.jsx)(b.Z,{variant:"outlined",id:"content",margin:"dense",label:"Note",fullWidth:!0,multiline:!0,minRows:10,value:e.value,onChange:e.handleChange,error:e.touched&&Boolean(e.error),name:"content",placeholder:"Note",helperText:e.touched&&e.error}),ie=e=>(0,x.jsx)(I.Z,{label:"Alert",checked:e.value,control:(0,x.jsx)(D.Z,{checked:e.value,onChange:e.handleChange,name:"isImportant"})}),le=e=>{var t,n,a,o;const s=P.Ry().shape({content:P.Z_().required("Content is required"),isImportant:P.O7().required()}),r={content:null!==(t=null===(n=e.companyNote)||void 0===n?void 0:n.content)&&void 0!==t?t:"",isImportant:null!==(a=null===(o=e.companyNote)||void 0===o?void 0:o.isImportant)&&void 0!==a&&a};return(0,x.jsx)(p.J9,{initialValues:r,validationSchema:s,onSubmit:async(t,n)=>{const a={content:t.content,isImportant:t.isImportant};try{await e.handleSubmit(a)}catch(o){(0,m.V)(o)}n.setSubmitting(!1)},children:t=>(0,x.jsx)(p.l0,{children:(0,x.jsxs)(C.D,{handleClose:e.handleCancel,title:"add"===e.formType?"Add Note":"Update Note",disableSaveButton:t.isSubmitting||y.R.isBusy,handleSave:()=>t.submitForm(),children:[(0,x.jsx)(re,{error:t.errors.content,touched:t.touched.content,value:t.values.content,handleChange:t.handleChange}),(0,x.jsx)(ie,{value:t.values.isImportant,handleChange:e=>t.setFieldValue("isImportant",e.target.checked)})]})})})};class de extends a.Component{constructor(){super(...arguments),this.render=()=>(0,x.jsx)(le,{formType:"add",handleSubmit:this.handleSubmit,handleCancel:this.props.handleClose}),this.handleSubmit=async e=>{await y.R.createNote({companyNote:(0,l.Z)({companyId:y.R.details?y.R.details.id:""},e)}),this.props.handleClose()}}}const ce=(0,u.EN)(de),ue=(0,u.EN)(e=>{var t;const n=a.useState(!1),o=(0,r.Z)(n,2),s=o[0],i=o[1],l=a.useState(null!==(t=e.existingNote)&&void 0!==t?t:""),d=(0,r.Z)(l,2),c=d[0],u=d[1],p=a.useState(!1),m=(0,r.Z)(p,2),h=m[0],v=m[1];return(0,x.jsxs)(C.D,{handleClose:e.handleClose,title:"Add Note",disableSaveButton:s||
10===c.length,handleSave:async()=>{i(!0);try{await e.handleSubmit(c,e.showIsImportant?h:void 0),e.handleClose()}finally{i(!1)}},children:[(0,x.jsx)(b.Z,{variant:"outlined",id:"content",margin:"dense",label:"Note",fullWidth:!0,multiline:!0,minRows:5,value:c,onChange:e=>u(e.target.value),placeholder:"Note"}),e.showIsImportant&&(0,x.jsx)(I.Z,{control:(0,x.jsx)(D.Z,{checked:h,onChange:e=>v(e.target.checked)}),label:"Alert"})]})});var pe=n(68482);const me=e=>{const t=e.products.map(e=>({label:e.name,value:e.id})),n=e.value?t.find(t=>t.value===e.value):null,a=n=>{const a=e.value?t.find(t=>t.value===e.value).label:"",o=t.find(e=>e.label===n);if(o)e.handleOptionSelected(o);else{a!==n&&e.handleRawTextSelected(n)}};return(0,x.jsx)(f.Z,{freeSolo:!0,value:n,onInputChange:e=>{a(e.target.value)},onChange:(t,n)=>{n&&"object"===typeof n?e.handleOptionSelected(n):"string"===typeof n&&a(n)},renderInput:e=>(0,x.jsx)(b.Z,(0,l.Z)((0,l.Z)({},e),{},{variant:"outlined",placeholder:"Product",onKeyDown:e=>"Enter"!==e.key||(e.preventDefault(),e.stopPropagation(),!1),margin:"dense",label:"Select Product",fullWidth:!0})),options:t,getOptionLabel:e=>{var t,n;return"string"===typeof e?e:"string"===typeof e.label?e.label:null!==(t=null===(n=e.label)||void 0===n?void 0:n.label)&&void 0!==t?t:""},loading:!1})},he=P.Ry().shape({productId:P.Z_(),productName:P.Z_()}),ve=e=>{const t={productId:""};a.useEffect(()=>{g.n.ensureProductsFetched()},[]);const n=async(t,n)=>{const a={productId:t.productId,productName:t.productName,companyId:e.companyId};try{await e.handleSubmit(a)}catch(o){(0,m.V)(o)}n.setSubmitting(!1)},o=(e,t)=>(0,x.jsx)(me,{handleOptionSelected:t=>((e,t)=>{t.setFieldValue("productId",e.value),t.setFieldValue("productName",void 0)})(t,e),handleRawTextSelected:t=>((e,t)=>{t.setFieldValue("productId",void 0),t.setFieldValue("productName",e)})(t,e),value:e.values.productId,error:e.errors.productId,touched:e.touched.productId,products:t});return(0,x.jsx)(s.Qj,{render:()=>{const a=g.n.getEnum("products");return g.n.isLoading("products")?(0,x.jsx)("div",{}):(0,x.jsx)(p.J9,{validationSchema:he,initialValues:t,onSubmit:n,children:t=>(0,x.jsx)(C.D,{handleClose:e.handleCancel,title:"Add Product",disableSaveButton:t.isSubmitting||y.R.isBusy,handleSave:()=>t.submitForm(),children:o(t,a)})})}})};class ge extends a.Component{constructor(){super(...arguments),this.render=()=>(0,x.jsx)(ve,{companyProducts:y.R.details?y.R.details.products:[],handleSubmit:this.handleSubmit,handleCancel:this.props.handleClose,companyId:y.R.details.id}),this.handleSubmit=async e=>{await y.R.createProduct(e),e.productName&&g.n.ensureProductsFetched(!0),this.props.handleClose()}}}const ye=(0,u.EN)(ge);class be extends a.Component{constructor(){super(...arguments),this.render=()=>{const e=y.R.details&&y.R.details.categories.find(e=>e.id===this.props.id);return(0,x.jsx)(ae,{companyId:y.R.details.id,formType:"update",companyCategory:e,handleSubmit:this.handleSubmit,handleCancel:this.props.handleClose})},this.handleSubmit=async e=>{await y.R.updateCategory(e),this.props.handleClose()}}}const fe=(0,u.EN)(be);class xe extends a.Component{constructor(){super(...arguments),this.handleSubmit=async e=>{const t=y.R.details&&y.R.details.notes.find(e=>e.id===this.props.id),n={companyNote:(0,l.Z)({id:this.props.id,companyId:y.R.details?y.R.details.id:""},e)};await y.R.updateNote(n,t),this.props.handleClose()}}render(){const e=y.R.details&&y.R.details.notes.find(e=>e.id===this.props.id);return(0,x.jsx)(le,{formType:"update",companyNote:e,handleSubmit:this.handleSubmit,handleCancel:this.props.handleClose})}}const je=(0,u.EN)(xe);var Ce=n(17508);const Ze=e=>{const t=(()=>{var t;return(t=e.transactionTypes,"credit"===e.mode?t.filter(e=>e.isManual&&"Company"===e.toPartyType):"debit"===e.mode?t.filter(e=>e.isManual&&"Company"===e.fromPartyType):t).map(e=>({value:e.id,label:e.description,fromPartyType:e.fromPartyType,toPartyType:e.toPartyType,defaultPoints:e.defaultPoints,defaultNote:e.defaultNote}))})(),n=t.find(t=>{var n;return t.value===(null===(n=e.value)||void 0===n?void 0:n.id)});return(0,x.jsxs)(O.Z,{variant:"filled",className:e.className,children:[(0,x.jsx)(f.Z,{options:t,loading:!1,onChange:(t,n)=>{const a=e.transactionTypes.find(e=>e.id===n.value);a&&e.onChanged(a)},value:n,isOptionEqualToValue:(e,t)=>
1e.value===t.value,getOptionLabel:e=>"string"===typeof e?e:"string"===typeof e.label?e.label:e.label.label,renderInput:e=>(0,x.jsx)(b.Z,(0,l.Z)((0,l.Z)({},e),{},{variant:"outlined",label:"Transaction Type",placeholder:"Select transaction type",style:{margin:0},InputProps:(0,l.Z)({},e.InputProps),margin:"dense"}))}),(0,x.jsx)(k.Z,{variant:"standard",className:e.errorClassName,children:e.errorMessage})]})},we=e=>{var t;return(0,x.jsxs)(O.Z,{className:e.className,children:[(0,x.jsx)(b.Z,{variant:"outlined",margin:"dense",InputProps:{inputComponent:Q.U,inputProps:{allowNegative:!1,prefix:"",decimalScale:0,min:e.min}},value:null!==(t=e.value)&&void 0!==t?t:"",id:"quantity",onFocus:e=>{e.target&&e.target.select()},onChange:t=>{const n=t.target.value;if(n.trim().length>0){const t=parseInt(n,0);e.onChanged(t)}},label:"Quantity"}),(0,x.jsx)(k.Z,{variant:"standard",className:e.errorClassName,children:e.errorMessage})]})};var Se=n(32042),Ne=n(92015),Pe=n(44580);const Ee=e=>{const t=(0,h.Z)(e=>(0,v.Z)({root:{},smaller:{fontSize:"smaller"}}))();a.useEffect(()=>{y.R.loadContacts(!1)},[]);const n=e=>void 0===e?[]:e.filter(e=>e.isEmployee&&e.isActive).map(e=>({label:e.altFullName,value:e.id,lastAwarded:e.lastAwardedBirthdayPointsOn,birthday:e.birthdayDate,altOrFirstName:void 0===e.altName||0===e.altName.length?e.firstName:e.altName})).sort((e,t)=>e.label<t.label?-1:e.label>t.label?1:0),o=e=>{var t,n;return e?"".concat(e.month,"/").concat(null!==(t=e.day)&&void 0!==t?t:"--","/").concat(null!==(n=e.year)&&void 0!==n?n:"----"):"---"},r=e=>{const n=e;return(0,x.jsxs)("div",{children:[(0,x.jsx)("div",{children:(0,x.jsx)("strong",{children:n.label})}),(0,x.jsxs)("div",{className:t.smaller,children:[(0,x.jsx)("strong",{children:"Birthday: "}),(0,x.jsx)("span",{children:o(n.birthday)})]}),(0,x.jsxs)("div",{className:t.smaller,children:[(0,x.jsx)("strong",{children:"Last Awarded Points On: "}),(0,x.jsx)(Pe.t,{date:n.lastAwarded})]})]})};return(0,x.jsx)(s.Qj,{render:()=>{const t=y.R.contacts;return(0,x.jsx)(Ne.A,{label:"Select Birthday Contact",options:n(t),loading:void 0===t,selectedOption:e.value,setSelectedOption:e.onChanged,invalidOptionIds:[],renderOption:r,canClear:!1,error:!1})}})};var Ie=n(72426),De=n.n(Ie);const Te=(0,h.Z)(e=>(0,v.Z)({root:{},formControl:{width:"100%"},points:{marginRight:e.spacing(1)},error:{color:e.palette.error.light},noError:{opacity:0},contentGrid:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridRowGap:e.spacing(2),gridColumnGap:e.spacing(2)},pointsRow:{gridColumn:"1 / 4",display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridGap:e.spacing(1),alignItems:"center"}}));var Ae=n(22889),Oe=n(61419),ke=n(17133),Re=n(82777),Me=n(36571),Fe=n(30905),Be=n(64723),Le=n(24518);const ze=(0,h.Z)(e=>(0,v.Z)({container:{display:"flex",width:"100%"},formControl:{margin:e.spacing(1)},buttons:{display:"flex",width:"100%",justifyContent:"flex-end",marginTop:e.spacing(4)}}));function Ue(e){const t=ze();return(0,x.jsx)(p.J9,{initialValues:{amount:e.payment?e.payment.amount.toString():"",checkNumber:e.payment?e.payment.checkNumber:"",date:e.payment?e.payment.date:new Date},validate:t=>{const n={};0!==t.amount.length&&"0"!==t.amount||(n.amount="Required");const a=parseFloat(t.amount);if(isNaN(a)&&(n.amount="Must be a number"),e.customAmountValidator){const t=e.customAmountValidator(a);t.passed||(n.amount=t.errorMessage)}return 0===t.checkNumber.length&&(n.checkNumber="Required"),n},onSubmit:t=>{const n=parseFloat(t.amount);e.onSave(n,t.checkNumber,t.date)},render:n=>(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)("div",{className:t.container,children:[(0,x.jsx)(Me._,{dateAdapter:Be.H,children:(0,x.jsx)(Fe.M,{inputFormat:"MM/dd/yy",label:"Date",value:n.values.date,onChange:e=>{n.setFieldValue("date",e)},renderInput:e=>(0,x.jsx)(b.Z,(0,l.Z)((0,l.Z)({},e),{},{margin:"dense",variant:"outlined",color:"secondary",name:"date",className:t.formControl}))})}),(0,x.jsx)(p.gN,{component:Re.f,variant:"outlined",margin:"dense",className:t.formControl,name:"checkNumber",label:"Check #"}),(0,x.jsx)(p.gN,{variant:"outlined",margin:"dense",component:Re.f,className:t.formControl,label:"Amount",name:"amount",id:"amount",InputProps:{inputComponent:Q.U,inputProps:{allowNegative:!1,prefix:"$",decimalScale:2}}})]}),(0,x.jsxs)("div",{className:t.buttons,children:[(0,x.jsx)(Le.Z,{color:"secondary",onClick:()=>
1{n.submitForm()},children:"Save"}),(0,x.jsx)(Le.Z,{onClick:e.onCancel,color:"secondary",children:"Cancel"})]})]})})}const Ge=e=>{var t,n;const a=(0,h.Z)(e=>(0,v.Z)({root:{display:"grid",gridTemplateColumns:"1fr 1fr",gridGap:e.spacing(1)},error:{gridColumn:"1 / 3",marginLeft:e.spacing(1),color:e.palette.error.main}}))();return(0,x.jsxs)("div",{className:a.root,children:[(0,x.jsxs)(O.Z,{children:[(0,x.jsx)(b.Z,{disabled:e.disabled,fullWidth:!0,error:e.showDollarsError,variant:"outlined",value:null!==(t=(0,Ce.uf)(e.dollarValue,2))&&void 0!==t?t:"",label:e.dollarLabel||"Amount (Dollars)",onChange:t=>{const n=t.target.value.replace("$",""),a=parseFloat(n),o=a/e.dollarsPerPoint,s=(0,Ce.NM)(o,2),r={dollars:isNaN(a)?void 0:a,points:isNaN(s)?void 0:s};(0,Ce.NM)(e.dollarValue,2)!==(0,Ce.NM)(a,2)&&e.onChange(r)},margin:"dense",InputProps:{inputComponent:Q.U,inputProps:{allowNegative:e.allowNegative,prefix:"$",decimalScale:2}}}),e.showDollarsError?(0,x.jsx)(k.Z,{className:a.error,children:e.dollarsError}):void 0]}),(0,x.jsxs)(O.Z,{children:[(0,x.jsx)(b.Z,{fullWidth:!0,disabled:e.disabled,value:null!==(n=e.pointValue)&&void 0!==n?n:"",error:e.showPointsError,variant:"outlined",onChange:t=>{const n=t.target.value;if(0===n.trim().length)e.onChange({dollars:void 0,points:void 0});else{const t=parseInt(n,0),a={dollars:(0,Ce.NM)(t*e.dollarsPerPoint,2),points:t};e.onChange(a)}},label:e.pointLabel||"Amount (Points)",InputProps:{inputComponent:Q.U,inputProps:{allowNegative:e.allowNegative,prefix:"",decimalScale:0}},margin:"dense"}),e.showPointsError?(0,x.jsx)(k.Z,{className:a.error,children:e.pointsError}):void 0]})]})},Ve=(0,h.Z)(e=>(0,v.Z)({container:{display:"flex",alignItems:"baseline"},formControl:{margin:e.spacing(1)},buttons:{display:"flex",width:"100%",justifyContent:"flex-end",marginTop:e.spacing(4)},error:{color:e.palette.error.main}}));function We(e){const t=Ve(),n=a.useState(!1),o=(0,r.Z)(n,2),s=o[0],i=o[1],d=a.useState(),c=(0,r.Z)(d,2),u=c[0],p=c[1],m=a.useState(),h=(0,r.Z)(m,2),v=h[0],g=h[1],y=a.useState(new Date),f=(0,r.Z)(y,2),j=f[0],C=f[1],Z=a.useState(void 0),w=(0,r.Z)(Z,2),S=w[0],N=w[1],P=a.useState(void 0),E=(0,r.Z)(P,2),I=E[0],D=E[1],T=a.useState(void 0),A=(0,r.Z)(T,2),R=A[0],M=A[1];function F(){let t=!1;if(j?M(void 0):(M("This is required"),t=!0),void 0===v)D("This is required"),t=!0;else if(0===v)D("Amount must be greater than zero"),t=!0;else{if(e.customAmountValidator){const n=e.customAmountValidator(v);n.passed?D(void 0):(D(n.errorMessage),t=!0)}D(void 0)}return void 0===u?(N("This is required"),t=!0):0===u?(N("Points must be greater than zero"),t=!0):N(void 0),!t}a.useEffect(()=>{F()},[v,u,j]);return(0,x.jsxs)("div",{children:[(0,x.jsxs)("div",{className:t.container,children:[(0,x.jsxs)(O.Z,{margin:"dense",variant:"outlined",className:t.formControl,children:[(0,x.jsx)(Me._,{dateAdapter:Be.H,children:(0,x.jsx)(Fe.M,{inputFormat:"MM/dd/yy",label:"Date",value:j,onChange:e=>C(e),renderInput:e=>(0,x.jsx)(b.Z,(0,l.Z)((0,l.Z)({},e),{},{error:s&&void 0!==R,variant:"outlined",margin:"dense"}))})}),(0,x.jsx)(k.Z,{className:t.error,variant:"standard",children:s?R:""})]}),(0,x.jsx)(Ge,{onChange:e=>{g(e.dollars),p(e.points)},dollarValue:v,pointValue:u,allowNegative:!1,dollarsPerPoint:e.costPerPoint,dollarsError:I,pointsError:S,showDollarsError:s&&void 0!==I,showPointsError:s&&void 0!==S})]}),(0,x.jsxs)("div",{className:t.buttons,children:[(0,x.jsx)(Le.Z,{color:"secondary",onClick:()=>{i(!0);F()&&e.onSave(u,v,j)},children:"Save"}),(0,x.jsx)(Le.Z,{onClick:e.onCancel,color:"secondary",children:"Cancel"})]})]})}const qe=e=>{const t=(0,h.Z)(e=>(0,v.Z)({root:{},subtitle:{color:e.palette.primary.main}}))();return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("div",{className:t.subtitle,children:"from ".concat(e.accountInfo.name," (").concat(e.accountInfo.identifier,")")}),(0,x.jsx)("div",{className:t.subtitle,children:"Point Balance: ".concat((0,Ce.uf)(e.accountInfo.computedBalance))}),void 0!==e.balanceDueDollars?(0,x.jsx)("div",{className:t.subtitle,children:"Balance Due: ".concat((0,Ce.lb)(e.balanceDueDollars))}):void 0," "]})},He=(0,h.Z)(e=>(0,v.Z)({container:{display:"flex",width:"100%"},formControl:{margin:e.spacing(1)},buttons:{display:"flex",width:"100%",justifyContent:"flex-end",marginTop:e.spacing(4)},error:{color:e.palette.error.main,transform:"translate(3px, -14px)"}}));function Ye(e){const t=He();return(0,x.jsxs)("div",{className:t.container,children:[(0,x.jsx)(O.Z,{margin:"dense",variant:"outlined",className:t.formControl,children:(0,x.jsx)(Me._,{dateAdapter:Be.H,children:(0,x.jsx)(Fe.M,{inputFormat:"MM/dd/yy",label:"Date",value:e.date,onChange:t=>e.onDateChanged(t),renderInput:e=>(0,x.jsx)(b.Z,(0,l.Z)((0,l.Z)({},e),{},{variant:"outlined",margin:"dense"}))})})}),(0,x.jsxs)(O.Z,{margin:"dense",variant:"outlined",className:t.formControl,children:[(0,x.jsx)(b.Z,{variant:"outlined",margin:"dense",onFocus:e=>e.target.select(),className:t.formControl,value:e.checkNumber,onChange:t=>e.onCheckNumberChanged(t.target.value),label:"Check #"}),(0,x.jsx)(k.Z,{className:t.error,variant:"standard",children:e.touched?e.checkNumberError:""})]}),(0,x.jsxs)(O.Z,{margin:"dense",variant:"outlined",className:t.formControl,children:[(0,x.jsx)(b.Z,{variant:"outlined",margin:"dense",value:e.amount,onChange:t=>e.onAmountChanged(parseFloat(t.target.value)),className:t.formControl,onFocus:e=>e.target.select(),label:"Amount",id:"amount",InputProps:{inputComponent:Q.U,inputProps:{allowNegative:!1,prefix:"$",decimalScale:2}}}),(0,x.jsx)(k.Z,{className:t.error,variant:"standard",children:e.touched?e.amountError:""})]})]})}const _e=(0,h.Z)(e=>(0,v.Z)({container:{display:"flex",alignItems:"baseline"},formControl:{margin:e.spacing(1)},buttons:{display:"flex",width:"100%",justifyContent:"flex-end",marginTop:e.spacing(4)},error:{color:e.palette.error.main}}));function Ke(e){const t=_e();return(0,x.jsxs)("div",{children:[(0,x.jsxs)("div",{className:t.container,children:[(0,x.jsxs)(O.Z,{margin:"dense",variant:"outlined",className:t.formControl,children:[(0,x.jsx)(Me._,{dateAdapter:Be.H,children:(0,x.jsx)(Fe.M,{inputFormat:"MM/dd/yy",label:"Date",value:e.date,onChange:e.onDateChanged,renderInput:t=>(0,x.jsx)(b.Z,(0,l.Z)((0,l.Z)({},t),{},{error:e.touched&&void 0!==e.dateError,variant:"outlined",margin:"dense"}))})}),(0,x.jsx)(k.Z,{className:t.error,variant:"standard",children:e.touched?e.dateError:""})]}),(0,x.jsx)(Ge,{onChange:t=>{e.onDollarsChanged(t.dollars),e.onPointsChanged(t.points)},dollarValue:e.dollars,pointValue:e.points,allowNegative:!1,dollarsPerPoint:e.costPerPoint,dollarsError:e.dollarsError,pointsError:e.pointsError,showDollarsError:e.touched&&void 0!==e.dollarsError,showPointsError:e.touched&&void 0!==e.pointsError})]}),(0,x.jsx)(O.Z,{margin:"dense",variant:"outlined",fullWidth:!0,className:t.formControl,children:(0,x.jsx)(b.Z,{minRows:2,multiline:!0,value:e.notes,margin:"dense",variant:"outlined",fullWidth:!0,label:"Memo",onChange:t=>
1e.setNotes(t.target.value)})})]})}var Qe=n(79836),Je=n(53382),$e=n(53994),Xe=n(56890),et=n(35855),tt=n(38247);const nt=e=>{const t=(0,h.Z)(e=>(0,v.Z)({root:{},formControl:{margin:e.spacing(1),maxWidth:150},newValue:{},oldValue:{display:"none"},status:{display:"flex"}}))(),n=e=>e.void?(0,x.jsx)(N.Z,{variant:"body2",children:"Void"}):e.amountPaid>=e.amount?(0,x.jsx)(N.Z,{variant:"body2",children:"Paid"}):e.amount-e.amountPaid>0?(0,x.jsx)(N.Z,{variant:"body2",children:"Open"}):(0,x.jsx)("div",{children:"Unknown"}),a=t=>{var n;const a=null!==(n=e.appliedAmounts[t.id])&&void 0!==n?n:0,o=t.amountPaid+a*(e.isRefund?-1:1);return t.void?(0,x.jsx)(N.Z,{variant:"body2",children:"Void"}):o>=t.amount?(0,x.jsx)(N.Z,{variant:"body2",children:"Paid"}):t.amount-o>0?(0,x.jsx)(N.Z,{variant:"body2",children:"Open"}):(0,x.jsx)("div",{children:"Unknown"})},o=()=>(0,x.jsx)("span",{children:"\xa0>>\xa0"});return(0,x.jsx)("div",{className:t.root,children:0===e.activeInvoices.length?(0,x.jsx)(tt.P,{message:"No open invoices found"}):(0,x.jsxs)(Qe.Z,{size:"small",children:[(0,x.jsx)(Xe.Z,{children:(0,x.jsxs)(et.Z,{children:[(0,x.jsx)($e.Z,{children:"Invoice #"}),(0,x.jsx)($e.Z,{children:"Status"}),(0,x.jsx)($e.Z,{align:"right",children:"Due"}),(0,x.jsx)($e.Z,{align:"right",children:"Paid"}),(0,x.jsx)($e.Z,{align:"right",children:"Amount to Apply"})]})}),(0,x.jsx)(Je.Z,{children:e.activeInvoices.map(s=>{var r,i;const l=e.appliedAmounts[s.id],d=null!==(r=e.originalAppliedAmounts[s.id])&&void 0!==r?r:0,c=void 0!==l&&!isNaN(l);return(0,x.jsxs)(et.Z,{children:[(0,x.jsx)($e.Z,{children:s.invoiceNumber}),(0,x.jsx)($e.Z,{children:(0,x.jsxs)("div",{className:t.status,children:[(0,x.jsx)("span",{children:n(s)}),c&&(0,x.jsxs)(x.Fragment,{children:[o(),(0,x.jsx)("span",{className:"foo",children:a(s)})]})]})}),(0,x.jsx)($e.Z,{align:"right",children:(0,x.jsxs)("div",{children:[(0,x.jsx)("span",{children:(0,Ce.lb)(s.amount-s.amountPaid)}),c&&(0,x.jsxs)(x.Fragment,{children:[o(),(0,x.jsx)("span",{children:(0,Ce.lb)(s.amount-s.amountPaid-(null!==l&&void 0!==l?l:0)*(e.isRefund?-1:1)+d)})]})]})}),(0,x.jsx)($e.Z,{align:"right",children:(0,x.jsxs)("div",{children:[(0,x.jsx)("span",{children:(0,Ce.lb)(s.amountPaid)}),c&&(0,x.jsxs)(x.Fragment,{children:[o(),(0,x.jsx)("span",{children:(0,Ce.lb)(s.amountPaid+(null!==l&&void 0!==l?l:0)*(e.isRefund?-1:1)-d)})]})]})}),(0,x.jsx)($e.Z,{align:"right",children:(0,x.jsx)(b.Z,{variant:"outlined",margin:"dense",value:null!==(i=e.appliedAmounts[s.id])&&void 0!==i?i:"",onChange:t=>{const n=parseFloat(t.target.value);e.onInvoiceAmountPaidChanged(s.id,isNaN(n)?0:n)},className:t.formControl,label:"Amount",id:"amount",InputProps:{inputComponent:Q.U,inputProps:{allowNegative:!1,prefix:"$",decimalScale:2}}})})]},s.id)})})]})})},at=e=>{const t=(0,h.Z)(t=>(0,v.Z)({root:{},refundCheckbox:{marginLeft:32,marginTop:-16},formLabel:{fontSize:".9rem"},optionsGroup:{display:"flex"},radios:{display:"flex",alignItems:"center",marginBottom:t.spacing(2),cursor:"Edit"===e.mode?"not-allowed":"unset"},paymentTypeLabel:{marginRight:t.spacing(2)}}))();return(0,x.jsxs)("div",{className:t.optionsGroup,children:[(0,x.jsx)(Ae.Z,{row:!0,onChange:t=>{e.onPaymentTypeChanged(t.target.value)},value:e.paymentType,name:"payment-type",children:(0,x.jsxs)("div",{className:t.radios,children:[(0,x.jsx)(ke.Z,{className:t.paymentTypeLabel,children:"Payment Type:"}),(0,x.jsx)(I.Z,{classes:{label:t.formLabel},value:"Check",control:(0,x.jsx)(Oe.Z,{disabled:"Edit"===e.mode,size:"small"}),label:"Check"}),(0,x.jsx)(I.Z,{classes:{label:t.formLabel},value:"Points",control:(0,x.jsx)(Oe.Z,{disabled:"Edit"===e.mode,size:"small"}),label:"Points"})]})}),(0,x.jsx)(I.Z,{disabled:"Edit"===e.mode,className:t.refundCheckbox,control:(0,x.jsx)(D.Z,{checked:e.refund,onChange:t=>{e.onRefundChanged(t.currentTarget.checked)}}),label:"Refund"})]})};var ot=n(82460),st=n(20068),rt=n(94721);var it=n(81316),lt=n(34489),dt=n(9150);var ct=n(11150);var ut=n(64097),pt=n(94070);var mt=n(47191);const ht=e=>{const t=(0,h.Z)(e=>(0,v.Z)({root:{},visibilityLabel:{display:"inline-block"},visibilityGroup:{display:"inline-block",marginLeft:e.spacing(2)},radioRoot:{padding:3}}))();return(0,x.jsxs)("div",{children:[(0,x.jsx)(ke.Z,{className:t.visibilityLabel,children:"Visibility:"}),(0,x.jsxs)(Ae.Z,{className:t.visibilityGroup,row:!0,name:"visibility",onChange:t=>{e.onChange(t.currentTarget.value)},value:e.value,children:[(0,x.jsx)(I.Z,{label:"Members",value:"Members",control:(0,x.jsx)(Oe.Z,{classes:{root:t.radioRoot}})}),(0,x.jsx)(I.Z,{label:"Sponsors",value:"Sponsors",control:(0,x.jsx)(Oe.Z,{classes:{root:t.radioRoot}})}),(0,x.jsx)(I.Z,{label:"Both",value:"Both",control:(0,x.jsx)(Oe.Z,{classes:{root:t.radioRoot}})}),(0,x.jsx)(I.Z,{label:"None",value:"None",control:(0,x.jsx)(Oe.Z,{classes:{root:t.radioRoot}})})]})]})},vt=e=>{const t=(0,h.Z)(e=>(0,v.Z)({root:{},mainLabel:{display:"inline-block"},group:{display:"inline-block",marginLeft:e.spacing(2)},radioRoot:{padding:3}}))();return(0,x.jsxs)("div",{children:[(0,x.jsx)(ke.Z,{className:t.mainLabel,children:"Sign-Up Status:"}),(0,x.jsxs)(Ae.Z,{className:t.group,row:!0,name:"status",onChange:t=>{e.onChange(t.currentTarget.value)},value:e.value,children:[(0,x.jsx)(I.Z,{label:"Open",value:"Open",control:(0,x.jsx)(Oe.Z,{classes:{root:t.radioRoot}})}),(0,x.jsx)(I.Z,{label:"Sold Out",value:"SoldOut",control:(0,x.jsx)(Oe.Z,{classes:{root:t.radioRoot}})}),(0,x.jsx)(I.Z,{label:"Coming Soon",value:"ComingSoon",control:(0,x.jsx)(Oe.Z,{classes:{root:t.radioRoot}})})]})]})},gt=e=>{var t,n,a,o,s,r,i,d,c,u,m,g,y,j,C,Z,w,S,N,E,I;const D=(0,h.Z)(e=>(0,v.Z)({root:{},formGrid:{display:"grid",gridTemplateColumns:"1fr 1fr",gridGap:e.spacing(1)},error:{color:e.palette.error.main,marginLeft:e.spacing(2)},formLabel:{fontSize:".9rem"}})),T=P.Ry().shape({eventName:P.Z_().required("Event name is required"),location:P.Z_().required("Location is required"),displayDate:P.Z_().required("Date (for web) is required"),startDate:P.hT().when("isPastEvent",{is:!0,then:e=>e.required("Start date is required"),otherwise:e=>e.min(new Date,"Start date must be in the future").required("Start date is required")}),endDate:P.hT().min(P.iH("startDate"),"End date cannot be before start date").required("End date is required"),description:P.Z_().when("isPastEvent",{is:!0,then:e=>e,otherwise:e=>e.required("Event description is required")}),costPerPersonDollars:P.Rx().nullable(),costPerPersonPoints:P.Rx().nullable(),eventType:P.Ry().nullable().required("Event type is required")}),A=e.eventTypes.map(e=>({label:e.name,value:e.id})),O=e=>{const t=e.errors.eventType,n=Boolean(t)&&(e.touched.eventType||!1);return(0,x.jsxs)("div",{style:{gridColumn:"1 / 3"},children:[(0,x.jsx)(f.Z,{onBlur:e.handleBlur,onChange:(t,n)=>e.setFieldValue("eventType",n),getOptionLabel:e=>"string"===typeof e.label?e.label:e.label.label,options:A,value:e.values.eventType,renderInput:e=>(0,x.jsx)(b.Z,(0,l.Z)((0,l.Z)({},e),{},{label:"Event Type",placeholder:"Event Type",variant:"outlined",name:"eventType",error:n,margin:"dense"}))}),n?(0,x.jsx)(k.Z,{className:q.error,children:t}):void 0]})},R=t=>{const n=t.errors.costPerPersonPoints,a=Boolean(n)&&(t.touched.costPerPersonPoints||!1),o=t.errors.costPerPersonDollars,s=Boolean(o)&&(t.touched.costPerPersonDollars||!1);return(0,x.jsx)("div",{style:{gridColumn:"1 / 3"},children:(0,x.jsx)(Ge,{onChange:e=>{t.setFieldValue("costPerPersonDollars",e.dollars),t.setFieldValue("costPerPersonPoints",e.points)},allowNegative:!1,dollarsPerPoint:e.eventCostPerPoint,dollarValue:t.values.costPerPersonDollars,pointValue:t.values.costPerPersonPoints,showDollarsError:s,showPointsError:a,pointsError:n,dollarsError:o,dollarLabel:"Cost Per Person (dollars)",pointLabel:"Cost Per Person (points)"})})},M=e=>{if(De().isDate(e))return De()(e).startOf("day").toDate()},F=e=>{var t,n;const a=e.errors.startDate,o=Boolean(a)&&(e.touched.startDate||!1),s=e.errors.endDate,r=Boolean(s)&&(e.touched.endDate||!1);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)("div",{children:[(0,x.jsx)(Fe.M,{inputFormat:"MM/dd/yyyy",disabled:e.isSubmitting,label:"Start Date",onCh
1ange:t=>{const n=M(t);e.setFieldValue("startDate",n)},value:null!==(t=e.values.startDate)&&void 0!==t?t:null,renderInput:t=>(0,x.jsx)(b.Z,(0,l.Z)((0,l.Z)({},t),{},{id:"startDate",name:"startDate",margin:"dense",fullWidth:!0,onBlur:e.handleBlur,error:Boolean(e.errors.startDate&&e.touched.startDate)}))}),o?(0,x.jsx)(k.Z,{className:q.error,children:a}):void 0]}),(0,x.jsxs)("div",{children:[(0,x.jsx)(Fe.M,{inputFormat:"MM/dd/yyyy",disabled:e.isSubmitting,label:"End Date",onChange:t=>{const n=M(t);e.setFieldValue("endDate",n)},value:null!==(n=e.values.endDate)&&void 0!==n?n:null,renderInput:t=>(0,x.jsx)(b.Z,(0,l.Z)((0,l.Z)({},t),{},{id:"endDate",name:"endDate",margin:"dense",fullWidth:!0,onBlur:e.handleBlur,error:Boolean(e.errors.endDate&&e.touched.endDate)}))}),r?(0,x.jsx)(k.Z,{className:q.error,children:s}):void 0]})]})},B=e=>(0,x.jsx)(p.gN,{style:{gridColumn:"1 / 3"},variant:"outlined",label:"Event Name",margin:"dense",component:Re.f,fullWidth:!0,disabled:e.isSubmitting,name:"eventName"}),L=e=>(0,x.jsx)(p.gN,{style:{gridColumn:"1 / 3"},variant:"outlined",label:"Description",margin:"dense",multiline:!0,rows:3,component:Re.f,fullWidth:!0,disabled:e.isSubmitting,name:"description",InputProps:{style:{lineHeight:1.4}}}),z=e=>(0,x.jsx)(p.gN,{style:{gridColumn:"1 / 3"},variant:"outlined",label:"Location",margin:"dense",component:Re.f,fullWidth:!0,disabled:e.isSubmitting,name:"location"}),U=e=>(0,x.jsx)(p.gN,{style:{gridColumn:"1 / 3"},variant:"outlined",label:"Date (for web)",margin:"dense",component:Re.f,fullWidth:!0,disabled:e.isSubmitting,name:"displayDate"}),G=e=>(0,x.jsx)(p.gN,{style:{gridColumn:"1 / 3"},variant:"outlined",label:"Notes",margin:"dense",multiline:!0,rows:4,component:Re.f,fullWidth:!0,disabled:e.isSubmitting,name:"notes"}),V=e=>(0,x.jsx)("div",{style:{gridColumn:"1 / 2"},children:(0,x.jsx)(ht,{value:e.values.visibility,onChange:t=>e.setFieldValue("visibility",t)})}),W=e=>(0,x.jsx)("div",{style:{gridColumn:"2 / 3"},children:(0,x.jsx)(vt,{value:e.values.signUpStatus,onChange:t=>e.setFieldValue("signUpStatus",t)})}),q=D();return(0,x.jsx)("div",{className:q.root,children:(0,x.jsx)(p.J9,{validationSchema:T,render:t=>(0,x.jsxs)(p.l0,{children:[(0,x.jsx)(mt.N,{isValid:t.isValid,submitCount:t.submitCount,errors:t.errors}),(0,x.jsxs)(Me._,{dateAdapter:Be.H,children:[(0,x.jsxs)("div",{className:q.formGrid,children:[B(t),L(t),O(t),z(t),F(t),U(t),R(t),V(t),W(t),G(t)]}),(0,x.jsx)(Le.Z,{disabled:t.isSubmitting,onClick:()=>{t.handleSubmit()},children:"Save"}),(0,x.jsx)(Le.Z,{disabled:t.isSubmitting,onClick:()=>e.handleClose(),children:"Cancel"})]})]}),onSubmit:async(t,n)=>{e.event?e.saveExistingEvent({costPerPersonDollars:t.costPerPersonDollars,description:t.description,displayDate:t.displayDate,endD
1ate:t.endDate,startDate:t.startDate,eventTypeId:t.eventType.value,id:e.event.id,location:t.location,name:t.eventName,notes:t.notes,visibility:t.visibility,signUpStatus:t.signUpStatus}):e.saveNewEvent({costPerPersonDollars:t.costPerPersonDollars,description:t.description,name:t.eventName,displayDate:t.displayDate,endDate:t.endDate,startDate:t.startDate,eventTypeId:t.eventType.value,location:t.location,notes:t.notes,visibility:t.visibility,signUpStatus:t.signUpStatus})},initialValues:{eventName:null!==(t=null===(n=e.event)||void 0===n?void 0:n.name)&&void 0!==t?t:"",isPastEvent:null!==(a=null===(o=e.event)||void 0===o?void 0:o.isPastEvent)&&void 0!==a&&a,description:null!==(s=null===(r=e.event)||void 0===r?void 0:r.description)&&void 0!==s?s:"",eventType:e.event?A.find(t=>t.value===e.event.eventTypeId):null,location:null!==(i=null===(d=e.event)||void 0===d?void 0:d.location)&&void 0!==i?i:"",startDate:null!==(c=null===(u=e.event)||void 0===u?void 0:u.startDate)&&void 0!==c?c:void 0,endDate:null!==(m=null===(g=e.event)||void 0===g?void 0:g.endDate)&&void 0!==m?m:void 0,displayDate:null!==(y=null===(j=e.event)||void 0===j?void 0:j.displayDate)&&void 0!==y?y:"",notes:null!==(C=null===(Z=e.event)||void 0===Z?void 0:Z.notes)&&void 0!==C?C:"",costPerPersonDollars:null===(w=e.event)||void 0===w?void 0:w.costPerPersonDollars,costPerPersonPoints:e.event&&e.event.costPerPersonDollars?e.event.costPerPersonDollars/e.eventCostPerPoint:void 0,visibility:null!==(S=null===(N=e.event)||void 0===N?void 0:N.visibility)&&void 0!==S?S:"Both",signUpStatus:null!==(E=null===(I=e.event)||void 0===I?void 0:I.signUpStatus)&&void 0!==E?E:"Open"}})})};var yt=n(42721);var bt=n(697);var ft=n(6227),xt=n(37066);const jt="manual";var Ct=n(50478);const Zt=(0,h.Z)(e=>(0,v.Z)({root:{},autoComplete:{minWidth:"30rem"},checkboxes:{marginTop:e.spacing(2)},content:{display:"grid",gridTemplateColumns:"auto 1fr",gridGap:e.spacing(2)},label:{textAlign:"right",fontWeight:"bold"},note:{fontSize:"0.9rem",color:e.palette.grey[500]},errorMessage:{marginBottom:e.spacing(2)}}));var wt=n(32686),St=n(79159);const Nt=e=>{const t=(0,h.Z)(e=>(0,v.Z)({root:{},error:{color:"red"},userNameState:{display:"flex",alignItems:"center",gridColumn:"2 / 4"},notValidOrTaken:{color:"red"},available:{color:"green"},checking:{color:"darkyellow"},accountInfoHeader:{marginBottom:e.spacing(2)},formControl:{margin:e.spacing(1)},signatureFieldsNote:{color:"gray",transform:"translateY(20px)"}}))(),n=e.userNameErrorInfo,a=()=>{switch(e.userNameState){case"Available":return"This user name is available!";case"Checking":return"Checking to see if this user name is available";case"Unknown":case"Locked":return"";case"NotValid":return"This isn't a valid user name";case"Taken":return"This user name is already taken. Please choose another."}};return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(N.Z,{className:t.accountInfoHeader,component:"p",color:"primary",variant:"caption",children:"Account Information"}),(0,x.jsxs)(E.ZP,{container:!0,alignItems:"center",spacing:1,children:[(0,x.jsx)(E.ZP,{item:!0,xs:6,sm:3,children:(0,x.jsx)(p.gN,{name:"firstName",label:"First Name",margin:"dense",fullWidth:!0,variant:"outlined",component:Re.f})}),(0,x.jsx)(E.ZP,{item:!0,xs:6,sm:3,children:(0,x.jsx)(p.gN,{name:"lastName",label:"Last Name",fullWidth:!0,margin:"dense",variant:"outlined",component:Re.f})}),(0,x.jsx)(E.ZP,{item:!0,xs:12,sm:6,children:(0,x.jsx)(p.gN,{name:"email",label:"Email Address",fullWidth:!0,disabled:e.disabled&&e.isCompanyAdmin,margin:"dense",variant:"outlined",component:Re.f})}),(0,x.jsx)(E.ZP,{item:!0,xs:12,sm:6,children:(0,x.jsxs)(O.Z,{fullWidth:!0,children:[(0,x.jsx)(b.Z,{label:"User Name",margin:"dense",variant:"outlined",disabled:e.disabled,error:n.showError,onChange:t=>{e.onUserNameChanged(t.target.value)},name:"userName",value:e.userName}),n.showError?(0,x.jsxs)(k.Z,{className:t.error,children:["\xa0\xa0",n.error]}):void 0]})}),(0,x.jsx)(E.ZP,{item:!0,xs:12,sm:6,children:(0,x.jsx)("div",{className:(0,q.Z)(t.userNameState,{[t.available]:"Available"===e.userNameState,[t.notValidOrTaken]:"NotValid"===e.userNameState||"Taken"===e.userNameState,[t.checking]:"Checking"===e.userNameState}),children:a()})}),"Administrator"===e.mode&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(E.ZP,{item:!0,xs:12,children:(0,x.jsx)(N.Z,{component:"div",className:t.
1signatureFieldsNote,children:'The fields below will be used in email signatures if this user is set as the "from" user for an email.'})}),(0,x.jsx)(E.ZP,{item:!0,xs:12,sm:6,children:(0,x.jsx)(T.z,{label:"Phone Number",onChange:t=>e.onPhoneNumberChanged(t.target.value),value:e.phoneNumber,type:"tel",error:!1,fullWidth:!0,required:!0})}),(0,x.jsx)(E.ZP,{item:!0,xs:12,sm:6,children:(0,x.jsx)(p.gN,{name:"jobTitle",label:"Job Title",fullWidth:!0,margin:"dense",variant:"outlined",component:Re.f})})]})]})]})};var Pt=n(45142);const Et=e=>{const t=(0,h.Z)(e=>(0,v.Z)({root:{},header:{margin:e.spacing(2,0)},tooltip:{fontSize:12,fontWeight:"normal",backgroundColor:e.palette.primary.main},note:{color:"red",fontWeight:"bold",margin:e.spacing(1,0)}})),n=t=>{const n="hasGeneralAdminRole"===t||e.getFieldValue(t);return(0,x.jsx)(st.Z,{classes:{tooltip:a.tooltip},title:Pt.YA[t],children:(0,x.jsx)(I.Z,{control:(0,x.jsx)(D.Z,{checked:n,disabled:"hasGeneralAdminRole"===t,onChange:n=>e.setFieldValue(t,n.target.checked)}),label:Pt.Hm[t]})})},a=t();return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(N.Z,{className:a.header,component:"p",color:"primary",variant:"caption",children:"Administrator Permissions"}),"Update"===e.mode&&(0,x.jsx)("div",{className:a.note,children:"Note: Changes here will not take effect until the next time the user logs in."}),(0,x.jsx)("div",{children:(0,x.jsxs)(x.Fragment,{children:[n("hasGeneralAdminRole"),n("hasCatalogOrderManagerRole"),n("hasCompanyUserAccountManagerRole"),n("hasImpersonatorRole"),n("hasMonthlyReportEditorRole"),n("hasSettingsManagerRole"),n("hasTransactionCreatorRole"),n("hasEventAdminRole"),n("hasHomePageManagerRole"),n("hasSysAdminRole")]})})]})};var It=n(13400),Dt=n(27247);const Tt=e=>{const t=(0,h.Z)(e=>(0,v.Z)({root:{},formControl:{},error:{color:"red"},addButton:{marginTop:e.spacing(2)},header:{margin:e.spacing(2,0)},permissionGroup:{[e.breakpoints.down("xs")]:{borderBottom:"1px solid gray",padding:e.spacing(1,0)}}}))(),n=a.useRef(["Member","Sponsor"]),o=(a,o)=>{const s=e.getCompanyError(o),r=((t,n)=>{if(e.userIsBcnAdmin)return;const a=e.permissions.filter((e,t)=>t!==n&&e.company).map(e=>e.company.value);return e.currentUserCompanies.filter(e=>a.indexOf(e.companyId)<0).map(e=>({computedBalance:e.pointBalance,label:"".concat(e.companyName," (").concat(e.companyIdentifier,")"),value:e.companyId,companyType:e.companyType}))})(0,o);return(0,x.jsx)(Y,{label:"Company",searchCompanyTypes:n,optionsFilter:t=>(t=>{const n=e.permissions.filter(e=>null!==e.company).map(e=>e.company.value);return t.filter(e=>n.indexOf(e.value)<0)})(t),errorMessage:s,onBlur:t=>{e.setFieldTouched("permissions.".concat(o,".company"))},errorClassName:t.error,onlyAvailableOptions:r,value:a,currentUserType:e.userIsBcnAdmin?"Admin":"Sponsor",onChange:t=>{e.setFieldValue("permissions.".concat(o,".company"),t),e.setFieldValue("permissions.".concat(o,".role"),null)},className:t.formControl})},s=(n,a)=>{const o=e.getRoleError(a),s=(t=>{const n=e.permissions[t];if(n&&n.company){if("Member"===n.company.companyType)return St.xc.filter(e=>e.value<200);if("Sponsor"===n.company.companyType)return St.xc.filter(e=>e.value>200)}return[]})(a);return console.log("roleOptions",s),(0,x.jsxs)(O.Z,{fullWidth:!0,children:[(0,x.jsx)(f.Z,{value:n,noOptionsText:"Select a company first",loading:!1,onBlur:t=>{e.setFieldTouched("permissions.".concat(a,".role"))},getOptionLabel:e=>"string"===typeof e?e:"string"===typeof e.label?e.label:e.label.label,renderInput:e=>(0,x.jsx)(b.Z,(0,l.Z)((0,l.Z)({},e),{},{variant:"outlined",label:"Role",error:Boolean(o),placeholder:"Select role",style:{margin:0},InputProps:(0,l.Z)({},e.InputProps),margin:"dense"})),onChange:(t,n)=>{e.setFieldValue("permissions.".concat(a,".role"),n)},options:s}),(0,x.jsx)(k.Z,{variant:"standard",className:t.error,children:o})]})};return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(N.Z,{className:t.header,component:"p",color:"primary",variant:"caption",children:"Company Permissions"}),(0,x.jsx)(p.F2,{name:"permissions",render:n=>{let a=n.push,r=n.remove;return(0,x.jsxs)("div",{children:[(0,x.jsxs)("div",{children:[e.permissions.map((e,n)=>((e,n,a)=>(0,x.jsxs)(E.ZP,{className:t.permissionGroup,container:!0,spacing:1,alignItems:"center",children:[(0,x.jsx)(E.ZP,{item:!0,xs:12,sm:6,children:o(e.company,n)}),(0,x.jsx)(E.ZP,{item:!0,xs:11,sm:5,children:s(e.role,n)}),(0,x.jsx)(E.ZP,{item:!0,xs:1,children:(0,x.jsx)(It.Z,{size:"small",onClick:()=>a(n),children:(0,x.jsx)(Dt.Z,{})})})]},n))(e,n,r)),0===e.permissions.length&&(0,x.jsx)("div",{children:"None Found"})]}),(0,x.jsx)(Le.Z,{className:t.addButton,disabled:!e.canAdd,variant:"contained",size:"small",onClick:()=>{a({company:null,role:null})},children:"Add Company"})]})}},"permissions")]})};var At=n(30829),Ot=n(58406);var kt=n(5574),Rt=n(39157),Mt=n(97123),Ft=n(43706),Bt=n(13967),Lt=n(72194),zt=n(815),Ut=n(4386);var Gt=n(33704),Vt=n(55069);var Wt=n(76896);const qt=e=>{const t=a.useRef(null),n=(0,h.Z)(e=>(0,v.Z)({root:{},downloadButton:{marginLeft:e.spacing(1),color:e.palette.primary.main},deleteButton:{marginLeft:e.spacing(1),color:ot.Z[900]},checkbox:{paddingTop:0,paddingBottom:0},checkedListBox:{overflowY:"scroll",border:"1px solid gainsboro",margin:e.spacing(2,0),padding:e.spacing(1)},label:{marginTop:2,marginBottom:2},fileSize:{color:e.palette.text.secondary,fontSize:"0.875rem",marginLeft:e.spacing(1)}}))(),o=e=>{if(!e)return"";const t=["B","KB","MB","GB"];let n=e,a=0;for(;n>=1024&&a<t.length-1;)n/=1024,a++;return"(".concat(n.toFixed(1)," ").concat(t[a],")")};return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("div",{className:n.checkedListBox,children:e.attachments.map(t=>{const a=e.checkedAttachmentIds.includes(t.id);return(0,x.jsx)("div",{children:(0,x.jsx)(I.Z,{classes:{label:n.label},label:(0,x.jsxs)("div",{children:[t.originalFileName," ",(0,x.jsx)("span",{className:n.fileSize,children:o(t.fileSizeBytes)}),(0,x.jsx)(It.Z,{className:n.downloadButton,onClick:()=>(e=>{const t="api/administrator/members/welcomeEmails/attachments/".concat(e,"/download");window.open(t,"_blank")})(t.id),size:"small",children:(0,x.jsx)(Wt.Z,{})}),(0,x.jsx)(It.Z,{className:n.deleteButton,onClick:()=>(async t=>{window.confirm("Are you sure you want to delete this attachment?")&&e.onAttachmentRemoved(t)})(t.id),size:"small",children:(0,x.jsx)(Dt.Z,{})})]}),control:(0,x.jsx)(D.Z,{value:t.id,onChange:e.onAttachmentCheckboxChanged,checked:a,className:n.checkbox})},t.id)})})}),(0,x.jsx)(N.Z,{children:'Click the "Choose File" button below to upload and use a new attachment'}),(0,x.jsx)("div",{children:(0,x.jsx)("input",{ref:t,type:"file",name:"file",onChange:async()=>{const n=t.current.files[0],a=await U.C.admin.files.uploadFile(n),o=await U.C.admin.members.createNewMemberWelcomeAttachment({fileUri:a.uri,originalFileName:a.originalFileName});e.onAttachmentAdded(o),t.current.value=""}})})]})},Ht=e=>{const t=(0,h.Z)(e=>(0,v.Z)({root:{},checkedListBox:{minHeight:400,maxHeight:400,overflowY:"scroll",border:"1px solid gainsboro",margin:e.spacing(2,0),padding:e.spacing(1)},label:{marginTop:2,marginBottom:2},checkbox:{paddingTop:0,paddingBottom:0}}))(),n=t=>{const n=t.currentTarget.value;e.handleContactCheckedChanged(n,t.currentTarget.checked)};return(0,x.jsxs)("div",{children:[e.title&&(0,x.jsx)(N.Z,{color:"primary",component:"div",variant:"caption",children:e.title}),(0,x.jsx)("div",{className:t.checkedListBox,children:e.contacts.map(a=>{const o=e.checkedContactIds.includes(a.id);return(0,x.jsx)("div",{children:(0,x.jsx)(I.Z,{classes:{label:t.label},label:a.altFullName,control:(0,x.jsx)(D.Z,{value:a.id,onChange:n,checked:o,className:t.checkbox})})},a.id)})})]})};var Yt=n(14659);const _t=e=>{const t=(0,h.Z)(e=>(0,v.Z)({root:{transition:e.transitions.create(["opacity"],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),[e.breakpoints.up("sm")]:{maxWidth:600,margin:"0 auto"}},formControl:{[e.breakpoints.up("sm")]:{margin:e.spacing(1)}},disabled:{opacity:.5},submitButton:{marginTop:e.spacing(3)},noVerticalPaddingGrid:{"& .MuiGrid-item":{padding:e.spacing(0,1)}}}))(),n=e.formikProps;return(0,x.jsx)(x.Fragment,{children:(0,x.jsxs)(E.ZP,{container:!0,spacing:2,className:(0,q.Z)(t.root,{[t.disabled]:e.formikProps.isSubmitting}),classes:{"spacing-xs-2":t.noVerticalPaddingGrid},children:[(0,x.jsx)(E.ZP,{item:!0,xs:12,children:(0,x.jsx)(p.gN,{component:Re.f,variant:"outlined",margin:"dense",fullWidth:!0,className:t.formControl,name:"companyName",label:"Company Name"})}),(0,x.jsx)(E.ZP,{item:!0,xs:12,children:(0,x.jsx)(p.gN,{component:Re.f,variant:"outlined",margin:"dense",fullWidth:!0,className:t.formControl,name:"address",label:"Address"})}),(0,x.jsx)(E.ZP,{item:!0,xs:6,children:(0,x.jsx)(p.gN,{component:Re.f,variant:"outlined",margin:"dense",className:t.formControl,style:{marginRight:50},name:"city",fullWidth:!0,label:"City"})}),(0,x.jsx)(E.ZP,{item:!0,xs:2,children:(0,x.jsx)(p.gN,{component:Re.f,variant:"outlined",fullWidth:!0,margin:"dense",className:t.formControl,name:"state",label:"State",inputProps:{maxLength:2}})}),(0,x.jsx)(E.ZP,{item:!0,xs:4,children:(0,x.jsx)(p.gN,{component:Re.f,variant:"outlined",fullWidth:!0,margin:"dense",className:t.formControl,name:"zipCode",label:"Zip"})}),(0,x.jsx)(E.ZP,{item:!0,xs:6,children:(0,x.jsx)(p.gN,{component:Re.f,variant:"outlined",margin:"dense",fullWidth:!0,className:t.formControl,name:"firstName",label:"FirstName"})}),(0,x.jsx)(E.ZP,{item:!0,xs:6,children:(0,x.jsx)(p.gN,{component:Re.f,variant:"outlined",margin:"dense",fullWidth:!0,className:t.formControl,name:"lastName",label:"LastName"})}),(0,x.jsx)(E.ZP,{item:!0,xs:6,children:(0,x.jsx)(p.gN,{component:Re.f,variant:"outlined",margin:"dense",fullWidth:!0,className:t.formControl,name:"emailAddress",label:"Email"})}),(0,x.jsx)(E.ZP,{item:!0,xs:6,children:(0,x.jsx)(T.z,{fullWidth:!0,disabled:n.isSubmitting,onBlur:()=>n.setTouched((0,l.Z)((0,l.Z)({},n.touched),{},{phoneNumber:!0})),className:t.formControl,label:"Phone Number",onChange:e=>{n.setFieldValue("phoneNumber",e.target.value)},value:n.values.phoneNumber,helperText:n.touched.phoneNumber?n.errors.phoneNumber:void 0,error:!0===n.touched.phoneNumber&&void 0!==n.errors.phoneNumber,type:"tel"})}),(0,x.jsx)(E.ZP,{item:!0,xs:12,children:(0,x.jsx)(p.gN,{component:Re.f,variant:"outlined",margin:"dense",fullWidth:!0,multiline:!0,minRows:5,className:t.formControl,name:"notes",label:"Notes"})})]})})},Kt=e=>"Categories"===e.listType?(0,x.jsxs)(pt.Z,{severity:"info",children:[(0,x.jsxs)("div",{children:["To display this category on the supplier profile, enter a number in the ",(0,x.jsx)("strong",{children:"supplierProfileSortOrder"})," field. Categories with smaller numbers will appear first."]}),(0,x.jsx)("br",{}),(0,x.jsxs)("div",{children:["Leave the ",(0,x.jsx)("strong",{children:"supplierProfileSortOrder"})," field blank if you do not want this category to appear on the supplier profile."]})]}):"EventTypes"===e.listType?(0,x.jsx)(pt.Z,{severity:"info",children:"The imageFileName field is used as a backup when no event images exist."}):"Markets"===e.listType?(0,x.jsx)(pt.Z,{severity:"info",children:"Markets with isActive set to false will not appear in the dropdown list when adding a new company."}):"RelationshipTypes"===e.listType?(0,x.jsxs)(pt.Z,{severity:"warning",children:[(0,x.jsx)("div",{children:'The oppositeTypeId field needs to be the value of any existing relationship type (including its own Id for types where the "opposite" is
1itself (e.g. Friend, Spouse)).'}),(0,x.jsx)("br",{}),(0,x.jsx)("div",{children:"If you create a new type, you may have to populate this field with the Id of a type that doesn't make sense temporarily. Once you save it, the new type will have an Id. Then you can edit it and enter the new Id in the oppositeTypeId field."})]}):(0,x.jsx)("div",{}),Qt=e=>{const t=(0,h.Z)(e=>(0,v.Z)({root:{height:"100%",display:"grid",gridTemplateRows:"auto 1fr"},box:{overflowY:"scroll",border:"1px solid gainsboro",padding:e.spacing(1),margin:e.spacing(2,0),height:"100%"},checkbox:{display:"block"},label:{transform:"translateY(2px)",display:"inline-block"},disabled:{opacity:.5,pointerEvents:"none"}}))(),n=(e,t,n)=>t?"".concat(e," (linked)"):n?"".concat(e," (lead exists)"):e;return(0,x.jsxs)("div",{className:t.root,children:[(0,x.jsx)(N.Z,{color:"primary",variant:"caption",children:"Matching Sponsors (".concat(e.sponsors.length,"):")}),(0,x.jsxs)("div",{className:(0,q.Z)(t.box,{[t.disabled]:e.disabled}),children:[0===e.sponsors.length&&(0,x.jsx)(N.Z,{children:"No sponsors found"}),e.sponsors.map(a=>{const o=e.linkedSponsorIds.includes(a.id),s=e.existingLeadSponsorIds.includes(a.id);return(0,x.jsx)(I.Z,{className:t.checkbox,disabled:o||s,classes:{label:t.label},control:(0,x.jsx)(D.Z,{checked:e.checkedSponsorIds.includes(a.id),onChange:t=>{e.onSponsorCheckedChange(a,t.target.checked)}}),label:n(a.name,o,s)})})]})]})},Jt=e=>{const t=(0,h.Z)(e=>(0,v.Z)({root:{display:"grid",gridTemplateRows:"auto 1fr"},disabled:{opacity:.5,pointerEvents:"none"},radioGroup:{padding:e.spacing(0,2),marginTop:e.spacing(2)}}))();return(0,x.jsxs)("div",{className:(0,q.Z)(t.root,{[t.disabled]:e.disabled}),children:[(0,x.jsx)(N.Z,{variant:"caption",color:"primary",children:"Sponsor Search Options"}),(0,x.jsxs)(Ae.Z,{className:t.radioGroup,value:e.selectedFilterType,onChange:t=>e.onFilterTypeChanged(t.target.value),children:[(0,x.jsx)(I.Z,{value:"ByName",control:(0,x.jsx)(Oe.Z,{}),label:"Find Sponsor by Name"}),(0,x.jsx)(b.Z,{variant:"outlined",margin:"dense",value:e.searchText,onChange:t=>e.onSearchTextCHanged(t.target.value),placeholder:"Name or ClubId"}),(0,x.jsx)(I.Z,{value:"ByCategory",control:(0,x.jsx)(Oe.Z,{}),label:"Find Sponsor by Category"}),(0,x.jsx)(L,{hasError:!1,hideLabel:!0,onChanged:t=>e.onSelectedCategoryChanged(t),value:e.selectedCategory,renderOption:e.renderOption})]})]})};var $t=n(81918);const Xt=()=>(0,x.jsxs)("div",{children:[(0,x.jsx)(p.gN,{label:"Company Name",variant:"outlined",margin:"dense",fullWidth:!0,component:Re.f,name:"companyName"}),(0,x.jsx)(p.gN,{variant:"outlined",margin:"dense",fullWidth:!0,component:Re.f,name:"programName",label:"Program Name"}),(0,x.jsx)(p.gN,{variant:"outlined",margin:"dense",fullWidth:!0,component:Re.f,name:"address1",label:"Address"}),(0,x.jsx)(p.gN,{variant:"outlined",margin:"dense",fullWidth:!0,component:Re.f,name:"city",label:"City"}),(0,x.jsx)(p.gN,{variant:"outlined",margin:"dense",fullWidth:!0,component:Re.f,name:"state",label:"State"}),(0,x.jsx)(p.gN,{variant:"outlined",margin:"dense",fullWidth:!0,component:Re.f,name:"emailAddress",label:"Bill To Email"}),(0,x.jsx)(p.gN,{variant:"outlined",margin:"dense",fullWidth:!0,component:Re.f,name:"shipToEmail",label:"Ship To Email"}),(0,x.jsx)(p.gN,{variant:"outlined",margin:"dense",fullWidth:!0,component:Re.f,name:"phoneNumber",label:"Bill To Phone"})]}),en=()=>(0,x.jsxs)("div",{children:[(0,x.jsx)(p.gN,{label:"Company Name",variant:"outlined",margin:"dense",fullWidth:!0,component:Re.f,name:"companyName"}),(0,x.jsx)(p.gN,{variant:"outlined",margin:"dense",fullWidth:!0,component:Re.f,name:"address1",label:"Address"}),(0,x.jsx)(p.gN,{variant:"outlined",margin:"dense",fullWidth:!0,component:Re.f,name:"city",label:"City"}),(0,x.jsx)(p.gN,{variant:"outlined",margin:"dense",fullWidth:!0,component:Re.f,name:"state",label:"State"}),(0,x.jsx)(p.gN,{variant:"outlined",margin:"dense",fullWidth:!0,component:Re.f,name:"zip",label:"Zip Code"}),(0,x.jsx)(p.gN,{variant:"outlined",margin:"dense",fullWidth:!0,component:Re.f,name:"phoneNumber",label:"Phone #"}),(0,x.jsx)(p.gN,{variant:"outlined",margin:"dense",fullWidth:!0,component:Re.f,name:"emailAddress",label:"Email"})]}),tn=e=>{const t=(0,h.Z)(e=>(0,v.Z)({root:{}}))(),n="".concat(e.label,"-select");return(0,x.jsx)("div",{className:t.root,children:(0,x.jsxs)(O.Z,{fullWidth:!0,variant:"outlined",margin:"dense",children:[(0,x.jsx)(At.Z,{htmlFor:n,children:e.label}),(0,x.jsxs)(Ot.Z,{inputProps:{name:n},label:e.label,value:e.value,onChange:t=>{e.onChange(t.target.value)},children:[(0,x.jsx)(te.Z,{value:"Company",children:"Company"}),(0,x.jsx)(te.Z,{value:"MarketingFund",children:"Marketing Fund"}),(0,x.jsx)(te.Z,{value:"None",children:"N/A"})]})]})})};var nn;const an={NewMemberUploadModal:e=>{const t=a.useRef(null),n=a.useState("NotUploaded"),o=(0,r.Z)(n,2),s=o[0],i=o[1],l=a.useState(!1),d=(0,r.Z)(l,2),c=d[0],u=d[1],p=a.useState(!1),m=(0,r.Z)(p,2),g=m[0],y=m[1],b=a.useState(""),f=(0,r.Z)(b,2),j=f[0],Z=f[1],w=a.useState(),S=(0,r.Z)(w,2),P=S[0],E=S[1],I=(0,h.Z)(e=>(0,v.Z)({root:{},success:{color:"green",marginTop:e.spacing(4)},link:{color:"blue",cursor:"pointer",border:0,background:"none",padding:0,font:"inherit"},disabledLink:{color:"gray",textDecoration:"none",pointerEvents:"none"},note:{color:e.palette.grey[500]},error:{color:e.palette.error[500],marginTop:e.spacing(2),transform:"translateY(20px)",whiteSpace:"pre-line",maxHeight:300,overflowY:"scroll"},warning:{color:ot.Z[500]},errors:{"& textarea":{maxHeight:200,fontFamily:"monospace",fontSize:"12pt",overflowY:"scroll !important"}}}))(),D=(0,dt.s0)(),T=async()=>{u(!0);try{await U.C.admin.sponsors.downloadNewMemberTemplate(),u(!1)}catch(e){u(!1)}};return(0,x.jsx)(C.D,{disableSaveButton:"Uploaded"!==s,handleClose:async()=>{P&&await U.C.admin.sponsors.deleteMemberUpload(P),e.handleClose()},saveButtonCaption:"OK",handleSave:async()=>{await U.C.admin.sponsors.validateMemberUpload(P),e.handleClose(),D("".concat(lt.H.app.admin.companyDetails,"/").concat(e.sponsorId,"/member-uploads")),e.saveCallback&&e.saveCallback()},title:"Upload Member List",children:(0,x.jsxs)("div",{className:I.root,children:[(0,x.jsxs)(N.Z,{children:[(0,x.jsx)("button",{type:"button",className:(0,q.Z)(I.link,{[I.disabledLink]:c}),onClick:()=>window.setTimeout(T,100),children:"Click here"}),", to download a template. Fill it out, then click the button below to select your spreadsheet."]}),(0,x.jsx)("div",{children:(0,x.jsx)("input",{ref:t,type:"file",name:"file",onChange:async()=>{const n=t.current.files[0];y(!0);try{const t=await U.C.admin.sponsors.uploadMemberListSpreadhseet(n,e.sponsorId,P);E(t.data.memberUploadId),Z(""),i("Uploaded")}catch(a){"string"===typeof a&&Z(a),i("InvalidUpload")}finally{t.current.value="",y(!1)}}})}),g&&(0,x.jsx)(N.Z,{children:"Uploading..."}),"Uploaded"===s&&(0,x.jsx)("div",{children:(0,x.jsx)(N.Z,{className:I.success,children:"The system recognizes the spreadsheet you uploaded and is ready to start scanning it for data quality issues. Click 'OK' to continue."})}),"InvalidUpload"===s&&(0,x.jsx)("div",{children:(0,x.jsx)(N.Z,{className:I.error,children:j})})]})})},AddCompanyCategory:se,UpdateCompanyCategory:fe,AddCompanyProduct:ye,AddCompanyBrand:S,AddCompanyNote:ce,UpdateCompanyNote:je,AddCompanyContact:B,AddEditEventPayerPaymentModal:e=>{var t,n,o,i,l,d,c,u,p,m,g,y;const b=(0,h.Z)(e=>(0,v.Z)({root:{width:800},invoiceHeader:{margin:e.spacing(2,0),fontWeight:"bold",background:e.palette.primary.main,color:"white",padding:4,borderRadius:4,fontSize:"12pt"},error:{color:e.palette.error.main}})),f=a.useCallback(()=>
1{if(!e.payment)return{};const t={};return e.payment.appliedInvoiceAmounts.forEach(e=>{console.log({appliedInvoiceAmount:e}),t[e.eventPayerInvoiceId]=e.amountApplied}),t},[e.payment]),j=a.useState(null!==(t=null===(n=e.payment)||void 0===n?void 0:n.paymentType)&&void 0!==t?t:"Check"),Z=(0,r.Z)(j,2),w=Z[0],S=Z[1],N=a.useState(null!==(o=null===(i=e.payment)||void 0===i?void 0:i.notes)&&void 0!==o?o:""),P=(0,r.Z)(N,2),E=P[0],I=P[1],D=a.useState(null!==(l=null===(d=e.payment)||void 0===d?void 0:d.refund)&&void 0!==l&&l),T=(0,r.Z)(D,2),A=T[0],O=T[1],k=a.useState(""),R=(0,r.Z)(k,2),M=R[0],F=R[1],B=a.useState(""),L=(0,r.Z)(B,2),z=L[0],U=L[1],G=a.useState(null!==(c=null===(u=e.payment)||void 0===u?void 0:u.date)&&void 0!==c?c:new Date),V=(0,r.Z)(G,2),W=V[0],q=V[1],H=a.useState(null!==(p=null===(m=e.payment)||void 0===m?void 0:m.checkNumber)&&void 0!==p?p:""),Y=(0,r.Z)(H,2),_=Y[0],K=Y[1],Q=a.useState(""),J=(0,r.Z)(Q,2),$=J[0],X=J[1],ee=a.useState(null!==(g=null===(y=e.payment)||void 0===y?void 0:y.amount)&&void 0!==g?g:0),te=(0,r.Z)(ee,2),ne=te[0],ae=te[1],oe=a.useState(""),se=(0,r.Z)(oe,2),re=se[0],ie=se[1],le=a.useState(f()),de=(0,r.Z)(le,2),ce=de[0],ue=de[1],pe=a.useState(!1),me=(0,r.Z)(pe,2),he=me[0],ve=me[1],ge=a.useState(!1),ye=(0,r.Z)(ge,2),be=ye[0],fe=ye[1],xe=a.useState(),je=(0,r.Z)(xe,2),Ze=je[0],we=je[1],Se=a.useState((()=>{if("Edit"===e.mode&&"Points"===e.payment.paymentType){var t;const n=null===(t=e.payment)||void 0===t?void 0:t.points;if(void 0===n)throw Error("Unable to get existing point payment value");return n}if(e.pointBalance&&e.pointBalance>0)return e.pointBalance})()),Ne=(0,r.Z)(Se,2),Pe=Ne[0],Ee=Ne[1],Ie=a.useState((()=>{if("Edit"===e.mode){var t;const n=null===(t=e.payment)||void 0===t?void 0:t.amount;if(void 0===n)throw Error("Unable to get existing dollar payment value");return n}if(e.pointBalance&&e.pointBalance>0)return e.pointBalance*e.costPerPoint})()),De=(0,r.Z)(Ie,2),Te=De[0],Ae=De[1],Oe=a.useState(new Date),ke=(0,r.Z)(Oe,2),Re=ke[0],Me=ke[1],Fe=a.useState(void 0),Be=(0,r.Z)(Fe,2),Le=Be[0],ze=Be[1],Ue=a.useState(void 0),Ge=(0,r.Z)(Ue,2),Ve=Ge[0],We=Ge[1],He=a.useState(void 0),_e=(0,r.Z)(He,2),Qe=_e[0],Je=_e[1];a.useEffect(()=>{_.length>0&&X("")},[_]),a.useEffect(()=>{if("Points"===w){const e=f();ue(e)}},[w,f]);const $e=t=>{if(!A||!t)return F(""),{passed:!0};if(t>e.maximumRefundDollarAmount){const t="Cannot exceed ".concat((0,Ce.lb)(e.maximumRefundDollarAmount));return F(t),{passed:!1,errorMessage:t}}return F(""),{passed:!0}},Xe=()=>Object.keys(ce).map(e=>({invoiceId:e,amount:ce[e]})),et=async()=>{if(ve(!0),"Points"===w){ot()&&await(async()=>{const t=e.eventPayerId;if(!$e(Te).passed)return;const n=Xe();if(e.payment)e.updatePayment({payment:{amount:Te,points:Pe,notes:E,checkNumber:"",date:Re,paymentType:w,eventPayerId:t,refund:A,id:e.payment.id},invoiceAmounts:n});else{const a={payment:{amount:Te,points:Pe,checkNumber:"",notes:E,date:Re,paymentType:w,eventPayerId:t,refund:A},invoiceAmounts:n};e.addPayment(a)}e.handleClose()})()}else{tt()&&await(async()=>{const t=e.eventPayerId;if(!$e(ne).passed)return;const n=Xe();if(e.payment)e.updatePayment({payment:{amount:ne,checkNumber:_,refund:A,notes:E,date:W,eventPayerId:t,paymentType:w,id:e.payment.id},invoiceAmounts:n});else{const a={payment:{amount:ne,checkNumber:_,date:W,paymentType:w,eventPayerId:t,notes:E,refund:A},invoiceAmounts:n};e.addPayment(a)}e.handleClose()})()}},tt=()=>{let t=!1;0===ne&&(ie("Required"),t=!0);const n=$e(ne);n.passed?ie(""):(ie(n.errorMessage),t=!0),0===_.length?(X("Required"),t=!0):X("");const a=Object.keys(ce).reduce((e,t)=>{var n;return e+(null!==(n=ce[t])&&void 0!==n?n:0)},0),o=e.existingInvoices.filter(e=>!e.void&&!e.isPaidInFull);return!A&&o.length>0&&ne!==a?(U("You must apply the total amount to all invoices"),t=!0):U(""),!t},ot=()=>{let e=!1;if(Re?Je(void 0):(Je("This is required"),e=!0),void 0===Te)We("This is required"),e=!0;else if(0===Te)We("Amount must be greater than zero"),e=!0;else{const t=$e(Te);t.passed?We(void 0):(We(t.errorMessage),e=!0),We(void 0)}return void 0===Pe?(ze("This is required"),e=!0):0===Pe?(ze("Points must be greater than zero"),e=!0):ze(void 0),!e},st=t=>{if(be)return void console.warn("Invoices have been touched");if(!t)return;const n=(t=>{if("Points"===w)return;const n=e.existingInvoices.filter(e=>!e.void&&!e.isPaidInFull);if(0===n.length)return;const a=n.find(e=>e.amount===t);return a||n.filter(e=>!e.void).reduce((e,t)=>
1e&&e.amount>t.amount?t:e)})(t);if(n){let e=Object.assign({},ce,{[n.id]:null!==t&&void 0!==t?t:0});Ze&&Ze.id!==n.id&&(e=Object.assign(e,ce,{[Ze.id]:void 0})),ue(e),we(n)}},rt=b();return(0,x.jsx)(s.Qj,{render:()=>(0,x.jsx)("div",{className:rt.root,children:(0,x.jsx)(C.D,{title:"Edit"===e.mode?"Edit Event Group Payment":"Add Event Group Payment",handleSave:et,handleClose:e.handleClose,children:(0,x.jsxs)("div",{children:[(0,x.jsx)(qe,{balanceDueDollars:e.balanceDueDollars,accountInfo:e.accountInfo,mode:e.mode}),M&&(0,x.jsx)("div",{className:rt.error,children:M}),(0,x.jsx)(at,{mode:e.mode,refund:A,onRefundChanged:O,onPaymentTypeChanged:S,paymentType:w}),"Check"===w&&(0,x.jsx)(Ye,{amount:ne,onAmountChanged:e=>{ae(e),st(e)},amountError:re,date:W,onDateChanged:q,checkNumber:_,onCheckNumberChanged:K,checkNumberError:$,touched:he}),"Points"===w&&(0,x.jsx)(Ke,{costPerPoint:e.costPerPoint,notes:E,setNotes:I,points:Pe,pointsError:Le,onPointsChanged:e=>{Ee(e)},dollars:Te,dollarsError:Ve,onDollarsChanged:e=>{Ae(e),st(e)},date:Re,onDateChanged:Me,dateError:Qe,touched:he}),"Points"===w?null:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("div",{className:rt.invoiceHeader,children:"Apply Payment to Invoices:"}),z&&(0,x.jsx)("div",{style:{fontWeight:"bold",margin:"20px 0"},className:rt.error,children:z}),(0,x.jsx)(nt,{isRefund:A,appliedAmounts:ce,originalAppliedAmounts:f(),activeInvoices:e.existingInvoices.filter(e=>!e.void),onInvoiceAmountPaidChanged:(e,t)=>{var n;const a=null!==(n=ce[e])&&void 0!==n?n:0;if(a===t||isNaN(a)||isNaN(t))return;const o=Object.assign({},ce,{[e]:t});fe(!0),ue(o)}})]})]})})})})},AddEditMonthlyReportPaymentModal:e=>{var t,n;const o=a.useState(null!==(t=null===(n=e.payment)||void 0===n?void 0:n.paymentType)&&void 0!==t?t:"Check"),i=(0,r.Z)(o,2),l=i[0],d=i[1],c=(0,h.Z)(t=>(0,v.Z)({subForm:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridGap:t.spacing(2),alignItems:"center"},fullWidth:{gridColumn:"1 / 5"},formLabel:{fontSize:".9rem"},radios:{display:"flex",alignItems:"center",marginBottom:t.spacing(2),cursor:e.payment?"not-allowed":"unset"},paymentTypeLabel:{marginRight:t.spacing(2)},subtitle:{color:t.palette.primary.main}})),u=async(t,n,a)=>{e.handleClose();const o=e.monthlyReportId;e.payment?e.updatePayment({amount:t,checkNumber:n,date:a,paymentType:l,monthlyReportId:o,id:e.payment.id}):e.addPayment({amount:t,checkNumber:n,date:a,paymentType:l,monthlyReportId:o})},p=async(t,n,a)=>{e.handleClose();const o=e.monthlyReportId;e.payment?e.updatePayment({amount:n,points:t,checkNumber:"",date:a,monthlyReportId:o,paymentType:l,id:e.payment.id}):e.addPayment({amount:n,points:t,checkNumber:"",date:a,monthlyReportId:o,paymentType:l})},m=e=>{d(e.target.value)},g=c();return(0,x.jsx)(s.Qj,{render:()=>(0,x.jsx)(C.D,{hideDoneButton:!0,handleClose:e.handleClose,title:e.payment?"Edit Monthly Report Payment":"Add Monthly Report Payment",children:(0,x.jsxs)("div",{children:[(0,x.jsx)("div",{className:g.subtitle,children:"from ".concat(e.companyInfo.name," (").concat(e.companyInfo.identifier,")")}),(0,x.jsx)("div",{className:g.subtitle,children:"Point Balance: ".concat((0,Ce.uf)(e.companyInfo.computedBalance))}),void 0!==e.balanceDueDollars?(0,x.jsx)("div",{className:g.subtitle,children:"Balance Due: ".concat((0,Ce.lb)(e.balanceDueDollars))}):void 0,(0,x.jsx)(Ae.Z,{row:!0,onChange:m,value:l,name:"payment-type",children:(0,x.jsxs)("div",{className:g.radios,children:[(0,x.jsx)(ke.Z,{className:g.paymentTypeLabel,children:"Payment Type:"}),(0,x.jsx)(I.Z,{classes:{label:g.formLabel},value:"Check",control:(0,x.jsx)(Oe.Z,{disabled:void 0!==e.payment,size:"small"}),label:"Check"}),(0,x.jsx)(I.Z,{classes:{label:g.formLabel},value:"Points",control:(0,x.jsx)(Oe.Z,{disabled:void 0!==e.payment,size:"small"}),label:"Points"})]})}),"Check"===l&&(0,x.jsx)(Ue,{payment:e.payment,onSave:u,onCancel:e.handleClose}),"Points"===l&&(0,x.jsx)(We,{costPerPoint:e.costPerPoint,pointBalance:e.companyInfo.computedBalance,payment:e.payment,onSave:p,onCancel:e.handleClose,mode:e.mode})]})})})},AddEditAttachment:e=>{const t=a.useRef(null),n=a.useState([]),o=(0,r.Z)(n,2),i=o[0],l=o[1],d=a.useState("All"),c=(0,r.Z)(d,2),u=c[0],p=c[1],m=a.useState(!1),y=(0,r.Z)(m,2),b=y[0],f=y[1],j=a.useState([]),Z=(0,r.Z)(j,2),w=Z[0],S=Z[1],N=(0,h.Z)(e=>(0,v.Z)({root:{position:"relative",display:"grid",gridTemplateColumns:"1fr",gridColumnGap:e.spacing(2),gridRowGap:e.spacing(3)},title:{display:"inline-block"},controls:{display:"grid",gridTemplateColumns:"auto 1fr auto 2fr"},formLabel:{fontSize:".9rem"},radiosHost:{margin:e.spacing(0,2),transform:"translateY(-10px)"},marketsHost:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)"},errors:{color:ot.Z[500]}}));a.useEffect(()=>{g.n.ensureMarketsFetched()},[]);const P=()=>{b&&E()},E=()=>{const e=[];return t.current.files&&0!==t.current.files.length||e.push("Please select a file"),u||e.push("Please select who you'd like the attachment to go to"),0===w.length&&e.push("Please select at least one market"),l(e),f(!0),0===e.length},T=()=>{if(E()){const n={id:"_"+Math.random().toString(36).substr(2,9),markets:w,file:t.current.files[0],audience:u};e.handleAddAttachment(n),e.handleClose()}},A=e=>{e.target.checked?S([...w,e.target.value]):S(w.filter(t=>t!==e.target.value))},O=()=>{const e=g.n.getEnum("markets").map(e=>(0,x.jsx)(st.Z,{title:e.description,children:(0,x.jsx)(I.Z,{classes:{label:R.formLabel},value:e.code,control:(0,x.jsx)(D.Z,{value:e.code,checked:w.indexOf(e.code)>=0,onChange:A,size:"small"}),label:e.code})},e.code));return(0,x.jsx)("div",{className:R.marketsHost,children:e})};a.useEffect(()=>{b&&E()},[u,b]);const k=e=>{p(e.target.value)},R=N(),M=()=>
1{if(i.length>0)return(0,x.jsx)("div",{className:R.errors,children:i.map((e,t)=>(0,x.jsx)("div",{children:e},t))})},F=()=>{const e=g.n.getEnum("markets").map(e=>e.code);S(e)};return(0,x.jsx)(s.Qj,{render:()=>(0,x.jsx)(C.D,{handleSave:T,handleClose:e.handleClose,title:"Add Attachment",children:(0,x.jsxs)("div",{className:R.root,children:[M(),(0,x.jsx)("div",{children:(0,x.jsx)("input",{ref:t,type:"file",name:"file",onChange:P})}),(0,x.jsx)(rt.Z,{}),(0,x.jsxs)("div",{className:R.controls,children:[(0,x.jsx)("strong",{children:"Send To:"}),(0,x.jsx)("div",{className:R.radiosHost,children:(0,x.jsxs)(Ae.Z,{name:"company-type",value:u,onChange:k,children:[(0,x.jsx)(I.Z,{classes:{label:R.formLabel},value:"ActivitySummary",control:(0,x.jsx)(Oe.Z,{size:"small"}),label:"Activity Summary"}),(0,x.jsx)(I.Z,{classes:{label:R.formLabel},value:"SponsorStatement",control:(0,x.jsx)(Oe.Z,{size:"small"}),label:"Sponsor Statement"}),(0,x.jsx)(I.Z,{classes:{label:R.formLabel},value:"All",control:(0,x.jsx)(Oe.Z,{size:"small"}),label:"All"})]})}),(0,x.jsx)("strong",{children:"Markets:"}),(0,x.jsx)("div",{className:R.radiosHost,children:O()})]}),(0,x.jsx)(Le.Z,{color:"secondary",onClick:F,children:"Select All Markets"})]})})})},CreateMonthlyReportModal:e=>{const t=a.useState("Manual"),n=(0,r.Z)(t,2),s=n[0],i=n[1],l=a.useRef(null),d=a.useState(!1),c=(0,r.Z)(d,2),u=c[0],p=c[1],m=a.useState(!1),g=(0,r.Z)(m,2),y=g[0],b=g[1],f=a.useState(void 0),j=(0,r.Z)(f,2),Z=j[0],w=j[1],S=(0,dt.s0)(),P=(0,h.Z)(e=>(0,v.Z)({root:{},instructions:{marginBottom:e.spacing(2)},error:{color:ot.Z[500]},errorHost:{marginBottom:e.spacing(2)},uploadInstructions:{margin:"0 0 1em 0",fontSize:"smaller"},link:{color:"blue",cursor:"pointer",border:0,background:"none",padding:0,font:"inherit"},uploadInfoHost:{marginLeft:30},disabled:{opacity:.2,pointerEvents:"none"},disabledLink:{color:"gray",textDecoration:"none",pointerEvents:"none"}}));const E=P(),D=async()=>{b(!0);try{if(await o.i.getMyInfo(),!o.i.currentCompany&&!e.sponsorId)throw Error("Unable to determine companyId");const t=o.i.currentCompany?o.i.currentCompany.companyId:e.sponsorId;0===(await U.C.shared.monthlyReports.getNewMonthlyReportData(t)).data.rates.length?alert(it.J):await U.C.shared.monthlyReports.downloadTemplate(t),b(!1)}catch(t){b(!1)}};return(0,x.jsx)(C.D,{disableSaveButton:u,handleClose:e.handleClose,saveButtonCaption:"OK",handleSave:async()=>{"Upload"===s?(async()=>{if(e.sponsorId)if(l.current.files&&0!==l.current.files.length){const n=l.current.files[0];p(!0);try{const t=await U.C.shared.monthlyReports.uploadSpreadsheet(n,e.sponsorId);p(!1),function(e){return void 0!==e.report}(t)?(e.onMonthlyReportCreated(t.report.id),e.handleClose()):(e.onValidationErrorsReceived(t),e.handleClose())}catch(t){const e=t;e.response&&w(e.response.data),p(!1)}}else alert("Please select a file");else alert("No sponsorId")})():((async()=>{"sponsor"===e.audience?S("".concat(lt.H.app.sponsors.root,"/newMonthlyReport")):S("".concat(lt.H.app.admin.companyDetails,"/").concat(e.sponsorId,"/newMonthlyReport"))})(),e.handleClose())},title:"New Report",children:(0,x.jsxs)("div",{children:[(0,x.jsx)(N.Z,{children:"How would you like to start your report?"}),(0,x.jsxs)(Ae.Z,{onChange:e=>{i(e.currentTarget.value)},value:s,children:[(0,x.jsx)(I.Z,{label:"Manually enter the values",value:"Manual",control:(0,x.jsx)(Oe.Z,{})}),(0,x.jsx)(I.Z,{label:"Upload a spreadsheet",value:"Upload",control:(0,x.jsx)(Oe.Z,{})}),(0,x.jsxs)("div",{className:(0,q.Z)(E.uploadInfoHost,{[E.disabled]:"Upload"!==s}),children:[(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(N.Z,{className:E.uploadInstructions,children:[(0,x.jsx)("button",{type:"button",onClick:()=>window.setTimeout(D,100),className:(0,q.Z)(E.link,{[E.disabledLink]:y}),children:"Click here"}),", to download a template. Fill it out, then click the button below to select your spreadsheet and click the ",(0,x.jsx)("strong",{children:"Upload"})," button."]}),(0,x.jsxs)(N.Z,{className:E.uploadInstructions,children:[(0,x.jsx)("strong",{children:"Note:"}),"\xa0The template now includes a second worksheet containing a list of all active members. If a member is missing from your report, you can add them by copying and pasting from this worksheet."]})]}),Z?(0,x.jsxs)("div",{className:E.errorHost,children:[(0,x.jsx)(N.Z,{className:E.error,children:"Your spreadsheet could not be uploaded because of the following issues:"}),(0,x.jsx)(N.Z,{className:E.error,children:Z})]}):void 0,(0,x.jsx)("div",{children:(0,x.jsx)("input",{ref:l,type:"file",name:"file"})})]})]})]})})},ConfirmCancelOrderModal:e=>{const t=(0,a.useState)("NoAction"),n=(0,r.Z)(t,2),o=n[0],s=n[1],i=(0,h.Z)(e=>(0,v.Z)({root:{},instructions:{marginBottom:e.spacing(2)},error:{color:ot.Z[500]},errorHost:{marginBottom:e.spacing(2)},formLabel:{fontSize:".9rem"}})),l=e=>{s(e.target.value)},d=i();return(0,x.jsx)(C.D,{handleClose:e.handleClose,handleSave:()=>{e.onConfirmCancellation(o)},title:"Are you sure you want to cancel this order?",children:(0,x.jsxs)(Ae.Z,{name:"company-type",value:o,onChange:l,children:[(0,x.jsx)(I.Z,{classes:{label:d.formLabel},value:"NoAction",control:(0,x.jsx)(Oe.Z,{size:"small"}),label:"Leave the address active"}),(0,x.jsx)(I.Z,{classes:{label:d.formLabel},value:"Deactivate",control:(0,x.jsx)(Oe.Z,{size:"small"}),label:"DEACTIVATE the address when cancelling the order"})]})})},ChangeMyPasswordModal:e=>{const t=a.useState([]),n=(0,r.Z)(t,2),o=n[0],s=n[1],i=a.useState(!1),l=(0,r.Z)(i,2),d=l[0],c=l[1],u=(0,h.Z)(e=>(0,v.Z)({root:{display:"flex",flexDirection:"column"},errors:{color:e.palette.error.main,marginBottom:e.spacing(2)},success:{color:e.palette.success.main,marginBottom:e.spacing(2)}})),m=P.Ry().shape({currentPassword:P.Z_().required("Your current password is required"),newPassword:P.Z_().required("Please enter a new password"),newPasswordConfirmation:P.Z_().oneOf([P.iH("newPassword"),void 0],"Passwords do not match").required("Password confirm is required")}),g=()=>{if(d)return(0,x.jsx)("div",{className:b.success,children:"Your password has been changed!"})},y=()=>
1{if(0!==o.length)return(0,x.jsx)("div",{className:b.errors,children:o.map((e,t)=>(0,x.jsx)("div",{style:{color:"red"},children:e},t))})},b=u();return(0,x.jsx)("div",{className:b.root,children:(0,x.jsx)(p.J9,{initialValues:{currentPassword:"",newPassword:"",newPasswordConfirmation:""},validationSchema:m,onSubmit:async(e,t)=>{s([]);const n=await(0,ct.changePassword)(e.currentPassword,e.newPassword);n.succeeded?(c(!0),window.setTimeout(()=>{},2500)):(t.setSubmitting(!1),s(n.errors.map(e=>e.description)))},render:t=>(0,x.jsx)(p.l0,{children:(0,x.jsxs)(C.D,{handleClose:e.handleClose,title:"Change Password",disableSaveButton:t.isSubmitting,handleSave:()=>t.submitForm(),children:[y(),g(),(0,x.jsx)(p.gN,{name:"currentPassword",variant:"outlined",autoComplete:"new-password",disabled:t.isSubmitting,label:"Current Password",fullWidth:!0,margin:"dense",inputProps:{type:"password"},component:Re.f}),(0,x.jsx)(p.gN,{name:"newPassword",variant:"outlined",disabled:t.isSubmitting,label:"New Password",autoComplete:"new-password",fullWidth:!0,margin:"dense",inputProps:{type:"password"},component:Re.f}),(0,x.jsx)(p.gN,{inputProps:{type:"password"},name:"newPasswordConfirmation",label:"Confirm New Password",disabled:t.isSubmitting,autoComplete:"new-password",fullWidth:!0,margin:"dense",variant:"outlined",component:Re.f})]})})})})},ChangeUserPasswordModal:e=>{const t=a.useState([]),n=(0,r.Z)(t,2),o=n[0],s=n[1],i=a.useState(!1),l=(0,r.Z)(i,2),d=l[0],c=l[1],u=a.useState(!1),m=(0,r.Z)(u,2),g=m[0],y=m[1],b=(0,h.Z)(e=>(0,v.Z)({root:{display:"flex",flexDirection:"column"},errors:{color:e.palette.error.main,marginBottom:e.spacing(2)},success:{color:e.palette.success.main,marginBottom:e.spacing(2)},note:{margin:e.spacing(2,0)}})),f=P.Ry().shape({newPassword:P.Z_().required("Please enter a new password"),newPasswordConfirmation:P.Z_().oneOf([P.iH("newPassword"),void 0],"Passwords do not match").required("Password confirm is required")}),j=()=>{if(d)return(0,x.jsx)("div",{className:w.success,children:"The password has been changed!"})},Z=()=>{if(0!==o.length)return(0,x.jsx)("div",{className:w.errors,children:o.map((e,t)=>(0,x.jsx)("div",{style:{color:"red"},children:e},t))})},w=b(),S="Change ".concat(e.userEmail,"'s Password");return(0,x.jsx)("div",{className:w.root,children:(0,x.jsx)(p.J9,{initialValues:{newPassword:"",newPasswordConfirmation:""},validationSchema:f,onSubmit:async(t,n)=>{s([]);try{const a=await(0,ut.changeUsersPassword)(t.newPassword,e.userId);a.succeeded?(c(!0),y(!0),window.setTimeout(()=>{},2500)):(n.setSubmitting(!1),s(a.errors.map(e=>e.description)))}finally{n.setSubmitting(!1)}},render:t=>(0,x.jsx)(p.l0,{children:(0,x.jsxs)(C.D,{handleClose:e.handleClose,title:S,disableSaveButton:t.isSubmitting,handleSave:g?void 0:()=>t.submitForm(),children:[Z(),j(),(0,x.jsx)(p.gN,{name:"newPassword",variant:"outlined",disabled:t.isSubmitting,label:"New Password",autoComplete:"new-password",fullWidth:!0,margin:"dense",inputProps:{type:"password"},component:Re.f}),(0,x.jsx)(p.gN,{inputProps:{type:"password"},name:"newPasswordConfirmation",label:"Confirm New Password",disabled:t.isSubmitting,autoComplete:"new-password",fullWidth:!0,margin:"dense",variant:"outlined",component:Re.f}),e.showImpersonationWarning&&(0,x.jsx)(pt.Z,{className:w.note,severity:"info",children:"Note: This is a slightly different popup from the one users will see when they are logged in. Their version will require them to type in their current password."})]})})})})},AddEditEventModal:e=>{a.useEffect(()=>{g.n.ensureEventTypesFetched()},[]);const t=async t=>{const n=await yt.K.saveNewEvent(t);e.handleClose(),n&&e.onEventCreated&&e.onEventCreated(n.id)},n=async t=>{await yt.K.updateEvent(t),e.handleClose()};return(0,x.jsx)(s.Qj,{render:()=>0===g.n.getEnum("eventTypes").length?(0,x.jsx)("div",{}):(0,x.jsx)(C.D,{handleClose:e.handleClose,hideDoneButton:!0,title:"Add"===e.mode?"Create Event":"Edit Event",children:(0,x.jsx)(gt,{event:e.event,eventCostPerPoint:e.eventCostPerPoint,eventTypes:g.n.getEnum("eventTypes"),handleClose:e.handleClose,saveNewEvent:t,saveExistingEvent:n})})})},AddEditEventAttachmentModal:e=>{var t,n;const o=!!e.attachment&&("Both"===e.attachment.visibility||"Sponsors"===e.attachment.visibility),i=!!e.attachment&&("Both"===e.attachment.visibility||"Members"===e.attachment.visibility),l=a.useRef(null),d=a.useState(!1),c=(0,r.Z)(d,2),u=c[0],p=c[1],m=a.useState(null!==(t=null===(n=e.attachment)||void 0===n?void 0:n.name)&&void 0!==t?t:""),g=(0,r.Z)(m,2),y=g[0],f=g[1],j=a.useState(o),Z=(0,r.Z)(j,2),w=Z[0],S=Z[1],P=a.useState(i),T=(0,r.Z)(P,2),A=T[0],O=T[1],
1k=a.useState(!1),R=(0,r.Z)(k,2),M=R[0],F=R[1],B=(0,h.Z)(e=>(0,v.Z)({root:{},instructions:{marginBottom:e.spacing(2)},formLabel:{fontSize:".9rem"},visibilityLabel:{display:"inline-block",transform:"translateY(2px)"},visibilityGroup:{display:"inline-block",marginLeft:e.spacing(2)},visibility:{marginTop:6,fontWeight:"bold",marginRight:10,marginLeft:20}}))(),L=()=>{p(!0)},z=async()=>{if(W()){F(!0);try{e.attachment?await U():await G(),e.handleClose()}finally{F(!1)}}},U=async()=>{const t=V();await yt.K.updateAttachment({eventId:yt.K.selectedEventDetails.id,id:e.attachment.id,name:y,visibility:t})},G=async()=>{const e=l.current.files[0],t=V();await yt.K.addAttachment(yt.K.selectedEventDetails.id,e,y,t)},V=()=>w&&!A?"Sponsors":A&&!w?"Members":w&&A?"Both":"None",W=()=>e.attachment||u?y.length<0?(alert("Please enter a name"),!1):!(!w&&!A)||(alert("Please specify which company type the attachment is visible to"),!1):(alert("Please select a file"),!1),q=e.attachment?"Edit Attachment":"Add Attachment";return(0,x.jsx)(s.Qj,{render:()=>(0,x.jsxs)(C.D,{handleSave:z,disableSaveButton:M,handleClose:e.handleClose,title:q,children:[!e.attachment&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(N.Z,{className:B.instructions,children:'Click the "Choose File" button below to find the attachment to upload. Then click "Add Attachment".'}),(0,x.jsx)(bt.Z,{mt:2,children:(0,x.jsx)("input",{ref:l,type:"file",name:"file",onChange:L})})]}),e.attachment&&(0,x.jsxs)("div",{children:[(0,x.jsx)("strong",{children:"File: "}),e.attachment.originalFileName]}),(0,x.jsxs)(E.ZP,{container:!0,alignItems:"flex-end",children:[(0,x.jsx)(E.ZP,{item:!0,xs:5,children:(0,x.jsx)(bt.Z,{mt:2,children:(0,x.jsx)(b.Z,{fullWidth:!0,variant:"outlined",label:"Button Caption",placeholder:"Button Caption (30 characters or less)",value:y,margin:"dense",onChange:e=>f(e.target.value),inputProps:{maxLength:30}})})}),(0,x.jsx)(E.ZP,{item:!0,xs:7,children:(0,x.jsxs)(bt.Z,{display:"flex",flexDirection:"row",mb:1,children:[(0,x.jsx)(N.Z,{className:B.visibility,variant:"subtitle1",gutterBottom:!0,children:"Visibility:"}),(0,x.jsxs)(bt.Z,{display:"flex",flexDirection:"row",mb:1,children:[(0,x.jsx)(I.Z,{control:(0,x.jsx)(D.Z,{checked:A,onChange:e=>O(e.target.checked),size:"small"}),label:"Members"}),(0,x.jsx)(I.Z,{control:(0,x.jsx)(D.Z,{checked:w,onChange:e=>S(e.target.checked),size:"small"}),label:"Sponsors",style:{marginLeft:8}})]})]})})]})]})})},AddEditEventAdjustmentModal:e=>{const t=(0,h.Z)(e=>(0,v.Z)({root:{},formControl:{margin:e.spacing(1)},form:{display:"grid",gridGap:e.spacing(1),gridTemplateColumns:"1fr 1fr"},error:{color:e.palette.error.main,marginLeft:e.spacing(2)}}))(),n=P.Ry().shape({name:P.Z_().required("Name is required"),amountDollars:P.Rx().required("Amount is required").notOneOf([0],"Amount cannot be zero"),amountPoints:P.Rx().required("Amount is required").notOneOf([0],"Amount cannot be zero"),showOnSignUpForm:P.O7(),deductFromMarketingFund:P.O7(),signUpFormGroupName:P.Z_().max(100)}),a=async(t,n)=>{e.handleClose();const a={name:t.name,amountDollars:t.amountDollars,deductFromMarketingFund:t.deductFromMarketingFund,eventId:yt.K.selectedEventDetails.id,showOnSignUpForm:t.showOnSignUpForm,type:e.type,signUpFormGroupName:t.
1signUpFormGroupName};e.eventAdjustment?await yt.K.updateEventAdjustment((0,l.Z)((0,l.Z)({},a),{},{eventAdjustmentId:e.eventAdjustment.id})):await yt.K.addEventAdjustment(a)};return(0,x.jsx)(s.Qj,{render:()=>{var o,s,r,i,l,d,c,u,m;return(0,x.jsx)("div",{className:t.root,children:(0,x.jsx)(p.J9,{validationSchema:n,onSubmit:a,initialValues:{name:null!==(o=null===(s=e.eventAdjustment)||void 0===s?void 0:s.name)&&void 0!==o?o:"",amountDollars:null===(r=e.eventAdjustment)||void 0===r?void 0:r.amountDollars,amountPoints:e.eventAdjustment?e.eventAdjustment.amountDollars/e.eventCostPerPoint:void 0,showOnSignUpForm:null!==(i=null===(l=e.eventAdjustment)||void 0===l?void 0:l.showOnSignUpForm)&&void 0!==i&&i,deductFromMarketingFund:null!==(d=null===(c=e.eventAdjustment)||void 0===c?void 0:c.deductFromMarketingFund)&&void 0!==d&&d,signUpFormGroupName:null!==(u=null===(m=e.eventAdjustment)||void 0===m?void 0:m.signUpFormGroupName)&&void 0!==u?u:""},render:n=>{const a=n.errors.amountPoints,o=Boolean(a)&&(n.touched.amountPoints||!1),s=n.errors.amountDollars,r=Boolean(s)&&(n.touched.amountDollars||!1),i="DiscountUpgrade"===e.type?"Add Discount/Upgrade":"Add Event Option";return(0,x.jsx)(C.D,{handleClose:e.handleClose,handleSave:()=>n.handleSubmit(),saveButtonCaption:e.eventAdjustment?"Update":"Add",title:i,children:(0,x.jsxs)("form",{className:t.form,onSubmit:n.handleSubmit,children:[(0,x.jsx)(p.gN,{component:Re.f,variant:"outlined",margin:"dense",className:t.formControl,name:"name",label:"Name"}),(0,x.jsx)(Ge,{allowNegative:!0,pointsError:a,showPointsError:o,dollarsError:s,showDollarsError:r,dollarsPerPoint:e.eventCostPerPoint,onChange:e=>{n.setFieldValue("amountPoints",e.points),n.setFieldValue("amountDollars",e.dollars)},pointValue:n.values.amountPoints,dollarValue:n.values.amountDollars}),"Option"===e.type&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(p.gN,{component:Re.f,variant:"outlined",margin:"dense",className:t.formControl,name:"signUpFormGroupName",id:"signUpFormGroupName",label:"Group Name (optional)"}),(0,x.jsx)(O.Z,{style:{paddingLeft:10},children:(0,x.jsx)(I.Z,{label:"Show On Sign-Up Form",control:(0,x.jsx)(D.Z,{checked:n.values.showOnSignUpForm,onChange:e=>n.setFieldValue("showOnSignUpForm",e.target.checked),id:"showOnSignUpForm",name:"showOnSignUpForm"})})})]}),"DiscountUpgrade"===e.type&&e.isGrandDestination&&(0,x.jsx)(O.Z,{style:{paddingLeft:10},children:(0,x.jsx)(I.Z,{label:"Deduct from Marketing Fund",control:(0,x.jsx)(D.Z,{checked:n.values.deductFromMarketingFund,onChange:e=>n.setFieldValue("deductFromMarketingFund",e.target.checked),id:"deductFromMarketingFund",name:"deductFromMarketingFund"})})})]})})}})})}})},AddEditEventPayerAdjustmentModal:e=>{const t=a.useState(!1),n=(0,r.Z)(t,2),o=n[0],i=n[1],d=a.useState([]),c=(0,r.Z)(d,2),u=c[0],m=c[1],g=(0,h.Z)(e=>(0,v.Z)({formControl:{margin:e.spacing(1)},form:{maxWidth:"600px",margin:"0 auto",display:"grid",gridGap:e.spacing(1),gridTemplateColumns:"repeat(12, 1fr)"},memoField:{gridColumn:"1 / span 12"},dropdownField:{gridColumn:"1 / span 9"},quantityField:{gridColumn:"10 / span 3"},amountPointsField:{gridColumn:"7 / span 6"},amountDollarsField:{gridColumn:"1 / span 6"},manualAdjustmentsInput:{gridColumn:"1 / span 12"},error:{color:e.palette.error.main,marginLeft:e.spacing(2)}})),y=e.eventId;a.useEffect(()=>{(async()=>{i(!0);const t=await U.C.admin.events.getEventAdjustments(y);m(t.filter(t=>t.type===e.type)),i(!1)})()},[y,e.type]);const j=g(),Z=P.Ry().shape({eventAdjustment:P.Ry().nullable().required("Discount/Upgrade is required"),quantity:P.Rx().min(1).required("Quanity is required")}),w=async(t,n)=>{const a=t.eventAdjustment.value===jt?void 0:t.eventAdjustment.value;e.eventPayerAdjustment?await yt.K.updateEventPayerAdjustment({eventAdjustmentId:a,eventPayerAdjustmentId:e.eventPayerAdjustment.id,quantity:t.quantity,memo:t.memo,manualDollarAdjustment:t.manualDollarValue}):await yt.K.addEventPayerAdjustment({eventAdjustmentId:a,eventPayerId:e.eventPayerId,quantity:t.quantity,memo:t.memo,manualDollarAdjustment:t.manualDollarValue}),e.handleClose()},S=e=>{var t;if((null===(t=e.values.eventAdjustment)||void 0===t?void 0:t.value)===jt)return(0,x.jsx)("div",{className:j.manualAdjustmentsInput,children:(0,x.jsx)(Ge,{pointValue:e.values.manualPointValue,allowNegative:!0,dollarValue:e.values.manualDollarValue,showDollarsError:Boolean(e.errors.manualDollarValue),showPointsError:Boolean(e.errors.manualPointValue),pointsError:e.errors.manualPointValue,dollarsError:e.errors.manualDollarValue,dollarsPerPoint:xt.P.eventCostPerPoint,onChange:t=>{e.setFieldValue("manualDollarValue",t.dollars),e.setFieldValue("manualPointValue",t.points),t.points&&e.setFieldError("manualPointValue","")}})});const n=N(e);return(0,x.jsx)("div",{className:j.manualAdjustmentsInput,children:(0,x.jsx)(Ge,{pointValue:n.points,allowNegative:!0,disabled:!0,dollarValue:n.dollars,showDollarsError:!1,showPointsError:!1,pointsError:"",dollarsError:"",dollarsPerPoint:xt.P.eventCostPerPoint,onChange:e=>{}})})},N=e=>{var t;const n=u.find(t=>{var n;return t.id===(null===(n=e.values.eventAdjustment)||void 0===n?void 0:n.value)}),a=null!==(t=null===n||void 0===n?void 0:n.amountDollars)&&void 0!==t?t:e.values.manualDollarValue;return{totalDollars:a?a*e.values.quantity:void 0,totalPoints:a?xt.P.convertEventDollarsToPoints(a*e.values.quantity):void 0,dollars:null===n||void 0===n?void 0:n.amountDollars,points:n?xt.P.convertEventDollarsToPoints(n.amountDollars):void 0}},E=e=>{const t=N(e);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)("div",{className:j.amountDollarsField,children:[(0,x.jsx)("strong",{children:"Total Dollars:"}),"\xa0",(0,Ce.lb)(t.totalDollars)]}),(0,x.jsxs)("div",{className:j.amountPointsField,children:[(0,x.jsx)("strong",{children:"Total Points:"}),"\xa0",(0,Ce.uf)(t.totalPoints)]})]})},I=e=>(0,x.jsx)(p.gN,{className:j.quantityField,variant:"outlined",margin:"dense",component:Re.f,label:"Quantity",name:"quantity",disabled:e.isSubmitting,type:"number"}),D=e=>(0,x.jsx)(p.gN,{className:j.memoField,variant:"outlined",multiline:!0,rows:3,margin:"dense",component:Re.f,label:"Memo",name:"memo",disabled:e.isSubmitting}),T=(t,n)=>{const a=t.errors.eventAdjustment,o=Boolean(a)&&(t.touched.eventAdjustment||!1);return(0,x.jsxs)("div",{className:j.dropdownField,children:[(0,x.jsx)(f.Z,{onBlur:t.handleBlur,onChange:(e,n)=>t.setFieldValue("eventAdjustment",n),options:n,value:t.values.eventAdjustment,renderInput:t=>(0,x.jsx)(b.Z,(0,l.Z)((0,l.Z)({},t),{},{label:"DiscountUpgrade"===e.type?"Discount/Upgrade":"Event Option",placeholder:"Event Discount/Upgrade",variant:"outlined",name:"eventType",error:o,margin:"dense"})),getOptionLabel:e=>"string"===typeof e.label?e.label:e.label.label}),o?(0,x.jsx)(k.Z,{className:j.error,children:a}):void 0]})};if(o)return(0,x.jsx)(ft.a,{message:"Loading"});const A=u.sort((e,t)=>
1e.name.localeCompare(t.name)).map(e=>({label:e.deductFromMarketingFund?"".concat(e.name,"** -- ").concat((0,Ce.lb)(e.amountDollars)):"".concat(e.name," -- ").concat((0,Ce.lb)(e.amountDollars)),value:e.id}));"DiscountUpgrade"===e.type&&A.unshift({label:"-- Manual Adjustment --",value:jt});const O=()=>{if(e.eventPayerAdjustment){const t=e.eventPayerAdjustment.eventAdjustmentId;return A.find(e=>e.value===(null!==t&&void 0!==t?t:jt))}return null};return(0,x.jsx)(s.Qj,{render:()=>{var t,n,a,o;return void 0===xt.P.eventCostPerPoint?(0,x.jsx)("div",{}):(0,x.jsx)("div",{children:(0,x.jsx)(p.J9,{validationSchema:Z,onSubmit:w,initialValues:{eventAdjustment:O(),quantity:(null===(t=e.eventPayerAdjustment)||void 0===t?void 0:t.quantity)||1,memo:(null===(n=e.eventPayerAdjustment)||void 0===n?void 0:n.memo)||"",manualDollarValue:null===(a=e.eventPayerAdjustment)||void 0===a?void 0:a.amountDollars,manualPointValue:xt.P.convertEventDollarsToPoints(null===(o=e.eventPayerAdjustment)||void 0===o?void 0:o.amountDollars)},render:t=>(0,x.jsx)(C.D,{handleSave:t.handleSubmit,disableSaveButton:t.isSubmitting,handleClose:e.handleClose,title:"DiscountUpgrade"===e.type?"Add Discount/Upgrade":"Add Event Option",children:(0,x.jsxs)("form",{className:j.form,onSubmit:t.handleSubmit,children:[T(t,A),I(t),S(t),E(t),D(t)]})})})})}})},CreateEventGroupModal:e=>{const t=a.useState(""),n=(0,r.Z)(t,2),o=n[0],i=n[1],l=a.useState(),d=(0,r.Z)(l,2),c=d[0],u=d[1],p=a.useState(void 0),m=(0,r.Z)(p,2),h=m[0],v=m[1],g=Zt();a.useEffect(()=>{i(""),u(void 0)},[h]);const y=a.useRef(["Sponsor"]),b=a.useRef(["Member"]),f=a.useRef(["Member","Sponsor"]),j=()=>{switch(e.eventVisibility){case"Members":return b;case"Sponsors":return y;default:return f}},Z=(0,dt.s0)();return(0,x.jsx)(s.Qj,{render:()=>(0,x.jsxs)(C.D,{title:"Create Event Group",saveButtonCaption:c?"Go To Existing Event Group":"Save",handleSave:()=>{c?(()=>{const t=c,n=t.eventId,a=t.companyId,o="".concat(lt.H.app.admin.root,"/events/").concat(n,"/companies/").concat(a);Z(o),e.handleClose()})():(async()=>{h||alert("Please select a company");const t=await yt.K.signUpCompany(e.eventId,h.value);if("string"===typeof t){i(t);const n=e.existingEventGroups.find(e=>e.companyId===h.value&&"Cancelled"!==e.eventGroupStatus);u(n)}else e.navigateToEventGroup(t.companyId),e.handleClose()})()},handleClose:e.handleClose,children:[o?(0,x.jsx)(pt.Z,{className:g.errorMessage,severity:"error",children:o}):void 0,(0,x.jsx)(Ct.e,{userType:"Admin",label:"Search companies",companyTypes:j(),selectedOption:h,onSelectedOptionChanged:v})]})})},ConfirmRemoveAttendeeModal:e=>{const t=a.useState(!1),n=(0,r.Z)(t,2),o=n[0],s=n[1],i=a.useState("MakeAnonymousAttendee"),l=(0,r.Z)(i,2),d=l[0],c=l[1],u=e=>{c(e.target.value)};return(0,x.jsx)(C.D,{handleSave:async()=>{if("DoNothing"!==d){const t=e.attendeeId,n=e.eventGroupId;s(!0),await yt.K.deleteAttendee(n,t,d),s(!1)}e.handleClose()},saveButtonCaption:"Ok",disableSaveButton:o,handleClose:e.handleClose,title:"Remove Attendee?",children:(0,x.jsxs)(Ae.Z,{name:"company-type",value:d,onChange:u,children:[(0,x.jsx)(I.Z,{value:"MakeAnonymousAttendee",control:(0,x.jsx)(Oe.Z,{size:"small"}),label:"Yes, and make an anonymous attendee"}),(0,x.jsx)(I.Z,{value:"JustDelete",control:(0,x.jsx)(Oe.Z,{size:"small"}),label:"Yes, and don't do anything else--just delete them"}),(0,x.jsx)(I.Z,{value:"DoNothing",control:(0,x.jsx)(Oe.Z,{size:"small"}),label:"No, don't delete this attendee"})]})})},CreateInvoiceModal:e=>{var t;const n=a.useState(e.currentBalanceDue-e.outstandingInvoiceAmount),o=(0,r.Z)(n,2),s=o[0],i=o[1],d=a.useState(""),c=(0,r.Z)(d,2),u=c[0],p=c[1],m=a.useState(De()(new Date).add(30,"days").toDate()),g=(0,r.Z)(m,2),y=g[0],f=g[1],j=a.useState(!1),Z=(0,r.Z)(j,2),w=Z[0],S=Z[1],N=a.useState(!1),P=(0,r.Z)(N,2),E=P[0],T=P[1],A=(0,h.Z)(e=>(0,v.Z)({root:{minWidth:"400px"},textField:{minWidth:"400px"},radios:{marginLeft:e.spacing(2)},radioHeader:{fontWeight:"bold",marginBottom:"1em"},datePicker:{marginLeft:e.spacing(2),transform:"translateY(8px)"},checkbox:{transform:"translate(13px, 15px)"}}))();return(0,x.jsx)(C.D,{handleClose:e.handleClose,handleSave:async()=>
1{if(!w&&!y)return void alert("Please enter a due date or check 'Due on Receipt'");T(!0);const t=await yt.K.addInvoice({amount:s,message:u,eventPayerId:e.eventPayerId,dateDue:null!==y&&void 0!==y?y:void 0});T(!1),t&&e.onInvoiceCreated(t.id),e.handleClose()},disableSaveButton:E,title:"Create Invoice",children:(0,x.jsxs)(Me._,{dateAdapter:Be.H,children:[(0,x.jsxs)("div",{children:[(0,x.jsx)(O.Z,{children:(0,x.jsx)(b.Z,{fullWidth:!0,variant:"outlined",value:null!==(t=(0,Ce.uf)(s,2))&&void 0!==t?t:"",label:"Invoice Amount (Dollars)",onChange:e=>{const t=e.target.value.replace("$",""),n=parseFloat(t);i(n)},margin:"dense",InputProps:{inputComponent:Q.U,inputProps:{allowNegative:!1,prefix:"$",decimalScale:2}}})}),(0,x.jsx)(O.Z,{className:A.datePicker,children:(0,x.jsx)(Fe.M,{disabled:w,inputFormat:"MM/dd/yyyy",label:"Due Date",value:y,onChange:e=>f(e),renderInput:e=>(0,x.jsx)(b.Z,(0,l.Z)((0,l.Z)({},e),{},{style:{margin:0},margin:"dense",variant:"outlined"}))})}),(0,x.jsx)(I.Z,{className:A.checkbox,control:(0,x.jsx)(D.Z,{checked:w,onChange:e=>{S(e.target.checked),f(new Date)}}),label:"Due on Receipt"})]}),(0,x.jsx)("div",{children:(0,x.jsx)(b.Z,{style:{width:"100%"},className:A.textField,value:u,variant:"outlined",margin:"dense",label:"Invoice Message",onChange:e=>{p(e.currentTarget.value)},multiline:!0,minRows:4})})]})})},AddEditUserModal:e=>{if(!e.userIsBcnAdmin&&"Administrator"===e.mode)throw Error("Invalid prop values.");if("Administrator"===e.mode&&!e.user&&!e.adminCreatedCallback)throw Error("Must provide a value for adminCreatedCallback");if("Administrator"===e.mode&&e.user&&!e.adminUpdatedCallback)throw Error("Must provide a value for adminUpdatedCallback");const t=a.useState(e.user?"Locked":"Unknown"),n=(0,r.Z)(t,2),o=n[0],i=n[1],l=a.useState(""),d=(0,r.Z)(l,2),c=d[0],u=d[1],m=(0,V.Nr)(c,500);a.useEffect(()=>{if(m){(async()=>{if(!m||m.length<5)i("NotValid");else{i("Checking");try{await U.C.admin.users.getUserByUserName(m),i("Taken")}catch(e){404===e.status&&i("Available")}}})()}},[m]);const h=e=>void 0!==e.permissions,v=e=>void 0!==e.hasCatalogOrderManagerRole,g=P.Ry().shape({firstName:P.Z_().required("First name is required"),lastName:P.Z_(),email:P.Z_().email().required("Email address is required"),phoneNumber:P.Z_(),userName:P.Z_().email().required("User name is required"),permissions:P.IX().of(P.Ry().shape({role:P.Ry().shape({label:P.Z_(),value:P.Rx()}).nullable().required("Role is required"),company:P.Ry().shape({computedBalance:P.Rx(),label:P.Z_(),value:P.Z_().required("Company is required"),companyType:P.nK()}).nullable().required("Company is required")})).notRequired()}),y=async(t,n)=>{const a=t.permissions.map(e=>({companyId:e.company.value,roleId:e.role.value}));if(e.user||"CompanyUser"!==e.mode)if(e.user||"Administrator"!==e.mode){if(e.user&&h(e.user)){if("CompanyUser"!==e.mode)throw Error("Invalid mode");Z(e.user.id,t,a)}else if(e.user&&v(e.user)){if("Administrator"!==e.mode)throw Error("Invalid mode");f(e.user.id,t)}}else b(t);else j(t,a)},b=async t=>{const n=Object.assign({},t,{isEnabled:!0,id:"ignored"}),a=await U.C.admin.users.createAdminUserAccount(n);a.data&&e.adminCreatedCallback&&(e.adminCreatedCallback(a.data),e.handleClose())},f=async(t,n)=>{const a=Object.assign({},n,{isEnabled:!0,id:e.user.id}),o=await U.C.admin.users.updateAdminUserAccount(a);o.data&&e.adminUpdatedCallback&&(e.adminUpdatedCallback(o.data),e.handleClose())},j=async(t,n)=>{const a=t.email,o=t.lastName,s={firstName:t.firstName,lastName:o,userName:t.userName,emailAddress:a,permissions:n},r=await wt.S.createUser(s);r&&(e.companyUserCreatedCallback&&e.companyUserCreatedCallback(r.data),e.handleClose())},Z=async(t,n,a)=>{const o={userId:t,firstName:n.firstName,lastName:n.lastName,email:n.email,permissions:a},s=await wt.S.updateUser(o);s&&e.companyUserUpdatedCallback&&e.companyUserUpdatedCallback(s),e.handleClose()},w={phoneNumber:e.user&&v(e.user)?e.user.phoneNumber:"",email:e.user?e.user.email:e.currentContact?e.currentContact.email:"",jobTitle:e.user&&v(e.user)?e.user.jobTitle:"",firstName:e.user?e.user.firstName:e.currentContact?e.currentContact.firstName:"",lastName:e.user?e.user.lastName:e.currentContact?e.currentContact.lastName:"",userName:e.user?e.user.userName:e.currentContact?e.currentContact.email:"",hasCatalogOrderManagerRole:!(!e.user||!v(e.user))&&e.user.hasCatalogOrderManagerRole,hasGeneralAdminRole:!(!e.user||!v(e.user))&&e.user.hasGeneralAdminRole,hasCompanyUserAccountManagerRole:!(!e.user||!v(e.user))&&e.user.hasCompanyUserAccountManagerRole,hasImpersonatorRole:!(!e.user||!v(e.user))&&e.user.hasImpersonatorRole,hasMonthlyReportEditorRole:!(!e.user||!v(e.user))&&e.user.hasMonthlyReportEditorRole,hasSettingsManagerRole:!(!e.user||!v(e.user))&&e.user.hasSettingsManagerRole,hasTransactionCreatorRole:!(!e.user||!v(e.user))&&e.user.hasTransactionCreatorRole,hasEventAdminRole:!(!e.user||!v(e.user))&&e.user.hasEventAdminRole,hasSysAdminRole:!(!e.user||!v(e.user))&&e.user.hasSysAdminRole,hasHomePageManagerRole:!(!e.user||!v(e.user))&&e.user.hasHomePageManagerRole,permissions:e.user&&h(e.user)?(()=>{if(!e.user)throw Error("No user!");if(!h(e.user))throw Error("User is not a company user");return e.user.permissions.map(e=>({company:{computedBalance:e.pointBalance,label:"".concat(e.companyName," (").concat(e.companyIdentifier,")"),value:e.companyId,companyType:e.companyType},role:St.xc.find(t=>t.value===e.roleId)}))})():e.user||"CompanyUser"!==e.mode?[]:[{company:!e.user&&e.currentCompany?{computedBalance:e.currentCompany.computedBalance,label:"".concat(e.currentCompany.name,"
1(").concat(e.currentCompany.identifier,")"),value:e.currentCompany.id,companyType:e.currentCompany.companyType}:null,role:null}]};console.log({initialValues:w});const S=t=>{if("Administrator"===e.mode)return(0,x.jsx)(Et,{mode:e.user?"Update":"Add",getFieldValue:e=>t.values[e],setFieldValue:t.setFieldValue})},N=t=>{if("CompanyUser"!==e.mode)return;const n=t.values.permissions.length<e.currentUserCompanies.length||e.userIsBcnAdmin;return(0,x.jsx)(Tt,{canAdd:n,setFieldValue:t.setFieldValue,setFieldTouched:t.setFieldTouched,getRoleError:e=>D(t,e),getCompanyError:e=>I(t,e),userIsBcnAdmin:e.userIsBcnAdmin,permissions:t.values.permissions,currentUserCompanies:e.currentUserCompanies})},E=t=>{const n=(e=>{const t=e.errors.userName;return{error:t,showError:!0===e.touched.userName&&(void 0!==t||"NotValid"===o||"Taken"===o)}})(t);return console.log({values:t.values}),(0,x.jsx)(Nt,{mode:e.mode,disabled:Boolean(e.user),userName:t.values.userName,phoneNumber:t.values.phoneNumber,userNameState:o,onUserNameChanged:e=>{t.setFieldValue("userName",e),i("Unknown"),u(e)},onPhoneNumberChanged:e=>{t.setFieldValue("phoneNumber",e)},userNameErrorInfo:n,isCompanyAdmin:!1===e.userIsBcnAdmin})},I=(e,t)=>{var n,a;const o=null===(n=e.errors.permissions)||void 0===n?void 0:n[t];return e.touched.permissions&&null!==(a=e.touched.permissions[t])&&void 0!==a&&a.company&&o&&"string"!==typeof o&&"company"in o&&o.company||""},D=(e,t)=>{var n,a;const o=null===(n=e.errors.permissions)||void 0===n?void 0:n[t];return e.touched.permissions&&null!==(a=e.touched.permissions[t])&&void 0!==a&&a.role&&o&&"string"!==typeof o&&"role"in o&&o.role||""};return(0,x.jsx)(s.Qj,{render:()=>(0,x.jsx)("div",{children:(0,x.jsx)(p.J9,{validationSchema:g,onSubmit:y,initialValues:w,render:t=>(0,x.jsx)(C.D,{handleClose:e.handleClose,title:e.user?"Edit Permissions":"Administrator"===e.mode?"Add Administrator":"Add Company User",disableSaveButton:t.isSubmitting,handleSave:()=>t.submitForm(),children:(0,x.jsxs)("div",{children:[E(t),"CompanyUser"===e.mode&&N(t),"Administrator"===e.mode&&S(t)]})})})})})},AddPurchaserSupplier:e=>{const t=a.useState(!1),n=(0,r.Z)(t,2),s=n[0],i=n[1],l=a.useState(),d=(0,r.Z)(l,2),c=d[0],u=d[1],p=a.useState(),m=(0,r.Z)(p,2),g=m[0],b=m[1],f=a.useState(),j=(0,r.Z)(f,2),Z=j[0],w=j[1],S=a.useState(),P=(0,r.Z)(S,2),E=P[0],T=P[1],A=a.useState(""),R=(0,r.Z)(A,2),M=R[0],F=R[1],B=a.useState(!1),G=(0,r.Z)(B,2),V=G[0],W=G[1],q=a.useState(),H=(0,r.Z)(q,2),Y=H[0],_=H[1],K=a.useState(),Q=(0,r.Z)(K,2),J=Q[0],$=Q[1],X=(0,h.Z)(e=>(0,v.Z)({root:{},error:{color:"red"},supplierHost:{display:"grid",gridTemplateColumns:"1fr auto",gridGap:e.spacing(2)},selfLabel:{transform:"translateY(-10px)"}}))(),ee=!o.i.isAdminNotImpersonating&&E?c:void 0;return(0,x.jsxs)(C.D,{handleClose:e.handleClose,handleSave:async()=>{b(void 0);const t=void 0===Z?"Category is required":void 0,n=void 0!==E||0!==M.length||s?void 0:"Company is required";$(t),_(n);const a=s?e.purchaserId:null===E||void 0===E?void 0:E.value;if(void 0===t&&void 0===n)try{await y.R.addPurchaserSupplier(e.purchaserId,Z.value,a,M),e.handleClose()}catch(o){const e=o;"string"===typeof e?b(e):400===e.status&&b(e.data)}},title:"Add Supplier",children:[g?(0,x.jsx)(N.Z,{className:X.error,children:g}):void 0,(0,x.jsxs)("div",{className:X.supplierHost,children:[(0,x.jsxs)(O.Z,{disabled:s,fullWidth:!0,children:[(0,x.jsx)(z.r,{disabled:s,label:"Supplier",existingValue:E,setExistingValue:async e=>{if(u(void 0),w(void 0),T(e),F(""),e){_(void 0),W(!0);const t=(await U.C.members.suppliers.getSupplierCategories(e.value)).map(e=>({value:e.id,label:e.name}));u(t),W(!1),1===t.length&&w(t[0])}},newValue:M,setNewValue:e=>{e&&_(void 0),T(void 0),F(e)},currentUserType:e.currentUserType}),(0,x.jsx)(k.Z,{className:X.error,children:Y})]}),(0,x.jsx)(I.Z,{className:X.selfLabel,control:(0,x.jsx)(D.Z,{checked:s,onChange:e=>{i(e.target.checked),e.target.checked&&T(void 0)}}),label:"Self"})]}),(0,x.jsxs)(O.Z,{fullWidth:!0,children:[(0,x.jsx)(L,{disabled:V,onlyAvailableOptions:ee,hasError:Boolean(J),onChanged:e=>{e&&$(void 0),w(e)},value:Z}),(0,x.jsx)(k.Z,{className:X.error,children:J})]})]})},AddSupplierPurchaser:e=>{const t=a.useState(),n=(0,r.Z)(t,2),o=n[0],s=n[1],i=a.useState(),l=(0,r.Z)(i,2),d=l[0],c=l[1],u=a.useState(null),p=(0,r.Z)(u,2),m=p[0],g=p[1],b=a.useState(),f=(0,r.Z)(b,2),j=f[0],Z=f[1],w=a.useState(),S=(0,r.Z)(w,2),P=S[0],E=S[1],I=a.useState(!1),D=(0,r.Z)(I,2),T=D[0],A=D[1],R=(0,h.Z)(e=>(0,v.Z)({root:{},error:{color:"red"}}))(),M=a.useRef(["Member","Sponsor"]);return(0,x.jsx)(C.D,{handleClose:e.handleClose,title:"Add Member",disableSaveButton:T,handleSave:async()=>{s(void 0);const t=void 0===d?"Category is required":void 0,n=null===m?"Member is required":void 0;if(E(t),Z(n),void 0===t&&void 0===n){A(!0);try{await y.R.addPurchaserSupplier(m.value,d.value,e.supplierId),e.handleClose()}catch(a){const e=a;400===e.status&&(s(e.data),A(!1))}}},children:(0,x.jsxs)("div",{style:{minWidth:400},children:[o?(0,x.jsx)(N.Z,{className:R.error,children:o}):void 0,(0,x.jsxs)(O.Z,{fullWidth:!0,children:[(0,x.jsx)(L,{onChanged:e=>{e&&E(void 0),c(e)},value:d,hasError:Boolean(P)}),(0,x.jsx)(k.Z,{className:R.error,children:P})]}),(0,x.jsx)(O.Z,{fullWidth:!0,children:(0,x.jsx)(Y,{label:"Member",currentUserType:e.currentUserType,searchCompanyTypes:M,errorClassName:R.error,noRecordsText:"No members found",value:m,onChange:e=>{e&&Z(void 0),g(e)},errorMessage:j||""})})]})})},AddEditNewspaperModal:e=>{var t,n,o,s,i,l,d,c,u,p;const m=a.useState(null!==(t=null===(n=e.newspaper)||void 0===n?void 0:n.startMonth)&&void 0!==t?t:(new Date).getMonth()+1),g=(0,r.Z)(m,2),y=g[0],f=g[1],j=a.useState(null!==(o=null===(s=e.newspaper)||void 0===s?void 0:s.startYear)&&void 0!==o?o:(new Date).getFullYear()),Z=(0,r.Z)(j,2),w=Z[0],S=Z[1],N=a.useState(null!==(i=null===(l=e.newspaper)||void 0===l?void 0:l.endMonth)&&void 0!==i?i:(new Date).getMonth()+1),P=(0,r.Z)(N,2),E=P[0],I=P[1],D=a.useState(null!==(d=null===(c=e.newspaper)||void 0===c?void 0:c.endYear)&&void 0!==d?d:(new Date).getFullYear()),T=(0,r.Z)(D,2),A=T[0],k=T[1],R=a.useState(null!==(u=null===(p=e.newspaper)||void 0===p?void 0:p.url)&&void 0!==u?u:""),M=(0,r.Z)(R,2),F=M[0],B=M[1],L=a.useState(""),z=(0,r.Z)(L,2),U=z[0],G=z[1],V=(0,h.Z)(e=>(0,v.Z)({root:{},formControl:{margin:e.spacing(1),minWidth:140},url:{minWidth:700},error:{color:e.palette.error.main,marginBottom:e.spacing(2)}}))(),W=(()=>{const e=[],t=(new Date).getFullYear()+1;for(let n=2013;n<=t;n++)e.push(n);return e})(),H=(e,t,n)=>(0,x.jsxs)(O.Z,{margin:"dense",variant:"outlined",className:V.formControl,children:[(0,x.jsx)(At.Z,{id:"month-label",children:n}),(0,x.jsxs)(Ot.Z,{labelId:"month-label",id:"month-select",value:e,onCh
1ange:e=>t(e.target.value),label:n,children:[(0,x.jsx)(te.Z,{value:"",children:(0,x.jsx)("em",{children:"Select One"})}),(0,x.jsx)(te.Z,{value:1,children:"January"}),(0,x.jsx)(te.Z,{value:2,children:"February"}),(0,x.jsx)(te.Z,{value:3,children:"March"}),(0,x.jsx)(te.Z,{value:4,children:"April"}),(0,x.jsx)(te.Z,{value:5,children:"May"}),(0,x.jsx)(te.Z,{value:6,children:"June"}),(0,x.jsx)(te.Z,{value:7,children:"July"}),(0,x.jsx)(te.Z,{value:8,children:"August"}),(0,x.jsx)(te.Z,{value:9,children:"September"}),(0,x.jsx)(te.Z,{value:10,children:"October"}),(0,x.jsx)(te.Z,{value:11,children:"November"}),(0,x.jsx)(te.Z,{value:12,children:"December"})]})]}),Y=(e,t,n)=>(0,x.jsxs)(O.Z,{margin:"dense",variant:"outlined",className:V.formControl,children:[(0,x.jsx)(At.Z,{id:"year-label",children:n}),(0,x.jsxs)(Ot.Z,{labelId:"year-label",id:"year-select",value:e,onChange:e=>t(e.target.value),label:n,children:[(0,x.jsx)(te.Z,{value:"",children:(0,x.jsx)("em",{children:"Select One"})}),W.map(e=>(0,x.jsx)(te.Z,{value:e,children:e},e))]})]});return(0,x.jsx)(C.D,{handleClose:e.handleClose,handleSave:()=>{0!==F.length?e.newspaper&&e.handleUpdate?e.handleUpdate({id:e.newspaper.id,startMonth:y,startYear:w,endMonth:E,endYear:A,url:F},()=>e.handleClose()):!e.newspaper&&e.handleCreate&&e.handleCreate({startMonth:y,startYear:w,endMonth:E,endYear:A,url:F},()=>e.handleClose()):G("Please enter a URL")},title:e.newspaper?"Edit Newspaper":"Add Newspaper",children:(0,x.jsxs)(x.Fragment,{children:[U?(0,x.jsx)("div",{className:V.error,children:U}):void 0,(0,x.jsxs)("div",{children:[H(y,f,"Start Month"),Y(w,S,"Start Year")]}),(0,x.jsxs)("div",{children:[H(E,I,"End Month"),Y(A,k,"End Year")]}),(0,x.jsx)("div",{children:(0,x.jsx)(b.Z,{className:(0,q.Z)(V.formControl,V.url),label:"Url",margin:"dense",variant:"outlined",value:F,onChange:e=>{B(e.target.value),G("")}})})]})})},AddEditTransactionModal:e=>{var t,n,o,i,d,c,u,p,m,h;const v=Te(),g=e.transaction?e.transactionTypeOptions.find(t=>t.id===e.transaction.transactionTypeId):void 0,f=a.useState(g),j=(0,r.Z)(f,2),Z=j[0],w=j[1],S=a.useState(""),P=(0,r.Z)(S,2),E=P[0],T=P[1],A=a.useState(null!==(t=null===(n=e.transaction)||void 0===n?void 0:n.points)&&void 0!==t?t:1),R=(0,r.Z)(A,2),M=R[0],F=R[1],B=a.useState(""),L=(0,r.Z)(B,2),z=L[0],G=L[1],V=a.useState(null!==(o=null===(i=e.transaction)||void 0===i?void 0:i.quantity)&&void 0!==o?o:1),W=(0,r.Z)(V,2),q=W[0],H=W[1],Y=a.useState(""),_=(0,r.Z)(Y,2),K=_[0],J=_[1],$=a.useState(null!==(d=e.mainAccount)&&void 0!==d?d:null),X=(0,r.Z)($,2),ee=X[0],te=X[1],ne=a.useState(""),ae=(0,r.Z)(ne,2),oe=ae[0],se=ae[1],re=a.useState(null!==(c=e.toAccount)&&void 0!==c?c:null),ie=(0,r.Z)(re,2),le=ie[0],de=ie[1],ce=a.useState(""),ue=(0,r.Z)(ce,2),pe=ue[0],me=ue[1],he=a.useState(null!==(u=null===(p=e.transaction)||void 0===p?void 0:p.notes)&&void 0!==u?u:""),ve=(0,r.Z)(he,2),ge=ve[0],ye=ve[1],be=a.useState(null!==(m=null===(h=e.transaction)||void 0===h?void 0:h.reverse)&&void 0!==m&&m),fe=(0,r.Z)(be,2),xe=fe[0],je=fe[1],Ne=a.useState(e.birthdayContact||void 0),Pe=(0,r.Z)(Ne,2),Ie=Pe[0],Ae=Pe[1],Oe=a.useState(!1),ke=(0,r.Z)(Oe,2),Re=ke[0],Me=ke[1],Fe=a.useRef(null),Be=e=>{var t;e&&(w(e),"Company"===e.fromPartyType&&"Company"===e.toPartyType&&je(!1),e.defaultPoints&&F(e.defaultPoints),ye(null!==(t=e.defaultNote)&&void 0!==t?t:""),Ke(e))},Le=e=>{de(e),Ye(e)},ze=e=>{te(e),_e(e)},Ue=()=>{const e=2===(null===Z||void 0===Z?void 0:Z.id)&&void 0!==(null===ee||void 0===ee?void 0:ee.companyId);return console.log({mainAccount:ee}),e&&(0,x.jsx)("div",{style:{gridColumn:"1 / 3"},children:(0,x.jsx)(Ee,{value:Ie,onChanged:e=>{Ae(e);const t=e.altOrFirstName;t&&ye("Happy Birthday, ".concat(t,"!"))}})})},Ge=()=>{if(Ve())return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("div",{style:{gridColumn:"1 / 3"},children:(0,x.jsx)(Se.e,{label:"To",className:v.formControl,value:le,errorClassName:pe?v.error:v.noError,errorMessage:pe,onChange:Le,isInEvents:!1})}),(0,x.jsx)(N.Z,{style:{paddingTop:10},children:"Point Balance: ".concat((0,Ce.uf)(null===le||void 0===le?void 0:le.computedBalance))})]})},Ve=()=>Z&&"Company"===Z.fromPartyType&&"Company"===Z.toPartyType,We=e=>{je(e.currentTarget.checked)},qe=()=>{if(!(12!==(null===Z||void 0===Z?void 0:Z.id)&&13!==(null===Z||void 0===Z?void 0:Z.id)))return;const e=!Z||"Company"===Z.toPartyType&&"Company"!==Z.fromPartyType?"Reverse Transaction":"Company"!==Z.toPartyType&&"Company"===Z.fromPartyType?"Refund":"Unknown";return(0,x.jsx)(O.Z,{style:{gridColumn:"1 / 4"},fullWidth:!0,className:v.formControl,children:(0,x.jsx)(I.Z,{inputRef:Fe,control:(0,x.jsx)(D.Z,{checked:xe,onCh
1ange:We}),label:e})})},He=e=>{ye(e.currentTarget.value)},Ye=e=>!e&&Ve()?(me("This field is required"),!1):(me(""),!0),_e=e=>e?(se(""),!0):(se("This field is required"),!1),Ke=e=>e?(T(""),!0):(T("This field is required"),!1),Qe=(e,t)=>{if(t.fromAccountId===e)return t.fromCurrentBalance;if(t.toAccountId===e)return t.toCurrentBalance;throw Error("Could not find account with Id of ".concat(e))},Je=async()=>{if((()=>{let e=!0;return Ke(Z)||(e=!1),Ye(le)||(e=!1),_e(ee)||(e=!1),M<=0&&(G("Must be greater than 0"),e=!1),q<=0&&(J("Must be greater than 0"),e=!1),2===(null===Z||void 0===Z?void 0:Z.id)&&void 0===Ie&&(window.alert("Please select a contact"),e=!1),e})()){if((()=>{if(2!==(null===Z||void 0===Z?void 0:Z.id))return!1;if(!Ie)return!1;const e=Ie.lastAwarded;return e?De()(e).year===De()(new Date).year:(console.log("nope"),!1)})()){const e="It looks like points have already been awarded this year for this contact. Are you sure you want to award more points?";if(!window.confirm(e))return}await $e()}},$e=async()=>{const t={mainAccountId:ee.value,notes:ge,toAccountId:le?le.value:void 0,points:M,quantity:q,reverse:xe,transactionTypeId:Z?Z.id:1,birthdayContactId:2===(null===Z||void 0===Z?void 0:Z.id)?null===Ie||void 0===Ie?void 0:Ie.value:void 0},n=await(async t=>{if("Update"===e.mode)return await U.C.admin.transactions.previewUpdate((0,l.Z)((0,l.Z)({},t),{},{id:e.transaction.id}));return await U.C.admin.transactions.previewCreate(t)})(t);let a="";const o=Qe(ee.value,n.data);if(ee.computedBalance>=0&&o<0&&(a+="".concat(ee.label," Preview Balance: ").concat((0,Ce.uf)(o))),le){const e=Qe(le.value,n.data);le.computedBalance>=0&&e<0&&(a+="".concat(le.label," Preview Balance: ").concat((0,Ce.uf)(e)))}if(a.length>0){const e="\r\n",t="Applying this transaction would create the following negative point balance. Are you sure you want to create it?"+e+e+a;if(!window.confirm(t))return}try{"Update"===e.mode?(Me(!0),await y.R.updateTransaction((0,l.Z)((0,l.Z)({},t),{},{id:e.transaction.id}))):(Me(!0),await y.R.createTransaction(t),t.birthdayContactId&&y.R.setLastAwarded(t.birthdayContactId,new Date)),e.saveCallback&&e.saveCallback(),e.handleClose()}finally{Me(!1)}};return(0,x.jsx)(s.Qj,{render:()=>(0,x.jsx)(C.D,{title:"Adjust Points",handleSave:Je,disableSaveButton:Re,handleClose:e.handleClose,children:(0,x.jsxs)("div",{className:v.contentGrid,children:[(0,x.jsx)("div",{style:{gridColumn:"1 / 3"},children:(0,x.jsx)(Ze,{className:v.formControl,value:Z,errorClassName:E?v.error:v.noError,errorMessage:E,mode:"open",transactionTypes:e.transactionTypeOptions,onChanged:Be})}),(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("div",{style:{gridColumn:"1 / 3"},children:(0,x.jsx)(Se.e,{label:"Account",className:v.formControl,value:ee,isInEvents:!1,errorClassName:oe?v.error:v.noError,errorMessage:oe,onChange:ze})}),(0,x.jsx)(N.Z,{style:{paddingTop:10},children:"Point Balance: ".concat((0,Ce.uf)(null===ee||void 0===ee?void 0:ee.computedBalance))})]}),Ge(),Ue(),(0,x.jsxs)("div",{className:v.pointsRow,children:[(0,x.jsxs)(O.Z,{className:"".concat(v.formControl," ").concat(v.points),children:[(0,x.jsx)(b.Z,{variant:"outlined",margin:"dense",id:"points",value:M,InputProps:{inputComponent:Q.U,inputProps:{allowNegative:!1,prefix:"",decimalScale:0,min:1}},onFocus:e=>{e.target.select()},label:"Points",onChange:e=>{isNaN(parseInt(e.target.value))?F(1):F(parseInt(e.target.value,0))}}),(0,x.jsx)(k.Z,{variant:"standard",className:z?v.error:v.noError,children:z})]}),(0,x.jsx)(we,{className:v.formControl,value:q,onChanged:e=>{H(e)},errorClassName:K?v.error:v.noError,errorMessage:K}),(0,x.jsxs)(N.Z,{color:"secondary",children:["Total: ",(0,Ce.uf)(M*q)]})]}),qe(),(0,x.jsx)(O.Z,{style:{gridColumn:"1 / 4"},className:v.formControl,children:(0,x.jsx)(b.Z,{margin:"none",maxRows:4,minRows:4,id:"name",label:"Notes",variant:"outlined",multiline:!0,type:"text",value:ge,onChange:He,fullWidth:!0})})]})})})},UpdateEventGroupInvoicesModal:e=>{const t=(0,h.Z)(e=>(0,v.Z)({root:{}}))();return(0,x.jsx)("div",{className:t.root,children:(0,x.jsx)(C.D,{handleClose:e.handleClose,title:"Update Event Group Invoices",children:(0,x.jsxs)(Qe.Z,{size:"small",children:[(0,x.jsx)(Xe.Z,{children:(0,x.jsxs)(et.Z,{children:[(0,x.jsx)($e.Z,{children:"Invoice #"}),(0,x.jsx)($e.Z,{children:"Created On"}),(0,x.jsx)($e.Z,{children:"Created By"}),(0,x.jsx)($e.Z,{align:"right",children:"Amount Due"}),(0,x.jsx)($e.Z,{align:"right",children:"Amount Paid"}),(0,x.jsx)($e.Z,{align:"right",children:"Additional Amount Paid"}),(0,x.jsx)($e.Z,{})]})}),(0,x.jsx)(Je.Z,{children:e.activeInvoices.map(e=>(0,x.jsxs)(et.Z,{children:[(0,x.jsx)($e.Z,{children:e.invoiceNumber}),(0,x.jsx)($e.Z,{children:(0,x.jsx)(Pe.t,{date:e.createdOn})}),(0,x.jsx)($e.Z,{children:e.createdBy}),(0,x.jsx)($e.Z,{align:"right",children:(0,Ce.lb)(e.amount)}),(0,x.jsx)($e.Z,{align:"right",children:(0,Ce.lb)(e.amountPaid)}),(0,x.jsxs)($e.Z,{align:"right",children:[(0,x.jsx)("div",{children:"Text Field Here"}),"T"]})]},e.id))})]})})})},AddEventImageModal:e=>{const t=a.useRef(null),n=a.useState(!1),o=(0,r.Z)(n,2),i=o[0],l=o[1],d=(0,h.Z)(e=>(0,v.Z)({root:{},instructions:{marginBottom:e.spacing(2)},formLabel:{fontSize:".9rem"}}))(),c=()=>
1{l(!0)},u=async()=>{const n=t.current.files[0];await yt.K.addImage(yt.K.selectedEventDetails.id,n),e.handleClose()};return(0,x.jsx)(s.Qj,{render:()=>(0,x.jsxs)(C.D,{handleSave:u,handleClose:e.handleClose,disableSaveButton:!i,title:"Add Image",children:[(0,x.jsx)(N.Z,{className:d.instructions,children:'Click the "Choose File" button below to find an image to upload. Then click "Add Image".'}),(0,x.jsx)("div",{children:(0,x.jsx)("input",{ref:t,type:"file",name:"file",accept:".jpg,.png",onChange:c})})]})})},MobileProduct:zt.Y,MemberInfoDialogWrapper:e=>(0,x.jsx)(C.D,{title:"Member Details",handleClose:e.handleClose,children:(0,x.jsx)(Ut.b,{companyId:e.companyId})}),AddUpdateContactPhotoModal:e=>{const t=a.useRef(null),n=a.useState(!1),o=(0,r.Z)(n,2),i=o[0],l=o[1],d=(0,h.Z)(e=>(0,v.Z)({root:{},instructions:{marginBottom:e.spacing(2)},formLabel:{fontSize:".9rem"}}))(),c=()=>{l(!0)},u=async()=>{const n=t.current.files[0],a=await U.C.admin.files.uploadPublicFile(n);e.handleFileAdded(a.uri),e.handleClose()};return(0,x.jsx)(s.Qj,{render:()=>(0,x.jsxs)(C.D,{handleSave:u,handleClose:e.handleClose,disableSaveButton:!i,title:"Add Image",children:[(0,x.jsx)(N.Z,{className:d.instructions,children:'Click the "Choose File" button below to find an image to upload. Then click "Add Image".'}),(0,x.jsx)("div",{children:(0,x.jsx)("input",{ref:t,type:"file",name:"file",accept:".jpg,.png",onChange:c})})]})})},CancellationPolicyModal:e=>{var t;const n=Gt.u.appText.find(e=>"event-cancellation-policy"===e.key),a=null!==(t=null===n||void 0===n?void 0:n.text)&&void 0!==t?t:"";return(0,x.jsx)(C.D,{handleClose:e.handleClose,hideDoneButton:!1,noTopPadding:!0,title:"CANCELLATION POLICIES",children:(0,x.jsx)(Vt.q,{markdown:a})})},ConfirmRefundEventGroupModal:e=>{const t=(0,h.Z)(e=>(0,v.Z)({question:{margin:e.spacing(2,0,1,0),display:"inline-block"},critical:{color:e.palette.error.main,marginTop:e.spacing(4)},indented:{paddingLeft:e.spacing(2)}}))(),n=a.useState(!1),o=(0,r.Z)(n,2),s=o[0],i=o[1],l=a.useState("IssueRefund"),d=(0,r.Z)(l,2),c=d[0],u=d[1],p=a.useState("Cancelled"),m=(0,r.Z)(p,2),g=m[0],y=m[1],b=e=>{u(e.target.value)},f=e=>{y(e.target.value)};return(0,x.jsx)(C.D,{handleSave:async()=>{i(!0),await e.handleRefund(e.eventGroupId,"IssueRefund"===c,"WaitingList"===g),i(!1),e.handleClose()},saveButtonCaption:"Ok",disableSaveButton:s,handleClose:e.handleClose,title:"",children:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(N.Z,{style:{fontWeight:"bold"},component:"div",children:[e.refundInfo.companyName," will no longer be attending the"," ",e.refundInfo.eventName," event."]}),(0,x.jsxs)("div",{className:t.indented,children:[e.refundInfo.totalPointsToRefund>0&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(ke.Z,{className:t.question,children:"Issue a refund for all point payments?"}),(0,x.jsx)("div",{className:t.indented,children:(0,x.jsxs)(Ae.Z,{name:"company-type",value:c,row:!0,onChange:b,children:[(0,x.jsx)(I.Z,{value:"IssueRefund",control:(0,x.jsx)(Oe.Z,{size:"small"}),label:"Yes, issue a refund of ".concat((0,Ce.uf)(e.refundInfo.totalPointsToRefund)," points")}),(0,x.jsx)(I.Z,{value:"DoNotIssueRefund",control:(0,x.jsx)(Oe.Z,{size:"small"}),label:"No, do not issue a refund"})]})})]}),(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(ke.Z,{className:t.question,children:"Which list should the event group be moved to?"}),(0,x.jsx)("div",{className:t.indented,children:(0,x.jsxs)(Ae.Z,{value:g,row:!0,onChange:f,children:[(0,x.jsx)(I.Z,{value:"Cancelled",control:(0,x.jsx)(Oe.Z,{size:"small"}),label:"Cancelled Groups"}),(0,x.jsx)(I.Z,{value:"WaitingList",control:(0,x.jsx)(Oe.Z,{size:"small"}),label:"Waiting List"})]})})]}),e.refundInfo.nonVoidInvoiceNumbers.length>0&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(ke.Z,{className:t.question,children:"The following invoices will be voided:"}),(0,x.jsx)("div",{className:t.indented,children:e.refundInfo.nonVoidInvoiceNumbers.map(e=>(0,x.jsx)(N.Z,{component:"div",children:(0,x.jsx)("strong",{children:e})}))})]}),e.refundInfo.totalCheckPayments>0&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(ke.Z,{className:t.question,children:"Should check payments be refunded?"}),(0,x.jsxs)("div",{className:t.indented,children:[(0,x.jsxs)(Ae.Z,{value:c,row:!0,onChange:b,children:[(0,x.jsx)(I.Z,{value:"IssueRefund",control:(0,x.jsx)(Oe.Z,{size:"small"}),label:"Issue Refund Manually"}),(0,x.jsx)(I.Z,{value:"DoNotIssueRefund",control:(0,x.jsx)(Oe.Z,{size:"small"}),label:"No, do not issue a refund"})]}),"IssueRefund"===c&&(0,x.jsxs)(ke.Z,{className:(0,q.Z)(t.question,t.critical),children:["There are check payments totalling"," ",(0,Ce.lb)(e.refundInfo.totalCheckPayments)," that should be refunded."]})]})]})]})]})})},GenericAddNote:ue,SendNewMemberWelcomeEmailModal:e=>
1{const t=e.referredBy?{label:"".concat(e.referredBy.name," (").concat(e.referredBy.identifier,")"),value:e.referredBy.id}:void 0,n=a.useState([]),o=(0,r.Z)(n,2),i=o[0],l=o[1],d=a.useState([]),c=(0,r.Z)(d,2),u=c[0],p=c[1],m=a.useState([]),g=(0,r.Z)(m,2),b=g[0],f=g[1],j=a.useState(!1),Z=(0,r.Z)(j,2),w=Z[0],S=Z[1],P=a.useState(t),E=(0,r.Z)(P,2),I=E[0],D=E[1],T=a.useState([]),A=(0,r.Z)(T,2),O=A[0],k=A[1],R=a.useState(),M=(0,r.Z)(R,2),F=M[0],B=M[1],L=a.useState(!1),z=(0,r.Z)(L,2),G=z[0],V=z[1],W=(0,h.Z)(e=>(0,v.Z)({root:{display:"grid",gridTemplateColumns:"1fr 1fr",gridTemplateRows:"auto 1fr",gridGap:e.spacing(2),transition:e.transitions.create(["opacity"],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen})},disabled:{opacity:.5,pointerEvents:"none"},alert:{marginTop:e.spacing(2)}}));a.useEffect(()=>{(async()=>{await y.R.loadContacts(!0);const e=await U.C.admin.members.getAllNewMemberWelcomeAttachments();f(e)})()},[]);const H=async e=>{f([e,...b]),l([e.id,...i])},Y=async e=>{await U.C.admin.members.deleteNewMemberWelcomeAttachment(e),f(b.filter(t=>t.id!==e))},_=e=>{const t=["B","KB","MB","GB"];let n=e,a=0;for(;n>=1024&&a<t.length-1;)n/=1024,a++;return"".concat(n.toFixed(1)," ").concat(t[a])},K=()=>i.reduce((e,t)=>{var n;const a=b.find(e=>e.id===t);return e+(null!==(n=null===a||void 0===a?void 0:a.fileSizeBytes)&&void 0!==n?n:0)},0),Q=W(),J=e=>{const t=e.currentTarget.value;e.currentTarget.checked?l([t,...i]):l(i.filter(e=>e!==t))},$=async()=>{if(u.length<1)return void alert("Please select at least one recipient");if(i.length<1)return void alert("Please select at least one attachment");const t=K();if(t>Yt.Dc){return void alert("Total attachment size (".concat((t/1048576).toFixed(1)," MB) exceeds the maximum allowed size of ").concat(Yt.hF," MB. ")+"Please remove some attachments or select smaller files.")}try{V(!0);const t=await U.C.admin.members.sendNewMemberWelcome({attachmentIds:i,contactIds:u,sponsorId:null===I||void 0===I?void 0:I.value});k(t.data.userAccountCreatedFor),B(t.data.emailsSent),e.sentCallback(),S(!0)}finally{V(!1)}},X=(e,t)=>{p(t?[e,...u]:u.filter(t=>t!==e))},ee=()=>{if(void 0!==F)return(0,x.jsxs)(pt.Z,{className:Q.alert,color:"success",children:[(0,x.jsx)(N.Z,{color:"primary",children:"".concat(F," welcome ").concat(F>1?"emails were":"email was"," sent")}),(0,x.jsx)(N.Z,{color:"primary",children:"(Welcome emails will include a set password link if a user account was created or if the existing user account has not set their password)"}),O.length>0&&(0,x.jsxs)("div",{children:[(0,x.jsx)(N.Z,{component:"div",children:"The following user accounts were created automatically:"}),O.map(e=>(0,x.jsx)(N.Z,{component:"div",children:"".concat(e.firstName," ").concat(e.lastName)}))]}),0===O.length&&(0,x.jsx)(N.Z,{color:"error",component:"div",children:"No user accounts were created (most likely because one already exists)."})]})},te=a.useRef(["Sponsor"]);return(0,x.jsx)(s.Qj,{render:()=>{if(!y.R.contacts)return(0,x.jsx)("div",{});const t=y.R.contacts.filter(e=>e.emailAddresses.length>0);return(0,x.jsx)(C.D,{saveButtonCaption:G?"Sending...":"Send",title:"Send New Member Welcome Email",handleSave:w?void 0:$,disableSaveButton:G,handleClose:e.handleClose,children:(0,x.jsxs)("div",{children:[(0,x.jsxs)("div",{className:(0,q.Z)(Q.root,{[Q.disabled]:G}),children:[(0,x.jsx)("div",{children:(0,x.jsx)(Ht,{title:"Recipients",checkedContactIds:u,handleContactCheckedChanged:X,contacts:t})}),(0,x.jsxs)("div",{style:{gridColumn:"1 / 2"},children:[(0,x.jsx)(N.Z,{color:"primary",component:"div",variant:"caption",style:{marginBottom:8},children:"Referring Sponsor"}),(0,x.jsx)(Ct.e,{userType:"Admin",minWidth:"200px",label:"Select Referring Sponsor",companyTypes:te,selectedOption:I,onSelectedOptionChanged:D})]}),(0,x.jsxs)("div",{style:{gridRow:"1 / 3",gridColumn:"2 / 3"},children:[(0,x.jsxs)(N.Z,{color:"primary",component:"div",variant:"caption",children:["Attachments"," ",i.length>0&&" (".concat(i.length," selected)")]}),i.length>0&&(0,x.jsxs)(N.Z,{component:"div",variant:"caption",style:{color:K()>Yt.Dc?"#d32f2f":"#666",marginBottom:4},children:["Total size: ",_(K())," / ",Yt.hF," MB",K()>Yt.Dc&&" (exceeds limit)"]}),(0,x.jsx)(qt,{onAttachmentAdded:H,attachments:b,checkedAttachmentIds:i,onAttachmentRemoved:Y,onAttachmentCheckboxChanged:J})]})]}),ee()]})})}})},SendNewSponsorReferralConfirmationModal:e=>
1{const t=e.referredBy?{label:"".concat(e.referredBy.name," (").concat(e.referredBy.identifier,")"),value:e.referredBy.id}:void 0,n=a.useState(t),o=(0,r.Z)(n,2),s=o[0],i=o[1],l=a.useState(),d=(0,r.Z)(l,2),c=d[0],u=d[1],p=a.useState(),m=(0,r.Z)(p,2),h=m[0],v=m[1],g=a.useState(!1),y=(0,r.Z)(g,2),b=y[0],f=y[1];a.useEffect(()=>{(async e=>{if(v(void 0),u(void 0),s){const t=(await U.C.admin.company.getActiveCompanyEmployees(e.value)).filter(e=>e.email).map(e=>({label:"".concat(e.firstName," ").concat(e.lastName),value:e.id}));v(t)}})(s)},[s]);const j=b?{opacity:.5,pointerEvents:"none"}:void 0,Z=a.useRef(["Sponsor"]);return(0,x.jsx)(C.D,{handleSave:async()=>{if(s)if(c)try{f(!0),await U.C.admin.members.sendNewSponsorReferralConfirmation({newMemberId:e.memberId,referringContactId:c.value,referringSponsorId:s.value}),e.sentCallback(),e.handleClose()}finally{f(!1)}else alert("Please select a contact");else alert("Please select a company")},disableSaveButton:b,handleClose:e.handleClose,title:"Send New Sponsor Referral Confirmation Email",saveButtonCaption:b?"Sending...":"Send",children:(0,x.jsxs)("div",{style:j,children:[(0,x.jsx)(Ct.e,{userType:"Admin",minWidth:"200px",label:"Select Referring Sponsor",companyTypes:Z,selectedOption:s,onSelectedOptionChanged:i}),s&&(0,x.jsx)(Ne.A,{selectedOption:c,setSelectedOption:u,error:!1,canClear:!1,invalidOptionIds:[],noOptionsText:"No Contacts Found",options:null!==h&&void 0!==h?h:[],label:"Select Contact",disabled:void 0===h})]})})},CreateMemberReferralModal:e=>{const t=a.useState("NotSubmitted"),n=(0,r.Z)(t,2),o=n[0],s=n[1],i=a.useState(!1),l=(0,r.Z)(i,2),d=l[0],c=l[1],u=(0,h.Z)(e=>(0,v.Z)({root:{},introduction:{marginBottom:e.spacing(4)},submittedMessage:{height:"100%",display:"flex",flexDirection:"column",justifyContent:"center",opacity:0,fontSize:"larger",textAlign:"center",transition:e.transitions.create(["opacity"],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),minHeight:500},visibleMessage:{opacity:1},errorMessage:{color:e.palette.error.main},infoMesage:{color:e.palette.error.main,margin:e.spacing(4,0)}}))(),m="InProgress"===o||"NotSubmitted"===o,g={address:"",city:"",companyName:e.defaultCompanyName,emailAddress:"",firstName:"",lastName:"",phoneNumber:"",state:"",zipCode:"",notes:""},y=P.Ry().shape({companyName:P.Z_().required("Required"),address:P.Z_().required("Required"),city:P.Z_().required("Required"),state:P.Z_().required("Required"),zipCode:P.Z_().required("Required"),emailAddress:P.Z_().email("Please enter a valid email address"),firstName:P.Z_().required("Required"),lastName:P.Z_().required("Required"),phoneNumber:P.Z_().required("Required"),notes:P.Z_()}),b="Error"===o||"Submitted"===o,f="Builders Club North",j="BCN"===Yt.an?"Perk":"Club";return(0,x.jsx)(p.J9,{initialValues:g,validationSchema:y,onSubmit:async(t,n)=>{await(async t=>{s("InProgress");try{await U.C.sponsors.members.createReferral(t),s("Submitted"),e.onReferralCreated(),setTimeout(()=>{c(!0)},100),setTimeout(()=>{e.handleClose()},4e3)}catch(n){s("Error")}})(t),n.setSubmitting(!1)},render:t=>(0,x.jsx)(C.D,{saveButtonCaption:"Submit",hideAllButtons:b,handleSave:t.submitForm,disableSaveButton:"NotSubmitted"!==o,title:b?"":"Enroll Member",handleClose:e.handleClose,children:(0,x.jsxs)("div",{className:u.root,children:[m&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(N.Z,{component:"div",className:u.introduction,children:[(0,x.jsxs)("strong",{children:["Thank You for enrolling a NEW ",f," Member!"]}),(0,x.jsx)("div",{children:"Please provide as much information as possible when enrolling a New Member."}),(0,x.jsxs)("div",{children:["Once you submit this form, ",f," will complete the enrollment process."]}),(0,x.jsxs)("div",{children:["We will email you with their ",j," ID# and the New Member will be added to your online reporting form."]})]}),(0,x.jsx)(_t,{formikProps:t})]}),"Submitted"===o&&(0,x.jsxs)(N.Z,{component:"div",className:(0,q.Z)(u.submittedMessage,{[u.visibleMessage]:d}),children:[(0,x.jsx)("h2",{children:"THANK YOU!"}),(0,x.jsx)("div",{children:"Your referral has been submitted."}),e.openedFromMonthlyReport&&(0,x.jsxs)(N.Z,{className:u.infoMesage,children:["A ","Builders Club North"," representative will complete the process and add the member to your report shortly."]})]}),"Error"===o&&(0,x.jsxs)(N.Z,{component:"div",className:u.errorMessage,children:[(0,x.jsx)("h2",{children:"Sorry!"}),(0,x.jsx)("div",{children:"We've encountered a problem. Please try again later."})]})]})})})},ViewCompanyEventAttendees:e=>(0,x.jsxs)(C.D,{handleClose:e.handleClose,title:"".concat(e.companyName," attendees for ").concat(e.eventName),children:[e.attendeeNames.map((e,t)=>(0,x.jsx)("div",{children:e},t)),0===e.attendeeNames.length&&(0,x.jsx)("div",{children:"(no attendees found)"})]}),GenericFormModal:e=>{const t=a.useState(Object.assign({},e.data)),n=(0,r.Z)(t,2),o=n[0],s=n[1],i=(e,t,n)=>(0,x.jsx)("div",{children:(0,x.jsx)(I.Z,{disabled:n,control:(0,x.jsx)(D.Z,{checked:t,onChange:t=>l(e,t.target.checked),size:"small"}),label:e})}),l=(e,t)=>
1{const n=Object.assign({},o,{[e]:t});s(n)},d=(e,t,n)=>(0,x.jsx)("div",{children:(0,x.jsx)(b.Z,{fullWidth:!0,placeholder:t,disabled:n,onChange:e=>l(t,e.target.value),label:t,variant:"outlined",margin:"dense",value:e})}),c=(e,t,n)=>(0,x.jsx)("div",{children:(0,x.jsx)(b.Z,{fullWidth:!0,placeholder:t,disabled:n,label:t,onChange:e=>l(t,e.target.value),variant:"outlined",margin:"dense",type:"number",value:e})}),u=(e,t)=>(0,x.jsx)("span",{}),p=["id","legacyId","createdOn","updatedOn"],m=["supplierProfileSortOrder"];return(0,x.jsxs)(C.D,{handleSave:async()=>{await e.onSave(o),e.handleClose()},handleClose:e.handleClose,title:"".concat(e.data.id?"Edit":"Create"," ").concat((e=>{switch(e){case"Brands":return"Brand";case"Categories":return"Category";case"EventTypes":return"Event Type";case"Markets":return"Market";case"Products":return"Product";case"RelationshipTypes":return"Relationship Type";case"Units":return"Unit";default:return e}})(e.typeName)),children:[(()=>{const e=[];for(const t in o){const n=m.indexOf(t)>=0?"number":typeof o[t],a=p.indexOf(t)>=0;if(console.log({propName:t,type:n}),!a)switch(n){case"boolean":e.push(i(t,o[t],!1));break;case"string":e.push(d(o[t],t,!1));break;case"number":e.push(c(o[t],t,!1));break;default:e.push(u(o[t]))}}return e})(),(0,x.jsx)(Kt,{listType:e.typeName})]})},AddTrackedLeadModal:e=>{const t=a.useState([]),n=(0,r.Z)(t,2),o=n[0],s=n[1],i=a.useState([]),l=(0,r.Z)(i,2),d=l[0],c=l[1],u=a.useState(e.member),p=(0,r.Z)(u,2),m=p[0],g=p[1],y=a.useState(!1),f=(0,r.Z)(y,2),j=f[0],Z=f[1],w=a.useState(!1),S=(0,r.Z)(w,2),P=S[0],I=S[1],D=a.useState([]),T=(0,r.Z)(D,2),A=T[0],O=T[1],k=a.useState([]),R=(0,r.Z)(k,2),M=R[0],F=R[1],B=a.useState(""),L=(0,r.Z)(B,2),z=L[0],G=L[1],W=a.useState([]),q=(0,r.Z)(W,2),H=q[0],Y=q[1],_=a.useState([]),K=(0,r.Z)(_,2),Q=K[0],J=K[1],$=a.useState("ByName"),X=(0,r.Z)($,2),ee=X[0],te=X[1],ne=a.useState(),ae=(0,r.Z)(ne,2),oe=ae[0],se=ae[1],re=a.useState(""),ie=(0,r.Z)(re,2),le=ie[0],de=ie[1],ce=(0,h.Z)(e=>(0,v.Z)({root:{},listBoxHost:{height:300,minHeight:300,maxHeight:300},earningPointsIn:{color:"gray",opacity:.7},summary:{height:65,minHeight:65,maxHeight:65,overflowY:"auto"}}))(),ue=(0,V.Nr)(z,500);a.useEffect(()=>{(async e=>{if(te("ByName"),I(!0),ue){const t=await U.C.admin.search.unifiedSearch({search:e,activeOnly:!0,includeContacts:!1,companyTypes:["Sponsor"]});ue===t.searchTerm&&(c(t.companies.map(e=>({id:e.id,name:e.name,identifier:e.identifier.toString()}))),I(!1))}})(ue)},[ue]),a.useEffect(()=>{oe&&(async e=>{I(!0),te("ByCategory");const t=await U.C.admin.sponsors.findByCategory(e);c(t),I(!1)})(oe.value)},[oe]),a.useEffect(()=>{m&&(async e=>{Z(!0);const t=await U.C.admin.members.getCategoryIdsEarningPointsIn(e),n=await U.C.shared.purchasers.getSuppliers(e),a=await U.C.admin.members.getTrackedLeads(e);F(t),s(a),O(n.suppliers.map(e=>e.supplierId)),Z(!1)})(m.value)},[m]);const pe=a.useRef(["Member"]),me=e=>M.includes(e.value)?(0,x.jsx)("div",{className:ce.earningPointsIn,children:"".concat(e.label," (Earning points)")}):(0,x.jsx)("div",{children:e.label}),he=o.map(e=>e.sponsorId);return(0,x.jsx)(C.D,{handleSave:async()=>{const t=await U.C.admin.trackedLeads.createTrackedLeads({memberId:m.value,sponsorIds:H,notes:le});e.savedCallback(t),e.handleClose()},title:"Add Lead(s)",disableSaveButton:0===H.length||void 0===m,handleClose:e.handleClose,children:(0,x.jsxs)(E.ZP,{container:!0,spacing:2,children:[(0,x.jsx)(E.ZP,{item:!0,xs:12,children:(0,x.jsx)(Ct.e,{disabled:Boolean(e.member)||H.length>0,userType:"Admin",minWidth:"200px",companyTypes:pe,label:"Select Member",onSelectedOptionChanged:e=>g(e),selectedOption:m})}),(0,x.jsx)(E.ZP,{item:!0,xs:6,children:j?(0,x.jsx)(N.Z,{children:"Loading Member Information. Please wait..."}):m?(0,x.jsx)(Jt,{disabled:j,selectedCategory:oe,onSelectedCategoryChanged:se,searchText:z,onSearchTextCHanged:G,onFilterTypeChanged:te,selectedFilterType:ee,categoryIdsEarningPointsIn:M,renderOption:me}):(0,x.jsx)(N.Z,{children:"Please select a member. Sponsor selection will be enabled once you select a member."})}),(0,x.jsx)(E.ZP,{item:!0,xs:6,children:(0,x.jsx)("div",{className:ce.listBoxHost,children:m&&(0,x.jsx)(Qt,{disabled:P||j,sponsors:d,linkedSponsorIds:A,checkedSponsorIds:H,existingLeadSponsorIds:he,onSponsorCheckedChange:(e,t)=>
1{t?(Y([...H,e.id]),J([...Q,e])):(Y(H.filter(t=>t!==e.id)),J(Q.filter(t=>t.id!==e.id)))}})})}),(0,x.jsx)(E.ZP,{item:!0,xs:12,children:(0,x.jsx)(b.Z,{multiline:!0,minRows:4,label:"Notes",fullWidth:!0,placeholder:"Enter note here",variant:"outlined",value:le,onChange:e=>{de(e.target.value)},margin:"dense"})}),m&&(0,x.jsxs)(E.ZP,{item:!0,xs:12,className:ce.summary,children:[(0,x.jsx)(N.Z,{component:"div",variant:"caption",color:"primary",children:"Leads will be created for ".concat(null===m||void 0===m?void 0:m.label," with following sponsors:")}),Q.map((e,t)=>{const n=t===Q.length-1?e.name:"".concat(e.name,", ");return(0,x.jsx)("span",{children:n},e.id)})]})]})})},SendMemberUploadEmailsModal:e=>{const t=a.useState([]),n=(0,r.Z)(t,2),o=n[0],s=n[1],i=a.useState([]),l=(0,r.Z)(i,2),d=l[0],c=l[1],u=a.useState(!1),p=(0,r.Z)(u,2),m=p[0],y=p[1],b=(0,h.Z)(e=>(0,v.Z)({root:{},instructions:{fontWeight:"bold",margin:0}}));a.useEffect(()=>{(async()=>{if(await g.n.ensureMarketsFetched(),e.showNewMemberFields){const e=await U.C.admin.members.getAllNewMemberWelcomeAttachments();c(e),y(!0)}else c([]),y(!0)})()},[e.showNewMemberFields]);const f=()=>o.reduce((e,t)=>{var n;const a=d.find(e=>e.id===t);return e+(null!==(n=null===a||void 0===a?void 0:a.fileSizeBytes)&&void 0!==n?n:0)},0),j=b();return(0,x.jsx)(C.D,{saveButtonCaption:"OK",handleSave:async()=>{if(e.showNewMemberFields&&0===o.length)return void alert("Please select at least one attachment");if(e.showNewMemberFields){const e=f();if(e>Yt.Dc){return void alert("Total attachment size (".concat((e/1048576).toFixed(1)," MB) exceeds the maximum allowed size of ").concat(Yt.hF," MB. ")+"Please remove some attachments or select smaller files.")}}const t=await U.C.admin.sponsors.startSendingMemberUploadEmails({memberUploadId:e.memberUploadId,attachmentIds:o});e.doneCallback(t.data),e.handleClose()},title:"Start Sending New Member Emails",handleClose:e.handleClose,disableSaveButton:!1,children:m&&(0,x.jsxs)(x.Fragment,{children:[!e.showNewMemberFields&&(0,x.jsx)("div",{children:(0,x.jsx)(N.Z,{children:"No new members where detected in this upload so you don't have to select any attachments."})}),e.showNewMemberFields&&(0,x.jsx)("div",{className:j.root,children:(0,x.jsxs)("div",{children:[(0,x.jsx)(N.Z,{className:j.instructions,children:"Please select one or more attachments to send along with the new member email:"}),o.length>0&&(0,x.jsxs)(N.Z,{component:"div",variant:"caption",style:{color:f()>Yt.Dc?"#d32f2f":"#666",marginTop:8,marginBottom:4},children:["Total size: ",(e=>{const t=["B","KB","MB","GB"];let n=e,a=0;for(;n>=1024&&a<t.length-1;)n/=1024,a++;return"".concat(n.toFixed(1)," ").concat(t[a])})(f())," / ",Yt.hF," MB",f()>Yt.Dc&&" (exceeds limit)"]}),(0,x.jsx)(qt,{onAttachmentRemoved:async e=>{await U.C.admin.members.deleteNewMemberWelcomeAttachment(e),c(d.filter(t=>t.id!==e))},onAttachmentCheckboxChanged:e=>{const t=e.currentTarget.value;e.currentTarget.checked?s([t,...o]):s(o.filter(e=>e!==t))},checkedAttachmentIds:o,attachments:d,onAttachmentAdded:async e=>{c([e,...d]),s([e.id,...o])}})]})})]})})},AddEditCancellationFee:e=>{const t=e.existingDollarValue?e.existingDollarValue/e.dollarsPerPoint:void 0,n=a.useState(t),o=(0,r.Z)(n,2),s=o[0],i=o[1],l=a.useState(e.existingDollarValue),d=(0,r.Z)(l,2),c=d[0],u=d[1];return(0,x.jsx)(C.D,{handleClose:e.handleClose,handleSave:async()=>{void 0!==c?(await yt.K.setCancellationFee({cancellationFee:c,eventPayerId:e.eventPayerId}),e.handleClose()):alert("Please enter a value")},width:"sm",saveButtonCaption:"Save",title:e.existingDollarValue?"Update Cancellation Fee":"Add Cancellation Fee",children:(0,x.jsx)("div",{children:(0,x.jsx)(Ge,{allowNegative:!1,pointsError:"",showPointsError:!1,dollarsError:"",showDollarsError:!1,dollarsPerPoint:e.dollarsPerPoint,onChange:e=>{i(e.points),u(e.dollars)},pointValue:s,dollarValue:c})})})},MergeCompanyModal:e=>{const t=a.useState(!1),n=(0,r.Z)(t,2),o=n[0],s=n[1],i=a.useState(""),l=(0,r.Z)(i,2),d=l[0],c=l[1],u=a.useState(void 0),p=(0,r.Z)(u,2),m=p[0],g=p[1],y=(0,dt.s0)(),f=(0,h.Z)(e=>(0,v.Z)({root:{display:"grid",gridTemplateColumns:"1fr 1fr",gridGap:e.spacing(4)},warningText:{fontWeight:"bold",marginTop:e.spacing(4)},mergeTypeRadios:{margin:e.spacing(2,0)},inactiveChip:{backgroundColor:"maroon",color:"white",marginLeft:e.spacing(2)}}))(),j=a.useRef([e.companyType]),Z="MERGE",w=()=>(0,x.jsx)($t.Z,{className:f.inactiveChip,size:"small",label:"Inactive"}),S=o||d!==Z||void 0===e.company2&&void 0===m;return(0,x.jsx)(C.D,{handleSave:async()=>{var t,n;const a=e.company1.id,o=null!==(t=null===(n=e.company2)||void 0===n?void 0:n.id)&&void 0!==t?t:null===m||void 0===m?void 0:m.value;if(o){s(!0);try{const t=await U.C.admin.company.mergeCompanies({keepCompanyId:a,deleteCompanyId:o});t.data.conflictCount>0?y("".concat(lt.H.app.admin.root,"/merge-conflicts/").concat(t.data.dataMergeId)):e.doneCallback(t.data.remainingCompanyId,e.potentialDuplicateId),e.handleClose()}finally{s(!1)}}else alert("Could not find other company")},handleClose:e.handleClose,saveButtonCaption:o?"Merging...":"Merge",disableSaveButton:S,title:"Merge Companies",children:(0,x.jsxs)("div",{className:f.root,children:[(0,x.jsxs)("div",{style:{borderRight:"1px solid gray",paddingRight:"1em"},children:[(0,x.jsx)(N.Z,{color:"primary",variant:"caption",children:"Companies"}),(0,x.jsxs)("ul",{children:[(0,x.jsxs)("li",{children:[(0,x.jsx)(N.Z,{component:"span",children:"".concat(e.company1.name,"
1(").concat(e.company1.identifier,")")}),e.company1Inactive&&w()]}),e.company2&&(0,x.jsxs)("li",{style:{marginTop:"1em"},children:[(0,x.jsx)(N.Z,{component:"span",children:"".concat(e.company2.name," (").concat(e.company2.identifier,")")}),e.company2Inactive&&w()]}),!e.company2&&(0,x.jsx)("li",{children:(0,x.jsx)("div",{style:{marginTop:"2em",transform:"translateY(-10px)"},children:(0,x.jsx)(Ct.e,{searchInactives:!0,userType:"Admin",hiddenOptionIds:[e.company1.id],minWidth:"200px",companyTypes:j,selectedOption:m,onSelectedOptionChanged:g})})})]})]}),(0,x.jsxs)("div",{children:[(0,x.jsx)(N.Z,{className:f.warningText,children:"Warning! This action cannot be undone. Type ".concat(Z," in the box below to continue")}),(0,x.jsx)(b.Z,{margin:"dense",variant:"outlined",value:d,onChange:e=>c(e.target.value)}),(0,x.jsx)(N.Z,{children:"NOTE: Merging companies with event history can take a long time (up to 10 minutes). Please leave this window open until the merge has completed."})]})]})})},CheckedContactsModal:e=>{const t=a.useState(!1),n=(0,r.Z)(t,2),o=n[0],s=n[1],i=a.useState([]),l=(0,r.Z)(i,2),d=l[0],c=l[1];return(0,x.jsx)(C.D,{handleSave:async()=>{if(window.confirm("Are you sure you want to send this email?"))try{s(!0),await e.handleSend(d),e.handleClose()}finally{s(!1)}},handleClose:e.handleClose,disableSaveButton:d.length<1||o,saveButtonCaption:"Send",title:e.modalTitle,children:(0,x.jsx)(Ht,{handleContactCheckedChanged:(e,t)=>{c(t?[e,...d]:d.filter(t=>t!==e))},contacts:e.contacts,checkedContactIds:d,title:"Active ".concat(e.companyName," employees (").concat(e.contacts.length,"):")})})},ReplinkInfoModal:e=>{const t=a.useState(),n=(0,r.Z)(t,2),o=n[0],s=n[1],i=(0,h.Z)(e=>(0,v.Z)({root:{}}))(),l=P.Ry().shape({companyName:P.Z_().required("Required"),programName:P.Z_().required("Required"),address1:P.Z_().required("Required"),zip:P.Z_().required("Required"),city:P.Z_().required("Required"),state:P.Z_().required("Required"),emailAddress:P.Z_().email().required("Required"),shipToEmail:P.Z_().email().required("Required"),phoneNumber:P.Z_().required("Required")});a.useEffect(()=>{(async()=>{const e=await U.C.admin.replinkInfo.getReplinkInfo();s(e)})()},[]);return o?(0,x.jsx)(p.J9,{initialValues:o,validationSchema:l,onSubmit:async t=>{await U.C.admin.replinkInfo.updateReplinkInfo(t),e.handleClose()},render:t=>(0,x.jsx)(C.D,{handleSave:()=>t.submitForm(),saveButtonCaption:"Save",handleClose:e.handleClose,title:"Update Replink Info",children:(0,x.jsx)("div",{className:i.root,children:o&&(0,x.jsx)(Xt,{})})})}):(0,x.jsx)("div",{})},HostCompanyInfoModal:e=>{const t=(0,h.Z)(e=>(0,v.Z)({root:{}}))(),n=P.Ry().shape({companyName:P.Z_().required("Required"),address1:P.Z_().required("Required"),zip:P.Z_().required("Required"),city:P.Z_().required("Required"),state:P.Z_().required("Required"),phoneNumber:P.Z_().required("Required"),emailAddress:P.Z_().email().required("Required")});a.useEffect(()=>{Lt.Y.ensureHostCompanyInfoIsLoaded()},[]);const o=async t=>{await U.C.admin.hostCompanyInfo.updateHostCompanyInfo(t),Lt.Y.refreshHostCompanyInfo(),e.handleClose()};return(0,x.jsx)(s.Qj,{render:()=>Lt.Y.hostCompanyInfo?(0,x.jsx)(p.J9,{initialValues:Lt.Y.hostCompanyInfo,validationSchema:n,onSubmit:o,render:n=>(0,x.jsx)(C.D,{handleSave:()=>n.submitForm(),saveButtonCaption:"Save",handleClose:e.handleClose,title:"Update Host Company Info",children:(0,x.jsxs)("div",{className:t.root,children:[(0,x.jsx)(pt.Z,{severity:"info",children:"Fields here may be used on the home page, event group invoices and email signatures."}),(0,x.jsx)("br",{}),Lt.Y.hostCompanyInfo&&(0,x.jsx)(en,{})]})})}):(0,x.jsx)("div",{})})},MergeContactsModal:e=>{const t=a.useState(!1),n=(0,r.Z)(t,2),o=n[0],s=n[1],i=a.useState(),l=(0,r.Z)(i,2),d=l[0],c=l[1],u=(0,h.Z)(e=>(0,v.Z)({root:{width:400},warningText:{fontWeight:"bold",marginTop:e.spacing(4)},inactiveChip:{backgroundColor:"maroon",color:"white",marginLeft:e.spacing(2)},dropdown:{transform:"translateY(-10px)",maxWidth:400},list:{"& li":{paddingBottom:10}}}))(),p=e.allCompanyContacts.slice().sort((e,t)=>e.altFullName.localeCompare(t.altFullName)).map(e=>({value:e.id,label:e.isActive?e.altFullName:"".concat(e.altFullName,"
1(inactive)")})),m=o||void 0===d;return(0,x.jsx)(C.D,{handleSave:async()=>{if(d){s(!0);try{const t=await U.C.admin.company.mergeContacts({companyId:e.companyId,contact1Id:e.targetContact.id,contact2Id:d.value});e.handleClose(),e.doneCallback&&e.doneCallback(t.data)}finally{s(!1)}}else alert("Please select a contact to merge with")},handleClose:e.handleClose,saveButtonCaption:o?"Merging...":"Merge",disableSaveButton:m,title:"Merge Contacts",children:(0,x.jsx)("div",{className:u.root,children:(0,x.jsxs)("div",{children:[(0,x.jsx)(N.Z,{color:"primary",variant:"caption",children:"Contacts"}),(0,x.jsxs)("ul",{className:u.list,children:[(0,x.jsxs)("li",{children:[(0,x.jsx)(N.Z,{component:"span",children:"".concat(e.targetContact.firstName," ").concat(e.targetContact.lastName)}),"Inactive"===e.targetContact.status&&(0,x.jsx)($t.Z,{className:u.inactiveChip,size:"small",label:"Inactive"})]}),(0,x.jsx)("li",{children:(0,x.jsx)("div",{className:u.dropdown,children:(0,x.jsx)(Ne.A,{options:p,selectedOption:d,setSelectedOption:e=>c(e),error:!1,canClear:!1,label:"Select Contact To Merge with...",invalidOptionIds:[e.targetContact.
1id]})})})]})]})})})},CloseMemberAccountModal:e=>{const t=a.useState(""),n=(0,r.Z)(t,2),o=n[0],s=n[1],i=a.useState(!1),l=(0,r.Z)(i,2),d=l[0],c=l[1],u=(0,h.Z)(e=>(0,v.Z)({root:{}}))();return(0,x.jsx)(C.D,{handleSave:async()=>{c(!0);try{await U.C.admin.members.closeAccount({memberId:e.memberId,notes:o}),e.handleClose(),e.doneCallback()}finally{c(!1)}},saveButtonCaption:"Close Account",disableSaveButton:d,handleClose:e.handleClose,title:"Close Member Account",children:(0,x.jsxs)("div",{className:u.root,children:[(0,x.jsx)(N.Z,{children:"Clicking OK will make the member inactive and transfer any remaining point balance to the marketing fund."}),(0,x.jsx)(b.Z,{variant:"outlined",label:"Note to add to account (optional)",margin:"dense",multiline:!0,minRows:3,disabled:d,maxRows:3,fullWidth:!0,value:o,onChange:e=>s(e.target.value)})]})})},CompanyExportOptionsModal:e=>{var t,n,o,s,i,l,d,c,u,p,m,g;const y=a.useState(!1),b=(0,r.Z)(y,2),f=b[0],j=b[1],Z=a.useState(null!==(t=null===(n=e.defaultValues)||void 0===n?void 0:n.nonVipMembersChecked)&&void 0!==t&&t),w=(0,r.Z)(Z,2),S=w[0],P=w[1],T=a.useState(null!==(o=null===(s=e.defaultValues)||void 0===s?void 0:s.vipMmbersChecked)&&void 0!==o&&o),A=(0,r.Z)(T,2),O=A[0],k=A[1],R=a.useState(null!==(i=null===(l=e.defaultValues)||void 0===l?void 0:l.sponsorsChecked)&&void 0!==i&&i),M=(0,r.Z)(R,2),F=M[0],B=M[1],L=a.useState(null!==(d=null===(c=e.defaultValues)||void 0===c?void 0:c.competitorsChecked)&&void 0!==d&&d),z=(0,r.Z)(L,2),G=z[0],V=z[1],W=a.useState(null!==(u=null===(p=e.defaultValues)||void 0===p?void 0:p.prospectsChecked)&&void 0!==u&&u),q=(0,r.Z)(W,2),H=q[0],Y=q[1],_=a.useState(!0),K=(0,r.Z)(_,2),Q=K[0],J=K[1],$=a.useState(null!==(m=null===(g=e.defaultValues)||void 0===g?void 0:g.inactiveChecked)&&void 0!==m&&m),X=(0,r.Z)($,2),ee=X[0],te=X[1],ne=a.useState(!1),ae=(0,r.Z)(ne,2),oe=ae[0],se=ae[1],re=(0,h.Z)(e=>(0,v.Z)({root:{},checkboxHost:{display:"flex",alignItems:"flex-start",flexDirection:"column",width:350}}))();const ie=(e,t,n,a)=>(0,x.jsx)(I.Z,{control:(0,x.jsx)(D.Z,{checked:t,disabled:n,onChange:e=>{a(e.target.checked)}}),label:(0,x.jsx)("div",{children:e})}),le=(O||S||F||G||H)&&(ee||Q);return(0,x.jsx)(C.D,{handleSave:async()=>{j(!0);try{const e=[];for(const n of function*(){O&&(yield"VipMember");S&&(yield"NonVipMember");F&&(yield"Sponsor");H&&(yield"Prospect");G&&(yield"Competitor")}())e.push(n);const t=ee&&Q;await U.C.admin.reports.exportCompanies({companyTypes:e,inactivesInSeparateWorksheet:t?oe:null,includeActive:Q,includeInactive:ee})}finally{j(!1)}},saveButtonCaption:f?"Exporting...":"Export",disableSaveButton:!le||f,title:"Company Export Options",handleClose:e.handleClose,children:(0,x.jsxs)(E.ZP,{container:!0,spacing:2,children:[(0,x.jsxs)(E.ZP,{item:!0,xs:6,children:[(0,x.jsx)(N.Z,{color:"primary",component:"div",variant:"caption",children:"Company Types"}),(0,x.jsxs)("div",{className:re.checkboxHost,children:[ie("Members (Non-VIP)",S,!1,P),ie("Members (VIP)",O,!1,k),ie("Sponsors",F,!1,B),ie("Prospects",H,!1,Y),ie("Competitors",G,!1,V)]})]}),(0,x.jsxs)(E.ZP,{item:!0,xs:6,children:[(0,x.jsx)(N.Z,{color:"primary",component:"div",variant:"caption",children:"Status"}),(0,x.jsxs)("div",{className:re.checkboxHost,children:[ie("Active",Q,!1,J),ie("Inactive",ee,!1,te)]}),(0,x.jsx)("br",{}),(0,x.jsx)("br",{}),(0,x.jsx)(N.Z,{color:"primary",component:"div",variant:"caption",children:"Excel Options"}),(0,x.jsx)("div",{className:re.checkboxHost,children:ie("Put Inactives in their own Worksheet",oe,!(Q&&ee),se)})]})]})})},GenericDateRange:e=>{const t=a.useState(null),n=(0,r.Z)(t,2),o=n[0],s=n[1],i=a.useState(null),l=(0,r.Z)(i,2),d=l[0],c=l[1];return(0,x.jsxs)(C.D,{handleClose:e.handleClose,title:e.title,disableSaveButton:!o||!d,handleSave:async()=>{e.handleOk(o,d),e.handleClose()},saveButtonCaption:"Send",children:[(0,x.jsx)(N.Z,{variant:"body1",children:e.instructions}),(0,x.jsx)(pe.C,{title:e.dateCaption,startValue:o,endValue:d,onStartDateChanged:s,onEndDateChanged:c})]})},AddEditTransactionTypeModal:e=>{var t,n,o,s,i,l,d,c;const u=a.useState(null!==(t=null===(n=e.transactionType)||void 0===n?void 0:n.description)&&void 0!==t?t:""),p=(0,r.Z)(u,2),m=p[0],h=p[1],v=a.useState(null===(o=e.transactionType)||void 0===o||null===(s=o.defaultPoints)||void 0===s?void 0:s.toString()),g=(0,r.Z)(v,2),y=g[0],f=g[1],j=a.useState(null!==(i=null===(l=e.transactionType)||void 0===l?void 0:l.defaultNote)&&void 0!==i?i:""),Z=(0,r.Z)(j,2),w=Z[0],S=Z[1],N=a.useState(null===(d=e.transactionType)||void 0===d?void 0:d.fromPartyType),P=(0,r.Z)(N,2),I=P[0],D=P[1],T=a.useState(null===(c=e.transactionType)||void 0===c?void 0:c.toPartyType),A=(0,r.Z)(T,2),O=A[0],k=A[1];return(0,x.jsx)(C.D,{width:"xl",handleClose:e.handleClose,saveButtonCaption:e.transactionType?"Update":"Add",handleSave:async()=>
1{(I?!!O||(alert("Please select a 'To Account Type'"),!1):(alert("Please select a 'From Account Type'"),!1))&&(e.transactionType?(await e.updateExistingTransactionType({description:m,defaultNote:w,defaultPoints:y?parseInt(y,10):void 0,fromPartyType:I,id:e.transactionType.id,isEvent:!1,isManual:!0,toPartyType:O}),e.handleClose()):(await e.saveNewTransactionType({description:m,defaultNote:w,defaultPoints:y?parseInt(y,10):void 0,fromPartyType:I,isEvent:!1,isManual:!0,toPartyType:O}),e.handleClose()))},title:e.transactionType?"Edit Transaction Type":"Add Transaction Type",children:(0,x.jsxs)(E.ZP,{container:!0,spacing:2,children:[(0,x.jsx)(E.ZP,{item:!0,xs:12,children:(0,x.jsx)(b.Z,{fullWidth:!0,margin:"dense",variant:"outlined",label:"Description",value:m,onChange:e=>h(e.target.value)})}),(0,x.jsx)(E.ZP,{item:!0,xs:6,children:(0,x.jsx)(b.Z,{fullWidth:!0,margin:"dense",variant:"outlined",label:"Default Note",value:w,onChange:e=>S(e.target.value)})}),(0,x.jsx)(E.ZP,{item:!0,xs:6,children:(0,x.jsx)(b.Z,{type:"number",fullWidth:!0,margin:"dense",variant:"outlined",label:"Default Points",value:y,onChange:e=>f(e.target.value)})}),(0,x.jsx)(E.ZP,{item:!0,xs:6,children:(0,x.jsx)(tn,{label:"From Account Type",value:I,onChange:e=>D(e)})}),(0,x.jsx)(E.ZP,{item:!0,xs:6,children:(0,x.jsx)(tn,{label:"To Account Type",value:O,onChange:e=>k(e)})})]})})},SupplimentExcelSpreadsheetModal:e=>{const t=a.useRef(null),n=a.useState(!1),o=(0,r.Z)(n,2),s=o[0],i=o[1],l="BCN"===Yt.an?"Perk ID":"Club ID";return(0,x.jsx)(C.D,{disableSaveButton:s,handleClose:e.handleClose,saveButtonCaption:"OK",handleSave:async()=>{(async()=>{if(t.current.files&&0!==t.current.files.length){const a=t.current.files;i(!0);try{await U.C.admin.reports.addContactEmailsToSpreadsheet(a[0]),i(!1),e.handleClose()}catch(n){i(!1)}}else alert("Please select a file")})()},title:"Add Contact Emails",children:(0,x.jsxs)("div",{children:[(0,x.jsxs)(N.Z,{children:["This will add an email address column to any spreadsheet that contains a ",l," column. Use the Choose File button below to upload the spreadsheet without an email address."]}),(0,x.jsx)("br",{}),(0,x.jsx)("input",{ref:t,type:"file",name:"file"})]})})}},on=a.forwardRef(function(e,t){return(0,x.jsx)(c.Z,(0,l.Z)({direction:"left",ref:t},e))});let sn=(0,d.Pi)(nn=class extends a.Component{constructor(){super(...arguments),this.handleKeyDown=e=>{"Escape"===e.key&&Lt.Y.closeModal()}}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}render(){const e=Lt.Y.modal&&an[Lt.Y.modal.type],t=Lt.Y.modal?Lt.Y.modal.props:{};return(0,x.jsxs)(kt.Z,{fullScreen:this.props.isXs,fullWidth:this.props.isXs,maxWidth:Lt.Y.modelWidth,keepMounted:!0,open:Lt.Y.isModalOpen,onClose:()=>Lt.Y.closeModal(),TransitionComponent:on,children:[(0,x.jsx)(Rt.Z,{children:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("div",{id:"mobile-dialog-contents-portal"}),e&&(0,x.jsx)(e,(0,l.Z)({handleClose:Lt.Y.closeModal},t))]})}),(0,x.jsx)(Mt.Z,{id:"mobile-dialog-actions-portal"})]})}})||nn;const rn=()=>{const e=(0,Bt.Z)(),t=(0,Ft.Z)(e.breakpoints.only("xs"));return(0,x.jsx)(sn,{isXs:t})};var ln=n(50173);const dn=a.lazy(()=>Promise.all([n.e(5021),n.e(9301),n.e(5268),n.e(9579)]).then(n.bind(n,9579)).then(e=>({default:e.SponsorDrawer}))),cn=a.lazy(()=>Promise.all([n.e(5021),n.e(9617),n.e(9301),n.e(3393),n.e(1304)]).then(n.bind(n,51304)).then(e=>({default:e.MemberDrawer}))),un=a.lazy(()=>Promise.all([n.e(5021),n.e(9617),n.e(9301),n.e(2672),n.e(9914)]).then(n.bind(n,99914)).then(e=>({default:e.AdminDrawer}))),pn=a.lazy(()=>n.e(3039).then(n.bind(n,23039)).then(e=>({default:e.AdminRoutes}))),mn=a.lazy(()=>n.e(3738).then(n.bind(n,63738)).then(e=>({default:e.MemberRoutes}))),hn=a.lazy(()=>n.e(7130).then(n.bind(n,57130)).then(e=>({default:e.SponsorRoutes}))),vn=e=>"Admin"===e.userType?(0,x.jsx)(a.Suspense,{fallback:(0,x.jsx)(ln.j,{}),children:(0,x.jsx)(un,{children:(0,x.jsx)(pn,{})})}):"Sponsor"===e.userType?(0,x.jsx)(a.Suspense,{fallback:(0,x.jsx)(ln.j,{}),children:(0,x.jsx)(dn,{children:(0,x.jsx)(hn,{})})}):"Member"===e.userType?(0,x.jsx)(a.Suspense,{fallback:(0,x.jsx)(ln.j,{}),children:(0,x.jsx)(cn,{children:(0,x.jsx)(mn,{})})}):(0,x.jsx)("div",{});var gn=n(57482);const yn=a.lazy(()=>n.e(6061).then(n.bind(n,46061)).then(e=>({default:e.FlyoutPanel}))),bn=()=>{const e={display:"flex",height:"100vh",width:"100%",overflow:"hidden"},t={width:"100%",position:"absolute",top:0,left:0,zIndex:1e4},n=a.useState(!0),l=(0,r.Z)(n,2),d=l[0],c=l[1];function u(){c(!1)}const p=a.useCallback(()=>
1{if(!o.i.isAdminNotImpersonating)return;const e=e=>{e.focus({preventScroll:!0}),e.value.length>0&&e.select()},t=document.getElementById("global-search-box");if(t instanceof HTMLInputElement)return void e(t);const n=document.getElementById("global-search-toggle-button");n instanceof HTMLButtonElement&&(n.click(),window.setTimeout(()=>{const t=document.getElementById("global-search-box");t instanceof HTMLInputElement&&e(t)},300))},[]),m=a.useCallback(()=>{const e=document.querySelectorAll("[aria-label^='Next page']");if(e.length>0){const t=e.item(0);t&&t.click&&t.click()}},[]),h=a.useCallback(()=>{document.querySelectorAll("[aria-label^='Previous page']").forEach(e=>{const t=e;t&&t.click&&t.click()})},[]);return a.useEffect(()=>{const e=e=>{e.ctrlKey&&!e.altKey&&!e.metaKey&&("Space"===e.code||" "===e.key||"Spacebar"===e.key)?(e.preventDefault(),p()):e.ctrlKey&&"ArrowRight"===e.key?m():e.ctrlKey&&"ArrowLeft"===e.key&&h()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[p,m,h]),a.useEffect(()=>{const e=document.documentElement.style.overflow,t=document.body.style.overflow;return document.documentElement.style.overflow="hidden",document.body.style.overflow="hidden",()=>{document.documentElement.style.overflow=e,document.body.style.overflow=t}},[]),(0,x.jsx)(s.Qj,{render:()=>{const n=o.i.displayUserType,s=Lt.Y.pendingAjaxCalls>0;return(0,x.jsxs)("div",{style:e,children:[(0,x.jsx)(i.ZP,{}),(0,x.jsx)(vn,{drawerWidth:240,closeDrawer:u,userType:n,isDrawerOpen:d}),(0,x.jsx)(a.Suspense,{fallback:null,children:(0,x.jsx)(yn,{})}),(0,x.jsx)(rn,{}),s?(0,x.jsx)(gn.Z,{style:t,color:"secondary"}):null]})}})},fn=e=>(a.useEffect(()=>{o.i.getMyInfo()},[]),(0,x.jsx)(s.Qj,{render:()=>o.i.myInfoLoading||!o.i.myInfo?(0,x.jsx)("div",{}):(0,x.jsx)(bn,{})}))},66616:(e,t,n)=>{n.d(t,{j:()=>d});n(72791);var a=n(52174),o=n(11135),s=n(20890),r=n(58406),i=n(23786),l=n(80184);const d=e=>{const t=(0,a.Z)(t=>(0,o.Z)({root:{marginTop:t.spacing(2)},optionDropdown:{minWidth:200,marginLeft:10},label:{display:"inline-block",marginLeft:"Catalog"===e.context?0:20,color:"Catalog"===e.context?t.palette.primary.main:"black"}}))();if(0===e.options.length)return(0,l.jsx)("div",{});return(0,l.jsxs)("div",{className:t.root,children:[(0,l.jsx)(s.Z,{className:t.label,display:"inline",children:"Catalog"===e.context?"Select Option:":"Option:"}),(0,l.jsx)(r.Z,{className:t.optionDropdown,margin:"dense",variant:"outlined",id:"".concat(e.productId,"+options"),value:e.selectedOptionId,onChange:t=>{e.setSelectedOptionId(t.target.value)},children:e.options.map(e=>(0,l.jsxs)(i.Z,{value:e.id,children:[e.name," ",e.deletedOn&&"(No Longer Available)"]},e.id))})]})}},32331:(e,t,n)=>{n.d(t,{o:()=>i});var a=n(4934),o=n(50427),s=n(51798),r=n(82460);const i={sponsor:a.Z[600],member:o.Z[600],prospect:s.Z[500],competitor:r.Z.A700}},46411:(e,t,n)=>{n.d(t,{R:()=>v});var a=n(29439),o=n(72791),s=n(52174),r=n(11135),i=n(93044),l=n(80526),d=n(71715),c=n(23786),u=n(72194),p=n(66708),m=n(80184);const h=e=>void 0!==e.onImageUploaded,v=e=>{const t=o.useState(null),n=(0,a.Z)(t,2),v=n[0],g=n[1],y=(0,s.Z)(t=>(0,r.Z)({avatar:{height:"large"===e.size?80:40,width:"large"===e.size?80:40},imageButton:{background:"none",border:0,padding:0,cursor:"pointer",lineHeight:0},uploadedLogo:{maxHeight:90,maxWidth:120}}))(),b=e.website?(0,l.X3)(e.website):void 0,f=t=>{g(null),u.Y.showModal({type:"AddUpdateContactPhotoModal",props:{handleFileAdded:async t=>{h(e)&&(await e.onImageUploaded(t),"Sponsor"===e.companyType?await u.Y.loadSponsorInfo(e.companyId):"Member"===e.companyType&&await u.Y.loadPurchaserInfo(e.companyId))}}})},x=()=>{h(e)&&e.onRemoveImage(),g(null)},j=e=>{g(e.currentTarget)};return(0,m.jsxs)(m.Fragment,{children:[(()=>{const t=h(e)&&p.i.isAdminNotImpersonating;if(e.imageUri){const n=(0,m.jsx)("img",{className:y.uploadedLogo,src:e.imageUri,alt:e.companyName});return t?(0,m.jsx)("button",{type:"button",className:y.imageButton,"aria-label":"Edit image for ".concat(e.companyName),onClick:j,children:n}):n}if(b){const n=(0,m.jsx)("img",{className:y.avatar,src:(0,l.aW)(b),alt:e.companyName});return t?(0,m.jsx)("button",{type:"button",className:y.imageButton,"aria-label":"Edit image for ".concat(e.companyName),onClick:j,children:n}):n}{const n=(0,m.jsx)(i.Z,{src:"/images/no-profile.png",alt:e.companyName,className:y.avatar});return t?(0,m.jsx)("button",{type:"button",className:y.imageButton,"aria-label":"Edit image for ".concat(e.companyName),onClick:j,children:n}):n}})(),h(e)&&p.i.isAdminNotImpersonating&&(0,m.jsxs)(d.Z,{open:Boolean(v),onClose:()=>g(null),anchorOrigin:{vertical:0,horizontal:75},anchorEl:v,children:[h(e)&&!e.imageUri&&(0,m.jsx)(c.Z,{onClick:f,children:"Add Image"}),h(e)&&e.imageUri&&(0,m.jsx)(c.Z,{onClick:f,children:"Change Image"}),h(e)&&e.imageUri&&(0,m.jsx)(c.Z,{onClick:x,children:"Remove Image"})]})]})}},12256:(e,t,n)=>{n.d(t,{b:()=>i});n(72791);var a=n(52174),o=n(11135),s=n(46411),r=n(80184);const i=e=>{const t=(0,a.Z)(e=>(0,o.Z)({companyInfoHeader:{display:"grid",gridTemplateColumns:"auto 1fr",alignItems:"center",marginBottom:e.spacing(3),gridGap:e.spacing(2)}}))(),n=e.website&&e.website.indexOf("http")<0?"http://".concat(e.website):e.website;return(0,r.jsxs)("div",{className:t.companyInfoHeader,children:[(0,r.jsx)(s.R,{size:"large",companyName:e.companyName,website:e.website,imageUri:e.imageUrl}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{style:{marginTop:0,marginBottom:0},children:"".concat(e.companyName," (").concat(e.identifier,")")}),(0,r.jsx)("a",{rel:"noopener noreferrer",href:n,target:"_blank",children:e.website})]})]})}},13906:(e,t,n)=>{n.d(t,{A:()=>d});n(72791);var a=n(52174),o=n(11135),s=n(38247),r=n(88884),i=n(84177),l=n(80184);const d=e=>{const t=(0,a.Z)(e=>(0,o.Z)({root:{},location:{marginBottom:e.spacing(2)}}))();return(0,l.jsx)(r.E,{title:"Locations",children:(()=>
1{if(e.locations)return 0===e.locations.length?(0,l.jsx)(s.P,{message:"No locations found"}):e.locations.map((e,n)=>(0,l.jsxs)("div",{className:t.location,children:[(0,l.jsx)("div",{children:e.address1}),(0,l.jsx)("div",{children:e.address2}),e.city?(0,l.jsx)("div",{children:"".concat(e.city,", ").concat(e.state," ").concat(e.zip)}):void 0,e.primaryContact?(0,l.jsx)("div",{children:(0,l.jsx)("strong",{children:e.primaryContact})}):void 0,e.phoneNumbers.map((e,t)=>(0,l.jsx)(i.B,{number:e.number},t))]},n))})()})}},21087:(e,t,n)=>{n.d(t,{c:()=>i});n(72791);var a=n(52174),o=n(11135),s=n(20890),r=n(80184);const i=e=>{const t=(0,a.Z)(e=>(0,o.Z)({marketingInformation:{marginBottom:e.spacing(3)}}))();return(0,r.jsx)(s.Z,{className:t.marketingInformation,variant:"body2",children:e.marketingInformation})}},7696:(e,t,n)=>{n.d(t,{k:()=>i});n(72791);var a=n(38247),o=n(88884),s=n(84177),r=n(80184);const i=e=>(0,r.jsx)(o.E,{title:"Primary Contact",children:(()=>{if(e.contactInfo)return e.contactInfo.primaryContactName?(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{children:e.contactInfo.primaryContactName}),e.contactInfo.primaryContactPhoneNumber&&(0,r.jsx)("div",{children:(0,r.jsx)(s.B,{number:e.contactInfo.primaryContactPhoneNumber})})]}):(0,r.jsx)(a.P,{message:"Not found"})})()})},67490:(e,t,n)=>{n.d(t,{b:()=>S});n(72791);var a=n(52174),o=n(11135),s=n(17508),r=n(72426),i=n.n(r),l=n(13906),d=n(21087),c=n(12256),u=n(7696),p=n(88884),m=n(20890),h=n(56125),v=n(13400),g=n(22885),y=n(81131),b=n(80184);const f=e=>{const t=(0,a.Z)(e=>({mobileGroupHeaderRoot:{marginBottom:e.spacing(2)},title:{display:"block",padding:"3px 6px",cursor:"pointer"},content:{paddingLeft:e.spacing(1)}}))();return(0,b.jsxs)("div",{className:t.mobileGroupHeaderRoot,children:[(0,b.jsxs)(m.Z,{classes:{root:t.title},variant:"caption",color:"primary",onClick:()=>e.onIsExpandedChanged(!e.isExpanded),children:[e.title,(0,b.jsx)(v.Z,{size:"small",onClick:()=>e.onIsExpandedChanged(!e.isExpanded),children:e.isExpanded?(0,b.jsx)(g.Z,{}):(0,b.jsx)(y.Z,{})})]}),(0,b.jsx)(h.Z,{in:e.isExpanded,children:(0,b.jsx)("div",{className:t.content,children:e.children})})]})};var x=n(14659),j=n(54046),C=n(9150),Z=n(72194),w=n(77257);const S=e=>{const t=(0,a.Z)(e=>(0,o.Z)({root:{paddingBottom:e.spacing(4)},points:{display:"flex",justifyContent:"space-between"},pointHistory:{display:"grid",gridTemplateColumns:"1fr 1fr",marginLeft:e.spacing(2)},number:{textAlign:"right"},group:{marginTop:e.spacing(2)},eventLink:{display:"block",marginBottom:2}})),n=e.memberInfo,r=n.name,m=n.identifier,h=n.marketingInformation,v=n.computedBalance,g=n.website,y=n.enrollDate,S=n.last12Months,N=n.last36Months,P=n.yearToDate,E=n.imageUrl,I=t(),D="BCN"===x.an?"Perk":"Club",T=e.memberInfo.redemptions.reduce((e,t)=>e+t.quantity,0),A=t=>{if(e.disableLinks)return;t.stopPropagation(),t.preventDefault();const n=t.target.getAttribute("data-event-id"),a=e.memberInfo.events.find(e=>e.eventId===n),o=e.memberInfo.grandDestinations.find(e=>e.eventId===n),s=a||o;Z.Y.setFlyoutOpen(!1),Z.Y.showEventAttendees(s.eventName,e.memberInfo.name,s.attendees)},O=t=>e.disableLinks?(0,b.jsx)("div",{children:t.eventName},t.companyId):(0,b.jsx)(C.rU,{className:I.eventLink,"data-event-id":t.eventId,onClick:A,to:"/bogus",children:t.eventName},t.eventId);return(0,b.jsx)(w.Qj,{render:()=>{var t;return(0,b.jsxs)("div",{className:I.root,children:[(0,b.jsx)(c.b,{companyName:r,identifier:m,website:g,imageUrl:E}),(0,b.jsx)(d.c,{marketingInformation:h}),(0,b.jsx)(u.k,{contactInfo:e.memberInfo}),(0,b.jsx)(p.E,{title:"Enroll Date",children:(0,b.jsx)("span",{children:i()(y).format("LL")})}),(0,b.jsx)(p.E,{title:"Point Balance",children:(0,b.jsx)("span",{children:(0,s.uf)(v)})}),(0,b.jsx)(p.E,{title:"".concat(D," Point Accumulation History"),children:(0,b.jsxs)("div",{className:I.pointHistory,children:[(0,b.jsx)("strong",{children:"Year-to-Date"}),(0,b.jsx)("div",{className:I.number,children:(0,s.uf)(P)}),(0,b.jsx)("strong",{children:"Last 12 Months"}),(0,b.jsx)("div",{className:I.number,children:(0,s.uf)(S)}),(0,b.jsx)("strong",{children:"Last 36 Months"}),(0,b.jsx)("div",{className:I.number,children:(0,s.uf)(N)})]})}),(0,b.jsx)(l.A,{locations:null===(t=e.memberInfo)||void 0===t?void 0:t.locations}),(0,b.jsx)(f,{title:"Redemptions (".concat(T,")"),onIsExpandedChanged:Z.Y.
1setMemberInfoRedemptionsExpanded,isExpanded:Z.Y.memberInfoRedemptionsExpanded,children:(0,b.jsx)("div",{children:(0,b.jsx)(j.Y,{size:"small",redemptions:e.memberInfo.redemptions})})}),(0,b.jsxs)(f,{onIsExpandedChanged:Z.Y.setMemberInfoEventsExpanded,isExpanded:Z.Y.memberInfoEventsExpanded,title:"Events (".concat(e.memberInfo.events.length,")"),children:[e.memberInfo.events.map(O),0===e.memberInfo.events.length&&(0,b.jsx)("div",{children:"No events found"})]}),(0,b.jsxs)(f,{onIsExpandedChanged:Z.Y.setMemberInfoGrandDestinationsExpanded,isExpanded:Z.Y.memberInfoGrandDestinationsExpanded,title:"Grand Destinations (".concat(e.memberInfo.grandDestinations.length,")"),children:[e.memberInfo.grandDestinations.map(O),0===e.memberInfo.grandDestinations.length&&(0,b.jsx)("div",{children:"No Grand Destinations found"})]}),(0,b.jsxs)(f,{onIsExpandedChanged:Z.Y.setMemberUsedCategoriesExpanded,isExpanded:Z.Y.memberUsedCategoriesExpanded,title:"Used Categories (".concat(e.memberInfo.usedCategories.length,")"),children:[e.memberInfo.usedCategories.map(e=>(0,b.jsx)("div",{children:e})),0===e.memberInfo.usedCategories.length&&(0,b.jsx)("div",{children:"No Used Categories found"})]})]})}})}},54046:(e,t,n)=>{n.d(t,{Y:()=>p});n(72791);var a=n(52174),o=n(11135),s=n(79836),r=n(53382),i=n(56890),l=n(53994),d=n(35855),c=n(17508),u=n(80184);const p=e=>{const t=(0,a.Z)(t=>(0,o.Z)({root:{},tableCellRoot:{fontSize:"small"===e.size?12:"unset"}}))();return(0,u.jsxs)(s.Z,{size:"small",children:[(0,u.jsx)(i.Z,{children:(0,u.jsxs)(d.Z,{children:[(0,u.jsx)(l.Z,{classes:{root:t.tableCellRoot},children:"Category"}),(0,u.jsx)(l.Z,{classes:{root:t.tableCellRoot},align:"right",children:"Qty"}),(0,u.jsx)(l.Z,{classes:{root:t.tableCellRoot},align:"right",children:"Points"})]})}),(0,u.jsx)(r.Z,{children:e.redemptions.map(e=>(0,u.jsxs)(d.Z,{children:[(0,u.jsx)(l.Z,{classes:{root:t.tableCellRoot},children:e.typeName}),(0,u.jsx)(l.Z,{classes:{root:t.tableCellRoot},align:"right",children:(0,c.uf)(e.quantity)}),(0,u.jsx)(l.Z,{classes:{root:t.tableCellRoot},align:"right",children:(0,c.uf)(e.points)})]},e.typeId))})]})}},81579:(e,t,n)=>{n.d(t,{U:()=>l});var a=n(1413),o=n(45987),s=(n(72791),n(30948)),r=n(80184);const i=["inputRef","onChange","prefix"];function l(e){const t=e.inputRef,n=e.onChange,l=(e.prefix,(0,o.Z)(e,i));return(0,r.jsx)(s.h3,(0,a.Z)((0,a.Z)({},l),{},{getInputRef:t,onValueChange:t=>{n({target:{value:t.value,id:e.id}})},decimalScale:e.decimalScale,allowNegative:e.allowNegative,min:e.min,thousandSeparator:!0,prefix:e.prefix}))}},4386:(e,t,n)=>{n.d(t,{b:()=>c});var a=n(29439),o=n(72791),s=n(52174),r=n(11135),i=n(7585),l=n(67490),d=n(80184);const c=e=>{const t=o.useState(),n=(0,a.Z)(t,2),c=n[0],u=n[1],p=(0,s.Z)(e=>(0,r.Z)({root:{}}));o.useEffect(()=>{e.companyId?(async e=>{const t=await i.C.sponsors.purchasers.getInfo(e);u(t)})(e.companyId):u(void 0)},[e.companyId]);const m=p();return(0,d.jsx)("div",{className:m.root,children:c&&(0,d.jsx)(l.b,{disableLinks:!0,memberInfo:c})})}},32042:(e,t,n)=>{n.d(t,{e:()=>v});var a=n(1413),o=n(29439),s=n(72791),r=n(68096),i=n(47071),l=n(7399),d=n(48550),c=n(13239),u=n(8696),p=n(7585),m=n(90485),h=n(80184);const v=e=>{var t,n,v;const g=s.useState(null!==(t=e.onlyAvailableOptions)&&void 0!==t?t:[]),y=(0,o.Z)(g,2),b=y[0],f=y[1],x=s.useState(!1),j=(0,o.Z)(x,2),C=j[0],Z=j[1],w=s.useState(""),S=(0,o.Z)(w,2),N=S[0],P=S[1],E=(0,u.Nr)(N,500),I=e.optionsFilter;s.useEffect(()=>{if(E&&!e.onlyAvailableOptions){const t=async t=>{Z(!0);const n=await p.C.admin.search.searchAccounts({search:t,isInEvents:e.isInEvents});if(n){if(n.searchTerm===E){let e=n.accounts.map(e=>({value:e.id,label:(0,m.m)(e),computedBalance:e.computedBalance,companyType:e.companyType,companyId:e.companyId}));I&&(e=I(e)),window.setTimeout(()=>{f(e),Z(!1)},100),f(e),Z(!1)}}else Z(!1)};t(E)}},[E,I,e.onlyAvailableOptions,e.isInEvents]);const D=null!==(n=e.noRecordsText)&&void 0!==n?n:"No companies found";return(0,h.jsxs)(r.Z,{fullWidth:!0,variant:"filled",className:null!==(v=e.className)&&void 0!==v?v:"",children:[(0,h.jsx)(l.Z,{value:e.value,noOptionsText:N?D:"Type to search",onInputChange:t=>{if(!t)return;e.onlyAvailableOptions||f([]);const n=t.currentTarget.value||"";P(n)},options:b,loading:C,onBlur:e.onBlur,loadingText:"Searching accounts...",isOptionEqualToValue:(e,t)=>
1e===t,getOptionLabel:e=>"string"===typeof e||"string"===typeof e?e:"string"===typeof e.label?e.label:e.label.label,onChange:(t,n)=>(e.onlyAvailableOptions||f([]),e.onChange(n)),renderInput:t=>(0,h.jsx)(d.Z,(0,a.Z)((0,a.Z)({},t),{},{variant:"outlined",error:Boolean(e.errorMessage),label:e.label,style:{margin:0},InputProps:(0,a.Z)((0,a.Z)({},t.InputProps),{},{endAdornment:(0,h.jsxs)(s.Fragment,{children:[C?(0,h.jsx)(c.Z,{color:"inherit",size:20}):null,t.InputProps.endAdornment]})}),margin:"dense"}))}),(0,h.jsx)(i.Z,{variant:"standard",className:e.errorClassName,children:e.errorMessage})]})}},17960:(e,t,n)=>{n.d(t,{r:()=>v});var a=n(1413),o=n(29439),s=n(72791),r=n(52174),i=n(11135),l=n(7399),d=n(63733),c=n(48550),u=n(13239),p=n(8696),m=n(7585),h=n(80184);const v=e=>{var t;const n=s.useState(!1),v=(0,o.Z)(n,2),g=v[0],y=v[1],b=s.useState([]),f=(0,o.Z)(b,2),x=f[0],j=f[1],C=s.useState(!1),Z=(0,o.Z)(C,2),w=Z[0],S=Z[1],N=(0,p.Nr)(e.newValue,500);s.useEffect(()=>{if(N){const t=async t=>{let n;if(y(!0),"Admin"===e.currentUserType){console.log("Admin search");const e=await m.C.admin.search.unifiedSearch({search:t,activeOnly:!1,includeContacts:!1,companyTypes:["Competitor","Sponsor","Prospect"]});n={companies:e.companies.map(e=>({id:e.id,name:e.name,identifier:e.identifier.toString(),computedBalance:e.computedBalance,companyType:e.companyType,isActive:e.isActive,searchScore:e.searchScore})),searchTerm:e.searchTerm}}else if("Member"===e.currentUserType){var a;console.log("Member search"),n=await m.C.shared.sponsors.searchSponsors(t,null!==(a=e.includeCompetitors)&&void 0!==a&&a)}else console.log("Unknown user type: ",e.currentUserType);if(n){if(n.searchTerm===N){const t=n.companies.map(t=>{const n=e.hideCompanyType?t.name:"".concat(t.name," (").concat(t.companyType,")");return{value:t.id,label:n}});j(t),y(!1),S(!1)}}else y(!1)};t(N)}},[N,e.currentUserType,e.hideCompanyType,e.includeCompetitors]);const P=(0,r.Z)(e=>(0,i.Z)({root:{},autoComplete:{},note:{fontSize:"0.9rem",color:e.palette.grey[500]},noRecords:{fontSize:"0.9rem",color:e.palette.grey[800]},whiteBackground:{background:"white"}}))(),E=N===e.newValue&&N.length>0&&!g&&!w&&0===x.length;return(0,h.jsxs)("div",{children:[(0,h.jsx)(l.Z,{disabled:e.disabled,noOptionsText:g?"Searching...":"No companies found",className:(0,d.Z)(P.autoComplete),options:x,loading:g,freeSolo:!0,filterOptions:(e,t)=>e,loadingText:"Searching companies...",isOptionEqualToValue:(e,t)=>e.value===t.value,getOptionLabel:e=>"string"===typeof e?e:"string"===typeof e.label?e.label:"string"===typeof e?e:"unknown",onChange:(t,n)=>{n&&"object"===typeof n?e.setExistingValue(n):"string"===typeof n&&e.setNewValue(n)},onInputChange:t=>{if(!t)return;j([]);const n=t.currentTarget.value||"";e.setNewValue(n),S(!0)},value:null!==(t=e.existingValue)&&void 0!==t?t:{label:e.newValue,value:""},renderInput:t=>(0,h.jsx)(c.Z,(0,a.Z)((0,a.Z)({},t),{},{variant:"outlined",label:e.label,value:e.newValue,placeholder:"Search by ID or business name",InputProps:(0,a.Z)((0,a.Z)({},t.InputProps),{},{endAdornment:(0,h.jsxs)(s.Fragment,{children:[g?(0,h.jsx)(u.Z,{color:"inherit",size:20}):null,t.InputProps.endAdornment]})}),margin:"dense"}))}),E&&!e.hideMessages?(0,h.jsx)("div",{className:P.noRecords,children:"No suppliers found"}):void 0,!e.hideMessages&&(0,h.jsx)("div",{className:P.note,children:"If company is not found, a new Competitor will be created with this Category"})]})}},50478:(e,t,n)=>{n.d(t,{e:()=>g});var a=n(1413),o=n(29439),s=n(72791),r=n(52174),i=n(11135),l=n(7399),d=n(48550),c=n(13239),u=n(63733),p=n(8696),m=n(7585),h=n(32331),v=n(80184);const g=e=>{const t=s.useState(!1),n=(0,o.Z)(t,2),g=n[0],y=n[1],b=s.useState(e.selectedOption?[e.selectedOption]:[]),f=(0,o.Z)(b,2),x=f[0],j=f[1],C=s.useState(!1),Z=(0,o.Z)(C,2),w=Z[0],S=Z[1],N=s.useState(""),P=(0,o.Z)(N,2),E=P[0],I=P[1],D=(0,r.Z)(t=>{var n;return(0,i.Z)({root:{},autoComplete:{minWidth:null!==(n=e.minWidth)&&void 0!==n?n:"30rem"},companyTypes:{display:"inline-block",marginLeft:t.spacing(1),fontSize:"smaller",color:"white",padding:t.spacing(0,1),borderRadius:"10px"},sponsor:{backgroundColor:h.o.sponsor},competitor:{backgroundColor:h.o.competitor},prospect:{backgroundColor:h.o.prospect},member:{backgroundColor:h.o.member}})}),T=e=>{if(!e)return;const t=e.currentTarget.value||"";I(t),y(!1)},A=(0,p.Nr)(E,500);s.useEffect(()=>{e.selectedOption?I(e.selectedOption.label):(console.log("Setting text box value to empty"),I(""))},[e.selectedOption]),s.useEffect(()=>{const t=async t=>{S(!0);const n=(()=>
1{if("Admin"===e.userType){const t=e.companyTypes?e.companyTypes.current:[],n=!e.searchInactives;return async e=>{const a=await m.C.admin.search.unifiedSearch({search:e,activeOnly:n,includeContacts:!1,companyTypes:t});return{companies:a.companies.map(e=>({id:e.id,name:e.name,identifier:e.identifier.toString(),computedBalance:e.computedBalance,companyType:e.companyType,isActive:e.isActive,searchScore:e.searchScore})),searchTerm:a.searchTerm}}}if("Sponsor"===e.userType)return e=>m.C.sponsors.purchasers.search(e);if("Member"===e.userType)return e=>m.C.shared.sponsors.searchSponsors(e);throw Error("Invalid property types")})(),a=await n(t);if(a.searchTerm===A){let t=a.companies.map(e=>({value:e.id,companyType:e.companyType,label:e.isActive?"".concat(e.name," (").concat(e.identifier,")"):"".concat(e.name," (").concat(e.identifier,") - Inactive")}));e.hiddenOptionIds&&(t=t.filter(t=>!e.hiddenOptionIds.includes(t.value))),j(t),S(!1),y(!0)}};A&&t(A)},[A,e.userType,e.companyTypes,e.hiddenOptionIds,e.searchInactives]);const O=D();return(0,v.jsx)("div",{className:O.root,children:(0,v.jsx)(l.Z,{noOptionsText:g?"No companies found":"Enter text to search companies",className:(0,u.Z)(O.autoComplete),options:x,disabled:e.disabled,loading:w,filterOptions:(e,t)=>e,loadingText:"Searching companies...",isOptionEqualToValue:(e,t)=>e.value===(null===t||void 0===t?void 0:t.value),getOptionLabel:e=>"string"===typeof e?e:"string"===typeof e.label?e.label:e.label.label,onChange:(t,n)=>e.onSelectedOptionChanged(n),onInputChange:T,renderOption:(t,n)=>n.companyType&&e.companyTypes&&e.companyTypes.current.length>1?(0,v.jsxs)("li",(0,a.Z)((0,a.Z)({},t),{},{children:[(0,v.jsx)("span",{children:n.label}),(0,v.jsx)("span",{className:(0,u.Z)(O.companyTypes,{[O.competitor]:"Competitor"===n.companyType,[O.sponsor]:"Sponsor"===n.companyType,[O.member]:"Member"===n.companyType,[O.prospect]:"Prospect"===n.companyType}),children:n.companyType})]})):(0,v.jsx)("li",(0,a.Z)((0,a.Z)({},t),{},{children:n.label})),value:e.selectedOption||null,renderInput:t=>(0,v.jsx)(d.Z,(0,a.Z)((0,a.Z)({},t),{},{variant:"outlined",label:e.label?e.label:"Select Company",placeholder:"Search companies",style:{margin:0},InputProps:(0,a.Z)((0,a.Z)({},t.InputProps),{},{style:{color:"unset",fontWeight:"unset"},endAdornment:(0,v.jsxs)(s.Fragment,{children:[w?(0,v.jsx)(c.Z,{color:"inherit",size:20}):null,t.InputProps.endAdornment]})}),margin:"dense"}))})})}},73237:(e,t,n)=>{n.d(t,{L:()=>c});var a=n(1413),o=n(72791),s=n(7399),r=n(48550),i=n(81238),l=n(62850),d=n(80184);const c=e=>{var t;o.useEffect(()=>{l.n.ensureEmailTypesFetched()},[]);const n=l.n.isLoading("emailTypes"),c=l.n.getEnum("emailTypes").map(i.To),u=null!==(t=c.find(t=>t.value===e.value))&&void 0!==t?t:null;return(0,d.jsx)(s.Z,{value:u,onChange:(t,n)=>{e.onChange(null===n||void 0===n?void 0:n.value)},renderInput:t=>(0,d.jsx)(r.Z,(0,a.Z)((0,a.Z)({},t),{},{variant:"outlined",error:e.error,margin:"dense",placeholder:"Type",label:"Type",fullWidth:!0})),onBlur:e.handleBlur,options:c,getOptionLabel:e=>"string"===typeof e?e:"string"===typeof e.label?e.label:e.label.label,loading:n})}},92015:(e,t,n)=>{n.d(t,{A:()=>d});var a=n(1413),o=(n(72791),n(52174)),s=n(11135),r=n(7399),i=n(48550),l=n(80184);const d=e=>{var t,n;const d=(0,o.Z)(t=>(0,s.Z)({root:{minWidth:"10rem"},noOptionsClass:{pointerEvents:"none",width:500},input:{backgroundColor:e.makeBackgroundWhite?"white":"unset"}}))();return(0,l.jsx)(r.Z,{onChange:(t,n)=>{e.setSelectedOption(n)},noOptionsText:null!==(t=e.noOptionsText)&&void 0!==t?t:"No options",getOptionLabel:e=>"string"===typeof e?e:"string"===typeof e.label?e.label:e.label.label,classes:{noOptions:d.noOptionsClass,inputRoot:d.input},className:d.root,options:e.options.filter(t=>!e.invalidOptionIds.some(e=>t.value===e)),freeSolo:!1,disabled:e.disabled,disableClearable:!e.canClear,value:null!==(n=e.selectedOption)&&void 0!==n?n:null,loading:e.loading,renderOption:(t,n)=>e.renderOption?(0,l.jsx)("li",(0,a.Z)((0,a.Z)({},t),{},{children:e.renderOption(n)})):(0,l.jsx)("li",(0,a.Z)((0,a.Z)({},t),{},{children:n.label})),renderInput:t=>{var n;return(0,l.jsx)(i.Z,(0,a.Z)((0,a.Z)({},t),{},{label:null!==(n=e.label)&&void 0!==n?n:"",variant:"outlined",style:{minWidth:100},error:e.error,margin:"dense"}))}})}},87405:(e,t,n)=>{n.d(t,{Z:()=>c});var a=n(1413),o=n(72791),s=n(7399),r=n(48550),i=n(81238),l=n(62850),d=n(80184);const c=e=>{var t;o.useEffect(()=>{l.n.ensurePhoneNumberTypesFetched()},[]);const n=l.n.isLoading("phoneNumberTypes"),c=l.n.getEnum("phoneNumberTypes").map(i.To),u=null!==(t=c.find(t=>t.value===e.value))&&void 0!==t?t:null;return(0,d.jsx)(s.Z,{value:u,onChange:(t,n)=>{n&&e.onChange(n.value)},renderInput:t=>(0,d.jsx)(r.Z,(0,a.Z)((0,a.Z)({},t),{},{variant:"outlined",error:e.error,margin:"dense",label:"Type",placeholder:"Type",fullWidth:!0})),onBlur:e.handleBlur,options:c,getOptionLabel:e=>"string"===typeof e?e:"string"===typeof e.label?e.label:e.label.label,loading:n})}},47191:(e,t,n)=>{n.d(t,{N:()=>r});var a=n(29439),o=(n(72791),n(94070)),s=n(80184);const r=e=>{let t=e.isValid,n=e.submitCount,r=e.errors;if(t||0===n)return null;const i=Object.entries(r).filter(e=>"string"===typeof(0,a.Z)(e,2)[1]);return 0===i.length?null:(0,s.jsxs)(o.Z,{severity:"error",sx:{mb:2},children:[(0,s.jsx)("strong",{children:"Please fix the following errors:"}),(0,s.jsx)("ul",{style:{margin:"8px 0 0 0",paddingLeft:"20px"},children:i.map(e=>{let t=(0,a.Z)(e,2),n=t[0],o=t[1];return(0,s.jsxs)("li",{children:[(0,s.jsxs)("strong",{children:[(r=n,r.replace(/([A-Z])/g," $1").replace(/^./,e=>e.toUpperCase()).trim()),":"]})," ",String(o)]},n);var r})})]})}},68482:(e,t,n)=>{n.d(t,{C:()=>P});
1var a=n(1413),o=n(29439),s=n(72791),r=n(52174),i=n(11135),l=n(68096),d=n(20890),c=n(48550),u=n(71715),p=n(23786),m=n(13400),h=n(90772),v=n(20068),g=n(36571),y=n(30905),b=n(64723),f=n(80184);const x=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0,0),j=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate(),23,59,59,999),C=e=>new Date(e.getFullYear(),e.getMonth(),1,0,0,0,0),Z=e=>new Date(e.getFullYear(),e.getMonth()+1,0,23,59,59,999),w=e=>new Date(e,0,1,0,0,0,0),S=e=>new Date(e,11,31,23,59,59,999),N=(e,t)=>{const n=new Date(e);return n.setDate(n.getDate()+t),n},P=e=>{const t=(0,r.Z)(e=>(0,i.Z)({root:{},dates:{display:"grid",gridTemplateColumns:"1fr 1fr auto",gridGap:e.spacing(2),alignItems:"center"},menuButtonHost:{display:"flex",justifyContent:"flex-end"},error:{color:"red",display:"inline-block",marginLeft:e.spacing(2)}}))(),n=s.useState(null),P=(0,o.Z)(n,2),E=P[0],I=P[1],D=Boolean(E),T=()=>{I(null)},A=(new Date).getFullYear(),O=[{key:"this-month",label:"This Month",getRange:()=>{const e=new Date;return{start:C(e),end:Z(e)}}},{key:"last-month",label:"Last Month",getRange:()=>{const e=new Date,t=new Date(e.getFullYear(),e.getMonth()-1,1);return{start:C(t),end:Z(t)}}},{key:"this-quarter",label:"This Quarter",getRange:()=>{const e=new Date,t=3*Math.floor(e.getMonth()/3),n=new Date(e.getFullYear(),t,1),a=new Date(e.getFullYear(),t+3,0);return{start:x(n),end:j(a)}}},{key:"last-quarter",label:"Last Quarter",getRange:()=>{const e=new Date,t=3*Math.floor(e.getMonth()/3),n=new Date(e.getFullYear(),t,0,23,59,59,999),a=new Date(n.getFullYear(),n.getMonth()-2,1);return{start:x(a),end:j(n)}}},{key:"this-year",label:"This Year",getRange:()=>{const e=(new Date).getFullYear();return{start:w(e),end:S(e)}}},{key:"last-year",label:"Last Year",getRange:()=>{const e=(new Date).getFullYear()-1;return{start:w(e),end:S(e)}}},{key:"year-to-date",label:"Year to Date",getRange:()=>{const e=new Date;return{start:w(e.getFullYear()),end:j(e)}}},{key:"last-7-days",label:"Last 7 Days",getRange:()=>{const e=new Date;return{start:x(N(e,-6)),end:j(e)}}},{key:"last-30-days",label:"Last 30 Days",getRange:()=>{const e=new Date;return{start:x(N(e,-29)),end:j(e)}}},{key:"last-90-days",label:"Last 90 Days",getRange:()=>{const e=new Date;return{start:x(N(e,-89)),end:j(e)}}},{key:"past-12-months",label:"Past 12 Months",getRange:()=>{const e=new Date,t=new Date(e.getFullYear(),e.getMonth()-11,1);return{start:x(t),end:j(e)}}},...Array.from({length:6},(e,t)=>{const n=A-t;return{key:"year-".concat(n),label:"".concat(n),getRange:()=>({start:w(n),end:S(n)})}})],k=e.startValue&&e.endValue&&e.startValue>e.endValue;return(0,f.jsx)(g._,{dateAdapter:b.H,children:(0,f.jsxs)("div",{style:e.style,className:t.root,children:[(0,f.jsxs)(d.Z,{variant:"caption",color:"primary",children:[e.title,k?(0,f.jsx)("span",{className:t.error,children:"End date is before start date"}):void 0]}),(0,f.jsxs)("div",{className:t.dates,children:[(0,f.jsx)(l.Z,{children:(0,f.jsx)(y.M,{inputFormat:"MM/dd/yyyy",label:"Start",value:e.startValue,onChange:t=>e.onStartDateChanged(t),renderInput:t=>(0,f.jsx)(c.Z,(0,a.Z)((0,a.Z)({},t),{},{style:{margin:0},required:!0,error:Boolean(e.startError),helperText:e.startError,variant:"outlined",margin:"dense"}))})}),(0,f.jsx)(l.Z,{children:(0,f.jsx)(y.M,{inputFormat:"MM/dd/yyyy",label:"End",value:e.endValue,onChange:t=>e.onEndDateChanged(t),renderInput:t=>(0,f.jsx)(c.Z,(0,a.Z)((0,a.Z)({},t),{},{style:{margin:0},required:!0,error:Boolean(e.endError),helperText:e.endError,variant:"outlined",margin:"dense"}))})}),(0,f.jsxs)("div",{className:t.menuButtonHost,children:[(0,f.jsx)(v.Z,{title:"Select common date range",children:(0,f.jsx)(m.Z,{"aria-label":"Select common date range","aria-controls":D?"date-range-presets-menu":void 0,"aria-haspopup":"true",onClick:e=>{I(e.currentTarget)},size:"large",children:(0,f.jsx)(h.Z,{})})}),(0,f.jsx)(u.Z,{id:"date-range-presets-menu",anchorEl:E,open:D,onClose:T,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:O.map(t=>(0,f.jsx)(p.Z,{onClick:()=>{(t=>{const n=t.getRange();e.onStartDateChanged(n.start),e.onEndDateChanged(n.end),T()})(t)},children:t.label},t.key))})]})]})]})})}},82777:(e,t,n)=>{n.d(t,{f:()=>d});var a=n(1413),o=n(45987),s=(n(72791),n(48550)),r=n(92506),i=n(80184);const l=["field","form","helperText"],d=e=>{var t;let n=e.field,d=e.form,c=e.helperText,u=(0,o.Z)(e,l);const p=(0,r.u9)(d.touched,n.name),m=(0,r.u9)(d.errors,n.name),h=Boolean(p&&m);return(0,i.jsx)(s.Z,(0,a.Z)((0,a.Z)((0,a.Z)({},n),u),{},{error:null!==(t=u.error)&&void 0!==t?t:h,helperText:h?m:c}))}},24375:(e,t,n)=>{n.d(t,{z:()=>u});var a=n(1413),o=n(29439),s=n(45987),r=n(72791),i=n(48550),l=n(80184);const d=["error","helperText","label","fullWidth","onChange","value","size","color"],c=e=>{const t=e.replace(/\D/g,"").slice(0,10);return t.length<=3?t:t.length<=6?"".concat(t.slice(0,3),"-").concat(t.slice(3)):"".concat(t.slice(0,3),"-").concat(t.slice(3,6),"-").concat(t.slice(6))},u=e=>{const t=e.error,n=e.helperText,u=e.label,p=e.fullWidth,m=e.onChange,h=e.value,v=(e.size,e.color,(0,s.Z)(e,d)),g=r.useState("string"===typeof h?c(h):""),y=(0,o.Z)(g,2),b=y[0],f=y[1];r.useEffect(()=>{f("string"===typeof h?c(h):"")},[h]);return(0,l.jsx)(i.Z,(0,a.Z)({label:u,margin:"dense",error:t,helperText:n,variant:"outlined",fullWidth:p,value:b,onChange:e=>{const t=c(e.target.value);f(t),e.target.value=t,e.currentTarget.value=t,null===m||void 0===m||m(e)},inputProps:{inputMode:"tel",maxLength:12}},v))}},84177:(e,t,n)=>{n.d(t,{B:()=>s});n(72791);var a=n(66708),o=n(80184);const s=e=>{const t=a.i.isAdminNotImpersonating;return e.number?e.extension&&t?(0,o.jsx)("div",{children:"".concat(e.number," Ext: ").concat(e.extension," (").concat(e.type,")")}):e.extension&&!t?(0,o.jsx)("div",{children:"".concat(e.number," (").concat(e.type,")")}):(0,o.jsxs)("div",{children:[(0,o.jsx)("a",{onClick:e=>e.stopPropagation(),href:"tel:".concat(e.number),children:e.number}),e.type&&(0,o.jsx)("span",{children:" (".concat(e.type,")")})]}):(0,o.jsx)("div",{})}},44580:(e,t,n)=>{n.d(t,{t:()=>r});n(72791);var a=n(72426),o=n.n(a),s=n(80184);const r=e=>{const t=e.hideTime?"MM/DD/YY":"MM/DD/YY h:mm a";return(0,s.jsx)("span",{children:e.date?o()(e.date).format(t):"---"})}},6227:(e,t,n)=>{n.d(t,{a:()=>o});n(72791);var a=n(80184);const o=e=>(0,a.jsx)("div",{})},88884:(e,t,n)=>{n.d(t,{E:()=>r});n(72791);var a=n(52174),o=n(20890),s=n(80184);const r=e=>{const t=(0,a.Z)(e=>({mobileGroupHeaderRoot:{marginBottom:e.spacing(2)},title:{display:"block",padding:"3px 6px"},content:{paddingLeft:e.spacing(1)}}))();return(0,s.jsxs)("div",{className:t.mobileGroupHeaderRoot,children:[(0,s.jsx)(o.Z,{classes:{root:t.title},variant:"caption",color:"primary",children:e.title}),(0,s.jsx)("div",{className:t.content,children:e.children})]})}},38247:(e,t,n)=>{n.d(t,{P:()=>r});n(72791);var a=n(52174),o=n(63733),s=n(80184);const r=e=>{const t=(0,a.Z)(t=>({root:{color:t.palette.grey[700],marginTop:e.disableTopMargin?0:t.spacing(2),fontSize:"12pt",textAlign:"center",[t.breakpoints.down("xs")]:{fontSize:"11pt",textAlign:"left",marginTop:0}},dim:{color:t.palette.grey[400]},left:{textAlign:"left"}}))();return(0,s.jsx)("div",{className:(0,o.Z)(t.root,{[t.dim]:e.dim,[t.left]:e.alignLeft}),children:e.message||"No data available"})}},81844:(e,t,n)=>{n.d(t,{D:()=>p});n(72791);var a=n(52174),o=n(13967),s=n(43706),r=n(24518),i=n(20890),l=n(63733),d=n(54164),c=n(80184);const u=e=>{const t=document.getElementById("mobile-dialog-actions-portal");return d.createPortal((0,c.jsx)(c.Fragment,{children:e.children}),t)},p=e=>{const t=(0,o.Z)(),n=(0,s.Z)(t.breakpoints.only("xs")),d=(0,a.Z)(t=>({root:{display:"grid"},actionsHost:{display:"flex",alignItems:"center",justifyContent:n?"space-between":"flex-end",marginBottom:n?"1em":"unset",marginTop:n?"unset":"2em",grid
1Row:n?1:"unset"},mobileTitleRow:{position:"absolute",top:0,left:0,width:"100%",color:"gray",padding:6,boxShadow:"0px 3px 15px rgba(0,0,0,0.2);",background:"white",zIndex:1e3},title:{textAlign:"center",position:"absolute",fontSize:"large",left:0,top:4,width:"100%",pointerEvents:"none",fontWeight:"normal"},content:{paddingTop:n?t.spacing(6):e.title?t.spacing(3):0}})),p=d(),m=Boolean(e.hideAllButtons);return(0,c.jsxs)("div",{className:p.root,children:[!n&&(0,c.jsx)(i.Z,{variant:"h6",children:(0,c.jsx)("strong",{children:e.title})}),e.noTopPadding?(0,c.jsx)("div",{children:e.children}):(0,c.jsx)("div",{className:p.content,children:e.children}),(0,c.jsx)("div",{className:(0,l.Z)(p.actionsHost,{[p.mobileTitleRow]:n}),children:!m&&(0,c.jsx)(c.Fragment,{children:(e=>void 0!==e.handleSave)(e)?(e=>n?(e=>{var t;return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(r.Z,{color:"inherit",onClick:e.handleClose,children:"Cancel"}),e.title&&(0,c.jsx)(i.Z,{className:p.title,children:(0,c.jsx)("strong",{children:e.title})}),(0,c.jsx)(r.Z,{color:"primary",disabled:e.disableSaveButton,onClick:e.handleSave,children:null!==(t=e.saveButtonCaption)&&void 0!==t?t:"Save"})]})})(e):(e=>{var t;return(0,c.jsxs)(u,{children:[(0,c.jsx)(r.Z,{variant:n?void 0:"contained",color:"primary",disabled:e.disableSaveButton,onClick:e.handleSave,children:null!==(t=e.saveButtonCaption)&&void 0!==t?t:"Save"}),(0,c.jsx)(r.Z,{variant:"contained",color:"inherit",onClick:e.handleClose,children:"Cancel"})]})})(e))(e):(e=>n?(e=>(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(r.Z,{color:"primary",onClick:e.handleClose,children:"Done"}),e.title&&(0,c.jsx)(i.Z,{className:p.title,children:(0,c.jsx)("strong",{children:e.title})}),e.renderMenuIcon&&e.renderMenuIcon()]}))(e):(e=>{if(!e.hideDoneButton)return(0,c.jsxs)(u,{children:[(0,c.jsx)(r.Z,{variant:"contained",color:"primary",onClick:e.handleClose,children:"Done"}),e.renderMenuIcon&&e.renderMenuIcon()]})})(e))(e)})})]})}},32856:(e,t,n)=>{n.d(t,{x:()=>i});n(72791);var a=n(68096),o=n(48550),s=n(23786),r=n(80184);const i=e=>{var t;return(0,r.jsx)(a.Z,{fullWidth:!0,children:(0,r.jsx)(o.Z,{select:!0,variant:"outlined",margin:"dense",label:e.label,error:e.touched&&Boolean(e.error),name:e.name,onChange:e.handleChange,value:null!==(t=e.value)&&void 0!==t?t:"",helperText:e.touched&&e.error,children:e.categories.map(e=>(0,r.jsx)(s.Z,{value:e.id,children:e.name},e.id))})})}},76329:(e,t,n)=>{n.d(t,{V:()=>r});n(72791);var a=n(39927),o=n(31399),s=n(80184);const r=e=>{const t=(0,o.dg)(e);return console.error("API Error:",(0,o.ZJ)(t)),console.error("Original error:",e),(0,o.mq)(t.status)&&a.Am.error((0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{children:t.message}),t.traceId&&(0,s.jsx)("div",{style:{marginTop:"8px"},children:(0,s.jsx)("small",{children:(0,s.jsxs)("code",{children:["Trace ID: ",t.traceId]})})})]}),{autoClose:5e3,position:"top-right"}),t}},37066:(e,t,n)=>{n.d(t,{P:()=>u});var a,o,s,r,i=n(43269),l=n(53229),d=n(7585),c=n(84098);const u=new(a=c.aD.bound,o=class{constructor(){(0,i.Z)(this,"sponsorCostPerPoint",s,this),(0,i.Z)(this,"eventCostPerPoint",r,this),(0,c.rC)(this)}async loadConfig(){if(this.sponsorCostPerPoint)return;const e=await d.C.admin.sponsors.getCostPerPoint(),t=await d.C.admin.events.getCostPerPoint();(0,c.z)(()=>{this.sponsorCostPerPoint=e,this.eventCostPerPoint=t})}convertEventDollarsToPoints(e){if(void 0!==e&&this.eventCostPerPoint)return e/this.eventCostPerPoint}},s=(0,l.Z)(o.prototype,"sponsorCostPerPoint",[c.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){}}),r=(0,l.Z)(o.prototype,"eventCostPerPoint",[c.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){}}),(0,l.Z)(o.prototype,"loadConfig",[a],Object.getOwnPropertyDescriptor(o.prototype,"loadConfig"),o.prototype),o)},42721:(e,t,n)=>{n.d(t,{K:()=>Be});var a,o,s,r,i,l,d,c,u,p,m,h,v,g,y,b,f,x,j,C,Z,w,S,N,P,E,I,D,T,A,O,k,R,M,F,B,L,z,U,G,V,W,q,H,Y,_,K,Q,J,$,X,ee,te,ne,ae,oe,se,re,ie,le,de,ce,ue,pe,me,he,ve,ge,ye,be,fe,xe,je,Ce,Ze,we,Se,Ne,Pe,Ee,Ie,De,Te,Ae=n(43269),Oe=n(53229),ke=n(84098),Re=n(46298),Me=n(7585);const Fe=e=>{if((0,Re.d8)(e)){const t=(0,Re.I0)(e);console.error("errors",t)}console.error(e)};const Be=new(a=ke.aD.bound,o=ke.aD.bound,s=ke.aD.bound,r=ke.aD.bound,i=ke.aD.bound,l=ke.aD.bound,d=ke.aD.bound,c=ke.aD.bound,u=ke.aD.bound,p=ke.aD.bound,m=ke.aD.bound,h=ke.aD.bound,v=ke.aD.bound,g=ke.aD.bound,y=ke.aD.bound,b=ke.aD.bound,f=ke.aD.bound,x=ke.aD.bound,j=ke.aD.bound,C=ke.aD.bound,Z=ke.aD.bound,w=ke.aD.bound,S=ke.aD.bound,N=ke.aD.bound,P=ke.aD.bound,E=ke.aD.bound,I=ke.aD.bound,D=ke.aD.bound,T=ke.aD.bound,A=ke.aD.bound,O=ke.aD.bound,k=ke.aD.bound,R=ke.aD.bound,M=ke.aD.bound,F=ke.aD.bound,B=ke.aD.bound,L=ke.aD.bound,z=ke.aD.bound,U=ke.aD.bound,G=ke.aD.bound,V=ke.aD.bound,W=ke.aD.bound,q=ke.aD.bound,H=ke.aD.bound,Y=ke.aD.bound,_=ke.aD.bound,K=ke.aD.bound,Q=ke.aD.bound,J=ke.aD.bound,$=ke.aD.bound,X=ke.aD.bound,ee=ke.aD.bound,te=class{constructor(){(0,Ae.Z)(this,"isSavingEvent",ne,this),(0,Ae.Z)(this,"isModifyingAttendees",ae,this),(0,Ae.Z)(this,"isModifyingPayments",oe,this),(0,Ae.Z)(this,"isModifyingAdjustments",se,this),(0,Ae.Z)(this,"isModifyingInvoices",re,this),(0,Ae.Z)(this,"isLoadingEvents",ie,this),(0,Ae.Z)(this,"isModifyingEventGroups",le,this),(0,Ae.Z)(this,"isModifyingRooms",de,this),(0,Ae.Z)(this,"isModifyingNotes",ce,this),(0,Ae.Z)(this,"eventGroupsFilterTerm",ue,this),(0,Ae.Z)(this,"eventGroupsOrderBy",pe,this),(0,Ae.Z)(this,"eventGroupsOrder",me,this),(0,Ae.Z)(this,"eventGroupsPage",he,this),(0,Ae.Z)(this,"eventGroupsPageSize",ve,this),(0,Ae.Z)(this,"eventCounts",ge,this),(0,Ae.Z)(this,"isLoadingEventDetails",ye,this),(0,Ae.Z)(this,"isLoadingEventGroupDetail
1s",be,this),(0,Ae.Z)(this,"isLoadingEventGroupSummary",fe,this),(0,Ae.Z)(this,"events",xe,this),(0,Ae.Z)(this,"filterType",je,this),(0,Ae.Z)(this,"eventGroups",Ce,this),(0,Ae.Z)(this,"callSheetPage",Ze,this),(0,Ae.Z)(this,"eventGroupsEventId",we,this),(0,Ae.Z)(this,"companyEventDetails",Se,this),(0,Ae.Z)(this,"accountEventSummary",Ne,this),(0,Ae.Z)(this,"selectedEventDetails",Pe,this),(0,Ae.Z)(this,"selectedPublicEventOptions",Ee,this),(0,Ae.Z)(this,"reloadEventGroup",Ie,this),(0,Ae.Z)(this,"reloadAccountEventSummary",De,this),(0,Ae.Z)(this,"reloadEventGroupDetails",Te,this),(0,ke.rC)(this)}async loadPublicOptionsForSelectedEvent(){if(this.selectedEventDetails){const e=await Me.C.companies.events.getPublicAdjustments(this.selectedEventDetails.id);(0,ke.z)(()=>{this.selectedPublicEventOptions=e})}else this.selectedPublicEventOptions=[]}setFilterType(e){this.filterType=e,this.loadEventList()}async saveNewEvent(e){this.isSavingEvent=!0;try{const t=await Me.C.admin.events.create(e);(0,ke.z)(()=>{this.filterType="Upcoming"});const n=await Me.C.admin.events.getEventList(this.filterType);return(0,ke.z)(()=>{this.events=n,this.isSavingEvent=!1}),t}catch(t){return(0,ke.z)(()=>{this.isSavingEvent=!1}),null}}async addCompanyEventNote(e){const t=await Me.C.admin.events.addCompanyEventNote(e);if(this.eventGroups){const n=this.eventGroups.find(t=>t.eventId===e.eventId&&t.companyId===e.companyId),a=[t.data,...n.notes],o=Object.assign({},n,{notes:a}),s=this.eventGroups.map(e=>e.id===o.id?o:e);(0,ke.z)(()=>{this.eventGroups=s})}}setEventGroupsFilterTerm(e){this.eventGroupsFilterTerm=e}setEventGroupsOrderBy(e){this.eventGroupsOrderBy=e}setEventGroupsOrder(e){this.eventGroupsOrder=e}setEventGroupsPage(e){this.eventGroupsPage=e}setEventGroupsPageSize(e){this.eventGroupsPageSize=e}async setCancellationFee(e){const t=await Me.C.admin.events.setCancellationFee(e);(0,ke.z)(()=>{this.accountEventSummary=t})}async sendEventGroupConfirmation(e,t,n){try{var a;const o=await Me.C.admin.events.sendEventGroupConfirmation(e,t,n),s=Object.assign({},null===(a=this.companyEventDetails)||void 0===a?void 0:a.groupDetails,{confirmationEmails:[...this.companyEventDetails.groupDetails.confirmationEmails,o]}),r=Object.assign({},this.companyEventDetails,{groupDetails:s});(0,ke.z)(()=>{this.companyEventDetails=r})}catch(o){console.log(o)}}async addCallSheetNote(e){const t=await Me.C.admin.events.addCompanyEventNote(e);if(this.reloadEventGroupDetails(),this.callSheetPage){const n=this.callSheetPage.data.find(t=>t.eventId===e.eventId&&t.companyId===e.companyId),a=[t.data,...n.notes],o=Object.assign({},n,{notes:a}),s=this.callSheetPage.data.map(e=>e.id===o.id?o:e),r=Object.assign({},this.callSheetPage,{data:s});(0,ke.z)(()=>{this.callSheetPage=r})}}async setCallSheetStatus(e){var t;const n=e.companyId,a=e.eventId;let o;const s=null===(t=this.callSheetPage)||void 0===t?void 0:t.data.find(t=>t.companyId===e.companyId);try{if((null===s||void 0===s?void 0:s.eventGroupStatus)===e.newStatus)await Me.C.admin.events.clearPotentialEventGroupStatus(e),this.setCompanyStatusToBlank({companyId:n,eventId:a});else{const t=await Me.C.admin.events.setPotentialEventGroupStatus(e);o=t.data}if(this.callSheetPage&&o){const e=this.callSheetPage.data.map(e=>e.companyId===o.companyId&&e.eventId===o.eventId?o:e),t=Object.assign({},this.callSheetPage,{data:e});(0,ke.z)(()=>{this.callSheetPage=t})}this.loadEventList(),this.loadEventCounts()}catch(r){console.log(r)}}async setPotentialEventGroupStatus(e){var t;const n=e.companyId,a=e.eventId,o=null===(t=this.eventGroups)||void 0===t?void 0:t.find(e=>e.companyId===n);try{if(e.newStatus===(null===o||void 0===o?void 0:o.eventGroupStatus))await Me.C.admin.events.clearPotentialEventGroupStatus(e),this.updatePotentialEventGroupStatus({companyId:n,eventId:a,status:"Blank"});else{const t=await Me.C.admin.events.setPotentialEventGroupStatus(e);this.reloadEventGroups(t.data),this.reloadEventGroup()}this.loadEventList(),this.loadEventCounts()}catch(s){console.log(s)}}reloadEventGroups(e){if(this.eventGroups){const t=this.eventGroups.map(t=>t.companyId===e.companyId&&t.eventId===e.eventId?e:t);this.eventGroups=t}}setCompanyStatusToBlank(e){const t=this.callSheetPage.data.find(t=>t.companyId===e.companyId&&t.eventId===e.eventId),n=Object.assign({},t,{eventGroupStatus:"Blank"}),a=this.callSheetPage.data.map(e=>e.id===n.id?n:e),o=Object.assign({},this.callSheetPage,{data:a});this.callSheetPage=o}updatePotentialEventGroupStatus(e){const t=this.eventGroups.find(t=>t.companyId===e.companyId&&t.eventId===e.eventId),n=Object.assign({},t,{eventGroupStatus:e.status}),a=this.eventGroups.map(e=>e.id===n.id?n:e);this.eventGroups=a}async signUpCompany(e,t){try{const n=await Me.C.admin.events.signUpCompany(t,e);return this.reloadEventGroups(n.data),this.loadEventCounts(),this.loadEventList(),await this.reloadEventGroup(),n.data}catch(n){return console.error(n),this.isModifyingAttendees=!1,n}}async updateEventAdjustment(e){this.isModifyingAdjustments=!0;try{const t=await Me.C.admin.events.updateEventAdjustment(e),n=this.selectedEventDetails.adjustments.map(e=>e.id===t.updatedAdjustment.id?t.updatedAdjustment:e),a=Object.assign({},this.selectedEventDetails,{adjustments:n});(0,ke.z)(()=>{this.selectedEventDetails=a});
1const o=t.balancedChangedForCompanies.length;if(o>0&&o<20){const e=t.balancedChangedForCompanies.reduce((e,t)=>"".concat(e,"\r\n").concat(t),""),n="The upgrade/discount has been updated. The balance has changed for the following event groups:\r\n".concat(e);alert(n)}else o>=20&&alert("The balance has changed for ".concat(o," event groups."))}catch(t){Fe(t)}await this.loadPublicOptionsForSelectedEvent(),(0,ke.z)(()=>{this.isModifyingAdjustments=!1})}async addPayment(e){this.isModifyingPayments=!0;try{await Me.C.admin.events.addPayment(e),await this.reloadEventGroup()}catch(t){console.error(t)}(0,ke.z)(()=>{this.isModifyingPayments=!1})}async deletePayment(e){this.isModifyingPayments=!0;try{await Me.C.admin.events.deletePayment(e),await this.reloadEventGroup()}catch(t){console.error(t)}(0,ke.z)(()=>{this.isModifyingPayments=!1})}async setInvoiceVoidStatus(e,t){this.isModifyingInvoices=!0;try{t?await Me.C.admin.events.voidInvoice(e):await Me.C.admin.events.unvoidInvoice(e),await this.reloadEventGroup()}catch(n){console.error(n)}(0,ke.z)(()=>{this.isModifyingInvoices=!1})}async updatePayment(e){this.isModifyingPayments=!0;try{await Me.C.admin.events.updatePayment(e),await this.reloadEventGroup()}catch(t){console.error(t)}(0,ke.z)(()=>{this.isModifyingPayments=!1})}async deleteEventAdjustment(e,t){this.isModifyingAdjustments=!0;try{await Me.C.admin.events.deleteEventAdjustment(e,t);const n=this.selectedEventDetails.adjustments.filter(e=>e.id!==t),a=Object.assign({},this.selectedEventDetails,{adjustments:n});(0,ke.z)(()=>{this.selectedEventDetails=a}),await this.loadPublicOptionsForSelectedEvent()}catch(n){console.error(n)}(0,ke.z)(()=>{this.isModifyingAdjustments=!1})}async addEventPayerAdjustment(e){try{await Me.C.admin.events.addEventPayerAdjustment(e),await this.reloadEventGroup()}catch(t){console.error(t)}}async addEventAdjustment(e){this.isModifyingAdjustments=!0;try{const t=await Me.C.admin.events.addEventAdjustment(e),n=[...this.selectedEventDetails.adjustments,t],a=Object.assign({},this.selectedEventDetails,{adjustments:n});(0,ke.z)(()=>{this.selectedEventDetails=a}),await this.loadPublicOptionsForSelectedEvent()}catch(t){Fe(t)}(0,ke.z)(()=>{this.isModifyingAdjustments=!1})}async deleteEvent(e){var t;const n=await Me.C.admin.events.deleteEvent(e);return(null===(t=this.selectedEventDetails)||void 0===t?void 0:t.id)===e&&(0,ke.z)(()=>{this.selectedEventDetails=void 0,this.selectedPublicEventOptions=void 0,this.companyEventDetails=void 0,this.accountEventSummary=void 0,this.events=this.events.filter(t=>t.id!==e)}),n}async refundEventGroup(e){try{await Me.C.admin.events.refundEventGroup(e),await this.reloadEventGroup(),this.loadEventCounts(),this.loadEventList()}catch(t){console.error(t)}}async restoreEventGroup(e){try{await Me.C.admin.events.restoreEventGroup(e),this.loadEventGroupDetails(this.companyEventDetails.eventId,this.companyEventDetails.companyInfo.id)}catch(t){console.error(t)}}async updateRoomsNeeded(e,t){this.isModifyingRooms=!0;try{await Me.C.admin.events.updateEventGroupRoomsNeeded(e,t)}catch(n){console.error(n)}(0,ke.z)(()=>{this.isModifyingRooms=!1})}async updateNotes(e,t,n,a){this.isModifyingNotes=!0;try{await Me.C.admin.events.updateEventGroupNotes(e,t,n,a),this.loadEventGroupDetails(this.companyEventDetails.eventId,this.companyEventDetails.companyInfo.id)}catch(o){console.error(o)}(0,ke.z)(()=>{this.isModifyingNotes=!1})}async updateEventPayerAdjustment(e){this.isModifyingAdjustments=!0;try{await Me.C.admin.events.updateEventPayerAdjustment(e),await this.reloadEventGroup()}catch(t){console.error(t)}(0,ke.z)(()=>{this.isModifyingAdjustments=!1})}async updateEvent(e){this.isSavingEvent=!0;try{const t=await Me.C.admin.events.update(e),n=await Me.C.admin.events.getEventList(this.filterType);(0,ke.z)(()=>{this.selectedEventDetails=t,this.events=n})}catch(t){console.error(t)}(0,ke.z)(()=>{this.isSavingEvent=!1})}async updateAttendeeChargeStatus(e,t){this.isModifyingAttendees=!0;try{await Me.C.admin.events.updateAttendeeChargeStatus(e,t),await this.reloadEventGroup()}catch(n){console.error(n)}(0,ke.z)(()=>{this.isModifyingAttendees=!1})}async loadEventList(){this.isLoadingEvents=!0;try{const e=await Me.C.admin.events.getEventList(this.filterType);(0,ke.z)(()=>{this.events=e})}catch(e){console.error(e)}(0,ke.z)(()=>{this.isLoadingEvents=!1})}async deleteAttendee(e,t,n){this.isModifyingAttendees=!0;try{await Me.C.admin.events.deleteEventGroupAttendee(e,t,n);const a=await Me.C.admin.events.getEventList(this.filterType);(0,ke.z)(()=>{this.events=a}),await this.reloadEventGroup()}catch(a){console.error(a)}(0,ke.z)(()=>{this.isModifyingAttendees=!1})}async deleteEventGroup(e,t){this.isModifyingEventGroups=!0;try{await Me.C.admin.events.deleteEventGroup(e,t),(0,ke.z)(()=>{this.eventGroups=this.eventGroups.filter(e=>e.eventGroupId!==t),this.selectedEventDetails.id===t&&(this.selectedEventDetails=void 0)}),this.loadEventCounts()}catch(n){console.error(n)}(0,ke.z)(()=>{this.isModifyingEventGroups=!1})}async loadEventCounts(){if(this.selectedEventDetails){const e=await Me.C.admin.events.getEventC
1ounts(this.selectedEventDetails.id);(0,ke.z)(()=>{this.eventCounts=e})}else console.log("No details")}async loadCallSheetPage(e){const t=await Me.C.admin.events.getCallSheet(e);(0,ke.z)(()=>{this.callSheetPage=t})}async loadEventGroups(e,t){this.isModifyingEventGroups=!0,this.eventGroups=void 0;try{const n=await Me.C.admin.events.getEventGroups(e,t);(0,ke.z)(()=>{this.eventGroups=n,this.eventGroupsEventId=e})}catch(n){console.error(n)}(0,ke.z)(()=>{this.isModifyingEventGroups=!1})}async loadEventPayerDetails(e,t){this.isLoadingEventGroupDetails=!0;try{const n=await Me.C.admin.events.getAccountEventDetails(e,t);(0,ke.z)(()=>{this.companyEventDetails=n}),null!==n&&void 0!==n&&n.payerDetails?await this.reloadAccountEventSummary():(0,ke.z)(()=>{this.accountEventSummary=null})}catch(n){console.error(n)}(0,ke.z)(()=>{this.isLoadingEventGroupDetails=!1})}async loadEventGroupDetails(e,t){this.isLoadingEventGroupDetails=!0;try{const n=await Me.C.admin.events.getCompanyEventDetails(e,t);(0,ke.z)(()=>{this.companyEventDetails=n}),null!==n&&void 0!==n&&n.payerDetails?await this.reloadAccountEventSummary():(0,ke.z)(()=>{this.accountEventSummary=null})}catch(n){console.error(n)}(0,ke.z)(()=>{this.isLoadingEventGroupDetails=!1})}async ensureEventDetailsLoaded(e){if(!this.selectedEventDetails||this.selectedEventDetails.id!==e){this.isLoadingEventDetails=!0;try{const t=await Me.C.admin.events.getEventDetails(e);(0,ke.z)(()=>{this.selectedEventDetails=t}),await this.loadEventCounts(),await this.loadPublicOptionsForSelectedEvent()}catch(t){console.error(t)}(0,ke.z)(()=>{this.isLoadingEventDetails=!1})}}async setGroupLead(e,t){this.isModifyingAttendees=!0;try{await Me.C.admin.events.setGroupLead(e,t);const n=this.companyEventDetails,a=n.eventId,o=n.accountInfo,s=await Me.C.admin.events.getAccountEventDetails(a,o.id);(0,ke.z)(()=>{this.companyEventDetails=s})}catch(n){console.error(n)}(0,ke.z)(()=>{this.isModifyingAttendees=!1})}async addInvoice(e){this.isModifyingInvoices=!0;try{const t=await Me.C.admin.events.addEventPayerInvoice(e);return await this.reloadEventGroup(),(0,ke.z)(()=>{this.isModifyingInvoices=!1}),t}catch(t){return console.error(t),void(0,ke.z)(()=>{this.isModifyingInvoices=!1})}}async removeAttachment(e,t){try{await Me.C.admin.events.removeAttachment(e,t);const n=this.selectedEventDetails.attachments.filter(e=>e.id!==t),a=Object.assign({},this.selectedEventDetails,{attachments:n});(0,ke.z)(()=>{this.selectedEventDetails=a})}catch(n){console.error(n)}}async removeImage(e,t){try{await Me.C.admin.events.removeImage(e,t);const n=this.selectedEventDetails.images.filter(e=>e.id!==t),a=Object.assign({},this.selectedEventDetails,{images:n});(0,ke.z)(()=>{this.selectedEventDetails=a})}catch(n){console.error(n)}}async addImage(e,t){try{const n=await Me.C.admin.files.uploadPublicFile(t),a={eventId:e,originalFileName:t.name,uri:n.uri},o=await Me.C.admin.events.addImage(a),s=[...this.selectedEventDetails.images,o],r=Object.assign({},this.selectedEventDetails,{images:s});(0,ke.z)(()=>{this.selectedEventDetails=r})}catch(n){console.error(n)}}async updateAttachment(e){const t=await Me.C.admin.events.updateAttachment(e),n=this.selectedEventDetails.attachments.map(e=>e.id===t.id?t:e),a=Object.assign({},this.selectedEventDetails,{attachments:n});(0,ke.z)(()=>{this.selectedEventDetails=a})}async addAttachment(e,t,n,a){try{const o=await Me.C.admin.files.uploadFile(t),s={eventId:e,originalFileName:t.name,uri:o.uri,name:n,visibility:a},r=await Me.C.admin.events.addAttachment(s),i=[...this.selectedEventDetails.attachments,r],l=Object.assign({},this.selectedEventDetails,{attachments:i});(0,ke.z)(()=>{this.selectedEventDetails=l})}catch(o){console.error(o)}}async deleteEventPayerAdjustment(e){this.isModifyingAdjustments=!0;try{var t;await Me.C.admin.events.deleteEventPayerAdjustment(e);const n=this.companyEventDetails.payerDetails.adjustments.filter(t=>t.id!==e.eventPayerAdjustmentId),a=Object.assign({},null===(t=this.companyEventDetails)||void 0===t?void 0:t.payerDetails,{adjustments:n}),o=Object.assign({},this.companyEventDetails,{payerDetails:a});(0,ke.z)(()=>{this.companyEventDetails=o}),await this.reloadAccountEventSummary()}catch(n){console.error(n)}(0,ke.z)(()=>{this.isModifyingAdjustments=!1})}getAttachmentsForCompanyType(e,t){return e.attachments.filter(e=>"Both"===e.visibility||"Member"===t&&"Members"===e.visibility||"Sponsor"===t&&"Sponsors"===e.visibility)}},ne=(0,Oe.Z)(te.prototype,"isSavingEvent",[ke.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),ae=(0,Oe.Z)(te.prototype,"isModifyingAttendees",[ke.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),oe=(0,Oe.Z)(te.prototype,"isModifyingPayments",[ke.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),se=(0,Oe.Z)(te.prototype,"isModifyingAdjustments",[ke.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),re=(0,Oe.Z)(te.prototype,"isModifyingInvoices",[ke.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),ie=(0,Oe.Z)(te.prototype,"isLoadingEvents",[ke.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),le=(0,Oe.Z)(te.prototype,"isModifyingEventGroups",[ke.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),de=(0,Oe.Z)(te.prototype,"isModifyingRooms",[ke.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),ce=(0,Oe.Z)(te.prototype,"isModifyingNotes",[ke.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),ue=(0,Oe.Z)(te.prototype,"eventGroupsFilterTerm",[ke.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),pe=(0,Oe.Z)(te.prototype,"eventGroupsOrderBy",[ke.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"companyName"}}),me=(0,Oe.Z)(te.prototype,"eventGroupsOrder",[ke.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"asc"}}),he=(0,Oe.Z)(te.prototype,"eventGroupsPage",[ke.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),ve=(0,Oe.Z)(te.prototype,"eventGroupsPageSize",[ke.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 200}}),ge=(0,Oe.Z)(te.prototype,"eventCounts",[ke.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return{cancelledGroups:0,eventGroups:0,interested:0,signUpQueue:0,waitingList:0}}}),ye=(0,Oe.Z)(te.prototype,"isLoadingEventDetails",[ke.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}
1),be=(0,Oe.Z)(te.prototype,"isLoadingEventGroupDetails",[ke.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),fe=(0,Oe.Z)(te.prototype,"isLoadingEventGroupSummary",[ke.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),xe=(0,Oe.Z)(te.prototype,"events",[ke.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),je=(0,Oe.Z)(te.prototype,"filterType",[ke.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"Upcoming"}}),Ce=(0,Oe.Z)(te.prototype,"eventGroups",[ke.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ze=(0,Oe.Z)(te.prototype,"callSheetPage",[ke.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),we=(0,Oe.Z)(te.prototype,"eventGroupsEventId",[ke.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Se=(0,Oe.Z)(te.prototype,"companyEventDetails",[ke.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ne=(0,Oe.Z)(te.prototype,"accountEventSummary",[ke.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Pe=(0,Oe.Z)(te.prototype,"selectedEventDetails",[ke.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ee=(0,Oe.Z)(te.prototype,"selectedPublicEventOptions",[ke.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),(0,Oe.Z)(te.prototype,"loadPublicOptionsForSelectedEvent",[a],Object.getOwnPropertyDescriptor(te.prototype,"loadPublicOptionsForSelectedEvent"),te.prototype),(0,Oe.Z)(te.prototype,"setFilterType",[o],Object.getOwnPropertyDescriptor(te.prototype,"setFilterType"),te.prototype),(0,Oe.Z)(te.prototype,"saveNewEvent",[s],Object.getOwnPropertyDescriptor(te.prototype,"saveNewEvent"),te.prototype),(0,Oe.Z)(te.prototype,"addCompanyEventNote",[r],Object.getOwnPropertyDescriptor(te.prototype,"addCompanyEventNote"),te.prototype),(0,Oe.Z)(te.prototype,"setEventGroupsFilterTerm",[i],Object.getOwnPropertyDescriptor(te.prototype,"setEventGroupsFilterTerm"),te.prototype),(0,Oe.Z)(te.prototype,"setEventGroupsOrderBy",[l],Object.getOwnPropertyDescriptor(te.prototype,"setEventGroupsOrderBy"),te.prototype),(0,Oe.Z)(te.prototype,"setEventGroupsOrder",[d],Object.getOwnPropertyDescriptor(te.prototype,"setEventGroupsOrder"),te.prototype),(0,Oe.Z)(te.prototype,"setEventGroupsPage",[c],Object.getOwnPropertyDescriptor(te.prototype,"setEventGroupsPage"),te.prototype),(0,Oe.Z)(te.prototype,"setEventGroupsPageSize",[u],Object.getOwnPropertyDescriptor(te.prototype,"setEventGroupsPageSize"),te.prototype),(0,Oe.Z)(te.prototype,"setCancellationFee",[p],Object.getOwnPropertyDescriptor(te.prototype,"setCancellationFee"),te.prototype),(0,Oe.Z)(te.prototype,"sendEventGroupConfirmation",[m],Object.getOwnPropertyDescriptor(te.prototype,"sendEventGroupConfirmation"),te.prototype),(0,Oe.Z)(te.prototype,"addCallSheetNote",[h],Object.getOwnPropertyDescriptor(te.prototype,"addCallSheetNote"),te.prototype),(0,Oe.Z)(te.prototype,"setCallSheetStatus",[v],Object.getOwnPropertyDescriptor(te.prototype,"setCallSheetStatus"),te.prototype),(0,Oe.Z)(te.prototype,"setPotentialEventGroupStatus",[g],Object.getOwnPropertyDescriptor(te.prototype,"setPotentialEventGroupStatus"),te.prototype),(0,Oe.Z)(te.prototype,"reloadEventGroups",[y],Object.getOwnPropertyDescriptor(te.prototype,"reloadEventGroups"),te.prototype),(0,Oe.Z)(te.prototype,"signUpCompany",[b],Object.getOwnPropertyDescriptor(te.prototype,"signUpCompany"),te.prototype),(0,Oe.Z)(te.prototype,"updateEventAdjustment",[f],Object.getOwnPropertyDescriptor(te.prototype,"updateEventAdjustment"),te.prototype),(0,Oe.Z)(te.prototype,"addPayment",[x],Object.getOwnPropertyDescriptor(te.prototype,"addPayment"),te.prototype),(0,Oe.Z)(te.prototype,"deletePayment",[j],Object.getOwnPropertyDescriptor(te.prototype,"deletePayment"),te.prototype),(0,Oe.Z)(te.prototype,"setInvoiceVoidStatus",[C],Object.getOwnPropertyDescriptor(te.prototype,"setInvoiceVoidStatus"),te.prototype),(0,Oe.Z)(te.prototype,"updatePayment",[Z],Object.getOwnPropertyDescriptor(te.prototype,"updatePayment"),te.prototype),(0,Oe.Z)(te.prototype,"deleteEventAdjustment",[w],Object.getOwnPropertyDescriptor(te.prototype,"deleteEventAdjustment"),te.prototype),(0,Oe.Z)(te.prototype,"addEventPayerAdjustment",[S],Object.getOwnPropertyDescriptor(te.prototype,"addEventPayerAdjustment"),te.prototype),(0,Oe.Z)(te.prototype,"addEventAdjustment",[N],Object.getOwnPropertyDescriptor(te.prototype,"addEventAdjustment"),te.prototype),(0,Oe.Z)(te.prototype,"deleteEvent",[P],Object.getOwnPropertyDescriptor(te.prototype,"deleteEvent"),te.prototype),(0,Oe.Z)(te.prototype,"refundEventGroup",[E],Object.getOwnPropertyDescriptor(te.prototype,"refundEventGroup"),te.prototype),(0,Oe.Z)(te.prototype,"restoreEventGroup",[I],Object.getOwnPropertyDescriptor(te.prototype,"restoreEventGroup"),te.prototype),(0,Oe.Z)(te.prototype,"updateRoomsNeeded",[D],Object.getOwnPropertyDescriptor(te.prototype,"updateRoomsNeeded"),te.prototype),(0,Oe.Z)(te.prototype,"updateNotes",[T],Object.getOwnPropertyDescriptor(te.prototype,"updateNotes"),te.prototype),(0,Oe.Z)(te.prototype,"updateEventPayerAdjustment",[A],Object.getOwnPropertyDescriptor(te.prototype,"updateEventPayerAdjustment"),te.prototype),(0,Oe.Z)(te.prototype,"updateEvent",[O],Object.getOwnPropertyDescriptor(te.prototype,"updateEvent"),te.prototype),(0,Oe.Z)(te.prototype,"updateAttendeeChargeStatus",[k],Object.getOwnPropertyDescriptor(te.prototype,"updateAttendeeChargeStatus"),te.prototype),(0,Oe.Z)(te.prototype,"loadEventList",[R],Object.getOwnPropertyDescriptor(te.prototype,"loadEventList"),te.prototype),(0,Oe.Z)(te.prototype,"deleteAttendee",[M],Object.getOwnPropertyDescriptor(te.prototype,"deleteAttendee"),te.prototype),(0,Oe.Z)(te.prototype,"deleteEventGroup",[F],Object.getOwnPropertyDescriptor(te.prototype,"deleteEventGroup"),te.prototype),(0,Oe.Z)(te.prototype,"loadEventCounts",[B
1],Object.getOwnPropertyDescriptor(te.prototype,"loadEventCounts"),te.prototype),(0,Oe.Z)(te.prototype,"loadCallSheetPage",[L],Object.getOwnPropertyDescriptor(te.prototype,"loadCallSheetPage"),te.prototype),(0,Oe.Z)(te.prototype,"loadEventGroups",[z],Object.getOwnPropertyDescriptor(te.prototype,"loadEventGroups"),te.prototype),(0,Oe.Z)(te.prototype,"loadEventPayerDetails",[U],Object.getOwnPropertyDescriptor(te.prototype,"loadEventPayerDetails"),te.prototype),(0,Oe.Z)(te.prototype,"loadEventGroupDetails",[G],Object.getOwnPropertyDescriptor(te.prototype,"loadEventGroupDetails"),te.prototype),(0,Oe.Z)(te.prototype,"ensureEventDetailsLoaded",[V],Object.getOwnPropertyDescriptor(te.prototype,"ensureEventDetailsLoaded"),te.prototype),(0,Oe.Z)(te.prototype,"setGroupLead",[W],Object.getOwnPropertyDescriptor(te.prototype,"setGroupLead"),te.prototype),(0,Oe.Z)(te.prototype,"addInvoice",[q],Object.getOwnPropertyDescriptor(te.prototype,"addInvoice"),te.prototype),(0,Oe.Z)(te.prototype,"removeAttachment",[H],Object.getOwnPropertyDescriptor(te.prototype,"removeAttachment"),te.prototype),(0,Oe.Z)(te.prototype,"removeImage",[Y],Object.getOwnPropertyDescriptor(te.prototype,"removeImage"),te.prototype),(0,Oe.Z)(te.prototype,"addImage",[_],Object.getOwnPropertyDescriptor(te.prototype,"addImage"),te.prototype),(0,Oe.Z)(te.prototype,"updateAttachment",[K],Object.getOwnPropertyDescriptor(te.prototype,"updateAttachment"),te.prototype),(0,Oe.Z)(te.prototype,"addAttachment",[Q],Object.getOwnPropertyDescriptor(te.prototype,"addAttachment"),te.prototype),(0,Oe.Z)(te.prototype,"deleteEventPayerAdjustment",[J],Object.getOwnPropertyDescriptor(te.prototype,"deleteEventPayerAdjustment"),te.prototype),Ie=(0,Oe.Z)(te.prototype,"reloadEventGroup",[$],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return async()=>{await this.reloadEventGroupDetails(),await this.reloadAccountEventSummary()}}}),De=(0,Oe.Z)(te.prototype,"reloadAccountEventSummary",[X],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return async()=>{if(!this.companyEventDetails)return;const e=await Me.C.admin.events.getAccountEventSummary({accountId:this.companyEventDetails.accountInfo.id,eventId:this.companyEventDetails.eventId});(0,ke.z)(()=>{this.accountEventSummary=e})}}}),Te=(0,Oe.Z)(te.prototype,"reloadEventGroupDetails",[ee],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return async()=>{if(!this.companyEventDetails)return;const e=this.companyEventDetails,t=e.eventId,n=e.accountInfo,a=await Me.C.admin.events.getAccountEventDetails(t,n.id);(0,ke.z)(()=>{this.companyEventDetails=a})}}}),te)},32686:(e,t,n)=>{n.d(t,{S:()=>w});var a,o,s,r,i,l,d,c,u,p,m,h,v,g,y,b,f,x=n(43269),j=n(53229),C=n(84098),Z=n(7585);const w=new(a=C.aD.bound,o=C.aD.bound,s=C.aD.bound,r=C.aD.bound,i=C.aD.bound,l=C.aD.bound,d=C.aD.bound,c=C.aD.bound,u=C.aD.bound,p=class{constructor(){(0,x.Z)(this,"isLoading",m,this),(0,x.Z)(this,"isLoaded",h,this),(0,x.Z)(this,"isSendingReminders",v,this),(0,x.Z)(this,"totalReminders",g,this),(0,x.Z)(this,"remainingReminders",y,this),(0,x.Z)(this,"users",b,this),(0,x.Z)(this,"currentListType",f,this),(0,C.rC)(this)}async loadCompanyUserList(e,t){this.isLoading=!0;try{this.currentListType="CompanyUsers";const n=await Z.C.shared.users.getCompanyUserList(e,t);(0,C.z)(()=>{this.users=n})}catch(n){console.error(n)}finally{(0,C.z)(()=>{this.isLoading=!1,this.isLoaded=!0})}}async loadAdminUserList(e){this.isLoading=!0;try{this.currentListType=e;const t=await Z.C.admin.users.getUserList(e);(0,C.z)(()=>{this.users=t})}catch(t){console.error(t)}finally{(0,C.z)(()=>{this.isLoading=!1,this.isLoaded=!0})}}async sendReminderByCreatingDate(e){await Z.C.admin.users.sendReminderByCreatingDate(e)}async sendReminders(){this.isSendingReminders=!0;try{let e=await Z.C.admin.users.sendReminders();const t=e.data.remaining;for((0,C.z)(()=>{void 0===this.totalReminders&&(this.totalReminders=e.data.remaining+e.data.sent),this.remainingReminders=t});e.data.remaining>0;){e=await Z.C.admin.users.sendReminders();const t=e.data.remaining;(0,C.z)(()=>{this.remainingReminders=t})}return e.data}finally{(0,C.z)(()=>{this.isSendingReminders=!1})}}async findUsers(e,t){this.isLoading=!0;try{this.currentListType="SearchResults";const n=await Z.C.admin.users.searchUsres(e,t);(0,C.z)(()=>{this.users=n})}catch(n){console.error(n)}finally{(0,C.z)(()=>{this.isLoading=!1,this.isLoaded=!0})}}async enableUserAccount(e){this.isLoading=!0;try{const t=await Z.C.admin.users.enableUserAccount(e),n=this.users.map(e=>e.id===t.id?t:e);(0,C.z)(()=>{this.users=n})}catch(t){console.error(t)}finally{(0,C.z)(()=>{this.isLoading=!1})}}async disableUserAccount(e){this.isLoading=!0;try{const t=await Z.C.admin.users.disableUserAccount(e),n=this.users.map(e=>e.id===t.id?t:e);(0,C.z)(()=>{this.users=n})}catch(t){console.error(t)}finally{(0,C.z)(()=>{this.isLoading=!1})}}async updateUser(e){this.isLoading=!0;try{const t=await Z.C.shared.users.updateUser(e);return(0,C.z)(()=>{t&&t.permissions.length>0?this.users=this.users.map(e=>e.id===t.id?t:e):this.users=this.users.filter(t=>t.id!==e.userId),this.isLoading=!1}),t}catch(t){return(0,C.z)(()=>{this.isLoading=!1}),void console.log(t)}}async createUser(e){this.isLoading=!0;try{const t=await Z.C.shared.users.createUser(e);return(0,C.z)(()=>
1{if(this.users){const e=[...this.users,t.data];this.users=e}this.isLoading=!1}),t}catch(t){return(0,C.z)(()=>{this.isLoading=!1}),void console.log(t)}}},m=(0,j.Z)(p.prototype,"isLoading",[C.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),h=(0,j.Z)(p.prototype,"isLoaded",[C.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),v=(0,j.Z)(p.prototype,"isSendingReminders",[C.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),g=(0,j.Z)(p.prototype,"totalReminders",[C.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),y=(0,j.Z)(p.prototype,"remainingReminders",[C.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),b=(0,j.Z)(p.prototype,"users",[C.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),f=(0,j.Z)(p.prototype,"currentListType",[C.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"RecentLogins"}}),(0,j.Z)(p.prototype,"loadCompanyUserList",[a],Object.getOwnPropertyDescriptor(p.prototype,"loadCompanyUserList"),p.prototype),(0,j.Z)(p.prototype,"loadAdminUserList",[o],Object.getOwnPropertyDescriptor(p.prototype,"loadAdminUserList"),p.prototype),(0,j.Z)(p.prototype,"sendReminderByCreatingDate",[s],Object.getOwnPropertyDescriptor(p.prototype,"sendReminderByCreatingDate"),p.prototype),(0,j.Z)(p.prototype,"sendReminders",[r],Object.getOwnPropertyDescriptor(p.prototype,"sendReminders"),p.prototype),(0,j.Z)(p.prototype,"findUsers",[i],Object.getOwnPropertyDescriptor(p.prototype,"findUsers"),p.prototype),(0,j.Z)(p.prototype,"enableUserAccount",[l],Object.getOwnPropertyDescriptor(p.prototype,"enableUserAccount"),p.prototype),(0,j.Z)(p.prototype,"disableUserAccount",[d],Object.getOwnPropertyDescriptor(p.prototype,"disableUserAccount"),p.prototype),(0,j.Z)(p.prototype,"updateUser",[c],Object.getOwnPropertyDescriptor(p.prototype,"updateUser"),p.prototype),(0,j.Z)(p.prototype,"createUser",[u],Object.getOwnPropertyDescriptor(p.prototype,"createUser"),p.prototype),p)},62850:(e,t,n)=>{n.d(t,{n:()=>S});var a,o,s,r,i,l,d,c,u,p,m,h,v,g,y,b,f,x,j=n(43269),C=n(53229),Z=n(84098),w=n(7585);const S=new(a=Z.aD.bound,o=Z.aD.bound,s=Z.aD.bound,r=Z.aD.bound,i=Z.aD.bound,l=Z.aD.bound,d=Z.aD.bound,c=Z.aD.bound,u=Z.aD.bound,p=Z.aD.bound,m=Z.aD.bound,h=Z.aD.bound,v=Z.aD.bound,g=Z.aD.bound,y=Z.aD.bound,b=class{constructor(){(0,j.Z)(this,"dict",f,this),(0,j.Z)(this,"loading",x,this),(0,Z.rC)(this)}get profileFormCategories(){return this.getEnum("categories").filter(e=>e.showOnSupplierProfile)}getEnum(e){return this.dict[e]||[]}isLoading(e){return!!this.loading[e]}ensureMarketsFetched(){this.shouldFetch("markets")&&this.fetchEnumerables("markets",w.C.enumerables.marketsShow)}ensureEventTypesFetched(){this.shouldFetch("eventTypes")&&this.fetchEnumerables("eventTypes",w.C.enumerables.eventTypes)}ensureCategoriesFetched(){this.shouldFetch("categories")&&this.fetchEnumerables("categories",w.C.enumerables.categoriesShow)}ensureBrandsFetched(){(arguments.length>0&&void 0!==arguments[0]&&arguments[0]||this.shouldFetch("brands"))&&this.fetchEnumerables("brands",w.C.enumerables.brandsShow)}ensureProductsFetched(){(arguments.length>0&&void 0!==arguments[0]&&arguments[0]||this.shouldFetch("products"))&&this.fetchEnumerables("products",w.C.enumerables.productsShow)}ensureTaxNumberTypesFetched(){this.shouldFetch("taxNumberTypes")&&this.fetchEnumerables("taxNumberTypes",w.C.enumerables.taxNumberTypesShow)}ensureAddressTypesFetched(){this.shouldFetch("addressTypes")&&this.fetchEnumerables("addressTypes",w.C.enumerables.addressTypesShow)}ensurePhoneNumberTypesFetched(){this.shouldFetch("phoneNumberTypes")&&this.fetchEnumerables("phoneNumberTypes",w.C.enumerables.phoneNumberTypesShow)}ensureEmailTypesFetched(){this.shouldFetch("emailTypes")&&this.fetchEnumerables("emailTypes",w.C.enumerables.emailTypesShow)}ensureUnitsFetched(){this.shouldFetch("units")&&this.fetchEnumerables("units",w.C.enumerables.units)}ensureTransactionTypesFetched(){this.shouldFetch("transactionTypes")&&this.fetchEnumerables("transactionTypes",w.C.enumerables.transactionTypes)}ensureRelationTypesFetched(){this.shouldFetch("relationTypes")&&this.fetchEnumerables("relationTypes",w.C.enumerables.relationTypes)}ensureRelationshipTypesFetched(){this.shouldFetch("relationshipTypes")&&this.fetchEnumerables("relationshipTypes",w.C.enumerables.relationshipTypes)}ensureContactTypesFetched(){(arguments.length>0&&void 0!==arguments[0]&&arguments[0]||this.shouldFetch("contactTypes"))&&this.fetchEnumerables("contactTypes",w.C.enumerables.contactTypes)}shouldFetch(e){return!this.dict[e]&&!this.loading[e]}async fetchEnumerables(e,t){(0,Z.t8)(this.loading,e,!0);try{const n=await t();(0,Z.z)(()=>{(0,Z.t8)(this.dict,e,n.data[e])})}catch(n){console.log(n)}finally{(0,Z.z)(()=>{(0,Z.t8)(this.loading,e,!1)})}}},f=(0,C.Z)(b.prototype,"dict",[Z.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return{}}}),x=(0,C.Z)(b.prototype,"loading",[Z.LO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return{}}}),(0,C.Z)(b.prototype,"profileFormCategories",[Z.Fl],Object.getOwnPropertyDescriptor(b.prototype,"profileFormCategories"),b.prototype),(0,C.Z)(b.prototype,"ensureMarketsFetched",[a],Object.getOwnPropertyDescriptor(b.prototype,"ensureMarketsFetched"),b.prototype),(0,C.Z)(b.prototype,"ensureEventTypesFetched",[o],Object.getOwnPropertyDescriptor(b.prototype,"ensureEventTypesFetched"),b.prototype),(0,C.Z)(b.prototype,"ensureCategoriesFetched",[s],Object.getOwnPropertyDescriptor(b.prototype,"ensureCategoriesFetched"),b.prototype),(0,C.Z)(b.prototype,"ensureBrandsFetched",[r],Object.getOwnPropertyDescriptor(b.prototype,"ensureBrandsFetched"),b.prototype),(0,C.Z)(b.prototype,"ensureProductsFetched",[i],Object.getOwnPropertyDescriptor(b.prototype,"ensureProductsFetched"),b.prototype),(0,C.Z)(b.prototype,"ensureTaxNumberTypesFetched",[l],Object.getOwnPropertyDescriptor(b.prototype,"ensureTaxNumberTypesFetched"),b.prototype),(0,C.Z)(b.prototype,"ensureAddressTypesFetched",[d],Object.getOwnPropertyDescriptor(b.prototype,"ensureAddressTypesFetched"),b.prototype),(0,C.Z)(b.prototype,"ensurePhoneNumberTypesFetched",[c],Object.getOwnPropertyDescriptor(b.prototype,"ensurePhoneNumberTypesFetched"),b.prototype),(0,C.Z)(b.prototype,"ensureEmailTypesFetched",[u],Object.getOwnPropertyDescriptor(b.prototype,"ensureEmailTypesFetched"),b.prototype),(0,C.Z)(b.prototype,"ensureUnitsFetched",[p],Object.getOwnPropertyDescriptor(b.prototype,"ensureUnitsFetched"),b.prototype),(0,C.Z)(b.prototype,"ensureTransactionTypesFetched",[m],Object.getOwnPropertyDescriptor(b.prototype,"ensureTransactionTypesFetched"),b.prototype),(0,C.Z)(b.prototype,"ensureRelationTypesFetched",[h],Object.getOwnPropertyDescriptor(b.prototype,"ensureRelationTypesFetched"),b.prototype),(0,C.Z)(b.prototype,"ensureRelationshipTypesFetched",[v],Object.getOwnPropertyDescriptor(b.prototype,"ensureRelationshipTypesFetched"),b.prototype),(0,C.Z)(b.prototype,"ensureContactTypesFetched",[g],Object.getOwnPropertyDescriptor(b.prototype,"ensureContactTypesFetched"),b.prototype),(0,C.Z)(b.prototype,"fetchEnumerables",[y],Object.getOwnPropertyDescriptor(b.prototype,"fetchEnumerables"),b.prototype),b)},90485:(e,t,n)=>{n.d(t,{m:()=>a});const a=e=>"".concat(e.name," (").concat(e.identifier,")")}
1,81238:(e,t,n)=>{n.d(t,{Er:()=>o,Pd:()=>a,To:()=>s});const a=(e,t,n)=>{let a;if("function"===typeof t)try{a=t(e)}catch(o){}else{a=(Array.isArray(t)?t.map(e=>e.split(".")).reduce((e,t)=>e.concat(t),[]):t.split(".")).reduce((e,t)=>{const n=e;if(void 0!==e&&null!==e&&(!n.hasOwnProperty||n.hasOwnProperty(t)))return e[t]},e)}return void 0===a?n:a};function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50,t=arguments.length>1?arguments[1]:void 0;return function(n,a,o){const s=o.value;return o.value=function(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:50,a=arguments.length>2?arguments[2]:void 0;return function(){for(var o=arguments.length,s=new Array(o),r=0;r<o;r++)s[r]=arguments[r];const i=this,l=a&&!t;t&&window.clearTimeout(t),t=window.setTimeout(function(){t=void 0,a||e.apply(i,s)},n),l&&e.apply(i,s)}}(s,e,t),o}}const s=e=>({label:e,value:e})},8696:(e,t,n)=>{n.d(t,{Nr:()=>r,Yz:()=>i,aM:()=>l});var a=n(29439),o=n(72791),s=n(9150);function r(e,t){const n=o.useState(e),s=(0,a.Z)(n,2),r=s[0],i=s[1];return o.useEffect(()=>{const n=window.setTimeout(()=>{i(e)},t);return()=>{window.clearTimeout(n)}},[e,t]),r}function i(e,t){const n=o.useRef(void 0);o.useEffect(()=>{n.current=e},[e]),o.useEffect(()=>{if(null!==t){const e=setInterval(function(){n.current&&n.current()},t);return()=>clearInterval(e)}},[t])}function l(){const e=o.useState({}),t=(0,a.Z)(e,2),n=t[0],r=t[1],i=(0,s.TH)().search,l=n[i];if(l)return l;{const e=new URLSearchParams(i);return r(Object.assign({},n,{[i]:e})),e}}"undefined"!==typeof window?o.useLayoutEffect:o.useEffect},81316:(e,t,n)=>{n.d(t,{J:()=>a,T:()=>o});const a="BCN"===n(14659).an?"Monthly Reports are not set up for your company yet. Please contact Kristin at 612-359-1111 or [email protected] for assistance.":"Monthly Reports are not set up for your company yet. Please contact Kristin at 612-359-1101 or [email protected] for assistance.",o="Unable to create monthly report. The sponsor may not have any rates set up."},17508:(e,t,n)=>{n.d(t,{NM:()=>r,lb:()=>o,rx:()=>s,uf:()=>a});const a=(e,t)=>{if(void 0===e||null===e)return"---";return("number"===typeof e&&void 0!==t?e.toFixed(t):e.toString()).replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")},o=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(void 0===e||null===e)return"---";const n=arguments.length>2&&void 0!==arguments[2]&&arguments[2]?0:2;return e<0?t?"(".concat(a(Math.abs(e).toFixed(n)),")"):"($".concat(a(Math.abs(e).toFixed(n)),")"):t?"".concat(a(e.toFixed(n))):"$".concat(a(e.toFixed(n)))},s=(e,t)=>[...Array(t-e+1)].map((t,n)=>n+e),r=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=Math.pow(10,t),a=e*n*(1+Number.EPSILON);return Math.round(a)/n}},58003:(e,t,n)=>{n.d(t,{AW:()=>c,EN:()=>m,NL:()=>p,TH:()=>s.TH,k6:()=>d,rU:()=>s.rU,rs:()=>u,s0:()=>s.s0});var a=n(1413),o=n(72791),s=n(9150),r=n(80184);const i=(e,t,n)=>{var a;const o=null!==e&&void 0!==e?e:"*",r=(0,s.LX)({path:o,end:!!n},t);return{params:null!==(a=null===r||void 0===r?void 0:r.params)&&void 0!==a?a:{},isExact:null!=r,path:o,url:t}},l=()=>{const e=(0,s.s0)(),t=(0,s.TH)();return o.useMemo(()=>({length:window.history.length,action:"POP",location:t,push:t=>{e(t)},replace:t=>{e(t,{replace:!0})},go:t=>{e(t)},back:()=>{e(-1)},forward:()=>{e(1)},goBack:()=>{e(-1)},goForward:()=>{e(1)},listen:()=>()=>{},block:()=>()=>{},createHref:e=>{var t,n,a;if("string"===typeof e)return e;const o=null!==(t=e.pathname)&&void 0!==t?t:"",s=null!==(n=e.search)&&void 0!==n?n:"",r=null!==(a=e.hash)&&void 0!==a?a:"";return"".concat(o).concat(s).concat(r)}}),[e,t])},d=l,c=e=>{var t;const n=(0,s.TH)(),d=l(),c=(0,s.UO)(),u=o.useMemo(()=>i(e.path,n.pathname,e.exact),[e.path,e.exact,n.pathname]);if(e.path&&!u.isExact)return null;const p={history:d,location:n,match:(0,a.Z)((0,a.Z)({},u),{},{params:(0,a.Z)((0,a.Z)({},u.params),c)})};return e.component?o.createElement(e.component,p):e.render?(0,r.jsx)(r.Fragment,{children:e.render(p)}):"function"===typeof e.children?(0,r.jsx)(r.Fragment,{children:e.children(p)}):e.children?(0,r.jsx)(r.Fragment,{children:e.children}):(0,r.jsx)(r.Fragment,{children:null!==(t=e.element)&&void 0!==t?t:null})},u=e=>{let t=e.children;const n=(0,s.TH)(),a=o.Children.toArray(t).find(e=>{if(!o.isValidElement(e))return!1;const t=e.props;return!t.path||i(t.path,n.pathname,t.exact).isExact});return a?(0,r.jsx)(r.Fragment,{children:a}):null},p=e=>{let t=e.when,n=e.message;const a=o.useContext(s.kH);return o.useEffect(()=>{if(!t)return()=>{};const e=null!==n&&void 0!==n?n:"Are you sure you want to leave this page?",o=null===a||void 0===a?void 0:a.navigator;if(!o)return()=>{};if("function"===typeof o.block){const t=o.block(n=>{window.confirm(e)&&(t(),n.retry())});return t}const s=o.push,r=o.replace,i=o.go,l=()=>window.confirm(e);return"function"===typeof s&&(o.push=function(){if(l()){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return s.apply(o,t)}}),"function"===typeof r&&(o.replace=function(){if(l()){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.apply(o,t)}}),"function"===typeof i&&(o.go=function(){if(l()){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return i.apply(o,t)}}),()=>{o.push=s,o.replace=r,o.go=i}},[t,n,a]),o.useEffect(()=>{if(!t)return()=>{};const e=null!==n&&void 0!==n?n:"Are you sure you want to leave this page?",a=t=>(t.preventDefault(),t.returnValue=e,e);return window.addEventListener("beforeunload",a),()=>{window.removeEventListener("beforeunload",a)}},[t,n]),null},m=e=>{var t,n;const d=t=>{const n=(0,s.TH)(),d=l(),c=(0,s.UO)(),u=o.useMemo(()=>i(void 0,n.pathname,!1),[n.pathname]);return(0,r.jsx)(e,(0,a.Z)((0,a.Z)({},t),{},{history:d,location:n,match:(0,a.Z)((0,a.Z)({},u),{},{params:c})}))};return d.displayName="withRouter(".concat(null!==(t=null!==(n=e.displayName)&&void 0!==n?n:e.name)&&void 0!==t?t:"Component",")"),d}}
1,80526:(e,t,n)=>{n.d(t,{X3:()=>a,aW:()=>o});const a=e=>{var t=(e=>(e.indexOf("//")>-1?e.split("/")[2]:e.split("/")[0]).split(":")[0].split("?")[0])(e),n=t.split("."),a=n.length;return a>2&&(t=n[a-2]+"."+n[a-1],2===n[a-2].length&&2===n[a-1].length&&(t=n[a-3]+"."+t)),t},o=e=>"https://www.google.com/s2/favicons?sz=64&domain_url=".concat(e)}}]); 2//# sourceMappingURL=9597.2831ceb6.chunk.js.map
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.