<?php $__env->startSection('css'); ?>
<link href="<?php echo e(asset('css/bootstrap-select.min.css')); ?>" rel="stylesheet" />
<link href="<?php echo e(asset('css/bootstrap-datepicker.min.css')); ?>" rel="stylesheet" />
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<div class="container-fluid pt-3">
    <form action="<?php echo e(route('payment.update', $payment->id)); ?>"
            novalidate class="<?php echo e(($errors->any()) ? 'was-validated' : 'needs-validation'); ?>"
            method="post"
    >
    <?php echo csrf_field(); ?>
    <?php echo method_field('PUT'); ?>
        <div class="row">
            <div class="col-12">
                <div class="card card-outline card-success">
                    <div class="card-header">
                        <h3 class="card-title">ข้อมูลค่าจ้าง</h3>
                    </div>
                    <div class="card-body">
                        <div class="row">
                            <div class="col-3">
                                <div class="form-group">
                                    <label for="drive">ประเภทการเรียน <span class="text-red">*</span></label>
                                    <select id="drive" name="drive" class="selectpicker show-menu-arrow form-control" title="--เลือก--" required>
                                        <option value="ขับ" <?php if($payment->drive == "ขับ"): ?> selected <?php endif; ?>>มีการขับรถ</option>
                                        <option value="ไม่ขับ" <?php if($payment->drive == "ไม่ขับ"): ?> selected <?php endif; ?>>ไม่มีการขับรถ</option>
                                    </select>
                                    <?php $__errorArgs = ['drive'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="text-danger"><?php echo e($message); ?></div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>
                            <div class="col-3">
                                <div class="form-group">
                                    <label for="type">ประเภทยานพาหนะ <span class="text-red">*</span></label>
                                    <select id="type" name="type" class="selectpicker show-menu-arrow form-control" title="--เลือก--" required>
                                        <option value="รถยนต์" <?php if($payment->type == "รถยนต์"): ?> selected <?php endif; ?>>รถยนต์</option>
                                        <option value="รถจักรยานยนต์" <?php if($payment->type == "รถจักรยานยนต์"): ?> selected <?php endif; ?>>รถจักรยานยนต์</option>
                                    </select>
                                    <?php $__errorArgs = ['type'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="text-danger"><?php echo e($message); ?></div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>
                            <div class="col-3">
                                <div class="form-group">
                                    <label for="gear">ประเภทเกียร์ <span class="text-red">*</span></label>
                                    <select id="gear" name="gear" class="selectpicker show-menu-arrow form-control" title="--เลือก--"  required>
                                        <option value="ออโต้" <?php if($payment->gear == "ออโต้"): ?> selected <?php endif; ?>>ออโต้</option>
                                        <option value="ธรรมดา" <?php if($payment->gear == "ธรรมดา"): ?> selected <?php endif; ?>>ธรรมดา</option>
                                    </select>
                                    <?php $__errorArgs = ['gear'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="text-danger"><?php echo e($message); ?></div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>
                            <div class="col-3">
                                <div class="form-group">
                                    <label for="cost">ค่าจ้าง / ชม. <span class="text-red">*</span></label>
                                    <input type="number" class="form-control" id="cost" name="cost" placeholder="ค่าจ้าง / ชม. (บาท)" value="<?php echo e($payment->cost); ?>" required>
                                    <?php $__errorArgs = ['cost'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="text-danger"><?php echo e($message); ?></div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>
                        </div>
                    </div>  <!-- div card body -->

                </div>
                <div class="row mt-3">
                    <div class="col-12">
                        <div style="float:left">
                            <a href="<?php echo e(route('payment.index')); ?>" class="btn btn-outline-secondary"><i class="fas fa-chevron-left"></i> ย้อนกลับ</a>
                        </div>
                        <div style="float: right">
                            <button type="reset" class="btn btn-outline-secondary" value="reset">ล้างข้อความ</button>
                            <button type="submit" class="btn btn-success ml-2" value="add-course">แก้ไขค่าจ้าง</button>
                        </div>

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

<?php $__env->startSection('footerscript'); ?>
<script src="<?php echo e(asset('js/bootstrap-select.min.js')); ?>"></script>
<script>
    $(document).ready(function(){
        $('.selectpicker').selectpicker();

        if($('#drive').val()=='ไม่ขับ') {
            $('#type').prop("disabled", true);
            $('#type').selectpicker('refresh');
            $('#gear').prop("disabled", true);
            $('#gear').selectpicker('refresh');
        }

        $('#drive').on('change', function (){
            if( $(this).val() == 'ไม่ขับ' ) {
                $('#type').val('');
                $('#gear').val('');
                $('#type').prop("disabled", true);
                $('#type').selectpicker('refresh');
                $('#gear').prop("disabled", true);
                $('#gear').selectpicker('refresh');
            } else {
                $('#type').prop("disabled", false);
                $('#type').selectpicker('refresh');
                $('#gear').prop("disabled", false);
                $('#gear').selectpicker('refresh');
            }
        });
    });
</script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.web', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\laragon\www\system.pongpetrdriving.com\resources\views/payment/edit.blade.php ENDPATH**/ ?>