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

<?php $__env->startSection('content'); ?>
<div class="container-fluid pt-3">
    <form action="<?php echo e(route('user.update', $user->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="username">ชื่อผู้ใช้ <span class="text-red">*</span></label>
                                    <input type="text" class="form-control" id="username" name="username" value="<?php echo e($user->username); ?>" readonly>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-2">
                                <div class="form-group">
                                    <label for="title">คำนำหน้า <span class="text-red">*</span></label>
                                    <select id="title" name="title" class="selectpicker show-menu-arrow form-control" required>
                                      <option value="นาย" <?php if($user->title == "นาย"): ?> selected <?php endif; ?>>นาย</option>
                                      <option value="นาง" <?php if($user->title == "นาง"): ?> selected <?php endif; ?>>นาง</option>
                                      <option value="นางสาว" <?php if($user->title == "นางสาว"): ?> selected <?php endif; ?>>นางสาว</option>
                                    </select>
                                    <?php $__errorArgs = ['gender'];
$__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="firstname">ชื่อ <span class="text-red">*</span></label>
                                    <input type="text" class="form-control" id="firstname" name="firstname" value="<?php echo e($user->firstname); ?>" placeholder="ชื่อ" required>
                                    <?php $__errorArgs = ['firstname'];
$__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="lastname">นามสกุล</label>
                                    <input type="text" class="form-control" id="lastname" name="lastname" value="<?php echo e($user->lastname); ?>" placeholder="นามสกุล" >
                                </div>
                            </div>
                            <div class="col-3">
                                <div class="form-group">
                                    <label for="phone">หมายเลขโทรศัพท์ <span class="text-red">*</span></label>
                                    <input type="number" name="phone" id="phone" class="form-control" value="<?php echo e($user->phone); ?>" placeholder="หมายเลขโทรศัพท์" required>
                                    <?php $__errorArgs = ['phone'];
$__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-3">
                                <div class="form-group">
                                    <label for="email">email</label>
                                    <input type="email" class="form-control  <?php $__errorArgs = ['email'];
$__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); ?>" value="<?php echo e($user->email); ?>" id="email" name="email" placeholder="อีเมล์">
                                </div>
                            </div>
                            <div class="col-3">
                                <div class="form-group">
                                    <label for="branch">สาขา <span class="text-red">*</span></label>
                                    <select id="branch" name="branch" class="selectpicker show-menu-arrow form-control" title="--เลือก--" required>
                                        <?php $__currentLoopData = $branchs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $indexKey => $branch): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($branch->id); ?>" <?php if($user->branch_id == $branch->id): ?> selected <?php endif; ?>><?php echo e($branch->name); ?></option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                    <?php $__errorArgs = ['branch'];
$__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="role">สิทธิ์ <span class="text-red">*</span></label>
                                    <select id="role" name="role" class="selectpicker show-menu-arrow form-control" title="--เลือก--" required>
                                        <option value="superadmin" <?php if($user->role == "superadmin"): ?> selected <?php endif; ?>>Superadmin</option>
                                        <option value="admin" <?php if($user->role == "admin"): ?> selected <?php endif; ?>>Admin</option>
                                        <option value="user" <?php if($user->role == "user"): ?> selected <?php endif; ?>>User</option>
                                    </select>
                                    <?php $__errorArgs = ['role'];
$__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('user.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();
    });
</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/user/edit.blade.php ENDPATH**/ ?>