price per item is printed

This commit is contained in:
atseirjo
2026-10-28 12:32:49 +01:00
parent c32adbad50
commit 77fbe16867
31 changed files with 656 additions and 55 deletions
+3
View File
@@ -77,6 +77,9 @@ class AnwendungController extends GetxController {
entry.toJson(),
]);
anwendungen.assignAll([entry]);
if (Get.isRegistered<HomeController>()) {
Get.find<HomeController>().loadProfile();
}
hasError.value = false;
message.value = 'Verarbeitungsprofil gespeichert.';
} catch (_) {
+6
View File
@@ -31,6 +31,7 @@ class BauteilController extends GetxController {
final minutenController = TextEditingController(text: '0');
final gewichtController = TextEditingController();
final abfallController = TextEditingController(text: '0');
final gesamtpreisController = TextEditingController();
final _verbrauchControllers = <String, TextEditingController>{};
final filamente = <KaufFilamentModel>[].obs;
final profile = <AnwendungModel>[].obs;
@@ -224,6 +225,7 @@ class BauteilController extends GetxController {
druckdauerMinuten: duration,
gewichtGramm: InputValidators.number(gewichtController.text)!,
abfallGramm: InputValidators.number(abfallController.text)!,
gesamtpreis: InputValidators.number(gesamtpreisController.text),
fotoBase64: foto.value == null ? null : base64Encode(foto.value!),
filamente: selectedFilamente.entries
.map(
@@ -268,6 +270,8 @@ class BauteilController extends GetxController {
minutenController.text = '${entry.druckdauerMinuten % 60}';
gewichtController.text = DisplayFormats.number(entry.gewichtGramm);
abfallController.text = DisplayFormats.number(entry.abfallGramm);
gesamtpreisController.text =
entry.gesamtpreis?.toString().replaceAll('.', ',') ?? '';
foto.value = entry.fotoBytes;
for (final item in entry.filamente) {
verbrauchController(item.filamentId).text = item.verbrauchGramm > 0
@@ -342,6 +346,7 @@ class BauteilController extends GetxController {
minutenController.text = '0';
gewichtController.clear();
abfallController.text = '0';
gesamtpreisController.clear();
selectedFilamente.clear();
for (final controller in _verbrauchControllers.values) {
controller.clear();
@@ -359,6 +364,7 @@ class BauteilController extends GetxController {
minutenController.dispose();
gewichtController.dispose();
abfallController.dispose();
gesamtpreisController.dispose();
for (final controller in _verbrauchControllers.values) {
controller.dispose();
}
+12
View File
@@ -4,6 +4,7 @@ import 'package:uuid/uuid.dart';
import '../models/kauf_filament_model.dart';
import '../models/bauteil_model.dart';
import '../models/anwendung_model.dart';
import '../helper/storage_keys.dart';
import '../helper/filament_bestand.dart';
import '../helper/display_formats.dart';
@@ -18,6 +19,16 @@ class HomeController extends GetxController {
final filamente = <KaufFilamentModel>[].obs;
final verbrauch = <String, double>{}.obs;
final filamentIdsMitProfil = <String>{}.obs;
void loadProfile() {
filamentIdsMitProfil.assignAll(
storage
.getModelList(StorageKeys.anwendungen)
.map(AnwendungModel.fromJson)
.map((profile) => profile.filamentId),
);
}
void loadVerbrauch() {
verbrauch.assignAll(
@@ -133,6 +144,7 @@ class HomeController extends GetxController {
void loadFilamente() {
loadVerbrauch();
loadProfile();
final data = storage.getModelList(storageKey);
filamente.assignAll(data.map(KaufFilamentModel.fromJson));