mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
terminados albaranes
This commit is contained in:
@ -175,6 +175,13 @@ class Albaran extends \App\Controllers\BaseResourceController
|
||||
return $this->respond($data);
|
||||
}
|
||||
|
||||
if($fieldName == 'fecha_albaran'){
|
||||
if($fieldValue == null || $fieldValue == '')
|
||||
$fieldValue = null;
|
||||
else
|
||||
$fieldValue = date('Y-m-d H:i:s', strtotime($fieldValue));
|
||||
}
|
||||
|
||||
$albaranEntity->fill([
|
||||
$fieldName => $fieldValue,
|
||||
'user_updated_id' => auth()->user()->id,
|
||||
|
||||
@ -14,6 +14,7 @@ class AlbaranEntity extends \CodeIgniter\Entity\Entity
|
||||
'mostrar_precios' => null,
|
||||
'direccion_albaran' => null,
|
||||
'att_albaran' => null,
|
||||
'fecha_albaran' => null,
|
||||
'user_created_id' => null,
|
||||
'user_updated_id' => null,
|
||||
'created_at' => null,
|
||||
@ -38,6 +39,7 @@ class AlbaranEntity extends \CodeIgniter\Entity\Entity
|
||||
'att_albaran' => '?string',
|
||||
'user_created_id' => 'integer',
|
||||
'user_updated_id' => 'integer',
|
||||
'fecha_albaran' => '?datetime',
|
||||
];
|
||||
|
||||
// Agrega tus métodos personalizados aquí
|
||||
|
||||
@ -22,6 +22,7 @@ class AlbaranModel extends \App\Models\BaseModel
|
||||
'numero_albaran',
|
||||
'mostrar_precios',
|
||||
'direccion_albaran',
|
||||
'fecha_albaran',
|
||||
'att_albaran',
|
||||
'user_created_id',
|
||||
'user_updated_id',
|
||||
|
||||
@ -283,6 +283,7 @@
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.css') ?>" />
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.1/css/rowReorder.dataTables.min.css">
|
||||
<link rel="stylesheet" href="https://code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">
|
||||
<link rel="stylesheet" href="<?= site_url("/themes/vuexy/vendor/libs/flatpickr/flatpickr.css") ?>">
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
@ -290,7 +291,5 @@
|
||||
<script src="https://code.jquery.com/ui/1.13.2/jquery-ui.min.js"></script>
|
||||
<script src="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.js') ?>"></script>
|
||||
<script src="https://cdn.datatables.net/rowgroup/1.3.1/js/dataTables.rowGroup.min.js"></script>
|
||||
|
||||
<script src="https://cdn.datatables.net/rowreorder/1.4.1/js/dataTables.rowReorder.min.js"></script>
|
||||
<script type="module" src="<?= site_url("assets/js/safekat/pages/logistica/envioEdit.js") ?>"></script>
|
||||
<?= $this->endSection() ?>
|
||||
@ -52,7 +52,7 @@
|
||||
FECHA:
|
||||
</th>
|
||||
<th class="text-start fecha">
|
||||
<?= $albaran->fecha_albaran ? date('d-m-Y', strtotime($albaran->fecha_albaran)) : date('d-m-Y') ?>
|
||||
<?= $albaran->fecha_albaran ? $albaran->fecha_albaran : date('d-m-Y') ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import DatePicker from "./datepicker.js";
|
||||
class AlbaranComponent {
|
||||
|
||||
constructor(item) {
|
||||
@ -8,9 +9,15 @@ class AlbaranComponent {
|
||||
this.att = item.att;
|
||||
this.direccion = item.direccion;
|
||||
this.envio_id = item.envio_id;
|
||||
this.fecha = null;
|
||||
if(this.item.fecha_albaran != null){
|
||||
const [dia, mes, anio] = item.fecha_albaran.split('/');
|
||||
this.fecha = `${anio}-${mes.padStart(2, '0')}-${dia.padStart(2, '0')}`;
|
||||
}
|
||||
this.selectorTabla = `#tablaAlbaran${this.id}`;
|
||||
|
||||
this.table = null;
|
||||
this.fechaAlbaran = null;
|
||||
}
|
||||
|
||||
mount(selector) {
|
||||
@ -257,6 +264,15 @@ class AlbaranComponent {
|
||||
}
|
||||
});
|
||||
|
||||
const option = {
|
||||
altInput: true,
|
||||
altFormat: "d/m/Y",
|
||||
dateFormat: "Y-m-d",
|
||||
allowInput: true,
|
||||
}
|
||||
this.fechaAlbaran = new DatePicker($('#fecha_albaran_' + this.id), option);
|
||||
this.fechaAlbaran.setDate(this.fecha);
|
||||
|
||||
$('#tablaAlbaran' + this.id).on('click', '.btn-delete-albaran-lineas', (e) => {
|
||||
e.preventDefault();
|
||||
const table = $('#tablaAlbaran' + this.id).DataTable();
|
||||
@ -386,6 +402,33 @@ class AlbaranComponent {
|
||||
});
|
||||
});
|
||||
|
||||
$('#fecha_albaran_' + this.item.id).on('change', (e) => {
|
||||
const value = $(e.currentTarget).val();
|
||||
const albaranId = this.id;
|
||||
|
||||
$.post('/albaranes/updateAlbaran', {
|
||||
albaranId: albaranId,
|
||||
fieldName: 'fecha_albaran',
|
||||
fieldValue: value
|
||||
}, (response) => {
|
||||
if (response.success) {
|
||||
this.table.ajax.reload(null, false);
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: 'Error',
|
||||
text: 'No se ha podido actualizar el albarán',
|
||||
icon: 'error',
|
||||
showCancelButton: false,
|
||||
confirmButtonColor: '#3085d6',
|
||||
confirmButtonText: 'Ok',
|
||||
customClass: {
|
||||
confirmButton: 'btn btn-primary me-1',
|
||||
},
|
||||
buttonsStyling: false
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#borrar_albaran_" + this.item.id).on('click', (e) => {
|
||||
e.preventDefault();
|
||||
@ -547,7 +590,7 @@ class AlbaranComponent {
|
||||
var albaran_id = this.id;
|
||||
window.open('/print-albaran/generar/'+ albaran_id , '_blank');
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
_initAutoNumericInputs() {
|
||||
|
||||
Reference in New Issue
Block a user