<?php $__env->startSection('title', translate('Update Employee')); ?>

<?php $__env->startSection('content'); ?>
<div class="content container-fluid">

    <div class="page-header">
        <h1 class="page-header-title">
            <span class="page-header-icon">
                <img src="<?php echo e(asset('public/assets/admin/img/employee.png')); ?>" class="w--24" alt="<?php echo e(translate('employee')); ?>">
            </span>
            <span>
                <?php echo e(translate('Update Employee')); ?>

            </span>
        </h1>
    </div>

    <form action="<?php echo e(route('admin.employee.update',[$employee['id']])); ?>" method="post" enctype="multipart/form-data">
        <?php echo csrf_field(); ?>
        <div class="card">
            <div class="card-header">
                <h5 class="card-title">
                    <span class="card-header-icon">
                        <i class="tio-user"></i>
                    </span> <?php echo e(translate('General Information')); ?>

                </h5>
            </div>
            <div class="card-body">
                <div class="row">
                    <div class="col-md-6">
                        <div class="row g-3">
                            <div class="col-md-6">
                                <label class="form-label"><?php echo e(translate('First Name')); ?></label>
                                <input type="text" name="first_name" value="<?php echo e($employee['f_name']); ?>" class="form-control" id="name"
                                        placeholder="<?php echo e(translate('Ex')); ?> : <?php echo e(translate('John')); ?>">
                            </div>
                            <div class="col-md-6">
                                <label class="form-label"><?php echo e(translate('Last Name')); ?></label>
                                <input type="text" name="last_name" value="<?php echo e($employee['l_name']); ?>" class="form-control" id="name"
                                        placeholder="<?php echo e(translate('Ex')); ?> : <?php echo e(translate('Joe')); ?>">
                            </div>
                            <div class="col-md-12">
                                <label class="form-label"><?php echo e(translate('Phone')); ?></label>
                                <input type="text" value="<?php echo e($employee['phone']); ?>" required name="phone" class="form-control" id="phone"
                                        placeholder="<?php echo e(translate('Ex')); ?> : +88017********">
                            </div>
                            <div class="col-md-12">
                                <label class="form-label"><?php echo e(translate('Role')); ?></label>
                                <select class="form-control w-100" name="role_id">
                                        <option value="0" selected disabled>---<?php echo e(translate('select')); ?>---</option>
                                        <?php $__currentLoopData = $adminRoles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $role): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <option
                                                value="<?php echo e($role->id); ?>" <?php echo e($role['id']==$employee['admin_role_id']?'selected':''); ?>><?php echo e($role->name); ?></option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                            </div>
                            <div class="col-md-12">
                                <label class="form-label"><?php echo e(translate('Identity Type')); ?></label>
                                <select name="identity_type" class="form-control">
                                    <option value="passport" <?php echo e($employee['identity_type'] == 'passport' ? 'selected' : ''); ?>><?php echo e(translate('passport')); ?></option>
                                    <option value="driving_license" <?php echo e($employee['identity_type'] == 'driving_license' ? 'selected' : ''); ?>><?php echo e(translate('driving')); ?> <?php echo e(translate('license')); ?></option>
                                    <option value="nid" <?php echo e($employee['identity_type'] == 'nid' ? 'selected' : ''); ?>><?php echo e(translate('nid')); ?></option>
                                </select>
                            </div>
                            <div class="col-md-12">
                                <label class="form-label"><?php echo e(translate('Identity Number')); ?></label>
                                <input type="text" class="form-control" name="identity_number" value="<?php echo e($employee['identity_number']); ?>" placeholder="<?php echo e(translate('Identity Number')); ?> : 674-5596-9854" required>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group mb-3">
                            <label class="form-label d-none d-md-block ">
                                &nbsp;
                            </label>
                            <div class="text-center mb-4">
                                <img class="initial-24" id="viewer"
                                    src="<?php echo e($employee->imageFullPath); ?>"
                                     alt="<?php echo e(translate('employee')); ?>"/>
                            </div>
                            <div class="form-group mb-0">
                                <label class="form-label d-block">
                                    <?php echo e(translate('Employee Image')); ?> <span class="text-danger">(Ratio 1:1)</span>
                                </label>
                                <div class="custom-file">
                                    <input type="file" name="image" id="customFileUpload" class="custom-file-input h--45px" accept=".jpg, .png, .jpeg, .gif, .bmp, .tif, .tiff|image/*" >
                                    <label class="custom-file-label h--45px" for="customFileUpload"></label>
                                </div>
                            </div>
                        </div>
                        <div>
                            <label class="form-label d-block mb-2 pb-1">
                                <?php echo e(translate('Identity Image')); ?>

                            </label>
                            <div class="product--coba">
                                    <div class="row g-2" id="coba">
                                            <?php $__currentLoopData = $employee->identityImageFullPath; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $identification_image): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <div class="two__item w-50">
                                                <div class="max-h-140px existing-item">
                                                    <img src="<?php echo e($identification_image); ?>"
                                                         alt="<?php echo e(translate('identity_image')); ?>">
                                                </div>
                                            </div>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="card mt-3">
            <div class="card-header">
                <h5 class="card-title">
                    <span class="card-header-icon">
                        <i class="tio-user"></i>
                    </span> <?php echo e(translate('Account Information')); ?>

                </h5>
            </div>
            <div class="card-body">
                <div class="row g-3">
                    <div class="col-md-4 col-sm-6">
                        <label class="form-label"><?php echo e(translate('Email')); ?></label>
                        <input type="email" value="<?php echo e($employee['email']); ?>" name="email" class="form-control" id="email"
                                placeholder="<?php echo e(translate('Ex')); ?> : ex@gmail.com" required>
                    </div>
                    <div class="col-md-4 col-sm-6">
                        <label class="form-label"><?php echo e(translate('Password')); ?></label><small class="text-danger">( <?php echo e(translate('input if you want to change')); ?> )</small>
                        <input type="text" name="password" class="form-control" id="password" placeholder="<?php echo e(translate('Ex : 8+ Characters')); ?>">
                    </div>
                    <div class="col-md-4 col-sm-6">
                        <label class="form-label"><?php echo e(translate('Confirm Password')); ?></label>
                        <input type="text" name="password_confirmation" class="form-control" id="password" placeholder="<?php echo e(translate('Ex : 8+ Characters')); ?>">
                    </div>
                </div>
            </div>
        </div>
        <div class="btn--container justify-content-end mt-3">
            <button type="reset" class="btn btn--reset"><?php echo e(translate('reset')); ?></button>
            <button type="submit" class="btn btn--primary"><?php echo e(translate('Update')); ?></button>
        </div>
    </form>

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

<?php $__env->startPush('script_2'); ?>

<script src="<?php echo e(asset('public/assets/back-end')); ?>/js/select2.min.js"></script>
<script src="<?php echo e(asset('public/assets/admin/js/spartan-multi-image-picker.js')); ?>"></script>

    <script>
        "use strict";

        function readURL(input) {
            if (input.files && input.files[0]) {
                var reader = new FileReader();

                reader.onload = function (e) {
                    $('#viewer').attr('src', e.target.result);
                }

                reader.readAsDataURL(input.files[0]);
            }
        }

        $("#customFileUpload").change(function () {
            readURL(this);
        });


        $(".js-example-theme-single").select2({
            theme: "classic"
        });

        $(".js-example-responsive").select2({
            width: 'resolve'
        });

    $(function () {
        $("#coba").spartanMultiImagePicker({
            fieldName: 'identity_image[]',
            maxCount: 2,
            rowHeight: '138px',
            groupClassName: 'two__item',
            maxFileSize: '',
            placeholderImage: {
                image: '<?php echo e(asset('public/assets/admin/img/upload-vertical.png')); ?>',
                width: '100%'
            },
            dropFileLabel: "Drop Here",
            onAddRow: function (index, file) {

            },
            onRenderedPreview: function (index) {

            },
            onRemoveRow: function (index) {

            },
            onExtensionErr: function (index, file) {
                toastr.error('<?php echo e(translate("Please only input png or jpg type file")); ?>', {
                    CloseButton: true,
                    ProgressBar: true
                });
            },
            onSizeErr: function (index, file) {
                toastr.error('<?php echo e(translate("File size too big")); ?>', {
                    CloseButton: true,
                    ProgressBar: true
                });
            }
        });
    });
</script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('layouts.admin.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/mimeld/mxepto.mimeld.com/resources/views/admin-views/employee/edit.blade.php ENDPATH**/ ?>