Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mileage-claim
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
trainee
mileage-claim
Commits
aa2c0374
Commit
aa2c0374
authored
Nov 07, 2025
by
Hannah Zahra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Final Update
parent
a3cb80f0
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
430 additions
and
88 deletions
+430
-88
packages/portal/mileage/resources/views/BOD/show.blade.php
+153
-0
packages/portal/mileage/resources/views/HOD/index.blade.php
+1
-1
packages/portal/mileage/resources/views/HOD/show.blade.php
+153
-0
packages/portal/mileage/resources/views/application/show.blade.php
+1
-1
packages/portal/mileage/resources/views/applyform/index.blade.php
+19
-0
packages/portal/mileage/resources/views/applyform/noproject.blade.php
+18
-0
packages/portal/mileage/resources/views/projectDirector/show.blade.php
+85
-86
No files found.
packages/portal/mileage/resources/views/BOD/show.blade.php
View file @
aa2c0374
<title>
Maklumat Tuntutan
</title>
@extends('ui::layouts.app')
@section('content')
<style>
body
{
background-color
:
#f0f2f5
;
}
.ui.container
{
max-width
:
70%
!important
;
margin-top
:
2rem
;
}
.ui.segment
{
box-shadow
:
0
4px
6px
rgba
(
0
,
0
,
0
,
0.1
);
border-radius
:
10px
;
background-color
:
#fff
;
padding
:
2rem
;
}
table
.ui.definition.table
td
:first-child
{
width
:
40%
;
font-weight
:
600
;
background-color
:
#f9fafb
;
}
.totals-row
td
{
font-weight
:
700
;
background
:
#f7f7f8
;
}
.small-muted
{
font-size
:
.9rem
;
color
:
#666
;
}
</style>
<div
class=
"ui container"
>
<h2
class=
"ui header"
>
Maklumat Tuntutan
</h2>
<div
class=
"ui segment"
>
<table
class=
"ui definition table"
>
<tr>
<td>
Tarikh Tuntutan
</td>
<td>
{{ \Carbon\Carbon::parse($claim->claim_date)->format('d/m/Y') }}
</td>
</tr>
<tr>
<td>
Jenis Kenderaan
</td>
<td>
{{ $claim->jenisKenderaan->keterangan ?? $claim->jenisKenderaan->name ?? '-' }}
</td>
</tr>
<tr>
<td>
Nama Projek
</td>
<td>
{{ $claim->project->p_project_description ?? 'Tanpa Projek' }}
</td>
</tr>
<tr>
<td>
Butiran Tuntutan
</td>
<td>
{{ $claim->description ?? '-' }}
</td>
</tr>
<tr>
<td>
Jarak Dari
</td>
<td>
{{ $claim->distance_from ?? '-' }}
</td>
</tr>
<tr>
<td>
Jarak Ke
</td>
<td>
{{ $claim->distance_to ?? '-' }}
</td>
</tr>
<tr>
<td>
Jumlah Perbatuan (KM)
</td>
<td>
{{ number_format($claim->total_mileage ?? 0, 2) }} km
</td>
</tr>
{{-- Claimable mileage (deduct 40km rule) --}}
<tr>
<td>
Jumlah Perbatuan Layak Dituntut
</td>
<td>
@php
$totalMileage = floatval($claim->total_mileage ?? 0);
$claimable = $claim->claimable_mileage ?? max(0, $totalMileage - 40);
@endphp
{{ number_format($claimable, 2) }} km
</td>
</tr>
{{-- Show per-km rate and mileage multiplication --}}
<tr>
<td>
Kiraan (Perbatuan × Kadar)
</td>
<td>
@php
// Determine rate by vehicle
$jenisId = $claim->jenis_kenderaan_id ?? ($claim->jenisKenderaan->id ?? null);
if ($jenisId == 1) {
$rate = ($claimable
<
=
500
)
?
0
.
55
:
0
.
50
;
//
Car
}
else
{
$
rate =
0.30;
//
Motorcycle
}
$
mileageAmount =
round($claimable
*
$
rate
,
2
);
@
endphp
<
span
class=
"small-muted"
>
{{ number_format($claimable, 2) }} km × RM {{ number_format($rate, 2) }}
</span>
=
<strong>
RM {{ number_format($mileageAmount, 2) }}
</strong>
</td>
</tr>
{{-- Toll amount --}}
<tr>
<td>
Tol (RM)
</td>
<td>
RM {{ number_format(floatval($claim->toll_amount ?? 0), 2) }}
</td>
</tr>
{{-- Others amount --}}
<tr>
<td>
Lain-lain (RM)
</td>
<td>
RM {{ number_format(floatval($claim->others_amount ?? 0), 2) }}
</td>
</tr>
{{-- Butiran Lain-lain (always shown) --}}
<tr>
<td>
Butiran Lain-lain
</td>
<td>
{{ $claim->others_description ?: 'Tiada Nilai Lain-lain' }}
</td>
</tr>
{{-- Subtotal: mileageAmount + toll + others --}}
<tr>
<td>
Jumlah Tuntutan (Perjalanan + Tol + Lain-lain)
</td>
<td>
@php
$toll = floatval($claim->toll_amount ?? 0);
$others = floatval($claim->others_amount ?? 0);
$subtotal = round($mileageAmount + $toll + $others, 2);
@endphp
RM {{ number_format($subtotal, 2) }}
</td>
</tr>
<tr
class=
"totals-row"
>
<td>
Jumlah Akhir (RM)
</td>
<td>
@php
$final = $claim->total_claim_amount ?? round($subtotal - ($displayPenalty ?? 0), 2);
@endphp
<strong>
RM {{ number_format(floatval($final), 2) }}
</strong>
</td>
</tr>
</table>
</div>
<a
href=
"{{ route('mileage::BOD.index') }}"
class=
"ui button"
>
<i
class=
"arrow left icon"
></i>
Kembali
</a>
</div>
@endsection
packages/portal/mileage/resources/views/HOD/index.blade.php
View file @
aa2c0374
...
@@ -97,7 +97,7 @@
...
@@ -97,7 +97,7 @@
<td>
{{ $claim->claim_date }}
</td>
<td>
{{ $claim->claim_date }}
</td>
<td>
{{ $claim->description ?? '-' }}
</td>
<td>
{{ $claim->description ?? '-' }}
</td>
<td>
{{ max(0, $claim->total_mileage - 40) }} km
</td>
<td>
{{ max(0, $claim->total_mileage - 40) }} km
</td>
<td>
RM {{ number_format($claim->
calculated
_amount, 2) }}
</td>
<td>
RM {{ number_format($claim->
total_claim
_amount, 2) }}
</td>
<td>
{{ $claim->status }}
</td>
<td>
{{ $claim->status }}
</td>
<td
style =
"white-space: nowrap; width: 1%;"
>
<td
style =
"white-space: nowrap; width: 1%;"
>
<a
href=
"{{ route('mileage::HOD.show', $claim->id) }}"
class=
"ui blue button tiny"
>
<a
href=
"{{ route('mileage::HOD.show', $claim->id) }}"
class=
"ui blue button tiny"
>
...
...
packages/portal/mileage/resources/views/HOD/show.blade.php
View file @
aa2c0374
<title>
Maklumat Tuntutan
</title>
@extends('ui::layouts.app')
@section('content')
<style>
body
{
background-color
:
#f0f2f5
;
}
.ui.container
{
max-width
:
70%
!important
;
margin-top
:
2rem
;
}
.ui.segment
{
box-shadow
:
0
4px
6px
rgba
(
0
,
0
,
0
,
0.1
);
border-radius
:
10px
;
background-color
:
#fff
;
padding
:
2rem
;
}
table
.ui.definition.table
td
:first-child
{
width
:
40%
;
font-weight
:
600
;
background-color
:
#f9fafb
;
}
.totals-row
td
{
font-weight
:
700
;
background
:
#f7f7f8
;
}
.small-muted
{
font-size
:
.9rem
;
color
:
#666
;
}
</style>
<div
class=
"ui container"
>
<h2
class=
"ui header"
>
Maklumat Tuntutan
</h2>
<div
class=
"ui segment"
>
<table
class=
"ui definition table"
>
<tr>
<td>
Tarikh Tuntutan
</td>
<td>
{{ \Carbon\Carbon::parse($claim->claim_date)->format('d/m/Y') }}
</td>
</tr>
<tr>
<td>
Jenis Kenderaan
</td>
<td>
{{ $claim->jenisKenderaan->keterangan ?? $claim->jenisKenderaan->name ?? '-' }}
</td>
</tr>
<tr>
<td>
Nama Projek
</td>
<td>
{{ $claim->project->p_project_description ?? 'Tanpa Projek' }}
</td>
</tr>
<tr>
<td>
Butiran Tuntutan
</td>
<td>
{{ $claim->description ?? '-' }}
</td>
</tr>
<tr>
<td>
Jarak Dari
</td>
<td>
{{ $claim->distance_from ?? '-' }}
</td>
</tr>
<tr>
<td>
Jarak Ke
</td>
<td>
{{ $claim->distance_to ?? '-' }}
</td>
</tr>
<tr>
<td>
Jumlah Perbatuan (KM)
</td>
<td>
{{ number_format($claim->total_mileage ?? 0, 2) }} km
</td>
</tr>
{{-- Claimable mileage (deduct 40km rule) --}}
<tr>
<td>
Jumlah Perbatuan Layak Dituntut
</td>
<td>
@php
$totalMileage = floatval($claim->total_mileage ?? 0);
$claimable = $claim->claimable_mileage ?? max(0, $totalMileage - 40);
@endphp
{{ number_format($claimable, 2) }} km
</td>
</tr>
{{-- Show per-km rate and mileage multiplication --}}
<tr>
<td>
Kiraan (Perbatuan × Kadar)
</td>
<td>
@php
// Determine rate by vehicle
$jenisId = $claim->jenis_kenderaan_id ?? ($claim->jenisKenderaan->id ?? null);
if ($jenisId == 1) {
$rate = ($claimable
<
=
500
)
?
0
.
55
:
0
.
50
;
//
Car
}
else
{
$
rate =
0.30;
//
Motorcycle
}
$
mileageAmount =
round($claimable
*
$
rate
,
2
);
@
endphp
<
span
class=
"small-muted"
>
{{ number_format($claimable, 2) }} km × RM {{ number_format($rate, 2) }}
</span>
=
<strong>
RM {{ number_format($mileageAmount, 2) }}
</strong>
</td>
</tr>
{{-- Toll amount --}}
<tr>
<td>
Tol (RM)
</td>
<td>
RM {{ number_format(floatval($claim->toll_amount ?? 0), 2) }}
</td>
</tr>
{{-- Others amount --}}
<tr>
<td>
Lain-lain (RM)
</td>
<td>
RM {{ number_format(floatval($claim->others_amount ?? 0), 2) }}
</td>
</tr>
{{-- Butiran Lain-lain (always shown) --}}
<tr>
<td>
Butiran Lain-lain
</td>
<td>
{{ $claim->others_description ?: 'Tiada Nilai Lain-lain' }}
</td>
</tr>
{{-- Subtotal: mileageAmount + toll + others --}}
<tr>
<td>
Jumlah Tuntutan (Perjalanan + Tol + Lain-lain)
</td>
<td>
@php
$toll = floatval($claim->toll_amount ?? 0);
$others = floatval($claim->others_amount ?? 0);
$subtotal = round($mileageAmount + $toll + $others, 2);
@endphp
RM {{ number_format($subtotal, 2) }}
</td>
</tr>
<tr
class=
"totals-row"
>
<td>
Jumlah Akhir (RM)
</td>
<td>
@php
$final = $claim->total_claim_amount ?? round($subtotal - ($displayPenalty ?? 0), 2);
@endphp
<strong>
RM {{ number_format(floatval($final), 2) }}
</strong>
</td>
</tr>
</table>
</div>
<a
href=
"{{ route('mileage::HOD.index') }}"
class=
"ui button"
>
<i
class=
"arrow left icon"
></i>
Kembali
</a>
</div>
@endsection
packages/portal/mileage/resources/views/application/show.blade.php
View file @
aa2c0374
...
@@ -71,7 +71,7 @@
...
@@ -71,7 +71,7 @@
@foreach($claims as $c)
@foreach($claims as $c)
@php
@php
$total += $c->total_claim;
$total += $c->total_claim
_amount
;
$totalMileage += $c->total_mileage ?? 0;
$totalMileage += $c->total_mileage ?? 0;
$totalToll += $c->toll_amount ?? 0;
$totalToll += $c->toll_amount ?? 0;
$totalOthers += $c->others_amount ?? 0;
$totalOthers += $c->others_amount ?? 0;
...
...
packages/portal/mileage/resources/views/applyform/index.blade.php
View file @
aa2c0374
...
@@ -226,6 +226,25 @@
...
@@ -226,6 +226,25 @@
<script>
<script>
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
// Show / hide "Butiran Lain-lain" based on input
function
toggleOthersDescription
()
{
const
val
=
parseFloat
(
$
(
'#others_amount'
).
val
())
||
0
;
if
(
val
>
0
)
{
$
(
'#others_description_wrapper'
).
slideDown
();
$
(
'#others_description'
).
attr
(
'required'
,
true
);
}
else
{
$
(
'#others_description_wrapper'
).
slideUp
();
$
(
'#others_description'
).
removeAttr
(
'required'
).
val
(
''
);
}
}
// Run when user types
$
(
'#others_amount'
).
on
(
'input'
,
toggleOthersDescription
);
// Run on page load in case editing
toggleOthersDescription
();
// === Auto Calculation for Ringkasan Pengiraan ===
// === Auto Calculation for Ringkasan Pengiraan ===
function
updateSummary
()
{
function
updateSummary
()
{
const
totalMileage
=
parseFloat
(
$
(
'#total_mileage'
).
val
())
||
0
;
const
totalMileage
=
parseFloat
(
$
(
'#total_mileage'
).
val
())
||
0
;
...
...
packages/portal/mileage/resources/views/applyform/noproject.blade.php
View file @
aa2c0374
...
@@ -212,6 +212,24 @@
...
@@ -212,6 +212,24 @@
<script>
<script>
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
// Show / hide "Butiran Lain-lain" based on input
function
toggleOthersDescription
()
{
const
val
=
parseFloat
(
$
(
'#others_amount'
).
val
())
||
0
;
if
(
val
>
0
)
{
$
(
'#others_description_wrapper'
).
slideDown
();
$
(
'#others_description'
).
attr
(
'required'
,
true
);
}
else
{
$
(
'#others_description_wrapper'
).
slideUp
();
$
(
'#others_description'
).
removeAttr
(
'required'
).
val
(
''
);
}
}
// Run when user types
$
(
'#others_amount'
).
on
(
'input'
,
toggleOthersDescription
);
// Run on page load in case editing
toggleOthersDescription
();
// === Auto Calculation for Ringkasan Pengiraan ===
// === Auto Calculation for Ringkasan Pengiraan ===
function
updateSummary
()
{
function
updateSummary
()
{
...
...
packages/portal/mileage/resources/views/projectDirector/show.blade.php
View file @
aa2c0374
...
@@ -75,19 +75,17 @@
...
@@ -75,19 +75,17 @@
</style>
</style>
<div
class=
"ui container"
>
<div
class=
"ui container"
>
{{-- Header --}}
<h2
class=
"ui header"
>
{{ $user->name }}
</h2>
<h2
class=
"ui header"
>
{{ $user->name }}
</h2>
<p>
<p>
<strong>
Bulan:
</strong>
{{ \Carbon\Carbon::parse($month)->translatedFormat('F Y') }}
<br>
<strong>
Bulan:
</strong>
{{ \Carbon\Carbon::parse($month)->translatedFormat('F Y') }}
<br>
<strong>
Projek:
</strong>
{{ $project->p_project_description ?? $project->project_name ?? 'Tanpa Projek' }}
<strong>
Projek:
</strong>
{{ $project->p_project_description ?? $project->project_name ?? 'Tanpa Projek' }}
</p>
</p>
{{-- Back button --}}
<a
href=
"{{ route('mileage::projectDirector.index', ['month' => $month]) }}"
class=
"ui grey button"
>
<a
href=
"{{ route('mileage::projectDirector.index', ['month' => $month]) }}"
class=
"ui grey button"
>
<i
class=
"arrow left icon"
></i>
Kembali
<i
class=
"arrow left icon"
></i>
Kembali
</a>
</a>
{{-- Claims Table --}}
<table
class=
"ui celled table"
>
<table
class=
"ui celled table"
>
<thead>
<thead>
<tr>
<tr>
...
@@ -107,42 +105,33 @@
...
@@ -107,42 +105,33 @@
@php
@php
$total = 0;
$total = 0;
$totalMileage = 0;
$totalMileage = 0;
$totalToll = 0;
$totalOthers = 0;
@endphp
@endphp
@forelse($claims as $claim)
@forelse($claims as $claim)
@php
@php
$total += $claim->total_claim_amount;
$total += $claim->total_claim_amount;
$totalMileage += $claim->total_mileage;
$totalMileage += $claim->total_mileage;
$totalToll += $claim->toll_amount ?? 0;
$totalOthers += $claim->others_amount ?? 0;
@endphp
@endphp
<tr>
<tr>
<td>
{{ \Carbon\Carbon::parse($claim->claim_date)->format('d/m/Y') }}
</td>
<td>
{{ \Carbon\Carbon::parse($claim->claim_date)->format('d/m/Y') }}
</td>
<td>
{{ $claim->description ?? '-'
}}
</td>
<td>
{{ $claim->description
}}
</td>
<td>
{{ $claim->distance_from ?? '-'
}}
</td>
<td>
{{ $claim->distance_from
}}
</td>
<td>
{{ $claim->distance_to ?? '-'
}}
</td>
<td>
{{ $claim->distance_to
}}
</td>
<td>
{{ $claim->total_mileage }}
</td>
<td>
{{ $claim->total_mileage }}
</td>
<td>
{{ number_format($claim->toll_amount ?? 0, 2) }}
</td>
<td>
{{ number_format($claim->toll_amount ?? 0, 2) }}
</td>
<td>
{{ number_format($claim->others_amount ?? 0, 2) }}
</td>
<td>
{{ number_format($claim->others_amount ?? 0, 2) }}
</td>
<td>
<td><span
class=
"status-label status-{{ $claim->status }}"
>
{{ $claim->status }}
</span></td>
<span
class=
"status-label status-{{ $claim->status }}"
>
{{ $claim->status }}
</span>
</td>
<td>
{{ number_format($claim->total_claim_amount, 2) }}
</td>
<td>
{{ number_format($claim->total_claim_amount, 2) }}
</td>
<td>
<td>
@if($claim->status === 'Disokong')
@if($claim->status === 'Disokong')
<form
action=
"{{ route('mileage::projectDirector.approveClaim', $claim->id) }}"
method=
"POST"
style=
"display:inline;"
>
<form
action=
"{{ route('mileage::projectDirector.approveClaim', $claim->id) }}"
method=
"POST"
style=
"display:inline;"
>
@csrf
@csrf
<button
type=
"submit"
class=
"ui green tiny button"
>
<button
type=
"submit"
class=
"ui green tiny button"
><i
class=
"check icon"
></i>
Sahkan
</button>
<i
class=
"check icon"
></i>
Sahkan
</button>
</form>
</form>
<button
<button
class=
"ui red tiny button reject-single-btn"
type=
"button"
class=
"ui red tiny button reject-single-btn"
data-claim-id=
"{{ $claim->id }}"
data-claim-id=
"{{ $claim->id }}"
data-project=
"{{ $project->id }}"
data-project=
"{{ $project->id }}"
data-user=
"{{ $user->id }}"
data-user=
"{{ $user->id }}"
...
@@ -155,19 +144,18 @@
...
@@ -155,19 +144,18 @@
</td>
</td>
</tr>
</tr>
@if(!empty($claim->others_description))
@if($claim->others_amount > 0
&&
$claim->others_description)
<tr
style=
"background: #f9f9f9;"
>
<tr
style=
"background:#fafafa;"
>
<td
colspan=
"10"
>
<td
colspan=
"10"
><strong>
Butiran Lain-lain:
</strong>
{{ $claim->others_description }}
</td>
<strong>
Butiran Lain-lain:
</strong>
{{ $claim->others_description }}
</td>
</tr>
</tr>
@endif
@endif
@empty
@empty
<tr><td
colspan=
"10"
class=
"center aligned"
>
Tiada tuntutan untuk bulan ini
.
</td></tr>
<tr><td
colspan=
"10"
class=
"center aligned"
>
Tiada tuntutan
.
</td></tr>
@endforelse
@endforelse
</tbody>
</tbody>
@if($claims->count()
> 0
)
@if($claims->count())
<tfoot>
<tfoot>
<tr>
<tr>
<th
colspan=
"9"
class=
"right aligned"
>
Jumlah Keseluruhan
</th>
<th
colspan=
"9"
class=
"right aligned"
>
Jumlah Keseluruhan
</th>
...
@@ -177,66 +165,100 @@
...
@@ -177,66 +165,100 @@
@endif
@endif
</table>
</table>
{{-- Status
&
Bulk Approval Section --}}
@if($claims->count() > 0)
@php
@php
$uniqueStatuses = $claims->pluck('status')->unique();
$hasPending = $claims->where('status', 'Disokong')->count() > 0;
$hasPending = $claims->where('status', 'Disokong')->count() > 0;
@endphp
@endphp
@if($hasPending)
<div
class=
"summary-box"
>
<div
class=
"summary-box"
>
<div>
<div>
<strong>
Status Semasa:
</strong>
<strong>
Status Semasa:
</strong>
<span
class=
"status-label status-{{ $claims->first()->status }}"
>
<span
class=
"status-label status-{{ $claims->first()->status }}"
>
{{ $claims->pluck('status')->unique()->implode(', ') }}
</span>
{{ $uniqueStatuses->implode(', ') }}
</span>
</div>
</div>
@if($hasPending)
<div
class=
"approval-actions"
>
<div
class=
"approval-actions"
>
<form
action=
"{{ route('mileage::projectDirector.approveMonth') }}"
method=
"POST"
style=
"display:inline;
"
>
<form
action=
"{{ route('mileage::projectDirector.approveMonth') }}"
method=
"POST
"
>
@csrf
@csrf
<input
type=
"hidden"
name=
"project_id"
value=
"{{ $project->id }}"
>
<input
type=
"hidden"
name=
"project_id"
value=
"{{ $project->id }}"
>
<input
type=
"hidden"
name=
"user_id"
value=
"{{ $user->id }}"
>
<input
type=
"hidden"
name=
"user_id"
value=
"{{ $user->id }}"
>
<input
type=
"hidden"
name=
"month"
value=
"{{ $month }}"
>
<input
type=
"hidden"
name=
"month"
value=
"{{ $month }}"
>
<button
type=
"submit"
class=
"ui green button"
>
<button
type=
"submit"
class=
"ui green button"
><i
class=
"check icon"
></i>
Sahkan Semua
</button>
<i
class=
"check icon"
></i>
Sahkan Semua
</button>
</form>
</form>
<button
<button
class=
"ui red button reject-btn"
type=
"button"
class=
"ui red button reject-btn"
data-project=
"{{ $project->id }}"
data-project=
"{{ $project->id }}"
data-user=
"{{ $user->id }}"
data-user=
"{{ $user->id }}"
data-month=
"{{ $month }}"
>
data-month=
"{{ $month }}"
>
<i
class=
"times icon"
></i>
Tolak Semua
<i
class=
"times icon"
></i>
Tolak Semua
</button>
</button
>
</div
>
</div>
</div>
@endif
@endif
{{-- Calculation Summary Section --}}
@if($claims->count() > 0)
@php
$totalMileage = $claims->sum('total_mileage');
$totalClaimAmount = $claims->sum('total_claim_amount');
$totalToll = $claims->sum('toll_amount');
$totalOthers = $claims->sum('others_amount');
$latestClaim = $claims->sortByDesc('claim_date')->first();
$penaltyAmount = $latestClaim->penalty_amount ?? 0;
$penaltyReason = $latestClaim->penalty_reason ?? '-';
$vehicleType = strtolower($claims->first()->jenisKenderaan->name ?? 'kereta');
$uniqueDates = $claims->pluck('claim_date')->unique()->count();
$deduction = 40 * $uniqueDates;
$claimableDistance = max(0, $totalMileage - $deduction);
if ($vehicleType === 'motosikal' || $vehicleType === 'motorcycle') {
$rateNote = "Motosikal – RM0.30/km";
} else {
if ($claimableDistance
<
=
500
)
{
$
rateNote =
"Kereta – RM0.55/km (≤500km)"
;
}
else
{
$
firstPartKm =
500;
$
secondPartKm =
$claimableDistance
-
500
;
$
rateNote =
"Kereta – 500km × RM0.55 + "
.
number_format
($
secondPartKm
,
1
)
.
"
km
×
RM0
.
50
";
}
}
$
finalTotal =
$totalClaimAmount
-
$
penaltyAmount
;
@
endphp
<
div
class=
"ui segment"
>
<h4><i
class=
"calculator icon"
></i>
Ringkasan Pengiraan (Mengikut Rekod Sistem)
</h4>
<table
class=
"ui definition table"
>
<tbody>
<tr><td><strong>
Jumlah Jarak (Sebenar)
</strong></td><td>
{{ number_format($totalMileage, 1) }} KM
</td></tr>
<tr><td><strong>
Jumlah Hari Tuntutan
</strong></td><td>
{{ $uniqueDates }} hari
</td></tr>
<tr><td><strong>
Potongan 40KM/Hari
</strong></td><td>
40 × {{ $uniqueDates }} = {{ $deduction }} KM
</td></tr>
<tr><td><strong>
Jumlah Jarak Boleh Tuntut
</strong></td><td>
{{ number_format($claimableDistance, 1) }} KM
</td></tr>
<tr><td><strong>
Kadar Kiraan
</strong></td><td>
{{ $rateNote }}
</td></tr>
<tr><td><strong>
Jumlah Mileage (Dari Sistem)
</strong></td><td>
RM {{ number_format($totalClaimAmount, 2) }}
</td></tr>
<tr><td><strong>
Jumlah Tol
</strong></td><td>
RM {{ number_format($totalToll, 2) }}
</td></tr>
<tr><td><strong>
Jumlah Lain-lain
</strong></td><td>
RM {{ number_format($totalOthers, 2) }}
</td></tr>
<tr><td><strong>
Penalti
</strong></td><td>
RM {{ number_format($penaltyAmount, 2) }} ({{ $penaltyReason }})
</td></tr>
<tr><td><strong><span
style=
"color:#21ba45;"
>
Jumlah Akhir
</span></strong></td><td><strong>
RM {{ number_format($finalTotal, 2) }}
</strong></td></tr>
</tbody>
</table>
</div>
</div>
@endif
@endif
</div>
</div>
{{-- Reject Modal --}}
{{-- Reject
Reason
Modal --}}
<div
class=
"ui small modal"
id=
"rejectModal"
>
<div
class=
"ui small modal"
id=
"rejectModal"
>
<i
class=
"close icon"
></i>
<div
class=
"header"
>
Sebab Penolakan
</div>
<div
class=
"header"
>
Sebab Penolakan
</div>
<div
class=
"content"
>
<div
class=
"content"
>
<form
id=
"rejectForm"
method=
"POST"
action=
"{{ route('mileage::projectDirector.rejectMonth') }}"
>
<form
id=
"rejectForm"
method=
"POST"
>
@csrf
@csrf
<input
type=
"hidden"
name=
"project_id"
id=
"rejectProjectId"
>
<input
type=
"hidden"
name=
"project_id"
id=
"rejectProjectId"
>
<input
type=
"hidden"
name=
"user_id"
id=
"rejectUserId"
>
<input
type=
"hidden"
name=
"user_id"
id=
"rejectUserId"
>
<input
type=
"hidden"
name=
"month"
id=
"rejectMonth"
>
<input
type=
"hidden"
name=
"month"
id=
"rejectMonth"
>
<div
class=
"ui form"
>
<div
class=
"ui form"
>
<div
class=
"field required"
>
<div
class=
"field required"
>
<label>
Nyatakan sebab tuntutan ini ditolak:
</label>
<label>
Sebab:
</label>
<textarea
<textarea
name=
"reject_reason"
id=
"rejectReason"
rows=
"3"
required
></textarea>
name=
"reject_reason"
id=
"rejectReason"
rows=
"3"
placeholder=
"Contoh: Tuntutan tidak lengkap atau tiada resit sokongan"
required
></textarea>
</div>
</div>
</div>
</div>
</form>
</form>
...
@@ -249,44 +271,22 @@
...
@@ -249,44 +271,22 @@
<script
src=
"https://code.jquery.com/jquery-3.7.1.min.js"
></script>
<script
src=
"https://code.jquery.com/jquery-3.7.1.min.js"
></script>
<script>
<script>
$
(
document
).
ready
(
function
()
{
$
(
'.reject-single-btn'
).
click
(
function
(){
// Handle single claim rejection
$
(
'#rejectForm'
).
attr
(
'action'
,
"{{ route('mileage::projectDirector.rejectClaim', ':id') }}"
.
replace
(
':id'
,
$
(
this
).
data
(
'claim-id'
)));
$
(
'.reject-single-btn'
).
on
(
'click'
,
function
()
{
$
(
'#rejectProjectId'
).
val
(
$
(
this
).
data
(
'project'
));
const
claimId
=
$
(
this
).
data
(
'claim-id'
);
$
(
'#rejectUserId'
).
val
(
$
(
this
).
data
(
'user'
));
const
projectId
=
$
(
this
).
data
(
'project'
);
$
(
'#rejectMonth'
).
val
(
$
(
this
).
data
(
'month'
));
const
userId
=
$
(
this
).
data
(
'user'
);
const
month
=
$
(
this
).
data
(
'month'
);
const
action
=
"{{ route('mileage::projectDirector.rejectClaim', ':id') }}"
.
replace
(
':id'
,
claimId
);
$
(
'#rejectForm'
).
attr
(
'action'
,
action
);
$
(
'#rejectProjectId'
).
val
(
projectId
);
$
(
'#rejectUserId'
).
val
(
userId
);
$
(
'#rejectMonth'
).
val
(
month
);
$
(
'#rejectReason'
).
val
(
''
);
$
(
'#rejectReason'
).
val
(
''
);
$
(
'#rejectModal'
).
modal
(
'show'
);
$
(
'#rejectModal'
).
modal
(
'show'
);
});
});
// Handle bulk rejection
$
(
'.reject-btn'
).
click
(
function
(){
$
(
'
.reject-btn'
).
on
(
'click'
,
function
()
{
$
(
'
#rejectForm'
).
attr
(
'action'
,
"{{ route('mileage::projectDirector.rejectMonth') }}"
);
$
(
'#rejectProjectId'
).
val
(
$
(
this
).
data
(
'project'
));
$
(
'#rejectProjectId'
).
val
(
$
(
this
).
data
(
'project'
));
$
(
'#rejectUserId'
).
val
(
$
(
this
).
data
(
'user'
));
$
(
'#rejectUserId'
).
val
(
$
(
this
).
data
(
'user'
));
$
(
'#rejectMonth'
).
val
(
$
(
this
).
data
(
'month'
));
$
(
'#rejectMonth'
).
val
(
$
(
this
).
data
(
'month'
));
$
(
'#rejectReason'
).
val
(
''
);
$
(
'#rejectReason'
).
val
(
''
);
$
(
'#rejectForm'
).
attr
(
'action'
,
"{{ route('mileage::projectDirector.rejectMonth') }}"
);
$
(
'#rejectModal'
).
modal
(
'show'
);
$
(
'#rejectModal'
).
modal
(
'show'
);
});
// Validate reject form
$
(
'#rejectForm'
).
on
(
'submit'
,
function
(
e
)
{
const
reason
=
$
(
'#rejectReason'
).
val
().
trim
();
if
(
reason
===
''
)
{
e
.
preventDefault
();
alert
(
'Sila nyatakan sebab penolakan sebelum menghantar.'
);
$
(
'#rejectReason'
).
focus
();
}
});
});
});
</script>
</script>
@endsection
@endsection
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment