diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php
index c348d809..8af1cf19 100644
--- a/ci4/app/Config/Routes.php
+++ b/ci4/app/Config/Routes.php
@@ -255,7 +255,7 @@ $routes->resource('maquinastarifasimpresion', ['namespace' => 'App\Controllers\
$routes->group('maquinaspapelesimpresion', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
$routes->post('datatable', 'Maquinaspapelesimpresion::datatable', ['as' => 'dataTableOfMaquinasPapelesImpresion']);
$routes->post('datatable_editor', 'Maquinaspapelesimpresion::datatable_editor', ['as' => 'editorOfMaquinasPapelImpresion']);
- $routes->post('updateOnTarifasChange', 'Maquinaspapelesimpresion::updateOnTarifasChange', ['as' => 'updateMaquinaPapelOnTarifasChange']);
+ $routes->post('updateTableOnChange', 'Maquinaspapelesimpresion::updateTableOnChange', ['as' => 'updateMaquinaPapelOnTarifasChange']);
});
$routes->resource('maquinastarifasimpresion', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Maquinastarifasimpresion', 'except' => 'show,new,create,update']);
diff --git a/ci4/app/Controllers/Configuracion/Maquinaspapelesimpresion.php b/ci4/app/Controllers/Configuracion/Maquinaspapelesimpresion.php
index 0a294715..c7202768 100644
--- a/ci4/app/Controllers/Configuracion/Maquinaspapelesimpresion.php
+++ b/ci4/app/Controllers/Configuracion/Maquinaspapelesimpresion.php
@@ -100,7 +100,7 @@ class Maquinaspapelesimpresion extends \App\Controllers\GoBaseResourceController
}
}
- public function updateOnTarifasChange(){
+ public function updateTableOnChange(){
if ($this->request->isAJAX()) {
@@ -119,88 +119,24 @@ class Maquinaspapelesimpresion extends \App\Controllers\GoBaseResourceController
// 1- Se obtienen los papeles que hay seleccionados (de la tabla lg_maquina_papel_impresion y que coincidan con las tarifas actuales)
$initData = $this->model->getInitData($isRotativa, $tarifas, $maquina_id);
// 2- Se cuentan los resultados. Si no hay coincidencias, hay que crear la tabla pivote con todos los papeles que cumplan la
- // condición de las tarifas y con la columna active a 0. Si hay coincidencias, se guardan los activos en un array
+ // condición de las tarifas y con la columna active a 0. Si hay coincidencias, se guardan los activos en un array
+ $selected_papers = $initData->countAllResults();
$active_values = [];
- if($initData->countAllResults() != 0){
+ if($selected_papers > 0){
$active_values = $this->model->getInitData($isRotativa, $tarifas, $maquina_id)->get()->getResult('array');
}
// Primero se borran las filas con la maquina_id de la tabla pivote
$this->model->deleteRows($maquina_id);
+
// Se insertan en la tabla pivote los resultados de los papeles que cumplan con las tarifas con el campo active = 0
- $papeles_ids = $papelimpresion_model->getIdPapelesActivos($tarifas)->get()->getResult('array');
- $data = [];
- foreach($papeles_ids as $papel_id){
- $value = [
- 'active' => 0,
- 'maquina_id' => $maquina_id,
- 'papel_impresion_id' => $papel_id['id']
- ];
- array_push($data, $value);
- }
+ $data = $papelimpresion_model->getIdPapelesImpresion($maquina_id, $tarifas)->get()->getResult('array');
$this->model->insertRows($data);
// Se actualizan los activos que había en caso de que los hubiera
- if(!empty($active_values)){
+ if(count($active_values)>0){
$this->model->updateRows($active_values);
}
- } else {
- return $this->failUnauthorized('Invalid request', 403);
- }
- }
- 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, 'lg_maquinas_tarifas_impresion' )
- ->fields(
- Field::inst( 'maquina_id' ),
- Field::inst( 'papel_impresion_id' ),
- Field::inst( 'active' )
-
- )
- ->validator( function($editor, $action, $data){
- if ($action === Editor::ACTION_EDIT){
- foreach ($data['data'] as $pkey => $values ){
- /*// Si no se quiere borrar...
- if($data['data'][$pkey]['is_deleted'] != 1)
- {
- // Cubierta y sobrecubierta sólo pueden ser en color
- if($values['uso'] != 'interior' && $values['tipo'] != 'color'){
- return lang('MaquinasTarifasImpresions.validation.cubierta_sobrecubierta_color');
- }
-
- $builder = $this->model->select('*')
- ->where(array(
- 'maquina_id'=> $values['maquina_id'],
- 'tipo'=> $values['tipo'],
- 'uso'=> $values['uso'],
- 'is_deleted'=> 0));
-
- if ($builder->countAllResults() >= 1){
- if(($action === Editor::ACTION_EDIT && $builder->get()->getFirstRow()->id != $pkey)
- || $action === Editor::ACTION_CREATE)
- return lang('MaquinasTarifasImpresions.validation.duplicated_uso_tipo');
-
- }
- }*/
- }
- }
- })
- ->debug(true)
- ->process( $_POST )
- ->data();
-
-
- /*// if unique key is set in DB
- if(isset($response['error'])){
- if(str_contains($response['error'], "tirada_min_tirada_max") &&
- str_contains($response['error'], "Duplicate entry ")){
- $response['error'] = lang('TarifaAcabadoLineas.validation.duplicated_tirada');
- }
- }*/
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
@@ -213,5 +149,55 @@ class Maquinaspapelesimpresion extends \App\Controllers\GoBaseResourceController
}
}
+ public function datatable_editor() {
+ if ($this->request->isAJAX()) {
+
+ $reqData = $this->request->getPost();
+ if($reqData['action'] =='edit'){
+
+ $rec_data = $reqData['data'];
+ $key = array_key_first($rec_data);
+ $maquina_id = $rec_data[$key]['maquina_id'] ?? -1;
+ $papel_id = $rec_data[$key]['papel_impresion_id'] ?? -1;
+ $active = $rec_data[$key]['active'] ?? -1;
+ $gramaje = $rec_data[$key]['gramaje'] ?? -1;
+
+ $data = [
+ 'maquina_id' => $maquina_id,
+ 'papel_impresion_id' => $papel_id,
+ 'active' => $active,
+ ];
+
+ // Se checkea que no haya otro papel con ese gramaje seleccionado y que la accion sea activar ese papel
+ if($this->model->getPapelActivo($maquina_id, $gramaje)->countAllResults() != 0 && intval($active)==1){
+ $response['error']= lang('MaquinasPapelImpresion.gramaje_duplicado');;
+ $ret_vals = [
+ 'DT_RowId' => 'row_'. $papel_id,
+ 'maquina_id' => $maquina_id,
+ 'papel_impresion_id' => $papel_id,
+ 'active' => '0',
+ ];
+ $response['data'] = $ret_vals;
+ }
+ else{
+ $this->model->updateRows([$data]);
+ }
+
+ $newTokenHash = csrf_hash();
+ $csrfTokenName = csrf_token();
+
+ $response[$csrfTokenName] = $newTokenHash;
+
+ echo json_encode($response);
+
+ }
+ else{
+ return $this->failUnauthorized('Invalid request', 403);
+ }
+ } else {
+ return $this->failUnauthorized('Invalid request', 403);
+ }
+ }
+
}
diff --git a/ci4/app/Controllers/Configuracion/Maquinastarifasimpresion.php b/ci4/app/Controllers/Configuracion/Maquinastarifasimpresion.php
index fcd24c70..4dfaeb1c 100644
--- a/ci4/app/Controllers/Configuracion/Maquinastarifasimpresion.php
+++ b/ci4/app/Controllers/Configuracion/Maquinastarifasimpresion.php
@@ -255,18 +255,21 @@ if ($this->request->getPost('predeterminado') == null ) {
return lang('MaquinasTarifasImpresions.validation.cubierta_sobrecubierta_color');
}
- $builder = $this->model->select('*')
- ->where(array(
- 'maquina_id'=> $values['maquina_id'],
- 'tipo'=> $values['tipo'],
- 'uso'=> $values['uso'],
- 'is_deleted'=> 0));
+ // No se pueden duplicar valores al crear
+ if($action === Editor::ACTION_CREATE){
+ $builder = $this->model->select('*')
+ ->where(array(
+ 'maquina_id'=> $values['maquina_id'],
+ 'tipo'=> $values['tipo'],
+ 'uso'=> $values['uso'],
+ 'is_deleted'=> 0));
- if ($builder->countAllResults() >= 1){
- if(($action === Editor::ACTION_EDIT && $builder->get()->getFirstRow()->id != $pkey)
- || $action === Editor::ACTION_CREATE)
- return lang('MaquinasTarifasImpresions.validation.duplicated_uso_tipo');
-
+ if ($builder->countAllResults() >= 1){
+ if(($action === Editor::ACTION_EDIT && $builder->get()->getFirstRow()->id != $pkey)
+ || $action === Editor::ACTION_CREATE)
+ return lang('MaquinasTarifasImpresions.validation.duplicated_uso_tipo');
+
+ }
}
}
}
diff --git a/ci4/app/Filters/LoginAuthFilter.php b/ci4/app/Filters/LoginAuthFilter.php
index 0a30acdb..65338cbf 100644
--- a/ci4/app/Filters/LoginAuthFilter.php
+++ b/ci4/app/Filters/LoginAuthFilter.php
@@ -144,6 +144,8 @@ class LoginAuthFilter implements FilterInterface
'Viewmode',
'GoBaseController',
'GoBaseResourceController',
+ 'Maquinaspapelesimpresion',
+ 'Maquinastarifasimpresion',
'My', 'Usuarios', 'Notification' // PARA LA DEMO
];
diff --git a/ci4/app/Language/en/Basic.php b/ci4/app/Language/en/Basic.php
index 21d74320..9162821a 100644
--- a/ci4/app/Language/en/Basic.php
+++ b/ci4/app/Language/en/Basic.php
@@ -80,10 +80,12 @@ return [
'text' => 'This action cannot be undone.',
'title' => 'Are you sure?',
'maxRowsReached' => 'No more lines can be added.',
- 'line' => 'the line'
+ 'line' => 'the line',
+ 'error_tittle' => 'Error',
],
'ok' => 'Ok',
'wait' => 'Wait',
+ 'yes' => 'Yes',
],
diff --git a/ci4/app/Language/en/MaquinasPapelImpresion.php b/ci4/app/Language/en/MaquinasPapelImpresion.php
index c5c594fa..b16a906e 100644
--- a/ci4/app/Language/en/MaquinasPapelImpresion.php
+++ b/ci4/app/Language/en/MaquinasPapelImpresion.php
@@ -4,5 +4,7 @@
return [
'activo' => 'Active',
-
+ 'gramaje_duplicado' => 'It can not be selected two pieces of paper with the same grammage',
+ 'sureToChangeRotativaTitle' => 'Are you sure to change this option?',
+ 'sureToChangeRotativaText' => 'This operation can\'t undone and the paper list will change.',
];
\ No newline at end of file
diff --git a/ci4/app/Language/es/Basic.php b/ci4/app/Language/es/Basic.php
index 5651f305..72ecf3b0 100644
--- a/ci4/app/Language/es/Basic.php
+++ b/ci4/app/Language/es/Basic.php
@@ -80,11 +80,12 @@ return [
'text' => 'Esta acción no se puede deshacer.',
'title' => 'Está seguro?',
'maxRowsReached' => 'No se pueden añadir más líneas.',
- 'line' => 'la línea'
-
+ 'line' => 'la línea',
+ 'error_tittle' => 'Error',
],
'ok' => 'Ok',
'wait' => 'Espere',
+ 'yes' => 'Si',
],
diff --git a/ci4/app/Language/es/MaquinasPapelImpresion.php b/ci4/app/Language/es/MaquinasPapelImpresion.php
index 2ef7d8ca..a9bc0ce8 100644
--- a/ci4/app/Language/es/MaquinasPapelImpresion.php
+++ b/ci4/app/Language/es/MaquinasPapelImpresion.php
@@ -4,5 +4,7 @@
return [
'activo' => 'Activo',
-
+ 'gramaje_duplicado' => 'No se pueden seleccionar dos papeles con el mismo gramaje',
+ 'sureToChangeRotativaTitle' => 'Está seguro de cambiar esta opción?',
+ 'sureToChangeRotativaText' => 'Está operación no se puede deshacer y cambiará la lista de papeles.',
];
\ No newline at end of file
diff --git a/ci4/app/Models/Configuracion/MaquinasPapelesImpresionModel.php b/ci4/app/Models/Configuracion/MaquinasPapelesImpresionModel.php
index 515a5c15..81b5e042 100644
--- a/ci4/app/Models/Configuracion/MaquinasPapelesImpresionModel.php
+++ b/ci4/app/Models/Configuracion/MaquinasPapelesImpresionModel.php
@@ -55,12 +55,9 @@ class MaquinasPapelesImpresionModel extends \App\Models\GoBaseModel
$builder->where("t3.is_deleted", 0);
$builder->where("t4.is_deleted", 0);
$builder->where("t3.isActivo", 1);
-
$builder->where("t3.rotativa", $isRotativa);
-
-
$isFirst = true;
$where_str = "(";
//Si hay tarifas...
@@ -92,7 +89,7 @@ class MaquinasPapelesImpresionModel extends \App\Models\GoBaseModel
$builder->where("t3.bn", 2);
}
-
+
return empty($search)
? $builder
: $builder
@@ -110,7 +107,6 @@ class MaquinasPapelesImpresionModel extends \App\Models\GoBaseModel
"t1.*"
);
-
$builder->join("lg_papel_impresion t2", "t1.papel_impresion_id = t2.id", "left");
$builder->where("t1.maquina_id", $maquina_id);
@@ -118,11 +114,9 @@ class MaquinasPapelesImpresionModel extends \App\Models\GoBaseModel
$builder->where("t2.isActivo", 1);
$builder->where("t2.rotativa", $isRotativa);
$builder->where("t1.active", 1);
-
-
$isFirst = true;
- $where_str = "";
+ $where_str = "(";
//Si hay tarifas...
if (!empty($tarifas)){
foreach ($tarifas as $tarifa){
@@ -142,18 +136,37 @@ class MaquinasPapelesImpresionModel extends \App\Models\GoBaseModel
$where_str .= "`t2`.`color`=1 ";
}
}
+ $where_str .= ")";
$builder->where($where_str);
}
// si no hay tarifas no hay que devolver nada
else{
// Se pone una condicion que no se puede dar
- $builder->where("t3.bn", 2);
+ $builder->where("t2.bn", 2);
}
-
-
+
return $builder;
}
+ // Funcion para consultar los papeles activos con un gramaje
+ // determinado seleccionados para una máquina
+ public function getPapelActivo($maquina_id=-1, $gramaje=-1){
+ $builder = $this->db
+ ->table($this->table . " t1")
+ ->select(
+ "t1.*"
+ );
+ $builder->join("lg_papel_impresion t2", "t1.papel_impresion_id = t2.id", "left");
+
+ $builder->where('t1.active', 1);
+ $builder->where('t1.maquina_id', $maquina_id);
+ $builder->where('t2.gramaje', $gramaje);
+
+ return $builder;
+ }
+
+
+ // Funcion que borra todos los registros de una máquina determinada
public function deleteRows($maquina_id = -1){
$this->db
->table($this->table . " t1")
@@ -161,12 +174,15 @@ class MaquinasPapelesImpresionModel extends \App\Models\GoBaseModel
->delete();
}
+
+ // Funcion que inserta valores en la tabla
public function insertRows($values = []){
if (!empty($values)){
$this->db->table($this->table)->insertBatch($values);
}
}
+ // Funcion que actualiza valores en la tabla
public function updateRows($values = []){
if (!empty($values)){
foreach($values as $value){
diff --git a/ci4/app/Models/Configuracion/MaquinasTarifasImpresionModel.php b/ci4/app/Models/Configuracion/MaquinasTarifasImpresionModel.php
index 37c0956b..baa68e59 100644
--- a/ci4/app/Models/Configuracion/MaquinasTarifasImpresionModel.php
+++ b/ci4/app/Models/Configuracion/MaquinasTarifasImpresionModel.php
@@ -13,15 +13,12 @@ class MaquinasTarifasImpresionModel extends \App\Models\GoBaseModel
protected $useAutoIncrement = true;
const SORTABLE = [
- 1 => "t1.id",
- 2 => "t1.maquina_id",
- 3 => "t1.tipo",
- 4 => "t1.precio",
- 5 => "t1.uso",
- 6 => "t2.nombre",
+ 1 => "t1.tipo",
+ 2 => "t1.uso",
+ 3 => "t1.precio",
];
- protected $allowedFields = ["maquina_id", "tipo", "precio", "uso"];
+ protected $allowedFields = ["maquina_id", "tipo", "precio", "uso", "user_created_id", "user_updated_id", "is_deleted", "deleted_at", "created_at", "updated_at"];
protected $returnType = "App\Entities\Configuracion\MaquinasTarifasImpresionEntity";
protected $useTimestamps = true;
@@ -95,7 +92,7 @@ class MaquinasTarifasImpresionModel extends \App\Models\GoBaseModel
$builder = $this->db
->table($this->table . " t1")
->select(
- "t1.id AS id, t1.tipo AS tipo, t1.precio AS precio, t1.uso AS uso, t2.nombre AS maquina"
+ "t1.id AS id, t1.tipo AS tipo, t1.precio AS precio, t1.uso AS uso"
);
//JJO
@@ -112,13 +109,11 @@ class MaquinasTarifasImpresionModel extends \App\Models\GoBaseModel
->orLike("t1.tipo", $search)
->orLike("t1.precio", $search)
->orLike("t1.uso", $search)
- ->orLike("t2.id", $search)
->orLike("t1.id", $search)
->orLike("t1.maquina_id", $search)
->orLike("t1.tipo", $search)
->orLike("t1.precio", $search)
->orLike("t1.uso", $search)
- ->orLike("t2.nombre", $search)
->groupEnd();
}
}
diff --git a/ci4/app/Models/Configuracion/PapelImpresionModel.php b/ci4/app/Models/Configuracion/PapelImpresionModel.php
index 0b8e23b4..7e71af37 100644
--- a/ci4/app/Models/Configuracion/PapelImpresionModel.php
+++ b/ci4/app/Models/Configuracion/PapelImpresionModel.php
@@ -231,12 +231,12 @@ class PapelImpresionModel extends \App\Models\GoBaseModel
->groupEnd();
}
- public function getIdPapelesActivos($tarifas = [])
+ public function getIdPapelesImpresion($maquina_id = -1, $tarifas = [])
{
$builder = $this->db
->table($this->table . " t1")
->select(
- "t1.id AS id"
+ "'".$maquina_id."'". " as maquina_id, t1.id AS papel_impresion_id, '0' as active"
);
$builder->where("t1.is_deleted", 0);
diff --git a/ci4/app/Views/themes/backend/vuexy/form/configuracion/maquinas/viewMaquinaForm.php b/ci4/app/Views/themes/backend/vuexy/form/configuracion/maquinas/viewMaquinaForm.php
index d4ec0ea2..224ae1a2 100644
--- a/ci4/app/Views/themes/backend/vuexy/form/configuracion/maquinas/viewMaquinaForm.php
+++ b/ci4/app/Views/themes/backend/vuexy/form/configuracion/maquinas/viewMaquinaForm.php
@@ -128,20 +128,38 @@
});
$('#isRotativa').on("click",function(el){
- if($(this).is(':checked')){
-
- $("#datosRotativa").show();
- isRotativa.watch = 1;
-
- }else{
- document.getElementById("precioTintaNegro").value = null;
- document.getElementById("precioTintaColor").value = null;
- document.getElementById("velocidadCorte").value = null;
- document.getElementById("precioHoraCorte").value = null;
- document.getElementById("metrosxminuto").value = null;
- $("#datosRotativa").hide();
- isRotativa.watch = 0;
- }
+
+ Swal.fire({
+ title: '= lang('MaquinasPapelImpresion.sureToChangeRotativaTitle') ?>',
+ text: '= lang('MaquinasPapelImpresion.sureToChangeRotativaText') ?>',
+ icon: 'warning',
+ showCancelButton: true,
+ confirmButtonColor: '#3085d6',
+ confirmButtonText: '= lang('Basic.global.yes') ?>',
+ cancelButtonText: '= lang('Basic.global.Cancel') ?>',
+ cancelButtonColor: '#d33'
+ })
+ .then((result) => {
+ if (result.value) {
+
+ if($(this).is(':checked')){
+ isRotativa.watch = 1;
+ $("#datosRotativa").show();
+ }else{
+ document.getElementById("precioTintaNegro").value = null;
+ document.getElementById("precioTintaColor").value = null;
+ document.getElementById("velocidadCorte").value = null;
+ document.getElementById("precioHoraCorte").value = null;
+ document.getElementById("metrosxminuto").value = null;
+ $("#datosRotativa").hide();
+ isRotativa.watch = 0;
+ }
+
+ theTable2.clearPipeline();
+ theTable2.draw();
+ yeniden(response.= csrf_token() ?>);
+ }
+ });
});
$('#isPadre').on("click",function(el){
@@ -268,24 +286,27 @@
editor.on( 'postSubmit', function ( e, json, data, action ) {
yeniden(json.= csrf_token() ?>);
- });
- editor.on( 'submitSuccess', function ( e, json, data, action ) {
-
- theTable.clearPipeline();
- theTable.draw();
-
+ setTimeout(() => {
+ console.log("1 Segundo esperado")
+ }, 1000);
$.ajax({
url: '= route_to('updateMaquinaPapelOnTarifasChange') ?>',
- data: function (d) {
- d.id_maquina= id;
- d.isRotativa = isRotativa.watch;
- d.= csrf_token() ?? "token" ?> = = csrf_token() ?>v;
+ data: {
+ maquina_id: id,
+ isRotativa: isRotativa.watch,
+ = csrf_token() ?? "token" ?>: = csrf_token() ?>v,
},
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
success:function(response){
- yeniden(response.= csrf_token() ?>);
+
+ token=JSON.parse(response).= csrf_token() ?>;
+ yeniden(token);
+
+ theTable.clearPipeline();
+ theTable.draw();
+
theTable2.clearPipeline();
theTable2.draw();
}
@@ -301,6 +322,7 @@
},
},
table : "#tableOfPapelesImpresion",
+ idSrc: 'papel_impresion_id',
fields: [
{
name: "active",
@@ -310,21 +332,11 @@
{ label: '', value: 1 }
]
},{
- "name": "papel_generico"
+ "name": "papel_impresion_id",
+ "type": "hidden"
},{
- "name": "papel_impresion",
- },{
- "name": "gramaje"
- },{
- "name": "bn"
- },{
- "name": "color"
- },{
- "name": "cubierta"
- },{
- "name": "sobrecubierta"
- },{
- "name": "rotativa"
+ "name": "gramaje",
+ "type": "hidden"
},{
"name": "maquina_id",
"type": "hidden"
@@ -332,36 +344,31 @@
]
} );
-
- /*editor2.on( 'preSubmit', function ( e, d, type ) {
- if(type === 'edit' ) {
- for (v in d.data){
- d.data[v]['maquina_id'] = id;
- //d.data[v]['papel_impresion_id'] = papel_impresion_id;
- }
- }
- });*/
-
-
editor2.on( 'postSubmit', function ( e, json, data, action ) {
-
yeniden(json.= csrf_token() ?>);
+ if(json.error){
+ document.getElementById("check_" + json.data.papel_impresion_id).checked = false;
+ Swal.fire({
+ icon: 'error',
+ title: '= lang('Basic.global.sweet.error_tittle') ?>',
+ text: json.error,
+ });
+ }
});
-
+
var theTable = $('#tableOfMaquinastarifasimpresion').DataTable( {
serverSide: true,
processing: true,
autoWidth: true,
responsive: true,
- lengthMenu: [ 5, 10, 25, 50],
order: [[ 1, "asc" ]],
- pageLength: 10,
- lengthChange: true,
- searching: true,
+ pageLength: 5,
+ lengthChange: false,
+ searching: false,
paging: true,
info: false,
- dom: "Bltp",
+ dom: "Blt",
ajax : $.fn.dataTable.pipeline( {
url: '= route_to('dataTableOfMaquinasTarifasImpresion') ?>',
data: {
@@ -441,6 +448,7 @@
data: function (d) {
d.maquina_id = id;
d.isRotativa = isRotativa.watch;
+ d.webguard_token = '= csrf_hash() ?>';
},
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
@@ -450,7 +458,7 @@
{ 'data': 'active',
render: function (data, type, row) {
if (type === 'display') {
- return '';
+ return '';
}
return data;
},
@@ -480,9 +488,9 @@
],
} );
+
// Cuando se clica en un checkbox hacer submit en el editor
theTable2.on( 'change', 'input.editor-active', function () {
- console.log($(this).closest('tr')[0]));
editor2
.edit( $(this).closest('tr'), false )
.set( 'active', $(this).prop( 'checked' ) ? 1 : 0 )