feat/ot-datatable-news

This commit is contained in:
amazuecos
2025-05-02 07:56:28 +02:00
parent 9283059f9d
commit 5138681718
14 changed files with 346 additions and 65 deletions

View File

@ -6,6 +6,12 @@ class OrdenTrabajoDatatable {
this.datatablePendientesItem = this.item.find("#ot-datatable-pendientes")
this.datatableFerroPendienteItem = this.item.find("#ot-datatable-ferro-pendiente")
this.datatableFerroOkItem = this.item.find("#ot-datatable-ferro-ok")
this.datatableNews = this.item.find("#ot-datatable-news")
this.datatableProd = this.item.find("#ot-datatable-prod")
this.datatableWaiting = this.item.find("#ot-datatable-waiting")
this.datatableRevisionComerical = this.item.find("#ot-datatable-revision-com")
this.datatableColumns = [
@ -37,15 +43,15 @@ class OrdenTrabajoDatatable {
render: (d, t) => {
return `<div class="btn-group btn-group-sm">
<a type="button" href="/produccion/ordentrabajo/edit/${d}" class=" btn btn-outline ot-edit"><i class="ti ti-eye ti-sm mx-2"></i></a>
<a type="button" target="_blank" href="/produccion/ordentrabajo/pdf/${d}" class="btn btn-outline ot-pdf"><i class="ti ti-download ti-sm mx-2"></i></a>
</div>`
}
// <a type="button" target="_blank" href="/produccion/ordentrabajo/pdf/${d}" class="btn btn-outline ot-pdf"><i class="ti ti-download ti-sm mx-2"></i></a>
}
]
}
init() {
this.datatable = this.datatableItem.DataTable({
this.datatableItem.DataTable({
processing: true,
layout: {
topStart: 'pageLength',
@ -71,7 +77,7 @@ class OrdenTrabajoDatatable {
});
}
initPendientes() {
this.datatable = this.datatablePendientesItem.DataTable({
this.datatablePendientesItem.DataTable({
processing: true,
layout: {
topStart: 'pageLength',
@ -98,7 +104,7 @@ class OrdenTrabajoDatatable {
});
}
initFerroPendiente() {
this.datatable = this.datatableFerroPendienteItem.DataTable({
this.datatableFerroPendienteItem.DataTable({
processing: true,
layout: {
topStart: 'pageLength',
@ -124,7 +130,7 @@ class OrdenTrabajoDatatable {
});
}
initFerroOk() {
this.datatable = this.datatableFerroOkItem.DataTable({
this.datatableFerroOkItem.DataTable({
processing: true,
layout: {
topStart: 'pageLength',
@ -149,6 +155,110 @@ class OrdenTrabajoDatatable {
}
});
}
initNews() {
this.datatableNews.DataTable({
processing: true,
layout: {
topStart: 'pageLength',
topEnd: 'search',
bottomStart: 'info',
bottomEnd: 'paging'
},
serverSide: true,
columnDefs: [
{ className: 'dt-center', targets: '_all' },
],
pageLength: 25,
language: {
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
},
columns: this.datatableColumns,
ajax: '/produccion/ordentrabajo/datatable_news',
createdRow: (row,data,dataIndex) => {
$(row).css("border-left",`20px solid ${data.logo.color}`)
$(row).css("border-right",`20px solid ${data.logo.color}`)
}
});
}
initWaiting() {
this.datatableWaiting.DataTable({
processing: true,
layout: {
topStart: 'pageLength',
topEnd: 'search',
bottomStart: 'info',
bottomEnd: 'paging'
},
serverSide: true,
columnDefs: [
{ className: 'dt-center', targets: '_all' },
],
pageLength: 25,
language: {
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
},
columns: this.datatableColumns,
ajax: '/produccion/ordentrabajo/datatable_waiting',
createdRow: (row,data,dataIndex) => {
$(row).css("border-left",`20px solid ${data.logo.color}`)
$(row).css("border-right",`20px solid ${data.logo.color}`)
}
});
}
initProd() {
this.datatableProd.DataTable({
processing: true,
layout: {
topStart: 'pageLength',
topEnd: 'search',
bottomStart: 'info',
bottomEnd: 'paging'
},
serverSide: true,
columnDefs: [
{ className: 'dt-center', targets: '_all' },
],
pageLength: 25,
language: {
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
},
columns: this.datatableColumns,
ajax: '/produccion/ordentrabajo/datatable_prod',
createdRow: (row,data,dataIndex) => {
$(row).css("border-left",`20px solid ${data.logo.color}`)
$(row).css("border-right",`20px solid ${data.logo.color}`)
}
});
}
initRevisionComercial() {
this.datatableRevisionComerical.DataTable({
processing: true,
layout: {
topStart: 'pageLength',
topEnd: 'search',
bottomStart: 'info',
bottomEnd: 'paging'
},
serverSide: true,
columnDefs: [
{ className: 'dt-center', targets: '_all' },
],
pageLength: 25,
language: {
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
},
columns: this.datatableColumns,
ajax: '/produccion/ordentrabajo/datatable_revision_com',
createdRow: (row,data,dataIndex) => {
$(row).css("border-left",`20px solid ${data.logo.color}`)
$(row).css("border-right",`20px solid ${data.logo.color}`)
}
});
}
}

View File

@ -53,6 +53,8 @@ class MaquinistaTareaView {
}
disableButtons() {
this.actionButtons.attr('disabled', 'disabled')
this.btnDelay.attr('disabled','disabled')
this.btnDeleteProgress.attr('disabled','disabled')
}
enableButtons() {
this.actionButtons.removeAttr('disabled')
@ -126,9 +128,7 @@ class MaquinistaTareaView {
console.log("Last status :", lastStatus)
this.showBasedOnStatus(lastStatus)
}
if (response.tiempo_trabajado) {
this.item.find('#tiempo-real-info').html(response.tiempo_trabajado)
}
this.item.find('#tiempo-real-info').html(response.tiempo_trabajado ?? "00:00")
this.actionLoader(false)
}
@ -146,15 +146,25 @@ class MaquinistaTareaView {
this.handleUpdateTareaProgressError.bind(this),
)
if (this.tareaId) {
ajax.post();
if(status == "F"){
alertConfirmAction('La tarea se marcará como finalizada')
.then(result => {
if (result.isConfirmed) {
ajax.post();
}
})
}else{
ajax.post();
}
}
}
handleUpdateTareaProgressSuccess(response) {
if (response.data) {
if (response.data.estado == 'D') {
if (response.data.tarea) {
if (response.data.tarea.estado == 'D') {
window.location.href = '/produccion/ordentrabajo/maquinista/maquinas/view'
}
this.showBasedOnStatus(response.data.status)
this.item.find('#tiempo-real-info').html(response.data.tiempo_trabajado ?? "00:00")
this.showBasedOnStatus(response.data.estado)
alertSuccess(response.message, null, { position: 'top' }).fire()
}
this.actionLoader(false)

View File

@ -1,9 +1,13 @@
import OrdenTrabajoDatatable from '../../components/datatables/otDatatable.js'
$(function() {
$(function () {
const otDatatable = new OrdenTrabajoDatatable($("#ots-datatables-container"))
otDatatable.init()
otDatatable.initPendientes()
otDatatable.initFerroPendiente()
otDatatable.initFerroOk()
otDatatable.initNews()
otDatatable.initProd()
otDatatable.initWaiting()
// otDatatable.initRevisionComercial()
})

View File

@ -21,7 +21,8 @@ class OrdenTrabajo {
this.btnErasePedidoDate = this.item.find('.btn-erase-pedido-date');
this.isOtFinalizada = false;
this.tiempoTotal = this.item.find('#tiempo-total')
this.tiempoEstimado = this.item.find('#tiempo-estimado')
this.btnResetTareas = this.item.find("#btn-reset-tareas")
this.pedidoEnEsperaCheck = this.item.find("#ot-pedido-espera");
this.pedidoEnEsperaBy = this.item.find("#pedido_espera_by");
@ -278,7 +279,6 @@ class OrdenTrabajo {
createSelectMaquinaTarea() {
try {
$('.select-proveedor-tarea-datatable').each((index, element) => {
console.log(element)
this.createSelectProveedor($(element))
})
this.summaryData.tasks.forEach(async (element) => {
@ -472,6 +472,8 @@ class OrdenTrabajo {
fillOtDetails() {
const progreso = this.summaryData.ot.progreso
this.otForm.find("#ot-progress-bar").attr('aria-valuenow', progreso).text(progreso + "%").css("width", progreso + "%")
this.tiempoEstimado.html(this.summaryData.tiempo_procesamiento)
this.tiempoTotal.html(this.summaryData.tiempo_total)
}
fillOtDates() {
this.fechaImpresion.setDate(this.summaryData.pedido.fecha_impresion)
@ -861,7 +863,6 @@ class OrdenTrabajo {
alertConfirmationDelete()
.then(result => {
if (result.isConfirmed) {
console.log(name)
ajax.post()
}
})
@ -892,7 +893,6 @@ class OrdenTrabajo {
alertConfirmationDelete()
.then(result => {
if (result.isConfirmed) {
console.log(name)
ajax.post()
}
})