@extends('layouts.main')

@section('breadcrumbs')
    {{ Breadcrumbs::render(request()->route()->getName(), request()->route('noreg')) }}
@endsection

@section('content')
    <div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
        <div class="card border border-agi-100 pb-2.5">
            <div class="card-header bg-agi-50" id="basic_settings">
                <h3 class="card-title">
                    Detail Penawaran
                </h3>
                <div class="flex items-center gap-2">
                    @if ($penawaranExists)
                        <a href="{{ route('tender.penawaran.editPenawaran', $noreg) }}" class="btn btn-xs btn-danger"
                            title="Penawaran"><i class="ki-filled ki-arrow-circle-left"></i> Penawaran Ulang</a>
                    @endif
                    @if (!$penawaranExists)
                        <a href="{{ route('tender.penawaran.createPenawaran', $noreg) }}" class="btn btn-xs btn-primary"
                            title="Penawaran"><i class="ki-filled ki-arrow-circle-right"></i> Tambah Penawaran</a>
                    @endif
                    @if ($penawaranExists)
                        <a href="{{ route('tender.penawaran.ulang.index') }}" class="btn btn-xs btn-info"><i
                                class="ki-filled ki-exit-left"></i> Back</a>
                    @endif
                    @if (!$penawaranExists)
                        <a href="{{ route('tender.penawaran.index') }}" class="btn btn-xs btn-info"><i
                                class="ki-filled ki-exit-left"></i> Back</a>
                    @endif
                </div>
            </div>
            <div class="card-body grid gap-5">
                <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                    <label class="form-label max-w-56">
                        No. registrasi
                    </label>
                    <div class="flex flex-wrap items-baseline w-full">
                        <p class="flex w-full text-gray-600 font-medium text-sm">
                            {{ $penawaran->nomor_registrasi ?? '' }}
                        </p>
                    </div>
                    @if ($penawaran->code)
                        <label class="form-label max-w-56">
                            No. Penawaran
                        </label>
                        <div class="flex flex-wrap items-baseline w-full">
                            <p class="flex w-full text-gray-600 font-medium text-sm">
                                {{ $penawaran->code }}
                            </p>
                        </div>
                    @endif
                </div>
                <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                    <label class="form-label max-w-56">
                        Status
                    </label>
                    @if (isset($penawaran->status))
                        <p class="flex w-full text-gray-600 font-medium text-sm">
                            {{ ucwords($penawaran->status) }}
                        </p>
                    @else
                        <p class="flex w-full text-gray-600 font-medium text-sm">
                            Tidak Ada
                        </p>
                    @endif
                </div>
                <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                    <label class="form-label max-w-56">
                        Nama KJPP Sebelumnya
                    </label>
                    <div class="flex flex-wrap items-baseline w-full">
                        @if (isset($penawaran->nama_kjpp_sebelumnya) && !empty($penawaran->nama_kjpp_sebelumnya))
                            <div class="flex flex-row space-x-4 text-gray-600 font-medium text-sm">
                                {{ $penawaran->nama_kjpp_sebelumnya }}
                            </div>
                        @else
                            <div class="flex flex-row space-x-4 text-gray-600 font-medium text-sm">
                                Tidak ada
                            </div>
                        @endif
                    </div>
                    <label class="form-label max-w-56">
                        Biaya KJPP Sebelumnya
                    </label>
                    <p class="flex w-full text-gray-600 font-medium text-sm">
                        @if (isset($penawaran->biaya_kjpp_sebelumnya))
                            {{ formatRupiah($penawaran->biaya_kjpp_sebelumnya) }}
                        @else
                            {{ formatRupiah(0) }}
                        @endif
                    </p>
                </div>
                <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                    <label class="form-label max-w-56">
                        Tanggal Penilaian Sebelumnya
                    </label>
                    @if (isset($penawaran->tanggal_penilaian_sebelumnya) && !empty($penawaran->tanggal_penilaian_sebelumnya))
                        <p class="flex w-full text-gray-600 font-medium text-sm">
                            {{ formatTanggalIndonesia($penawaran->tanggal_penilaian_sebelumnya) }}
                        </p>
                    @else
                        <p class="flex w-full text-gray-600 font-medium text-sm">
                            Tidak Ada
                        </p>
                    @endif
                </div>
                <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                    <label class="form-label max-w-56">
                        Tujuan Penilaian KJPP
                    </label>
                    <p class="flex w-full text-gray-600 font-medium text-sm">
                        @if (isset($tujuan_penilaian_kjpp))
                            @foreach ($tujuan_penilaian_kjpp as $tpk)
                                {{ $tpk->name }}
                            @endforeach
                        @else
                            Tidak Ada
                        @endif
                    </p>
                    <label class="form-label max-w-56">
                        Jenis Laporan
                    </label>
                    <p class="flex w-full text-gray-600 font-medium text-sm">
                        @if (isset($jenis_laporan))
                            @foreach ($jenis_laporan as $jl)
                                {{ $jl->name }}
                            @endforeach
                        @else
                            Tidak Ada
                        @endif
                    </p>
                </div>
                <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                    <label class="form-label max-w-56">
                        Tanggal Batas Waktu
                    </label>
                    <p class="flex w-full text-gray-600 font-medium text-sm">
                        {{ formatTanggalIndonesia($penawaran->start_date) }} -
                        {{ formatTanggalIndonesia($penawaran->end_date) }}
                    </p>
                </div>
                <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                    <label class="form-label max-w-56">
                        Catatan
                    </label>
                    @if (isset($penawaran->catatan))
                        <p class="flex w-full text-gray-600 font-medium text-sm">
                            {{ $penawaran->catatan }}
                        </p>
                    @else
                        <p class="flex w-full text-gray-600 font-medium text-sm">
                            Tidak Ada
                        </p>
                    @endif
                </div>
                <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
                    <label class="form-label max-w-56">
                        Nama KJPP
                    </label>
                    <div class="flex flex-row space-x-4 text-gray-600 font-medium text-sm gap-1">
                        @if (isset($kjpps) && !empty(json_decode($kjpps, true)))
                            @foreach ($kjpps as $kjpp)
                                @if (isset($kjpp))
                                    <div
                                        class="flex flex-row space-x-4 text-white font-medium text-sm badge badge-dark dark-mode:badge dark-mode:text-gray-600 badge-xs">
                                        {{ $kjpp->name }}</div>
                                @endif
                            @endforeach
                        @else
                            <div class="flex flex-row space-x-4 text-gray-600 font-medium text-sm">Tidak Ada</div>
                        @endif
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection
