@extends('pemerintah.main')

@section('content')
    <style>
        body {
            background-color: #f8f9fa;
        }

        .profile-container {
            max-width: 800px;
            margin: 0 auto;
            padding: 30px;
            background-color: #fff;
            border-radius: 10px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
        }

        .profile-img {
            border: 3px solid #e9ecef;
            padding: 5px;
            background-color: #fff;
            box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
        }

        .profile-img img {
            border-radius: 50%;
        }

        .card {
            border-radius: 10px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
            margin-top: 20px;
        }

        .card-title {
            font-size: 1.75rem;
            margin-bottom: 15px;
            color: #343a40;
        }

        .edit-btn {
            background-color: #007bff;
            color: white;
            border-radius: 5px;
            padding: 10px 20px;
            text-decoration: none;
            margin-top: 20px;
            display: inline-block;
            transition: background-color 0.3s;
        }

        .edit-btn:hover {
            background-color: #0056b3;
        }

        .list-group-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .list-group-item strong {
            color: #6c757d;
        }

        @media (max-width: 768px) {
            .profile-container {
                padding: 15px;
            }
        }


        .text-center {
            display: flex;
            /* Menggunakan flexbox untuk memusatkan konten */
            flex-direction: column;
            /* Menyusun elemen secara vertikal */
            align-items: center;
            /* Memusatkan konten secara horizontal */
        }

        .profile-img {
            display: flex;
          
            justify-content: center;
            /* Memusatkan gambar secara horizontal */
            align-items: center;
            /* Memusatkan gambar secara vertikal */
            width: 200px;
            /* Lebar kontainer gambar */
            height: 200px;
            /* Tinggi kontainer gambar */
            border-radius: 50%;
            /* Membuat kontainer gambar menjadi bulat */
            overflow: hidden;
            /* Menghindari gambar melampaui batas kontainer */
            background-color: #f0f0f0;
            /* Warna latar belakang untuk tampilan */
        }

        .profile-img img {
            width: 100%;
            /* Memastikan gambar memenuhi lebar kontainer */
            height: 100%;
            /* Memastikan gambar memenuhi tinggi kontainer */
            object-fit: cover;
            /* Memastikan gambar terpotong dan tetap memenuhi area */
        }
    </style>

    <div class="container py-5 mt-5 profile-container">
        <div class="text-center">
            <div class="profile-img">
                <img src="{{ asset('storage/' . $detail->foto) }}" alt="Profile Picture" class="img-fluid">
            </div>

            <h2 class="mt-3">{{ $user->full_name }}</h2>
            <p class="text-muted">{{ ucfirst($user->role) }}</p>

        </div>
        <div class="card">
            <div class="card-body">
                <h4 class="card-title">Detail Profil</h4>
                <ul class="list-group list-group-flush">
                    {{-- <li class="list-group-item"><strong>Preferensi Sub Sektor:</strong> {{ $user->sub_sektor }}</li> --}}
                    <li class="list-group-item"><strong>NIK:</strong> {{ $user->nik }}</li>
                    <li class="list-group-item"><strong>Tanggal Lahir:</strong> {{ $user->birthdate }}</li>
                    <li class="list-group-item"><strong>Alamat:</strong> {{ $user->address }}</li>
                    <li class="list-group-item"><strong>Email:</strong> {{ $user->email }}</li>
                    <li class="list-group-item"><strong>No Telephone:</strong> {{ $user->phone_number }}</li>

                    @if ($user->role == 'pemerintah')
                        <li class="list-group-item"><strong>Instansi:</strong> {{ $detail->institution_name }}</li>
                        <li class="list-group-item"><strong>Deskripsi:</strong> {{ $detail->description_pemerintah }}
                        </li>
                    @elseif($user->role == 'umkm')
                        <li class="list-group-item"><strong>Nama UMKM:</strong> {{ $detail->umkm_name }}</li>
                        <li class="list-group-item"><strong>Tanggal Pendirian:</strong>
                            {{ $detail->establishment_date_umkm }}</li>
                        <li class="list-group-item"><strong>Deskripsi:</strong> {{ $detail->description_umkm }}</li>
                        <li class="list-group-item"><strong>Nomor SIUP:</strong> {{ $detail->siup_number_umkm }}</li>
                        <li class="list-group-item"><strong>Produk:</strong> {{ $detail->product }}</li>
                        <li class="list-group-item"><strong>Profit:</strong> {{ $detail->profit_umkm }}</li>
                    @elseif($user->role == 'investor')
                        @php
                            $detail = $user->investorDetails;
                        @endphp

                        @if ($detail->category === 'personal' && $detail->personalDetails)
                            @php
                                $personalDetail = $detail->personalDetails;
                            @endphp
                            <li class="list-group-item"><strong>Nomor NPWP:</strong>
                                {{ $personalDetail->npwp_number_inves_personal }}</li>
                            <li class="list-group-item"><strong>Pekerjaan:</strong> {{ $personalDetail->job }}</li>
                            <li class="list-group-item"><strong>Total Aset:</strong>
                                {{ number_format($personalDetail->total_assets, 2, ',', '.') }}</li>
                            <li class="list-group-item"><strong>Profit:</strong>
                                {{ number_format($personalDetail->profit_inves_personal, 2, ',', '.') }}</li>
                        @elseif ($detail->category === 'perusahaan' && $detail->perusahaanDetails)
                            @php
                                $perusahaanDetail = $detail->perusahaanDetails;
                            @endphp
                            <li class="list-group-item"><strong>Nama Perusahaan:</strong>
                                {{ $perusahaanDetail->company_name }}</li>
                            <li class="list-group-item"><strong>Deskripsi:</strong>
                                {{ $perusahaanDetail->description_inves_perusahaan }}</li>
                            <li class="list-group-item"><strong>Tanggal Pendirian:</strong>
                                {{ $perusahaanDetail->establishment_date_inves_perusahaan }}</li>
                            <li class="list-group-item"><strong>Nomor SIUP:</strong>
                                {{ $perusahaanDetail->siup_number_inves_perusahaan }}</li>
                            <li class="list-group-item"><strong>Nomor NIB:</strong> {{ $perusahaanDetail->nib_number }}</li>
                            <li class="list-group-item"><strong>Nomor NPWP:</strong>
                                {{ $perusahaanDetail->npwp_number_inves_perusahaan }}</li>
                            <li class="list-group-item"><strong>Profit:</strong>
                                {{ number_format($perusahaanDetail->profit_inves_perusahaan, 2, ',', '.') }}</li>
                        @else
                            <li class="list-group-item">Tidak ada rincian untuk investor ini.</li>
                        @endif
                    @elseif($user->role == 'akademisi')
                        <li class="list-group-item"><strong>Nama Universitas:</strong> {{ $detail->university_name }}</li>
                        <li class="list-group-item"><strong>Fakultas:</strong> {{ $detail->faculty }}</li>
                        <li class="list-group-item"><strong>Bidang Keahlian:</strong> {{ $detail->expertise_field }}</li>
                    @elseif($user->role == 'komunitas')
                        <li class="list-group-item"><strong>Nama Komunitas:</strong> {{ $detail->community_name }}</li>
                        <li class="list-group-item"><strong>Lisensi Komunitas:</strong> {{ $detail->community_license }}</li>
                    @endif
                </ul>

            </div>
        </div>
    </div>
@endsection
