
<?php $__env->startSection('title','Users'); ?>
<?php $__env->startSection('user','active'); ?>
<?php $__env->startSection('content'); ?>
<div id="main" style="width:99%;">
    <div id="breadcrumbs-wrapper">
        <div class="container">
            <div class="row">
                <div class="col s12 m12 l12">
                    <h5 class="breadcrumbs-title col s5"><b><?php echo e(__('messages.user_page.edit user')); ?></b></h5>
                    <ol class="breadcrumbs col s7 right-align">
                        <a class="btn-floating waves-effect waves-light teal tooltipped" href="<?php echo e(route('users.index')); ?>" data-position=top data-tooltip="<?php echo e(__('messages.common.go back')); ?>"><i class="material-icons">arrow_back</i></a>
                    </ol>
                </div>
            </div>
        </div>
    </div>
    <div class="col s12">
        <div class="container">
            <div class="row">
                <div class="col  s12 m10  offset-m1">
                    <div class="card-panel">
                        <div class="row">
                            <form id="user_form" method="post" action="<?php echo e(route('users.update',[$user->id])); ?>" enctype="multipart/form-data">
                                <?php echo e(@csrf_field()); ?>

                                <?php echo e(method_field('PATCH')); ?>

                                <div class="row">
                                    <div class="row form_align">
                                        <div class="input-field col s6">
                                            <label for="name"><?php echo e(__('messages.user_page.name')); ?></label>
                                            <input id="name" name="name" type="text" value="<?php echo e($user->name); ?>" data-error=".name">
                                            <div class="name">
                                                <?php if($errors->has('name')): ?>
                                                <span class="text-danger errbk"><?php echo e($errors->first('name')); ?></span>
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                        <div class="input-field col s6">
                                            <label for="email"><?php echo e(__('messages.user_page.email')); ?></label>
                                            <input id="email" name="email" type="text" value="<?php echo e($user->email); ?>" data-error=".email">
                                            <div class="email">
                                                <?php if($errors->has('email')): ?>
                                                <span class="text-danger errbk"><?php echo e($errors->first('email')); ?></span>
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row form_align">
                                        <div class="input-field col s6">
                                            <label for="password"><?php echo e(__('messages.user_page.password')); ?></label>
                                            <input id="password" name="password" type="password" data-error=".password">
                                            <div class="password">
                                                <?php if($errors->has('password')): ?>
                                                <span class="text-danger errbk"><?php echo e($errors->first('password')); ?></span>
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                        <div class="file-field input-field col s6">
                                            <div class="btn">
                                                <span><?php echo e(__('messages.user_page.image')); ?></span>
                                                <input type="file" name="image">
                                            </div>
                                            <div class="file-path-wrapper">
                                                <input class="file-path validate" type="text">
                                            </div>
                                            <?php if($errors->has('image')): ?>
                                            <span class="text-danger errbk"><?php echo e($errors->first('image')); ?></span>
                                            <?php endif; ?>
                                        </div>
                                    </div>
                                    <div class="row form_align">
                                        <div class="input-field col s6">
                                            <select name="role" id="user_id">
                                                <option value="" disabled selected><?php echo e(__('messages.user_page.select role')); ?></option>
                                                <?php $__currentLoopData = $roles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $role): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($role->id); ?>" <?php echo e($user->getRoleNames()->contains($role->name) ? 'selected' : ''); ?>><?php echo e($role->name); ?> </option>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </select>
                                            <label><?php echo e(__('messages.user_page.role')); ?></label>
                                        </div>
                                    </div>
                                    <div class="input-field col s12">
                                        <button class="btn waves-effect waves-light right submit" type="submit" name="action"><?php echo e(__('messages.common.update')); ?>

                                            <i class="mdi-content-send right"></i>
                                        </button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('js'); ?>
<script src="<?php echo e(asset('app-assets/js/vendors.min.js')); ?>"></script>
<script src="<?php echo e(asset('app-assets/vendors/jquery-validation/jquery.validate.min.js')); ?>"></script>
<script>
    $(document).ready(function() {
        $('body').addClass('loaded');
    });
    $(function() {
        $('#user_form').validate({
            rules: {
                name: {
                    required: true,
                },
                role: {
                    required: true,
                },
                email: {
                    required: true,
                    email: true
                },
                password: {
                    required: true,
                    minlength: 5
                },
                image: {
                    accept: "jpg|jpeg|png"
                }
            },
            errorElement: 'div',
            errorPlacement: function(error, element) {
                var placement = $(element).data('error');
                if (placement) {
                    $(placement).append(error)
                } else {
                    error.insertAfter(element);
                }
            }
        });
    });
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layout.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/techseba/token.techseba.com/resources/views/user/edit.blade.php ENDPATH**/ ?>