diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php index 3c958310..a71c49fa 100644 --- a/ci4/app/Config/Routes.php +++ b/ci4/app/Config/Routes.php @@ -410,16 +410,9 @@ $routes->resource('tarifasenvios', ['namespace' => 'App\Controllers\Tarifas', ' $routes->group('tarifasenviosprecios', ['namespace' => 'App\Controllers\Tarifas'], function ($routes) { -/* $routes->get('', 'Tarifasenvioserecios::index', ['as' => 'tarifaEnvioPrecioList']); - $routes->get('add', 'Tarifasenvioserecios::add', ['as' => 'newTarifaEnvioPrecio']); - $routes->post('add', 'Tarifasenvioserecios::add', ['as' => 'createTarifaEnvioPrecio']); - $routes->post('create', 'Tarifasenvioserecios::create', ['as' => 'ajaxCreateTarifaEnvioPrecio']); - $routes->put('(:num)/update', 'Tarifasenvioserecios::update/$1', ['as' => 'ajaxUpdateTarifaEnvioPrecio']); - $routes->post('(:num)/edit', 'Tarifasenvioserecios::edit/$1', ['as' => 'updateTarifaEnvioPrecio']); - $routes->post('datatable', 'Tarifasenvioserecios::datatable', ['as' => 'dataTableOfTarifaEnvioPrecio']); - $routes->post('allmenuitems', 'Tarifasenvioserecios::allItemsSelect', ['as' => 'select2ItemsOfTarifaEnvioPrecio']); - $routes->post('menuitems', 'Tarifasenvioserecios::menuItems', ['as' => 'menuItemsOfTarifaEnvioPrecio']); -*/}); + $routes->post('datatable', 'Tarifasenvioserecios::datatable', ['as' => 'dataTableOfTarifasEnvioPrecios']); + $routes->post('datatable_editor', 'Tarifasenvioserecios::datatable_editor', ['as' => 'editorOfTarifasEnvioPrecios']); +}); $routes->resource('tarifasenviosprecios', ['namespace' => 'App\Controllers\Tarifas', 'controller' => 'Tarifasenvioserecios', 'except' => 'show,new,create,update']); diff --git a/ci4/app/Controllers/Tarifas/Tarifasenvios.php b/ci4/app/Controllers/Tarifas/Tarifasenvios.php index 13dda667..15c72682 100644 --- a/ci4/app/Controllers/Tarifas/Tarifasenvios.php +++ b/ci4/app/Controllers/Tarifas/Tarifasenvios.php @@ -8,6 +8,8 @@ use App\Models\Collection; use App\Entities\Tarifas\TarifaEnvioEntity; use App\Models\Configuracion\PaisModel; +use App\Models\Compras\ProveedorModel; +use App\Models\Compras\ProveedorTipoModel; use App\Models\Tarifas\TarifaEnvioModel; @@ -43,7 +45,7 @@ class Tarifasenvios extends \App\Controllers\GoBaseResourceController { // Breadcrumbs $this->viewData['breadcrumb'] = [ ['title' => lang("App.menu_tarifas"), 'route' => "javascript:void(0);", 'active' => false], - ['title' => lang("App.menu_tarifasenvios"), 'route' => site_url('tarifas/tarifasenvios'), 'active' => true] + ['title' => lang("App.menu_tarifaenvio"), 'route' => site_url('tarifas/tarifasenvios'), 'active' => true] ]; parent::initController($request, $response, $logger); @@ -217,6 +219,8 @@ class Tarifasenvios extends \App\Controllers\GoBaseResourceController { $this->viewData['boxTitle'] = lang('Basic.global.edit2').' '.lang('TarifasEnvios.moduleTitle').' '.lang('Basic.global.edit3'); + //JJO + $this->viewData['proveedores'] = $this->getProveedores(); return $this->displayForm(__METHOD__, $id); } // end function edit(...) @@ -307,4 +311,12 @@ class Tarifasenvios extends \App\Controllers\GoBaseResourceController { return $data; } + private function getProveedores(){ + $provTipoModel = new ProveedorTipoModel(); + $provModel = new ProveedorModel(); + + $tipoId = $provTipoModel->getTipoId("Transporte"); + return $provModel->getProvList($tipoId); + } + } diff --git a/ci4/app/Controllers/Tarifas/Tarifasenvioserecios.php b/ci4/app/Controllers/Tarifas/Tarifasenvioserecios.php index 41745e29..16626478 100644 --- a/ci4/app/Controllers/Tarifas/Tarifasenvioserecios.php +++ b/ci4/app/Controllers/Tarifas/Tarifasenvioserecios.php @@ -13,6 +13,10 @@ use App\Models\Tarifas\TarifaEnvioModel; use App\Models\Tarifas\TarifaEnvioPrecioModel; +use + DataTables\Editor, + DataTables\Editor\Field; + class Tarifasenvioserecios extends \App\Controllers\GoBaseResourceController { protected $modelName = TarifaEnvioPrecioModel::class; @@ -34,6 +38,12 @@ class Tarifasenvioserecios extends \App\Controllers\GoBaseResourceController { public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) { $this->viewData['pageTitle'] = lang('TarifasEnviosPrecios.moduleTitle'); $this->viewData['usingSweetAlert'] = true; + + // Se indica que este controlador trabaja con soft_delete + $this->soft_delete = true; + // Se indica el flag para los ficheros borrados + $this->delete_flag = 1; + parent::initController($request, $response, $logger); } @@ -202,6 +212,103 @@ class Tarifasenvioserecios extends \App\Controllers\GoBaseResourceController { } // end function edit(...) + public function datatable_editor() + { + if ($this->request->isAJAX()) { + + include(APPPATH . "ThirdParty/DatatablesEditor/DataTables.php"); + + // Build our Editor instance and process the data coming from _POST + $response = Editor::inst($db, 'tarifas_envios_precios') + ->fields( + Field::inst('tipo_envio') + ->validator('Validate::required', array( + 'message' => lang('TarifasEnviosPrecios.validation.tipo_envio.required')) + ), + Field::inst('peso_min') + ->validator('Validate::required', array( + 'message' => lang('TarifasEnviosPrecios.validation.peso_min.required')) + ) + ->validator('Validate::numeric', array( + 'message' => lang('TarifasEnviosPrecios.validation.peso_min.decimal')) + ), + Field::inst('peso_max') + ->validator('Validate::required', array( + 'message' => lang('TarifasEnviosPrecios.validation.peso_max.required')) + ) + ->validator('Validate::numeric', array( + 'message' => lang('TarifasEnviosPrecios.validation.peso_max.decimal')) + ), + Field::inst('precio') + ->validator('Validate::required', array( + 'message' => lang('TarifasEnviosPrecios.validation.precio.required')) + ) + ->validator('Validate::numeric', array( + 'message' => lang('TarifasEnviosPrecios.validation.precio.decimal')) + ), + Field::inst('precio_adicional') + ->validator('Validate::required', array( + 'message' => lang('TarifasEnviosPrecios.validation.precio_adicional.required')) + ) + ->validator('Validate::numeric', array( + 'message' => lang('TarifasEnviosPrecios.validation.precio_adicional.decimal')) + ), + Field::inst('zona_envio_id'), + Field::inst('proveedor_id'), + Field::inst('user_created_id'), + Field::inst('created_at'), + Field::inst('user_updated_id'), + Field::inst('updated_at'), + Field::inst('is_deleted'), + Field::inst('deleted_at'), + + ) + ->validator(function ($editor, $action, $data) { + if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT) { + foreach ($data['data'] as $pkey => $values) { + // Si no se quiere borrar... + if ($data['data'][$pkey]['is_deleted'] != 1) { + /*Los CP son string... consultar si checkear*/ + } + } + } + }) + ->on('preCreate', function ($editor, &$values) { + $session = session(); + $datetime = (new \CodeIgniter\I18n\Time("now")); + $editor + ->field('user_created_id') + ->setValue($session->id_user); + $editor + ->field('created_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); + $editor + ->field('updated_at') + ->setValue($datetime->format('Y-m-d H:i:s')); + }) + ->debug(true) + ->process($_POST) + ->data(); + + $newTokenHash = csrf_hash(); + $csrfTokenName = csrf_token(); + + $response[$csrfTokenName] = $newTokenHash; + + echo json_encode($response); + + } else { + return $this->failUnauthorized('Invalid request', 403); + } + } + public function datatable() { if ($this->request->isAJAX()) { diff --git a/ci4/app/Controllers/Tarifas/Tarifasenvioszonas.php b/ci4/app/Controllers/Tarifas/Tarifasenvioszonas.php index 2dd85204..3efde431 100644 --- a/ci4/app/Controllers/Tarifas/Tarifasenvioszonas.php +++ b/ci4/app/Controllers/Tarifas/Tarifasenvioszonas.php @@ -13,6 +13,8 @@ use App\Models\Tarifas\TarifaEnvioZonaModel; use DataTables\Editor, + + DataTables\Editor\Validate, DataTables\Editor\Field; class Tarifasenvioszonas extends \App\Controllers\GoBaseResourceController { @@ -36,6 +38,12 @@ class Tarifasenvioszonas extends \App\Controllers\GoBaseResourceController { public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) { $this->viewData['pageTitle'] = lang('TarifasEnviosZonas.moduleTitle'); $this->viewData['usingSweetAlert'] = true; + + // Se indica que este controlador trabaja con soft_delete + $this->soft_delete = true; + // Se indica el flag para los ficheros borrados + $this->delete_flag = 1; + parent::initController($request, $response, $logger); } @@ -191,7 +199,7 @@ class Tarifasenvioszonas extends \App\Controllers\GoBaseResourceController { $this->viewData['tarifaEnvioZonaEntity'] = $tarifaEnvioZonaEntity; $this->viewData['tarifaEnvioList'] = $this->getTarifaEnvioListItems($tarifaEnvioZonaEntity->tarifa_envio_id ?? null); - $this->viewData['formAction'] = route_to('updateTarifaEnvioZona', $id); + $this->viewData['formAction'] = route_to('updateTarifaEnvioZona', $id); $this->viewData['boxTitle'] = lang('Basic.global.edit2').' '.lang('TarifasEnviosZonas.moduleTitle').' '.lang('Basic.global.edit3'); @@ -213,14 +221,14 @@ class Tarifasenvioszonas extends \App\Controllers\GoBaseResourceController { ->validator('Validate::required', array( 'message' => lang('TarifasEnviosZonas.validation.cp_inicial.required')) ) - ->validator('Validate::maxLen(10)', array( + ->validator(Validate::maxLen(10), array( 'message' => lang('TarifasEnviosZonas.validation.cp_inicial.max_length')) ), Field::inst('cp_final') ->validator('Validate::required', array( 'message' => lang('TarifasEnviosZonas.validation.cp_final.required')) ) - ->validator('Validate::maxLen(10)', array( + ->validator(Validate::maxLen(10), array( 'message' => lang('TarifasEnviosZonas.validation.cp_final.max_length')) ), Field::inst('importe_fijo') @@ -296,8 +304,8 @@ class Tarifasenvioszonas extends \App\Controllers\GoBaseResourceController { $start = $reqData['start'] ?? 0; $length = $reqData['length'] ?? 5; $search = $reqData['search']['value']; - $requestedOrder = $reqData['order']['0']['column'] ?? 1; - $order = TarifaEnvioZonaModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 1]; + $requestedOrder = $reqData['order']['0']['column'] ?? 0; + $order = TarifaEnvioZonaModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 0]; $dir = $reqData['order']['0']['dir'] ?? 'asc'; $resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject(); diff --git a/ci4/app/Language/en/TarifasEnviosPrecios.php b/ci4/app/Language/en/TarifasEnviosPrecios.php index 8e05f238..1828053a 100644 --- a/ci4/app/Language/en/TarifasEnviosPrecios.php +++ b/ci4/app/Language/en/TarifasEnviosPrecios.php @@ -25,6 +25,7 @@ return [ 'userCreatedId' => 'User Created ID', 'userUpdatedId' => 'User Updated ID', 'validation' => [ + 'error_seleccion_zonas' => 'A line from the zones table must be selected before creating a new record.', 'peso_max' => [ 'decimal' => 'The field must contain a decimal number.', 'required' => 'The field is required.', diff --git a/ci4/app/Language/es/TarifasEnviosPrecios.php b/ci4/app/Language/es/TarifasEnviosPrecios.php index 278dd1ab..a1e020d8 100644 --- a/ci4/app/Language/es/TarifasEnviosPrecios.php +++ b/ci4/app/Language/es/TarifasEnviosPrecios.php @@ -13,8 +13,8 @@ return [ 'palets' => 'Palets', 'pesoMax' => 'Peso Max', 'pesoMin' => 'Peso Min', - 'precio' => 'Precio', - 'precioAdicional' => 'Precio Adicional', + 'precio' => 'Precio peso mín.', + 'precioAdicional' => 'Precio Kg Adicional', 'proveedorId' => 'Proveedor', 'tarifaEnvioId' => 'Tarifa Envío', 'tarifaEnvioPrecio' => 'Peso y Precio', @@ -25,6 +25,7 @@ return [ 'userCreatedId' => 'User Created ID', 'userUpdatedId' => 'User Updated ID', 'validation' => [ + 'error_seleccion_zonas' => 'Debe seleccionar una línea de la tabla zonas antes de crear un registro nuevo.', 'peso_max' => [ 'decimal' => 'El campo debe contener un número decimal.', 'required' => 'El campo es obligatorio.', diff --git a/ci4/app/Models/Tarifas/TarifaEnvioPrecioModel.php b/ci4/app/Models/Tarifas/TarifaEnvioPrecioModel.php index 3b842fa8..d97b96aa 100644 --- a/ci4/app/Models/Tarifas/TarifaEnvioPrecioModel.php +++ b/ci4/app/Models/Tarifas/TarifaEnvioPrecioModel.php @@ -13,16 +13,12 @@ class TarifaEnvioPrecioModel extends \App\Models\GoBaseModel protected $useAutoIncrement = true; const SORTABLE = [ - 1 => "t1.id", - 2 => "t1.tarifa_envio_id", - 3 => "t1.proveedor_id", - 4 => "t1.tipo_envio", - 5 => "t1.peso_min", - 6 => "t1.peso_max", - 7 => "t1.precio", - 8 => "t1.precio_adicional", - 9 => "t2.id", - 10 => "t3.id", + 0 => "t1.proveedor", + 1 => "t1.tipo_envio", + 2 => "t1.peso_min", + 3 => "t1.peso_max", + 4 => "t1.precio", + 5 => "t1.precio_adicional" ]; protected $allowedFields = [ @@ -33,6 +29,8 @@ class TarifaEnvioPrecioModel extends \App\Models\GoBaseModel "peso_max", "precio", "precio_adicional", + "deleted_at", + "is_deleted", ]; protected $returnType = "App\Entities\Tarifas\TarifaEnvioPrecioEntity"; @@ -123,9 +121,10 @@ class TarifaEnvioPrecioModel extends \App\Models\GoBaseModel $builder = $this->db ->table($this->table . " t1") ->select( - "t1.id AS id, t1.tipo_envio AS tipo_envio, t1.peso_min AS peso_min, t1.peso_max AS peso_max, t1.precio AS precio, t1.precio_adicional AS precio_adicional, t2.id AS tarifa_envio, t3.id AS proveedor" + "t1.id AS id, t1.tipo_envio AS tipo_envio, t1.peso_min AS peso_min, t1.peso_max AS peso_max, t1.precio AS precio, + t1.precio_adicional AS precio_adicional, t2.id AS tarifa_envio, t3.id AS proveedor_id, t3.nombre AS proveedor" ); - $builder->join("lg_tarifas_envios t2", "t1.tarifa_envio_id = t2.id", "left"); + $builder->join("tarifas_envios_zonas t2", "t1.zona_envio_id = t2.id", "left"); $builder->join("lg_proveedores t3", "t1.proveedor_id = t3.id", "left"); //JJO @@ -135,24 +134,18 @@ class TarifaEnvioPrecioModel extends \App\Models\GoBaseModel ? $builder : $builder ->groupStart() - ->like("t1.id", $search) + ->like("t1.tipo_envio", $search) + ->orLike("t1.peso_min", $search) + ->orLike("t1.peso_max", $search) + ->orLike("t1.precio", $search) + ->orLike("t1.precio_adicional", $search) + ->orLike("t3.nombre", $search) ->orLike("t1.tipo_envio", $search) ->orLike("t1.peso_min", $search) ->orLike("t1.peso_max", $search) ->orLike("t1.precio", $search) ->orLike("t1.precio_adicional", $search) - ->orLike("t2.id", $search) - ->orLike("t3.id", $search) - ->orLike("t1.id", $search) - ->orLike("t1.tarifa_envio_id", $search) - ->orLike("t1.proveedor_id", $search) - ->orLike("t1.tipo_envio", $search) - ->orLike("t1.peso_min", $search) - ->orLike("t1.peso_max", $search) - ->orLike("t1.precio", $search) - ->orLike("t1.precio_adicional", $search) - ->orLike("t2.id", $search) - ->orLike("t3.id", $search) + ->orLike("t3.nombre", $search) ->groupEnd(); } } diff --git a/ci4/app/Models/Tarifas/TarifaEnvioZonaModel.php b/ci4/app/Models/Tarifas/TarifaEnvioZonaModel.php index a872ff99..f0759b5c 100644 --- a/ci4/app/Models/Tarifas/TarifaEnvioZonaModel.php +++ b/ci4/app/Models/Tarifas/TarifaEnvioZonaModel.php @@ -13,11 +13,9 @@ class TarifaEnvioZonaModel extends \App\Models\GoBaseModel protected $useAutoIncrement = true; const SORTABLE = [ - 1 => "t1.tarifa_envio_id", - 2 => "t1.cp_inicial", - 3 => "t1.cp_final", - 4 => "t1.importe_fijo", - 5 => "t2.id", + 0 => "t1.cp_inicial", + 1 => "t1.cp_final", + 2 => "t1.importe_fijo", ]; protected $allowedFields = ["tarifa_envio_id", "cp_inicial", "cp_final", "importe_fijo"]; @@ -109,12 +107,9 @@ class TarifaEnvioZonaModel extends \App\Models\GoBaseModel ->like("t1.cp_inicial", $search) ->orLike("t1.cp_final", $search) ->orLike("t1.importe_fijo", $search) - ->orLike("t2.id", $search) - ->orLike("t1.tarifa_envio_id", $search) ->orLike("t1.cp_inicial", $search) ->orLike("t1.cp_final", $search) ->orLike("t1.importe_fijo", $search) - ->orLike("t2.id", $search) ->groupEnd(); } } diff --git a/ci4/app/Views/themes/backend/vuexy/form/tarifas/envios/viewTarifaEnvioForm.php b/ci4/app/Views/themes/backend/vuexy/form/tarifas/envios/viewTarifaEnvioForm.php index 96ed63a8..8ac1be99 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/tarifas/envios/viewTarifaEnvioForm.php +++ b/ci4/app/Views/themes/backend/vuexy/form/tarifas/envios/viewTarifaEnvioForm.php @@ -16,10 +16,15 @@ getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?> - @@ -54,6 +59,38 @@ + +
+
+

+ + +

+ +
+
+ + + + + + + + + + + + + + + +
+
+
+
+
@@ -109,11 +146,11 @@ const row = $(this).closest('tr'); if ($.isNumeric(dataId)) { - if($(this).attr('table').includes('tiradas')){ - remove_tiradas(dataId, row); + if($(this).attr('table').includes('zonas')){ + remove_zonas(dataId, row); } - else if ($(this).attr('table').includes('lineas')){ - remove_lineas(dataId, row); + else if ($(this).attr('table').includes('precios')){ + remove_precios(dataId, row); } } }); @@ -253,7 +290,7 @@ } ); // Delete row - function remove_lineas(dataId, row){ + function remove_zonas(dataId, row){ $.ajax({ url: `/tarifas/tarifasenvioszonas/delete/${dataId}`, @@ -287,10 +324,190 @@ endSection() ?> + + + +section("additionalInlineJs") ?> +const lastColNr2 = $('#tableOfPrecios').find("tr:first th").length - 1; + + var editor2 = new $.fn.dataTable.Editor( { + ajax: { + url: "", + headers: { + : v, + }, + }, + table : "#tableOfPrecios", + idSrc: 'id', + fields: [ + { + "name": "proveedor_id", + "type": "select" + }, { + name: "tipo_envio" + }, { + name: "peso_min" + }, { + name: "peso_max" + }, { + name: "precio" + }, { + name: "precio_adicional" + }, { + "name": "zona_envio_id", + "type": "hidden" + }, { + "name": "proveedor_id", + "type": "hidden" + }, { + "name": "deleted_at", + "type": "hidden" + },{ + "name": "is_deleted", + "type": "hidden" + }, + ] + } ); + + // Generación de la lista de proveedores (id, nombre) para encuadernación + const suppliersList = ; + editor2.field( 'proveedor_id' ).update( suppliersList ); + + editor2.on( 'preSubmit', function ( e, d, type ) { + if ( type === 'create'){ + d.data[0]['zona_envio_id'] = selected_zona_id; + } + else if(type === 'edit' ) { + for (v in d.data){ + d.data[v]['zona_envio_id'] = selected_zona_id; + } + } + }); + + + editor2.on( 'postSubmit', function ( e, json, data, action ) { + + yeniden(json.); + }); + + + editor2.on( 'submitSuccess', function ( e, json, data, action ) { + + theTable2.clearPipeline(); + theTable2.draw(); + }); + + + var theTable2 = $('#tableOfPrecios').DataTable( { + serverSide: true, + processing: true, + autoWidth: true, + responsive: true, + lengthMenu: [ 5, 10, 25, 50, 100], + order: [[ 0, "asc" ], [ 1, "asc" ]], + pageLength: 25, + lengthChange: true, + searching: false, + paging: true, + info: false, + dom: '<"mt-4"><"float-end"B><"float-start"l><"mt-4 mb-3"p>', + ajax : $.fn.dataTable.pipeline( { + url: '', + data: function ( d ) { + d.zona_envio_id = selected_zona_id; + }, + method: 'POST', + headers: {'X-Requested-With': 'XMLHttpRequest'}, + async: true, + }), + columns: [ + { 'data': 'proveedor' }, + { 'data': 'tipo_envio' }, + { 'data': 'peso_min' }, + { 'data': 'peso_max' }, + { 'data': 'precio' }, + { 'data': 'precio_adicional' }, + { + data: actionBtns, + className: 'row-edit dt-center' + } + ], + columnDefs: [ + { + orderable: false, + searchable: false, + targets: [lastColNr2] + }, + {"orderData": [ 0, 1 ], "targets": 0 }, + + ], + language: { + url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/i18n ?>.json" + }, + buttons: [ { + className: 'btn btn-primary float-end me-sm-3 me-1', + extend: "createInline", + editor: editor2, + formOptions: { + submitTrigger: -1, + submitHtml: '' + + }, + action: function ( e, dt, node, config ) { + if(selected_zona_id == -1){ + popErrorAlert(""); + } + else{ + formOptions= { + submitTrigger: -1, + submitHtml: '' + + }; + editor2.inlineCreate(config.position, formOptions); + } + }, + } ], + + } ); + + + // Activate an inline edit on click of a table cell + $('#tableOfPrecios').on( 'click', 'tbody span.edit', function (e) { + editor.inline( + theTable2.cells(this.parentNode.parentNode, '*').nodes(), + { + cancelHtml: '', + cancelTrigger: 'span.cancel', + submitHtml: '', + submitTrigger: 'span.edit', + submit: 'allIfChanged' + } + ); + } ); + + // Delete row + function remove_precios(dataId, row){ + + $.ajax({ + url: `/tarifas/tarifasenviosprecios/delete/${dataId}`, + method: 'GET', + }).done((data, textStatus, jqXHR) => { + $('#confirm2delete').modal('toggle'); + theTable2.clearPipeline(); + theTable2.row($(row)).invalidate().draw(); + popSuccessAlert(data.msg ?? jqXHR.statusText); + }).fail((jqXHR, textStatus, errorThrown) => { + popErrorAlert(jqXHR.responseJSON.messages.error) + }); + } + +endSection() ?> + section('css') ?> + endSection() ?>