Promociones para cada subdivicion

This commit is contained in:
Juan Pablo Vial
2025-04-03 16:32:40 -03:00
parent b5d6d0acb9
commit 7b2df74e4d
19 changed files with 495 additions and 247 deletions

View File

@ -26,13 +26,13 @@ class Promotion extends Common\Ideal\Model
return $this->projects;
}
protected array $contracts;
public function contracts(): array
protected array $brokers;
public function brokers(): array
{
if (empty($this->contracts)) {
$this->contracts = $this->runFactory('contracts') ?? [];
if (empty($this->brokers)) {
$this->brokers = $this->runFactory('brokers') ?? [];
}
return $this->contracts;
return $this->brokers;
}
protected array $unitTypes;
@ -61,15 +61,6 @@ class Promotion extends Common\Ideal\Model
return $this->units;
}
protected array $contractUnits;
public function contractUnits(): array
{
if (empty($this->contractUnits)) {
$this->contractUnits = $this->runFactory('contractUnits');
}
return $this->contractUnits;
}
public function value(float $price): float
{
if ($this->type === Type::FIXED) {
@ -89,7 +80,7 @@ class Promotion extends Common\Ideal\Model
'type' => $this->type,
'state' => $this->state,
'projects' => $this->projects() ?? [],
'contracts' => $this->contracts() ?? [],
'contracts' => $this->brokers() ?? [],
'units' => $this->units() ?? []
];
}