

<?php $__env->startSection('title', 'Edit Admin | NEX Finserv'); ?>

<?php $__env->startSection('page-title', 'Edit Admin'); ?>

<?php $__env->startSection(
    'page-description',
    'Update administrator account information and password'
); ?>

<?php $__env->startPush('styles'); ?>
<link rel="stylesheet" href="<?php echo e(asset('admin/css/profilesettingsadmin.css')); ?>">
<?php $__env->stopPush(); ?>


<?php $__env->startSection('content'); ?>

<div class="admin-edit-page">


    <?php if(session('admin_success')): ?>

        <div class="edit-alert success">
            ✓ <?php echo e(session('admin_success')); ?>

        </div>

    <?php endif; ?>


    <?php if($errors->any()): ?>

        <div class="edit-alert error">
            Please check the highlighted fields below.
        </div>

    <?php endif; ?>


    <div class="admin-edit-card">


        

        <div class="admin-edit-header">

            <div class="admin-edit-icon">
                ✏
            </div>

            <div>

                <h3>
                    Edit Administrator
                </h3>

                <p>
                    Update administrator account details.
                </p>

            </div>

        </div>


        <div class="admin-edit-body">


            

            <?php

                $adminName =
                    $admin->name ?? 'Administrator';

                $adminInitial =
                    strtoupper(
                        substr(
                            $adminName,
                            0,
                            1
                        )
                    );

            ?>


            <div class="admin-edit-user">

                <div class="admin-edit-avatar">
                    <?php echo e($adminInitial); ?>

                </div>

                <div>

                    <span class="admin-edit-user-name">
                        <?php echo e($admin->name); ?>

                    </span>

                    <span class="admin-edit-user-email">
                        <?php echo e($admin->email); ?>

                    </span>

                    <span class="admin-edit-badge">
                        Administrator
                    </span>

                </div>

            </div>


            

            <form
                method="POST"
                action="<?php echo e(route(
                        'admin.profile-settings.admin.update',
                        $admin
                    )); ?>"
            >

                <?php echo csrf_field(); ?>

                <?php echo method_field('PUT'); ?>


                <div class="admin-edit-grid">


                    

                    <div class="admin-edit-field">

                        <label for="name">
                            Admin Name
                        </label>

                        <input
                            type="text"
                            id="name"
                            name="name"
                            value="<?php echo e(old('name', $admin->name)); ?>"
                            maxlength="255"
                            required
                        >

                        <?php $__errorArgs = ['name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>

                            <span class="field-error">
                                <?php echo e($message); ?>

                            </span>

                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>

                    </div>


                    

                    <div class="admin-edit-field">

                        <label for="email">
                            Email Address
                        </label>

                        <input
                            type="email"
                            id="email"
                            name="email"
                            value="<?php echo e(old('email', $admin->email)); ?>"
                            maxlength="255"
                            required
                        >

                        <?php $__errorArgs = ['email'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>

                            <span class="field-error">
                                <?php echo e($message); ?>

                            </span>

                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>

                    </div>


                    

                    <div class="admin-edit-field">

                        <label for="mobile">
                            Mobile Number
                        </label>

                        <input
                            type="text"
                            id="mobile"
                            name="mobile"
                            value="<?php echo e(old('mobile', $admin->mobile)); ?>"
                            maxlength="20"
                            placeholder="Optional"
                        >

                        <?php $__errorArgs = ['mobile'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>

                            <span class="field-error">
                                <?php echo e($message); ?>

                            </span>

                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>

                    </div>


                    

                    <div class="admin-edit-field">

                        <label for="password">
                            New Password
                        </label>

                        <div class="password-wrapper">

                            <input
                                type="password"
                                id="password"
                                name="password"
                                minlength="8"
                                placeholder="Leave blank to keep current"
                            >

                            <button
                                type="button"
                                class="password-toggle"
                                onclick="togglePassword(
                                    'password',
                                    this
                                )"
                            >
                                Show
                            </button>

                        </div>

                        <?php $__errorArgs = ['password'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>

                            <span class="field-error">
                                <?php echo e($message); ?>

                            </span>

                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>

                    </div>


                    

                    <div class="admin-edit-field">

                        <label for="password_confirmation">
                            Confirm New Password
                        </label>

                        <div class="password-wrapper">

                            <input
                                type="password"
                                id="password_confirmation"
                                name="password_confirmation"
                                minlength="8"
                                placeholder="Confirm new password"
                            >

                            <button
                                type="button"
                                class="password-toggle"
                                onclick="togglePassword(
                                    'password_confirmation',
                                    this
                                )"
                            >
                                Show
                            </button>

                        </div>

                    </div>


                </div>


                

                <div class="admin-edit-actions">

                    <a
                        href="<?php echo e(route(
                                'admin.profile-settings.edit'
                            )); ?>"
                        class="admin-back-button"
                    >
                        ← Back
                    </a>


                    <button
                        type="submit"
                        class="admin-save-button"
                    >
                        ✓ &nbsp; Save Changes
                    </button>

                </div>


            </form>


        </div>

    </div>

</div>


<script>

function togglePassword(inputId, button)
{
    const input =
        document.getElementById(inputId);

    if (!input) {
        return;
    }

    if (input.type === 'password') {

        input.type = 'text';

        button.textContent = 'Hide';

    } else {

        input.type = 'password';

        button.textContent = 'Show';

    }
}

</script>

<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\laragon\www\emi-card\resources\views/admin/profile-settings/edit-admin.blade.php ENDPATH**/ ?>