add some new features

This commit is contained in:
2026-10-29 15:03:48 +01:00
parent c876405a8f
commit 20012db615
39 changed files with 2908 additions and 97 deletions
+38
View File
@@ -0,0 +1,38 @@
class AbfallModel {
const AbfallModel({
required this.abfallId,
required this.datumZeit,
required this.gewichtGramm,
required this.kosten,
this.bauteilId,
this.bauteilName,
this.kostenUnbekannt = false,
this.kostenNachtraeglich = false,
});
final String abfallId;
final DateTime datumZeit;
final double gewichtGramm;
final double kosten;
// Linked records are derived from parts, never stored a second time.
final String? bauteilId;
final String? bauteilName;
final bool kostenUnbekannt;
final bool kostenNachtraeglich;
bool get ausBauteil => bauteilId != null;
factory AbfallModel.fromJson(Map<String, dynamic> json) => AbfallModel(
abfallId: json['abfallId'] as String,
datumZeit: DateTime.parse(json['datumZeit'] as String).toLocal(),
gewichtGramm: (json['gewichtGramm'] as num).toDouble(),
kosten: (json['kosten'] as num).toDouble(),
);
Map<String, dynamic> toJson() => {
'abfallId': abfallId,
'datumZeit': datumZeit.toIso8601String(),
'gewichtGramm': gewichtGramm,
'kosten': kosten,
};
}