Auth, Login, Home, Venta->Listados->Precios
This commit is contained in:
42
app/src/Model/Proyecto/ProyectoTipoUnidad.php
Normal file
42
app/src/Model/Proyecto/ProyectoTipoUnidad.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
namespace Incoviba\Model\Proyecto;
|
||||
|
||||
use Incoviba\Common\Ideal;
|
||||
use Incoviba\Model;
|
||||
|
||||
class ProyectoTipoUnidad extends Ideal\Model
|
||||
{
|
||||
public Model\Proyecto $proyecto;
|
||||
public Model\Venta\TipoUnidad $tipoUnidad;
|
||||
public string $nombre;
|
||||
public string $abreviacion;
|
||||
public float $util;
|
||||
public float $logia;
|
||||
public float $terraza;
|
||||
public string $descripcion;
|
||||
|
||||
public function superficie(): float
|
||||
{
|
||||
return array_reduce([$this->util, $this->logia, $this->terraza], function($sum, $item) {return $sum + $item;}, 0);
|
||||
}
|
||||
public function vendible(): float
|
||||
{
|
||||
return array_reduce([$this->util, $this->logia, $this->terraza / 2], function($sum, $item) {return $sum + $item;}, 0);
|
||||
}
|
||||
|
||||
public function jsonSerialize(): mixed
|
||||
{
|
||||
return array_merge(parent::jsonSerialize(), [
|
||||
'proyecto' => $this->proyecto,
|
||||
'tipo_unidad' => $this->tipoUnidad,
|
||||
'nombre' => $this->nombre,
|
||||
'abreviacion' => $this->abreviacion,
|
||||
'util' => $this->util,
|
||||
'logia' => $this->logia,
|
||||
'terraza' => $this->terraza,
|
||||
'superficie' => $this->superficie(),
|
||||
'vendible' => $this->vendible(),
|
||||
'descripcion' => $this->descripcion
|
||||
]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user