Se agregan los campos por segmento
This commit is contained in:
148
src/Productos/Retail.php
Normal file
148
src/Productos/Retail.php
Normal file
@ -0,0 +1,148 @@
|
||||
<?php
|
||||
namespace ProVM\KI\Productos;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use ProVM\KI\Producto;
|
||||
|
||||
class Retail extends Producto {
|
||||
protected $properties = [
|
||||
'bono',
|
||||
'rentabilidad',
|
||||
'cuota',
|
||||
'entrega',
|
||||
'estado',
|
||||
'unidades',
|
||||
'modelos',
|
||||
'tamaños'
|
||||
];
|
||||
|
||||
public function setTamaños(int $min, int $max = -1) {
|
||||
if ($max == -1) {
|
||||
$max = $min;
|
||||
}
|
||||
$this->tamaños = $min . ' - ' . $max . ' m²';
|
||||
}
|
||||
public function getTamaños() {
|
||||
return $this->tamaños;
|
||||
}
|
||||
public function setEntrega(\DataTime $fecha) {
|
||||
$this->entrega = $fecha->format('%m/%Y');
|
||||
}
|
||||
public function getEntrega() {
|
||||
return Carbon::parse(implode('-', array_reverse(explode('/', $this->entrega))) . '-01');
|
||||
}
|
||||
public function getDireccion() {
|
||||
return implode(', ', [
|
||||
$this->direccion->calle,
|
||||
$this->direccion->comuna ?? '',
|
||||
$this->direccion->ciudad ?? ''
|
||||
]);
|
||||
}
|
||||
public function getProperties(): array {
|
||||
$properties = [];
|
||||
$properties []= (object) [
|
||||
'label' => 'Bono Pie en UF',
|
||||
'name' => 'bono'
|
||||
];
|
||||
$properties []= (object) [
|
||||
'label' => 'Rentabilidad %',
|
||||
'name' => 'rentabilidad'
|
||||
];
|
||||
$properties []= (object) [
|
||||
'label' => 'Valor Cuota en UF',
|
||||
'name' => 'cuota'
|
||||
];
|
||||
$properties []= (object) [
|
||||
'label' => 'Entrega Estimada',
|
||||
'name' => 'entrega'
|
||||
];
|
||||
$properties []= (object) [
|
||||
'label' => 'Estado',
|
||||
'name' => 'estado'
|
||||
];
|
||||
$properties []= (object) [
|
||||
'label' => 'Unidades',
|
||||
'name' => 'unidades'
|
||||
];
|
||||
$properties []= (object) [
|
||||
'label' => 'Modelos',
|
||||
'name' => 'modelos'
|
||||
];
|
||||
$properties []= (object) [
|
||||
'label' => 'Tamaños',
|
||||
'name' => 'tamaños'
|
||||
];
|
||||
return $properties;
|
||||
}
|
||||
public function getFicha(): array {
|
||||
$properties = [
|
||||
[
|
||||
'label' => 'Valor Depto',
|
||||
'name' => 'valor',
|
||||
'suffix' => ' UF'
|
||||
],
|
||||
[
|
||||
'label' => 'Bono Pie',
|
||||
'name' => 'bono',
|
||||
'suffix' => ' UF'
|
||||
],
|
||||
[
|
||||
'label' => 'Rentabilidad',
|
||||
'name' => 'rentabilidad',
|
||||
'suffix' => '%'
|
||||
],
|
||||
[
|
||||
'label' => 'Valor Cuota',
|
||||
'name' => 'cuota',
|
||||
'suffix' => ' UF'
|
||||
],
|
||||
[
|
||||
'label' => 'Entrega Estimada',
|
||||
'name' => 'entrega'
|
||||
]
|
||||
];
|
||||
array_walk($properties, function(&$item) {
|
||||
$item['suffix'] = $item['suffix'] ?? '';
|
||||
$item = (object) $item;
|
||||
});
|
||||
return $properties;
|
||||
}
|
||||
public function getShow() {
|
||||
$properties = [
|
||||
[
|
||||
'label' => 'Precio',
|
||||
'name' => 'valor',
|
||||
'suffix' => ' UF'
|
||||
],
|
||||
[
|
||||
'label' => 'Estado',
|
||||
'name' => 'estado'
|
||||
],
|
||||
[
|
||||
'label' => 'Tipo',
|
||||
'name' => 'segmento'
|
||||
],
|
||||
[
|
||||
'label' => 'Ubicación',
|
||||
'name' => 'getDireccion'
|
||||
],
|
||||
[
|
||||
'label' => 'Unidades',
|
||||
'name' => 'unidades'
|
||||
],
|
||||
[
|
||||
'label' => 'Modelos',
|
||||
'name' => 'modelos'
|
||||
],
|
||||
[
|
||||
'label' => 'Tamaño',
|
||||
'name' => 'tamaños'
|
||||
]
|
||||
];
|
||||
array_walk($properties, function(&$item) {
|
||||
$item['suffix'] = $item['suffix'] ?? '';
|
||||
$item = (object) $item;
|
||||
});
|
||||
return $properties;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user