

<?php $__env->startSection('title', 'Kontrak Saya - TUNJUK-i'); ?>

<?php $__env->startSection('content'); ?>
<div class="mb-6">
    <div class="flex items-center justify-between">
        <div>
            <h1 class="text-2xl font-bold text-[#0b2b4a] flex items-center gap-2">
                <i class="fas fa-file-signature text-[#c9a84c]"></i>
                Kontrak Saya
            </h1>
            <p class="text-gray-500 text-sm mt-1">Daftar kontrak yang Anda miliki</p>
        </div>
        <a href="<?php echo e(route('super_admin.dashboard')); ?>" class="text-gray-600 hover:text-gray-800 transition">
            <i class="fas fa-arrow-left mr-1"></i> Kembali
        </a>
    </div>
</div>

<?php
    $user = Auth::user();
    $contractor = \App\Models\Contractor::where('user_id', $user->id)->first();
    $contracts = $contractor ? \App\Models\Contract::where('contractor_id', $contractor->id)
        ->with(['jobPackage'])
        ->orderBy('created_at', 'desc')
        ->get() : collect();
?>

<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($contractor): ?>
    <div class="bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden">
        <div class="overflow-x-auto">
            <table class="w-full">
                <thead class="bg-gray-50">
                    <tr>
                        <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">No. Kontrak</th>
                        <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Paket</th>
                        <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Nilai</th>
                        <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Status</th>
                        <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Tanggal</th>
                        <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Aksi</th>
                    </tr>
                </thead>
                <tbody class="divide-y divide-gray-200">
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__empty_1 = true; $__currentLoopData = $contracts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $contract): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoopIteration(); ?><?php endif; ?>
                        <tr class="hover:bg-gray-50 transition">
                            <td class="px-6 py-4 text-sm text-gray-900 font-medium"><?php echo e($contract->contract_number); ?></td>
                            <td class="px-6 py-4 text-sm text-gray-900"><?php echo e($contract->jobPackage->name ?? '-'); ?></td>
                            <td class="px-6 py-4 text-sm text-gray-900">Rp <?php echo e(number_format($contract->value, 0, ',', '.')); ?></td>
                            <td class="px-6 py-4">
                                <span class="px-2 py-1 text-xs rounded-full 
                                    <?php echo e($contract->status === 'completed' ? 'bg-green-100 text-green-700' : 
                                       ($contract->status === 'signed' ? 'bg-blue-100 text-blue-700' : 
                                       ($contract->status === 'execution' ? 'bg-purple-100 text-purple-700' : 
                                       ($contract->status === 'draft' ? 'bg-gray-100 text-gray-700' : 
                                       'bg-yellow-100 text-yellow-700')))); ?>">
                                    <?php echo e(ucfirst($contract->status)); ?>

                                </span>
                            </td>
                            <td class="px-6 py-4 text-sm text-gray-900"><?php echo e($contract->created_at->format('d/m/Y')); ?></td>
                            <td class="px-6 py-4">
                                <a href="<?php echo e(route('super_admin.contracts.show', $contract)); ?>" class="text-blue-600 hover:text-blue-800">
                                    <i class="fas fa-eye"></i>
                                </a>
                            </td>
                        </tr>
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::endLoop(); ?><?php endif; ?><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::closeLoop(); ?><?php endif; ?>
                        <tr>
                            <td colspan="6" class="px-6 py-8 text-center text-gray-500">
                                <i class="fas fa-file-signature text-4xl block mb-2 text-gray-300"></i>
                                Belum ada kontrak
                            </td>
                        </tr>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                </tbody>
            </table>
        </div>
    </div>
<?php else: ?>
    <div class="bg-white p-8 rounded-2xl shadow-sm text-center">
        <i class="fas fa-user-circle text-6xl text-gray-300 mb-4"></i>
        <h3 class="text-xl font-semibold text-gray-700">Profil Belum Lengkap</h3>
        <p class="text-gray-500 mt-2">Silakan lengkapi profil kontraktor Anda terlebih dahulu</p>
        <a href="<?php echo e(route('super_admin.profile')); ?>" class="mt-4 inline-block bg-[#c9a84c] text-white px-6 py-2 rounded-lg hover:bg-[#b8962a] transition">
            <i class="fas fa-edit mr-2"></i> Lengkapi Profil
        </a>
    </div>
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\laragon\www\tunjuk-i-backend\resources\views/contractor/my-contracts.blade.php ENDPATH**/ ?>