<?php $__env->startSection('title', 'Görev Arşivi'); ?>
<?php $__env->startSection('page_title', 'Görev Arşivi'); ?>

<?php
    $breadcrumbs = [
        ['title' => 'Dashboard', 'url' => route('agency.dashboard')],
        ['title' => 'Görevler', 'url' => route('agency.tasks.index')],
        ['title' => 'Arşiv', 'url' => ''],
    ];

    $dtColumns = [
        ['key' => 'title', 'label' => 'Görev', 'sortable' => false],
        ['key' => 'assignees', 'label' => 'Atananlar'],
        ['key' => 'status', 'label' => 'Durum', 'align' => 'center', 'width' => '120px'],
        ['key' => 'archived_at', 'label' => 'Arşivlenme', 'width' => '170px'],
        ['key' => 'archived_by', 'label' => 'Arşivleyen', 'width' => '160px'],
        ['key' => '_actions', 'label' => '', 'fixed' => true, 'align' => 'end', 'width' => '90px'],
    ];
?>

<?php $__env->startSection('content'); ?>
<div class="tka-page">
    <?php if (isset($component)) { $__componentOriginalc8463834ba515134d5c98b88e1a9dc03 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalc8463834ba515134d5c98b88e1a9dc03 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.data-table','data' => ['module' => 'tasks-archive','title' => 'Görev Arşivi','subtitle' => 'Arşive alınan görevler — dilediğinizde geri alabilirsiniz','icon' => 'fa-box-archive','columns' => $dtColumns,'search' => request('search', ''),'searchPlaceholder' => 'Arşivde ara…','paginator' => $tasks,'perPageOptions' => [10, 25, 50, 100]]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('data-table'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['module' => 'tasks-archive','title' => 'Görev Arşivi','subtitle' => 'Arşive alınan görevler — dilediğinizde geri alabilirsiniz','icon' => 'fa-box-archive','columns' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($dtColumns),'search' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(request('search', '')),'search-placeholder' => 'Arşivde ara…','paginator' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($tasks),'per-page-options' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute([10, 25, 50, 100])]); ?>

         <?php $__env->slot('headerActions', null, []); ?> 
            <a href="<?php echo e(route('agency.tasks.index')); ?>" class="tka-back">
                <i class="fas fa-arrow-left"></i> Görevlere Dön
            </a>
         <?php $__env->endSlot(); ?>

        <?php $__empty_1 = true; $__currentLoopData = $tasks; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $task): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
            <tr data-quickview-url="<?php echo e(route('agency.tasks.quick-view', $task)); ?>" style="cursor:pointer">
                <td data-col="title">
                    <div class="dt-cell-main d-flex align-items-center gap-2">
                        <?php if($task->is_auto): ?>
                            <i class="fas fa-robot" style="color:#7c3aed; font-size:.75rem;" title="Sistem tarafından oluşturuldu"></i>
                        <?php endif; ?>
                        <span><?php echo e(\Illuminate\Support\Str::limit($task->title, 70)); ?></span>
                    </div>
                    <?php if($task->description): ?>
                        <div class="dt-cell-sub"><?php echo e(\Illuminate\Support\Str::limit($task->description, 80)); ?></div>
                    <?php endif; ?>
                </td>
                <td data-col="assignees">
                    <div class="tk-people">
                        <?php $__currentLoopData = $task->assignees->take(3); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <span class="tk-person"><span class="tk-avatar"><?php echo e($user->initials); ?></span><?php echo e($user->full_name); ?></span>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        <?php if($task->assignees->count() > 3): ?>
                            <span class="tk-person more">+<?php echo e($task->assignees->count() - 3); ?></span>
                        <?php endif; ?>
                    </div>
                </td>
                <td data-col="status" class="text-center">
                    <span class="tk-badge" style="background: <?php echo e($task->statusMeta()['color']); ?>18; color: <?php echo e($task->statusMeta()['color']); ?>;">
                        <?php echo e($task->statusMeta()['label']); ?>

                    </span>
                </td>
                <td data-col="archived_at">
                    <span class="dt-cell-sub"><?php echo e($task->archived_at?->translatedFormat('d M Y, H:i')); ?></span>
                </td>
                <td data-col="archived_by">
                    <span class="dt-cell-sub"><?php echo e($task->archiver?->full_name ?? '—'); ?></span>
                </td>
                <td data-col="_actions" class="text-end">
                    <div class="dt-rowact">
                        <?php if($canAssign || $task->created_by === auth()->id()): ?>
                            <button type="button" class="dt-iconbtn success" title="Arşivden Çıkar"
                                    onclick="event.stopPropagation(); tkaUnarchive(<?php echo e($task->id); ?>, this)">
                                <i class="fas fa-rotate-left"></i>
                            </button>
                        <?php endif; ?>
                    </div>
                </td>
            </tr>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
            <tr>
                <td colspan="100">
                    <div class="dt-empty">
                        <i class="fas fa-box-open"></i>
                        <h4>Arşiv boş</h4>
                        <p>Arşive alınan görevler burada listelenir.</p>
                    </div>
                </td>
            </tr>
        <?php endif; ?>
     <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalc8463834ba515134d5c98b88e1a9dc03)): ?>
<?php $attributes = $__attributesOriginalc8463834ba515134d5c98b88e1a9dc03; ?>
<?php unset($__attributesOriginalc8463834ba515134d5c98b88e1a9dc03); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc8463834ba515134d5c98b88e1a9dc03)): ?>
<?php $component = $__componentOriginalc8463834ba515134d5c98b88e1a9dc03; ?>
<?php unset($__componentOriginalc8463834ba515134d5c98b88e1a9dc03); ?>
<?php endif; ?>
</div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('styles'); ?>
<style>
    .tka-back {
        display: inline-flex; align-items: center; gap: .45rem; text-decoration: none;
        border: 1px solid #e2e8f0; background: #fff; color: #64748b;
        font-weight: 800; font-size: .8rem; padding: .5rem .85rem; border-radius: 11px; transition: all .15s ease;
    }
    .tka-back:hover { border-color: #cbd5e1; color: #334155; background: #f8fafc; }

    /* Ortak görev rozet/kişi stilleri (arşiv sayfası bağımsız yüklenir) */
    .tk-badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .68rem; font-weight: 800; padding: .18rem .55rem; border-radius: 999px; letter-spacing: .02em; }
    .tk-people { display: flex; flex-wrap: wrap; gap: .3rem; }
    .tk-person {
        display: inline-flex; align-items: center; gap: .38rem; max-width: 100%;
        font-size: .72rem; font-weight: 700; color: #475569;
        background: #f8fafc; border: 1px solid #eef1f6; border-radius: 999px;
        padding: .13rem .6rem .13rem .16rem; white-space: nowrap;
    }
    .tk-person .tk-avatar {
        width: 20px; height: 20px; border-radius: 50%; background: #e2e8f0; color: #475569;
        font-size: .54rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center;
    }
    .tk-person.more { padding: .13rem .6rem; color: #92400e; background: #fef3c7; border-color: #fde68a; }
</style>
<?php $__env->stopPush(); ?>

<?php $__env->startPush('scripts'); ?>
<script>
    function tkaUnarchive(id, btn) {
        btn.disabled = true;
        fetch(`<?php echo e(url('agency/tasks')); ?>/${id}/unarchive`, {
            method: 'POST',
            headers: {
                'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content,
                'X-Requested-With': 'XMLHttpRequest',
                'Accept': 'application/json'
            }
        }).then(r => {
            if (!r.ok) throw new Error();
            location.reload();
        }).catch(() => { btn.disabled = false; alert('Görev arşivden çıkarılamadı.'); });
    }
</script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('agency.layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\acente\resources\views/agency/tasks/archive.blade.php ENDPATH**/ ?>