<?php $__env->startSection('content'); ?>
    <div class="container-fluid">
        <div class="page-titles">
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="javascript:void(0)">Sales</a></li>
                <li class="breadcrumb-item active"><a href="javascript:void(0)">Public Users Tickets</a></li>
            </ol>
        </div>
        <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>Counter User  : </b> : 
                                        <?php if(isset($users)): ?>
                                                <?php echo e($users->name); ?>;
                                        <?php endif; ?>
                                    </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>Public User Name</th>
                                                    <th>Invoice Date</th>
                                                    <th>Invoice Number</th>
                                                    <th>Show Date</th>
                                                    <th>Amount</th>
                                                    <th>Print Ticket</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <?php
                                                    $n = 0;
                                                ?>
                                                <?php if(isset($invoices)): ?>
                                                <?php $__currentLoopData = $invoices; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $invoice): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <?php
                                                        $n++;
                                                        $invoice_id = $invoice->id;
                                                        $invoicemd5=md5($invoice_id);
                                                        $invoice_date = $invoice->invoice_date;
                                                        $invoice_month = date('m',strtotime($invoice_date));
                                                        $invoice_year = date('Y',strtotime($invoice_date));
                                                        $invoice_no = $invoice->invoice_no;
                                                        $org_code = $invoice->organisation->short_code;
                                                        if($invoice_month<4)
                                                            $invoice_year--;

                                                        $nextyear = $invoice_year+1;

                                                        $invoice_number = $org_code.'/'.$invoice_no.'/'.$invoice_year.'-'.$nextyear;
                                                    ?>
                                                    <tr>
                                                        <td><?php echo e($n); ?></td>
                                                        <td>
                                                            <?php if(isset($invoice->public_user_id)): ?>
                                                                <?php echo e($invoice->publicuser->name); ?> (<?php echo e($invoice->publicuser->phone); ?>)
                                                            <?php endif; ?>
                                                        </td>
                                                        <td><?php echo e(date("d-M-Y", strtotime($invoice->invoice_date))); ?></td>
                                                        <td>
                                                            <?php if($invoice->status==1): ?>
                                                            <?php echo e($invoice_number); ?>

                                                            <?php endif; ?>
                                                        </td>
                                                        <td><?php echo e(date("d-M-Y", strtotime($invoice->show_date))); ?></td>
                                                        <td style="text-align: center;"><i class='fa fa-rupee'></i><?php echo e($invoice->amount); ?></td>
                                                        <td style="text-align: center;">
                                                            <?php if($invoice->status==1): ?>
                                                                <a href="<?php echo e(URL::to('/print_tickets')); ?>/<?php echo e($invoice_id); ?>/<?php echo e($invoicemd5); ?>" target="_blank"><i class='fa fa-print'></i></a>
                                                            <?php elseif($invoice->status==2): ?>
                                                                <span style="color: red;"><b>Rejected</b></span>   
                                                            <?php else: ?>
                                                                <span style="color: blue;"><b>Not Approved</b></span>   
                                                            <?php endif; ?>
                                                        </td>
                                                    </tr>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                <?php endif; ?>
                                            </tbody>
                                        </table>
                                    </div> 
                                </div>
                            </div>     
                        </div>                                       
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $(document).ready(function () 
        {
            var table = $('#ticket_list').DataTable({
                    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/getticket_publicuser_list.blade.php ENDPATH**/ ?>