@extends('layout.base')

@section('content')
<div class="panel panel-default">
	<div class="panel-heading">Reajustar - {{$venta->unidad()->descripcion}} - {{$venta->proyecto()->descripcion}}</div>
	<div class="panel-body">
	<form method="post" action="{{url('', ['p' => 'pies', 'a' => 'reajuste', 'venta' => $venta->id])}}" class="form-horizontal">
		<div class="row">
			<div class="col-md-2">Pie Pagado</div>
			<div class="col-md-4">$ {{format('pesos', $venta->pie()->valorPagado('pesos'))}}</div>
			<div class="col-md-4">{{format('ufs', $venta->pie()->valorPagado())}} UF</div>
		</div>
		<div class="form-group">
			<div class="col-md-2">Reajuste</div>
			<div class="col-md-1">$</div>
			<div class="col-md-3"><input type="text" name="valor" class="form-control" /></div>
			<div class="col-md-1"><select name="day" class="form-control">
			<?php $f = \Carbon\Carbon::today(config('app.timezone')) ?>
			@for ($i = 0; $i < 31; $i ++)
				<option value="{{$i + 1}}"
				@if ($i + 1 == $f->day)
				selected="selected"
				@endif
				>{{str_pad($i + 1, 2, '0', STR_PAD_LEFT)}}</option>
			@endfor
			</select></div>
			<div class="col-md-1"><select name="month" class="form-control">
			@for ($i = 0; $i < 31; $i ++)
				<option value="{{$i + 1}}"
				@if ($i + 1 == $f->month)
				selected="selected"
				@endif
				>{{str_pad($i + 1, 2, '0', STR_PAD_LEFT)}}</option>
			@endfor
			</select></div>
			<div class="col-md-2"><select name="year" class="form-control">
			@for ($i = $f->year; $i > $f->year - 5; $i --)
				<option value="{{$i}}">{{$i}}</option>
			@endfor
			</select></div>
		</div>
		<div class="form-group">
			<div class="col-md-offset-2 col-md-3"><input type="submit" value="Reajustar" class="form-control" /></div>
		</div>
	</form>
	</div>
</div>
@endsection