This commit is contained in:
Juan Pablo Vial
2023-09-07 23:03:21 -03:00
parent 59825259b6
commit fa15da1ee2
40 changed files with 1787 additions and 71 deletions

View File

@ -6,7 +6,7 @@
<div class="ui grid">
<div class="two wide column">Total</div>
<div class="column">{{count($cuotas_pendientes)}}</div>
<div class="column">{{$format->pesos(array_reduce($cuotas_pendientes, function($sum, $cuota) {return $sum + $cuota['Valor'];}, 0))}}</div>
<div class="two wide column">{{$format->pesos(array_reduce($cuotas_pendientes, function($sum, $cuota) {return $sum + $cuota['Valor'];}, 0))}}</div>
</div>
<table class="ui striped table" id="cuotas">
<thead>
@ -14,13 +14,14 @@
<th class="two wide column">Proyecto</th>
<th class="column">Departamento</th>
<th>Departamento Sort</th>
<th class="two wide column">Propietario</th>
<th class="column">Cuota</th>
<th class="column">Banco</th>
<th class="column">Valor</th>
<th class="column">Día</th>
<th class="column">Cuota</th>
<th class="two wide column">Propietario</th>
<th class="column">Banco</th>
<th class="two wide column">Fecha Cheque (Días)</th>
<th>Fecha ISO</th>
<th class="two wide column">Fecha Deposito</th>
<th class="column">Depositar</th>
</tr>
</thead>
@ -34,16 +35,24 @@
</a>
</td>
<td>{{str_pad($cuota['Departamento'], 4, '0', STR_PAD_LEFT)}}</td>
<td>{{$cuota['Propietario']}}</td>
<td>{{$cuota['Numero']}}</td>
<td>{{$cuota['Banco']}}</td>
<td>{{$format->pesos($cuota['Valor'])}}</td>
<td>{{$cuota['Dia']}}</td>
<td>{{$cuota['Numero']}}</td>
<td>{{$cuota['Propietario']}}</td>
<td>{{$cuota['Banco']}}</td>
<td>{{$cuota['Fecha Cheque']}} ({{$cuota['Vencida']}})</td>
<td>{{$cuota['Fecha ISO']}}</td>
<td>
<div class="ui calendar" data-cuota="{{$cuota['id']}}">
<div class="ui icon input">
<input type="text" name="fecha_deposito{{$cuota['id']}}" />
<i class="calendar icon"></i>
</div>
</div>
</td>
<td>
<button class="ui icon button depositar" data-cuota="{{$cuota['id']}}">
<i class="currency icon"></i>
<i class="dollar icon"></i>
</button>
</td>
</tr>
@ -85,11 +94,19 @@
[2, 'asc']
]
})
$('.ui.calendar').calendar({
type: 'date',
formatter: {
date: 'DD-MM-YYYY'
}
})
$('.depositar.button').click(event => {
const button = $(event.currentTarget)
const cuota_id = button.data('cuota')
fetch('{{$urls->base}}/ventas/cuota/depositar', {
method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({cuota_id})
const calendar = $(".ui.calendar[data-cuota='" + cuota_id + "']").calendar('get date')
const fecha = [calendar.getFullYear(), calendar.getMonth()+1, calendar.getDate()].join('-')
fetch('{{$urls->api}}/ventas/cuota/depositar', {
method: 'post', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({cuota_id, fecha})
}).then(response => {
if (response.ok) {
return response.json()