mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-24 07:28:19 +02:00
Fix permission errors on delivery and order pages
Address ReferenceError by correctly importing and utilizing the usePermissions hook in Deliveries.tsx and Orders.tsx, resolving undefined permission issues and refining the handling of modal data for deliveries and orders. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 76582ba3-44cb-4730-92fa-66f28725967b Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/76582ba3-44cb-4730-92fa-66f28725967b/QrspnZr
This commit is contained in:
1 parent
a4a637d415
commit
a7936fab8d
4 files changed
+8
-4
No files matched your search
@@ -10,6 +10,7 @@ import { useStore } from "@/components/Layout";
|
||||
import { useToast } from "@/hooks/use-toast";
|
||||
import { apiRequest } from "@/lib/queryClient";
|
||||
import { isUnauthorizedError } from "@/lib/authUtils";
|
||||
import { usePermissions } from "@shared/permissions";
|
||||
import {
|
||||
Plus,
|
||||
Search,
|
||||
@@ -36,6 +37,7 @@ export default function Deliveries() {
|
||||
const { selectedStoreId } = useStore();
|
||||
const { toast } = useToast();
|
||||
const queryClient = useQueryClient();
|
||||
const permissions = usePermissions(user?.role);
|
||||
|
||||
// Redirection pour les employés
|
||||
if (user?.role === 'employee') {
|
||||
@@ -219,7 +221,7 @@ export default function Deliveries() {
|
||||
};
|
||||
|
||||
const handleViewDelivery = (delivery: DeliveryWithRelations) => {
|
||||
setSelectedDelivery({ ...delivery, type: 'delivery' });
|
||||
setSelectedDelivery(delivery);
|
||||
setShowDetailModal(true);
|
||||
};
|
||||
|
||||
@@ -316,7 +318,7 @@ export default function Deliveries() {
|
||||
<div className="flex items-center justify-center h-64">
|
||||
<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-secondary"></div>
|
||||
</div>
|
||||
) : (console.log('🚚 Filtered deliveries length:', filteredDeliveries.length) || filteredDeliveries.length === 0) ? (
|
||||
) : filteredDeliveries.length === 0 ? (
|
||||
<div className="flex flex-col items-center justify-center h-64 text-gray-500">
|
||||
<Truck className="w-16 h-16 mb-4 text-gray-300" />
|
||||
<h3 className="text-lg font-medium mb-2">Aucune livraison trouvée</h3>
|
||||
|
||||
Reference in new issue
Block a user