V1 calendrier
This commit is contained in:
		| @@ -1,5 +1,4 @@ | ||||
| import 'package:cloud_firestore/cloud_firestore.dart'; | ||||
| import 'package:latlong2/latlong.dart'; | ||||
|  | ||||
| enum EventStatus { | ||||
|   confirmed, | ||||
| @@ -41,6 +40,7 @@ class EventModel { | ||||
|   final int installationTime; | ||||
|   final int disassemblyTime; | ||||
|   final String eventTypeId; | ||||
|   final DocumentReference? eventTypeRef; | ||||
|   final String customerId; | ||||
|   final String address; | ||||
|   final double latitude; | ||||
| @@ -60,6 +60,7 @@ class EventModel { | ||||
|     required this.installationTime, | ||||
|     required this.disassemblyTime, | ||||
|     required this.eventTypeId, | ||||
|     this.eventTypeRef, | ||||
|     required this.customerId, | ||||
|     required this.address, | ||||
|     required this.latitude, | ||||
| @@ -79,7 +80,7 @@ class EventModel { | ||||
|     final docs = docsRaw is List | ||||
|         ? docsRaw.map<Map<String, String>>((e) { | ||||
|             if (e is Map) { | ||||
|               return Map<String, String>.from(e as Map); | ||||
|               return Map<String, String>.from(e); | ||||
|             } else if (e is String) { | ||||
|               final fileName = Uri.decodeComponent( | ||||
|                 e.split('/').last.split('?').first, | ||||
| @@ -94,7 +95,7 @@ class EventModel { | ||||
|     final options = optionsRaw is List | ||||
|         ? optionsRaw.map<Map<String, dynamic>>((e) { | ||||
|             if (e is Map) { | ||||
|               return Map<String, dynamic>.from(e as Map); | ||||
|               return Map<String, dynamic>.from(e); | ||||
|             } else { | ||||
|               return {}; | ||||
|             } | ||||
| @@ -112,7 +113,10 @@ class EventModel { | ||||
|       disassemblyTime: map['DisassemblyTime'] ?? 0, | ||||
|       eventTypeId: map['EventType'] is DocumentReference | ||||
|           ? (map['EventType'] as DocumentReference).id | ||||
|           : '', | ||||
|           : map['EventType'] ?? '', | ||||
|       eventTypeRef: map['EventType'] is DocumentReference | ||||
|           ? map['EventType'] as DocumentReference | ||||
|           : null, | ||||
|       customerId: map['customer'] is DocumentReference | ||||
|           ? (map['customer'] as DocumentReference).id | ||||
|           : '', | ||||
| @@ -135,8 +139,8 @@ class EventModel { | ||||
|       'BasePrice': basePrice, | ||||
|       'InstallationTime': installationTime, | ||||
|       'DisassemblyTime': disassemblyTime, | ||||
|       'EventType': eventTypeId, | ||||
|       'customer': customerId, | ||||
|       'EventType': eventTypeId.isNotEmpty ? FirebaseFirestore.instance.collection('eventTypes').doc(eventTypeId) : null, | ||||
|       'customer': customerId.isNotEmpty ? FirebaseFirestore.instance.collection('customers').doc(customerId) : null, | ||||
|       'Address': address, | ||||
|       'Position': GeoPoint(latitude, longitude), | ||||
|       'Latitude': latitude, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 ElPoyo
					ElPoyo