<?php $__env->startSection('title','Invoice Details'); ?>

<?php $__env->startPush('css'); ?>
    <style type="text/css">
        .cus>t{
            border-bottom: 2px dotted;
        }
    </style>
<?php $__env->stopPush(); ?>
<!-- page content -->
<?php $__env->startSection('content'); ?>
    <div class="right_col" role="main">
        <div class="">
           <!-- <div class="page-title">
                <div class="title_left">
                    <h3>Sales Management</h3>
                </div>
                <div class="title_right">
                    <div class="col-md-5 col-sm-5 col-xs-12 form-group pull-right top_search">
                        <div class="col-md-5 col-sm-5 col-xs-12 form-group top_search" style="padding-left: 100px;">
                            <div class="input-group">
                                <a href="<?php echo e(route('sales.create')); ?>" class="btn btn-success">Make New Sales</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>-->
            <div class="clearfix"></div>
            <div class="row">
                <div class="col-md-12 col-sm-12 col-xs-12">
                    <div class="x_panel">
                        <div class="x_title">
                            <a href="<?php echo e(route('sales.list')); ?>" calss="btn" ><h2><i class="fa fa-mail-reply"></i></h2></a>
                            <h2>Invoices List</h2>
                            <ul class="nav navbar-right panel_toolbox">
                                <li><a class="btn-primary" onclick="printDiv('printableArea')" ><i class="fa fa-print fa-x"></i></a>
                                <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                                </li>
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
                                    <ul class="dropdown-menu" role="menu">
                                        <li><a href="#">Settings 1</a>
                                        </li>
                                        <li><a href="#">Settings 2</a>
                                        </li>
                                    </ul>
                                </li>
                                <li><a class="close-link"><i class="fa fa-close"></i></a>
                                </li>
                            </ul>
                            <div class="clearfix"></div>
                        </div>
                        <div class="x_content">
                            <div class="" id="printableArea">
                                <div class="row">
                                    <div class="col-xs-12 col-sm-12">
                                        <div class="row">
                                            <div class="col-xs-1"></div>
                                            <div class="col-xs-1">
                                                <img src="<?php echo e(asset('storage/about/'.about()->logo)); ?>" class="img-responsive img-thumbnail" alt="logo" width="85px" height="75px" >
                                            </div>
                                            <div class="col-xs-8">
                                                <div class="text-center">
                                                    <h4><?php echo e(about()->english_name); ?></h4>
                                                    <p>Phone:  <?php echo e(about()->phone); ?>, Email: <?php echo e(about()->email); ?></p>
                                                    <p>Address: <?php echo e(about()->address); ?> </p>
                                                    <h4>Sales Details Report</h4>
                                                </div>
                                            </div>
                                            <div class="col-xs-2"></div>
                                        </div>
                                        <div class="row">
                                            <div class="col-sm-3 col-xs-3">
                                                <b>INVOICE NO: <?php echo e($sale->invoice_no); ?></b>
                                            </div>
                                            <div class="col-sm-6 col-xs-6"></div>
                                            <div class="col-sm-3 col-xs-3">
                                                 <b>Sale Date: <?php echo e(date('d-m-Y',strtotime($sale->sale_date))); ?></b>
                                            </div>
                                        </div>
                                        <hr/>
                                        <div class="row">
                                            <div class="customer">
                                                <table class="table table-bordered table-condensed">
                                                    <tr class="customer-detail">
                                                        <td><b>Customer Name: </b> <?php echo e($sale->customer->name); ?></td>
                                                        <td><b>Customer Phone: </b> <?php echo e($sale->customer->phone); ?></td>
                                                    </tr>
                                                    <tr class="customer-detail">
                                                        <td colspan="2"><b>Customer Address: </b><?php echo e($sale->customer->address); ?> </td>
                                                    </tr>
                                                </table>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <table class="table table-bordered table-condensed">
                                                <thead>
                                                    <tr class="bg-primary">
                                                        <th>SL</th>
                                                        <th>DESCRIPTION</th>
                                                        <th>UNIT PRICE</th>
                                                        <th>SIZE</th>
                                                        <th>TSQF</th>
                                                        <th>TOTAL</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                <?php $__currentLoopData = $sale->details; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $i=>$detail): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <tr>
                                                        <td class="no"><?php echo e($i+1); ?></td>
                                                        <td class="text-left">
                                                            <?php echo e($detail->product->product_name); ?>

                                                            ( <?php echo e($detail->height); ?>x<?php echo e($detail->width); ?>)
                                                        </td>
                                                        <td class="unit"><?php echo e($detail->unit_price); ?></td>
                                                        <td class="qty"><?php echo e($detail->size); ?></td>
                                                        <td class="qty"><?php echo e($detail->tsqf); ?></td>
                                                        <td class="total"><?php echo e($detail->tsqf * $detail->unit_price); ?></td>
                                                    </tr>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                 <!--<?php if($sale->other_cost != ''): ?>-->
                                                 <!--   <tr>-->
                                                 <!--       <td class="no"><?php echo e($i+2); ?></td>-->
                                                 <!--       <td colspan="3"><?php echo e($sale->note); ?></td>-->
                                                 <!--       <td ><?php echo e($sale->other_cost); ?></td>-->
                                                 <!--       <td ><?php echo e($sale->other_cost); ?></td>-->
                                                 <!--   </tr>-->
                                                 <!--   <?php endif; ?>-->
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                    <div class="hr hr8 hr-double hr-dotted"></div>
                                    <div class="row">
                                        <div class="col-sm-5 pull-right">
                                            <h4 class="pull-right">
                                                Total amount :
                                                <span class="red"><?php echo e($sale->total_price); ?></span>
                                            </h4>
                                        </div>
                                        <div class="col-sm-7 pull-left"> 
                                            Previous Due: <b class="red"><?php echo e($sale->customer->sales->sum('due_amount') -  $sale->due_amount); ?> </b>
                                            <br/>
                                            Total Due: <b class="red"><?php echo e($sale->customer->sales->sum('due_amount')); ?> </b>
                                        </div>
                                    </div>
                                    <div class="space-6"></div>
                                    <div class="">
                                        
                                    </div>
                                    <div class="row">
                                        <div class="col-sm-12">Note: <?php echo e($sale->note); ?></div>
                                    </div>
                                    <hr/>
                                    <div class="text-center">
                                        <small>
                                            Thank you for choosing our Company products.We believe you will be satisfied by our services.
                                        </small>
                                    </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- /page content -->
<?php $__env->stopSection(); ?>
<?php $__env->startPush('js'); ?>
    <script type="text/javascript">
        function printDiv(divName) {
         var printContents = document.getElementById(divName).innerHTML;
         var originalContents = document.body.innerHTML;

         document.body.innerHTML = printContents;

         window.print();

         document.body.innerHTML = originalContents;
        }
    </script>
    
<?php $__env->stopPush(); ?>
<?php echo $__env->make('backend.layouts.master', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>