The TimeTracker application now includes a comprehensive client management system that allows administrators to:
- Create and manage client organizations
- Set default hourly rates per client
- Automatically populate project rates when creating projects
- Track client statistics and project relationships
- Maintain client contact information
- Client Creation: Create new clients with detailed information
- Client Editing: Update client details, rates, and contact information
- Client Archiving: Archive inactive clients while preserving data
- Client Deletion: Remove clients (only when no projects exist)
- Default Hourly Rates: Set standard rates per client
- Automatic Rate Population: Rates automatically fill when creating projects
- Project-Level Override: Individual projects can still have custom rates
- Client Selection: Dropdown selection instead of manual typing
- Error Prevention: Eliminates typos and duplicate client names
- Relationship Tracking: Clear view of all projects per client
CREATE TABLE clients (
id INTEGER PRIMARY KEY,
name VARCHAR(200) NOT NULL UNIQUE,
description TEXT,
contact_person VARCHAR(200),
email VARCHAR(200),
phone VARCHAR(50),
address TEXT,
default_hourly_rate NUMERIC(9, 2),
status VARCHAR(20) DEFAULT 'active',
created_at DATETIME NOT NULL,
updated_at DATETIME NOT NULL
);CREATE TABLE projects (
id INTEGER PRIMARY KEY,
name VARCHAR(200) NOT NULL,
client_id INTEGER NOT NULL,
description TEXT,
billable BOOLEAN DEFAULT TRUE,
hourly_rate NUMERIC(9, 2),
billing_ref VARCHAR(100),
status VARCHAR(20) DEFAULT 'active',
created_at DATETIME NOT NULL,
updated_at DATETIME NOT NULL,
FOREIGN KEY (client_id) REFERENCES clients (id)
);The old system stored client names as strings in the projects.client field. The migration script will:
- Create the new
clientstable - Extract unique client names from existing projects
- Create
Clientrecords for each unique client - Add
client_idcolumn to projects table - Update project records to reference client IDs
- Remove the old
clientcolumn
cd migrations
python migrate_to_client_model.py- Navigate to Clients β New Client
- Fill in client information:
- Client Name (required)
- Default Hourly Rate (optional)
- Description (optional)
- Contact Person (optional)
- Email (optional)
- Phone (optional)
- Address (optional)
- Click Create Client
- Navigate to Projects β Create Project
- Select a client from the dropdown
- The hourly rate will automatically populate if the client has a default rate
- You can still modify the rate per project if needed
- View Client: See client details and associated projects
- Edit Client: Update client information and rates
- Archive Client: Mark client as inactive
- Delete Client: Remove client (only if no projects exist)
GET /clients- List all clientsPOST /clients/create- Create new clientGET /clients/<id>- View client detailsPOST /clients/<id>/edit- Edit clientPOST /clients/<id>/archive- Archive clientPOST /clients/<id>/activate- Activate clientPOST /clients/<id>/delete- Delete client
GET /api/clients- Get active clients for dropdowns (JSON)
- No More Typos: Dropdown selection eliminates manual typing errors
- Consistent Naming: Standardized client names across the system
- Duplicate Prevention: System prevents duplicate client entries
- Automatic Rate Population: Saves time when creating projects
- Quick Client Selection: Faster project creation process
- Centralized Management: All client information in one place
- Client Overview: See all projects and statistics per client
- Contact Management: Keep client contact information organized
- Rate Tracking: Monitor and adjust client rates easily
- Admin Only: Client creation, editing, and deletion restricted to administrators
- View Access: All authenticated users can view client information
- Project Access: Users can see client information through projects
- Foreign Key Constraints: Ensures data consistency
- Cascade Protection: Prevents client deletion when projects exist
- Audit Trail: Tracks creation and modification timestamps
- Client Categories: Group clients by industry or type
- Rate History: Track rate changes over time
- Client Notes: Add internal notes about clients
- Bulk Operations: Import/export client data
- Client Dashboard: Dedicated analytics per client
- Invoice System: Enhanced client billing
- Reporting: Client-specific time and cost reports
- Communication: Email integration for client updates
- Ensure database backup before running migration
- Check database permissions
- Verify all required tables exist
- Check if client is archived
- Verify client exists in database
- Ensure proper foreign key relationships
- Verify client has default hourly rate set
- Check JavaScript console for errors
- Ensure client is active
For issues or questions about the client management system, please:
- Check the application logs
- Verify database schema
- Test with a simple client creation
- Contact system administrator
The new client management system provides a robust foundation for managing client relationships and project billing. It eliminates common errors, improves efficiency, and provides better organization of client information. The system is designed to be scalable and can accommodate future enhancements as needed.