mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'main' into refactor/messages-view
This commit is contained in:
@ -584,6 +584,7 @@ $routes->group('presupuestocliente', ['namespace' => 'App\Controllers\Presupuest
|
|||||||
$routes->get('cargar/(:num)', 'Presupuestocliente::cargar/$1', ['as' => 'cargarPresupuesto']);
|
$routes->get('cargar/(:num)', 'Presupuestocliente::cargar/$1', ['as' => 'cargarPresupuesto']);
|
||||||
$routes->post('duplicarPresupuesto', 'Presupuestocliente::duplicarPresupuesto', ['as' => 'duplicarPresupuesto']);
|
$routes->post('duplicarPresupuesto', 'Presupuestocliente::duplicarPresupuesto', ['as' => 'duplicarPresupuesto']);
|
||||||
$routes->post('calcular', 'Presupuestocliente::calcular', ['as' => 'calcularPresupuesto']);
|
$routes->post('calcular', 'Presupuestocliente::calcular', ['as' => 'calcularPresupuesto']);
|
||||||
|
$routes->post('calcularsolapas', 'Presupuestocliente::calcularMaxSolapas', ['as' => 'calcularSolapas']);
|
||||||
});
|
});
|
||||||
$routes->resource('presupuestocliente', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Presupuestocliente', 'except' => 'show,new,create,update']);
|
$routes->resource('presupuestocliente', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Presupuestocliente', 'except' => 'show,new,create,update']);
|
||||||
|
|
||||||
|
|||||||
@ -301,8 +301,10 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
|||||||
$tipo = goSanitize($this->request->getGet('tipo'))[0];
|
$tipo = goSanitize($this->request->getGet('tipo'))[0];
|
||||||
$selected_papel = goSanitize($this->request->getGet('papel'))[0] ?? null;
|
$selected_papel = goSanitize($this->request->getGet('papel'))[0] ?? null;
|
||||||
$cubierta = goSanitize($this->request->getGet('cubierta'))[0] ?? 0;
|
$cubierta = goSanitize($this->request->getGet('cubierta'))[0] ?? 0;
|
||||||
$menu = $this->model->getPapelCliente($tipo, $cubierta, $selected_papel, false);
|
$tapa_dura = goSanitize($this->request->getGet('tapa_dura'))[0] ?? null;
|
||||||
$menu2 = $this->model->getPapelCliente($tipo, $cubierta, $selected_papel, true);
|
|
||||||
|
$menu = $this->model->getPapelCliente($tipo, $cubierta, $selected_papel, $tapa_dura, false);
|
||||||
|
$menu2 = $this->model->getPapelCliente($tipo, $cubierta, $selected_papel, $tapa_dura, true);
|
||||||
|
|
||||||
$newTokenHash = csrf_hash();
|
$newTokenHash = csrf_hash();
|
||||||
$csrfTokenName = csrf_token();
|
$csrfTokenName = csrf_token();
|
||||||
|
|||||||
@ -175,7 +175,7 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
|
|||||||
|
|
||||||
if ($this->request->getPost()) :
|
if ($this->request->getPost()) :
|
||||||
|
|
||||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
$nullIfEmpty = false; // !(phpversion() >= '8.1');
|
||||||
|
|
||||||
$postData = $this->request->getPost();
|
$postData = $this->request->getPost();
|
||||||
|
|
||||||
@ -200,6 +200,9 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
|
|||||||
if ($this->request->getPost('cubierta') == null) {
|
if ($this->request->getPost('cubierta') == null) {
|
||||||
$sanitizedData['cubierta'] = false;
|
$sanitizedData['cubierta'] = false;
|
||||||
}
|
}
|
||||||
|
if ($this->request->getPost('use_for_tapa_dura') == null) {
|
||||||
|
$sanitizedData['use_for_tapa_dura'] = false;
|
||||||
|
}
|
||||||
if ($this->request->getPost('sobrecubierta') == null) {
|
if ($this->request->getPost('sobrecubierta') == null) {
|
||||||
$sanitizedData['sobrecubierta'] = false;
|
$sanitizedData['sobrecubierta'] = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -324,10 +324,10 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
|
|
||||||
// Cubierta
|
// Cubierta
|
||||||
$cubierta = [
|
$cubierta = [
|
||||||
'papel_generico_cubierta' => $modelPapelGenerico->getIdFromCode($cubierta['papelCubierta']),
|
'papel_generico_cubierta' => $modelPapelGenerico->where('id', $cubierta['papelCubierta'])->first()->toArray(),
|
||||||
'gramajeCubierta' => intval($cubierta['gramajeCubierta']),
|
'gramajeCubierta' => intval($cubierta['gramajeCubierta']),
|
||||||
'carasCubierta' => intval($cubierta['carasImpresion'] ?? 0),
|
'carasCubierta' => intval($cubierta['carasImpresion'] ?? 0),
|
||||||
'solapasCubierta' => intval($cubierta['solapas'] ?? 0),
|
'solapasCubierta' => intval($cubierta['solapas'] ?? 0) == 1 ? intval($cubierta['tamanioSolapas']) : 0,
|
||||||
'acabadosCubierta' => $cubierta['acabados'] ?? 0,
|
'acabadosCubierta' => $cubierta['acabados'] ?? 0,
|
||||||
'lomoRedondo' => $lomoRedondo,
|
'lomoRedondo' => $lomoRedondo,
|
||||||
];
|
];
|
||||||
@ -471,6 +471,94 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function calcularMaxSolapas()
|
||||||
|
{
|
||||||
|
if ($this->request->isAJAX()) {
|
||||||
|
|
||||||
|
$reqData = $this->request->getPost();
|
||||||
|
$modelPapelGenerico = new PapelGenericoModel();
|
||||||
|
|
||||||
|
$POD = model('App\Models\Configuracion\ConfiguracionSistemaModel')->getPOD();
|
||||||
|
|
||||||
|
$cliente_id = $reqData['clienteId'] ?? -1;
|
||||||
|
|
||||||
|
$tirada = $reqData['tirada'] ?? 0;
|
||||||
|
$tamanio = $reqData['tamanio'];
|
||||||
|
$paginas = $reqData['paginas'] ?? 0;
|
||||||
|
$paginas_color = $reqData['paginasColor'] ?? 0;
|
||||||
|
$papelInteriorDiferente = intval($reqData['papelInteriorDiferente']) ?? null;
|
||||||
|
$excluirRotativa = $reqData['excluirRotativa'] ?? 0;
|
||||||
|
$excluirRotativa = intval($excluirRotativa);
|
||||||
|
|
||||||
|
$tipo = $reqData['tipo'];
|
||||||
|
$tipoCubierta = 'blanda'; // solapas sólo tapa blanda y sobre cubierta
|
||||||
|
|
||||||
|
$isColor = intval($reqData['isColor']) ?? 0;
|
||||||
|
$isHq = intval($reqData['isHq']) ?? 0;
|
||||||
|
|
||||||
|
$tipo_impresion_id = $this->getTipoImpresion($tipo, $tipoCubierta);
|
||||||
|
$is_cosido = (new TipoPresupuestoModel())->get_isCosido($tipo_impresion_id);
|
||||||
|
|
||||||
|
$interior = $reqData['interior'] ?? [];
|
||||||
|
|
||||||
|
if ($papelInteriorDiferente) {
|
||||||
|
$papel['negro'] = $modelPapelGenerico->where('id', $interior['papelInterior']['negro'])->first()->toArray();
|
||||||
|
$papel['color'] = $modelPapelGenerico->where('id', $interior['papelInterior']['color'])->first()->toArray();
|
||||||
|
$gramaje['negro'] = intval($interior['gramajeInterior']['negro']);
|
||||||
|
$gramaje['color'] = intval($interior['gramajeInterior']['color']);
|
||||||
|
} else {
|
||||||
|
$papel = $modelPapelGenerico->where('id', $interior['papelInterior'])->first()->toArray();
|
||||||
|
$gramaje = intval($interior['gramajeInterior']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$datosPedido = (object) array(
|
||||||
|
'paginas' => $paginas,
|
||||||
|
'tirada' => $tirada[0],
|
||||||
|
'merma' => $tirada[0] > $POD ? $this->calcular_merma($tirada[0], $POD) : 0,
|
||||||
|
'ancho' => intval($tamanio['ancho']) ?? 100000,
|
||||||
|
'alto' => intval($tamanio['alto']) ?? 100000,
|
||||||
|
'isCosido' => $is_cosido,
|
||||||
|
'a_favor_fibra' => 1,
|
||||||
|
);
|
||||||
|
|
||||||
|
$input_data = array(
|
||||||
|
'uso' => 'interior',
|
||||||
|
'tipo_impresion_id' => $tipo_impresion_id,
|
||||||
|
'datosPedido' => $datosPedido,
|
||||||
|
'papel_generico' => $papel,
|
||||||
|
'gramaje' => $gramaje,
|
||||||
|
'isColor' => $isColor,
|
||||||
|
'isHq' => $isHq,
|
||||||
|
'cliente_id' => $cliente_id,
|
||||||
|
'paginas_color' => $paginas_color,
|
||||||
|
'excluirRotativa' => $excluirRotativa,
|
||||||
|
'papelInteriorDiferente' => $papelInteriorDiferente
|
||||||
|
);
|
||||||
|
|
||||||
|
$interior = PresupuestoClienteService::obtenerInterior($input_data);
|
||||||
|
if ($interior == null) {
|
||||||
|
return $this->failServerError('Error al calcular el interior');
|
||||||
|
}
|
||||||
|
$anchoTotal = $interior[0]['mano'];
|
||||||
|
// le añadimos 2*ancho libro
|
||||||
|
$anchoTotal += 2 * $datosPedido->ancho;
|
||||||
|
// le añadimos los dobleces de las solapas
|
||||||
|
$anchoTotal += 6;
|
||||||
|
// le añadimos la sangre
|
||||||
|
$anchoTotal += PresupuestoService::SANGRE_FORMAS;
|
||||||
|
// 863 es el ancho máximo permitido por las máquinas
|
||||||
|
$maxSolapa = (865 - floor($anchoTotal)) / 2;
|
||||||
|
$maxSolapa = min($maxSolapa, 0.75 * $datosPedido->ancho);
|
||||||
|
return $this->respond($maxSolapa);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return $this->failUnauthorized('Invalid request', 403);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getDireccionesCliente()
|
public function getDireccionesCliente()
|
||||||
{
|
{
|
||||||
if ($this->request->isAJAX()) {
|
if ($this->request->isAJAX()) {
|
||||||
@ -488,6 +576,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
'menu' => $data,
|
'menu' => $data,
|
||||||
$csrfTokenName => $newTokenHash
|
$csrfTokenName => $newTokenHash
|
||||||
]);
|
]);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return $this->failUnauthorized('Invalid request', 403);
|
return $this->failUnauthorized('Invalid request', 403);
|
||||||
}
|
}
|
||||||
@ -696,10 +785,10 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
|
|
||||||
// Cubierta
|
// Cubierta
|
||||||
$cubierta = [
|
$cubierta = [
|
||||||
'papel_generico_cubierta' => $modelPapelGenerico->getIdFromCode($cubierta['papelCubierta']),
|
'papel_generico_cubierta' => $modelPapelGenerico->where('id', $cubierta['papelCubierta'])->first()->toArray(),
|
||||||
'gramajeCubierta' => intval($cubierta['gramajeCubierta']),
|
'gramajeCubierta' => intval($cubierta['gramajeCubierta']),
|
||||||
'carasCubierta' => intval($cubierta['carasImpresion'] ?? 0),
|
'carasCubierta' => intval($cubierta['carasImpresion'] ?? 0),
|
||||||
'solapasCubierta' => intval($cubierta['solapas'] ?? 0),
|
'solapasCubierta' => intval($cubierta['solapas'] ?? 0) == 1 ? intval($cubierta['tamanioSolapas']) : 0,
|
||||||
'acabadosCubierta' => $cubierta['acabados'] ?? 0,
|
'acabadosCubierta' => $cubierta['acabados'] ?? 0,
|
||||||
'lomoRedondo' => $cubierta['lomoRedondo'] ?? 0,
|
'lomoRedondo' => $cubierta['lomoRedondo'] ?? 0,
|
||||||
'cabezada' => $cubierta['cabezada'] ?? 'WHI',
|
'cabezada' => $cubierta['cabezada'] ?? 'WHI',
|
||||||
@ -913,6 +1002,9 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
} else if ($servicio->tarifa_id == 62) {
|
} else if ($servicio->tarifa_id == 62) {
|
||||||
// Servicios manipulado
|
// Servicios manipulado
|
||||||
$this->guardarServicio($id, $servicio, 'manipulado');
|
$this->guardarServicio($id, $servicio, 'manipulado');
|
||||||
|
} else if ($servicio->tarifa_id == 73) {
|
||||||
|
// Servicios manipulado
|
||||||
|
$this->guardarServicio($id, $servicio, 'manipulado');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1013,6 +1105,9 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
$data['sobrecubierta']['solapas'] = $presupuesto->solapas_sobrecubierta ? 1 : 0;
|
$data['sobrecubierta']['solapas'] = $presupuesto->solapas_sobrecubierta ? 1 : 0;
|
||||||
$data['sobrecubierta']['solapas_ancho'] = $presupuesto->solapas_ancho_sobrecubierta;
|
$data['sobrecubierta']['solapas_ancho'] = $presupuesto->solapas_ancho_sobrecubierta;
|
||||||
$data['sobrecubierta']['plastificado'] = $modelAcabado->getCodeFromId($presupuesto->acabado_sobrecubierta_id);
|
$data['sobrecubierta']['plastificado'] = $modelAcabado->getCodeFromId($presupuesto->acabado_sobrecubierta_id);
|
||||||
|
if ($data['sobrecubierta']['plastificado'] == '') {
|
||||||
|
$data['sobrecubierta']['plastificado'] = 'NONE';
|
||||||
|
}
|
||||||
|
|
||||||
$data['guardas'] = array_key_exists('guardas', $datos_papel) ? $datos_papel['guardas'] : [];
|
$data['guardas'] = array_key_exists('guardas', $datos_papel) ? $datos_papel['guardas'] : [];
|
||||||
|
|
||||||
@ -1796,6 +1891,9 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
'solapas' => intval($solapasCubierta) > 0 ? 1 : 0,
|
'solapas' => intval($solapasCubierta) > 0 ? 1 : 0,
|
||||||
'paginasCuadernillo' => $paginasCuadernillo,
|
'paginasCuadernillo' => $paginasCuadernillo,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$costeServiciosDefecto = 0.0;
|
$costeServiciosDefecto = 0.0;
|
||||||
foreach ($servDefecto as $servicio) {
|
foreach ($servDefecto as $servicio) {
|
||||||
if ($servicio->total <= 0) {
|
if ($servicio->total <= 0) {
|
||||||
@ -1829,6 +1927,14 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Servicios
|
// Servicios
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
'retractilado' => 3,
|
||||||
|
'prototipo' => 9,
|
||||||
|
*/
|
||||||
|
$serviciosAutomaticos = [];
|
||||||
|
$servicios = [];
|
||||||
// se comprueba si $datos guardas es un array
|
// se comprueba si $datos guardas es un array
|
||||||
if (is_array($datos_guardas)) {
|
if (is_array($datos_guardas)) {
|
||||||
if (count($datos_guardas) > 0) {
|
if (count($datos_guardas) > 0) {
|
||||||
@ -1839,13 +1945,6 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
array_push($servicios, 62); // Plegado de guardas
|
array_push($servicios, 62); // Plegado de guardas
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
'retractilado' => 3,
|
|
||||||
'prototipo' => 9,
|
|
||||||
*/
|
|
||||||
$serviciosAutomaticos = [];
|
|
||||||
$servicios = [];
|
|
||||||
if ($datos_entrada['servicios']['retractilado']) // acabado
|
if ($datos_entrada['servicios']['retractilado']) // acabado
|
||||||
array_push($servicios, 3);
|
array_push($servicios, 3);
|
||||||
if ($datos_entrada['servicios']['retractilado5']) // acabado
|
if ($datos_entrada['servicios']['retractilado5']) // acabado
|
||||||
@ -1873,7 +1972,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
$errorModel->insertError(
|
$errorModel->insertError(
|
||||||
$datos_entrada['id'],
|
$datos_entrada['id'],
|
||||||
auth()->user()->id,
|
auth()->user()->id,
|
||||||
'No se puede obtener servicio con id ' . ((string)$servicio),
|
'No se puede obtener servicio con id ' . ((string) $servicio),
|
||||||
$input_data
|
$input_data
|
||||||
);
|
);
|
||||||
$return_data = [
|
$return_data = [
|
||||||
@ -1901,7 +2000,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
$errorModel->insertError(
|
$errorModel->insertError(
|
||||||
$datos_entrada['id'],
|
$datos_entrada['id'],
|
||||||
auth()->user()->id,
|
auth()->user()->id,
|
||||||
'No se puede obtener servicio con id ' . ((string)$servicio),
|
'No se puede obtener servicio con id ' . ((string) $servicio),
|
||||||
$input_data
|
$input_data
|
||||||
);
|
);
|
||||||
$return_data = [
|
$return_data = [
|
||||||
@ -1921,6 +2020,45 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Plegado de solapas grandes
|
||||||
|
if (
|
||||||
|
(intval($solapasCubierta) > 0 && intval($cubierta['dimension_desarrollo']['ancho']) > 630) ||
|
||||||
|
(is_array($sobreCubierta) && ($sobreCubierta['solapas'] > 0 && intval($linea_sobrecubierta['dimension_desarrollo']['ancho']) > 630))
|
||||||
|
) {
|
||||||
|
|
||||||
|
// Servicios acabado
|
||||||
|
$resultado = PresupuestoCLienteService::getServiciosManipulado([
|
||||||
|
'tarifa_id' => 73,
|
||||||
|
'tirada' => $datosPedido->tirada,
|
||||||
|
'POD' => $POD,
|
||||||
|
]);
|
||||||
|
array_push($serviciosAutomaticos, $resultado[0]);
|
||||||
|
|
||||||
|
if ($resultado[0]->total <= 0) {
|
||||||
|
|
||||||
|
$errorModel = new ErrorPresupuesto();
|
||||||
|
$errorModel->insertError(
|
||||||
|
$datos_entrada['id'],
|
||||||
|
auth()->user()->id,
|
||||||
|
'No se puede obtener servicio de manupulado con id ' . ((string) $servicio),
|
||||||
|
$input_data
|
||||||
|
);
|
||||||
|
$return_data = [
|
||||||
|
'errors' => (object) ([
|
||||||
|
'status' => 1
|
||||||
|
]),
|
||||||
|
];
|
||||||
|
return $return_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
$coste_servicios += floatval($resultado[0]->total);
|
||||||
|
if ($extra_info) {
|
||||||
|
$totalServicios += floatval($resultado[0]->total);
|
||||||
|
$margenServicios += floatval($resultado[0]->total) * floatval($resultado[0]->margen) / 100.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
array_push($precio_u, round(($costeInterior + $coste_cubierta + $coste_sobrecubierta + $costeServiciosDefecto + $coste_servicios) / $tirada[$t], 4));
|
array_push($precio_u, round(($costeInterior + $coste_cubierta + $coste_sobrecubierta + $costeServiciosDefecto + $coste_servicios) / $tirada[$t], 4));
|
||||||
array_push($peso, round($peso_interior + $peso_cubierta + $peso_sobrecubierta + $peso_guardas, 2));
|
array_push($peso, round($peso_interior + $peso_cubierta + $peso_sobrecubierta + $peso_guardas, 2));
|
||||||
|
|
||||||
|
|||||||
320
ci4/app/Controllers/Utiles.php
Normal file
320
ci4/app/Controllers/Utiles.php
Normal file
@ -0,0 +1,320 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Controllers\BaseController;
|
||||||
|
use App\Models\Configuracion\MaquinasTarifasImpresionModel;
|
||||||
|
use App\Models\Configuracion\PapelGenericoModel;
|
||||||
|
use App\Models\Configuracion\MaquinaModel;
|
||||||
|
use App\Models\Presupuestos\PresupuestoModel;
|
||||||
|
use App\Models\Usuarios\GroupModel;
|
||||||
|
use App\Models\Usuarios\PermisosModel;
|
||||||
|
use App\Services\PresupuestoService;
|
||||||
|
use CodeIgniter\Shield\Entities\User;
|
||||||
|
|
||||||
|
class Utiles extends BaseController
|
||||||
|
{
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function echo()
|
||||||
|
{
|
||||||
|
|
||||||
|
echo "echo";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
echo "ok";
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function get_tarifas_encuadernacion()
|
||||||
|
{
|
||||||
|
// Llamar al modelo
|
||||||
|
$model = model('App\Models\Tarifas\TarifaEncuadernacionModel');
|
||||||
|
|
||||||
|
// Obtener todos los resultados
|
||||||
|
$results = $model->where(['is_deleted' => 0])->findAll();
|
||||||
|
|
||||||
|
// Iterar sobre cada entidad
|
||||||
|
echo '<pre>';
|
||||||
|
foreach ($results as $result) {
|
||||||
|
// Cada $result es una instancia de una entidad
|
||||||
|
print_r($result->toArray()); // Convierte la entidad a un array para imprimir sus valores
|
||||||
|
}
|
||||||
|
echo '</pre>';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_tarifa_encuadernacion($tarifaEncuadernacionId)
|
||||||
|
{
|
||||||
|
// Llamar a los modelos
|
||||||
|
$modelTE = model('App\Models\Tarifas\TarifaEncuadernacionModel');
|
||||||
|
$modelTELineas = model('App\Models\Tarifas\TarifaEncuadernacionLineaModel');
|
||||||
|
$modelTELineasHoras = model('App\Models\Tarifas\TarifaEncuadernacionLineaHorasModel');
|
||||||
|
$modelTETiradas = model('App\Models\Tarifas\TarifaEncuadernacionTiradaModel');
|
||||||
|
|
||||||
|
|
||||||
|
// Obtener el registro principal de tarifa_encuadernacion
|
||||||
|
$tarifas_encuadernacion = $modelTE->where([
|
||||||
|
'id' => $tarifaEncuadernacionId,
|
||||||
|
'is_deleted' => 0
|
||||||
|
])->findAll();
|
||||||
|
|
||||||
|
// Verificar si se encontró la tarifa
|
||||||
|
if (empty($tarifas_encuadernacion)) {
|
||||||
|
echo "No se encontraron datos para la tarifa de encuadernación con ID: $tarifaEncuadernacionId.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Imprimir la tarifa de encuadernación principal
|
||||||
|
echo "<h3>---------------------- DATO TARIFA ENCUADERNACION ----------------------</h3>";
|
||||||
|
foreach ($tarifas_encuadernacion as $tarifa_encuadernacion) {
|
||||||
|
echo "<strong>ID Tarifa: </strong>" . $tarifa_encuadernacion->id . "<br>";
|
||||||
|
echo "<strong>Nombre: </strong>" . $tarifa_encuadernacion->nombre . "<br>";
|
||||||
|
echo "<hr>";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Obtener las tiradas asociadas a esta tarifa de encuadernación
|
||||||
|
$tarifas_encuadernacion_tiradas = $modelTETiradas->where([
|
||||||
|
'tarifa_encuadernacion_id' => $tarifaEncuadernacionId,
|
||||||
|
'is_deleted' => 0
|
||||||
|
])->findAll();
|
||||||
|
|
||||||
|
// Verificar si existen tiradas para la tarifa de encuadernación
|
||||||
|
if (empty($tarifas_encuadernacion_tiradas)) {
|
||||||
|
echo "No hay tiradas asociadas a esta tarifa de encuadernación.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Imprimir las tiradas asociadas
|
||||||
|
echo "<h3>---------------------- DATO TARIFA ENCUADERNACION (TIRADAS) -------------</h3>";
|
||||||
|
foreach ($tarifas_encuadernacion_tiradas as $tarifa_encuadernacion_tirada) {
|
||||||
|
echo "<strong>ID Tirada: </strong>" . $tarifa_encuadernacion_tirada->id . "<br>";
|
||||||
|
echo "<strong>Tirada Min: </strong>" . $tarifa_encuadernacion_tirada->tirada_min . "<br>";
|
||||||
|
echo "<strong>Tirada Max: </strong>" . $tarifa_encuadernacion_tirada->tirada_max . "<br>";
|
||||||
|
|
||||||
|
// Obtener las líneas asociadas a esta tirada
|
||||||
|
$tarifas_encuadernacion_lineas = $modelTELineas->where([
|
||||||
|
'tirada_encuadernacion_id' => $tarifa_encuadernacion_tirada->id,
|
||||||
|
'is_deleted' => 0
|
||||||
|
])->findAll();
|
||||||
|
|
||||||
|
// Verificar si existen líneas asociadas a la tirada
|
||||||
|
if (empty($tarifas_encuadernacion_lineas)) {
|
||||||
|
echo "No hay líneas asociadas a esta tirada de encuadernación.<br>";
|
||||||
|
} else {
|
||||||
|
// Imprimir las líneas asociadas
|
||||||
|
echo "<ul>";
|
||||||
|
foreach ($tarifas_encuadernacion_lineas as $tarifa_encuadernacion_linea) {
|
||||||
|
echo "<li><strong>ID Línea: </strong>" . $tarifa_encuadernacion_linea->id . "<br>";
|
||||||
|
}
|
||||||
|
echo "</ul>";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Obtener las líneas y horas asociadas a esta tirada
|
||||||
|
$tarifas_encuadernacion_lineas_horas = $modelTELineasHoras->where([
|
||||||
|
'tirada_encuadernacion_id' => $tarifa_encuadernacion_tirada->id,
|
||||||
|
'is_deleted' => 0
|
||||||
|
])->findAll();
|
||||||
|
|
||||||
|
// Verificar si existen líneas y horas asociadas a la tirada
|
||||||
|
if (empty($tarifas_encuadernacion_lineas_horas)) {
|
||||||
|
echo "No hay líneas y horas asociadas a esta tirada de encuadernación.<br>";
|
||||||
|
} else {
|
||||||
|
// Imprimir las líneas asociadas
|
||||||
|
echo "<ul>";
|
||||||
|
foreach ($tarifas_encuadernacion_lineas_horas as $tarifas_encuadernacion_linea_hora) {
|
||||||
|
echo "<li><strong>ID Línea/Hora: </strong>" . $tarifas_encuadernacion_linea_hora->id . "<br>";
|
||||||
|
}
|
||||||
|
echo "</ul>";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<hr>";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<h3>---------------------- FIN DE DATO TARIFA ENCUADERNACION ----------------------</h3>";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete_tarifa_encuadernacion($tarifaEncuadernacionId)
|
||||||
|
{
|
||||||
|
// Llamar a los modelos
|
||||||
|
$modelTE = model('App\Models\Tarifas\TarifaEncuadernacionModel');
|
||||||
|
$modelTELineas = model('App\Models\Tarifas\TarifaEncuadernacionLineaModel');
|
||||||
|
$modelTELineasHoras = model('App\Models\Tarifas\TarifaEncuadernacionLineaHorasModel');
|
||||||
|
$modelTETiradas = model('App\Models\Tarifas\TarifaEncuadernacionTiradaModel');
|
||||||
|
|
||||||
|
// Obtener el registro principal de tarifa_encuadernacion
|
||||||
|
$tarifas_encuadernacion = $modelTE->where([
|
||||||
|
'id' => $tarifaEncuadernacionId,
|
||||||
|
'is_deleted' => 0
|
||||||
|
])->findAll();
|
||||||
|
|
||||||
|
// Verificar si se encontró la tarifa
|
||||||
|
if (empty($tarifas_encuadernacion)) {
|
||||||
|
echo "No se encontró la tarifa de encuadernación con ID: $tarifaEncuadernacionId.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Iniciar eliminación de datos asociados
|
||||||
|
echo "Eliminando datos asociados a la tarifa de encuadernación ID: $tarifaEncuadernacionId...<br>";
|
||||||
|
|
||||||
|
// Eliminar las tiradas asociadas a la tarifa de encuadernación
|
||||||
|
$tarifas_encuadernacion_tiradas = $modelTETiradas->where([
|
||||||
|
'tarifa_encuadernacion_id' => $tarifaEncuadernacionId,
|
||||||
|
'is_deleted' => 0
|
||||||
|
])->findAll();
|
||||||
|
|
||||||
|
if (!empty($tarifas_encuadernacion_tiradas)) {
|
||||||
|
foreach ($tarifas_encuadernacion_tiradas as $tarifa_encuadernacion_tirada) {
|
||||||
|
// Eliminar las líneas de horas asociadas a cada tirada
|
||||||
|
$tarifas_encuadernacion_lineas_horas = $modelTELineasHoras->where([
|
||||||
|
'tirada_encuadernacion_id' => $tarifa_encuadernacion_tirada->id,
|
||||||
|
'is_deleted' => 0
|
||||||
|
])->findAll();
|
||||||
|
|
||||||
|
if (!empty($tarifas_encuadernacion_lineas_horas)) {
|
||||||
|
foreach ($tarifas_encuadernacion_lineas_horas as $tarifa_encuadernacion_linea_hora) {
|
||||||
|
$modelTELineasHoras->delete($tarifa_encuadernacion_linea_hora->id); // Eliminar la línea/hora
|
||||||
|
echo "===sk >-Eliminando Línea/Hora ID: " . $tarifa_encuadernacion_linea_hora->id . "<br>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Eliminar las líneas asociadas a cada tirada
|
||||||
|
$tarifas_encuadernacion_lineas = $modelTELineas->where([
|
||||||
|
'tirada_encuadernacion_id' => $tarifa_encuadernacion_tirada->id,
|
||||||
|
'is_deleted' => 0
|
||||||
|
])->findAll();
|
||||||
|
|
||||||
|
if (!empty($tarifas_encuadernacion_lineas)) {
|
||||||
|
foreach ($tarifas_encuadernacion_lineas as $tarifa_encuadernacion_linea) {
|
||||||
|
$modelTELineas->delete($tarifa_encuadernacion_linea->id); // Eliminar la línea
|
||||||
|
echo "===>-Eliminando Línea ID: " . $tarifa_encuadernacion_linea->id . "<br>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Eliminar la tirada
|
||||||
|
$modelTETiradas->delete($tarifa_encuadernacion_tirada->id); // Eliminar la tirada
|
||||||
|
echo "=>-Eliminando Tirada ID: " . $tarifa_encuadernacion_tirada->id . "<br>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo " *** Proceso de eliminación completado. ***<br><br>";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function clone_tarifa_encuadernacion($origenId, $destinoId)
|
||||||
|
{
|
||||||
|
// Llamar a los modelos
|
||||||
|
$modelTETiradas = model('App\Models\Tarifas\TarifaEncuadernacionTiradaModel');
|
||||||
|
$modelTELineas = model('App\Models\Tarifas\TarifaEncuadernacionLineaModel');
|
||||||
|
$modelTELineasHoras = model('App\Models\Tarifas\TarifaEncuadernacionLineaHorasModel');
|
||||||
|
|
||||||
|
// 1. Eliminar el contenido asociado de la tarifa destino
|
||||||
|
$this->delete_tarifa_encuadernacion($destinoId);
|
||||||
|
|
||||||
|
// 2. Obtener las tiradas asociadas a la tarifa origen
|
||||||
|
$tiradasOrigen = $modelTETiradas->where([
|
||||||
|
'tarifa_encuadernacion_id' => $origenId,
|
||||||
|
'is_deleted' => 0
|
||||||
|
])->findAll();
|
||||||
|
|
||||||
|
foreach ($tiradasOrigen as $tiradaOrigen) {
|
||||||
|
// Crear un nuevo registro para la tirada en la tarifa destino
|
||||||
|
$nuevaTirada = [
|
||||||
|
'tarifa_encuadernacion_id' => (int) $destinoId,
|
||||||
|
'proveedor_id' => (int) $tiradaOrigen->proveedor_id,
|
||||||
|
'importe_fijo' => (float) $tiradaOrigen->importe_fijo,
|
||||||
|
'tirada_min' => (int) $tiradaOrigen->tirada_min,
|
||||||
|
'tirada_max' => (int) $tiradaOrigen->tirada_max,
|
||||||
|
'user_created_id' => (int) auth()->id(),
|
||||||
|
'is_deleted' => 0
|
||||||
|
];
|
||||||
|
|
||||||
|
try {
|
||||||
|
$nuevaTiradaId = $modelTETiradas->insert($nuevaTirada);
|
||||||
|
if (!$nuevaTiradaId) {
|
||||||
|
throw new \Exception("Error al insertar el registro.");
|
||||||
|
}
|
||||||
|
echo "<br>==>+Tirada creada con ID: " . $nuevaTiradaId;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
echo "Error: " . $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Clonar las líneas asociadas a esta tirada
|
||||||
|
$lineasOrigen = $modelTELineas->where([
|
||||||
|
'tirada_encuadernacion_id' => $tiradaOrigen->id,
|
||||||
|
'is_deleted' => 0
|
||||||
|
])->findAll();
|
||||||
|
|
||||||
|
foreach ($lineasOrigen as $lineaOrigen) {
|
||||||
|
$nuevaLinea = [
|
||||||
|
'tirada_encuadernacion_id' => (int) $nuevaTiradaId,
|
||||||
|
'paginas_libro_min' => (float) $lineaOrigen->paginas_libro_min,
|
||||||
|
'paginas_libro_max' => (float) $lineaOrigen->paginas_libro_max,
|
||||||
|
'dimensiones_id' => (int) $lineaOrigen->dimensiones_id,
|
||||||
|
'precio_min' => (float) $lineaOrigen->precio_min,
|
||||||
|
'precio_max' => (float) $lineaOrigen->precio_max,
|
||||||
|
'tirada_min' => (float) $lineaOrigen->tirada_min,
|
||||||
|
'tirada_max' => (float) $lineaOrigen->tirada_max,
|
||||||
|
'total_min' => (float) $lineaOrigen->total_min,
|
||||||
|
'margen' => (float) $lineaOrigen->margen,
|
||||||
|
'user_created_id' => (int) auth()->id(),
|
||||||
|
'is_deleted' => 0
|
||||||
|
];
|
||||||
|
|
||||||
|
try {
|
||||||
|
$nuevaLineaId = $modelTELineas->insert($nuevaLinea);
|
||||||
|
if (!$nuevaLineaId) {
|
||||||
|
throw new \Exception("Error al insertar el registro.");
|
||||||
|
}
|
||||||
|
echo "<br>====>+Linea creada con ID: " . $nuevaLineaId;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
echo "Error: " . $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. Clonar las líneas y horas asociadas a esta tirada
|
||||||
|
$lineasHorasOrigen = $modelTELineasHoras->where([
|
||||||
|
'tirada_encuadernacion_id' => $tiradaOrigen->id,
|
||||||
|
'is_deleted' => 0
|
||||||
|
])->findAll();
|
||||||
|
|
||||||
|
foreach ($lineasHorasOrigen as $lineaHoraOrigen) {
|
||||||
|
$nuevaLineaHora = [
|
||||||
|
'tirada_encuadernacion_id' => (int) $nuevaTiradaId,
|
||||||
|
'tiempo_min' => (float) $lineaHoraOrigen->tiempo_min,
|
||||||
|
'tiempo_max' => (float) $lineaHoraOrigen->tiempo_max,
|
||||||
|
'precio_hora' => (float) $lineaHoraOrigen->precio_hora,
|
||||||
|
'total_min' => (float) $lineaHoraOrigen->total_min,
|
||||||
|
'margen' => (float) $lineaHoraOrigen->margen,
|
||||||
|
'user_created_id' => (int) auth()->id(),
|
||||||
|
'is_deleted' => 0
|
||||||
|
];
|
||||||
|
|
||||||
|
try {
|
||||||
|
$nuevaLineaHoraId = $modelTELineasHoras->insert($nuevaLineaHora);
|
||||||
|
if (!$nuevaLineaHoraId) {
|
||||||
|
throw new \Exception("Error al insertar el registro.");
|
||||||
|
}
|
||||||
|
echo "<br>====>+Linea/Hora creado con ID: " . $nuevaLineaHoraId;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
echo "Error: " . $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<br> *** Proceso de clonacion completado. ***<br><br>";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
|
use CodeIgniter\Database\Migration;
|
||||||
|
|
||||||
|
class AddTickTapaDuraPapelImp extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$fields = [
|
||||||
|
'use_for_tapa_dura' => [
|
||||||
|
'type' => 'TINYINT',
|
||||||
|
'constraint' => 1,
|
||||||
|
'null' => false,
|
||||||
|
'default' => 0,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->forge->addColumn('lg_papel_impresion', $fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
$this->forge->dropColumn('lg_papel_impresion', 'use_for_tapa_dura');
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -25,6 +25,7 @@ class PapelImpresion extends \CodeIgniter\Entity\Entity
|
|||||||
"rotativa" => false,
|
"rotativa" => false,
|
||||||
"isActivo" => true,
|
"isActivo" => true,
|
||||||
"use_in_client" => false,
|
"use_in_client" => false,
|
||||||
|
"use_for_tapa_dura" => false,
|
||||||
"is_deleted" => 0,
|
"is_deleted" => 0,
|
||||||
"created_at" => null,
|
"created_at" => null,
|
||||||
"updated_at" => null,
|
"updated_at" => null,
|
||||||
@ -45,6 +46,7 @@ class PapelImpresion extends \CodeIgniter\Entity\Entity
|
|||||||
"rotativa" => "boolean",
|
"rotativa" => "boolean",
|
||||||
"isActivo" => "boolean",
|
"isActivo" => "boolean",
|
||||||
"use_in_client" => "boolean",
|
"use_in_client" => "boolean",
|
||||||
|
"use_for_tapa_dura" => "boolean",
|
||||||
"is_deleted" => "int",
|
"is_deleted" => "int",
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,7 @@ return [
|
|||||||
'color' => 'Color',
|
'color' => 'Color',
|
||||||
'createdAt' => 'Creado en',
|
'createdAt' => 'Creado en',
|
||||||
'cubierta' => 'Cubierta',
|
'cubierta' => 'Cubierta',
|
||||||
|
'use_for_tapa_dura' => 'Papel tapa dura',
|
||||||
'sobrecubierta' => 'Sobrecubierta',
|
'sobrecubierta' => 'Sobrecubierta',
|
||||||
'guardas' => 'Guardas',
|
'guardas' => 'Guardas',
|
||||||
'defecto' => 'Por defecto',
|
'defecto' => 'Por defecto',
|
||||||
|
|||||||
@ -313,7 +313,7 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getPapelCliente($tipo, $is_cubierta = false, $selected_papel_id = null, $papel_especial = false)
|
public function getPapelCliente($tipo, $is_cubierta = false, $selected_papel_id = null, $tapa_dura = null, $papel_especial = false)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
1.-> Tipo impresion
|
1.-> Tipo impresion
|
||||||
@ -382,6 +382,9 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
|||||||
if ($is_cubierta == true) {
|
if ($is_cubierta == true) {
|
||||||
$builder->where("t2.cubierta", 1);
|
$builder->where("t2.cubierta", 1);
|
||||||
$builder->where("t5.uso", 'cubierta');
|
$builder->where("t5.uso", 'cubierta');
|
||||||
|
if($tapa_dura == true){
|
||||||
|
$builder->where("t2.use_for_tapa_dura", 1);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$builder->where("t2.interior", 1);
|
$builder->where("t2.interior", 1);
|
||||||
$builder->where("t5.uso", 'interior');
|
$builder->where("t5.uso", 'interior');
|
||||||
@ -394,6 +397,9 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
|||||||
if ($papel_especial == true) {
|
if ($papel_especial == true) {
|
||||||
$builder->where("t1.show_in_client_special", 1);
|
$builder->where("t1.show_in_client_special", 1);
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
$builder->where("t1.show_in_client_special", 0);
|
||||||
|
}
|
||||||
|
|
||||||
if ($tipo == 'colorhq' || $tipo == 'negrohq') {
|
if ($tipo == 'colorhq' || $tipo == 'negrohq') {
|
||||||
$builder->where("t2.rotativa", 0);
|
$builder->where("t2.rotativa", 0);
|
||||||
|
|||||||
@ -20,12 +20,13 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
|||||||
4 => "t1.bn",
|
4 => "t1.bn",
|
||||||
5 => "t1.color",
|
5 => "t1.color",
|
||||||
6 => "t1.cubierta",
|
6 => "t1.cubierta",
|
||||||
7 => "t1.sobrecubierta",
|
7 => "t1.use_for_tapa_dura",
|
||||||
8 => "t1.guardas",
|
8 => "t1.sobrecubierta",
|
||||||
9 => "t1.inkjet",
|
9 => "t1.guardas",
|
||||||
10 => "t1.rotativa",
|
10 => "t1.inkjet",
|
||||||
11 => "t1.isActivo",
|
11 => "t1.rotativa",
|
||||||
12 => "t1.use_in_client",
|
12 => "t1.isActivo",
|
||||||
|
13 => "t1.use_in_client",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
@ -48,6 +49,7 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
|||||||
"rotativa",
|
"rotativa",
|
||||||
"isActivo",
|
"isActivo",
|
||||||
"use_in_client",
|
"use_in_client",
|
||||||
|
"use_for_tapa_dura",
|
||||||
"deleted_at",
|
"deleted_at",
|
||||||
"is_deleted",
|
"is_deleted",
|
||||||
"user_updated_id",
|
"user_updated_id",
|
||||||
@ -152,7 +154,8 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
|||||||
->select(
|
->select(
|
||||||
"t1.id AS id, t1.nombre AS nombre, t1.defecto AS defecto, t1.referencia AS referencia, t1.mano AS mano,
|
"t1.id AS id, t1.nombre AS nombre, t1.defecto AS defecto, t1.referencia AS referencia, t1.mano AS mano,
|
||||||
t1.espesor AS espesor, t1.gramaje AS gramaje, t1.interior AS interior, t1.precio_tonelada AS precio_tonelada,
|
t1.espesor AS espesor, t1.gramaje AS gramaje, t1.interior AS interior, t1.precio_tonelada AS precio_tonelada,
|
||||||
t1.bn AS bn, t1.color AS color, t1.cubierta AS cubierta, t1.sobrecubierta AS sobrecubierta, t1.guardas AS guardas,
|
t1.bn AS bn, t1.color AS color, t1.cubierta AS cubierta, t1.use_for_tapa_dura AS use_for_tapa_dura,
|
||||||
|
t1.sobrecubierta AS sobrecubierta, t1.guardas AS guardas,
|
||||||
t1.inkjet AS inkjet, t1.rotativa AS rotativa,
|
t1.inkjet AS inkjet, t1.rotativa AS rotativa,
|
||||||
t1.isActivo AS isActivo, t2.nombre AS papel_generico_id,
|
t1.isActivo AS isActivo, t2.nombre AS papel_generico_id,
|
||||||
t1.use_in_client AS use_in_client"
|
t1.use_in_client AS use_in_client"
|
||||||
|
|||||||
@ -248,7 +248,7 @@ class PresupuestoEncuadernacionesModel extends \App\Models\BaseModel
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPrecioTarifaHoras($tarifa_encuadernacion_id, $paginas, $tirada, $proveedor_id, $POD, $paginas_cuadernillo = null){
|
public function getPrecioTarifaHoras($tarifa_encuadernacion_id, $paginas, $tirada, $proveedor_id, $POD, $paginas_cuadernillo = 32){
|
||||||
|
|
||||||
$modelTarifa = model('App\Models\Tarifas\TarifaEncuadernacionModel');
|
$modelTarifa = model('App\Models\Tarifas\TarifaEncuadernacionModel');
|
||||||
|
|
||||||
|
|||||||
@ -426,7 +426,7 @@ class PresupuestoModel extends \App\Models\BaseModel
|
|||||||
'solapas' => $data['cubierta']['solapasCubierta'] == 0 ? 0 : 1,
|
'solapas' => $data['cubierta']['solapasCubierta'] == 0 ? 0 : 1,
|
||||||
'lomo_redondo' => $data['cubierta']['lomoRedondo'] == 0 ? 0 : 1,
|
'lomo_redondo' => $data['cubierta']['lomoRedondo'] == 0 ? 0 : 1,
|
||||||
'cabezada' => $data['cubierta']['cabezada'] == 0 ? 0 : 1,
|
'cabezada' => $data['cubierta']['cabezada'] == 0 ? 0 : 1,
|
||||||
'solapas_ancho' => $data['cubierta']['solapasCubierta'] == 0 ? $data['cubierta']['solapasCubierta'] : 0,
|
'solapas_ancho' => $data['cubierta']['solapasCubierta'] > 0 ? $data['cubierta']['solapasCubierta'] : 0,
|
||||||
'solapas_sobrecubierta' => !$data['sobrecubierta'] ? 0 : 1,
|
'solapas_sobrecubierta' => !$data['sobrecubierta'] ? 0 : 1,
|
||||||
'solapas_ancho_sobrecubierta' => !$data['sobrecubierta'] ? 0 : $data['sobrecubierta']['solapas'],
|
'solapas_ancho_sobrecubierta' => !$data['sobrecubierta'] ? 0 : $data['sobrecubierta']['solapas'],
|
||||||
'cosido' => $is_cosido,
|
'cosido' => $is_cosido,
|
||||||
|
|||||||
@ -79,6 +79,7 @@ class TipoPresupuestoServiciosDefectoModel extends \App\Models\BaseModel
|
|||||||
$where = "(t1.solapas IS NULL OR t1.solapas='" . $solapas . "')";
|
$where = "(t1.solapas IS NULL OR t1.solapas='" . $solapas . "')";
|
||||||
$builder->where($where);
|
$builder->where($where);
|
||||||
|
|
||||||
|
$builder->where("t1.is_deleted", 0);
|
||||||
$builder->where("t2.is_deleted", 0);
|
$builder->where("t2.is_deleted", 0);
|
||||||
$builder->select("t1.tarifa_id AS tarifa_id, t2.nombre AS tarifa_nombre");
|
$builder->select("t1.tarifa_id AS tarifa_id, t2.nombre AS tarifa_nombre");
|
||||||
|
|
||||||
|
|||||||
@ -416,6 +416,17 @@ class PresupuestoClienteService extends BaseService
|
|||||||
return $values;
|
return $values;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getServiciosManipuladoDefault($data)
|
||||||
|
{
|
||||||
|
|
||||||
|
$tirada = $data['tirada'] ?? -1;
|
||||||
|
$anchoDesarrollo = $data['anchoDesarrollo'] ?? -1;
|
||||||
|
|
||||||
|
/*$model = model('App\Models\Presupuestos\PresupuestoEncuadernacionesModel');
|
||||||
|
$values = $model->initPresupuesto($tipo_impresion_id, $solapas, $tirada, $paginas, $ancho, $alto, $POD, $paginasCuadernillo);*/
|
||||||
|
//return $values;
|
||||||
|
}
|
||||||
|
|
||||||
public static function getServiciosManipulado($data)
|
public static function getServiciosManipulado($data)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@ -1479,7 +1479,7 @@ class PresupuestoService extends BaseService
|
|||||||
// con el mismo proveedor
|
// con el mismo proveedor
|
||||||
else {
|
else {
|
||||||
if ($tarifaModel->isTarifaPorHoras($servicio->tarifa_encuadernado_id)) {
|
if ($tarifaModel->isTarifaPorHoras($servicio->tarifa_encuadernado_id)) {
|
||||||
$paginas_cuadernillo = $servicio->paginas_por_cuadernillo ?? null;
|
$paginas_cuadernillo = $servicio->paginas_por_cuadernillo ?? 32;
|
||||||
$nueva_tarifa = $model->getPrecioTarifaHoras(
|
$nueva_tarifa = $model->getPrecioTarifaHoras(
|
||||||
$servicio->tarifa_encuadernado_id,
|
$servicio->tarifa_encuadernado_id,
|
||||||
$input_data['paginas'],
|
$input_data['paginas'],
|
||||||
@ -1815,6 +1815,12 @@ class PresupuestoService extends BaseService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($uso == 'cubierta' || $uso == 'sobrecubierta') {
|
||||||
|
|
||||||
|
$linea['fields']['dimension_desarrollo']['ancho'] = $datosPedido->anchoExteriores;
|
||||||
|
$linea['fields']['dimension_desarrollo']['alto'] = $datosPedido->altoExteriores;
|
||||||
|
}
|
||||||
|
|
||||||
if (!array_key_exists('tipo_linea', $linea['fields'])) {
|
if (!array_key_exists('tipo_linea', $linea['fields'])) {
|
||||||
if ($isColor) {
|
if ($isColor) {
|
||||||
if ($isHq)
|
if ($isHq)
|
||||||
|
|||||||
@ -99,6 +99,17 @@
|
|||||||
</div><!--//.form-check -->
|
</div><!--//.form-check -->
|
||||||
</div><!--//.mb-3 -->
|
</div><!--//.mb-3 -->
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<div class="form-check">
|
||||||
|
|
||||||
|
<label for="use_for_tapa_dura" class="form-check-label">
|
||||||
|
<input <?= $papelImpresion->cubierta? ' ' : 'disabled ' ?> type="checkbox" id="useForTapaDura" name="use_for_tapa_dura" value="1" class="form-check-input"
|
||||||
|
<?= $papelImpresion->use_for_tapa_dura == true ? 'checked' : ''; ?>>
|
||||||
|
<?= lang('PapelImpresion.use_for_tapa_dura') ?>
|
||||||
|
</label>
|
||||||
|
</div><!--//.form-check -->
|
||||||
|
</div><!--//.mb-3 -->
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
|
|
||||||
|
|||||||
@ -403,6 +403,16 @@
|
|||||||
`;
|
`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$('#cubierta').on('change', function() {
|
||||||
|
if($(this).is(':checked')) {
|
||||||
|
$('#useForTapaDura').prop('disabled', false);
|
||||||
|
$('#useForTapaDura').prop('checked', false);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$('#useForTapaDura').prop('disabled', true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// Etiquetas para las tipologias
|
// Etiquetas para las tipologias
|
||||||
const tipoTypes = [
|
const tipoTypes = [
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
<th><?= lang('PapelImpresion.bn') ?></th>
|
<th><?= lang('PapelImpresion.bn') ?></th>
|
||||||
<th><?= lang('PapelImpresion.color') ?></th>
|
<th><?= lang('PapelImpresion.color') ?></th>
|
||||||
<th><?= lang('PapelImpresion.cubierta') ?></th>
|
<th><?= lang('PapelImpresion.cubierta') ?></th>
|
||||||
|
<th><?= lang('PapelImpresion.use_for_tapa_dura') ?></th>
|
||||||
<th><?= lang('PapelImpresion.sobrecubierta') ?></th>
|
<th><?= lang('PapelImpresion.sobrecubierta') ?></th>
|
||||||
<th><?= lang('PapelImpresion.guardas') ?></th>
|
<th><?= lang('PapelImpresion.guardas') ?></th>
|
||||||
<th><?= lang('PapelImpresion.inkjet') ?></th>
|
<th><?= lang('PapelImpresion.inkjet') ?></th>
|
||||||
@ -104,6 +105,7 @@
|
|||||||
{ 'data': 'bn' },
|
{ 'data': 'bn' },
|
||||||
{ 'data': 'color' },
|
{ 'data': 'color' },
|
||||||
{ 'data': 'cubierta' },
|
{ 'data': 'cubierta' },
|
||||||
|
{ 'data': 'use_for_tapa_dura'},
|
||||||
{ 'data': 'sobrecubierta' },
|
{ 'data': 'sobrecubierta' },
|
||||||
{ 'data': 'guardas' },
|
{ 'data': 'guardas' },
|
||||||
{ 'data': 'inkjet' },
|
{ 'data': 'inkjet' },
|
||||||
@ -116,7 +118,7 @@
|
|||||||
|
|
||||||
|
|
||||||
theTable.on( 'draw.dt', function () {
|
theTable.on( 'draw.dt', function () {
|
||||||
const boolCols = [3, 4, 5, 6, 7, 8, 9, 10, 11];
|
const boolCols = [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13];
|
||||||
for (let coln of boolCols) {
|
for (let coln of boolCols) {
|
||||||
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
||||||
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
||||||
|
|||||||
@ -777,7 +777,7 @@ function convertirTiempo(horas){
|
|||||||
// se convierte a formato hh:mm:ss
|
// se convierte a formato hh:mm:ss
|
||||||
const h = Math.floor(seconds / 3600);
|
const h = Math.floor(seconds / 3600);
|
||||||
const minutos = Math.floor((seconds % 3600) / 60);
|
const minutos = Math.floor((seconds % 3600) / 60);
|
||||||
const segundos = round(seconds % 60, 0);
|
const segundos = Math.round(seconds % 60, 0);
|
||||||
return h + ':' + minutos + ':' + segundos;
|
return h + ':' + minutos + ':' + segundos;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|||||||
@ -318,6 +318,8 @@
|
|||||||
|
|
||||||
init_servicio_extra()
|
init_servicio_extra()
|
||||||
|
|
||||||
|
/* ELIMINADO PARA COMPROBAR EL MAXIMO DE SOLAPAS DESDE EL BACKEND
|
||||||
|
PENDIENTE
|
||||||
$('.solapas_cubierta').on('change', function(){
|
$('.solapas_cubierta').on('change', function(){
|
||||||
|
|
||||||
const ancho_libro = getDimensionLibro().ancho;
|
const ancho_libro = getDimensionLibro().ancho;
|
||||||
@ -337,6 +339,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$('#compGramajeCubierta').trigger('change')
|
$('#compGramajeCubierta').trigger('change')
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -361,4 +364,6 @@
|
|||||||
$('#compGramajeSobrecubierta').trigger('change')
|
$('#compGramajeSobrecubierta').trigger('change')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|||||||
@ -54,7 +54,7 @@
|
|||||||
<label <?= (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) ? " hidden" : "" ?> id="label_clienteId" for="clienteId" class="form-label">
|
<label <?= (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) ? " hidden" : "" ?> id="label_clienteId" for="clienteId" class="form-label">
|
||||||
Cliente*
|
Cliente*
|
||||||
</label>
|
</label>
|
||||||
<select <?= (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) ? " hidden" : "" ?> id="clienteId" name="cliente_id" class="form-control select2bs2 calcular-presupuesto"
|
<select <?= (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) ? " hidden" : "" ?> id="clienteId" name="cliente_id" class="form-control select2bs2 calcular-presupuesto calcular-solapas"
|
||||||
style="width: 100%;">
|
style="width: 100%;">
|
||||||
<?php if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')): ?>
|
<?php if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')): ?>
|
||||||
<option value="<?= $clienteId ?>" selected>cliente</option>
|
<option value="<?= $clienteId ?>" selected>cliente</option>
|
||||||
@ -66,7 +66,7 @@
|
|||||||
<div
|
<div
|
||||||
class="col-sm-5 mb-3 d-flex flex-column align-items-center <?= (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) ? " d-none" : "" ?>">
|
class="col-sm-5 mb-3 d-flex flex-column align-items-center <?= (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) ? " d-none" : "" ?>">
|
||||||
<div class="form-check form-switch mb-2">
|
<div class="form-check form-switch mb-2">
|
||||||
<input <?= (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) ? " hidden" : "" ?> class="calcular-presupuesto form-check-input" type="checkbox" id="excluirRotativa"
|
<input <?= (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) ? " hidden" : "" ?> class=" calcular-solapas calcular-presupuesto form-check-input" type="checkbox" id="excluirRotativa"
|
||||||
name="excluir_rotativa" value="1">
|
name="excluir_rotativa" value="1">
|
||||||
<label <?= (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) ? " hidden" : "" ?> class="form-check-label" for="excluirRotativa">Excluir rotativa</label>
|
<label <?= (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) ? " hidden" : "" ?> class="form-check-label" for="excluirRotativa">Excluir rotativa</label>
|
||||||
</div>
|
</div>
|
||||||
@ -78,7 +78,7 @@
|
|||||||
<label for="tirada" class="form-label">
|
<label for="tirada" class="form-label">
|
||||||
<?= lang('Presupuestos.tirada') ?> 1*
|
<?= lang('Presupuestos.tirada') ?> 1*
|
||||||
</label>
|
</label>
|
||||||
<input type="number" class="calcular-presupuesto form-control text-center num-input" id="tirada"
|
<input type="number" class="calcular-presupuesto calcular-solapas form-control text-center num-input" id="tirada"
|
||||||
name="tirada" step="1" value="50">
|
name="tirada" step="1" value="50">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -86,7 +86,7 @@
|
|||||||
<label for="tirada2" class="form-label">
|
<label for="tirada2" class="form-label">
|
||||||
<?= lang('Presupuestos.tirada') ?> 2
|
<?= lang('Presupuestos.tirada') ?> 2
|
||||||
</label>
|
</label>
|
||||||
<input type="number" class="calcular-presupuesto form-control text-center num-input" id="tirada2"
|
<input type="number" class="calcular-presupuesto calcular-solapas form-control text-center num-input" id="tirada2"
|
||||||
name="tirada2" step="1" value="">
|
name="tirada2" step="1" value="">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -94,7 +94,7 @@
|
|||||||
<label for="tirada3" class="form-label">
|
<label for="tirada3" class="form-label">
|
||||||
<?= lang('Presupuestos.tirada') ?> 3
|
<?= lang('Presupuestos.tirada') ?> 3
|
||||||
</label>
|
</label>
|
||||||
<input type="number" class="calcular-presupuesto form-control text-center num-input" id="tirada3"
|
<input type="number" class="calcular-presupuesto calcular-solapas form-control text-center num-input" id="tirada3"
|
||||||
name="tirada3" step="1" value="">
|
name="tirada3" step="1" value="">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -102,7 +102,7 @@
|
|||||||
<label for="tirada4" class="form-label">
|
<label for="tirada4" class="form-label">
|
||||||
<?= lang('Presupuestos.tirada') ?> 4
|
<?= lang('Presupuestos.tirada') ?> 4
|
||||||
</label>
|
</label>
|
||||||
<input type="number" class="calcular-presupuesto form-control text-center num-input" id="tirada4"
|
<input type="number" class="calcular-presupuesto calcular-solapas form-control text-center num-input" id="tirada4"
|
||||||
name="tirada4" step="1" value="">
|
name="tirada4" step="1" value="">
|
||||||
</div>
|
</div>
|
||||||
</div> <!--//.row -->
|
</div> <!--//.row -->
|
||||||
@ -113,7 +113,7 @@
|
|||||||
<label id="label_papelFormatoId" for="papelFormatoId" class="form-label">
|
<label id="label_papelFormatoId" for="papelFormatoId" class="form-label">
|
||||||
Formato Libro*
|
Formato Libro*
|
||||||
</label>
|
</label>
|
||||||
<select id="papelFormatoId" name="papel_formato_id" class="form-control select2bs2 calcular-presupuesto"
|
<select id="papelFormatoId" name="papel_formato_id" class="form-control select2bs2 calcular-presupuesto calcular-solapas"
|
||||||
style="width: 100%;">
|
style="width: 100%;">
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -123,20 +123,20 @@
|
|||||||
<div class="col-sm-3 mb-1 mx-1 div-num-input">
|
<div class="col-sm-3 mb-1 mx-1 div-num-input">
|
||||||
<label class="form-label" for="papelFormatoAncho">Ancho Libro*</label>
|
<label class="form-label" for="papelFormatoAncho">Ancho Libro*</label>
|
||||||
<input type="number" id="papelFormatoAncho" name="papel_formato_ancho" step="1"
|
<input type="number" id="papelFormatoAncho" name="papel_formato_ancho" step="1"
|
||||||
class="form-control formato_libro calcular-presupuesto num-input" min="110" value="110">
|
class="form-control formato_libro calcular-presupuesto calcular-solapas num-input" min="110" value="110">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-3 mb-1 mx-1 div-num-input">
|
<div class="col-sm-3 mb-1 mx-1 div-num-input">
|
||||||
<label class="form-label" for="papelFormatoAlto">Alto Libro*</label>
|
<label class="form-label" for="papelFormatoAlto">Alto Libro*</label>
|
||||||
<input type="number" id="papelFormatoAlto" name="papel_formato_alto" step="1"
|
<input type="number" id="papelFormatoAlto" name="papel_formato_alto" step="1"
|
||||||
class="form-control formato_libro calcular-presupuesto num-input" min="170" value="170">
|
class="form-control formato_libro calcular-presupuesto calcular-solapas num-input" min="170" value="170">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row col-sm-4 mb-3 d-flex flex-column align-items-center">
|
<div class="row col-sm-4 mb-3 d-flex flex-column align-items-center">
|
||||||
<div class="form-check form-switch mb-2">
|
<div class="form-check form-switch mb-2">
|
||||||
<input class="calcular-presupuesto form-check-input" type="checkbox" id="papelFormatoPersonalizado"
|
<input class="calcular-presupuesto calcular-solapas form-check-input" type="checkbox" id="papelFormatoPersonalizado"
|
||||||
name="papel_formato_personalizado" value="1">
|
name="papel_formato_personalizado" value="1">
|
||||||
<label class="form-check-label"
|
<label class="form-check-label"
|
||||||
for="papelFormatoPersonalizado"><?= lang('Presupuestos.papelFormatoPersonalizado') ?></label>
|
for="papelFormatoPersonalizado"><?= lang('Presupuestos.papelFormatoPersonalizado') ?></label>
|
||||||
@ -153,7 +153,7 @@
|
|||||||
<label for="paginasColor" class="form-label">
|
<label for="paginasColor" class="form-label">
|
||||||
<?= lang('Presupuestos.paginasColor') ?>
|
<?= lang('Presupuestos.paginasColor') ?>
|
||||||
</label>
|
</label>
|
||||||
<input type="number" class="form-control calcular-presupuesto input-paginas num-input" id="paginasColor"
|
<input type="number" class="form-control calcular-presupuesto calcular-solapas input-paginas num-input" id="paginasColor"
|
||||||
name="paginasColor" step="1" value="0">
|
name="paginasColor" step="1" value="0">
|
||||||
|
|
||||||
<div class="form-text">
|
<div class="form-text">
|
||||||
@ -166,7 +166,7 @@
|
|||||||
<label for="paginasNegro" class="form-label">
|
<label for="paginasNegro" class="form-label">
|
||||||
<?= lang('Presupuestos.paginasNegro') ?>
|
<?= lang('Presupuestos.paginasNegro') ?>
|
||||||
</label>
|
</label>
|
||||||
<input type="number" class="form-control calcular-presupuesto input-paginas num-input" id="paginasNegro"
|
<input type="number" class="form-control calcular-presupuesto calcular-solapas input-paginas num-input" id="paginasNegro"
|
||||||
name="paginasNegro" step="1" value="32">
|
name="paginasNegro" step="1" value="32">
|
||||||
|
|
||||||
<div class="form-text">
|
<div class="form-text">
|
||||||
@ -179,7 +179,7 @@
|
|||||||
<label for="paginas" class="form-label">
|
<label for="paginas" class="form-label">
|
||||||
<?= lang('Presupuestos.totalPaginas') ?>
|
<?= lang('Presupuestos.totalPaginas') ?>
|
||||||
</label>
|
</label>
|
||||||
<input disabled class="form-control calcular-presupuesto" id="paginas" name="paginas" step="1"
|
<input disabled class="form-control" id="paginas" name="paginas" step="1"
|
||||||
value="32">
|
value="32">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -234,28 +234,28 @@
|
|||||||
|
|
||||||
<div id="divTipoLibro" name="div_tipo_libro" class="row col-sm-10 mb-3 justify-content-center">
|
<div id="divTipoLibro" name="div_tipo_libro" class="row col-sm-10 mb-3 justify-content-center">
|
||||||
|
|
||||||
<div id="fresado" class="tipo-libro calcular-presupuesto imagen-selector image-container">
|
<div id="fresado" class="tipo-libro calcular-solapas calcular-presupuesto imagen-selector image-container">
|
||||||
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/fresado.png") ?>"
|
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/fresado.png") ?>"
|
||||||
alt="Fresado">
|
alt="Fresado">
|
||||||
<div class="form-text text-center">
|
<div class="form-text text-center">
|
||||||
Fresado (a partir de 32 páginas)
|
Fresado (a partir de 32 páginas)
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="grapado" class="tipo-libro calcular-presupuesto imagen-selector image-container">
|
<div id="grapado" class="tipo-libro calcular-solapas calcular-presupuesto imagen-selector image-container">
|
||||||
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/grapado.png") ?>"
|
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/grapado.png") ?>"
|
||||||
alt="Grapado">
|
alt="Grapado">
|
||||||
<div class="form-text text-center">
|
<div class="form-text text-center">
|
||||||
Grapado (entre 12 y 40 páginas)
|
Grapado (entre 12 y 40 páginas)
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="espiral" class="tipo-libro calcular-presupuesto imagen-selector image-container">
|
<div id="espiral" class="tipo-libro calcular-solapas calcular-presupuesto imagen-selector image-container">
|
||||||
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/espiral.png") ?>"
|
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/espiral.png") ?>"
|
||||||
alt="Espiral">
|
alt="Espiral">
|
||||||
<div class="form-text text-center">
|
<div class="form-text text-center">
|
||||||
Espiral
|
Espiral
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="cosido" class="tipo-libro calcular-presupuesto imagen-selector image-container">
|
<div id="cosido" class="tipo-libro calcular-solapas calcular-presupuesto imagen-selector image-container">
|
||||||
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/cosido.png") ?>"
|
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/cosido.png") ?>"
|
||||||
alt="Cosido">
|
alt="Cosido">
|
||||||
<div class="form-text text-center">
|
<div class="form-text text-center">
|
||||||
|
|||||||
@ -91,7 +91,7 @@
|
|||||||
</label>
|
</label>
|
||||||
<input id="solapasCubierta" name="solapas_cubierta" type="number"
|
<input id="solapasCubierta" name="solapas_cubierta" type="number"
|
||||||
class="calcular-presupuesto form-control text-center num-input" min="60" max="120" step="1" value="60">
|
class="calcular-presupuesto form-control text-center num-input" min="60" max="120" step="1" value="60">
|
||||||
<div class="form-text">
|
<div id="textoSolapasCubierta" class="form-text">
|
||||||
Entre 60 y 120 mm
|
Entre 60 y 120 mm
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -138,101 +138,29 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
|
<div id="textoPapelCubierta" class="col-sm-8 mb-3 d-flex flex-column align-items-center d-none">
|
||||||
<h3 class="mb-1 fw-bold"> Papel cubierta </h3>
|
<h3 class="mb-1 fw-bold"> Papel cubierta </h3>
|
||||||
</div><!--//.mb-3 -->
|
</div><!--//.mb-3 -->
|
||||||
|
|
||||||
<div id="divPapelCubierta" name="div_papel_cubierta" class="row col-sm-10 mb-5 justify-content-center">
|
<div id="divPapelCubierta" name="div_papel_cubierta" class="row col-sm-10 mb-5 justify-content-center">
|
||||||
|
|
||||||
<div id="cartulinaEstucada" cod="CAR1"
|
|
||||||
class="calcular-presupuesto min-width-fit d-flex flex-column align-items-center justify-content-center papel-cubierta imagen-selector image-container">
|
|
||||||
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/cartulina-grafica.png") ?>"
|
|
||||||
alt="Cartulina estucada">
|
|
||||||
<label class="form-label">
|
|
||||||
Cartulina gráfica estucada a una cara
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="estucadoMate" cod="EST2"
|
|
||||||
class="calcular-presupuesto min-width-fit d-flex flex-column align-items-center justify-content-center papel-cubierta imagen-selector image-container">
|
|
||||||
<img class="image-presupuesto"
|
|
||||||
src="<?= site_url("assets/img/presupuestoCliente/estucado-mate-cubierta.png") ?>" alt="Estucado mate">
|
|
||||||
<label class="form-label">
|
|
||||||
Estucado Mate
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="divPapelEspecialCubierta" name="div_papel_especial_cubierta"
|
||||||
|
class="row col-sm-10 mb-3 justify-content-center d-none">
|
||||||
|
<div class="col-sm-5 mb-0">
|
||||||
|
<label for="titulo" class="form-label">
|
||||||
|
Seleccione el papel especial
|
||||||
|
</label>
|
||||||
|
<select id="papelEspecialCubiertaSel" name="papel_especial_cubierta"
|
||||||
|
class="form-control select2bs2 calcular-presupuesto col-5 mb-0">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="divGramajeCubierta" name="div_gramaje_cubierta" class="row col-sm-10 mb-3 justify-content-center d-none">
|
<div id="divGramajeCubierta" name="div_gramaje_cubierta" class="row col-sm-10 mb-3 justify-content-center d-none">
|
||||||
|
|
||||||
|
|
||||||
<div id="divGramaje170Cubierta" class="checkbox-presupuesto-container col-md mb-md-0 mb-2">
|
|
||||||
<div class="form-check custom-option custom-option-icon gramaje-cubierta">
|
|
||||||
<label class="form-check-label custom-option-content" for="gramaje170Cubierta">
|
|
||||||
<span class="custom-option-body">
|
|
||||||
<span class="custom-option-title"> 170 gr </span>
|
|
||||||
</span>
|
|
||||||
<input id="gramaje170Cubierta" name="gramajeCubiertaRadio" data-value="170"
|
|
||||||
class="check-gramaje-cubierta calcular-presupuesto form-check-input" type="radio" value="170" />
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="divGramaje250Cubierta" class="checkbox-presupuesto-container col-md mb-md-0 mb-2">
|
|
||||||
<div class="form-check custom-option custom-option-icon gramaje-cubierta">
|
|
||||||
<label class="form-check-label custom-option-content" for="gramaje250Cubierta">
|
|
||||||
<span class="custom-option-body">
|
|
||||||
<span class="custom-option-title"> 250 gr </span>
|
|
||||||
</span>
|
|
||||||
<input id="gramaje250Cubierta" name="gramajeCubiertaRadio" data-value="250"
|
|
||||||
class="check-gramaje-cubierta calcular-presupuesto form-check-input" type="radio" value="250" />
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="divGramaje270Cubierta" class="checkbox-presupuesto-container col-md mb-md-0 mb-2">
|
|
||||||
<div class="form-check custom-option custom-option-icon gramaje-cubierta">
|
|
||||||
<label class="form-check-label custom-option-content" for="gramaje270Cubierta">
|
|
||||||
<span class="custom-option-body">
|
|
||||||
<span class="custom-option-title"> 270 gr </span>
|
|
||||||
</span>
|
|
||||||
<input id="gramaje270Cubierta" name="gramajeCubiertaRadio" data-value="270"
|
|
||||||
class="check-gramaje-cubierta calcular-presupuesto form-check-input" type="radio" value="270" />
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="divGramaje300Cubierta" class="checkbox-presupuesto-container col-md mb-md-0 mb-2">
|
|
||||||
<div class="form-check custom-option custom-option-icon gramaje-cubierta">
|
|
||||||
<label class="form-check-label custom-option-content" for="gramaje300Cubierta">
|
|
||||||
<span class="custom-option-body">
|
|
||||||
<span class="custom-option-title"> 300 gr </span>
|
|
||||||
</span>
|
|
||||||
<input id="gramaje300Cubierta" name="gramajeCubiertaRadio" data-value="300"
|
|
||||||
class="check-gramaje-cubierta calcular-presupuesto form-check-input" type="radio" value="300" />
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-text">
|
|
||||||
Recomendado
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="divGramaje350Cubierta" class="checkbox-presupuesto-container col-md mb-md-0 mb-2">
|
|
||||||
<div class="form-check custom-option custom-option-icon gramaje-cubierta">
|
|
||||||
<label class="form-check-label custom-option-content" for="gramaje350Cubierta">
|
|
||||||
<span class="custom-option-body">
|
|
||||||
<span class="custom-option-title"> 350 gr </span>
|
|
||||||
</span>
|
|
||||||
<input id="gramaje350Cubierta" name="gramajeCubiertaRadio" data-value="350"
|
|
||||||
class="check-gramaje-cubierta calcular-presupuesto form-check-input" type="radio" value="350" />
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<hr class="col-sm-10 my-10">
|
<hr class="col-sm-10 my-10">
|
||||||
|
|
||||||
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
|
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
|
||||||
@ -333,7 +261,7 @@
|
|||||||
<input id="solapasSobrecubierta" name="solapas_sobrecubierta" type="number"
|
<input id="solapasSobrecubierta" name="solapas_sobrecubierta" type="number"
|
||||||
class="calcular-presupuesto form-control text-center num-input" min="60" max="120" step="1"
|
class="calcular-presupuesto form-control text-center num-input" min="60" max="120" step="1"
|
||||||
value="60">
|
value="60">
|
||||||
<div class="form-text">
|
<div id="textoLimitesSolapasSobrecubierta" class="form-text">
|
||||||
Entre 60 y 120 mm
|
Entre 60 y 120 mm
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -65,7 +65,7 @@
|
|||||||
Seleccione el papel especial
|
Seleccione el papel especial
|
||||||
</label>
|
</label>
|
||||||
<select id="papelEspecialInterior" name="papel_especial_interior"
|
<select id="papelEspecialInterior" name="papel_especial_interior"
|
||||||
class="form-control select2bs2 calcular-presupuesto col-5 mb-0">
|
class="form-control select2bs2 calcular-solapas calcular-presupuesto col-5 mb-0">
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -120,7 +120,7 @@
|
|||||||
Seleccione el papel especial
|
Seleccione el papel especial
|
||||||
</label>
|
</label>
|
||||||
<select id="papelEspecialInteriorColor" name="papel_especial_interior_color"
|
<select id="papelEspecialInteriorColor" name="papel_especial_interior_color"
|
||||||
class="form-control select2bs2 calcular-presupuesto col-5 mb-0">
|
class="form-control select2bs2 calcular-solapas calcular-presupuesto col-5 mb-0">
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,20 +1,44 @@
|
|||||||
|
import { getToken } from '../../common/common.js';
|
||||||
|
import { capitalizeFirstLetter } from '../../common/common.js';
|
||||||
|
|
||||||
|
import Ajax from '../../components/ajax.js';
|
||||||
|
import ClassSelect from '../../components/select2.js';
|
||||||
|
|
||||||
|
|
||||||
class DisenioCubierta {
|
class DisenioCubierta {
|
||||||
|
|
||||||
constructor(domItem, wizardForm, validatorStepper) {
|
constructor(domItem, wizardForm, validatorStepper, presupuestoCliente) {
|
||||||
|
|
||||||
this.domItem = domItem;
|
this.domItem = domItem;
|
||||||
this.allowNext = true;
|
this.allowNext = true;
|
||||||
|
|
||||||
|
this.presupuestoCliente = presupuestoCliente;
|
||||||
|
|
||||||
|
this.csrf_token = getToken();
|
||||||
|
this.csrf_hash = $('#mainContainer').find('input[name="' + this.csrf_token + '"]').val();
|
||||||
|
|
||||||
this.wizardStep = wizardForm.querySelector('#cubierta-libro');
|
this.wizardStep = wizardForm.querySelector('#cubierta-libro');
|
||||||
this.validatorStepper = validatorStepper;
|
this.validatorStepper = validatorStepper;
|
||||||
|
|
||||||
this.disenioCubierta = this.domItem.find(".tipo-cubierta");
|
this.disenioCubierta = this.domItem.find(".tipo-cubierta");
|
||||||
this.solapasCubierta = this.domItem.find(".solapas-cubierta");
|
this.solapasCubierta = this.domItem.find(".solapas-cubierta");
|
||||||
this.papelCubierta = this.domItem.find(".papel-cubierta");
|
this.textoPapelCubierta = this.domItem.find("#textoPapelCubierta");
|
||||||
|
|
||||||
|
this.divPapelEspecial = this.domItem.find("#divPapelEspecialCubierta");
|
||||||
|
this.papelEspecial = new ClassSelect($("#papelEspecialCubiertaSel"),
|
||||||
|
'/papelesgenericos/selectpapelespecial',
|
||||||
|
window.translations["selectPapel"],
|
||||||
|
false,
|
||||||
|
{
|
||||||
|
[this.csrf_token]: this.csrf_hash,
|
||||||
|
tipo: 'colorhq',
|
||||||
|
cubierta: 1,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
this.divSolapas = this.domItem.find("#divSolapasCubierta");
|
this.divSolapas = this.domItem.find("#divSolapasCubierta");
|
||||||
this.divCarasImpresion = this.domItem.find("#divCarasImpresion");
|
this.divCarasImpresion = this.domItem.find("#divCarasImpresion");
|
||||||
this.divConfigGuardas = this.domItem.find("#divConfigGuardas");
|
this.divConfigGuardas = this.domItem.find("#divConfigTapaDura");
|
||||||
|
|
||||||
this.carasCubierta = this.domItem.find("#carasCubierta");
|
this.carasCubierta = this.domItem.find("#carasCubierta");
|
||||||
|
|
||||||
@ -25,6 +49,7 @@ class DisenioCubierta {
|
|||||||
this.sinSolapas = this.domItem.find("#solapasCubiertaNo");
|
this.sinSolapas = this.domItem.find("#solapasCubiertaNo");
|
||||||
this.conSolapas = this.domItem.find("#solapasCubiertaSi");
|
this.conSolapas = this.domItem.find("#solapasCubiertaSi");
|
||||||
this.divTamanioSolapas = this.domItem.find("#divTamanioSolapas");
|
this.divTamanioSolapas = this.domItem.find("#divTamanioSolapas");
|
||||||
|
this.textoSolapasCubierta = this.domItem.find("#textoSolapasCubierta");
|
||||||
this.tamanioSolapasCubierta = $(this.domItem.find("#solapasCubierta"));
|
this.tamanioSolapasCubierta = $(this.domItem.find("#solapasCubierta"));
|
||||||
|
|
||||||
this.papelGuardas = this.domItem.find("#papelGuardas");
|
this.papelGuardas = this.domItem.find("#papelGuardas");
|
||||||
@ -35,16 +60,7 @@ class DisenioCubierta {
|
|||||||
this.estucadoMate = this.domItem.find("#estucadoMate");
|
this.estucadoMate = this.domItem.find("#estucadoMate");
|
||||||
|
|
||||||
this.divPapelCubierta = this.domItem.find("#divPapelCubierta");
|
this.divPapelCubierta = this.domItem.find("#divPapelCubierta");
|
||||||
|
|
||||||
this.divGramajeCubierta = this.domItem.find("#divGramajeCubierta");
|
this.divGramajeCubierta = this.domItem.find("#divGramajeCubierta");
|
||||||
this.gramaje = this.domItem.find(".check-gramaje-cubierta");
|
|
||||||
this.gramaje170 = $(this.domItem.find("#divGramaje170Cubierta"));
|
|
||||||
this.gramaje250 = $(this.domItem.find("#divGramaje250Cubierta"));
|
|
||||||
this.gramaje270 = $(this.domItem.find("#divGramaje270Cubierta"));
|
|
||||||
this.gramaje300 = $(this.domItem.find("#divGramaje300Cubierta"));
|
|
||||||
this.gramaje350 = $(this.domItem.find("#divGramaje350Cubierta"));
|
|
||||||
|
|
||||||
this.checksGramaje = $('.check-gramaje-cubierta');
|
|
||||||
|
|
||||||
this.cubiertaPlastificado = this.domItem.find("#plastificado");
|
this.cubiertaPlastificado = this.domItem.find("#plastificado");
|
||||||
this.cubiertaBarniz = this.domItem.find("#barniz");
|
this.cubiertaBarniz = this.domItem.find("#barniz");
|
||||||
@ -60,6 +76,7 @@ class DisenioCubierta {
|
|||||||
this.faja = this.domItem.find("#addFaja");
|
this.faja = this.domItem.find("#addFaja");
|
||||||
|
|
||||||
this.solapasSobrecubierta = this.domItem.find("#solapasSobrecubierta");
|
this.solapasSobrecubierta = this.domItem.find("#solapasSobrecubierta");
|
||||||
|
this.textoSolapasSobrecubierta = this.domItem.find("#textoLimitesSolapasSobrecubierta");
|
||||||
this.solapasFaja = this.domItem.find("#solapasFaja");
|
this.solapasFaja = this.domItem.find("#solapasFaja");
|
||||||
this.altoFaja = this.domItem.find("#altoFaja");
|
this.altoFaja = this.domItem.find("#altoFaja");
|
||||||
|
|
||||||
@ -91,12 +108,14 @@ class DisenioCubierta {
|
|||||||
else if (targetElement.classList.contains('solapas-cubierta')) {
|
else if (targetElement.classList.contains('solapas-cubierta')) {
|
||||||
this.#handleMenuSolapas();
|
this.#handleMenuSolapas();
|
||||||
}
|
}
|
||||||
else if (targetElement.classList.contains('papel-cubierta')) {
|
|
||||||
this.#handleMenuPapel();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.papelCubierta = null;
|
||||||
|
this.gramaje = null;
|
||||||
|
|
||||||
|
this.cargando = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -104,10 +123,12 @@ class DisenioCubierta {
|
|||||||
|
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
|
this.papelEspecial.init();
|
||||||
|
$('#papelEspecialCubiertaSel').on("change", this.#handlePapelCubiertaEspecial.bind(this));
|
||||||
|
|
||||||
// Eventos
|
// Eventos
|
||||||
this.disenioCubierta.on('click', this.#handleDisenioCubierta.bind(this));
|
this.disenioCubierta.on('click', this.#handleDisenioCubierta.bind(this));
|
||||||
this.solapasCubierta.on('click', this.#handleSolapasCubierta.bind(this));
|
this.solapasCubierta.on('click', this.#handleSolapasCubierta.bind(this));
|
||||||
this.papelCubierta.on('click', this.#handlePapelCubierta.bind(this));
|
|
||||||
this.tamanioSolapasCubierta.on('change', this.#handleTamanioSolapas.bind(this));
|
this.tamanioSolapasCubierta.on('change', this.#handleTamanioSolapas.bind(this));
|
||||||
this.altoFaja.on('blur', this.#handleInputs);
|
this.altoFaja.on('blur', this.#handleInputs);
|
||||||
this.solapasSobrecubierta.on('blur', this.#handleInputs);
|
this.solapasSobrecubierta.on('blur', this.#handleInputs);
|
||||||
@ -129,23 +150,16 @@ class DisenioCubierta {
|
|||||||
this.observer.observe(this.tapaBlanda[0], { attributes: true });
|
this.observer.observe(this.tapaBlanda[0], { attributes: true });
|
||||||
this.observer.observe(this.tapaDuraLomoRecto[0], { attributes: true });
|
this.observer.observe(this.tapaDuraLomoRecto[0], { attributes: true });
|
||||||
this.observer.observe(this.tapaDuraLomoRedondo[0], { attributes: true });
|
this.observer.observe(this.tapaDuraLomoRedondo[0], { attributes: true });
|
||||||
this.observer.observe(this.cartulinaEstucada[0], { attributes: true });
|
|
||||||
this.observer.observe(this.estucadoMate[0], { attributes: true });
|
|
||||||
this.observer.observe(this.conSolapas[0], { attributes: true });
|
this.observer.observe(this.conSolapas[0], { attributes: true });
|
||||||
this.observer.observe(this.sinSolapas[0], { attributes: true });
|
this.observer.observe(this.sinSolapas[0], { attributes: true });
|
||||||
|
|
||||||
this.checksGramaje.each(function () {
|
|
||||||
|
|
||||||
const customOptionEL = $(this);
|
|
||||||
customOptionEL.on('click', function () {
|
|
||||||
self.#handleClickGramaje(customOptionEL);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cargarDatos(datosCubierta, datosGuardas, datosSobrecubierta) {
|
cargarDatos(datosCubierta, datosGuardas, datosSobrecubierta) {
|
||||||
|
|
||||||
|
this.papelCubierta = datosCubierta.papel.id;
|
||||||
|
this.gramaje = datosCubierta.gramaje;
|
||||||
|
|
||||||
if (datosCubierta.lomoRedondo) {
|
if (datosCubierta.lomoRedondo) {
|
||||||
this.tapaDuraLomoRedondo.trigger('click');
|
this.tapaDuraLomoRedondo.trigger('click');
|
||||||
}
|
}
|
||||||
@ -259,17 +273,19 @@ class DisenioCubierta {
|
|||||||
validators: {
|
validators: {
|
||||||
callback: {
|
callback: {
|
||||||
callback: function (input) {
|
callback: function (input) {
|
||||||
const div = $('#divPapelCubierta');
|
|
||||||
if (div.hasClass("d-none")) return true;
|
|
||||||
|
|
||||||
div.find('.fv-plugins-message-container').remove();
|
$('#divPapelCubierta').find('.fv-plugins-message-container').remove();
|
||||||
if ($('.papel-cubierta.selected').length > 0) {
|
$('#divPapelEspecialCubierta').find('.fv-plugins-message-container').remove();
|
||||||
|
|
||||||
|
const papelSeleccionado = $('.custom-selector-papel-cubierta input[type="radio"]:checked');
|
||||||
|
if (papelSeleccionado.length > 0) {
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
div.append(`
|
$('#divPapelCubierta').append(`
|
||||||
<div class="fv-plugins-message-container invalid-feedback">
|
<div class="fv-plugins-message-container invalid-feedback">
|
||||||
<div data-field="div_papel_cubierta" data-validator="callback" style="margin-top: 50px;">
|
<div data-field="div_impresion_interior" data-validator="callback" style="margin-top: 50px;">
|
||||||
${window.translations["validation"].papel_interior}
|
${window.translations["validation"].papel_interior}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -280,20 +296,48 @@ class DisenioCubierta {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
div_papel_especial_cubierta: {
|
||||||
|
validators: {
|
||||||
|
callback: {
|
||||||
|
callback: function (input) {
|
||||||
|
|
||||||
|
$('#divPapelEspecialCubierta').find('.fv-plugins-message-container').remove();
|
||||||
|
if ($('#divPapelEspecialCubierta').hasClass("d-none")) return true;
|
||||||
|
|
||||||
|
if ($('#papelEspecialCubiertaSel').select2('data').length > 0)
|
||||||
|
return true;
|
||||||
|
else {
|
||||||
|
$('#divPapelEspecialCubierta').append(`
|
||||||
|
<div class="fv-plugins-message-container invalid-feedback">
|
||||||
|
<div data-field="div_impresion_interior" data-validator="callback" style="margin-top: 50px;">
|
||||||
|
${window.translations["validation"].papel_interior}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
div_gramaje_cubierta: {
|
div_gramaje_cubierta: {
|
||||||
validators: {
|
validators: {
|
||||||
callback: {
|
callback: {
|
||||||
callback: function (input) {
|
callback: function (input) {
|
||||||
const div = $('#divGramajeCubierta'); // Selecciona el div
|
|
||||||
|
|
||||||
div.find('.fv-plugins-message-container').remove();
|
const divGramajeInterior = $('#divGramajeCubierta'); // Selecciona el div
|
||||||
if ($('.check-gramaje-cubierta:checked').length > 0) {
|
divGramajeInterior.find('.fv-plugins-message-container').remove();
|
||||||
|
|
||||||
|
const gramajeSeleccionado = $('.custom-selector-gramaje-cubierta input[type="radio"]:checked');
|
||||||
|
if (gramajeSeleccionado.length > 0) {
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
div.append(`
|
divGramajeInterior.append(`
|
||||||
<div class="fv-plugins-message-container invalid-feedback">
|
<div class="fv-plugins-message-container invalid-feedback">
|
||||||
<div data-field="div_gramaje_cubierta" data-validator="callback" style="margin-top: 50px;">
|
<div data-field="div_impresion_interior" data-validator="callback" style="margin-top: 50px;">
|
||||||
${window.translations["validation"].gramaje_interior}
|
${window.translations["validation"].gramaje_interior}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -319,6 +363,7 @@ class DisenioCubierta {
|
|||||||
case 'div_solapas_cubierta':
|
case 'div_solapas_cubierta':
|
||||||
case 'div_papel_cubierta':
|
case 'div_papel_cubierta':
|
||||||
case 'div_gramaje_cubierta':
|
case 'div_gramaje_cubierta':
|
||||||
|
case 'div_papel_especial_cubierta':
|
||||||
return '.col-sm-10';
|
return '.col-sm-10';
|
||||||
default:
|
default:
|
||||||
return '.col-sm-3';
|
return '.col-sm-3';
|
||||||
@ -339,25 +384,28 @@ class DisenioCubierta {
|
|||||||
|
|
||||||
let menu_off = true;
|
let menu_off = true;
|
||||||
|
|
||||||
if($('.papel-cubierta.selected').length>0 && this.getGramaje() != null){
|
const papel = this.getPapel(true);
|
||||||
this.rl_papel_cubierta.text($($('.papel-cubierta.selected').find('.form-label')).text() + " " +
|
const gramaje = this.getGramaje();
|
||||||
this.getGramaje() + " gr");
|
|
||||||
|
if (papel != null && gramaje != null) {
|
||||||
|
|
||||||
|
this.rl_papel_cubierta.text(papel + " " + gramaje + " gr");
|
||||||
this.rl_acabado_cubierta.text(this.domItem.find("#plastificado").children("option:selected").text());
|
this.rl_acabado_cubierta.text(this.domItem.find("#plastificado").children("option:selected").text());
|
||||||
this.rl_papel_cubierta.removeClass('d-none');
|
this.rl_papel_cubierta.removeClass('d-none');
|
||||||
this.rl_acabado_cubierta.removeClass('d-none');
|
this.rl_acabado_cubierta.removeClass('d-none');
|
||||||
|
|
||||||
if(this.carasCubierta.find('option:selected').length>0){
|
if (this.carasCubierta.find('option:selected').length > 0) {
|
||||||
this.rl_caras_cubierta.text("Impresa " + this.carasCubierta.find('option:selected').text());
|
this.rl_caras_cubierta.text("Impresa " + this.carasCubierta.find('option:selected').text());
|
||||||
this.rl_caras_cubierta.removeClass('d-none');
|
this.rl_caras_cubierta.removeClass('d-none');
|
||||||
menu_off = false;
|
menu_off = false;
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
this.rl_caras_cubierta.addClass('d-none');
|
this.rl_caras_cubierta.addClass('d-none');
|
||||||
}
|
}
|
||||||
|
|
||||||
menu_off = false;
|
menu_off = false;
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
this.rl_papel_cubierta.addClass('d-none');
|
this.rl_papel_cubierta.addClass('d-none');
|
||||||
this.rl_acabado_cubierta.addClass('d-none');
|
this.rl_acabado_cubierta.addClass('d-none');
|
||||||
}
|
}
|
||||||
@ -368,15 +416,15 @@ class DisenioCubierta {
|
|||||||
this.rl_cubierta.addClass('d-none');
|
this.rl_cubierta.addClass('d-none');
|
||||||
|
|
||||||
// Sobrecubierta solo se muestra si cubierta ok
|
// Sobrecubierta solo se muestra si cubierta ok
|
||||||
if(!this.rl_cubierta.hasClass('d-none')){
|
if (!this.rl_cubierta.hasClass('d-none')) {
|
||||||
this.rl_sobrecubierta.removeClass('d-none');
|
this.rl_sobrecubierta.removeClass('d-none');
|
||||||
if(!this.sobrecubierta.is(":checked")){
|
if (!this.sobrecubierta.is(":checked")) {
|
||||||
this.rl_no_sobrecubierta.removeClass('d-none');
|
this.rl_no_sobrecubierta.removeClass('d-none');
|
||||||
this.rl_papel_sobrecubierta.addClass('d-none');
|
this.rl_papel_sobrecubierta.addClass('d-none');
|
||||||
this.rl_tamanio_sobrecubierta.addClass('d-none');
|
this.rl_tamanio_sobrecubierta.addClass('d-none');
|
||||||
this.rl_acabado_sobrecubierta.addClass('d-none');
|
this.rl_acabado_sobrecubierta.addClass('d-none');
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
this.rl_no_sobrecubierta.addClass('d-none');
|
this.rl_no_sobrecubierta.addClass('d-none');
|
||||||
this.rl_papel_sobrecubierta.removeClass('d-none');
|
this.rl_papel_sobrecubierta.removeClass('d-none');
|
||||||
this.rl_tamanio_sobrecubierta.removeClass('d-none');
|
this.rl_tamanio_sobrecubierta.removeClass('d-none');
|
||||||
@ -386,12 +434,12 @@ class DisenioCubierta {
|
|||||||
this.rl_papel_sobrecubierta.text(sobrecubierta.papel + " " + sobrecubierta.gramaje + " gr")
|
this.rl_papel_sobrecubierta.text(sobrecubierta.papel + " " + sobrecubierta.gramaje + " gr")
|
||||||
this.rl_tamanio_sobrecubierta.text("Solapas: " + sobrecubierta.solapas + " mm")
|
this.rl_tamanio_sobrecubierta.text("Solapas: " + sobrecubierta.solapas + " mm")
|
||||||
let acabado_text = sobrecubierta.plastificado;
|
let acabado_text = sobrecubierta.plastificado;
|
||||||
if(acabado_text.includes("Sin plastificar"))
|
if (acabado_text.includes("Sin plastificar"))
|
||||||
acabado_text = "Sin plastificar";
|
acabado_text = "Sin plastificar";
|
||||||
this.rl_acabado_sobrecubierta.text(acabado_text);
|
this.rl_acabado_sobrecubierta.text(acabado_text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
this.rl_sobrecubierta.addClass('d-none');
|
this.rl_sobrecubierta.addClass('d-none');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,11 +467,30 @@ class DisenioCubierta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
getPapel() {
|
getPapel(forResumen = false) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (this.papelCubierta.filter('.selected').length > 0) {
|
let checkedPapel = $('.custom-selector-papel-cubierta input[type="radio"]:checked');
|
||||||
return this.papelCubierta.filter('.selected').attr('cod');
|
if (this.papelCubierta != null && checkedPapel != null && checkedPapel.length > 0) {
|
||||||
|
if (forResumen) {
|
||||||
|
|
||||||
|
if (checkedPapel.length == 0)
|
||||||
|
return null;
|
||||||
|
let radioButtonId = checkedPapel[0].id;
|
||||||
|
if (radioButtonId == 'papelEspecialCubierta')
|
||||||
|
return capitalizeFirstLetter(this.papelEspecial.getText());
|
||||||
|
else {
|
||||||
|
let associatedLabel = $('label[for="' + radioButtonId + '"]');
|
||||||
|
return capitalizeFirstLetter($(associatedLabel[0]).text().toLocaleLowerCase());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (this.divPapelEspecial.hasClass('d-none'))
|
||||||
|
return this.papelCubierta;
|
||||||
|
else {
|
||||||
|
return this.papelEspecial.getVal();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -435,17 +502,13 @@ class DisenioCubierta {
|
|||||||
|
|
||||||
getGramaje() {
|
getGramaje() {
|
||||||
|
|
||||||
|
let checkedGramaje = $('.custom-selector-gramaje-cubierta input[type="radio"]:checked');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (this.divGramajeCubierta.hasClass("d-none"))
|
if (checkedGramaje.length == 0)
|
||||||
return null;
|
return null;
|
||||||
|
return checkedGramaje[0].id.split('_')[1];
|
||||||
if (this.gramaje.filter(':checked').length > 0)
|
|
||||||
return this.gramaje.filter(':checked').attr('data-value');
|
|
||||||
|
|
||||||
else
|
|
||||||
return null;
|
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -606,8 +669,6 @@ class DisenioCubierta {
|
|||||||
element.closest(class2Find).toggleClass('selected');
|
element.closest(class2Find).toggleClass('selected');
|
||||||
element.closest('.image-presupuesto').toggleClass('selected');
|
element.closest('.image-presupuesto').toggleClass('selected');
|
||||||
|
|
||||||
$(".papel-cubierta").removeClass("selected");
|
|
||||||
|
|
||||||
if (this.tapaBlanda.hasClass("selected")) {
|
if (this.tapaBlanda.hasClass("selected")) {
|
||||||
if (this.carasCubierta.val() == 2) {
|
if (this.carasCubierta.val() == 2) {
|
||||||
this.cartulinaEstucada.removeClass("d-none");
|
this.cartulinaEstucada.removeClass("d-none");
|
||||||
@ -618,12 +679,6 @@ class DisenioCubierta {
|
|||||||
this.cartulinaEstucada.addClass("d-none");
|
this.cartulinaEstucada.addClass("d-none");
|
||||||
this.estucadoMate.addClass("selected");
|
this.estucadoMate.addClass("selected");
|
||||||
this.divGramajeCubierta.removeClass("d-none");
|
this.divGramajeCubierta.removeClass("d-none");
|
||||||
this.gramaje170.removeClass("d-none");
|
|
||||||
this.gramaje170.closest(".checkbox-presupuesto-container").addClass("checked");
|
|
||||||
this.gramaje250.addClass("d-none");
|
|
||||||
this.gramaje270.addClass("d-none");
|
|
||||||
this.gramaje300.addClass("d-none");
|
|
||||||
this.gramaje350.addClass("d-none");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
element.trigger('change');
|
element.trigger('change');
|
||||||
@ -651,26 +706,6 @@ class DisenioCubierta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#handlePapelCubierta(event) {
|
|
||||||
// Accede al ID del elemento que disparó el evento
|
|
||||||
const element = $(event.target);
|
|
||||||
|
|
||||||
let class2Find = '.papel-cubierta';
|
|
||||||
|
|
||||||
let containers = element.closest(class2Find).parent().find(class2Find);
|
|
||||||
for (let container of containers) {
|
|
||||||
if (container != element.closest(class2Find)[0]) {
|
|
||||||
$(container).removeClass('selected');
|
|
||||||
$(container).find('.image-presupuesto').removeClass('selected');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
element.closest(class2Find).toggleClass('selected');
|
|
||||||
element.closest('.image-presupuesto').toggleClass('selected');
|
|
||||||
|
|
||||||
element.trigger('change');
|
|
||||||
}
|
|
||||||
|
|
||||||
#handleMenuTipoCubierta() {
|
#handleMenuTipoCubierta() {
|
||||||
|
|
||||||
if (this.tapaBlanda.hasClass("selected")) {
|
if (this.tapaBlanda.hasClass("selected")) {
|
||||||
@ -684,15 +719,14 @@ class DisenioCubierta {
|
|||||||
this.divSolapas.addClass("d-none");
|
this.divSolapas.addClass("d-none");
|
||||||
this.divCarasImpresion.addClass("d-none");
|
this.divCarasImpresion.addClass("d-none");
|
||||||
this.divConfigGuardas.removeClass("d-none");
|
this.divConfigGuardas.removeClass("d-none");
|
||||||
this.#handleMenuPapel();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.divSolapas.addClass("d-none");
|
this.divSolapas.addClass("d-none");
|
||||||
this.divCarasImpresion.addClass("d-none");
|
this.divCarasImpresion.addClass("d-none");
|
||||||
this.divConfigGuardas.addClass("d-none");
|
this.divConfigGuardas.addClass("d-none");
|
||||||
this.#handleMenuPapel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.#handleMenuPapel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -708,42 +742,234 @@ class DisenioCubierta {
|
|||||||
|
|
||||||
#handleMenuPapel() {
|
#handleMenuPapel() {
|
||||||
|
|
||||||
$(".check-gramaje-cubierta").prop("checked", false);
|
this.divGramajeCubierta.empty();
|
||||||
|
const tapa_dura = this.tapaBlanda.hasClass("selected") ? 0 : 1;
|
||||||
|
new Ajax('/papelesgenericos/getpapelcliente',
|
||||||
|
{
|
||||||
|
[this.csrf_token]: this.csrf_hash,
|
||||||
|
tipo: 'colorhq',
|
||||||
|
cubierta: 1,
|
||||||
|
tapa_dura: tapa_dura
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
(response) => { this.fillPapeles(response); },
|
||||||
|
(response) => { console.log(response); }
|
||||||
|
).get();
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.tapaBlanda.hasClass("selected") && !this.tapaDuraLomoRecto.hasClass("selected") && !this.tapaDuraLomoRedondo.hasClass("selected")) {
|
|
||||||
this.divGramajeCubierta.addClass("d-none");
|
#handlePapelCubiertaEspecial() {
|
||||||
this.estucadoMate.removeClass("selected");
|
|
||||||
this.cartulinaEstucada.removeClass("selected");
|
const context = this;
|
||||||
|
|
||||||
|
this.papelCubierta = this.papelEspecial.getVal();
|
||||||
|
const tapa_dura = this.tapaBlanda.hasClass("selected") ? 0 : 1;
|
||||||
|
|
||||||
|
new Ajax('/papelesgenericos/getpapelcliente',
|
||||||
|
{
|
||||||
|
[this.csrf_token]: this.csrf_hash,
|
||||||
|
papel: this.papelCubierta,
|
||||||
|
tipo: 'colorhq',
|
||||||
|
cubierta: 1,
|
||||||
|
tapa_dura: tapa_dura,
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
this.fillGramajes.bind(context),
|
||||||
|
(response) => { console.log(response); }
|
||||||
|
).get();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fillPapeles(response) {
|
||||||
|
|
||||||
|
this.divPapelCubierta.empty();
|
||||||
|
this.divGramajeCubierta.empty();
|
||||||
|
|
||||||
|
if (response.papeles.length > 0) {
|
||||||
|
this.textoPapelCubierta.removeClass('d-none');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.textoPapelCubierta.addClass("d-none");
|
||||||
|
}
|
||||||
|
|
||||||
|
response.papeles.forEach(papel => {
|
||||||
|
var container = $('<div>', {
|
||||||
|
class: 'custom-selector custom-selector-papel-cubierta d-flex flex-column align-items-center justify-content-center'
|
||||||
|
});
|
||||||
|
|
||||||
|
var radioButton = $('<input>', {
|
||||||
|
type: 'radio', // Tipo de input
|
||||||
|
name: 'calcular-presupuesto papel-cubierta',
|
||||||
|
id: 'papelCubierta_' + papel.id, // ID único
|
||||||
|
value: 'option1' // Valor del radio button
|
||||||
|
});
|
||||||
|
|
||||||
|
// Crear una etiqueta para el radio button
|
||||||
|
var label = $('<label>', {
|
||||||
|
for: 'papelCubierta_' + papel.id,
|
||||||
|
text: papel.nombre
|
||||||
|
});
|
||||||
|
|
||||||
|
radioButton.on('click', this.#handleGramajeCubierta.bind(this));
|
||||||
|
|
||||||
|
container.append(radioButton).append(label);
|
||||||
|
$('#divPapelCubierta').append(container);
|
||||||
|
|
||||||
|
if (this.papelCubierta == papel.id) {
|
||||||
|
radioButton.prop('checked', true);
|
||||||
|
radioButton.trigger('click');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.papeles_especiales.length > 0) {
|
||||||
|
this.divPapelCubierta.removeClass('d-none');
|
||||||
|
|
||||||
|
var container = $('<div>', {
|
||||||
|
class: 'custom-selector custom-selector-papel-cubierta d-flex flex-column align-items-center justify-content-center'
|
||||||
|
});
|
||||||
|
|
||||||
|
var radioButton = $('<input>', {
|
||||||
|
type: 'radio',
|
||||||
|
name: 'calcular-presupuesto papel-cubierta',
|
||||||
|
id: 'papelEspecialCubierta',
|
||||||
|
value: 'option1'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Crear una etiqueta para el radio button
|
||||||
|
var label = $('<label>', {
|
||||||
|
for: 'papelEspecialCubierta',
|
||||||
|
text: 'PAPEL ESPECIAL'
|
||||||
|
});
|
||||||
|
|
||||||
|
radioButton.on('click', this.#handleGramajeCubierta.bind(this));
|
||||||
|
|
||||||
|
response.papeles_especiales.forEach(papel => {
|
||||||
|
if (papel.id == this.papelCubierta) {
|
||||||
|
radioButton.prop('checked', true);
|
||||||
|
radioButton.trigger('click');
|
||||||
|
|
||||||
|
this.papelEspecial.setOption(papel.id, papel.nombre);
|
||||||
|
this.#handlePapelCubiertaEspecial();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
container.append(radioButton).append(label);
|
||||||
|
$('#divPapelCubierta').append(container);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#handleGramajeCubierta() {
|
||||||
|
|
||||||
|
const context = this;
|
||||||
|
|
||||||
|
// Accede al ID del elemento que disparó el evento
|
||||||
|
const element = $(event.target);
|
||||||
|
const papel = element[0].id.split('_')[1];
|
||||||
|
this.papelCubierta = papel;
|
||||||
|
|
||||||
|
$('#' + papel).prop('checked', true);
|
||||||
|
|
||||||
|
|
||||||
|
if (element[0].id == 'papelEspecialCubierta') {
|
||||||
|
|
||||||
|
if(!this.cargando)
|
||||||
|
this.gramaje = null;
|
||||||
|
this.divGramajeCubierta.empty();
|
||||||
|
this.divPapelEspecial.removeClass("d-none");
|
||||||
|
$('#papelEspecialCubiertaSel').off("change");
|
||||||
|
this.papelEspecial.empty();
|
||||||
|
$('#papelEspecialCubiertaSel').on("change", this.#handlePapelCubiertaEspecial.bind(this));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
this.divPapelEspecial.addClass("d-none");
|
||||||
|
$('#papelEspecialCubiertaSel').off("change");
|
||||||
|
this.papelEspecial.empty();
|
||||||
|
$('#papelEspecialCubiertaSel').on("change", this.#handlePapelCubiertaEspecial.bind(this));
|
||||||
|
this.divGramajeCubierta.empty();
|
||||||
|
const tapa_dura = this.tapaBlanda.hasClass("selected") ? 0 : 1;
|
||||||
|
new Ajax('/papelesgenericos/getpapelcliente',
|
||||||
|
{
|
||||||
|
[this.csrf_token]: this.csrf_hash,
|
||||||
|
papel: papel,
|
||||||
|
tipo: 'colorhq',
|
||||||
|
cubierta: 1,
|
||||||
|
tapa_dura: tapa_dura
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
this.fillGramajes.bind(context),
|
||||||
|
(response) => { console.log(response); }
|
||||||
|
).get();
|
||||||
|
}
|
||||||
|
if (!this.cargando)
|
||||||
|
this.gramaje = null;
|
||||||
|
else {
|
||||||
|
this.cargando = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fillGramajes(response) {
|
||||||
|
|
||||||
|
|
||||||
|
this.divGramajeCubierta.empty()
|
||||||
|
let showGramaje = false;
|
||||||
|
|
||||||
|
if (response.papeles.length <= 0 && response.papeles_especiales.length <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.cartulinaEstucada.hasClass("selected")) {
|
let papel = response.papeles.length > 0 ? response.papeles : response.papeles_especiales;
|
||||||
this.divGramajeCubierta.removeClass("d-none");
|
|
||||||
this.gramaje170.addClass("d-none");
|
|
||||||
this.gramaje250.removeClass("d-none");
|
|
||||||
this.gramaje270.removeClass("d-none");
|
|
||||||
this.gramaje300.removeClass("d-none");
|
|
||||||
this.gramaje350.removeClass("d-none");
|
|
||||||
}
|
|
||||||
else if (this.estucadoMate.hasClass("selected")) {
|
|
||||||
if (this.tapaBlanda.hasClass("selected")) {
|
|
||||||
this.divGramajeCubierta.removeClass("d-none");
|
|
||||||
this.gramaje170.addClass("d-none");
|
|
||||||
this.gramaje250.removeClass("d-none");
|
|
||||||
this.gramaje270.addClass("d-none");
|
|
||||||
this.gramaje300.removeClass("d-none");
|
|
||||||
this.gramaje350.removeClass("d-none");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.divGramajeCubierta.removeClass("d-none");
|
|
||||||
this.gramaje170.removeClass("d-none");
|
|
||||||
this.gramaje250.addClass("d-none");
|
|
||||||
this.gramaje270.addClass("d-none");
|
|
||||||
this.gramaje300.addClass("d-none");
|
|
||||||
this.gramaje350.addClass("d-none");
|
|
||||||
|
|
||||||
$('#gramaje170Cubierta').trigger("click");
|
papel.forEach(valor => {
|
||||||
|
|
||||||
|
var container = $('<div>', {
|
||||||
|
class: 'custom-selector custom-selector-gramaje-cubierta d-flex flex-column align-items-center justify-content-center gramaje-cubierta',
|
||||||
|
});
|
||||||
|
|
||||||
|
var radioButton = $('<input>', {
|
||||||
|
type: 'radio', // Tipo de input
|
||||||
|
name: 'calcular-presupuesto gramaje-cubierta',
|
||||||
|
id: 'gramajeCubierta_' + valor.gramaje, // ID único
|
||||||
|
value: 'option1' // Valor del radio button
|
||||||
|
});
|
||||||
|
|
||||||
|
// Crear una etiqueta para el radio button
|
||||||
|
var label = $('<label>', {
|
||||||
|
for: "gramajeCubierta_" + valor.gramaje,
|
||||||
|
text: valor.gramaje + " gr"
|
||||||
|
});
|
||||||
|
|
||||||
|
radioButton.on('click', (event) => {
|
||||||
|
const element = $(event.target);
|
||||||
|
const gramaje = element[0].id;
|
||||||
|
|
||||||
|
this.presupuestoCliente.checkForm(event);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
container.append(radioButton).append(label);
|
||||||
|
$('#divGramajeCubierta').append(container);
|
||||||
|
|
||||||
|
if (this.gramaje != null) {
|
||||||
|
if (this.gramaje == parseInt(valor.gramaje)) {
|
||||||
|
radioButton.prop('checked', true);
|
||||||
|
radioButton.trigger('click');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showGramaje = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
if ($("#divGramajeCubierta").hasClass("d-none") && showGramaje) {
|
||||||
|
$("#divGramajeCubierta").removeClass("d-none");
|
||||||
|
}
|
||||||
|
else if (!showGramaje) {
|
||||||
|
$("#divGramajeCubierta").addClass("d-none");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -116,7 +116,7 @@ class DisenioInterior {
|
|||||||
|
|
||||||
const context = this;
|
const context = this;
|
||||||
|
|
||||||
if (papeles == 'color' || papeles == null) {
|
if (papeles == 'color') {
|
||||||
this.divGramajeInteriorColor.empty();
|
this.divGramajeInteriorColor.empty();
|
||||||
new Ajax('/papelesgenericos/getpapelcliente',
|
new Ajax('/papelesgenericos/getpapelcliente',
|
||||||
{
|
{
|
||||||
@ -214,7 +214,7 @@ class DisenioInterior {
|
|||||||
radioButton.prop('checked', true);
|
radioButton.prop('checked', true);
|
||||||
radioButton.trigger('click');
|
radioButton.trigger('click');
|
||||||
|
|
||||||
this.papelEspecial.setVal(papel.id);
|
this.papelEspecial.setOption(papel.id, papel.nombre);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -291,7 +291,7 @@ class DisenioInterior {
|
|||||||
radioButton.prop('checked', true);
|
radioButton.prop('checked', true);
|
||||||
radioButton.trigger('click');
|
radioButton.trigger('click');
|
||||||
|
|
||||||
this.papelEspecialColor.setVal(papel.id);
|
this.papelEspecialColor.setOption(papel.id, papel.nombre);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -837,11 +837,6 @@ class DisenioInterior {
|
|||||||
const element = $(event.target);
|
const element = $(event.target);
|
||||||
const papel = element[0].id.split('_')[1];
|
const papel = element[0].id.split('_')[1];
|
||||||
this.papelInterior = papel;
|
this.papelInterior = papel;
|
||||||
if (!this.cargando)
|
|
||||||
this.gramaje = null;
|
|
||||||
else {
|
|
||||||
this.cargando = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#' + papel).prop('checked', true);
|
$('#' + papel).prop('checked', true);
|
||||||
|
|
||||||
@ -849,7 +844,8 @@ class DisenioInterior {
|
|||||||
|
|
||||||
if (element[0].id == 'papelEspecialInterior') {
|
if (element[0].id == 'papelEspecialInterior') {
|
||||||
|
|
||||||
this.gramaje = null;
|
if(!this.cargando)
|
||||||
|
this.gramaje = null;
|
||||||
this.divGramajeInterior.empty();
|
this.divGramajeInterior.empty();
|
||||||
this.divPapelEspecialInterior.removeClass("d-none");
|
this.divPapelEspecialInterior.removeClass("d-none");
|
||||||
this.papelEspecialInterior.empty();
|
this.papelEspecialInterior.empty();
|
||||||
@ -872,6 +868,11 @@ class DisenioInterior {
|
|||||||
(response) => { console.log(response); }
|
(response) => { console.log(response); }
|
||||||
).get();
|
).get();
|
||||||
}
|
}
|
||||||
|
if (!this.cargando)
|
||||||
|
this.gramaje = null;
|
||||||
|
else {
|
||||||
|
this.cargando = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#handlePapelInteriorEspecial() {
|
#handlePapelInteriorEspecial() {
|
||||||
@ -971,11 +972,13 @@ class DisenioInterior {
|
|||||||
this.divGramajeInterior.empty()
|
this.divGramajeInterior.empty()
|
||||||
let showGramaje = false;
|
let showGramaje = false;
|
||||||
|
|
||||||
if (response.papeles.length <= 0) {
|
if (response.papeles.length <= 0 && response.papeles_especiales.length <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
response.papeles.forEach(valor => {
|
let papel = response.papeles.length > 0 ? response.papeles : response.papeles_especiales;
|
||||||
|
|
||||||
|
papel.forEach(valor => {
|
||||||
|
|
||||||
var container = $('<div>', {
|
var container = $('<div>', {
|
||||||
class: 'custom-selector custom-selector-gramaje d-flex flex-column align-items-center justify-content-center gramaje-interior',
|
class: 'custom-selector custom-selector-gramaje d-flex flex-column align-items-center justify-content-center gramaje-interior',
|
||||||
@ -983,7 +986,7 @@ class DisenioInterior {
|
|||||||
|
|
||||||
var radioButton = $('<input>', {
|
var radioButton = $('<input>', {
|
||||||
type: 'radio', // Tipo de input
|
type: 'radio', // Tipo de input
|
||||||
name: 'calcular-presupuesto gramaje-interior',
|
name: ' calcular-solapas calcular-presupuesto gramaje-interior',
|
||||||
id: 'gramaje_' + valor.gramaje, // ID único
|
id: 'gramaje_' + valor.gramaje, // ID único
|
||||||
value: 'option1' // Valor del radio button
|
value: 'option1' // Valor del radio button
|
||||||
});
|
});
|
||||||
@ -998,6 +1001,7 @@ class DisenioInterior {
|
|||||||
const element = $(event.target);
|
const element = $(event.target);
|
||||||
const gramaje = element[0].id;
|
const gramaje = element[0].id;
|
||||||
|
|
||||||
|
this.presupuestoCliente.calcularSolapas(event);
|
||||||
this.presupuestoCliente.checkForm(event);
|
this.presupuestoCliente.checkForm(event);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1041,7 +1045,7 @@ class DisenioInterior {
|
|||||||
|
|
||||||
var radioButton = $('<input>', {
|
var radioButton = $('<input>', {
|
||||||
type: 'radio', // Tipo de input
|
type: 'radio', // Tipo de input
|
||||||
name: 'calcular-presupuesto gramaje-interior-color',
|
name: ' calcular-solapas calcular-presupuesto gramaje-interior-color',
|
||||||
id: 'gramajeColor_' + valor.gramaje, // ID único
|
id: 'gramajeColor_' + valor.gramaje, // ID único
|
||||||
value: 'option1' // Valor del radio button
|
value: 'option1' // Valor del radio button
|
||||||
});
|
});
|
||||||
@ -1056,6 +1060,7 @@ class DisenioInterior {
|
|||||||
const element = $(event.target);
|
const element = $(event.target);
|
||||||
const gramaje = element[0].id;
|
const gramaje = element[0].id;
|
||||||
|
|
||||||
|
this.presupuestoCliente.calcularSolapas(event);
|
||||||
this.presupuestoCliente.checkForm(event);
|
this.presupuestoCliente.checkForm(event);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@ class PresupuestoCliente {
|
|||||||
|
|
||||||
this.datosGenerales = new DatosGenerales($("#datos-generales"), this.clientePresupuestoWizard, this.validationStepper);
|
this.datosGenerales = new DatosGenerales($("#datos-generales"), this.clientePresupuestoWizard, this.validationStepper);
|
||||||
this.disenioInterior = new DisenioInterior($("#interior-libro"), this.clientePresupuestoWizard, this.validationStepper, this);
|
this.disenioInterior = new DisenioInterior($("#interior-libro"), this.clientePresupuestoWizard, this.validationStepper, this);
|
||||||
this.disenioCubierta = new DisenioCubierta($("#cubierta-libro"), this.clientePresupuestoWizard, this.validationStepper);
|
this.disenioCubierta = new DisenioCubierta($("#cubierta-libro"), this.clientePresupuestoWizard, this.validationStepper, this);
|
||||||
this.direcciones = new Direcciones($("#direcciones-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.resumen = new Resumen($("#resumen-libro"), this.datosGenerales, this.disenioInterior, this.disenioCubierta, this.direcciones);
|
||||||
|
|
||||||
@ -110,6 +110,7 @@ class PresupuestoCliente {
|
|||||||
|
|
||||||
|
|
||||||
$(".calcular-presupuesto").on('change', this.checkForm.bind(this));
|
$(".calcular-presupuesto").on('change', this.checkForm.bind(this));
|
||||||
|
$(".calcular-solapas").on('change', this.calcularSolapas.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -154,6 +155,28 @@ class PresupuestoCliente {
|
|||||||
return !(noPOD && siPOD);
|
return !(noPOD && siPOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
calcularSolapas(){
|
||||||
|
|
||||||
|
/* Solapas Max */
|
||||||
|
this.#getDatos(false, true);
|
||||||
|
if (Object.values(this.datos).every(this.#isValidDataForm)) {
|
||||||
|
new Ajax('/presupuestocliente/calcularsolapas',
|
||||||
|
this.datos,
|
||||||
|
{},
|
||||||
|
(response) => {
|
||||||
|
if (response === null || response === undefined || response === "") {
|
||||||
|
console.log("Error en el calculo máximo de solapas.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.disenioCubierta.tamanioSolapasCubierta.attr('max', response);
|
||||||
|
this.disenioCubierta.solapasSobrecubierta.attr('max', response);
|
||||||
|
this.disenioCubierta.textoSolapasCubierta.text("Entre 60 y " + response + " mm");
|
||||||
|
this.disenioCubierta.textoSolapasSobrecubierta.text("Entre 60 y " + response + " mm");
|
||||||
|
},
|
||||||
|
() => { }
|
||||||
|
).post();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
checkForm(event) {
|
checkForm(event) {
|
||||||
|
|
||||||
@ -163,6 +186,7 @@ class PresupuestoCliente {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (this.calcularPresupuesto) {
|
if (this.calcularPresupuesto) {
|
||||||
|
|
||||||
if (event.target.id === 'divDirecciones') {
|
if (event.target.id === 'divDirecciones') {
|
||||||
@ -580,7 +604,7 @@ class PresupuestoCliente {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#getDatos(save = false) {
|
#getDatos(save = false, calcularSolapas = false) {
|
||||||
|
|
||||||
this.datos = {
|
this.datos = {
|
||||||
|
|
||||||
@ -590,20 +614,12 @@ class PresupuestoCliente {
|
|||||||
tirada: this.datosGenerales.getTiradas(),
|
tirada: this.datosGenerales.getTiradas(),
|
||||||
paginas: this.datosGenerales.paginas.val(),
|
paginas: this.datosGenerales.paginas.val(),
|
||||||
paginasColor: this.datosGenerales.paginasColor.val(),
|
paginasColor: this.datosGenerales.paginasColor.val(),
|
||||||
posPaginasColor: this.datosGenerales.posPaginasColor.val(),
|
|
||||||
pagColorConsecutivas: this.datosGenerales.pagColorConsecutivas.is(':checked') ? 1 : 0,
|
pagColorConsecutivas: this.datosGenerales.pagColorConsecutivas.is(':checked') ? 1 : 0,
|
||||||
papelInteriorDiferente: this.datosGenerales.papelDiferente.is(':checked') ? 1 : 0,
|
papelInteriorDiferente: this.datosGenerales.papelDiferente.is(':checked') ? 1 : 0,
|
||||||
paginasCuadernillo: this.datosGenerales.paginasCuadernillo.val(),
|
paginasCuadernillo: this.datosGenerales.paginasCuadernillo.val(),
|
||||||
|
|
||||||
tipo: this.datosGenerales.tiposLibro.filter('.selected').attr('id'),
|
tipo: this.datosGenerales.tiposLibro.filter('.selected').attr('id'),
|
||||||
|
|
||||||
prototipo: this.datosGenerales.prototipo.is(':checked') ? 1 : 0,
|
|
||||||
ferro: this.datosGenerales.ferro.is(':checked') ? 1 : 0,
|
|
||||||
ferroDigital: this.datosGenerales.ferroDigital.is(':checked') ? 1 : 0,
|
|
||||||
marcapaginas: this.datosGenerales.marcapaginas.is(':checked') ? 1 : 0,
|
|
||||||
retractilado: this.datosGenerales.retractilado.is(':checked') ? 1 : 0,
|
|
||||||
retractilado5: this.datosGenerales.retractilado5.is(':checked') ? 1 : 0,
|
|
||||||
|
|
||||||
isColor: this.datosGenerales.getIsColor() ? 1 : 0,
|
isColor: this.datosGenerales.getIsColor() ? 1 : 0,
|
||||||
isHq: this.disenioInterior.getIsHq() ? 1 : 0,
|
isHq: this.disenioInterior.getIsHq() ? 1 : 0,
|
||||||
|
|
||||||
@ -612,31 +628,46 @@ class PresupuestoCliente {
|
|||||||
gramajeInterior: this.disenioInterior.getGramaje(),
|
gramajeInterior: this.disenioInterior.getGramaje(),
|
||||||
|
|
||||||
},
|
},
|
||||||
|
}
|
||||||
|
|
||||||
cubierta: {
|
if (calcularSolapas) {
|
||||||
tipoCubierta: this.disenioCubierta.disenioCubierta.filter('.selected').attr('id'),
|
return;
|
||||||
papelCubierta: this.disenioCubierta.getPapel(),
|
}
|
||||||
gramajeCubierta: this.disenioCubierta.getGramaje(),
|
|
||||||
cabezada: this.disenioCubierta.getCabezada(),
|
|
||||||
acabados: this.disenioCubierta.getAcabados(),
|
|
||||||
carasImpresion: this.disenioCubierta.carasCubierta.val(),
|
|
||||||
},
|
|
||||||
|
|
||||||
guardas: this.disenioCubierta.getGuardas(),
|
this.datos.posPaginasColor = this.datosGenerales.posPaginasColor.val();
|
||||||
sobrecubierta: this.disenioCubierta.getSobrecubierta(),
|
|
||||||
faja: this.disenioCubierta.getFaja(),
|
|
||||||
|
|
||||||
excluirRotativa: this.datosGenerales.excluirRotativa.is(':checked') ? 1 : 0,
|
this.datos.prototipo = this.datosGenerales.prototipo.is(':checked') ? 1 : 0;
|
||||||
ivaReducido: this.datosGenerales.ivaReducido.find('option:selected').val(),
|
this.datos.ferro = this.datosGenerales.ferro.is(':checked') ? 1 : 0;
|
||||||
servicios: {
|
this.datos.ferroDigital = this.datosGenerales.ferroDigital.is(':checked') ? 1 : 0;
|
||||||
'prototipo': this.datosGenerales.prototipo.is(':checked') ? 1 : 0,
|
this.datos.marcapaginas = this.datosGenerales.marcapaginas.is(':checked') ? 1 : 0;
|
||||||
'ferro': this.datosGenerales.ferro.is(':checked') ? 1 : 0,
|
this.datos.retractilado = this.datosGenerales.retractilado.is(':checked') ? 1 : 0;
|
||||||
'ferroDigital': this.datosGenerales.ferroDigital.is(':checked') ? 1 : 0,
|
this.datos.retractilado5 = this.datosGenerales.retractilado5.is(':checked') ? 1 : 0;
|
||||||
'marcapaginas': this.datosGenerales.marcapaginas.is(':checked') ? 1 : 0,
|
|
||||||
'retractilado': this.datosGenerales.retractilado.is(':checked') ? 1 : 0,
|
|
||||||
'retractilado5': this.datosGenerales.retractilado5.is(':checked') ? 1 : 0,
|
this.datos.cubierta = {
|
||||||
},
|
tipoCubierta: this.disenioCubierta.disenioCubierta.filter('.selected').attr('id'),
|
||||||
|
papelCubierta: this.disenioCubierta.getPapel(),
|
||||||
|
gramajeCubierta: this.disenioCubierta.getGramaje(),
|
||||||
|
cabezada: this.disenioCubierta.getCabezada(),
|
||||||
|
acabados: this.disenioCubierta.getAcabados(),
|
||||||
|
carasImpresion: this.disenioCubierta.carasCubierta.val(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.datos.guardas = this.disenioCubierta.getGuardas();
|
||||||
|
this.datos.sobrecubierta = this.disenioCubierta.getSobrecubierta();
|
||||||
|
this.datos.faja = this.disenioCubierta.getFaja();
|
||||||
|
|
||||||
|
this.datos.excluirRotativa = this.datosGenerales.excluirRotativa.is(':checked') ? 1 : 0;
|
||||||
|
this.datos.ivaReducido = this.datosGenerales.ivaReducido.find('option:selected').val();
|
||||||
|
this.datos.servicios = {
|
||||||
|
'prototipo': this.datosGenerales.prototipo.is(':checked') ? 1 : 0,
|
||||||
|
'ferro': this.datosGenerales.ferro.is(':checked') ? 1 : 0,
|
||||||
|
'ferroDigital': this.datosGenerales.ferroDigital.is(':checked') ? 1 : 0,
|
||||||
|
'marcapaginas': this.datosGenerales.marcapaginas.is(':checked') ? 1 : 0,
|
||||||
|
'retractilado': this.datosGenerales.retractilado.is(':checked') ? 1 : 0,
|
||||||
|
'retractilado5': this.datosGenerales.retractilado5.is(':checked') ? 1 : 0,
|
||||||
|
};
|
||||||
|
|
||||||
let lomoRedondo = 0;
|
let lomoRedondo = 0;
|
||||||
if (this.disenioCubierta.disenioCubierta.filter('.selected').length > 0)
|
if (this.disenioCubierta.disenioCubierta.filter('.selected').length > 0)
|
||||||
lomoRedondo = this.disenioCubierta.disenioCubierta.filter('.selected').attr('id').includes('Redondo') ? 1 : 0;
|
lomoRedondo = this.disenioCubierta.disenioCubierta.filter('.selected').attr('id').includes('Redondo') ? 1 : 0;
|
||||||
|
|||||||
@ -280,7 +280,7 @@ class Resumen {
|
|||||||
this.cabezada.text(this.disenioCubierta.getCabezada(true));
|
this.cabezada.text(this.disenioCubierta.getCabezada(true));
|
||||||
|
|
||||||
}
|
}
|
||||||
this.papelCubierta.text($($('.papel-cubierta.selected').find('.form-label')).text())
|
this.papelCubierta.text(this.disenioCubierta.getPapel(true));
|
||||||
this.gramajeCubierta.text(this.disenioCubierta.getGramaje());
|
this.gramajeCubierta.text(this.disenioCubierta.getGramaje());
|
||||||
this.cubiertaAcabados.text(this.disenioCubierta.getAcabados(true));
|
this.cubiertaAcabados.text(this.disenioCubierta.getAcabados(true));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user