Fixed numerous problems with adding dates to the availability calendar in the reg...
authorChuck Scott <cscott@gaslightmedia.com>
Wed, 13 Dec 2017 16:36:44 +0000 (11:36 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Wed, 13 Dec 2017 16:36:44 +0000 (11:36 -0500)
classes/data/dataRegEvent.php
config/plugin.ini
models/admin/ajax/updateAvailability.php
models/admin/registrations/events.php
views/admin/registrations/eventDashboard.html

index 1b92734..2bff88c 100644 (file)
@@ -174,7 +174,7 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract
                 'field'     => 'admin_active',
                 'type'      => 'checkbox',
                 'use'       => 'a',
-                'default'   => 0
+                'default'   => 1
             ),
 
             // Active flag to indicate that this event is available for registrations
index 49019dd..2e00476 100644 (file)
@@ -22,12 +22,10 @@ show_rate_type_numb['From']                    = 20
 registration_account_option[1]                 = 'Guest Registration'
 registration_account_option[2]                 = 'Saved Registration Accounts'
 registration_account_option[3]                 = 'Member Contact Registrations'
-registration_account_option[4]                 = 'Ask for Alternate/Emergency Contact'
 
 registration_account_option_numb['Guest']               = 1
 registration_account_option_numb['Saved']               = 2
 registration_account_option_numb['Member']              = 3
-registration_account_option_numb['AlternateContact']    = 4
 
 ;
 ; Payment Method - Use as Bitmap Index or List
index c71f4e2..fb0748e 100644 (file)
     public function modelAction($actionData = false)
     {
 
+        if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+            trigger_error("Registration Event: updateAvailability class called", E_USER_NOTICE);
+        }
+
         $haveRequest = false;
 
         // Get new time flag
         // Get the reg_time entry id
         if ($newTime) {
 
+            $active = false;
+            if (isset($_REQUEST['active']) && $_REQUEST['active'] == 'true') {
+                $active = true;
+            }
             // This is a new entry
             $allDay = false;
             if (isset($_REQUEST['allDay']) && $_REQUEST['allDay'] == 'true') {
index bb571aa..4636efb 100644 (file)
@@ -115,6 +115,7 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent
         $regClassesJSON            = false;
         $regTimesJSON              = false;
         $regEventDeleted           = false;
+        $classes                   = false;
 
         // Register the masked input script that we need for input controls
         wp_dequeue_script('glm-members-admin-maskedinput');
index 59290fc..1e00caf 100644 (file)
     <p><h3>Dates and Availability</h3></p>
     <p>Event occurs every day from first day to last day at the times shown.</p>
     <table>
-      {foreach $regEvent.recurrenceSummary as $rs}
-        <tr><th>First Day of Event: </th><td>{$rs.firstTime.start_time.datetime} - {$rs.firstTime.end_time.datetime}</td></tr>
-        <tr><th>Last Day of Event: </th><td>{$rs.lastTime.start_time.datetime} - {$rs.lastTime.end_time.datetime}</td></tr>
-      {/foreach}
       {foreach $regEvent.reg_time as $rt}
        {if $rt.non_time_specific.value}
         {if $rt.attendee_max == 0}
   {if $regEvent.time_specific.value}        
         <tr id="dialogTrackLine"><th style="text-align: left">Track Attendees:</th><td><input id="dialogAttendees" type="checkbox" value=""></td></tr>
   {/if}
-        <tr id="dialogStartTimeLine"><th style="text-align: left">Start Time:</th><td><input id="dialogStartTime" class="glm-form-text-input-short time-input not-all-day" type="text" value=""></td></tr>
-        <tr id="dialogEndTimeLine"><th style="text-align: left">End Time:</th><td><input id="dialogEndTime" class="glm-form-text-input-short time-input not-all-day" type="text" value=""></td></tr>
+        <tr id="dialogStartTimeLine"><th style="text-align: left" class="glm-required">Start Time:</th><td><input id="dialogStartTime" class="glm-form-text-input-short time-input not-all-day" type="text" value=""></td></tr>
+        <tr id="dialogEndTimeLine"><th style="text-align: left" class="glm-required">End Time:</th><td><input id="dialogEndTime" class="glm-form-text-input-short time-input not-all-day" type="text" value=""></td></tr>
   {if $regEvent.time_specific.value}        
         <tr><th style="text-align: left">Maximum Attendees:</th><td><input class="glm-form-text-input-veryshort availabilityInput" type="text" id="dialogMaxAtt" value=""> 0 = Unlimited</td></tr>
         <tr id="dialogRegLine"><th style="text-align: left">Registered Attendees:</th><td id="dialogRegAtt"></td></tr>
            
             function initFullCalendar(){
                 $('#eventCalendar').fullCalendar({
+                    timezone: 'local',
     {if $regEvent}
                     // Add existing registration dates/times
                     events: [
         {/foreach}
       {/if}
                     ],
-                    // Clicking on a date cell (not a reg event) Brings up the new reg event dialog
+                    // Clicking on a date cell (not an existing event time) Brings up the new date dialog
                     dayClick: function(date, allDay, jsEvent, view) {
 
                         $('#dialogAvailSubmit').off('click');           
-                        
-                        $('#availabilityTitle').html('Create New: '+date.format());
+                        $('#availabilityTitle').html('Create New: '+date.format('MM/DD/YYYY'));
                         $('#availabilityEditDialog').dialog('open');
-                        $('#dialogRegActive').prop('checked', true);
+                        $('#dialogRegActive').prop('checked', false);
                         $('#dialogTimeAllDay').prop('checked', false);
                         $('#dialogStartTime').val('');
                         $('#dialogEndTime').val('');
                         $('#dialogAvailLine').hide();
                         $('#dialogAvailSubmit').on('click', function() {
 
+                            if ($('#dialogStartTime').val() == '' || $('#dialogEndTime').val() == '') {
+                                alert('Both start and end times are required!');
+                            } else { 
+
                             // Submit clicked 
-                            var max = $('#dialogMaxAtt').val();
+        {if $regEvent.time_specific.value}                                     
+                                var max = $('#dialogMaxAtt').val();
+        {else}                      
+                                var max = 0;
+        {/if}
                             var startDate = new Date($('#dialogStartTime').val());
                             var startTime = $('#dialogStartTime').val();
 
                             // Initialize the event data object with submitted data 
                             var newEvent = {
                     {if $regEvent.time_specific.value}
-                                title:              startTime + ' unlimited',
+                                title:              ' unlimited',
                     {else}
                                 title:              '',
                     {/if}
                                 active:             $('#dialogRegActive').is(":checked"),
                                 backgroundColor:    '#aaa',
                                 allDay:             $('#dialogTimeAllDay').is(':checked'),
-                                attendees:          $('#dialogAttendees').is(':checked'),          
+        {if $regEvent.time_specific.value}                                     
+                                attendees:          $('#dialogAttendees').is(':checked'),
+        {else}                      
+                                attendees:          0,
+        {/if}
                                 max:                max,
                                 count:              0,
                                 pending:            0,
                     {if $regEvent.time_specific.value}
                             // If max or active is set, override the defaults
                             if (newEvent.max > 0 ) {
-                                newEvent.title = startTime + ' ' + newEvent.max + '-0-0-' + newEvent.max
+                                newEvent.title = ' ' + newEvent.max + '-0-0-' + newEvent.max
                             }
                             if (newEvent.active) {
                                 newEvent.backgroundColor = 'light-blue';
                                 
                             });
 
+                            }
                         });
 
                     },