You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

217 lines
11 KiB

@extends('layouts.admin.app')
@section('title',translate('Employee List'))
@push('css_or_js')
@endpush
@section('content')
<div class="content container-fluid">
<!-- Page Heading -->
<div class="page-header">
<h1 class="page-header-title mb-2 text-capitalize">
<div class="card-header-icon d-inline-flex mr-2 img">
<img src="{{asset('/public/assets/admin/img/employee-list.png')}}" alt="public">
</div>
<span>
{{translate('messages.Employee')}} {{translate('messages.list')}}
</span>
</h1>
</div>
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header py-2">
<div class="search--button-wrapper justify-content-end">
<form action="javascript:" id="search-form" class="search-form">
@csrf
<!-- Search -->
<div class="input--group input-group input-group-merge input-group-flush">
<input id="datatableSearch_" type="search" name="search" class="form-control" placeholder="{{ translate('Search by name or email') }}" aria-label="Search">
<button type="submit" class="btn btn--secondary">
<i class="tio-search"></i>
</button>
</div>
<!-- End Search -->
</form>
<!-- Unfold -->
<div class="hs-unfold">
<a class="js-hs-unfold-invoker btn btn-sm btn-white dropdown-toggle btn export-btn export--btn btn-outline-primary btn--primary font--sm" href="javascript:;"
data-hs-unfold-options='{
"target": "#usersExportDropdown",
"type": "css-animation"
}'>
<i class="tio-download-to mr-1"></i> {{translate('messages.export')}}
</a>
<div id="usersExportDropdown"
class="hs-unfold-content dropdown-unfold dropdown-menu dropdown-menu-sm-right">
{{--<span class="dropdown-header">{{translate('messages.options')}}</span>
<a id="export-copy" class="dropdown-item" href="javascript:;">
<img class="avatar avatar-xss avatar-4by3 mr-2"
src="{{asset('public/assets/admin')}}/svg/illustrations/copy.svg"
alt="Image Description">
{{translate('messages.copy')}}
</a>
<a id="export-print" class="dropdown-item" href="javascript:;">
<img class="avatar avatar-xss avatar-4by3 mr-2"
src="{{asset('public/assets/admin')}}/svg/illustrations/print.svg"
alt="Image Description">
{{translate('messages.print')}}
</a>
<div class="dropdown-divider"></div>--}}
<span class="dropdown-header">{{translate('messages.download')}} {{translate('messages.options')}}</span>
<a id="export-excel" class="dropdown-item" href="{{route('admin.employee.export-employee', ['type'=>'excel'])}}">
<img class="avatar avatar-xss avatar-4by3 mr-2"
src="{{asset('public/assets/admin')}}/svg/components/excel.svg"
alt="Image Description">
{{translate('messages.excel')}}
</a>
<a id="export-csv" class="dropdown-item" href="{{route('admin.employee.export-employee', ['type'=>'csv'])}}">
<img class="avatar avatar-xss avatar-4by3 mr-2"
src="{{asset('public/assets/admin')}}/svg/components/placeholder-csv-format.svg"
alt="Image Description">
.{{translate('messages.csv')}}
</a>
{{--<a id="export-pdf" class="dropdown-item" href="javascript:;">
<img class="avatar avatar-xss avatar-4by3 mr-2"
src="{{asset('public/assets/admin')}}/svg/components/pdf.svg"
alt="Image Description">
{{translate('messages.pdf')}}
</a>--}}
</div>
</div>
<!-- End Unfold -->
<!-- Unfold -->
{{-- <div class="hs-unfold">
<a class="js-hs-unfold-invoker btn btn-sm btn-white" href="javascript:;">
<i class="tio-filter-list mr-1"></i> Filters <span class="badge badge-success badge-pill ml-1" id="filter_count"></span>
</a>
</div> --}}
<!-- End Unfold -->
</div>
</div>
<div class="card-body p-0">
<div class="table-responsive">
<table id="datatable"
class="table table-hover table-borderless table-thead-bordered table-nowrap table-align-middle card-table"
data-hs-datatables-options='{
"order": [],
"orderCellsTop": true,
"paging":false
}'>
<thead class="thead-light">
<tr>
<th>{{ translate('messages.sl') }}</th>
<th>{{translate('Employee Name')}}</th>
<th>{{translate('messages.phone')}}</th>
<th>{{translate('messages.email')}}</th>
<th>
<div class="pl-2">
{{ translate('Created At') }}
</div>
</th>
<th class="text-center w-120px">{{translate('messages.action')}}</th>
</tr>
</thead>
<tbody id="set-rows">
@foreach($em as $k=>$e)
<tr>
<th scope="row">{{$k+$em->firstItem()}}</th>
<td class="text-capitalize">{{$e['f_name']}} {{$e['l_name']}}</td>
<td>{{$e['phone']}}</td>
<td >
{{$e['email']}}
</td>
<td>
{{$e['created_at']->format('d M, Y')}}
</td>
<td>
@if (auth('admin')->id() != $e['id'])
<div class="btn--container">
<a class="btn btn-sm btn--primary btn-outline-primary action-btn"
href="{{route('admin.employee.edit',[$e['id']])}}" title="{{translate('messages.edit')}} {{translate('messages.Employee')}}"><i class="tio-edit"></i>
</a>
<a class="btn btn-sm btn--danger btn-outline-danger action-btn" href="javascript:"
onclick="form_alert('employee-{{$e['id']}}','{{translate('messages.Want_to_delete_this_role')}}')" title="{{translate('messages.delete')}} {{translate('messages.Employee')}}"><i class="tio-delete-outlined"></i>
</a>
</div>
<form action="{{route('admin.employee.delete',[$e['id']])}}"
method="post" id="employee-{{$e['id']}}">
@csrf @method('delete')
</form>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
@if(count($em) === 0)
<div class="empty--data">
<img src="{{asset('/public/assets/admin/img/empty.png')}}" alt="public">
<h5>
{{translate('no_data_found')}}
</h5>
</div>
@endif
</div>
</div>
<div class="card-footer pt-0 border-0">
<div class="page-area px-4 pb-3">
<div class="d-flex align-items-center justify-content-end">
{{-- {{-- <div>
1-15 of 380
</div> --}}
<div>
{!! $em->links() !!}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
@push('script_2')
<script>
// Call the dataTables jQuery plugin
$(document).ready(function () {
$('#dataTable').DataTable();
});
$('#search-form').on('submit', function (e) {
e.preventDefault();
var formData = new FormData(this);
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$.post({
url: '{{route('admin.employee.search')}}',
data: formData,
cache: false,
contentType: false,
processData: false,
beforeSend: function () {
$('#loading').show();
},
success: function (data) {
$('#set-rows').html(data.view);
$('#itemCount').html(data.count);
$('.page-area').hide();
},
complete: function () {
$('#loading').hide();
},
});
});
</script>
@endpush