Skip to content

Promotions

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

Overview

Admins create promotion campaigns with timelines. Sellers submit discount offers within active promotions. The mobile app displays active promotions and offer pricing.

Features

  • Tabbed view: All, Active, Draft, Ended, Cancelled
  • Create/Edit dialog: Title, description, date range, status
  • Activate: Sets status to active and broadcasts notification to all customers
  • End: Sets status to ended (offers stop showing)
  • Delete: Remove draft promotions
  • Offers viewer: See all seller-submitted offers within a promotion

Service

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

Function Description
getPromotions({status, search, page, limit}) List with banner/creator data
getPromotionById(id) Single promotion
createPromotion(payload) Create (sets created_by to current user)
updatePromotion(id, payload) Edit
deletePromotion(id) Delete
activatePromotion(id) Activate + notify all customers
endPromotion(id) End (set status to ended)
getPromotionOffers(promotionId) View seller offers
getActivePromotions() Currently active

Promotion Status Lifecycle

draft → active → ended
cancelled

Notification on Activation

When a promotion is activated:

// promotions.js
await notificationService.createNotificationForAllCustomers({
  type: 'promotion_activated',
  title: promotion.title,
  message: `New promotion: ${promotion.description}`,
  relatedId: promotion.id,
  relatedType: 'promotion',
});