react-version #1

Merged
memartel_loc merged 290 commits from react-version into main 2023-11-04 09:48:15 -04:00
3 changed files with 12 additions and 11 deletions
Showing only changes of commit a7f343545f - Show all commits

View File

@ -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>
<h1 className='simple-item-buttons'><FontAwesomeIcon icon={faTimes} className='btn-effacer-morceau' style={{ color: "red", cursor: 'pointer', margin: 'auto'}}
onClick={() => onCancel(invoice.id)} /></h1>
{(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>}
</div>
<ul className="invoice-item-product-list">
{invoice.products.map((p) => (

View File

@ -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',
});

View File

@ -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',
});