Prioritize pending tasks and improve task sorting for better visibility

Update task filtering and sorting logic to display pending tasks at the top, followed by sorting by priority and creation date.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: d43bd811-9372-45a7-8ac9-4a954c0538e1
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/d43bd811-9372-45a7-8ac9-4a954c0538e1/wOe6TmM
This commit is contained in:
michaelschal committed 2025-08-15 12:22:13 +00:00
1 parent 0c47c69619
commit 7ff6a493fb
2 files changed
+39 -18

No files matched your search

+38 -18
View File
@@ -56,7 +56,7 @@ export default function Tasks() {
queryFn: () => {
const params = new URLSearchParams();
if (selectedStoreId) {
params.append('storeId', selectedStoreId);
params.append('storeId', selectedStoreId.toString());
}
return fetch(`/api/tasks?${params.toString()}`, {
credentials: 'include'
@@ -157,26 +157,46 @@ export default function Tasks() {
}
};
// Filtrer les tâches
const filteredTasks = tasks.filter((task: TaskWithRelations) => {
// Filtre par recherche
if (searchTerm && !task.title.toLowerCase().includes(searchTerm.toLowerCase()) &&
!task.description?.toLowerCase().includes(searchTerm.toLowerCase())) {
return false;
}
// Filtrer et trier les tâches
const filteredTasks = tasks
.filter((task: TaskWithRelations) => {
// Filtre par recherche
if (searchTerm && !task.title.toLowerCase().includes(searchTerm.toLowerCase()) &&
!task.description?.toLowerCase().includes(searchTerm.toLowerCase())) {
return false;
}
// Filtre par statut
if (statusFilter !== "all" && task.status !== statusFilter) {
return false;
}
// Filtre par statut
if (statusFilter !== "all" && task.status !== statusFilter) {
return false;
}
// Filtre par priorité
if (priorityFilter !== "all" && task.priority !== priorityFilter) {
return false;
}
// Filtre par priorité
if (priorityFilter !== "all" && task.priority !== priorityFilter) {
return false;
}
return true;
});
return true;
})
.sort((a: TaskWithRelations, b: TaskWithRelations) => {
// Faire remonter les tâches non validées (pending) en premier
if (a.status === 'pending' && b.status === 'completed') return -1;
if (a.status === 'completed' && b.status === 'pending') return 1;
// Pour les tâches de même statut, trier par priorité (high > medium > low)
const priorityOrder = { 'high': 3, 'medium': 2, 'low': 1 };
const aPriority = priorityOrder[a.priority as keyof typeof priorityOrder] || 2;
const bPriority = priorityOrder[b.priority as keyof typeof priorityOrder] || 2;
if (aPriority !== bPriority) {
return bPriority - aPriority; // Ordre décroissant (high en premier)
}
// Enfin, trier par date de création (plus récent en premier)
const aDate = a.createdAt ? new Date(a.createdAt).getTime() : 0;
const bDate = b.createdAt ? new Date(b.createdAt).getTime() : 0;
return bDate - aDate;
});
// Pagination
const {
+1
View File
@@ -34,6 +34,7 @@ The platform is built with a clear separation of concerns, utilizing a modern fu
- **Reconciliation:** Functionality for reconciling Bills of Lading (BL) and invoices with immediate UI updates.
- **Invoice Verification Cache:** Robust caching system for invoice verification results with automatic expiration and conflict resolution. Enhanced with unique constraint handling and graceful error management for production stability (August 2025). Fixed production SSL certificate errors and fetch timeout loops with enhanced error handling, network timeout protection, and error result caching to prevent infinite retry loops (August 2025).
- **UI Scrollbar Optimization:** Eliminated redundant vertical scrollbar on the right side of the screen while preserving necessary internal page scrolling. Implemented global CSS rules with `overflow: hidden` on html/body/root and Layout height management to prevent vertical overflow issues in production (August 2025).
- **Task Management:** Système complet de gestion des tâches avec tri intelligent - les tâches non validées (status 'pending') remontent automatiquement en première page pour une meilleure visibilité et suivi prioritaire. Tri secondaire par priorité et date de création (Août 2025).
- **User and Permission Management:** Granular access controls ensuring that users (e.g., employees) have appropriate permissions for tasks like creating customer orders.
- **Reporting:** Statistical reporting, including monthly summaries of deliveries based on `deliveredDate`.