<?php if (isset($component)) { $__componentOriginal1f9e5f64f242295036c059d9dc1c375c = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal1f9e5f64f242295036c059d9dc1c375c = $attributes; } ?>
<?php $component = App\View\Components\Layout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\App\View\Components\Layout::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
    <!-- Header Halaman -->
    <div class="flex justify-between mb-2 mt-0">
        <div>
            <h2 class="text-2xl font-bold text-white">Projects</h2>
        </div>
        <div class="">
            <a href="project/project_form/create" class="inline-flex items-center rounded-sm bg-indigo-600 px-2.5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 transition-colors cursor-pointer border border-indigo-500">
                <svg class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
                    <path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15" />
                </svg>
            </a>
        </div>
    </div>

    <!-- CARD 1: Filter / Action Bar (Dark Mode) -->
    <div class="mb-4 p-4 bg-slate-800 rounded-md shadow-lg border border-slate-700 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4">
        <div>
            <h3 class="text-sm font-medium text-slate-100">Filter Data</h3>
            <p class="text-xs text-slate-400 mt-1">Saring project berdasarkan status saat ini.</p>
        </div>
        <div class="w-full sm:w-56">
            <label for="filter-status" class="sr-only">Filter Status</label>
            <select id="filter-status" name="filter-status" class="block w-full rounded-sm border border-slate-600 py-2 pl-3 pr-10 text-white focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm sm:leading-6 cursor-pointer bg-slate-900 shadow-sm transition-colors [&>option]:bg-slate-800">
                <option value="">Semua Status</option>
                <option value="active">Active</option>
                <option value="in_progress">In Progress</option>
                <option value="pending">Pending</option>
            </select>
        </div>
    </div>

    <!-- CARD 2: Tabel Data (Dark Mode) -->
    <div class="bg-slate-800 rounded-sm shadow-lg border border-slate-700 overflow-hidden">
        <div class="overflow-x-auto">
            <!-- Warna garis pembagi tabel diubah ke border-slate-700 -->
            <table class="min-w-full divide-y divide-slate-700/50">
                
                <!-- Background Header Tabel -->
                <thead class="bg-slate-900/50">
                    <tr>
                        <th scope="col" width="20" class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-slate-200 sm:pl-6">Project</th>
                        <th scope="col" width="15" class="px-3 py-3.5 text-left text-sm font-semibold text-slate-200">Status</th>
                        <th scope="col" width="50" class="px-3 py-3.5 text-left text-sm font-semibold text-slate-200">Description</th>
                        <th scope="col" width="15" class="relative py-3.5 pl-3 pr-4 sm:pr-6">
                            <span class="sr-only">Aksi</span>
                        </th>
                    </tr>
                </thead>
                
                <tbody class="divide-y divide-slate-700/50 bg-transparent">
                    <?php $__empty_1 = true; $__currentLoopData = $projects; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $project): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <!-- Baris Tabel dengan efek hover dan belang khas Dark Mode -->
                    <tr class="even:bg-slate-900/30 hover:bg-slate-700/50 transition-colors">
                        <td class="whitespace-nowrap py-3 pl-4 pr-3 sm:pl-6">
                            <div class="font-medium text-white"><?php echo e($project->project_name); ?></div>
                            <div class="text-slate-400 text-sm"><?php echo e($project->project_code); ?></div>
                        </td>
                        <td class="whitespace-nowrap px-3 py-3 text-sm">
                            <!-- Penyesuaian warna Badge (Green & Red) untuk Dark Mode -->
                            <span class="inline-flex items-center rounded-sm <?php echo e(($project->status == 1) ? 'bg-green-500/10 text-green-400 ring-green-500/20' : 'bg-red-500/10 text-red-400 ring-red-500/20'); ?> px-2 py-1 text-xs font-medium ring-1 ring-inset">
                                <?php echo e(($project->status == 1) ? 'Active' : 'Non Active'); ?>

                            </span>
                        </td>
                        <td class="whitespace-nowrap px-3 py-3 text-sm text-slate-400">
                            <?php echo e(Str::limit($project->description, 100)); ?>

                        </td>
                        <td class="whitespace-nowrap py-3 pl-3 pr-4 text-right text-sm font-medium sm:pr-6">
                            <div class="flex items-center justify-end gap-2">
                                <a href="project/project_from/<?php echo e($project->project_code); ?>" title="Edit" class="inline-flex items-center justify-center rounded-sm bg-indigo-600 p-1.5 text-white shadow-sm hover:bg-indigo-500 transition-colors cursor-pointer">
                                    <?php if (isset($component)) { $__componentOriginal643fe1b47aec0b76658e1a0200b34b2c = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal643fe1b47aec0b76658e1a0200b34b2c = $attributes; } ?>
<?php $component = BladeUI\Icons\Components\Svg::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('iconpark-edittwo'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\BladeUI\Icons\Components\Svg::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['class' => 'h-4 w-4']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal643fe1b47aec0b76658e1a0200b34b2c)): ?>
<?php $attributes = $__attributesOriginal643fe1b47aec0b76658e1a0200b34b2c; ?>
<?php unset($__attributesOriginal643fe1b47aec0b76658e1a0200b34b2c); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal643fe1b47aec0b76658e1a0200b34b2c)): ?>
<?php $component = $__componentOriginal643fe1b47aec0b76658e1a0200b34b2c; ?>
<?php unset($__componentOriginal643fe1b47aec0b76658e1a0200b34b2c); ?>
<?php endif; ?>
                                </a>
                                <div title="Hapus" onclick="handleClickDelete('<?php echo e($project->project_code); ?>', '<?php echo e($project->project_name); ?>')" class="inline-flex items-center justify-center rounded-sm bg-red-600 p-1.5 text-white shadow-sm hover:bg-red-500 transition-colors cursor-pointer">
                                    <?php if (isset($component)) { $__componentOriginal643fe1b47aec0b76658e1a0200b34b2c = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal643fe1b47aec0b76658e1a0200b34b2c = $attributes; } ?>
<?php $component = BladeUI\Icons\Components\Svg::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('iconpark-delete-o'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\BladeUI\Icons\Components\Svg::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['class' => 'h-4 w-4']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal643fe1b47aec0b76658e1a0200b34b2c)): ?>
<?php $attributes = $__attributesOriginal643fe1b47aec0b76658e1a0200b34b2c; ?>
<?php unset($__attributesOriginal643fe1b47aec0b76658e1a0200b34b2c); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal643fe1b47aec0b76658e1a0200b34b2c)): ?>
<?php $component = $__componentOriginal643fe1b47aec0b76658e1a0200b34b2c; ?>
<?php unset($__componentOriginal643fe1b47aec0b76658e1a0200b34b2c); ?>
<?php endif; ?>
                                </div>
                            </div>
                        </td>
                    </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <tr>
                            <!-- Empty state disesuaikan warnanya -->
                            <td colspan="4" class="text-center py-6 text-slate-400 text-sm">Projects not found</td>
                        </tr>
                    <?php endif; ?>
                </tbody>
            </table>
        </div>
        
        <div class="p-3 border-t border-slate-700 bg-slate-800">
            <?php echo e($projects->links()); ?>

        </div>
    </div>

    <script>
        function handleClickDelete(project_code, project_name)
        {
            Swal.fire({
                title: "Are you sure want to delete "+project_name+" project?",
                icon: "warning",
                showCancelButton: true,
                confirmButtonText: "Yes",
                confirmButtonColor: "#d33",
                focusCancel: true
                }).then((result) => {
                if (result.isConfirmed){
                    async function deleteProject(){
                        try {
                            const response      = await fetch('project/'+project_code, {
                                method: 'DELETE',
                                headers: {
                                    'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content,
                                    'Accept': 'application/json'
                                }
                            });

                            if (!response.ok) {
                                throw new Error(`HTTP error! Status: ${response.status}`);
                            }

                            const data = await response.json();
                            console.log(data)
                            if(data.success){
                                Swal.fire({
                                    title: "Deleted!",
                                    text: "Project "+project_name+" has been deleted",
                                    icon: "success"
                                }).then(() => {
                                    window.location.reload();
                                });
                            }
                        } catch (error) {
                           console.error('Fetch failed:', error); 
                        }
                    }

                    deleteProject();
                }
            });
        }
    </script>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal1f9e5f64f242295036c059d9dc1c375c)): ?>
<?php $attributes = $__attributesOriginal1f9e5f64f242295036c059d9dc1c375c; ?>
<?php unset($__attributesOriginal1f9e5f64f242295036c059d9dc1c375c); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal1f9e5f64f242295036c059d9dc1c375c)): ?>
<?php $component = $__componentOriginal1f9e5f64f242295036c059d9dc1c375c; ?>
<?php unset($__componentOriginal1f9e5f64f242295036c059d9dc1c375c); ?>
<?php endif; ?><?php /**PATH C:\Users\Hype\Herd\symmapan\resources\views/project/projects_list.blade.php ENDPATH**/ ?>