@@ -2,31 +2,33 @@ var eduBookingView = {
22 Customer : null ,
33 ContactPerson : null ,
44 Participants : [ ] ,
5+ SingleParticipant : false ,
56 MaxParticipants : 0 ,
67 CurrentParticipants : 0 ,
78 AddParticipant : function ( ) {
8- if ( eduBookingView . MaxParticipants == - 1 || eduBookingView . CurrentParticipants < eduBookingView . MaxParticipants )
9- {
10- var holder = document . getElementById ( 'edu-participantHolder' ) ;
11- var tmpl = document . querySelector ( '.eduadmin .participantItem.template' ) ;
12- var cloned = tmpl . cloneNode ( true ) ;
13- cloned . style . display = 'block' ;
14- cloned . className = cloned . className . replace ( ' template' , '' ) ;
15- holder . appendChild ( cloned ) ;
16- }
17- else
18- {
19- var partWarning = document . getElementById ( 'edu-warning-participants' ) ;
20- if ( partWarning )
9+ if ( ! eduBookingView . SingleParticipant ) {
10+ if ( eduBookingView . MaxParticipants == - 1 || eduBookingView . CurrentParticipants < eduBookingView . MaxParticipants )
2111 {
22- partWarning . style . display = 'block' ;
23- setTimeout ( function ( ) {
24- var partWarning = document . getElementById ( 'edu-warning-participants' ) ;
25- partWarning . style . display = '' ;
26- } , 5000 ) ;
12+ var holder = document . getElementById ( 'edu-participantHolder' ) ;
13+ var tmpl = document . querySelector ( '.eduadmin .participantItem.template' ) ;
14+ var cloned = tmpl . cloneNode ( true ) ;
15+ cloned . style . display = 'block' ;
16+ cloned . className = cloned . className . replace ( ' template' , '' ) ;
17+ holder . appendChild ( cloned ) ;
18+ }
19+ else
20+ {
21+ var partWarning = document . getElementById ( 'edu-warning-participants' ) ;
22+ if ( partWarning )
23+ {
24+ partWarning . style . display = 'block' ;
25+ setTimeout ( function ( ) {
26+ var partWarning = document . getElementById ( 'edu-warning-participants' ) ;
27+ partWarning . style . display = '' ;
28+ } , 5000 ) ;
29+ }
2730 }
2831 }
29-
3032 eduBookingView . UpdatePrice ( ) ;
3133 } ,
3234 RemoveParticipant : function ( obj ) {
@@ -42,7 +44,7 @@ var eduBookingView = {
4244 } ,
4345 CheckParticipantCount : function ( )
4446 {
45- var participants = document . querySelectorAll ( '.eduadmin .participantItem:not(.template):not(.contactPerson)' ) . length - 1 ;
47+ var participants = ( eduBookingView . SingleParticipant ? 1 : document . querySelectorAll ( '.eduadmin .participantItem:not(.template):not(.contactPerson)' ) . length - 1 ) ;
4648 if ( participants >= eduBookingView . MaxParticipants && eduBookingView . MaxParticipants >= 0 ) {
4749 return false ;
4850 }
@@ -59,7 +61,7 @@ var eduBookingView = {
5961 }
6062 }
6163 eduBookingView . ContactAsParticipant ( ) ;
62- eduBookingView . CurrentParticipants = document . querySelectorAll ( '.eduadmin .participantItem:not(.template):not(.contactPerson)' ) . length + contact ;
64+ eduBookingView . CurrentParticipants = ( eduBookingView . SingleParticipant ? 1 : document . querySelectorAll ( '.eduadmin .participantItem:not(.template):not(.contactPerson)' ) . length + contact ) ;
6365
6466 var questions = document . querySelectorAll ( '.questionPanel [data-price]' ) ;
6567
@@ -160,7 +162,7 @@ var eduBookingView = {
160162 }
161163 }
162164
163- if ( contactParticipant . checked ) {
165+ if ( contactParticipant && contactParticipant . checked ) {
164166 var subEventPrices = document . querySelectorAll ( '.eduadmin .participantItem.contactPerson:not(.template) input.subEventCheckBox:checked' ) ;
165167 if ( subEventPrices . length > 0 ) {
166168 for ( var i = 0 ; i < subEventPrices . length ; i ++ ) {
0 commit comments