Display all product details for sales in history

Modify the sales history component to correctly display the type, category, and quantity for each product within a sale, and update the storage to return sales with their associated products.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: a388004f-01c5-42b1-b1d1-f18daf8bdd0c
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/0715008c-7244-40f4-befc-26c014852236/a388004f-01c5-42b1-b1d1-f18daf8bdd0c/pSitqax
This commit is contained in:
michaelschal committed 2025-08-06 11:21:11 +00:00
1 parent b9ae743ffb
commit 01c005adea
3 files changed
+47 -9

No files matched your search

+39 -7
View File
@@ -554,15 +554,47 @@ export default function SalesHistory({ canDelete = false }: SalesHistoryProps) {
<span>{sale.nom} {sale.prenom}</span>
</div>
</td>
<td className="text-sm">{sale.typeArticle}</td>
<td className="text-sm">
{sale.products && sale.products.length > 0 ? (
<div className="space-y-1">
{sale.products.map((product, index) => (
<div key={index} className="text-xs">
{product.typeArticle}
</div>
))}
</div>
) : (
<span className="text-gray-400">-</span>
)}
</td>
<td>
<span className={`modern-badge ${
sale.categorie === 'F3' ? 'badge-destructive' : 'badge-secondary'
}`}>
{sale.categorie}
</span>
{sale.products && sale.products.length > 0 ? (
<div className="space-y-1">
{sale.products.map((product, index) => (
<span key={index} className={`modern-badge block ${
product.categorie === 'F3' || product.categorie === 'F4' ? 'badge-destructive' : 'badge-secondary'
}`}>
{product.categorie}
</span>
))}
</div>
) : (
<span className="text-gray-400">-</span>
)}
</td>
<td className="text-center">
{sale.products && sale.products.length > 0 ? (
<div className="space-y-1">
{sale.products.map((product, index) => (
<div key={index} className="text-xs">
{product.quantite}
</div>
))}
</div>
) : (
<span className="text-gray-400">-</span>
)}
</td>
<td className="text-center">{sale.quantite}</td>
<td className="text-sm">{sale.modePaiement}</td>
<td>
<div className="flex items-center gap-2">