mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
feat confirm alert pedido to produccion
This commit is contained in:
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) => {
|
||||
|
||||
});
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user