Changeset 1661856
- Timestamp:
- 05/21/2017 07:52:27 PM (9 years ago)
- Location:
- redi-restaurant-reservation/branches/andrew
- Files:
-
- 4 edited
-
css/restaurant.css (modified) (7 diffs)
-
js/restaurant.js (modified) (5 diffs)
-
redi-restaurant-reservation.php (modified) (8 diffs)
-
templates/frontend.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
redi-restaurant-reservation/branches/andrew/css/restaurant.css
r1658007 r1661856 282 282 float: left; 283 283 284 margin-left: 5px;284 /*margin-left: 5px;*/ 285 285 286 286 width: 21%; … … 296 296 } 297 297 298 299 300 .redi-restaurant-time-button, .redi-restaurant-button { 298 .redi-restaurant-time-button,.redi-restaurant-duration-button, .redi-restaurant-button { 301 299 margin: 1px; 302 300 cursor: pointer; … … 306 304 } 307 305 308 309 310 .redi-restaurant-time-button:hover, .redi-restaurant-button:hover { 306 .redi-restaurant-time-button:hover,.redi-restaurant-duration-button:hover, .redi-restaurant-button:hover { 311 307 312 308 border: 1px solid #999999; … … 321 317 322 318 .redi-restaurant-time-button[disabled="disabled"], 323 319 .redi-restaurant-duration-button[disabled="disabled"], 324 320 .redi-restaurant-button[disabled="disabled"], 325 326 321 input.disabled, button.disabled { 327 322 … … 336 331 337 332 338 .redi-restaurant-time-button[select="select"], .redi-restaurant-button[select="select"] { 333 .redi-restaurant-time-button[select="select"], 334 .redi-restaurant-duration-button[select="select"], 335 .redi-restaurant-button[select="select"] { 339 336 340 337 font-weight: bold !important; … … 344 341 } 345 342 346 347 348 #step1button, #redi-restaurant-step3 {349 350 }351 352 353 354 343 .cancel-reservation { 355 356 344 float: right; 357 358 345 } 359 346 … … 380 367 381 368 382 .redi-restaurant-time-button.normal {369 .redi-restaurant-time-button.normal, .redi-restaurant-duration-button.normal { 383 370 384 371 width: 15%; -
redi-restaurant-reservation/branches/andrew/js/restaurant.js
r1658007 r1661856 142 142 143 143 jQuery(document).on('click', '.redi-restaurant-time-button', function () { 144 144 145 jQuery('.redi-restaurant-time-button').each(function () { 145 146 jQuery(this).removeAttr('select'); … … 356 357 357 358 var b = response[availability]['Availability'][current_button_index]; 358 359 var menu = jQuery('#menu').val(); 360 361 var selmenu = jQuery.grep(response['menus'], function(a){return a.title ===menu})[0]; 362 var disabled = false; 363 if(selmenu !== undefined){ 364 if(selmenu['times'] !== undefined) { 365 disabled = jQuery.grep(selmenu['times'], function(a){return a===b['Time']}).length === 0; 366 } 367 } 359 368 html += '<button ' 360 + (b['Available'] ? '' : 'disabled="disabled"')369 + (b['Available'] && !disabled ? '' : 'disabled="disabled"') 361 370 + (b['Available'] ? '' : ' title="' + redi_restaurant_reservation.tooltip + '"') + ' class="redi-restaurant-time-button button ' + (b['Available'] ? '' : 'disabled') + '" value="' + b['StartTimeISO'] + '" ' + 362 371 ' ' + (b['Select'] ? 'select="select"' : '') + '>' … … 399 408 display_all_busy(all_busy); 400 409 } 401 402 console.log(response); 410 411 var savedMenu = null; 412 savedMenu = jQuery('#menu').val(); 403 413 jQuery('#menu').find('option').remove(); 404 414 for(var menu in response['menus']){ 405 415 jQuery('#menu').append(jQuery('<option>', { value : response['menus'][menu]['title'] }).text(response['menus'][menu]['title'])); 406 416 } 417 jQuery('#menu').val(savedMenu); 407 418 break; 408 419 } … … 547 558 }); 548 559 549 jQuery(document).on('click', '.redi-restaurant-duration-button', function(event){ 560 jQuery(document).on('click', '.redi-restaurant-duration-button', function(event){ 561 console.log('duration click'); 550 562 event.preventDefault(); 551 563 jQuery('#redi-restaurant-durationHidden').val(jQuery(this).val()); 564 565 jQuery('.redi-restaurant-duration-button').each(function () { 566 jQuery(this).removeAttr('select'); 567 }); 568 569 jQuery(this).attr('select', 'select'); 552 570 553 571 var day1 = jQuery('#redi-restaurant-startDate').datepicker('getDate').getDate(); … … 555 573 var year1 = jQuery('#redi-restaurant-startDate').datepicker('getDate').getFullYear(); 556 574 var fullDate = year1 + '-' + zeroFill(month1) + '-' + zeroFill(day1); 557 step1call(fullDate); 575 step1call(fullDate); 576 }); 577 578 jQuery(document).on('change', '#menu', function(event){ 579 event.preventDefault(); 580 var day1 = jQuery('#redi-restaurant-startDate').datepicker('getDate').getDate(); 581 var month1 = jQuery('#redi-restaurant-startDate').datepicker('getDate').getMonth() + 1; 582 var year1 = jQuery('#redi-restaurant-startDate').datepicker('getDate').getFullYear(); 583 var fullDate = year1 + '-' + zeroFill(month1) + '-' + zeroFill(day1); 584 step1call(fullDate); 558 585 }); 559 586 }); -
redi-restaurant-reservation/branches/andrew/redi-restaurant-reservation.php
r1660405 r1661856 1078 1078 $durations = self::getDurations(); 1079 1079 $defaultDuration = 0; 1080 1080 1081 foreach($durations as $duration){ 1081 1082 if(isset($duration['default'])){ … … 1372 1373 } 1373 1374 1374 if ( $timeshiftmode === 'byshifts' ) { 1375 // var_dump($menus); 1375 if ( $timeshiftmode === 'byshifts' ) { 1376 1376 $query['menus'] = self::getMenus(date('d.m.Y', $startTimeInt), date('l', $startTimeInt)); 1377 1377 $query['alternativeTime'] = $alternativeTime; 1378 1378 1379 switch ( $alternativeTime ) { 1379 1380 case AlternativeTime::AlternativeTimeBlocks: // pass thought … … 1384 1385 $q->StartTime = self::format_time( $q->StartTime, $time_lang, $time_format ); 1385 1386 $q->EndTime = date( $time_format, strtotime( $q->EndTime ) ); 1387 1386 1388 } 1387 1389 break; … … 1394 1396 $q->StartTime = self::format_time( $q->StartTime, $time_lang, $time_format ); 1395 1397 $q->EndTime = date( $time_format, strtotime( $q->EndTime ) ); 1398 $q->Time = date( 'G:i', strtotime( $q->EndTime ) ); 1396 1399 } 1397 1400 } … … 1406 1409 $q->EndTime = date( $time_format, strtotime( $q->EndTime ) ); 1407 1410 } 1408 } 1409 1410 1411 } 1411 1412 return $query; 1412 1413 } … … 1517 1518 } 1518 1519 $comment .= mb_substr( self::GetPost( 'UserComments' ), 0, 250 ); 1519 $comment .= '<br/>Menu: '.self::GetPost( 'Menu' );1520 1520 1521 1521 $params = array( … … 1533 1533 'Version' => $this->version 1534 1534 ) 1535 ); 1536 $params['reservation']['Parameters'] = array( 1537 'Menu' => self::GetPost( 'Menu' ) 1535 1538 ); 1536 1539 if ( isset( $this->options['EmailFrom'] ) && $this->options['EmailFrom'] == EmailFrom::Disabled || … … 1718 1721 1719 1722 foreach ($posts as $post) { 1720 $menus[] = array( 1721 'title' => $post->post_title, 1723 $custom_fields = self::ArrayKeysLowercase(get_post_custom($post->ID)); 1724 $menu = array( 1725 'title' => $post->post_title, 1722 1726 ); 1727 if(isset($custom_fields['time'])){ 1728 $menu['times'] = explode( ',', $custom_fields['time'][0]); 1729 } 1730 1731 $menus[] = $menu; 1723 1732 } 1724 1733 1725 1734 return $menus; 1726 1735 } -
redi-restaurant-reservation/branches/andrew/templates/frontend.php
r1660405 r1661856 91 91 <label for="duration"> 92 92 <?php _e('Duration', 'redi-restaurant-reservation')?>:<span class="redi_required"> *</span> 93 </label> 94 <?php $defaultDuration = 0;?> 95 <?php foreach($durations as $duration):?> 96 <?php if(isset($duration['default'])) $defaultDuration = $duration['minutes'];?> 97 <button class="redi-restaurant-duration-button button" value="<?php echo $duration['minutes'] ?>"><?php echo $duration['title'] ?></button> 93 </label> 94 <?php foreach($durations as $duration):?> 95 <button <?php if($defaultDuration ===$duration['minutes']):?>select="select"<?php endif ?> class="redi-restaurant-duration-button button" value="<?php echo $duration['minutes'] ?>"><?php echo $duration['title'] ?></button> 98 96 <?php endforeach ?> 99 97 <input type="hidden" id="redi-restaurant-durationHidden" value="<?php echo $defaultDuration ?> "/> … … 106 104 if ( $hidesteps ): 107 105 $current = 0; 108 109 106 if ( isset( $step1 ) && is_array( $step1 ) && ! isset( $step1['Error'] ) ): 110 107 $all_busy = true; … … 114 111 if ( isset( $available['Availability'] ) && is_array( $available['Availability'] ) ) { 115 112 foreach ( $available['Availability'] as $button ) { 113 116 114 if ( $button['Available'] ) { 117 115 $all_busy = $current_busy = false; … … 178 176 <?php if ( isset( $available['Availability'] ) && is_array($available['Availability']) ): ?> 179 177 <?php $all_busy = true; ?> 180 <?php foreach ( $available['Availability'] as $button ): ?><button title="<?php echo $button['Reason']?>" <?php if(!$button['Available']):?>disabled="disabled"<?php endif?> class="redi-restaurant-time-button button" value="<?php echo $button['StartTimeISO'] ?>"><?php echo $button['StartTime'] ?></button><?php if($button['Available']) $all_busy = false; ?><?php endforeach; ?> 178 <?php foreach ( $available['Availability'] as $button ): ?> 179 180 <button title="<?php echo $button['Reason']?>" <?php 181 if( 182 $button['Available'] && 183 isset($menus[0]['times']) ? 184 in_array(date( 'G:i', strtotime($button['StartTimeISO']) ),$menus[0]['times']):true ):?><?php else: ?> disabled="disabled"<?php endif?> class="redi-restaurant-time-button button" value="<?php echo $button['StartTimeISO'] ?>"> 185 <?php echo $button['StartTime'] ?> 186 </button><?php if($button['Available']) $all_busy = false; ?><?php endforeach; ?> 181 187 182 188 <?php endif; ?>
Note: See TracChangeset
for help on using the changeset viewer.