<?php $__env->startPush('js'); ?>
    <?php $bassetBlock = 'admin/js/toggle-password.js'; ob_start(); ?>
        <script nonce="<?php echo e(basset_nonce('script')); ?>">
            const passwordFields = document.querySelectorAll('.toggle-password');

            passwordFields.forEach((wrapper) => {
                wrapper.classList.add('position-relative');

                let viewPasswordButton = document.createElement('button');

                viewPasswordButton.setAttribute('type', 'button');
                viewPasswordButton.className = 'btn btn-link shadow-none position-absolute top-0 right-0';
                viewPasswordButton.innerHTML = '<i class="fas fa-eye">';

                if (wrapper.classList.contains('has-danger')) {
                    viewPasswordButton.classList.add('mr-4');
                }

                wrapper.appendChild(viewPasswordButton);

                viewPasswordButton.addEventListener('click', function() {
                    if (passwordInput = wrapper.querySelector('input[type="password"]')) {
                        viewPasswordButton.innerHTML = '<i class="fas fa-eye-slash">';
                        passwordInput.setAttribute('type', 'text');
                    } else if (textInput = wrapper.querySelector('input[type="text"]')) {
                        viewPasswordButton.innerHTML = '<i class="fas fa-eye">';
                        textInput.setAttribute('type', 'password');
                    }
                });
            });
        </script>
    <?php Basset::bassetBlock($bassetBlock, ob_get_clean()); ?>
<?php $__env->stopPush(); ?>
<?php /**PATH /home/ifsb/public_html/portal.ifsb.org/resources/views/admin/components/toggle-password.blade.php ENDPATH**/ ?>