@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);
    }
</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>{{ $claim->claim_date }}</td>
            </tr>
            <tr>
                <td>Jenis Kenderaan</td>
                <td>{{ $claim->jenisKenderaan->name ?? '-' }}</td>
            </tr>
            <tr>
                <td>Nama Projek</td>
                <td>{{ $claim->project->p_project_description ?? '-' }}</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>{{ $claim->total_mileage }} km</td>
            </tr>
            <tr>
                <td>Jumlah Perbatuan Layak Tuntut</td>
                <td>{{ $claim->claimable_mileage ?? 0 }} km</td>
            </tr>
            <tr>
                <td>Jumlah Tuntutan Perjalanan (RM)</td>
                <td>RM {{ number_format($claim->calculated_amount ?? 0, 2) }}</td>
            </tr>
            <tr>
                <td>Toll (RM)</td>
                <td>RM {{ number_format($claim->toll_amount ?? 0, 2) }}</td>
            </tr>
            <tr>
                <td>Lain-lain (RM)</td>
                <td>RM {{ number_format($claim->others_amount ?? 0, 2) }}</td>
            </tr>
            <tr>
                <td>Butiran Lain-lain</td>
                <td>{{ $claim->others_description ?? '-' }}</td>
            </tr>
            <tr>
                <td>Penalti (RM) (Jika Ada)</td>
                <td>
                    @if(isset($claim->display_penalty_amount))
                        @if($claim->display_penalty_amount > 0)
                            RM {{ number_format($claim->display_penalty_amount, 2) }}
                        @else
                            @if($claim->display_penalty_reason === 'Tertakluk kepada BOD')
                                <span style="color: orange;">{{ $claim->display_penalty_reason }}</span>
                            @else
                                RM 0.00
                            @endif
                        @endif
                    @else
                        RM {{ number_format($claim->penalty_amount ?? 0, 2) }}
                    @endif
                </td>
            </tr>
            <tr>
                <td>Sebab Penalti</td>
                <td>
                    {{ $claim->display_penalty_reason ?? $claim->penalty_reason ?? '-' }}
                </td>
            </tr>
            <tr>
                <td><strong>Jumlah Keseluruhan Tuntutan (RM)</strong></td>
                <td><strong>RM {{ number_format($claim->total_claim_amount ?? $claim->total_claim_amount ?? 0, 2) }}</strong></td>
            </tr>
            <tr>
                <td><strong>Status</strong></td>
                <td><strong>{{ $claim->status }}</strong></td>
            </tr>
        </table>
    </div>

    <a href="{{ route('mileage::projectDirector.index') }}" class="ui button">
        Kembali
    </a>
</div>
@endsection
