231 lines
6.7 KiB
PHP
231 lines
6.7 KiB
PHP
@extends('layout.base')
|
|
|
|
@section('content')
|
|
<div class="row page-heading">
|
|
<div class="col-md-6 h3">Proyecto - {{$proyecto->descripcion}}</div>
|
|
<div class="col-md-6 h3 text-right"><a href="{{url('', ['p' => 'proyectos', 'a' => 'edit', 'proyecto' => $proyecto->id])}}"><span class="glyphicon glyphicon-edit"></span></a></div>
|
|
</div>
|
|
<table class="table table-striped">
|
|
<tr>
|
|
<td>Dirección</td>
|
|
<td>{{$proyecto->direccion()->completa(true)}}</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Inmobiliaria</td>
|
|
<td colspan="2"><a href="{{url('', ['p' => 'inmobiliarias', 'a' => 'show', 'rut' => $proyecto->inmobiliaria()->rut])}}">{{$proyecto->inmobiliaria()->abreviacion}}</a></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Inicio</td>
|
|
<td>{{$proyecto->estados()[0]->tipo()->descripcion}} [{{$proyecto->estados()[0]->tipo()->etapa()->descripcion}}]] ({{format('shortDate', $proyecto->estados()[0]->fecha)}})
|
|
(<?php
|
|
$today = \Carbon\Carbon::today(config('app.timezone'));
|
|
$f = \Carbon\Carbon::parse($proyecto->estados()[0]->fecha, config('app.timezone'));
|
|
?>{{$f->diffForHumans($today)}})
|
|
</td>
|
|
<td></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Estado <a href="{{nUrl('proyectos', 'historial', ['proyecto' => $proyecto->id])}}"><span class="glyphicon glyphicon-list-alt"></span></a></td>
|
|
<td>{{$proyecto->estado()->tipo()->descripcion}}
|
|
@if ($proyecto->estado()->tipo()->etapa()->descripcion == 'Construcción')
|
|
<a href="{{nUrl('proyectos', 'construccion', ['proyecto' => $proyecto->id])}}">
|
|
@endif
|
|
[{{$proyecto->estado()->tipo()->etapa()->descripcion}}]
|
|
@if ($proyecto->estado()->tipo()->etapa()->descripcion == 'Construcción')
|
|
</a>
|
|
@endif
|
|
({{format('shortDate', $proyecto->estado()->fecha)}}) (<?php
|
|
$f = \Carbon\Carbon::parse($proyecto->estado()->fecha, config('app.timezone'));
|
|
?>{{$f->diffForHumans($today)}})</td>
|
|
<td><a href="{{url('', ['p' => 'proyectos', 'a' => 'advance', 'proyecto' => $proyecto->id])}}"><span class="glyphicon glyphicon-chevron-right"></span></a>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>@include('proyectos.avance')
|
|
</tr>
|
|
<tr>
|
|
<td>Operadores</td>
|
|
<td>
|
|
@if ($proyecto->operadoresVigentes())
|
|
{{array_reduce($proyecto->operadoresVigentes(), function($list, $item) {
|
|
return trim($list . ', ' . $item->agente()->agente()->abreviacion, ', ');
|
|
})}}
|
|
@endif
|
|
<a href="{{nUrl('operadores', 'agregar', ['proyecto' => $proyecto->id])}}">
|
|
<span class="glyphicon glyphicon-plus"></span>
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
@include('proyectos.superficies')
|
|
@if (count($proyecto->proyectoTipoUnidades()) > 0)
|
|
<tr>
|
|
<td>Departamentos</td>
|
|
<td colspan="2"><a href="{{nUrl('proyectos', 'list_unidades', ['proyecto' => $proyecto->id])}}">{{count($proyecto->unidades(1))}}</a></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Pisos</td>
|
|
<td colspan="2">{{$proyecto->pisos()}}</td>
|
|
</tr>
|
|
@else
|
|
<tr>
|
|
<td></td>
|
|
<td colspan="2"><a href="{{url('', ['p' => 'proyectos', 'a' => 'add_tipo_unidad', 'proyecto' => $proyecto->id])}}">Agregar tipo de unidad <span class="glyphicon glyphicon-plus"></span></a></td>
|
|
</tr>
|
|
@endif
|
|
@include('proyectos.ventas')
|
|
@include('proyectos.por_vender')
|
|
@include('proyectos.estimado')
|
|
<tr>
|
|
<td colspan="2" style="text-align: center;">
|
|
<canvas id="ventas_un" width="400" height="300" style="display: inline;"></canvas>
|
|
<canvas id="ventas_uf" width="400" height="300" style="display: inline;"></canvas>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="2" class="text-center">
|
|
<table class="table">
|
|
<tr id="graficos_unidades"></tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="2" style="text-align: center;">
|
|
<canvas id="ventas_pt" width="1000" height="400" style="display: inline;"></canvas>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
@endsection
|
|
|
|
@push('scripts')
|
|
@if (count($proyecto->unidades()) > 0)
|
|
<script>
|
|
function buildPie(chart_id, data, options) {
|
|
var ctx = document.getElementById(chart_id).getContext('2d')
|
|
var vData = {
|
|
datasets: [{
|
|
data: data.values,
|
|
backgroundColor: data.colors
|
|
}],
|
|
labels: data.labels
|
|
}
|
|
var vOptions = {
|
|
responsive: false,
|
|
title: {
|
|
display: true,
|
|
text: options.title
|
|
},
|
|
legend: {
|
|
position: 'right'
|
|
},
|
|
tooltips: {
|
|
callbacks: {
|
|
label: changeLabel
|
|
}
|
|
}
|
|
}
|
|
return chart = new Chart(ctx, {
|
|
type: 'pie',
|
|
data: vData,
|
|
options: vOptions
|
|
})
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
@if ($proyecto->ventas())
|
|
buildPie('ventas_un', {
|
|
values: [
|
|
{{count($proyecto->ventas())}},
|
|
{{$proyecto->valores()->estimados->departamentos->cantidad}}
|
|
],
|
|
colors: [
|
|
'rgba(0, 200, 0, .7)',
|
|
'rgba(200, 0, 0, .7)'
|
|
],
|
|
labels: [
|
|
'Vendida',
|
|
'Por Vender'
|
|
]
|
|
}, {
|
|
title: 'Unidades Vendidas'
|
|
})
|
|
buildPie('ventas_uf', {
|
|
values: [
|
|
{{round($proyecto->valores()->vendidos->ingreso->bruto, 0)}},
|
|
{{round($proyecto->valores()->estimados->ingreso->bruto, 0)}}
|
|
],
|
|
colors: [
|
|
'rgba(0, 200, 0, .7)',
|
|
'rgba(200, 0, 0, .7)'
|
|
],
|
|
labels: [
|
|
'Vendida',
|
|
'Estimada'
|
|
]
|
|
}, {
|
|
title: 'UF Neto Vendida'
|
|
})
|
|
|
|
var width = {{floor(1000 / count($ventas_pt->data))}}
|
|
<?php $c = 0 ?>
|
|
@foreach ($ventas_pt->data as $tipo => $data)
|
|
chart = $('<td></td>').append(
|
|
$('<canvas></canvas>').attr('id', 'chart_{{$tipo}}').attr('width', width).attr('height', 300)
|
|
)
|
|
$('#graficos_unidades').append(chart)
|
|
buildPie('chart_{{$tipo}}', {
|
|
values: [
|
|
{{$ventas_pt->totales[$tipo] * $data[count($data) - 1] / 100}},
|
|
{{$ventas_pt->totales[$tipo] * (1 - $data[count($data) - 1] / 100)}}
|
|
],
|
|
colors: ['rgba(0, 255, 0, .7)', 'rgba(255, 0, 0, .7)'],
|
|
labels: ['Vendido', 'Total']
|
|
}, {
|
|
title: '{{$tipo}}'
|
|
})
|
|
@endforeach
|
|
|
|
ctx = document.getElementById('ventas_pt').getContext('2d');
|
|
vData = {
|
|
labels: ["{!!implode('", "', $ventas_pt->fields)!!}"],
|
|
datasets: [
|
|
<?php $c = 0 ?>
|
|
@foreach ($ventas_pt->data as $tipo => $data)
|
|
{
|
|
data: [{{implode(', ', $data)}}],
|
|
borderColor: '{{$colors[$c]}}',
|
|
backgroundColor: '{{$colors[$c ++]}}',
|
|
fill: false,
|
|
label: "{{$tipo}}"
|
|
},
|
|
@endforeach
|
|
]
|
|
}
|
|
vOptions = {
|
|
responsive: false,
|
|
title: {
|
|
display: true,
|
|
text: "% Unidades Vendidas por Tipo"
|
|
},
|
|
legend: {
|
|
position: 'bottom'
|
|
},
|
|
scales: {
|
|
yAxes: [{
|
|
ticks: {
|
|
min: 0,
|
|
max: 100
|
|
}
|
|
}]
|
|
}
|
|
};
|
|
ventas = new Chart(ctx, {
|
|
type: "line",
|
|
data: vData,
|
|
options: vOptions
|
|
})
|
|
@endif
|
|
})
|
|
</script>
|
|
@endif
|
|
@endpush
|