<?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-timepicker.min.css')); ?>" rel="stylesheet" />
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<div class="container-fluid pt-3">
    <form action="<?php echo e(route('branch.update', $branch->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-sm-12 col-md-6">
                                <div class="form-group">
                                    <label for="name">ชื่อสาขา <span class="text-red">*</span></label>
                                <input type="text" class="form-control" id="name" name="name" value="<?php echo e($branch->name); ?>" placeholder="ชื่อสาขา" required>
                                <?php $__errorArgs = ['name'];
$__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-sm-12 col-md-2">
                                <div class="form-group">
                                    <label for="code">รหัสสาขา <span class="text-red">*</span></label>
                                    <input type="text" class="form-control" id="code" name="code" value="<?php echo e($branch->code); ?>" placeholder="รหัสสาขา" required>
                                    <?php $__errorArgs = ['code'];
$__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 class="row">
                            <div class="col-sm-12 col-md-8">
                                <div class="form-group">
                                    <label for="address">ที่ตั้ง <span class="text-red">*</span></label>
                                    <input type="text" class="form-control" id="address" name="address" value="<?php echo e($branch->address); ?>" placeholder="สถานที่ตั้งสาขา" required>
                                    <?php $__errorArgs = ['address'];
$__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-sm-12 col-md-4">
                                <div class="form-group">
                                    <label for="province">จังหวัด <span class="text-red">*</span></label>
                                    <select class="form-control selectpicker show-menu-arrow" id="province" name="province" data-live-search="true" required>
                                        <?php $__currentLoopData = $provinces; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $indexKey => $province): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($province->name); ?>" <?php if($branch->province == $province->name): ?> selected <?php endif; ?>><?php echo e($province->name); ?></option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                    <?php $__errorArgs = ['province'];
$__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 class="row">
                            <div class="col-sm-8 col-md-3">
                                <div class="form-group">
                                    <label for="phone1">หมายเลขโทรศัพท์ 1 <span class="text-red">*</span></label>
                                    <input type="number"
                                            class="form-control"
                                            id="phone1"
                                            name="phone1"
                                            value="<?php echo e($branch->phone_1); ?>"
                                            placeholder="หมายเลขโทรศัพท์ 1"
                                            oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);"
                                            maxlength="10"
                                            required>
                                    <?php $__errorArgs = ['phone1'];
$__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-sm-8 col-md-3">
                                <div class="form-group">
                                    <label for="phone1">หมายเลขโทรศัพท์ 2</label>
                                    <input type="number"
                                            class="form-control"
                                            id="phone2"
                                            name="phone2"
                                            value="<?php echo e($branch->phone_2); ?>"
                                            placeholder="หมายเลขโทรศัพท์ 2"
                                            oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);"
                                            maxlength="10">
                                </div>
                            </div>
                            <div class="col-sm-8 col-md-3">
                                <div class="form-group">
                                    <label for="open">เวลาเปิด <span class="text-red">*</span></label>
                                    <div class="input-group mb-3">
                                        <input type="text" name="open" id="open" value="<?php echo e(formatTimeFromDB($branch->open)); ?>" class="form-control" placeholder="เวลาเปิด" required>
                                        <div class="input-group-append">
                                            <span class="input-group-text"><i class="far fa-clock"></i></span>
                                        </div>
                                    </div>
                                    <?php $__errorArgs = ['open'];
$__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-sm-8 col-md-3">
                                <div class="form-group">
                                    <label for="close">เวลาปิด <span class="text-red">*</span></label>
                                    <div class="input-group mb-3">
                                        <input type="text" name="close" id="close" value="<?php echo e(formatTimeFromDB($branch->close)); ?>" class="form-control" value="" placeholder="เวลาปิด" required>
                                        <div class="input-group-append">
                                            <span class="input-group-text"><i class="far fa-clock"></i></span>
                                        </div>
                                    </div>
                                    <?php $__errorArgs = ['close'];
$__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('branch.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 src="<?php echo e(asset('js/bootstrap-timepicker.min.js')); ?>"></script>
<script>
    $(document).ready(function(){
        $('.selectpicker').selectpicker();
        $('#open').timepicker({
            showMeridian: false,
            showSeconds: true,
            minuteStep: 1,
            secondStep: 1,
            icons: {
                up: 'fa fa-angle-up',
                down: 'fa fa-angle-down'
            }
        });

        $('#close').timepicker({
            showMeridian: false,
            showSeconds: true,
            minuteStep: 1,
            secondStep: 1,
            icons: {
                up: 'fa fa-angle-up',
                down: 'fa fa-angle-down'
            }
        });
    });
</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\tkp-system.bright.in.th\resources\views/branch/edit.blade.php ENDPATH**/ ?>