subidos ficheros

This commit is contained in:
2025-04-26 18:08:41 +02:00
parent 5aa2a2e6c9
commit 7f31e65960
5 changed files with 339 additions and 0 deletions

View File

@ -0,0 +1,36 @@
<?php
namespace App\Database\Migrations;
use App\Models\OrdenTrabajo\OrdenTrabajoTarea;
use CodeIgniter\Database\Migration;
use CodeIgniter\Database\RawSql;
use CodeIgniter\I18n\Time;
class AddClickColumnOrdenTrabajoTarea extends Migration
{
protected array $COLUMNS = [
"click_init" => [
"type" => "INT",
"unsigned" => true,
"default" => 0,
"comment" => "Click iniciales de una tarea de impresion"
],
"click_end" => [
"type" => "INT",
"unsigned" => true,
"default" => 0,
"comment" => "Click finales de una tarea de impresion"
],
];
public function up()
{
$this->forge->addColumn('orden_trabajo_tareas', $this->COLUMNS);
}
public function down()
{
$this->forge->dropColumn('orden_trabajo_tareas', array_keys($this->COLUMNS));
}
}

View File

@ -0,0 +1,35 @@
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
<?= $this->section('content'); ?>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h4><?= $boxTitle ?></h4>
</div>
<div id="albaranContainer" class="card-body">
<input type="hidden" id="id" value="<?= $albaranId ?>">
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
</div>
</div>
</div>
</div>
<?= $this->endSection() ?>
<?= $this->section('css') ?>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.css') ?>" />
<?= $this->endSection() ?>
<?= $this->section('additionalExternalJs') ?>
<script src="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.js') ?>"></script>
<script type="module" src="<?= site_url("assets/js/safekat/pages/albaranes/edit.js") ?>"></script>
<?= $this->endSection() ?>

View File

@ -0,0 +1,65 @@
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
<?= $this->section('content'); ?>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h4><?= $boxTitle ?></h4>
</div>
<div class="card-body">
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
<table id="tableOfAlbaranes" class="table table-striped table-hover w-100">
<thead>
<tr>
<th><?= lang('Albaran.id') ?></th>
<th><?= lang('Albaran.numAlbaran') ?></th>
<th><?= lang('Albaran.numEnvio') ?></th>
<th><?= lang('Albaran.numPedidos') ?></th>
<th><?= lang('Albaran.cliente') ?></th>
<th><?= lang('Albaran.att') ?></th>
<th><?= lang('Albaran.direccion') ?></th>
<th><?= lang('Albaran.unidadesTotal') ?></th>
<th><?= lang('Albaran.cajas') ?></th>
<th><?= lang('Albaran.acciones') ?? 'Acciones' ?></th>
</tr>
<tr>
<th><input type="text" class="form-control albaran-filter" name="id"></th>
<th><input type="text" class="form-control albaran-filter" name="numero_albaran"></th>
<th><input type="text" class="form-control albaran-filter" name="envio_id"></th>
<th><input type="text" class="form-control albaran-filter-pedidos" name="pedidos"></th>
<th><input type="text" class="form-control albaran-filter" name="cliente"></th>
<th><input type="text" class="form-control albaran-filter" name="att"></th>
<th><input type="text" class="form-control albaran-filter" name="direccion"></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
<?= $this->endSection() ?>
<?= $this->section('css') ?>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.css') ?>" />
<?= $this->endSection() ?>
<?= $this->section('additionalExternalJs') ?>
<script src="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.js') ?>"></script>
<script type="module" src="<?= site_url("assets/js/safekat/pages/albaranes/list.js") ?>"></script>
<?= $this->endSection() ?>

View File

@ -0,0 +1,43 @@
import Ajax from '../../components/ajax.js';
import AlbaranComponent from '../../components/albaranComponent.js';
$(() => {
const dropdown = document.querySelector(".dropdown-language");
const activeItem = dropdown.querySelector(".dropdown-menu .dropdown-item");
let locale = 'es';
if (activeItem) {
locale = activeItem.getAttribute("data-language");
}
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['Albaran'] }, {},
function (translations) {
window.language = JSON.parse(translations);
new Ajax(
'/albaranes/getAlbaran',
{
id: $('#id').val()
},
{},
function (data, headers, success, error, type) {
if (success) {
const albaran = new AlbaranComponent(data.data, '/logistica/listAlbaranes');
albaran.mount('#albaranContainer');
$('.accordion-button').trigger('click');
} else {
popErrorAlert(error);
}
},
function (data, headers, success, error, type) {
popErrorAlert(error);
}
).get();
},
function (error) {
console.log("Error getting translations:", error);
}
).post();
});

View File

@ -0,0 +1,160 @@
import Ajax from "../../components/ajax.js";
$(() => {
let pedidosFilter = '';
const dropdown = document.querySelector(".dropdown-language");
const activeItem = dropdown.querySelector(".dropdown-menu .dropdown-item");
let locale = 'es';
if (activeItem) {
locale = activeItem.getAttribute("data-language");
}
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['Albaran'] }, {},
function (translations) {
window.language = JSON.parse(translations);
},
function (error) {
console.log("Error getting translations:", error);
}
).post();
$('#btnAddEnvio').on('click', () => {
const pedido_id = selectPedidos.getVal();
const direccionSeleccionada = selectDirecciones.getText();
$.post('/albaranes/datatable', {
pedido_id: pedido_id,
direccion: direccionSeleccionada
}, function (response) {
if (response.status) {
window.open(`${window.location.origin}/logistica/envio/${response.data.id_envio}`);
selectDirecciones.empty();
selectPedidos.empty();
$('.select-direcciones').addClass('d-none');
$('.add-envio').addClass('d-none');
} else {
popErrorAlert(response.message);
}
}).fail(function (xhr, status, error) {
popErrorAlert(error);
});
})
const tableAlbaranes = $('#tableOfAlbaranes').DataTable({
processing: true,
serverSide: true,
autoWidth: true,
responsive: true,
scrollX: true,
orderCellsTop: true,
lengthMenu: [5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500],
pageLength: 50,
"dom": 'lBrtip',
"ajax": {
"url": "/albaranes/datatable",
"data": function (d) {
d.pedidosFilter = pedidosFilter;
}
},
"columns": [
{ "data": "id" },
{ "data": "numero_albaran" },
{ "data": "envio_id" },
{ "data": "pedidos" },
{ "data": "cliente" },
{ "data": "att" },
{ "data": "direccion" },
{ "data": "unidades_total" },
{ "data": "cajas" },
{ "data": "action" }
],
"language": {
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
},
"columnDefs": [
{
orderable: false,
searchable: false,
targets: [9]
},
],
"order": [[0, "desc"]],
});
$(document).on('click', '.btn-delete', function (e) {
const data = {
albaranId: $(this).attr('data-id')
};
const url = '/albaranes/borrarAlbaran';
Swal.fire({
title: window.language.Albaran.borrarAlbaran,
text: window.language.Albaran.borrarAlbaranConfirm,
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: window.language.Albaran.borrar,
cancelButtonText: window.language.Albaran.cancelar,
customClass: {
confirmButton: 'btn btn-primary me-1',
cancelButton: 'btn btn-outline-secondary'
},
buttonsStyling: false
}).then((result) => {
$.ajax({
url: url,
type: 'POST',
data: data,
success: (response) => {
if (response.success) {
tableAlbaranes.draw();
} else {
Swal.fire({
title: 'Error',
text: 'No se ha podido borrar el albarán',
icon: 'error',
showCancelButton: false,
confirmButtonColor: '#3085d6',
confirmButtonText: 'Ok',
customClass: {
confirmButton: 'btn btn-primary me-1',
},
buttonsStyling: false
});
}
},
error: (xhr, status, error) => {
console.error(error);
}
});
});
});
$(document).on('click', '.btn-edit', function (e) {
window.location.href = '/albaranes/edit/' + $(this).attr('data-id');
});
$(document).on("keyup", ".albaran-filter", (event) => {
let columnName = $(event.currentTarget).attr("name");
let columnIndex = $('#tableOfAlbaranes').DataTable().columns().eq(0).filter(function (index) {
return $('#tableOfAlbaranes').DataTable().column(index).dataSrc() === columnName;
})[0];
$('#tableOfAlbaranes').DataTable().column(columnIndex).search($(event.currentTarget).val()).draw()
})
$(document).on("keyup", ".albaran-filter-pedidos", (event) => {
pedidosFilter = $(event.currentTarget).val();
$('#tableOfAlbaranes').DataTable().ajax.reload();
})
});