mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 05:25:40 +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,14 +186,27 @@ function imprimirConta() {
|
||||
|
||||
|
||||
function closeConta(id){
|
||||
|
||||
const resultadoConfirmacao = confirm("Encerrar comanda?");
|
||||
const buttonAdd = document.getElementById('openModal')
|
||||
const buttonClose = document.getElementById('closeComanda')
|
||||
const buttonreOpenComanda = document.getElementById('reOpenComanda')
|
||||
const buttonPrintComanda = document.getElementById('printComanda')
|
||||
const buttonPayment = document.getElementById('pagarComanda')
|
||||
if (resultadoConfirmacao){
|
||||
|
||||
|
||||
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',
|
||||
@@ -209,16 +222,23 @@ function closeConta(id){
|
||||
buttonAdd.style.display = 'none'
|
||||
buttonreOpenComanda.style.display = 'flex'
|
||||
buttonPayment.style.display = 'flex'
|
||||
showToast('✅Comanda encerrada!😁','success')
|
||||
imprimirConta()
|
||||
}
|
||||
})
|
||||
.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",
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function reloadPage(){
|
||||
|
||||
Reference in New Issue
Block a user