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

new neo integrate

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