Files
lpj/resources/views/surveyor/components/card-tambah.blade.php
2024-12-02 07:11:08 +07:00

94 lines
4.4 KiB
PHP

<div class="grid grid-cols-1 lg:grid-cols-2 gap-5 lg:gap-7.5">
@foreach ($permohonan->debiture->documents as $dokumen)
@php
$jaminanId = $dokumen->jenisJaminan->id;
$currentInspeksi = $inspeksiData[$jaminanId] ?? null;
$tanahBangunanTypes = ['KAPAL', 'PESAWAT', 'KENDARAAN', 'ALAT BERAT'];
$href = [
[
'label' => 'form inspeksi',
'url' => route('surveyor.inspeksi', [
'id' => $permohonan->id,
'jaminanId' => $jaminanId,
]) . "?form=create-inspeksi&inspeksi={$permohonan->id}&jenis_jaminan={$jaminanId}",
'show' => true,
'icon' => !empty($currentInspeksi['data_form']),
],
];
if (!in_array(strtoupper($dokumen->jenisJaminan->name), $tanahBangunanTypes)) {
$href[] = [
'label' => 'denah tanah dan bangunan',
'url' => route('surveyor.denah', [
'id' => $permohonan->id,
'jaminanId' => $jaminanId,
]) . "?form=create-denah&denah={$permohonan->id}&jenis_jaminan={$jaminanId}",
'show' => true,
'icon' => !empty($currentInspeksi['denah_form']),
];
}
$href = array_merge($href, [
[
'label' => 'foto',
'url' => route('surveyor.foto', [
'id' => $permohonan->id,
'jaminanId' => $jaminanId,
]) . "?form=create-foto&foto={$permohonan->id}&jenis_jaminan={$jaminanId}",
'show' => true,
'icon' => !empty($currentInspeksi['foto_form']),
],
[
'label' => 'data pembanding',
'url' => route('surveyor.data-pembanding', [
'id' => $permohonan->id,
'jaminanId' => $jaminanId,
]) . "?form=data-pembanding&pembanding={$permohonan->id}&jenis_jaminan={$jaminanId}",
'show' => true,
'icon' => !empty($currentInspeksi['data_pembanding']),
],
]);
@endphp
<div class="card border-2 border-dashed border-brand-clarity bg-center bg-[length:600px] bg-no-repeat add-new-bg grid gap-5"
style="padding: 20px">
<div class="card-group flex items-center flex-wrap sm:flex-nowrap justify-between py-4 gap-2.5">
<div class="flex items-center gap-3.5">
<div class="relative size-[50px] shrink-0">
<!-- SVG code remains the same -->
</div>
</div>
<div class="flex items-center gap-2.5">
<span class="flex items-center gap-1.5 leading-none font-medium text-sm text-gray-900">
{{ $dokumen->jenisJaminan->name ?? '' }}
</span>
</div>
</div>
@foreach ($href as $item)
@if ($item['show'])
<a href="{{ $item['url'] }}"
class="flex items-center justify-between border border-gray-200 rounded-xl gap-2 px-4 py-4 btn-outline {{ $item['icon'] ? 'btn-success' : 'btn-primary' }} hover:btn-light">
<div class="flex items-center gap-3.5">
<div class="flex flex-col">
<h1 class="text-sm font-medium text-gray-900 mb-px uppercase">
{{ $item['label'] }}
</h1>
</div>
</div>
<div class="flex items-center gap-5">
<div class="flex gap-0.5">
<div class="btn btn-sm btn-icon btn-clear {{ $item['icon'] ? '' : 'btn-light' }}">
<i class="ki-filled {{ $item['icon'] ? 'ki-check-circle' : 'ki-notepad-edit'}}"></i>
</div>
</div>
</div>
</a>
@endif
@endforeach
</div>
@endforeach
</div>