Avances inicializacion edit

This commit is contained in:
unknown
2025-04-19 22:27:27 +02:00
parent c42f223b9a
commit 49f9fe4009
6 changed files with 145 additions and 79 deletions

View File

@ -178,8 +178,8 @@ class CatalogoLibros extends BaseResourceController
endif; // $noException && $successfulResult
endif; // ($requestMethod === 'post')
$catalogoLibrosEntity->tipoImpresion = $catalogoLibrosEntity->tipo_impresion ?? 'negro';
$catalogoLibrosEntity->clienteName = model('App\Models\Clientes\ClienteModel')->find($catalogoLibrosEntity->cliente_id)->nombre;
$catalogoLibrosEntity->encuadernacionName = model('App\Models\Configuracion\TipoPresupuestoModel')->find($catalogoLibrosEntity->encuadernacion_id)->encuadernacion;
$catalogoLibrosEntity->createdUser = model('App\Models\Usuarios\UserModel')->getFullName($catalogoLibrosEntity->user_created_id);
$catalogoLibrosEntity->updatedUser = model('App\Models\Usuarios\UserModel')->getFullName($catalogoLibrosEntity->user_update_id);

View File

@ -3,6 +3,7 @@
namespace App\Entities\Catalogo;
use CodeIgniter\Entity\Entity;
use App\Models\Configuracion\PapelGenericoModel;
class CatalogoLibroEntity extends Entity
{
@ -44,19 +45,24 @@ class CatalogoLibroEntity extends Entity
'comentarios' => '',
'negro_paginas' => null,
'negro_papel' => null,
'negro_papel_id' => null,
'negro_gramaje' => null,
'color_paginas' => null,
'color_papel' => null,
'color_papel_id' => null,
'color_gramaje' => null,
'portada_paginas' => null,
'portada_papel' => null,
'portada_gramaje' => null,
'portada_acabado' => null,
'cubierta_paginas' => null,
'cubierta_papel' => null,
'cubierta_papel_id' => null,
'cubierta_gramaje' => null,
'cubierta_acabado' => null,
'sobrecubierta_paginas' => null,
'sobrecubierta_papel' => null,
'sobrecubierta_papel_id' => null,
'sobrecubierta_gramaje' => null,
'sobrecubierta_acabado' => null,
'encuardenacion' => '',
'encuardenacion_id' => 'null',
'ubicacion' => null,
'created_at' => null,
'updated_at' => null,
@ -84,11 +90,57 @@ class CatalogoLibroEntity extends Entity
'cubiertas_ancho' => 'float',
'negro_paginas' => '?int',
'negro_gramaje' => '?float',
'negro_papel_id' => '?int',
'color_paginas' => '?int',
'color_gramaje' => '?float',
'portada_paginas' => '?int',
'portada_gramaje' => '?float',
'color_papel_id' => '?int',
'cubierta_paginas' => '?int',
'cubierta_gramaje' => '?float',
'cubierta_papel_id' => '?int',
'sobrecubierta_paginas' => '?int',
'sobrecubierta_gramaje' => '?float',
'sobrecubierta_papel_id' => '?int',
];
public function getNegroPapelName()
{
if (!$this->negro_papel_id) {
return null;
}
$papel = model(PapelGenericoModel::class)->asObject()->find($this->negro_papel_id);
return $papel?->nombre ?? null;
}
public function getColorPapelName()
{
if (!$this->color_papel_id) {
return null;
}
$papel = model(PapelGenericoModel::class)->asObject()->find($this->color_papel_id);
return $papel?->nombre ?? null;
}
public function getCubiertaPapelName()
{
if (!$this->cubierta_papel_id) {
return null;
}
$papel = model(PapelGenericoModel::class)->asObject()->find($this->cubierta_papel_id);
return $papel?->nombre ?? null;
}
public function getSobrecubiertaPapelName()
{
if (!$this->sobrecubierta_papel_id) {
return null;
}
$papel = model(PapelGenericoModel::class)->asObject()->find($this->sobrecubierta_papel_id);
return $papel?->nombre ?? null;
}
}

View File

@ -40,6 +40,7 @@ return [
'sello' => 'Sello',
'paginas' => 'Páginas',
'tipoImpresion' => 'Tipo de Impresión',
'seleccionarTipoImpresion' => 'Seleccionar tipo de impresión',
'solapasAncho' => 'Ancho de Solapas',
'cubiertasAncho' => 'Ancho de Cubiertas',
'comentarios' => 'Comentarios',

View File

@ -29,17 +29,18 @@
<div class="row px-4 mt-1">
<div class="col-md-12 col-lg-3">
<select id="tipoImpresion" name="comp_tipo_impresion" class="form-control select2bs2"
style="width: 100%;">
<option value="negro" <?= ($catalogoLibrosEntity->tipoImpresion === 'negro') ? 'selected' : '' ?>>
style="width: 100%;" data-placeholder="<?= lang('Catalogo.seleccionarTipoImpresion') ?>">
<option></option>
<option value="negro" <?= ($catalogoLibrosEntity->tipo_impresion == 'negro') ? 'selected' : '' ?>>
<?= lang('MaquinasTarifasImpresions.negro') ?>
</option>
<option value="negrohq" <?= ($catalogoLibrosEntity->tipoImpresion === 'negrohq') ? 'selected' : '' ?>>
<option value="negrohq" <?= ($catalogoLibrosEntity->tipo_impresion == 'negrohq') ? 'selected' : '' ?>>
<?= lang('MaquinasTarifasImpresions.negrohq') ?>
</option>
<option value="color" <?= ($catalogoLibrosEntity->tipoImpresion === 'color') ? 'selected' : '' ?>>
<option value="color" <?= ($catalogoLibrosEntity->tipo_impresion == 'color') ? 'selected' : '' ?>>
<?= lang('MaquinasTarifasImpresions.color') ?>
</option>
<option value="colorhq" <?= ($catalogoLibrosEntity->tipoImpresion === 'colorhq') ? 'selected' : '' ?>>
<option value="colorhq" <?= ($catalogoLibrosEntity->tipo_impresion == 'colorhq') ? 'selected' : '' ?>>
<?= lang('MaquinasTarifasImpresions.colorhq') ?>
</option>
</select>
@ -48,6 +49,9 @@
<div class="col-md-12 col-lg-3">
<select id="encuadernacion" name="encuadernacion" class="form-control select2bs2 warning-change"
style="width: 100%;">
<option value="<?= $catalogoLibrosEntity->encuadernacion_id ?>" selected>
<?= $catalogoLibrosEntity->encuadernacionName ?>
</option>
</select>
</div><!--//.col -->
</div><!--//.row -->
@ -67,12 +71,12 @@
<div class="col-md-12 col-lg-2 px-1 mb-0">
<p class="mb-0"></p>
</div>
<div class="col-md-12 col-lg-2 px-4 mb-0">
<div class="col-md-12 col-lg-1 px-4 mb-0">
<p class="mb-0">
<?= lang("Presupuestos.numeroPaginas") ?>
</p>
</div>
<div class="col-md-12 col-lg-6 px-4 mb-0">
<div class="col-md-12 col-lg-3 px-4 mb-0">
<p class="mb-0">
<?= lang("Presupuestos.papel") ?>
</p>
@ -82,6 +86,16 @@
<?= lang("Presupuestos.gramaje") ?>
</p>
</div>
<div class="col-md-12 col-lg-2 px-4 mb-0">
<p class="mb-0">
<?= "Solapas" ?>
</p>
</div>
<div class="col-md-12 col-lg-2 px-4 mb-0">
<p class="mb-0">
<?= "Acabados" ?>
</p>
</div>
<div>
<hr class="my-1">
<hr class="my-1">
@ -95,20 +109,31 @@
<?= lang('MaquinasTarifasImpresions.negro') ?>
</p>
</div>
<div class="col-md-12 col-lg-2 px-4">
<div class="col-md-12 col-lg-1 px-4">
<input type="text" id="compPaginasNegro" name="comp_paginas_negro" placeholder="0" maxLength="5"
class="form-control comp_negro_items" value="">
class="form-control comp_negro_items"
value="<?= old('negro_paginas', $catalogoLibrosEntity->negro_paginas) ?>">
</div>
<div class="col-md-12 col-lg-6 px-4">
<div class="col-md-12 col-lg-3 px-4">
<select id="compPapelNegro" name="comp_papel_negro"
class="form-control select2bs2 comp_negro_items" style="width: 100%;">
<?php if (!is_null($catalogoLibrosEntity->negroPapelName)): ?>
<option value="<?= $catalogoLibrosEntity->negro_papel_id ?>" selected>
<?= esc($catalogoLibrosEntity->negroPapelName) ?>
</option>
<?php endif; ?>
</select>
</div>
<div class="col-md-12 col-lg-2 px-4">
<select id="compGramajeNegro" name="comp_gramaje_negro"
class="form-control select2bs2 comp_negro_items" style="width: 100%;">
<option value="<?= $catalogoLibrosEntity->negro_gramaje ?>" selected>
<?= $catalogoLibrosEntity->negro_gramaje ?>
</option>
</select>
</div>
<div class="col-md-12 col-lg-2 px-4"></div>
<div class="col-md-12 col-lg-2 px-4"></div>
<div>
<hr class="my-1">
</div>
@ -121,11 +146,11 @@
<?= lang('MaquinasTarifasImpresions.negrohq') ?>
</p>
</div>
<div class="col-md-12 col-lg-2 px-4">
<div class="col-md-12 col-lg-1 px-4">
<input type="text" id="compPaginasNegrohq" name="comp_paginas_negrohq" placeholder="0"
maxLength="5" class="form-control comp_negrohq_items" value="">
</div>
<div class="col-md-12 col-lg-6 px-4">
<div class="col-md-12 col-lg-3 px-4">
<select id="compPapelNegrohq" name="comp_papel_negrohq"
class="form-control select2bs2 comp_negrohq_items" style="width: 100%;">
</select>
@ -135,6 +160,8 @@
class="form-control select2bs2 comp_negrohq_items" style="width: 100%;">
</select>
</div>
<div class="col-md-12 col-lg-2 px-4"></div>
<div class="col-md-12 col-lg-2 px-4"></div>
<div>
<hr class="my-1">
</div>
@ -147,20 +174,31 @@
<?= lang('MaquinasTarifasImpresions.color') ?>
</p>
</div>
<div class="col-md-12 col-lg-2 px-4">
<div class="col-md-12 col-lg-1 px-4">
<input type="text" id="compPaginasColor" name="comp_paginas_color" placeholder="0" maxLength="5"
class="form-control comp_color_items" value="">
class="form-control comp_color_items"
value="<?= old('negro_paginas', $catalogoLibrosEntity->color_paginas) ?>">
</div>
<div class="col-md-12 col-lg-6 px-4">
<div class="col-md-12 col-lg-3 px-4">
<select id="compPapelColor" name="comp_papel_color"
class="form-control select2bs2 comp_color_items" style="width: 100%;">
<?php if (!is_null($catalogoLibrosEntity->colorPapelName)): ?>
<option value="<?= $catalogoLibrosEntity->color_papel_id ?>" selected>
<?= esc($catalogoLibrosEntity->colorPapelName) ?>
</option>
<?php endif; ?>
</select>
</div>
<div class="col-md-12 col-lg-2 px-4">
<select id="compGramajeColor" name="comp_gramaje_color"
class="form-control select2bs2 comp_color_items" style="width: 100%;">
<option value="<?= $catalogoLibrosEntity->color_gramaje ?>" selected>
<?= $catalogoLibrosEntity->color_gramaje ?>
</option>
</select>
</div>
<div class="col-md-12 col-lg-2 px-4"></div>
<div class="col-md-12 col-lg-2 px-4"></div>
<div>
<hr class="my-1">
</div>
@ -173,11 +211,11 @@
<?= lang('MaquinasTarifasImpresions.colorhq') ?>
</p>
</div>
<div class="col-md-12 col-lg-2 px-4">
<div class="col-md-12 col-lg-1 px-4">
<input type="text" id="compPaginasColorhq" name="comp_paginas_colorhq" placeholder="0"
maxLength="5" class="form-control comp_colorhq_items" value="">
</div>
<div class="col-md-12 col-lg-6 px-4">
<div class="col-md-12 col-lg-3 px-4">
<select id="compPapelColorhq" name="comp_papel_colorhq"
class="form-control select2bs2 comp_colorhq_items" style="width: 100%;">
</select>
@ -187,6 +225,8 @@
class="form-control select2bs2 comp_colorhq_items" style="width: 100%;">
</select>
</div>
<div class="col-md-12 col-lg-2 px-4"></div>
<div class="col-md-12 col-lg-2 px-4"></div>
<div>
<hr class="my-1">
</div>
@ -199,7 +239,7 @@
<?= lang('PapelImpresion.cubierta') ?>
</p>
</div>
<div class="col-md-12 col-lg-2 px-4">
<div class="col-md-12 col-lg-1 px-4">
<select id="compCarasCubierta" name="comp_paginas_cubierta"
class="form-control select2bs2 comp_cubierta_items" style="width: 100%;">
<option value="2">
@ -214,60 +254,27 @@
</option>
</select>
</div>
<div class="col-md-12 col-lg-6 px-4">
<div class="col-md-12 col-lg-3 px-4">
<select id="compPapelCubierta" name="comp_papel_cubierta"
class="form-control select2bs2 comp_cubierta_items" style="width: 100%;">
<?php if (!is_null($catalogoLibrosEntity->cubiertaPapelName)): ?>
<option value="<?= $catalogoLibrosEntity->cubierta_papel_id ?>" selected>
<?= esc($catalogoLibrosEntity->cubiertaPapelName) ?>
</option>
<?php endif; ?>
</select>
</div>
<div class="col-md-12 col-lg-2 px-4">
<select id="compGramajeCubierta" name="comp_gramaje_cubierta"
class="form-control select2bs2 comp_cubierta_items" style="width: 100%;">
<option value="<?= $catalogoLibrosEntity->cubierta_gramaje ?>" selected>
<?= $catalogoLibrosEntity->cubierta_gramaje ?>
</option>
</select>
</div>
<?php /* if ($tipo_impresion_id == 1 || $tipo_impresion_id == 3): ?>
<div class="col-md-12 col-lg-2 px-4">
</div>
<div class="col-md-12 col-lg-2 px-4">
<label id="label_compLomoRedondo" for="compLomoRedondo" class="form-label">
<?= lang('Presupuestos.lomoRedondo') ?>*
</label>
<select id="compLomoRedondo" name="lomo_redondo" service-id="<?= $serviciosAutomaticos['lomo_redondo'] ?>"
class="form-control select2bs2 comp_cubierta_items" style="width: 100%;">
<option value="0">
<p>
<?= lang('Presupuestos.no') ?>
</p>
</option>
<option value="1">
<p>
<?= lang('Presupuestos.si') ?>
</p>
</option>
</select>
</div>
<div class="col-md-12 col-lg-2 px-4">
<label for="cabezada" class="form-label">
<?= lang('Presupuestos.cabezada') ?>
</label>
<select class="form-select select2bs2" id="cabezada" name="cabezada">
<option value="WHI">
<?= lang('Presupuestos.blanca') ?>
</option>
<option value="GRE">
<?= lang('Presupuestos.verde') ?>
</option>
<option value="BLUE">
<?= lang('Presupuestos.azul') ?>
</option>
<option value="REDYEL">
<?= lang('Presupuestos.rojaAmarilla') ?>
</option>
</select>
</div>
<?php endif; */ ?>
<div class="col-md-12 col-lg-2 px-4"></div>
<div class="col-md-12 col-lg-2 px-4"></div>
<div>
<hr class="my-1">
</div>
@ -282,7 +289,7 @@ class="form-control select2bs2 comp_cubierta_items" style="width: 100%;">
<?= lang('PapelImpresion.sobrecubierta') ?>
</p>
</div>
<div class="col-md-12 col-lg-2 px-4">
<div class="col-md-12 col-lg-1 px-4">
<select id="compSobrecubierta" name="comp_sobrecubierta"
class="form-control select2bs2 comp_sobrecubierta_items" style="width: 100%;">
<option value="0">
@ -293,16 +300,27 @@ class="form-control select2bs2 comp_cubierta_items" style="width: 100%;">
</option>
</select>
</div>
<div class="col-md-12 col-lg-6 px-4">
<div class="col-md-12 col-lg-3 px-4">
<select disabled id="compPapelSobrecubierta" name="comp_papel_sobrecubierta"
class="form-control select2bs2 comp_sobrecubierta_items" style="width: 100%;">
<?php if (!is_null($catalogoLibrosEntity->sobrecubiertaPapelName)): ?>
<option value="<?= $catalogoLibrosEntity->sobrecubierta_papel_id ?>" selected>
<?= esc($catalogoLibrosEntity->sobrecubiertaPapelName) ?>
</option>
<?php endif; ?>
</select>
</div>
<div class="col-md-12 col-lg-2 px-4">
<select disabled id="compGramajeSobrecubierta" name="comp_gramaje_sobrecubierta"
class="form-control select2bs2 comp_sobrecubierta_items" style="width: 100%;">
<option value="<?= $catalogoLibrosEntity->sobrecubierta_gramaje ?>" selected>
<?= $catalogoLibrosEntity->sobrecubierta_gramaje ?>
</option>
</select>
</div>
<div class="col-md-12 col-lg-2 px-4"></div>
<div class="col-md-12 col-lg-2 px-4"></div>
<div>
<hr class="my-1">
</div>

View File

@ -34,7 +34,7 @@
<div class="col-md-4 mb-3">
<label for="clienteId" class="form-label">Cliente</label>
<select id="clienteId" name="clienteId" class="form-select select2bs5">
<option value="<?= $catalogoLibrosEntity->cliente_id ?>">
<option value="<?= $catalogoLibrosEntity->cliente_id ?>" selected>
<?= $catalogoLibrosEntity->clienteName ?>
</option>
</select>

View File

@ -12,7 +12,7 @@ class Catalogo {
this.tipo_impresion = $("#tipoImpresion");
this.encuadernacion = new ClassSelect($("#encuadernacion"), '/importador/getencuadernacion', "Seleccione una encuadernación");
this.compPapelNegro = new ClassSelect($("#compPapelNegro"), '/presupuestoadmin/papelgenerico', "Seleccione un papel", false,
{
@ -144,11 +144,8 @@ class Catalogo {
document.querySelector('.select2-search__field').focus();
});
let clienteId = $("#clienteId").val();
let clienteName = $("#clienteId").text();
this.cliente.init();
this.cliente.setOption(clienteId, clienteName);
this.tipo_impresion.select2();
this.encuadernacion.init();
this.compPapelNegro.init();
@ -245,8 +242,6 @@ class Catalogo {
getDimensionLibro() {
let ancho = $('#ancho').val();
let alto = $('#alto').val();;