

<?php $__env->startSection('content'); ?>
<style>
.circle { 
   width: 140px;
   height: 140px;
   background: lightgray; 
   -moz-border-radius: 70px; 
   -webkit-border-radius: 70px; 
   border-radius: 70px;
}

.showtime-pill-wrapper {
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
}
.showtime-pill-container {
    margin: 8px;
}
.showtime-pill-container .showtime-pill {
    border: 1px solid #999;
    color: #4abd5d;
    padding: 4px;
    border-radius: 4px;
    width: 120px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    position: relative;
    font-size: 80%;
}
.showtime-pill-container .showtime-pill .__details .__text {
    margin: 0 auto;
}
.showtime-pill-container .showtime-pill .__details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0 2px;
    height: 14px;
}

.oval {
 background-color: ghostwhite;
}

.seat {
  
}

.seat.selected {
  
}

.seat.occupied {
  
}

.seata {
    display: inline-block;
    font-size: 10px;
    line-height: 25px;
    font-weight: 400;
    background: #fff;
    vertical-align: top;

    border: 1px solid #1ea83c;

    width: 25px;
    height: 25px;
    border-radius: 2px;
    color: #1ea83c;
    text-align: center;
    font-size: 10px;
}

a._available {
    display: inline-block;
    font-size: 11px;
    line-height: 25px;
    font-weight: 400;
    background: #fff;
    vertical-align: top;

    border: 1px solid #1ea83c;

    width: 25px;
    height: 25px;
    border-radius: 2px;
    color: #1ea83c;
    text-align: center;
    font-size: 11px;
}

a._available:hover {
  background-color: yellow;
}

a._blocked {

    display: inline-block;
    font-size: 11px;
    line-height: 25px;
    font-weight: 400;
    background: #fff;
    vertical-align: top;

    border: 1px solid grey;

    width: 25px;
    height: 25px;
    border-radius: 2px;
    color: #1ea83c;
    text-align: center;
    font-size: 11px;

    background: #eee!important;
    cursor: default;
    color: #fff!important;
}

a._selected {
    display: inline-block;
    font-size: 11px;
    line-height: 25px;
    font-weight: 400;
    vertical-align: top;


    width: 25px;
    height: 25px;
    border-radius: 2px;
    text-align: center;
    font-size: 11px;

    color: #fff;
    background-color: #1ea83c!important;
    border-color: #1ea83c;
}

td {
    padding:  10px 5px 5px 5px !important;
}

</style>
<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)">Ticket Approval</a></li>
        </ol>
    </div>
    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-primary">
                    <div class="card-header custom-tab-1">
                        <ul class="nav nav-tabs">
                            <li class="nav-item">
                                <a class="nav-link active" data-toggle="tab" href="#organisation_form"><b>Ticket Approval</b></a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link" data-toggle="tab" href="#listorgdata"><b>Approved Ticket List</b></a>
                            </li>
                        </ul>
                    </div>
                    <div class="card-body">
                        <div class="default-tab">
                            <div class="tab-content">
                                <div class="tab-pane fade show active" id="organisation_form" role="tabpanel">
                                    <div class="table-responsive">
                                        <table class="display" style="width:100%" id="feewaiver_approval_list">
                                            <thead class="thead-info">
                                                <tr>
                                                    <th>Sl No</th>
                                                    <th>Invoice Date</th>
                                                    <th>Show Date</th>
                                                    <th>Payment Method</th>
                                                    <th>Amount</th>
                                                    <th>Status</th>
                                                    <th>Request Initiated By</th>
                                                    <th>Request Initiated Time</th>
                                                    <th></th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <?php
                                                    $n = 0;
                                                    $invoice_id = "";
                                                ?>
                                                <?php $__currentLoopData = $ticket_approval_list; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ticket_approval): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <?php
                                                        $n++;
                                                        $invoice_id = $ticket_approval->invoice_id;
                                                        $invoicemd5=md5($invoice_id);
                                                        $invoice_created_time = $ticket_approval->created_at;                                                        
                                                    ?>
                                                    <tr>
                                                        <td><?php echo e($n); ?></td>
                                                        <td><?php echo e(date("d-M-Y", strtotime($ticket_approval->invoice->invoice_date))); ?></td>
                                                        <td><?php echo e(date("d-M-Y", strtotime($ticket_approval->invoice->show_date))); ?></td>
                                                        <td>
                                                            <?php if(isset($ticket_approval->invoice->payment_method)): ?>
                                                                <?php echo e($ticket_approval->invoice->paymentmethod->method); ?>

                                                            <?php endif; ?>
                                                        </td>
                                                        <td style="text-align: center;"><i class='fa fa-rupee'></i><?php echo e($ticket_approval->invoice->amount); ?></td>
                                                        <td>                                                           
                                                            <?php if($ticket_approval->approval_flag==1): ?>
                                                                <?php echo "Approved"; ?>
                                                            <?php else: ?>
                                                                <?php echo "Approval Pending"; ?>
                                                            <?php endif; ?>
                                                        </td>
                                                        <td>
                                                            <?php echo e($ticket_approval->requestuser->name); ?>

                                                        </td>
                                                        <td>
                                                        	<?php
                                                        		$request_time = $ticket_approval->created_at;
                                                        	?>
                                                        	<?php echo e(date("d-M-Y H:i:A", strtotime($request_time))); ?>

                                                        </td>
                                                        <td style="text-align: center;">
                                                            <form class="form-horizontal" action="<?php echo e(URL::to('/ticket_invoicedetails')); ?>" method="post">
                                                                <?php echo e(csrf_field()); ?>

                                                                <input type="hidden" name="invoice_id" id="invoice_id" value="<?php echo e($invoice_id); ?>">
                                                                <button type="submit" class="btn btn-secondary btn-xs">Show</a>
                                                            </form>
                                                        </td>
                                                    </tr>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                                <div class="tab-pane fade" id="listorgdata">
                                    <div class="table-responsive">
                                        <table class="display" style="width:100%" id="feewaiver_list">
                                            <thead class="thead-info">
                                                <tr>
                                                    <th>Sl No</th>
                                                    <th>Invoice Date</th>
                                                    <th>Invoice Number</th>
                                                    <th>Show Date</th>
                                                    <th>Payment Method</th>
                                                    <th>Amount</th>
                                                    <th>Status</th>
                                                    <th>Inititator</th>
                                                    <th>Approver</th>
                                                    <th></th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <?php
                                                    $n = 0;
                                                    //dd($feewaiver_status);
                                                ?>
                                                <?php $__currentLoopData = $approved_ticket_list; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $approved_ticket): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <?php
                                                        $n++;
                                                        $invoice_id = $approved_ticket->invoice_id;
                                                        $invoicemd5=md5($invoice_id);
                                                        $invoice_date = $approved_ticket->invoice->invoice_date;
                                                        $invoice_month = date('m',strtotime($invoice_date));
                                                        $invoice_year = date('Y',strtotime($invoice_date));
                                                        $invoice_no = $approved_ticket->invoice->invoice_no;
                                                        $org_code = $approved_ticket->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 echo e(date("d-M-Y", strtotime($approved_ticket->invoice->invoice_date))); ?></td>
                                                        <td>
                                                            <?php if($approved_ticket->approve_flag==1): ?>
                                                                    <?php echo e($invoice_number); ?>

                                                            <?php endif; ?>
                                                        </td>
                                                        <td><?php echo e(date("d-M-Y", strtotime($approved_ticket->invoice->show_date))); ?></td>
                                                        <td>
                                                            <?php if(isset($approved_ticket->invoice->payment_method)): ?>
                                                                <?php echo e($approved_ticket->invoice->paymentmethod->method); ?>

                                                            <?php endif; ?>
                                                        </td>
                                                        <td style="text-align: center;"><i class='fa fa-rupee'></i><?php echo e($approved_ticket->invoice->amount); ?></td>
                                                        <td>
                                                            <?php if($approved_ticket->approve_flag==1): ?>
                                                                <?php echo "Approved"; ?>
                                                            <?php elseif($approved_ticket->approve_flag==2): ?>
                                                                <?php echo "Rejected"; ?>
                                                            <?php else: ?>
                                                                <?php echo "Approval Pending"; ?>
                                                            <?php endif; ?>
                                                        </td>
                                                        <td>
                                                            <?php if(isset($approved_ticket->request_user_id)): ?>
                                                            <?php echo e($approved_ticket->requestuser->name); ?>

                                                            <?php endif; ?>

                                                        </td>
                                                        <td>
                                                            <?php if(isset($approved_ticket->approved_user_id)): ?>
                                                            <?php echo e($approved_ticket->approveduser->name); ?>

                                                            <?php endif; ?>
                                                            
                                                        </td>
                                                        <td>
                                                            <div class="form-check form-check-inline">
                                                                <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>
                                                                &nbsp;&nbsp;
                                                                <form class="form-horizontal" action="<?php echo e(URL::to('/ticket_invoicedetails')); ?>" method="post">
                                                                    <?php echo e(csrf_field()); ?>

                                                                    <input type="hidden" name="invoice_id" id="invoice_id" value="<?php echo e($invoice_id); ?>">
                                                                    <button type="submit" class="btn btn-info btn-xs">View</a></button>
                                                                </form>    
                                                            </div>
                                                        </td>
                                                    </tr>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                                <div class="row modal-dialog modal-dialog-centered" id="spinnerdiv" style="display: none;">
                                    <div class="col-xl-12" style="text-align: center;">
                                        <div class="spinner-border"></div>
                                        <h3>Please wait while we load</h3>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="application/javascript">
    $(document).ready(function () 
    {
        var table = $('#feewaiver_list').DataTable({
                pageLength : 50,
                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')
            });
    });
    $(document).ready(function () 
    {
        var table = $('#feewaiver_approval_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/ksstmorg/resources/views/Sales/ticket_approval.blade.php ENDPATH**/ ?>