@extends('layouts.dashboard')

@section('page_title')
	Project
@endsection

@section('page_header_title')
	Manage {{ucwords(str_replace('_',' ',$branch_labels['module']))}}
@endsection



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

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


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

					     <h3 class="card-title">Add {{ucwords(str_replace('_',' ',$branch_labels['module']))}}</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>{{ucwords(str_replace('_',' ',$branch_labels['name']))}}</th>
                          <th>{{ucwords(str_replace('_',' ',$branch_labels['code']))}}</th>
                          <th>{{ucwords(str_replace('_',' ',$branch_labels['location']))}}</th>

                            <th>{{ucwords(str_replace('_',' ',$branch_labels['city']))}}</th>

                          {{--<th>{{ucwords(str_replace('_',' ',$branch_labels['email']))}}</th>
                          <th>{{ucwords(str_replace('_',' ',$branch_labels['contact']))}}</th>
                          <th>{{ucwords(str_replace('_',' ',$branch_labels['commission']))}}</th>--}}

                          <th>Duration</th>
                          <th style="text-align: center;"><i class="dropdown-icon fa fa-cogs"></i></th>
                          
                        </tr>
                      </thead>
                      <tbody>
                      	@isset($branch_list)
                          @php($pass_data = [])
                      		@foreach($branch_list as $rows)

                        
                            @php(
                              $pass_data = array(
                                  $branch_labels['branch']      => Crypt::encrypt($rows->id),
                                  $branch_labels['name']        => $rows->name,
                                  $branch_labels['code']        => $rows->code,
                                  $branch_labels['location']    => $rows->location,
                                  $branch_labels['start_date']  => EF::dateHtml($rows->start_date),
                                  $branch_labels['end_date']    => EF::dateHtml($rows->end_date),
                                  $branch_labels['city']        => $rows->city,


                                {{--
                                    $branch_labels['email']       => $rows->email,
                                    $branch_labels['contact']     => $rows->contact,
                                    $branch_labels['commission']  => $rows->commission,
                                --}}
                                )
                            )
                      			<tr>
                      				<td>{{$loop->iteration}}</td>

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

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

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

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


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

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

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

                      				<td>
                                {{EF::dateFormat($rows->start_date)}} -  {{EF::dateFormat($rows->end_date)}}
                              </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">
			                            

                    @if(Auth::user()->hasAnyPermission(['All','Update Branch']))
			                                <a onclick="update(event,'{{json_encode($pass_data)}}','form_update_branch','md_update_branch')" href="javascript:void(0)" class="dropdown-item"><i class="dropdown-icon fa fa-edit"></i> Update </a>
                                      @endif
			                               
			                               
			                               
			                              </div>
			                            </div>
			                         </td>
                      			</tr>

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

@section('page_modal')
	@include('branch.modals.add_branch')
  @include('branch.modals.update_branch')
@endsection

@section('page_script')
	
@endsection

  