mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
falta preview resumen
This commit is contained in:
@ -410,6 +410,8 @@ $routes->group('clienteusuarios', ['namespace' => 'App\Controllers\Clientes'], f
|
||||
$routes->group('misdirecciones', ['namespace' => 'App\Controllers\Clientes'], function ($routes) {
|
||||
$routes->get('', 'Clientedirecciones::index', ['as' => 'clientedireccionesIndex']);
|
||||
$routes->get('get/(:num)', 'Clientedirecciones::get/$1', ['as' => 'get']);
|
||||
$routes->post('add', 'Clientedirecciones::add', ['as' => 'newClientedirecciones']);
|
||||
$routes->get('getSelect2', 'Clientedirecciones::getSelect2', ['as' => 'listaClientedirecciones']);
|
||||
});
|
||||
|
||||
|
||||
|
||||
@ -82,7 +82,7 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
|
||||
$att = $reqData['att'] ?? "";
|
||||
$email = $reqData['email'] ?? "";
|
||||
$direccion = $reqData['direccion'] ?? "";
|
||||
$pais_id = $reqData['paisId'] ?? -1;
|
||||
$pais_id = $reqData['pais_id'] ?? -1;
|
||||
$provincia = $reqData['provincia'] ?? "";
|
||||
$municipio = $reqData['municipio'] ?? "";
|
||||
$cp = $reqData['cp'] ?? "";
|
||||
@ -103,11 +103,8 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
|
||||
];
|
||||
$response = $this->model->insert($data);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data_ret = [
|
||||
'data' => $response,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data_ret);
|
||||
} else {
|
||||
@ -140,6 +137,34 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
|
||||
public function getSelect2()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$cliente_id = $this->request->getGet('cliente_id');
|
||||
|
||||
|
||||
$query = $this->model->builder()->select(
|
||||
[
|
||||
"id",
|
||||
"alias as name"
|
||||
]
|
||||
)
|
||||
->where("cliente_id", $cliente_id)
|
||||
->orderBy("alias", "asc");
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("clientes.nombre", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
@ -320,7 +320,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$tipo = $reqData['tipo'];
|
||||
|
||||
$paginasCuadernillo = $reqData['paginasCuadernillo'] ?? null;
|
||||
$papelInteriorDiferente = $reqData['papelInteriorDiferente'] ?? null;
|
||||
$papelInteriorDiferente = intval($reqData['papelInteriorDiferente']) ?? null;
|
||||
|
||||
$isColor = intval($reqData['isColor']) ?? 0;
|
||||
$isHq = intval($reqData['isHq']) ?? 0;
|
||||
@ -331,16 +331,26 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$guardas = $reqData['guardas'] ?? [];
|
||||
$faja = $reqData['faja'] ?? [];
|
||||
$excluirRotativa = $reqData['excluirRotativa'] ?? 0;
|
||||
$ivaReducido = $reqData['ivaReducido'] ?? 0;
|
||||
$ivaReducido = intval($reqData['ivaReducido']) ?? 0;
|
||||
|
||||
$direcciones = $reqData['direcciones'] ?? [];
|
||||
|
||||
$tipo_impresion_id = $this->getTipoImpresion($tipo, $cubierta['tipoCubierta']);
|
||||
|
||||
if($papelInteriorDiferente){
|
||||
$papel['negro'] = $modelPapelGenerico->getIdFromCode($interior['papelInterior']['negro']);
|
||||
$papel['color'] = $modelPapelGenerico->getIdFromCode($interior['papelInterior']['color']);
|
||||
$gramaje['negro'] = intval($interior['gramajeInterior']['negro']);
|
||||
$gramaje['color'] = intval($interior['gramajeInterior']['color']);
|
||||
}
|
||||
else{
|
||||
$papel = $modelPapelGenerico->getIdFromCode($interior['papelInterior']);
|
||||
$gramaje = intval($interior['gramajeInterior']);
|
||||
}
|
||||
// Interior
|
||||
$interior = [
|
||||
'papel_generico' => $modelPapelGenerico->getIdFromCode($interior['papelInterior']),
|
||||
'gramaje' => intval($interior['gramajeInterior']),
|
||||
'papel_generico' => $papel,
|
||||
'gramaje' => $gramaje,
|
||||
'excluirRotativa' => $excluirRotativa == "false" ? false : true,
|
||||
'paginas' => $paginas,
|
||||
'paginas_color' => $paginas_color,
|
||||
@ -396,7 +406,11 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
);
|
||||
|
||||
$return_data = $this->calcular_presupuesto($datos_presupuesto, 0, false); //TRUE FOR DEBUG
|
||||
|
||||
if(array_key_exists('exception', $return_data)){
|
||||
return $this->failServerError(
|
||||
$return_data['exception'] . ' - ' .
|
||||
$return_data['file'] . ' - ' . $return_data['line']);
|
||||
}
|
||||
if(count($direcciones) > 1){
|
||||
|
||||
for ($i=0; $i<count($tirada); $i++){
|
||||
|
||||
@ -54,7 +54,7 @@ class ClienteDireccionesModel extends \App\Models\BaseModel
|
||||
],
|
||||
"email" => [
|
||||
"label" => "ClienteDirecciones.email",
|
||||
"rules" => "trim|max_length[100]|valid_email",
|
||||
"rules" => "trim|max_length[100]",
|
||||
],
|
||||
"cp" => [
|
||||
"label" => "ClienteDirecciones.cp",
|
||||
|
||||
@ -24,7 +24,6 @@ class PresupuestoClienteService extends BaseService
|
||||
|
||||
$total_plana = -1;
|
||||
$hay_plana = false;
|
||||
$papelInteriorDiferente = $data['papelInteriorDiferente'];
|
||||
if ($data['isColor']) {
|
||||
if ($data['datosPedido']->paginas == $data['paginas_color'])
|
||||
$total_plana += floatval($plana[1]['total_impresion']);
|
||||
@ -297,8 +296,6 @@ class PresupuestoClienteService extends BaseService
|
||||
return $result;
|
||||
}
|
||||
);
|
||||
$linea_negro_plana = $linea_negro_plana[0]['fields'];
|
||||
$linea_negro_plana['tipo_linea'] = $isHq ? 'lp_bnhq' : 'lp_bn';
|
||||
}
|
||||
}
|
||||
|
||||
@ -308,6 +305,10 @@ class PresupuestoClienteService extends BaseService
|
||||
$datosPedido->paginas = $paginas_color;
|
||||
for ($i = 0; $i < 2; $i++) {
|
||||
|
||||
if ($data['papelInteriorDiferente'] == true){
|
||||
$papel_generico = $papel_generico_color;
|
||||
$gramaje = $gramaje_color;
|
||||
}
|
||||
$lineas = PresupuestoService::obtenerComparadorPlana([
|
||||
'uso' => $uso,
|
||||
'tipo_impresion_id' => $tipo_impresion_id,
|
||||
@ -337,10 +338,57 @@ class PresupuestoClienteService extends BaseService
|
||||
return $result;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Si hay negro y color, y se hace con el mismo papel, hay que buscar la combinación
|
||||
// más económica con la misma máquna
|
||||
if (
|
||||
$paginas_negro > 0 && $paginas_color > 0 && $data['papelInteriorDiferente'] == 0 &&
|
||||
count($linea_negro_plana) > 0 && count($linea_color_plana) > 0
|
||||
) {
|
||||
$mejor_combinacion = null;
|
||||
$coste_menor = PHP_INT_MAX;
|
||||
// Iteramos ambos arrays
|
||||
foreach ($linea_color_plana as $color_item) {
|
||||
foreach ($linea_negro_plana as $negro_item) {
|
||||
// Comparar si tienen el mismo 'maquina_id'
|
||||
if ($color_item['fields']['maquina_id'] == $negro_item['fields']['maquina_id']) {
|
||||
// Sumar los 'total_impresion' de ambas líneas
|
||||
$costo_total = $color_item['fields']['total_impresion'] + $negro_item['fields']['total_impresion'];
|
||||
|
||||
// Verificar si es la combinación más barata hasta ahora
|
||||
if ($costo_total < $coste_menor) {
|
||||
$coste_menor = $costo_total;
|
||||
$mejor_combinacion = [
|
||||
'maquina_id' => $color_item['fields']['maquina_id'],
|
||||
'costo_total' => $costo_total,
|
||||
'color_item' => $color_item,
|
||||
'negro_item' => $negro_item,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Retornar la mejor combinación encontrada
|
||||
if ($mejor_combinacion !== null) {
|
||||
return [$mejor_combinacion['negro_item']['fields'], $mejor_combinacion['color_item']['fields']];
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (count($linea_negro_plana) > 0) {
|
||||
$linea_negro_plana = $linea_negro_plana[0]['fields'];
|
||||
$linea_negro_plana['tipo_linea'] = $isHq ? 'lp_bnhq' : 'lp_bn';
|
||||
}
|
||||
if (count($linea_color_plana) > 0) {
|
||||
$linea_color_plana = $linea_color_plana[0]['fields'];
|
||||
$linea_color_plana['tipo_linea'] = $isHq ? 'lp_colorhq' : 'lp_color';
|
||||
}
|
||||
}
|
||||
|
||||
return [$linea_negro_plana, $linea_color_plana];
|
||||
}
|
||||
|
||||
|
||||
114
ci4/app/Views/themes/vuexy/components/modals/modalDireccion.php
Normal file
114
ci4/app/Views/themes/vuexy/components/modals/modalDireccion.php
Normal file
@ -0,0 +1,114 @@
|
||||
<div id="addressModal" action='create' class="modal fade addModal">
|
||||
<div class="modal-dialog modal-lg modal-simple">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 id="labelTitleConfirmDialog" class="modal-title"><?= lang('ClienteDirecciones.direccionTitle') ?></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="texto-error d-none">
|
||||
Rellene los campos obligatorios
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="add_alias" class="form-label">
|
||||
<?= lang('ClienteDirecciones.alias') ?>*
|
||||
</label>
|
||||
<input type="text" id="add_alias" tabindex="1" maxLength="100" class="form-control">
|
||||
</div><!--//.mb-3 -->
|
||||
<div class="mb-3">
|
||||
<label for="add_att" class="form-label">
|
||||
<?= lang('ClienteDirecciones.att') ?>*
|
||||
</label>
|
||||
<input type="text" id="add_att" tabindex="1" maxLength="100" class="form-control">
|
||||
</div><!--//.mb-3 -->
|
||||
<div class="mb-3">
|
||||
<label for="add_email" class="form-label">
|
||||
<?= lang('ClienteDirecciones.email') ?>
|
||||
</label>
|
||||
<input type="text" id="add_email" tabindex="2" maxLength="100" class="form-control">
|
||||
</div><!--//.mb-3 -->
|
||||
<div class="mb-3">
|
||||
<label for="add_direccion" class="form-label">
|
||||
<?= lang('ClienteDirecciones.direccion') ?>*
|
||||
</label>
|
||||
<input type="text" id="add_direccion" tabindex="3" maxLength="255" class="form-control">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class='row'>
|
||||
|
||||
<div id='divPais' class="col-md-12 col-lg-12 pl-4">
|
||||
<div class="mb-3">
|
||||
<label for="add_pais_id" class="form-label">
|
||||
<?= lang('ClienteDirecciones.pais') ?>*
|
||||
</label>
|
||||
<select id="add_pais_id" tabindex="4" class="form-control select2bs" style="width: 100%;">
|
||||
<option value="" disabled selected><?= lang('ClienteDirecciones.selectPais') ?></option>
|
||||
<?php foreach ($paisList as $item) : ?>
|
||||
<option value="<?= $item->id ?>">
|
||||
<?= $item->nombre ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div><!--//.mb-3 -->
|
||||
</div>
|
||||
|
||||
|
||||
</div> <!-- //.row -->
|
||||
|
||||
<div class='row'>
|
||||
|
||||
<div id='divMunicipio' class="col-md-12 col-lg-12 pl-4">
|
||||
<div class="mb-3">
|
||||
<label for="add_municipio" class="form-label">
|
||||
<?= lang('ClienteDirecciones.municipio') ?>*
|
||||
</label>
|
||||
<input type="text" id="add_municipio" tabindex="6" maxLength="100" class="form-control">
|
||||
</div><!--//.mb-3 -->
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 col-lg-6 pl-4 spain-data" style="display: none;">
|
||||
<div class="mb-3">
|
||||
<label for="add_provincia" class="form-label">
|
||||
<?= lang('ClienteDirecciones.provincia') ?>
|
||||
</label>
|
||||
<input type="text" id="add_provincia" tabindex="7" maxLength="100" class="form-control">
|
||||
</div><!--//.mb-3 -->
|
||||
</div>
|
||||
|
||||
</div> <!-- //.row -->
|
||||
|
||||
<div class='row'>
|
||||
|
||||
<div class="col-md-12 col-lg-6 pl-4">
|
||||
<div class="mb-3">
|
||||
<label for="add_cp" class="form-label">
|
||||
<?= lang('ClienteDirecciones.cp') ?>*
|
||||
</label>
|
||||
<input type="text" id="add_cp" tabindex="8" maxLength="100" class="form-control">
|
||||
</div><!--//.mb-3 -->
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 col-lg-6 pl-4">
|
||||
<div class="mb-3">
|
||||
<label for="add_telefono" class="form-label">
|
||||
<?= lang('ClienteDirecciones.telefono') ?>
|
||||
</label>
|
||||
<input type="text" id="add_telefono" tabindex="9" maxLength="100" class="form-control"></input>
|
||||
</div><!--//.mb-3 -->
|
||||
</div>
|
||||
|
||||
</div> <!-- //.row -->
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button id="saveAdd"
|
||||
type="button"
|
||||
class="btn btn-primary">Guardar</button>
|
||||
<button id="cancelAdd"
|
||||
type="button"
|
||||
class="btn btn-secondary">Cancelar</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
<div id="divInputDirecciones" name="div_input_direcciones" class="row col-sm-12 mb-5 justify-content-center">
|
||||
|
||||
<div id="containerTiradasEnvios" class="row mb-3">
|
||||
<div id="containerTiradasEnvios" class="row mb-3 justify-content-center">
|
||||
</div>
|
||||
|
||||
<div class="row mb-3 justify-content-center">
|
||||
@ -47,6 +47,15 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3 justify-content-center">
|
||||
<div class="col-sm-2 mb-3 mt-auto mb-0">
|
||||
<button id="nuevaDireccion" type="button"
|
||||
class="btn btn-secondary waves-effect waves-light">Nueva Dirección</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="divErrorEnvios" name="div_error_envios" class="col-sm-10 mb-3 justify-content-center"></div>
|
||||
|
||||
<div id="divDirecciones" class="calcular-presupuesto col-sm-12 d-flex flex-column align-items-center">
|
||||
|
||||
</div>
|
||||
|
||||
@ -0,0 +1,143 @@
|
||||
<div id="addressForm" action='create' class="modal fade addModal">
|
||||
<div class="modal-dialog modal-lg modal-simple">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 id="labelTitleConfirmDialog" class="modal-title"><?= lang('PresupuestosDirecciones.direccionTitle') ?></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="add_clientedAdd" class="form-label">
|
||||
<?= lang('PresupuestosDirecciones.clientedAdd') ?>*
|
||||
</label>
|
||||
<select id="add_clientedAdd" class="form-control select2bs" style="width: 100%;">
|
||||
|
||||
</select>
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="add_cantidad" class="form-label">
|
||||
<?= lang('PresupuestosDirecciones.cantidad') ?>*
|
||||
</label>
|
||||
<input type="number" id="add_cantidad" class="form-control">
|
||||
</div><!--//.mb-3 -->
|
||||
<div class="mb-3">
|
||||
<label for="add_att" class="form-label">
|
||||
<?= lang('PresupuestosDirecciones.att') ?>*
|
||||
</label>
|
||||
<input type="text" id="add_att" maxLength="100" class="form-control new-address">
|
||||
</div><!--//.mb-3 -->
|
||||
<div class="mb-3">
|
||||
<label for="add_email" class="form-label">
|
||||
<?= lang('PresupuestosDirecciones.email') ?>*
|
||||
</label>
|
||||
<input type="text" id="add_email" maxLength="100" class="form-control new-address">
|
||||
</div><!--//.mb-3 -->
|
||||
<div class="mb-3">
|
||||
<label for="add_direccion" class="form-label">
|
||||
<?= lang('PresupuestosDirecciones.direccion') ?>*
|
||||
</label>
|
||||
<input type="text" id="add_direccion" maxLength="255" class="form-control new-address">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="add_pais_id" class="form-label">
|
||||
<?= lang('PresupuestosDirecciones.pais') ?>*
|
||||
</label>
|
||||
<select id="add_pais_id" class="form-control select2bs new-address" style="width: 100%;">
|
||||
<option value="" disabled selected><?= lang('PresupuestosDirecciones.selectPais') ?></option>
|
||||
<?php foreach ($paisList as $item) : ?>
|
||||
<option value="<?= $item->id ?>" <?= $item->id == 1 ? ' selected' : '' ?>>
|
||||
<?= $item->nombre ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
|
||||
|
||||
<div class='row'>
|
||||
|
||||
<div id='divMunicipio' class="col-md-12 col-lg-12 pl-4">
|
||||
<div class="mb-3">
|
||||
<label for="add_municipio" class="form-label">
|
||||
<?= lang('PresupuestosDirecciones.municipio') ?>*
|
||||
</label>
|
||||
<input type="text" id="add_municipio" maxLength="100" class="form-control new-address">
|
||||
</div><!--//.mb-3 -->
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 col-lg-6 pl-4 spain-data" style="display: none;">
|
||||
<div class="mb-3">
|
||||
<label for="add_provincia" class="form-label">
|
||||
<?= lang('PresupuestosDirecciones.provincia') ?>*
|
||||
</label>
|
||||
<input type="text" id="add_provincia" maxLength="100" class="form-control new-address">
|
||||
</div><!--//.mb-3 -->
|
||||
</div>
|
||||
|
||||
</div> <!-- //.row -->
|
||||
|
||||
<div class='row'>
|
||||
|
||||
<div class="col-md-12 col-lg-6 pl-4">
|
||||
<div class="mb-3">
|
||||
<label for="add_cp" class="form-label">
|
||||
<?= lang('PresupuestosDirecciones.cp') ?>*
|
||||
</label>
|
||||
<input type="text" id="add_cp" maxLength="100" class="form-control new-address">
|
||||
</div><!--//.mb-3 -->
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 col-lg-6 pl-4">
|
||||
<div class="mb-3">
|
||||
<label for="add_telefono" class="form-label">
|
||||
<?= lang('PresupuestosDirecciones.telefono') ?>*
|
||||
</label>
|
||||
<input type="text" id="add_telefono" maxLength="100" class="form-control new-address"></input>
|
||||
</div><!--//.mb-3 -->
|
||||
</div>
|
||||
|
||||
</div> <!-- //.row -->
|
||||
|
||||
<div class="col-md-12 col-lg-6 pl-4">
|
||||
<div class="form-check form-switch mb-2">
|
||||
<input class="form-check-input" type="checkbox" id="add_entregaPieCalle" name="add_entregaPieCalle" value="1">
|
||||
<label class="form-check-label" for="add_entregaPieCalle"><?= lang('PresupuestosDirecciones.entregaPieCalle') ?></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 col-lg-6 pl-4">
|
||||
<div class="form-check form-switch mb-2">
|
||||
<input class="form-check-input" type="checkbox" id="add_saveDirection" name="add_saveDirection" value="1">
|
||||
<label class="form-check-label" for="add_saveDirection"><?= lang('PresupuestosDirecciones.saveDirection') ?></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label style="display:none" for="add_alias" class="form-label save-alias">
|
||||
<?= lang('PresupuestosDirecciones.alias') ?>*
|
||||
</label>
|
||||
<input type="text" id="add_alias" maxLength="100" class="form-control new-address save-alias" style='display: none;'>
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button id="saveDireccionEnvio"
|
||||
type="button"
|
||||
class="btn btn-primary">Guardar</button>
|
||||
<button id="cancelAdd"
|
||||
type="button"
|
||||
class="btn btn-default">Cancelar</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<?= $this->section("additionalExternalJs") ?>
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
@ -0,0 +1,174 @@
|
||||
<div class="col-12 d-flex flex-column align-items-center">
|
||||
|
||||
<h3 class="mb-1 fw-bold">Resumen del presupuesto</h3>
|
||||
<div class="line mb-4"></div>
|
||||
|
||||
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
|
||||
<h5 class="mb-1 "> Precio unidad: <span id="resumenPrecioU"></span> €</h5>
|
||||
<h4 class="mb-1 "> Total base: <span id="resumenTotalBase"></span> €</h>
|
||||
<h4 class="mb-1 "> Iva (<span id="resumenIvaPorcentaje"></span>%): <span id="resumenIva"></span> €</h>
|
||||
<h3 class="mb-1 fw-bold"> Total: <span id="resumenTotal"></span> €</h>
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
|
||||
<div class="table-responsive col-10 mb-3">
|
||||
<table class="table table-bordered">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th colspan="2">Datos generales</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-item-resumen-table">Titulo</td>
|
||||
<td id="resumenTitulo">Albert Cook</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-item-resumen-table">Tipo libro</td>
|
||||
<td id="resumenTipoLibro"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-item-resumen-table">Formato</td>
|
||||
<td id="resumenFormato"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-item-resumen-table">Páginas negro</td>
|
||||
<td id="resumenPaginasNegro"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-item-resumen-table">Páginas color</td>
|
||||
<td id="resumenPaginasColor"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-item-resumen-table">Páginas en total</td>
|
||||
<td id="resumenPaginas"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-item-resumen-table">Tirada</td>
|
||||
<td id="resumenTirada"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-item-resumen-table">Prototipo</td>
|
||||
<td id="resumenPrototipo"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive col-10 mb-3">
|
||||
<table class="table table-bordered">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th colspan="2">Interior</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-item-resumen-table">Impresion</td>
|
||||
<td id="resumenImpresion"></td>
|
||||
</tr>
|
||||
<tr class="mismoInterior">
|
||||
<td class="col-item-resumen-table">Papel</td>
|
||||
<td id="resumenPapelInterior"></td>
|
||||
</tr>
|
||||
<tr class="mismoInterior">
|
||||
<td class="col-item-resumen-table">Gramaje</td>
|
||||
<td id="resumenGramajeInterior"></td>
|
||||
</tr>
|
||||
<tr class="diferenteInterior d-none">
|
||||
<td class="col-item-resumen-table">Papel B&N</td>
|
||||
<td id="resumenPapelInteriorNegro"></td>
|
||||
</tr>
|
||||
<tr class="diferenteInterior d-none">
|
||||
<td class="col-item-resumen-table">Gramaje B&N</td>
|
||||
<td id="resumenGramajeInteriorNegro"></td>
|
||||
</tr>
|
||||
<tr class="diferenteInterior d-none">
|
||||
<td class="col-item-resumen-table">Papel Color</td>
|
||||
<td id="resumenPapelInteriorColor"></td>
|
||||
</tr>
|
||||
<tr class="diferenteInterior d-none">
|
||||
<td class="col-item-resumen-table">Gramaje Color</td>
|
||||
<td id="resumenGramajeInteriorColor"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive col-10 mb-3">
|
||||
<table class="table table-bordered">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th colspan="2">Cubierta</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-item-resumen-table">Tipo</td>
|
||||
<td id="resumenCubiertaTipo"></td>
|
||||
</tr>
|
||||
<tr class="cubierta-tapa-blanda d-none">
|
||||
<td class="col-item-resumen-table">Caras impresas</td>
|
||||
<td id="resumenCarasCubierta"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-item-resumen-table">Papel</td>
|
||||
<td id="resumenPapelCubierta"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-item-resumen-table">Gramaje</td>
|
||||
<td id="resumenGramajeCubierta"></td>
|
||||
</tr>
|
||||
<tr class="cubierta-tapa-blanda d-none">
|
||||
<td class="col-item-resumen-table">Solapas</td>
|
||||
<td id="resumenSolapasCubierta"></td>
|
||||
</tr>
|
||||
<tr class="cubierta-tapa-dura d-none">
|
||||
<td class="col-item-resumen-table">Papel de guardas</td>
|
||||
<td id="resumenPapelGuardas"></td>
|
||||
</tr>
|
||||
<tr class="cubierta-tapa-dura d-none">
|
||||
<td class="col-item-resumen-table">Guardas impresas</td>
|
||||
<td id="resumenGuardasImpresas"></td>
|
||||
</tr>
|
||||
<tr class="cubierta-tapa-dura d-none">
|
||||
<td class="col-item-resumen-table">Cabezada</td>
|
||||
<td id="resumenCabezada"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-item-resumen-table">Acabados</td>
|
||||
<td id="resumenCubiertaAcabados"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="divResumenSobrecubierta" class="table-responsive col-10 mb-3 d-none">
|
||||
<table class="table table-bordered">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th colspan="2">Sobrecubierta</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-item-resumen-table">Papel</td>
|
||||
<td id="resumenPapelSobrecubierta">Estucado Mate</td>
|
||||
</tr>
|
||||
<tr class="d-none">
|
||||
<td class="col-item-resumen-table">Gramaje</td>
|
||||
<td id="resumenGramajeSobrecubierta"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-item-resumen-table">Tamaño solapas</td>
|
||||
<td id="resumenSolapaSobrecubierta"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-item-resumen-table">Plastificado</td>
|
||||
<td id="resumenPlastificadoSobreCubierta"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -9,6 +9,7 @@
|
||||
|
||||
<?= view("themes/vuexy/form/clientes/cliente/_clienteDireccionesForm") ?>
|
||||
<?= view("themes/_commonPartialsBs/_modalInput") ?>
|
||||
<?= view("themes/vuexy/components/modals/modalDireccion") ?>
|
||||
|
||||
<div class="container-xxl flex-grow-1 container-p-y">
|
||||
<div class="col-12">
|
||||
@ -60,6 +61,15 @@
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="step" data-target="#resumen-libro">
|
||||
<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">
|
||||
<span class="bs-stepper-title">Resumen del presupuesto</span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="line"></div>
|
||||
|
||||
<div id='divTiradasPrecio'></div>
|
||||
@ -70,8 +80,6 @@
|
||||
<div class="bs-stepper-content">
|
||||
<form id="presupuesto-cliente-form" onsubmit="return false">
|
||||
|
||||
|
||||
<!-- Tipo Libro -->
|
||||
<div id="datos-generales" class="content active dstepper-block fv-plugins-bootstrap5 fv-plugins-framework">
|
||||
|
||||
<div class="row g-3">
|
||||
@ -97,6 +105,12 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="resumen-libro" class="content fv-plugins-bootstrap5 fv-plugins-framework">
|
||||
<div class="row g-3">
|
||||
<?= view("themes/vuexy/form/presupuestos/cliente/items/_resumen") ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?= view("themes/vuexy/form/presupuestos/cliente/items/_buttons") ?>
|
||||
|
||||
|
||||
94
httpdocs/assets/js/safekat/components/modalDireccion.js
Normal file
94
httpdocs/assets/js/safekat/components/modalDireccion.js
Normal file
@ -0,0 +1,94 @@
|
||||
class Direccionmodal {
|
||||
constructor(modal, saveCallback) {
|
||||
this.modal = modal;
|
||||
this.saveCallback = saveCallback;
|
||||
|
||||
this.alias = $(this.modal.find('#add_alias'));
|
||||
this.att = $(this.modal.find('#add_att'));
|
||||
this.email = $(this.modal.find('#add_email'));
|
||||
this.direccion = $(this.modal.find('#add_direccion'));
|
||||
this.pais = $(this.modal.find('#add_pais_id'));
|
||||
this.municipio = $(this.modal.find('#add_municipio'));
|
||||
this.provincia = $(this.modal.find('#add_provincia'));
|
||||
this.cp = $(this.modal.find('#add_cp'));
|
||||
this.telefono = $(this.modal.find('#add_telefono'));
|
||||
|
||||
this.btnCancel = $(this.modal.find('#cancelAdd'));
|
||||
this.btnSave = $(this.modal.find('#saveAdd'));
|
||||
|
||||
this.error = $(this.modal.find('.texto-error'));
|
||||
}
|
||||
|
||||
init() {
|
||||
this.btnCancel.on('click', () => {
|
||||
|
||||
this.modal.modal("hide");
|
||||
});
|
||||
|
||||
this.modal.on('hidden.bs.modal', () => {
|
||||
this.error.addClass('d-none');
|
||||
this.alias.val("");
|
||||
this.att.val("");
|
||||
this.email.val("");
|
||||
this.direccion.val("");
|
||||
this.pais.val("").trigger('change');
|
||||
this.municipio.val("");
|
||||
this.provincia.val("");
|
||||
this.cp.val("");
|
||||
this.telefono.val("");
|
||||
this.btnSave.off('click');
|
||||
});
|
||||
|
||||
this.pais.on('change', () => {
|
||||
var nombre_pais = $("#add_pais_id option:selected").text().trim();
|
||||
if (nombre_pais.localeCompare('España') == 0) {
|
||||
$('#divPais').removeClass('col-lg-12').addClass('col-lg-6')
|
||||
$('#divMunicipio').removeClass('col-lg-12').addClass('col-lg-6')
|
||||
$('.spain-data').css('display', 'inline')
|
||||
}
|
||||
else {
|
||||
$('.spain-data').css('display', 'none')
|
||||
$('#divPais').removeClass('col-lg-6').addClass('col-lg-12')
|
||||
$('#divMunicipio').removeClass('col-lg-6').addClass('col-lg-12')
|
||||
}
|
||||
});
|
||||
|
||||
this.btnSave.on('click', () => {
|
||||
if (this.#validatemodal()) {
|
||||
this.saveCallback();
|
||||
}
|
||||
else {
|
||||
$(this.modal.find('.texto-error')).removeClass('d-none');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
this.modal.modal('show');
|
||||
}
|
||||
|
||||
#validatemodal() {
|
||||
|
||||
if(this.alias.val() == "" || this.att.val() == "" || this.direccion.val() == "" || this.municipio.val() == "" || this.cp.val() == "" ){
|
||||
return false;
|
||||
}
|
||||
if(this.pais.children("option:selected").val() < 1)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
getData() {
|
||||
return {
|
||||
alias: this.alias.val(),
|
||||
att: this.att.val(),
|
||||
email: this.email.val(),
|
||||
direccion: this.direccion.val(),
|
||||
pais_id: this.pais.children("option:selected").val(),
|
||||
municipio: this.municipio.val(),
|
||||
provincia: this.provincia.val(),
|
||||
cp: this.cp.val(),
|
||||
telefono: this.telefono.val()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default Direccionmodal;
|
||||
@ -1,6 +1,9 @@
|
||||
import ClassSelect from '../../components/select2.js';
|
||||
import Ajax from '../../components/ajax.js';
|
||||
import tarjetaDireccion from '../../components/tarjetaDireccionPresupuesto.js';
|
||||
import SelectorTiradaEnvio from './selectorTiradaEnvio.js';
|
||||
import DireccionForm from '../../components/modalDireccion.js';
|
||||
|
||||
|
||||
class Direcciones {
|
||||
|
||||
@ -12,11 +15,15 @@ class Direcciones {
|
||||
|
||||
this.unidadesAdd = this.domItem.find('#unidadesEnvio');
|
||||
this.btnAdd = this.domItem.find('#insertarDireccion');
|
||||
this.btnNew = this.domItem.find('#nuevaDireccion');
|
||||
this.entregaPieCallero = this.domItem.find('#entregaPieCalle');
|
||||
|
||||
this.direccionesCliente = new ClassSelect($("#direcciones"), '/clientedirecciones/menuitems');
|
||||
this.direccionesCliente = new ClassSelect($("#direcciones"), '/misdirecciones/getSelect2');
|
||||
|
||||
this.divDirecciones = $(this.domItem.find('#divDirecciones'));
|
||||
this.divTiradas = this.domItem.find('#containerTiradasEnvios');
|
||||
|
||||
this.checksTiradasEnvio = $('.tirada-envio');
|
||||
|
||||
this.direcciones = [];
|
||||
|
||||
@ -31,16 +38,51 @@ class Direcciones {
|
||||
|
||||
this.direccionesCliente.init();
|
||||
this.btnAdd.on('click', this.#insertDireccion.bind(this));
|
||||
this.btnNew.on('click', this.#nuevaDireccion.bind(this));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
initValidation() {
|
||||
|
||||
const stepper = this.validatorStepper;
|
||||
|
||||
this.formValidation = FormValidation.formValidation(this.wizardStep, {
|
||||
fields: {
|
||||
div_error_envios: {
|
||||
validators: {
|
||||
callback: {
|
||||
callback: () => {
|
||||
const div = $('#divErrorEnvios'); // Selecciona el div
|
||||
|
||||
div.find('.fv-plugins-message-container').remove();
|
||||
|
||||
if ($('.check-tirada-envio:checked').length > 0) {
|
||||
let unidades = parseInt($($('.check-tirada-envio:checked')[0]).attr('tirada'));
|
||||
let total_envio = 0;
|
||||
// se recorre el array this.direcciones
|
||||
this.direcciones.forEach(direccion => {
|
||||
total_envio += parseInt(direccion.getUnidades());
|
||||
});
|
||||
if (total_envio == unidades) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
div.append(`
|
||||
<div class="fv-plugins-message-container invalid-feedback">
|
||||
<div data-field="div_tipo_cubierta" data-validator="callback">
|
||||
El total de unidades enviadas no se corresponde con las unidades del pedido
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
return false;
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
plugins: {
|
||||
trigger: new FormValidation.plugins.Trigger(),
|
||||
@ -52,7 +94,7 @@ class Direcciones {
|
||||
// field is the field name
|
||||
// ele is the field element
|
||||
switch (field) {
|
||||
case ' ':
|
||||
case 'div_error_envios':
|
||||
return '.col-sm-10';
|
||||
default:
|
||||
return '.col-sm-3';
|
||||
@ -68,24 +110,79 @@ class Direcciones {
|
||||
}
|
||||
|
||||
|
||||
getDirecciones(){
|
||||
getDirecciones() {
|
||||
|
||||
let direcciones = this.divDirecciones.find('.direccion-cliente')
|
||||
if(direcciones.length > 0){
|
||||
if (direcciones.length > 0) {
|
||||
direcciones.forEach(element => {
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
insertTirada(tirada) {
|
||||
|
||||
const self = this;
|
||||
|
||||
let tarjeta = new SelectorTiradaEnvio(this.divTiradas, 'tiradaEnvios-' + tirada, tirada);
|
||||
let customOption = tarjeta.card.find('.check-tirada-envio');
|
||||
|
||||
customOption.on('click', function () {
|
||||
self.#handleTiradaEnvio(customOption);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
#nuevaDireccion() {
|
||||
|
||||
let dialog = new DireccionForm($("#addressModal"), function () {
|
||||
try {
|
||||
let data = dialog.getData();
|
||||
data.cliente_id = $("#clienteId").select2('data')[0].id;
|
||||
|
||||
new Ajax(
|
||||
'/misdirecciones/add',
|
||||
data,
|
||||
{},
|
||||
() => { dialog.modal.modal('hide') },
|
||||
() => { dialog.modal.modal('hide') }
|
||||
).post();
|
||||
}
|
||||
catch (e) {
|
||||
console.error(e);
|
||||
dialog.modal.modal('hide');
|
||||
}
|
||||
|
||||
});
|
||||
dialog.init();
|
||||
}
|
||||
|
||||
#handleTiradaEnvio(customOption) {
|
||||
|
||||
const el = customOption[0];
|
||||
|
||||
if (el.checked) {
|
||||
// If custom option element is radio, remove checked from the siblings (closest `.row`)
|
||||
if (el.type === 'radio') {
|
||||
const customRadioOptionList = [].slice.call(el.closest('.row').querySelectorAll('.custom-option'))
|
||||
customRadioOptionList.map(function (customRadioOptionEL) {
|
||||
customRadioOptionEL.closest('.custom-option').classList.remove('checked')
|
||||
})
|
||||
}
|
||||
el.closest('.custom-option').classList.add('checked')
|
||||
} else {
|
||||
el.closest('.custom-option').classList.remove('checked')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#insertDireccion() {
|
||||
|
||||
self = this;
|
||||
|
||||
|
||||
try {
|
||||
|
||||
let id = this.direccionesCliente.getValue();
|
||||
let id = this.direccionesCliente.getVal();
|
||||
let unidades = this.unidadesAdd.val();
|
||||
let entregaPalets = this.entregaPieCallero.is(':checked');
|
||||
let dirId = "dirEnvio-" + id;
|
||||
@ -111,7 +208,7 @@ class Direcciones {
|
||||
tarjeta.card.find('.direccion-editar').on('click', this.#editUnits.bind(self));
|
||||
tarjeta.card.find('.direccion-eliminar').on('click', this.#deleteDireccion.bind(self));
|
||||
this.divDirecciones.append(tarjeta.card);
|
||||
this.direcciones.push({ "id": id, "unidades": unidades, "enPallets": entregaPalets});
|
||||
this.direcciones.push(tarjeta);
|
||||
self.divDirecciones.trigger('change');
|
||||
$('#loader').hide();
|
||||
},
|
||||
@ -139,7 +236,8 @@ class Direcciones {
|
||||
|
||||
#editUnits(event) {
|
||||
|
||||
let tarjeta = $(event.currentTarget.closest('.direccion-cliente'));
|
||||
let id = $(event.currentTarget.closest('.direccion-cliente')).id;
|
||||
let tarjeta = this.direcciones.find(direccion => direccion.id == id).card;
|
||||
let unidades = tarjeta.find('.unidades').text().split(' ')[0];
|
||||
|
||||
let modal = $('#modalInput');
|
||||
@ -170,7 +268,7 @@ class Direcciones {
|
||||
|
||||
tarjeta.remove();
|
||||
this.divDirecciones.trigger('change');
|
||||
|
||||
|
||||
this.direcciones = this.direcciones.filter(direccion => direccion.id != id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ class DisenioCubierta {
|
||||
this.sinSolapas = this.domItem.find("#solapasCubiertaNo");
|
||||
this.conSolapas = this.domItem.find("#solapasCubiertaSi");
|
||||
this.divTamanioSolapas = this.domItem.find("#divTamanioSolapas");
|
||||
this.tamanioSolapasCubierta = this.domItem.find("#solapasCubierta");
|
||||
this.tamanioSolapasCubierta = $(this.domItem.find("#solapasCubierta"));
|
||||
|
||||
this.cartulinaEstucada = this.domItem.find("#cartulinaEstucada");
|
||||
this.estucadoMate = this.domItem.find("#estucadoMate");
|
||||
@ -254,10 +254,12 @@ class DisenioCubierta {
|
||||
if (this.solapasCubierta.hasClass("selected").length == 0)
|
||||
return null;
|
||||
else {
|
||||
if (this.solapasCubierta.hasClass("selected").attr("id") == "solapasCubiertaNo")
|
||||
if (this.sinSolapas.hasClass("selected"))
|
||||
return false;
|
||||
else if (this.conSolapas.hasClass("selected"))
|
||||
return parseInt(this.tamanioSolapasCubierta.val());
|
||||
else
|
||||
parseInt(this.tamanioSolapasCubierta.val());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
@ -284,7 +286,7 @@ class DisenioCubierta {
|
||||
|
||||
try {
|
||||
|
||||
if(this.divGramajeCubierta.hasClass("d-none"))
|
||||
if (this.divGramajeCubierta.hasClass("d-none"))
|
||||
return null;
|
||||
|
||||
if (this.gramaje.filter(':checked').length > 0)
|
||||
@ -298,13 +300,26 @@ class DisenioCubierta {
|
||||
}
|
||||
}
|
||||
|
||||
getAcabados() {
|
||||
getAcabados(forResumen = false) {
|
||||
try {
|
||||
let acabados = {};
|
||||
acabados.plastificado = this.domItem.find("#plastificado ").children("option:selected").val();
|
||||
acabados.barniz = this.domItem.find("#barniz").children("option:selected").val();
|
||||
acabados.estampado = this.domItem.find("#estampado").children("option:selected").val();
|
||||
acabados.retractilado = this.domItem.find("#retractilado").hasClass('selected') ? true : false;
|
||||
if (forResumen) {
|
||||
acabados = 'Plastificado ' + this.domItem.find("#plastificado").children("option:selected").text();
|
||||
if (this.domItem.find("#barniz").children("option:selected").val() != 'NONE')
|
||||
acabados += ", Barniz UVI " + this.domItem.find("#barniz").children("option:selected").text();
|
||||
if (this.domItem.find("#estampado").children("option:selected").val() != 'NONE')
|
||||
acabados += ", Estampado " + this.domItem.find("#estampado").children("option:selected").text();
|
||||
if (this.domItem.find("#retractilado").hasClass('selected')) {
|
||||
acabados += ", Retractilado ";
|
||||
}
|
||||
return acabados;
|
||||
}
|
||||
else {
|
||||
acabados.plastificado = this.domItem.find("#plastificado ").children("option:selected").val();
|
||||
acabados.barniz = this.domItem.find("#barniz").children("option:selected").val();
|
||||
acabados.estampado = this.domItem.find("#estampado").children("option:selected").val();
|
||||
acabados.retractilado = this.domItem.find("#retractilado").hasClass('selected') ? true : false;
|
||||
}
|
||||
return acabados;
|
||||
} catch (e) {
|
||||
return null;
|
||||
@ -312,20 +327,23 @@ class DisenioCubierta {
|
||||
}
|
||||
|
||||
|
||||
getCabezada() {
|
||||
getCabezada(forResumen = false) {
|
||||
|
||||
try {
|
||||
if (this.tapaBlanda.hasClass("selected"))
|
||||
return false;
|
||||
else
|
||||
return this.domItem.find("#cabezada").children("option:selected").val();
|
||||
if (forResumen)
|
||||
return this.domItem.find("#cabezada").children("option:selected").text();
|
||||
else
|
||||
return this.domItem.find("#cabezada").children("option:selected").val();
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
getGuardas() {
|
||||
getGuardas(forResumen = false) {
|
||||
|
||||
try {
|
||||
if (this.tapaBlanda.hasClass("selected")) {
|
||||
@ -333,10 +351,19 @@ class DisenioCubierta {
|
||||
}
|
||||
else {
|
||||
let guardas = {};
|
||||
let papelGuardas = this.domItem.find("#papelGuardas").children("option:selected").val();
|
||||
guardas.papel = papelGuardas.split('_')[0];
|
||||
guardas.gramaje = papelGuardas.split('_')[1];
|
||||
guardas.guardasImpresas = this.domItem.find("#guardasImpresas").children("option:selected").val();
|
||||
|
||||
if (forResumen) {
|
||||
let papelGuardas = this.domItem.find("#papelGuardas").children("option:selected").text();
|
||||
guardas.papel = papelGuardas.split(' ')[0] + ' ' + papelGuardas.split(' ')[1];
|
||||
guardas.gramaje = papelGuardas.split(' ')[2];
|
||||
guardas.guardasImpresas = this.domItem.find("#guardasImpresas").children("option:selected").text();
|
||||
}
|
||||
else {
|
||||
let papelGuardas = this.domItem.find("#papelGuardas").children("option:selected").val();
|
||||
guardas.papel = papelGuardas.split('_')[0];
|
||||
guardas.gramaje = papelGuardas.split('_')[1];
|
||||
guardas.guardasImpresas = this.domItem.find("#guardasImpresas").children("option:selected").val();
|
||||
}
|
||||
return guardas;
|
||||
}
|
||||
|
||||
@ -345,20 +372,30 @@ class DisenioCubierta {
|
||||
}
|
||||
}
|
||||
|
||||
getSobrecubierta() {
|
||||
getSobrecubierta(forResumen = false) {
|
||||
|
||||
try {
|
||||
if (!this.sobrecubierta.is(":checked")) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
let sobrecubierta = {};
|
||||
let papel = this.domItem.find("#papelSobrecubierta").children("option:selected").val();
|
||||
sobrecubierta.papel = papel.split('_')[0];
|
||||
sobrecubierta.gramaje = papel.split('_')[1];
|
||||
sobrecubierta.solapas = this.domItem.find("#solapasSobrecubierta").val();
|
||||
sobrecubierta.plastificado = this.domItem.find("#plastificadoSobrecubierta").children("option:selected").val();
|
||||
return sobrecubierta;
|
||||
if (forResumen) {
|
||||
let sobrecubierta = {};
|
||||
const papel = this.domItem.find("#papelSobrecubierta").children("option:selected").text();
|
||||
sobrecubierta.papel = papel.split(' ')[0] + ' ' + papel.split(' ')[1];
|
||||
sobrecubierta.gramaje = papel.split(' ')[2];
|
||||
sobrecubierta.solapas = this.domItem.find("#solapasSobrecubierta").val();
|
||||
sobrecubierta.plastificado = 'Plastificado ' + this.domItem.find("#plastificadoSobrecubierta").children("option:selected").text();
|
||||
}
|
||||
else {
|
||||
let sobrecubierta = {};
|
||||
let papel = this.domItem.find("#papelSobrecubierta").children("option:selected").val();
|
||||
sobrecubierta.papel = papel.split('_')[0];
|
||||
sobrecubierta.gramaje = papel.split('_')[1];
|
||||
sobrecubierta.solapas = this.domItem.find("#solapasSobrecubierta").val();
|
||||
sobrecubierta.plastificado = this.domItem.find("#plastificadoSobrecubierta").children("option:selected").val();
|
||||
return sobrecubierta;
|
||||
}
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
@ -389,12 +426,12 @@ class DisenioCubierta {
|
||||
}
|
||||
}
|
||||
|
||||
#handleCarasCubierta(){
|
||||
#handleCarasCubierta() {
|
||||
// Si es a dos caras
|
||||
if(this.carasCubierta.val() == 4){
|
||||
if (this.carasCubierta.val() == 4) {
|
||||
this.cartulinaEstucada.addClass("d-none");
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.cartulinaEstucada.removeClass("d-none");
|
||||
}
|
||||
}
|
||||
@ -420,7 +457,7 @@ class DisenioCubierta {
|
||||
$(".papel-cubierta").removeClass("selected");
|
||||
|
||||
if (this.tapaBlanda.hasClass("selected")) {
|
||||
if(this.carasCubierta.val() == 2){
|
||||
if (this.carasCubierta.val() == 2) {
|
||||
this.cartulinaEstucada.removeClass("d-none");
|
||||
}
|
||||
this.divGramajeCubierta.addClass("d-none");
|
||||
|
||||
@ -318,19 +318,36 @@ class DisenioInterior {
|
||||
}
|
||||
|
||||
|
||||
getPapel() {
|
||||
getPapel(forResumen = false) {
|
||||
|
||||
try {
|
||||
if (this.papelInterior.filter('.selected').length > 0) {
|
||||
|
||||
if (this.papelInterior_color.filter('.selected').length > 0) {
|
||||
return {
|
||||
negro: this.papelInterior.filter('.selected').attr('cod'),
|
||||
color: this.papelInterior_color.filter('.selected').attr('cod')
|
||||
if(forResumen)
|
||||
{
|
||||
return {
|
||||
negro: $(this.papelInterior.filter('.selected').find('.form-label')).text(),
|
||||
color: $(this.papelInterior_color.filter('.selected').find('.form-label')).text(),
|
||||
}
|
||||
}
|
||||
else{
|
||||
return {
|
||||
negro: this.papelInterior.filter('.selected').attr('cod'),
|
||||
color: this.papelInterior_color.filter('.selected').attr('cod')
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (this.interiorColor.filter('.d-none').length > 0){
|
||||
if(forResumen){
|
||||
return $(this.papelInterior.filter('.selected').find('.form-label')).text();
|
||||
}
|
||||
else{
|
||||
return this.papelInterior.filter('.selected').attr('cod')
|
||||
}
|
||||
}
|
||||
if (this.interiorColor.filter('.d-none').length > 0)
|
||||
return this.papelInterior.filter('.selected').attr('cod')
|
||||
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ import DatosGenerales from './datosGenerales.js';
|
||||
import DisenioInterior from './disenioInterior.js';
|
||||
import DisenioCubierta from './disenioCubierta.js';
|
||||
import Direcciones from './direcciones.js';
|
||||
import Resumen from './resumen.js';
|
||||
import Ajax from '../../components/ajax.js';
|
||||
|
||||
|
||||
@ -26,6 +27,7 @@ class PresupuestoCliente {
|
||||
this.disenioInterior = new DisenioInterior($("#interior-libro"), this.clientePresupuestoWizard, this.validationStepper);
|
||||
this.disenioCubierta = new DisenioCubierta($("#cubierta-libro"), this.clientePresupuestoWizard, this.validationStepper);
|
||||
this.direcciones = new Direcciones($("#direcciones-libro"), this.clientePresupuestoWizard, this.validationStepper);
|
||||
this.resumen = new Resumen($("#resumen-libro"), this.datosGenerales, this.disenioInterior, this.disenioCubierta, this.direcciones);
|
||||
|
||||
this.divTiradasPrecios = $("#divTiradasPrecio");
|
||||
|
||||
@ -34,6 +36,8 @@ class PresupuestoCliente {
|
||||
{}, this.datos,
|
||||
this.#procesarPresupuesto.bind(this),
|
||||
() => { $('#loader').hide(); });
|
||||
|
||||
this.actualizarTiradasEnvio = false;
|
||||
}
|
||||
|
||||
|
||||
@ -49,7 +53,7 @@ class PresupuestoCliente {
|
||||
document.querySelector('.select2-search__field').focus();
|
||||
});
|
||||
|
||||
this.validationStepper._element.addEventListener('shown.bs-stepper', this.buttonsHandler.bind(this));
|
||||
this.validationStepper._element.addEventListener('shown.bs-stepper', this.stepperHandler.bind(this));
|
||||
|
||||
this.datosGenerales.init();
|
||||
this.disenioInterior.init();
|
||||
@ -63,9 +67,27 @@ class PresupuestoCliente {
|
||||
|
||||
checkForm(event) {
|
||||
|
||||
if (event.target.id === 'divDirecciones') {
|
||||
this.actualizarTiradasEnvio = false;
|
||||
if(this.direcciones.direcciones.length == 1 && this.direcciones.direcciones[0].getEntregaPalets() == false) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.actualizarTiradasEnvio = true;
|
||||
this.direcciones.divTiradas.empty();
|
||||
}
|
||||
|
||||
this.#getDatos();
|
||||
|
||||
if (Object.values(this.datos).every(this.#isValidDataForm)) {
|
||||
this.divTiradasPrecios.empty();
|
||||
|
||||
let datos_to_check = this.datos;
|
||||
if (datos_to_check.direcciones) {
|
||||
delete datos_to_check.direcciones;
|
||||
}
|
||||
|
||||
if (Object.values(datos_to_check).every(this.#isValidDataForm)) {
|
||||
try {
|
||||
$('#loader').show();
|
||||
|
||||
@ -97,24 +119,25 @@ class PresupuestoCliente {
|
||||
const newOption2 = new Option("148 x 210", "1", true, true);
|
||||
papelFormatoId.append(newOption2).trigger('change');
|
||||
|
||||
|
||||
$("#paginasColor").val("6");
|
||||
$("#paginasColor").trigger('change');
|
||||
|
||||
$("#fresado").trigger("click");
|
||||
|
||||
|
||||
$("#colorEstandar").trigger("click");
|
||||
$("#colorPremium").trigger("click");
|
||||
$("#offsetBlanco").trigger("click");
|
||||
|
||||
setTimeout(function () {
|
||||
$("#gramaje80").trigger("click");
|
||||
$("#gramaje90").trigger("click");
|
||||
}, 0);
|
||||
|
||||
setTimeout(function () {
|
||||
$("#tapaDura").trigger("click");
|
||||
}, 0);
|
||||
|
||||
/*
|
||||
|
||||
setTimeout(function () {
|
||||
$("#btnNext").trigger("click");
|
||||
}, 0);
|
||||
@ -127,14 +150,17 @@ class PresupuestoCliente {
|
||||
|
||||
|
||||
setTimeout(function () {
|
||||
$("#unidadesEnvio").val("100");
|
||||
}, 0);*/
|
||||
$("#unidadesEnvio").val("50");
|
||||
}, 0);
|
||||
}
|
||||
|
||||
|
||||
buttonsHandler() {
|
||||
switch (this.validationStepper._currentIndex + 1) {
|
||||
case 0:
|
||||
stepperHandler() {
|
||||
|
||||
const element = $('.fv-plugins-bootstrap5.fv-plugins-framework.active');
|
||||
|
||||
switch (element.attr('id')) {
|
||||
case 'datos-generales':
|
||||
this.btnPrev.addClass('d-none');
|
||||
this.btnNext.removeClass('d-none');
|
||||
this.btnPrint.addClass('d-none');
|
||||
@ -142,13 +168,27 @@ class PresupuestoCliente {
|
||||
this.btnConfirm.addClass('d-none');
|
||||
break;
|
||||
|
||||
case 1:
|
||||
case 'interior-libro':
|
||||
case 'cubierta-libro':
|
||||
case 'direcciones-libro':
|
||||
this.btnPrev.removeClass('d-none');
|
||||
this.btnNext.removeClass('d-none');
|
||||
this.btnPrint.addClass('d-none');
|
||||
this.btnSave.addClass('d-none');
|
||||
this.btnConfirm.addClass('d-none');
|
||||
break;
|
||||
|
||||
case 'resumen-libro':
|
||||
this.btnPrev.removeClass('d-none');
|
||||
this.btnNext.addClass('d-none');
|
||||
this.btnPrint.removeClass('d-none');
|
||||
this.btnSave.removeClass('d-none');
|
||||
this.btnConfirm.removeClass('d-none');
|
||||
this.resumen.generate();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -166,10 +206,13 @@ class PresupuestoCliente {
|
||||
this.divTiradasPrecios,
|
||||
('precio-tiradas-' + response.tiradas[i]),
|
||||
response.tiradas[i],
|
||||
(parseFloat(response.precio_u[i])*parseInt(response.tiradas[i])).toFixed(2),
|
||||
(parseFloat(response.precio_u[i]) * parseInt(response.tiradas[i])).toFixed(2),
|
||||
response.precio_u[i]
|
||||
);
|
||||
|
||||
if (this.actualizarTiradasEnvio)
|
||||
this.direcciones.insertTirada(response.tiradas[i]);
|
||||
|
||||
}
|
||||
}
|
||||
// DEBUG
|
||||
@ -204,8 +247,9 @@ class PresupuestoCliente {
|
||||
|
||||
|
||||
#prevtStep() {
|
||||
if (this.validationStepper._currentIndex >= 1 && this.validationStepper._currentIndex <= 4)
|
||||
if (this.validationStepper._currentIndex >= 1 && this.validationStepper._currentIndex <= 4){
|
||||
this.validationStepper.previous();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -220,12 +264,12 @@ class PresupuestoCliente {
|
||||
paginas: this.datosGenerales.paginas.val(),
|
||||
paginasColor: this.datosGenerales.paginasColor.val(),
|
||||
paginasCuadernillo: this.datosGenerales.paginasCuadernillo.val(),
|
||||
papelInteriorDiferente: this.datosGenerales.papelDiferente.is(':checked');
|
||||
|
||||
papelInteriorDiferente: this.datosGenerales.papelDiferente.is(':checked') ? 1 : 0,
|
||||
|
||||
tipo: this.datosGenerales.tiposLibro.filter('.selected').attr('id'),
|
||||
|
||||
isColor: this.datosGenerales.getIsColor(),
|
||||
isHq: this.disenioInterior.getIsHq(),
|
||||
|
||||
isColor: this.datosGenerales.getIsColor() ? 1 : 0,
|
||||
isHq: this.disenioInterior.getIsHq() ? 1 : 0,
|
||||
|
||||
interior: {
|
||||
papelInterior: this.disenioInterior.getPapel(),
|
||||
@ -245,31 +289,31 @@ class PresupuestoCliente {
|
||||
sobrecubierta: this.disenioCubierta.getSobrecubierta(),
|
||||
faja: this.disenioCubierta.getFaja(),
|
||||
|
||||
excluirRotativa: this.datosGenerales.excluirRotativa.is(':checked'),
|
||||
excluirRotativa: this.datosGenerales.excluirRotativa.is(':checked') ? 1 : 0,
|
||||
ivaReducido: this.datosGenerales.ivaReducido.find('option:selected').val(),
|
||||
servicios: {
|
||||
'prototipo' : this.datosGenerales.prototipo.is(':checked'),
|
||||
'prototipo': this.datosGenerales.prototipo.is(':checked') ? 1 : 0,
|
||||
},
|
||||
};
|
||||
|
||||
if(this.datos.tipo == "cosido"){
|
||||
if (this.datos.tipo == "cosido") {
|
||||
this.datos.paginasCuadernillo = this.datosGenerales.paginasCuadernillo.val();
|
||||
}
|
||||
let solapasCubierta = this.disenioCubierta.getSolapasCubierta();
|
||||
if (solapasCubierta !== null && solapasCubierta !== undefined) {
|
||||
|
||||
if (solapasCubierta === false)
|
||||
this.datos.cubierta.solapas = false;
|
||||
this.datos.cubierta.solapas = 0;
|
||||
else {
|
||||
this.datos.cubierta.solapas = true;
|
||||
this.datos.cubierta.solapas = 1;
|
||||
this.datos.cubierta.tamanioSolapas = solapasCubierta;
|
||||
}
|
||||
}
|
||||
else{
|
||||
this.datos.cubierta.solapas = false;
|
||||
else {
|
||||
this.datos.cubierta.solapas = 0;
|
||||
}
|
||||
|
||||
if(this.direcciones.direcciones.length > 0){
|
||||
if (this.direcciones.direcciones.length > 0) {
|
||||
this.datos.direcciones = this.direcciones.direcciones;
|
||||
}
|
||||
}
|
||||
|
||||
143
httpdocs/assets/js/safekat/pages/presupuestoCliente/resumen.js
Normal file
143
httpdocs/assets/js/safekat/pages/presupuestoCliente/resumen.js
Normal file
@ -0,0 +1,143 @@
|
||||
class Resumen {
|
||||
constructor(domItem, datosGenerales, disenioInterior, disenioCubierta, direcciones) {
|
||||
|
||||
this.domItem = domItem;
|
||||
|
||||
this.datosGenerales = datosGenerales;
|
||||
this.disenioInterior = disenioInterior;
|
||||
this.disenioCubierta = disenioCubierta;
|
||||
|
||||
this.titulo = $(this.domItem.find("#resumenTitulo"));
|
||||
this.tipoLibro = $(this.domItem.find("#resumenTipoLibro"));
|
||||
this.formato = $(this.domItem.find("#resumenFormato"));
|
||||
this.paginas = $(this.domItem.find("#resumenPaginas"));
|
||||
this.paginasColor = $(this.domItem.find("#resumenPaginasColor"));
|
||||
this.paginasNegro = $(this.domItem.find("#resumenPaginasNegro"));
|
||||
this.tirada = $(this.domItem.find("#resumenTirada"));
|
||||
this.prototipo = $(this.domItem.find("#resumenPrototipo"));
|
||||
|
||||
this.impresionInterior = $(this.domItem.find("#resumenImpresion"));
|
||||
this.papelInterior = $(this.domItem.find("#resumenPapelInterior"));
|
||||
this.gramajeInterior = $(this.domItem.find("#resumenGramajeInterior"));
|
||||
this.papelInteriorColor = $(this.domItem.find("#resumenPapelInteriorColor"));
|
||||
this.gramajeInteriorColor = $(this.domItem.find("#resumenGramajeInteriorColor"));
|
||||
this.papelInteriorNegro = $(this.domItem.find("#resumenPapelInteriorNegro"));
|
||||
this.gramajeInteriorNegro = $(this.domItem.find("#resumenGramajeInteriorNegro"));
|
||||
|
||||
this.cubiertaTipo = $(this.domItem.find("#resumenCubiertaTipo"));
|
||||
this.itemsCubiertaTapaBlanda = $(this.domItem.find(".cubierta-tapa-blanda"));
|
||||
this.itemsCubiertaTapaDura = $(this.domItem.find(".cubierta-tapa-dura"));
|
||||
this.carasCubierta = $(this.domItem.find("#resumenCarasCubierta"));
|
||||
this.papelCubierta = $(this.domItem.find("#resumenPapelCubierta"));
|
||||
this.gramajeCubierta = $(this.domItem.find("#resumenGramajeCubierta"));
|
||||
this.solapasCubierta = $(this.domItem.find("#resumenSolapasCubierta"));
|
||||
this.papelGuardas = $(this.domItem.find("#resumenPapelGuardas"));
|
||||
this.guardasImpresas = $(this.domItem.find("#resumenGuardasImpresas"));
|
||||
this.cabezada = $(this.domItem.find("#resumenCabezada"));
|
||||
this.cubiertaAcabados = $(this.domItem.find("#resumenCubiertaAcabados"));
|
||||
|
||||
this.divSobrecubierta = $(this.domItem.find("#divResumenSobrecubierta"));
|
||||
this.papelSobrecubierta = $(this.domItem.find("#resumenPapelSobrecubierta"));
|
||||
this.gramajeSobrecubierta = $(this.domItem.find("#resumenGramajeSobrecubierta"));
|
||||
this.solapasSobrecubierta = $(this.domItem.find("#resumenSolapasSobrecubierta"));
|
||||
this.plastificadoSobrecubierta = $(this.domItem.find("#resumenPlastificadoSobrecubierta"));
|
||||
|
||||
this.precio_unidad = $(this.domItem.find("#resumenPrecioU"));
|
||||
this.total_base = $(this.domItem.find("#resumenTotalBase"));
|
||||
this.iva_porcentaje = $(this.domItem.find("#resumenIvaPorcentaje"));
|
||||
this.iva = $(this.domItem.find("#resumenIva"));
|
||||
this.total = $(this.domItem.find("#resumenTotal"));
|
||||
}
|
||||
|
||||
init() {
|
||||
|
||||
}
|
||||
|
||||
generate() {
|
||||
|
||||
this.titulo.text(this.datosGenerales.titulo.val());
|
||||
this.tipoLibro.text(this.#capitalizeFirstLetter(this.datosGenerales.tiposLibro.filter('.selected').attr('id')));
|
||||
this.formato.text(this.datosGenerales.papelFormatoId.find('option:selected').text());
|
||||
this.paginas.text(this.datosGenerales.paginas.val());
|
||||
this.paginasColor.text(this.datosGenerales.paginasColor.val());
|
||||
this.paginasNegro.text(this.datosGenerales.paginasNegro.val());
|
||||
this.tirada.text(parseInt($($('.check-tirada-envio:checked')[0]).attr('tirada')));
|
||||
this.prototipo.text(this.datosGenerales.prototipo.is(':checked') ? 'Sí' : 'No');
|
||||
|
||||
const HQ = this.disenioInterior.getIsHq();
|
||||
const color = this.datosGenerales.getIsColor();
|
||||
const papelInterior = this.disenioInterior.getPapel(true);
|
||||
const gramajeInterior = this.disenioInterior.getGramaje();
|
||||
if ($(".interior-color").hasClass('d-none')) {
|
||||
this.domItem.find(".mismoInterior").removeClass('d-none');
|
||||
this.domItem.find(".diferenteInterior").addClass('d-none');
|
||||
const impInterior = (color ? "Color " : "Blanco y Negro") + (HQ ? "Premium" : "Estándar");
|
||||
this.impresionInterior.text(impInterior);
|
||||
this.papelInterior.text(papelInterior);
|
||||
this.gramajeInterior.text(gramajeInterior);
|
||||
}
|
||||
else {
|
||||
this.domItem.find(".mismoInterior").addClass('d-none');
|
||||
this.domItem.find(".diferenteInterior").removeClass('d-none');
|
||||
const impInterior = ("Negro " + (HQ.negro ? "Premium" : "Estándar") + " / Color" + (HQ.color ? "Premium" : "Estándar"));
|
||||
this.impresionInterior.text(impInterior);
|
||||
this.papelInteriorNegro.text(papelInterior.negro);
|
||||
this.papelInteriorColor.text(papelInterior.color);
|
||||
this.gramajeInteriorNegro.text(gramajeInterior.negro);
|
||||
this.gramajeInteriorColor.text(gramajeInterior.color);
|
||||
}
|
||||
|
||||
this.cubiertaTipo.text($($('.tipo-cubierta.selected').find('.form-label')).text());
|
||||
this.carasCubierta.text(this.disenioCubierta.carasCubierta.find('option:selected').text());
|
||||
if (this.cubiertaTipo.text().toLowerCase().includes('blanda')) {
|
||||
this.itemsCubiertaTapaBlanda.removeClass('d-none');
|
||||
this.itemsCubiertaTapaDura.addClass('d-none');
|
||||
const solapasCubierta = this.disenioCubierta.getSolapasCubierta();
|
||||
this.solapasCubierta.text( solapasCubierta == false ? 'No' : solapasCubierta);
|
||||
}
|
||||
else {
|
||||
this.itemsCubiertaTapaDura.removeClass('d-none');
|
||||
this.itemsCubiertaTapaBlanda.addClass('d-none');
|
||||
const guardas = this.disenioCubierta.getGuardas(true);
|
||||
this.papelGuardas.text(guardas.papel + ' ' + guardas.gramaje);
|
||||
this.guardasImpresas.text(guardas.guardasImpresas);
|
||||
this.cabezada.text(this.disenioCubierta.getCabezada(true));
|
||||
|
||||
}
|
||||
this.papelCubierta.text($($('.papel-cubierta.selected').find('.form-label')).text())
|
||||
this.gramajeCubierta.text(this.disenioCubierta.getGramaje());
|
||||
this.cubiertaAcabados.text(this.disenioCubierta.getAcabados(true));
|
||||
|
||||
if (this.disenioCubierta.getSobrecubierta()) {
|
||||
this.divSobrecubierta.rempveClass('d-none');
|
||||
const sobrecubierta = this.disenioCubierta.getSobrecubierta(true);
|
||||
this.papelSobrecubierta.text(sobrecubierta.papel);
|
||||
this.gramajeSobrecubierta.text(sobrecubierta.gramaje);
|
||||
this.solapasSobrecubierta.text(sobrecubierta.solapas);
|
||||
this.plastificadoSobrecubierta.text(sobrecubierta.plastificado);
|
||||
}
|
||||
else {
|
||||
this.divSobrecubierta.addClass('d-none');
|
||||
}
|
||||
|
||||
const unidades = parseInt($($('.check-tirada-envio:checked')[0]).attr('tirada'));
|
||||
const tarjetaPrecio = $('.tarjeta-tiradas-precios').filter(function () {
|
||||
return parseInt($(this).find('.tarjeta-tiradas-precios-tirada').attr('data')) == unidades;
|
||||
});
|
||||
this.precio_unidad.text(tarjetaPrecio.find('.tarjeta-tiradas-precios-precio-unidad').attr('data'));
|
||||
const base = tarjetaPrecio.find('.tarjeta-tiradas-precios-precio').attr('data');
|
||||
const iva_porcentaje = this.datosGenerales.ivaReducido.find('option:selected').val() == 1 ? 0.21 : 0.04;
|
||||
const iva = (parseFloat(base) * iva_porcentaje).toFixed(2);
|
||||
this.total_base.text(base);
|
||||
this.iva_porcentaje.text(this.datosGenerales.ivaReducido.find('option:selected').val() == 1 ? '21' : '4');
|
||||
this.iva.text(iva);
|
||||
this.total.text((parseFloat(base) + parseFloat(iva)).toFixed(2));
|
||||
|
||||
}
|
||||
|
||||
#capitalizeFirstLetter(string) {
|
||||
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||
}
|
||||
}
|
||||
|
||||
export default Resumen;
|
||||
@ -1,45 +1,58 @@
|
||||
class SelectorTiradaEnvio {
|
||||
|
||||
constructor(container, id, tirada, precio_u) {
|
||||
constructor(container, id, tirada) {
|
||||
|
||||
this.container = container;
|
||||
this.card = this.#generateHTML(id, tirada, precio_u);
|
||||
this.tirada = tirada;
|
||||
this.card = this.#generateHTML(id, tirada);
|
||||
this.container.append(this.card);
|
||||
}
|
||||
|
||||
#generateHTML(id, tirada, precio_u) {
|
||||
#generateHTML(id, tirada) {
|
||||
|
||||
var $div = $('<div>', {
|
||||
|
||||
var $checkboxContainer = $('<div>', {
|
||||
class: 'checkbox-presupuesto-tiradas-envio mb-md-0 mb-3'
|
||||
});
|
||||
|
||||
// Crear el segundo div con clase form-check
|
||||
var $formCheckDiv = $('<div>', {
|
||||
class: 'form-check custom-option custom-option-icon tirada-envio'
|
||||
});
|
||||
|
||||
// Crear el label
|
||||
var $label = $('<label>', {
|
||||
class: 'form-check-label custom-option-content',
|
||||
for: id
|
||||
});
|
||||
|
||||
// Crear los spans para el título
|
||||
var $spanBody = $('<span>', { class: 'custom-option-body' });
|
||||
var $spanTitle = $('<span>', { class: 'custom-option-title', text: tirada + ' ud.' });
|
||||
|
||||
// Crear el input radio
|
||||
var $inputRadio = $('<input>', {
|
||||
id: id,
|
||||
class: 'form-check custom-option custom-option-basic custom-option-tiradasDirecciones'
|
||||
}).append(
|
||||
$('<label>', {
|
||||
class: 'form-check-label custom-option-content',
|
||||
for: 'tiradaEnvios1'
|
||||
}).append(
|
||||
$('<input>', {
|
||||
class: 'form-check-input',
|
||||
type: 'radio',
|
||||
value: '',
|
||||
}),
|
||||
$('<span>', { class: 'custom-option-header' }).append(
|
||||
$('<span>', {
|
||||
class: 'h6 mb-0',
|
||||
text: tirada
|
||||
}),
|
||||
$('<span>', {
|
||||
class: 'text-muted precio-tirada-envio',
|
||||
text: 'Total: ' + parseFloat(precio_u * tirada).toFixed(2) + '€'
|
||||
})
|
||||
),
|
||||
$('<span>', { class: 'custom-option-body' }).append(
|
||||
$('<small>', {
|
||||
text: precio_u + '€/ud'
|
||||
})
|
||||
)
|
||||
)
|
||||
);
|
||||
name: 'customRadioTiradaEnvio',
|
||||
class: 'check-tirada-envio form-check-input',
|
||||
type: 'radio',
|
||||
tirada: tirada,
|
||||
value: ''
|
||||
});
|
||||
|
||||
// Añadir el span del título al span del cuerpo
|
||||
$spanBody.append($spanTitle);
|
||||
|
||||
// Añadir los elementos al label
|
||||
$label.append($spanBody).append($inputRadio);
|
||||
|
||||
// Añadir el label al div form-check
|
||||
$formCheckDiv.append($label);
|
||||
|
||||
// Añadir el form-check div al contenedor principal
|
||||
$checkboxContainer.append($formCheckDiv);
|
||||
|
||||
return $div;
|
||||
return $checkboxContainer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ class tarjetaTiradasPrecio {
|
||||
|
||||
let $html = $('<div>', {
|
||||
id: id,
|
||||
class: 'list-group mb-2'
|
||||
class: 'list-group mb-2 tarjeta-tiradas-precios'
|
||||
});
|
||||
|
||||
let $link = $('<a>', {
|
||||
@ -33,21 +33,21 @@ class tarjetaTiradasPrecio {
|
||||
|
||||
$listContent.append($('<h7>', {
|
||||
id: 'ud_' + id,
|
||||
class: 'mb-1',
|
||||
class: 'mb-1 tarjeta-tiradas-precios-tirada',
|
||||
text: tirada + ' ud.'
|
||||
}));
|
||||
}).attr('data', tirada));
|
||||
|
||||
$listContent.append($('<h6>', {
|
||||
id: 'tot_' + id,
|
||||
class: 'mb-1',
|
||||
class: 'mb-1 tarjeta-tiradas-precios-precio',
|
||||
text: 'Total: ' + precio + '€'
|
||||
}));
|
||||
}).attr('data', precio));
|
||||
|
||||
$listContent.append($('<h7>', {
|
||||
id: 'pu_' + id,
|
||||
class: 'mb-1',
|
||||
class: 'mb-1 tarjeta-tiradas-precios-precio-unidad',
|
||||
text: precio_unidad + '€/ud'
|
||||
}));
|
||||
}).attr('data', precio_unidad));
|
||||
|
||||
$liWrapper.append($listContent);
|
||||
$link.append($liWrapper);
|
||||
|
||||
@ -43,7 +43,24 @@
|
||||
min-width: 110px !important;
|
||||
}
|
||||
|
||||
.checkbox-presupuesto-tiradas-envio {
|
||||
width: 130px !important;
|
||||
max-width: 130px !important;
|
||||
min-width: 130px !important;
|
||||
}
|
||||
|
||||
.min-width-fit {
|
||||
min-width: fit-content !important;
|
||||
}
|
||||
|
||||
.texto-error {
|
||||
color: #ea5455;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.col-item-resumen-table {
|
||||
max-width: 200px;
|
||||
width: 200px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user