mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'main' into feat/sk-7/planning
This commit is contained in:
@ -13,9 +13,20 @@
|
||||
<!--//.card-header -->
|
||||
<form id="pedidoForm" method="post" class="card-body" action="<?= $formAction ?>">
|
||||
<?= csrf_field() ?>
|
||||
<div class="card-body">
|
||||
<div class="card-body pt-0">
|
||||
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
|
||||
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
|
||||
<?php if (isset($orden_id)): ?>
|
||||
<div class="row mt-1 justify-content-end">
|
||||
<div class="col-auto">
|
||||
<div class="btn mt-3 btn-warning waves-effect waves-light ml-2"
|
||||
onclick="window.location.href='<?= route_to("viewOrdenTrabajoEdit", $orden_id) ?>'" >
|
||||
<span class="align-middle d-sm-inline-block d-none me-sm-1">Orden</span>
|
||||
<i class="ti ti-building-factory-2 ti-xs"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?= view("themes/vuexy/form/pedidos/_cabeceraItems") ?>
|
||||
<?= view("themes/vuexy/form/pedidos/_lineasItems") ?>
|
||||
<?php if (!(auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor'))) : ?>
|
||||
@ -29,7 +40,7 @@
|
||||
<div class="row">
|
||||
<div class="col-md-12 d-flex justify-content-between">
|
||||
<div class="pt-4">
|
||||
<?= anchor(route_to("listaPresupuestos"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start"]) ?>
|
||||
<?= anchor(route_to("listaPedidos"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start"]) ?>
|
||||
</div><!-- /.card-footer -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -72,10 +72,10 @@ $('#tableOfPedidos thead tr:eq(1) th').each(function (i) {
|
||||
var title = $(this).text();
|
||||
if($(this).hasClass("totalizador")){
|
||||
if(i==9){
|
||||
$(this).html('<span id="total_tirada" class="autonumeric"></span>');
|
||||
$(this).html('<span id="total_tirada" class="autonumeric-int"></span><br><span id="total_tirada_2" class="mostrar-totales autonumeric-int d-none"></span>');
|
||||
}
|
||||
else if(i==10){
|
||||
$(this).html('<span id="total_aceptado" class="autonumeric"></span>');
|
||||
$(this).html('<span id="total_aceptado" class="autonumeric"></span>€<br><span id="total_aceptado_2" class="mostrar-totales autonumeric d-none"></span><span class="mostrar-totales d-none">€</span>');
|
||||
}
|
||||
}
|
||||
else{
|
||||
@ -125,25 +125,31 @@ $('#tableOfPedidos thead tr:eq(1) th').each(function (i) {
|
||||
|
||||
}
|
||||
else if (i == 11) {
|
||||
// Agregar un selector en la tercera columna
|
||||
$(this).html('<select class="form-control" style="min-width:100px;max-width:120px;font-size:0.8rem !important;"></select>');
|
||||
|
||||
// Agregar opciones al selector
|
||||
var selector = $('select', this);
|
||||
if("<?= $estadoPedidos ?>" == "" || "<?= $estadoPedidos ?>" == "todos"){
|
||||
|
||||
selector.append('<option value="">Todos</option>'); // Opción vacía
|
||||
selector.append('<option value="validacion"><?= lang('Pedidos.validacion') ?></option>');
|
||||
selector.append('<option value="produccion"><?= lang('Pedidos.produccion') ?></option>');
|
||||
selector.append('<option value="finalizado"><?= lang('Pedidos.finalizado') ?></option>');
|
||||
selector.append('<option value="enviado"><?= lang('Pedidos.enviado') ?></option>');
|
||||
selector.append('<option value="cancelado"><?= lang('Pedidos.cancelado') ?></option>');
|
||||
|
||||
selector.on('change', function () {
|
||||
var val = $.fn.dataTable.util.escapeRegex(
|
||||
$(this).val()
|
||||
);
|
||||
theTable.column(i).search(val).draw();
|
||||
});
|
||||
$(this).html('<select class="form-control" style="min-width:100px;max-width:120px;font-size:0.8rem !important;"></select>');
|
||||
|
||||
// Agregar opciones al selector
|
||||
var selector = $('select', this);
|
||||
|
||||
selector.append('<option value="">Todos</option>'); // Opción vacía
|
||||
selector.append('<option value="validacion"><?= lang('Pedidos.validacion') ?></option>');
|
||||
selector.append('<option value="produccion"><?= lang('Pedidos.produccion') ?></option>');
|
||||
selector.append('<option value="finalizado"><?= lang('Pedidos.finalizado') ?></option>');
|
||||
selector.append('<option value="enviado"><?= lang('Pedidos.enviado') ?></option>');
|
||||
selector.append('<option value="cancelado"><?= lang('Pedidos.cancelado') ?></option>');
|
||||
|
||||
selector.on('change', function () {
|
||||
var val = $.fn.dataTable.util.escapeRegex(
|
||||
$(this).val()
|
||||
);
|
||||
theTable.column(i).search(val).draw();
|
||||
});
|
||||
}
|
||||
else{
|
||||
$(this).html('<span></span>');
|
||||
}
|
||||
}
|
||||
else{
|
||||
$(this).html('<input type="text" class="form-control " style="min-width:100px;max-width:120px;font-size:0.8rem !important;" />');
|
||||
@ -189,7 +195,7 @@ $('#tableOfPedidos thead tr:eq(1) th').each(function (i) {
|
||||
}
|
||||
],
|
||||
stateSave: false,
|
||||
order: [[0, 'asc']],
|
||||
order: [[0, 'desc']],
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
@ -256,38 +262,53 @@ $('#tableOfPedidos thead tr:eq(1) th').each(function (i) {
|
||||
{ 'data': actionBtns }
|
||||
],
|
||||
drawCallback: function (settings) {
|
||||
$('#total_tirada').text(settings.json.extra.total_tirada);
|
||||
$('#total_aceptado').text(settings.json.extra.total);
|
||||
}
|
||||
});
|
||||
|
||||
theTable.on( 'draw.dt', function () {
|
||||
const dateCols = [1,2];
|
||||
const priceCols = [10];
|
||||
var api = this.api();
|
||||
|
||||
$('#total_tirada').text(settings.json.extra.total_tirada??0);
|
||||
$('#total_tirada_2').text(settings.json.extra.total_tirada2??0);
|
||||
$('#total_aceptado').text(settings.json.extra.total??0);
|
||||
$('#total_aceptado_2').text(settings.json.extra.total2??0);
|
||||
AutoNumeric.multiple('.autonumeric', { decimalPlaces: 2 });
|
||||
AutoNumeric.multiple('.autonumeric-int', { decimalPlaces: 0 });
|
||||
|
||||
for (let coln of dateCols) {
|
||||
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
||||
const datestr = cell.innerHTML;
|
||||
const dateStrLen = datestr.toString().trim().length;
|
||||
if (dateStrLen > 0) {
|
||||
let dateTimeParts= datestr.split(/[- :]/); // regular expression split that creates array with: year, month, day, hour, minutes, seconds values
|
||||
dateTimeParts[1]--; // monthIndex begins with 0 for January and ends with 11 for December so we need to decrement by one
|
||||
const d = new Date(...dateTimeParts); // new Date(datestr);
|
||||
cell.innerHTML = d.toLocaleDateString();
|
||||
const dateCols = [1,2];
|
||||
const priceCols = [10];
|
||||
|
||||
for (let coln of dateCols) {
|
||||
api.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
||||
const datestr = cell.innerHTML;
|
||||
const dateStrLen = datestr.toString().trim().length;
|
||||
if (dateStrLen > 0) {
|
||||
let dateTimeParts= datestr.split(/[- :]/); // regular expression split that creates array with: year, month, day, hour, minutes, seconds values
|
||||
dateTimeParts[1]--; // monthIndex begins with 0 for January and ends with 11 for December so we need to decrement by one
|
||||
const d = new Date(...dateTimeParts); // new Date(datestr);
|
||||
cell.innerHTML = d.toLocaleDateString();
|
||||
}
|
||||
});
|
||||
}
|
||||
if(<?= $cliente_id ?> != -1){
|
||||
api.column(3).visible(false);
|
||||
}
|
||||
else{
|
||||
api.column(3).visible(true);
|
||||
}
|
||||
},
|
||||
"rowCallback": function(row, data, index) {
|
||||
if('<?= $estadoPedidos ?>' == 'todos'){
|
||||
if (data['estado'] === "cancelado") {
|
||||
$(row).css('background-color', '#ffcccc'); // Rojo claro
|
||||
} else if (data['estado'] === "validacion") {
|
||||
$(row).css('background-color', '#fff5cc'); // Amarillo claro
|
||||
} else if (data['estado'] === "finalizado") {
|
||||
$(row).css('background-color', '#ccffcc'); // Verde claro
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if(<?= $cliente_id ?> != -1){
|
||||
// Se oculta la columna de cliente (3)
|
||||
theTable.column(3).visible(false);
|
||||
}
|
||||
else{
|
||||
theTable.column(3).visible(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$(document).on('click', '.btn-edit', function(e) {
|
||||
@ -301,6 +322,12 @@ $('#tableOfPedidos thead tr:eq(1) th').each(function (i) {
|
||||
});
|
||||
|
||||
$('#showTotal').on('change', function() {
|
||||
if($('#showTotal').is(':checked')){
|
||||
$('.mostrar-totales').removeClass('d-none');
|
||||
}
|
||||
else{
|
||||
$('.mostrar-totales').addClass('d-none');
|
||||
}
|
||||
theTable.clearPipeline();
|
||||
theTable.ajax.reload(null, false);
|
||||
//theTable.draw();
|
||||
|
||||
@ -30,7 +30,29 @@
|
||||
|
||||
<input type="hidden" name="POD" id="POD" class="form-control"
|
||||
value="<?= $POD ?>"></input>
|
||||
|
||||
|
||||
<?php if (isset($orden__id) || isset($pedido_id)): ?>
|
||||
<div class="row mt-1 justify-content-end">
|
||||
<?php if (isset($pedido_id)): ?>
|
||||
<div class="col-auto">
|
||||
<div class="btn mt-3 btn-warning waves-effect waves-light ml-2"
|
||||
onclick="window.location.href='<?= route_to("editarPedido", $pedido_id) ?>'" >
|
||||
<span class="align-middle d-sm-inline-block d-none me-sm-1"><?= lang('Pedidos.pedido') ?></span>
|
||||
<i class="ti ti-file-description ti-xs"></i>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($orden_id)): ?>
|
||||
<div class="col-auto">
|
||||
<div class="btn mt-3 btn-warning waves-effect waves-light ml-2"
|
||||
onclick="window.location.href='<?= route_to("viewOrdenTrabajoEdit", $orden_id) ?>'" >
|
||||
<span class="align-middle d-sm-inline-block d-none me-sm-1">Orden</span>
|
||||
<i class="ti ti-building-factory-2 ti-xs"></i>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?= view("themes/vuexy/form/presupuestos/admin/_datosPresupuestoItems") ?>
|
||||
<?= view("themes/vuexy/form/presupuestos/admin/_datosLibroItems") ?>
|
||||
<?php if (str_contains($formAction, 'edit')): ?>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -16,6 +16,13 @@ if (
|
||||
<?= lang("App.menu_pedidos") ?>
|
||||
</a>
|
||||
<ul class="menu-sub">
|
||||
<?php if (auth()->user()->can('pedidos-validacion.menu')) { ?>
|
||||
<li class="menu-item">
|
||||
<a href="<?= site_url("pedidos/pedido/validacion") ?>" class="menu-link">
|
||||
<?= lang("App.menu_pedidos_validacion") ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if (auth()->user()->can('pedidos-activos.menu')) { ?>
|
||||
<li class="menu-item">
|
||||
<a href="<?= site_url("pedidos/pedido/activos") ?>" class="menu-link">
|
||||
|
||||
Reference in New Issue
Block a user