mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en el comparador
This commit is contained in:
@ -570,7 +570,6 @@ $routes->group('presupuestoadmin', ['namespace' => 'App\Controllers\Presupuestos
|
||||
$routes->get('list/(:num)', 'Presupuestoadmin::list/$1', ['as' => 'presupuestoAdminList']); // HOMOGENIZAR CON ARGS DINAMICOS!!!
|
||||
$routes->get('add/(:num)', 'Presupuestoadmin::add/$1', ['as' => 'newPresupuestoAdmin']);
|
||||
$routes->get('edit/(:any)', 'Presupuestoadmin::edit/$1', ['as' => 'editarPresupuestoAdmin']);
|
||||
$routes->get('cargar/(:any)', 'Presupuestoadmin::cargar/$1');
|
||||
$routes->post('add/(:num)', 'Presupuestoadmin::add/$1', ['as' => 'createPresupuestoAdmin']);
|
||||
$routes->post('create', 'Presupuestoadmin::create', ['as' => 'ajaxCreatePresupuestoAdmin']);
|
||||
$routes->put('(:num)/update', 'Presupuestoadmin::update/$1', ['as' => 'ajaxUpdatePresupuestoAdmin']);
|
||||
@ -580,6 +579,8 @@ $routes->group('presupuestoadmin', ['namespace' => 'App\Controllers\Presupuestos
|
||||
$routes->post('allmenuitems', 'Presupuestoadmin::allItemsSelect', ['as' => 'select2ItemsOfPresupuestoAdmin']);
|
||||
$routes->post('menuitems', 'Presupuestoadmin::menuItems', ['as' => 'menuItemsOfPresupuestoAdmin']);
|
||||
|
||||
$routes->get('cargar/(:any)', 'Presupuestoadmin::cargar/$1');
|
||||
$routes->post('comparadorplana', 'Presupuestoadmin::obtenerComparadorPlana');
|
||||
$routes->get('papelgenerico', 'Presupuestoadmin::getPapelGenerico');
|
||||
$routes->get('papelgramaje', 'Presupuestoadmin::getGramaje');
|
||||
});
|
||||
|
||||
@ -19,6 +19,7 @@ use App\Models\Presupuestos\PresupuestoModel;
|
||||
use App\Models\Presupuestos\PresupuestoPreimpresionesModel;
|
||||
use App\Models\Presupuestos\PresupuestoServiciosExtraModel;
|
||||
use App\Services\PresupuestoService;
|
||||
use App\Services\PresupuestoClienteService;
|
||||
use Exception;
|
||||
|
||||
class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
||||
@ -534,14 +535,11 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
||||
foreach ($data['comparador']['json_data'] as &$item) {
|
||||
$item['papel_nombre'] = $modelPapelGenerico->getNombre($item['papel_id'])['nombre'];
|
||||
}
|
||||
|
||||
$data['comparador']['posPagColor'] = $presupuesto->comp_pos_paginas_color;
|
||||
|
||||
|
||||
/*
|
||||
$data['datosGenerales']['posPaginasColor'] = $presupuesto->comp_pos_paginas_color;
|
||||
$data['datosGenerales']['papelInteriorDiferente'] = $presupuesto->papel_interior_diferente;
|
||||
$data['datosGenerales']['paginasColorConsecutivas'] = $presupuesto->paginas_color_consecutivas;
|
||||
|
||||
|
||||
|
||||
|
||||
$datos_papel = $this->obtenerDatosPapel($presupuesto->id);
|
||||
@ -610,6 +608,44 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function obtenerComparadorPlana(){
|
||||
echo "hola";
|
||||
//if($this->request->isAJAX()){
|
||||
|
||||
$cliente_id = $this->request->getPost('cliente_id');
|
||||
$datosPedido = $this->request->getPost('datosPedido');
|
||||
$papel_generico = $this->request->getPost('papel_generico');
|
||||
$gramaje = $this->request->getPost('gramaje');
|
||||
$papelInteriorDirefente = $this->request->getPost('papelInteriorDiferente');
|
||||
$paginas_color = $this->request->getPost('paginas_color');
|
||||
$isColor = $this->request->getPost('isColor');
|
||||
$isHq = $this->request->getPost('isHq');
|
||||
$tipo_impresion_id = $this->request->getPost('tipo_impresion_id');
|
||||
$uso = $this->request->getPost('uso');
|
||||
|
||||
$data = (object)array(
|
||||
'cliente_id' => $cliente_id,
|
||||
'datosPedido' => $datosPedido,
|
||||
'papel_generico' => $papel_generico,
|
||||
'gramaje' => $gramaje,
|
||||
'papelInteriorDirefente' => $papelInteriorDirefente,
|
||||
'paginas_color' => $paginas_color,
|
||||
'isColor' => $isColor,
|
||||
'isHq' => $isHq,
|
||||
'tipo_impresion_id' => $tipo_impresion_id,
|
||||
'uso' => $uso
|
||||
);
|
||||
|
||||
$data = PresupuestoClienteService::obtenerComparadorInteriorPlana($data);
|
||||
return $this->respond($data);
|
||||
/*}
|
||||
else{
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
@ -1310,11 +1346,11 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
||||
$query = $model->getGramajeForComparador($tipo, $papel_generico_id, $cubierta, $sobrecubierta, $rotativa, $guardas, $tapa_dura, $isPOD);
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("lg_papel_generico.nombre", $this->request->getGet("q"))
|
||||
->orLike("lg_papel_impresion.gramaje", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
return $this->response->setJSON($query->orderBy("t1.nombre", "asc")->get()->getResultObject());
|
||||
return $this->response->setJSON($query->orderBy("t2.gramaje", "asc")->get()->getResultObject());
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
|
||||
@ -369,6 +369,9 @@ return [
|
||||
'paginas' => 'El campo páginas tiene que ser mayor que cero',
|
||||
'paginasLP' => 'El número de páginas no coincide con el total',
|
||||
'tiradas' => 'El campo tiradas tiene que ser mayor que cero',
|
||||
'seleccionePapel' => 'Seleccione un papel',
|
||||
'seleccioneGramaje' => 'Seleccione un gramaje',
|
||||
'seleccioneCliente' => 'Seleccione un cliente',
|
||||
'dimension' => 'La dimensión del libro tiene que ser mayor que 60mm',
|
||||
'lineaDuplicada' => 'Ya existe ese tipo de linea en el presupuesto',
|
||||
'errorRotColor' => 'Papeles y gramajes deben ser iguales en color y BN',
|
||||
|
||||
@ -158,7 +158,7 @@
|
||||
<!-- Código JS comportamiento ?????. -->
|
||||
<!------------------------------------------------------->
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
/*
|
||||
$("textarea[name*='comentarios_']").each(function(){
|
||||
if (!$.trim($(this).val())) {
|
||||
// textarea is empty or contains only white-space
|
||||
@ -167,7 +167,7 @@ $("textarea[name*='comentarios_']").each(function(){
|
||||
$("#mostrar_" + $(this).attr('name')).show();
|
||||
}
|
||||
});
|
||||
|
||||
*/
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
<!-- Código JS comportamiento general pag. -->
|
||||
<!------------------------------------------->
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
/*
|
||||
window.paisList = <?php echo json_encode($paisList); ?>;
|
||||
window.direccionesList = <?php echo json_encode($direccionesList); ?>;
|
||||
|
||||
@ -74,5 +74,5 @@ window.token_ajax= {<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v};
|
||||
$( document ).ready(function() {
|
||||
load_datos_envios();
|
||||
});
|
||||
|
||||
*/
|
||||
<?= $this->endSection() ?>
|
||||
File diff suppressed because it is too large
Load Diff
@ -286,6 +286,7 @@
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
// Generación de la lista de servicios de acabado (id, nombre)
|
||||
<?php /*
|
||||
window.acabadosList = <?php echo json_encode($serviciosAcabado); ?>;
|
||||
window.serviciosacabadosList = <?php echo json_encode($serviciosAcabadosList); ?>;
|
||||
window.serviciosAutomaticos = <?php echo json_encode($serviciosAutomaticos); ?>;
|
||||
@ -318,7 +319,7 @@
|
||||
|
||||
init_servicio_extra()
|
||||
|
||||
/* ELIMINADO PARA COMPROBAR EL MAXIMO DE SOLAPAS DESDE EL BACKEND
|
||||
/// ELIMINADO PARA COMPROBAR EL MAXIMO DE SOLAPAS DESDE EL BACKEND
|
||||
PENDIENTE
|
||||
$('.solapas_cubierta').on('change', function(){
|
||||
|
||||
@ -364,6 +365,6 @@
|
||||
$('#compGramajeSobrecubierta').trigger('change')
|
||||
})
|
||||
|
||||
*/
|
||||
*/?>
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
@ -74,7 +74,7 @@
|
||||
<!-- Código JS de las lineas de presupuesto. -->
|
||||
<!------------------------------------------->
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
window.papelGenericoNegroList = [];
|
||||
/*window.papelGenericoNegroList = [];
|
||||
window.papelGenericoNegroHQList = [];
|
||||
window.papelGenericoColorList = [];
|
||||
window.papelGenericoColorHQList = [];
|
||||
@ -95,7 +95,7 @@ window.routes_lp = {
|
||||
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
/*
|
||||
fill_lp_from_bbdd()
|
||||
|
||||
|
||||
@ -140,7 +140,7 @@
|
||||
|
||||
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
/*
|
||||
$('#cancelAdd').on('click', function(){
|
||||
$('#addressForm').modal("hide");
|
||||
})
|
||||
@ -394,5 +394,5 @@ $('#addressForm').on('hidden.bs.modal', function () {
|
||||
$('#add_saveDirection').prop('checked', false)
|
||||
$('#add_entregaPieCalle').prop('checked', false)
|
||||
})
|
||||
|
||||
*/
|
||||
<?=$this->endSection() ?>
|
||||
@ -918,7 +918,7 @@
|
||||
<!-- Código JS comportamiento ?????. -->
|
||||
<!------------------------------------------------------->
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
/*
|
||||
|
||||
$('#tab-pv-bn').on( "click", function() {
|
||||
|
||||
@ -980,6 +980,7 @@ $('#tab-pv-sobrecubierta').on( "click", function() {
|
||||
previewInteriorPlana('sobrecubierta', <?php echo $isCosido; ?>, <?php echo $isTapaDura; ?>);
|
||||
|
||||
} );
|
||||
*/
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
@ -52,14 +52,14 @@
|
||||
<!-- Código JS comportamiento ?????. -->
|
||||
<!------------------------------------------------------->
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
window.datatable_lang_url = "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json";
|
||||
/* window.datatable_lang_url = "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json";
|
||||
|
||||
window.datatable_TA_url = "<?= route_to('dataTableOfPresupuestoTiradasAlternativas') ?>";
|
||||
window.get_tirada_url = "<?= route_to('getTiradaData') ?>";
|
||||
|
||||
window.error_lang_tirada_alt_duplicada = "<?= lang('Presupuestos.errores.tirada_alt_duplicada') ?>";
|
||||
window.error_lang_tirada_alt_tipo = "<?= lang('Presupuestos.errores.tirada_alt_tipo') ?>";
|
||||
|
||||
*/
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
|
||||
@ -1,81 +1,11 @@
|
||||
/*******************************
|
||||
* Eventos asociados a elementos HTML
|
||||
*******************************/
|
||||
$('#compPaginasNegro').on("change", function () {
|
||||
var negro = parseInt(document.getElementById('compPaginasNegro').value);
|
||||
const paginas = parseInt(document.getElementById('paginas').value);
|
||||
if (paginas < negro) {
|
||||
document.getElementById('compPaginasNegro').value = paginas;
|
||||
negro = paginas;
|
||||
}
|
||||
var color = parseInt(document.getElementById('compPaginasColor').value);
|
||||
if ($('#tipoImpresion').select2('data')[0].id == 'color') {
|
||||
|
||||
var newValue = paginas - negro;
|
||||
if (newValue != color) {
|
||||
document.getElementById('compPaginasColor').value = newValue >= 0 ? newValue : 0;
|
||||
$('#compPaginasColor').change();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#compPaginasColor').on("change", function () {
|
||||
const paginas = parseInt(document.getElementById('paginas').value);
|
||||
var color = parseInt(document.getElementById('compPaginasColor').value);
|
||||
var negro = parseInt(document.getElementById('compPaginasNegro').value);
|
||||
|
||||
if (paginas < color) {
|
||||
document.getElementById('compPaginasColor').value = paginas;
|
||||
color = paginas
|
||||
}
|
||||
var newValue = paginas - color;
|
||||
if (newValue != negro) {
|
||||
document.getElementById('compPaginasNegro').value = newValue >= 0 ? newValue : 0;
|
||||
$('#compPaginasNegro').change();
|
||||
}
|
||||
});
|
||||
|
||||
$('#compPaginasNegrohq').on("change", function () {
|
||||
|
||||
var negro = parseInt(document.getElementById('compPaginasNegrohq').value);
|
||||
const paginas = parseInt(document.getElementById('paginas').value);
|
||||
if (paginas < negro) {
|
||||
document.getElementById('compPaginasNegrogq').value = paginas;
|
||||
negro = paginas;
|
||||
}
|
||||
var color = parseInt(document.getElementById('compPaginasColorhq').value);
|
||||
if ($('#tipoImpresion').select2('data')[0].id == 'colorhq') {
|
||||
|
||||
var newValue = paginas - negro;
|
||||
if (newValue != color) {
|
||||
document.getElementById('compPaginasColorhq').value = newValue >= 0 ? newValue : 0;
|
||||
$('#compPaginasColorhq').change();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('#compPaginasColorhq').on("change", function () {
|
||||
const paginas = parseInt(document.getElementById('paginas').value);
|
||||
var color = parseInt(document.getElementById('compPaginasColorhq').value);
|
||||
var negro = parseInt(document.getElementById('compPaginasNegrohq').value);
|
||||
|
||||
if (paginas < color) {
|
||||
document.getElementById('compPaginasColorhq').value = paginas;
|
||||
color = paginas
|
||||
}
|
||||
var newValue = paginas - color;
|
||||
if (newValue != negro) {
|
||||
document.getElementById('compPaginasNegrohq').value = newValue >= 0 ? newValue : 0;
|
||||
$('#compPaginasNegrohq').change();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('#prototipo').on("change", function () {
|
||||
$('#ferro').prop('checked', true)
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -84,28 +14,6 @@ $('#compPosPaginasColor').on("keyup", function () {
|
||||
});
|
||||
|
||||
|
||||
// Este evento recoloca los headers de las tablas cuando se pulsa el
|
||||
// boton del acordeon
|
||||
$('.accordion-button').on('click', function (e) {
|
||||
|
||||
if (e.target.id.includes("plana")) {
|
||||
$("#tableCompIntPlana").DataTable().columns.adjust();
|
||||
}
|
||||
else if (e.target.id.includes("rotativa")) {
|
||||
$("#tableCompIntRotativa").DataTable().columns.adjust();
|
||||
}
|
||||
else if (e.target.id.includes("cubierta")) {
|
||||
$("#tableCompCubierta").DataTable().columns.adjust();
|
||||
}
|
||||
else if (e.target.id.includes("guardas")) {
|
||||
$("#tableCompGuardas").DataTable().columns.adjust();
|
||||
}
|
||||
else if (e.target.id.includes("LineasPresupuesto")) {
|
||||
$("#tableLineasPresupuesto").DataTable().columns.adjust();
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
@ -189,110 +97,11 @@ function getRowFromLineaRot(linea) {
|
||||
|
||||
|
||||
|
||||
function computarPaginasColor(string) {
|
||||
|
||||
var numbers = [];
|
||||
for (const [, beginStr, endStr] of string.matchAll(/(\d+)(?:-(\d+))?/g)) {
|
||||
const [begin, end] = [beginStr, endStr].map(Number);
|
||||
numbers.push(begin);
|
||||
if (endStr !== undefined) {
|
||||
for (let num = begin + 1; num <= end; num++) {
|
||||
numbers.push(num);
|
||||
}
|
||||
}
|
||||
}
|
||||
var numbers2 = [];
|
||||
numbers.forEach(function (value, i) {
|
||||
// Si es impar y no está el siguiente par hay que añadirlo
|
||||
if (value % 2 != 0 && numbers[i + 1] != value + 1) {
|
||||
numbers2.push(value + 1);
|
||||
}
|
||||
});
|
||||
numbers = numbers.concat(numbers2);
|
||||
numbers.sort(function (a, b) {
|
||||
return a - b;
|
||||
});
|
||||
calPagesTextarea = document.getElementById('compCalPaginasColor');
|
||||
calPagesTextarea.value = numbers;
|
||||
autosize.update(calPagesTextarea);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function updatePapelesComparador() {
|
||||
|
||||
var e = document.getElementById("tipoImpresion");
|
||||
elements_negro = document.getElementsByClassName('comp-negro-selected');
|
||||
elements_negrohq = document.getElementsByClassName('comp-negrohq-selected');
|
||||
elements_color = document.getElementsByClassName('comp-color-selected');
|
||||
elements_colorhq = document.getElementsByClassName('comp-colorhq-selected');
|
||||
switch (e.value) {
|
||||
case "negro":
|
||||
Array.from(elements_color).forEach(element => {
|
||||
element.style.display = "none";
|
||||
});
|
||||
Array.from(elements_negro).forEach(element => {
|
||||
element.style.display = "flex";
|
||||
});
|
||||
Array.from(elements_negrohq).forEach(element => {
|
||||
element.style.display = "none";
|
||||
});
|
||||
Array.from(elements_colorhq).forEach(element => {
|
||||
element.style.display = "none";
|
||||
});
|
||||
break;
|
||||
|
||||
case "negrohq":
|
||||
Array.from(elements_color).forEach(element => {
|
||||
element.style.display = "none";
|
||||
|
||||
});
|
||||
Array.from(elements_negro).forEach(element => {
|
||||
element.style.display = "none";
|
||||
});
|
||||
Array.from(elements_negrohq).forEach(element => {
|
||||
element.style.display = "flex";
|
||||
});
|
||||
Array.from(elements_colorhq).forEach(element => {
|
||||
element.style.display = "none";
|
||||
});
|
||||
break;
|
||||
|
||||
case "color":
|
||||
Array.from(elements_negro).forEach(element => {
|
||||
element.style.display = "flex";
|
||||
});
|
||||
Array.from(elements_negrohq).forEach(element => {
|
||||
element.style.display = "none";
|
||||
});
|
||||
Array.from(elements_color).forEach(element => {
|
||||
element.style.display = "flex";
|
||||
});
|
||||
Array.from(elements_colorhq).forEach(element => {
|
||||
element.style.display = "none";
|
||||
});
|
||||
break;
|
||||
|
||||
case "colorhq":
|
||||
Array.from(elements_negro).forEach(element => {
|
||||
element.style.display = "none";
|
||||
});
|
||||
Array.from(elements_negrohq).forEach(element => {
|
||||
element.style.display = "flex";
|
||||
});
|
||||
Array.from(elements_color).forEach(element => {
|
||||
element.style.display = "none";
|
||||
});
|
||||
Array.from(elements_colorhq).forEach(element => {
|
||||
element.style.display = "flex";
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -304,14 +304,14 @@
|
||||
<script src="<?= site_url('themes/vuexy/vendor/libs/autosize/autosize.js') ?>"></script>
|
||||
<script src="<?= site_url('js_loader/translate_js/Presupuestos') ?>"></script>
|
||||
<?php if (str_contains($formAction, 'edit')): ?>
|
||||
<script src="<?= site_url('js_loader/datosEnvios_js') ?>"></script>
|
||||
<!---<script src="<?= site_url('js_loader/datosEnvios_js') ?>"></script>
|
||||
<script src="<?= site_url('js_loader/resumenPresupuestos_js') ?>"></script>
|
||||
<script src="<?= site_url('js_loader/presupuestos_js') ?>"></script>
|
||||
<script src="<?= site_url('js_loader/comparadorPresupuestoAdmin_js') ?>"></script>
|
||||
<script src="<?= site_url('js_loader/previsualizador_js') ?>"></script>
|
||||
<!---<script src="<?= site_url('js_loader/lineasPresupuesto_js') ?>"></script> -->
|
||||
<script src="<?= site_url('js_loader/lineasPresupuesto_js') ?>"></script>
|
||||
<script src="<?= site_url('js_loader/tiradasAlternativas_js') ?>"></script>
|
||||
<script src="<?= site_url('js_loader/datosServicios_js') ?>"></script>
|
||||
<script src="<?= site_url('js_loader/datosServicios_js') ?>"></script> -->
|
||||
<script src="<?= site_url('themes/vuexy/vendor/libs/two/two.js') ?>"></script>
|
||||
<script src="<?= site_url('themes/vuexy/vendor/libs/perfect-scrollbar/perfect-scrollbar.js') ?>"></script>
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -97,7 +97,7 @@ class DatosLibro {
|
||||
this.removeService('fajaColor');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
changeFerro() {
|
||||
|
||||
if (this.ferro.prop('checked')) {
|
||||
@ -112,6 +112,7 @@ class DatosLibro {
|
||||
|
||||
if (this.prototipo.prop('checked')) {
|
||||
this.addService('prototipo');
|
||||
this.ferro.prop('checked', true).trigger('change');
|
||||
}
|
||||
else {
|
||||
this.removeService('prototipo');
|
||||
@ -396,4 +397,5 @@ class DatosLibro {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export default DatosLibro;
|
||||
Reference in New Issue
Block a user