mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'mod/presupuesto_admin' of https://git.imnavajas.es/jjimenez/safekat into mod/presupuesto_admin
This commit is contained in:
20
httpdocs/assets/js/safekat/components/alerts/sweetAlert.js
Normal file
20
httpdocs/assets/js/safekat/components/alerts/sweetAlert.js
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
|
||||
|
||||
export const alertConfirmationDelete = (title,type="primary") => {
|
||||
return Swal.fire({
|
||||
title: '¿Estás seguro?',
|
||||
text: "Esta acción es irreversible.",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Sí',
|
||||
cancelButtonText: 'Cancelar',
|
||||
customClass: {
|
||||
confirmButton: 'btn btn-danger me-1',
|
||||
cancelButton: 'btn btn-label-secondary'
|
||||
},
|
||||
buttonsStyling: false
|
||||
})
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
|
||||
class ServicioClienteDatatable {
|
||||
constructor(domItem) {
|
||||
this.datatableItem = domItem
|
||||
|
||||
this.datatableColumns = [
|
||||
{ data: 'nombre', searchable: true, sortable: true },
|
||||
{ data: 'code', searchable: true, sortable: true },
|
||||
{ data: 'created_at', searchable: true, sortable: true },
|
||||
{
|
||||
data: 'action', searchable: false, sortable: false,
|
||||
render: (d, t) => {
|
||||
return `<div class="btn-group btn-group-sm">
|
||||
<a href="/configuracion/servicios/edit/${d}" class="servicio-cliente-edit"><i class="ti ti-eye ti-sm mx-2"></i></a>
|
||||
</div>`
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
|
||||
}
|
||||
init() {
|
||||
this.datatable = this.datatableItem.DataTable({
|
||||
processing: true,
|
||||
layout: {
|
||||
topStart: 'pageLength',
|
||||
topEnd: 'search',
|
||||
bottomStart: 'info',
|
||||
bottomEnd: 'paging'
|
||||
},
|
||||
serverSide: true,
|
||||
pageLength: 25,
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
columns: this.datatableColumns,
|
||||
ajax: '/configuracion/servicios/datatable'
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default ServicioClienteDatatable;
|
||||
125
httpdocs/assets/js/safekat/components/datatables/otDatatable.js
Normal file
125
httpdocs/assets/js/safekat/components/datatables/otDatatable.js
Normal file
@ -0,0 +1,125 @@
|
||||
|
||||
class OrdenTrabajoDatatable {
|
||||
constructor(domItem) {
|
||||
this.item = domItem
|
||||
this.datatableItem = this.item.find("#ot-datatable-finalizados")
|
||||
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.datatableColumns = [
|
||||
{ data: 'pedido_id', searchable: false, sortable: false },
|
||||
{ data: 'fecha_encuadernado_at', searchable: false, sortable: false },
|
||||
{ data: 'cliente_nombre', searchable: false, sortable: false },
|
||||
{ data: 'presupuesto_titulo', searchable: false, sortable: false },
|
||||
{ data: 'ubicacion_nombre', searchable: false, sortable: false },
|
||||
{ data: 'total_tirada', searchable: false, sortable: false },
|
||||
{ data: 'tipo_presupuesto_impresion', searchable: false, sortable: false },
|
||||
{
|
||||
data: 'logo', searchable: false, sortable: false, render: (d, t) => {
|
||||
return `<img src="${d}" width="30px" height="30px" alt="logo-impresion" />`
|
||||
}
|
||||
},
|
||||
{
|
||||
data: 'progreso', searchable: false, sortable: false, render: (d, t) => {
|
||||
return `<div class="progress border rounded-2" style="height: 1rem;">
|
||||
<div id="ot-progress-bar" class="progress-bar" role="progressbar" style="width: ${parseInt(d)}%;" aria-valuenow="${d}" aria-valuemin="0" aria-valuemax="100">${d}%</div>
|
||||
</div>
|
||||
`
|
||||
}
|
||||
},
|
||||
{
|
||||
data: 'action', searchable: false, sortable: false,
|
||||
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" href="/produccion/ordentrabajo/pdf/${d}" class="btn btn-outline ot-pdf"><i class="ti ti-download ti-sm mx-2"></i></a>
|
||||
|
||||
</div>`
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
init() {
|
||||
this.datatable = this.datatableItem.DataTable({
|
||||
processing: true,
|
||||
layout: {
|
||||
topStart: 'pageLength',
|
||||
topEnd: 'search',
|
||||
bottomStart: 'info',
|
||||
bottomEnd: 'paging'
|
||||
},
|
||||
columnDefs : [
|
||||
{ className: 'dt-center', targets: '_all' },
|
||||
],
|
||||
serverSide: true,
|
||||
pageLength: 25,
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
columns: this.datatableColumns,
|
||||
ajax: '/produccion/ordentrabajo/datatable'
|
||||
});
|
||||
}
|
||||
initPendientes() {
|
||||
this.datatable = this.datatablePendientesItem.DataTable({
|
||||
processing: true,
|
||||
layout: {
|
||||
topStart: 'pageLength',
|
||||
topEnd: 'search',
|
||||
bottomStart: 'info',
|
||||
bottomEnd: 'paging'
|
||||
},
|
||||
columnDefs : [
|
||||
{ className: 'dt-center', targets: '_all' },
|
||||
],
|
||||
serverSide: true,
|
||||
pageLength: 25,
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
columns: this.datatableColumns,
|
||||
ajax: '/produccion/ordentrabajo/datatable_pendientes'
|
||||
});
|
||||
}
|
||||
initFerroPendiente() {
|
||||
this.datatable = this.datatableFerroPendienteItem.DataTable({
|
||||
processing: true,
|
||||
layout: {
|
||||
topStart: 'pageLength',
|
||||
topEnd: 'search',
|
||||
bottomStart: 'info',
|
||||
bottomEnd: 'paging'
|
||||
},
|
||||
serverSide: true,
|
||||
pageLength: 25,
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
columns: this.datatableColumns,
|
||||
ajax: '/produccion/ordentrabajo/datatable_ferro_pendiente'
|
||||
});
|
||||
}
|
||||
initFerroOk() {
|
||||
this.datatable = this.datatableFerroOkItem.DataTable({
|
||||
processing: true,
|
||||
layout: {
|
||||
topStart: 'pageLength',
|
||||
topEnd: 'search',
|
||||
bottomStart: 'info',
|
||||
bottomEnd: 'paging'
|
||||
},
|
||||
serverSide: true,
|
||||
pageLength: 25,
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
columns: this.datatableColumns,
|
||||
ajax: '/produccion/ordentrabajo/datatable_ferro_ok'
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default OrdenTrabajoDatatable;
|
||||
28
httpdocs/assets/js/safekat/components/datepicker.js
Normal file
28
httpdocs/assets/js/safekat/components/datepicker.js
Normal file
@ -0,0 +1,28 @@
|
||||
|
||||
import { Spanish } from "../../../../themes/vuexy/vendor/libs/flatpickr/es.js"
|
||||
|
||||
class DatePicker {
|
||||
constructor(domItem, options) {
|
||||
this.item = domItem
|
||||
this.options = options
|
||||
this.itemDate = null;
|
||||
this.init()
|
||||
}
|
||||
init() {
|
||||
this.itemDate = this.item.flatpickr({ ...this.options, locale: Spanish })
|
||||
|
||||
}
|
||||
setDateFormat(dateFormat = "dd/mm/yy") {
|
||||
this.item.flatpickr("option", "dateFormat", dateFormat)
|
||||
}
|
||||
getDate() {
|
||||
return this.itemDate.getDate()
|
||||
}
|
||||
setDate(date) {
|
||||
if(!isNaN(new Date(date))){
|
||||
this.itemDate.setDate(date,true,this.options.dateFormat)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default DatePicker;
|
||||
30
httpdocs/assets/js/safekat/components/forms/formClass.js
Normal file
30
httpdocs/assets/js/safekat/components/forms/formClass.js
Normal file
@ -0,0 +1,30 @@
|
||||
|
||||
|
||||
|
||||
class FormClass
|
||||
{
|
||||
constructor(domItem) {
|
||||
this.item = domItem
|
||||
this.formData = null
|
||||
}
|
||||
|
||||
validateField()
|
||||
{
|
||||
|
||||
}
|
||||
setAsValid(field)
|
||||
{
|
||||
}
|
||||
setAsInvalid(field){}
|
||||
addSuccessFeedback(field){}
|
||||
addErrorFeedback(field){}
|
||||
getFormData() {
|
||||
let data = {}
|
||||
this.item.serializeArray().forEach((e) => {
|
||||
data[e.name] = e.value
|
||||
}
|
||||
)
|
||||
this.formData = data
|
||||
return this.formData
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,125 @@
|
||||
import Ajax from '../ajax.js'
|
||||
import ClassSelect from '../select2.js'
|
||||
|
||||
class ServicioClienteForm {
|
||||
/**
|
||||
*
|
||||
* @param {*} domItem jQuery item of the form html element
|
||||
*/
|
||||
constructor(domItem) {
|
||||
this.item = domItem
|
||||
this.btnNew = this.item.find("#btn-new-servicio-cliente")
|
||||
this.btnUpdate = this.item.find("#btn-update-servicio-cliente")
|
||||
this.selectItemTarifaAcabado = this.item.find("#servicio-cliente-tarifa-acabado")
|
||||
this.selectItemTarifaManipulado = this.item.find("#servicio-cliente-tarifa-manipulado")
|
||||
this.selectTarifaAcabado = new ClassSelect(this.selectItemTarifaAcabado, '/tarifas/acabados/select', "Seleccione una tarifa", true)
|
||||
this.selectTarifaManipulado = new ClassSelect(this.selectItemTarifaManipulado, '/tarifasmanipulado/select', "Seleccione una tarifa", true)
|
||||
this.checkTarifaAcabado = this.item.find("#check-tarifa-acabado")
|
||||
this.checkTarifaManipulado = this.item.find("#check-tarifa-manipulado")
|
||||
|
||||
|
||||
}
|
||||
init() {
|
||||
this.modelId = this.item.data('id')
|
||||
this.uri = `/configuracion/servicios/${this.modelId}`
|
||||
this.uriUpdate = `/configuracion/servicios/update/${this.modelId}`
|
||||
this.uriPost = `/configuracion/servicios`
|
||||
this.btnNew.on("click", this.handlePost.bind(this))
|
||||
this.btnUpdate.on("click", this.handlePut.bind(this))
|
||||
this.handleGet()
|
||||
this.selectTarifaAcabado.init()
|
||||
this.selectTarifaManipulado.init()
|
||||
this.btnUpdate.removeClass("d-none")
|
||||
this.checkTarifaAcabado.change(() => {
|
||||
console.log("Acabado", this.checkTarifaAcabado.is(":checked"))
|
||||
if (this.checkTarifaAcabado.is(":checked")) {
|
||||
this.item.find("#container-tarifa-acabado-select").removeClass("d-none")
|
||||
this.item.find("#container-tarifa-manipulado-select").addClass("d-none")
|
||||
} else {
|
||||
this.item.find("#container-tarifa-acabado-select").addClass("d-none")
|
||||
this.item.find("#container-tarifa-manipulado-select").removeClass("d-none")
|
||||
}
|
||||
})
|
||||
this.checkTarifaManipulado.change(() => {
|
||||
console.log("Manipulado", this.checkTarifaManipulado.is(":checked"))
|
||||
if (this.checkTarifaManipulado.is(":checked")) {
|
||||
this.item.find("#container-tarifa-acabado-select").addClass("d-none")
|
||||
this.item.find("#container-tarifa-manipulado-select").removeClass("d-none")
|
||||
} else {
|
||||
this.item.find("#container-tarifa-acabado-select").removeClass("d-none")
|
||||
this.item.find("#container-tarifa-manipulado-select").addClass("d-none")
|
||||
}
|
||||
})
|
||||
}
|
||||
handleGet() {
|
||||
const ajax = new Ajax(
|
||||
this.uri,
|
||||
null,
|
||||
null,
|
||||
this.handleGetSuccess.bind(this),
|
||||
this.handleGetError.bind(this)
|
||||
)
|
||||
ajax.get()
|
||||
}
|
||||
handleGetSuccess(data) {
|
||||
this.item.find('[name="nombre"]').val(data.nombre)
|
||||
this.item.find('[name="code"]').val(data.code)
|
||||
if(data?.tarifas_acabado){
|
||||
this.selectTarifaAcabado.setOption(data.tarifas_acabado.id,data.tarifas_acabado.nombre)
|
||||
this.checkTarifaAcabado.prop("checked",true)
|
||||
this.checkTarifaAcabado.trigger("change")
|
||||
this.selectTarifaManipulado.reset()
|
||||
}
|
||||
if(data?.tarifas_manipulado){
|
||||
this.checkTarifaManipulado.prop("checked",true)
|
||||
this.selectTarifaManipulado.setOption(data.tarifas_manipulado.id,data.tarifas_manipulado.nombre)
|
||||
this.checkTarifaManipulado.trigger("change")
|
||||
this.selectTarifaAcabado.reset()
|
||||
}
|
||||
|
||||
}
|
||||
handleGetError(e) {
|
||||
console.error(e)
|
||||
}
|
||||
handlePost() {
|
||||
let bodyData = this.getFormData()
|
||||
const ajax = new Ajax(
|
||||
this.uriPost,
|
||||
bodyData,
|
||||
null,
|
||||
this.handlePostSuccess.bind(this),
|
||||
this.handlePostError.bind(this)
|
||||
)
|
||||
ajax.post()
|
||||
}
|
||||
handlePostSuccess() {
|
||||
this.item.reset()
|
||||
}
|
||||
handlePostError() { }
|
||||
handlePut() {
|
||||
let bodyData = this.getFormData()
|
||||
const ajax = new Ajax(
|
||||
this.uriUpdate,
|
||||
bodyData,
|
||||
null,
|
||||
this.handlePutSuccess.bind(this),
|
||||
this.handlePutError.bind(this)
|
||||
)
|
||||
ajax.post()
|
||||
}
|
||||
handlePutSuccess(data) {
|
||||
// this.item.reset()
|
||||
this.handleGet(data)
|
||||
}
|
||||
handlePutError() { }
|
||||
|
||||
getFormData() {
|
||||
let data = {}
|
||||
this.item.serializeArray().forEach((e) => {
|
||||
data[e.name] = e.value
|
||||
}
|
||||
)
|
||||
return data
|
||||
}
|
||||
}
|
||||
export default ServicioClienteForm
|
||||
@ -0,0 +1,6 @@
|
||||
import ServicioClienteForm from '../../../components/forms/servicioClienteForm.js'
|
||||
|
||||
$(document).ready(() => {
|
||||
const formServicioCliente = new ServicioClienteForm($("#formServicioCliente"))
|
||||
formServicioCliente.init()
|
||||
})
|
||||
@ -0,0 +1,4 @@
|
||||
import ServicioClienteDatatable from '../../../components/datatables/ServicioClienteDatatable.js'
|
||||
|
||||
const servicioClienteDatatable = new ServicioClienteDatatable($("#tableServiciosCliente"))
|
||||
servicioClienteDatatable.init()
|
||||
7
httpdocs/assets/js/safekat/pages/produccion/edit.js
Normal file
7
httpdocs/assets/js/safekat/pages/produccion/edit.js
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
import OrdenTrabajo from "./ot.js";
|
||||
|
||||
$(function() {
|
||||
const ot = new OrdenTrabajo($("#ot-edit"))
|
||||
ot.init()
|
||||
})
|
||||
9
httpdocs/assets/js/safekat/pages/produccion/index.js
Normal file
9
httpdocs/assets/js/safekat/pages/produccion/index.js
Normal file
@ -0,0 +1,9 @@
|
||||
import OrdenTrabajoDatatable from '../../components/datatables/otDatatable.js'
|
||||
|
||||
$(function() {
|
||||
const otDatatable = new OrdenTrabajoDatatable($("#ots-datatables-container"))
|
||||
otDatatable.init()
|
||||
otDatatable.initPendientes()
|
||||
otDatatable.initFerroPendiente()
|
||||
otDatatable.initFerroOk()
|
||||
})
|
||||
471
httpdocs/assets/js/safekat/pages/produccion/ot.js
Normal file
471
httpdocs/assets/js/safekat/pages/produccion/ot.js
Normal file
@ -0,0 +1,471 @@
|
||||
import Ajax from "../../components/ajax.js"
|
||||
import ClassSelect from "../../components/select2.js";
|
||||
import DatePicker from "../../components/datepicker.js";
|
||||
import { alertConfirmationDelete } from "../../components/alerts/sweetAlert.js";
|
||||
import Modal from "../../components/modal.js"
|
||||
|
||||
class OrdenTrabajo {
|
||||
constructor(domItem) {
|
||||
this.item = domItem
|
||||
this.otForm = this.item.find("#ot-edit-form")
|
||||
this.modelId = this.item.data("id");
|
||||
this.tareasTableItem = this.item.find("#ot-task-table");
|
||||
this.tareasId = []
|
||||
this.summaryData = {}
|
||||
this.tareaCommentModal = new Modal($("#modalCommentTarea"))
|
||||
this.alertOrdenTrabajo = this.item.find("#alert-orden-trabajo");
|
||||
this.btnFinalizarPedido = this.item.find("#btn-finalizar-orden-pedido")
|
||||
this.btnResetTareas = this.item.find("#btn-reset-tareas")
|
||||
this.datatableColumns = [
|
||||
{ data: 'orden', searchable: true, sortable: true, render: this._renderOrdenTarea.bind(this), width: "10%" },
|
||||
{ data: 'nombre', searchable: true, sortable: true, width: "20%" },
|
||||
{ data: 'maquina_presupuesto_linea', searchable: true, sortable: true, width: "20%" },
|
||||
{ data: 'maquina_tarea', searchable: false, sortable: false, render: this._renderMaquinaSelectTable.bind(this), width: "20%" },
|
||||
// { data: 'imposicion_id', searchable: false, sortable: false },
|
||||
{ data: 'tiempo_estimado', searchable: false, sortable: false },
|
||||
{ data: 'tiempo_real', searchable: false, sortable: false },
|
||||
{
|
||||
data: 'action', searchable: false, sortable: false, width: "10%", render: this._renderActionCell.bind(this)
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
configDatePickers() {
|
||||
const option = {
|
||||
altInput: true,
|
||||
altFormat: "d/m/Y",
|
||||
dateFormat: "Y-m-d",
|
||||
allowInput: true,
|
||||
}
|
||||
this.tiempoProcesamiento = new DatePicker(this.otForm.find("#ot-tiempo-procesamiento"), {
|
||||
dateFormat: "H:i",
|
||||
enableTime: true,
|
||||
noCalendar: true,
|
||||
time_24hr: true,
|
||||
allowInput: true,
|
||||
})
|
||||
this.fechaImpresion = new DatePicker(this.otForm.find("#ot-fecha-impresion"), option)
|
||||
this.fechaEncuadernado = new DatePicker(this.otForm.find("#ot-fecha-encuadernado"), option)
|
||||
this.fechaEntregaExterno = new DatePicker(this.otForm.find("#ot-fecha-entrega-externo"), option)
|
||||
this.fechaEntregaReal = new DatePicker(this.otForm.find("#ot-fecha-entrega-real"), option)
|
||||
this.fechaEntregaEstimada = new DatePicker(this.otForm.find("#ot-fecha-entrega-estimada"), option)
|
||||
|
||||
this.pendienteFerro = new DatePicker(this.otForm.find("#ot-pendiente-ferro"), option)
|
||||
this.ferroCliente = new DatePicker(this.otForm.find("#ot-ferro-cliente"), option)
|
||||
this.ferroOk = new DatePicker(this.otForm.find("#ot-ferro-ok"), option)
|
||||
this.plakeneTraslucido = new DatePicker(this.otForm.find("#ot-plakene-traslucido"), option)
|
||||
this.impresionColor = new DatePicker(this.otForm.find("#ot-impresion-color"), option)
|
||||
this.portada = new DatePicker(this.otForm.find("#ot-portada"), option)
|
||||
this.plastificadoMate = new DatePicker(this.otForm.find("#ot-plastificado-mate"), option)
|
||||
this.prepGuillotina = new DatePicker(this.otForm.find("#ot-prep-guillotina"), option)
|
||||
this.espiral = new DatePicker(this.otForm.find("#ot-espiral"), option)
|
||||
this.embalaje = new DatePicker(this.otForm.find("#ot-embalaje"), option)
|
||||
this.envio = new DatePicker(this.otForm.find("#ot-envio"), option)
|
||||
|
||||
|
||||
}
|
||||
eventTareas() {
|
||||
this.otForm.on("change", ".select-maquina-tarea-datatable", this.handleTareaChange.bind(this))
|
||||
this.otForm.on("change", ".orden-tarea", this.handleTareaChange.bind(this))
|
||||
this.otForm.on("click", ".increase-order", (event) => {
|
||||
const input_orden_tarea = $(event.currentTarget).parent().parent().find('.orden-tarea')
|
||||
let actual_value = parseInt(input_orden_tarea.val())
|
||||
input_orden_tarea.val(actual_value + 1).trigger("change")
|
||||
})
|
||||
this.otForm.on("click", ".decrease-order", (event) => {
|
||||
const input_orden_tarea = $(event.currentTarget).parent().parent().find('.orden-tarea')
|
||||
let actual_value = parseInt(input_orden_tarea.val())
|
||||
if (actual_value > 0) {
|
||||
input_orden_tarea.val(actual_value - 1).trigger("change")
|
||||
}
|
||||
})
|
||||
}
|
||||
unbindEventTareas() {
|
||||
this.otForm.off("change", ".select-maquina-tarea-datatable")
|
||||
this.otForm.off("change", ".orden-tarea")
|
||||
this.otForm.off("click", ".increase-order")
|
||||
this.otForm.off("click", ".decrease-order")
|
||||
}
|
||||
init() {
|
||||
this.configDatePickers()
|
||||
this.initDatatableTareas()
|
||||
this.tareasTableItem.on("draw.dt", this.createSelectMaquinaTarea.bind(this))
|
||||
this.tareasTableItem.on("xhr.dt", this.unbindEventTareas.bind(this))
|
||||
this.otForm.on("click", "#btn-upload-portada", this.handleUploadPortada.bind(this))
|
||||
this.otForm.on("click", "#btn-finalizar-orden-pedido", this.handleFinalizarPedido.bind(this))
|
||||
this.tareasTableItem.on("click", ".ot-tarea-btn-delete", this.handleTareaDeleteConfirmation.bind(this))
|
||||
this.item.on("click", "#btn-reset-tareas", this.handleResetTareasDeleteConfirmation.bind(this))
|
||||
this.otForm.on("click", ".ot-tarea-comment", this.handleNoteTarea.bind(this))
|
||||
$("#btn-update-tarea-comment").on("click", this.handleTareaNoteSubmit.bind(this))
|
||||
this.otForm.on("keyup","#ot-comment",this.handleOtComment.bind(this))
|
||||
|
||||
this._handleGetData()
|
||||
this.handleGetPortada()
|
||||
}
|
||||
initDatatableTareas() {
|
||||
this.datatableTareas = this.tareasTableItem.DataTable({
|
||||
processing: true,
|
||||
paging: false,
|
||||
layout: {
|
||||
topStart: 'pageLength',
|
||||
topEnd: 'search',
|
||||
bottomStart: 'info',
|
||||
bottomEnd: 'paging'
|
||||
},
|
||||
serverSide: true,
|
||||
responsive : true,
|
||||
createdRow: this.filterCreatedRow.bind(this),
|
||||
pageLength: 10,
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
columns: this.datatableColumns,
|
||||
ajax: '/produccion/ordentrabajo/tareas/datatable/' + this.modelId
|
||||
});
|
||||
}
|
||||
getFormData() {
|
||||
let data = {}
|
||||
this.otForm.serializeArray().forEach((e) => {
|
||||
data[e.name] = e.value
|
||||
}
|
||||
)
|
||||
return data
|
||||
}
|
||||
_handleGetData() {
|
||||
const ajax = new Ajax(`/produccion/ordentrabajo/summary/${this.modelId}`,
|
||||
null,
|
||||
null,
|
||||
this.handleSummarySuccess.bind(this),
|
||||
this.handleSummaryError.bind(this)
|
||||
)
|
||||
ajax.get();
|
||||
}
|
||||
_renderMaquinaSelectTable(d, t) {
|
||||
this.tareasId.push(d.id)
|
||||
return `<select id="select-maquina-tarea-${d.id}" data-maquina-id="${d.maquina_id}" data-id="${d.id}" name="maquina_id" class="select2 form-select select-maquina-tarea-datatable ${d.maquina_id ? '' : 'is-invalid'}">
|
||||
<option value="${d.maquina_id}" selected="selected">${d.maquina_name ?? ''}</option>
|
||||
</select>`
|
||||
|
||||
}
|
||||
_renderActionCell(d, t) {
|
||||
|
||||
let cell = `<div class="d-flex justify-content-start align-items-center gap-1">
|
||||
<a type="button" class="btn btn-xs ot-tarea-comment" data-id="${d.id}"><i class="ti ti-${d.comment ? "message" : "note"} ti-sm mx-2"></i></a>
|
||||
<a type="button" class="btn btn-xs ot-tarea-btn-delete" data-id="${d.id}"><i class="ti ti-trash ti-sm mx-2"></i></a>
|
||||
</div>`
|
||||
return cell;
|
||||
}
|
||||
_renderOrdenTarea(d, t) {
|
||||
|
||||
return `
|
||||
<div class="d-flex justify-content-between aling-items-center gap-2 orden-tarea-cell">
|
||||
<input type="text" style="min-width:5rem" data-id="${d.id}" class="form-control form-control-sm orden-tarea mr-2" name="orden" value="${d.orden}">
|
||||
<div class="btn-group-vertical">
|
||||
<button type="button" class="btn btn-primary btn-outlined btn-xs increase-order"><i class="ti ti-chevron-up ti-xs"></i></button>
|
||||
<button type="button" class="btn btn-primary btn-xs decrease-order" data-id="${d.id}"><i class="ti ti-chevron-down ti-xs"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
}
|
||||
createSelectMaquinaTarea() {
|
||||
try {
|
||||
this.tareasId.forEach(element => {
|
||||
let selectItem = this.item.find("#select-maquina-tarea-" + element);
|
||||
let maquina_id = selectItem.data("maquina-id")
|
||||
let maquinaSelects = new ClassSelect(selectItem, `/maquinas/select`, "Seleccione una maquina", true);
|
||||
maquinaSelects.init();
|
||||
if (maquina_id) {
|
||||
maquinaSelects.setVal(maquina_id)
|
||||
} else {
|
||||
maquinaSelects.reset()
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
} finally {
|
||||
this.eventTareas()
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
filterCreatedRow(row, data, dataIndex, cells) {
|
||||
if (data.maquina_tarea.maquina_id == null) {
|
||||
}
|
||||
}
|
||||
|
||||
/**========================================================================
|
||||
* DETAILS
|
||||
*========================================================================**/
|
||||
handleSummarySuccess(data) {
|
||||
try {
|
||||
this.summaryData = data
|
||||
this.otForm.off("change", ".ot-date")
|
||||
this.otForm.off("change", ".ot-preview")
|
||||
this.fillOtDetails()
|
||||
this.fillOtDates()
|
||||
this.fillPreimpresionReview()
|
||||
} catch (error) {
|
||||
|
||||
} finally {
|
||||
this.otForm.on("change", ".ot-date", this.handleDateChange.bind(this))
|
||||
this.otForm.on("change", ".ot-preview", this.handlePreimpresionReviewChange.bind(this))
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
handleSummaryError(error) { }
|
||||
fillPreimpresionReview() {
|
||||
console.log(this.summaryData.ot)
|
||||
this.otForm.find("[name=fecha_entrega_warning]").prop("checked", this.summaryData.ot.fecha_entrega_warning)
|
||||
this.otForm.find("[name=fecha_entrega_warning_revised]").prop("checked", this.summaryData.ot.fecha_entrega_warning_revised)
|
||||
this.otForm.find("[name=revisar_formato]").prop("checked", this.summaryData.ot.revisar_formato)
|
||||
this.otForm.find("[name=revisar_lomo]").prop("checked", this.summaryData.ot.revisar_lomo)
|
||||
this.otForm.find("[name=revisar_solapa]").prop("checked", this.summaryData.ot.revisar_solapa)
|
||||
this.otForm.find("[name=revisar_isbn]").prop("checked", this.summaryData.ot.revisar_isbn)
|
||||
this.otForm.find("[name=revisar_codigo_barras]").prop("checked", this.summaryData.ot.revisar_codigo_barras)
|
||||
this.otForm.find("[name=realizar_imposicion]").prop("checked", this.summaryData.ot.realizar_imposicion)
|
||||
this.otForm.find("[name=enviar_impresion]").prop("checked", this.summaryData.ot.enviar_impresion)
|
||||
|
||||
}
|
||||
fillOtDetails() {
|
||||
const progreso = this.summaryData.ot.progreso
|
||||
this.otForm.find("#ot-progress-bar").attr('aria-valuenow',progreso).text(progreso + "%").css("width",progreso + "%")
|
||||
this.otForm.find("#ot-paginas").val(this.summaryData.presupuesto.paginas)
|
||||
this.otForm.find("#ot-tirada").val(this.summaryData.presupuesto.tirada)
|
||||
this.otForm.find("#ot-merma").val(this.summaryData.presupuesto.merma)
|
||||
}
|
||||
fillOtDates() {
|
||||
this.fechaImpresion.setDate(this.summaryData.dates.fecha_impresion_at)
|
||||
this.fechaEncuadernado.setDate(this.summaryData.dates.fecha_encuadernado_at)
|
||||
// this.fechaEntregaExterno.setDate(this.summaryData.dates.fecha_entrega_externo_)
|
||||
this.fechaEntregaReal.setDate(this.summaryData.dates.fecha_entrega_real_at)
|
||||
this.fechaEntregaEstimada.setDate(this.summaryData.dates.fecha_entrega_at)
|
||||
|
||||
this.pendienteFerro.setDate(this.summaryData.dates.pendiente_ferro_at)
|
||||
this.ferroCliente.setDate(this.summaryData.dates.ferro_en_cliente_at)
|
||||
this.ferroOk.setDate(this.summaryData.dates.ferro_ok_at)
|
||||
// this.plakeneTraslucido.setDate(this.summaryData.dates.fecha_impresion_at)
|
||||
this.impresionColor.setDate(this.summaryData.dates.interior_color_at)
|
||||
this.portada.setDate(this.summaryData.dates.cubierta_at)
|
||||
this.plastificadoMate.setDate(this.summaryData.dates.plastificado_at)
|
||||
this.prepGuillotina.setDate(this.summaryData.dates.corte_at)
|
||||
this.espiral.setDate(this.summaryData.dates.fecha_impresion_at)
|
||||
this.embalaje.setDate(this.summaryData.dates.embalaje_at)
|
||||
this.envio.setDate(this.summaryData.dates.envio_at)
|
||||
|
||||
}
|
||||
|
||||
handleTareaChange(event) {
|
||||
const key = $(event.currentTarget).attr("name")
|
||||
const data = {}
|
||||
data[key] = $(event.currentTarget).val()
|
||||
data["orden_trabajo_tarea_id"] = $(event.currentTarget).data("id")
|
||||
console.log(data);
|
||||
const ajax = new Ajax(
|
||||
"/produccion/ordentrabajo/update/tarea",
|
||||
data,
|
||||
null,
|
||||
this.handleTareaChangeSuccess.bind(this),
|
||||
this.handleTareaChangeError.bind(this)
|
||||
)
|
||||
ajax.post();
|
||||
}
|
||||
handleTareaNoteSubmit(event) {
|
||||
const data = {}
|
||||
data["comment"] = $("#comment-tarea").val()
|
||||
data["orden_trabajo_tarea_id"] = $("#comment-tarea").data("id")
|
||||
const ajax = new Ajax(
|
||||
"/produccion/ordentrabajo/update/tarea",
|
||||
data,
|
||||
null,
|
||||
this.handleTareaChangeSuccess.bind(this),
|
||||
this.handleTareaChangeError.bind(this)
|
||||
)
|
||||
ajax.post();
|
||||
}
|
||||
handleTareaChangeSuccess(data) {
|
||||
this.datatableTareas.ajax.reload()
|
||||
this.tareaCommentModal.item.modal("hide")
|
||||
this._handleGetData();
|
||||
}
|
||||
handleTareaChangeError(error) { }
|
||||
handleOtComment(event){
|
||||
console.log($(event.currentTarget).val())
|
||||
const ajax = new Ajax(
|
||||
"/produccion/ordentrabajo/update",
|
||||
{
|
||||
"orden_trabajo_id" : this.modelId,
|
||||
"name" : $(event.currentTarget).attr("name"),
|
||||
"comentarios" : $(event.currentTarget).val()
|
||||
},
|
||||
null,
|
||||
null,
|
||||
null
|
||||
)
|
||||
ajax.post();
|
||||
}
|
||||
handleDateChange(event) {
|
||||
const key = $(event.currentTarget).attr("name")
|
||||
const data = {}
|
||||
const element = $(event.currentTarget);
|
||||
data[key] = $(event.currentTarget).val()
|
||||
data["orden_trabajo_id"] = this.modelId
|
||||
data["name"] = key;
|
||||
console.log(data)
|
||||
const ajax = new Ajax(
|
||||
"/produccion/ordentrabajo/update/date",
|
||||
data,
|
||||
null,
|
||||
this.handleDateChangeSuccess.bind(this, element),
|
||||
this.handleDateChangeError.bind(this)
|
||||
)
|
||||
ajax.post();
|
||||
|
||||
}
|
||||
handleDateChangeSuccess(formItem, response) {
|
||||
formItem.addClass("is-valid")
|
||||
formItem.parent().append(`<div class="form-text">${[response.user.first_name, response.user.last_name].join(" ")}</div>`)
|
||||
}
|
||||
handleDateChangeError(errors) { }
|
||||
handlePreimpresionReviewChange(event) {
|
||||
const key = $(event.currentTarget).attr("name")
|
||||
const data = {}
|
||||
data[key] = $(event.currentTarget).is(":checked") ? 1 : 0
|
||||
data["orden_trabajo_id"] = this.modelId
|
||||
const ajax = new Ajax(
|
||||
"/produccion/ordentrabajo/update",
|
||||
data,
|
||||
null,
|
||||
this.handlePreimpresionReviewChangeSuccess.bind(this),
|
||||
this.handlePreimpresionReviewChangeError.bind(this)
|
||||
)
|
||||
ajax.post();
|
||||
|
||||
}
|
||||
handlePreimpresionReviewChangeSuccess(response) {
|
||||
|
||||
}
|
||||
handlePreimpresionReviewChangeError(error) {
|
||||
|
||||
}
|
||||
handleUploadPortada(event) {
|
||||
|
||||
|
||||
let data = new FormData()
|
||||
data.set("orden_trabajo_id", this.modelId)
|
||||
data.set("portada_file", this.otForm.find("#portada-file-input")[0].files[0])
|
||||
const ajax = new Ajax(
|
||||
"/produccion/ordentrabajo/upload/portada",
|
||||
data,
|
||||
null,
|
||||
this.handleUploadPortadaSuccess.bind(this),
|
||||
this.handleUploadPortadaError.bind(this)
|
||||
)
|
||||
ajax.ajaxForm("POST");
|
||||
|
||||
}
|
||||
handleUploadPortadaSuccess(response) {
|
||||
this.handleGetPortada()
|
||||
this.otForm.find("#portada-file-input").val(null)
|
||||
}
|
||||
handleUploadPortadaError(errors) { }
|
||||
handleGetPortada() {
|
||||
this.item.find(".portada-loader").prop("hidden", false);
|
||||
this.item.find("#portada-orden-trabajo").prop("hidden", true);
|
||||
$.ajax({
|
||||
url: '/produccion/ordentrabajo/portada/' + this.modelId,
|
||||
method: 'GET',
|
||||
xhrFields: {
|
||||
responseType: 'blob' // Expect binary data
|
||||
},
|
||||
success: this.handleGetPortadaSuccess.bind(this),
|
||||
error: this.handleGetPortadaError.bind(this)
|
||||
});
|
||||
}
|
||||
handleGetPortadaSuccess(data) {
|
||||
const imageUrl = URL.createObjectURL(data);
|
||||
$('#portada-orden-trabajo').attr('src', imageUrl);
|
||||
this.item.find(".portada-loader").prop("hidden", true);
|
||||
this.item.find("#portada-orden-trabajo").prop("hidden", false);
|
||||
}
|
||||
handleGetPortadaError(errors) { }
|
||||
handleFinalizarPedido() {
|
||||
const ajax = new Ajax(
|
||||
"/produccion/ordentrabajo/update",
|
||||
{
|
||||
orden_trabajo_id: this.modelId,
|
||||
estado: 'F'
|
||||
},
|
||||
null,
|
||||
this.handleEstadoChangeSuccess.bind(this),
|
||||
this.handleEstadoChangeError.bind(this)
|
||||
);
|
||||
ajax.post()
|
||||
}
|
||||
handleEstadoChangeSuccess() {
|
||||
this.alertOrdenTrabajo.removeClass("alert-info").addClass("alert-success")
|
||||
this.btnFinalizarPedido.prop("disabled", true);
|
||||
}
|
||||
handleEstadoChangeError() { }
|
||||
handleTareaDeleteConfirmation(event) {
|
||||
const orden_tarea_id = $(event.currentTarget).data("id")
|
||||
alertConfirmationDelete("¿Estás seguro de realizar esta acción?")
|
||||
.then(result => {
|
||||
if (result.isConfirmed) {
|
||||
this.handleDeleteTarea(orden_tarea_id)
|
||||
}
|
||||
})
|
||||
}
|
||||
handleResetTareasDeleteConfirmation(event) {
|
||||
alertConfirmationDelete("¿Estás seguro de realizar esta acción?")
|
||||
.then(result => {
|
||||
if (result.isConfirmed) {
|
||||
this.handleDeleteResetTareas()
|
||||
}
|
||||
})
|
||||
}
|
||||
handleDeleteResetTareas() {
|
||||
const ajax = new Ajax(
|
||||
"/produccion/ordentrabajo/reset/tareas/" + this.modelId,
|
||||
null,
|
||||
null,
|
||||
this.handleDeleteTareaSuccess.bind(this),
|
||||
this.handleDeleteTareaError.bind(this)
|
||||
);
|
||||
ajax.delete()
|
||||
}
|
||||
handleDeleteResetTareasSuccess(response) {
|
||||
this.datatableTareas.ajax.reload()
|
||||
}
|
||||
handleDeleteResetTareasError() { }
|
||||
handleDeleteTarea(orden_tarea_id) {
|
||||
const ajax = new Ajax(
|
||||
"/produccion/ordentrabajo/tareas/" + orden_tarea_id,
|
||||
null,
|
||||
null,
|
||||
this.handleDeleteTareaSuccess.bind(this),
|
||||
this.handleDeleteTareaError.bind(this)
|
||||
);
|
||||
ajax.delete()
|
||||
}
|
||||
handleDeleteTareaSuccess(response) {
|
||||
this.datatableTareas.ajax.reload()
|
||||
}
|
||||
handleDeleteTareaError() { }
|
||||
handleNoteTarea(event) {
|
||||
let tarea_id = $(event.currentTarget).data("id");
|
||||
const tarea = this.summaryData.tasks.find(task => task.id == tarea_id)
|
||||
if (tarea) {
|
||||
$("#comment-tarea").attr("data-id", tarea_id)
|
||||
$("#comment-type").text(tarea.nombre ?? "")
|
||||
$("#comment-tarea").val(tarea.comment)
|
||||
this.tareaCommentModal.toggle()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
export default OrdenTrabajo;
|
||||
@ -0,0 +1,7 @@
|
||||
import PlanningRotativa from "./planning_rotativa.js";
|
||||
|
||||
$(function(){
|
||||
const planningRotativa = new PlanningRotativa($("#planning-rotativa-page"));
|
||||
planningRotativa.init();
|
||||
console.log("PL")
|
||||
})
|
||||
@ -0,0 +1,90 @@
|
||||
import ClassSelect from "../../../components/select2.js";
|
||||
|
||||
class PlanningRotativa {
|
||||
constructor(domItem) {
|
||||
this.item = domItem
|
||||
this.tablePlanningRot = this.item.find("#planning-rotativa-datatable")
|
||||
this.papelGramajeTablePlanning = this.item.find("#planning-papel-datatable")
|
||||
|
||||
this.datatableColumns = [
|
||||
{ data: 'otId', searchable: false, sortable: false },
|
||||
{ data: 'fecha_entrega_real_at', searchable: true, sortable: false },
|
||||
{ data: 'presupuesto_titulo', searchable: true, sortable: false },
|
||||
{ data: 'maquina_planning_nombre', searchable: true, sortable: false },
|
||||
{ data: 'ot_tirada', searchable: false, sortable: false },
|
||||
{ data: 'maquina_ancho', searchable: false, sortable: false },
|
||||
{ data: 'maquina_alto', searchable: false, sortable: false },
|
||||
{ data: 'papel_impresion', searchable: false, sortable: false },
|
||||
{ data: 'papel_gramaje', searchable: false, sortable: false },
|
||||
{ data: 'action', searchable: false, sortable: false, render: this._renderBtnAction },
|
||||
|
||||
]
|
||||
this.papelGramajeDatatableColumns = [
|
||||
{ data: 'papelImpresionNombre', searchable: true, sortable: true },
|
||||
{ data: 'papelImpresionGramaje', searchable: true, sortable: true },
|
||||
{ data: 'tareasCount', searchable: true, sortable: true },
|
||||
{ data: 'totalTirada', searchable: false, sortable: false },
|
||||
{ data: 'tiempoReal', searchable: false, sortable: false },
|
||||
|
||||
]
|
||||
this.maquinaSelectFilter = new ClassSelect($("#maquina-select-filter"), `/maquinas/select`, "Seleccione una maquina", true);
|
||||
this.maquinaSelectFilter.config.dropdownParent = this.item
|
||||
}
|
||||
init() {
|
||||
this.maquinaSelectFilter.init()
|
||||
this.datatablePlanningRot = this.tablePlanningRot.DataTable({
|
||||
processing: true,
|
||||
layout: {
|
||||
topStart: 'pageLength',
|
||||
topEnd: 'search',
|
||||
bottomStart: 'info',
|
||||
bottomEnd: 'paging'
|
||||
},
|
||||
|
||||
serverSide: true,
|
||||
responsive: true,
|
||||
pageLength: 10,
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
columns: this.datatableColumns,
|
||||
ajax: '/produccion/ordentrabajo/planning/rotativa/datatable'
|
||||
});
|
||||
this.papelGramajeDatatable = this.papelGramajeTablePlanning.DataTable({
|
||||
processing: true,
|
||||
layout: {
|
||||
topStart: 'pageLength',
|
||||
topEnd: 'search',
|
||||
bottomStart: 'info',
|
||||
bottomEnd: 'paging'
|
||||
},
|
||||
|
||||
serverSide: true,
|
||||
responsive: true,
|
||||
pageLength: 10,
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
columns: this.papelGramajeDatatableColumns,
|
||||
ajax: '/produccion/ordentrabajo/planning/papel/datatable'
|
||||
});
|
||||
this.item.on("keyup", ".planning-filter", (event) => {
|
||||
console.log(this.datatablePlanningRot.column($(event.currentTarget).attr("name")))
|
||||
let columnIndex = this.datatableColumns.findIndex((element) => element.data == $(event.currentTarget).attr("name"))
|
||||
this.datatablePlanningRot.column(columnIndex).search($(event.currentTarget).val()).draw()
|
||||
})
|
||||
this.item.on("change", "#maquina-select-filter", (event) => {
|
||||
let columnIndex = this.datatableColumns.findIndex((element) => element.data == $(event.currentTarget).attr("name"))
|
||||
this.datatablePlanningRot.column(columnIndex).search(this.maquinaSelectFilter.getText()).draw()
|
||||
})
|
||||
}
|
||||
_renderBtnAction(d) {
|
||||
return `<a type="button" href="/produccion/ordentrabajo/edit/${d.otId}" class="btn btn-md btn-primary ot-tarea-comment" data-id="${d.otId}"><i class="ti ti-building-factory-2 ti-sm mx-2"></i> Ver orden</a>`
|
||||
}
|
||||
_columnFiltering() {
|
||||
this.api().columns()
|
||||
console.log(this.api().columns())
|
||||
}
|
||||
|
||||
}
|
||||
export default PlanningRotativa;
|
||||
47
httpdocs/assets/js/safekat/pages/produccion/to_prod.js
Normal file
47
httpdocs/assets/js/safekat/pages/produccion/to_prod.js
Normal file
@ -0,0 +1,47 @@
|
||||
import Ajax from "../../components/ajax.js"
|
||||
$(() => {
|
||||
$("#button-pedido-to-prod").on("click", (event) => {
|
||||
const pedidoId = $(event.currentTarget).data("id");
|
||||
Swal.fire({
|
||||
title: '¿Estás seguro?',
|
||||
text: "Esta acción creará la orden de trabajo del pedido",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Sí',
|
||||
cancelButtonText: 'Cancelar',
|
||||
customClass: {
|
||||
confirmButton: 'btn btn-primary me-1',
|
||||
cancelButton: 'btn btn-label-secondary'
|
||||
},
|
||||
buttonsStyling: false
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
let ajax = new Ajax(
|
||||
"/pedidos/produccion/" + pedidoId,
|
||||
null,
|
||||
null,
|
||||
(response) => {
|
||||
Swal.fire({
|
||||
title: response.message,
|
||||
icon: 'success',
|
||||
showCancelButton: true,
|
||||
showConfirmButton: false,
|
||||
cancelButtonText: 'Cancelar',
|
||||
customClass: {
|
||||
confirmButton: 'btn btn-primary me-1',
|
||||
cancelButton: 'btn btn-label-secondary'
|
||||
},
|
||||
buttonsStyling: false
|
||||
})
|
||||
},
|
||||
null,
|
||||
)
|
||||
ajax.post()
|
||||
}
|
||||
}).catch((err) => {
|
||||
|
||||
});
|
||||
})
|
||||
})
|
||||
@ -0,0 +1,7 @@
|
||||
import TarifaMaquina from "../../tarifaMaquina.js"
|
||||
|
||||
|
||||
$(() => {
|
||||
const tarifaMaquinaAcabado = new TarifaMaquina($("#tarifa_maquina_component"),"acabado");
|
||||
tarifaMaquinaAcabado.init()
|
||||
})
|
||||
@ -0,0 +1,7 @@
|
||||
import TarifaMaquina from "../../tarifaMaquina.js"
|
||||
|
||||
|
||||
$(() => {
|
||||
const tarifaMaquina = new TarifaMaquina($("#tarifa_maquina_component"),"encuadernacion");
|
||||
tarifaMaquina.init()
|
||||
})
|
||||
@ -0,0 +1,7 @@
|
||||
import TarifaMaquina from "../../tarifaMaquina.js"
|
||||
|
||||
|
||||
$(() => {
|
||||
const tarifaMaquina = new TarifaMaquina($("#tarifa_maquina_component"),"extra");
|
||||
tarifaMaquina.init()
|
||||
})
|
||||
@ -0,0 +1,7 @@
|
||||
import TarifaMaquina from "../../tarifaMaquina.js"
|
||||
|
||||
|
||||
$(() => {
|
||||
const tarifaMaquina = new TarifaMaquina($("#tarifa_maquina_component"),"manipulado");
|
||||
tarifaMaquina.init()
|
||||
})
|
||||
@ -0,0 +1,7 @@
|
||||
import TarifaMaquina from "../../tarifaMaquina.js"
|
||||
|
||||
|
||||
$(() => {
|
||||
const tarifaMaquina = new TarifaMaquina($("#tarifa_maquina_component"),"preimpresion");
|
||||
tarifaMaquina.init()
|
||||
})
|
||||
94
httpdocs/assets/js/safekat/pages/tarifas/tarifaMaquina.js
Normal file
94
httpdocs/assets/js/safekat/pages/tarifas/tarifaMaquina.js
Normal file
@ -0,0 +1,94 @@
|
||||
import ClassSelect from "../../components/select2.js";
|
||||
import Ajax from "../../components/ajax.js";
|
||||
class TarifaMaquina {
|
||||
constructor(domItem, type = "acabado") {
|
||||
this.item = domItem
|
||||
this.type = type
|
||||
this.tarifaId = this.item.data("id")
|
||||
this.btnNewTarifaMaquina = this.item.find("#btn-new-tarifa-maquina")
|
||||
this.selectTarifaMaquina = new ClassSelect(this.item.find("#select-tarifa-maquina"), `/tarifas/maquinas/${this.type}/select`, "Seleccione una maquina", true);
|
||||
this.selectMaquinaTarea = new ClassSelect(this.item.find("#select-maquina-tarea"), `/tarifas/maquinas/tareas/select`, "Seleccione una tarea", true);
|
||||
this.datatableItem = this.item.find("#table-tarifa-maquinas")
|
||||
this.datatableColumns = [
|
||||
{ data: 'maquinaNombre', searchable: false, sortable: false },
|
||||
{ data: 'tareaNombre', searchable: false, sortable: false },
|
||||
{
|
||||
data: 'action', searchable: false, sortable: false,
|
||||
render: (d, t) => {
|
||||
return `<div class="btn-group btn-group-xs">
|
||||
<a type="button" class="btn btn-xs tarifa-maquina-btn-delete" data-id="${d}"><i class="ti ti-trash ti-sm mx-2"></i></a>
|
||||
</div>`
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
init() {
|
||||
// this.btnNewTarifaMaquina.prop("disabled",true)
|
||||
this.selectMaquinaTarea.init()
|
||||
this.selectTarifaMaquina.init()
|
||||
this.datatable = this.datatableItem.DataTable({
|
||||
processing: true,
|
||||
layout: {
|
||||
topStart: 'pageLength',
|
||||
topEnd: 'search',
|
||||
bottomStart: 'info',
|
||||
bottomEnd: 'paging'
|
||||
},
|
||||
serverSide: true,
|
||||
pageLength: 25,
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
columns: this.datatableColumns,
|
||||
ajax: `/tarifas/maquinas/${this.type}/datatable/${this.tarifaId}`
|
||||
});
|
||||
this.events();
|
||||
}
|
||||
events() {
|
||||
this.btnNewTarifaMaquina.on("click", this.handleNewTarifaMaquina.bind(this));
|
||||
this.datatable.on("click", ".tarifa-maquina-btn-delete", this.handleDeleteTarifaMaquina.bind(this))
|
||||
}
|
||||
handleNewTarifaMaquina() {
|
||||
let key = `tarifa_${this.type}_id`
|
||||
let bodyData = {
|
||||
maquina_id: this.selectTarifaMaquina.getVal(),
|
||||
maquina_tarea_id: this.selectMaquinaTarea.getVal()
|
||||
}
|
||||
bodyData[key] = this.tarifaId;
|
||||
|
||||
const ajax = new Ajax(
|
||||
`/tarifas/maquinas/${this.type}`,
|
||||
bodyData,
|
||||
null,
|
||||
this.handleNewTarifaMaquinaSuccess.bind(this),
|
||||
this.handleNewTarifaMaquinaError.bind(this),
|
||||
)
|
||||
ajax.post()
|
||||
}
|
||||
handleNewTarifaMaquinaSuccess(response) {
|
||||
this.datatable.ajax.reload()
|
||||
this.selectMaquinaTarea.reset()
|
||||
this.selectTarifaMaquina.reset()
|
||||
console.log(response)
|
||||
}
|
||||
handleNewTarifaMaquinaError(error) { }
|
||||
|
||||
handleDeleteTarifaMaquina(event) {
|
||||
const tarifaMaquinaId = $(event.currentTarget).data("id")
|
||||
const ajax = new Ajax(
|
||||
`/tarifas/maquinas/${this.type}/${tarifaMaquinaId}`,
|
||||
null,
|
||||
null,
|
||||
this.handleDeleteTarifaMaquinaSuccess.bind(this),
|
||||
this.handleDeleteTarifaMaquinaError.bind(this),
|
||||
)
|
||||
ajax.delete()
|
||||
}
|
||||
handleDeleteTarifaMaquinaSuccess() {
|
||||
this.datatable.ajax.reload()
|
||||
}
|
||||
handleDeleteTarifaMaquinaError() { }
|
||||
|
||||
}
|
||||
export default TarifaMaquina
|
||||
329
httpdocs/themes/vuexy/css/pdf.ot.css
Normal file
329
httpdocs/themes/vuexy/css/pdf.ot.css
Normal file
@ -0,0 +1,329 @@
|
||||
@page {
|
||||
size: A4;
|
||||
margin: 0;
|
||||
}
|
||||
@media print {
|
||||
html, body {
|
||||
width: 210mm;
|
||||
height: 297mm;
|
||||
}
|
||||
/* ... the rest of the rules ... */
|
||||
}
|
||||
html,body {
|
||||
font-family: Arial, sans-serif;
|
||||
width: 210mm;
|
||||
height: 297mm;
|
||||
max-width: 210mm;
|
||||
max-height: 297mm;
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
body{
|
||||
border: 2px solid;
|
||||
padding: 20px;
|
||||
|
||||
}
|
||||
.cubierta{
|
||||
color: #007bff;
|
||||
}
|
||||
.encuadernacion{
|
||||
color: green;
|
||||
}
|
||||
.impresion{
|
||||
color: #ff4000;
|
||||
}
|
||||
.container {
|
||||
width: 100%;
|
||||
width: 210mm;
|
||||
height: 297mm;
|
||||
background: #fff;
|
||||
padding: 20px;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
border: 2px solid;
|
||||
|
||||
}
|
||||
.header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.cover{
|
||||
display: flex;
|
||||
justify-content: start;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.portada-info{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
}
|
||||
.portada-row{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-items: center;
|
||||
justify-content: space-between;
|
||||
background-color: #4ba0fccc;
|
||||
width: 100%;
|
||||
height: 5mm;
|
||||
border: solid 2px;
|
||||
margin: 2px;
|
||||
border-color: black;
|
||||
|
||||
}
|
||||
.portada-row-2{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-items: center;
|
||||
background-color: #ff4000;
|
||||
width: 100%;
|
||||
height: 35mm;
|
||||
color: white;
|
||||
margin: 2px;
|
||||
border: 2px solid;
|
||||
border-color: black;
|
||||
|
||||
}
|
||||
.portada{
|
||||
height: 40mm;
|
||||
}
|
||||
.presupuesto-title{
|
||||
color: #007bff;
|
||||
font-size: medium;
|
||||
line-height: 0;
|
||||
}
|
||||
.pl-2{
|
||||
padding-left: 0.5rem;
|
||||
}
|
||||
.pr-2{
|
||||
padding-right: 0.5rem;
|
||||
}
|
||||
.pt-2{
|
||||
padding-top: 0.5rem;
|
||||
}
|
||||
.flex-row{
|
||||
display: flex;
|
||||
width: 100%;
|
||||
justify-content: start;
|
||||
align-items: flex-start;
|
||||
}
|
||||
.date{
|
||||
padding-left: 0.5rem;
|
||||
padding-top: 0px;
|
||||
width: 100%;
|
||||
line-height: 0px;
|
||||
stroke-width: 5px;
|
||||
font-size: medium;
|
||||
}
|
||||
#presupuesto-section{
|
||||
width: 100%;
|
||||
}
|
||||
.flex-col{
|
||||
display: flex;
|
||||
padding: 0;
|
||||
flex-direction: column;
|
||||
}
|
||||
.cliente-title{
|
||||
color: red;
|
||||
font-size: medium;
|
||||
stroke-width: 10px;
|
||||
line-height: 0px;
|
||||
}
|
||||
|
||||
.header .title {
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.section {
|
||||
margin-top: 0.5rem;
|
||||
border-top: 1px solid #ddd;
|
||||
padding-top: 0.2rem;
|
||||
}
|
||||
.section-title {
|
||||
font-weight: bold;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-bottom: 5px;
|
||||
font-size: 12px;
|
||||
}
|
||||
table th, table td {
|
||||
border: 2px solid #000000;
|
||||
text-align: center;
|
||||
}
|
||||
table th {
|
||||
background-color: #f4f4f4;
|
||||
font-weight: bold;
|
||||
}
|
||||
table td{
|
||||
font-weight: bold;
|
||||
}
|
||||
.comments {
|
||||
color: #555;
|
||||
font-style: italic;
|
||||
margin-top: 0.2rem;
|
||||
}
|
||||
.comment-content {
|
||||
line-height: 0;
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
border: solid;
|
||||
border-width: 1px;
|
||||
}
|
||||
.footer {
|
||||
text-align: center;
|
||||
margin-top: 0.5rem;
|
||||
font-size: 14px;
|
||||
color: #777;
|
||||
}
|
||||
.row-logo-impresion{
|
||||
text-align: center;
|
||||
}
|
||||
.portada-img{
|
||||
border: black;
|
||||
border-style: solid;
|
||||
border-width: 2px;
|
||||
height: 40mm;
|
||||
width: 100px;
|
||||
max-width: 30mm;
|
||||
border: 2px solid;
|
||||
border-color: black;
|
||||
border-radius: 5%;
|
||||
}
|
||||
.portada-text{
|
||||
color: white;
|
||||
}
|
||||
|
||||
.t-header{
|
||||
color: black;
|
||||
width: 25%;
|
||||
}
|
||||
.t-cell{
|
||||
background-color: white;
|
||||
color: black;
|
||||
text-align: start;
|
||||
padding-left: 0.2rem;
|
||||
}
|
||||
.t-row{
|
||||
font-size: 10px;
|
||||
}
|
||||
.esquema{
|
||||
display: flex;
|
||||
justify-content:flex-end;
|
||||
width: 100%;
|
||||
justify-items: flex-end;
|
||||
|
||||
}
|
||||
.pagina-imposicion-outer-start{
|
||||
border-top: 2px solid;
|
||||
border-left: 2px solid;
|
||||
border-bottom: 2px solid;
|
||||
width: 50px;
|
||||
height: 100px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.pagina-imposicion-outer-end{
|
||||
border-top: 2px solid;
|
||||
border-right: 2px solid;
|
||||
border-bottom: 2px solid;
|
||||
width: 50px;
|
||||
height: 100px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.pagina-imposicion-outer{
|
||||
border-top: 2px solid;
|
||||
border-bottom: 2px solid;
|
||||
width: 50px;
|
||||
height: 100px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.pagina-imposicion-inner{
|
||||
border: 2px solid;
|
||||
font-size: 25px;
|
||||
width: 40px;
|
||||
height: 90px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
}
|
||||
.square-wrapper{
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2,1fr);
|
||||
margin-left: 10px;
|
||||
|
||||
}
|
||||
.square{
|
||||
width: 100px;
|
||||
height: 50px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
.cod{
|
||||
width: 200px;
|
||||
height: 100px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: orange;
|
||||
margin-left: 10px;
|
||||
color: white;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-weight: bold;
|
||||
}
|
||||
.cod-code{
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
}
|
||||
.esquema-imposicion-wrapper{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-left: 2rem;
|
||||
gap: 10px;
|
||||
}
|
||||
.imposicion{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 200px;
|
||||
}
|
||||
.imposicion td{
|
||||
font-size: large;
|
||||
}
|
||||
.cod-barras{
|
||||
width: 190px;
|
||||
height: 50px;
|
||||
margin: 5px;
|
||||
background-color: white;
|
||||
}
|
||||
.bg-white{
|
||||
background-color: white;
|
||||
color: black;
|
||||
}
|
||||
.bg-red{
|
||||
background-color: red;
|
||||
color: white;
|
||||
}
|
||||
.bg-gray{
|
||||
background-color: gray;
|
||||
color:white
|
||||
}
|
||||
.bg-blue{
|
||||
background-color: blue;
|
||||
color: white;
|
||||
}
|
||||
51
httpdocs/themes/vuexy/vendor/libs/flatpickr/es.js
vendored
Normal file
51
httpdocs/themes/vuexy/vendor/libs/flatpickr/es.js
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
|
||||
export const Spanish = {
|
||||
weekdays: {
|
||||
shorthand: ["Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb"],
|
||||
longhand: [
|
||||
"Domingo",
|
||||
"Lunes",
|
||||
"Martes",
|
||||
"Miércoles",
|
||||
"Jueves",
|
||||
"Viernes",
|
||||
"Sábado",
|
||||
],
|
||||
},
|
||||
months: {
|
||||
shorthand: [
|
||||
"Ene",
|
||||
"Feb",
|
||||
"Mar",
|
||||
"Abr",
|
||||
"May",
|
||||
"Jun",
|
||||
"Jul",
|
||||
"Ago",
|
||||
"Sep",
|
||||
"Oct",
|
||||
"Nov",
|
||||
"Dic",
|
||||
],
|
||||
longhand: [
|
||||
"Enero",
|
||||
"Febrero",
|
||||
"Marzo",
|
||||
"Abril",
|
||||
"Mayo",
|
||||
"Junio",
|
||||
"Julio",
|
||||
"Agosto",
|
||||
"Septiembre",
|
||||
"Octubre",
|
||||
"Noviembre",
|
||||
"Diciembre",
|
||||
],
|
||||
},
|
||||
ordinal: function () {
|
||||
return "º";
|
||||
},
|
||||
firstDayOfWeek: 1,
|
||||
rangeSeparator: " a ",
|
||||
time_24hr: true,
|
||||
};
|
||||
Reference in New Issue
Block a user