<?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 $__env->slot('heading', null, []); ?> Health & Mortality <?php $__env->endSlot(); ?>

    <?php if (isset($component)) { $__componentOriginalf8d4ea307ab1e58d4e472a43c8548d8e = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalf8d4ea307ab1e58d4e472a43c8548d8e = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.page-header','data' => ['title' => 'Health & Mortality','description' => 'Track disease incidents, treatments, and fish deaths.']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('page-header'); ?>
<?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' => 'Health & Mortality','description' => 'Track disease incidents, treatments, and fish deaths.']); ?>
         <?php $__env->slot('actions', null, []); ?> 
            <a href="<?php echo e(route('health.mortality.create')); ?>"
               class="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-4 py-2 text-sm font-semibold text-gray-700 hover:bg-gray-50">
                Log Mortality
            </a>
            <a href="<?php echo e(route('health.treatment.create')); ?>"
               class="inline-flex items-center gap-2 rounded-lg bg-primary-600 px-4 py-2 text-sm font-semibold text-white hover:bg-primary-700">
                Log Treatment
            </a>
         <?php $__env->endSlot(); ?>
     <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalf8d4ea307ab1e58d4e472a43c8548d8e)): ?>
<?php $attributes = $__attributesOriginalf8d4ea307ab1e58d4e472a43c8548d8e; ?>
<?php unset($__attributesOriginalf8d4ea307ab1e58d4e472a43c8548d8e); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalf8d4ea307ab1e58d4e472a43c8548d8e)): ?>
<?php $component = $__componentOriginalf8d4ea307ab1e58d4e472a43c8548d8e; ?>
<?php unset($__componentOriginalf8d4ea307ab1e58d4e472a43c8548d8e); ?>
<?php endif; ?>

    <!-- Active withdrawal period alert -->
    <?php if($activeWithdrawals->isNotEmpty()): ?>
    <div class="mb-5 rounded-xl border border-red-200 bg-red-50 p-4">
        <p class="font-semibold text-red-800 mb-2">⚠️ Active Withdrawal Periods — Harvest Blocked</p>
        <div class="space-y-1">
            <?php $__currentLoopData = $activeWithdrawals; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $w): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <p class="text-sm text-red-700">
                <a href="<?php echo e(route('ponds.show', $w->pond)); ?>" class="font-medium underline"><?php echo e($w->pond->name); ?></a>
                — <?php echo e($w->drug_chemical_name); ?> — Safe to harvest after:
                <strong><?php echo e($w->harvest_safe_after->format('d M Y')); ?></strong>
            </p>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </div>
    </div>
    <?php endif; ?>

    <!-- Filters -->
    <form method="GET" class="mb-4 flex flex-wrap gap-3">
        <select name="pond_id" class="rounded-lg border-gray-200 text-sm shadow-sm focus:border-primary-500 focus:ring-primary-500">
            <option value="">All ponds</option>
            <?php $__currentLoopData = $ponds; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $p): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <option value="<?php echo e($p->id); ?>" <?php if(request('pond_id') == $p->id): echo 'selected'; endif; ?>><?php echo e($p->name); ?></option>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </select>
        <button type="submit" class="rounded-lg bg-gray-100 px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-200">Filter</button>
    </form>

    <div class="grid grid-cols-1 gap-6 lg:grid-cols-2">

        <!-- Mortality logs -->
        <div>
            <h3 class="mb-3 font-semibold text-gray-900">Mortality Logs</h3>
            <?php if($mortalityLogs->isEmpty()): ?>
                <p class="text-sm text-gray-400">No mortality records.</p>
            <?php else: ?>
            <div class="rounded-xl border border-gray-100 bg-white shadow-sm overflow-hidden">
                <table class="w-full text-sm">
                    <thead class="bg-gray-50 text-xs uppercase tracking-wider text-gray-500">
                        <tr>
                            <th class="px-4 py-3 text-left">Date</th>
                            <th class="px-4 py-3 text-left">Pond</th>
                            <th class="px-4 py-3 text-right">Dead</th>
                            <th class="px-4 py-3 text-left">Cause</th>
                        </tr>
                    </thead>
                    <tbody class="divide-y divide-gray-50">
                        <?php $__currentLoopData = $mortalityLogs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $m): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr class="hover:bg-gray-50">
                            <td class="px-4 py-3 whitespace-nowrap font-medium text-gray-900"><?php echo e($m->log_date->format('d M Y')); ?></td>
                            <td class="px-4 py-3">
                                <a href="<?php echo e(route('ponds.show', $m->pond)); ?>" class="text-primary-600 hover:underline"><?php echo e($m->pond->name); ?></a>
                            </td>
                            <td class="px-4 py-3 text-right font-bold text-red-600"><?php echo e(number_format($m->dead_count)); ?></td>
                            <td class="px-4 py-3 text-gray-600 capitalize text-xs"><?php echo e(str_replace('_',' ',$m->probable_cause ?? '—')); ?></td>
                        </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </tbody>
                </table>
            </div>
            <div class="mt-3"><?php echo e($mortalityLogs->links()); ?></div>
            <?php endif; ?>
        </div>

        <!-- Treatment logs -->
        <div>
            <h3 class="mb-3 font-semibold text-gray-900">Treatment Logs</h3>
            <?php if($treatmentLogs->isEmpty()): ?>
                <p class="text-sm text-gray-400">No treatment records.</p>
            <?php else: ?>
            <div class="rounded-xl border border-gray-100 bg-white shadow-sm overflow-hidden">
                <table class="w-full text-sm">
                    <thead class="bg-gray-50 text-xs uppercase tracking-wider text-gray-500">
                        <tr>
                            <th class="px-4 py-3 text-left">Date</th>
                            <th class="px-4 py-3 text-left">Pond</th>
                            <th class="px-4 py-3 text-left">Drug</th>
                            <th class="px-4 py-3 text-center">Withdrawal</th>
                        </tr>
                    </thead>
                    <tbody class="divide-y divide-gray-50">
                        <?php $__currentLoopData = $treatmentLogs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $t): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr class="hover:bg-gray-50">
                            <td class="px-4 py-3 whitespace-nowrap font-medium text-gray-900"><?php echo e($t->treatment_date->format('d M Y')); ?></td>
                            <td class="px-4 py-3">
                                <a href="<?php echo e(route('ponds.show', $t->pond)); ?>" class="text-primary-600 hover:underline"><?php echo e($t->pond->name); ?></a>
                            </td>
                            <td class="px-4 py-3 text-gray-900 text-xs"><?php echo e($t->drug_chemical_name); ?></td>
                            <td class="px-4 py-3 text-center">
                                <?php if($t->isWithdrawalActive()): ?>
                                    <?php if (isset($component)) { $__componentOriginal8c81617a70e11bcf247c4db924ab1b62 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal8c81617a70e11bcf247c4db924ab1b62 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.status-badge','data' => ['status' => 'danger','size' => 'xs']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('status-badge'); ?>
<?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(['status' => 'danger','size' => 'xs']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal8c81617a70e11bcf247c4db924ab1b62)): ?>
<?php $attributes = $__attributesOriginal8c81617a70e11bcf247c4db924ab1b62; ?>
<?php unset($__attributesOriginal8c81617a70e11bcf247c4db924ab1b62); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal8c81617a70e11bcf247c4db924ab1b62)): ?>
<?php $component = $__componentOriginal8c81617a70e11bcf247c4db924ab1b62; ?>
<?php unset($__componentOriginal8c81617a70e11bcf247c4db924ab1b62); ?>
<?php endif; ?>
                                    <p class="text-xs text-red-600 mt-0.5"><?php echo e($t->harvest_safe_after->format('d M')); ?></p>
                                <?php elseif($t->harvest_safe_after): ?>
                                    <span class="text-xs text-green-600">Cleared</span>
                                <?php else: ?>
                                    <span class="text-xs text-gray-400">—</span>
                                <?php endif; ?>
                            </td>
                        </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </tbody>
                </table>
            </div>
            <div class="mt-3"><?php echo e($treatmentLogs->links()); ?></div>
            <?php endif; ?>
        </div>

    </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 C:\laragon\www\farm\resources\views\health\index.blade.php ENDPATH**/ ?>