Skip to content

Promotions & Offers

Source: pharmanet-web/src/pages/Promotions/

Pages

Page Route Description
PromotionsList /promotions View active and upcoming promotions
CreateOffer /promotions/create-offer/:promotionId Create a discount offer
MyOffers /promotions/my-offers Manage existing offers

Features

Promotions List (PromotionsList.jsx)

  • Card grid showing active and upcoming promotions
  • Each card: banner, title, description, date range, status chip
  • "Create Offer" button → navigate to /promotions/create-offer/:promotionId
  • "My Offers" button → navigate to /promotions/my-offers

Create Offer (CreateOffer.jsx)

  • Promotion info alert
  • Product selector (dropdown, excludes already-offered products)
  • Discount type selector: Percentage / Fixed Amount
  • Discount value input
  • Max quantity per customer input
  • Real-time price preview:
    Original Price: 500.00 ETB
    Discount: 20% (-100.00 ETB)
    Offer Price: 400.00 ETB
    You Save: 100.00 ETB
    
  • On submit → offerService.createOffer() + notifies admins

My Offers (MyOffers.jsx)

  • Table: Promotion, Product, Original Price, Offer Price, Discount, Status, Active toggle
  • Delete with confirmation modal
  • "Join a Promotion" button

Services

Source: pharmanet-web/src/services/promotions.js

Function Description
getActivePromotions() Current active promotions
getUpcomingPromotions() Future promotions
getPromotionById(id) Single promotion

Source: pharmanet-web/src/services/offers.js

Function Description
getMyOffers(pharmacyId) Seller's offers
getOffersByPromotion(promotionId, pharmacyId) Offers for a promotion
createOffer(payload) Create + notify admins
updateOffer(id, payload) Edit offer
deleteOffer(id) Delete offer
toggleOfferActive(id, isActive) Toggle active flag

Offer Price Calculation

if (discountType === 'percentage') {
  offerPrice = originalPrice - (originalPrice * discountValue / 100);
} else {
  offerPrice = originalPrice - discountValue;
}