mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
terminado a falta del resumen
This commit is contained in:
@ -32,13 +32,14 @@
|
||||
</div>
|
||||
|
||||
<div id="divDirecciones" class="col-12 pb-2">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
window.direcciones = <?= json_encode($presupuestoEntity->direcciones_envio) ?>;
|
||||
window.direcciones_sel_tirada = <?= json_encode($presupuestoEntity->selected_tirada) ?>;
|
||||
window.routes_direcciones = {
|
||||
direcciones: "<?= route_to('getDirecciones') ?>",
|
||||
getDatos: "<?= route_to('getDatosDireccion') ?>",
|
||||
|
||||
@ -374,7 +374,7 @@
|
||||
<div class="col-sm-3 mb-md-0 mb-2 d-flex align-items-end">
|
||||
<div class="form-check form-switch mb-2">
|
||||
<input class="form-check-input" type="checkbox" id="enableSobrecubierta" name="enableSobrecubierta" value="0"
|
||||
<?php if (isset($datosPresupuesto->papel_sobrecubierta) && is_array($datosPresupuesto->papel_sobrecubierta) && !empty($datosPresupuesto->papel_sobrecubierta)) :
|
||||
<?php if (isset($presupuestoEntity->papel_sobrecubierta) && $presupuestoEntity->papel_sobrecubierta>0) :
|
||||
echo 'checked';
|
||||
endif; ?>
|
||||
>
|
||||
@ -384,7 +384,7 @@
|
||||
</div>
|
||||
|
||||
<h6 class="sobrecubierta enable-sobrecubierta"
|
||||
<?php if (isset($datosPresupuesto->papel_sobrecubierta) && is_array($datosPresupuesto->papel_sobrecubierta) && !empty($datosPresupuesto->papel_sobrecubierta)) :
|
||||
<?php if (isset($presupuestoEntity->papel_sobrecubierta) && $presupuestoEntity->papel_sobrecubierta>0) :
|
||||
echo '';
|
||||
else:
|
||||
echo 'style="display: none;"';
|
||||
@ -414,14 +414,20 @@
|
||||
</div>
|
||||
|
||||
<h6 class="sobrecubierta enable-sobrecubierta"
|
||||
<?php if (isset($datosPresupuesto->papel_sobrecubierta) && is_array($datosPresupuesto->papel_sobrecubierta) && !empty($datosPresupuesto->papel_sobrecubierta)) :
|
||||
<?php if (isset($presupuestoEntity->papel_sobrecubierta) && $presupuestoEntity->papel_sobrecubierta>0) :
|
||||
echo '';
|
||||
else:
|
||||
echo 'style="display: none;"';
|
||||
endif; ?>
|
||||
> Opciones extra </h6>
|
||||
|
||||
<div class="row sobrecubierta enable-sobrecubierta" style="display: none;">
|
||||
<div class="row sobrecubierta enable-sobrecubierta"
|
||||
<?php if (isset($presupuestoEntity->papel_sobrecubierta) && $presupuestoEntity->papel_sobrecubierta>0) :
|
||||
echo '';
|
||||
else:
|
||||
echo 'style="display: none;"';
|
||||
endif; ?>
|
||||
>
|
||||
|
||||
<div id="tamanioSolapasSobrecubierta" class="col-sm-3 mb-md-0 mb-2"">
|
||||
<label for="anchoSolapasSobrecubierta" class="form-label">Tamaño solapas</label>
|
||||
@ -431,7 +437,7 @@
|
||||
</div>
|
||||
|
||||
<div class="row sobrecubierta enable-sobrecubierta"
|
||||
<?php if (isset($datosPresupuesto->papel_sobrecubierta) && is_array($datosPresupuesto->papel_sobrecubierta) && !empty($datosPresupuesto->papel_sobrecubierta)) :
|
||||
<?php if (isset($presupuestoEntity->papel_sobrecubierta) && $presupuestoEntity->papel_sobrecubierta>0) :
|
||||
echo '';
|
||||
else:
|
||||
echo 'style="display: none;"';
|
||||
@ -469,13 +475,19 @@
|
||||
<div class="col-sm-4 mb-md-0 mb-2">
|
||||
<label for="impresionGuardas" class="form-label">Impresión de guardas</label>
|
||||
<select id="impresionGuardas" name="impresionGuardas" class="form-control select2bs2 comp_guardas_items calcular-presupuesto" style="width: 100%;">
|
||||
<option value="0">
|
||||
<option value="0"
|
||||
<?php echo ((!isset($presupuestoEntity->paginas_guardas) || $presupuestoEntity->paginas_guardas==0) ? 'selected' : ''); ?>
|
||||
>
|
||||
<p><?= lang('Presupuestos.sinImpresion') ?></p>
|
||||
</option>
|
||||
<option value="4">
|
||||
<option value="4"
|
||||
<?php echo ($presupuestoEntity->paginas_guardas==4 ? 'selected' : ''); ?>
|
||||
>
|
||||
<p><?= lang('Presupuestos.unaCara') ?></p>
|
||||
</option>
|
||||
<option value="8">
|
||||
<option value="8"
|
||||
<?php echo ($presupuestoEntity->paginas_guardas==8 ? 'selected' : ''); ?>
|
||||
>
|
||||
<p><?= lang('Presupuestos.dosCaras') ?></p>
|
||||
</option>
|
||||
</select>
|
||||
@ -488,7 +500,7 @@
|
||||
<select id="papelGuardas" name="papelGuardas" class="form-control select2bs2 calcular-presupuesto" style="width: 100%;">
|
||||
<?php if (isset($datosPresupuesto->papelGuardas) && is_array($datosPresupuesto->papelGuardas) && !empty($datosPresupuesto->papelGuardas)) :
|
||||
foreach ($datosPresupuesto->papelGuardas as $k => $v) : ?>
|
||||
<option value="<?= $v->id ?>">
|
||||
<option value="<?= $v->id ?>" <? echo ($v->id==$presupuestoEntity->papel_guardas?'selected':'');?> >
|
||||
<?= $v->nombre ?>
|
||||
</option>
|
||||
<?php endforeach;
|
||||
|
||||
@ -1,5 +1,9 @@
|
||||
<div class="col-12 pb-2">
|
||||
<div class="row mb-3">
|
||||
<?php if($presupuestoEntity->estado_id==2): ?>
|
||||
<h2>PRESUPUESTO ACEPTADO</h2>
|
||||
<br>
|
||||
<?php endif; ?>
|
||||
<h3>Resumen</h3>
|
||||
<div class="col-sm-6">
|
||||
<h5 class="mb-1">Libro</h5>
|
||||
@ -48,7 +52,11 @@
|
||||
|
||||
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
window.estado = <?= $presupuestoEntity->estado_id ?>;
|
||||
window.tirada = <?= $presupuestoEntity->selected_tirada ?>;
|
||||
window.total = <?= $presupuestoEntity->total_aceptado ?>;
|
||||
window.total_unidad = <?= $presupuestoEntity->total_precio_unidad ?>;
|
||||
window.iva_reducido= <?= $presupuestoEntity->iva_reducido ?>;
|
||||
window.routes_resumen = {
|
||||
guardarPresupuesto: "<?= route_to('guardarPresupuesto') ?>",
|
||||
}
|
||||
|
||||
@ -24,6 +24,7 @@ function initDirecciones() {
|
||||
|
||||
function initTiradasDirecciones() {
|
||||
const _this = this
|
||||
let sel_index = 1;
|
||||
|
||||
$('#containerTiradasEnvios').empty();
|
||||
|
||||
@ -54,10 +55,16 @@ function initTiradasDirecciones() {
|
||||
|
||||
$('#containerTiradasEnvios').append(html);
|
||||
|
||||
if(parseInt($('#' + tirada_id).text().split(' ')[0]) == window.direcciones_sel_tirada){
|
||||
sel_index = i;
|
||||
}
|
||||
|
||||
$('#' + id).hide();
|
||||
}
|
||||
$('#env_tiradaPrecio1').trigger('click');
|
||||
}
|
||||
$(('#env_tiradaPrecio' + sel_index)).trigger('click');
|
||||
|
||||
cargarDirecciones();
|
||||
|
||||
const tiradasDireccionesList = [].slice.call(document.querySelectorAll('.custom-option-tiradasDirecciones .form-check-input'))
|
||||
tiradasDireccionesList.map(function (customOptionEL) {
|
||||
@ -71,6 +78,48 @@ function initTiradasDirecciones() {
|
||||
})
|
||||
}
|
||||
|
||||
function cargarDirecciones(){
|
||||
$('#loader').show();
|
||||
$('#divDirecciones').empty();
|
||||
|
||||
if(window.direcciones == null){
|
||||
$('#loader').hide();
|
||||
return;
|
||||
}
|
||||
for(let i=0; i<window.direcciones.length; i++){
|
||||
const tipo = window.direcciones[i].entregaPieCalle == 1?'palets':'cajas';
|
||||
let html = '';
|
||||
html += '<div id="envioId' + window.direcciones[i].direccion_id + '" t="' + tipo + '" p= ' +window.direcciones[i].precio + ' class="row mb-3">';
|
||||
html += '<div class="col-sm-5 form-check custom-option custom-option-basic checked">';
|
||||
html += '<label class="form-check-label custom-option-content" for="customRadioAddress1">';
|
||||
html += '<span class="custom-option-header mb-2">';
|
||||
html += '<h6 class="fw-semibold mb-0">' + window.direcciones[i].att + '</h6>';
|
||||
html += '<span class="badge bg-label-primary">' + window.direcciones[i].cantidad + ' unidades</span>';
|
||||
html += '</span>';
|
||||
html += '<span class="custom-option-body">';
|
||||
html += '<small>' + window.direcciones[i].direccion + '</small><br>';
|
||||
html += '<small>' + window.direcciones[i].cp + '</small><br>';
|
||||
html += '<small>' + window.direcciones[i].municipio +', ' + window.direcciones[i].pais + '</small><br>';
|
||||
html += '<small>' + window.direcciones[i].telefono + '</small><br>';
|
||||
html += '<small>' + window.direcciones[i].email + '</small><br>';
|
||||
if(tipo == 'palets'){
|
||||
html += '<small><i>Envío en palets</i></small><br>';
|
||||
}
|
||||
html += '<hr class="my-2">';
|
||||
html += '<span class="d-flex">';
|
||||
html += '<a class="eliminar-direccion" href="javascript:void(0)">Eliminar</a>';
|
||||
html += '</span>';
|
||||
html += '</span>';
|
||||
html += '</label>';
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
|
||||
$('#divDirecciones').append(html);
|
||||
$('#errorDirecciones').hide();
|
||||
$('#loader').hide();
|
||||
}
|
||||
}
|
||||
|
||||
function updateTiradasDireccionesCheck(el) {
|
||||
if (el.checked) {
|
||||
// If custom option element is radio, remove checked from the siblings (closest `.row`)
|
||||
|
||||
@ -77,32 +77,44 @@ function generarResumen(){
|
||||
$('.resumen-extras').hide();
|
||||
}
|
||||
|
||||
for (i = 1; i <= 4; i++) {
|
||||
let id = "tiradaPrecio" + i;
|
||||
if ($('#' + id).length > 0) {
|
||||
if(window.estado==1){
|
||||
for (i = 1; i <= 4; i++) {
|
||||
let id = "tiradaPrecio" + i;
|
||||
if ($('#' + id).length > 0) {
|
||||
|
||||
const envio = getTotalEnvio();
|
||||
|
||||
let tirada_id = "ud_tiradaPrecio" + i;
|
||||
if(parseInt($('#' + tirada_id).text().replace(' ud.', '')) != tirada){
|
||||
continue;
|
||||
}
|
||||
const envio = getTotalEnvio();
|
||||
|
||||
let tirada_id = "ud_tiradaPrecio" + i;
|
||||
if(parseInt($('#' + tirada_id).text().replace(' ud.', '')) != tirada){
|
||||
continue;
|
||||
}
|
||||
|
||||
let total_id = "tot_tiradaPrecio" + i;
|
||||
|
||||
let total = parseFloat($('#' + total_id).text().replace('€', '').replace('Total: ', '')) + envio;
|
||||
let total_iva = 0.0;
|
||||
if($('#ivaReducido').val() == '1'){
|
||||
total_iva = total * 1.04;
|
||||
let total_id = "tot_tiradaPrecio" + i;
|
||||
|
||||
let total = parseFloat($('#' + total_id).text().replace('€', '').replace('Total: ', '')) + envio;
|
||||
let total_iva = 0.0;
|
||||
if($('#ivaReducido').val() == '1'){
|
||||
total_iva = total * 1.04;
|
||||
}
|
||||
else{
|
||||
total_iva = total * 1.21;
|
||||
}
|
||||
const precio_u = total_iva/tirada;
|
||||
$('#resumenTotalIVA').text('Total (I.V.A. ' + (($('#ivaReducido').val() == '1')?'4':'21') + '%): ' + total_iva.toFixed(2) + '€');
|
||||
$('#resumenPrecioU').text(precio_u.toFixed(4) + '€/ud');
|
||||
}
|
||||
else{
|
||||
total_iva = total * 1.21;
|
||||
}
|
||||
const precio_u = total_iva/tirada;
|
||||
$('#resumenTotalIVA').text('Total (I.V.A. ' + (($('#ivaReducido').val() == '1')?'4':'21') + '%): ' + total_iva.toFixed(2) + '€');
|
||||
$('#resumenPrecioU').text(precio_u.toFixed(4) + '€/ud');
|
||||
}
|
||||
}
|
||||
else{
|
||||
let iva = 1.04;
|
||||
if(window.iva_reducido == 0){
|
||||
iva = 1.21;
|
||||
}
|
||||
let total = window.total*iva;
|
||||
let p_unidad = total/window.tirada;
|
||||
$('#resumenTotalIVA').text('Total (I.V.A. ' + (total.toFixed(2)) + '€');
|
||||
$('#resumenPrecioU').text(p_unidad.toFixed(4) + '€/ud');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -139,6 +151,13 @@ $('#btnBack').on('click', function() {
|
||||
});
|
||||
|
||||
function finalizarPresupuesto(confirmar){
|
||||
|
||||
const paths = window.location.pathname.split("/").filter(path => path !== "");
|
||||
let id=0;
|
||||
if(paths.length > 0 && paths[paths.length - 2] == 'edit'){
|
||||
id=paths[paths.length - 1];
|
||||
}
|
||||
|
||||
let servicios = [];
|
||||
$('.servicio-extra:checked').each(function () {
|
||||
servicios.push($(this).attr('serv_id'));
|
||||
@ -185,7 +204,7 @@ function finalizarPresupuesto(confirmar){
|
||||
}
|
||||
}
|
||||
|
||||
if ($('#divGuardas').is(':visible')) {
|
||||
if ($('#divGuardas').css('display') != 'none') {
|
||||
datos_libro.guardas = {
|
||||
papel: $('#papelGuardas option:selected').val(),
|
||||
papel_nombre: $('#papelGuardas option:selected').text().trim(),
|
||||
@ -215,6 +234,7 @@ function finalizarPresupuesto(confirmar){
|
||||
|
||||
let direcciones = getDireccionesEnvio();
|
||||
datos = {
|
||||
id: id,
|
||||
datos_libro : datos_libro,
|
||||
datos_cabecera: datos_cabecera,
|
||||
direcciones: direcciones,
|
||||
|
||||
@ -19,8 +19,12 @@
|
||||
<!-- Create Deal Wizard -->
|
||||
<div id="wizard-presupuesto-cliente" class="bs-stepper vertical mt-2 linear">
|
||||
<div class="bs-stepper-header">
|
||||
|
||||
|
||||
<?php if($presupuestoEntity->estado_id==1): ?>
|
||||
<div class="step active" data-target="#tipo-libro">
|
||||
<?php else: ?>
|
||||
<div class="step" data-target="#tipo-libro">
|
||||
<?php endif; ?>
|
||||
<button type="button" class="step-trigger" aria-selected="false" disabled="disabled">
|
||||
<span class="bs-stepper-circle"><i class="ti ti-book ti-sm"></i></span>
|
||||
<span class="bs-stepper-label">
|
||||
@ -53,7 +57,12 @@
|
||||
</div>
|
||||
<div class="line"></div>
|
||||
|
||||
|
||||
<?php if($presupuestoEntity->estado_id==1): ?>
|
||||
<div class="step" data-target="#resumen-libro">
|
||||
<?php else: ?>
|
||||
<div class="step active" data-target="#resumen-libro">
|
||||
<?php endif; ?>
|
||||
<button type="button" class="step-trigger" aria-selected="false" disabled="disabled">
|
||||
<span class="bs-stepper-circle"><i class="ti ti-checkbox ti-sm"></i></span>
|
||||
<span class="bs-stepper-label">
|
||||
@ -80,7 +89,12 @@
|
||||
|
||||
|
||||
<!-- Tipo Libro -->
|
||||
<?php if($presupuestoEntity->estado_id==1): ?>
|
||||
<div id="tipo-libro" class="content active dstepper-block fv-plugins-bootstrap5 fv-plugins-framework">
|
||||
<?php else: ?>
|
||||
<div id="tipo-libro" class="content dstepper-block fv-plugins-bootstrap5 fv-plugins-framework">
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="row g-3">
|
||||
|
||||
<?= view("themes/vuexy/form/presupuestos/cliente/_tipoLibroItems") ?>
|
||||
@ -135,9 +149,14 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Review & Complete -->
|
||||
<?php if($presupuestoEntity->estado_id==1): ?>
|
||||
<div id="resumen-libro" class="content fv-plugins-bootstrap5 fv-plugins-framework">
|
||||
<?php else: ?>
|
||||
<div id="resumen-libro" class="content active fv-plugins-bootstrap5 fv-plugins-framework">
|
||||
<?php endif; ?>
|
||||
<div class="row g-3">
|
||||
|
||||
<?= view("themes/vuexy/form/presupuestos/cliente/_resumenItems") ?>
|
||||
@ -145,10 +164,12 @@
|
||||
</div>
|
||||
<div class="col-12 d-flex justify-content-between mt-4">
|
||||
<div class="col-6 d-flex flex-row">
|
||||
<?php if ($presupuestoEntity->estado_id == 1) : ?>
|
||||
<button class="btn btn-primary btn-prev waves-effect waves-light">
|
||||
<i class="ti ti-arrow-left ti-xs me-sm-1 me-0"></i>
|
||||
<span class="align-middle d-sm-inline-block d-none me-sm-1">Anterior</span>
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="col-6 d-flex flex-row-reverse">
|
||||
<?php if ($presupuestoEntity->estado_id == 1) : ?>
|
||||
|
||||
Reference in New Issue
Block a user