


<?php $__env->startSection('content'); ?>


<div class="container-fluid">
    <div class="row">
        <div class="col-lg-12">
            <?php if($ticket_count>0): ?>
                <?php
                    $invoice_date = $tickets->invoice->invoice_date;
                    $invoice_month = date('m',strtotime($invoice_date));
                    $invoice_year = date('Y',strtotime($invoice_date));
                    $invoice_no = $tickets->invoice->invoice_no;
                    $org_code = $tickets->invoice->organisation->short_code;
                    if($invoice_month<4)
                        $invoice_year--;

                    $nextyear = $invoice_year+1;

                    $invoice_number = $org_code.'/'.$invoice_no.'/'.$invoice_year.'-'.$nextyear;

                    if($tickets->status==1)
                        $invoice_status = 'Paid';
                    else if($tickets->status==0)
                        $invoice_status = 'Pending';
                    else
                        $invoice_status = 'Cancelled';

                    //get adults and child count from tickets
                    
                    $adultCount = $tickets->noof_adult;
                    $childCount = $tickets->noof_child;
                    $totalCount = $adultCount+$childCount;
                    $payment_type = $tickets->invoice->payment_type;
                    $payment_method = $tickets->invoice->payment_method;
                ?>
                <div class="card ">
                    <div class="card-header"> <div> <strong>Invoice Date : </strong><br><small><?php echo e(date('d-m-Y', strtotime($invoice_date))); ?></small></div> <span class="float-right">
                            <strong>Invoice Status :</strong> <?php echo e($invoice_status); ?></span> </div>
                    <div class="card-body">
                        <div class="row">
                            <div class="col-xl-6 col-sm-6 mb-8">
                                <div class="col-sm-12 row"><div class="col-sm-4"> Invoice #:&nbsp;</div><div class="col-sm-8"><strong><?php echo e($invoice_number); ?></strong> </div></div>
                                <div class="col-sm-12 row"><div class="col-sm-4"> Show Date:&nbsp;</div><div class="col-sm-8"><strong><?php echo e(date('d-m-Y', strtotime($tickets->show_date))); ?></strong> </div></div>
                                <div class="col-sm-12 row">
                                    <div class="col-sm-4"> Visitor:&nbsp;</div>
                                    <div class="col-sm-8">
                                        <strong><?php echo e($tickets->invoice->visitor_name); ?> 
                                            <?php if($tickets->invoice->visitor_phone_number): ?>
                                            (<?php echo e($tickets->invoice->visitor_phone_number); ?>)
                                            <?php endif; ?>
                                        </strong> 
                                    </div>
                                </div>
                                <div class="col-sm-12 row"><div class="col-sm-4"> Centre:&nbsp;</div><div class="col-sm-8"><strong><?php echo e($tickets->invoice->organisation->organisation_name); ?>,&nbsp;<?php echo e($tickets->invoice->organisation->city); ?></strong> </div></div>
                            </div>
                            
                        </div>
                        <div class="table-responsive">
                            <table class="table table-striped">
                                <thead>
                                    <tr>
                                        <th class="center">#</th>
                                        <th>Ticket #</th>
                                        <th>Adult #</th>
                                        <th>Child #</th>
                                        <th>Facility</th>
                                        <th class="right">Show Time</th>
                                        <th class="right">Ticket Amount</th>
                                        <th class="right">Refund Amount</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php 
                                        $i=0; 
                                        $totalrefund = 0;
                                    ?>
                                    <?php if(isset($tickets)): ?>
                                        <?php 
                                            $i++; 
                                            $org_code = $tickets->facility->organisation->short_code;
                                            $facility_short_code = $tickets->facility->short_code;
                                            $ticket_no = $tickets->ticket_no;
                                            $invoice_date = $tickets->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 class="center"><?php echo e($i); ?></td>
                                            <td class="center">
                                                <?php if(isset($tickets->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 class="left strong"><?php echo e($tickets->noof_adult); ?></td>
                                            <td class="left strong"><?php echo e($tickets->noof_child); ?></td>
                                            <td class="left"><?php echo e($tickets->facility->facility_name); ?></td>
                                            <td class="right"><?php echo e(date("H:i A", strtotime($tickets->showtime->from_time))); ?>&nbsp;-&nbsp;<?php echo e(date("H:i A", strtotime($tickets->showtime->to_time))); ?></td>
                                            <td class="right"><i class='fa fa-rupee'></i>&nbsp;<?php echo e($tickets->amount); ?></td>
                                            <td class="right"><i class='fa fa-rupee'></i>&nbsp;
                                                <?php if(isset($refundticket[$tickets->id])): ?>
                                                    <?php echo e($refundticket[$tickets->id]); ?>

                                                <?php endif; ?>
                                            </td>
                                        </tr>
                                        <?php 
                                            $totalrefund += $refundticket[$tickets->id];
                                        ?>
                                    <?php endif; ?>
                                    <tfoot>
                                        <tr>
                                            <td colspan="7" align="right"><strong><h4>Total Refund Amount:&nbsp;&nbsp;&nbsp;<i class='fa fa-rupee'></i>&nbsp;<?php echo e($totalrefund); ?></h4></strong></td>
                                        </tr>
                                        <tr>
                                            <td colspan="7">
                                                <?php $mess=""; ?>
                                                <?php if($payment_type==1): ?>
                                                    <?php
                                                        $mess = "The payment for this ticket is Online.";
                                                    ?>
                                                <?php elseif(($payment_method==2) && ($payment_type==2)): ?>
                                                    <?php
                                                        $mess = "The payment for this ticket is via CARD.";
                                                    ?>
                                                <?php elseif(($payment_method==3) && ($payment_type==2)): ?>
                                                    <?php
                                                        $mess = "The payment for this ticket is via UPI.";
                                                    ?>
                                                <?php else: ?>
                                                    <?php if($refundticket[$tickets->id]>0): ?>
                                                        <!-- check whether cancel request already send or not -->
                                                        <?php if($ticket_cancel_list_count==0): ?>
                                                        <!-- end-->
                                                            <form action="<?php echo url('/ticket_cancellation_approval'); ?>" method="post">
                                                                <?php echo e(csrf_field()); ?>

                                                                <button class="btn btn-success pull-right" type="submit" value="Approve" id="btnValue" name="btnValue">Cancel & Approve Ticket</button>
                                                                <input type="hidden" name="invoice_id" id="invoice_id" value="<?php echo e($tickets->invoice->id); ?>">
                                                                <input type="hidden" name="ticket_id" id="ticket_id" value="<?php echo e($tickets->id); ?>">
                                                            </form>
                                                        <?php endif; ?>
                                                    <?php endif; ?>
                                                <?php endif; ?>
                                                <span class="pull-right" style="color: red;"><b><?php echo e($mess); ?></b></span>
                                            </td>
                                        </tr>
                                    </tfoot>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            <?php else: ?>
                <div class="card card-body card-header">
                    <div> <strong> No Ticket Available !!!</strong></div>
                </div>
            <?php endif; ?>
        </div>
    </div>
</div>

<?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_cancel_view.blade.php ENDPATH**/ ?>