fear: rev 2

This commit is contained in:
efrilm
2025-09-02 19:49:01 +07:00
parent 3624f75bea
commit 6599e6fe7c
15 changed files with 563 additions and 1023 deletions
+30 -10
View File
@@ -35,18 +35,25 @@ Future<void> onPrint(
// Checker printer
if (checkerPrinter != null) {
try {
final productByPrinter = productQuantity
.where((item) => item.product.printerType == 'checker')
.toList();
final printValue = await PrintDataoutputs.instance.printChecker(
productQuantity,
productByPrinter,
order.tableNumber ?? "",
order.orderNumber ?? "",
authData.user?.name ?? "",
order.metadata?['customer_name'] ?? "",
checkerPrinter.paper.toIntegerFromText,
order.orderType ?? "",
);
await PrinterService()
// ignore: use_build_context_synchronously
.printWithPrinter(checkerPrinter, printValue, context);
if (productByPrinter.isNotEmpty) {
await PrinterService()
// ignore: use_build_context_synchronously
.printWithPrinter(checkerPrinter, printValue, context);
}
} catch (e) {
log("Error printing checker: $e");
ScaffoldMessenger.of(context).showSnackBar(
@@ -58,17 +65,23 @@ Future<void> onPrint(
// Kitchen printer
if (kitchenPrinter != null) {
try {
final productByPrinter = productQuantity
.where((item) => item.product.printerType == 'kitchen')
.toList();
final printValue = await PrintDataoutputs.instance.printKitchen(
productQuantity,
productByPrinter,
order.tableNumber!,
order.orderNumber ?? "",
authData.user?.name ?? "",
order.metadata?['customer_name'] ?? "",
kitchenPrinter.paper.toIntegerFromText,
order.orderType ?? "",
);
await PrinterService()
.printWithPrinter(kitchenPrinter, printValue, context);
if (productByPrinter.isNotEmpty) {
await PrinterService()
.printWithPrinter(kitchenPrinter, printValue, context);
}
} catch (e) {
log("Error printing kitchen order: $e");
ScaffoldMessenger.of(context).showSnackBar(
@@ -80,17 +93,24 @@ Future<void> onPrint(
// Bar printer
if (barPrinter != null) {
try {
final productByPrinter = productQuantity
.where((item) => item.product.printerType == 'bar')
.toList();
final printValue = await PrintDataoutputs.instance.printBar(
productQuantity,
productByPrinter,
order.tableNumber ?? "",
order.orderNumber ?? "",
authData.user?.name ?? "",
order.metadata?['customer_name'] ?? "",
barPrinter.paper.toIntegerFromText,
order.orderType ?? "",
);
await PrinterService()
.printWithPrinter(barPrinter, printValue, context);
if (productByPrinter.isNotEmpty) {
await PrinterService()
.printWithPrinter(barPrinter, printValue, context);
}
} catch (e) {
log("Error printing bar order: $e");
ScaffoldMessenger.of(context).showSnackBar(