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

@ -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;
}
}