diff --git a/ci4/app/Controllers/Clientes/ClientePrecios.php b/ci4/app/Controllers/Clientes/ClientePrecios.php index bc258921..105d085a 100755 --- a/ci4/app/Controllers/Clientes/ClientePrecios.php +++ b/ci4/app/Controllers/Clientes/ClientePrecios.php @@ -205,21 +205,19 @@ class ClientePrecios extends \App\Controllers\BaseResourceController } }) ->on('preCreate', function ($editor, &$values) { - $session = session(); $datetime = (new \CodeIgniter\I18n\Time("now")); $editor ->field('user_updated_id') - ->setValue($session->id_user); + ->setValue(auth()->user()->id); $editor ->field('updated_at') ->setValue($datetime->format('Y-m-d H:i:s')); }) ->on('preEdit', function ($editor, &$values) { - $session = session(); $datetime = (new \CodeIgniter\I18n\Time("now")); $editor ->field('user_updated_id') - ->setValue($session->id_user); + ->setValue(auth()->user()->id); $editor ->field('updated_at') ->setValue($datetime->format('Y-m-d H:i:s')); diff --git a/httpdocs/assets/js/safekat/components/ConfirmDeleteModal.js b/httpdocs/assets/js/safekat/components/ConfirmDeleteModal.js index a874abf7..161c593f 100644 --- a/httpdocs/assets/js/safekat/components/ConfirmDeleteModal.js +++ b/httpdocs/assets/js/safekat/components/ConfirmDeleteModal.js @@ -1,9 +1,16 @@ class ConfirmDeleteModal { + constructor(alias = "") { - this.modalId = 'confirm2delete'; + + this.modalId = alias !== "" ? `confirm2delete-${alias}`: 'confirm2delete'; const removeClass = alias !== "" ? `btn-remove-${alias}` : 'btn-remove'; + this.btnCancelId = alias !== "" ? `btnCancelDelete-${alias}` : 'btnCancelDelete'; + this.btnDeleteId = alias !== "" ? `btnConfirmDelete-${alias}` : 'btnConfirmDelete'; + + this.data = null; + this.modalHtml = `
@@ -25,19 +32,39 @@ class ConfirmDeleteModal { `; } - // Método para mostrar el modal - show(callback) { + init() { + // Insertar el modal en el body del documento si no existe if (!document.getElementById(this.modalId)) { document.body.insertAdjacentHTML('beforeend', this.modalHtml); } + document.getElementById(this.btnCancelId).addEventListener('click', () => { + const modal = new bootstrap.Modal(document.getElementById(this.modalId)); + modal.hide(); + }); + } + + getModalId() { + return '#' + this.modalId; + } + + setData(data) { + this.data = data; + } + + getData() { + return this.data; + } + + // Método para mostrar el modal + show(callback) { // Mostrar el modal usando Bootstrap const modal = new bootstrap.Modal(document.getElementById(this.modalId)); modal.show(); // Configurar el evento de confirmación de eliminación - document.getElementById('confirmDelete').addEventListener('click', () => { + document.getElementById(this.btnDeleteId).addEventListener('click', () => { callback(); // Llamar al callback que el usuario haya proporcionado modal.hide(); // Cerrar el modal }); @@ -49,3 +76,6 @@ class ConfirmDeleteModal { modal.hide(); } } + + +export default ConfirmDeleteModal; \ No newline at end of file diff --git a/httpdocs/assets/js/safekat/components/table.js b/httpdocs/assets/js/safekat/components/table.js index 2f3c8eb3..84f94c7b 100644 --- a/httpdocs/assets/js/safekat/components/table.js +++ b/httpdocs/assets/js/safekat/components/table.js @@ -23,15 +23,13 @@ let Table = function ( dom = '<"mt-4"><"float-end"B><"float-start"l>