-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
173 lines (157 loc) · 4.07 KB
/
types.ts
File metadata and controls
173 lines (157 loc) · 4.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
export enum Role {
MANAGER = 'MANAGER',
EMPLOYEE = 'EMPLOYEE',
VIEWER = 'VIEWER',
ADMINISTRATOR = 'ADMINISTRATOR',
PENDING = 'PENDING'
}
export enum Status {
PENDING = 'PENDING',
COMPLETED = 'COMPLETED'
}
export enum ViewMode {
MONTH = 'MONTH',
WEEK = 'WEEK',
DAY = 'DAY'
}
export interface User {
id: string;
name: string;
searchKey?: string; // Lowercase name for case-insensitive search
role: Role;
email: string;
phoneNumber?: string;
password?: string; // For mock authentication
}
export interface Customer {
id: string;
name: string;
searchKey?: string; // Lowercase name for case-insensitive search
address?: string; // Street Address
city?: string;
region?: string;
contactName?: string; // Person to ask for
phone1?: string;
phone2?: string;
phone3?: string;
geoLocation?: string; // Google Maps Link
coordinates?: { lat: number; lng: number; };
color: string; // e.g. 'red', 'blue', 'green' - used for Tailwind classes
}
export interface Product {
id: string;
name: string;
searchKey?: string; // Lowercase name for case-insensitive search
sku?: string;
category: string;
price: number;
unit: string;
imageUrl?: string;
inStock: boolean;
quantity?: number;
createdAt: Date;
}
export interface DeliveryDestination {
id: string;
customerId: string; // Reference to Customer
isCompleted: boolean;
comments?: string;
completedAt?: Date;
photos?: string[]; // Array of Storage URLs
// Fulfillment Fields
items?: {
productId: string;
name: string;
quantity: number;
unit: string;
isVerified?: boolean; // Driver verified this item
}[];
isPacked?: boolean; // Warehouse packed this order
signature?: string; // Optional Proof of Delivery
}
export interface Route {
id: string;
title: string;
description: string;
assignedTo: string; // User UID
createdBy: string; // User UID of the creator
category?: string; // Keep for backward compatibility if needed, or remove? Let's keep as optional.
// We should prefer looking up customer details via destinations[0].customerId now for "main" customer.
dueDate: Date;
status: Status;
priority?: 'Low' | 'Medium' | 'High';
createdAt: Date;
destinations: DeliveryDestination[];
}
export interface CalendarDay {
date: Date;
isCurrentMonth: boolean;
isToday: boolean;
}
export interface AppIssue {
id: string;
ticketNumber: string;
userId: string;
userName: string;
reportedAt: Date;
issueDescription: string;
severity: 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL';
status: 'PENDING' | 'CLOSED';
developerComment?: string;
}
export interface LoginLog {
id: string;
userId: string;
userName: string;
userEmail: string;
userPhone?: string;
timestamp: Date; // Server timestamp
browserTime: string; // Local browser time string
userAgent: string;
platform: string;
ipAddress?: string;
type: 'LOGIN';
status: 'SUCCESS' | 'FAILURE';
failureReason?: string;
}
export interface DeliveryConfig {
warehouseLocation: {
coordinates: { lat: number; lng: number };
geoLocation?: string; // Google Maps Link
name?: string;
};
enableCamera?: boolean; // Global feature toggle
// Storage Management
blockUploads?: boolean; // Emergency stop for storage limits
autoCleanupDays?: number; // 0 = disabled, >0 = delete photos older than X days
}
export interface Vehicle {
id: string;
name: string;
licensePlate: string;
type: 'TRUCK' | 'VAN' | 'BIKE' | 'CAR';
status: 'ACTIVE' | 'MAINTENANCE' | 'INACTIVE';
assignedTo?: string; // User ID
createdAt: Date;
// Extended Details
make: string;
model: string;
year: number;
vin: string;
mileage: number;
maintenanceDate?: Date;
maintenanceNotes?: string;
}
export type MaintenanceType = 'OIL_CHANGE' | 'TIRE_ROTATION' | 'BRAKE_SERVICE' | 'INSPECTION' | 'BATTERY' | 'REPAIR' | 'OTHER';
export interface MaintenanceRecord {
id: string;
vehicleId: string;
type: MaintenanceType;
date: Date;
cost: number;
provider: string;
mileageAtService: number;
notes?: string;
performedBy: string; // User ID
createdAt: Date;
}