55 lines
1.6 KiB
Dart
55 lines
1.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../theme/app_theme.dart';
|
|
|
|
/// Art des PDF / Vorgangs im Lebenszyklus (Angebot → Leistung → Rechnung …).
|
|
enum DokumentTyp {
|
|
angebot,
|
|
leistung,
|
|
abschlag,
|
|
rechnung,
|
|
schlussrechnung,
|
|
mahnung,
|
|
}
|
|
|
|
extension DokumentTypX on DokumentTyp {
|
|
String get storageValue => name;
|
|
|
|
String get labelDe => switch (this) {
|
|
DokumentTyp.angebot => 'Angebot',
|
|
DokumentTyp.leistung => 'Leistung / Baustelle',
|
|
DokumentTyp.abschlag => 'Abschlagsrechnung',
|
|
DokumentTyp.rechnung => 'Rechnung',
|
|
DokumentTyp.schlussrechnung => 'Schlussrechnung',
|
|
DokumentTyp.mahnung => 'Mahnung',
|
|
};
|
|
|
|
/// PDF-Titel / Dokumentkopf.
|
|
String get pdfTitel => switch (this) {
|
|
DokumentTyp.angebot => 'Angebot',
|
|
DokumentTyp.leistung => 'Leistungsnachweis',
|
|
DokumentTyp.abschlag => 'Abschlagsrechnung',
|
|
DokumentTyp.rechnung => 'Rechnung',
|
|
DokumentTyp.schlussrechnung => 'Schlussrechnung',
|
|
DokumentTyp.mahnung => 'Mahnung',
|
|
};
|
|
|
|
Color get badgeColor => switch (this) {
|
|
DokumentTyp.angebot => const Color(0xFF7E57C2),
|
|
DokumentTyp.leistung => AppTheme.statusGeplant,
|
|
DokumentTyp.abschlag => const Color(0xFF26A69A),
|
|
DokumentTyp.rechnung => AppTheme.accentCyan,
|
|
DokumentTyp.schlussrechnung => const Color(0xFF42A5F5),
|
|
DokumentTyp.mahnung => const Color(0xFFE53935),
|
|
};
|
|
}
|
|
|
|
DokumentTyp dokumentTypFromStorage(String? raw) {
|
|
if (raw != null && raw.isNotEmpty) {
|
|
for (final v in DokumentTyp.values) {
|
|
if (v.name == raw) return v;
|
|
}
|
|
}
|
|
return DokumentTyp.rechnung;
|
|
}
|