Skip to content

πŸ”’ Lock Out Tag Out (LOTO) Management System - Professional Equipment Protection Frontend | Modern React application with multi-language support for managing lockout/tagout procedures

License

Notifications You must be signed in to change notification settings

Mjeed42/LOTO_PEP

Repository files navigation

LOTO PEP - Frontend

πŸ”’ Lock Out Tag Out (LOTO) Management System - Professional Equipment Protection

A modern, responsive React-based frontend application for managing lockout/tagout procedures with comprehensive multi-language support and intuitive user interface.

React Tailwind CSS License

πŸ“‹ Table of Contents

✨ Features

Core Functionality

  • πŸ” Secure Authentication - JWT-based authentication with role management
  • πŸ‘₯ Role-Based Access Control - Admin, Supervisor, and Worker roles
  • πŸ“ LOTO Procedure Management - Create, update, and track lockout/tagout procedures
  • ⚑ Equipment & Energy Tracking - Comprehensive equipment and energy source management
  • πŸ“ Location-Based Organization - Organize procedures by facility locations
  • πŸ”„ Handover Chain Management - Track procedure handovers with snapshots
  • πŸ“Š Data Export - Export data to Excel and PDF formats
  • πŸ“ˆ Analytics Dashboard - Visual insights into procedures and safety metrics

User Experience

  • 🌐 Multi-Language Support - English and Arabic with RTL support
  • πŸ“± Responsive Design - Optimized for desktop, tablet, and mobile devices
  • 🎨 Modern UI/UX - Clean, intuitive interface with Tailwind CSS
  • πŸ”” Real-time Notifications - Toast notifications for user feedback
  • πŸŒ“ Theme Support - Light and dark mode capabilities
  • ⚑ Fast Performance - Optimized rendering and lazy loading

πŸ›  Tech Stack

  • React 18.2.0 - Modern UI library
  • React Router 6.15.0 - Client-side routing
  • Axios 1.5.0 - HTTP client for API requests
  • Tailwind CSS 3.4.18 - Utility-first CSS framework
  • i18next - Internationalization framework
  • Formik & Yup - Form handling and validation
  • React Toastify - Toast notifications
  • Recharts - Data visualization
  • xlsx - Excel file generation
  • date-fns - Date manipulation library

βœ… Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js 16.x or higher
  • npm 7.x or higher (or yarn 1.22.x or higher)
  • A running backend API instance

πŸ’» Installation

  1. Clone the repository

    git clone https://github.com/yourusername/LOTO_PEP.git
    cd LOTO_PEP
  2. Install dependencies

    npm install

    Or using yarn:

    yarn install

βš™οΈ Configuration

Create a .env.local file in the root directory:

# API Configuration
REACT_APP_API_URL=http://localhost:5000/api

# Optional: Additional environment variables
# REACT_APP_ENV=production

Note: A template file env.local.example is provided for reference.

Environment Variables

Variable Description Default
REACT_APP_API_URL Backend API base URL http://localhost:5000/api

πŸš€ Running the Application

Development Mode

Start the development server:

npm start

Or with yarn:

yarn start

The application will open automatically at http://localhost:3000

Features in Development Mode

  • Hot reload on file changes
  • Detailed error messages
  • React DevTools support

πŸ— Building for Production

Create an optimized production build:

npm run build

Or with yarn:

yarn build

The production-ready files will be in the build/ directory.

Serving the Production Build

# Install a static server
npm install -g serve

# Serve the build
serve -s build

πŸ“ Project Structure

frontend/
β”œβ”€β”€ public/                 # Static files
β”‚   β”œβ”€β”€ index.html         # HTML template
β”‚   └── favicon.ico        # App icon
β”‚
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/        # Reusable React components
β”‚   β”‚   β”œβ”€β”€ common/       # Shared components
β”‚   β”‚   β”œβ”€β”€ layout/       # Layout components
β”‚   β”‚   └── ...
β”‚   β”‚
β”‚   β”œβ”€β”€ contexts/         # React Context providers
β”‚   β”‚   β”œβ”€β”€ AuthContext.js
β”‚   β”‚   └── LanguageContext.js
β”‚   β”‚
β”‚   β”œβ”€β”€ locales/          # Translation files
β”‚   β”‚   β”œβ”€β”€ en/          # English translations
β”‚   β”‚   └── ar/          # Arabic translations
β”‚   β”‚
β”‚   β”œβ”€β”€ pages/            # Page components
β”‚   β”‚   β”œβ”€β”€ Dashboard/
β”‚   β”‚   β”œβ”€β”€ Login/
β”‚   β”‚   β”œβ”€β”€ LOTO/
β”‚   β”‚   └── ...
β”‚   β”‚
β”‚   β”œβ”€β”€ utils/            # Utility functions
β”‚   β”‚   β”œβ”€β”€ api.js       # API client
β”‚   β”‚   └── helpers.js   # Helper functions
β”‚   β”‚
β”‚   β”œβ”€β”€ App.js            # Main application component
β”‚   β”œβ”€β”€ index.js          # Application entry point
β”‚   └── index.css         # Global styles
β”‚
β”œβ”€β”€ .env.local.example    # Environment variables template
β”œβ”€β”€ package.json          # Dependencies and scripts
β”œβ”€β”€ tailwind.config.js    # Tailwind CSS configuration
β”œβ”€β”€ postcss.config.js     # PostCSS configuration
└── README.md            # This file

🎯 Key Features

Authentication & Authorization

The application implements a comprehensive authentication system:

  • Login with email and password
  • JWT token management
  • Protected routes based on user roles
  • Automatic token refresh
  • Secure password handling

LOTO Procedure Management

Create and manage lockout/tagout procedures with:

  • Step-by-step procedure creation
  • Equipment association
  • Energy source tracking
  • Multi-point verification
  • Status tracking (Active, Completed, etc.)

Handover Chain

Track procedure handovers with:

  • Chain of custody tracking
  • Snapshot creation at each handover
  • Historical record maintenance
  • Audit trail

Data Export

Export your data in multiple formats:

  • Excel spreadsheets (.xlsx)
  • PDF documents
  • Customizable export fields
  • Batch export capabilities

🌐 Internationalization

The application supports multiple languages with full RTL (Right-to-Left) support for Arabic:

Available Languages

  • English (en) - Default
  • Arabic (ar) - With RTL layout

Adding New Languages

  1. Create a new directory in src/locales/[language-code]/
  2. Add translation JSON files
  3. Update src/i18n.js configuration
  4. Add language switcher option in UI

πŸ§ͺ Testing

Run the test suite:

npm test

Run tests in watch mode:

npm test -- --watch

🐳 Docker Support

Build the Docker image:

docker build -t loto-frontend .

Run the container:

docker run -p 3000:80 loto-frontend

πŸ“ Scripts

Script Description
npm start Start development server
npm run build Build for production
npm test Run test suite
npm run eject Eject from Create React App

🀝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Code Style

  • Follow React best practices
  • Use functional components with hooks
  • Maintain consistent formatting
  • Write meaningful commit messages
  • Add comments for complex logic

πŸ”’ Security

  • Never commit sensitive data or API keys
  • Use environment variables for configuration
  • Keep dependencies up to date
  • Follow security best practices
  • Report security vulnerabilities responsibly

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘₯ Support

For questions, issues, or feature requests:

  • Open an issue on GitHub
  • Contact the development team
  • Check the documentation

πŸ™ Acknowledgments

  • React team for the amazing framework
  • Tailwind CSS for the utility-first CSS framework
  • All contributors and users of this project

Built with ❀️ for workplace safety and equipment protection

About

πŸ”’ Lock Out Tag Out (LOTO) Management System - Professional Equipment Protection Frontend | Modern React application with multi-language support for managing lockout/tagout procedures

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published