174 lines
5.6 KiB
Dart
174 lines
5.6 KiB
Dart
enum DataConsent { basicOnly, full }
|
|
|
|
enum BusinessType { ecommerce, manufacturing, wholesale, retail }
|
|
|
|
enum ClientStatus { newClient, pending, completed, updated }
|
|
|
|
extension BusinessTypeLabel on BusinessType {
|
|
String get label {
|
|
switch (this) {
|
|
case BusinessType.ecommerce:
|
|
return 'E-commerce';
|
|
case BusinessType.manufacturing:
|
|
return 'Manufacturing';
|
|
case BusinessType.wholesale:
|
|
return 'Wholesale';
|
|
case BusinessType.retail:
|
|
return 'Retail';
|
|
}
|
|
}
|
|
}
|
|
|
|
extension ClientStatusLabel on ClientStatus {
|
|
String get label {
|
|
switch (this) {
|
|
case ClientStatus.newClient:
|
|
return 'NEW';
|
|
case ClientStatus.pending:
|
|
return 'PENDING';
|
|
case ClientStatus.completed:
|
|
return 'COMPLETED';
|
|
case ClientStatus.updated:
|
|
return 'UPDATED';
|
|
}
|
|
}
|
|
}
|
|
|
|
class Client {
|
|
final String id;
|
|
final String name;
|
|
final String city; // free-text, e.g. "New York", "Austin"
|
|
final BusinessType businessType;
|
|
final double parcelVolume;
|
|
final int activeContracts;
|
|
final String provider;
|
|
final String efficiency;
|
|
final ClientStatus status;
|
|
final String lastUpdated;
|
|
final bool surveySubmitted;
|
|
final String notes;
|
|
final DataConsent dataConsent;
|
|
|
|
// Extended basic-info fields
|
|
final String phone; // contact number
|
|
final String frequency; // shipment frequency: Daily / Weekly / etc.
|
|
final String businessState; // Indian state of the business
|
|
final String transitType; // 'within_state' | 'state_to_state' | ''
|
|
final String transitFrom; // city (within_state) or state name (state_to_state)
|
|
final String transitTo; // city (within_state) or state name (state_to_state)
|
|
final String neighbourhood; // local area / neighbourhood
|
|
final String logisticsSegment; // 'First Mile' | 'Middle Mile' | 'Last Mile' | ''
|
|
final String pincode; // client postal/PIN code — optional manual entry
|
|
|
|
// Device GPS at the moment of survey submission — stored for field audit, not displayed in app UI.
|
|
final double surveyLat;
|
|
final double surveyLng;
|
|
final String surveyAddress; // reverse-geocoded full address
|
|
final String surveyZone; // suburb / neighbourhood from geocoder
|
|
final String surveyPincode; // postal code from GPS reverse-geocode
|
|
|
|
// Field-agent attribution — who collected this record (from login session).
|
|
final String recordedByName; // e.g. "Kamesh"
|
|
final String recordedByEmail; // login email of the agent
|
|
final String recordedByRole; // 'admin' | 'rep' | 'support'
|
|
|
|
const Client({
|
|
required this.id,
|
|
required this.name,
|
|
required this.city,
|
|
required this.businessType,
|
|
required this.parcelVolume,
|
|
required this.activeContracts,
|
|
required this.provider,
|
|
required this.efficiency,
|
|
required this.status,
|
|
required this.lastUpdated,
|
|
required this.surveySubmitted,
|
|
this.notes = '',
|
|
this.dataConsent = DataConsent.full,
|
|
this.phone = '',
|
|
this.frequency = '',
|
|
this.businessState = '',
|
|
this.transitType = '',
|
|
this.transitFrom = '',
|
|
this.transitTo = '',
|
|
this.neighbourhood = '',
|
|
this.logisticsSegment = '',
|
|
this.pincode = '',
|
|
this.surveyLat = 0.0,
|
|
this.surveyLng = 0.0,
|
|
this.surveyAddress = '',
|
|
this.surveyZone = '',
|
|
this.surveyPincode = '',
|
|
this.recordedByName = '',
|
|
this.recordedByEmail = '',
|
|
this.recordedByRole = '',
|
|
});
|
|
|
|
Client copyWith({
|
|
String? id,
|
|
String? name,
|
|
String? city,
|
|
BusinessType? businessType,
|
|
double? parcelVolume,
|
|
int? activeContracts,
|
|
String? provider,
|
|
String? efficiency,
|
|
ClientStatus? status,
|
|
String? lastUpdated,
|
|
bool? surveySubmitted,
|
|
String? notes,
|
|
DataConsent? dataConsent,
|
|
String? phone,
|
|
String? frequency,
|
|
String? businessState,
|
|
String? transitType,
|
|
String? transitFrom,
|
|
String? transitTo,
|
|
String? neighbourhood,
|
|
String? logisticsSegment,
|
|
String? pincode,
|
|
double? surveyLat,
|
|
double? surveyLng,
|
|
String? surveyAddress,
|
|
String? surveyZone,
|
|
String? surveyPincode,
|
|
String? recordedByName,
|
|
String? recordedByEmail,
|
|
String? recordedByRole,
|
|
}) {
|
|
return Client(
|
|
id: id ?? this.id,
|
|
name: name ?? this.name,
|
|
city: city ?? this.city,
|
|
businessType: businessType ?? this.businessType,
|
|
parcelVolume: parcelVolume ?? this.parcelVolume,
|
|
activeContracts: activeContracts ?? this.activeContracts,
|
|
provider: provider ?? this.provider,
|
|
efficiency: efficiency ?? this.efficiency,
|
|
status: status ?? this.status,
|
|
lastUpdated: lastUpdated ?? this.lastUpdated,
|
|
surveySubmitted: surveySubmitted ?? this.surveySubmitted,
|
|
notes: notes ?? this.notes,
|
|
dataConsent: dataConsent ?? this.dataConsent,
|
|
phone: phone ?? this.phone,
|
|
frequency: frequency ?? this.frequency,
|
|
businessState: businessState ?? this.businessState,
|
|
transitType: transitType ?? this.transitType,
|
|
transitFrom: transitFrom ?? this.transitFrom,
|
|
transitTo: transitTo ?? this.transitTo,
|
|
neighbourhood: neighbourhood ?? this.neighbourhood,
|
|
logisticsSegment: logisticsSegment ?? this.logisticsSegment,
|
|
pincode: pincode ?? this.pincode,
|
|
surveyLat: surveyLat ?? this.surveyLat,
|
|
surveyLng: surveyLng ?? this.surveyLng,
|
|
surveyAddress: surveyAddress ?? this.surveyAddress,
|
|
surveyZone: surveyZone ?? this.surveyZone,
|
|
surveyPincode: surveyPincode ?? this.surveyPincode,
|
|
recordedByName: recordedByName ?? this.recordedByName,
|
|
recordedByEmail: recordedByEmail ?? this.recordedByEmail,
|
|
recordedByRole: recordedByRole ?? this.recordedByRole,
|
|
);
|
|
}
|
|
}
|