Mostrar correctamente venta desistida
This commit is contained in:
@ -55,7 +55,7 @@ class Mapper implements Define\Repository\Mapper
|
||||
if ($this->hasProperty()) {
|
||||
$property = $this->property;
|
||||
}
|
||||
if (isset($data[$column])) {
|
||||
if (in_array($column, array_keys($data))) {
|
||||
if ($this->hasFactory()) {
|
||||
$model->addFactory($property, $this->factory);
|
||||
return true;
|
||||
|
@ -26,6 +26,14 @@
|
||||
<a href="{{$urls->base}}/venta/{{$venta->id}}/ceder">
|
||||
Ceder <i clasS="right chevron icon"></i>
|
||||
</a>
|
||||
@else
|
||||
<div class="ui red icon label">
|
||||
<i class="ban icon"></i>
|
||||
{{ucwords($venta->currentEstado()->tipoEstadoVenta->descripcion)}}
|
||||
(<a href="{{$urls->base}}/venta/{{$venta->id}}/desistida">
|
||||
{{$format->pesos($venta->resciliacion()->valor)}}
|
||||
</a>)
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<div class="ui segments">
|
||||
|
@ -17,6 +17,7 @@ class Venta extends Ideal\Model
|
||||
public bool $relacionado;
|
||||
protected ?Venta\Entrega $entrega;
|
||||
public float $uf;
|
||||
protected ?Pago $resciliacion;
|
||||
|
||||
public array $estados;
|
||||
public Venta\EstadoVenta $currentEstado;
|
||||
@ -49,6 +50,13 @@ class Venta extends Ideal\Model
|
||||
}
|
||||
return $this->entrega;
|
||||
}
|
||||
public function resciliacion(): ?Venta\Pago
|
||||
{
|
||||
if (!isset($this->resciliacion)) {
|
||||
$this->resciliacion = $this->runFactory('resciliacion');
|
||||
}
|
||||
return $this->resciliacion;
|
||||
}
|
||||
|
||||
public function estados(): array
|
||||
{
|
||||
|
@ -115,9 +115,12 @@ class Venta extends Ideal\Repository
|
||||
->register('fecha_ingreso', new Implement\Repository\Mapper\DateTime('fecha_ingreso', 'fechaIngreso'))
|
||||
//->register('avalchile')
|
||||
//->register('agente')
|
||||
->register('resciliacion', (new Implement\Repository\Mapper())
|
||||
->setFactory((new Implement\Repository\Factory())
|
||||
->setCallable([$this->pagoService, 'getById'])
|
||||
->setArgs(['pago_id' => $data['resciliacion']])))
|
||||
->register('relacionado', new Implement\Repository\Mapper\Boolean('relacionado'));
|
||||
//->register('promocion')
|
||||
//->register('resciliacion')
|
||||
//->register('devolucion');
|
||||
return $this->parseData(new Model\Venta(), $data, $map);
|
||||
}
|
||||
|
@ -14,13 +14,13 @@ class Venta
|
||||
protected Repository\Venta\TipoEstadoVenta $tipoEstadoVentaRepository,
|
||||
protected Repository\Venta\Credito $creditoRepository,
|
||||
protected Repository\Venta\Escritura $escrituraRepository,
|
||||
protected Repository\Venta\Pago $pagoRepository,
|
||||
protected Venta\Propietario $propietarioService,
|
||||
protected Venta\Propiedad $propiedadService,
|
||||
protected Venta\Pie $pieService,
|
||||
protected Venta\Subsidio $subsidioService,
|
||||
protected Venta\Credito $creditoService,
|
||||
protected Venta\BonoPie $bonoPieService,
|
||||
protected Venta\Pago $pagoService,
|
||||
protected Money $moneyService
|
||||
) {}
|
||||
|
||||
@ -384,8 +384,7 @@ class Venta
|
||||
{
|
||||
try {
|
||||
if ($this->validarData($data, ['fecha', 'devolucion'])) {
|
||||
$pago = $this->pagoRepository->create(['fecha' => $data['fecha'], 'valor' => $data['devolucion']]);
|
||||
$pago = $this->pagoRepository->save($pago);
|
||||
$pago = $this->pagoService->add(['fecha' => $data['fecha'], 'valor' => $data['devolucion']]);
|
||||
$this->ventaRepository->edit($venta, ['resciliacion' => $pago->id]);
|
||||
}
|
||||
$tipoEstado = $this->tipoEstadoVentaRepository->fetchByDescripcion('desistida');
|
||||
|
Reference in New Issue
Block a user