Version 1.0

This commit is contained in:
unknown
2025-04-22 22:57:27 +02:00
parent 7dee2c26e8
commit 919c80fa9b
9 changed files with 2226 additions and 88 deletions

View File

@ -0,0 +1,92 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateCatalogoLibros extends Migration
{
public function up()
{
$this->db->query('SET foreign_key_checks = 0');
$this->forge->addField([
'id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'auto_increment' => true],
'cliente_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'proveedor_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'user_created_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'default' => 1],
'user_update_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'default' => 1],
'cubierta_archivo' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'cubierta_url' => ['type' => 'VARCHAR', 'constraint' => 500, 'null' => true],
'ancho' => ['type' => 'DOUBLE', 'constraint' => '8,2'],
'alto' => ['type' => 'DOUBLE', 'constraint' => '8,2'],
'peso' => ['type' => 'DOUBLE', 'constraint' => '8,2', 'null' => true],
'titulo' => ['type' => 'VARCHAR', 'constraint' => 300],
'autor' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'autor_entidad' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'traductor' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'ilustrador' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'idioma' => ['type' => 'VARCHAR', 'constraint' => 3, 'default' => 'spa'],
'num_edic' => ['type' => 'INT', 'default' => 1, 'null' => true],
'fecha_disponibilidad' => ['type' => 'DATE', 'null' => true],
'fecha_public' => ['type' => 'DATE', 'null' => true],
'num_fotos' => ['type' => 'INT', 'default' => 0],
'num_ilustr' => ['type' => 'INT', 'default' => 0],
'num_ilustr_color' => ['type' => 'INT', 'default' => 0],
'num_ilustr_bn' => ['type' => 'INT', 'default' => 0],
'coleccion' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'isk' => ['type' => 'VARCHAR', 'constraint' => 64, 'null' => true],
'isbn' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'ean' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'editorial' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'resumen' => ['type' => 'TEXT', 'null' => true],
'resumen_breve' => ['type' => 'TEXT', 'null' => true],
'sello' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'paginas' => ['type' => 'INT'],
'tipo_impresion' => ['type' => 'ENUM', 'constraint' => ['negro','negrohq','color','colorhq'], 'null' => true],
'comentarios' => ['type' => 'TEXT', 'null' => true],
'negro_paginas' => ['type' => 'INT', 'null' => true],
'negro_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'negro_gramaje' => ['type' => 'DOUBLE', 'null' => true],
'negro_pod_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'negro_pod_gramaje' => ['type' => 'DOUBLE', 'null' => true],
'color_paginas' => ['type' => 'INT', 'null' => true],
'color_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'color_gramaje' => ['type' => 'DOUBLE', 'null' => true],
'color_pod_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'color_pod_gramaje' => ['type' => 'DOUBLE', 'null' => true],
'cubierta_paginas' => ['type' => 'INT', 'null' => true],
'cubierta_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'cubierta_gramaje' => ['type' => 'DOUBLE', 'null' => true],
'cubierta_acabado_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'cubierta_ancho_solapas' => ['type' => 'DOUBLE', 'constraint' => '8,2', 'default' => 0.00, 'unsigned' => true],
'cubierta_pod_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'cubierta_pod_gramaje' => ['type' => 'DOUBLE', 'null' => true],
'sobrecubierta_paginas' => ['type' => 'INT', 'null' => true],
'sobrecubierta_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'sobrecubierta_gramaje' => ['type' => 'DOUBLE', 'null' => true],
'sobrecubierta_acabado_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'sobrecubierta_ancho_solapas' => ['type' => 'DOUBLE', 'constraint' => '8,2', 'default' => 0.00, 'unsigned' => true],
'sobrecubierta_pod_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'sobrecubierta_pod_gramaje' => ['type' => 'DOUBLE', 'null' => true],
'encuadernacion_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
'ubicacion' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'created_at' => ['type' => 'TIMESTAMP', 'default' => 'CURRENT_TIMESTAMP'],
'updated_at' => ['type' => 'TIMESTAMP', 'null' => true],
'deleted_at' => ['type' => 'TIMESTAMP', 'null' => true],
]);
$this->forge->addKey('id', true);
$this->forge->addUniqueKey('isk');
$this->forge->addForeignKey('cliente_id', 'clientes', 'id');
$this->forge->createTable('catalogo_libros');
$this->db->query('SET foreign_key_checks = 1');
}
public function down()
{
$this->forge->dropTable('catalogo_libros');
}
}

File diff suppressed because it is too large Load Diff

View File

@ -51,21 +51,28 @@ class CatalogoLibroEntity extends Entity
'negro_papel' => null,
'negro_papel_id' => null,
'negro_gramaje' => null,
'negro_pod_papel_id' => null,
'negro_pod_gramaje' => null,
'color_paginas' => null,
'color_papel' => null,
'color_papel_id' => null,
'color_gramaje' => null,
'color_pod_papel_id' => null,
'color_pod_gramaje' => null,
'cubierta_paginas' => null,
'cubierta_papel' => null,
'cubierta_papel_id' => null,
'cubierta_gramaje' => null,
'cubierta_acabado' => null,
'cubierta_pod_papel_id' => null,
'cubierta_pod_gramaje' => null,
'sobrecubierta_paginas' => null,
'sobrecubierta_papel' => null,
'sobrecubierta_papel_id' => null,
'sobrecubierta_gramaje' => null,
'sobrecubierta_acabado' => null,
'encuardenacion' => '',
'sobrecubierta_pod_papel_id' => null,
'sobrecubierta_pod_gramaje' => null,
'encuardenacion_id' => 'null',
'ubicacion' => null,
'created_at' => null,
@ -95,16 +102,26 @@ class CatalogoLibroEntity extends Entity
'negro_paginas' => '?int',
'negro_gramaje' => '?float',
'negro_papel_id' => '?int',
'negro_pod_papel_id' => '?int',
'negro_pod_gramaje' => '?float',
'color_paginas' => '?int',
'color_gramaje' => '?float',
'color_papel_id' => '?int',
'color_pod_papel_id' => '?int',
'color_pod_gramaje' => '?float',
'cubierta_paginas' => '?int',
'cubierta_gramaje' => '?float',
'cubierta_papel_id' => '?int',
'cubierta_pod_papel_id' => '?int',
'cubierta_pod_gramaje' => '?float',
'sobrecubierta_paginas' => '?int',
'sobrecubierta_gramaje' => '?float',
'sobrecubierta_papel_id' => '?int',
'sobrecubierta_pod_papel_id' => '?int',
'sobrecubierta_pod_gramaje' => '?float',
'fecha_disponibilidad' => 'datetime',
'fecha_public' => 'datetime',
];
public function getClienteName()
@ -156,6 +173,16 @@ class CatalogoLibroEntity extends Entity
return $papel?->nombre ?? null;
}
public function getNegroPodPapelName()
{
if (!$this->negro_pod_papel_id) {
return null;
}
$papel = model(PapelGenericoModel::class)->asObject()->find($this->negro_pod_papel_id);
return $papel?->nombre ?? null;
}
public function getColorPapelName()
{
if (!$this->color_papel_id) {
@ -166,6 +193,16 @@ class CatalogoLibroEntity extends Entity
return $papel?->nombre ?? null;
}
public function getColorPodPapelName()
{
if (!$this->color_pod_papel_id) {
return null;
}
$papel = model(PapelGenericoModel::class)->asObject()->find($this->color_pod_papel_id);
return $papel?->nombre ?? null;
}
public function getCubiertaPapelName()
{
if (!$this->cubierta_papel_id) {
@ -176,6 +213,16 @@ class CatalogoLibroEntity extends Entity
return $papel?->nombre ?? null;
}
public function getCubiertaPodPapelName()
{
if (!$this->cubierta_pod_papel_id) {
return null;
}
$papel = model(PapelGenericoModel::class)->asObject()->find($this->cubierta_pod_papel_id);
return $papel?->nombre ?? null;
}
public function getSobrecubiertaPapelName()
{
if (!$this->sobrecubierta_papel_id) {
@ -186,6 +233,16 @@ class CatalogoLibroEntity extends Entity
return $papel?->nombre ?? null;
}
public function getSobrecubiertaPodPapelName()
{
if (!$this->sobrecubierta_pod_papel_id) {
return null;
}
$papel = model(PapelGenericoModel::class)->asObject()->find($this->sobrecubierta_pod_papel_id);
return $papel?->nombre ?? null;
}
public function getCubiertaAcabadoName()
{
if (!$this->cubierta_acabado_id) {

View File

@ -10,8 +10,10 @@ return [
'color' => 'Color',
'createdAt' => 'Creado en',
'cubierta' => 'Cubierta',
'cubierta_pod' => 'Cubierta (POD)',
'use_for_tapa_dura' => 'Papel tapa dura',
'sobrecubierta' => 'Sobrecubierta',
'sobrecubierta_pod' => 'Sobrecubierta (POD)',
'guardas' => 'Guardas',
'defecto' => 'Por defecto',
'deletedAt' => 'Borrado en',

View File

@ -47,19 +47,27 @@ class CatalogoLibroModel extends Model
'negro_paginas',
'negro_papel_id',
'negro_gramaje',
'negro_pod_papel_id',
'negro_pod_gramaje',
'color_paginas',
'color_papel_id',
'color_gramaje',
'color_pod_papel_id',
'color_pod_gramaje',
'cubierta_paginas',
'cubierta_papel_id',
'cubierta_gramaje',
'cubierta_acabado_id',
'cubierta_ancho_solapas',
'cubierta_pod_papel_id',
'cubierta_pod_gramaje',
'sobrecubierta_paginas',
'sobrecubierta_papel_id',
'sobrecubierta_gramaje',
'sobrecubierta_acabado_id',
'sobrecubierta_ancho_solapas',
'sobrecubierta_pod_papel_id',
'sobrecubierta_pod_gramaje',
'encuadernacion_id',
'ubicacion',
];

View File

@ -13,10 +13,6 @@
data-bs-parent="#accordionConfiguracionLibro">
<div class="accordion-body">
<!-- Alertas + campo oculto -->
<div id="divAlarmasComparador"></div>
<input type="hidden" name="comparador_json_data" id="comparador_json_data" value="">
<?php
// 1) TIPO DE IMPRESIÓN + ENCUADERNACIÓN
$tipos = ['negro', 'negrohq', 'color', 'colorhq'];
@ -28,7 +24,7 @@
</div>
<div class="row px-4 mt-1">
<div class="col-lg-3 col-md-12">
<select id="tipo_impresion" name="tipo_impresion" class="form-control select2bs2"
<select id="tipo_impresion" name="tipo_impresion" class="form-control select2bs2 warning-change"
style="width:100%" data-placeholder="<?= lang('Catalogo.seleccionarTipoImpresion') ?>">
<option></option>
<?php foreach ($tipos as $t): ?>
@ -109,14 +105,16 @@
<?php
$especiales = [
'cubierta' => ['faces' => [2 => 'unaCara', 4 => 'dosCaras'], 'disable' => false],
'sobrecubierta' => ['faces' => [0 => 'no', 1 => 'si'], 'disable' => in_array($catalogoLibrosEntity->tipo_impresion_id, [5, 6, 7, 8, 21])]
'cubierta_pod' => ['faces' => [2 => 'unaCara', 4 => 'dosCaras'], 'disable' => false],
'sobrecubierta' => ['faces' => [0 => 'no', 1 => 'si'], 'disable' => in_array($catalogoLibrosEntity->tipo_impresion_id, [5, 6, 7, 8, 21])],
'sobrecubierta_pod' => ['faces' => [0 => 'no', 1 => 'si'], 'disable' => in_array($catalogoLibrosEntity->tipo_impresion_id, [5, 6, 7, 8, 21])]
];
foreach ($especiales as $tipo => $cfg):
$pag = $catalogoLibrosEntity->{"{$tipo}_paginas"};
$papId = $catalogoLibrosEntity->{"{$tipo}_papel_id"};
$papNm = $catalogoLibrosEntity->{"{$tipo}PapelName"};
$gram = $catalogoLibrosEntity->{"{$tipo}_gramaje"};
$sol = old("{$tipo}_solapas_ancho", $catalogoLibrosEntity->{"{$tipo}_solapas_ancho"});
$sol = old("{$tipo}_solapas_ancho", $catalogoLibrosEntity->{"{$tipo}_ancho_solapas"});
$acId = $catalogoLibrosEntity->{"{$tipo}_acabado_id"};
$acNm = $catalogoLibrosEntity->{"{$tipo}AcabadoName"};
@ -134,11 +132,11 @@
. "</select>",
"<select id=\"{$tipo}_gramaje\" name=\"{$tipo}_gramaje\" class=\"form-control select2bs2 {$tipo}_items\" style=\"width:100%\"" . ($cfg['disable'] ? ' disabled' : '') . ">"
. "<option value=\"" . esc($gram) . "\" selected>" . esc($gram) . "</option></select>",
"<input type=\"text\" id=\"{$tipo}_solapas_ancho\" name=\"{$tipo}_solapas_ancho\" placeholder=\"0\" maxlength=\"5\" class=\"form-control {$tipo}_items\" value=\"" . esc($sol) . "\"" . ($cfg['disable'] ? ' disabled' : '') . ">",
"<input type=\"text\" id=\"{$tipo}_ancho_solapas\" name=\"{$tipo}_ancho_solapas\" placeholder=\"0\" maxlength=\"5\" class=\"form-control {$tipo}_items\" value=\"" . esc($sol) . "\"" . ($cfg['disable'] ? ' disabled' : '') . ">",
"<select id=\"{$tipo}_acabado_id\" name=\"{$tipo}_acabado_id\" class=\"form-control select2bs2 {$tipo}_items\" style=\"width:100%\"" . ($cfg['disable'] ? ' disabled' : '') . ">"
. "<option value=\"" . esc($acId) . "\" selected>" . esc($acNm) . "</option></select>",
];
$renderRow($cells);
$renderRow($cells, $tipo);
endforeach;
?>

View File

@ -19,11 +19,9 @@
<img src="<?= esc($catalogoLibrosEntity->cubierta_url) ?>" class="img-fluid mb-2"
alt="Portada">
<?php else: ?>
<img src="<?= base_url('assets/img/default_cover.png') ?>" class="img-fluid mb-2"
<img src="https://static.cegal.es/imagenes/marcadas/9788415/978841f45711.gif" class="img-fluid mb-2"
alt="Sin portada">
<?php endif; ?>
<input type="file" name="cubierta_archivo" class="form-control" accept="image/*">
<small class="form-text text-muted">Subir portada</small>
<?php endif; ?>
</div>
</div>
@ -97,9 +95,9 @@
</div>
<div class="col-md-3 mb-3">
<label for="cubierta_archivo" class="form-label">Archivo</label>
<input type="text" id="cubierta_archivo" name="cubierta_archivo" class="form-control"
value="<?= old('cubierta_archivo', $catalogoLibrosEntity->cubierta_archivo) ?>">
<label for="ubicacion" class="form-label">Ubicación</label>
<input type="text" id="ubicacion" name="ubicacion" class="form-control"
value="<?= old('ubicacion', $catalogoLibrosEntity->ubicacion) ?>">
</div>
<div class="col-md-3 mb-3">

View File

@ -50,13 +50,13 @@
<div class="col-md-2 mb-3">
<label for="fecha_disponibilidad" class="form-label">Fecha Disponibilidad</label>
<input type="date" id="fecha_disponibilidad" name="fecha_disponibilidad" class="form-control"
value="<?= old('fecha_disponibilidad', $catalogoLibrosEntity->fecha_disponibilidad) ?>">
value="<?= old('fecha_disponibilidad', $catalogoLibrosEntity->fecha_disponibilidad?->format('Y-m-d')) ?>">
</div>
<div class="col-md-2 mb-3">
<label for="fecha_public" class="form-label">Fecha Publicación</label>
<input type="date" id="fecha_public" name="fecha_public" class="form-control"
value="<?= old('fecha_public', $catalogoLibrosEntity->fecha_public) ?>">
value="<?= old('fecha_public', $catalogoLibrosEntity->fecha_public?->format('Y-m-d')) ?>">
</div>
<div class="col-md-2 mb-3">