 @extends('layouts.user')

 <script src="https://code.jquery.com/jquery-3.5.1.js"></script>
 <script src="https://cdn.datatables.net/1.11.4/js/jquery.dataTables.min.js"></script>

 <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
 <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>


 <script src="https://code.jquery.com/jquery-3.5.1.js"></script>
 <script src="https://cdn.datatables.net/1.11.4/js/jquery.dataTables.min.js"></script>


 {{-- Web site Title --}}

 {{-- Content --}}
 @section('content')
 <?php
    $php_variable = 'string'; //Define our PHP variable. You can of course get the value of this variable however you need.
    ?>

 <form method="POST" action="{{ route('qoutation.insert') }}">
     <input type="hidden" name="_token" value="{{ csrf_token() }}" />
     <div class="form-group row">

<?php

foreach($invoice_details as $i_d)
{
?>


         <div class="col-xs-3">
             <label for="ex1">Invoice No</label>
             <input value="{{$i_d->id}}" class="form-control" name="id_no" type="number" id="c_id" placeholder="Enter ID No" required>
         </div>

         <div class="col-xs-3">
             <label for="ex1">Customer Mobile</label>
             <input value="{{$i_d->mobile}}" class="form-control" type="number" id="c_mobile" name="contact" placeholder="Enter Mobile Number" required>
         </div>


         <div class="col-xs-3">
             <label for="ex1">Customer Name</label>
             <input value="{{$i_d->first_name." ".$i_d->last_name}}" class="form-control" id="c_name" type="text" name="name" placeholder="Enter Customer Name">
         </div>

         <div class="col-xs-3">
            <label for="ex1">Payment term</label>
            <input value="{{$i_d->payment_term}}" class="form-control" id="c_name" type="text" name="name" placeholder="Enter Customer Name">
        </div>

        <div class="col-xs-3">
            <label for="ex1">Status</label>
            <input value="{{$i_d->status}}" class="form-control" id="c_name" type="text" name="name" placeholder="Enter Customer Name">
        </div>
        <div class="col-xs-3">
            <label for="ex1">Invoice date</label>
            <input value="{{$i_d->invoice_date}}" class="form-control" id="c_name" type="text" name="name" placeholder="Enter Customer Name">
        </div>

        <div class="col-xs-3">
            <label for="ex1">Due date</label>
            <input value="{{$i_d->due_date}}" class="form-control" id="c_name" type="text" name="name" placeholder="Enter Customer Name">
        </div>
<?php
}
?>
         


     </div>



     <div class="form-group row">
         <div class="col-xs-12">
             <table id="datatable" class="table table-bordered table-hover">
                 <thead>
                     <tr>
                         <td>#.</td>
                        <td>Name</td>
                        <td>Description</td>
                         <td>Price</td>
                         <td>Quantity</td>
                         <td>Amount</td>
                   
                     </tr>
                 </thead>
                 <tbody>
                     <?php
                     $sno=1;
                     //$total=0;
                    foreach($invoice_products as $i_p)
                    {    
                    ?>
                    <tr>
                        <td>{{$sno}}</td>
                          <td>{{$i_p->product_name}}</td>
                          <td>{{$i_p->dexription}}</td>
                          <td>{{$i_p->price}}</td>
                          <td>{{$i_p->quantity}}</td>
                          <td>{{$i_p->sub_total}}</td>
                       
                    </tr>
                    <?php
                    $sno++;
                    }
    //                 $total=$i_d->grand_total;
    // $unpaid=$i_d->$unpaid_amount;
    // $discount=$i_d->discount;
    // $final_total=$i_d->final_price;
                    ?>
                    <?php
                    foreach($invoice_details as $i_d)
                    {
                        $total=$i_d->grand_total;
    $unpaid=$i_d->unpaid_amount;
    $discount=$i_d->discount;
    $final_total=$i_d->final_price;

                    ?>
                     <tr>
                        <td></td>
                          <td></td>
                          <td></td>
                          <td></td>
                          <td>Subtotal</td>
                          <td>{{$total}}</td>
                       
                    </tr>
                    <tr>
                        <td></td>
                          <td></td>
                          <td></td>
                          <td></td>
                          <td>Discount(%)</td>
                          <td>{{$discount}}</td>
                       
                    </tr>
                    <tr>
                        <td></td>
                          <td></td>
                          <td></td>
                          <td></td>
                          <td>Grand total</td>
                          <td>{{$final_total}}</td>
                       
                    </tr>
                    <?php
                    }
                    ?>
                 </tbody>
             </table>
         </div>
     </div>
 

     <button type="submit" class="btn btn-primary">Create</button>
 </form>
 @stop
 <script>
 
 </script>