mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
modificado la muestra de tiradas
This commit is contained in:
@ -714,23 +714,36 @@ async function calcularPresupuesto() {
|
|||||||
console.log(response);
|
console.log(response);
|
||||||
$('#loader').hide();
|
$('#loader').hide();
|
||||||
if(error){
|
if(error){
|
||||||
$('#precios > tbody').empty();
|
$('#tiradaPrecio1').hide();
|
||||||
$('#precios').hide();
|
$('#tiradaPrecio2').hide();
|
||||||
|
$('#tiradaPrecio3').hide();
|
||||||
|
$('#tiradaPrecio4').hide();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$('#precios > tbody').empty();
|
$('#precios').show();
|
||||||
|
|
||||||
for (i = 0; i < response.tiradas.length; i++) {
|
for (i = 0; i < response.tiradas.length; i++) {
|
||||||
$('#precios > tbody').append('<tr class="table-light"><td>' + response.tiradas[i] + '</td><td>' + response.precio_u[i] + '€</td></tr>');
|
const total = (parseFloat(response.precio_u[i]) * parseInt(response.tiradas[i])).toFixed(2) ;
|
||||||
|
const label = "tiradaPrecio" + parseInt(i+1);
|
||||||
|
|
||||||
|
$('#ud_' + label).text(response.tiradas[i] + ' ud.');
|
||||||
|
$('#tot_' + label).text('Total: ' + total + '€');
|
||||||
|
$('#pu_' + label).text(response.precio_u[i] + '€/ud');
|
||||||
|
$('#' + label).show();
|
||||||
}
|
}
|
||||||
$('#precios').show();
|
for (i = response.tiradas.length; i < 4; i++) {
|
||||||
|
const label = "tiradaPrecio" + parseInt(i+1);
|
||||||
|
$('#' + label).hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
error: function (error) {
|
error: function (error) {
|
||||||
$('#loader').hide();
|
$('#loader').hide();
|
||||||
$('#precios > tbody').empty();
|
$('#tiradaPrecio1').hide();
|
||||||
$('#precios').hide();
|
$('#tiradaPrecio2').hide();
|
||||||
|
$('#tiradaPrecio3').hide();
|
||||||
|
$('#tiradaPrecio4').hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -68,17 +68,52 @@
|
|||||||
administrador.</p>
|
administrador.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table id="precios" class="table table-sm" style="display: none;">
|
<div id="tiradaPrecio1" class="list-group" style="display: none;">
|
||||||
<caption>Precio/Unidad por tirada</caption>
|
<a class="list-group-item list-group-item-action d-flex justify-content-between" style="display: none;">
|
||||||
<thead>
|
<div class="li-wrapper d-flex justify-content-start align-items-center" >
|
||||||
<tr>
|
<div class="list-content">
|
||||||
<th></th>
|
<h7 id="ud_tiradaPrecio1" class="mb-1">100 unidades</h7>
|
||||||
<th></th>
|
<h6 id="tot_tiradaPrecio1" class="mb-1">Total 387.54€</h6>
|
||||||
</tr>
|
<h7 id="pu_tiradaPrecio1" class="mb-1">3.8754€/ud</h7>
|
||||||
</thead>
|
</div>
|
||||||
<tbody>
|
</div>
|
||||||
</tbody>
|
</a>
|
||||||
</table>
|
</div>
|
||||||
|
<div id="tiradaPrecio2" class="list-group" style="display: none;">
|
||||||
|
<a class="list-group-item list-group-item-action d-flex justify-content-between" style="display: none;">
|
||||||
|
<div class="li-wrapper d-flex justify-content-start align-items-center" >
|
||||||
|
<div class="list-content">
|
||||||
|
<h7 id="ud_tiradaPrecio2" class="mb-1">100 unidades</h7>
|
||||||
|
<h6 id="tot_tiradaPrecio2" class="mb-1">Total 387.54€</h6>
|
||||||
|
<h7 id="pu_tiradaPrecio2" class="mb-1">3.8754€/ud</h7>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div id="tiradaPrecio3" class="list-group" style="display: none;">
|
||||||
|
<a class="list-group-item list-group-item-action d-flex justify-content-between" style="display: none;">
|
||||||
|
<div class="li-wrapper d-flex justify-content-start align-items-center" >
|
||||||
|
<div class="list-content">
|
||||||
|
<h7 id="ud_tiradaPrecio3" class="mb-1">100 unidades</h7>
|
||||||
|
<h6 id="tot_tiradaPrecio3" class="mb-1">Total 387.54€</h6>
|
||||||
|
<h7 id="pu_tiradaPrecio3" class="mb-1">3.8754€/ud</h7>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div id="tiradaPrecio4" class="list-group" style="display: none;">
|
||||||
|
<a class="list-group-item list-group-item-action d-flex justify-content-between" style="display: none;">
|
||||||
|
<div class="li-wrapper d-flex justify-content-start align-items-center" >
|
||||||
|
<div class="list-content">
|
||||||
|
<h7 id="ud_tiradaPrecio4" class="mb-1">100 unidades</h7>
|
||||||
|
<h6 id="tot_tiradaPrecio4" class="mb-1">Total 387.54€</h6>
|
||||||
|
<h7 id="pu_tiradaPrecio4" class="mb-1">3.8754€/ud</h7>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
2509
xdebug.log
2509
xdebug.log
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user