File: /var/www/html/fieldsblaze-heroku/resources/views/admin/approved-leaves.blade.php
@extends('admin.include.master')
@section('content')
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>Approved Leaves</h1>
</div>
<div class="col-sm-6 text-right">
<button type="button" class="btn btn-sm btn-outline-info mx-1" data-toggle="modal" data-target="#addLeaveApplication">Add New</button>
</div>
</div>
</div><!-- /.container-fluid -->
</section>
<!-- Main content -->
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<a href="{{ ('all-leaves') }}" class="btn btn-default btn-sm card-title px-2 mx-1">All <span class="badge badge-info">{{ $AllLeave->count()}}</span></a>
<a href="{{ ('approved-leaves') }}" class="btn btn-info btn-sm card-title px-2 mx-1">Approved <span class="badge badge-light">{{ $ApprovedLeave->count()}}</span></a>
<a href="{{ ('rejected-leaves') }}" class="btn btn-default btn-sm card-title px-2 mx-1">Rejected <span class="badge badge-info">{{ $RejectedLeave->count()}}</span></a>
<a href="{{ ('trash-leaves') }}" class="btn btn-default btn-sm card-title px-2 mx-1">Deleted <span class="badge badge-info">{{ $TrashLeave->count()}}</span></a>
<div class="text-right">
{{-- <p id="selectTriggerFilter"><label><b>Select User:</b></label> </p> --}}
</div>
</div>
<!-- /.card-header -->
<div class="card-body">
<table id="attendanceTable" class="table-sm table table-bordered table-striped">
<thead>
<tr>
<th>S.N.</th>
<th>Application No</th>
<th>User Name</th>
<th>Leave Type</th>
<th>Start Date</th>
<th>End Date</th>
<th>No. of day(s)</th>
<th>Status</th>
<th>Created at</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@foreach ($ApprovedLeave as $leave)
<tr>
<td>{{ $loop->iteration }}</td>
<td><a href="{{ url('view-leave', $leave->LeaveId) }}">{{ $leave->ApplicationNo }}</a></td>
<td>{{ $leave->FirstName }} @if ($leave->LastName) {{ $leave->LastName }} @endif</td>
<td>{{ $leave->LeaveType }}</td>
<td>{{ date('d-M-y', strtotime($leave->StartDate)) }}</td>
<td>{{ date('d-M-y', strtotime($leave->EndDate)) }}</td>
<td>{{ $leave->TotalLeave }}</td>
<td>
@if ($leave->LeaveStatus == '0')
<span class="badge badge-warning">Submitted</span>
@elseif($leave->LeaveStatus == '1')
<span class="badge badge-success">Approved</span>
@elseif($leave->LeaveStatus == '2')
<span class="badge badge-danger">Rejected</span>
@endif
<td>
@if ($leave->Created_by)
{{ $leave->Created_by }}
@else
{{ $leave->FirstName }}
@endif,
{{ date('d-M-y h:i:s a', strtotime($leave->Created_at)) }}</td>
<td>
<div class="btn-group">
<button type="button" class="btn btn-default btn-sm dropdown-toggle dropdown-icon" data-toggle="dropdown" aria-expanded="false">
</button>
<div class="dropdown-menu dropdown-menu-right" role="menu">
<a type="submit" class="dropdown-item btn btn-default" href="{{ url('view-leave', $leave->LeaveId) }}">View</a>
@if ($leave->LeaveStatus=='0')
<button type="button" class="dropdown-item btn btn-default" data-id="{{ $leave->LeaveId }}" onclick="editRecord('{{ $leave->LeaveId }}')">Edit</button>
<button type="button" class="dropdown-item btn btn-default" data-id="{{ $leave->LeaveId }}" onClick="approveLeave('{{ $leave->LeaveId }}');">Approve</button>
<button type="button" class="dropdown-item btn btn-default" data-id="{{ $leave->LeaveId }}" onClick="rejectLeave('{{ $leave->LeaveId }}');">Reject</button>
<button type="button" class="dropdown-item btn btn-default" data-id="{{ $leave->LeaveId }}" onClick="deleteLeave('{{ $leave->LeaveId }}');">Delete</button>
@endif
</div>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</div>
<!-- /.container-fluid -->
</section>
<!-- /.content -->
</div>
{{-- Modal Component --}}
<x-LeaveModal/>
<!-- /.content-wrapper -->
@endsection