@extends('template.layouts.template-base') @section('title') Leave Management | {{ config('setting.website_name') ?: config('app.name') }} @endsection @section('content')

Leave Management

@php // Fresh page load defaults: current month with its first and last dates $searched = request()->filled('staff_type'); $defaultYear = $searched ? request('year') : now()->year; $defaultFromMonth = $searched ? request('from_month') : now()->month; $defaultToMonth = $searched ? request('to_month') : now()->month; $defaultFrom = $searched ? request('from_date') : now()->startOfMonth()->toDateString(); $defaultTo = $searched ? request('to_date') : now()->endOfMonth()->toDateString(); $staffType = request('staff_type', 'Client'); @endphp
@error('staff_type')
{{ $message }}
@enderror
@error('projects')
{{ $message }}
@enderror
@error('clients')
{{ $message }}
@enderror
@error('from_date')
{{ $message }}
@enderror
@error('to_date')
{{ $message }}
@enderror
{{-- Type a Staff ID manually or pick one of the chosen client's / project's staff --}} @error('staff_id')
{{ $message }}
@enderror
@if(isset($staffList))
Dates: {{ date('d-m-Y', strtotime($fromDate)) . ' / ' . date('d-m-Y', strtotime($toDate)) }}
@if(isset($selected_client) && $selected_client)
Client: {{ $selected_client->company_name }}
@endif @if(isset($selected_project) && $selected_project)
Project: {{ $selected_project->project_name }}
@endif @if($staffList->isNotEmpty())
{{-- Same filters as the search, carried over in the query string --}} Export
@endif
@if($staffList->isEmpty())
No staff records match the selected filters.
@else
@foreach($staffList as $index => $staff) @endforeach
S.No {{ $type === 'Project' ? 'Project' : 'Client' }} Staff ID Staff Name Absent Week Off Loss of Pay (LOP) Casual Leave (CL)
{{ $index + 1 }} {{ $type === 'Project' ? ($staff->project?->project_name ?: '-') : ($staff->client?->company_name ?: '-') }} {{ $staff->staff_id }} {{ $staff->staff_name }} {{ $staff->absent_days }} {{ $staff->weekoff_days }} {{ $staff->lop_days }} {{ $staff->cl_days }}
@endif @endif @section('scripts') @endsection @endsection