<?php
if (Auth('admin')->User()->dashboard_style == 'light') {
    $text = 'dark';
} else {
    $text = 'light';
}
?>

<?php $__env->startSection('content'); ?>
    <?php echo $__env->make('admin.topmenu', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    <?php echo $__env->make('admin.sidebar', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    <div class="main-panel">
        <div class="content ">
            <div class="page-inner">
                <div class="mt-2 mb-4">
                    <h1 class="title1 "><?php echo e($title); ?></h1>
                </div>
                <?php if (isset($component)) { $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4 = $component; } ?>
<?php $component = $__env->getContainer()->make(Illuminate\View\AnonymousComponent::class, ['view' => 'components.danger-alert','data' => []]); ?>
<?php $component->withName('danger-alert'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4)): ?>
<?php $component = $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4; ?>
<?php unset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4); ?>
<?php endif; ?>

                <?php if(session('success')): ?>
                    <div class="alert alert-success">
                        <?php echo e(session('success')); ?>

                    </div>
                <?php endif; ?>

                <div class="mb-3">
                    <a href="<?php echo e(route('admin.personnel.create')); ?>" class="btn btn-primary">
                        <i class="fa fa-plus"></i> Add New Personnel
                    </a>
                </div>

                <div class="mb-5 row">
                    <div class="col card p-3 shadow ">
                        <div class="bs-example widget-shadow table-responsive" data-example-id="hoverable-table">
                            <span style="margin:3px;">
                                <table id="ShipTable" class="table table-hover ">
                                    <thead>
                                        <tr>
                                            <th>Service Number</th>
                                            <th>Full Name</th>
                                            <th>Email</th>
                                            <th>Rank</th>
                                            <th>Unit</th>
                                            <th>MOS</th>
                                            <th>Status</th>
                                            <th>Date Created</th>
                                            <th>View</th>
                                            <th>Edit</th>
                                            <th>Delete</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php $__empty_1 = true; $__currentLoopData = $personnel; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $person): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                            <tr>
                                                <td><?php echo e($person->service_number); ?></td>
                                                <td><?php echo e($person->full_name); ?></td>
                                                <td><?php echo e($person->email); ?></td>
                                                <td><?php echo e($person->rank); ?></td>
                                                <td><?php echo e($person->unit); ?></td>
                                                <td><?php echo e($person->mos); ?></td>
                                                <td>
                                                    <?php if($person->status === 'Active Duty'): ?>
                                                        <span class="badge badge-success"><?php echo e($person->status); ?></span>
                                                    <?php elseif($person->status === 'Reserve' || $person->status === 'National Guard'): ?>
                                                        <span class="badge badge-warning"><?php echo e($person->status); ?></span>
                                                    <?php elseif($person->status === 'Retired'): ?>
                                                        <span class="badge badge-info"><?php echo e($person->status); ?></span>
                                                    <?php else: ?>
                                                        <span class="badge badge-secondary"><?php echo e($person->status); ?></span>
                                                    <?php endif; ?>
                                                </td>
                                                <td><?php echo e(\Carbon\Carbon::parse($person->created_at)->toDayDateTimeString()); ?></td>
                                                <td>
                                                    <a href="<?php echo e(route('admin.personnel.show', $person->id)); ?>"
                                                        class="m-1 btn btn-info btn-sm"><i class="fa fa-eye"></i> View</a>
                                                </td>
                                                <td>
                                                    <a href="<?php echo e(route('admin.personnel.edit', $person->id)); ?>"
                                                        class="m-1 btn btn-warning btn-sm"><i class="fa fa-edit"></i> Edit</a>
                                                </td>
                                                <td>
                                                    <form action="<?php echo e(route('admin.personnel.destroy', $person->id)); ?>" method="POST" style="display: inline-block;">
                                                        <?php echo csrf_field(); ?>
                                                        <?php echo method_field('DELETE'); ?>
                                                        <button type="submit" class="m-1 btn btn-danger btn-sm"
                                                                onclick="return confirm('Are you sure you want to delete this personnel record?')">
                                                            <i class="fa fa-trash"></i> Delete
                                                        </button>
                                                    </form>
                                                </td>
                                            </tr>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                            <tr>
                                                <td colspan="11" class="text-center">
                                                    <div class="alert alert-info">
                                                        No personnel records found.
                                                        <a href="<?php echo e(route('admin.personnel.create')); ?>" class="btn btn-primary btn-sm">
                                                            Add the first personnel record
                                                        </a>
                                                    </div>
                                                </td>
                                            </tr>
                                        <?php endif; ?>
                                    </tbody>
                                </table>
                            </span>
                        </div>

                        <?php if($personnel->hasPages()): ?>
                            <div class="mt-3">
                                <?php echo e($personnel->links()); ?>

                            </div>
                        <?php endif; ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\milit\resources\views/admin/personnel/index.blade.php ENDPATH**/ ?>