2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-13 10:45:29 +00:00

Improve error management for label printing (#588)

- Handle empty label
- Handle empty printer
This commit is contained in:
Oliver
2024-12-23 10:36:36 +11:00
committed by GitHub
parent bc44b99d43
commit d84f76d482
3 changed files with 39 additions and 0 deletions

View File

@ -94,6 +94,28 @@ Future<void> selectAndPrintLabel(
"",
fields,
icon: TablerIcons.printer,
validate: (Map<String, dynamic> data) {
final template = data["label"];
final plugin = data["plugin"];
if (template == null) {
showSnackIcon(
L10().labelSelectTemplate,
success: false,
);
return false;
}
if (plugin == null) {
showSnackIcon(
L10().labelSelectPrinter,
success: false,
);
return false;
}
return true;
},
onSuccess: (Map<String, dynamic> data) async {
int labelId = (data["label"] ?? -1) as int;
var pluginKey = data["plugin"];