@extends('layouts.dashboard')

@section('page_title')
	Manage Vendor
@endsection

@section('page_header_title')
	Manage Vendor
@endsection



@section('page_body')
{{ Breadcrumbs::render('vendor') }}

	<div class="row row-cards row-deck">
              <div class="col-12">
                <div class="card">
                	  <div class="card-header">



					     <button  class="float-right btn btn-sm btn-outline-primary" data-toggle="modal" data-target="#md_add_vendor"><i class="fa fa-plus"></i></button> &nbsp;&nbsp;

					     <h3 class="card-title">Add Vendor</h3>
					  </div>

                	<div class="card-status card-status-left bg-blue"></div>
                  <div class="table-responsive table-height">
                    <table class="table table-hover table-outline table-vcenter text-nowrap card-table cls_datatable">
                      <thead>
                        <tr>

                          <th>#</th>
                          <th>Name</th>
                          <th>Cnic #</th>
                          <th>Contact #</th>
                          <th>NTN #</th>
                          <th>STN #</th>
                          <th style="text-align: center;"><i class="dropdown-icon fa fa-cogs"></i></th>

                        </tr>
                      </thead>
                      <tbody>
                      	@isset($vendor_list)
                          @php($pass_data = [])
                      		@foreach($vendor_list as $rows)
                            @php(
                              $pass_data = array(
                                  'user'      			   => Crypt::encrypt($rows->id),
                                  'full_name'        	   => $rows->name,
                                  'cnic'                 => ($rows->cnic),
                                  'contact'    	         => $rows->contact,
                                  'temporary_address'    => $rows->temp_address,
                                  'permanent_address'    => $rows->per_address,
                                  'ntn'                  => $rows->ntn,
                                  'stn'                  => $rows->stn,

                                  'user_image'           => $rows->dp,
                                )
                            )
                      			<tr>
                      				<td>{{$loop->iteration}}</td>

                      				<td style="text-align: left;"> <span class="avatar" style="background-image: url({{EF::getFile($rows->dp)}});"></span>&nbsp;&nbsp;&nbsp;{{$rows->name}}</td>

                      				<td>{{($rows->cnic)}}</td>

                      				<td>{{$rows->contact}}</td>

                      				<td>{{$rows->ntn}}</td>

                      				<td>{{$rows->stn}}</td>

                      				<td class="text-center">

			                            <div class="item-action dropdown">
			                              <a href="javascript:void(0)" data-toggle="dropdown" class="icon"><i class="fa fa-list-ul"></i></a>
			                              <div class="dropdown-menu dropdown-menu-right">

			                                <a onclick="update(event,'{{json_encode($pass_data)}}','form_update_vendor','md_update_vendor')"class="dropdown-item"><i class="dropdown-icon fa fa-edit"></i> Update </a>

                                      <a href="{{route('vendoropeningbalance',['id' => Crypt::encrypt($rows->id)])}}" class="dropdown-item"><i class="dropdown-icon fa fa-eye"></i>  Opening Balances </a>

			                              </div>
			                            </div>
			                         </td>
                      			</tr>


                      		@endforeach
                      	@endisset

                      </tbody>
                    </table>
                  </div>
                </div>
              </div>
          </div>
@endsection

@section('page_modal')
	@include('estatechvendor::modals.add_vendor')
  @include('estatechvendor::modals.update_vendor')
@endsection

@section('page_script')

@endsection

