@extends('layouts.app')

@section('title')
Add Vendor
@stop

@section('breadcrumb')
<ol class="breadcrumb pull-right">
        <li><a href="{{route('home')}}"><i class="fa fa-dashboard"></i> Home</a></li>

        <li class="active">Vendors</li>
      </ol>
@stop




@section('content')
  <div class="container-fluid">
  <div class="row">
                    
    <div class="col-sm-12">

        <div class="white-box">

<div class="row">
<div class="col-sm-12" style="    margin-bottom: 2rem;">
<center><h3>Vendor Details</h3></center>
<hr style="border-color: #e6e6e6;margin-top: 10px;">
</div>

<div class="col-sm-4">
<h5> 
<div class="row">
    <div class="col-sm-3">
           <b> Name </b>
    </div>

     <div class="col-sm-9" style="position: relative;">
           <span style="color: gray;">{{ucfirst($data['vendor']->name)}}</span>
    </div>

</div>

</h5>
</div>

<div class="col-sm-4">
<h5> 

<div class="row">
    <div class="col-sm-3">
           <b> Email  </b> 
    </div>

     <div class="col-sm-9" style="position: relative;">
           <span style="color: gray;">{{ucfirst($data['vendor']->email)}}</span>
    </div>

</div>


</h5>
</div>

<div class="col-sm-4">
<h5>


<div class="row">
    <div class="col-sm-3">
           <b> Phone  </b> 
    </div>

     <div class="col-sm-9" style="position: relative;">
         <span style="color: gray;">0{{ucfirst($data['vendor']->phone_number)}}</span>
    </div>

</div>

</h5>
</div>

<div class="col-sm-4">
<h5>

<div class="row">
    <div class="col-sm-3">
           <b> CNIC  </b> 
    </div>

     <div class="col-sm-9" style="position: relative;">
         <span style="color: gray;">{{ucfirst($data['vendor']->cnic)}}</span>
    </div>
</div>

</h5>
</div>

<div class="col-sm-4">
<h5> 

<div class="row">
    <div class="col-sm-3">
           <b> NTN  </b> 
    </div>

     <div class="col-sm-9" style="position: relative;">
         <span style="color: gray;">{{$data['vendor']->ntn}}</span>
    </div>
</div>

</h5>
</div>

<div class="col-sm-4">
<h5> 

    <div class="row">
    <div class="col-sm-3">
           <b> STRN  </b> 
    </div>

     <div class="col-sm-9" style="position: relative;">
        <span style="color: gray;">{{$data['vendor']->stn}}</span>
    </div>
</div>


</h5>
</div>

<div class="col-sm-12">
<h5> 

    <b> Address  </b> <span style="color: gray;margin-left:2rem;">{{ucfirst($data['vendor']->address)}}</span>
</h5>
</div>
</div>


</div>


        <div class="white-box">

            <div class="row">
                    <div class="col-md-6 col-sm-12" style="padding: 5rem 5rem 0rem 5rem;">
                      <center><div style="padding: 1rem 2.5rem 3rem 2.5rem !important;" class="white-box bg-primary color-box us-custom">
                            <h1 class="text-white font-light m-b-0">Purchase Orders</h1>
                            <span class="hr-line"></span>
                            

                            <h6 class="text-white font-semibold">Sent  <span style="margin-left: 1rem;" class="font-light">{{  $data['sent_po'] }}</span> 

                            <a href="{{ route('purchase-orders.vendor' , ['vendor' => $data['vendor']->id , 'status' => 'po-sent']) }}" style="float: right;" class="btn  btn-info  btn-xs"> view
                            </a>
                            </h6>
                          

                           <h6 class="text-white font-semibold">Received  <span style="margin-left: 1rem;" class="font-light">{{$data['receive_po']}}</span>

                             <a href="{{ route('purchase-orders.vendor' , ['vendor' => $data['vendor']->id , 'status' => 'po-receive']) }}" style="float: right;" class="btn  btn-info  btn-xs"> view 
                           </a>

                           </h6>


                            <h6 class="text-white font-semibold">Partial Received   <span style="margin-left: 1rem;" class="font-light">{{$data['partial_receive_po']}}</span>

                            <a href="{{ route('purchase-orders.vendor' , ['vendor' => $data['vendor']->id , 'status' => 'po-partial-receive']) }}" style="float: right;" class="btn btn-info  btn-xs"> view  </a>

                            </h6>

                           
                        </div></center>
                    </div>
                     <div class="col-md-6 col-sm-12" style="padding: 5rem 5rem 0rem 5rem;">
                      <center><div  style="padding: 1rem 2.5rem 3rem 2.5rem !important;" class="white-box bg-danger color-box us-custom">
                            <h1 class="text-white font-light m-b-0">Receipts</h1>
                            <span  class="hr-line"></span>
                          


                            <h6 class="text-white font-semibold">Paid  <span style="margin-left: 1rem;" class="font-light">{{$data['paid_receipt'] }}</span><a href="{{ route('purchase-order-receipts.vendor' , ['vendor' => $data['vendor']->id , 'status' => 'paid']) }}" style="float: right;" class="btn btn-info  btn-xs"> view</a></h6>



                           <h6 class="text-white font-semibold">Unpaid  <span style="margin-left: 1rem;"  class="font-light">{{ $data['unpaid_receipt']}}</span><a href="{{ route('purchase-order-receipts.vendor' , ['vendor' => $data['vendor']->id , 'status' => 'unpaid']) }}" style="float: right;" class="btn btn-info  btn-xs"> view </a></h6>


                        <h6 class="text-white font-semibold">Partial Paid   <span class="font-light" style="margin-left: 1rem;">{{ $data['partialy_paid_receipt'] }}</span>
                        <a href="{{ route('purchase-order-receipts.vendor' , ['vendor' => $data['vendor']->id , 'status' => 'partial-paid']) }}" style="float: right;" class="btn btn-info  btn-xs"> view </a>
                        </h6>


                        </div></center>
                    </div>
                </div>




                            <div class="table-responsive">
                             
                            @if(Session::has('success'))   
                            <div id="successMessage" class="alert alert-success" role="alert">
                            {{ Session::get('success') }}
                            </div>
                            @endif
<h3>Items List</h3>
                            <table id="myTable" class="table table-striped table-bordered dataTable color-table primary-table" role="grid" aria-describedby="myTable_info">
                                    <thead>
                                        <tr role="row">
                                            <th style="color:black;" class="sorting_asc" tabindex="0" aria-controls="myTable" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Name: activate to sort column descending" style="width: 100px;">Category</th>

                                        	<th style="color:black;" class="sorting_asc" tabindex="0" aria-controls="myTable" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Name: activate to sort column descending" style="width: 100px;">Item code</th>

                                            <th style="color:black;" class="sorting" tabindex="0" aria-controls="myTable" rowspan="1" colspan="1" aria-label="Position: activate to sort column ascending" style="width: 100px;">Items name</th>

                                            <th style="color:black;" class="sorting" tabindex="0" aria-controls="myTable" rowspan="1" colspan="1" aria-label="Position: activate to sort column ascending" style="width: 100px;">Unit</th>


                                            <th style="color:black;" class="sorting" tabindex="0" aria-controls="myTable" rowspan="1" colspan="1" aria-label="Position: activate to sort column ascending" style="width: 10px; text-align: center;">Action</th>
                                        </tr>
                                    </thead>
                                <tbody>
  
                                   
                                    @foreach( $data['vendor']->items  as $list )

                                    <tr role="row" class="odd">
                                           
                                    <td>{{ $list->category->category_name}} </td>
                                    <td> {{$list->item_code}}  </td>

                                    <td>  {{$list->item_name}} </td>

                                    <td>  {{$list->unit}} </td>

                                    <td style="text-align: center;"> <a href="{{route('vendor.item-detail' , ['vendor' => $data['vendor']->id, 'item' => $list->id])}}" class="btn btn-info btn-sm"> View Details</a> </td>
                                          
                                      </tr>
                                     @endforeach   
                                     
                                </tbody>
                                </table>
                                
                            </div>
                            </div>
                        </div>
                    </div>


    </div>
@stop

@section('js')  

<script type="text/javascript">
    function validate()
    { 
        if(!confirm('Are you sure you want to delete?'))
        {
            return false;
        } 
    }
</script>

@stop