feat: update type and customer is required
This commit is contained in:
parent
092e68615c
commit
37ed6686f8
@ -34,10 +34,10 @@ class _TypeDialogState extends State<TypeDialog> {
|
||||
'type': OrderType.delivery,
|
||||
},
|
||||
{
|
||||
'value': 'grab',
|
||||
'label': 'Grab',
|
||||
'icon': Icons.two_wheeler,
|
||||
'type': OrderType.grab,
|
||||
'value': 'free_table',
|
||||
'label': 'Free Table',
|
||||
'icon': Icons.table_bar_outlined,
|
||||
'type': OrderType.freeTable,
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
enum OrderType {
|
||||
dineIn('DINE IN'),
|
||||
takeAway('TAKE AWAY'),
|
||||
grab('GRAB'),
|
||||
delivery('DELIVERY');
|
||||
delivery('DELIVERY'),
|
||||
freeTable('FREE TABLE');
|
||||
|
||||
final String value;
|
||||
const OrderType(this.value);
|
||||
|
||||
@ -876,16 +876,26 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
|
||||
SpaceWidth(12),
|
||||
Expanded(
|
||||
child: Button.filled(
|
||||
onPressed: () => showDialog(
|
||||
context: context,
|
||||
builder: (dcontext) => SaveDialog(
|
||||
selectedTable: widget.table,
|
||||
customerName: customerController.text,
|
||||
items: items,
|
||||
orderType: orderType,
|
||||
customer: selectedCustomer,
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
if (customerController.text == '') {
|
||||
AppFlushbar.showError(
|
||||
context,
|
||||
'Pilih Pelanggan terlebih dahulu',
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (dcontext) => SaveDialog(
|
||||
selectedTable: widget.table,
|
||||
customerName: customerController.text,
|
||||
items: items,
|
||||
orderType: orderType,
|
||||
customer: selectedCustomer,
|
||||
),
|
||||
);
|
||||
},
|
||||
label: 'Simpan',
|
||||
),
|
||||
),
|
||||
@ -914,6 +924,15 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
|
||||
child: state.maybeMap(
|
||||
orElse: () => Button.filled(
|
||||
onPressed: () {
|
||||
if (customerController.text ==
|
||||
'') {
|
||||
AppFlushbar.showError(
|
||||
context,
|
||||
'Pilih Pelanggan terlebih dahulu',
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
context.read<OrderFormBloc>().add(
|
||||
OrderFormEvent.create(
|
||||
items: items,
|
||||
|
||||
@ -6,6 +6,7 @@ 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/type_dialog.dart';
|
||||
import 'package:enaklo_pos/presentation/home/models/order_type.dart';
|
||||
import 'package:enaklo_pos/presentation/home/pages/dashboard_page.dart';
|
||||
import 'package:enaklo_pos/presentation/sales/pages/sales_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@ -115,27 +116,56 @@ class HomeRightTitle extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
),
|
||||
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}',
|
||||
),
|
||||
BlocBuilder<CheckoutBloc, CheckoutState>(
|
||||
builder: (context, state) {
|
||||
return state.maybeWhen(
|
||||
orElse: () => const SizedBox.shrink(),
|
||||
loaded: (items,
|
||||
discountModel,
|
||||
discount,
|
||||
discountAmount,
|
||||
tax,
|
||||
serviceCharge,
|
||||
totalQuantity,
|
||||
totalPrice,
|
||||
draftName,
|
||||
orderType) {
|
||||
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 const SizedBox.shrink();
|
||||
default:
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user