@php $mupremi = $data->matauang ?? 'Rp'; @endphp
{{-- ── Header ── --}}
PLACING SLIP
No: {{ $data->no_placing_slip }}
  {{-- --}}
CV. TRANS INDO UTAMA
Insurance Services
Surabaya, {{ \Carbon\Carbon::parse(date('Y-m-d'))->translatedFormat('d F Y') }}
{{-- ── Info Utama ── --}} @if ($tipe_asuransi->namaasuransi == 'ASURANSI KENDARAAN' && $data->vehicle) @endif @if ($tipe_asuransi->namaasuransi == 'ASURANSI TRAVEL' && $data->travel) @endif @if ($tipe_asuransi->namaasuransi == 'ASURANSI PERSONAL ACCIDENT' && $data->pa) @endif @if ($tipe_asuransi->namaasuransi == 'ASURANSI CARGO' && $data->cargo) @endif @if ($tipe_asuransi->namaasuransi == 'ASURANSI BUILDING' && $data->buildings->count() > 0) @endif @if ($tipe_asuransi->namaasuransi != 'ASURANSI BUILDING') @endif @if ($tipe_asuransi->namaasuransi == 'ASURANSI KENDARAAN' && $data->vehicle) @if (!empty($data->accesories)) @endif @if (!empty($data->deductible)) @endif @if (!empty($data->extensionclause)) @endif @endif @if ($tipe_asuransi->namaasuransi == 'ASURANSI BUILDING') @if (!empty($data->coverage)) @endif @if (!empty($data->interestinsured)) @endif @if (!empty($data->accesories)) @endif @if (!empty($data->deductible)) @endif @if (!empty($data->extensionclause)) @php $rows = splitRichTextIntoRows($data->extensionclause); @endphp @foreach ($rows as $i => $rowHtml) @endforeach @endif @endif @if ($tipe_asuransi->namaasuransi == 'ASURANSI BUILDING') @endif
TYPE OF INSURANCE : {{ strtoupper($tipe_asuransi->namaasuransi ?? '-') }}
INSURED : {{ $data->namadipolis ?? '-' }}
ADDRESS : {{ $client->alamat ?? '-' }}
Vehicle Insured : @foreach ($data->vehicles as $key => $value) {{ $value->merkmobil }} {{ $value->tipemobil }} / {{ $value->tahunmobil }} / {{ $value->platnomor }}
@endforeach
No Rangka / Mesin : @foreach ($data->vehicles as $key => $value) {{ $value->norangka }} / {{ $value->nomesin }}
@endforeach
Destination : {{ $data->travel->tujuan ?? '-' }}
Name Insured : {{ $data->pa->namatertanggung ?? '-' }}
Conveyance : {{ $data->cargo->conveyance ?? '-' }}
Origin / Destination : {{ $data->cargo->asal ?? '-' }} / {{ $data->cargo->tujuan ?? '-' }}
Location of Risk : @foreach ($data->buildings as $building) {{ $building->lokasi ?? '-' }}
@endforeach
Occupation : @foreach ($data->buildings as $building) {{ $building->okupasi ?? '-' }}
@endforeach
Periode : {{ \Carbon\Carbon::parse($data->tglawal)->translatedFormat('d F Y') }} s/d {{ \Carbon\Carbon::parse($data->tglakhir)->translatedFormat('d F Y') }}
Sum Insured : {{ $mupremi }} {{ number_format($data->nilaipertanggungan, 0, ',', '.') }},00
ACCESSORIES : {!! $data->accesories !!}
DEDUCTIBLE : {!! $data->deductible !!}
EXTENSION CLAUSE : {!! $data->extensionclause !!}
COVERAGE : {!! $data->coverage !!}
INTEREST INSURED : {!! $data->interestinsured !!}
ACCESSORIES : {!! $data->accesories !!}
DEDUCTIBLE : {!! $data->deductible !!}
{{ $i === 0 ? 'EXTENSION CLAUSE' : '' }} {{ $i === 0 ? ':' : '' }} {!! $rowHtml !!}
SUM INSURED : @if ($data->sum_insured != '') {!! $data->sum_insured !!} @else @php $sumInsureds = $data->sumInsureds ?? collect([]); $sortInsureds = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L']; @endphp @if ($sumInsureds->count() > 0) @foreach ($sumInsureds as $key => $value) @endforeach @endif
{{ $sortInsureds[$key] ?? '-' }}. {{ $value->types }}   {{ $value->matauang }} {{ number_format($value->sum_insured, 0, ',', '.') }}
@endif
TOTAL SUM INSURED : {{ $mupremi }} {{ number_format($data->nilaipertanggungan, 0, ',', '.') }},00
{{-- ── Coverage & Premium ── --}}
Coverage & Premium
@php $categories = $data->categorySummaries ?? collect([]); $coveragesByCategory = $data->coverages->groupBy(function ($item) { return $item->category ?: 'Uncategorized'; }); $grandTotalPremium = 0; @endphp @if (isset($tipe_asuransi->namaasuransi) && $tipe_asuransi->namaasuransi == 'ASURANSI TRAVEL') @php if ($categories->count() > 0) { $grossPremium = $categories->sum('gross_premium'); $discountNominal = $categories->sum('discount_nominal'); $policyCost = $categories->sum('policy_cost'); $totalPremium = $categories->sum('total_premium'); } else { $grossPremium = $data->coverages->sum(function ($item) { $prem = floatval($item->premium ?? 0); $disc = floatval($item->discount ?? 0); return $prem - ($prem * $disc) / 100; }); $diskon = floatval($data->diskon ?? 0); $policyCost = floatval($data->biayapolis ?? 0); $discountNominal = ($diskon * $grossPremium) / 100; $totalPremium = $grossPremium - $discountNominal + $policyCost; } @endphp
Premium : {{ $mupremi }} {{ number_format($grossPremium, 2, ',', '.') }}
Diskon : -{{ $mupremi }} {{ number_format($discountNominal, 2, ',', '.') }}
Biaya Polis : {{ $mupremi }}
{{ number_format($policyCost, 2, ',', '.') }}
Total Premium : {{ $mupremi }} {{ number_format($totalPremium, 2, ',', '.') }}
Terbilang : {{ ucwords(terbilang($totalPremium, 2)) }} {{ $mupremi == 'Rp' ? 'Rupiah' : 'US Dollar' }}
Untuk Pembayaran : {!! $data->payment_for !!}
@elseif ($categories->count() > 0) @php $no = 0; @endphp @foreach ($categories as $catSummary) @php $no++; $catName = $catSummary->category; $covs = $coveragesByCategory[$catName] ?? collect([]); $grandTotalPremium += $catSummary->total_premium; @endphp @php $totalrate = 0; $totalnilaip = 0; @endphp @forelse($covs as $coverage) @php $totalrate += $coverage->rate ?? 0; $totalnilaip += $coverage->nilaipertanggungan ?? 0; @endphp @empty @endforelse {{-- Sub Total --}} {{-- Discount --}} @if (floatval($catSummary->discount_nominal) > 0) @endif {{-- Policy Cost --}} @if (floatval($catSummary->policy_cost) > 0) @endif {{-- Total Kategori (dengan nomor urut) --}}
No Cover Rate Nilai Pertanggungan Premi
  {{ $coverage->coverage_name }} {{ number_format($coverage->rate ?? 0, 4, ',', '.') }}% x {{ $mupremi }} {{ number_format($data->nilaipertanggungan, 0, ',', '.') }},00 : {{ $mupremi }} {{ number_format($coverage->premium ?? 0, 2, ',', '.') }}
Tidak ada coverage
  Sub Total : {{ $mupremi }} {{ number_format($catSummary->gross_premium, 2, ',', '.') }}
Discount {{-- ({{ number_format($catSummary->discount_percentage, 2, ',', '.') }}%) --}} : ({{ $mupremi }} {{ number_format($catSummary->discount_nominal, 2, ',', '.') }})
Policy Cost & Stamp Duty : {{ $mupremi }} {{ number_format($catSummary->policy_cost, 2, ',', '.') }}
{{ $no }} {{ $catName }} {{ number_format($totalrate ?? 0, 4, ',', '.') }}% x {{ $mupremi }} {{ number_format($data->nilaipertanggungan, 0, ',', '.') }},00 : {{ $mupremi }} {{ number_format($catSummary->total_premium, 2, ',', '.') }}
@endforeach @if ($categories->count() > 1)
GRAND TOTAL PREMIUM {{ $mupremi }} {{ number_format($grandTotalPremium, 2, ',', '.') }}
@endif @else @php $grossPremium = $data->coverages->sum(function ($item) { $prem = floatval($item->premium ?? 0); $disc = floatval($item->discount ?? 0); return $prem - ($prem * $disc) / 100; }); $diskon = floatval($data->diskon ?? 0); $policyCost = floatval($data->biayapolis ?? 0); $diskonNominal = ($diskon * $grossPremium) / 100; $totalPremium = $grossPremium - $diskonNominal + $policyCost; @endphp @forelse($data->coverages as $coverage) @empty @endforelse {{-- Sub Total --}} {{-- Discount --}} @php $discountNominal = 0; @endphp @if ($diskon > 0) @php $discountNominal = $grossPremium * ($diskon / 100); @endphp @endif {{-- Policy Cost --}} @if ($policyCost > 0) @endif {{-- Total --}}
Sum Insured {{ $mupremi }}   {{ number_format($data->nilaipertanggungan, 0, ',', '.') }},00 {{ strtoupper($tipe_asuransi->namaasuransi ?? '') }}
Cover Rate Premi
@if (!empty($coverage->category)) [{{ $coverage->category }}]
@endif {{ $coverage->coverage_name }}
  {{ number_format($coverage->rate ?? 0, 4, ',', '.') }}% @if (floatval($coverage->discount) > 0)
(Disc: {{ number_format($coverage->discount, 2, ',', '.') }}%) @endif :
@php $cPrem = floatval($coverage->premium ?? 0); $cDisc = floatval($coverage->discount ?? 0); $cNet = $cPrem - ($cPrem * $cDisc) / 100; @endphp {{ $mupremi }} {{ number_format($cNet, 2, ',', '.') }}
Tidak ada coverage
    Sub Total : {{ $mupremi }} {{ number_format($grossPremium, 2, ',', '.') }}
Discount   : ({{ $mupremi }} {{ number_format($discountNominal, 2, ',', '.') }})
Policy Cost & Stamp Duty   : {{ $mupremi }} {{ number_format($policyCost, 2, ',', '.') }}
Total Premium {{ $mupremi }} {{ number_format($totalPremium, 2, ',', '.') }}
@endif {{-- ── Note ── --}} @if ($data->tipeasuransi == 'ASURANSI OTHER' && $data->other && $data->other->keterangan)
NOTE :
{{ $data->other->keterangan }}
@endif {{-- ── Footer Info ── --}} {{-- ── Signature ── --}}
Insured Acceptance :



  Name, Signature, Date