Plugin Directory

Changeset 1661856


Ignore:
Timestamp:
05/21/2017 07:52:27 PM (9 years ago)
Author:
robby.roboter
Message:

default menu, menu in Parameters

Location:
redi-restaurant-reservation/branches/andrew
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • redi-restaurant-reservation/branches/andrew/css/restaurant.css

    r1658007 r1661856  
    282282     float: left;
    283283
    284     margin-left: 5px;
     284    /*margin-left: 5px;*/
    285285
    286286    width: 21%;
     
    296296}
    297297
    298 
    299 
    300 .redi-restaurant-time-button, .redi-restaurant-button {
     298.redi-restaurant-time-button,.redi-restaurant-duration-button, .redi-restaurant-button {
    301299    margin: 1px;
    302300    cursor: pointer;
     
    306304}
    307305
    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 {
    311307
    312308    border: 1px solid #999999;
     
    321317
    322318.redi-restaurant-time-button[disabled="disabled"],
    323 
     319.redi-restaurant-duration-button[disabled="disabled"],
    324320.redi-restaurant-button[disabled="disabled"],
    325 
    326321input.disabled, button.disabled {
    327322
     
    336331
    337332
    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"] {
    339336
    340337    font-weight: bold !important;
     
    344341}
    345342
    346 
    347 
    348 #step1button, #redi-restaurant-step3 {
    349 
    350 }
    351 
    352 
    353 
    354343.cancel-reservation {
    355 
    356344    float: right;
    357 
    358345}
    359346
     
    380367
    381368
    382 .redi-restaurant-time-button.normal {
     369.redi-restaurant-time-button.normal, .redi-restaurant-duration-button.normal {
    383370
    384371    width: 15%;
  • redi-restaurant-reservation/branches/andrew/js/restaurant.js

    r1658007 r1661856  
    142142
    143143    jQuery(document).on('click', '.redi-restaurant-time-button', function () {
     144       
    144145        jQuery('.redi-restaurant-time-button').each(function () {
    145146            jQuery(this).removeAttr('select');
     
    356357
    357358                                        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                                        }
    359368                                        html += '<button '
    360                                             + (b['Available'] ? '' : 'disabled="disabled"')
     369                                            + (b['Available'] && !disabled ? '' : 'disabled="disabled"')
    361370                                            + (b['Available'] ? '' : ' title="' + redi_restaurant_reservation.tooltip + '"') + ' class="redi-restaurant-time-button button ' + (b['Available'] ? '' : 'disabled') + '" value="' + b['StartTimeISO'] + '" ' +
    362371                                            ' ' + (b['Select'] ? 'select="select"' : '') + '>'
     
    399408                                display_all_busy(all_busy);
    400409                            }
    401 
    402                             console.log(response);
     410                           
     411                            var savedMenu = null;
     412                            savedMenu = jQuery('#menu').val();
    403413                            jQuery('#menu').find('option').remove();
    404414                            for(var menu in response['menus']){
    405415                                jQuery('#menu').append(jQuery('<option>', { value : response['menus'][menu]['title'] }).text(response['menus'][menu]['title']));
    406416                            }
     417                            jQuery('#menu').val(savedMenu);
    407418                            break;
    408419                    }
     
    547558    });
    548559
    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');
    550562        event.preventDefault();
    551563        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');
    552570
    553571        var day1 = jQuery('#redi-restaurant-startDate').datepicker('getDate').getDate();
     
    555573        var year1 = jQuery('#redi-restaurant-startDate').datepicker('getDate').getFullYear();
    556574        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);       
    558585    });
    559586});
  • redi-restaurant-reservation/branches/andrew/redi-restaurant-reservation.php

    r1660405 r1661856  
    10781078            $durations = self::getDurations();
    10791079            $defaultDuration = 0;
     1080           
    10801081            foreach($durations as $duration){
    10811082                if(isset($duration['default'])){
     
    13721373            }
    13731374
    1374             if ( $timeshiftmode === 'byshifts' ) {             
    1375             //  var_dump($menus);
     1375            if ( $timeshiftmode === 'byshifts' ) {
    13761376                $query['menus'] = self::getMenus(date('d.m.Y', $startTimeInt), date('l', $startTimeInt));
    13771377                $query['alternativeTime'] = $alternativeTime;
     1378               
    13781379                switch ( $alternativeTime ) {
    13791380                    case AlternativeTime::AlternativeTimeBlocks: // pass thought
     
    13841385                            $q->StartTime    = self::format_time( $q->StartTime, $time_lang, $time_format );
    13851386                            $q->EndTime      = date( $time_format, strtotime( $q->EndTime ) );
     1387                           
    13861388                        }
    13871389                        break;
     
    13941396                                    $q->StartTime    = self::format_time( $q->StartTime, $time_lang, $time_format );
    13951397                                    $q->EndTime      = date( $time_format, strtotime( $q->EndTime ) );
     1398                                    $q->Time         = date( 'G:i', strtotime( $q->EndTime ) );
    13961399                                }
    13971400                            }
     
    14061409                    $q->EndTime      = date( $time_format, strtotime( $q->EndTime ) );
    14071410                }
    1408             }
    1409 
    1410            
     1411            }           
    14111412            return $query;
    14121413        }
     
    15171518                    }
    15181519                    $comment .= mb_substr( self::GetPost( 'UserComments' ), 0, 250 );
    1519                     $comment .= '<br/>Menu: '.self::GetPost( 'Menu' );
    15201520
    15211521                    $params = array(
     
    15331533                            'Version'      => $this->version
    15341534                        )
     1535                    );
     1536                    $params['reservation']['Parameters'] = array(
     1537                        'Menu' => self::GetPost( 'Menu' )
    15351538                    );
    15361539                    if ( isset( $this->options['EmailFrom'] ) && $this->options['EmailFrom'] == EmailFrom::Disabled ||
     
    17181721
    17191722            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,                   
    17221726                );
     1727                if(isset($custom_fields['time'])){
     1728                    $menu['times'] = explode( ',', $custom_fields['time'][0]);
     1729                }
     1730
     1731                $menus[] = $menu;
    17231732            }
    1724 
     1733       
    17251734            return $menus;
    17261735        }
  • redi-restaurant-reservation/branches/andrew/templates/frontend.php

    r1660405 r1661856  
    9191            <label for="duration">
    9292                <?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>     
    9896            <?php endforeach ?>
    9997            <input type="hidden" id="redi-restaurant-durationHidden" value="<?php echo $defaultDuration ?> "/>
     
    106104                    if ( $hidesteps ):
    107105                        $current = 0;
    108 
    109106                        if ( isset( $step1 ) && is_array( $step1 ) && ! isset( $step1['Error'] ) ):
    110107                            $all_busy = true;
     
    114111                                if ( isset( $available['Availability'] ) && is_array( $available['Availability'] ) ) {
    115112                                    foreach ( $available['Availability'] as $button ) {
     113                                       
    116114                                        if ( $button['Available'] ) {
    117115                                            $all_busy = $current_busy = false;
     
    178176                    <?php if ( isset( $available['Availability'] ) && is_array($available['Availability']) ): ?>
    179177                        <?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; ?>
    181187
    182188                    <?php endif; ?>
Note: See TracChangeset for help on using the changeset viewer.