Back to projects

Warrington Portal - Job Management & Cost Estimation System

Warrington Portal - Job Management & Cost Estimation System
Freelance

Project Overview

Warrington's Installations Limited portal is a comprehensive job management system for UK-based installation contractors, featuring automated cost estimation, time tracking, and multi-role dashboards for contractors, managers, and customers.

Built advanced cost estimation engine using Google Maps Distance Matrix API for accurate travel calculations, integrating multi-postcode route optimization, worker rate databases, vehicle pricing, and job type multipliers (Emergency: 1.5x, Urgent: 1.3x, Complex: 1.2x).

Integrated Google Cloud Platform with Maps API for distance/travel cost calculation with waypoint routing, Sheets API for automated report generation and data export, and Drive API for PDF invoice uploads with service account authentication.

Developed 55+ RESTful API endpoints with Next.js 14 App Router, implementing role-based access control (Employee, Admin, Customer), authentication with NextAuth.js, and 10+ MongoDB collections for comprehensive data management.

Created automated booking request system with customer job submissions, real-time cost calculations (labor + travel + materials), admin approval workflows, and conversion tracking from booking requests to active jobs.

Implemented comprehensive time tracking with timestamped work logs, mileage tracking, expense management, overtime calculations (hours beyond 10), vehicle usage logging, and manager approval mechanisms.

Built UK postcode validation engine with 20+ postcode area mapping, distance fallback calculations, round-trip optimization, and mile-to-meter conversion for accurate cost estimation when Google API unavailable.

Key Features

AI-Powered Cost Estimation Engine

Multi-factor calculation with Google Maps Distance Matrix API, worker types, vehicle pricing (£/mile), job type multipliers (Emergency: 1.5x, Urgent: 1.3x), overtime calculation (hours beyond 10), and UK postcode validation with 20+ area mapping.

Google Cloud Platform Integration (55+ Endpoints)

Maps API for multi-postcode route optimization and waypoint routing, Sheets API for automated report generation and data export, Drive API for PDF invoice uploads with service account authentication via Google OAuth.

Automated Booking Request System

Customer job submissions with real-time cost calculations (labor + travel + materials breakdown), admin approval workflows (approve/reject with notes), conversion tracking from booking requests to active jobs.

Comprehensive Time Tracking

Timestamped work logs with details, costs, and hours worked; mileage tracking with amounts; expense management; overtime calculations; vehicle usage logging per progress entry; manager approval mechanisms.

Dynamic PDF/Excel Export

Professional job reports generated with jsPDF and ExcelJS, including cost breakdowns, worker assignments, progress timelines, invoice generation, and automated export to Google Sheets/Drive.

Multi-Role Dashboard System

Role-based access control (Employee, Admin, Customer) with NextAuth.js JWT authentication, separate dashboards for each role, protected 55+ API endpoints with session management.

Job Progress Tracking & Analytics

Calendar view with date range filtering (7d, 15d, 1m, 6m, 12m), client-based and status-based filtering, real-time data visualization with Recharts, job analytics and performance metrics dashboard.

Challenges & Solutions

Google Maps API Cost Optimization

Google Maps Distance Matrix API charges per element (origin-destination pair), making multi-postcode route calculations expensive with complex waypoint routing requiring multiple API calls.

Solution:

Implemented intelligent fallback system with 20+ UK postcode area distance mapping, caching frequently requested routes in MongoDB, batch processing multiple postcodes in single requests, and optimized waypoint ordering to minimize API calls.

Complex Multi-Factor Cost Estimation

Calculating accurate job costs required coordinating worker types with different day/overtime rates, vehicle pricing per mile, job type multipliers (Emergency: 1.5x), UK postcode distances, and overtime thresholds (10+ hours).

Solution:

Built modular estimation engine with separate calculation services for labor (worker rates database), travel (Google Maps API with fallback), materials, and overtime, implementing real-time breakdown display and admin override capabilities.

Google Sheets API Authentication & Permissions

Automated report generation required service account setup with proper OAuth scopes, handling token expiration, and managing shared spreadsheet permissions across multiple client accounts.

Solution:

Configured Google Cloud service account with Drive and Sheets API scopes, implemented JWT token refresh mechanism, created automated spreadsheet sharing via Drive API permissions, and built error recovery for expired credentials.

Secure User Management

Preventing unauthorized access while allowing efficient user onboarding and admin approval.

Solution:

Implemented OAuth2 authentication with two-factor email verification and an approval system for new accounts.

Seamless Google Sheets Integration

Uploading reports directly to Google Sheets while maintaining structured formatting.

Solution:

Developed an API bridge that formats data before pushing it to Google Sheets, ensuring compatibility and accuracy.

Project Gallery

Admin dashboard for managing users and tasks

Admin dashboard for managing users and tasks

Google Sheets integration for automated report uploads

Google Sheets integration for automated report uploads

Project Details

Timeline

2024 - Present

Company

Freelance

My Role

Full-Stack Engineer (Solo Developer)

Technologies Used

Next.js 14
TypeScript
React 18
NextAuth.js
Google Maps API
Google Sheets API
Google Drive API
Google Cloud Platform
Google OAuth
MongoDB
MongoDB Atlas
TailwindCSS
Shadcn/ui
Radix UI
jsPDF
ExcelJS
Recharts
EmailJS
REST APIs
Vercel

Testimonial

Muhammad Junaid played a key role in delivering an efficient data management system for our business. His expertise in Next.js, authentication systems, and API integrations streamlined our workflow and enhanced security.
David Clarke

David Clarke

Operations Manager at Warrington Portal