change table

This commit is contained in:
efrilm
2025-10-27 01:18:46 +07:00
parent 08bbfc393b
commit e8fd683077
6 changed files with 304 additions and 10 deletions
@@ -1,3 +1,4 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -7,6 +8,7 @@ import '../../../../../../common/theme/theme.dart';
import '../../../../../../common/types/order_type.dart';
import '../../../../../components/button/button.dart';
import '../../../../../components/dialog/dialog.dart';
import '../../../../../router/app_router.gr.dart';
class HomeRightTitle extends StatelessWidget {
// final TableModel? table;
@@ -48,9 +50,17 @@ class HomeRightTitle extends StatelessWidget {
),
switch (state.orderType) {
OrderType.dineIn => _buildButton(
'Pilih Meja',
state.table == null
? 'Pilih Meja'
: (state.table?.tableName ?? '-'),
Icons.table_restaurant_outlined,
() {},
() {
if (state.table != null) return;
context.router.navigate(
const MainRoute(children: [TableRoute()]),
);
},
),
OrderType.takeAway => SizedBox.shrink(),
OrderType.delivery => _buildButton(
@@ -1,8 +1,11 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../../../../../application/checkout/checkout_form/checkout_form_bloc.dart';
import '../../../../../../application/table/table_loader/table_loader_bloc.dart';
import '../../../../../../common/theme/theme.dart';
import '../../../../../../domain/table/table.dart' as t;
import '../../../../../router/app_router.gr.dart';
class TableFloatingBottomNavbar extends StatelessWidget {
final t.Table? selectedTable;
@@ -115,13 +118,16 @@ class TableFloatingBottomNavbar extends StatelessWidget {
),
),
onPressed: () {
if (selectedTable?.status.isAvailable ?? false) {
// context.pushReplacement(
// DashboardPage(
// table: selectedTable!,
// items: widget.items,
// ),
// );
if (selectedTable?.status.isAvailable ?? true) {
context.read<CheckoutFormBloc>().add(
CheckoutFormEvent.updateTable(selectedTable),
);
context.read<TableLoaderBloc>().add(
TableLoaderEvent.setSelectedTable(null),
);
context.router.navigate(
const MainRoute(children: [HomeRoute()]),
);
} else {}
},
child: const Text(