Commit 8786e506 authored by Dio Maulana's avatar Dio Maulana

new neo integrate

parent d5210801
...@@ -102,7 +102,7 @@ class Api { ...@@ -102,7 +102,7 @@ class Api {
setListHistory(listHistory); setListHistory(listHistory);
} }
setOrderId(jsonObject['data']['order_id']); setOrderId(jsonObject['data']['order_id']);
setTableMode(jsonObject['data']['table_mode']); // setTableMode(jsonObject['data']['table_mode']);
setLogoUrl(jsonObject['data']['logo']); setLogoUrl(jsonObject['data']['logo']);
setSesssionId(jsonObject['data']['session_id']); setSesssionId(jsonObject['data']['session_id']);
setSecretKey(jsonObject['data']['secret_key']); setSecretKey(jsonObject['data']['secret_key']);
...@@ -842,6 +842,7 @@ class Api { ...@@ -842,6 +842,7 @@ class Api {
"customer_name": orderDetail[d]['customer_name'], "customer_name": orderDetail[d]['customer_name'],
"table_status": jsonObject['data']['table_status'], "table_status": jsonObject['data']['table_status'],
"order_status": jsonObject['data']['order_status'], "order_status": jsonObject['data']['order_status'],
"state": jsonObject['data']['state'],
"order_detail": billDetail, "order_detail": billDetail,
"payment_list": paymentList, "payment_list": paymentList,
"outstanding": jsonObject['data']['outstanding'], "outstanding": jsonObject['data']['outstanding'],
......
...@@ -16,6 +16,7 @@ class ViewBillBloc extends Cubit<List<Bill>> { ...@@ -16,6 +16,7 @@ class ViewBillBloc extends Cubit<List<Bill>> {
customerName: '', customerName: '',
tableStatus: 0, tableStatus: 0,
orderStatus: 0, orderStatus: 0,
state: 0,
outStandingPay: '', outStandingPay: '',
outStandingIndividu: '', outStandingIndividu: '',
invoice: '', invoice: '',
...@@ -84,6 +85,7 @@ class ViewBillBloc extends Cubit<List<Bill>> { ...@@ -84,6 +85,7 @@ class ViewBillBloc extends Cubit<List<Bill>> {
customerName: '', customerName: '',
tableStatus: 0, tableStatus: 0,
orderStatus: 0, orderStatus: 0,
state: 0,
outStandingPay: '', outStandingPay: '',
outStandingIndividu: '', outStandingIndividu: '',
invoice: '', invoice: '',
......
...@@ -63,7 +63,7 @@ Future<dynamic> sendTele(String teks, String namaFungsi) async { ...@@ -63,7 +63,7 @@ Future<dynamic> sendTele(String teks, String namaFungsi) async {
} }
//** httpPostLoger */ //** httpPostLoger */
//**get orderStatus */ //**get orderStatus and color status */
String getOrderStatus(int status) { String getOrderStatus(int status) {
if (status == completeOrder) { if (status == completeOrder) {
return 'Complete'; return 'Complete';
...@@ -75,7 +75,19 @@ String getOrderStatus(int status) { ...@@ -75,7 +75,19 @@ String getOrderStatus(int status) {
return 'Pending'; return 'Pending';
} }
} }
//**get orderStatus */
Color getOrderStatusColor(int status) {
if (status == completeOrder) {
return successColor;
} else if (status == cancelOrder) {
return cancelColorButton;
} else if (status == processingOrder) {
return processingColor;
} else {
return pendingColor;
}
}
//**get orderStatus and color status */
//**get payment Status */ //**get payment Status */
String getpaymentStatus(bool isApproved, int method) { String getpaymentStatus(bool isApproved, int method) {
...@@ -364,6 +376,26 @@ const int pendingOrder = 0; ...@@ -364,6 +376,26 @@ const int pendingOrder = 0;
const int processingOrder = 1; const int processingOrder = 1;
//** untuk nampilin orderan preparing atau compelete */ //** untuk nampilin orderan preparing atau compelete */
//** constanta order status bill */
const int orderStateCanceled = -1;
const int orderStateCreated = 0;
const int orderStatePending = 1;
const int orderStateApproved = 2;
const int orderStatePaid = 3;
const int orderStateDone = 99;
//** constanta order status bill */
//** Bill status */
const int billCanceled = -1;
const int billNotProcess = 1;
const int billInProcess = 2;
const int billInDelivery = 3;
const int billReadyForPickup = 5;
const int billDriverOtwPickup = 6;
const int billDriverArrived = 7;
const int billStatusDone = 99;
//** Bill status */
//** untuk cek status table orderan */ //** untuk cek status table orderan */
const int tableStatusOpen = 0; const int tableStatusOpen = 0;
const int tableStatusSoftLock = 1; const int tableStatusSoftLock = 1;
...@@ -379,11 +411,11 @@ const String responseByodInActive = 'inactive'; ...@@ -379,11 +411,11 @@ const String responseByodInActive = 'inactive';
const String responseByodBranchExist = 'branchExist'; const String responseByodBranchExist = 'branchExist';
//** untuk response API getbranch */ //** untuk response API getbranch */
//** TABLE MODE */ //** TABLE BILL MODE */
const int singleTable = 1; const int closebill = 1;
const int multiTable = 2; const int openBill = 2;
const int defaultTable = 2; // default table di multiin aja const int defaultBillTable = 2; // default table di open aja
//** TABLE MODE */ //** TABLE BILL MODE */
//** DURATION ANIMATED SWITECHER in ms */ //** DURATION ANIMATED SWITECHER in ms */
int animatedTime = 200; int animatedTime = 200;
...@@ -545,4 +577,8 @@ const int typeCategory = 1; ...@@ -545,4 +577,8 @@ const int typeCategory = 1;
const int typeGroup = 2; const int typeGroup = 2;
const int typeMenu = 3; const int typeMenu = 3;
//** type menu */ //** type menu */
//** constanta redirect */
const String goBill = 'to-bill';
//** constanta redirect */
//** END CONSTANT */ //** END CONSTANT */
...@@ -129,7 +129,7 @@ Future<void> setListHistory(List<String> value) async { ...@@ -129,7 +129,7 @@ Future<void> setListHistory(List<String> value) async {
} }
int getTableMode() { int getTableMode() {
return prefs.getInt(_tableMode) ?? defaultTable; return prefs.getInt(_tableMode) ?? defaultBillTable;
} }
Future<void> setTableMode(int value) async { Future<void> setTableMode(int value) async {
......
...@@ -7,6 +7,7 @@ import 'package:byod/bloc/check_voucher.dart'; ...@@ -7,6 +7,7 @@ import 'package:byod/bloc/check_voucher.dart';
import 'package:byod/bloc/member_info.dart'; import 'package:byod/bloc/member_info.dart';
import 'package:byod/bloc/order_bloc.dart'; import 'package:byod/bloc/order_bloc.dart';
import 'package:byod/bloc/search_menu.dart'; import 'package:byod/bloc/search_menu.dart';
import 'package:byod/helper/helper.dart';
import 'package:byod/helper/prefs.dart'; import 'package:byod/helper/prefs.dart';
import 'package:byod/ui/no_route.dart'; import 'package:byod/ui/no_route.dart';
import 'package:byod/ui/splash.dart'; import 'package:byod/ui/splash.dart';
...@@ -63,10 +64,24 @@ void main() async { ...@@ -63,10 +64,24 @@ void main() async {
configLoading(); configLoading();
loadAssetConfig().then((value) { loadAssetConfig().then((value) {
String orderId = Uri.base.queryParameters["o"] ?? ''; String branch = Uri.base.queryParameters["r"] ?? '';
runApp(MyApp( String brand = Uri.base.queryParameters["b"] ?? '';
title: value, String table = Uri.base.queryParameters["t"] ?? '';
)); String idOrder = Uri.base.queryParameters["o"] ?? '';
String redirect = Uri.base.queryParameters["rd"] ?? '';
if (redirect != goBill) {
redirect = '';
}
runApp(
MyApp(
title: value,
branch: branch,
brand: brand,
table: table,
idOrder: idOrder,
tobill: redirect,
),
);
}); });
} }
...@@ -108,11 +123,27 @@ Future<String> loadAssetConfig() async { ...@@ -108,11 +123,27 @@ Future<String> loadAssetConfig() async {
// ignore: must_be_immutable // ignore: must_be_immutable
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
// String myUrl, param, brand, tn, role, cashierName, toViewBill; // String myUrl, branch, brand, tn, role, cashierName, toViewBill;
String title; String title;
String branch;
String brand;
String table;
String idOrder;
String role;
String cashier;
String tobill;
String tokenParam;
MyApp({ MyApp({
Key? key, Key? key,
required this.title, required this.title,
required this.branch,
required this.brand,
required this.table,
required this.idOrder,
this.role = 'customer',
this.cashier = 'customer',
this.tobill = '',
this.tokenParam = '',
}) : super(key: key); }) : super(key: key);
// This widget is the root of your application. // This widget is the root of your application.
...@@ -133,7 +164,7 @@ class MyApp extends StatelessWidget { ...@@ -133,7 +164,7 @@ class MyApp extends StatelessWidget {
} }
//** Check Session ID */ //** Check Session ID */
String paramStrg = ''; String branchStrg = '';
String brandStrg = ''; String brandStrg = '';
String tnStrg = ''; String tnStrg = '';
String roleStrg = 'customer'; String roleStrg = 'customer';
...@@ -141,6 +172,14 @@ class MyApp extends StatelessWidget { ...@@ -141,6 +172,14 @@ class MyApp extends StatelessWidget {
String cashierNameStrg = ''; String cashierNameStrg = '';
String tokenUser = ''; String tokenUser = '';
bool isParamGet;
if (idOrder != '' || branch != '') {
isParamGet = true;
setTableMode(openBill);
} else {
isParamGet = false;
setTableMode(closebill);
}
return MultiBlocProvider( return MultiBlocProvider(
providers: [ providers: [
BlocProvider(create: (_) => OrdersBloc()), BlocProvider(create: (_) => OrdersBloc()),
...@@ -163,81 +202,104 @@ class MyApp extends StatelessWidget { ...@@ -163,81 +202,104 @@ class MyApp extends StatelessWidget {
BlocProvider(create: (_) => SearchActive()), BlocProvider(create: (_) => SearchActive()),
BlocProvider(create: (_) => SearchHistory()), BlocProvider(create: (_) => SearchHistory()),
], ],
child: MaterialApp( child: (!isParamGet)
title: (title == null) ? defaultTitle : title, ? MaterialApp(
builder: EasyLoading.init(), title: (title == null) ? defaultTitle : title,
debugShowCheckedModeBanner: false, builder: EasyLoading.init(),
onGenerateRoute: (routes) { debugShowCheckedModeBanner: false,
var uri = Uri.parse(routes.name!); onGenerateRoute: (routes) {
if (uri.pathSegments.isEmpty) { var uri = Uri.parse(routes.name!);
return MaterialPageRoute( if (uri.pathSegments.isEmpty) {
builder: (context) => NoRoute( return MaterialPageRoute(
identification: 'emptyUri', builder: (context) => NoRoute(
)); identification: 'emptyUri',
} else if (uri.pathSegments.length == 3) { ),
brandStrg = uri.pathSegments.first; );
paramStrg = uri.pathSegments[1]; } else if (uri.pathSegments.length == 3) {
tnStrg = uri.pathSegments[2]; brandStrg = uri.pathSegments.first;
branchStrg = uri.pathSegments[1];
return MaterialPageRoute( tnStrg = uri.pathSegments[2];
builder: (_) => Splash(
param: paramStrg, return MaterialPageRoute(
builder: (_) => Splash(
branch: branchStrg,
brand: brandStrg, brand: brandStrg,
tn: tnStrg, tn: tnStrg,
role: roleStrg, role: roleStrg,
cashierName: cashierNameStrg, cashierName: cashierNameStrg,
toBill: toBill, toBill: toBill,
orderId: orderId, orderId: orderId,
token: tokenUser)); token: tokenUser,
} else if (uri.pathSegments.length == 4) { ),
brandStrg = uri.pathSegments.first; );
paramStrg = uri.pathSegments[1]; } else if (uri.pathSegments.length == 4) {
tnStrg = uri.pathSegments[2]; brandStrg = uri.pathSegments.first;
if (uri.pathSegments[3] == 'go') { branchStrg = uri.pathSegments[1];
toBill = 'go'; tnStrg = uri.pathSegments[2];
} else if (uri.pathSegments[3].length == 32) { if (uri.pathSegments[3] == goBill) {
// its uuid or not toBill = goBill;
} else if (uri.pathSegments[3].length == 32) {
tokenUser = uri.pathSegments[3]; // its uuid or not
isExcelso = true;
} tokenUser = uri.pathSegments[3];
return MaterialPageRoute( isExcelso = true;
builder: (_) => Splash( }
param: paramStrg, return MaterialPageRoute(
builder: (_) => Splash(
branch: branchStrg,
brand: brandStrg, brand: brandStrg,
tn: tnStrg, tn: tnStrg,
role: roleStrg, role: roleStrg,
cashierName: cashierNameStrg, cashierName: cashierNameStrg,
toBill: toBill, toBill: toBill,
orderId: orderId, orderId: orderId,
token: tokenUser)); token: tokenUser,
} else if (uri.pathSegments.length == 5) { ),
brandStrg = uri.pathSegments.first; );
paramStrg = uri.pathSegments[1]; } else if (uri.pathSegments.length == 5) {
tnStrg = uri.pathSegments[2]; brandStrg = uri.pathSegments.first;
if (uri.pathSegments[3] == 'cashier') { branchStrg = uri.pathSegments[1];
// roleStrg = 'cashier'; tnStrg = uri.pathSegments[2];
roleStrg = 'customer'; if (uri.pathSegments[3] == 'cashier') {
cashierNameStrg = uri.pathSegments[4]; // roleStrg = 'cashier';
} else if (uri.pathSegments[3].length == 32 && roleStrg = 'customer';
uri.pathSegments[4] == 'go') { cashierNameStrg = uri.pathSegments[4];
tokenUser = uri.pathSegments[3]; } else if (uri.pathSegments[3].length == 32 &&
isExcelso = true; uri.pathSegments[4] == goBill) {
toBill = 'go'; tokenUser = uri.pathSegments[3];
} isExcelso = true;
return MaterialPageRoute( toBill = goBill;
builder: (_) => Splash( }
param: paramStrg, return MaterialPageRoute(
builder: (_) => Splash(
branch: branchStrg,
brand: brandStrg, brand: brandStrg,
tn: tnStrg, tn: tnStrg,
role: roleStrg, role: roleStrg,
cashierName: cashierNameStrg, cashierName: cashierNameStrg,
toBill: toBill, toBill: toBill,
orderId: orderId, orderId: orderId,
token: tokenUser)); token: tokenUser,
} ),
return null; );
}), }
return null;
})
: MaterialApp(
title: (title == null) ? defaultTitle : title,
builder: EasyLoading.init(),
debugShowCheckedModeBanner: false,
home: Splash(
branch: branch,
brand: brand,
tn: table,
role: role,
cashierName: cashier,
toBill: tobill,
orderId: orderId,
token: tokenParam,
),
),
); );
} }
} }
...@@ -10,6 +10,7 @@ class Bill { ...@@ -10,6 +10,7 @@ class Bill {
String customerName; String customerName;
int tableStatus; int tableStatus;
int orderStatus; int orderStatus;
int state;
String outStandingPay; String outStandingPay;
String outStandingIndividu; String outStandingIndividu;
String dateOrder; String dateOrder;
...@@ -32,6 +33,7 @@ class Bill { ...@@ -32,6 +33,7 @@ class Bill {
required this.customerName, required this.customerName,
required this.tableStatus, required this.tableStatus,
required this.orderStatus, required this.orderStatus,
required this.state,
required this.outStandingPay, required this.outStandingPay,
required this.outStandingIndividu, required this.outStandingIndividu,
required this.dateOrder, required this.dateOrder,
...@@ -56,6 +58,7 @@ class Bill { ...@@ -56,6 +58,7 @@ class Bill {
customerName: json['customer_name'], customerName: json['customer_name'],
tableStatus: json['table_status'], tableStatus: json['table_status'],
orderStatus: json['order_status'], orderStatus: json['order_status'],
state: json['state'],
billDetail: json['order_detail'], billDetail: json['order_detail'],
paymentList: json['payment_list'], paymentList: json['payment_list'],
outStandingPay: json['outstanding'], outStandingPay: json['outstanding'],
......
...@@ -341,7 +341,7 @@ class _CheckOutState extends State<CheckOut> { ...@@ -341,7 +341,7 @@ class _CheckOutState extends State<CheckOut> {
onTap: () { onTap: () {
String namaPelanggan = getCustomerName(); String namaPelanggan = getCustomerName();
if (tableMode == singleTable && namaPelanggan != '') { if (tableMode == closebill && namaPelanggan != '') {
checkOut(context, listOrders, namaPelanggan); checkOut(context, listOrders, namaPelanggan);
} else { } else {
String namaPelanggan = getCustomerName(); String namaPelanggan = getCustomerName();
...@@ -586,7 +586,7 @@ class _CheckOutState extends State<CheckOut> { ...@@ -586,7 +586,7 @@ class _CheckOutState extends State<CheckOut> {
height: height:
MediaQuery.of(context).size.height * MediaQuery.of(context).size.height *
0.005), 0.005),
(tableMode == multiTable) (tableMode == openBill)
? ?
// Text( // Text(
// "Pesanan yang di input tidak dapat di batalkan, Yakin ingin melanjutkan ?", // "Pesanan yang di input tidak dapat di batalkan, Yakin ingin melanjutkan ?",
......
...@@ -487,8 +487,8 @@ class _HomeState extends State<Home> { ...@@ -487,8 +487,8 @@ class _HomeState extends State<Home> {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
String namaPelanggan = getCustomerName(); String namaPelanggan = getCustomerName();
if (tableMode == singleTable) { if (tableMode == closebill) {
if (tableMode == singleTable && namaPelanggan != '') { if (tableMode == closebill && namaPelanggan != '') {
checkOut(context, listOrders, namaPelanggan); checkOut(context, listOrders, namaPelanggan);
} else { } else {
String namaPelanggan = getCustomerName(); String namaPelanggan = getCustomerName();
...@@ -917,7 +917,7 @@ class _HomeState extends State<Home> { ...@@ -917,7 +917,7 @@ class _HomeState extends State<Home> {
height: height:
MediaQuery.of(context).size.height * MediaQuery.of(context).size.height *
0.005), 0.005),
(tableMode == multiTable) (tableMode == openBill)
? defaultText(context, ? defaultText(context,
"Pesanan yang diinput tidak dapat dibatalkan, Yakin ingin melanjutkan ?", "Pesanan yang diinput tidak dapat dibatalkan, Yakin ingin melanjutkan ?",
style: textStyleNormalFont( style: textStyleNormalFont(
......
...@@ -917,7 +917,7 @@ class _NewHome2State extends State<NewHome2> { ...@@ -917,7 +917,7 @@ class _NewHome2State extends State<NewHome2> {
final nameController = TextEditingController(); final nameController = TextEditingController();
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
if (tableMode == singleTable) { if (tableMode == closebill) {
if (namaPelanggan != '') { if (namaPelanggan != '') {
checkOut(context, listOrders, namaPelanggan); checkOut(context, listOrders, namaPelanggan);
} else { } else {
......
...@@ -18,10 +18,10 @@ import 'home/shimmer_menu.dart'; ...@@ -18,10 +18,10 @@ import 'home/shimmer_menu.dart';
import 'screen_responsive.dart'; import 'screen_responsive.dart';
class Splash extends StatefulWidget { class Splash extends StatefulWidget {
final String param, brand, tn, role, cashierName, toBill, orderId, token; final String branch, brand, tn, role, cashierName, toBill, orderId, token;
const Splash( const Splash(
{Key? key, {Key? key,
required this.param, required this.branch,
required this.brand, required this.brand,
required this.tn, required this.tn,
required this.role, required this.role,
...@@ -56,7 +56,7 @@ class _SplashState extends State<Splash> { ...@@ -56,7 +56,7 @@ class _SplashState extends State<Splash> {
loadBaseUrl().then((baseUrl) { loadBaseUrl().then((baseUrl) {
setBaseUrl(baseUrl); setBaseUrl(baseUrl);
context.read<BranchExist>().branchExist( context.read<BranchExist>().branchExist(
widget.param, widget.branch,
widget.brand, widget.brand,
widget.role, widget.role,
widget.cashierName, widget.cashierName,
...@@ -64,10 +64,10 @@ class _SplashState extends State<Splash> { ...@@ -64,10 +64,10 @@ class _SplashState extends State<Splash> {
context, context,
getMenu: true, getMenu: true,
); );
// context.read<CategoryMenu>().catAndMenu(widget.param, widget.brand, // context.read<CategoryMenu>().catAndMenu(widget.branch, widget.brand,
// widget.role, widget.cashierName, widget.token); // widget.role, widget.cashierName, widget.token);
// context.read<FilterMenuBloc>().catAndMenu(widget.param, widget.brand, // context.read<FilterMenuBloc>().catAndMenu(widget.branch, widget.brand,
// widget.role, widget.cashierName, widget.token); // widget.role, widget.cashierName, widget.token);
if (widget.token != '') { if (widget.token != '') {
...@@ -75,14 +75,14 @@ class _SplashState extends State<Splash> { ...@@ -75,14 +75,14 @@ class _SplashState extends State<Splash> {
} }
Future.delayed(const Duration(milliseconds: 1000), () async { Future.delayed(const Duration(milliseconds: 1000), () async {
setToken(widget.token); setToken(widget.token);
setBranch(widget.param); setBranch(widget.branch);
setBrand(widget.brand); setBrand(widget.brand);
setTableNumber(widget.tn); setTableNumber(widget.tn);
setRole(widget.role); setRole(widget.role);
setCashierName(widget.cashierName); setCashierName(widget.cashierName);
// ignore: use_build_context_synchronously // ignore: use_build_context_synchronously
if (widget.toBill == 'go') { if (widget.toBill == goBill) {
// ignore: use_build_context_synchronously // ignore: use_build_context_synchronously
Navigator.pushReplacement( Navigator.pushReplacement(
context, MaterialPageRoute(builder: (_) => const ViewBillNew())); context, MaterialPageRoute(builder: (_) => const ViewBillNew()));
......
...@@ -26,7 +26,7 @@ class OrderViewBill extends StatefulWidget { ...@@ -26,7 +26,7 @@ class OrderViewBill extends StatefulWidget {
required this.itemKe, required this.itemKe,
required this.itemCount, required this.itemCount,
this.isFromPayment = false, this.isFromPayment = false,
this.tableMode = multiTable, this.tableMode = openBill,
required this.tableStatus}) required this.tableStatus})
: super(key: key); : super(key: key);
...@@ -315,8 +315,8 @@ class _OrderViewBillState extends State<OrderViewBill> { ...@@ -315,8 +315,8 @@ class _OrderViewBillState extends State<OrderViewBill> {
// font: normalFont, // font: normalFont,
// ), // ),
// ), // ),
(widget.tableMode == multiTable || (widget.tableMode == openBill ||
widget.tableMode == singleTable) widget.tableMode == closebill)
? ?
// Text( // Text(
// // (widget.billDetail.orderStatus == completeOrder) // // (widget.billDetail.orderStatus == completeOrder)
...@@ -391,7 +391,7 @@ class _OrderViewBillState extends State<OrderViewBill> { ...@@ -391,7 +391,7 @@ class _OrderViewBillState extends State<OrderViewBill> {
// color: Colors.blue, // color: Colors.blue,
// padding: EdgeInsets.only( // padding: EdgeInsets.only(
// right: widthScreen * 0.01), // right: widthScreen * 0.01),
child: (widget.tableMode == singleTable && child: (widget.tableMode == closebill &&
widget.tableStatus == tableStatusOpen) widget.tableStatus == tableStatusOpen)
? Row( ? Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
......
...@@ -181,6 +181,16 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> { ...@@ -181,6 +181,16 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
overFlow: TextOverflow.ellipsis, overFlow: TextOverflow.ellipsis,
style: menuNameListViewBill(), style: menuNameListViewBill(),
), ),
defaultText(
context,
getOrderStatus(widget.billDetail.orderStatus),
style: viewbillStyle(
font: 12,
fontWeight: FontWeight.w300,
color: getOrderStatusColor(
widget.billDetail.orderStatus),
),
),
const SizedBox( const SizedBox(
height: 6, height: 6,
), ),
...@@ -215,7 +225,7 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> { ...@@ -215,7 +225,7 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
], ],
), ),
), ),
(!widget.isHistory && widget.tableStatus == tableStatusOpen) (!widget.isHistory && widget.billDetail.orderStatus == pendingOrder)
? Container( ? Container(
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: paddingLeftRightBill, left: paddingLeftRightBill,
...@@ -226,12 +236,12 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> { ...@@ -226,12 +236,12 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
), ),
) )
: const SizedBox(), : const SizedBox(),
(!widget.isHistory && widget.tableStatus == tableStatusOpen) (!widget.isHistory && widget.billDetail.orderStatus == pendingOrder)
? const SizedBox( ? const SizedBox(
height: 11, height: 11,
) )
: const SizedBox(), : const SizedBox(),
(!widget.isHistory && widget.tableStatus == tableStatusOpen) (!widget.isHistory && widget.billDetail.orderStatus == pendingOrder)
? Container( ? Container(
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: paddingLeftRightBill, left: paddingLeftRightBill,
......
...@@ -107,7 +107,7 @@ class _ViewBillState extends State<ViewBill> { ...@@ -107,7 +107,7 @@ class _ViewBillState extends State<ViewBill> {
String cashierName = prefs.getString("cashier_name") ?? ''; String cashierName = prefs.getString("cashier_name") ?? '';
// String token = prefs.getString("token") ?? ''; // String token = prefs.getString("token") ?? '';
String sessionID = prefs.getString("sessionId") ?? uuid; String sessionID = prefs.getString("sessionId") ?? uuid;
int tableMode = prefs.getInt('table_mode') ?? defaultTable; int tableMode = prefs.getInt('table_mode') ?? defaultBillTable;
List<String> historyOrder = prefs.getStringList('list_history') ?? []; List<String> historyOrder = prefs.getStringList('list_history') ?? [];
return SafeArea( return SafeArea(
child: Scaffold( child: Scaffold(
...@@ -451,7 +451,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran'''; ...@@ -451,7 +451,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
), ),
) )
: const SizedBox(), : const SizedBox(),
(tableMode == multiTable) (tableMode == openBill)
? pricePerCustomer( ? pricePerCustomer(
dataBill, dataBill,
context, context,
...@@ -560,7 +560,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran'''; ...@@ -560,7 +560,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
children: [ children: [
GestureDetector( GestureDetector(
onTap: () { onTap: () {
if (tableMode == singleTable && if (tableMode == closebill &&
memberinfo.id == '') { memberinfo.id == '') {
addPayment( addPayment(
context, context,
...@@ -1565,10 +1565,10 @@ Mohon menuju kasir untuk meminta bukti pembayaran'''; ...@@ -1565,10 +1565,10 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
int indexDataIndividu = int indexDataIndividu =
dataBill.indexWhere((data) => data.customerName == customerName); dataBill.indexWhere((data) => data.customerName == customerName);
double heighContainer; double heighContainer;
if (tableMode == singleTable && memberinfo.id != '') { if (tableMode == closebill && memberinfo.id != '') {
heighContainer = MediaQuery.of(context).size.height * 0.45; heighContainer = MediaQuery.of(context).size.height * 0.45;
} else if ((tableMode == multiTable && memberinfo.id == '') || } else if ((tableMode == openBill && memberinfo.id == '') ||
tableMode == singleTable && memberinfo.id != '') { tableMode == closebill && memberinfo.id != '') {
heighContainer = MediaQuery.of(context).size.height * 0.3; heighContainer = MediaQuery.of(context).size.height * 0.3;
} else { } else {
heighContainer = MediaQuery.of(context).size.height * 0.25; heighContainer = MediaQuery.of(context).size.height * 0.25;
...@@ -1605,7 +1605,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran'''; ...@@ -1605,7 +1605,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
String titlePayment; String titlePayment;
String customerName = prefs.getString('userName') ?? ''; String customerName = prefs.getString('userName') ?? '';
bool isIndividu; bool isIndividu;
if (tableMode == multiTable) { if (tableMode == openBill) {
isIndividu = true; isIndividu = true;
titlePayment = 'Semua Bill'; titlePayment = 'Semua Bill';
} else { } else {
...@@ -1613,7 +1613,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran'''; ...@@ -1613,7 +1613,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
titlePayment = customerName; titlePayment = customerName;
} }
if (outStandingAll > 0) { if (outStandingAll > 0) {
if (tableMode == singleTable) { if (tableMode == closebill) {
addPayment( addPayment(
context, context,
dataBill[0].id, dataBill[0].id,
...@@ -1644,7 +1644,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran'''; ...@@ -1644,7 +1644,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
child: Align( child: Align(
child: defaultText( child: defaultText(
context, context,
(tableMode == multiTable) (tableMode == openBill)
? "Bayar Sebagian" ? "Bayar Sebagian"
: "Online - Rp ${formatNumber().format(outStandingAll)}", : "Online - Rp ${formatNumber().format(outStandingAll)}",
style: textStyleNormalFont( style: textStyleNormalFont(
...@@ -1655,12 +1655,12 @@ Mohon menuju kasir untuk meminta bukti pembayaran'''; ...@@ -1655,12 +1655,12 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
), ),
), ),
), ),
(tableMode == multiTable) (tableMode == openBill)
? SizedBox( ? SizedBox(
height: MediaQuery.of(context).size.height * 0.02, height: MediaQuery.of(context).size.height * 0.02,
) )
: const SizedBox(), : const SizedBox(),
(tableMode == multiTable) (tableMode == openBill)
? GestureDetector( ? GestureDetector(
onTap: () { onTap: () {
if (outStandingAll > 0) { if (outStandingAll > 0) {
......
This diff is collapsed.
// This is a basic Flutter widget test. // // This is a basic Flutter widget test.
// // //
// To perform an interaction with a widget in your test, use the WidgetTester // // To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll // // utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget // // gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct. // // tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart'; // import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; // import 'package:flutter_test/flutter_test.dart';
import 'package:byod/main.dart'; // import 'package:byod/main.dart';
void main() { // void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async { // testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame. // // Build our app and trigger a frame.
await tester.pumpWidget(MyApp( // await tester.pumpWidget(MyApp(
title: 'Ravintola BYOD', // title: 'Ravintola BYOD',
)); // ));
// Verify that our counter starts at 0. // // Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget); // expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing); // expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame. // // Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add)); // await tester.tap(find.byIcon(Icons.add));
await tester.pump(); // await tester.pump();
// Verify that our counter has incremented. // // Verify that our counter has incremented.
expect(find.text('0'), findsNothing); // expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget); // expect(find.text('1'), findsOneWidget);
}); // });
} // }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment