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:
parent
565f677c38
commit
a7f343545f
@ -105,8 +105,9 @@ const InvoiceItem = ({ invoice, onCancel }) => {
|
||||
<div className="invoice-item-products">
|
||||
<div className="invoice-product-delete">
|
||||
<h4 className='simple-item-title' >Produits</h4>
|
||||
{(invoice.status == 0 || invoice.status == 2 )&&
|
||||
<h1 className='simple-item-buttons'><FontAwesomeIcon icon={faTimes} className='btn-effacer-morceau' style={{ color: "red", cursor: 'pointer', margin: 'auto' }}
|
||||
onClick={() => onCancel(invoice.id)} /></h1>
|
||||
onClick={() => onCancel(invoice.id)} /></h1>}
|
||||
</div>
|
||||
<ul className="invoice-item-product-list">
|
||||
{invoice.products.map((p) => (
|
||||
|
@ -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',
|
||||
});
|
||||
|
@ -29,8 +29,8 @@ const MyInvoices = () => {
|
||||
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',
|
||||
@ -54,7 +54,7 @@ const MyInvoices = () => {
|
||||
}
|
||||
else {
|
||||
mySwal.fire({
|
||||
title: `Erreur lors de la suppression de la commande...`,
|
||||
title: `Erreur lors de l'annulation de la commande...`,
|
||||
text: `L'erreur: ${await response.json()}`,
|
||||
icon: 'error',
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user