
<?php $__env->startSection('title','Alert Action'); ?>
<?php $__env->startPush('styles'); ?>
    <style>
        .action-view {
            height: 402px;
            overflow-y: scroll;
            padding: 0px;
        }

        .card-header {
            background: #EAECF0;
            align-items: center;
            height: 60px;
        }

        table tr td a {
            color: #1C274D;
        }

        table th, table td {
            border-color: #EAECF0;
        }

        .action-view {
            scrollbar-width: auto;
            scrollbar-color: #fff #CCCED2;
        }

        .action-view::-webkit-scrollbar {
            width: 8px;
        }

        .action-view::-webkit-scrollbar-track {
            background: #CCCED2;
        }

        .action-view::-webkit-scrollbar-thumb {
            background-color: #fff;
            border-radius: 5px;
            border: 2px solid #CCCED2;
        }

        .card-body table tr td, .card-body table tr th {
            font-size: 0.8vw;
        }

        .view_details {
            cursor: pointer;
        }
    </style>
<?php $__env->stopPush(); ?>
<?php $__env->startSection('content'); ?>
    <h2 class="mb-3 card-title"><?php echo e(__('messages.alert_action')); ?> <?php echo e(__('messages.list')); ?></h2>
    <div class="card-body">
        <div class="row">
            <div class="col-md-4 mt-4 ">
                <div class="card  pb-3">
                    <div class="card-header d-flex justify-content-between">
                        <h5 class="title_name"> <?php echo e(__('messages.first_heat_age_cattle')); ?> (<?php echo e(config('perameters.first_heat_age')); ?>

                            <?php echo e(__('messages.months')); ?>)</h5>
                        <button class="btn btn-light border" onclick="printDiv('firstHeatPdf')" type="button"><i
                                class="print-ico"></i></button>
                    </div>
                    <div class="card-body action-view " id="firstHeatPdf">
                        <table class="table table-bordered w-100">
                            <?php $__currentLoopData = $firstHeatAgeCattle; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <td>
                                        <a data-url="<?php echo e(route('ai.create',["tag"=>$item->id])); ?>" class="view_details">
                                            <?php echo e($item->tag->uid); ?>

                                        </a>
                                    </td>
                                    <td>
                                        <a href="javascript: void(0);">
                                            <?php echo e($item->expected_ai_date); ?>

                                        </a>
                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </table>
                    </div>
                </div>
            </div>
            <div class="col-md-4 mt-4 ">
                <div class="card  pb-3">
                    <div class="card-header d-flex justify-content-between">
                        <h5 class="title_name"> <?php echo e(__('messages.fertility_problem_cattle')); ?> ( <?php echo e(config('perameters.fertility_problem')); ?>

                            <?php echo e(__('messages.fails')); ?>)</h5>
                        <button class="btn btn-light border" onclick="printDiv('fertilityPdf')" type="button"><i
                                class="print-ico"></i></button>
                    </div>
                    <div class="card-body action-view " id="fertilityPdf">
                        <table class="table table-bordered w-100">
                            <?php $__currentLoopData = $fertilityProblemCattle; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php if($item->hasFertilityProblem): ?>
                                    <tr>
                                        <td>
                                            <a href="#">
                                                <?php echo e($item->tag->uid); ?>

                                            </a>
                                        </td>
                                    </tr>
                                <?php endif; ?>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </table>
                    </div>
                </div>
            </div>
            <div class="col-md-4 mt-4 ">
                <div class="card  pb-3">
                    <div class="card-header d-flex justify-content-between">
                        <h5 class="title_name"><?php echo e(__('messages.low_milk_yield_cattle')); ?> (< <?php echo e(config('perameters.milk_yield')); ?>L
                            <?php echo e(__('messages.in').' 100'. __('messages.days')); ?>)</h5>
                        <button class="btn btn-light border" onclick="printDiv('milkYieldPdf')" type="button"><i
                                class="print-ico"></i></button>
                    </div>
                    <div class="card-body action-view " id="milkYieldPdf">
                        <table class="table table-bordered w-100">
                            <?php $__currentLoopData = $milkYieldCattles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php $milkYeild = config('perameters.milk_yield');  ?>
                                <?php if($item['grand_milk'] < $milkYeild): ?>
                                    <tr>
                                        <td>
                                            <a href="javascript: void(0);">
                                                <?php echo e($item['tag']['uid']); ?>

                                            </a>
                                        </td>
                                        <td>
                                            <a href="javascript: void(0);">
                                                <?php echo e($item['grand_milk']); ?>L
                                            </a>
                                        </td>
                                    </tr>
                                <?php endif; ?>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </table>
                    </div>
                </div>
            </div>
            <div class="col-md-4 mt-4 ">
                <div class="card  pb-3">
                    <div class="card-header d-flex justify-content-between">
                        <h5 class="title_name"><?php echo e(__('messages.low_milk_yield_cattle')); ?>( < <?php echo e(config('perameters.lactation_yield')); ?>L <?php echo e(__('messages.in').' ' .__('messages.a').' '. __('messages.calving_period')); ?>)</h5>
                        <button class="btn btn-light border" onclick="printDiv('lacYieldPdf')" type="button"><i
                                class="print-ico"></i></button>
                    </div>
                    <div class="card-body action-view " id="lacYieldPdf">
                        <table class="table table-bordered w-100">
                            <?php $__currentLoopData = $lowLactionCattles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php if($item->totalMilkInPeriod < config('perameters.lactation_yield')): ?>
                                    <tr>
                                        <td>
                                            <a href="javascript: void(0);">
                                                <?php echo e($item->tag->uid); ?>

                                            </a>
                                        </td>
                                        <td>
                                            <a href="javascript: void(0);">
                                                <?php echo e($item->totalMilkInPeriod); ?>L
                                            </a>
                                        </td>
                                    </tr>
                                <?php endif; ?>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </table>
                    </div>
                </div>
            </div>
            <div class="col-md-4 mt-4 ">
                <div class="card  pb-3">
                    <div class="card-header d-flex justify-content-between">
                        <h5 class="title_name"><?php echo e(__('messages.low_lactation_length_cattle')); ?>( < <?php echo e(config('perameters.lactation_length')); ?> <?php echo e(__('messages.days_in_a_calving_period')); ?>)</h5>
                        <button class="btn btn-light border" onclick="printDiv('lacLengthPdf')" type="button"><i
                                class="print-ico"></i></button>
                    </div>
                    <div class="card-body action-view " id="lacLengthPdf">
                        <table class="table table-bordered w-100">
                            <?php $__currentLoopData = $lowLactationLengthCattle; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php if($item->calving_interval < config('perameters.lactation_length')): ?>
                                    <tr>
                                        <td>
                                            <a href="javascript: void(0);">
                                                <?php echo e($item->tag->uid); ?>

                                            </a>
                                        </td>
                                        <td>
                                            <a href="javascript: void(0);">
                                                <?php echo e($item->calving_interval); ?> <?php echo e(__('messages.days')); ?>

                                            </a>
                                        </td>
                                    </tr>
                                <?php endif; ?>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </table>
                    </div>
                </div>
            </div>
            <div class="col-md-4 mt-4 ">
                <div class="card  pb-3">
                    <div class="card-header d-flex justify-content-between">
                        <h5 class="title_name"><?php echo e(__('messages.amr_alert')); ?> (<?php echo e(config('perameters.amr_period')); ?> <?php echo e(__('messages.days_after_treatment')); ?>)</h5>
                        <button class="btn btn-light border" onclick="printDiv('amrPdf')" type="button"><i
                                class="print-ico"></i></button>
                    </div>
                    <div class="card-body action-view " id="amrPdf">
                        <table class="table table-bordered w-100">
                            <?php $__currentLoopData = $amrCattleAlertData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <td>
                                        <a href="Javascript:void(0)">
                                            <?php echo e($item->cattle->tag->uid); ?>

                                        </a>
                                    </td>
                                    <td>
                                        <a href="javascript: void(0);">
                                            <?php echo e($item->alert_expire_date); ?>

                                        </a>
                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </table>
                    </div>
                </div>
            </div>
            <div class="col-md-4 mt-4 ">
                <div class="card  pb-3">
                    <div class="card-header d-flex justify-content-between">
                        <h5 class="title_name"><?php echo e(__('messages.calving_preparation')); ?> (<?php echo e(config('perameters.calving_preparation')); ?> <?php echo e(__('messages.days').' '.__('messages.before_calving')); ?>)</h5>
                        <button class="btn btn-light border" onclick="printDiv('calvingPdf')" type="button"><i
                                class="print-ico"></i></button>
                    </div>
                    <div class="card-body action-view " id="calvingPdf">
                        <table class="table table-bordered w-100">
                            <?php $__currentLoopData = $aiCattleCalvingData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <td>
                                        <a href="#">
                                            <?php echo e($item['cattle']['tag']['uid']); ?>

                                        </a>
                                    </td>
                                    <td>
                                        <a href="javascript: void(0);">
                                            <?php echo e($item['expected_calving_date']); ?>

                                        </a>
                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </table>
                    </div>
                </div>
            </div>
            <div class="col-md-4 mt-4 ">
                <div class="card  pb-3">
                    <div class="card-header d-flex justify-content-between">
                        <h5 class="title_name"><?php echo e(__('messages.sire_performance')); ?> (< 60%)</h5>
                        <button class="btn btn-light border" onclick="printDiv('sirePdf')" type="button"><i
                                class="print-ico"></i></button>
                    </div>
                    <div class="card-body action-view " id="sirePdf">
                        <table class="table table-bordered w-100">
                            <?php $__currentLoopData = $sirePerformance; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php if($item['sirePregnantRate'] < 60): ?>
                                    <tr>
                                        <td>
                                            <a href="javascript: void(0);">
                                                <?php echo e($item['code']); ?>

                                            </a>
                                        </td>
                                        <td>
                                            <a href="javascript: void(0);">
                                                <?php echo e(number_format($item['sirePregnantRate'], 2)); ?>%
                                            </a>
                                        </td>
                                    </tr>
                                <?php endif; ?>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fade" id="statusUpdate" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1"
         role="dialog" aria-labelledby="statusLabel" aria-hidden="true">
        <div class="modal-dialog modal-lg modal-dialog-centered" role="document">
            <div class="modal-content">
                <form method="POST" action="<?php echo e(route('alert.status.update')); ?>">
                    <?php echo csrf_field(); ?>
                    <div class="modal-header">
                        <h5 class="modal-title" id="statusLabel"><?php echo e(__('messages.alert_status')); ?></h5>
                        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                    </div>
                    <div class="modal-body">
                        <input type="hidden" id="alertid" name="alertId"/>
                        <h4 class="text-info"><?php echo e(__('messages.are_you_remove')); ?></h4>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-danger" data-bs-dismiss="modal"><?php echo e(__('messages.cancel')); ?></button>
                        <button type="submit" class="btn btn-success"><?php echo e(__('messages.ok')); ?></button>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <div class="modal fade" id="alertaction_modal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-lg modal-dialog-centered">
            <div class="modal-content p-5">
                <div class="modal-body p-0 mt-3 editModal">

                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>
<?php $__env->startPush('scripts'); ?>
    <script type="text/javascript">
        function printDiv(divName) {
            var printContents = document.getElementById(divName).innerHTML;
            var printStyle = '<style>@page {size: auto;margin: 0mm;}</style>';
            var printDiv = '<div id="order-details-wrapper" style="padding: 20px;">' + printStyle + printContents + '</div>';
            document.body.innerHTML = printDiv;
            var originalContents = document.body.innerHTML;
            window.print();
            document.body.innerHTML = originalContents;
            location.reload();
        }

        $(document).on('click', '.statusUpdate', function () {
            var id = $(this).data('id');
            var uid = $(this).data('uid-id');
            $('#alertid').val(id);
            $('#statusLabel').text(uid);
        });
        $('.view_details').click(function () {
            let id = $(this).attr('data-url');
            $('.editModal').empty();
            axios.get(id, {}).then(function (response) {
                $('#alertaction_modal').modal('show');
                $('.editModal').html(response.data);

            }).catch(function (error) {
                console.log(error);
            });
        });
    </script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('backend.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH D:\laragon\www\hr_and_att\resources\views/backend/alert_action/index.blade.php ENDPATH**/ ?>