mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
terminando la consulta get resource del modelo maquinaspapelimpresion
This commit is contained in:
@ -252,6 +252,11 @@ $routes->group('maquinastarifasimpresion', ['namespace' => 'App\Controllers\Conf
|
|||||||
});
|
});
|
||||||
$routes->resource('maquinastarifasimpresion', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Maquinastarifasimpresion', 'except' => 'show,new,create,update']);
|
$routes->resource('maquinastarifasimpresion', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Maquinastarifasimpresion', 'except' => 'show,new,create,update']);
|
||||||
|
|
||||||
|
$routes->group('maquinaspapelesimpresion', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||||
|
$routes->post('datatable', 'Maquinaspapelesimpresion::datatable', ['as' => 'dataTableOfMaquinasPapelesImpresion']);
|
||||||
|
});
|
||||||
|
$routes->resource('maquinastarifasimpresion', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Maquinastarifasimpresion', 'except' => 'show,new,create,update']);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$routes->group('profile', ['namespace' => 'App\Controllers'], function ($routes) {
|
$routes->group('profile', ['namespace' => 'App\Controllers'], function ($routes) {
|
||||||
|
|||||||
@ -5,9 +5,9 @@ use App\Controllers\GoBaseResourceController;
|
|||||||
|
|
||||||
use App\Models\Collection;
|
use App\Models\Collection;
|
||||||
|
|
||||||
use App\Entities\Configuracion\MaquinasTarifasImpresionEntity;
|
use App\Entities\Configuracion\MaquinasPapelesImpresionEntity;
|
||||||
|
|
||||||
use App\Models\Configuracion\MaquinasTarifasImpresionModel;
|
use App\Models\Configuracion\MaquinasPapelesImpresionModel;
|
||||||
|
|
||||||
use App\Models\Configuracion\MaquinaModel;
|
use App\Models\Configuracion\MaquinaModel;
|
||||||
|
|
||||||
@ -22,38 +22,74 @@ use
|
|||||||
DataTables\Editor\Validate,
|
DataTables\Editor\Validate,
|
||||||
DataTables\Editor\ValidateOptions;
|
DataTables\Editor\ValidateOptions;
|
||||||
|
|
||||||
class Maquinaspapelesimpresion extends \App\Controllers\GoBaseResourceController {
|
class Maquinaspapelesimpresion extends \App\Controllers\GoBaseResourceController {
|
||||||
|
|
||||||
|
|
||||||
|
protected $modelName = MaquinasPapelesImpresionModel::class;
|
||||||
|
protected $format = 'json';
|
||||||
|
|
||||||
|
protected static $singularObjectName = 'Maquinas Papel Impresion';
|
||||||
|
protected static $singularObjectNameCc = 'maquinasPapelImpresion';
|
||||||
|
protected static $pluralObjectName = 'Maquinas Papeles Impresion';
|
||||||
|
protected static $pluralObjectNameCc = 'maquinasPapelesImpresion';
|
||||||
|
|
||||||
|
protected static $controllerSlug = 'maquinaspapelesimpresion';
|
||||||
|
|
||||||
|
protected static $viewPath = 'themes/backend/vuexy/form/configuracion/maquinas/';
|
||||||
|
|
||||||
|
protected $indexRoute = '';
|
||||||
|
|
||||||
public function datatable_maquinas() {
|
|
||||||
if ($this->request->isAJAX()) {
|
|
||||||
$reqData = $this->request->getPost();
|
|
||||||
if (!isset($reqData['draw']) || !isset($reqData['columns']) ) {
|
|
||||||
$errstr = 'No data available in response to this specific request.';
|
|
||||||
$response = $this->respond(Collection::datatable( [], 0, 0, $errstr ), 400, $errstr);
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
$start = $reqData['start'] ?? 0;
|
|
||||||
$length = $reqData['length'] ?? 5;
|
|
||||||
$search = $reqData['search']['value'];
|
|
||||||
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
|
|
||||||
$order = MaquinasTarifasImpresionModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 1];
|
|
||||||
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
|
||||||
|
|
||||||
// el primer dato representa el uso y el segundo el tipo
|
|
||||||
$tarifas = $reqData['tarifas'] ?? null;
|
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) {
|
||||||
// Para saber si el papel que se tiene que mostrar es para rotativa
|
$this->viewData['pageTitle'] = '';
|
||||||
$isRotativa= $reqData['isRotativa'] ?? false;
|
$this->viewData['usingSweetAlert'] = true;
|
||||||
|
parent::initController($request, $response, $logger);
|
||||||
$resourceData = $this->model->getResource("", $tarifas, $isRotativa)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
}
|
||||||
|
|
||||||
return $this->respond(Collection::datatable(
|
|
||||||
$resourceData,
|
public function index() {
|
||||||
$this->model->getResource()->countAllResults(),
|
|
||||||
$this->model->getResource($search)->countAllResults()
|
$viewData = [
|
||||||
));
|
'currentModule' => static::$controllerSlug,
|
||||||
} else {
|
'pageSubTitle' => '',
|
||||||
return $this->failUnauthorized('Invalid request', 403);
|
'maquinasTarifasImpresion' => new Maquinaspapelesimpresion(),
|
||||||
|
'usingServerSideDataTable' => true,
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function datatable() {
|
||||||
|
if ($this->request->isAJAX()) {
|
||||||
|
$reqData = $this->request->getPost();
|
||||||
|
if (!isset($reqData['draw']) || !isset($reqData['columns']) ) {
|
||||||
|
$errstr = 'No data available in response to this specific request.';
|
||||||
|
$response = $this->respond(Collection::datatable( [], 0, 0, $errstr ), 400, $errstr);
|
||||||
|
return $response;
|
||||||
}
|
}
|
||||||
}
|
$start = $reqData['start'] ?? 0;
|
||||||
|
$length = $reqData['length'] ?? 5;
|
||||||
|
$search = $reqData['search']['value'];
|
||||||
|
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
|
||||||
|
$order = MaquinasPapelesImpresionModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 1];
|
||||||
|
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
||||||
|
|
||||||
}
|
// el primer dato representa el uso y el segundo el tipo
|
||||||
|
//$tarifas = $reqData['tarifas'] ?? [];
|
||||||
|
// Para saber si el papel que se tiene que mostrar es para rotativa
|
||||||
|
$isRotativa= $reqData['isRotativa'] ?? 0;
|
||||||
|
|
||||||
|
$resourceData = $this->model->getResource("", $isRotativa)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||||
|
|
||||||
|
return $this->respond(Collection::datatable(
|
||||||
|
$resourceData,
|
||||||
|
$this->model->getResource()->countAllResults(),
|
||||||
|
$this->model->getResource($search, $isRotativa)->countAllResults()
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
return $this->failUnauthorized('Invalid request', 403);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@ -235,10 +235,6 @@ if ($this->request->getPost('predeterminado') == null ) {
|
|||||||
->validator( 'Validate::notEmpty',array(
|
->validator( 'Validate::notEmpty',array(
|
||||||
'message' => lang('MaquinasTarifasImpresions.validation.tipo.required') )
|
'message' => lang('MaquinasTarifasImpresions.validation.tipo.required') )
|
||||||
),
|
),
|
||||||
Field::inst( 'predeterminado' )
|
|
||||||
->validator( 'Validate::notEmpty',array(
|
|
||||||
'message' => lang('MaquinasTarifasImpresions.validation.tipo.required') )
|
|
||||||
),
|
|
||||||
Field::inst( 'maquina_id' ),
|
Field::inst( 'maquina_id' ),
|
||||||
Field::inst( 'user_created_id' ),
|
Field::inst( 'user_created_id' ),
|
||||||
Field::inst( 'created_at' ),
|
Field::inst( 'created_at' ),
|
||||||
@ -254,6 +250,10 @@ if ($this->request->getPost('predeterminado') == null ) {
|
|||||||
// Si no se quiere borrar...
|
// Si no se quiere borrar...
|
||||||
if($data['data'][$pkey]['is_deleted'] != 1)
|
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('*')
|
$builder = $this->model->select('*')
|
||||||
->where(array(
|
->where(array(
|
||||||
@ -338,7 +338,7 @@ if ($this->request->getPost('predeterminado') == null ) {
|
|||||||
return $this->respond(Collection::datatable(
|
return $this->respond(Collection::datatable(
|
||||||
$resourceData,
|
$resourceData,
|
||||||
$this->model->getResource()->countAllResults(),
|
$this->model->getResource()->countAllResults(),
|
||||||
$this->model->getResource($search)->countAllResults()
|
$this->model->getResource($search, $id_M)->countAllResults()
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
return $this->failUnauthorized('Invalid request', 403);
|
return $this->failUnauthorized('Invalid request', 403);
|
||||||
|
|||||||
@ -11,7 +11,6 @@ class MaquinasTarifasImpresionEntity extends \CodeIgniter\Entity\Entity
|
|||||||
"tipo" => null,
|
"tipo" => null,
|
||||||
"precio" => null,
|
"precio" => null,
|
||||||
"uso" => null,
|
"uso" => null,
|
||||||
"predeterminado" => false,
|
|
||||||
"user_created_id" => 0,
|
"user_created_id" => 0,
|
||||||
"user_updated_id" => 0,
|
"user_updated_id" => 0,
|
||||||
"is_deleted" => 0,
|
"is_deleted" => 0,
|
||||||
@ -21,7 +20,6 @@ class MaquinasTarifasImpresionEntity extends \CodeIgniter\Entity\Entity
|
|||||||
protected $casts = [
|
protected $casts = [
|
||||||
"maquina_id" => "int",
|
"maquina_id" => "int",
|
||||||
"precio" => "float",
|
"precio" => "float",
|
||||||
"predeterminado" => "boolean",
|
|
||||||
"user_created_id" => "int",
|
"user_created_id" => "int",
|
||||||
"user_updated_id" => "int",
|
"user_updated_id" => "int",
|
||||||
"is_deleted" => "int",
|
"is_deleted" => "int",
|
||||||
|
|||||||
8
ci4/app/Language/en/MaquinasPapelImpresion.php
Normal file
8
ci4/app/Language/en/MaquinasPapelImpresion.php
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return [
|
||||||
|
'activo' => 'Active',
|
||||||
|
|
||||||
|
];
|
||||||
@ -20,14 +20,16 @@ return [
|
|||||||
'userCreatedId' => 'User Created ID',
|
'userCreatedId' => 'User Created ID',
|
||||||
'userUpdatedId' => 'User Updated ID',
|
'userUpdatedId' => 'User Updated ID',
|
||||||
'uso' => 'Use',
|
'uso' => 'Use',
|
||||||
'interior' => 'inside',
|
'interior' => 'Inside',
|
||||||
'portada' => 'cover',
|
'cubierta' => 'Cover',
|
||||||
'negro' => 'black',
|
'sobrecubierta' => 'Dust jacket',
|
||||||
'color' => 'color',
|
'negro' => 'Black',
|
||||||
'negrohq' => 'blackhq',
|
'color' => 'Color',
|
||||||
'bicolor' => 'bicolor',
|
'negrohq' => 'Black HQ',
|
||||||
|
'bicolor' => 'Bicolor',
|
||||||
'validation' => [
|
'validation' => [
|
||||||
'duplicated_uso_tipo' => "Duplicate line (the combination 'use' and 'type' already exists)",
|
'duplicated_uso_tipo' => "Duplicate line (the combination 'use' and 'type' already exists)",
|
||||||
|
'cubierta_sobrecubierta_color' => "Cover and dust jacket only allow 'color' type",
|
||||||
'tipo' => [
|
'tipo' => [
|
||||||
'in_list' => 'The {field} field must be one of: {param}.',
|
'in_list' => 'The {field} field must be one of: {param}.',
|
||||||
'required' => 'Required field.',
|
'required' => 'Required field.',
|
||||||
|
|||||||
8
ci4/app/Language/es/MaquinasPapelImpresion.php
Normal file
8
ci4/app/Language/es/MaquinasPapelImpresion.php
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return [
|
||||||
|
'activo' => 'Activo',
|
||||||
|
|
||||||
|
];
|
||||||
@ -20,14 +20,16 @@ return [
|
|||||||
'userCreatedId' => 'User Created ID',
|
'userCreatedId' => 'User Created ID',
|
||||||
'userUpdatedId' => 'User Updated ID',
|
'userUpdatedId' => 'User Updated ID',
|
||||||
'uso' => 'Uso',
|
'uso' => 'Uso',
|
||||||
'interior' => 'interior',
|
'interior' => 'Interior',
|
||||||
'portada' => 'portada',
|
'cubierta' => 'Cubierta',
|
||||||
'negro' => 'negro',
|
'sobrecubierta' => 'Sobrecubierta',
|
||||||
'color' => 'color',
|
'negro' => 'Negro',
|
||||||
'negrohq' => 'negrohq',
|
'color' => 'Color',
|
||||||
'bicolor' => 'bicolor',
|
'negrohq' => 'Negro HQ',
|
||||||
|
'bicolor' => 'Bicolor',
|
||||||
'validation' => [
|
'validation' => [
|
||||||
'duplicated_uso_tipo' => "Línea duplicada (la combinación 'uso' y 'tipo' ya existe)",
|
'duplicated_uso_tipo' => "Línea duplicada (la combinación 'uso' y 'tipo' ya existe)",
|
||||||
|
'cubierta_sobrecubierta_color' => "Cubierta y sobrecubierta solo permiten tipo 'color'",
|
||||||
'tipo' => [
|
'tipo' => [
|
||||||
'in_list' => 'El campo {field} debe contener uno de: {param}.',
|
'in_list' => 'El campo {field} debe contener uno de: {param}.',
|
||||||
'required' => 'Campo obligatorio.',
|
'required' => 'Campo obligatorio.',
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace App\Models\Configuracion;
|
namespace App\Models\Configuracion;
|
||||||
|
|
||||||
class MaquinasTarifasImpresionModel extends \App\Models\GoBaseModel
|
class MaquinasPapelesImpresionModel extends \App\Models\GoBaseModel
|
||||||
{
|
{
|
||||||
protected $table = "lg_maquina_papel_impresion";
|
protected $table = "lg_maquina_papel_impresion";
|
||||||
|
|
||||||
@ -13,9 +13,15 @@ class MaquinasTarifasImpresionModel extends \App\Models\GoBaseModel
|
|||||||
protected $useAutoIncrement = true;
|
protected $useAutoIncrement = true;
|
||||||
|
|
||||||
const SORTABLE = [
|
const SORTABLE = [
|
||||||
1 => "t1.maquina_id",
|
0 => "t1.active",
|
||||||
2 => "t1.papel_impresion_id",
|
1 => "t4.nombre",
|
||||||
3 => "t1.active",
|
2 => "t3.nombre",
|
||||||
|
3 => "t3.gramaje",
|
||||||
|
4 => "t3.bn",
|
||||||
|
5 => "t3.color",
|
||||||
|
6 => "t3.cubierta",
|
||||||
|
7 => "t3.sobrecubierta",
|
||||||
|
8 => "t3.rotativa",
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $allowedFields = ["maquina_id", "papel_impresion_id", "active"];
|
protected $allowedFields = ["maquina_id", "papel_impresion_id", "active"];
|
||||||
@ -29,20 +35,34 @@ class MaquinasTarifasImpresionModel extends \App\Models\GoBaseModel
|
|||||||
*
|
*
|
||||||
* @return \CodeIgniter\Database\BaseBuilder
|
* @return \CodeIgniter\Database\BaseBuilder
|
||||||
*/
|
*/
|
||||||
public function getResource(string $search = "", $tarifas = null, $isRotativa = false)
|
public function getResource(string $search = "", $isRotativa = 0)
|
||||||
{
|
{
|
||||||
$builder = $this->db
|
$builder = $this->db
|
||||||
->table($this->table . " t1")
|
->table($this->table . " t1")
|
||||||
->select(
|
->select(
|
||||||
"t1.maquina_id AS maquina_id, t1.papel_impresion_id AS papel_impresion_id, t1.active AS active, t2.nombre AS maquina, t3.nombre AS papel_impresion"
|
"t1.maquina_id AS maquina_id, t1.papel_impresion_id AS papel_impresion_id, t1.active AS active, t2.nombre AS maquina,
|
||||||
|
t3.nombre AS papel_impresion, t3.gramaje AS gramaje, , t3.bn AS bn, t3.color AS color, t3.cubierta AS cubierta, , t3.sobrecubierta AS sobrecubierta,
|
||||||
|
t3.rotativa AS rotativa, t4.nombre as papel_generico"
|
||||||
);
|
);
|
||||||
|
|
||||||
$builder->join("lg_maquinas t2", "t1.maquina_id = t2.id", "left");
|
|
||||||
$builder->join("lg_papel_impresion t3", "t3.papel_impresion_id = t3.id", "left");
|
|
||||||
|
|
||||||
|
$builder->join("lg_maquinas t2", "t1.maquina_id = t2.id", "left");
|
||||||
|
$builder->join("lg_papel_impresion t3", "t1.papel_impresion_id = t3.id", "left");
|
||||||
|
$builder->join("lg_papel_generico t4", "t3.papel_generico_id = t4.id", "left");
|
||||||
|
|
||||||
|
$builder->where("t2.is_deleted", 0);
|
||||||
|
$builder->where("t3.is_deleted", 0);
|
||||||
|
$builder->where("t4.is_deleted", 0);
|
||||||
|
$builder->where("t3.isActivo", 1);
|
||||||
|
|
||||||
|
$builder->where("t3.rotativa", $isRotativa);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$isFirst = false;
|
$isFirst = false;
|
||||||
$where_str = "";
|
$where_str = "";
|
||||||
if (!is_null($tarifas)){
|
// Si hay tarifas...
|
||||||
|
/*if (!empty($tarifas)){
|
||||||
foreach ($tarifas as $tarifa){
|
foreach ($tarifas as $tarifa){
|
||||||
if (!$isFirst)
|
if (!$isFirst)
|
||||||
$where_str += ' OR ';
|
$where_str += ' OR ';
|
||||||
@ -55,17 +75,13 @@ class MaquinasTarifasImpresionModel extends \App\Models\GoBaseModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
$builder->where($where_str);
|
$builder->where($where_str);
|
||||||
}
|
}*/
|
||||||
if($isRotativa){
|
// si no hay tarifas no hay que devolver nada
|
||||||
$builder->where("t3.rotativa", 1);
|
/*else{
|
||||||
}
|
return "";
|
||||||
else{
|
}*/
|
||||||
$builder->where("t3.rotativa", 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
$builder->where("t2.is_deleted", 0);
|
|
||||||
$builder->where("t3.is_deleted", 0);
|
|
||||||
|
|
||||||
|
|
||||||
return empty($search)
|
return empty($search)
|
||||||
? $builder
|
? $builder
|
||||||
|
|||||||
@ -18,11 +18,10 @@ class MaquinasTarifasImpresionModel extends \App\Models\GoBaseModel
|
|||||||
3 => "t1.tipo",
|
3 => "t1.tipo",
|
||||||
4 => "t1.precio",
|
4 => "t1.precio",
|
||||||
5 => "t1.uso",
|
5 => "t1.uso",
|
||||||
6 => "t1.predeterminado",
|
6 => "t2.nombre",
|
||||||
7 => "t2.nombre",
|
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $allowedFields = ["maquina_id", "tipo", "precio", "uso", "predeterminado"];
|
protected $allowedFields = ["maquina_id", "tipo", "precio", "uso"];
|
||||||
protected $returnType = "App\Entities\Configuracion\MaquinasTarifasImpresionEntity";
|
protected $returnType = "App\Entities\Configuracion\MaquinasTarifasImpresionEntity";
|
||||||
|
|
||||||
protected $useTimestamps = true;
|
protected $useTimestamps = true;
|
||||||
@ -96,7 +95,7 @@ class MaquinasTarifasImpresionModel extends \App\Models\GoBaseModel
|
|||||||
$builder = $this->db
|
$builder = $this->db
|
||||||
->table($this->table . " t1")
|
->table($this->table . " t1")
|
||||||
->select(
|
->select(
|
||||||
"t1.id AS id, t1.tipo AS tipo, t1.precio AS precio, t1.uso AS uso, t1.predeterminado AS predeterminado, t2.nombre AS maquina"
|
"t1.id AS id, t1.tipo AS tipo, t1.precio AS precio, t1.uso AS uso, t2.nombre AS maquina"
|
||||||
);
|
);
|
||||||
|
|
||||||
//JJO
|
//JJO
|
||||||
|
|||||||
@ -49,7 +49,6 @@
|
|||||||
<th><?= lang('MaquinasTarifasImpresions.uso') ?></th>
|
<th><?= lang('MaquinasTarifasImpresions.uso') ?></th>
|
||||||
<th><?= lang('MaquinasTarifasImpresions.tipo') ?></th>
|
<th><?= lang('MaquinasTarifasImpresions.tipo') ?></th>
|
||||||
<th><?= lang('MaquinasTarifasImpresions.precio') ?></th>
|
<th><?= lang('MaquinasTarifasImpresions.precio') ?></th>
|
||||||
<th><?= lang('MaquinasTarifasImpresions.predeterminado') ?></th>
|
|
||||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -68,22 +67,26 @@
|
|||||||
<div class="accordion mt-3" id="accordianPapelesImpresion">
|
<div class="accordion mt-3" id="accordianPapelesImpresion">
|
||||||
<div class="card accordion-item active">
|
<div class="card accordion-item active">
|
||||||
<h2 class="accordion-header" id="headingOne">
|
<h2 class="accordion-header" id="headingOne">
|
||||||
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionTip1" aria-expanded="false" aria-controls="accordionTip1">
|
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionTip2" aria-expanded="false" aria-controls="accordionTip2">
|
||||||
<p><?= lang("MaquinasTarifasImpresions.moduleTitle") ?></p>
|
<p><?= lang("MaquinasTarifasImpresions.moduleTitle") ?></p>
|
||||||
</button>
|
</button>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<div id="accordionTip1" class="accordion-collapse collapse show" data-bs-parent="#accordianPapelesImpresion">
|
<div id="accordionTip2" class="accordion-collapse collapse show" data-bs-parent="#accordianPapelesImpresion">
|
||||||
<div class="accordion-body">
|
<div class="accordion-body">
|
||||||
|
|
||||||
<table id="tableOfPapelesImpresion" class="table table-striped table-hover" style="width: 100%;">
|
<table id="tableOfPapelesImpresion" class="table table-striped table-hover" style="width: 100%;">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th><?= lang('MaquinasTarifasImpresions.uso') ?></th>
|
<th><?= lang('MaquinasPapelImpresion.activo') ?></th>
|
||||||
<th><?= lang('MaquinasTarifasImpresions.tipo') ?></th>
|
<th><?= lang('PapelGenerico.papelGenerico') ?></th>
|
||||||
<th><?= lang('MaquinasTarifasImpresions.precio') ?></th>
|
<th><?= lang('PapelImpresion.nombre') ?></th>
|
||||||
<th><?= lang('MaquinasTarifasImpresions.predeterminado') ?></th>
|
<th><?= lang('PapelImpresion.gramaje') ?></th>
|
||||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
<th><?= lang('PapelImpresion.bn') ?></th>
|
||||||
|
<th><?= lang('PapelImpresion.color') ?></th>
|
||||||
|
<th><?= lang('PapelImpresion.cubierta') ?></th>
|
||||||
|
<th><?= lang('PapelImpresion.sobrecubierta') ?></th>
|
||||||
|
<th><?= lang('PapelImpresion.rotativa') ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -102,6 +105,21 @@
|
|||||||
|
|
||||||
<?= $this->section("additionalInlineJs") ?>
|
<?= $this->section("additionalInlineJs") ?>
|
||||||
|
|
||||||
|
function watch(j) {
|
||||||
|
return new Proxy(JSON.parse ('{"watch":' + j + '}'), {
|
||||||
|
set: function(target, property, value) {
|
||||||
|
target[property] = value;
|
||||||
|
$('#tableOfPapelesImpresion').DataTable().ajax.reload(null,false);
|
||||||
|
theTable2.clearPipeline();
|
||||||
|
theTable2.draw();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
isRotativa = watch(0);
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
if($(this).is(':checked')){
|
if($(this).is(':checked')){
|
||||||
|
|
||||||
@ -113,6 +131,8 @@
|
|||||||
if($(this).is(':checked')){
|
if($(this).is(':checked')){
|
||||||
|
|
||||||
$("#datosRotativa").show();
|
$("#datosRotativa").show();
|
||||||
|
isRotativa.watch = 1;
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
document.getElementById("precioTintaNegro").value = null;
|
document.getElementById("precioTintaNegro").value = null;
|
||||||
document.getElementById("precioTintaColor").value = null;
|
document.getElementById("precioTintaColor").value = null;
|
||||||
@ -120,6 +140,7 @@
|
|||||||
document.getElementById("precioHoraCorte").value = null;
|
document.getElementById("precioHoraCorte").value = null;
|
||||||
document.getElementById("metrosxminuto").value = null;
|
document.getElementById("metrosxminuto").value = null;
|
||||||
$("#datosRotativa").hide();
|
$("#datosRotativa").hide();
|
||||||
|
isRotativa.watch = 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -183,6 +204,19 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
usoTypes = [
|
||||||
|
{label:'<?= lang('MaquinasTarifasImpresions.interior') ?>', value:'interior'},
|
||||||
|
{label:'<?= lang('MaquinasTarifasImpresions.cubierta') ?>', value: 'cubierta'},
|
||||||
|
{label:'<?= lang('MaquinasTarifasImpresions.sobrecubierta') ?>', value: 'sobrecubierta'}
|
||||||
|
];
|
||||||
|
|
||||||
|
tipoTypes = [
|
||||||
|
{label:'<?= lang('MaquinasTarifasImpresions.negro') ?>', value:'negro'},
|
||||||
|
{label:'<?= lang('MaquinasTarifasImpresions.negrohq') ?>', value: 'negrohq'},
|
||||||
|
{label:'<?= lang('MaquinasTarifasImpresions.bicolor') ?>', value: 'bicolor'},
|
||||||
|
{label:'<?= lang('MaquinasTarifasImpresions.color') ?>', value: 'color'}
|
||||||
|
];
|
||||||
|
|
||||||
editor = new $.fn.dataTable.Editor( {
|
editor = new $.fn.dataTable.Editor( {
|
||||||
ajax: {
|
ajax: {
|
||||||
url: "<?= route_to('editorOfMaquinasTarifaImpresion') ?>",
|
url: "<?= route_to('editorOfMaquinasTarifaImpresion') ?>",
|
||||||
@ -195,26 +229,16 @@
|
|||||||
fields: [ {
|
fields: [ {
|
||||||
name: "uso",
|
name: "uso",
|
||||||
type: "select",
|
type: "select",
|
||||||
options: ['<?= lang('MaquinasTarifasImpresions.interior') ?>', '<?= lang('MaquinasTarifasImpresions.portada') ?>']
|
options: usoTypes
|
||||||
}, {
|
}, {
|
||||||
name: "tipo",
|
name: "tipo",
|
||||||
type: "select",
|
type: "select",
|
||||||
options: ['<?= lang('MaquinasTarifasImpresions.negro') ?>', '<?= lang('MaquinasTarifasImpresions.color') ?>',
|
options: tipoTypes
|
||||||
'<?= lang('MaquinasTarifasImpresions.negrohq') ?>', '<?= lang('MaquinasTarifasImpresions.bicolor') ?>']
|
|
||||||
}, {
|
}, {
|
||||||
name: "precio",
|
name: "precio",
|
||||||
attr: {
|
attr: {
|
||||||
type: "number"
|
type: "number"
|
||||||
}
|
}
|
||||||
}, {
|
|
||||||
name: "predeterminado",
|
|
||||||
type: "checkbox",
|
|
||||||
separator: "",
|
|
||||||
options: [
|
|
||||||
{ label: "", value: 1 }
|
|
||||||
],
|
|
||||||
unselectedValue: 0
|
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
"name": "maquina_id",
|
"name": "maquina_id",
|
||||||
"type": "hidden"
|
"type": "hidden"
|
||||||
@ -228,6 +252,7 @@
|
|||||||
]
|
]
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|
||||||
editor.on( 'preSubmit', function ( e, d, type ) {
|
editor.on( 'preSubmit', function ( e, d, type ) {
|
||||||
if ( type === 'create'){
|
if ( type === 'create'){
|
||||||
d.data[0]['maquina_id'] = id;
|
d.data[0]['maquina_id'] = id;
|
||||||
@ -257,11 +282,11 @@
|
|||||||
processing: true,
|
processing: true,
|
||||||
autoWidth: true,
|
autoWidth: true,
|
||||||
responsive: true,
|
responsive: true,
|
||||||
lengthMenu: [ 5, 10, 25],
|
lengthMenu: [ 5, 10, 25, 50],
|
||||||
order: [[ 0, "asc" ]],
|
order: [[ 1, "asc" ]],
|
||||||
pageLength: 10,
|
pageLength: 10,
|
||||||
lengthChange: true,
|
lengthChange: true,
|
||||||
searching: false,
|
searching: true,
|
||||||
paging: true,
|
paging: true,
|
||||||
info: false,
|
info: false,
|
||||||
dom: "Bltp",
|
dom: "Bltp",
|
||||||
@ -275,14 +300,32 @@
|
|||||||
async: true,
|
async: true,
|
||||||
}),
|
}),
|
||||||
columns: [
|
columns: [
|
||||||
{ 'data': 'uso' },
|
{ 'data': 'uso', "render": function ( data, type, row, meta ) {
|
||||||
{ 'data': 'tipo' },
|
if(data=='interior')
|
||||||
|
return '<?= lang('MaquinasTarifasImpresions.interior') ?>';
|
||||||
|
else if (data=='cubierta')
|
||||||
|
return '<?= lang('MaquinasTarifasImpresions.cubierta') ?>';
|
||||||
|
else if (data=='sobrecubierta')
|
||||||
|
return '<?= lang('MaquinasTarifasImpresions.sobrecubierta') ?>';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ 'data': 'tipo', "render": function ( data, type, row, meta ) {
|
||||||
|
if(data=='negro')
|
||||||
|
return '<?= lang('MaquinasTarifasImpresions.negro') ?>';
|
||||||
|
else if (data=='negrohq')
|
||||||
|
return '<?= lang('MaquinasTarifasImpresions.negrohq') ?>';
|
||||||
|
else if (data=='bicolor')
|
||||||
|
return '<?= lang('MaquinasTarifasImpresions.bicolor') ?>';
|
||||||
|
else if (data=='color')
|
||||||
|
return '<?= lang('MaquinasTarifasImpresions.color') ?>';
|
||||||
|
}
|
||||||
|
},
|
||||||
{ 'data': 'precio' },
|
{ 'data': 'precio' },
|
||||||
{ 'data': 'predeterminado' },
|
|
||||||
{
|
{
|
||||||
data: actionBtns,
|
data: actionBtns,
|
||||||
className: 'row-edit dt-center'
|
className: 'row-edit dt-center'
|
||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
columnDefs: [
|
columnDefs: [
|
||||||
{
|
{
|
||||||
@ -307,6 +350,49 @@
|
|||||||
} ]
|
} ]
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
var theTable2 = $('#tableOfPapelesImpresion').DataTable( {
|
||||||
|
serverSide: true,
|
||||||
|
processing: true,
|
||||||
|
autoWidth: true,
|
||||||
|
responsive: true,
|
||||||
|
lengthMenu: [ 5, 10, 25],
|
||||||
|
order: [[ 1, "asc" ]],
|
||||||
|
pageLength: 10,
|
||||||
|
lengthChange: true,
|
||||||
|
searching: true,
|
||||||
|
paging: true,
|
||||||
|
info: false,
|
||||||
|
dom: "lftp",
|
||||||
|
ajax : $.fn.dataTable.pipeline( {
|
||||||
|
url: '<?= route_to('dataTableOfMaquinasPapelesImpresion') ?>',
|
||||||
|
data: function (d) {
|
||||||
|
d.id_maquina = id;
|
||||||
|
d.isRotativa = isRotativa.watch;
|
||||||
|
},
|
||||||
|
/*{
|
||||||
|
id_maquina: id,
|
||||||
|
//tarifas: [{'uso':'interior', 'tipo':'negro'}],
|
||||||
|
isRotativa: isRotativa.watch,
|
||||||
|
},*/
|
||||||
|
method: 'POST',
|
||||||
|
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||||
|
async: true,
|
||||||
|
}),
|
||||||
|
columns: [
|
||||||
|
{ 'data': 'active'},
|
||||||
|
{ 'data': 'papel_generico'},
|
||||||
|
{ 'data': 'papel_impresion'},
|
||||||
|
{ 'data': 'gramaje'},
|
||||||
|
{ 'data': 'bn'},
|
||||||
|
{ 'data': 'color'},
|
||||||
|
{ 'data': 'cubierta'},
|
||||||
|
{ 'data': 'sobrecubierta'},
|
||||||
|
{ 'data': 'rotativa'}
|
||||||
|
],
|
||||||
|
language: {
|
||||||
|
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
|
||||||
// Activate an inline edit on click of a table cell
|
// Activate an inline edit on click of a table cell
|
||||||
@ -323,6 +409,14 @@
|
|||||||
);
|
);
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
theTable2.on( 'draw.dt', function () {
|
||||||
|
const boolCols = [4, 5, 6, 7, 8];
|
||||||
|
for (let coln of boolCols) {
|
||||||
|
theTable2.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
||||||
|
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Delete row
|
// Delete row
|
||||||
$('#tableOfMaquinastarifasimpresion').on( 'click', 'tbody span.remove', function (e) {
|
$('#tableOfMaquinastarifasimpresion').on( 'click', 'tbody span.remove', function (e) {
|
||||||
@ -352,15 +446,6 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
theTable.on( 'draw.dt', function () {
|
|
||||||
const boolCols = [3];
|
|
||||||
for (let coln of boolCols) {
|
|
||||||
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
|
||||||
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user