afficher le x que lorsque la commande est confirmé ou en préparation et fix de la page Invoice d'admin
This commit is contained in:
@@ -33,16 +33,16 @@ const Invoices = () => {
|
||||
const handleCancelInvoice = async (id) => {
|
||||
|
||||
mySwal.fire({
|
||||
title: `Effacer la commande?`,
|
||||
text: 'Êtes-vous certain de vouloir effacer cette commande (cette action est irréversible)?',
|
||||
title: `Annuler la commande?`,
|
||||
text: 'Êtes-vous certain de vouloir annuler cette commande (cette action est irréversible)?',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Oui',
|
||||
cancelButtonText: 'Non',
|
||||
}).then(async (result) => {
|
||||
if (result.isConfirmed) {
|
||||
fetch(`https://localhost:7292/api/Invoice?id=${id}`, {
|
||||
method: 'CANCEL',
|
||||
fetch(`https://localhost:7292/api/Invoice/Cancel/${id}`, {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
credentials: 'include'
|
||||
}).then(async (response) => {
|
||||
@@ -50,11 +50,11 @@ const Invoices = () => {
|
||||
const deletedId = await response.json();
|
||||
setInvoices(invoices.filter((invoice) => invoice.id !== deletedId));
|
||||
|
||||
onShowAlert('Suppression de la commande avec succès!', 2000);
|
||||
onShowAlert('Annulation de la commande avec succès!', 2000);
|
||||
}
|
||||
else {
|
||||
mySwal.fire({
|
||||
title: `Erreur lors de la suppression de la commande...`,
|
||||
title: `Erreur lors de l'annulation de la commande...`,
|
||||
text: `L'erreur: ${response}`,
|
||||
icon: 'error',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user