Reservas
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace Incoviba\Model\Venta;
|
||||
|
||||
use DateTimeInterface;
|
||||
use JsonSerializable;
|
||||
use Incoviba\Model\Direccion;
|
||||
|
||||
@ -12,6 +13,7 @@ class Datos
|
||||
public ?Direccion $direccion = null;
|
||||
public ?int $telefono = null;
|
||||
public ?string $email = null;
|
||||
public ?DateTimeInterface $fecha_nacimiento = null;
|
||||
|
||||
public function jsonSerialize(): mixed
|
||||
{
|
||||
@ -21,7 +23,8 @@ class Datos
|
||||
'profesion' => $this->profesion ?? '',
|
||||
'direccion' => $this->direccion ?? '',
|
||||
'telefono' => $this->telefono ?? '',
|
||||
'email' => $this->email ?? ''
|
||||
'email' => $this->email ?? '',
|
||||
'fecha_nacimiento' => $this->fecha_nacimiento?->format('Y-m-d') ?? '',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ class Reservation extends Common\Ideal\Model
|
||||
public function addUnit(Model\Venta\Unidad $unit, float $value): self
|
||||
{
|
||||
if (($i = $this->findUnit($unit->id)) !== null) {
|
||||
$this->units[$i]['value'] = $value;
|
||||
$this->units[$i]->value = $value;
|
||||
return $this;
|
||||
}
|
||||
$this->units[] = (object) [
|
||||
@ -88,12 +88,7 @@ class Reservation extends Common\Ideal\Model
|
||||
}
|
||||
public function findUnit(int $unit_id): ?int
|
||||
{
|
||||
foreach ($this->units as $idx => $unit) {
|
||||
if ($unit['unit']->id == $unit_id) {
|
||||
return $idx;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return array_find_key($this->units, fn($unit) => $unit->unit->id == $unit_id);
|
||||
}
|
||||
public function hasUnit(int $unit_id): bool
|
||||
{
|
||||
|
@ -3,8 +3,9 @@ namespace Incoviba\Model\Venta\Reservation\State;
|
||||
|
||||
enum Type: int
|
||||
{
|
||||
case ACTIVE = 1;
|
||||
case INACTIVE = 0;
|
||||
case ACTIVE = 1;
|
||||
case PROMISED = 2;
|
||||
case REJECTED = -1;
|
||||
|
||||
public function jsonSerialize(): array
|
||||
|
Reference in New Issue
Block a user