Skip to content

Orders

Source: pharmanet-admin/src/pages/Orders/Orders.jsx

Overview

Full order lifecycle management with real-time updates via Supabase Realtime.

Components

Component File Description
OrderFilters components/orders/OrderFilters.jsx Status filter controls
OrderList components/orders/OrderList.jsx Paginated order table
OrderDetailsModal components/orders/OrderDetailsModal.jsx Full order details
OrderTimeline components/orders/OrderTimeline.jsx Status history timeline
OrderStatusUpdate components/orders/OrderStatusUpdate.jsx Status change form

Service

Source: pharmanet-admin/src/services/orders.js

Function Description
getOrders({page, limit, search, status}) List with customer info
getOrderById(id) Full detail with items, products, payments
updateOrderStatus(id, status, trackingData) Change status + log history + notify customer
updatePrescriptionStatus(id, status) Verify/reject prescription

Real-Time Updates

// orderSlice.js — subscribeToOrders middleware
const subscription = supabase
  .channel('orders-channel')
  .on('postgres_changes',
    { event: '*', schema: 'public', table: 'orders' },
    (payload) => { dispatch(fetchOrders()); }
  )
  .subscribe();