mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
haciendo la conexion con el ajax del comparador negro
This commit is contained in:
@ -69,10 +69,10 @@
|
||||
<p><?= lang('MaquinasTarifasImpresions.negro') ?></p>
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<input type="number" id="compPaginasNegro" name="comp_paginas_negro" placeholder="0" maxLength="5" class="form-control" value="<?= isset($presupuestoEntity->comparador_json_data->negro) ? (old(0, $presupuestoEntity->comparador_json_data->negro->paginas)) : '0' ?>">
|
||||
<input type="number" id="compPaginasNegro" name="comp_paginas_negro" placeholder="0" maxLength="5" class="form-control comp_negro_items" value="<?= isset($presupuestoEntity->comparador_json_data->negro) ? (old(0, $presupuestoEntity->comparador_json_data->negro->paginas)) : '0' ?>">
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-6 px-4">
|
||||
<select id="compPapelNegro" name="comp_papel_negro" class="form-control select2bs2" style="width: 100%;">
|
||||
<select id="compPapelNegro" name="comp_papel_negro" class="form-control select2bs2 comp_negro_items" style="width: 100%;">
|
||||
<?php if (isset($papelGenericoNegroList) && is_array($papelGenericoNegroList) && !empty($papelGenericoNegroList)) :
|
||||
foreach ($papelGenericoNegroList as $k => $v) : ?>
|
||||
<option value="<?= $k ?>" /*<?= $k == $presupuestoEntity->tipo_impresion_id ? ' selected' : '' ?>* />
|
||||
@ -83,7 +83,7 @@
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<select id="compGramajeNegro" name="comp_gramaje_negro" class="form-control select2bs2" disabled style="width: 100%;">
|
||||
<select id="compGramajeNegro" name="comp_gramaje_negro" class="form-control select2bs2 comp_negro_items" disabled style="width: 100%;">
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
@ -58,10 +58,21 @@ $('.accordion-button').on('click', function (e) {
|
||||
|
||||
|
||||
|
||||
|
||||
/*******************************
|
||||
* Metodos
|
||||
*******************************/
|
||||
function checkDatosPedidoForComp() {
|
||||
|
||||
if (parseInt(document.getElementById('paginas').value) > 0 &&
|
||||
parseInt(document.getElementById('tirada').value) > 0 &&
|
||||
($('#papelFormatoId').select2('data').length > 0 ||
|
||||
(parseInt(document.getElementById('papelFormatoAncho').value) > 0 && parseInt(document.getElementById('papelFormatoAlto').value) > 0)))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function init_comparador() {
|
||||
updatePapelesComparador();
|
||||
const paginasColor = document.getElementById('compCalPaginasColor');
|
||||
|
||||
@ -145,11 +145,14 @@
|
||||
document.getElementById("papelFormatoAncho").style.display = "block";
|
||||
document.getElementById("papelFormatoAlto").style.display = "block";
|
||||
$('#papelFormatoId').next(".select2-container").hide();
|
||||
$('#papelFormatoId').val('').change();
|
||||
document.getElementById("label_papelFormatoId").innerHTML =
|
||||
"<?=lang('Presupuestos.papelFormatoId') ?> (" +
|
||||
"<?=lang('Presupuestos.papelFormatoAncho') ?> x <?=lang('Presupuestos.papelFormatoAncho') ?>)*";
|
||||
}
|
||||
else{
|
||||
document.getElementById("papelFormatoAncho").value= "";
|
||||
document.getElementById("papelFormatoAlto").value= "";
|
||||
document.getElementById("papelFormatoAncho").style.display = "none";
|
||||
document.getElementById("papelFormatoAlto").style.display = "none";
|
||||
$('#papelFormatoId').next(".select2-container").show();
|
||||
@ -172,6 +175,29 @@
|
||||
language: {
|
||||
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
|
||||
},
|
||||
columns: [
|
||||
{ 'data': 'tipo' },
|
||||
{ 'data': 'paginas' },
|
||||
{ 'data': 'papel' },
|
||||
{ 'data': 'gramaje' },
|
||||
{ 'data': 'marca' },
|
||||
{ 'data': 'maquina' },
|
||||
{ 'data': 'numeroPliegos' },
|
||||
{ 'data': 'pliegosPedido' },
|
||||
{ 'data': 'precioPliego' },
|
||||
{ 'data': 'libro' },
|
||||
{ 'data': 'totalPapelPedido' },
|
||||
{ 'data': 'lomo' },
|
||||
{ 'data': 'peso' },
|
||||
{ 'data': 'click' },
|
||||
{ 'data': 'totalClicks' },
|
||||
{ 'data': 'precioPagNegro' },
|
||||
{ 'data': 'precioPagColor' },
|
||||
{ 'data': 'totalTinta' },
|
||||
{ 'data': 'totalCorte' },
|
||||
{ 'data': 'total' },
|
||||
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
@ -245,6 +271,53 @@
|
||||
});
|
||||
});
|
||||
|
||||
$('.comp_negro_items').on('change', function (e) {
|
||||
checkComparadorNegro();
|
||||
|
||||
});
|
||||
|
||||
function checkComparadorNegro() {
|
||||
if (document.getElementById('compPaginasNegro').value &&
|
||||
$('#compPapelNegro').select2('data').length > 0 &&
|
||||
$('#compGramajeNegro').select2('data').length > 0) {
|
||||
|
||||
if (parseInt(document.getElementById('compPaginasNegro').value) > 0 && checkDatosPedidoForComp()) {
|
||||
|
||||
if($('#papelFormatoId').select2('data').length > 0){
|
||||
ancho = parseFloat($('#papelFormatoId').select2('data')[0].text.trim().split(" x ")[0]);
|
||||
alto = parseFloat($('#papelFormatoId').select2('data')[0].text.trim().split(" x ")[1]);
|
||||
}
|
||||
else{
|
||||
ancho = parseFloat(document.getElementById('papelFormatoAncho').value);
|
||||
alto = parseFloat(document.getElementById('papelFormatoAlto').value);
|
||||
}
|
||||
|
||||
let datos = {
|
||||
table_type: 'comp_int_bn',
|
||||
paginas: parseInt(document.getElementById('compPaginasNegro').value),
|
||||
tirada: parseInt(document.getElementById('tirada').value),
|
||||
merma: parseInt(document.getElementById('merma').value),
|
||||
ancho: ancho,
|
||||
alto: alto,
|
||||
papel_generico_id: $('#compPapelNegro').select2('data')[0].id,
|
||||
papel_generico: $('#compPapelNegro').select2('data')[0].text.trim(),
|
||||
gramaje: $('#compGramajeNegro').select2('data')[0].text.trim() ,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/cosidotapablanda/datatable",
|
||||
data: datos,
|
||||
success: function (data) {
|
||||
console.log(data)
|
||||
yeniden(data.<?= csrf_token() ?>);
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$('#compPapelNegrohq').on('select2:select', function (e){
|
||||
|
||||
|
||||
17
ci4/app/Views/themes/backend/vuexy/form/test_js/test_js.js
Normal file
17
ci4/app/Views/themes/backend/vuexy/form/test_js/test_js.js
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
fetch("/presupuestos/cosidotapablanda/datatable", {
|
||||
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data),
|
||||
headers: { 'X-Requested-With': 'XMLHttpRequest' },
|
||||
|
||||
})
|
||||
.then(response => console.log(response))
|
||||
//.then(json => console.log(json))
|
||||
.catch(err => console.log(err));
|
||||
|
||||
*/
|
||||
36
ci4/app/Views/themes/backend/vuexy/form/test_js/viewTest.php
Normal file
36
ci4/app/Views/themes/backend/vuexy/form/test_js/viewTest.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
|
||||
|
||||
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
console.log("Hola")
|
||||
|
||||
let datos = {
|
||||
table_type: 'comp_int_bn',
|
||||
paginas: 200,
|
||||
tirada: 100,
|
||||
merma: 10,
|
||||
ancho: 98 ,
|
||||
alto: 148,
|
||||
papel_generico_id: 4,
|
||||
papel_generico: 'AHUESADO OFFSET',
|
||||
gramaje: 80,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
}
|
||||
|
||||
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url:"cosidotapablanda/datatable",
|
||||
data:datos, // data recive un objeto con la informacion que se enviara al servidor
|
||||
success:function(data){ //success es una funcion que se utiliza si el servidor retorna informacion
|
||||
console.log(data)
|
||||
yeniden(data.<?= csrf_token() ?>);
|
||||
},
|
||||
//dataType: dataType // El tipo de datos esperados del servidor. Valor predeterminado: Intelligent Guess (xml, json, script, text, html).
|
||||
})
|
||||
|
||||
|
||||
<?=$this->endSection() ?>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user