mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'dev/servicios_externos' into 'main'
Dev/servicios externos See merge request jjimenez/safekat!202
This commit is contained in:
@ -8,6 +8,7 @@ $('.nav-servicios button').on('shown.bs.tab', function(){
|
||||
$("#tableOfServiciosPreimpresion").DataTable().columns.adjust();
|
||||
$("#tableOfServiciosManipulado").DataTable().columns.adjust();
|
||||
$("#tableOfServiciosAcabado").DataTable().columns.adjust();
|
||||
$("#tableOfServiciosExtra").DataTable().columns.adjust();
|
||||
})
|
||||
|
||||
|
||||
@ -37,6 +38,9 @@ $(document).on('click', '.btn-delete-serv', function(e) {
|
||||
else if($(this).closest('table').attr('id').includes('tableOfServiciosPreimpresion')){
|
||||
table = "tableOfServiciosPreimpresion";
|
||||
}
|
||||
else if($(this).closest('table').attr('id').includes('tableOfServiciosExtra')){
|
||||
table = "tableOfServiciosExtra";
|
||||
}
|
||||
else{
|
||||
table = "";
|
||||
}
|
||||
@ -60,6 +64,7 @@ $(document).on('click', '.btn-delete-serv', function(e) {
|
||||
check_serv_acabado_error()
|
||||
check_serv_preimpresion_error()
|
||||
check_serv_manipulado_error()
|
||||
check_serv_extra_error()
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
@ -77,6 +82,7 @@ function save_servicios(){
|
||||
var datosEnc = get_datos_encuadernacion()
|
||||
var datosManipulado = get_datos_manipulado()
|
||||
var datosPreimpresion = get_datos_preimpresion()
|
||||
var datosServiciosExtra = get_datos_serviciosextra()
|
||||
|
||||
const domain = window.location.origin
|
||||
|
||||
@ -135,7 +141,21 @@ function save_servicios(){
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
yeniden(data[window.csrf_token]);
|
||||
})
|
||||
})
|
||||
)
|
||||
|
||||
.then(
|
||||
fetch(domain + "/presupuestos/presupuestoserviciosextra/edit/" + id , {
|
||||
method: "POST",
|
||||
body: JSON.stringify(Object.assign({datos: datosServiciosExtra}, window.token_ajax)),
|
||||
headers: {
|
||||
"Content-type": "application/json; charset=UTF-8"
|
||||
}
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
yeniden(data[window.csrf_token]);
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
@ -156,6 +176,16 @@ var tableServiciosAcabado = new DataTable('#tableOfServiciosAcabado',{
|
||||
},
|
||||
});
|
||||
|
||||
tableServiciosAcabado.on('draw', function(){
|
||||
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true})
|
||||
})
|
||||
|
||||
function init_servicio_acabado(){
|
||||
|
||||
$('#add_servicio_acabado_list').select2({
|
||||
@ -190,15 +220,7 @@ function init_servicio_acabado(){
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true})
|
||||
})
|
||||
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
check_serv_acabado_error()
|
||||
}
|
||||
@ -273,16 +295,6 @@ function get_tarifas_acabado(tarifa_id = -1, uso=null){
|
||||
})
|
||||
|
||||
});
|
||||
if(data.values.lenght > 0){
|
||||
//updateTotales(false, true, false)
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
}
|
||||
|
||||
check_serv_acabado_error()
|
||||
yeniden(data[window.csrf_token]);
|
||||
@ -479,6 +491,14 @@ var tableServiciosEnc = new DataTable('#tableOfServiciosEncuadernacion',{
|
||||
},
|
||||
});
|
||||
|
||||
tableServiciosEnc.on('draw', function(){
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true})
|
||||
})
|
||||
|
||||
function init_servicio_encuadernado(){
|
||||
|
||||
@ -560,14 +580,6 @@ function init_servicio_encuadernado(){
|
||||
});
|
||||
$('#proveedor_enc_' + element.tarifa_encuadernado_id).on('change', proveedor_enc_event)
|
||||
});
|
||||
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
check_serv_enc_error()
|
||||
|
||||
}
|
||||
@ -602,13 +614,6 @@ function proveedor_enc_event(){
|
||||
$('#precio_total_encuadernado_' + datos.tarifa_encuadernacion_id).val(parseFloat(data.values[0].total).toFixed(2))
|
||||
$('#enc_margen_' + datos.tarifa_encuadernacion_id).val(parseFloat(data.values[0].margen).toFixed(2))
|
||||
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
yeniden(data[window.csrf_token]);
|
||||
return true;
|
||||
},
|
||||
@ -746,17 +751,6 @@ async function get_tarifas_enc(tipo=null, tarifa_id = -1){
|
||||
|
||||
|
||||
});
|
||||
|
||||
if(data.values.lenght > 0){
|
||||
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
}
|
||||
check_serv_enc_error()
|
||||
yeniden(data[window.csrf_token]);
|
||||
return true;
|
||||
@ -781,6 +775,8 @@ $('#insertar_serv_enc').on('click', function(){
|
||||
}
|
||||
check_serv_enc_error()
|
||||
})
|
||||
|
||||
|
||||
function get_datos_encuadernacion(){
|
||||
|
||||
var datosEnc = []
|
||||
@ -882,6 +878,15 @@ var tableServiciosManipulado = new DataTable('#tableOfServiciosManipulado',{
|
||||
},
|
||||
});
|
||||
|
||||
tableServiciosManipulado.on('draw', function(){
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true})
|
||||
})
|
||||
|
||||
function init_servicio_manipulado(){
|
||||
|
||||
$('#add_servicio_manipulado_list').select2({
|
||||
@ -989,17 +994,6 @@ async function get_tarifas_manipulado(tipo=null, tarifa_id = -1){
|
||||
update_tiradas_alternativas: true})
|
||||
})
|
||||
});
|
||||
|
||||
if(data.values.lenght > 0){
|
||||
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
}
|
||||
check_serv_manipulado_error()
|
||||
yeniden(data[window.csrf_token]);
|
||||
return true;
|
||||
@ -1133,6 +1127,15 @@ var tableServiciosPreimpresion = new DataTable('#tableOfServiciosPreimpresion',{
|
||||
}
|
||||
});
|
||||
|
||||
tableServiciosPreimpresion.on('draw', function(){
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true})
|
||||
})
|
||||
|
||||
|
||||
function init_servicio_preimpresion(){
|
||||
|
||||
@ -1163,14 +1166,6 @@ function init_servicio_preimpresion(){
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
check_serv_preimpresion_error()
|
||||
}
|
||||
|
||||
@ -1207,7 +1202,7 @@ function get_tarifas_preimpresion(tarifa_id = -1){
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: window.routes_servicios.dataTableOfPresupuestoPreimpresiones,
|
||||
url: window.routes_servicios.dataTableOfPresupuestoPreimpresion,
|
||||
data: datos,
|
||||
success: function (data) {
|
||||
|
||||
@ -1231,17 +1226,6 @@ function get_tarifas_preimpresion(tarifa_id = -1){
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
if(data.values.lenght > 0){
|
||||
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
}
|
||||
check_serv_preimpresion_error()
|
||||
yeniden(data[window.csrf_token]);
|
||||
return true;
|
||||
@ -1375,6 +1359,225 @@ async function get_servPreimpresion_tiradasAlternativas(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/****************************************************************************************
|
||||
* Seccion para los servicios extra
|
||||
***************************************************************************************/
|
||||
var tableServiciosExtra = new DataTable('#tableOfServiciosExtra',{
|
||||
scrollX: true,
|
||||
searching: false,
|
||||
paging: false,
|
||||
info: false,
|
||||
ordering: false,
|
||||
responsive: true,
|
||||
select: false,
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
}
|
||||
});
|
||||
|
||||
tableServiciosExtra.on('draw', function(){
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true})
|
||||
})
|
||||
|
||||
function init_servicio_extra(){
|
||||
|
||||
|
||||
$('#add_servicio_extra_list').select2({
|
||||
allowClear: false,
|
||||
minimumResultsForSearch: -1,
|
||||
placeholder: window.Presupuestos.servicioextraList
|
||||
})
|
||||
|
||||
window.serviciosextraList.forEach((element) =>{
|
||||
|
||||
tableServiciosExtra.row.add([
|
||||
element.tarifa_extra_id,
|
||||
element.nombre,
|
||||
'<input class="update-totales-servicios" id="precio_servicioextra_' + element.tarifa_extra_id +'" value="' + parseFloat(element.precio).toFixed(2) + '"></input>',
|
||||
'<span style="display: none;" class="update-totales" id="servicioextra_margen_' + element.tarifa_extra_id + '">' + parseFloat(element.margen).toFixed(2) + '</span>',
|
||||
'<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete-serv mx-2" data-id="' + element.tarifa_extra_id +'"></i></a>'
|
||||
]).draw(false)
|
||||
|
||||
$('#precio_servicioextra_' + element.tarifa_extra_id).on('change', function(){
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true})
|
||||
})
|
||||
|
||||
})
|
||||
check_serv_extra_error()
|
||||
}
|
||||
|
||||
function check_serv_extra_error(){
|
||||
|
||||
var htmlString = '';
|
||||
|
||||
$('#tableOfServiciosExtra tr').each(function(){
|
||||
|
||||
if(parseFloat($(this).find('td:eq(2) input').val()) == '0'){
|
||||
htmlString = `
|
||||
<div class="alert alert-danger d-flex align-items-baseline" role="alert">
|
||||
<span class="alert-icon alert-icon-lg text-primary me-2">
|
||||
<i class="ti ti-ban ti-sm"></i>
|
||||
</span>
|
||||
<div class="d-flex flex-column ps-1">
|
||||
<h5 class="alert-heading mb-2">` +
|
||||
window.Presupuestos.errores.error_servicios_anadidos +
|
||||
`</h5>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
})
|
||||
$('#serv-preimpresion-error').html(htmlString)
|
||||
}
|
||||
|
||||
function get_tarifas_extra(tarifa_id = -1){
|
||||
|
||||
var datos = {
|
||||
tarifa_extra_id : tarifa_id,
|
||||
};
|
||||
datos = Object.assign(datos, window.token_ajax)
|
||||
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: window.routes_servicios.dataTableOfPresupuestoServiciosExtra,
|
||||
data: datos,
|
||||
success: function (data) {
|
||||
|
||||
data.values.forEach((row) => {
|
||||
|
||||
tableServiciosExtra.row.add([
|
||||
row.tarifa_id,
|
||||
row.tarifa_nombre,
|
||||
'<input class="update-totales-servicios" id="precio_servicioextra_' + row.tarifa_id +'" value="' + parseFloat(row.precio).toFixed(2) + '"></input>',
|
||||
'<span style="display: none;" class="update-totales" id="servicioextra_margen_' + row.tarifa_id + '">' + parseFloat(row.margen).toFixed(2) + '</span>',
|
||||
'<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete-serv mx-2" data-id="' + row.tarifa_id +'"></i></a>'
|
||||
]).draw(false)
|
||||
|
||||
$('#precio_servicioextra_' + row.tarifa_id).on('change', function(){
|
||||
updatePresupuesto({
|
||||
update_lineas: false,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true})
|
||||
})
|
||||
|
||||
});
|
||||
check_serv_extra_error()
|
||||
yeniden(data[window.csrf_token]);
|
||||
return true;
|
||||
},
|
||||
error: function(e){
|
||||
return false;
|
||||
}
|
||||
})
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$('#insertar_serv_extra').on('click', function(){
|
||||
const tarifa_text = $('#add_servicio_extra_list').select2('data')[0].text.trim()
|
||||
|
||||
if( $('#add_servicio_extra_list').select2('data')[0].text.trim().length > 0){
|
||||
if($('#tableOfServiciosExtra tr > td:contains(' + tarifa_text + ')').length == 0)
|
||||
get_tarifas_extra($('#add_servicio_extra_list').select2('data')[0].id);
|
||||
else{
|
||||
popErrorAlert(window.Presupuestos.errores.error_servicios_duplicados, 'serv-extra-alert')
|
||||
}
|
||||
}
|
||||
check_serv_extra_error()
|
||||
})
|
||||
|
||||
|
||||
function get_datos_serviciosextra(){
|
||||
|
||||
var datosServiciosExtra = []
|
||||
if($("#tableOfServiciosExtra").DataTable().rows().count()>0){
|
||||
|
||||
$("#tableOfServiciosExtra tr").each(function (index,tr) {
|
||||
var values = {}
|
||||
$(this).find("td").each(function (index2) {
|
||||
|
||||
switch (index2) {
|
||||
case 0:
|
||||
values['tarifa_id'] = $(this).text()
|
||||
break
|
||||
case 2:
|
||||
values['precio'] = $(this).children(":first").val()
|
||||
break
|
||||
case 3:
|
||||
values['margen'] = $(this).text()
|
||||
break
|
||||
}
|
||||
})
|
||||
if(Object.keys(values).length>0)
|
||||
datosServiciosExtra.push(values)
|
||||
})
|
||||
}
|
||||
|
||||
return datosServiciosExtra;
|
||||
}
|
||||
|
||||
|
||||
async function get_servExtra_tiradasAlternativas(){
|
||||
|
||||
const url = window.location.href;
|
||||
const url_parts = url.split('/');
|
||||
var id = -1;
|
||||
if(url_parts[url_parts.length-2] == 'edit'){
|
||||
id = url_parts[url_parts.length-1];
|
||||
}
|
||||
|
||||
var serviciosExtra ={
|
||||
coste: 0.0,
|
||||
margen: 0.0,
|
||||
}
|
||||
var json_data = {
|
||||
datos: get_datos_serviciosextra(),
|
||||
POD: $('#POD').val()
|
||||
}
|
||||
if(json_data.datos.length>0){
|
||||
|
||||
json_data = Object.assign(json_data, window.token_ajax);
|
||||
|
||||
await fetch(window.location.origin + "/presupuestos/presupuestoserviciosextra/update/" + id , {
|
||||
method: "POST",
|
||||
body: JSON.stringify(json_data),
|
||||
headers: {
|
||||
"Content-type": "application/json; charset=UTF-8"
|
||||
}
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
//const values = await response.json();
|
||||
yeniden(data[window.csrf_token]);
|
||||
data.lines.forEach((line) => {
|
||||
serviciosExtra.coste += parseFloat(line[0].precio);
|
||||
serviciosExtra.margen += parseFloat(line[0].precio)*parseFloat(line[0].margen)/100.0;
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
return serviciosExtra;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************************
|
||||
* Seccion para "otros"
|
||||
***************************************************************************************/
|
||||
async function actualizar_servicios(update_preimpresion=false){
|
||||
|
||||
const domain = window.location.origin
|
||||
@ -1425,6 +1628,11 @@ async function actualizar_servicios(update_preimpresion=false){
|
||||
datos_json_preimpresion = Object.assign(datos_json_preimpresion, window.token_ajax);
|
||||
|
||||
|
||||
var datos_json_serviciosextra = {
|
||||
datos: get_datos_serviciosextra(),
|
||||
}
|
||||
datos_json_preimpresion = Object.assign(datos_json_preimpresion, window.token_ajax);
|
||||
|
||||
fetch(domain + "/presupuestos/presupuestoacabados/update/" + id , {
|
||||
method: "POST",
|
||||
body: JSON.stringify(datos_json_acabados),
|
||||
@ -1507,6 +1715,26 @@ async function actualizar_servicios(update_preimpresion=false){
|
||||
yeniden(data[window.csrf_token]);
|
||||
})
|
||||
}
|
||||
}).then(function(){
|
||||
if(update_preimpresion){
|
||||
fetch(domain + "/presupuestos/presupuestoserviciosextra/update/" + id , {
|
||||
method: "POST",
|
||||
body: JSON.stringify(datos_json_serviciosextra),
|
||||
headers: {
|
||||
"Content-type": "application/json; charset=UTF-8"
|
||||
}
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
|
||||
data.lines.forEach((line) => {
|
||||
$('#precio_serviciosextra_' + line[0].tarifa_id).val(parseFloat(line[0].total).toFixed(2))
|
||||
$('#serviciosextra_margen_' + line[0].tarifa_id).val(parseFloat(line[0].margen).toFixed(2))
|
||||
});
|
||||
check_serv_preimpresion_error();
|
||||
yeniden(data[window.csrf_token]);
|
||||
})
|
||||
}
|
||||
})
|
||||
)
|
||||
)
|
||||
@ -1531,4 +1759,4 @@ function popAlert(message, alertClass, alertIcon, containerId = 'sk-alert'){
|
||||
$('#' + containerId).fadeOut("slow");
|
||||
}, 5000);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,6 +66,18 @@
|
||||
<?= lang("Presupuestos.servicioManipulado") ?>
|
||||
</button>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<button
|
||||
type="button"
|
||||
class="nav-link"
|
||||
role="tab"
|
||||
data-bs-toggle="tab"
|
||||
data-bs-target="#servicios-extra"
|
||||
aria-controls="servicios-extra"
|
||||
aria-selected="false">
|
||||
<?= lang("Presupuestos.servicioExtra") ?>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content border border-container">
|
||||
<div class="tab-pane fade show active" id="servicios-acabado" role="tabpanel">
|
||||
@ -221,6 +233,42 @@
|
||||
</div>
|
||||
|
||||
|
||||
<div class="tab-pane fade" id="servicios-extra" role="tabpanel">
|
||||
<div id="serv-extra-alert">
|
||||
</div>
|
||||
<div id="serv-extra-error">
|
||||
</div>
|
||||
<table id="tableOfServiciosExtra" class="table table-striped table-hover tiradas-alternativas update-resumen-presupuesto" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= lang('Presupuestos.id') ?></th>
|
||||
<th><?= lang('Tarifaextra.tarifaextra') ?></th>
|
||||
<th><?= lang('Presupuestos.precio') ?></th>
|
||||
<th></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="row mb-3 px-4">
|
||||
<div class="col-md-12 col-lg-4 py-4">
|
||||
<select id="add_servicio_extra_list" class="select2bs2" style="width: 100%;">
|
||||
<option></option>
|
||||
<?php foreach ($serviciosExtra as $item) : ?>
|
||||
<option value="<?= $item->value ?>" >
|
||||
<?= $item->label ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-4 px-2 py-4">
|
||||
<button id="insertar_serv_extra" type="button" class="btn btn-secondary waves-effect waves-light float-start tiradas-alternativas"><?= lang("Presupuestos.insertar")?></button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- //.accordion-body -->
|
||||
@ -243,12 +291,15 @@
|
||||
|
||||
window.serviciospreimpresionList = <?php echo json_encode($serviciosPreimpresionList); ?>;
|
||||
|
||||
window.serviciosextraList = <?php echo json_encode($serviciosExtraList); ?>;
|
||||
|
||||
window.routes_servicios = {
|
||||
dataTableOfPresupuestoAcabados: "<?=route_to('dataTableOfPresupuestoAcabados') ?>",
|
||||
dataTableOfPresupuestoPreimpresion: "<?=route_to('dataTableOfPresupuestoPreimpresiones') ?>",
|
||||
dataTableOfPresupuestoEncuadernaciones: "<?=route_to('dataTableOfPresupuestoEncuadernaciones') ?>",
|
||||
dataTableOfPresupuestoManipulados: "<?=route_to('dataTableOfPresupuestoManipulados') ?>",
|
||||
menuItemsOfPresupuestoEncuadernaciones: '<?= route_to("menuItemsOfPresupuestoEncuadernaciones") ?>',
|
||||
dataTableOfPresupuestoServiciosExtra: "<?=route_to('dataTableOfPresupuestoServiciosExtra') ?>",
|
||||
}
|
||||
|
||||
init_servicio_acabado()
|
||||
@ -258,5 +309,7 @@
|
||||
init_servicio_manipulado()
|
||||
|
||||
init_servicio_preimpresion()
|
||||
|
||||
init_servicio_extra()
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
@ -114,6 +114,17 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){
|
||||
})
|
||||
}
|
||||
|
||||
if ( typeof $("#tableOfServiciosExtra").DataTable() !== 'undefined' && $("#tableOfServiciosExtra").DataTable().rows().count() > 0){
|
||||
|
||||
$('#tableOfServiciosExtra tbody tr').each(function(){
|
||||
var currentRow = $(this).closest("tr");
|
||||
var subId = $('#tableOfServiciosExtra').DataTable().cell(currentRow,0).node().innerHTML;
|
||||
var total = parseFloat($('#precio_servicioextra_' + subId)[0].value)
|
||||
totalServicios += total
|
||||
margenServicios += (total*parseFloat($('#servicioextra_margen_' + subId)[0].innerHTML)/100.0)
|
||||
})
|
||||
}
|
||||
|
||||
if ( typeof $("#tableOfServiciosManipulado").DataTable() !== 'undefined' && $("#tableOfServiciosManipulado").DataTable().rows().count() > 0){
|
||||
|
||||
$('#tableOfServiciosManipulado tbody tr').each(function(){
|
||||
|
||||
@ -143,6 +143,10 @@ async function add_tirada_alternativa(tirada_alt) {
|
||||
costes_servicios += parseFloat(valuePreimpresion.coste);
|
||||
margen_servicios += parseFloat(valuePreimpresion.margen);
|
||||
|
||||
const valueServiciosExtra = await get_servExtra_tiradasAlternativas(parseInt(datos.tirada));
|
||||
costes_servicios += parseFloat(valueServiciosExtra.coste);
|
||||
margen_servicios += parseFloat(valueServiciosExtra.margen);
|
||||
|
||||
//console.log('coste preimpresion ('+ datos.tirada +'): ' + valuePreimpresion.coste);
|
||||
|
||||
const valueTransporte = await get_coste_envio_tiradasAlternativas(parseInt(datos.tirada));
|
||||
|
||||
@ -84,14 +84,16 @@
|
||||
}
|
||||
})
|
||||
|
||||
const domain = window.location.origin
|
||||
const url = window.location.href;
|
||||
const url_parts = url.split('/');
|
||||
var id = -1;
|
||||
if(url_parts[url_parts.length-2] == 'edit'){
|
||||
id = url_parts[url_parts.length-1];
|
||||
}
|
||||
|
||||
if(gotaNegro){
|
||||
const domain = window.location.origin
|
||||
const url = window.location.href;
|
||||
const url_parts = url.split('/');
|
||||
var id = -1;
|
||||
if(url_parts[url_parts.length-2] == 'edit'){
|
||||
id = url_parts[url_parts.length-1];
|
||||
}
|
||||
|
||||
asyncMessageDialog('<?= lang("Basic.global.Warning") ?>', '<?= lang("Presupuestos.duplicarConTipologias") ?>', function() {
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
@ -117,6 +119,30 @@
|
||||
});
|
||||
})
|
||||
}
|
||||
else{
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '<?= route_to("updateDataOfCosidotapablanda") ?>',
|
||||
|
||||
data: {
|
||||
tipo: 'duplicar',
|
||||
presupuesto_id: id,
|
||||
<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v
|
||||
},
|
||||
dataType: 'json',
|
||||
success:function(response){
|
||||
|
||||
token=response.<?= csrf_token() ?>;
|
||||
yeniden(token);
|
||||
// redirect
|
||||
new_location = '<?= site_url("presupuestos/cosidotapablanda/edit/") ?>' + response.id
|
||||
window.location.href = new_location;
|
||||
}
|
||||
}).fail(function (jqXHR, textStatus, error) {
|
||||
// Handle error here
|
||||
console.log(jqXHR)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -365,14 +391,14 @@
|
||||
<script src="<?= site_url('js_loader/translate_js/Presupuestos') ?>"></script>
|
||||
<script src="<?= site_url('js_loader/datosLibro_js') ?>"></script>
|
||||
<?php if (str_contains($formAction, 'edit')): ?>
|
||||
<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/comparadorCosidoTapaBlanda_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/tiradasAlternativas_js') ?>"></script>
|
||||
<script src="<?= site_url('js_loader/datosServicios_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('themes/vuexy/vendor/libs/two/two.js') ?>"></script>
|
||||
<?php endif; ?>
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
@ -0,0 +1,93 @@
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-12 px-4">
|
||||
<div class="mb-3">
|
||||
<label for="nombre" class="form-label">
|
||||
<?= lang('Tarifaextra.nombre') ?>*
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="nombre"
|
||||
name="nombre"
|
||||
required
|
||||
maxLength="255"
|
||||
class="form-control"
|
||||
value="<?= old('nombre', $tarifaextraEntity->nombre) ?>"
|
||||
>
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="precio" class="form-label">
|
||||
<?= lang('Tarifaextra.precio') ?>*
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
id="precio"
|
||||
name="precio"
|
||||
required
|
||||
maxLength="31"
|
||||
step="0.01"
|
||||
class="form-control"
|
||||
value="<?= old('precio', $tarifaextraEntity->precio) ?>"
|
||||
>
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="precio_min" class="form-label">
|
||||
<?= lang('Tarifaextra.precioMin') ?>*
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="precio_min"
|
||||
name="precio_min"
|
||||
required
|
||||
class="form-control"
|
||||
value="<?= old('precio_min', $tarifaextraEntity->precio_min) ?>"
|
||||
>
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="importe_fijo" class="form-label">
|
||||
<?= lang('Tarifaextra.importeFijo') ?>*
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="importe_fijo"
|
||||
name="importe_fijo"
|
||||
required
|
||||
class="form-control"
|
||||
value="<?= old('importe_fijo', $tarifaextraEntity->importe_fijo) ?>"
|
||||
>
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="margen" class="form-label">
|
||||
<?= lang('Tarifaextra.margen') ?>*
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="margen"
|
||||
name="margen"
|
||||
required
|
||||
class="form-control"
|
||||
value="<?= old('margen', $tarifaextraEntity->margen) ?>"
|
||||
>
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="form-check form-check-inline">
|
||||
<input type="checkbox"
|
||||
id="mostrar_en_presupuesto"
|
||||
name="mostrar_en_presupuesto"
|
||||
value="1"
|
||||
class="form-check-input"<?= $tarifaextraEntity->mostrar_en_presupuesto == true ? 'checked' : ''; ?>
|
||||
>
|
||||
<label for="mostrar_en_presupuesto" class="form-check-label">
|
||||
<?= lang('Tarifaextra.mostrar_en_presupuesto') ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div><!--//.col -->
|
||||
|
||||
</div><!-- //.row -->
|
||||
@ -0,0 +1,30 @@
|
||||
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
|
||||
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
|
||||
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
|
||||
<?= $this->section("content") ?>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card card-info">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title"><?= $boxTitle ?? $pageTitle ?></h3>
|
||||
</div><!--//.card-header -->
|
||||
<form id="tarifaextraForm" method="post" class="card-body" action="<?= $formAction ?>">
|
||||
<?= csrf_field() ?>
|
||||
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
|
||||
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
|
||||
<?= view("themes/backend/vuexy/form/tarifas/extra/_tarifaextraFormItems") ?>
|
||||
<div class="pt-4">
|
||||
<input
|
||||
type="submit"
|
||||
class="btn btn-primary float-start me-sm-3 me-1"
|
||||
name="save"
|
||||
value="<?= lang("Basic.global.Save") ?>"
|
||||
/>
|
||||
<?= anchor(route_to("tarifaextraList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary"]) ?>
|
||||
|
||||
</div><!-- /.card-footer -->
|
||||
</form>
|
||||
</div><!-- //.card -->
|
||||
</div><!--//.col -->
|
||||
</div><!--//.row -->
|
||||
<?= $this->endSection() ?>
|
||||
120
ci4/app/Views/themes/backend/vuexy/form/tarifas/extra/viewTarifaextraList.php
Executable file
120
ci4/app/Views/themes/backend/vuexy/form/tarifas/extra/viewTarifaextraList.php
Executable file
@ -0,0 +1,120 @@
|
||||
<?=$this->include('themes/_commonPartialsBs/datatables') ?>
|
||||
<?=$this->extend('themes/backend/vuexy/main/defaultlayout') ?>
|
||||
<?=$this->section('content'); ?>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<div class="card card-info">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title"><?=lang('Tarifaextra.tarifaextraList') ?></h3>
|
||||
<?=anchor(route_to('newTarifaextra'), lang('Basic.global.addNew').' '.lang('Tarifaextra.tarifaextra'), ['class'=>'btn btn-primary float-end']); ?>
|
||||
</div><!--//.card-header -->
|
||||
<div class="card-body">
|
||||
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
|
||||
|
||||
<table id="tableOfTarifasextra" class="table table-striped table-hover using-exportable-data-table" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= lang('Tarifaextra.nombre') ?></th>
|
||||
<th><?= lang('Tarifaextra.precio') ?></th>
|
||||
<th><?= lang('Tarifaextra.precioMin') ?></th>
|
||||
<th><?= lang('Tarifaextra.importeFijo') ?></th>
|
||||
<th><?= lang('Tarifaextra.margen') ?></th>
|
||||
<th><?= lang('Tarifaextra.mostrar_en_presupuesto') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($tarifaextraList as $item ) : ?>
|
||||
<tr>
|
||||
<td class="align-middle">
|
||||
<?= empty($item->nombre) || strlen($item->nombre) < 51 ? esc($item->nombre) : character_limiter(esc($item->nombre), 50) ?>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<?= esc($item->precio) ?>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<?= esc($item->precio_min) ?>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<?= esc($item->importe_fijo) ?>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<?= esc($item->margen) ?>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<?= esc($item->mostrar_en_presupuesto)==1?'<i class="ti ti-check"></i>':"" ?>
|
||||
</td>
|
||||
<td class="align-middle text-center text-nowrap">
|
||||
<?=anchor(route_to('editTarifaextra', $item->id), "<i class='ti ti-pencil ti-sm mx-2'></i>", ['class'=>'text-body', 'data-id'=>$item->id,]); ?>
|
||||
<?=anchor('#confirm2delete', "<i class='ti ti-trash ti-sm mx-2'></i>", ['class'=>'text-body', 'data-href'=>route_to('deleteTarifaextra', $item->id), 'data-bs-toggle'=>'modal', 'data-bs-target'=>'#confirm2delete']); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div><!--//.card-body -->
|
||||
<div class="card-footer">
|
||||
|
||||
</div><!--//.card-footer -->
|
||||
</div><!--//.card -->
|
||||
</div><!--//.col -->
|
||||
</div><!--//.row -->
|
||||
|
||||
<?=$this->endSection() ?>
|
||||
|
||||
<?=$this->section('css') ?>
|
||||
<link rel="stylesheet" href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.css") ?>">
|
||||
<?=$this->endSection() ?>
|
||||
|
||||
|
||||
<?= $this->section('additionalExternalJs') ?>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/dataTables.buttons.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.html5.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.print.min.js") ?>"></script>
|
||||
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/jszip/jszip.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/pdfmake.min.js") ?>" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/vfs_fonts.js") ?>"></script>
|
||||
|
||||
<?=$this->endSection() ?>
|
||||
|
||||
<?=$this->section('additionalInlineJs') ?>
|
||||
|
||||
const lastColNr2 = $(".using-exportable-data-table").find("tr:first th").length - 1;
|
||||
theTable = $('.using-exportable-data-table').DataTable({
|
||||
"responsive": true,
|
||||
"paging": true,
|
||||
"lengthMenu": [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ],
|
||||
"pageLength": 50,
|
||||
"lengthChange": true,
|
||||
"searching": true,
|
||||
"ordering": true,
|
||||
"info": true,
|
||||
"dom": 'lfBrtip', // 'lfBrtip', // you can try different layout combinations by uncommenting one or the other
|
||||
// "dom": '<"top"lf><"clear">rt<"bottom"ipB><"clear">', // remember to comment this line if you uncomment the above
|
||||
"buttons": [
|
||||
'copy', 'csv', 'excel', 'print', {
|
||||
extend: 'pdfHtml5',
|
||||
orientation: 'landscape',
|
||||
pageSize: 'A4'
|
||||
}
|
||||
],
|
||||
"autoWidth": true,
|
||||
"scrollX": true,
|
||||
"stateSave": true,
|
||||
"language": {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
"columnDefs": [
|
||||
{
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
targets: [lastColNr2]
|
||||
}
|
||||
]
|
||||
});
|
||||
<?=$this->endSection() ?>
|
||||
@ -1,4 +1,4 @@
|
||||
<?php $menus = getMenuControl(); ?>
|
||||
<?php $menus = getMenuControl(); ?>
|
||||
|
||||
<!-- Menu -->
|
||||
<aside id="layout-menu" class="layout-menu menu-vertical menu bg-menu-theme">
|
||||
@ -409,7 +409,7 @@
|
||||
*/
|
||||
if (allowMenuSection($menus,
|
||||
['Tarifaacabado', 'Tarifasenvios', 'Tarifaimpresion', 'Tarifamanipulado', 'Tarifaencuadernacion',
|
||||
'Tarifapapelcompra', 'Tarifapapeldefecto', 'Tarifapreimpresion'
|
||||
'Tarifapapelcompra', 'Tarifapapeldefecto', 'Tarifapreimpresion', 'Tarifaextra'
|
||||
], 'index')): ?>
|
||||
<!-- Prices -->
|
||||
<li class="menu-item">
|
||||
@ -490,6 +490,15 @@
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php if (count($temp = getArrayItem($menus, 'name', 'Tarifaextra')) > 0): ?>
|
||||
<?php if (count(getArrayItem($temp, 'methods', 'index', true)) > 0): ?>
|
||||
<li class="menu-item">
|
||||
<a href="<?= site_url("tarifas/tarifaextra") ?>" class="menu-link">
|
||||
<div data-i18n="<?= lang("App.menu_tarifaextra") ?>"><?= lang("App.menu_tarifaextra") ?></div>
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
@ -556,7 +556,7 @@
|
||||
* MENU TARIFAS
|
||||
*/
|
||||
if (allowMenuSection($menus,
|
||||
['Tarifapreimpresion', 'Tarifasmanipulado', 'Tarifaacabado', 'Tarifasenvios', 'Tarifasencuadernacion'], 'index')): ?>
|
||||
['Tarifapreimpresion', 'Tarifasmanipulado', 'Tarifaacabado', 'Tarifasenvios', 'Tarifasencuadernacion, Tarifasextra'], 'index')): ?>
|
||||
<!-- Prices -->
|
||||
<li class="menu-item">
|
||||
<a href="javascript:void(0);" class="menu-link menu-toggle">
|
||||
@ -609,6 +609,15 @@
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php if (count($temp = getArrayItem($menus, 'name', 'Tarifaextra')) > 0): ?>
|
||||
<?php if (count(getArrayItem($temp, 'methods', 'index', true)) > 0): ?>
|
||||
<li class="menu-item">
|
||||
<a href="<?= site_url("tarifas/tarifaextra") ?>" class="menu-link">
|
||||
<div data-i18n="<?= lang("App.menu_tarifaextra") ?>"><?= lang("App.menu_tarifaextra") ?></div>
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
Reference in New Issue
Block a user