127 lines
4.4 KiB
PHP
127 lines
4.4 KiB
PHP
@extends('layout.base')
|
|
|
|
@section('content')
|
|
<div class="page-heading">
|
|
<h3>
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
Precios - {{$proyecto->descripcion}}
|
|
</div>
|
|
<div class="col-md-6 text-right"><a href="{{nUrl('precios', 'add', ['proyecto' => $proyecto->id])}}"><span class="glyphicon glyphicon-plus"></span></a></div>
|
|
</div>
|
|
</h3>
|
|
</div>
|
|
<br />
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>Tipo</th>
|
|
<th>Nombre</th>
|
|
<th>Tipología</th>
|
|
<th>Líneas</th>
|
|
<th>m² Vendibles</th>
|
|
<th>#</th>
|
|
<th>Precio Promedio</th>
|
|
<th>UF/m²</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach ($proyecto->ProyectoTipoUnidades() as $tipo)
|
|
<tr class="show-unidades" data-status="closed" data-id="{{$tipo->id}}">
|
|
<td>{{ucwords($tipo->tipo()->descripcion)}}</td>
|
|
<td>{{$tipo->nombre}}</td>
|
|
<td>
|
|
@if ($tipo->tipologia())
|
|
{{$tipo->tipologia()->descripcion}}
|
|
@else
|
|
{{$tipo->abreviacion}}
|
|
@endif
|
|
</td>
|
|
<td>{{$tipo->lineas()}}</td>
|
|
<td>{{$tipo->m2()}}</td>
|
|
<td>{{count($tipo->unidades())}}</td>
|
|
<td>{{format('ufs', $tipo->precio(), true)}}</td>
|
|
<th>{{format('ufs', $tipo->precio() / $tipo->m2(), true)}}/m²</th>
|
|
</tr>
|
|
<tr class="unidades" data-tipo="{{$tipo->id}}">
|
|
<td></td>
|
|
<td colspan="7">
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>Unidad</th>
|
|
<th>Desde</th>
|
|
<th>Precio</th>
|
|
<th>UF/m²</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php $subtipo = ''; ?>
|
|
@foreach ($tipo->unidades() as $unidad)
|
|
@if ($subtipo != $unidad->subtipo)
|
|
<?php $subtipo = $unidad->subtipo; ?>
|
|
<tr data-id="{{$subtipo}}" data-status="closed" class="subtipo">
|
|
<th>Línea {{$subtipo}}</th>
|
|
<th></th>
|
|
<th>{{format('ufs', $tipo->precioSubtipo($subtipo), null, true)}}</th>
|
|
<th>{{format('ufs', $tipo->precioSubtipo($subtipo) / $tipo->m2(), null, true)}}/m²</th>
|
|
</tr>
|
|
@endif
|
|
<tr>
|
|
<td>{{$unidad->descripcion}}</td>
|
|
@if ($unidad->precio())
|
|
<td>{{format('shortDate', $unidad->precio()->estado()->fecha)}}</td>
|
|
<td>{{format('ufs', $unidad->precio()->valor, null, true)}}</td>
|
|
<td>
|
|
@if ($unidad->m2('vendible') > 0)
|
|
{{format('ufs', $unidad->precio()->valor / $unidad->m2('vendible'), null, true)}}/m²
|
|
@endif
|
|
</td>
|
|
@else
|
|
<td colspan="3">--</td>
|
|
@endif
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
@endsection
|
|
|
|
@push('scripts')
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
$('.unidades').hide()
|
|
$('.show-unidades').css('cursor', 'pointer').click(function(e) {
|
|
var id = $(this).attr('data-id')
|
|
var status = $(this).attr('data-status')
|
|
if (status == 'open') {
|
|
$(".unidades[data-tipo='" + id + "']").hide()
|
|
$(this).attr('data-status', 'closed')
|
|
} else {
|
|
$(".unidades[data-tipo='" + id + "']").show()
|
|
if ($(".unidades[data-tipo='" + id + "']").find('.subtipo').length > 0) {
|
|
$(".unidades[data-tipo='" + id + "']").find('tbody tr').hide()
|
|
$(".unidades[data-tipo='" + id + "']").find('.subtipo').show()
|
|
}
|
|
$(this).attr('data-status', 'open')
|
|
}
|
|
})
|
|
$('.subtipo').css('cursor', 'pointer').click(function(e) {
|
|
var id = $(this).attr('data-id')
|
|
var status = $(this).attr('data-status')
|
|
if (status == 'open') {
|
|
$(this).nextUntil('.subtipo').hide()
|
|
$(this).attr('data-status', 'closed')
|
|
} else {
|
|
$(this).nextUntil('.subtipo').show()
|
|
$(this).attr('data-status', 'open')
|
|
}
|
|
})
|
|
})
|
|
</script>
|
|
@endpush
|