mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-23 06:58:19 +02:00
Add alert for clients not contacted when their order status is available
Update `getPendingClientCalls` to filter customer orders where the client has not been notified and the order status is one of 'Disponible', 'disponible', 'Arrivé', 'arrivé', 'Prêt', or 'prêt' in both database and in-memory storage. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 95e8aab4-f39f-4b48-aa57-a759ec15ba3d Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/95e8aab4-f39f-4b48-aa57-a759ec15ba3d/TckvSqR
This commit is contained in:
1 parent
7ae93cc4b8
commit
967fe14a33
2 files changed
+11
-11
No files matched your search
@@ -15,6 +15,10 @@ run = ["npm", "run", "start"]
|
|||||||
localPort = 5000
|
localPort = 5000
|
||||||
externalPort = 80
|
externalPort = 80
|
||||||
|
|
||||||
|
[[ports]]
|
||||||
|
localPort = 35077
|
||||||
|
externalPort = 3003
|
||||||
|
|
||||||
[[ports]]
|
[[ports]]
|
||||||
localPort = 38451
|
localPort = 38451
|
||||||
externalPort = 3002
|
externalPort = 3002
|
||||||
|
|||||||
+7
-11
@@ -1682,8 +1682,8 @@ export class DatabaseStorage implements IStorage {
|
|||||||
|
|
||||||
async getPendingClientCalls(groupIds?: number[]): Promise<CustomerOrderWithRelations[]> {
|
async getPendingClientCalls(groupIds?: number[]): Promise<CustomerOrderWithRelations[]> {
|
||||||
const conditions = [
|
const conditions = [
|
||||||
eq(dlcProducts.status, 'valides'),
|
eq(customerOrders.customerNotified, false),
|
||||||
eq(customerOrders.customerNotified, false)
|
inArray(customerOrders.status, ['Disponible', 'disponible', 'Arrivé', 'arrivé', 'Prêt', 'prêt'])
|
||||||
];
|
];
|
||||||
|
|
||||||
if (groupIds && groupIds.length > 0) {
|
if (groupIds && groupIds.length > 0) {
|
||||||
@@ -1697,7 +1697,6 @@ export class DatabaseStorage implements IStorage {
|
|||||||
group: groups
|
group: groups
|
||||||
})
|
})
|
||||||
.from(customerOrders)
|
.from(customerOrders)
|
||||||
.innerJoin(dlcProducts, eq(customerOrders.gencode, dlcProducts.gencode))
|
|
||||||
.leftJoin(suppliers, eq(customerOrders.supplierId, suppliers.id))
|
.leftJoin(suppliers, eq(customerOrders.supplierId, suppliers.id))
|
||||||
.leftJoin(groups, eq(customerOrders.groupId, groups.id))
|
.leftJoin(groups, eq(customerOrders.groupId, groups.id))
|
||||||
.where(and(...conditions))
|
.where(and(...conditions))
|
||||||
@@ -3477,15 +3476,12 @@ export class MemStorage implements IStorage {
|
|||||||
orders = orders.filter(order => groupIds.includes(order.groupId));
|
orders = orders.filter(order => groupIds.includes(order.groupId));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find orders where client not notified and product is available
|
// Find orders where client not notified and status is 'Disponible'
|
||||||
const pendingOrders = orders.filter(order => {
|
const pendingOrders = orders.filter(order => {
|
||||||
if (order.customerNotified) return false;
|
return !order.customerNotified &&
|
||||||
|
(order.status === 'Disponible' || order.status === 'disponible' ||
|
||||||
// Check if there's a DLC product with status 'valides' matching this gencode
|
order.status === 'Arrivé' || order.status === 'arrivé' ||
|
||||||
const matchingDlcProduct = Array.from(this.dlcProducts.values())
|
order.status === 'Prêt' || order.status === 'prêt');
|
||||||
.find(dlc => dlc.gencode === order.gencode && dlc.status === 'valides');
|
|
||||||
|
|
||||||
return !!matchingDlcProduct;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return pendingOrders.map(order => ({
|
return pendingOrders.map(order => ({
|
||||||
|
|||||||
Reference in new issue
Block a user