From 6599e6fe7c9b2414cfc63782e226bf7d52cf424b Mon Sep 17 00:00:00 2001 From: efrilm Date: Tue, 2 Sep 2025 19:49:01 +0700 Subject: [PATCH] fear: rev 2 --- lib/core/function/app_function.dart | 40 +- lib/data/dataoutputs/print_dataoutputs.dart | 50 ++- .../home/dialog/payment_qris_dialog.dart | 62 ++-- ...t => confirm_payment_page-old.dart.backup} | 2 +- lib/presentation/home/pages/home_page.dart | 20 +- .../home/widgets/save_order_dialog.dart | 211 ----------- .../home/widgets/success_payment_dialog.dart | 349 ------------------ .../setting/widgets/bar_printer_page.dart | 83 +++-- .../setting/widgets/checker_printer_page.dart | 84 +++-- .../setting/widgets/kitchen_printer_page.dart | 84 +++-- .../success/pages/success_order_page.dart | 336 ++++++++--------- .../success/pages/success_payment_page.dart | 257 ++++++------- ..._page.dart => payment_table_page.dart.old} | 0 lib/presentation/table/pages/table_page.dart | 6 + .../table/widgets/card_table_widget.dart | 2 +- 15 files changed, 563 insertions(+), 1023 deletions(-) rename lib/presentation/home/pages/{confirm_payment_page-old.dart => confirm_payment_page-old.dart.backup} (99%) delete mode 100644 lib/presentation/home/widgets/save_order_dialog.dart delete mode 100644 lib/presentation/home/widgets/success_payment_dialog.dart rename lib/presentation/table/pages/{payment_table_page.dart => payment_table_page.dart.old} (100%) diff --git a/lib/core/function/app_function.dart b/lib/core/function/app_function.dart index 217d9ca..0c4d364 100644 --- a/lib/core/function/app_function.dart +++ b/lib/core/function/app_function.dart @@ -35,18 +35,25 @@ Future 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 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 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( diff --git a/lib/data/dataoutputs/print_dataoutputs.dart b/lib/data/dataoutputs/print_dataoutputs.dart index 6090e0e..1620e51 100644 --- a/lib/data/dataoutputs/print_dataoutputs.dart +++ b/lib/data/dataoutputs/print_dataoutputs.dart @@ -1275,6 +1275,7 @@ class PrintDataoutputs { String tableName, String draftName, String cashierName, + String customerName, int paper, String orderType) async { List bytes = []; @@ -1330,9 +1331,6 @@ class PrintDataoutputs { styles: const PosStyles(align: PosAlign.right), ), ]); - // bytes += generator.text( - // 'Receipt: JF-${DateFormat('yyyyMMddhhmm').format(DateTime.now())}', - // styles: const PosStyles(bold: false, align: PosAlign.left)); //cashier name bytes += generator.row([ PosColumn( @@ -1352,7 +1350,7 @@ class PrintDataoutputs { //column 2 bytes += generator.row([ PosColumn( - text: 'Customer - $draftName', + text: '$customerName - $draftName', width: 6, styles: const PosStyles(align: PosAlign.left), ), @@ -1410,6 +1408,7 @@ class PrintDataoutputs { String tableNumber, String draftName, String cashierName, + String customerName, int paper, String orderType) async { List bytes = []; @@ -1462,14 +1461,26 @@ class PrintDataoutputs { styles: const PosStyles(align: PosAlign.left), ), PosColumn( - text: 'JF-${DateFormat('yyyyMMddhhmm').format(DateTime.now())}', + text: DateFormat('yyyyMMddhhmm').format(DateTime.now()), width: 6, styles: const PosStyles(align: PosAlign.right), ), ]); bytes += generator.row([ PosColumn( - text: 'Customer - $draftName', + text: 'Cashier', + width: 6, + styles: const PosStyles(align: PosAlign.left), + ), + PosColumn( + text: cashierName, + width: 6, + styles: const PosStyles(align: PosAlign.right), + ), + ]); + bytes += generator.row([ + PosColumn( + text: '$customerName - $draftName', width: 6, styles: const PosStyles(align: PosAlign.left), ), @@ -1524,8 +1535,15 @@ class PrintDataoutputs { return bytes; } - Future> printBar(List products, String tableNumber, - String draftName, String cashierName, int paper, String orderType) async { + Future> printBar( + List products, + String tableNumber, + String draftName, + String cashierName, + String customerName, + int paper, + String orderType, + ) async { List bytes = []; final profile = await CapabilityProfile.load(); @@ -1576,14 +1594,26 @@ class PrintDataoutputs { styles: const PosStyles(align: PosAlign.left), ), PosColumn( - text: 'JF-${DateFormat('yyyyMMddhhmm').format(DateTime.now())}', + text: DateFormat('yyyyMMddhhmm').format(DateTime.now()), width: 6, styles: const PosStyles(align: PosAlign.right), ), ]); bytes += generator.row([ PosColumn( - text: 'Customer - $draftName', + text: 'Cashier', + width: 6, + styles: const PosStyles(align: PosAlign.left), + ), + PosColumn( + text: cashierName, + width: 6, + styles: const PosStyles(align: PosAlign.right), + ), + ]); + bytes += generator.row([ + PosColumn( + text: '$customerName - $draftName', width: 6, styles: const PosStyles(align: PosAlign.left), ), diff --git a/lib/presentation/home/dialog/payment_qris_dialog.dart b/lib/presentation/home/dialog/payment_qris_dialog.dart index 33688f2..4a6ea01 100644 --- a/lib/presentation/home/dialog/payment_qris_dialog.dart +++ b/lib/presentation/home/dialog/payment_qris_dialog.dart @@ -12,7 +12,7 @@ import 'package:intl/intl.dart'; import 'package:enaklo_pos/core/extensions/build_context_ext.dart'; import 'package:enaklo_pos/presentation/home/bloc/qris/qris_bloc.dart'; -import 'package:enaklo_pos/presentation/home/widgets/success_payment_dialog.dart'; +// import 'package:enaklo_pos/presentation/home/widgets/success_payment_dialog.dart'; import 'package:widgets_to_image/widgets_to_image.dart'; import 'package:enaklo_pos/core/utils/printer_service.dart'; @@ -124,36 +124,36 @@ class _PaymentQrisDialogState extends State { )); }); }, success: (message) async { - context.read().add(OrderEvent.order( - widget.items, - widget.discount, - widget.discountAmount, - widget.tax, - widget.serviceCharge, - widget.paymentAmount, - widget.customerName, - widget.tableNumber, - 'completed', - 'paid', - 'Qris', - widget.price, - OrderType.dineIn)); - await showDialog( - context: context, - barrierDismissible: false, - builder: (context) => SuccessPaymentDialog( - isTablePaymentPage: widget.isTablePaymentPage, - data: widget.items, - totalQty: widget.totalQty, - totalPrice: widget.price, - totalTax: widget.tax, - totalDiscount: widget.discountAmount, - subTotal: widget.subTotal, - normalPrice: widget.price, - totalService: widget.serviceCharge, - draftName: widget.customerName, - ), - ); + // context.read().add(OrderEvent.order( + // widget.items, + // widget.discount, + // widget.discountAmount, + // widget.tax, + // widget.serviceCharge, + // widget.paymentAmount, + // widget.customerName, + // widget.tableNumber, + // 'completed', + // 'paid', + // 'Qris', + // widget.price, + // OrderType.dineIn)); + // await showDialog( + // context: context, + // barrierDismissible: false, + // builder: (context) => SuccessPaymentDialog( + // isTablePaymentPage: widget.isTablePaymentPage, + // data: widget.items, + // totalQty: widget.totalQty, + // totalPrice: widget.price, + // totalTax: widget.tax, + // totalDiscount: widget.discountAmount, + // subTotal: widget.subTotal, + // normalPrice: widget.price, + // totalService: widget.serviceCharge, + // draftName: widget.customerName, + // ), + // ); }); }, child: BlocBuilder( diff --git a/lib/presentation/home/pages/confirm_payment_page-old.dart b/lib/presentation/home/pages/confirm_payment_page-old.dart.backup similarity index 99% rename from lib/presentation/home/pages/confirm_payment_page-old.dart rename to lib/presentation/home/pages/confirm_payment_page-old.dart.backup index 89f2a0d..924b855 100644 --- a/lib/presentation/home/pages/confirm_payment_page-old.dart +++ b/lib/presentation/home/pages/confirm_payment_page-old.dart.backup @@ -13,7 +13,7 @@ import 'package:enaklo_pos/presentation/home/bloc/order/order_bloc.dart'; import 'package:enaklo_pos/presentation/home/bloc/payment_methods/payment_methods_bloc.dart'; import 'package:enaklo_pos/presentation/home/models/product_quantity.dart'; import 'package:enaklo_pos/presentation/home/models/order_type.dart'; -import 'package:enaklo_pos/presentation/home/widgets/save_order_dialog.dart'; +// import 'package:enaklo_pos/presentation/home/widgets/save_order_dialog.dart'; import 'package:enaklo_pos/data/models/response/payment_methods_response_model.dart'; import 'package:enaklo_pos/data/datasources/product_local_datasource.dart'; diff --git a/lib/presentation/home/pages/home_page.dart b/lib/presentation/home/pages/home_page.dart index 5e1d9f4..569cc81 100644 --- a/lib/presentation/home/pages/home_page.dart +++ b/lib/presentation/home/pages/home_page.dart @@ -214,8 +214,24 @@ class _HomePageState extends State { final filteredProducts = _filterProducts(products); if (filteredProducts.isEmpty) { - return const Center( - child: Text('No Items Found'), + return Center( + child: Column( + children: [ + Text('No Items Found'), + SpaceHeight(20), + Button.filled( + width: 120, + onPressed: () { + context + .read< + ProductLoaderBloc>() + .add(const ProductLoaderEvent + .getProduct()); + }, + label: 'Retry', + ), + ], + ), ); } return GridView.builder( diff --git a/lib/presentation/home/widgets/save_order_dialog.dart b/lib/presentation/home/widgets/save_order_dialog.dart deleted file mode 100644 index d73ec72..0000000 --- a/lib/presentation/home/widgets/save_order_dialog.dart +++ /dev/null @@ -1,211 +0,0 @@ -import 'dart:developer'; - -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:enaklo_pos/core/extensions/string_ext.dart'; -import 'package:enaklo_pos/data/datasources/product_local_datasource.dart'; -import 'package:enaklo_pos/core/extensions/build_context_ext.dart'; -import 'package:enaklo_pos/data/dataoutputs/print_dataoutputs.dart'; -import 'package:enaklo_pos/data/models/response/table_model.dart'; -import 'package:enaklo_pos/presentation/home/models/product_quantity.dart'; - -import '../../../core/assets/assets.gen.dart'; -import '../../../core/components/buttons.dart'; -import '../../../core/components/spaces.dart'; -import '../../table/blocs/get_table/get_table_bloc.dart'; -import '../bloc/checkout/checkout_bloc.dart'; -import '../models/order_type.dart'; -import 'package:enaklo_pos/core/utils/printer_service.dart'; - -class SaveOrderDialog extends StatefulWidget { - const SaveOrderDialog({ - super.key, - required this.data, - required this.totalQty, - required this.totalPrice, - required this.totalTax, - required this.totalDiscount, - required this.subTotal, - required this.normalPrice, - required this.table, - required this.draftName, - }); - final List data; - final int totalQty; - final int totalPrice; - final int totalTax; - final int totalDiscount; - final int subTotal; - final int normalPrice; - final TableModel table; - final String draftName; - - @override - State createState() => _SaveOrderDialogState(); -} - -class _SaveOrderDialogState extends State { - // List data = []; - // int totalQty = 0; - // int totalPrice = 0; - @override - Widget build(BuildContext context) { - return AlertDialog( - content: SingleChildScrollView( - padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 20), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Center(child: Assets.icons.success.svg()), - const SpaceHeight(16.0), - const Center( - child: Text( - 'Order Berhasil Disimpan', - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 20, - ), - ), - ), - const SpaceHeight(20.0), - Row( - children: [ - Flexible( - child: Button.outlined( - onPressed: () { - context - .read() - .add(const CheckoutEvent.started([])); - context - .read() - .add(const GetTableEvent.getTables()); - context.popToRoot(); - }, - label: 'Kembali', - ), - ), - const SpaceWidth(8.0), - Flexible( - child: BlocBuilder( - builder: (context, state) { - final orderType = state.maybeWhen( - orElse: () => OrderType.dineIn, - loaded: ( - items, - discountModel, - discount, - discountAmount, - tax, - serviceCharge, - totalQuantity, - totalPrice, - draftName, - orderType, - deliveryType, - ) => - orderType, - ); - - return Button.filled( - onPressed: () async { - final checkerPrinter = await ProductLocalDatasource - .instance - .getPrinterByCode('checker'); - final kitchenPrinter = await ProductLocalDatasource - .instance - .getPrinterByCode('kitchen'); - final barPrinter = await ProductLocalDatasource - .instance - .getPrinterByCode('bar'); - - log("Checker printer: ${checkerPrinter?.toMap()}"); - log("Kitchen printer: ${kitchenPrinter?.toMap()}"); - log("Bar printer: ${barPrinter?.toMap()}"); - - // Checker printer - if (checkerPrinter != null) { - try { - final printValue = await PrintDataoutputs.instance - .printChecker( - widget.data, - widget.table.tableName!, - widget.draftName, - 'kasir', - checkerPrinter.paper.toIntegerFromText, - orderType.value); - - await PrinterService().printWithPrinter( - checkerPrinter, printValue, context); - } catch (e) { - log("Error printing checker: $e"); - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: - Text('Error printing checker: $e')), - ); - } - } - - // Kitchen printer - if (kitchenPrinter != null) { - try { - final printValue = - await PrintDataoutputs.instance.printKitchen( - widget.data, - widget.table.tableName!, - widget.draftName, - 'kasir', - kitchenPrinter.paper.toIntegerFromText, - orderType.value, - ); - - await PrinterService().printWithPrinter( - kitchenPrinter, printValue, context); - } catch (e) { - log("Error printing kitchen order: $e"); - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text( - 'Error printing kitchen order: $e')), - ); - } - } - - // Bar printer - if (barPrinter != null) { - try { - final printValue = - await PrintDataoutputs.instance.printBar( - widget.data, - widget.table.tableName!, - widget.draftName, - 'kasir', - barPrinter.paper.toIntegerFromText, - orderType.value, - ); - - await PrinterService().printWithPrinter( - barPrinter, printValue, context); - } catch (e) { - log("Error printing bar order: $e"); - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: - Text('Error printing bar order: $e')), - ); - } - } - }, - label: 'Print Checker', - ); - }, - ), - ), - ], - ), - ], - ), - ), - ); - } -} diff --git a/lib/presentation/home/widgets/success_payment_dialog.dart b/lib/presentation/home/widgets/success_payment_dialog.dart deleted file mode 100644 index e1edda3..0000000 --- a/lib/presentation/home/widgets/success_payment_dialog.dart +++ /dev/null @@ -1,349 +0,0 @@ -// ignore_for_file: public_member_api_docs, sort_constructors_first -import 'dart:developer'; - -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:intl/intl.dart'; - -import 'package:enaklo_pos/core/extensions/build_context_ext.dart'; -import 'package:enaklo_pos/core/extensions/int_ext.dart'; -import 'package:enaklo_pos/core/extensions/string_ext.dart'; -import 'package:enaklo_pos/data/dataoutputs/print_dataoutputs.dart'; -import 'package:enaklo_pos/data/datasources/product_local_datasource.dart'; -import 'package:enaklo_pos/presentation/home/models/product_quantity.dart'; -import 'package:enaklo_pos/presentation/home/models/order_type.dart'; -import 'package:enaklo_pos/core/utils/printer_service.dart'; -import 'package:enaklo_pos/data/datasources/settings_local_datasource.dart'; - -import '../../../core/assets/assets.gen.dart'; -import '../../../core/components/buttons.dart'; -import '../../../core/components/spaces.dart'; -import '../../table/blocs/get_table/get_table_bloc.dart'; -import '../bloc/checkout/checkout_bloc.dart'; -import '../bloc/order/order_bloc.dart'; - -class SuccessPaymentDialog extends StatefulWidget { - const SuccessPaymentDialog({ - Key? key, - required this.data, - required this.totalQty, - required this.totalPrice, - required this.totalTax, - required this.totalDiscount, - required this.subTotal, - required this.normalPrice, - required this.totalService, - required this.draftName, - this.isTablePaymentPage = false, - }) : super(key: key); - final List data; - final int totalQty; - final int totalPrice; - final int totalTax; - final int totalDiscount; - final int subTotal; - final int normalPrice; - final int totalService; - final String draftName; - final bool? isTablePaymentPage; - @override - State createState() => _SuccessPaymentDialogState(); -} - -class _SuccessPaymentDialogState extends State { - // List data = []; - // int totalQty = 0; - // int totalPrice = 0; - @override - Widget build(BuildContext context) { - return AlertDialog( - content: SingleChildScrollView( - padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 20), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Center(child: Assets.icons.success.svg()), - const SpaceHeight(16.0), - const Center( - child: Text( - 'Pembayaran telah sukses dilakukan', - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 20, - ), - ), - ), - const SpaceHeight(20.0), - const Text('METODE BAYAR'), - const SpaceHeight(5.0), - BlocBuilder( - builder: (context, state) { - final paymentMethod = state.maybeWhen( - orElse: () => 'Cash', - loaded: (model, orderId) => model.paymentMethod, - ); - return Text( - paymentMethod, - style: const TextStyle( - fontWeight: FontWeight.w700, - ), - ); - }, - ), - const SpaceHeight(10.0), - const Divider(), - const SpaceHeight(8.0), - const Text('TOTAL TAGIHAN'), - const SpaceHeight(5.0), - BlocBuilder( - builder: (context, state) { - state.maybeWhen( - orElse: () => 0, - loaded: (model, orderId) => model.total, - ); - return Text( - widget.totalPrice.currencyFormatRp, - style: const TextStyle( - fontWeight: FontWeight.w700, - ), - ); - }, - ), - const SpaceHeight(10.0), - const Divider(), - const SpaceHeight(8.0), - const Text('NOMINAL BAYAR'), - const SpaceHeight(5.0), - BlocBuilder( - builder: (context, state) { - final paymentAmount = state.maybeWhen( - orElse: () => 0, - loaded: (model, orderId) => model.paymentAmount, - ); - return Text( - paymentAmount.ceil().currencyFormatRp, - style: const TextStyle( - fontWeight: FontWeight.w700, - ), - ); - }, - ), - const Divider(), - const SpaceHeight(8.0), - const Text('KEMBALIAN'), - const SpaceHeight(5.0), - BlocBuilder( - builder: (context, state) { - final paymentAmount = state.maybeWhen( - orElse: () => 0, - loaded: (model, orderId) => model.paymentAmount, - ); - final total = state.maybeWhen( - orElse: () => 0, - loaded: (model, orderId) => model.total, - ); - final diff = paymentAmount - total; - log("DIFF: $diff paymentAmount: $paymentAmount total: $total"); - return Text( - diff.ceil().currencyFormatRp, - style: const TextStyle( - fontWeight: FontWeight.w700, - ), - ); - }, - ), - const SpaceHeight(10.0), - const Divider(), - const SpaceHeight(8.0), - const Text('WAKTU PEMBAYARAN'), - const SpaceHeight(5.0), - Text( - DateFormat('dd MMMM yyyy, HH:mm').format(DateTime.now()), - style: const TextStyle( - fontWeight: FontWeight.w700, - ), - ), - const SpaceHeight(20.0), - Row( - children: [ - Flexible( - child: Button.outlined( - onPressed: () { - // For table payment page, just close the dialog - // The cleanup and navigation is handled by the payment page - if (widget.isTablePaymentPage == true) { - Navigator.of(context).pop(); // Close dialog only - } else { - // For regular payment flow, reset and go to root - context - .read() - .add(const CheckoutEvent.started([])); - context - .read() - .add(const GetTableEvent.getTables()); - context.popToRoot(); - } - }, - label: 'Kembali', - ), - ), - const SpaceWidth(8.0), - Flexible( - child: BlocBuilder( - builder: (context, state) { - final paymentAmount = state.maybeWhen( - orElse: () => 0, - loaded: (model, orderId) => model.paymentAmount, - ); - - final kembalian = paymentAmount - widget.totalPrice; - return BlocBuilder( - builder: (context, checkoutState) { - final orderType = checkoutState.maybeWhen( - orElse: () => OrderType.dineIn, - loaded: ( - items, - discountModel, - discount, - discountAmount, - tax, - serviceCharge, - totalQuantity, - totalPrice, - draftName, - orderType, - deliveryType, - ) => - orderType, - ); - - return Button.filled( - onPressed: () async { - final receiptPrinter = - await ProductLocalDatasource.instance - .getPrinterByCode('receipt'); - final kitchenPrinter = - await ProductLocalDatasource.instance - .getPrinterByCode('kitchen'); - final barPrinter = await ProductLocalDatasource - .instance - .getPrinterByCode('bar'); - - // Receipt Printer - if (receiptPrinter != null) { - try { - final settingsLocalDatasource = - SettingsLocalDatasource(); - final taxModel = - await settingsLocalDatasource.getTax(); - final serviceChargeValue = - await settingsLocalDatasource - .getServiceCharge(); - - // Get the actual payment method from OrderBloc - final paymentMethod = state.maybeWhen( - orElse: () => 'Cash', - loaded: (model, orderId) => - model.paymentMethod, - ); - - final printValue = await PrintDataoutputs - .instance - .printOrderV3( - widget.data, - widget.totalQty, - widget.totalPrice, - paymentMethod, - paymentAmount, - kembalian, - widget.subTotal, - widget.totalDiscount, - widget.totalTax, - widget.totalService, - 'kasir', - widget.draftName, - receiptPrinter.paper.toIntegerFromText, - taxPercentage: taxModel.value, - serviceChargePercentage: serviceChargeValue, - ); - - await PrinterService().printWithPrinter( - receiptPrinter, printValue, context); - } catch (e) { - log("Error printing receipt: $e"); - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: - Text('Error printing receipt: $e')), - ); - } - } - - // Kitchen Printer - if (kitchenPrinter != null && - widget.isTablePaymentPage == false) { - try { - final printValue = await PrintDataoutputs - .instance - .printKitchen( - widget.data, - '', - widget.draftName, - 'kasir', - kitchenPrinter.paper.toIntegerFromText, - orderType.value, - ); - - await PrinterService().printWithPrinter( - kitchenPrinter, printValue, context); - } catch (e) { - log("Error printing kitchen order: $e"); - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text( - 'Error printing kitchen order: $e')), - ); - } - } - - // Bar printer - if (barPrinter != null && - widget.isTablePaymentPage == false) { - try { - final printValue = - await PrintDataoutputs.instance.printBar( - widget.data, - '', - widget.draftName, - 'kasir', - barPrinter.paper.toIntegerFromText, - orderType.value, - ); - - await PrinterService().printWithPrinter( - barPrinter, printValue, context); - } catch (e) { - log("Error printing bar order: $e"); - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text( - 'Error printing bar order: $e')), - ); - } - } - }, - label: 'Print', - ); - }, - ); - }, - ), - ), - ], - ), - ], - ), - ), - ); - } -} diff --git a/lib/presentation/setting/widgets/bar_printer_page.dart b/lib/presentation/setting/widgets/bar_printer_page.dart index a37a195..d206128 100644 --- a/lib/presentation/setting/widgets/bar_printer_page.dart +++ b/lib/presentation/setting/widgets/bar_printer_page.dart @@ -160,48 +160,53 @@ class _BarPrinterPageState extends State { SpaceHeight(16), // button test print Button.outlined( - onPressed: () async { - if (addressController!.text.isNotEmpty && printNameController!.text.isNotEmpty) { - try { - // Create a test print model - final testPrinter = PrintModel( - code: 'bar', - name: printNameController!.text, - address: addressController!.text, - paper: paper, - type: selectedPrinter, - ); - - // Generate test print data - final testPrintData = await PrintDataoutputs.instance.printBar( - [], // Empty product list for test - 'Test Table', - 'Test Order', - 'Test Cashier', - int.parse(paper), - 'DINE IN', - ); - - // Print test - await PrinterService().printWithPrinter( - testPrinter, - testPrintData, - context, - ); - } catch (e) { - log("Error test printing: $e"); + onPressed: () async { + if (addressController!.text.isNotEmpty && + printNameController!.text.isNotEmpty) { + try { + // Create a test print model + final testPrinter = PrintModel( + code: 'bar', + name: printNameController!.text, + address: addressController!.text, + paper: paper, + type: selectedPrinter, + ); + + // Generate test print data + final testPrintData = + await PrintDataoutputs.instance.printBar( + [], // Empty product list for test + 'Test Table', + 'Test Order', + 'Test Cashier', + 'Test Customer', + int.parse(paper), + 'DINE IN', + ); + + // Print test + await PrinterService().printWithPrinter( + testPrinter, + testPrintData, + context, + ); + } catch (e) { + log("Error test printing: $e"); + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text('Error test printing: $e')), + ); + } + } else { ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text('Error test printing: $e')), + SnackBar( + content: Text( + 'Please fill in printer details first')), ); } - } else { - ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text('Please fill in printer details first')), - ); - } - }, - label: 'Test Print' - ), + }, + label: 'Test Print'), SpaceHeight(8), // button save data == null diff --git a/lib/presentation/setting/widgets/checker_printer_page.dart b/lib/presentation/setting/widgets/checker_printer_page.dart index 924dd95..1405eb4 100644 --- a/lib/presentation/setting/widgets/checker_printer_page.dart +++ b/lib/presentation/setting/widgets/checker_printer_page.dart @@ -162,48 +162,54 @@ class _CheckerPrinterPageState extends State { SpaceHeight(16), // button test print Button.outlined( - onPressed: () async { - if (addressController!.text.isNotEmpty && printNameController!.text.isNotEmpty) { - try { - // Create a test print model - final testPrinter = PrintModel( - code: 'checker', - name: printNameController!.text, - address: addressController!.text, - paper: paper, - type: selectedPrinter, - ); - - // Generate test print data - final testPrintData = await PrintDataoutputs.instance.printChecker( - [], // Empty product list for test - 'Test Table', - 'Test Order', - 'Test Cashier', - int.parse(paper), - 'DINE IN', - ); - - // Print test - await PrinterService().printWithPrinter( - testPrinter, - testPrintData, - context, - ); - } catch (e) { - log("Error test printing: $e"); + onPressed: () async { + if (addressController!.text.isNotEmpty && + printNameController!.text.isNotEmpty) { + try { + // Create a test print model + final testPrinter = PrintModel( + code: 'checker', + name: printNameController!.text, + address: addressController!.text, + paper: paper, + type: selectedPrinter, + ); + + // Generate test print data + final testPrintData = await PrintDataoutputs + .instance + .printChecker( + [], // Empty product list for test + 'Test Table', + 'Test Order', + 'Test Cashier', + 'Test Customer', + int.parse(paper), + 'DINE IN', + ); + + // Print test + await PrinterService().printWithPrinter( + testPrinter, + testPrintData, + context, + ); + } catch (e) { + log("Error test printing: $e"); + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text('Error test printing: $e')), + ); + } + } else { ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text('Error test printing: $e')), + SnackBar( + content: Text( + 'Please fill in printer details first')), ); } - } else { - ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text('Please fill in printer details first')), - ); - } - }, - label: 'Test Print' - ), + }, + label: 'Test Print'), SpaceHeight(8), // button save data == null diff --git a/lib/presentation/setting/widgets/kitchen_printer_page.dart b/lib/presentation/setting/widgets/kitchen_printer_page.dart index 0afd491..7ed4ad2 100644 --- a/lib/presentation/setting/widgets/kitchen_printer_page.dart +++ b/lib/presentation/setting/widgets/kitchen_printer_page.dart @@ -160,48 +160,54 @@ class _KitchenPrinterPageState extends State { SpaceHeight(16), // button test print Button.outlined( - onPressed: () async { - if (addressController!.text.isNotEmpty && printNameController!.text.isNotEmpty) { - try { - // Create a test print model - final testPrinter = PrintModel( - code: 'kitchen', - name: printNameController!.text, - address: addressController!.text, - paper: paper, - type: selectedPrinter, - ); - - // Generate test print data - final testPrintData = await PrintDataoutputs.instance.printKitchen( - [], // Empty product list for test - 'Test Table', - 'Test Order', - 'Test Cashier', - int.parse(paper), - 'DINE IN', - ); - - // Print test - await PrinterService().printWithPrinter( - testPrinter, - testPrintData, - context, - ); - } catch (e) { - log("Error test printing: $e"); + onPressed: () async { + if (addressController!.text.isNotEmpty && + printNameController!.text.isNotEmpty) { + try { + // Create a test print model + final testPrinter = PrintModel( + code: 'kitchen', + name: printNameController!.text, + address: addressController!.text, + paper: paper, + type: selectedPrinter, + ); + + // Generate test print data + final testPrintData = await PrintDataoutputs + .instance + .printKitchen( + [], // Empty product list for test + 'Test Table', + 'Test Order', + 'Test Cashier', + 'Test Customer', + int.parse(paper), + 'DINE IN', + ); + + // Print test + await PrinterService().printWithPrinter( + testPrinter, + testPrintData, + context, + ); + } catch (e) { + log("Error test printing: $e"); + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text('Error test printing: $e')), + ); + } + } else { ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text('Error test printing: $e')), + SnackBar( + content: Text( + 'Please fill in printer details first')), ); } - } else { - ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text('Please fill in printer details first')), - ); - } - }, - label: 'Test Print' - ), + }, + label: 'Test Print'), SpaceHeight(8), // button save data == null diff --git a/lib/presentation/success/pages/success_order_page.dart b/lib/presentation/success/pages/success_order_page.dart index 9c9c4d6..2c4cb55 100644 --- a/lib/presentation/success/pages/success_order_page.dart +++ b/lib/presentation/success/pages/success_order_page.dart @@ -204,180 +204,186 @@ class _SuccessOrderPageState extends State child: Column( children: [ // Success Header with Glassmorphism Effect - Container( - width: double.infinity, - padding: const EdgeInsets.all(32.0), - decoration: BoxDecoration( - gradient: LinearGradient( - begin: Alignment.topLeft, - end: Alignment.bottomRight, - colors: [ - AppColors.primary.withOpacity(0.1), - AppColors.primary.withOpacity(0.05), - ], - ), - borderRadius: const BorderRadius.vertical( - top: Radius.circular(24), - ), - ), - child: Column( - children: [ - // Animated Success Icon with Floating Effect - AnimatedBuilder( - animation: _floatingAnimation, - builder: (context, child) { - return Transform.translate( - offset: Offset(0, _floatingAnimation.value), - child: ScaleTransition( - scale: _successIconAnimation, - child: Container( - padding: const EdgeInsets.all(20.0), - decoration: BoxDecoration( - gradient: LinearGradient( - begin: Alignment.topLeft, - end: Alignment.bottomRight, - colors: [ - AppColors.primary, - AppColors.primary.withOpacity(0.8), - ], - ), - shape: BoxShape.circle, - boxShadow: [ - BoxShadow( - color: AppColors.primary.withOpacity(0.3), - blurRadius: 20, - offset: const Offset(0, 10), - ), - ], - ), - child: const Icon( - Icons.check_rounded, - size: 48, - color: Colors.white, - ), - ), - ), - ); - }, - ), - - const SizedBox(height: 24), - - // Success Title with Shimmer Effect - FadeTransition( - opacity: _fadeInAnimation, - child: ShaderMask( - shaderCallback: (bounds) { - return LinearGradient( - begin: Alignment.centerLeft, - end: Alignment.centerRight, - colors: const [ - AppColors.primary, - Colors.amber, - AppColors.primary, - ], - stops: [ - _shimmerAnimation.value - 1, - _shimmerAnimation.value, - _shimmerAnimation.value + 1, - ], - ).createShader(bounds); - }, - child: const Text( - 'Pesanan Berhasil!', - style: TextStyle( - fontSize: 26, - fontWeight: FontWeight.bold, - color: Colors.white, - ), - ), - ), - ), - - const SizedBox(height: 12), - - FadeTransition( - opacity: _fadeInAnimation, - child: Container( - padding: const EdgeInsets.symmetric( - horizontal: 16, - vertical: 8, - ), - decoration: BoxDecoration( - color: Colors.white.withOpacity(0.2), - borderRadius: BorderRadius.circular(20), - ), - child: const Text( - 'Pesanan telah diterima dan sedang diproses', - style: TextStyle( - fontSize: 14, - color: AppColors.primary, - fontWeight: FontWeight.w500, - ), - textAlign: TextAlign.center, - ), - ), - ), - ], - ), - ), - - // Order Information Section Expanded( - child: Padding( - padding: const EdgeInsets.all(24.0), + child: SingleChildScrollView( child: Column( - crossAxisAlignment: CrossAxisAlignment.start, children: [ - _buildSectionTitle('Informasi Pesanan'), - const SizedBox(height: 24), - - // Customer Card with Gradient Background - _buildInfoCard( - icon: Icons.person_outline_rounded, - title: 'Nama Pelanggan', - value: widget.order.metadata?['customer_name'] ?? "-", - gradient: [ - Colors.blue.withOpacity(0.1), - Colors.purple.withOpacity(0.1), - ], - ), - - const SizedBox(height: 16), - - // Order Details Grid - Expanded( + Container( + width: double.infinity, + padding: const EdgeInsets.all(32.0), + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + colors: [ + AppColors.primary.withOpacity(0.1), + AppColors.primary.withOpacity(0.05), + ], + ), + borderRadius: const BorderRadius.vertical( + top: Radius.circular(24), + ), + ), child: Column( children: [ - _buildInfoRow( - icon: Icons.receipt_long_outlined, - label: 'No. Pesanan', - value: widget.order.orderNumber ?? "-", - delay: 0.3, + // Animated Success Icon with Floating Effect + AnimatedBuilder( + animation: _floatingAnimation, + builder: (context, child) { + return Transform.translate( + offset: Offset(0, _floatingAnimation.value), + child: ScaleTransition( + scale: _successIconAnimation, + child: Container( + padding: const EdgeInsets.all(20.0), + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + colors: [ + AppColors.primary, + AppColors.primary.withOpacity(0.8), + ], + ), + shape: BoxShape.circle, + boxShadow: [ + BoxShadow( + color: AppColors.primary + .withOpacity(0.3), + blurRadius: 20, + offset: const Offset(0, 10), + ), + ], + ), + child: const Icon( + Icons.check_rounded, + size: 48, + color: Colors.white, + ), + ), + ), + ); + }, ), - const SizedBox(height: 12), - _buildInfoRow( - icon: Icons.table_restaurant_outlined, - label: 'No. Meja', - value: widget.order.tableNumber ?? "-", - delay: 0.4, + + const SizedBox(height: 24), + + // Success Title with Shimmer Effect + FadeTransition( + opacity: _fadeInAnimation, + child: ShaderMask( + shaderCallback: (bounds) { + return LinearGradient( + begin: Alignment.centerLeft, + end: Alignment.centerRight, + colors: const [ + AppColors.primary, + Colors.amber, + AppColors.primary, + ], + stops: [ + _shimmerAnimation.value - 1, + _shimmerAnimation.value, + _shimmerAnimation.value + 1, + ], + ).createShader(bounds); + }, + child: const Text( + 'Pesanan Berhasil!', + style: TextStyle( + fontSize: 26, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + ), ), + const SizedBox(height: 12), - _buildInfoRow( - icon: Icons.access_time_rounded, - label: 'Waktu', - value: (widget.order.createdAt ?? DateTime.now()) - .toFormattedDate3(), - delay: 0.5, + + FadeTransition( + opacity: _fadeInAnimation, + child: Container( + padding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 8, + ), + decoration: BoxDecoration( + color: Colors.white.withOpacity(0.2), + borderRadius: BorderRadius.circular(20), + ), + child: const Text( + 'Pesanan telah diterima dan sedang diproses', + style: TextStyle( + fontSize: 14, + color: AppColors.primary, + fontWeight: FontWeight.w500, + ), + textAlign: TextAlign.center, + ), + ), ), - const SizedBox(height: 12), - _buildInfoRow( - icon: Icons.check_circle_outline, - label: 'Status Pembayaran', - value: 'Lunas', - delay: 0.6, - valueColor: Colors.green, - showBadge: true, + ], + ), + ), + // Order Information Section + Padding( + padding: const EdgeInsets.all(24.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _buildSectionTitle('Informasi Pesanan'), + const SizedBox(height: 24), + + // Customer Card with Gradient Background + _buildInfoCard( + icon: Icons.person_outline_rounded, + title: 'Nama Pelanggan', + value: + widget.order.metadata?['customer_name'] ?? "-", + gradient: [ + Colors.blue.withOpacity(0.1), + Colors.purple.withOpacity(0.1), + ], + ), + + const SizedBox(height: 16), + + // Order Details Grid + Column( + children: [ + _buildInfoRow( + icon: Icons.receipt_long_outlined, + label: 'No. Pesanan', + value: widget.order.orderNumber ?? "-", + delay: 0.3, + ), + const SizedBox(height: 12), + _buildInfoRow( + icon: Icons.wallet_outlined, + label: 'Metode Pembayaran', + value: widget.paymentMethod ?? "-", + delay: 0.3, + ), + if (widget.order.tableNumber != "") ...[ + const SizedBox(height: 12), + _buildInfoRow( + icon: Icons.table_restaurant_outlined, + label: 'No. Meja', + value: widget.order.tableNumber ?? "-", + delay: 0.4, + ), + ], + const SizedBox(height: 12), + _buildInfoRow( + icon: Icons.access_time_rounded, + label: 'Waktu', + value: + (widget.order.createdAt ?? DateTime.now()) + .toFormattedDate3(), + delay: 0.5, + ), + ], ), ], ), diff --git a/lib/presentation/success/pages/success_payment_page.dart b/lib/presentation/success/pages/success_payment_page.dart index cfcef39..d183539 100644 --- a/lib/presentation/success/pages/success_payment_page.dart +++ b/lib/presentation/success/pages/success_payment_page.dart @@ -108,141 +108,146 @@ class _SuccessPaymentPageState extends State { child: Column( children: [ // Success Header - Container( - width: double.infinity, - padding: const EdgeInsets.all(32.0), - decoration: BoxDecoration( - gradient: LinearGradient( - begin: Alignment.topLeft, - end: Alignment.bottomRight, - colors: [ - AppColors.primary.withOpacity(0.1), - AppColors.primary.withOpacity(0.05), - ], - ), - borderRadius: const BorderRadius.vertical( - top: Radius.circular(24), - ), - ), - child: Column( - children: [ - // Success Icon - Container( - padding: const EdgeInsets.all(20.0), - decoration: BoxDecoration( - gradient: LinearGradient( - begin: Alignment.topLeft, - end: Alignment.bottomRight, - colors: [ - AppColors.primary, - AppColors.primary.withOpacity(0.8), - ], - ), - shape: BoxShape.circle, - boxShadow: [ - BoxShadow( - color: AppColors.primary.withOpacity(0.3), - blurRadius: 20, - offset: const Offset(0, 10), - ), - ], - ), - child: const Icon( - Icons.check_rounded, - size: 48, - color: Colors.white, - ), - ), - - const SizedBox(height: 24), - - // Success Title - const Text( - 'Pesanan Berhasil!', - style: TextStyle( - fontSize: 26, - fontWeight: FontWeight.bold, - color: AppColors.primary, - ), - ), - - const SizedBox(height: 12), - - Container( - padding: const EdgeInsets.symmetric( - horizontal: 16, - vertical: 8, - ), - decoration: BoxDecoration( - color: Colors.white.withOpacity(0.2), - borderRadius: BorderRadius.circular(20), - ), - child: const Text( - 'Pesanan telah diterima dan sedang diproses', - style: TextStyle( - fontSize: 14, - color: AppColors.primary, - fontWeight: FontWeight.w500, - ), - textAlign: TextAlign.center, - ), - ), - ], - ), - ), - - // Order Information Section Expanded( - child: Padding( - padding: const EdgeInsets.all(24.0), + child: SingleChildScrollView( child: Column( - crossAxisAlignment: CrossAxisAlignment.start, children: [ - _buildSectionTitle('Informasi Pesanan'), - const SizedBox(height: 24), - - // Customer Card - _buildInfoCard( - icon: Icons.person_outline_rounded, - title: 'Nama Pelanggan', - value: order.metadata?['customer_name'] ?? "-", - gradient: [ - Colors.blue.withOpacity(0.1), - Colors.purple.withOpacity(0.1), - ], - ), - - const SizedBox(height: 16), - - // Order Details - Expanded( + Container( + width: double.infinity, + padding: const EdgeInsets.all(32.0), + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + colors: [ + AppColors.primary.withOpacity(0.1), + AppColors.primary.withOpacity(0.05), + ], + ), + borderRadius: const BorderRadius.vertical( + top: Radius.circular(24), + ), + ), child: Column( children: [ - _buildInfoRow( - icon: Icons.receipt_long_outlined, - label: 'No. Pesanan', - value: order.orderNumber ?? "-", + // Success Icon + Container( + padding: const EdgeInsets.all(20.0), + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + colors: [ + AppColors.primary, + AppColors.primary.withOpacity(0.8), + ], + ), + shape: BoxShape.circle, + boxShadow: [ + BoxShadow( + color: AppColors.primary.withOpacity(0.3), + blurRadius: 20, + offset: const Offset(0, 10), + ), + ], + ), + child: const Icon( + Icons.check_rounded, + size: 48, + color: Colors.white, + ), ), - const SizedBox(height: 12), - _buildInfoRow( - icon: Icons.table_restaurant_outlined, - label: 'No. Meja', - value: order.tableNumber ?? "-", + + const SizedBox(height: 24), + + // Success Title + const Text( + 'Pesanan Berhasil!', + style: TextStyle( + fontSize: 26, + fontWeight: FontWeight.bold, + color: AppColors.primary, + ), ), + const SizedBox(height: 12), - _buildInfoRow( - icon: Icons.access_time_rounded, - label: 'Waktu', - value: (order.createdAt ?? DateTime.now()) - .toFormattedDate3(), + + Container( + padding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 8, + ), + decoration: BoxDecoration( + color: Colors.white.withOpacity(0.2), + borderRadius: BorderRadius.circular(20), + ), + child: const Text( + 'Pesanan telah diterima dan sedang diproses', + style: TextStyle( + fontSize: 14, + color: AppColors.primary, + fontWeight: FontWeight.w500, + ), + textAlign: TextAlign.center, + ), ), - const SizedBox(height: 12), - _buildInfoRow( - icon: Icons.check_circle_outline, - label: 'Status Pembayaran', - value: 'Lunas', - valueColor: Colors.green, - showBadge: true, + ], + ), + ), + // Order Information Section + Padding( + padding: const EdgeInsets.all(24.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _buildSectionTitle('Informasi Pesanan'), + const SizedBox(height: 24), + + // Customer Card + _buildInfoCard( + icon: Icons.person_outline_rounded, + title: 'Nama Pelanggan', + value: order.metadata?['customer_name'] ?? "-", + gradient: [ + Colors.blue.withOpacity(0.1), + Colors.purple.withOpacity(0.1), + ], + ), + + const SizedBox(height: 16), + + // Order Details + Expanded( + child: Column( + children: [ + _buildInfoRow( + icon: Icons.receipt_long_outlined, + label: 'No. Pesanan', + value: order.orderNumber ?? "-", + ), + const SizedBox(height: 12), + _buildInfoRow( + icon: Icons.receipt_long_outlined, + label: 'Metode Pembayaran', + value: widget.paymentMethod, + ), + const SizedBox(height: 12), + _buildInfoRow( + icon: Icons.access_time_rounded, + label: 'Waktu', + value: (order.createdAt ?? DateTime.now()) + .toFormattedDate3(), + ), + const SizedBox(height: 12), + _buildInfoRow( + icon: Icons.check_circle_outline, + label: 'Status Pembayaran', + value: 'Lunas', + valueColor: Colors.green, + showBadge: true, + ), + ], + ), ), ], ), diff --git a/lib/presentation/table/pages/payment_table_page.dart b/lib/presentation/table/pages/payment_table_page.dart.old similarity index 100% rename from lib/presentation/table/pages/payment_table_page.dart rename to lib/presentation/table/pages/payment_table_page.dart.old diff --git a/lib/presentation/table/pages/table_page.dart b/lib/presentation/table/pages/table_page.dart index 268fc38..fd1b0ad 100644 --- a/lib/presentation/table/pages/table_page.dart +++ b/lib/presentation/table/pages/table_page.dart @@ -79,6 +79,12 @@ class _TablePageState extends State { appBar: AppBar( title: const Text("Layout Meja"), actions: [ + IconButton( + icon: const Icon(Icons.refresh), + onPressed: () { + context.read().add(const GetTableEvent.getTables()); + }, + ), BlocListener( listener: (context, state) { state.maybeWhen( diff --git a/lib/presentation/table/widgets/card_table_widget.dart b/lib/presentation/table/widgets/card_table_widget.dart index 16de503..0ffd1a8 100644 --- a/lib/presentation/table/widgets/card_table_widget.dart +++ b/lib/presentation/table/widgets/card_table_widget.dart @@ -16,7 +16,7 @@ import 'package:enaklo_pos/presentation/home/bloc/status_table/status_table_bloc import 'package:enaklo_pos/presentation/home/pages/home_page.dart'; import 'package:enaklo_pos/presentation/table/blocs/get_table/get_table_bloc.dart'; import 'package:enaklo_pos/presentation/table/models/draft_order_model.dart'; -import 'package:enaklo_pos/presentation/table/pages/payment_table_page.dart'; +import 'package:enaklo_pos/presentation/table/pages/payment_table_page.dart.old'; class CardTableWidget extends StatefulWidget { final TableModel table;