

<?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 Cancellation</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>Cancel Ticket</b></a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link" data-toggle="tab" href="#listorgdata"><b>View Cancelled Tickets</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">
                                    <form id="organisation_form" class="form-horizontal" action="<?php echo e(URL::to('/ticket_cancel_view')); ?>" method="post" onsubmit="return validation();" autocomplete="off" enctype="multipart/form-data">
                                        <?php echo e(csrf_field()); ?>

                                        <div class="form-row">    
                                          <div class="form-group col-6">
                                              <label><b>Ticket Number : </b></label>&nbsp;&nbsp;
                                              <div class="form-check form-check-inline">
                                                <?php
                                                  $org_short_code = $users->organisation->short_code;
                                                  $current_year = date('Y');
                                                  $next_year = $current_year+1;
                                                  $finyear = $current_year." - ".$next_year;
                                                ?>
                                                <?php echo e($org_short_code); ?>/&nbsp;
                                                <select name="facility_id" id="facility_id" class="form-control" style="width: 100px;" required>
                                                  <option value=""></option>
                                                  <?php $__currentLoopData = $facility_short_codes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $facility_short_code): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <option value="<?php echo e($facility_short_code->id); ?>"><?php echo e($facility_short_code->short_code); ?> - <?php echo e($facility_short_code->facility_name); ?></option>
                                                  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </select>
                                                &nbsp;&nbsp;
                                                <input name="ticket_number" class="form-control" id="ticket_number" type="text" style="width: 100px;" onkeypress="return isNumber(event);" maxlength="8" required>
                                                &nbsp;
                                                /<?php echo e($finyear); ?>

                                              </div>
                                          </div>  
                                        </div>   
                                        <div class="card-footer">
                                          <div id="canceldiv">
                                            <button type="submit" class="btn btn-primary">View Ticket</button>
                                          </div>
                                        </div>
                                    </form>
                                </div>
                                <div class="tab-pane fade" id="listorgdata">
                                    <div class="table-responsive">
                                        <table class="display" style="width:100%" id="example">
                                            <thead class="thead-info">
                                                <tr>
                                                    <th>Slno</th>
                                                    <th>Ticket #</th>
                                                    <th>Facility</th>
                                                    <th>Show Time</th>
                                                    <th>Show Date</th>
                                                    <th>Adult #</th>
                                                    <th>Child #</th>
                                                    <th>Refund Amount</th>
                                                    <th>Request Initiated By</th>
                                                    <th>Approval Status</th>
                                                    <th>Actions</th>
                                                </tr>
                                            </thead>
                                            <tbody>      
                                                <?php $n=0; ?>                                              
                                                <?php if(isset($ticket_cancel_list)): ?>
                                                    <?php $__currentLoopData = $ticket_cancel_list; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ticket_cancel): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <?php  
                                                            $n++;
                                                            $approval_flag = $ticket_cancel->approval_status;
                                                            if($approval_flag==1)
                                                            {
                                                              $approved_status = "Approved";
                                                            }
                                                            if($approval_flag==0)
                                                            {
                                                              $approved_status = "Not Approved";
                                                            }
                                                            $show_start_time = date("g:i A", strtotime($ticket_cancel->showtime->from_time));
                                                            if(!$ticket_cancel->showtime->dont_show_to_time)
                                                            {
                                                                $show_start_time .=  "-". date("g:i A", strtotime($ticket_cancel->showtime->to_time));
                                                            } 
                                                            $org_code = $ticket_cancel->ticket->facility->organisation->short_code;
                                                            $facility_short_code = $ticket_cancel->ticket->facility->short_code;
                                                            $ticket_no = $ticket_cancel->ticket_no;
                                                            $invoice_date = $ticket_cancel->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_cancel->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 echo e($ticket_cancel->ticket->facility->facility_name); ?></td>
                                                            <td><?php echo e($show_start_time); ?></td>
                                                            <td><?php echo e(date("d-M-Y", strtotime($ticket_cancel->show_date))); ?></td>
                                                            <td><?php echo e($ticket_cancel->noof_adult); ?></td>
                                                            <td><?php echo e($ticket_cancel->noof_child); ?></td>
                                                            <td><?php echo e($ticket_cancel->refund_amount); ?></td>
                                                            <td>
                                                              <?php if(isset($ticket_cancel->user_id)): ?>
                                                                <?php if($ticket_cancel->user->name): ?>
                                                                  <?php echo e($ticket_cancel->user->name); ?>

                                                                <?php endif; ?>
                                                              <?php endif; ?>
                                                            </td>
                                                            <td><?php echo e($approved_status); ?></td>
                                                            <td>
                                                              <div class="form-group">
                                                                <div class="form-check form-check-inline" style="margin-right:0px !important;">
                                                                  <?php if($approval_flag==0): ?>
                                                                    <?php if(in_array('Approve', $permission_arr)): ?>
                                                                      <form  action="<?php echo e(URL::to('/ticket_cancel_final_approval')); ?>" method="post">
                                                                        <?php echo e(csrf_field()); ?>

                                                                        <input type="hidden" name="ticket_id" id="ticket_id" value="<?php echo e($ticket_cancel->ticket_id); ?>">
                                                                        <input type="hidden" name="ticket_cancel_id" id="ticket_cancel_id" value="<?php echo e($ticket_cancel->id); ?>">
                                                                        <button type="submit" class="btn btn-success btn-xs">Approve</button>
                                                                      </form>
                                                                    <?php endif; ?>
                                                                  <?php else: ?>
                                                                    <span style="color: blue;">Approved</span>
                                                                  <?php endif; ?>                                                                       
                                                                </div> 
                                                                                                                                
                                                              </div>
                                                            </td>
                                                        </tr>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                <?php endif; ?>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="application/javascript">
  $(document).ready(function() {
      toastr.options.timeOut = 10000;
      <?php if(Session::has('error')): ?>
          toastr.error('<?php echo e(Session::get('error')); ?>');
      <?php elseif(Session::has('success')): ?>
          toastr.success('<?php echo e(Session::get('success')); ?>');
      <?php endif; ?>
  });
</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/ticket_cancellation.blade.php ENDPATH**/ ?>