Auth, Login, Home, Venta->Listados->Precios

This commit is contained in:
Juan Pablo Vial
2023-07-24 20:55:26 -04:00
parent d9d5a15376
commit 1a7b10ce3c
130 changed files with 4302 additions and 0 deletions

16
app/src/Model/Banco.php Normal file
View File

@ -0,0 +1,16 @@
<?php
namespace Incoviba\Model;
use Incoviba\Common\Ideal\Model;
class Banco extends Model
{
public ?string $nombre;
public function jsonSerialize(): mixed
{
return array_merge(parent::jsonSerialize(), [
'nombre' => $this->nombre ?? ''
]);
}
}

18
app/src/Model/Comuna.php Normal file
View File

@ -0,0 +1,18 @@
<?php
namespace Incoviba\Model;
use Incoviba\Common\Ideal\Model;
class Comuna extends Model
{
public string $descripcion;
public Provincia $provincia;
public function jsonSerialize(): mixed
{
return array_merge(parent::jsonSerialize(), [
'descripcion' => $this->descripcion,
'provincia' => $this->provincia
]);
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace Incoviba\Model;
use Incoviba\Common\Ideal\Model;
class Direccion extends Model
{
public string $calle;
public int $numero;
public string $extra;
public Comuna $comuna;
public function jsonSerialize(): mixed
{
return array_merge(parent::jsonSerialize(), [
'calle' => $this->calle,
'numero' => $this->numero,
'extra' => $this->extra,
'comuna' => $this->comuna
]);
}
}

View File

@ -0,0 +1,38 @@
<?php
namespace Incoviba\Model;
use Incoviba\Common\Ideal\Model;
use Incoviba\Model\Inmobiliaria\TipoSociedad;
class Inmobiliaria extends Model
{
public int $rut;
public ?string $dv;
public ?string $razon;
public ?string $abreviacion;
public ?string $cuenta;
public ?Banco $banco;
public ?TipoSociedad $tipoSociedad;
public function rut(): string
{
return implode('-', [
number_format($this->rut, 0, ',', '.'),
$this->dv
]);
}
public function jsonSerialize(): mixed
{
return [
'rut' => $this->rut,
'dv' => $this->dv ?? '',
'rut_formateado' => $this->rut(),
'razon' => $this->razon ?? '',
'abreviacion' => $this->abreviacion ?? '',
'cuenta' => $this->cuenta ?? '',
'banco' => $this->banco ?? '',
'tipo_sociedad' => $this->tipoSociedad ?? ''
];
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace Incoviba\Model\Inmobiliaria;
use Incoviba\Model;
class TipoSociedad extends Model\Tipo
{
public string $abreviacion;
public function jsonSerialize(): mixed
{
return array_merge(parent::jsonSerialize(), [
'abreviacion' => $this->abreviacion
]);
}
}

25
app/src/Model/Login.php Normal file
View File

@ -0,0 +1,25 @@
<?php
namespace Incoviba\Model;
use DateTimeInterface;
use Incoviba\Common\Ideal;
class Login extends Ideal\Model
{
public User $user;
public string $selector;
public string $token;
public DateTimeInterface $dateTime;
public bool $status;
public function jsonSerialize(): mixed
{
return array_merge(parent::jsonSerialize(), [
'user_id' => $this->user->id,
'selector' => $this->selector,
'token' => $this->token,
'date_time' => $this->dateTime->format('Y-m-d H:i:s'),
'status' => $this->status
]);
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace Incoviba\Model;
use Incoviba\Common\Ideal\Model;
class Provincia extends Model
{
public string $descripcion;
public Region $region;
public function jsonSerialize(): mixed
{
return array_merge(parent::jsonSerialize(), [
'descripcion' => $this->descripcion,
'region' => $this->region
]);
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace Incoviba\Model;
use Incoviba\Common\Ideal\Model;
use Incoviba\Model\Proyecto\Superficie;
use Incoviba\Model\Proyecto\Terreno;
class Proyecto extends Model
{
public Inmobiliaria $inmobiliaria;
public string $descripcion;
public Direccion $direccion;
public Terreno $terreno;
public Superficie $superficie;
public float $corredor;
public int $pisos;
public int $subterraneos;
public function jsonSerialize(): mixed
{
return array_merge(parent::jsonSerialize(), [
'inmobiliaria' => $this->inmobiliaria,
'descripcion' => $this->descripcion,
'direccion' => $this->direccion,
'terreno' => $this->terreno,
'superficie' => $this->superficie,
'corredor' => $this->corredor,
'pisos' => $this->pisos,
'subterraneos' => $this->subterraneos
]);
}
}

View 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
]);
}
}

View File

@ -0,0 +1,8 @@
<?php
namespace Incoviba\Model\Proyecto;
class Superficie
{
public float $sobre_nivel;
public float $bajo_nivel;
}

View File

@ -0,0 +1,8 @@
<?php
namespace Incoviba\Model\Proyecto;
class Terreno
{
public float $superficie;
public float $valor;
}

20
app/src/Model/Region.php Normal file
View File

@ -0,0 +1,20 @@
<?php
namespace Incoviba\Model;
use Incoviba\Common\Ideal\Model;
class Region extends Model
{
public string $descripcion;
public string $numeral;
public ?int $numeracion;
public function jsonSerialize(): mixed
{
return array_merge(parent::jsonSerialize(), [
'descripcion' => $this->descripcion,
'numeral' => $this->numeral,
'numeracion' => $this->numeracion ?? 0
]);
}
}

7
app/src/Model/Role.php Normal file
View File

@ -0,0 +1,7 @@
<?php
namespace Incoviba\Model;
use Incoviba\Common\Ideal\Model;
class Role extends Model
{}

16
app/src/Model/Tipo.php Normal file
View File

@ -0,0 +1,16 @@
<?php
namespace Incoviba\Model;
use Incoviba\Common\Ideal;
abstract class Tipo extends Ideal\Model
{
public string $descripcion;
public function jsonSerialize(): mixed
{
return array_merge(parent::jsonSerialize(), [
'descripcion' => $this->descripcion
]);
}
}

28
app/src/Model/User.php Normal file
View File

@ -0,0 +1,28 @@
<?php
namespace Incoviba\Model;
use Incoviba\Common\Ideal;
use function password_verify;
class User extends Ideal\Model
{
public string $name;
public string $password;
public bool $enabled;
public function validate(string $provided_password): bool
{
return password_verify($provided_password, $this->password);
}
public function isAdmin(): bool
{
return false;
}
public function jsonSerialize(): mixed
{
return array_merge(parent::jsonSerialize(), [
'name' => $this->name
]);
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace Incoviba\Model\Venta;
use DateTimeInterface;
use Incoviba\Common\Ideal;
use Incoviba\Model;
class Cierre extends Ideal\Model
{
public Model\Proyecto $proyecto;
public float $precio;
public DateTimeInterface $dateTime;
public bool $relacionado;
public Propietario $propietario;
public function jsonSerialize(): mixed
{
return array_merge(parent::jsonSerialize(), [
'proyecto_id' => $this->proyecto->id,
'precio' => $this->precio,
'date_time' => $this->dateTime->format('Y-m-d H:i:s'),
'relacionado' => $this->relacionado,
'propietario' => $this->propietario->rut
]);
}
}

View File

@ -0,0 +1,38 @@
<?php
namespace Incoviba\Model\Venta;
use DateTimeInterface;
use Incoviba\Common\Ideal\Model;
use Incoviba\Model\Banco;
class Cuota extends Model
{
public Pie $pie;
public DateTimeInterface $fecha;
public float $valor;
public ?bool $estado;
public ?Banco $banco;
public ?DateTimeInterface $fechaPago;
public ?bool $abonado;
public ?DateTimeInterface $fechaAbonado;
public ?float $uf;
public ?Pago $pago;
public ?int $numero;
public function jsonSerialize(): mixed
{
return array_merge(parent::jsonSerialize(), [
'pie_id' => $this->pie->id,
'fecha' => $this->fecha->format('Y-m-d H:i:s'),
'valor' => $this->valor,
'estado' => $this->estado ?? false,
'banco' => $this->banco,
'fecha_pago' => $this->fechaPago->format('Y-m-d H:i:s') ?? '',
'abonado' => $this->abonado ?? false,
'fecha_abonado' => $this->fechaAbonado->format('Y-m-d H:i:s') ?? '',
'uf' => $this->uf ?? 1,
'pago' => $this->pago ?? '',
'numero' => $this->numero ?? ''
]);
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace Incoviba\Model\Venta;
use JsonSerializable;
use Incoviba\Model\Direccion;
class Datos
{
public ?string $sexo;
public ?string $estado_civil;
public ?string $profesion;
public ?Direccion $direccion;
public ?int $telefono;
public ?string $email;
public function jsonSerialize(): mixed
{
return [
'sexo' => $this->sexo ?? '',
'estado_civil' => $this->estado_civil ?? '',
'profesion' => $this->profesion ?? '',
'direccion' => $this->direccion ?? '',
'telefono' => $this->telefono ?? '',
'email' => $this->email ?? ''
];
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace Incoviba\Model\Venta;
use DateTimeInterface;
use Incoviba\Common\Ideal\Model;
class EstadoPago extends Model
{
public Pago $pago;
public DateTimeInterface $fecha;
public TipoEstadoPago $tipoEstadoPago;
public function jsonSerialize(): mixed
{
return array_merge(parent::jsonSerialize(), [
'pago_id' => $this->pago->id,
'fecha' => $this->fecha->format('Y-m-d'),
'tipo_estado_pago_id' => $this->tipoEstadoPago->id
]);
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace Incoviba\Model\Venta;
use DateTimeInterface;
use Incoviba\Common\Ideal;
class EstadoPrecio extends Ideal\Model
{
public Precio $precio;
public TipoEstadoPrecio $tipoEstadoPrecio;
public DateTimeInterface $fecha;
public function jsonSerialize(): mixed
{
return array_merge(parent::jsonSerialize(), [
'precio_id' => $this->precio->id,
'tipo_estado_precio' => $this->tipoEstadoPrecio,
'fecha' => $this->fecha->format('Y-m-d')
]);
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace Incoviba\Model\Venta;
use DateTimeInterface;
use Incoviba\Common\Ideal\Model;
use Incoviba\Model\Banco;
class Pago extends Model
{
public float $valor;
public ?Banco $banco;
public ?TipoPago $tipoPago;
public ?string $identificador;
public ?DateTimeInterface $fecha;
public ?float $uf;
public ?string $pagador;
public ?Pago $asociado;
public function jsonSerialize(): mixed
{
return array_merge(parent::jsonSerialize(), [
'valor' => $this->valor,
'banco' => $this->banco ?? '',
'tipo_pago' => $this->tipoPago ?? '',
'identificador' => $this->identificador ?? '',
'fecha' => $this->fecha->format('Y-m-d H:i:S') ?? '',
'uf' => $this->uf ?? 1,
'pagador' => $this->pagador ?? '',
'asociado' => $this->asociado ?? ''
]);
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace Incoviba\Model\Venta;
use DateTimeInterface;
use Incoviba\Common\Ideal\Model;
class Pie extends Model
{
public DateTimeInterface $fecha;
public float $valor;
public ?float $uf;
public int $cuotas;
public ?Pie $asociado;
public ?Pago $reajuste;
public function jsonSerialize(): mixed
{
return array_merge(parent::jsonSerialize(), [
'fecha' => $this->fecha->format('Y-m-d H:i:s'),
'valor' => $this->valor,
'uf' => $this->uf ?? 1,
'cuotas' => $this->cuotas,
'asociado' => $this->asociado ?? '',
'reajuste' => $this->reajuste ?? ''
]);
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Incoviba\Model\Venta;
use Incoviba\Common\Ideal;
class Precio extends Ideal\Model
{
public Unidad $unidad;
public float $valor;
public array $estados;
public EstadoPrecio $current;
public function jsonSerialize(): mixed
{
return array_merge(parent::jsonSerialize(), [
'unidad' => $this->unidad,
'valor' => $this->valor,
'estado_precio' => $this->current ?? [],
'estados' => $this->estados ?? null
]);
}
}

View File

@ -0,0 +1,46 @@
<?php
namespace Incoviba\Model\Venta;
use Incoviba\Common\Ideal\Model;
use Incoviba\Model\Direccion;
class Propietario extends Model
{
public int $rut;
public string $dv;
public string $nombres;
public array $apellidos;
public Datos $datos;
public ?Propietario $representante;
public ?bool $otro;
public function rut(): string
{
return implode('-', [
number_format($this->rut, 0, ',', '.'),
$this->dv
]);
}
public function nombreCompleto(): string
{
return implode(' ', [
$this->nombres,
implode(' ', $this->apellidos)
]);
}
public function jsonSerialize(): mixed
{
return array_merge([
'rut' => $this->rut,
'dv' => $this->dv,
'rut_formateado' => $this->rut(),
'nombres' => $this->nombres,
'apellidos' => $this->apellidos,
'nombre_completo' => $this->nombreCompleto(),
], $this->datos->jsonSerialize(), [
'representante' => $this->representante ?? '',
'otro' => $this->otro ?? ''
]);
}
}

View File

@ -0,0 +1,8 @@
<?php
namespace Incoviba\Model\Venta;
use Incoviba\Model;
class TipoEstadoPago extends Model\Tipo
{
}

View File

@ -0,0 +1,7 @@
<?php
namespace Incoviba\Model\Venta;
use Incoviba\Model\Tipo;
class TipoEstadoPrecio extends Tipo
{}

View File

@ -0,0 +1,8 @@
<?php
namespace Incoviba\Model\Venta;
use Incoviba\Model;
class TipoPago extends Model\Tipo
{
}

View File

@ -0,0 +1,16 @@
<?php
namespace Incoviba\Model\Venta;
use Incoviba\Model;
class TipoUnidad extends Model\Tipo
{
public int $orden;
public function jsonSerialize(): mixed
{
return array_merge(parent::jsonSerialize(), [
'orden' => $this->orden
]);
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace Incoviba\Model\Venta;
use Incoviba\Common\Ideal;
use Incoviba\Model;
class Unidad extends Ideal\Model
{
public ?string $subtipo = '';
public int $piso;
public string $descripcion;
public ?string $orientacion = '';
public Model\Proyecto\ProyectoTipoUnidad $proyectoTipoUnidad;
public function jsonSerialize(): mixed
{
return array_merge(parent::jsonSerialize(), [
'subtipo' => $this->subtipo,
'piso' => $this->piso,
'descripcion' => $this->descripcion,
'orientacion' => $this->orientacion,
'proyecto_tipo_unidad' => $this->proyectoTipoUnidad
]);
}
}