diff --git a/assets/icons/people.svg b/assets/icons/people.svg new file mode 100644 index 0000000..f956bf1 --- /dev/null +++ b/assets/icons/people.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/lib/core/assets/assets.gen.dart b/lib/core/assets/assets.gen.dart index 59248fd..8f43a4a 100644 --- a/lib/core/assets/assets.gen.dart +++ b/lib/core/assets/assets.gen.dart @@ -101,6 +101,9 @@ class $AssetsIconsGen { /// File path: assets/icons/payments.svg SvgGenImage get payments => const SvgGenImage('assets/icons/payments.svg'); + /// File path: assets/icons/people.svg + SvgGenImage get people => const SvgGenImage('assets/icons/people.svg'); + /// File path: assets/icons/print.svg SvgGenImage get print => const SvgGenImage('assets/icons/print.svg'); @@ -152,6 +155,7 @@ class $AssetsIconsGen { orders, pajak, payments, + people, print, qrCode, report, diff --git a/lib/presentation/home/pages/dashboard_page.dart b/lib/presentation/home/pages/dashboard_page.dart index 9c95225..f00472c 100644 --- a/lib/presentation/home/pages/dashboard_page.dart +++ b/lib/presentation/home/pages/dashboard_page.dart @@ -3,6 +3,7 @@ import 'dart:async'; import 'dart:developer'; import 'package:connectivity_plus/connectivity_plus.dart'; +import 'package:enaklo_pos/presentation/customer/pages/customer_page.dart'; import 'package:enaklo_pos/presentation/setting/pages/setting_page.dart'; import 'package:enaklo_pos/presentation/table/pages/table_page.dart'; import 'package:flutter/material.dart'; @@ -15,7 +16,6 @@ import 'package:enaklo_pos/data/datasources/auth_local_datasource.dart'; import 'package:enaklo_pos/presentation/auth/login_page.dart'; import 'package:enaklo_pos/presentation/report/pages/report_page.dart'; import 'package:enaklo_pos/presentation/setting/bloc/sync_order/sync_order_bloc.dart'; -import 'package:enaklo_pos/presentation/setting/pages/printer_configuration_page.dart'; import '../../../core/assets/assets.gen.dart'; import '../../auth/bloc/logout/logout_bloc.dart'; @@ -59,8 +59,7 @@ class _DashboardPageState extends State { ), const TablePage(), const ReportPage(), - const PrinterConfigurationPage(), - // SalesPage(), + const CustomerPage(), const SettingPage(), ]; // ignore: unused_local_variable @@ -121,7 +120,7 @@ class _DashboardPageState extends State { onTap: () => _onItemTapped(2), ), NavItem( - iconPath: Assets.icons.print.path, + iconPath: Assets.icons.people.path, isActive: _selectedIndex == 3, onTap: () => _onItemTapped(3), ), diff --git a/lib/presentation/home/widgets/home_right_title.dart b/lib/presentation/home/widgets/home_right_title.dart index 0208414..3d1ba60 100644 --- a/lib/presentation/home/widgets/home_right_title.dart +++ b/lib/presentation/home/widgets/home_right_title.dart @@ -3,7 +3,6 @@ import 'package:enaklo_pos/core/constants/colors.dart'; import 'package:enaklo_pos/core/extensions/build_context_ext.dart'; import 'package:enaklo_pos/core/extensions/string_ext.dart'; import 'package:enaklo_pos/data/models/response/table_model.dart'; -import 'package:enaklo_pos/presentation/customer/pages/customer_page.dart'; import 'package:enaklo_pos/presentation/home/bloc/checkout/checkout_bloc.dart'; import 'package:enaklo_pos/presentation/home/dialog/delivery_dialog.dart'; import 'package:enaklo_pos/presentation/home/dialog/type_dialog.dart'; @@ -20,7 +19,7 @@ class HomeRightTitle extends StatelessWidget { @override Widget build(BuildContext context) { return Container( - height: context.deviceHeight * 0.15, + height: context.deviceHeight * 0.12, decoration: BoxDecoration( color: AppColors.primary, border: Border( @@ -33,52 +32,77 @@ class HomeRightTitle extends StatelessWidget { child: Column( mainAxisSize: MainAxisSize.min, children: [ - Row( - children: [ - Expanded( - child: Button.filled( - width: 180.0, - height: 40, - elevation: 0, - onPressed: () => context.push(SalesPage( - status: 'pending', - )), - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - icon: Icon( - Icons.list, - color: Colors.white, - size: 24, + Expanded( + child: Row( + children: [ + Expanded( + child: Button.filled( + width: 180.0, + height: 40, + elevation: 0, + onPressed: () => context.push(SalesPage( + status: 'pending', + )), + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + icon: Icon( + Icons.list, + color: Colors.white, + size: 24, + ), + label: 'Daftar Pesanan', ), - label: 'Daftar Pesanan', ), - ), - Expanded( - child: Button.filled( - width: 180.0, - height: 40, - elevation: 0, - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - icon: Icon( - Icons.person_outline, - color: Colors.white, - size: 24, - ), - onPressed: () { - if (table == null) { - context.push(CustomerPage()); - } - }, - label: 'Pelanggan', - ), - ), - ], + ], + ), ), - Row( - children: [ - Expanded( - child: BlocBuilder( + Expanded( + child: Row( + children: [ + Expanded( + child: BlocBuilder( + builder: (context, state) { + return state.maybeWhen( + orElse: () => const SizedBox.shrink(), + loaded: ( + items, + discountModel, + discount, + discountAmount, + tax, + serviceCharge, + totalQuantity, + totalPrice, + draftName, + orderType, + deliveryType, + ) { + return Button.filled( + width: 180.0, + height: 40, + elevation: 0, + onPressed: () { + showDialog( + context: context, + builder: (context) { + return TypeDialog(); + }); + }, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + icon: Icon( + Icons.dinner_dining_outlined, + color: Colors.white, + size: 24, + ), + label: orderType.value.toTitleCase(), + ); + }, + ); + }, + ), + ), + BlocBuilder( builder: (context, state) { return state.maybeWhen( orElse: () => const SizedBox.shrink(), @@ -95,109 +119,68 @@ class HomeRightTitle extends StatelessWidget { orderType, deliveryType, ) { - return Button.filled( - width: 180.0, - height: 40, - elevation: 0, - onPressed: () { - showDialog( - context: context, - builder: (context) { - return TypeDialog(); - }); - }, - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - icon: Icon( - Icons.dinner_dining_outlined, - color: Colors.white, - size: 24, - ), - label: orderType.value.toTitleCase(), - ); + switch (orderType) { + case OrderType.dineIn: + return Expanded( + child: Button.filled( + width: 180.0, + height: 40, + elevation: 0, + icon: Icon( + Icons.table_restaurant_outlined, + color: Colors.white, + size: 24, + ), + onPressed: () { + if (table == null) { + context.push(DashboardPage( + index: 1, + )); + } + }, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + label: table == null + ? 'Pilih Meja' + : '${table!.tableName}', + ), + ); + case OrderType.takeAway: + return const SizedBox.shrink(); + case OrderType.delivery: + return Expanded( + child: Button.filled( + width: 180.0, + height: 40, + elevation: 0, + icon: Icon( + Icons.motorcycle_outlined, + color: Colors.white, + size: 24, + ), + onPressed: () { + showDialog( + context: context, + builder: (context) { + return DeliveryDialog(); + }); + }, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + label: deliveryType == null + ? 'Pilih Pengiriman' + : deliveryType.name, + ), + ); + default: + return const SizedBox.shrink(); + } }, ); }, ), - ), - BlocBuilder( - builder: (context, state) { - return state.maybeWhen( - orElse: () => const SizedBox.shrink(), - loaded: ( - items, - discountModel, - discount, - discountAmount, - tax, - serviceCharge, - totalQuantity, - totalPrice, - draftName, - orderType, - deliveryType, - ) { - switch (orderType) { - case OrderType.dineIn: - return Expanded( - child: Button.filled( - width: 180.0, - height: 40, - elevation: 0, - icon: Icon( - Icons.table_restaurant_outlined, - color: Colors.white, - size: 24, - ), - onPressed: () { - if (table == null) { - context.push(DashboardPage( - index: 1, - )); - } - }, - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - label: table == null - ? 'Pilih Meja' - : '${table!.tableName}', - ), - ); - case OrderType.takeAway: - return const SizedBox.shrink(); - case OrderType.delivery: - return Expanded( - child: Button.filled( - width: 180.0, - height: 40, - elevation: 0, - icon: Icon( - Icons.motorcycle_outlined, - color: Colors.white, - size: 24, - ), - onPressed: () { - showDialog( - context: context, - builder: (context) { - return DeliveryDialog(); - }); - }, - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - label: deliveryType == null - ? 'Pilih Pengiriman' - : deliveryType.name, - ), - ); - default: - return const SizedBox.shrink(); - } - }, - ); - }, - ), - ], + ], + ), ), ], ), diff --git a/lib/presentation/setting/bloc/get_printer_ticket/get_printer_ticket_bloc.freezed.dart b/lib/presentation/setting/bloc/get_printer_ticket/get_printer_ticket_bloc.freezed.dart index 2f6949b..f091fec 100644 --- a/lib/presentation/setting/bloc/get_printer_ticket/get_printer_ticket_bloc.freezed.dart +++ b/lib/presentation/setting/bloc/get_printer_ticket/get_printer_ticket_bloc.freezed.dart @@ -512,12 +512,11 @@ class _$SuccessImpl implements _Success { return identical(this, other) || (other.runtimeType == runtimeType && other is _$SuccessImpl && - const DeepCollectionEquality().equals(other.printer, printer)); + (identical(other.printer, printer) || other.printer == printer)); } @override - int get hashCode => - Object.hash(runtimeType, const DeepCollectionEquality().hash(printer)); + int get hashCode => Object.hash(runtimeType, printer); /// Create a copy of GetPrinterTicketState /// with the given fields replaced by the non-null parameter values.