<?php /* Body tag */ ?>
<?php $__env->startSection('body_tag'); ?>
<body class="left-slider two-column">
    <?php $__env->stopSection(); ?>
    <?php /* Content */ ?>
    <?php $__env->startSection('content'); ?>
    <div class="row">
     <div class="large-12 medium-12 columns">
        <div id="main">	
            <div id="primary">	
             <div class="row">
             <div id="content" class="large-4 medium-4 columns">
                <div  class="sidebar-middle">
                    <form action="01-home-v1.html" class="complete_reservation">
                        <div class="widget main-widget main-widget-3column">
                            <div class="widget-title">
                                <div>
                                    MY PROFILE
                                </div>
                                <div class="clear"></div>
                            </div>
                            <div style="word-break: break-all;" class="widget-content main-block product-widget-mini">		
                                <h4>Account Information<a href="<?php echo URL::to('/account/profile'); ?>" title="">Edit</a></h4>
                                <p style="padding: 2px;"><b>Email Address:</b><span style="margin-left: 5px;"><?php echo Sentry::getUser()->email; ?></span></p>
                                <p style="padding: 2px;"><b>First Name:</b><span style="margin-left: 26px;"><?php echo Sentry::getUser()->first_name; ?></span></p>
                                <p style="padding: 2px;"><b>Last Name:</b><span style="margin-left: 28px;"><?php echo Sentry::getUser()->last_name; ?></span></p>
                                <p style="padding: 2px;"><b>Phone:</b><span style="margin-left: 54px;"><?php echo Sentry::getUser()->phone; ?></span></p>
                                <p style="padding: 2px;"><b>Age :</b><span style="margin-left: 29px;"><?php echo Sentry::getUser()->age; ?></span></p>
                                <h4>Email Subscription<a href="<?php echo URL::to('/account/profile'); ?>" title="">Edit</a></h4>
                                <p style="padding: 2px;">
                                    <?php if(Sentry::getUser()->newsLetter=='1'): ?>
                                    <img style="vertical-align: bottom;width: 24px;" src="<?php echo asset('assets/images/check_box.png'); ?>" alt="" />
                                    News &amp; Updates
                                    <?php else: ?>
                                    <img style="vertical-align: bottom;width: 24px;" src="<?php echo asset('assets/images/empty_check_box.png'); ?>" alt="" />
                                    News &amp; Updates
                                    <?php endif; ?>
                                </p>
                                <p style="padding: 2px;">
                                    <?php if(Sentry::getUser()->price_alert=='1'): ?>
                                    <img style="vertical-align: bottom;width: 24px;" src="<?php echo asset('assets/images/check_box.png'); ?>" alt="" />
                                    Price Alerts
                                    <?php else: ?>
                                    <img style="vertical-align: bottom;width: 24px;" src="<?php echo asset('assets/images/empty_check_box.png'); ?>" alt="" />
                                    Price Alerts
                                    <?php endif; ?>
                                </p>
                                <p style="padding: 6px;">You'll continue to receive email about you reservations separately from your subscriptions.</p>
    
                            </div>
                        </div>
    
                    </form>
                </div>				
                </div>
                <div id="secondary" class="large-8 medium-8 columns">
                <aside class="sidebar-left">	
                    <div class="widget">
                        <h3 class="widget-title">
                            Reservation History
                        </h3>
                        <?php if( count($upcoming_reservations) == 0 && count($past_reservations) == 0  ): ?>
                        <div class="widget-content main-block product-widget-mini">
                            <h4>
                                You don't have Reservations.
                            </h4>
                        </div>
                        <?php else: ?>
                        <div class="widget-content main-block product-widget-mini">
                            <?php if( count($upcoming_reservations) > 0 ): ?>  
                            <h4>UPCOMING RESERVATIONS</h4>
                            <?php endif; ?>
                            <?php foreach(@$upcoming_reservations as $reservation ): ?>
                            <?php if( time() <= strtotime($reservation->pickup_time) ): ?>
                            <div class="reservation-block">
                            <div class="row">
                             <div id="secondary" class="large-7 medium-7 columns">
                                <div class="product-info reservation">
                                    <div class="reservation_location" class="entry-format">
                                        <div style="margin-bottom: 10px;"> <?php echo $reservation->pickup_location; ?> </div>
                                    </div>
                                    <div class="features">
                                        <p><span>Pickup Time : </span><b> <?php echo date("F d, h:i A",strtotime($reservation->pickup_time)); ?></b></p>
                                        <p><span>Dropoff Time : </span><b> <?php echo date("F d, h:i A",strtotime($reservation->dropoff_time)); ?></b></p>
                                        <p><span>Confirmation ID :</span> <b style="color:#42BD39;"> <?php echo $reservation->confirmation_id; ?></b></p>
                                        <p><span>Est. Total :</span><strong class="reservation_rate">$<?php echo number_format($reservation->total,2); ?></strong></p>
                                    </div>
                                </div>
                             </div>
                             <div id="secondary" class="large-5 medium-5 columns">
                                <div class="reservation_action">
                                    <!--p class="reservation_rate">$<?php echo number_format($reservation->total,2); ?></p-->
                                    <p >Status : <b class="reservation_status_<?php echo $reservation->status; ?>"> <?php echo $reservation->status; ?></b></p>
                                    <?php if( $reservation->status != 'Cancelled' ): ?>
                                    <a href="<?php echo URL("/account/reservation/{$reservation->confirmation_type}-{$reservation->confirmation_id}/view"); ?>">
                                        <input style="padding: 0 18px 3px 12px;height: 30px;background:#ec702f;" class="continue_button orange_button" type="button" value="View Reservation" />
                                    </a>
                                    <a href="<?php echo URL("/account/reservation/{$reservation->confirmation_type}-{$reservation->confirmation_id}/cancel"); ?>" class="cancel_reservation" style="color: #008000;"><img style="vertical-align: top;" src="<?php echo asset('assets/images/math_multiplication.png'); ?>" /> Cancel Reservation</a>
                                    <div id="dialog-confirm" class="hidden" title="CANCEL RESERVATION">
                                        <p style="border-bottom: 1px solid #aaa; margin-bottom: 5px;padding-bottom: 5px;">
                                            <!--span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span-->
                                            Are you sure you want to cancel reservation !
                                        </p>
                                        <div class="reservation_location" class="entry-format">
                                            <div style="margin-bottom: 10px;"> <?php echo $reservation->pickup_location; ?> </div>
                                        </div>
                                        <div style="float: left;width: 20%;">
                                            <?php
                                            $agency = Agency::where('code', '=', $reservation->agency_code)->get()->first();
                                            ?>
                                            <?php if(is_null($agency)): ?>
                                            <?php echo $reservation->agency_code; ?>

                                            <?php else: ?>
                                            <img class="agency-logo" src="<?php echo asset('images/agency/'.$agency->image); ?>" alt="<?php echo $agency->title; ?>" 
                                                 title="<?php echo $agency->title; ?>" style="width: 100%;" />
                                            <?php endif; ?>
                                        </div>
                                        <div style="float: right;width: 80%;">
                                            <div class="features" style="float: left;width: 80%;">
                                                <p><span>Pickup Time : </span><b> <?php echo date("F d, h:i A",strtotime($reservation->pickup_time)); ?></b></p>
                                                <p><span>Dropoff Time : </span><b> <?php echo date("F d, h:i A",strtotime($reservation->dropoff_time)); ?></b></p>
                                                <p><span>Confirmation ID :</span> <b style="color:#42BD39;"> <?php echo $reservation->confirmation_id; ?></b></p>
                                            </div>
                                            <div style="float: right; width: 20%;">
                                                <p><span>Est. Total:</span><br/>
                                                    <strong class="reservation_rate">$<?php echo number_format($reservation->total,2); ?></strong>
                                                </p>
                                            </div>
                                        </div>
                                        <div style="clear: both;"></div>
                                    </div>
                                    <?php endif; ?>
                                </div>
                             </div>
                            </div>
                            </div>
                            <?php endif; ?>
                            <?php endforeach; ?>
                            <?php if( count($past_reservations) > 0 ): ?>  
                            <h4>
                                PREVIOUS RESERVATIONS
                            </h4>
                            <?php endif; ?>
                            <?php foreach(@$past_reservations as $reservation ): ?>
    
                            <div class="reservation-block">	
                              <div class="row">
                                <div id="secondary" class="large-8 medium-8 columns">
                                <div class="product-info reservation">
                                    <div class="reservation_location" class="entry-format">
                                        <div style="margin-bottom: 10px;"><?php echo $reservation->pickup_location; ?> </div>
    
                                    </div>
                                    <div class="features">
                                        <p><span>Pickup Time :</span> <b> <?php echo date("F d, h:i A",strtotime($reservation->pickup_time)); ?></b></p>
                                        <p><span>Dropoff Time :</span> <b> <?php echo date("F d, h:i A",strtotime($reservation->dropoff_time)); ?></b></p>			
                                        <p><span>Confirmation ID :</span> <b style="color:#42BD39;"> <?php echo $reservation->confirmation_id; ?></b></p>
                                        <p><span>Est. Total :</span><strong class="reservation_rate">$<?php echo number_format($reservation->total,2); ?></strong></p>
                                    </div>
                                </div>
                                </div>
                                <div id="secondary" class="large-4 medium-4 columns">
                                <div class="reservation_action">
                                    <p >Status :<b class="reservation_status_<?php echo $reservation->status; ?>"> <?php echo $reservation->status; ?></b></p>
                                </div>   
                                </div>
                              </div>
                            </div>
                            <?php endforeach; ?>
                        </div>
                        <?php endif; ?>
                    </div>
    
                </aside>	
                </div>
                
             </div>				
            </div>
        </div>
     </div>
    </div>
    <?php $__env->stopSection(); ?>

    <?php $__env->startSection('scripts'); ?>
    <script type="text/javascript">
        $(document).ready(function () {

            $('.cancel_reservation').click(function (e)
            {
                e.preventDefault();
                var href = $(this).attr('href');
                $("#dialog-confirm").dialog({
                    resizable: false,
                    height: 140,
                    modal: true,
                    buttons: {
                        "Don't Cancel": function () {
                            $(this).dialog("close");
                        },
                        Cancel: function () {
                            $.ajax({
                                url: href,
                                context: document.body
                            }).done(function (data) {
                                if (typeof data.Error !== 'undefined' && data.Error !== null)
                                {
                                    alert(data.Error['!']);
                                }
                                else if (data.Status === 'Success')
                                {
                                    location.reload();
                                }
                            });
                            $(this).dialog("close");
                        }
                    }
                });
            });
        });

    </script>
    <?php $__env->stopSection(); ?>

<?php echo $__env->make('site.default', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>