mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
terminada modificacion
This commit is contained in:
@ -120,9 +120,28 @@ class PresupuestoAdminEdit {
|
||||
this.tiradasAlternativas.init();
|
||||
this.resumen.init();
|
||||
|
||||
$('#btn_aceptar_revisado').on('click', function () {
|
||||
|
||||
this.resumen.updateTotales({ updateLP: true, updateServicios: true, updateEnvio: true });
|
||||
$('#btn_ajustar_revisado').on('click', function () {
|
||||
|
||||
this.resumen.updateTotales({ updateLP: true, updateServicios: true, updateEnvio: true }, true);
|
||||
}.bind(this));
|
||||
|
||||
$('#total_aceptado_revisado').on('change', function () {
|
||||
let totalCostes = AutoNumeric.getAutoNumericElement($('#totalCostes')[0]);
|
||||
let envio_base = AutoNumeric.getAutoNumericElement($('#precioEnvios')[0]);
|
||||
let autoTotalAceptado = AutoNumeric.getAutoNumericElement($('#total_aceptado_revisado')[0]);
|
||||
let total_aceptado_revisado = autoTotalAceptado.getNumber();
|
||||
|
||||
if (total_aceptado_revisado && total_aceptado_revisado != 0) {
|
||||
const nuevoTotal = totalCostes.getNumber() + envio_base.getNumber();
|
||||
|
||||
if (total_aceptado_revisado < nuevoTotal) {
|
||||
// Solo usá .set(), no .val() ni .html()
|
||||
autoTotalAceptado.set(nuevoTotal);
|
||||
total_aceptado_revisado = nuevoTotal;
|
||||
}
|
||||
|
||||
totalMargenes = total_aceptado_revisado - nuevoTotal;
|
||||
}
|
||||
}.bind(this));
|
||||
|
||||
if (window.location.href.includes("edit")) {
|
||||
@ -147,7 +166,7 @@ class PresupuestoAdminEdit {
|
||||
target.removeClass('d-none');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
$(document).on('update-presupuesto', this.updatePresupuesto.bind(this));
|
||||
|
||||
@ -380,9 +399,10 @@ class PresupuestoAdminEdit {
|
||||
self.tipo_impresion.val(response.data.tipo_impresion);
|
||||
self.POD.val(response.data.POD);
|
||||
|
||||
$('#total_aceptado_revisado').val(response.data.total_aceptado_revisado);
|
||||
AutoNumeric.getAutoNumericElement($('#total_aceptado_revisado')[0]).set(response.data.total_aceptado_revisado);
|
||||
|
||||
$('#aprobado_by_at').html(response.data.aprobado_by_at);
|
||||
|
||||
|
||||
$('#created_by').html(response.data.created_by);
|
||||
$('#updated_by').html(response.data.updated_by);
|
||||
$('#created_at').html(response.data.created_at);
|
||||
@ -628,7 +648,7 @@ class PresupuestoAdminEdit {
|
||||
const svgData = serializer.serializeToString(shapeSvgEl);
|
||||
const svgBlob = new Blob([svgData], { type: 'image/svg+xml;charset=utf-8' });
|
||||
const svgUrl = URL.createObjectURL(svgBlob);
|
||||
const img = new Image(shapeSvgEl.getBoundingClientRect().width,shapeSvgEl.getBoundingClientRect().height);
|
||||
const img = new Image(shapeSvgEl.getBoundingClientRect().width, shapeSvgEl.getBoundingClientRect().height);
|
||||
img.onload = () => {
|
||||
const scaleFactor = 3; // Increase resolution (e.g., 2x, 3x)
|
||||
const canvas = document.createElement('canvas');
|
||||
@ -639,7 +659,7 @@ class PresupuestoAdminEdit {
|
||||
canvas.height = height * scaleFactor;
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.scale(scaleFactor, scaleFactor);
|
||||
ctx.drawImage(img, 0,0,width,height);
|
||||
ctx.drawImage(img, 0, 0, width, height);
|
||||
const pngUrl = canvas.toDataURL('image/png');
|
||||
const downloadLink = document.createElement('a');
|
||||
downloadLink.href = pngUrl;
|
||||
|
||||
Reference in New Issue
Block a user