Skip to content

Latest commit

 

History

History
71 lines (58 loc) · 2.02 KB

File metadata and controls

71 lines (58 loc) · 2.02 KB

Toast Notifications Implementation

Overview

All pages in the Purchasing Tracker application now use modern toast notifications instead of inline alert messages.

Features

  • Position: Fixed in top-right corner of the screen
  • Types:
    • Success (green with ✓ icon)
    • Error (red with ✕ icon)
    • Info (blue with ℹ icon)
  • Behavior:
    • Automatically dismisses after 3 seconds
    • Smooth slide-in animation from the right
    • Smooth slide-out animation when dismissing
    • Multiple toasts stack vertically
    • Non-intrusive and doesn't block content

Implementation Details

CSS Styles (styles.css)

  • .toast-container: Fixed position container in top-right
  • .toast: Individual toast notification styling
  • .toast-success, .toast-error, .toast-info: Type-specific colors
  • @keyframes slideIn and @keyframes slideOut: Animation definitions

JavaScript Functions

All pages include these utility functions:

function showToast(message, type = 'success') {
    // Creates and displays a toast notification
    // Auto-removes after 3 seconds with animation
}

function showSuccess(message) {
    // Convenience function for success toasts
    showToast(message, 'success');
}

function showError(message) {
    // Convenience function for error toasts
    showToast(message, 'error');
}

Updated Pages

  1. index.html - Public purchase request form
  2. approval.html - Approval management page
  3. tracking.html - Order tracking page
  4. admin.html - Admin management page

Usage Examples

// Success notification
showSuccess('Purchase request submitted successfully!');

// Error notification
showError('Failed to load vendors');

// Info notification (if needed)
showToast('Loading data...', 'info');

Benefits

  • ✨ Modern and professional appearance
  • 🎯 Non-intrusive user experience
  • 📱 Works well on all screen sizes
  • ⚡ Smooth animations
  • 🔄 Can show multiple notifications simultaneously
  • ♿ Clear visual feedback for all actions