feat: ajout de la gestion de la préparation d'un événement avec page permettant de le gérer
This commit is contained in:
@@ -13,8 +13,7 @@ String eventStatusToString(EventStatus status) {
|
||||
case EventStatus.canceled:
|
||||
return 'CANCELED';
|
||||
case EventStatus.waitingForApproval:
|
||||
default:
|
||||
return 'WAITING_FOR_APPROVAL';
|
||||
return 'WAITING_FOR_APPROVAL';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,6 +64,78 @@ PreparationStatus preparationStatusFromString(String? status) {
|
||||
}
|
||||
}
|
||||
|
||||
// Statut de chargement (loading)
|
||||
enum LoadingStatus {
|
||||
notStarted,
|
||||
inProgress,
|
||||
completed,
|
||||
completedWithMissing
|
||||
}
|
||||
|
||||
String loadingStatusToString(LoadingStatus status) {
|
||||
switch (status) {
|
||||
case LoadingStatus.notStarted:
|
||||
return 'NOT_STARTED';
|
||||
case LoadingStatus.inProgress:
|
||||
return 'IN_PROGRESS';
|
||||
case LoadingStatus.completed:
|
||||
return 'COMPLETED';
|
||||
case LoadingStatus.completedWithMissing:
|
||||
return 'COMPLETED_WITH_MISSING';
|
||||
}
|
||||
}
|
||||
|
||||
LoadingStatus loadingStatusFromString(String? status) {
|
||||
switch (status) {
|
||||
case 'NOT_STARTED':
|
||||
return LoadingStatus.notStarted;
|
||||
case 'IN_PROGRESS':
|
||||
return LoadingStatus.inProgress;
|
||||
case 'COMPLETED':
|
||||
return LoadingStatus.completed;
|
||||
case 'COMPLETED_WITH_MISSING':
|
||||
return LoadingStatus.completedWithMissing;
|
||||
default:
|
||||
return LoadingStatus.notStarted;
|
||||
}
|
||||
}
|
||||
|
||||
// Statut de déchargement (unloading)
|
||||
enum UnloadingStatus {
|
||||
notStarted,
|
||||
inProgress,
|
||||
completed,
|
||||
completedWithMissing
|
||||
}
|
||||
|
||||
String unloadingStatusToString(UnloadingStatus status) {
|
||||
switch (status) {
|
||||
case UnloadingStatus.notStarted:
|
||||
return 'NOT_STARTED';
|
||||
case UnloadingStatus.inProgress:
|
||||
return 'IN_PROGRESS';
|
||||
case UnloadingStatus.completed:
|
||||
return 'COMPLETED';
|
||||
case UnloadingStatus.completedWithMissing:
|
||||
return 'COMPLETED_WITH_MISSING';
|
||||
}
|
||||
}
|
||||
|
||||
UnloadingStatus unloadingStatusFromString(String? status) {
|
||||
switch (status) {
|
||||
case 'NOT_STARTED':
|
||||
return UnloadingStatus.notStarted;
|
||||
case 'IN_PROGRESS':
|
||||
return UnloadingStatus.inProgress;
|
||||
case 'COMPLETED':
|
||||
return UnloadingStatus.completed;
|
||||
case 'COMPLETED_WITH_MISSING':
|
||||
return UnloadingStatus.completedWithMissing;
|
||||
default:
|
||||
return UnloadingStatus.notStarted;
|
||||
}
|
||||
}
|
||||
|
||||
enum ReturnStatus {
|
||||
notStarted,
|
||||
inProgress,
|
||||
@@ -104,6 +175,8 @@ class EventEquipment {
|
||||
final String equipmentId; // ID de l'équipement
|
||||
final int quantity; // Quantité (pour consommables)
|
||||
final bool isPrepared; // Validé en préparation
|
||||
final bool isLoaded; // Validé au chargement
|
||||
final bool isUnloaded; // Validé au déchargement
|
||||
final bool isReturned; // Validé au retour
|
||||
final int? returnedQuantity; // Quantité retournée (pour consommables)
|
||||
|
||||
@@ -111,6 +184,8 @@ class EventEquipment {
|
||||
required this.equipmentId,
|
||||
this.quantity = 1,
|
||||
this.isPrepared = false,
|
||||
this.isLoaded = false,
|
||||
this.isUnloaded = false,
|
||||
this.isReturned = false,
|
||||
this.returnedQuantity,
|
||||
});
|
||||
@@ -120,6 +195,8 @@ class EventEquipment {
|
||||
equipmentId: map['equipmentId'] ?? '',
|
||||
quantity: map['quantity'] ?? 1,
|
||||
isPrepared: map['isPrepared'] ?? false,
|
||||
isLoaded: map['isLoaded'] ?? false,
|
||||
isUnloaded: map['isUnloaded'] ?? false,
|
||||
isReturned: map['isReturned'] ?? false,
|
||||
returnedQuantity: map['returnedQuantity'],
|
||||
);
|
||||
@@ -130,6 +207,8 @@ class EventEquipment {
|
||||
'equipmentId': equipmentId,
|
||||
'quantity': quantity,
|
||||
'isPrepared': isPrepared,
|
||||
'isLoaded': isLoaded,
|
||||
'isUnloaded': isUnloaded,
|
||||
'isReturned': isReturned,
|
||||
'returnedQuantity': returnedQuantity,
|
||||
};
|
||||
@@ -139,6 +218,8 @@ class EventEquipment {
|
||||
String? equipmentId,
|
||||
int? quantity,
|
||||
bool? isPrepared,
|
||||
bool? isLoaded,
|
||||
bool? isUnloaded,
|
||||
bool? isReturned,
|
||||
int? returnedQuantity,
|
||||
}) {
|
||||
@@ -146,6 +227,8 @@ class EventEquipment {
|
||||
equipmentId: equipmentId ?? this.equipmentId,
|
||||
quantity: quantity ?? this.quantity,
|
||||
isPrepared: isPrepared ?? this.isPrepared,
|
||||
isLoaded: isLoaded ?? this.isLoaded,
|
||||
isUnloaded: isUnloaded ?? this.isUnloaded,
|
||||
isReturned: isReturned ?? this.isReturned,
|
||||
returnedQuantity: returnedQuantity ?? this.returnedQuantity,
|
||||
);
|
||||
@@ -181,6 +264,8 @@ class EventModel {
|
||||
final List<EventEquipment> assignedEquipment;
|
||||
final List<String> assignedContainers; // IDs des conteneurs assignés
|
||||
final PreparationStatus? preparationStatus;
|
||||
final LoadingStatus? loadingStatus;
|
||||
final UnloadingStatus? unloadingStatus;
|
||||
final ReturnStatus? returnStatus;
|
||||
|
||||
EventModel({
|
||||
@@ -208,6 +293,8 @@ class EventModel {
|
||||
this.assignedEquipment = const [],
|
||||
this.assignedContainers = const [],
|
||||
this.preparationStatus,
|
||||
this.loadingStatus,
|
||||
this.unloadingStatus,
|
||||
this.returnStatus,
|
||||
});
|
||||
|
||||
@@ -342,6 +429,8 @@ class EventModel {
|
||||
contactPhone: map['contactPhone']?.toString(),
|
||||
assignedEquipment: assignedEquipment,
|
||||
preparationStatus: preparationStatusFromString(map['preparationStatus'] as String?),
|
||||
loadingStatus: loadingStatusFromString(map['loadingStatus'] as String?),
|
||||
unloadingStatus: unloadingStatusFromString(map['unloadingStatus'] as String?),
|
||||
returnStatus: returnStatusFromString(map['returnStatus'] as String?),
|
||||
);
|
||||
} catch (e) {
|
||||
@@ -401,6 +490,8 @@ class EventModel {
|
||||
'assignedEquipment': assignedEquipment.map((e) => e.toMap()).toList(),
|
||||
'assignedContainers': assignedContainers,
|
||||
'preparationStatus': preparationStatus != null ? preparationStatusToString(preparationStatus!) : null,
|
||||
'loadingStatus': loadingStatus != null ? loadingStatusToString(loadingStatus!) : null,
|
||||
'unloadingStatus': unloadingStatus != null ? unloadingStatusToString(unloadingStatus!) : null,
|
||||
'returnStatus': returnStatus != null ? returnStatusToString(returnStatus!) : null,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user