diff --git a/include/controllers/default/cockpit/api/houroverride.php b/include/controllers/default/cockpit/api/houroverride.php index 972c3062f..71ba53894 100644 --- a/include/controllers/default/cockpit/api/houroverride.php +++ b/include/controllers/default/cockpit/api/houroverride.php @@ -44,12 +44,28 @@ class Controller_api_houroverride extends Crunchbutton_Controller_RestAccount { $date_start = $this->request()[ 'date_start' ]; $date_start = explode( '/' , $date_start ); $date_start_hour = ( $this->request()[ 'date_start_hour' ] ) ? $this->request()[ 'date_start_hour' ] : '00:00'; - $date_start = $date_start[ 2 ] . '/' . $date_start[ 0 ] . '/' . $date_start[ 1 ] . ' ' . $date_start_hour . ':00'; + $date_start_hour = explode( ':', $date_start_hour ); + $date_start_hr = $date_start_hour[ 0 ]; + $date_start_mn = $date_start_hour[ 1 ]; + $hour_override_date_start_ampm = $this->request()[ 'hour_override_date_start_ampm' ]; + if( $hour_override_date_start_ampm == 'PM' ){ + $date_start_hr = $date_start_hr + 12; + } + + $date_start = $date_start[ 2 ] . '/' . $date_start[ 0 ] . '/' . $date_start[ 1 ] . ' ' . $date_start_hr . ':' . $date_start_mn; $date_end = $this->request()[ 'date_end' ]; $date_end = explode( '/' , $date_end ); $date_end_hour = ( $this->request()[ 'date_end_hour' ] ) ? $this->request()[ 'date_end_hour' ] : '00:00'; - $date_end = $date_end[ 2 ] . '/' . $date_end[ 0 ] . '/' . $date_end[ 1 ] . ' ' . $date_end_hour . ':00'; + $date_end_hour = explode( ':', $date_end_hour ); + $date_end_hr = $date_end_hour[ 0 ]; + $date_end_mn = $date_end_hour[ 1 ]; + $hour_override_date_end_ampm = $this->request()[ 'hour_override_date_end_ampm' ]; + if( $hour_override_date_end_ampm == 'PM' ){ + $date_end_hr = $date_end_hr + 12; + } + + $date_end = $date_end[ 2 ] . '/' . $date_end[ 0 ] . '/' . $date_end[ 1 ] . ' ' . $date_end_hr . ':' . $date_end_mn; $hour->date_start = $date_start; $hour->date_end = $date_end; diff --git a/include/controllers/default/cockpit/tests/hours/index.php b/include/controllers/default/cockpit/tests/hours/index.php index 8356d8701..f4041c2ad 100644 --- a/include/controllers/default/cockpit/tests/hours/index.php +++ b/include/controllers/default/cockpit/tests/hours/index.php @@ -2,7 +2,6 @@ class Controller_tests_hours extends Crunchbutton_Controller_Account { public function init() { - $restaurant = new Restaurant($_REQUEST['r'] ? intval($_REQUEST['r']) : 1); $now = (new DateTime('now'))->format('Y-m-d H:i:s'); if (!$_REQUEST['t'] || $_REQUEST['t'] == 'NOW') { @@ -11,15 +10,9 @@ class Controller_tests_hours extends Crunchbutton_Controller_Account { } else { $time = $_REQUEST['t']; } - - c::view()->restaurant = $restaurant; c::view()->open = $restaurant->open($time); c::view()->time = new DateTime($time, new DateTimeZone($restaurant->timezone)); - c::view()->display('tests/hours/index'); - - - } } \ No newline at end of file diff --git a/include/library/Cana/Util.php b/include/library/Cana/Util.php index 76fc1525a..cc417bb24 100755 --- a/include/library/Cana/Util.php +++ b/include/library/Cana/Util.php @@ -32,6 +32,33 @@ class Cana_Util extends Cana_Model { return $reverse ? array_reverse($array) : $array; } + public static function format_time( $time ) { + $h = floor( $time / 100 ); + $m = $time - ( 100 * $h ); + if( $h >= 24 ){ + $h -= 24; + } + $mintute_formated = ':' . str_pad( $m, 2, '0', STR_PAD_LEFT ); + return $h . $mintute_formated; + } + + function sort_col($table, $colname) { + $tn = $ts = $temp_num = $temp_str = array(); + foreach ($table as $key => $row) { + if(is_numeric(substr($row[$colname], 0, 1))) { + $tn[$key] = $row[$colname]; + $temp_num[$key] = $row; + } + else { + $ts[$key] = $row[$colname]; + $temp_str[$key] = $row; + } + } + unset($table); + array_multisort($tn, SORT_ASC, SORT_NUMERIC, $temp_num); + array_multisort($ts, SORT_ASC, SORT_STRING, $temp_str); + return array_merge($temp_num, $temp_str); + } public static function convertBytes($bytesIn, $from = 'bytes', $to = 'bytes') { diff --git a/include/library/Crunchbutton/Restaurant.php b/include/library/Crunchbutton/Restaurant.php index b3e7638d7..96a02d8f6 100644 --- a/include/library/Crunchbutton/Restaurant.php +++ b/include/library/Crunchbutton/Restaurant.php @@ -694,8 +694,6 @@ class Crunchbutton_Restaurant extends Cana_Table_Trackchange { } public function hours($gmt = false) { - - $force_close = $this->forceClose(); $gmt = $gmt ? '1' : '0'; @@ -732,19 +730,24 @@ class Crunchbutton_Restaurant extends Cana_Table_Trackchange { /** * Confirms a restaurant is open */ - public function open($dt = null) { + public function open( $dt = null ) { if (!$this->open_for_business) { - /*if( $this->forceOpen() ){ + if( $this->forceOpen() ){ return true; - }*/ + } + return false; + } + // it means some overrided hour is forcing it to be opened + if( $this->forceOpen() ){ + return true; + } + + // it means some overrided hour is forcing it to be closed + if( $this->forceClose() ){ return false; } - /*if( $this->forceClose() ){ - return false; - } - */ $today = new DateTime( 'now', new DateTimeZone( $this->timezone ) ); $hours = $this->hours(); $day = strtolower($today->format('D')); @@ -806,13 +809,25 @@ class Crunchbutton_Restaurant extends Cana_Table_Trackchange { } // Return minutes left to close - public function closesIn($dt = null) { - if (!$this->open()) { + public function closesIn( $dt = null ) { + if ( !$this->open() ) { return false; } - $hours = $this->hours(); + + $_hours = []; + foreach ( $this->hours() as $hour ) { + $_hours[$hour->day][] = [$hour->time_open, $hour->time_close]; + } + $_hours = $this->overrideHours( $_hours ); + $hours = []; + foreach( $_hours as $day => $segments ){ + foreach( $segments as $segment ){ + $hours[] = ( object ) [ 'day' => $day, 'time_open' => $segment[ 0 ], 'time_close' => $segment[ 1 ] ]; + } + } + $today = new DateTime($dt ? $dt : 'now', new DateTimeZone($this->timezone)); - $day = strtolower($today->format('D')); + $day = strtolower($today->format('D')); foreach ($hours as $hour) { if ($hour->day != $day) { @@ -835,14 +850,25 @@ class Crunchbutton_Restaurant extends Cana_Table_Trackchange { } // Return minutes left to open - public function openIn($dt) { + public function openIn( $dt = null ) { if ($this->open()) { return false; } - $hours = $this->hours(); + $_hours = []; + foreach ( $this->hours() as $hour ) { + $_hours[$hour->day][] = [$hour->time_open, $hour->time_close]; + } + $_hours = $this->overrideHours( $_hours ); + $hours = []; + foreach( $_hours as $day => $segments ){ + foreach( $segments as $segment ){ + $hours[] = ( object ) [ 'day' => $day, 'time_open' => $segment[ 0 ], 'time_close' => $segment[ 1 ] ]; + } + } + $today = new DateTime($dt ? $dt : 'now', new DateTimeZone($this->timezone)); - $day = strtolower($today->format('D')); + $day = strtolower($today->format('D')); foreach ($hours as $hour) { if ($hour->day != $day) { @@ -1046,6 +1072,12 @@ class Crunchbutton_Restaurant extends Cana_Table_Trackchange { return $this->_weight; } + public function export_force_override_hours(){ + $data = $this->exports(); + $data[ '_hours' ] = $this->overrideHours( $data[ '_hours' ] ); + return $data; + } + /** * Returns an array with all the information for a Restaurant. * @@ -1073,7 +1105,7 @@ class Crunchbutton_Restaurant extends Cana_Table_Trackchange { $out['_closesIn'] = $this->closesIn(); $out['_weight'] = $this->weight(); $out['_minimumTime'] = 15; // Min minutes to show the hurry message - // $out['_openIn'] = $this->openIn(); + $out['_openIn'] = $this->openIn(); if( $out['_closesIn'] == 0 ){ $out['_open'] = false; @@ -1177,7 +1209,10 @@ class Crunchbutton_Restaurant extends Cana_Table_Trackchange { $out['_hours'][$hours->day][] = [$hours->time_open, $hours->time_close]; } - $out['_hours'] = $this->overrideHours( $out['_hours'] ); + // Dont export the overrided hours at cockpit + if( !$isCockpit || $ignore['force_override_hours'] == true ){ + $out['_hours'] = $this->overrideHours( $out['_hours'] ); + } if (!$ignore['_preset']) { if ($this->preset()->count()) { @@ -1213,40 +1248,146 @@ class Crunchbutton_Restaurant extends Cana_Table_Trackchange { } public function overrideHours( $hours ){ - /* - $overrides = Crunchbutton_Restaurant_Hour_Override::q( "SELECT * FROM restaurant_hour_override WHERE id_restaurant = {$this->id_restaurant}" ); - if( $overrides->count() ){ - foreach( $overrides as $override ){ - $type = $override->type; - $date_start = new DateTime( $override->date_start, new DateTimeZone( $this->timezone ) ); - $date_end = new DateTime( $override->date_end, new DateTimeZone( $this->timezone ) ); - $date_start->setTimezone( new DateTimeZone('GMT' ) ); - $date_end->setTimezone( new DateTimeZone('GMT' ) ); - foreach ( $hours as $weekday => $hour ) { - $time_close = new DateTime( $hour->time_close, new DateTimeZone( $this->timezone ) ); - // if it is the same weekday - if( $date_start->format( 'D' ) == $time_open->format( 'D' ) ){ - if( $type == Crunchbutton_Restaurant_Hour_Override::TYPE_CLOSED ){ - if( $date_start->format( 'His' ) > $time_open->format( 'His' ) ){ - $hour->time_open = $time_open->format( 'Y-m-d' ) . ' ' . $date_start->format( 'H:i' ); - } - $hour->time_close = $date_end->format( 'Y-m-d H:i' ); - } - } - $interval = date_diff( $datetime1, $datetime2 ); - /*if( $date_end->format( 'D' ) == $time_close->format( 'D' ) ){ - if( $type == Crunchbutton_Restaurant_Hour_Override::TYPE_CLOSED ){ - if( $date_end->format( 'His' ) < $time_close->format( 'His' ) ){ - $hour->time_close = $time_close->format( 'Y-m-d' ) . ' ' . $date_end->format( 'H:i' ); - } - } - } - } + + if( count( $hours ) == 0 ){ + return $hours; + } + + $weekdays = [ 'mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun' ]; + + // Convert to hours starting at monday + $hoursStartFinish = []; + foreach( $hours as $day => $segments ){ + $dayshours = array_search( $day, $weekdays ) * 2400; + foreach( $segments as $times ){ + preg_match( '/(\d+):(\d+)/', $times[ 0 ], $hour_open ); + preg_match( '/(\d+):(\d+)/', $times[ 1 ], $hour_close ); + $hour_open = ( $dayshours + intval( $hour_open[ 1 ] ) * 100 ) + intval( $hour_open[ 2 ] ); + $hour_close = ( $dayshours + intval( $hour_close[ 1 ] ) * 100 ) + intval( $hour_close[ 2 ] ); + $hoursStartFinish[] = [ 'open' => $hour_open, 'close' => $hour_close ]; } } - */ - return $hours; + + $monday = date('Y-m-d', strtotime('monday this week') ); + $sunday = date('Y-m-d', strtotime('sunday this week') ); + $overrides = Crunchbutton_Restaurant_Hour_Override::q( "SELECT * FROM restaurant_hour_override + WHERE id_restaurant = {$this->id_restaurant} + AND + ( DATE_FORMAT( date_start, '%Y-%m-%d' ) >= '{$monday}' AND DATE_FORMAT( date_start, '%Y-%m-%d' ) <= '{$sunday}' ) + OR + + ( DATE_FORMAT( date_start, '%Y-%m-%d' ) < '{$monday}' AND DATE_FORMAT( date_end, '%Y-%m-%d' ) > '{$monday}' ) " ); + $hoursStartFinishOverrideClose = []; + if( $overrides->count() ){ + + foreach( $overrides as $override ){ + + $monday = new DateTime( date('Y-m-d H:i:s', strtotime('monday this week') ), new DateTimeZone( $this->timezone ) ); + $date_start = new DateTime( $override->date_start, new DateTimeZone( $this->timezone ) ); + // Limit the override to this week + if( $date_start < $monday ){ + $date_start = $monday; + } + $dayshours = array_search( strtolower( $date_start->format( 'D' ) ), $weekdays ) * 2400; + $hour_open = ( $dayshours + intval( $date_start->format( 'H' ) ) * 100 ) + intval( $date_start->format( 'i' ) ); + + $sunday = new DateTime( date('Y-m-d H:i:s', strtotime('sunday this week') ), new DateTimeZone( $this->timezone ) ); + $sunday->setTime( 23, 59 ); + $date_end = new DateTime( $override->date_end, new DateTimeZone( $this->timezone ) ); + // Limit the override to this week + if( $date_end > $sunday ){ + $date_end = $sunday; + } + $dayshours = array_search( strtolower( $date_end->format( 'D' ) ), $weekdays ) * 2400; + + $hour_close = ( $dayshours + intval( $date_end->format( 'H' ) ) * 100 ) + intval( $date_end->format( 'i' ) ); + if( $override->type == Crunchbutton_Restaurant_Hour_Override::TYPE_CLOSED ){ + $hoursStartFinishOverrideClose[] = [ 'start' => $hour_open, 'end' => $hour_close ]; + } else if( $override->type == 'open' ){ + // Merge the override open hours at the open/close array + $hoursStartFinish[] = [ 'open' => $hour_open, 'close' => $hour_close ]; + } + } + } + + $hoursStartFinish = Cana_Util::sort_col( $hoursStartFinish, 'open' ); + + // Merge the hours + foreach( $hoursStartFinish as $key => $val ){ + $getNext = false; + foreach( $hoursStartFinish as $keyNext => $valNext ){ + if( $getNext ){ + if( $hoursStartFinish[ $keyNext ][ 'open' ] <= $hoursStartFinish[ $key ][ 'close' ] + && $hoursStartFinish[ $keyNext ][ 'close' ] - $hoursStartFinish[ $key ][ 'open' ] < 3600 ) { + $hoursStartFinish[ $key ][ 'close' ] = $hoursStartFinish[ $keyNext ][ 'close' ]; + unset( $hoursStartFinish[ $keyNext ] ); + $getNext = false; + } + } + if( $key == $keyNext ){ + $getNext = true; + } + } + } + + foreach( $hoursStartFinishOverrideClose as $keyClose => $valClose ){ + foreach( $hoursStartFinish as $keyOpen => $valOpen ){ + // the close override is between a segment + if( $hoursStartFinishOverrideClose[ $keyClose ][ 'start' ] >= $hoursStartFinish[ $keyOpen ][ 'open' ] + && $hoursStartFinishOverrideClose[ $keyClose ][ 'end' ] < $hoursStartFinish[ $keyOpen ][ 'close' ] ){ + $hoursStartFinish[] = [ 'open' => $hoursStartFinishOverrideClose[ $keyClose ][ 'end' ], 'close' => $hoursStartFinish[ $keyOpen ][ 'close' ] ]; + $hoursStartFinish[ $keyOpen ][ 'close' ] = $hoursStartFinishOverrideClose[ $keyClose ][ 'start' ]; + } else + // the close override start after the segment but ends before it + if( $hoursStartFinishOverrideClose[ $keyClose ][ 'start' ] <= $hoursStartFinish[ $keyOpen ][ 'open' ] + && $hoursStartFinishOverrideClose[ $keyClose ][ 'end' ] > $hoursStartFinish[ $keyOpen ][ 'open' ] + && $hoursStartFinishOverrideClose[ $keyClose ][ 'end' ] > $hoursStartFinish[ $keyOpen ][ 'close' ] ){ + unset( $hoursStartFinish[ $keyOpen ] ); + } else + if( $hoursStartFinishOverrideClose[ $keyClose ][ 'start' ] <= $hoursStartFinish[ $keyOpen ][ 'open' ] + && $hoursStartFinishOverrideClose[ $keyClose ][ 'end' ] > $hoursStartFinish[ $keyOpen ][ 'open' ] ){ + $hoursStartFinish[ $keyOpen ][ 'open' ] = $hoursStartFinishOverrideClose[ $keyClose ][ 'end' ]; + } + } + } + + $hoursStartFinish = Cana_Util::sort_col( $hoursStartFinish, 'open' ); + + foreach( $hoursStartFinish as $key => $val ){ + $getNext = false; + foreach( $hoursStartFinish as $keyNext => $valNext ){ + if( $getNext ){ + if( $hoursStartFinish[ $keyNext ][ 'open' ] <= $hoursStartFinish[ $key ][ 'close' ] + && $hoursStartFinish[ $keyNext ][ 'close' ] - $hoursStartFinish[ $key ][ 'open' ] < 3600 ) { + $hoursStartFinish[ $key ][ 'close' ] = $hoursStartFinish[ $keyNext ][ 'close' ]; + unset( $hoursStartFinish[ $keyNext ] ); + $getNext = false; + } + } + if( $key == $keyNext ){ + $getNext = true; + } + } + } + $_hours = []; + foreach( $hoursStartFinish as $key => $val ){ + $open = $hoursStartFinish[ $key ][ 'open' ]; + $close = $hoursStartFinish[ $key ][ 'close' ]; + $weekday = $weekdays[ floor( $open / 2400 ) ]; + while( $open >= 2400 ) { + $open -= 2400; + $close -= 2400; + } + if( !$hours[ $weekday ] ){ + $hours[ $weekday ] = []; + } + $_hours[ $weekday ][] = array( Cana_Util::format_time( $open ), Cana_Util::format_time( $close ) ); + } + return $_hours; } + + + /** * Imports an array with all the information for a Restaurant. * diff --git a/include/library/Crunchbutton/Restaurant/Hour/Override.php b/include/library/Crunchbutton/Restaurant/Hour/Override.php index c53055671..816a5029b 100644 --- a/include/library/Crunchbutton/Restaurant/Hour/Override.php +++ b/include/library/Crunchbutton/Restaurant/Hour/Override.php @@ -41,13 +41,10 @@ class Crunchbutton_Restaurant_Hour_Override extends Cana_Table { $restaurant = Restaurant::o( $id_restaurant ); $today = new DateTime( 'now', new DateTimeZone( $restaurant->timezone ) ); $today_mysql = $today->format('Y-m-d H:i'); - $overrides = Crunchbutton_Restaurant_Hour_Override::q( "SELECT * FROM restaurant_hour_override WHERE date_start <= '{$today_mysql}' and date_end >= '{$today_mysql}'" ); + $type_closed = Crunchbutton_Restaurant_Hour_Override::TYPE_CLOSED; + $overrides = Crunchbutton_Restaurant_Hour_Override::q( "SELECT * FROM restaurant_hour_override WHERE date_start <= '{$today_mysql}' and date_end >= '{$today_mysql}' AND type = '{$type_closed}' LIMIT 1" ); if( $overrides->count() > 0 ){ - foreach( $overrides as $override ){ - if( $override->type == Crunchbutton_Restaurant_Hour_Override::TYPE_CLOSED ){ - return true; - } - } + return true; } return false; } @@ -56,13 +53,10 @@ class Crunchbutton_Restaurant_Hour_Override extends Cana_Table { $restaurant = Restaurant::o( $id_restaurant ); $today = new DateTime( 'now', new DateTimeZone( $restaurant->timezone ) ); $today_mysql = $today->format('Y-m-d H:i'); - $overrides = Crunchbutton_Restaurant_Hour_Override::q( "SELECT * FROM restaurant_hour_override WHERE date_start <= '{$today_mysql}' and date_end >= '{$today_mysql}'" ); + $type_opened = Crunchbutton_Restaurant_Hour_Override::TYPE_OPENED; + $overrides = Crunchbutton_Restaurant_Hour_Override::q( "SELECT * FROM restaurant_hour_override WHERE date_start <= '{$today_mysql}' and date_end >= '{$today_mysql}' AND type = '{$type_opened}' LIMIT 1" ); if( $overrides->count() > 0 ){ - foreach( $overrides as $override ){ - if( $override->type == Crunchbutton_Restaurant_Hour_Override::TYPE_OPENED ){ - return true; - } - } + return true; } return false; } diff --git a/include/views/default/cockpit/restaurants/hour_override.phtml b/include/views/default/cockpit/restaurants/hour_override.phtml index 471f88345..e86bcc12b 100644 --- a/include/views/default/cockpit/restaurants/hour_override.phtml +++ b/include/views/default/cockpit/restaurants/hour_override.phtml @@ -8,12 +8,14 @@ $timezone = new DateTimeZone( $restaurant->timezone ); $date_start = new DateTime( 'now ', $timezone ); $hour_override_date_start = $date_start->format( 'm/d/Y' ); -$hour_override_date_start_hour = $date_start->format( 'H:i' ); +$hour_override_date_start_hour = $date_start->format( 'h:i' ); +$hour_override_date_start_ampm = $date_start->format( 'A' ); $date_end = $restaurant->next_open_time(); if( $date_end ){ $hour_override_date_end = $date_end->format( 'm/d/Y' ); - $hour_override_date_end_hour = $date_end->format( 'H:i' ); + $hour_override_date_end_hour = $date_end->format( 'h:i' ); + $hour_override_date_end_ampm = $date_end->format( 'A' ); } ?>
@@ -26,33 +28,45 @@ if( $date_end ){
-
+
Start at:
- +
-
+
Hour:
-
- +
+ +
+
+
-
+
Finish at:
- +
-
+
Hour:
-
- +
+ +
+
+
@@ -123,12 +137,12 @@ if( $date_end ){ ?> - date_start()->format('M jS Y'); ?> + date_start()->format('M jS Y - D'); ?>
date_start()->format('g:i:s A'); ?> - date_end()->format('M jS Y'); ?> + date_end()->format('M jS Y - D'); ?>
date_end()->format('g:i:s A'); ?> diff --git a/include/views/default/cockpit/tests/hours/index.phtml b/include/views/default/cockpit/tests/hours/index.phtml index 91490cd44..eb7b04f60 100644 --- a/include/views/default/cockpit/tests/hours/index.phtml +++ b/include/views/default/cockpit/tests/hours/index.phtml @@ -1,4 +1,6 @@ restaurant->exports(); + $this->title = 'TESTS'; $this->titleicon = 'food'; ?> @@ -38,11 +40,15 @@
- -
restaurant->name?> is open ? 'OPEN' : 'CLOSED'?> now ? 'now' : 'at '.$this->time->format('Y-m-d H:i:s')?> +
+ Curent time: restaurant->timezone ) ); + echo $today->format(' M jS Y g:i:s A - D '); + echo ' (' . $this->restaurant->timezone . ')'; + ?>
@@ -50,30 +56,24 @@
Closed message: -

+
+

+ Close in: +
+ Open in:
-
-
- - - + \ No newline at end of file diff --git a/www/assets/js/admin_restaurant.js b/www/assets/js/admin_restaurant.js index d65b08c06..0fa710b7e 100644 --- a/www/assets/js/admin_restaurant.js +++ b/www/assets/js/admin_restaurant.js @@ -1591,13 +1591,14 @@ hour_override.remove = function( id_restaurant_hour_override ){ }); } - hour_override.save = function(){ var date_start = $( '#hour_override_date_start' ).val(); var date_start_hour = $( '#hour_override_date_start_hour' ).val(); + var hour_override_date_start_ampm = $( '#hour_override_date_start_ampm' ).val(); var date_end = $( '#hour_override_date_end' ).val(); var date_end_hour = $( '#hour_override_date_end_hour' ).val(); + var hour_override_date_end_ampm = $( '#hour_override_date_end_ampm' ).val(); var type = $( '#hour_override_type' ).val(); var notes = $( '#hour_override_notes' ).val(); @@ -1623,8 +1624,10 @@ hour_override.save = function(){ 'id_restaurant' : _id_restaurant, 'date_start' : date_start, 'date_start_hour' : date_start_hour, + 'hour_override_date_start_ampm' : hour_override_date_start_ampm, 'date_end' : date_end, 'date_end_hour' : date_end_hour, + 'hour_override_date_end_ampm' : hour_override_date_end_ampm, 'type' : type, 'notes' : notes }