{"version":3,"sources":["Pages/Home/ActivityRegistration.js"],"names":["initEvents","$","click","valid","addClass","data","registrationCount","val","adultRegistrationCount","childrenRegistrationCount","dietaryPreference","tShirtSize","postAsJson","activityId","JSON","stringify","success","window","location","removeClass","addAlertMessage","errorMessage","redirectUrl","allowWaitlist","show","addWaitlistAlertMessage","cancelUrl","initValidation","length","validate","extendValidationSettings","errorContainer","errorLabelContainer","addNumberInGroupValidation","rules","required","min","max","messages","addWaitlistValidation","addAdultAndChildRegistrationValidation","element","parseInt","addAdultAndChildWaitlistRegistrationValidation","addTShirtSizeValidation","addDietaryPreferenceValidation","alertClass","headerText","messageText","alert","append","appendTo","applyMasks"],"mappings":"AAMA,SAASA,aACLC,EAAE,qBAAqBC,OAAM,WACzB,GAAID,EAAE,iBAAiBE,QAAS,CAG5BF,EAAE,2BAA2BG,SAAS,YAEtC,IAAIC,EAAO,CACPC,kBAAmBL,EAAE,sBAAsBM,MAC3CC,uBAAwBP,EAAE,2BAA2BM,MACrDE,0BAA2BR,EAAE,8BAA8BM,MAC3DG,kBAAmBT,EAAE,sBAAsBM,MAC3CI,WAAYV,EAAE,eAAeM,OAGjCK,WAAW,kCAAoCC,WAAYC,KAAKC,UAAUV,IAAO,SAAUA,GACnFA,EAAKW,QACLC,OAAOC,SAAW,qCAAuCL,YAGzDZ,EAAE,2BAA2BkB,YAAY,YACzCC,gBAAgB,eAAgB,iBAAkBf,EAAKgB,cAEnDhB,EAAKiB,cACLL,OAAOC,SAAWb,EAAKiB,aAGvBjB,EAAKkB,gBACLtB,EAAE,8BAA8BuB,OAChCvB,EAAE,0BAA0BuB,gBAOhDvB,EAAE,uBAAuBC,OAAM,WAC3BD,EAAE,2BAA2BG,SAAS,YAEtCQ,WAAW,wCAA0CC,WAAY,IAAI,SAAUR,GACvEA,EAAKW,UACLC,OAAOC,SAAW,iCAK9BjB,EAAE,iBAAiBC,OAAM,WACrBD,EAAE,2BAA2BG,SAAS,YAEtC,IAAIC,EAAO,CACPC,kBAA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,mCAAmCM,OAAiE,GAAxDmC,SAASzC,EAAE,mCAAmCM,OACrF,EAGJ,GAEX8B,IAAK,IACLC,SAAU,CACNH,SAAU,kCACVC,IAAK,6DACLC,IAAK,gDAMrB,SAASO,0BACD3C,EAAE,eAAe2B,OAAS,GAC1B3B,EAAE,eAAeiC,MAAM,MAAO,CAC1BC,UAAU,EACVG,SAAU,CACNH,SAAU,+BAM1B,SAASU,iCACD5C,EAAE,sBAAsB2B,OAAS,GACjC3B,EAAE,sBAAsBiC,MAAM,MAAO,CACjCC,UAAU,EACVG,SAAU,CACNH,SAAU,qCAM1B,SAASf,gBAAgB0B,EAAYC,EAAYC,GAC7C,IAAIC,EAAQhD,EAAE,qBAAuB6C,EAAa,4EAA8EC,EAAa,eAEzIC,GACAC,EAAMC,OAAO,SAAWF,EAAc,WAG1CC,EAAME,SAAS,mBAGnB,SAAS1B,wBAAwBqB,EAAYC,EAAYC,GACrD,IAAIC,EAAQhD,EAAE,qBAAuB6C,EAAa,4EAA8EC,EAAa,eAEzIC,GACAC,EAAMC,OAAO,SAAWF,EAAc,WAG1CC,EAAME,SAAS,2BAjSnBlD,GAAE,WACEmD,aACAzB,iBACA3B","file":"ActivityRegistration.min.js","sourcesContent":["$(function () {\n applyMasks();\n initValidation();\n initEvents();\n});\n\nfunction initEvents() {\n $('.saveRegistration').click(function () {\n if ($('#RegisterForm').valid()) {\n\n //We're using registrationSaveButton class here and below to avoid conflicts with global saveButton class causing save buttons not being disabled/enabled properly after validation errors\n $('.registrationSaveButton').addClass('disabled');\n\n var data = {\n registrationCount: $('#RegistrationCount').val(),\n adultRegistrationCount: $('#AdultRegistrationCount').val(),\n childrenRegistrationCount: $('#ChildrenRegistrationCount').val(),\n dietaryPreference: $(\"#DietaryPreference\").val(),\n tShirtSize: $(\"#TShirtSize\").val()\n };\n\n postAsJson('/api/Home/ActivityRegistration/' + activityId, JSON.stringify(data), function (data) {\n if (data.success) {\n window.location = '/ActivityRegistrationConfirmation/' + activityId;\n }\n else {\n $('.registrationSaveButton').removeClass('disabled');\n addAlertMessage(\"alert-danger\", \"Sign Up Failed\", data.errorMessage);\n\n if (data.redirectUrl) {\n window.location = data.redirectUrl;\n }\n\n if (data.allowWaitlist) {\n $('#ParticipantWaitlistSignup').show();\n $('#ActivityContactPannel').show();\n }\n }\n });\n }\n });\n\n $('.removeRegistration').click(function () {\n $('.registrationSaveButton').addClass('disabled');\n\n postAsJson('/api/Home/RemoveActivityRegistration/' + activityId, '', function (data) {\n if (data.success) {\n window.location = '/Dashboard#myActivities';\n }\n });\n });\n\n $('.joinWaitlist').click(function () {\n $('.registrationSaveButton').addClass('disabled');\n\n var data = {\n registrationCount: $('#RegistrationCount').val(),\n adultRegistrationCount: $('#AdultRegistrationCount').val(),\n childrenRegistrationCount: $('#ChildrenRegistrationCount').val()\n };\n\n if ($('#RegisterForm').valid()) {\n postAsJson('/api/Home/ActivityWaitlist/' + activityId, JSON.stringify(data), function (data) {\n if (data.success) {\n window.location = '/ActivityRegistrationConfirmation/' + activityId;\n }\n else {\n $('.registrationSaveButton').removeClass('disabled');\n addAlertMessage(\"alert-danger\", \"Sign Up Failed\", data.errorMessage);\n\n if (data.redirectUrl) {\n window.location = data.redirectUrl;\n }\n }\n });\n }\n });\n\n $('.joinParticipantWaitlist').click(function () {\n if ($('#WaitlistForm').valid()) {\n $('.registrationSaveButton').addClass('disabled');\n\n var data = {\n registrationCount: $('#WaitlistRegistrationCount').val(),\n adultRegistrationCount: $('#WaitlistAdultRegistrationCount').val(),\n childrenRegistrationCount: $('#WaitlistChildrenRegistrationCount').val()\n };\n\n if ($('#WaitlistForm').valid()) {\n postAsJson('/api/Home/ActivityWaitlist/' + activityId, JSON.stringify(data), function (data) {\n if (data.success) {\n window.location = '/ActivityRegistrationConfirmation/' + activityId;\n }\n else {\n $('.registrationSaveButton').removeClass('disabled');\n addWaitlistAlertMessage(\"alert-danger\", \"Sign Up Failed\", data.errorMessage);\n\n if (data.redirectUrl) {\n window.location = data.redirectUrl;\n }\n }\n });\n }\n }\n });\n\n $('.removeWaitlist').click(function () {\n $('.registrationSaveButton').addClass('disabled');\n\n postAsJson('/api/Home/RemoveActivityWaitlist/' + activityId, '', function (data) {\n if (data.success) {\n window.location = '/Dashboard#myActivities';\n }\n });\n });\n\n $('.cancelRegistration').click(function () {\n if (cancelUrl) {\n window.location = cancelUrl;\n } else {\n window.location = '/Dashboard#myActivities';\n }\n });\n}\n\nfunction initValidation() {\n if ($('#RegisterForm').length > 0) {\n $('#RegisterForm').validate(extendValidationSettings({\n }));\n }\n\n if ($('#WaitlistForm').length > 0) {\n $('#WaitlistForm').validate(extendValidationSettings({\n success: null,\n errorContainer: '#waitlistErrorMessageBox',\n errorLabelContainer: '#waitlistErrorList',\n }));\n }\n}\n\nfunction addNumberInGroupValidation() {\n if ($('#RegistrationCount').length > 0) {\n $('#RegistrationCount').rules('add', {\n required: true,\n min: 1,\n max: 999,\n messages: {\n required: \"Party Size is required.\",\n min: \"Party Size must be at least 1.\",\n max: \"Party Size must be less than 1000.\"\n }\n });\n }\n}\n\nfunction addWaitlistValidation() {\n if ($('#WaitlistRegistrationCount').length > 0) {\n $('#WaitlistRegistrationCount').rules('add', {\n required: true,\n min: 1,\n max: 999,\n messages: {\n required: \"Party Size is required.\",\n min: \"Party Size must be at least 1.\",\n max: \"Party Size must be less than 1000.\"\n },\n });\n }\n}\n\nfunction addAdultAndChildRegistrationValidation() {\n if ($('#AdultRegistrationCount').length > 0) {\n $('#AdultRegistrationCount').rules('add', {\n required: true,\n min: function (element) {\n if ($('#ChildrenRegistrationCount').val() && parseInt($('#ChildrenRegistrationCount').val()) == 0) {\n return 1;\n }\n\n return 0;\n },\n max: 999,\n messages: {\n required: \"Number of Adults is required.\",\n min: \"Number of Adults or Number of Children must be at least 1.\",\n max: \"Number of Adults must be less than 1000.\"\n }\n });\n }\n\n if ($('#ChildrenRegistrationCount').length > 0) {\n $('#ChildrenRegistrationCount').rules('add', {\n required: true,\n min: function (element) {\n if ($('#AdultRegistrationCount').val() && parseInt($('#AdultRegistrationCount').val()) == 0) {\n return 1;\n }\n\n return 0;\n },\n max: 999,\n messages: {\n required: \"Number of Children is required.\",\n min: \"Number of Adults or Number of Children must be at least 1.\",\n max: \"Number of Children must be less than 1000.\"\n } \n });\n }\n}\n\nfunction addAdultAndChildWaitlistRegistrationValidation() {\n if ($('#WaitlistAdultRegistrationCount').length > 0) {\n $('#WaitlistAdultRegistrationCount').rules('add', {\n required: true,\n min: function (element) {\n if ($('#WaitlistChildrenRegistrationCount').val() && parseInt($('#WaitlistChildrenRegistrationCount').val()) == 0) {\n return 1;\n }\n\n return 0;\n },\n max: 999,\n messages: {\n required: \"Number of Adults is required.\",\n min: \"Number of Adults or Number of Children must be at least 1.\",\n max: \"Number of Adults must be less than 1000.\"\n }\n });\n }\n\n if ($('#WaitlistChildrenRegistrationCount').length > 0) {\n $('#WaitlistChildrenRegistrationCount').rules('add', {\n required: true,\n min: function (element) {\n if ($('#WaitlistAdultRegistrationCount').val() && parseInt($('#WaitlistAdultRegistrationCount').val()) == 0) {\n return 1;\n }\n\n return 0;\n },\n max: 999,\n messages: {\n required: \"Number of Children is required.\",\n min: \"Number of Adults or Number of Children must be at least 1.\",\n max: \"Number of Children must be less than 1000.\"\n }\n });\n }\n}\n\nfunction addTShirtSizeValidation() {\n if ($('#TShirtSize').length > 0) {\n $('#TShirtSize').rules('add', {\n required: true,\n messages: {\n required: \"T-Shirt Size is required.\"\n }\n });\n }\n}\n\nfunction addDietaryPreferenceValidation() {\n if ($('#DietaryPreference').length > 0) {\n $('#DietaryPreference').rules('add', {\n required: true,\n messages: {\n required: \"Dietary Preference is required.\"\n }\n });\n }\n}\n\nfunction addAlertMessage(alertClass, headerText, messageText) {\n var alert = $('

' + headerText + '

');\n\n if (messageText) {\n alert.append('' + messageText + '');\n }\n\n alert.appendTo(\"#alertContainer\");\n}\n\nfunction addWaitlistAlertMessage(alertClass, headerText, messageText) {\n var alert = $('

' + headerText + '

');\n\n if (messageText) {\n alert.append('' + messageText + '');\n }\n\n alert.appendTo(\"#waitlistAlertContainer\");\n}\n"]}