Overview
The Service entity represents services or offerings available in Simple Manager Mobile. Services can be activated or deactivated, have pricing information, and include color coding for visual organization.
Interface Definition
export interface Service {
id: string;
name: string;
defaultPrice: number;
color: string;
isActive: boolean;
createdAt: string;
updatedAt: string;
}
Properties
Unique identifier for the service
Name or title of the service
Default price for the service in the application’s base currency
Color code (typically hex format) used for visual identification of the service in the UI
Flag indicating whether the service is currently active and available for use. Inactive services are typically hidden from selection
ISO 8601 timestamp indicating when the service was created
ISO 8601 timestamp indicating when the service was last updated
Usage Example
import { Service } from '@/domain/entities/Service';
const service: Service = {
id: 'svc_123456',
name: 'General Consultation',
defaultPrice: 150.00,
color: '#4A90E2',
isActive: true,
createdAt: '2024-03-12T10:30:00Z',
updatedAt: '2024-03-12T10:30:00Z'
};
Common Operations
Creating a New Service
const newService: Omit<Service, 'id' | 'createdAt' | 'updatedAt'> = {
name: 'Physical Therapy Session',
defaultPrice: 100.00,
color: '#2ECC71',
isActive: true
};
Deactivating a Service
const deactivatedService: Service = {
...existingService,
isActive: false,
updatedAt: new Date().toISOString()
};
Updating Service Price
const updatedService: Service = {
...existingService,
defaultPrice: 175.00,
updatedAt: new Date().toISOString()
};
Color Guidelines
The color field should follow these recommendations:
- Use hex color codes (e.g.,
#4A90E2, #FF5733)
- Choose distinct colors for different services to improve visual differentiation
- Consider accessibility and contrast when selecting colors
// Example color palette for services
const serviceColors = {
consultation: '#4A90E2',
therapy: '#2ECC71',
diagnostic: '#F39C12',
surgery: '#E74C3C',
followUp: '#9B59B6'
};
Filtering Active Services
// Get only active services
const activeServices = services.filter(service => service.isActive);
// Get services by price range
const affordableServices = services.filter(
service => service.isActive && service.defaultPrice <= 100
);