mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-20 21:49:07 +02:00
Remove client call notifications from the main orders page
Removes the client call notification component and related data fetching from the Orders page, addressing a bug where these notifications were incorrectly displayed. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 818c4995-85cc-4d53-8067-b67dcee52c2d Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/818c4995-85cc-4d53-8067-b67dcee52c2d/ac4X8UH
This commit is contained in:
1 parent
e9e843055f
commit
6f114499fe
2 files changed
+5
-46
No files matched your search
@@ -15,10 +15,6 @@ run = ["npm", "run", "start"]
|
|||||||
localPort = 5000
|
localPort = 5000
|
||||||
externalPort = 80
|
externalPort = 80
|
||||||
|
|
||||||
[[ports]]
|
|
||||||
localPort = 34895
|
|
||||||
externalPort = 3000
|
|
||||||
|
|
||||||
[[ports]]
|
[[ports]]
|
||||||
localPort = 38451
|
localPort = 38451
|
||||||
externalPort = 3002
|
externalPort = 3002
|
||||||
@@ -27,6 +23,10 @@ externalPort = 3002
|
|||||||
localPort = 41343
|
localPort = 41343
|
||||||
externalPort = 3001
|
externalPort = 3001
|
||||||
|
|
||||||
|
[[ports]]
|
||||||
|
localPort = 45571
|
||||||
|
externalPort = 3000
|
||||||
|
|
||||||
[workflows]
|
[workflows]
|
||||||
runButton = "Project"
|
runButton = "Project"
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
|
|||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { Alert, AlertDescription } from "@/components/ui/alert";
|
|
||||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||||
import { Pagination, usePagination } from "@/components/ui/pagination";
|
import { Pagination, usePagination } from "@/components/ui/pagination";
|
||||||
import { useAuthUnified } from "@/hooks/useAuthUnified";
|
import { useAuthUnified } from "@/hooks/useAuthUnified";
|
||||||
@@ -23,15 +22,13 @@ import {
|
|||||||
Trash2,
|
Trash2,
|
||||||
Building,
|
Building,
|
||||||
User,
|
User,
|
||||||
Phone
|
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import { safeFormat } from "@/lib/dateUtils";
|
import { safeFormat } from "@/lib/dateUtils";
|
||||||
import CreateOrderModal from "@/components/modals/CreateOrderModal";
|
import CreateOrderModal from "@/components/modals/CreateOrderModal";
|
||||||
import EditOrderModal from "@/components/modals/EditOrderModal";
|
import EditOrderModal from "@/components/modals/EditOrderModal";
|
||||||
import OrderDetailModal from "@/components/modals/OrderDetailModal";
|
import OrderDetailModal from "@/components/modals/OrderDetailModal";
|
||||||
import ConfirmDeleteModal from "@/components/modals/ConfirmDeleteModal";
|
import ConfirmDeleteModal from "@/components/modals/ConfirmDeleteModal";
|
||||||
import ClientCallsModal from "@/components/modals/ClientCallsModal";
|
import type { OrderWithRelations } from "@shared/schema";
|
||||||
import type { OrderWithRelations, CustomerOrderWithRelations } from "@shared/schema";
|
|
||||||
|
|
||||||
export default function Orders() {
|
export default function Orders() {
|
||||||
const { user } = useAuthUnified();
|
const { user } = useAuthUnified();
|
||||||
@@ -68,7 +65,6 @@ export default function Orders() {
|
|||||||
const [showEditModal, setShowEditModal] = useState(false);
|
const [showEditModal, setShowEditModal] = useState(false);
|
||||||
const [showDetailModal, setShowDetailModal] = useState(false);
|
const [showDetailModal, setShowDetailModal] = useState(false);
|
||||||
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
||||||
const [showClientCallsModal, setShowClientCallsModal] = useState(false);
|
|
||||||
const [selectedOrder, setSelectedOrder] = useState<OrderWithRelations | null>(null);
|
const [selectedOrder, setSelectedOrder] = useState<OrderWithRelations | null>(null);
|
||||||
const [orderToDelete, setOrderToDelete] = useState<OrderWithRelations | null>(null);
|
const [orderToDelete, setOrderToDelete] = useState<OrderWithRelations | null>(null);
|
||||||
|
|
||||||
@@ -76,21 +72,6 @@ export default function Orders() {
|
|||||||
// CRITICAL FIX: Appliquer le filtrage par storeId pour TOUS les rôles, pas seulement admin
|
// CRITICAL FIX: Appliquer le filtrage par storeId pour TOUS les rôles, pas seulement admin
|
||||||
const ordersUrl = `/api/orders${selectedStoreId ? `?storeId=${selectedStoreId}` : ''}`;
|
const ordersUrl = `/api/orders${selectedStoreId ? `?storeId=${selectedStoreId}` : ''}`;
|
||||||
|
|
||||||
// Query pour les appels clients en attente
|
|
||||||
const pendingCallsUrl = `/api/customer-orders/pending-calls${selectedStoreId ? `?storeId=${selectedStoreId}` : ''}`;
|
|
||||||
const { data: pendingCalls = [], isLoading: isPendingCallsLoading } = useQuery<CustomerOrderWithRelations[]>({
|
|
||||||
queryKey: [pendingCallsUrl, selectedStoreId],
|
|
||||||
queryFn: async () => {
|
|
||||||
const response = await fetch(pendingCallsUrl, { credentials: 'include' });
|
|
||||||
if (!response.ok) {
|
|
||||||
throw new Error('Failed to fetch pending calls');
|
|
||||||
}
|
|
||||||
const data = await response.json();
|
|
||||||
console.log('📞 Pending calls received:', Array.isArray(data) ? data.length : 'NOT_ARRAY', 'items');
|
|
||||||
return data;
|
|
||||||
},
|
|
||||||
refetchInterval: 30000, // Refetch every 30 seconds
|
|
||||||
});
|
|
||||||
|
|
||||||
const { data: ordersData = [], isLoading } = useQuery<OrderWithRelations[]>({
|
const { data: ordersData = [], isLoading } = useQuery<OrderWithRelations[]>({
|
||||||
queryKey: [ordersUrl, selectedStoreId],
|
queryKey: [ordersUrl, selectedStoreId],
|
||||||
@@ -272,22 +253,6 @@ export default function Orders() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Alerte pour les appels clients en attente */}
|
|
||||||
{!isPendingCallsLoading && pendingCalls.length > 0 && (
|
|
||||||
<Alert
|
|
||||||
className="sticky top-0 z-50 bg-orange-50 border-orange-200 cursor-pointer hover:bg-orange-100 transition-colors"
|
|
||||||
onClick={() => setShowClientCallsModal(true)}
|
|
||||||
data-testid="alert-client-calls"
|
|
||||||
>
|
|
||||||
<Phone className="h-4 w-4 text-orange-600" />
|
|
||||||
<AlertDescription className="text-orange-700">
|
|
||||||
<strong>📞 {pendingCalls.length} client{pendingCalls.length > 1 ? 's' : ''} à appeler</strong>
|
|
||||||
<span className="block text-sm mt-1">
|
|
||||||
Produits disponibles - Cliquez pour voir la liste des clients à contacter
|
|
||||||
</span>
|
|
||||||
</AlertDescription>
|
|
||||||
</Alert>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* Filters */}
|
{/* Filters */}
|
||||||
<div className="bg-gray-50 border border-gray-200 p-4 rounded-lg">
|
<div className="bg-gray-50 border border-gray-200 p-4 rounded-lg">
|
||||||
@@ -503,12 +468,6 @@ export default function Orders() {
|
|||||||
isLoading={deleteMutation.isPending}
|
isLoading={deleteMutation.isPending}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* Modal pour les appels clients */}
|
|
||||||
<ClientCallsModal
|
|
||||||
isOpen={showClientCallsModal}
|
|
||||||
onClose={() => setShowClientCallsModal(false)}
|
|
||||||
pendingCalls={pendingCalls}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user