Skip to content

Naieem-55/Cab-Management-System

Repository files navigation

Cab Management System

🚖 Cab Management System

Enterprise-Grade Fleet & Operations Management Platform

Built with ASP.NET Core 8 MVC | Entity Framework Core | SignalR | Bootstrap 5 | Chart.js


.NET 8.0 EF Core Bootstrap 5 SQL Server Chart.js


SignalR MailKit QuestPDF Bootstrap Icons License: MIT


A unified, role-based platform for managing fleet operations, trip booking, customer self-service, real-time trip tracking, driver performance ratings, customer feedback & reviews, billing, expense tracking, HR, and vehicle maintenance — with SignalR real-time updates, toast notifications, and dark mode.



📋 Table of Contents

Click to expand

🔍 Overview

The Cab Management System is a comprehensive web application designed to digitize and streamline the end-to-end operations of a cab or fleet agency. It provides dedicated workspaces for five operational roles:

Role Area Purpose
Admin System-wide Fleet, routes, customers, users, feedback management, audit logs
Finance Manager Financial Billing, expenses, revenue reports, invoices
HR Manager Workforce Employees, drivers, license compliance, performance
Travel Manager Operations Trips, maintenance, ratings, feedback response
Customer Self-Service Trip booking, feedback & reviews, invoices, profile management

The platform covers the complete operational lifecycle: customer self-service registration and trip booking, real-time trip tracking via SignalR, driver performance tracking with star ratings, customer feedback & complaint management with admin response workflow, employee and driver management, vehicle and route maintenance, payment processing, expense tracking, PDF invoice generation, license compliance monitoring, email and in-app notifications, toast alerts, and a system-wide dark mode for user comfort.


✨ Key Features

🏢 Core Operations

Feature Description
Multi-Role Dashboards 5 dedicated dashboards with role-specific KPIs, Chart.js visualizations, and contextual alerts
Full CRUD Operations Create, view, edit, and delete across all 12 entity types with server-side validation
Advanced Search & Filtering Text search, enum dropdowns, date ranges, and multi-criteria filtering on all list views
Server-Side Pagination Consistent pagination across all list views with query string preservation

👤 Customer Self-Service Portal

Feature Description
Customer Registration Public sign-up form creating Identity user + Customer profile with auto-login
Personalized Dashboard Trip count, active trips, total spend, recent trips, and quick action buttons
Self-Service Trip Booking Select route and date; driver and vehicle are auto-assigned from available resources
Trip History & Details Full trip list with search, status filter, pagination, and visual progress tracker
Trip Cancellation Cancel pending or confirmed trips with confirmation dialog; auto-releases driver/vehicle
Trip Rating Rate completed trips with interactive 5-star rating from the customer portal
Trip Feedback Submit categorized feedback on completed trips; view feedback history and admin responses
Invoice Access Download PDF invoices directly from the customer portal
Profile Management View and edit personal information (name, phone, address)

⭐ Driver Performance & Ratings

Feature Description
Trip Rating System Interactive 5-star rating with hover effects on completed trips, one rating per trip
Performance Dashboard Per-driver analytics: average rating, total trips, completion rate, revenue, charts
Top Rated Drivers Ranked leaderboard on HR Dashboard with trophy badges and performance links
Visual Star Display Star ratings rendered inline on tables and detail views throughout the app

💬 Customer Feedback & Reviews

Feature Description
Trip Feedback System Customers submit categorized feedback (General, Vehicle Condition, Timing, Driver Behavior, Pricing, Safety) with 1-5 star overall rating on completed trips
Complaint Management Feedback status tracking (Open → In Review → Resolved → Closed) with admin/manager response workflow
Admin Response Admins and Travel Managers can respond to feedback; customer receives in-app notification + email when a response is posted
Feedback Dashboard Admin dashboard displays Total Feedback, Open Complaints, and Average Satisfaction KPIs
Multi-Area Access Feedback visible and manageable from Admin, Travel, and CustomerPortal areas with role-appropriate views
Category Filtering Filter feedback by category, status, and search term across all management views

📡 Real-Time Trip Tracking (SignalR)

Feature Description
Trip Simulation TravelManager triggers auto-progression: Pending → Confirmed (5s) → InProgress (8s) → Completed (12s)
WebSocket Push SignalR hub pushes status updates instantly to all connected clients viewing the trip
Live UI Updates Customer sees status badge, progress tracker, and action buttons update without page reload
Group-Based Routing Each trip has its own SignalR group — only users viewing that trip receive updates
Cancellation-Safe Simulation stops automatically if customer cancels the trip mid-progression
Auto Notifications Each status change creates an in-app notification visible in the bell icon

🚕 Customer & Trip Management

Feature Description
Customer Profiles Centralized directory with contact details, trip history, and total spend tracking
Trip Booking Workflow Automated driver/vehicle status transitions through trip states (Pending → Completed)
Customer-Trip Linking Optional association between customer profiles and bookings for repeat tracking

💰 Financial Management

Feature Description
Billing & Payments Payment records linked to trips with status tracking, method breakdown, and date filtering
Expense Tracking Categorized recording (Fuel, Toll, Parking, Driver Allowance, Insurance, Other)
Profit & Loss Analysis Real-time net profit calculations on Finance dashboard and Reports page
Revenue Reporting Monthly and total summaries with payment method distribution and trend analysis
PDF Invoice Generation Professional A4 invoices via QuestPDF with company branding and billing summary

👥 HR & Compliance

Feature Description
Employee Management Workforce management with position classification and employment status tracking
Driver Management Driver registration with license number and expiry date tracking
License Expiry Alerts Proactive alerts on Admin and HR dashboards for licenses expiring within 30 days
Compliance Badges "Expired" and "Expiring Soon" badges on Driver Index for at-a-glance monitoring

📧 Communication & Notifications

Feature Description
Email Notifications MailKit-powered transactional email with graceful degradation when SMTP is unconfigured
Trip Status Emails Automated email sent to customers when trip status is updated or cancelled
Cancellation Emails Email + in-app notification sent when customer cancels a trip from the portal
Password Reset Emails Secure token-based password reset flow with email delivery
Booking Confirmations Automated email confirmations sent to customers upon trip creation
Feedback Response Emails Email sent to customer when admin/manager responds to their feedback
Feedback Notifications In-app notifications sent to admins/managers on new feedback and to customers on responses
In-App Notifications Bell icon with unread count badge, dropdown feed, mark-as-read, and 60s auto-polling
Toast Notifications Bootstrap 5 toast overlays (fixed top-right, auto-dismiss) replacing inline page alerts

🔧 Platform Capabilities

Feature Description
Role-Based Authorization ASP.NET Identity with area-level route protection and per-controller enforcement
Comprehensive Audit Trail Automatic change tracking recording entity name, action, changed fields, and user
CSV Data Export One-click export on Customers, Vehicles, Trips, Billings, and Expenses
🌙 Dark Mode System-wide theme with CSS variables, navbar toggle, localStorage, system preference detection, smooth transitions, and Chart.js color updates
Styled Empty States Consistent icon + message + CTA button shown when no data exists across all list views
Confirmation Dialogs JavaScript confirm prompts on all delete forms and destructive actions via data-confirm
Double-Submit Prevention Global form handler disables submit buttons and shows spinner after first click
Security Headers X-Frame-Options, X-Content-Type-Options, X-XSS-Protection, Referrer-Policy, CSP with WebSocket support
Structured Logging ILogger<T> throughout all controllers and services with semantic templates
Auto-Migration & Seeding Database schema and sample data provisioned automatically on first run
Responsive Design Bootstrap 5 layout with collapsible sidebar, mobile-friendly tables, and badges

🛠 Technology Stack

Layer Technology Version Purpose
Runtime .NET 8.0 Cross-platform application framework
Web Framework ASP.NET Core MVC 8.0 Server-side request handling and view rendering
ORM Entity Framework Core 8.0 Object-relational mapping, migrations, change tracking
Database SQL Server LocalDB Relational data storage
Real-Time ASP.NET Core SignalR 8.0 WebSocket-based real-time push for trip tracking
Authentication ASP.NET Core Identity 8.0 User management, password hashing, role-based claims
Email MailKit 4.3 SMTP email delivery for notifications
PDF QuestPDF 2024.3 Fluent API for professional PDF invoices
Frontend Razor Views + Bootstrap 5.3 Server-rendered HTML with responsive CSS
Charts Chart.js 4.4 Interactive visualizations (pie, bar, line)
Icons Bootstrap Icons 1.11 UI iconography via CDN
Validation jQuery Validation Unobtrusive Client-side form validation

🏗 Architecture

The application implements a layered architecture with clear separation of concerns:

┌─────────────────────────────────────────┐
│            Presentation Layer            │
│    Razor Views  ·  Bootstrap 5           │
│    Chart.js  ·  Dark Mode  ·  Toasts     │
├─────────────────────────────────────────┤
│        Real-Time + Controller Layer      │
│    SignalR Hub  ·  5 Area Controllers    │
│    [Authorize]  ·  ViewModels            │
├─────────────────────────────────────────┤
│             Service Layer                │
│    Business Logic  ·  Orchestration      │
│    Email  ·  PDF  ·  Trip Simulation     │
├─────────────────────────────────────────┤
│            Repository Layer              │
│    Generic CRUD  ·  Eager Loading        │
│    Custom Queries  ·  Filtering          │
├─────────────────────────────────────────┤
│      EF Core + ASP.NET Identity          │
│    DbContext  ·  Migrations              │
│    Audit Interceptor  ·  Seeding         │
├─────────────────────────────────────────┤
│             SQL Server                   │
└─────────────────────────────────────────┘

Design Principles

Principle Implementation
Generic Repository IRepository<T> / Repository<T> provides CRUD, counting, and predicate queries; entity repos extend with custom methods
Thin Controllers Controllers delegate to services; no direct repository or DbContext access
Area Isolation Each module (Admin, Finance, HR, Travel, CustomerPortal) in its own MVC Area
ViewModel Separation Domain models never bind directly to forms; ViewModels handle all form concerns
Automatic Auditing SaveChangesAsync override sets audit timestamps and logs all changes to AuditLog
Graceful Degradation Email and external services wrapped in try-catch to prevent core operation disruptions

📁 Project Structure

Cab Management System/
│
├── Areas/
│   ├── Admin/                        # System administration
│   │   ├── Controllers/              # Dashboard, UserManagement, Vehicle, Route, Customer, Feedback
│   │   └── Views/                    # 24 views
│   ├── CustomerPortal/               # Customer self-service
│   │   ├── Controllers/              # Dashboard, Trip, Invoice, Profile, Feedback
│   │   └── Views/                    # 12 views
│   ├── Finance/                      # Financial management
│   │   ├── Controllers/              # Dashboard, Billing, Expense, Reports
│   │   └── Views/                    # 17 views
│   ├── HR/                           # Human resources
│   │   ├── Controllers/              # Dashboard, Employee, Driver
│   │   └── Views/                    # 13 views
│   └── Travel/                       # Trip operations
│       ├── Controllers/              # Dashboard, Trip, Maintenance, Feedback
│       └── Views/                    # 16 views
│
├── Controllers/
│   ├── AccountController.cs          # Auth, registration, profile, password reset
│   ├── HomeController.cs             # Landing page with role-based redirect
│   └── NotificationController.cs     # AJAX notification endpoints (get, mark read)
│
├── Hubs/
│   └── TripTrackingHub.cs            # SignalR hub for real-time trip status updates
│
├── Data/
│   ├── ApplicationDbContext.cs        # DbContext, entity config, audit interceptor
│   └── DbSeeder.cs                   # Role, user, and sample data seeding
│
├── Helpers/
│   └── CsvExportHelper.cs            # Generic CSV export utility
│
├── Models/
│   ├── Enums/                         # 12 enums (DriverStatus, TripStatus, FeedbackCategory, etc.)
│   ├── ViewModels/                    # 19 ViewModels
│   ├── BaseEntity.cs                  # Abstract base with audit timestamps
│   └── [12 domain models]            # Employee, Driver, Vehicle, Route, Trip,
│                                      # Billing, MaintenanceRecord, Customer,
│                                      # Expense, DriverRating, TripFeedback, Notification
│
├── Repositories/
│   ├── IRepository.cs                 # Generic repository interface
│   ├── Repository.cs                  # Generic repository implementation
│   └── [11 entity repositories]       # Interface + implementation pairs
│
├── Services/
│   ├── EmailService.cs                # MailKit SMTP implementation
│   ├── InvoicePdfService.cs           # QuestPDF invoice implementation
│   ├── DashboardService.cs            # Multi-role dashboard statistics
│   ├── TripSimulationService.cs       # SignalR-powered trip status simulation
│   └── [11 entity services]           # Business logic implementations
│
├── Views/
│   ├── Account/                       # Login, Register, Profile, Password flows
│   ├── Home/                          # Landing page
│   └── Shared/                        # _Layout, _Sidebar, _Login, _Pagination
│
├── wwwroot/
│   ├── css/
│   │   ├── site.css                   # Core styles with CSS variables
│   │   └── dark-mode.css              # Dark theme definitions & overrides
│   └── js/
│       └── site.js                    # Sidebar, theme, notifications, form UX
│
├── Migrations/                        # EF Core migration files
├── Program.cs                         # Entry point, DI, middleware pipeline
└── appsettings.json                   # Connection strings, email, logging

🗄 Database Design

Entity Relationship Diagram

┌──────────────────┐     ┌──────────────────┐     ┌──────────────────┐
│     Employee     │     │      Driver      │     │     Customer     │
├──────────────────┤     ├──────────────────┤     ├──────────────────┤
│ Id            PK │─1─1─│ Id            PK │     │ Id            PK │
│ Name             │     │ EmployeeId    FK │     │ Name             │
│ Email       (UQ) │     │ LicenseNo   (UQ) │     │ Email       (UQ) │
│ Phone            │     │ LicenseExpiry    │     │ Phone            │
│ Position         │     │ Status           │     │ Address          │
│ Status           │     └────────┬─────────┘     └────────┬─────────┘
│ HireDate         │              │                        │
│ Salary           │              1                   0..* (optional)
└──────────────────┘              │                        │
                                  │                        │
┌──────────────────┐     ┌────────┴─────────┐◄─────────────┘
│     Vehicle      │     │      Trip        │
├──────────────────┤     ├──────────────────┤
│ Id            PK │─1─*─│ Id            PK │
│ RegNo       (UQ) │     │ DriverId      FK │
│ Make             │     │ VehicleId     FK │
│ Model            │     │ RouteId       FK │
│ Year             │     │ CustomerId    FK │  (nullable)
│ Color            │     │ CustomerName     │
│ Capacity         │     │ CustomerPhone    │
│ FuelType         │     │ BookingDate      │
│ Status           │     │ TripDate         │
│ Mileage          │     │ Status           │
└────────┬─────────┘     │ Cost             │
         │               └───┬────────┬─────┘
         │                   │        │
         1                   1        *
         │                   │        │
┌────────┴─────────┐  ┌─────┴──────────┐  ┌──────────────────┐  ┌──────────────────┐
│   Maintenance    │  │    Billing     │  │     Expense      │  │  DriverRating     │
│     Record       │  ├────────────────┤  ├──────────────────┤  ├──────────────────┤
├──────────────────┤  │ Id          PK │  │ Id            PK │  │ Id            PK │
│ Id            PK │  │ TripId      FK │  │ VehicleId     FK │  │ TripId    FK(UQ) │
│ VehicleId     FK │  │ Amount         │  │ TripId        FK │  │ DriverId      FK │
│ Description      │  │ PayDate        │  │ Category         │  │ Rating     (1-5) │
│ Cost             │  │ Method         │  │ Amount           │  │ Comment          │
│ Date             │  │ Status         │  │ Date             │  │ CustomerName     │
│ NextMaintDate    │  └────────────────┘  │ Description      │  └──────────────────┘
│ Status           │                      │ ApprovedBy       │
└──────────────────┘                      └──────────────────┘

┌──────────────────┐
│  TripFeedback    │
├──────────────────┤
│ Id            PK │
│ TripId    FK(UQ) │
│ CustomerId    FK │
│ Rating     (1-5) │
│ Category         │
│ Comment          │
│ Status           │
│ AdminResponse    │
│ RespondedBy      │
│ RespondedDate    │
└──────────────────┘

┌──────────────────┐     ┌──────────────────┐     ┌──────────────────┐
│      Route       │     │    AuditLog      │     │   Notification   │
├──────────────────┤     ├──────────────────┤     ├──────────────────┤
│ Id            PK │─1─*─│ Id            PK │     │ Id            PK │
│ Origin           │ Trip│ EntityName       │     │ UserId        FK │
│ Destination      │     │ EntityId         │     │ Title            │
│ Distance         │     │ Action           │     │ Message          │
│ EstTimeHours     │     │ Changes   (JSON) │     │ IsRead           │
│ BaseCost         │     │ UserId           │     │ Link             │
└──────────────────┘     │ Timestamp        │     │ CreatedDate      │
                         └──────────────────┘     └──────────────────┘

+ ASP.NET Identity tables (AspNetUsers, AspNetRoles, AspNetUserRoles, etc.)

Referential Integrity Rules

Relationship Delete Behavior Rationale
Employee → Driver Restrict Prevent orphaned driver records
Driver → Trip Restrict Preserve trip history
Vehicle → Trip Restrict Preserve trip history
Route → Trip Restrict Preserve trip history
Customer → Trip Set Null Trips persist; CustomerId becomes null
Trip → Billing Cascade Billing follows trip lifecycle
Trip → Expense Set Null Expenses persist for financial records
Trip → DriverRating Cascade Rating follows trip lifecycle; unique TripId constraint
Trip → TripFeedback Cascade Feedback follows trip lifecycle; unique TripId constraint
Customer → TripFeedback Restrict Preserve feedback history
Driver → DriverRating Restrict Preserve rating history
Vehicle → Maintenance Cascade Maintenance follows vehicle lifecycle
Vehicle → Expense Set Null Expenses persist for financial records

🔐 Modules & Access Control

🛡 Admin Module

Full system oversight, configuration, and customer management

Feature Description
Dashboard System-wide KPIs with trip status charts, monthly revenue, feedback stats, and license expiry alerts
User Management Create and manage users; assign roles (Admin, Finance, HR, Travel)
Vehicle Management Fleet CRUD with search; registration, capacity, fuel type, mileage tracking
Route Management Origin-destination routes with distance, estimated time, and base cost
Customer Management Customer directory with CRUD, search, pagination, CSV export, and trip history
Feedback Management View all customer feedback; filter by category/status; respond to complaints; track resolution
Audit Logs Searchable trail of all create, update, and delete operations

💳 Finance Module

Revenue tracking, expense management, and financial reporting

Feature Description
Dashboard Revenue, expenses, net profit KPIs with payment method, trend, and expense charts
Billing Manage billing records; filter by status and date range; download PDF invoices
Expense Tracking Categorized expenses with vehicle/trip associations; filter and CSV export
Reports Revenue summaries, payment breakdowns, period analysis, and profit/loss

👨‍💼 HR Module

Workforce administration, compliance monitoring, and driver performance

Feature Description
Dashboard Workforce KPIs, license expiry alerts, and Top Rated Drivers leaderboard
Employee Management Full CRUD with position and status filters
Driver Management License tracking with visual compliance badges and performance links
Driver Performance Analytics dashboard: average rating, trips, completion rate, revenue, charts

🗺 Travel Module

Trip operations, real-time tracking, vehicle maintenance, and trip ratings

Feature Description
Dashboard Trip and vehicle status KPIs with pie chart visualizations
Trip Management Book trips with automated driver/vehicle assignment and email confirmations
Trip Simulation One-click simulation auto-progresses trip through all statuses with real-time SignalR push
Trip Rating Interactive 5-star rating on completed trips with comments; one per trip
Feedback Response View and respond to customer feedback; update complaint status; customer notified via email + in-app
Maintenance Schedule and track vehicle maintenance; flag overdue records

🧑‍💻 Customer Portal

Self-service trip booking, tracking, rating, and invoice management

Feature Description
Registration Public sign-up creating Identity user + Customer profile with auto-login
Dashboard Personalized stats, recent trips table, and quick action buttons
Trip Booking Select route and date; driver/vehicle auto-assigned from available pool; trip created as Pending
My Trips Trip history with search by route, status filter, pagination, and progress tracker
Live Trip Tracking Real-time status updates via SignalR — progress tracker, badge, and buttons update without page reload
Trip Cancellation Cancel pending/confirmed trips with confirm dialog; releases driver/vehicle; sends email + notification
Trip Rating Interactive 5-star rating on completed trips with comments; "Rated" badge display
Trip Feedback Submit categorized feedback (General, Vehicle Condition, Timing, Safety, etc.) with 1-5 star rating on completed trips
My Feedback View submitted feedback history, check admin responses, and track complaint resolution status
Invoices Billing list with PDF download buttons for each invoice
Profile View and edit personal information

🚀 Getting Started

Prerequisites

Requirement Version
.NET SDK 8.0 or later
SQL Server LocalDB (included with Visual Studio) or any instance

Quick Start

# 1. Clone the repository
git clone https://github.com/Naieem-55/Cab-Management-System.git
cd "Cab Management System"

# 2. Restore dependencies
dotnet restore

# 3. Run the application
dotnet run

Note: The application will automatically create the database, apply all EF Core migrations, and seed roles, default users, and sample data on first run.

Access the Application

Protocol URL
HTTPS https://localhost:7188
HTTP http://localhost:5195

Custom Database Connection

Update appsettings.json to use a different SQL Server instance:

{
  "ConnectionStrings": {
    "DefaultConnection": "Server=YOUR_SERVER;Database=CabManagementDb;Trusted_Connection=True;MultipleActiveResultSets=true"
  }
}

🔑 Default Credentials

The application seeds the following accounts on first run:

Role Email Password
Admin admin@cabsystem.com Admin@123
Finance Manager finance@cabsystem.com Finance@123
HR Manager hr@cabsystem.com HR@1234
Travel Manager travel@cabsystem.com Travel@123

Tip: The Admin account can create additional users through User Management. Customers can self-register via the Register link on the login page.

Sample Data

The seeder provisions realistic sample data for immediate testing:

Entity Count Notes
Employees 8 4 drivers, 2 receptionists, 1 mechanic, 1 cleaner
Drivers 4 Linked to driver-position employees
Vehicles 6 Mixed fuel types and statuses
Routes 5 Indian city-to-city routes
Trips 6 Various statuses (Pending through Completed)
Billings 4 Pending and completed payments
Maintenance 3 Scheduled, in-progress, and completed

⚙ Configuration

Email Settings

Configure SMTP in appsettings.json to enable email notifications:

{
  "EmailSettings": {
    "SmtpHost": "smtp.gmail.com",
    "SmtpPort": 587,
    "SmtpUsername": "your-email@gmail.com",
    "SmtpPassword": "your-app-password",
    "FromEmail": "noreply@cabmanagement.com",
    "FromName": "Cab Management System",
    "EnableSsl": true
  }
}

When SMTP is not configured, the application logs a warning and continues without sending emails. No functionality is blocked.

Security Configuration

Password Policy
Rule Value
Minimum length 6 characters
Require uppercase Yes
Require lowercase Yes
Require digit Yes
Require special character Yes
Authentication
Setting Value
Login path /Account/Login
Access denied path /Account/AccessDenied
Session expiry 30 days (sliding)
Security Headers
Header Value
X-Frame-Options DENY
X-Content-Type-Options nosniff
X-XSS-Protection 1; mode=block
Referrer-Policy strict-origin-when-cross-origin
Content-Security-Policy Configured for self, inline styles/scripts, and CDN assets
Logging

Structured logging via ILogger<T> across all controllers and services:

Category Level
Default Information
Microsoft.AspNetCore Warning

📄 License

This project is developed for educational and demonstration purposes.


Developed by @Naieem-55 using ASP.NET Core 8