1$(document).ready(function() { 2 let create_participant = ko.observable(); 3 if($('#create_participant:checked').size()) { 4 $('.creating_participant').show(); 5 $('.not_creating_participant').hide(); 6 create_participant(true); 7 } else { 8 $('.creating_participant').hide(); 9 $('.not_creating_participant').show(); 10 create_participant(false); 11 } 12 13 $('#create_participant').click(function() { 14 if($(this).is(':checked')) { 15 $('.creating_participant').show(); 16 $('.not_creating_participant').hide(); 17 create_participant(true); 18 } else { 19 $('.creating_participant').hide(); 20 $('.not_creating_participant').show(); 21 create_participant(false); 22 } 23 }); 24 25 $('input[name="email"]').on("blur", function() { 26 $(this).val($(this).val().trim()) 27 }); 28 29 window.sampleParticipant = new Participant({data: Object.assign({}, window['participantSample'])}); 30 window.sampleUser = new User({ 31 data: { 32 id: null, 33 context_id: 0, 34 email: '', 35 first_name: '', 36 last_name: '', 37 name: '', 38 gender_id: null, 39 dd: null, 40 mm: null, 41 yyyy: null, 42 address: { 43 address_id: null, 44 company_name: null, 45 first_name: null, 46 last_name: null, 47 address1: null, 48 address2: null, 49 city: null, 50 prov: null, 51 prov_code: null, 52 country: null, 53 country_code: null, 54 postal: null, 55 phone: null, 56 cell: null, 57 email: null 58 } 59 } 60 }); 61 62 $('#dd').change(function () { 63 window.sampleParticipant.dd(($(this).val()||'').padStart(2, '0')); 64 window.sampleUser.dd(($(this).val()||'').padStart(2, '0')); 65 }).change(); 66 $('#mm').change(function () { 67 window.sampleParticipant.mm(($(this).val()||'').padStart(2, '0')); 68 window.sampleUser.mm(($(this).val()||'').padStart(2, '0')); 69 }).change(); 70 $('#yyyy').change(function () { 71 window.sampleParticipant.yyyy($(this).val()||''); 72 window.sampleUser.yyyy($(this).val()||''); 73 }).change(); 74 $('#email').change(function() { 75 window.sampleUser.email($(this).val()||''); 76 window.sampleUser.address.email($(this).val()||''); 77 }).change(); 78 $('#first_name').change(function() { 79 window.sampleParticipant.first_name($(this).val()||''); 80 window.sampleParticipant.name([window.sampleParticipant.first_name(), window.sampleParticipant.last_name()].filter(function(val) {return (val||'').trim().length > 0}).join(' ')); 81 82 window.sampleUser.first_name($(this).val()||''); 83 window.sampleUser.address.first_name($(this).val()||''); 84 window.sampleUser.name([window.sampleUser.first_name(), window.sampleUser.last_name()].filter(function(val) {return (val||'').trim().length > 0}).join(' ')); 85 }).change(); 86 $('#last_name').change(function() { 87 window.sampleParticipant.last_name($(this).val()||''); 88 window.sampleParticipant.name([window.sampleParticipant.first_name(), window.sampleParticipant.last_name()].filter(function(val) {return (val||'').trim().length > 0}).join(' ')); 89 90 window.sampleUser.last_name($(this).val()||''); 91 window.sampleUser.address.last_name($(this).val()||''); 92 window.sampleUser.name([window.sampleUser.first_name(), window.sampleUser.last_name()].filter(function(val) {return (val||'').trim().length > 0}).join(' ')); 93 }).change(); 94 $('#gender').change(function () { 95 window.sampleParticipant.gender_id($(this).val() || null) 96 window.sampleUser.gender_id($(this).val() || null) 97 }).change(); 98 $('#company_name').change(function() { 99 window.sampleUser.address.company_name($(this).val()||''); 100 }).change(); 101 $('#address1').change(function() { 102 window.sampleUser.address.address1($(this).val()||''); 103 }).change(); 104 $('#address2').change(function() { 105 window.sampleUser.address.address2($(this).val()||''); 106 }).change(); 107 $('#city').change(function() { 108 window.sampleUser.address.city($(this).val()||''); 109 }).change(); 110 $('#prov').change(function() { 111 let province = $(this).val() || '', 112 prov_code = province; 113 if(province && $(this).is('select')) { 114 province = $(this).find("option:selected").text() 115 } 116 window.sampleUser.address.prov(province); 117 window.sampleUser.address.prov_code(prov_code); 118 }).change(); 119 $('#country').change(function() { 120 let country = $(this).val() || '', 121 country_code = country; 122 if(country && $(this).is('select')) { 123 country = $(this).find("option:selected").text() 124 } 125 window.sampleUser.address.country(country); 126 window.sampleUser.address.country_code(country_code); 127 }).change(); 128 $('#postal').change(function() { 129 window.sampleUser.address.postal($(this).val()||''); 130 }); 131 $('#phone').change(function() { 132 window.sampleUser.address.phone($(this).val()||''); 133 }).change(); 134 $('#cell').change(function() { 135 window.sampleUser.address.cell($(this).val()||''); 136 }).change(); 137 138 (function () { 139 let Policies = function (pageData, post) { 140 let self = this; 141 let _clubPoliciesById = {}; 142 self.getClubPolicyById = function (id) { 143 return _clubPoliciesById[id]; 144 }; 145 self.participant = ko.observable(window.sampleParticipant); 146 self.user = window.sampleUser; 147 148 self.create_participant = ko['pureComputed'](function () { 149 return create_participant() || window['displayBirthdate']; 150 }); 151 152 self.getSiteFieldValue = function(site_field, context) { 153 let site_field_id = site_field.site_field_id(), 154 context_id = context.context_id(); 155 if( 156 typeof window.created_site_fields === 'object' && window.created_site_fields !== null && 157 typeof window.created_site_fields[site_field_id] === 'object' && window.created_site_fields[site_field_id] !== null && 158 typeof window.created_site_fields[site_field_id][context_id] === 'object' && window.created_site_fields[site_field_id][context_id] !== null 159 ) { 160 return window.created_site_fields[site_field_id][context_id] 161 } 162 } 163 164 self.policies = ko['observableArray']([]); 165 ko.mapping.fromJS(pageData, { 166 club_policies: { 167 create: function (options) { 168 _clubPoliciesById[options.data.club_policy_id] = new ClubPolicy(options.data); 169 return _clubPoliciesById[options.data.club_policy_id]; 170 } 171 }, 172 policies: { 173 create: function (options) { 174 if (post && post[options.data.club_policy_id]) { 175 options.data.viewed = post[options.data.club_policy_id].viewed; 176 options.data.accepted = post[options.data.club_policy_id].accepted; 177 options.data.acknowledged_by = post[options.data.club_policy_id].acknowledged_by; 178 options.data.acknowledged_age_of_majority = post[options.data.club_policy_id].acknowledged_age_of_majority; 179 options.data.digital_signature = post[options.data.club_policy_id].digital_signature; 180 options.data.acceptance_data = post[options.data.club_policy_id].policy_fields; 181 } 182 return new OrderClubPolicy(options.data, self); 183 } 184 } 185 }, self); 186 self.applicablePolicies = ko['pureComputed'](function () { 187 let age = self.participant().age(); 188 return self.policies().filter(function (policy) { 189 let max_participant_age = parseInt(policy.club_policy()['max_participant_age'](), 10); 190 let min_participant_age = policy.club_policy()['present_only_if_age_of_majority']() ? parseInt(policy.club_policy()['acknowledge_age_of_majority'](), 10) : 0; 191 return (
192 policy.club_policy().apply_to() === 'user' || ( 193 create_participant() && ( 194 (!age || 195 ((!max_participant_age || age <= max_participant_age) && 196 age >= min_participant_age) 197 ) 198 ) 199 ) 200 ); 201 }); 202 }); 203 self.groupedPolicies = ko['pureComputed'](function () { 204 let result = new ObjectMap(); 205 self.applicablePolicies().forEach(function (orderPolicy) { 206 let groupingType = orderPolicy.club_policy().groupingType(); 207 let obj = result.get(groupingType); 208 if (!obj) { 209 obj = { 210 type: groupingType, 211 policies: [] 212 }; 213 result.put(groupingType, obj); 214 } 215 obj.policies.push(orderPolicy); 216 }); 217 return result.values(); 218 }); 219 self.openClubPolicy = function (orderPolicy) { 220 orderPolicy.closeCallback(function () { 221 if (orderPolicy.isDisabled()) { 222 orderPolicy.resetPolicy(); 223 } 224 orderPolicy.modal.close(); 225 }); 226 orderPolicy.open(); 227 }; 228 let _lastValues = {}; 229 ko.computed(function () { 230 let currentValues = { 231 create_participant: create_participant(), 232 dd: self.participant().dd(), 233 mm: self.participant().mm(), 234 yyyy: self.participant().yyyy() 235 }; 236 if ( 237 (typeof _lastValues.create_participant !== 'undefined' && _lastValues.create_participant !== currentValues.create_participant) || 238 (typeof _lastValues.dd !== 'undefined' && _lastValues.dd !== currentValues.dd) || 239 (typeof _lastValues.mm !== 'undefined' && _lastValues.mm !== currentValues.mm) || 240 (typeof _lastValues.yyyy !== 'undefined' && _lastValues.yyyy !== currentValues.yyyy) 241 ) { 242 self.applicablePolicies().forEach(function (orderPolicy) { 243 if (orderPolicy.hasAgeRestrictions()) { 244 orderPolicy.resetPolicy(); 245 orderPolicy.viewed(0); 246 } 247 }); 248 } 249 _lastValues = currentValues 250 }); 251 }; 252 let selector = document.querySelector('#club-policies'); 253 if (window['pageData'] && selector) { 254 let vm = new Policies(window['pageData'], window['policyPost']); 255 ko.applyBindings(vm, selector); 256 } 257 })(); 258 259 if (window.frameElement && window.frameElement.id == 'fancybox-frame') { 260 parent.location = '/login/'; 261 } 262});
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.