<?php $__env->startPush('head_links'); ?>
<link href="<?php echo e(asset('/theme/plugins/bootstrap-jasny/bootstrap-jasny.min.css')); ?>" rel="stylesheet" />
<?php $__env->stopPush(); ?>

<form id="entity-form" class="form-horizontal" method="post" action="" 
      enctype="multipart/form-data" autocomplete="off">
    <div class="row">
        <div class="col-lg-7 align-self-center">
            <?php echo csrf_field(); ?>
            <div class="form-group row">
                <label class="col-sm-3 control-label"><?php echo app('translator')->get('Ime'); ?><sup>*</sup></label>
                <div class="col-sm-9">
                    <input 
                        type="text" 
                        class="form-control <?= $errors->has("first_name") ? 'is-invalid' : ""; ?>" 
                        name="first_name" 
                        placeholder="<?php echo app('translator')->get('Ime'); ?>" 
                        value="<?php echo e(old('first_name', $entity->first_name)); ?>"
                    >
                    <?php echo $__env->make('_layout.partials.form.error', ['field' => 'first_name'], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                    
                </div>
            </div>
            <div class="form-group row">
                <label class="col-sm-3 control-label"><?php echo app('translator')->get('Prezime'); ?><sup>*</sup></label>
                <div class="col-sm-9">
                    <input 
                        type="text" 
                        class="form-control <?= $errors->has("last_name") ? 'is-invalid' : ""; ?>" 
                        name="last_name" 
                        placeholder="<?php echo app('translator')->get('Prezime'); ?>" 
                        value="<?php echo e(old('last_name', $entity->last_name)); ?>"
                    >
                    <?php echo $__env->make('_layout.partials.form.error', ['field' => 'last_name'], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                    
                </div>
            </div>
            <?php if(request()->segment(count(request()->segments())) != 'edit'): ?>
            <div class="form-group row">
                <label class="col-sm-3 control-label"><?php echo app('translator')->get('Lozinka'); ?><sup>*</sup></label>
                <div class="col-sm-9 input-group">
                    <input 
                        type="password" 
                        class="form-control <?= $errors->has("password") ? 'is-invalid' : ""; ?>" 
                        name="password" 
                        placeholder="<?php echo app('translator')->get('Lozinka'); ?>" 
                        value="<?php echo e(old('password', $entity->password)); ?>"
                    >
                    <?php echo $__env->make('_layout.partials.form.error', ['field' => 'password'], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                    
                </div>
            </div>
            <div class="form-group row">
                <label class="col-sm-3 control-label"><?php echo app('translator')->get('Potvrda lozinke'); ?><sup>*</sup></label>
                <div class="col-sm-9 input-group">
                    <input 
                        type="password" 
                        class="form-control <?= $errors->has("password_confirmation") ? 'is-invalid' : ""; ?>" 
                        name="password_confirmation" 
                        placeholder="<?php echo app('translator')->get('Potvrda lozinke'); ?>" 
                        value=""
                    >
                    <?php echo $__env->make('_layout.partials.form.error', ['field' => 'password_confirmation'], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                    
                </div>
            </div>
            <?php endif; ?>
            <div class="form-group row">
                <label class="col-sm-3 control-label"><?php echo app('translator')->get('Email'); ?><sup>*</sup></label>
                <div class="col-sm-9 input-group">
                    <input 
                        type="text" 
                        class="form-control <?= $errors->has("email") ? 'is-invalid' : ""; ?>" 
                        name="email" 
                        placeholder="<?php echo app('translator')->get('Email'); ?>" 
                        value="<?php echo e(old('email', $entity->email)); ?>"
                    >
                    <span class="input-group-addon bootstrap-touchspin-postfix input-group-append">
                        <span class="input-group-text">
                            <i class="fa fa-at"></i>
                        </span>
                    </span>
                    <?php echo $__env->make('_layout.partials.form.error', ['field' => 'email'], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                    
                </div>
            </div>
            <div class="form-group row">
                <label class="col-sm-3 control-label"><?php echo app('translator')->get('Telefon'); ?></label>
                <div class="col-sm-9 input-group">
                    <input 
                        type="text" 
                        class="form-control <?= $errors->has("phone") ? 'is-invalid' : ""; ?>" 
                        name="phone" 
                        placeholder="<?php echo app('translator')->get('Telefon'); ?>" 
                        value="<?php echo e(old('phone', $entity->phone)); ?>"
                    >
                    <span class="input-group-addon bootstrap-touchspin-postfix input-group-append">
                        <span class="input-group-text">
                            <i class="fa fa-phone"></i>
                        </span>
                    </span>
                    <?php echo $__env->make('_layout.partials.form.error', ['field' => 'phone'], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                    
                </div>
            </div>
            <div class="form-group row">
                <label class="col-sm-3 control-label"><?php echo app('translator')->get('Grupa korisnika'); ?><sup>*</sup></label>
                <div class="col-sm-9">
                    <select id="users_group" name="users_group" class="form-control select2 select2-hidden-accessible <?= $errors->has("users_group") ? 'is-invalid' : ""; ?>")">
                        <option value=""><?php echo app('translator')->get('Odaberite grupu za korisnika ...'); ?></option>
                        
                        <?php $__currentLoopData = $usersGroups; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $usersGroup): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <option value="<?php echo e($usersGroup['id']); ?>"
                            <?php if(old('users_group', in_array($usersGroup['id'], $currentUsersGroups))): ?> selected <?php endif; ?>
                            ><?php echo e($usersGroup['text']); ?>

                        </option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                    <?php echo $__env->make('_layout.partials.form.error', ['field' => 'users_group'], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

                </div>
            </div>
        </div>
    </div>
    <hr>
    <div class="form-group row">
        <div class="col-sm-9">
            <button type="submit" class="btn btn-success waves-effect waves-light">
                <i class="fa fa-save"></i>
                <?php echo app('translator')->get('Sačuvaj'); ?>
            </button>
        </div>
    </div>
</form>

<?php $__env->startPush('footer_scripts'); ?>
<script src="<?php echo e(asset('/theme/plugins/bootstrap-filestyle/js/bootstrap-filestyle.min.js')); ?>"></script>
<script src="<?php echo e(asset('/theme/plugins/bootstrap-jasny/bootstrap-jasny.min.js')); ?>"></script>
<script>
$(function() {
    $("#primary_website, #websites, #users_group").select2();
    
    //$('#websites_' + $('#primary_website').val()).attr("disabled", true);
    
    $('#primary_website').on('change', function(){
        $('.websites').removeAttr("disabled");
        $('#websites_' + $(this).val()).prop('checked', true);
        $('#websites_' + $(this).val()).attr("disabled", true);
    });
    
    $('#entity-form').validate({
        rules: {
            first_name:{
               required: true
            },
            last_name:{
               required: true
            },
            phone:{
            },
            password: {
                required: true,
            },
            password_confirm: {
                required: true,
            },
            email: {
                required: true,
                email: true
            },
            primary_website: {
                //required: true
            },
            websites: {
                required: true
            },
            users_group: {
                required: true
            }
            
        }
    });
});
</script>
<?php $__env->stopPush(); ?><?php /**PATH /home/drventar/vd-trans.com/fakture/resources/views/users/partials/form.blade.php ENDPATH**/ ?>