@extends('layouts.dashboard')

@section('page_title')
 Allowances
@endsection

@section('page_header_title')
HR
@endsection



@section('page_body')
{{ Breadcrumbs::render('allowance') }}
	<div class="row row-cards row-deck">
  <div class="col-12">
                <div class="card">
                	  <div class="card-header">		    

      @if(Auth::user()->hasAnyPermission(['All',' Assign Allowance']))
					     <button  class="float-right btn btn-sm btn-outline-primary" data-toggle="modal" data-target="#md_add_assign_allowance"><i class="fa fa-tasks"></i></button> &nbsp;&nbsp;
               @endif

					     <h3 class="card-title">Assign Allowance</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>Scale</th>
                          <th>Designation</th>
                          <th>Allowance Type</th>
                          <th>Allowance Title</th>
                           <th style="text-align: center;"><i class="dropdown-icon fa fa-cogs"></i></th>
                         
                          
                        </tr>
                      </thead>
                      <tbody>
                      	@isset($assign_allowance_list)
                          @php($pass_data = [])
                      		@foreach($assign_allowance_list as $rows)

 @php(
        $pass_data = array(
        'id'                        => Crypt::encrypt($rows->id),
        'scale'                     => $rows->scale->title,
        'designation'               => $rows->designation->title,
        'allowance'                 => $rows->allowance->title,
                        )
                        )
                      			<tr>
                      				<td>{{$loop->iteration}}</td>

                      				<td>@if(isset($rows->scale->id)) {{$rows->scale->title}} @else N/A @endif</td>

                      				<td>@if(isset($rows->designation->id)) {{$rows->designation->title}} @else N/A @endif</td>

                              <td>{{$rows->allowance->type}}</td>

                               <td>{{$rows->allowance->title}}</td>
                                <td>
                                  <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">
                                     
                                     

                                  @if(Auth::user()->hasAnyPermission(['All','Update Assign Allowance']))
                                      <a onclick="update(event,'{{json_encode($pass_data)}}','form_update_assign_allowance','md_update_assign_allowance')" href="javascript:void(0)" class="dropdown-item"><i class="dropdown-icon fa fa-edit"></i> Update </a>
                                      @endif
                         <div class="dropdown-divider"></div>
      @if(Auth::user()->hasAnyPermission(['All',' Assign Contract']))
                 <a onclick="assignToContract(event,'{{Crypt::encrypt($rows->id)}}')" href="javascript:void(0)" class="dropdown-item"><i class="dropdown-icon fa fa-tasks"></i> Assign To Contract</a>
                                      @endif
                                     
                                     
                                     
                                    </div>
                                  </div>
                               </td>

                      			</tr>

                      		@endforeach
                      	@endisset	
                        
                      </tbody>
                    </table>
                  </div>
                </div>
              </div>
          </div>

@endsection

@section('page_modal')

  @include('hr.assign_allowance.modals.add_assign_allowance')
   @include('hr.assign_allowance.modals.update_assign_allowance')
   @include('hr.assign_allowance.modals.allot_contract')

@endsection

@section('page_script')
   @include('hr.scripts.contract') 
@endsection
