<?php if (isset($component)) { $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54 = $attributes; } ?>
<?php $component = App\View\Components\AppLayout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('app-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\AppLayout::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
    <?php if (isset($component)) { $__componentOriginal80ffb5bf12f57d81844c4bbf89dbe34a = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal80ffb5bf12f57d81844c4bbf89dbe34a = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.module-hero','data' => ['title' => 'Leadership History','description' => 'View past leaders and their achievements','icon' => 'fa-history']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('module-hero'); ?>
<?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(['title' => 'Leadership History','description' => 'View past leaders and their achievements','icon' => 'fa-history']); ?>

         <?php $__env->slot('tabs', null, []); ?> 
            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('view organizations')): ?><a href="<?php echo e(route('organization.details.index')); ?>" class="module-hero-tab <?php echo e(request()->routeIs('organization.details.*') ? 'active-tab' : ''); ?>"><i class="fas fa-building"></i> Organizations</a><?php endif; ?>
            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('view leadership positions')): ?><a href="<?php echo e(route('organization.leadership-positions.index')); ?>" class="module-hero-tab <?php echo e(request()->routeIs('organization.leadership-positions.*') ? 'active-tab' : ''); ?>"><i class="fas fa-sitemap"></i> Leadership Positions</a><?php endif; ?>
            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('view leadership history')): ?><a href="<?php echo e(route('organization.leadership-history.index')); ?>" class="module-hero-tab <?php echo e(request()->routeIs('organization.leadership-history.*') ? 'active-tab' : ''); ?>"><i class="fas fa-history"></i> Leadership History</a><?php endif; ?>
            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('view staff history')): ?><a href="<?php echo e(route('organization.staff-history.index')); ?>" class="module-hero-tab <?php echo e(request()->routeIs('organization.staff-history.*') ? 'active-tab' : ''); ?>"><i class="fas fa-user-tie"></i> Staff History</a><?php endif; ?>
            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('view election cycles')): ?><a href="<?php echo e(route('organization.election-cycles.index')); ?>" class="module-hero-tab <?php echo e(request()->routeIs('organization.election-cycles.*') ? 'active-tab' : ''); ?>"><i class="fas fa-calendar-alt"></i> Election Cycles</a><?php endif; ?>
            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('view voting procedures')): ?><a href="<?php echo e(route('organization.voting-procedures.index')); ?>" class="module-hero-tab <?php echo e(request()->routeIs('organization.voting-procedures.*') ? 'active-tab' : ''); ?>"><i class="fas fa-vote-yea"></i> Voting Procedures</a><?php endif; ?>
            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('view organogram')): ?><a href="<?php echo e(route('organization.organogram.show')); ?>" class="module-hero-tab <?php echo e(request()->routeIs('organization.organogram.*') ? 'active-tab' : ''); ?>"><i class="fas fa-project-diagram"></i> Organogram</a><?php endif; ?>
         <?php $__env->endSlot(); ?>
     <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal80ffb5bf12f57d81844c4bbf89dbe34a)): ?>
<?php $attributes = $__attributesOriginal80ffb5bf12f57d81844c4bbf89dbe34a; ?>
<?php unset($__attributesOriginal80ffb5bf12f57d81844c4bbf89dbe34a); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal80ffb5bf12f57d81844c4bbf89dbe34a)): ?>
<?php $component = $__componentOriginal80ffb5bf12f57d81844c4bbf89dbe34a; ?>
<?php unset($__componentOriginal80ffb5bf12f57d81844c4bbf89dbe34a); ?>
<?php endif; ?>

    
    <?php if(session('success')): ?>
    <div class="px-6 pt-4">
        <div class="p-4 bg-green-100 border border-green-400 text-green-700 rounded-lg flex items-center gap-2">
            <i class="fas fa-check-circle"></i><?php echo e(session('success')); ?>

        </div>
    </div>
    <?php endif; ?>
    <?php if(session('error')): ?>
    <div class="px-6 pt-4">
        <div class="p-4 bg-red-100 border border-red-400 text-red-700 rounded-lg flex items-center gap-2">
            <i class="fas fa-exclamation-circle"></i><?php echo e(session('error')); ?>

        </div>
    </div>
    <?php endif; ?>

    
    <div class="px-6 pt-4 pb-2 bg-white border-b border-gray-200">
        <form method="GET" class="flex flex-wrap items-end gap-4">
            <div class="flex-1 min-w-[180px]">
                <label class="block text-sm font-medium text-gray-700 mb-1">Search</label>
                <input type="text" name="search" value="<?php echo e(request('search')); ?>"
                    placeholder="Name or position..."
                    class="w-full px-4 py-2 border border-gray-300 rounded-lg bg-white text-gray-800 focus:ring-2 focus:ring-green-500 focus:border-transparent">
            </div>
            <div class="flex-1 min-w-[180px]">
                <label class="block text-sm font-medium text-gray-700 mb-1">Organization</label>
                <select name="organization_id" class="w-full px-4 py-2 border border-gray-300 rounded-lg bg-white text-gray-800 focus:ring-2 focus:ring-green-500 focus:border-transparent">
                    <option value="">All Organizations</option>
                    <?php $__currentLoopData = $organizations; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $org): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <option value="<?php echo e($org->id); ?>" <?php echo e(request('organization_id') == $org->id ? 'selected' : ''); ?>><?php echo e($org->name); ?></option>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </select>
            </div>
            <div class="flex-1 min-w-[180px]">
                <label class="block text-sm font-medium text-gray-700 mb-1">Position</label>
                <select name="position_id" class="w-full px-4 py-2 border border-gray-300 rounded-lg bg-white text-gray-800 focus:ring-2 focus:ring-green-500 focus:border-transparent">
                    <option value="">All Positions</option>
                    <?php $__currentLoopData = $positions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $pos): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <option value="<?php echo e($pos->id); ?>" <?php echo e(request('position_id') == $pos->id ? 'selected' : ''); ?>><?php echo e($pos->title); ?></option>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </select>
            </div>
            <div class="flex items-end gap-2">
                <button type="submit" class="px-4 py-2 bg-green-700 text-white rounded-lg hover:bg-green-800 transition text-sm font-medium">
                    <i class="fas fa-search mr-1"></i>Filter
                </button>
                <a href="<?php echo e(route('organization.leadership-history.index')); ?>" class="px-4 py-2 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300 transition text-sm font-medium">
                    <i class="fas fa-times mr-1"></i>Reset
                </a>
            </div>
        </form>
    </div>

    
    <div class="w-full">
        <?php if($histories->count() > 0): ?>
        <div class="overflow-x-auto">
            <table class="w-full table-zebra">
                <thead>
                    <tr>
                        <th class="px-4 py-3 text-left th-col-1">Leader</th>
                        <th class="px-4 py-3 text-left th-col-2">Position</th>
                        <th class="px-4 py-3 text-left th-col-3">Organization</th>
                        <th class="px-4 py-3 text-left th-col-4">Term Period</th>
                        <th class="px-4 py-3 text-center th-col-5">Achievements</th>
                        <th class="px-4 py-3 text-center th-col-6">Actions</th>
                    </tr>
                </thead>
                <tbody>
                    <?php $__currentLoopData = $histories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $history): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <tr>
                        <td class="px-4 py-3">
                            <div class="flex items-center gap-3">
                                <div class="w-9 h-9 bg-indigo-100 rounded-full flex items-center justify-center shrink-0">
                                    <i class="fas fa-user text-indigo-600 text-sm"></i>
                                </div>
                                <div class="font-semibold text-gray-800"><?php echo e($history->user?->name ?? $history->leader_name ?? '—'); ?></div>
                            </div>
                        </td>
                        <td class="px-4 py-3 text-sm text-gray-700"><?php echo e($history->position_title); ?></td>
                        <td class="px-4 py-3 text-sm text-gray-700"><?php echo e($history->organization->name); ?></td>
                        <td class="px-4 py-3 text-sm text-gray-700">
                            <div><?php echo e($history->term_start_date->format('M d, Y')); ?></div>
                            <div class="text-xs text-gray-500">to <?php echo e($history->term_end_date->format('M d, Y')); ?></div>
                            <div class="text-xs text-green-600 mt-0.5"><?php echo e($history->term_duration); ?></div>
                        </td>
                        <td class="px-4 py-3 text-center">
                            <span class="px-2 py-0.5 bg-yellow-100 text-yellow-800 rounded text-xs font-semibold">
                                <?php echo e($history->achievements_count); ?> achievements
                            </span>
                        </td>
                        <td class="px-4 py-3 text-center">
                            <div class="flex justify-center gap-1">
                                <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('view leadership history')): ?>
                                <a href="<?php echo e(route('organization.leadership-history.show', $history)); ?>" class="btn-action-view">
                                    <i class="fas fa-eye"></i> View
                                </a>
                                <?php endif; ?>
                            </div>
                        </td>
                    </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </tbody>
            </table>
        </div>
        <div class="px-4 py-3 border-t border-gray-200 bg-white">
            <?php echo e($histories->links()); ?>

        </div>
        <?php else: ?>
        <div class="p-6">
            <div class="text-center py-12">
                <i class="fas fa-history text-6xl text-gray-300 mb-4"></i>
                <h3 class="text-xl font-semibold text-gray-700 mb-2">No Leadership History Found</h3>
                <p class="text-gray-500">History records are created automatically when leadership assignments end.</p>
            </div>
        </div>
        <?php endif; ?>
    </div>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $attributes = $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $component = $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php /**PATH /home/www/sshia.org/sshia/resources/views/organization/leadership-history/index.blade.php ENDPATH**/ ?>