@extends('layouts.dashboard')

@section('page_title')
	Manage Employee Assets
@endsection

@section('page_header_title')
	Manage Employee Assets
@endsection



@section('page_body')
{{ Breadcrumbs::render('employeeasset',Crypt::encrypt($employee->id),($employee->name.' Asset List'))}}


	<div class="row row-cards row-deck">
              <div class="col-12">
                <div class="card">
                	  <div class="card-header">
					     <h3 class="card-title">Employee Assets</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>Father Name</th>
                          <th>Cnic #</th>
                          <th>Asset Code</th>
                          <th>Asset Name</th>
                          <th>Type</th>
                          <th>Description</th>
                          <th></th>
                          <th></th>
                 
                          
                       
                        </tr>
                      </thead>
                      <tbody>
                      @if(isset($employee_assets))
                      @foreach($employee_assets as $rows)
                      <tr>
                        <td>{{$loop->iteration}}</td>
                        <td>{{ucwords($rows->contract->user->name)}}</td>
                        <td>{{ucwords($rows->contract->user->fname)}}</td>
                        <td>{{ucwords($rows->contract->user->cnic)}}</td>
                        <td>{{ucwords($rows->asset->asset_code)}}</td>
                        <td>{{ucwords($rows->asset->name)}}</td>
                        <td>{{ucwords($rows->asset->type)}}</td>
                        <td>{{ucwords($rows->asset->description)}}</td>
                         <td><a href="{{EF::getFile($rows->form)}}">View Document</a></td>
                        <td><button class = "btn btn-primary btn-sm" onclick="uploadImage(event,'{{Crypt::encrypt($rows->id)}}')">Upload Document</button></td>

                      </tr>
                     @endforeach
                      @endif      
                      </tbody>
                    </table>
                  </div>
                </div>
              </div>
          </div>
@endsection

@section('page_modal')
  @include('user.modals.asset_form')



@endsection

@section('page_script')
  <script type="text/javascript">

    function uploadImage(event,employee_asset)
    {
       $('input[name = employee_asset').val(employee_asset);

       $('#md_asset_form').modal('show');
    }
  </script>
@endsection

  