mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
añadida entrega a pie de calle y lomo_cubierta
This commit is contained in:
@ -983,16 +983,17 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$direccionId = $reqData['id'] ?? 0;
|
||||
$peso = $reqData['peso'] ?? 0;
|
||||
$unidades = $reqData['unidades'] ?? 0;
|
||||
$entregaPieCalle = $reqData['entregaPieCalle'] ?? 0;
|
||||
$model = model('App\Models\Clientes\ClienteDireccionesModel');
|
||||
$data = $model->getDireccion($direccionId);
|
||||
|
||||
$modelTarifaEnvio = model('App\Models\Tarifas\TarifaEnvioModel');
|
||||
$coste = 0;
|
||||
if ($data > 0) {
|
||||
$tarifas_envio = $modelTarifaEnvio->getTarifaEnvio($data[0]->pais_id, $peso, $unidades, 'cajas');
|
||||
$tarifas_envio = $modelTarifaEnvio->getTarifaEnvio($data[0]->pais_id, $peso, $unidades, $entregaPieCalle?'palets':'cajas');
|
||||
for ($i = 0; $i < count($tarifas_envio); $i++) {
|
||||
if ($peso > $tarifas_envio[$i]->peso_max) {
|
||||
$tarifas_envio[$i]->precio = number_format($tarifas_envio[$i]->peso_min + ($peso - $data[$i]->peso_min) * $data[$i]->precio_adicional, 2);
|
||||
$tarifas_envio[$i]->precio = number_format($tarifas_envio[$i]->peso_min + ($peso - $tarifas_envio[$i]->peso_min) * $tarifas_envio[$i]->precio_adicional, 2);
|
||||
}
|
||||
// si no se calcula linealmente
|
||||
else {
|
||||
@ -1016,7 +1017,11 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
|
||||
|
||||
}
|
||||
$data[0]->coste = $coste;
|
||||
if(count($data)>0){
|
||||
$data[0]->coste = $coste;
|
||||
$data[0]->tipo = $entregaPieCalle?'palets':'cajas';
|
||||
}
|
||||
|
||||
|
||||
return $this->respond([
|
||||
'data' => $data,
|
||||
|
||||
@ -1,11 +1,8 @@
|
||||
<div class="col-12 pb-2">
|
||||
|
||||
<div id="containerTiradasEnvios" class="row mb-3">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row mb-3">
|
||||
|
||||
<div class="col-sm-4 mb-3">
|
||||
@ -22,12 +19,20 @@
|
||||
<button id="insertarDireccion" type="button" class="btn btn-secondary waves-effect waves-light">Insertar</button>
|
||||
</div>
|
||||
<div id="errorDirecciones" class="fv-plugins-message-container invalid-feedback" style="display: none;">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-sm-4 mb-3">
|
||||
<div class="form-check form-switch mb-2">
|
||||
<input class="form-check-input" type="checkbox" id="entregaPieCalle" name="entregaPieCalle" value="1">
|
||||
<label class="form-check-label" for="add_entregaPieCalle"><?= lang('PresupuestosDirecciones.entregaPieCalle') ?></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="divDirecciones" class="col-12 pb-2">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -35,8 +40,8 @@
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
window.routes_direcciones = {
|
||||
direcciones: "<?= route_to('getDirecciones') ?>",
|
||||
getDatos: "<?= route_to('getDatosDireccion') ?>",
|
||||
nuevaDireccion: "<?= route_to('nuevaDireccion') ?>",
|
||||
direcciones: "<?= route_to('getDirecciones') ?>",
|
||||
getDatos: "<?= route_to('getDatosDireccion') ?>",
|
||||
nuevaDireccion: "<?= route_to('nuevaDireccion') ?>",
|
||||
}
|
||||
<?= $this->endSection() ?>
|
||||
@ -1,5 +1,8 @@
|
||||
<div class="col-12 pb-2">
|
||||
<div class="tipo_libro">
|
||||
|
||||
<input hidden readonly id="lomo_cubierta" name="lomo_cubierta" maxLength="12" class="form-control" value="<?= old('lomoCubierta', $presupuestoEntity->lomoCubierta) ?>">
|
||||
|
||||
<div class="row row-cols-3 mb-6 d-flex justify-content-center d-flex justify-content-center">
|
||||
|
||||
<div class="container col-md-4 mb-6 d-flex justify-content-center" style="margin-bottom: 40px;">
|
||||
|
||||
@ -141,9 +141,12 @@ $('#insertarDireccion').on('click', function() {
|
||||
data = {
|
||||
id: $('#direcciones').val(),
|
||||
peso: $('#env_tiradaPrecio' + number[0]).attr('peso'),
|
||||
unidades: unidades
|
||||
unidades: unidades,
|
||||
entregaPieCalle: $('#entregaPieCalle').is(':checked')?1:0,
|
||||
},
|
||||
data = Object.assign(data, window.token_ajax)
|
||||
|
||||
$('#loader').show();
|
||||
|
||||
$.ajax({
|
||||
url: window.routes_direcciones.getDatos,
|
||||
@ -152,7 +155,7 @@ $('#insertarDireccion').on('click', function() {
|
||||
success: function(response) {
|
||||
if(response.data.length > 0) {
|
||||
let html = '';
|
||||
html += '<div id="envioId' + response.data[0].id + '" p= ' +response.data[0].coste + ' class="row mb-3">';
|
||||
html += '<div id="envioId' + response.data[0].id + '" t= ' +response.data[0].tipo + '" p= ' +response.data[0].coste + ' 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">';
|
||||
@ -176,10 +179,12 @@ $('#insertarDireccion').on('click', function() {
|
||||
|
||||
$('#divDirecciones').append(html);
|
||||
$('#errorDirecciones').hide();
|
||||
$('#loader').hide();
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
$("#direcciones").empty();
|
||||
$('#loader').hide();
|
||||
},
|
||||
});
|
||||
}
|
||||
@ -259,7 +264,6 @@ function saveAdd_callback(){
|
||||
cp: $('#add_cp').val(),
|
||||
telefono: $('#add_telefono').val(),
|
||||
}
|
||||
console.log(data);
|
||||
data = Object.assign(data, window.token_ajax)
|
||||
|
||||
$.ajax({
|
||||
|
||||
@ -711,6 +711,8 @@ async function calcularPresupuesto() {
|
||||
|
||||
$('#divTiradasPrecio').empty();
|
||||
|
||||
$('#lomo_cubierta').val(response.lomo_cubierta);
|
||||
|
||||
$('#precios').show();
|
||||
|
||||
for (i = 0; i < response.tiradas.length; i++) {
|
||||
@ -719,7 +721,6 @@ async function calcularPresupuesto() {
|
||||
|
||||
let html = '';
|
||||
|
||||
|
||||
html += '<div id="' + label + '" peso="' +response.peso[i]+ '" class="list-group" >';
|
||||
html += '<a href="javascript:void(0);" class="list-group-item list-group-item-action">';
|
||||
html += '<div class="li-wrapper d-flex justify-content-start align-items-center" >';
|
||||
|
||||
@ -33,7 +33,7 @@ function generarResumen(){
|
||||
|
||||
let papelCubierta = $('#papelCubierta option:selected').text().trim() + ' ' +
|
||||
$('#gramajeCubierta option:selected').text();
|
||||
papelCubierta += 'gr/m<sup>2</sup>';
|
||||
papelCubierta += 'gr/m²';
|
||||
$('#resumenPapelCubierta').text(papelCubierta);
|
||||
$('#resumenCarasCubierta').text('Impresión: ' + $('#carasCubierta option:selected').text())
|
||||
$('#resumenAcabadoCubierta').text('Acabado: ' + $('#acabadosCubierta option:selected').text())
|
||||
|
||||
4998
xdebug.log
4998
xdebug.log
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user