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,
|
'type': OrderType.delivery,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'value': 'grab',
|
'value': 'free_table',
|
||||||
'label': 'Grab',
|
'label': 'Free Table',
|
||||||
'icon': Icons.two_wheeler,
|
'icon': Icons.table_bar_outlined,
|
||||||
'type': OrderType.grab,
|
'type': OrderType.freeTable,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
enum OrderType {
|
enum OrderType {
|
||||||
dineIn('DINE IN'),
|
dineIn('DINE IN'),
|
||||||
takeAway('TAKE AWAY'),
|
takeAway('TAKE AWAY'),
|
||||||
grab('GRAB'),
|
delivery('DELIVERY'),
|
||||||
delivery('DELIVERY');
|
freeTable('FREE TABLE');
|
||||||
|
|
||||||
final String value;
|
final String value;
|
||||||
const OrderType(this.value);
|
const OrderType(this.value);
|
||||||
|
|||||||
@ -876,16 +876,26 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
|
|||||||
SpaceWidth(12),
|
SpaceWidth(12),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Button.filled(
|
child: Button.filled(
|
||||||
onPressed: () => showDialog(
|
onPressed: () {
|
||||||
context: context,
|
if (customerController.text == '') {
|
||||||
builder: (dcontext) => SaveDialog(
|
AppFlushbar.showError(
|
||||||
selectedTable: widget.table,
|
context,
|
||||||
customerName: customerController.text,
|
'Pilih Pelanggan terlebih dahulu',
|
||||||
items: items,
|
);
|
||||||
orderType: orderType,
|
return;
|
||||||
customer: selectedCustomer,
|
}
|
||||||
),
|
|
||||||
),
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (dcontext) => SaveDialog(
|
||||||
|
selectedTable: widget.table,
|
||||||
|
customerName: customerController.text,
|
||||||
|
items: items,
|
||||||
|
orderType: orderType,
|
||||||
|
customer: selectedCustomer,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
label: 'Simpan',
|
label: 'Simpan',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -914,6 +924,15 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
|
|||||||
child: state.maybeMap(
|
child: state.maybeMap(
|
||||||
orElse: () => Button.filled(
|
orElse: () => Button.filled(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
if (customerController.text ==
|
||||||
|
'') {
|
||||||
|
AppFlushbar.showError(
|
||||||
|
context,
|
||||||
|
'Pilih Pelanggan terlebih dahulu',
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
context.read<OrderFormBloc>().add(
|
context.read<OrderFormBloc>().add(
|
||||||
OrderFormEvent.create(
|
OrderFormEvent.create(
|
||||||
items: items,
|
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/customer/pages/customer_page.dart';
|
||||||
import 'package:enaklo_pos/presentation/home/bloc/checkout/checkout_bloc.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/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/home/pages/dashboard_page.dart';
|
||||||
import 'package:enaklo_pos/presentation/sales/pages/sales_page.dart';
|
import 'package:enaklo_pos/presentation/sales/pages/sales_page.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -115,27 +116,56 @@ class HomeRightTitle extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
BlocBuilder<CheckoutBloc, CheckoutState>(
|
||||||
child: Button.filled(
|
builder: (context, state) {
|
||||||
width: 180.0,
|
return state.maybeWhen(
|
||||||
height: 40,
|
orElse: () => const SizedBox.shrink(),
|
||||||
elevation: 0,
|
loaded: (items,
|
||||||
icon: Icon(
|
discountModel,
|
||||||
Icons.table_restaurant_outlined,
|
discount,
|
||||||
color: Colors.white,
|
discountAmount,
|
||||||
size: 24,
|
tax,
|
||||||
),
|
serviceCharge,
|
||||||
onPressed: () {
|
totalQuantity,
|
||||||
if (table == null) {
|
totalPrice,
|
||||||
context.push(DashboardPage(
|
draftName,
|
||||||
index: 1,
|
orderType) {
|
||||||
));
|
switch (orderType) {
|
||||||
}
|
case OrderType.dineIn:
|
||||||
},
|
return Expanded(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
child: Button.filled(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
width: 180.0,
|
||||||
label: table == null ? 'Pilih Meja' : '${table!.tableName}',
|
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