Files
oficial/resources/views/ventas/show.blade.php
2021-03-25 21:20:49 -03:00

288 lines
9.9 KiB
PHP

@extends('layout.base')
@section('content')
<div class="row page-heading">
<div class="col-md-6 h3">Venta - {{$venta->unidad()->descripcion}} - {{$venta->proyecto()->descripcion}}</div>
<div class="col-md-6 text-right h3"><a href="{{url('', ['p' => 'ventas', 'a' => 'edit', 'venta' => $venta->id])}}"><span class="glyphicon glyphicon-edit"></span></a></div>
</div>
<table class="table">
<thead>
<tr class="section-heading">
<th>PROYECTO</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="{{url('', ['p' => 'proyectos', 'a' => 'show', 'proyecto' => $venta->proyecto()->id])}}">{{$venta->proyecto()->descripcion}}</a></td>
</tr>
</tbody>
</table>
<table class="table">
<thead>
<tr class="section-heading">
<th>PROPIETARIO</th>
<th class="text-right"><a href="{{url('', ['p' => 'propietarios', 'a' => 'edit', 'venta' => $venta->id])}}"><span class="glyphicon glyphicon-edit"></span></a>
</tr>
</thead>
<tbody>
<tr>
<td>{{\App\Helper\Format::number($venta->propietario()->rut, 0)}}-{{$venta->propietario()->dv}}</td>
<td>{{($venta->propietario()->direccion()) ? $venta->propietario()->direccion()->completa() : ''}}</td>
</tr>
<tr>
<td>
<a href="{{url('', ['p' => 'buscar', 'q' => urlencode('"' . $venta->propietario()->nombreCompleto() . '"')])}}">
{{$venta->propietario()->nombreCompleto()}} <span class="small glyphicon glyphicon-search"></span>
</a>
</td>
<td>{{($venta->propietario()->direccion()) ? $venta->propietario()->direccion()->comuna()->descripcion : ''}}
</tr>
</tbody>
</table>
<div class="row small">
@if ($venta->estado()->tipo()->activa())
<div class="col-md-2">
<a href="{{url('', ['p' => 'ventas', 'a' => 'desistir', 'venta' => $venta->id])}}">Desistir <span class="glyphicon glyphicon-minus"></span></a>
</div>
<div class="col-md-2">
<a href="{{url('', ['p' => 'ventas', 'a' => 'ceder', 'venta' => $venta->id])}}">Ceder <span class="glyphicon glyphicon-chevron-right"></span></a>
</div>
@else
<div class="col-md-2">
@if (!$venta->estado()->tipo()->activa() and $venta->estado()->tipo()->descripcion == 'desistida')
Desistida <span class="glyphicon glyphicon-ban-circle"></span>
@if ($venta->resciliacion != null)
(<a href="{{url('', ['p' => 'pagos', 'a' => 'show', 'pago' => $venta->resciliacion, 'asociado' => 'venta', 'venta' => $venta->id])}}">$ {{format('pesos', $venta->resciliacion()->valor)}}</a>)
@endif
@elseif (!$venta->estado()->tipo()->activa() and $venta->estado()->tipo()->descripcion == 'cedida')
Cedida <span class="glyphicon glyphicon-share-alt"></span>
@endif
</div>
@endif
</div>
<table class="table table-striped">
<thead>
<tr class="section-heading">
<th colspan="7">PROPIEDAD</th>
</tr>
<tr class="subsection-heading">
<th colspan="2">Unidad</th>
<th>Piso</th>
<th>Metros Vendibles</th>
<th class="text-right">Valor Base</th>
<th>UF/m&#0178;</th>
<th>Orientaci&oacute;n</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ucwords($venta->unidad()->tipo()->descripcion)}} {{$venta->unidad()->tipologia()->tipologia()->descripcion}}</td>
<td>{{$venta->unidad()->descripcion}}</td>
<td>{{$venta->unidad()->piso}}</td>
<td>{{\App\Helper\Format::number($venta->unidad()->m2(), 2)}} m&#0178;</td>
<td class="text-right">
@if ($venta->unidad()->precio($venta->fecha()))
{{format('ufs', $venta->unidad()->precio($venta->fecha())->valor)}} UF
@else
{{format('ufs', $venta->unidad()->valor)}} UF
@endif
</td>
<td>
@if ($venta->unidad()->precio($venta->fecha()))
{{format('ufs', $venta->unidad()->precio($venta->fecha())->valor / $venta->unidad()->m2(), null, true)}}/m&#0178;
@else
{{format('ufs', $venta->unidad()->valor / $venta->unidad()->m2(), null, true)}}/m&#0178;
@endif
</td>
<td>{{$venta->unidad()->orientacion}}</td>
</tr>
@foreach ($venta->propiedad()->unidades() as $unidad)
@if ($unidad->unidad()->id == $venta->unidad()->id)
@continue
@endif
<tr>
<td>
{{ucwords($unidad->unidad()->tipo()->descripcion)}}
@if ($unidad->unidad()->tipo()->descripcion == 'departamento')
{{$unidad->unidad()->tipologia()->tipologia()->descripcion}}
@endif
</td>
<td>{{$unidad->unidad()->descripcion}}</td>
<td>{{$unidad->unidad()->piso}}</td>
<td>
@if ($unidad->unidad()->tipo()->descripcion == 'departamento')
{{\App\Helper\Format::number($unidad->unidad()->m2(), 2)}} m&#0178;
@endif
</td>
<td class="text-right">
@if ($unidad->unidad()->precio($venta->fecha()))
{{format('ufs', $unidad->unidad()->precio($venta->fecha())->valor, null, true)}}
@else
{{format('ufs', $unidad->unidad()->valor, null, true)}}
@endif
</td>
<td>
@if ($unidad->unidad()->tipo()->descripcion == 'departamento')
@if ($unidad->unidad()->precio($venta->fecha()))
{{format('ufs', $unidad->unidad()->precio($venta->fecha())->valor / $unidad->unidad()->m2(), null, true)}}/m&#0178;
@else
{{format('ufs', $unidad->unidad()->valor / $unidad->unidad()->m2(), null, true)}}/m&#0178;
@endif
@endif
</td>
<td>
@if ($unidad->unidad()->tipo()->descripcion == 'departamento')
{{$unidad->unidad()->orientacion}}
@endif
</td>
</tr>
@endforeach
<tr>
<td colspan="4"><b>Total</b></td>
<td class="text-right">
<b>
{{format('ufs', $venta->valorUnidades(), null, true)}}
</b>
</td>
<td>
<b>
{{format('ufs', $venta->valorDepartamentos() / $venta->superficie(), null, true)}}/m&#0178;
</b>
</td>
<td colspan="2"></td>
</tr>
</tbody>
</table>
<table class="table">
<thead>
<tr class="section-heading">
<th colspan="5">VENTA</th>
</tr>
<tr class="subsection-heading">
<th>Valor Total</th>
<th>Valor Util</th>
<th>UF/m&#0178;</th>
<th>Operador</th>
<th>Fecha Promesa<br />Fecha Ingreso</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{format('ufs', $venta->valor_uf)}} UF</td>
<td>{{format('ufs', $venta->valorFinal())}} UF</td>
<td>{{format('ufs', $venta->uf_m2(), null, true)}}/m&#0178;</td>
<td>{{format('ufs', $venta->valorComision())}} UF ({{\App\Helper\Format::number($venta->comision() * 100, 2)}}%)
@if ($venta->agente != 0)
<br />
{{$venta->agente()->agente()->agente()->descripcion}}
@endif
</td>
<td>{{format('shortDate', $venta->fecha)}}<br />{{format('shortDate', $venta->fecha_ingreso)}}</td>
</tr>
@if (count($venta->promociones()) > 0)
@foreach ($venta->promociones() as $promo)
<tr>
<td>{{$promo->promocion()->descripcion}}</td>
<td>{{format('ufs', $promo->valor, null, true)}}</td>
<td colspan="3"></td>
</tr>
@endforeach
@endif
</tbody>
</table>
@include('ventas.forma_pago')
<table class="table">
<thead>
<tr class="section-heading">
<th>ESCRITURA</th>
</tr>
</thead>
<tbody>
<tr>
<td>
@if ($venta->escriturado == 0)
<a href="{{url('', ['p' => 'escrituras', 'a' => 'add', 'venta' => $venta->id])}}">Escriturar <span class="small glyphicon glyphicon-chevron-right"></span></a>
@elseif ($venta->estado()->tipo()->activa())
Escriturado {{format('shortDate', $venta->estado('escriturando')->fecha)}} <a href="{{url('', ['p' => 'escrituras', 'a' => 'informe', 'venta' => $venta->id])}}">Informe <span class="small glyphicon glyphicon-chevron-right"></span></a>
@if ($venta->estado()->tipo()->descripcion == 'escriturando')
<br /><a href="{{nUrl('ventas', 'firmar', ['venta' => $venta->id])}}">Firmar</a>
@elseif ($venta->estado()->tipo()->descripcion == 'firmado por inmobiliaria')
<br />Firmado {{format('shortDate', $venta->estado('firmado por inmobiliaria')->fecha)}}
<br /><a href="{{nUrl('ventas', 'archivar', ['venta' => $venta->id])}}">Archivar</a>
@elseif ($venta->estado()->tipo()->descripcion == 'archivado')
<br />Archivado {{format('shortDate', $venta->estado('archivado')->fecha)}}
@endif
@if ($venta->saldo() / $venta->valor_uf > 0.01)
<br />Devolver: $ {{format('pesos', $venta->saldo('pesos'))}} ({{format('ufs', $venta->saldo())}} UF)
@endif
@endif
</td>
</tr>
</tbody>
</table>
<table class="table">
<thead>
<tr class="section-heading">
<th>
@if ($venta->entregado == 0)
ENTREGA
@else
ENTREGADO
@endif
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
@if ($venta->entregado == 0)
<a href="{{url('', ['p' => 'ventas', 'a' => 'entregar', 'venta' => $venta->id])}}">No <span class="glyphicon glyphicon-chevron-right"></span></a>
@else
<a href="{{url('', ['p' => 'entregas', 'a' => 'add', 'venta' => $venta->id])}}">Agregar observaciones de entrega.</a>
@endif
</td>
</tr>
</tbody>
</table>
@if ($venta->entregado != 0)
<table class="table">
<thead>
<tr class="section-heading">
<th>POSTVENTA</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="{{url('', ['p' => 'postventas', 'a' => 'add', 'venta' => $venta->id])}}"><span class="glyphicon glyphicon-plus"></span></a>
</tr>
@if ($venta->postventas() != null)
@foreach ($venta->postventas() as $postventa)
<tr>
<td><a href="{{url('', ['p' => 'postventas', 'a' => 'show', 'postventa' => $postventa->id])}}">({{format('shortDate', $postventa->estado()->fecha)}}) [{{count($postventa->observacionesPendientes())}} / {{count($postventa->observaciones())}}]</a></td>
</tr>
@endforeach
@endif
</tbody>
</table>
@endif
<table class="table">
<thead>
<tr class="section-heading">
<th colspan="2">COMENTARIOS</th>
<th class="text-right"><a href="{{url('', ['p' => 'comentarios', 'a' => 'add', 'venta' => $venta->id])}}"><span class="glyphicon glyphicon-plus"></span></a>
</tr>
</thead>
<tbody>
@foreach ($venta->comentarios() as $comentario)
@if ($comentario->estado == 1)
<tr>
<td>{{format('shortDate', $comentario->fecha)}}</td>
<td>{{$comentario->texto}}</td>
<td><a href="{{nUrl('comentarios', 'delete', ['comentario' => $comentario->id])}}"><span class="glyphicon glyphicon-minus"></span></a></td>
</tr>
@endif
@endforeach
</tbody>
</table>
@endsection