mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 13:35:42 +00:00
refactor: alteração na modal de confirmação para encerrar a comanda
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -186,16 +186,29 @@ function imprimirConta() {
|
|||||||
|
|
||||||
|
|
||||||
function closeConta(id){
|
function closeConta(id){
|
||||||
|
|
||||||
const resultadoConfirmacao = confirm("Encerrar comanda?");
|
|
||||||
const buttonAdd = document.getElementById('openModal')
|
const buttonAdd = document.getElementById('openModal')
|
||||||
const buttonClose = document.getElementById('closeComanda')
|
const buttonClose = document.getElementById('closeComanda')
|
||||||
const buttonreOpenComanda = document.getElementById('reOpenComanda')
|
const buttonreOpenComanda = document.getElementById('reOpenComanda')
|
||||||
const buttonPrintComanda = document.getElementById('printComanda')
|
const buttonPrintComanda = document.getElementById('printComanda')
|
||||||
const buttonPayment = document.getElementById('pagarComanda')
|
const buttonPayment = document.getElementById('pagarComanda')
|
||||||
if (resultadoConfirmacao){
|
|
||||||
|
|
||||||
fetch(`/comandas/closeComanda/${id}/`, {
|
|
||||||
|
Swal.fire({
|
||||||
|
title: "Encerrar essa comanda?",
|
||||||
|
text: "Depois de encerrar somente o gerente pode reabrir.",
|
||||||
|
icon: "warning",
|
||||||
|
showCancelButton: true,
|
||||||
|
background: 'rgb(23, 38, 54)',
|
||||||
|
color: 'white',
|
||||||
|
confirmButtonColor: 'linear-gradient(145deg, #1E2A3B, #2C3E50)',
|
||||||
|
cancelButtonColor: "rgb(253, 69, 69)",
|
||||||
|
confirmButtonText: "Encerrar",
|
||||||
|
cancelButtonText: "Cancelar",
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
|
||||||
|
|
||||||
|
fetch(`/comandas/closeComanda/${id}/`, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
@@ -209,15 +222,22 @@ function closeConta(id){
|
|||||||
buttonAdd.style.display = 'none'
|
buttonAdd.style.display = 'none'
|
||||||
buttonreOpenComanda.style.display = 'flex'
|
buttonreOpenComanda.style.display = 'flex'
|
||||||
buttonPayment.style.display = 'flex'
|
buttonPayment.style.display = 'flex'
|
||||||
showToast('✅Comanda encerrada!😁','success')
|
|
||||||
imprimirConta()
|
imprimirConta()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
showToast('❌Ocorreu um erro!😢','error')
|
Swal.fire({
|
||||||
|
color: 'white',
|
||||||
|
title: "Algo deu errado!😢",
|
||||||
|
confirmButtonColor: 'linear-gradient(145deg, #1E2A3B, #2C3E50)',
|
||||||
|
background: 'rgb(23, 38, 54)',
|
||||||
|
text: "Erro: " + error.message,
|
||||||
|
icon: "error",
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user