<?php
    $userPermissions = isset($userPermissions) && is_array($userPermissions) ? $userPermissions : [];
?>


<?php if (isset($component)) { $__componentOriginald7f77a02f879fd4954ea3c39c4e952cb = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginald7f77a02f879fd4954ea3c39c4e952cb = $attributes; } ?>
<?php $component = Modules\LMS\View\Components\Dashboard\Layout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('dashboard-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Modules\LMS\View\Components\Dashboard\Layout::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
     <?php $__env->slot('title', null, []); ?> <?php echo e(isset($staff) ? translate('Edit') : translate('Create')); ?> <?php echo e(translate('Staff')); ?> <?php $__env->endSlot(); ?>
    <!-- BREADCRUMB -->
    <?php if (isset($component)) { $__componentOriginalcf27f2c2c873893339708d5fdeeb6984 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalcf27f2c2c873893339708d5fdeeb6984 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => '7ee9c4f86007ba41bc79bbfab1cd8a68::admin.breadcrumb','data' => ['backUrl' => ''.e(route('staff.index')).'','title' => ''.e(isset($staff) ? 'Edit' : 'Create').' Staff','pageTo' => 'Staff']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('portal::admin.breadcrumb'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['back-url' => ''.e(route('staff.index')).'','title' => ''.e(isset($staff) ? 'Edit' : 'Create').' Staff','page-to' => 'Staff']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalcf27f2c2c873893339708d5fdeeb6984)): ?>
<?php $attributes = $__attributesOriginalcf27f2c2c873893339708d5fdeeb6984; ?>
<?php unset($__attributesOriginalcf27f2c2c873893339708d5fdeeb6984); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalcf27f2c2c873893339708d5fdeeb6984)): ?>
<?php $component = $__componentOriginalcf27f2c2c873893339708d5fdeeb6984; ?>
<?php unset($__componentOriginalcf27f2c2c873893339708d5fdeeb6984); ?>
<?php endif; ?>
    <form action="<?php echo e(isset($staff) ? route('staff.update', $staff->id) : route('staff.store')); ?>" method="post"
        class="form">
        <?php if(isset($staff)): ?>
            <?php echo method_field('PUT'); ?>
        <?php endif; ?>
        <?php echo csrf_field(); ?>
        <div class="grid grid-cols-12 gap-x-4">
            <input type="hidden" name="id" value="<?php echo e($staff->id ?? ''); ?>">
            <div class="col-span-full md:col-span-8 card">
                <div class="grid grid-cols-2 gap-x-4 gap-y-6 mt-7">
                    <div class="col-span-full xl:col-auto leading-none">
                        <label class="form-label"><?php echo e(translate('Name')); ?> <span
                                class="require-field"><b>*</b></span></label>
                        <input type="text" name="name" value="<?php echo e($staff->name ?? ''); ?>" class="form-input">
                        <span class="text-danger error-text name_err"></span>
                    </div>
                    <div class="col-span-full xl:col-auto leading-none">
                        <label class="form-label"><?php echo e(translate('Email')); ?> <span
                                class="require-field"><b>*</b></span></label>
                        <input type="text" name="email" value="<?php echo e($staff->email ?? ''); ?>" class="form-input">
                        <span class="text-danger error-text email_err"></span>
                    </div>

                    <div class="col-span-full xl:col-auto leading-none">
                        <label class="form-label"><?php echo e(translate('Password')); ?> <span
                                class="require-field"><b>*</b></span></label>
                        <input type="password" name="password" class="form-input">
                        <span class="text-danger error-text password_err"></span>
                    </div>

                    <div class="col-span-full xl:col-auto leading-none">
                        <label class="form-label"><?php echo e(translate('Confirm Password')); ?> <span
                                class="require-field"><b>*</b></span></label>
                        <input type="password" name="password_confirmation" class="form-input">
                    </div>
                    <div class="col-span-full xl:col-auto leading-none">
                        <label class="form-label"><?php echo e(translate('Phone')); ?> <span
                                class="require-field"><b>*</b></span></label>
                        <input type="text" name="phone" value="<?php echo e($staff->phone ?? ''); ?>" class="form-input">
                        <span class="text-danger error-text phone_err"></span>
                    </div>
                    <div class="col-span-full xl:col-auto leading-none">
                        <label class="form-label"> <?php echo e(translate('Roles')); ?></label>
                        <select name="roles[]" class="singleSelect" multiple>
                            <option disabled><?php echo e(translate('Select Role')); ?></option>
                            <?php $__currentLoopData = get_all_role(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $role): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option value="<?php echo e($role->name); ?>"
                                    <?php if(isset($staff->roles)): ?> <?php $__currentLoopData = $staff->roles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $srole): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <?php echo e($srole->name == $role->name ? 'selected' : ''); ?> 
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> <?php endif; ?>>
                                    <?php echo e($role->name); ?>

                                </option>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </select>
                    </div>


                </div>

                <div class="mt-5 mb-3">
                    <label class="text-lg"> <?php echo e(translate('Permission')); ?> </label>
                </div>
                <div class="h-80 overflow-y-scroll">

                    <div class="flex flex-col gap-5">
                        <?php $__currentLoopData = $permissions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $permission): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <div class="group-permission">
                                <div class="flex items-center gap-2 mb-2">
                                    <input id="check-s-<?php echo e($key); ?>" type="checkbox"
                                        class="check check-primary-solid check-md check-enable-parent">
                                    <label for="check-s-<?php echo e($key); ?>" class="card-title text-lg">
                                        <?php echo e($key); ?></label>
                                </div>
                                <div class="ml-10">
                                    <?php $__currentLoopData = $permission; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <div class="flex items-center gap-2 mb-2">
                                            <input id="check-s-<?php echo e($value->id); ?>" type="checkbox"
                                                class="check check-primary-solid check-md check-enable-child"
                                                name="permissions[]" value="<?php echo e($value->name); ?>"
                                                <?php echo e(in_array($value->id, $userPermissions) ? 'checked' : ''); ?>>
                                            <label for="check-s-<?php echo e($value->id); ?>"
                                                class="form-label text-base m-0"><?php echo e($value->name); ?></label>
                                        </div>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </div>
                            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </div>
                </div>
            </div>
            <div class="col-span-full md:col-span-4 card">
                <p class="text-xs text-gray-500 dark:text-dark-text leading-none font-semibold mb-3">
                    <?php echo e(translate('Profile Image')); ?>(100x100)
                </p>
                <label for="profileImg"
                    class="dropzone-wrappe file-container ac-bg text-xs leading-none font-semibold mb-3 cursor-pointer w-full h-[200px] flex flex-col items-center justify-center gap-2.5 border border-dashed border-gray-900 rounded-10 dk-theme-card-square">
                    <input type="file" hidden name="image" id="profileImg"
                        class="dropzone dropzone-image img-src peer/file">

                    <span class="flex-center flex-col peer-[.uploaded]/file:hidden">
                        <img src="<?php echo e(asset('lms/assets/images/icons/upload-file.svg')); ?>" alt="file-icon"
                            class="size-8 lg:size-auto">
                        <div class="text-gray-500 dark:text-dark-text mt-2"> <?php echo e(translate('Choose file')); ?></div>
                    </span>
                </label>
                <div class="preview-zone dropzone-preview">
                    <div class="box box-solid">
                        <div class="box-body flex items-center gap-2 flex-wrap">
                            <?php if(isset($staff) && fileExists('lms/admins/', $staff?->profile_img) == true && $staff?->profile_img !== ''): ?>
                                <div class="img-thumb-wrapper"> <button class="remove">
                                        <i class="ri-close-line text-inherit text-[13px]"></i> </button>
                                    <img class="img-thumb" width="100"
                                        src="<?php echo e(asset('storage/lms/admins/' . $staff->profile_img)); ?>" />
                                </div>
                            <?php endif; ?>


                        </div>
                    </div>
                </div>
                <span class="text-danger error-text image_err"></span>
            </div>
        </div>
        <div class="card flex justify-end">
            <button type="submit" class="btn b-solid btn-primary-solid dk-theme-card-square">
                <?php echo e(isset($staff) ? translate('Update') : translate('Save')); ?>

            </button>
        </div>
    </form>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginald7f77a02f879fd4954ea3c39c4e952cb)): ?>
<?php $attributes = $__attributesOriginald7f77a02f879fd4954ea3c39c4e952cb; ?>
<?php unset($__attributesOriginald7f77a02f879fd4954ea3c39c4e952cb); ?>
<?php endif; ?>
<?php if (isset($__componentOriginald7f77a02f879fd4954ea3c39c4e952cb)): ?>
<?php $component = $__componentOriginald7f77a02f879fd4954ea3c39c4e952cb; ?>
<?php unset($__componentOriginald7f77a02f879fd4954ea3c39c4e952cb); ?>
<?php endif; ?>
<?php /**PATH D:\www\edulab\Modules\Roles\resources\views\staff\form.blade.php ENDPATH**/ ?>