@extends('Dashboard.layouts.main')

@section('title', 'Detail Penilaian Kepuasan')

@section('content')
<div class="content">
    <div class="container-fluid">
        <div class="row">
            <div class="col-12">
                <div class="page-title-box">
                    <div class="page-title-right">
                        <ol class="breadcrumb m-0">
                            <li class="breadcrumb-item"><a href="{{ route('dashboard') }}">Dashboard</a></li>
                            <li class="breadcrumb-item"><a href="{{ route('satisfactions.index') }}">Penilaian Kepuasan</a></li>
                            <li class="breadcrumb-item active">Detail</li>
                        </ol>
                    </div>
                    <h4 class="page-title">Detail Penilaian Kepuasan</h4>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-12">
                <div class="card">
                    <div class="card-header bg-primary text-white">
                        <div class="d-flex justify-content-between align-items-center">
                            <h5 class="card-title mb-0 text-white">Hasil Penilaian</h5>
                            <div>
                                <span class="badge {{ $satisfaction->average_score >= 4 ? 'badge-success' : ($satisfaction->average_score >= 3 ? 'badge-info' : 'badge-danger') }} p-2">
                                    <strong>Rata-rata: {{ number_format($satisfaction->average_score, 1) }}</strong>
                                </span>
                            </div>
                        </div>
                    </div>
                    <div class="card-body">
                        <div class="row">
                            <div class="col-md-6">
                                <div class="card mb-4">
                                    <div class="card-header bg-light">
                                        <h5 class="card-title mb-0">Informasi Pengisi</h5>
                                    </div>
                                    <div class="card-body">
                                        <table class="table table-borderless">
                                            <tr>
                                                <th style="width: 30%;">Nama</th>
                                                <td>{{ $satisfaction->user->name }}</td>
                                            </tr>
                                            <tr>
                                                <th>Email</th>
                                                <td>{{ $satisfaction->user->email }}</td>
                                            </tr>
                                            @if($satisfaction->user->phone)
                                            <tr>
                                                <th>Telepon</th>
                                                <td>{{ $satisfaction->user->phone }}</td>
                                            </tr>
                                            @endif
                                            @if($satisfaction->user->business_name)
                                            <tr>
                                                <th>Nama Usaha</th>
                                                <td>{{ $satisfaction->user->business_name }}</td>
                                            </tr>
                                            @endif
                                            @if($satisfaction->user->business_address)
                                            <tr>
                                                <th>Alamat Usaha</th>
                                                <td>{{ $satisfaction->user->business_address }}</td>
                                            </tr>
                                            @endif
                                        </table>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="card mb-4">
                                    <div class="card-header bg-light">
                                        <h5 class="card-title mb-0">Informasi Pengisian</h5>
                                    </div>
                                    <div class="card-body">
                                        <table class="table table-borderless">
                                            {{-- <tr>
                                                <th style="width: 40%;">ID Penilaian</th>
                                                <td># {{ $satisfaction->id }}</td>
                                            </tr> --}}
                                            <tr>
                                                <th>Tanggal Pengisian</th>
                                                <td>{{ $satisfaction->created_at->format('d F Y, H:i') }}</td>
                                            </tr>
                                            <tr>
                                                <th>Terakhir Diperbarui</th>
                                                <td>{{ $satisfaction->updated_at->format('d F Y, H:i') }}</td>
                                            </tr>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <p><strong>Keterangan Penilaian:</strong></p>
                        <ul class="mb-4">
                            <li><span class="badge badge-danger">1</span> = Sangat Tidak Setuju / Sangat Tidak Puas</li>
                            <li><span class="badge badge-warning">2</span> = Tidak Setuju / Tidak Puas</li>
                            <li><span class="badge badge-secondary">3</span> = Netral / Cukup</li>
                            <li><span class="badge badge-info">4</span> = Setuju / Puas</li>
                            <li><span class="badge badge-success">5</span> = Sangat Setuju / Sangat Puas</li>
                        </ul>

                        <div class="table-responsive">
                            <table class="table table-bordered table-striped">
                                <thead class="thead-light">
                                    <tr>
                                        <th width="5%">No</th>
                                        <th width="65%">ASPEK PELAYANAN YANG DINILAI</th>
                                        <th width="15%" class="text-center">NILAI</th>
                                        <th width="15%" class="text-center">KATEGORI</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr>
                                        <td>1</td>
                                        <td>Bagaimana Pendapat Saudara tentang kesesuaian persyarataran pelayanan dengan jenis pelayanan.</td>
                                        <td class="text-center">{{ $satisfaction->q1 }}</td>
                                        <td class="text-center">
                                            <span class="badge {{ $satisfaction->q1 >= 4 ? 'badge-success' : ($satisfaction->q1 >= 3 ? 'badge-info' : 'badge-danger') }}">
                                                {{ $satisfaction->q1 >= 4 ? 'Baik' : ($satisfaction->q1 >= 3 ? 'Cukup' : 'Kurang') }}
                                            </span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>2</td>
                                        <td>Bagaimana Pendapat Saudara tentang kejelasan persyaratan administrasi yang dibutuhkan</td>
                                        <td class="text-center">{{ $satisfaction->q2 }}</td>
                                        <td class="text-center">
                                            <span class="badge {{ $satisfaction->q2 >= 4 ? 'badge-success' : ($satisfaction->q2 >= 3 ? 'badge-info' : 'badge-danger') }}">
                                                {{ $satisfaction->q2 >= 4 ? 'Baik' : ($satisfaction->q2 >= 3 ? 'Cukup' : 'Kurang') }}
                                            </span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>3</td>
                                        <td>Bagaimana Pendapat Saudara tentang kemudahan prosedur mendapatkan pelayanan di unit ini?</td>
                                        <td class="text-center">{{ $satisfaction->q3 }}</td>
                                        <td class="text-center">
                                            <span class="badge {{ $satisfaction->q3 >= 4 ? 'badge-success' : ($satisfaction->q3 >= 3 ? 'badge-info' : 'badge-danger') }}">
                                                {{ $satisfaction->q3 >= 4 ? 'Baik' : ($satisfaction->q3 >= 3 ? 'Cukup' : 'Kurang') }}
                                            </span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>4</td>
                                        <td>Bagaimana pendapat saudara tentang kecepatan waktu dalam memberikan pelayanan?</td>
                                        <td class="text-center">{{ $satisfaction->q4 }}</td>
                                        <td class="text-center">
                                            <span class="badge {{ $satisfaction->q4 >= 4 ? 'badge-success' : ($satisfaction->q4 >= 3 ? 'badge-info' : 'badge-danger') }}">
                                                {{ $satisfaction->q4 >= 4 ? 'Baik' : ($satisfaction->q4 >= 3 ? 'Cukup' : 'Kurang') }}
                                            </span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>5</td>
                                        <td>Apakah jam buka pelayanan sudah tepat waktu sesuai standart pelayanan yang dijanjikan?</td>
                                        <td class="text-center">{{ $satisfaction->q5 }}</td>
                                        <td class="text-center">
                                            <span class="badge {{ $satisfaction->q5 >= 4 ? 'badge-success' : ($satisfaction->q5 >= 3 ? 'badge-info' : 'badge-danger') }}">
                                                {{ $satisfaction->q5 >= 4 ? 'Baik' : ($satisfaction->q5 >= 3 ? 'Cukup' : 'Kurang') }}
                                            </span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>6</td>
                                        <td>Bagaimana pendapat saudara tentang kewajaran biaya/tarif dalam pelayanan?</td>
                                        <td class="text-center">{{ $satisfaction->q6 }}</td>
                                        <td class="text-center">
                                            <span class="badge {{ $satisfaction->q6 >= 4 ? 'badge-success' : ($satisfaction->q6 >= 3 ? 'badge-info' : 'badge-danger') }}">
                                                {{ $satisfaction->q6 >= 4 ? 'Baik' : ($satisfaction->q6 >= 3 ? 'Cukup' : 'Kurang') }}
                                            </span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>7</td>
                                        <td>Bagaimana pendapat saudara tentang kesesuaian produk hasil pelayanan dengan standar pelayanan?</td>
                                        <td class="text-center">{{ $satisfaction->q7 }}</td>
                                        <td class="text-center">
                                            <span class="badge {{ $satisfaction->q7 >= 4 ? 'badge-success' : ($satisfaction->q7 >= 3 ? 'badge-info' : 'badge-danger') }}">
                                                {{ $satisfaction->q7 >= 4 ? 'Baik' : ($satisfaction->q7 >= 3 ? 'Cukup' : 'Kurang') }}
                                            </span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>8</td>
                                        <td>Bagiamana pendapat saudara tentang kompetensi/kemampuan petugas dalam pelayanan?</td>
                                        <td class="text-center">{{ $satisfaction->q8 }}</td>
                                        <td class="text-center">
                                            <span class="badge {{ $satisfaction->q8 >= 4 ? 'badge-success' : ($satisfaction->q8 >= 3 ? 'badge-info' : 'badge-danger') }}">
                                                {{ $satisfaction->q8 >= 4 ? 'Baik' : ($satisfaction->q8 >= 3 ? 'Cukup' : 'Kurang') }}
                                            </span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>9</td>
                                        <td>Bagaimana pendapat saudara, kesopanan dan keramahan petugas dalam memberikan pelayanan?</td>
                                        <td class="text-center">{{ $satisfaction->q9 }}</td>
                                        <td class="text-center">
                                            <span class="badge {{ $satisfaction->q9 >= 4 ? 'badge-success' : ($satisfaction->q9 >= 3 ? 'badge-info' : 'badge-danger') }}">
                                                {{ $satisfaction->q9 >= 4 ? 'Baik' : ($satisfaction->q9 >= 3 ? 'Cukup' : 'Kurang') }}
                                            </span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>10</td>
                                        <td>Bagaimana pendapat saudara tentang kualitas sarana dan prasarana pelayanan?</td>
                                        <td class="text-center">{{ $satisfaction->q10 }}</td>
                                        <td class="text-center">
                                            <span class="badge {{ $satisfaction->q10 >= 4 ? 'badge-success' : ($satisfaction->q10 >= 3 ? 'badge-info' : 'badge-danger') }}">
                                                {{ $satisfaction->q10 >= 4 ? 'Baik' : ($satisfaction->q10 >= 3 ? 'Cukup' : 'Kurang') }}
                                            </span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>11</td>
                                        <td>Apakah ruang pelayanan bersih dan nyaman?</td>
                                        <td class="text-center">{{ $satisfaction->q11 }}</td>
                                        <td class="text-center">
                                            <span class="badge {{ $satisfaction->q11 >= 4 ? 'badge-success' : ($satisfaction->q11 >= 3 ? 'badge-info' : 'badge-danger') }}">
                                                {{ $satisfaction->q11 >= 4 ? 'Baik' : ($satisfaction->q11 >= 3 ? 'Cukup' : 'Kurang') }}
                                            </span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>12</td>
                                        <td>Apakah kamar mandi atau toilet yang tersedia sudah bersih?</td>
                                        <td class="text-center">{{ $satisfaction->q12 }}</td>
                                        <td class="text-center">
                                            <span class="badge {{ $satisfaction->q12 >= 4 ? 'badge-success' : ($satisfaction->q12 >= 3 ? 'badge-info' : 'badge-danger') }}">
                                                {{ $satisfaction->q12 >= 4 ? 'Baik' : ($satisfaction->q12 >= 3 ? 'Cukup' : 'Kurang') }}
                                            </span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>13</td>
                                        <td>Apakah tempat parkir sudah cukup luas, nyaman dan aman</td>
                                        <td class="text-center">{{ $satisfaction->q13 }}</td>
                                        <td class="text-center">
                                            <span class="badge {{ $satisfaction->q13 >= 4 ? 'badge-success' : ($satisfaction->q13 >= 3 ? 'badge-info' : 'badge-danger') }}">
                                                {{ $satisfaction->q13 >= 4 ? 'Baik' : ($satisfaction->q13 >= 3 ? 'Cukup' : 'Kurang') }}
                                            </span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>14</td>
                                        <td>Bagaimana pendapat saudara tentang penanganan saran dan pengaduan pengguna layanan</td>
                                        <td class="text-center">{{ $satisfaction->q14 }}</td>
                                        <td class="text-center">
                                            <span class="badge {{ $satisfaction->q14 >= 4 ? 'badge-success' : ($satisfaction->q14 >= 3 ? 'badge-info' : 'badge-danger') }}">
                                                {{ $satisfaction->q14 >= 4 ? 'Baik' : ($satisfaction->q14 >= 3 ? 'Cukup' : 'Kurang') }}
                                            </span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>15</td>
                                        <td>Apakah sarana pengaduan (komplain) berupa kotak saran dari pengaduan/telepon/email mudah diakses?</td>
                                        <td class="text-center">{{ $satisfaction->q15 }}</td>
                                        <td class="text-center">
                                            <span class="badge {{ $satisfaction->q15 >= 4 ? 'badge-success' : ($satisfaction->q15 >= 3 ? 'badge-info' : 'badge-danger') }}">
                                                {{ $satisfaction->q15 >= 4 ? 'Baik' : ($satisfaction->q15 >= 3 ? 'Cukup' : 'Kurang') }}
                                            </span>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>

                        @if($satisfaction->kritik_saran)
                        <div class="mt-4">
                            <div class="card">
                                <div class="card-header bg-light">
                                    <h5 class="card-title mb-0">Kritik dan Saran</h5>
                                </div>
                                <div class="card-body">
                                    <p class="card-text">{{ $satisfaction->kritik_saran }}</p>
                                </div>
                            </div>
                        </div>
                        @endif

                        <div class="mt-4 text-right">
                            <a href="{{ route('satisfactions.index') }}" class="btn btn-secondary">Kembali</a>
                            @can('customer')
                                <a href="{{ route('satisfactions.edit', $satisfaction->id) }}" class="btn btn-primary ml-2">Edit</a>
                                <button type="button" class="btn btn-danger ml-2" onclick="confirmDelete('{{ route('satisfactions.destroy', $satisfaction->id) }}')">
                                    <i class="fe-trash"></i> Hapus
                                </button>
                            @endcan
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- Sertakan Modal Konfirmasi Hapus -->
@include('layouts.delete-modal')
@endsection 