212 lines
8.7 KiB
PHP
212 lines
8.7 KiB
PHP
|
@extends('layouts.app')
|
||
|
|
||
|
@section('content')
|
||
|
<div class="page-content">
|
||
|
<div class="container-fluid">
|
||
|
<div class="card">
|
||
|
<div class="card-body text-align-center">
|
||
|
<form action="{{ route('leave.index') }}" method="GET">
|
||
|
<div class="row g-2">
|
||
|
<div class="col-xl-3">
|
||
|
<div class="search-box">
|
||
|
{{ html()->select('employee_id', $employeeList)->class('form-control select2')->value(request('employee_id'))->placeholder('By Employee') }}
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="col-sm-3">
|
||
|
<div class="">
|
||
|
{{ html()->text('date')->class('form-control')->value(request('date'))->placeholder('Date Range')->attributes([
|
||
|
'id' => 'datepicker-range',
|
||
|
'data-provider' => 'flatpickr',
|
||
|
'data-date-format' => 'Y-m-d',
|
||
|
'data-range-date' => 'true',
|
||
|
]) }}
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="col-xl-3">
|
||
|
<div class="search-box">
|
||
|
{{ html()->select('status', $status)->class('form-control select2')->value(request('status'))->placeholder('By Status') }}
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
</div>
|
||
|
<div class="g-2 text-end">
|
||
|
<div>
|
||
|
<button type="submit" class="btn btn-primary">Filter</button>
|
||
|
<a href="{{ route('leave.index') }}" class="btn btn-danger">Reset</a>
|
||
|
</div>
|
||
|
</div>
|
||
|
</form>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="row">
|
||
|
<div class="col-lg-12">
|
||
|
<div class="card">
|
||
|
<div class="card-header align-items-center d-flex">
|
||
|
<h5 class="card-title flex-grow-1 mb-0">Leave Lists</h5>
|
||
|
<div class="flex-shrink-0">
|
||
|
<a href="{{ route('leave.create') }}" class="btn btn-success waves-effect waves-light"><i
|
||
|
class="ri-add-fill me-1 align-bottom"></i> Apply Leave</a>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="card-body">
|
||
|
<div class="table-responsive">
|
||
|
<table id="buttons-datatables" class="display table-sm table-bordered table" style="width:100%">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>S.N</th>
|
||
|
<th>Employee Name</th>
|
||
|
<th>Leave Type</th>
|
||
|
<th>Start Date</th>
|
||
|
<th>End Date</th>
|
||
|
<th>Status</th>
|
||
|
<th>Action</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
@forelse ($leaves as $key => $leave)
|
||
|
<tr>
|
||
|
<td>{{ $key + 1 }}</td>
|
||
|
<td>{{ optional($leave->employee)->full_name }}</td>
|
||
|
<td>
|
||
|
<div class="d-flex align-items-center">
|
||
|
<div class="">
|
||
|
<h5 class="fs-12 fw-medium my-1">
|
||
|
{{ optional($leave->leaveType)->name }}
|
||
|
</h5>
|
||
|
<span class="fs-10 text-danger text-bold">{{ $leave->getDuration() }}</span>
|
||
|
</div>
|
||
|
</div>
|
||
|
</td>
|
||
|
<td>{{ $leave->start_date }}</td>
|
||
|
<td>{{ $leave->end_date }}</td>
|
||
|
<td>
|
||
|
<span class="badge bg-{{ $leave->status_name['color'] }}">
|
||
|
{!! $leave->status_name['status'] !!} </span>
|
||
|
</td>
|
||
|
<td>
|
||
|
<div class="hstack flex-wrap gap-3">
|
||
|
{{-- <a href="javascript:void(0);" class="link-info fs-15 view-item-btn" data-bs-toggle="modal"
|
||
|
data-bs-target="#viewModal">
|
||
|
<i class="ri-eye-line"></i>
|
||
|
</a> --}}
|
||
|
@can('leave.show')
|
||
|
<a href="{{ route('leave.show', $leave->leave_id) }}" class="link-info fs-15">
|
||
|
<i class="ri-eye-line"></i>
|
||
|
</a>
|
||
|
@endcan
|
||
|
@can('leave.edit')
|
||
|
<a href="{{ route('leave.edit', $leave->leave_id) }}"
|
||
|
class="link-success fs-15 edit-item-btn"><i class="ri-edit-2-line"></i></a>
|
||
|
@endcan
|
||
|
@can('leave.updateStatus')
|
||
|
<a href="javascript:void(0);" class="link-dark fs-15 approve-item-btn" data-bs-toggle="modal"
|
||
|
data-bs-target="#statusModal" data-leave-id="{{ $leave->leave_id }}"
|
||
|
data-employee-id="{{ $leave->employee_id }}">
|
||
|
<i class="ri-check-double-line"></i>
|
||
|
</a>
|
||
|
@endcan
|
||
|
@can('leave.destroy')
|
||
|
<a href="javascript:void(0);" data-link="{{ route('leave.destroy', $leave->leave_id) }}"
|
||
|
data-id="{{ $leave->leave_id }}" class="link-danger fs-15 remove-item-btn"><i
|
||
|
class="ri-delete-bin-line"></i></a>
|
||
|
@endcan
|
||
|
</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
@empty
|
||
|
<tr>
|
||
|
<td colspan="7" class="text-center"> No Leave Found</td>
|
||
|
</tr>
|
||
|
@endforelse
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<!--end row-->
|
||
|
</div>
|
||
|
</div>
|
||
|
<!-- container-fluid -->
|
||
|
@can('leave.updateStatus')
|
||
|
<div class="modal fade" id="statusModal" tabindex="-1" aria-labelledby="statusModalLabel" aria-modal="true">
|
||
|
<div class="modal-dialog">
|
||
|
<div class="modal-content">
|
||
|
<div class="modal-header">
|
||
|
<h5 class="modal-title" id="exampleModalgridLabel">Update Status</h5>
|
||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||
|
</div>
|
||
|
<div class="modal-body">
|
||
|
<form action="{{ route('leave.updateStatus') }}" id="statusForm" class="needs-validation" novalidate
|
||
|
method="post">
|
||
|
@csrf
|
||
|
<input type="hidden" id="leave_id" name="leave_id" value="">
|
||
|
<input type="hidden" id="employeeId" name="employee_id" value="">
|
||
|
<div class="row g-2">
|
||
|
<div class="col-md-12">
|
||
|
{{ html()->label('Status')->class('form-label') }}
|
||
|
{{ html()->select('status', $status)->class('form-select select2')->placeholder('Select Status')->required() }}
|
||
|
{{ html()->div('Please Select Status')->class('invalid-feedback') }}
|
||
|
</div>
|
||
|
|
||
|
<div class="col-md-12">
|
||
|
{{ html()->label('Remark')->class('form-label') }}
|
||
|
{{ html()->textarea('remarks')->class('form-control')->placeholder('Write remarks...') }}
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
<div class="mt-3 text-end">
|
||
|
{{ html()->button('Save')->class('btn btn-info') }}
|
||
|
</div>
|
||
|
</form>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
@endcan
|
||
|
@endsection
|
||
|
|
||
|
@push('js')
|
||
|
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||
|
|
||
|
<script>
|
||
|
// $(document).ready(function(){
|
||
|
// $('#statusForm').on('submit',function(e){
|
||
|
// e.preventDefault();
|
||
|
// var formData = $(this).serialize();
|
||
|
|
||
|
// $.ajax({
|
||
|
// url:'{{ route('leave.updateStatus') }}',
|
||
|
// type: 'POST',
|
||
|
// // headers: {
|
||
|
// // 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||
|
// // }
|
||
|
// data: formData,
|
||
|
// success: function(response){
|
||
|
// console.log(response);
|
||
|
// location.reload();
|
||
|
// },
|
||
|
// error: function(xhr, status, error){
|
||
|
// console.error(error)
|
||
|
// }
|
||
|
// });
|
||
|
// });
|
||
|
// });
|
||
|
$(document).ready(function() {
|
||
|
$('.approve-item-btn').on('click', function() {
|
||
|
let leaveId = $(this).data('leave-id');
|
||
|
$('#leave_id').val(leaveId);
|
||
|
let employeeId = $(this).data('employee-id');
|
||
|
$('#employeeId').val(employeeId);
|
||
|
})
|
||
|
})
|
||
|
</script>
|
||
|
@endpush
|