añadido tick en papeles impresion para papel de tapa dura. añadida funcionalidad presupuesto cliente

This commit is contained in:
2024-11-27 15:33:55 +01:00
parent 8a7a487dc0
commit e70f0a0807
11 changed files with 82 additions and 12 deletions

View File

@ -301,8 +301,10 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
$tipo = goSanitize($this->request->getGet('tipo'))[0]; $tipo = goSanitize($this->request->getGet('tipo'))[0];
$selected_papel = goSanitize($this->request->getGet('papel'))[0] ?? null; $selected_papel = goSanitize($this->request->getGet('papel'))[0] ?? null;
$cubierta = goSanitize($this->request->getGet('cubierta'))[0] ?? 0; $cubierta = goSanitize($this->request->getGet('cubierta'))[0] ?? 0;
$menu = $this->model->getPapelCliente($tipo, $cubierta, $selected_papel, false); $tapa_dura = goSanitize($this->request->getGet('tapa_dura'))[0] ?? null;
$menu2 = $this->model->getPapelCliente($tipo, $cubierta, $selected_papel, true);
$menu = $this->model->getPapelCliente($tipo, $cubierta, $selected_papel, $tapa_dura, false);
$menu2 = $this->model->getPapelCliente($tipo, $cubierta, $selected_papel, $tapa_dura, true);
$newTokenHash = csrf_hash(); $newTokenHash = csrf_hash();
$csrfTokenName = csrf_token(); $csrfTokenName = csrf_token();

View File

@ -175,7 +175,7 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
if ($this->request->getPost()) : if ($this->request->getPost()) :
$nullIfEmpty = true; // !(phpversion() >= '8.1'); $nullIfEmpty = false; // !(phpversion() >= '8.1');
$postData = $this->request->getPost(); $postData = $this->request->getPost();
@ -200,6 +200,9 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
if ($this->request->getPost('cubierta') == null) { if ($this->request->getPost('cubierta') == null) {
$sanitizedData['cubierta'] = false; $sanitizedData['cubierta'] = false;
} }
if ($this->request->getPost('use_for_tapa_dura') == null) {
$sanitizedData['use_for_tapa_dura'] = false;
}
if ($this->request->getPost('sobrecubierta') == null) { if ($this->request->getPost('sobrecubierta') == null) {
$sanitizedData['sobrecubierta'] = false; $sanitizedData['sobrecubierta'] = false;
} }

View File

@ -0,0 +1,27 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class AddTickTapaDuraPapelImp extends Migration
{
public function up()
{
$fields = [
'use_for_tapa_dura' => [
'type' => 'TINYINT',
'constraint' => 1,
'null' => false,
'default' => 0,
],
];
$this->forge->addColumn('lg_papel_impresion', $fields);
}
public function down()
{
$this->forge->dropColumn('lg_papel_impresion', 'use_for_tapa_dura');
}
}

View File

@ -25,6 +25,7 @@ class PapelImpresion extends \CodeIgniter\Entity\Entity
"rotativa" => false, "rotativa" => false,
"isActivo" => true, "isActivo" => true,
"use_in_client" => false, "use_in_client" => false,
"use_for_tapa_dura" => false,
"is_deleted" => 0, "is_deleted" => 0,
"created_at" => null, "created_at" => null,
"updated_at" => null, "updated_at" => null,
@ -45,6 +46,7 @@ class PapelImpresion extends \CodeIgniter\Entity\Entity
"rotativa" => "boolean", "rotativa" => "boolean",
"isActivo" => "boolean", "isActivo" => "boolean",
"use_in_client" => "boolean", "use_in_client" => "boolean",
"use_for_tapa_dura" => "boolean",
"is_deleted" => "int", "is_deleted" => "int",
]; ];
} }

View File

@ -10,6 +10,7 @@ return [
'color' => 'Color', 'color' => 'Color',
'createdAt' => 'Creado en', 'createdAt' => 'Creado en',
'cubierta' => 'Cubierta', 'cubierta' => 'Cubierta',
'use_for_tapa_dura' => 'Papel tapa dura',
'sobrecubierta' => 'Sobrecubierta', 'sobrecubierta' => 'Sobrecubierta',
'guardas' => 'Guardas', 'guardas' => 'Guardas',
'defecto' => 'Por defecto', 'defecto' => 'Por defecto',

View File

@ -313,7 +313,7 @@ class PapelGenericoModel extends \App\Models\BaseModel
} }
public function getPapelCliente($tipo, $is_cubierta = false, $selected_papel_id = null, $papel_especial = false) public function getPapelCliente($tipo, $is_cubierta = false, $selected_papel_id = null, $tapa_dura = null, $papel_especial = false)
{ {
/* /*
1.-> Tipo impresion 1.-> Tipo impresion
@ -382,6 +382,9 @@ class PapelGenericoModel extends \App\Models\BaseModel
if ($is_cubierta == true) { if ($is_cubierta == true) {
$builder->where("t2.cubierta", 1); $builder->where("t2.cubierta", 1);
$builder->where("t5.uso", 'cubierta'); $builder->where("t5.uso", 'cubierta');
if($tapa_dura == true){
$builder->where("t2.use_for_tapa_dura", 1);
}
} else { } else {
$builder->where("t2.interior", 1); $builder->where("t2.interior", 1);
$builder->where("t5.uso", 'interior'); $builder->where("t5.uso", 'interior');

View File

@ -20,12 +20,13 @@ class PapelImpresionModel extends \App\Models\BaseModel
4 => "t1.bn", 4 => "t1.bn",
5 => "t1.color", 5 => "t1.color",
6 => "t1.cubierta", 6 => "t1.cubierta",
7 => "t1.sobrecubierta", 7 => "t1.use_for_tapa_dura",
8 => "t1.guardas", 8 => "t1.sobrecubierta",
9 => "t1.inkjet", 9 => "t1.guardas",
10 => "t1.rotativa", 10 => "t1.inkjet",
11 => "t1.isActivo", 11 => "t1.rotativa",
12 => "t1.use_in_client", 12 => "t1.isActivo",
13 => "t1.use_in_client",
]; ];
@ -48,6 +49,7 @@ class PapelImpresionModel extends \App\Models\BaseModel
"rotativa", "rotativa",
"isActivo", "isActivo",
"use_in_client", "use_in_client",
"use_for_tapa_dura",
"deleted_at", "deleted_at",
"is_deleted", "is_deleted",
"user_updated_id", "user_updated_id",
@ -152,7 +154,8 @@ class PapelImpresionModel extends \App\Models\BaseModel
->select( ->select(
"t1.id AS id, t1.nombre AS nombre, t1.defecto AS defecto, t1.referencia AS referencia, t1.mano AS mano, "t1.id AS id, t1.nombre AS nombre, t1.defecto AS defecto, t1.referencia AS referencia, t1.mano AS mano,
t1.espesor AS espesor, t1.gramaje AS gramaje, t1.interior AS interior, t1.precio_tonelada AS precio_tonelada, t1.espesor AS espesor, t1.gramaje AS gramaje, t1.interior AS interior, t1.precio_tonelada AS precio_tonelada,
t1.bn AS bn, t1.color AS color, t1.cubierta AS cubierta, t1.sobrecubierta AS sobrecubierta, t1.guardas AS guardas, t1.bn AS bn, t1.color AS color, t1.cubierta AS cubierta, t1.use_for_tapa_dura AS use_for_tapa_dura,
t1.sobrecubierta AS sobrecubierta, t1.guardas AS guardas,
t1.inkjet AS inkjet, t1.rotativa AS rotativa, t1.inkjet AS inkjet, t1.rotativa AS rotativa,
t1.isActivo AS isActivo, t2.nombre AS papel_generico_id, t1.isActivo AS isActivo, t2.nombre AS papel_generico_id,
t1.use_in_client AS use_in_client" t1.use_in_client AS use_in_client"

View File

@ -99,6 +99,17 @@
</div><!--//.form-check --> </div><!--//.form-check -->
</div><!--//.mb-3 --> </div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="use_for_tapa_dura" class="form-check-label">
<input <?= $papelImpresion->cubierta? ' ' : 'disabled ' ?> type="checkbox" id="useForTapaDura" name="use_for_tapa_dura" value="1" class="form-check-input"
<?= $papelImpresion->use_for_tapa_dura == true ? 'checked' : ''; ?>>
<?= lang('PapelImpresion.use_for_tapa_dura') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<div class="mb-3"> <div class="mb-3">
<div class="form-check"> <div class="form-check">

View File

@ -403,6 +403,16 @@
`; `;
}; };
$('#cubierta').on('change', function() {
if($(this).is(':checked')) {
$('#useForTapaDura').prop('disabled', false);
$('#useForTapaDura').prop('checked', false);
}
else{
$('#useForTapaDura').prop('disabled', true);
}
});
// Etiquetas para las tipologias // Etiquetas para las tipologias
const tipoTypes = [ const tipoTypes = [

View File

@ -25,6 +25,7 @@
<th><?= lang('PapelImpresion.bn') ?></th> <th><?= lang('PapelImpresion.bn') ?></th>
<th><?= lang('PapelImpresion.color') ?></th> <th><?= lang('PapelImpresion.color') ?></th>
<th><?= lang('PapelImpresion.cubierta') ?></th> <th><?= lang('PapelImpresion.cubierta') ?></th>
<th><?= lang('PapelImpresion.use_for_tapa_dura') ?></th>
<th><?= lang('PapelImpresion.sobrecubierta') ?></th> <th><?= lang('PapelImpresion.sobrecubierta') ?></th>
<th><?= lang('PapelImpresion.guardas') ?></th> <th><?= lang('PapelImpresion.guardas') ?></th>
<th><?= lang('PapelImpresion.inkjet') ?></th> <th><?= lang('PapelImpresion.inkjet') ?></th>
@ -104,6 +105,7 @@
{ 'data': 'bn' }, { 'data': 'bn' },
{ 'data': 'color' }, { 'data': 'color' },
{ 'data': 'cubierta' }, { 'data': 'cubierta' },
{ 'data': 'use_for_tapa_dura'},
{ 'data': 'sobrecubierta' }, { 'data': 'sobrecubierta' },
{ 'data': 'guardas' }, { 'data': 'guardas' },
{ 'data': 'inkjet' }, { 'data': 'inkjet' },
@ -116,7 +118,7 @@
theTable.on( 'draw.dt', function () { theTable.on( 'draw.dt', function () {
const boolCols = [3, 4, 5, 6, 7, 8, 9, 10, 11]; const boolCols = [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13];
for (let coln of boolCols) { for (let coln of boolCols) {
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) { theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : ''; cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';

View File

@ -740,11 +740,13 @@ class DisenioCubierta {
#handleMenuPapel() { #handleMenuPapel() {
this.divGramajeCubierta.empty(); this.divGramajeCubierta.empty();
const tapa_dura = this.tapaBlanda.hasClass("selected") ? 0 : 1;
new Ajax('/papelesgenericos/getpapelcliente', new Ajax('/papelesgenericos/getpapelcliente',
{ {
[this.csrf_token]: this.csrf_hash, [this.csrf_token]: this.csrf_hash,
tipo: 'colorhq', tipo: 'colorhq',
cubierta: 1, cubierta: 1,
tapa_dura: tapa_dura
}, },
{}, {},
(response) => { this.fillPapeles(response); }, (response) => { this.fillPapeles(response); },
@ -758,6 +760,7 @@ class DisenioCubierta {
const context = this; const context = this;
this.papelCubierta = this.papelEspecial.getVal(); this.papelCubierta = this.papelEspecial.getVal();
const tapa_dura = this.tapaBlanda.hasClass("selected") ? 0 : 1;
new Ajax('/papelesgenericos/getpapelcliente', new Ajax('/papelesgenericos/getpapelcliente',
{ {
@ -765,6 +768,7 @@ class DisenioCubierta {
papel: this.papelCubierta, papel: this.papelCubierta,
tipo: 'colorhq', tipo: 'colorhq',
cubierta: 1, cubierta: 1,
tapa_dura: tapa_dura,
}, },
{}, {},
this.fillGramajes.bind(context), this.fillGramajes.bind(context),
@ -884,12 +888,14 @@ class DisenioCubierta {
this.papelEspecial.empty(); this.papelEspecial.empty();
$('#papelEspecialCubiertaSel').on("change", this.#handlePapelCubiertaEspecial.bind(this)); $('#papelEspecialCubiertaSel').on("change", this.#handlePapelCubiertaEspecial.bind(this));
this.divGramajeCubierta.empty(); this.divGramajeCubierta.empty();
const tapa_dura = this.tapaBlanda.hasClass("selected") ? 0 : 1;
new Ajax('/papelesgenericos/getpapelcliente', new Ajax('/papelesgenericos/getpapelcliente',
{ {
[this.csrf_token]: this.csrf_hash, [this.csrf_token]: this.csrf_hash,
papel: papel, papel: papel,
tipo: 'colorhq', tipo: 'colorhq',
cubierta: 1, cubierta: 1,
tapa_dura: tapa_dura
}, },
{}, {},
this.fillGramajes.bind(context), this.fillGramajes.bind(context),