<script>
    (() => {
        const ctx = window.factoryCrud;
        if (!ctx) {
            return;
        }

        const updateCedulaUsuarioEditState = (isEditMode) => {
            const input = document.getElementById(ctx.selectors.cedulaUsuarioDisplay);
            if (!input) {
                return;
            }

            input.readOnly = isEditMode;
            input.classList.toggle('bg-light', isEditMode);
        };

        ctx.hooks.onSetModalMode.push(({ isEditMode }) => {
            updateCedulaUsuarioEditState(isEditMode);
        });

        ctx.hooks.afterBoot.push(() => {
            updateCedulaUsuarioEditState(false);
        });
    })();
</script>