<?php
    $c_id = request()->get('tag');
?>

<h4 class="card-title">A.I Information</h4>
<p class="card-title-desc">Fill all information below</p>

<form action="<?php echo e(route('ai.store')); ?>" method="POST" role="form" id="form1" enctype="multipart/form-data">
    <?php echo csrf_field(); ?>
    <div class="row">
        <div class="col-md-6">
            <label class="form-label">Tag ID <span class="text-danger">*</span></label>

            <select class="form-control select2-multiple <?php $__errorArgs = ['cattle_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" name="cattle_id"
                    id="cattle_id">
                <option value="">--Select Tag ID--</option>
                <?php $__currentLoopData = $cattles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <?php
                        $today = Carbon\Carbon::now()->addDays(1)->format('Y-m-d');
                        $adult_age_start_day = config('perameters.adult_age_start');
                        $adult_date = Carbon\Carbon::createFromFormat('Y-m-d', $item->birth_date)->addDays($adult_age_start_day)->format('Y-m-d');
                    ?>

                    <?php if($today >=  $adult_date): ?>
                        <option
                            value="<?php echo e($item->id); ?>" <?php echo e((($c_id) && ($c_id==$item->id)) ? 'selected' : ''); ?>><?php echo e($item->tag->uid); ?></option>
                    <?php endif; ?>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </select>
            <?php $__errorArgs = ['cattle_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <span class="text-danger"><i
                    class="entypo-info-circled"></i>  <?php echo e($message); ?></span> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
        </div>

        <div class="col-md-6">
            <label class="form-label">Sire Code <span class="text-danger">*</span></label>

            <select class="form-control select2-multiple <?php $__errorArgs = ['sire_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" name="sire_id"
                    id="sire_id">
                <option value="">--Select Sire Code--</option>
                <?php $__currentLoopData = $sires; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option value="<?php echo e($item->id); ?>"><?php echo e($item->code); ?></option>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </select>
            <?php $__errorArgs = ['sire_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <span class="text-danger"><i
                    class="entypo-info-circled"></i>  <?php echo e($message); ?></span> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
        </div>
    </div>
    <div class="row mt-2">
        <div class="col-md-6">
            <label class="form-label">AI Date <span class="text-danger">*</span></label>

            <input type="text" class="form-control custom-date-format <?php $__errorArgs = ['heat_date'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                   name="heat_date" id="heat_date" value="<?php echo e(old('heat_date')); ?>" placeholder="Pick heat dtate"/>
            <?php $__errorArgs = ['heat_date'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <span class="text-danger"><i
                    class="entypo-info-circled"></i>  <?php echo e($message); ?></span> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
        </div>

        <div class="col-md-6">
            <label class="form-label">Service Type <span class="text-danger">*</span></label>

            <select class="form-control  <?php $__errorArgs = ['service_type'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" name="service_type"
                    id="service_type">
                <option value="">--Select Service Type--</option>
                <option value="AI">AI</option>
                <option value="NATURAL">NATURAL</option>
                <option value="SKIP">SKIP</option>
                <option value="ET">ET</option>
            </select>
            <?php $__errorArgs = ['service_type'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <span class="text-danger"><i
                    class="entypo-info-circled"></i>  <?php echo e($message); ?></span> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
        </div>
    </div>
    <div class="row mt-2 ">
        <div class="col-md-6">
            <div class="form-group">
                <label class="form-label">Inseminator</label>
                <select class="form-control" name="inseminated_by" id="inseminated_by">
                    <option value="">--Select Inseminator--</option>
                    <?php $__currentLoopData = $inseminators; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <option value="<?php echo e($item->id); ?>"><?php echo e($item->name); ?></option>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </select>
            </div>
        </div>

        <div class="col-md-6">
            <label class="form-label">Total Dose</label>

            <input type="text" class="form-control" name="total_dose" id="total_dose" value="<?php echo e(old('total_dose')); ?>"
                   placeholder="Enter total dose"/>
        </div>
    </div>
    <div class="mt-5 d-flex justify-content-end mt-5">
        <button type="button" class="btn  me-2" data-bs-dismiss="modal"
                style="background: #EAECF0;">Close
        </button>
        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('AI.create')): ?>
            <div class="d-flex flex-wrap gap-2">
                <button type="submit" class="btn btn-primary waves-effect waves-light">Update A.I</button>
            </div>
        <?php endif; ?>
    </div>

</form>
<script !src="">
    $(".custom-date-format").datepicker({
        autoHide: true,
        format: 'dd-mm-yyyy',
    });
</script>
<?php /**PATH D:\laragon\www\hr_and_att\resources\views/backend/breeding/ai/create.blade.php ENDPATH**/ ?>