

<?php $__env->startSection('title', 'Pusat Aduan & Keluhan Pelanggan'); ?>

<?php $__env->startSection('content'); ?>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8 items-start">

    <div class="bg-white border border-gray-200 rounded-2xl p-6 shadow-sm lg:col-span-1">
        <h2 class="text-base font-black text-gray-900 mb-1">Formulir Layanan CRM</h2>
        <p class="text-xs text-gray-400 font-medium mb-4">Laporkan kendala produk sembako atau pelayanan kasir kami di sini.</p>

        <?php if(session('success')): ?>
        <div class="mb-4 bg-emerald-50 border border-emerald-200 text-emerald-800 text-xs p-3 rounded-xl font-semibold shadow-sm">
            🎉 <?php echo e(session('success')); ?>

        </div>
        <?php endif; ?>

        <form action="<?php echo e(url('/keluhan/kirim')); ?>" method="POST" class="space-y-4">
            <?php echo csrf_field(); ?>
            <div>
                <label class="block text-xs font-bold text-gray-700 mb-1">Subjek / Masalah</label>
                <input type="text" name="subjek" required placeholder="Contoh: Telur Pecah / Beras Berbatu" class="w-full px-3 py-2 border border-gray-300 rounded-xl text-xs outline-none focus:ring-1 focus:ring-blue-600 font-medium">
            </div>
            <div>
                <label class="block text-xs font-bold text-gray-700 mb-1">Detail Kronologi Keluhan</label>
                <textarea name="isi_keluhan" rows="4" required placeholder="Ketik secara rinci nomor nota beserta kendala yang Anda alami..." class="w-full px-3 py-2 border border-gray-300 rounded-xl text-xs outline-none focus:ring-1 focus:ring-blue-600 font-medium"></textarea>
            </div>
            <button type="submit" class="w-full bg-blue-600 text-white font-black text-xs py-2.5 rounded-xl hover:bg-blue-700 transition shadow-md">
                🚀 Kirim Aduan Resmi
            </button>
        </form>
    </div>

    <div class="lg:col-span-2 space-y-4">
        <h2 class="text-base font-black text-gray-900">Riwayat Laporan Anda</h2>

        <?php $__empty_1 = true; $__currentLoopData = $riwayatKeluhans; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
        <div class="bg-white border border-gray-200 rounded-2xl p-5 shadow-sm space-y-3">
            <div class="flex justify-between items-center border-b border-gray-100 pb-2">
                <div>
                    <h3 class="font-black text-xs text-gray-900">📋 <?php echo e($item->subjek); ?></h3>
                    <span class="text-[10px] text-gray-400 font-mono block mt-0.5"><?php echo e(date('d M Y H:i', strtotime($item->created_at))); ?> WIB</span>
                </div>
                <span class="px-2.5 py-0.5 text-[9px] font-black rounded border uppercase tracking-wider
                    <?php echo e($item->status == 'pending' ? 'bg-amber-50 text-amber-700 border-amber-200' : 'bg-emerald-50 text-emerald-700 border-emerald-200'); ?>">
                    <?php echo e($item->status); ?>

                </span>
            </div>

            <div class="bg-slate-50 border border-slate-100 rounded-xl p-3 text-xs text-gray-700 font-medium leading-relaxed">
                <span class="block text-[9px] text-gray-400 font-bold mb-1">📥 Laporan Anda:</span>
                <?php echo e($item->isi_keluhan); ?>

            </div>

            <?php if($item->status == 'selesai' || !empty($item->solusi_admin)): ?>
            <div class="bg-blue-50/80 border border-blue-100 rounded-xl p-4 text-xs text-gray-800 font-medium leading-relaxed mt-2 relative">
                <span class="block text-[9px] text-blue-600 font-black mb-1">🧑‍💻 Respon Resmi Customer Service:</span>
                <p class="italic">"<?php echo e($item->solusi_admin ?? 'Terimakasih laporan Anda telah kami selesaikan.'); ?>"</p>
            </div>
            <?php else: ?>
            <div class="text-[10px] text-gray-400 italic font-medium pt-1 px-1">
                ⏳ Menunggu tanggapan resmi tim administrasi Mega Mart...
            </div>
            <?php endif; ?>
        </div>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
        <div class="bg-white border border-gray-200 rounded-2xl p-8 text-center text-gray-400 font-medium text-xs shadow-sm">
            📭 Anda belum pernah mengirimkan laporan keluhan.
        </div>
        <?php endif; ?>
    </div>

</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.frontend', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH D:\SKRIPSI CRM 2026 II\PROGRAM CRM MEGA MART\megamart-crm\resources\views/keluhan.blade.php ENDPATH**/ ?>