Broker Contact
This commit is contained in:
@ -9,7 +9,7 @@ class Broker extends Common\Ideal\Model
|
||||
public string $digit;
|
||||
public string $name;
|
||||
|
||||
protected ?Broker\Data $data = null;
|
||||
protected ?Broker\Data $data;
|
||||
public function data(): ?Broker\Data
|
||||
{
|
||||
if (!isset($this->data)) {
|
||||
@ -18,13 +18,28 @@ class Broker extends Common\Ideal\Model
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
protected array $contracts;
|
||||
public function contracts(): ?array
|
||||
{
|
||||
if (!isset($this->contracts)) {
|
||||
$this->contracts = $this->runFactory('contracts');
|
||||
}
|
||||
return $this->contracts;
|
||||
}
|
||||
|
||||
public function rutFull(): string
|
||||
{
|
||||
return implode('-', [number_format($this->rut, 0, ',', '.'), $this->digit]);
|
||||
}
|
||||
|
||||
public function jsonSerialize(): mixed
|
||||
{
|
||||
return [
|
||||
'rut' => $this->rut,
|
||||
'digit' => $this->digit,
|
||||
'name' => $this->name,
|
||||
'data' => $this->data()
|
||||
'data' => $this->data(),
|
||||
'rut_full' => $this->rutFull()
|
||||
];
|
||||
}
|
||||
}
|
||||
|
24
app/src/Model/Proyecto/Broker/Contact.php
Normal file
24
app/src/Model/Proyecto/Broker/Contact.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace Incoviba\Model\Proyecto\Broker;
|
||||
|
||||
use Incoviba\Common\Ideal;
|
||||
use Incoviba\Model\Direccion;
|
||||
use Incoviba\Model\Proyecto\Broker;
|
||||
|
||||
class Contact extends Ideal\Model
|
||||
{
|
||||
public string $name;
|
||||
public ?string $email = null;
|
||||
public ?string $phone = null;
|
||||
public ?Direccion $address = null;
|
||||
|
||||
protected function jsonComplement(): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->name,
|
||||
'email' => $this->email,
|
||||
'phone' => $this->phone,
|
||||
'address' => $this->address
|
||||
];
|
||||
}
|
||||
}
|
@ -7,15 +7,15 @@ use Incoviba\Model;
|
||||
class Data extends Common\Ideal\Model
|
||||
{
|
||||
public Model\Proyecto\Broker $broker;
|
||||
public ?Model\Persona $representative = null;
|
||||
public ?Model\Proyecto\Broker\Contact $representative = null;
|
||||
public ?string $legalName = null;
|
||||
|
||||
protected function jsonComplement(): array
|
||||
{
|
||||
return [
|
||||
'broker_rut' => $this->broker->rut,
|
||||
'representative_rut' => $this->representative?->rut,
|
||||
'representative' => $this->representative,
|
||||
'legal_name' => $this->legalName
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user