<?php $__env->startSection('content'); ?>
<style>
body {
    background-image: url('images/sky2.jpg');
    height: 100vh;
}
table {
    color: black !important;
    background-color: white;
}

.float{
    position:fixed;
    width:60px;
    height:60px;
    bottom:40px;
    right:40px;
    background-color:#0C9;
    color:#FFF;
    border-radius:50px;
    text-align:center;
    box-shadow: 2px 2px 3px #999;
}

.my-float{
    margin-top:22px;
}
</style>
<?php   
    $timenowplus5min = strtotime($timenow." +5minutes");
?>
<script>
    var timenow_str = <?php echo e($timenowplus5min); ?>;
</script>
<div class="btn-group">
    <div class="col-sm-20">
        <img class="logo-abbr" width="80" src="<?php echo e(asset('images/logo_ksstm.png')); ?>" alt="">
    </div>
    <div class="col-sm-80">
        <label style="text-align: center; padding:15px;"><br><b><h4>KSSTM ONLINE TICKETING APPLICATION <br>SELF SERVICE KIOSK</h4></b></label>
    </div>
</div>

<div class="table-responsive align-self-start">

      <!--Table-->
      <table class="table">

        <!--Table head-->
        <thead>
          <tr>
            <th>#</th>
            
            <th class="th-lg">Invoice</th>
            <th class="th-lg">Show Date</th>
            <th class="th-lg">Amount</th>
            <th class="th-lg">&nbsp;</th>
          </tr>
        </thead>
        <!--Table head-->
        <?php 
          $n=0;
        ?>
        <!--Table body-->
        <tbody>
        <?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>
                    <th scope="row"><?php echo e($n); ?></th>
                    <td><?php echo e($invoice_number); ?></td>
                    <td>
                        <?php if(isset($invoice->show_date)): ?>
                            <?php echo e(date("d-M-Y", strtotime($invoice->show_date))); ?>

                        <?php endif; ?>
                    </td>
                    <td><i class='fa fa-rupee'></i><?php echo e($invoice->amount); ?></td>
                    <td>
                        <?php
                            $verify_status = $invoice->tickets[0]->verify_status;

                        ?>
                        <?php if($verify_status==1): ?>
                            <?php  echo "Already taken print out."; ?>
                        <?php else: ?>
                            <a href="<?php echo e(URL::to('/print_tickets_general')); ?>/<?php echo e($invoice_id); ?>/<?php echo e($invoicemd5); ?>" target="_self"><button class="btn btn-xs btn-primary"><i class='fa fa-print'></i>&nbsp;Print</button></a>
                        <?php endif; ?>
                    </td>
                </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        <?php endif; ?>
        <?php if($n==0): ?>  
          <tr>
            <td colspan="5" align="center">No tickets to print!!</td>
          </tr>
        <?php endif; ?>

        </tbody>
        <!--Table body-->

      </table>
      <!--Table-->

</div>

<a href="<?php echo e(URL::to('getTicket_public')); ?>" class="float">
<i class="fa fa-refresh my-float"></i>
</a>


<script type="text/javascript">
        ///////time checking //////////////////////////////////////////////
        window.onload = function() 
        {
            var interval = setInterval(() => 
            {
                //console.log(new Date().toLocaleTimeString()); 
                const d = new Date();
                let time = Math.floor(d.getTime()/1000);
                //console.log(time);
                console.log(timenow_str);
                if(time>=timenow_str)
                {
                    if (navigator.userAgent.indexOf("Firefox") > 0) {
                        window.location = "<?php echo e(URL::to('getTicket_public')); ?>";
                    }
                    window.location.href = "<?php echo e(URL::to('getTicket_public')); ?>";
                }
            }, 1000);

        }
    </script>

<?php $__env->stopSection(); ?>
<?php echo $__env->make('layout.fullwidth', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/html/ksstmorg/resources/views/getTickets_public.blade.php ENDPATH**/ ?>