<?php $__env->startSection('content'); ?>
    <div class="container-fluid">
        <div class="row">
            <div class="col-12">
                <div class="card card-primary">
                    <div class="card-body"> 
                        <div class="default-tab">
                            <div class="tab-content">
                                <div class="form-row ">
                                    <div class="form-group col-3">
                                        <b>Facility</b> : 
                                        <?php echo e($cancelshows->facility->facility_name); ?>

                                    </div>
                                    <div class="form-group col-3">
                                        <b>Show Time </b> : 
                                        <?php
                                            $show_start_time = date("g:i A", strtotime($cancelshows->showtime->from_time));
                                            if(!$cancelshows->showtime->dont_show_to_time)
                                            {
                                                $show_start_time .=  "-". date("g:i A", strtotime($cancelshows->showtime->to_time));
                                            }
                                        ?>
                                        <?php echo e($show_start_time); ?>

                                    </div>
                                    <div class="form-group col-3">
                                        <b>Show Date</b> : 
                                        <?php
                                            $show_date = $cancelshows->show_date;
                                            echo date("d-M-Y", strtotime($show_date));
                                        ?>
                                    </div>
                                </div>                
                                <div class="tab" id="listdata" style="padding-top: 30px;">       
                                    <div class="table-responsive"> 
                                        <table class="display" style="width:100%" id="ticket_list">
                                            <thead class="thead-info">
                                                <tr>
                                                    <th>Sl No</th>
                                                    <th>Ticket Number</th>
                                                    <th># of Adults</th>
                                                    <th># of Children</th>
                                                    <th>Amount</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <?php
                                                    $n = 0;
                                                    $org_code = "";
                                                    $facility_short_code = "";
                                                    $ticket_no = "";
                                                    $invoice_date = "";
                                                    $invoice_month ="";
                                                    $invoice_year ="";
                                                    $nextyear ="";
                                                ?>
                                                <?php $__currentLoopData = $tickets; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ticket): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <?php
                                                        $n++;
                                                        $org_code = $ticket->facility->organisation->short_code;
                                                        $facility_short_code = $ticket->facility->short_code;
                                                        $ticket_no = $ticket->ticket_no;
                                                        $invoice_date = $ticket->invoice->invoice_date;
                                                        $invoice_month = date('m',strtotime($invoice_date));
                                                        $invoice_year = date('Y',strtotime($invoice_date));
                                                        if($invoice_month<4)
                                                            $invoice_year--;
                                                        $nextyear = $invoice_year+1;
                                                    ?>
                                                    <tr>
                                                        <td><?php echo e($n); ?></td>
                                                        <td>
                                                            <?php if(isset($ticket->ticket_no)): ?>
                                                                <strong><?php echo e($org_code); ?>/<?php echo e($facility_short_code); ?>/<?php echo e($ticket_no); ?>/<?php echo e($invoice_year); ?>-<?php echo e($nextyear); ?></strong>
                                                            <?php endif; ?>
                                                        </td>
                                                        <td>
                                                            <?php if(isset($ticket->noof_adult)): ?>
                                                                <?php echo e($ticket->noof_adult); ?>

                                                            <?php endif; ?>
                                                        </td>
                                                        <td>
                                                            <?php if(isset($ticket->noof_child)): ?>
                                                                <?php echo e($ticket->noof_child); ?>

                                                            <?php endif; ?>
                                                        </td>
                                                        <td style="text-align: center;"><i class='fa fa-rupee'></i><?php echo e($ticket->amount); ?></td>
                                                    </tr>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </tbody>
                                        </table>
                                    </div> 
                                </div>
                            </div>     
                        </div>                                       
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $(document).ready(function () 
        {
            var table = $('#ticket_list').DataTable({
                    dom: 'lfBrtip',
                    buttons: [
                        'excelHtml5',
                        'pdfHtml5'
                    ],
                    
                    createdRow: function ( row, data, index ) {
                       $(row).addClass('selected')
                    } 
                });
                  
                table.on('click', 'tbody tr', function() {
                var $row = table.row(this).nodes().to$();
                var hasClass = $row.hasClass('selected');
                if (hasClass) {
                    $row.removeClass('selected')
                } else {
                    $row.addClass('selected')
                }
                })
                
                table.rows().every(function() {
                this.nodes().to$().removeClass('selected')
                });
        });
    </script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layout.default', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/html/ksstmprod/resources/views/Sales/online_tickets.blade.php ENDPATH**/ ?>