Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
B
Byodv2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dio Maulana
Byodv2
Commits
f80b3813
Commit
f80b3813
authored
Sep 29, 2022
by
Dio Maulana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
edit api v2 dan prefs global
parent
1d42dd8f
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
726 additions
and
378 deletions
+726
-378
api.dart
lib/api/api.dart
+365
-239
branch_exist.dart
lib/bloc/branch_exist.dart
+14
-6
view_bill.dart
lib/bloc/view_bill.dart
+9
-9
helper.dart
lib/helper/helper.dart
+17
-0
prefs.dart
lib/helper/prefs.dart
+161
-0
emoticon_rate.dart
lib/helper/widget/emoticon_rate.dart
+4
-4
emoticon_rate_new.dart
lib/helper/widget/emoticon_rate_new.dart
+7
-7
main.dart
lib/main.dart
+9
-8
checkout.dart
lib/ui/checkout/checkout.dart
+4
-3
fuction.dart
lib/ui/checkout/fuction.dart
+6
-6
history.dart
lib/ui/history_order/history.dart
+1
-1
history_new.dart
lib/ui/history_order/history_new.dart
+1
-1
bottom_sheet_menu_new.dart
lib/ui/home/bottom_sheet_menu_new.dart
+15
-7
home.dart
lib/ui/home/home.dart
+6
-5
new_home2.dart
lib/ui/home/new_home2.dart
+5
-4
payment.dart
lib/ui/payment/payment.dart
+4
-3
payment_balance.dart
lib/ui/payment/payment_balance.dart
+4
-4
payment_voucher.dart
lib/ui/payment/payment_voucher.dart
+5
-4
splash.dart
lib/ui/splash.dart
+15
-13
app_bar.dart
lib/ui/viewbill/app_bar.dart
+13
-7
order_view_bill_new.dart
lib/ui/viewbill/order_view_bill_new.dart
+17
-8
view_bill.dart
lib/ui/viewbill/view_bill.dart
+14
-6
view_bill_new.dart
lib/ui/viewbill/view_bill_new.dart
+30
-33
No files found.
lib/api/api.dart
View file @
f80b3813
...
...
@@ -5,6 +5,7 @@ import 'dart:convert';
import
'package:byod/bloc/view_bill.dart'
;
import
'package:byod/helper/helper.dart'
;
import
'package:byod/helper/logger.dart'
;
import
'package:byod/helper/prefs.dart'
;
import
'package:byod/models/bill.dart'
;
import
'package:byod/models/bill_detail.dart'
;
import
'package:byod/models/feedback_option.dart'
;
...
...
@@ -12,15 +13,14 @@ import 'package:byod/models/filter_menu.dart';
import
'package:byod/models/member_info.dart'
;
import
'package:byod/models/payment_list.dart'
;
import
'package:byod/models/voucher_list.dart'
;
import
'package:byod/ui/viewbill/view_bill.dart'
;
import
'package:byod/ui/viewbill/view_bill_new.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:flutter_easyloading/flutter_easyloading.dart'
;
import
'package:uuid/uuid.dart'
;
import
'../bloc/order_bloc.dart'
;
import
'../helper/widget/open_url.dart'
;
import
'../main.dart'
;
import
'../models/fav_menu.dart'
;
import
'../models/variant_categories.dart'
;
import
'../models/variants.dart'
;
// ignore: avoid_web_libraries_in_flutter
...
...
@@ -40,18 +40,30 @@ import '../models/variants.dart';
// return false;
// }
// }
const
String
endPoint
=
'romi/api/v2/byod/'
;
class
Api
{
static
Future
<
dynamic
>
getBranch
(
String
branchCode
,
String
brandCode
,
String
role
,
String
cashierName
,
String
sessionId
)
async
{
String
baseUrl
=
prefs
.
getString
(
'baseUrl'
)
??
''
;
String
apiUrl
=
'
${baseUrl}
romi/api/byod/get_branch'
;
String
role
,
String
cashierName
,
String
orderId
)
async
{
String
baseUrl
=
getBaseUrl
();
String
apiUrl
=
'
$baseUrl${endPoint}
get_branch'
;
String
currentSessionId
=
getSessionId
();
const
uuidInit
=
Uuid
();
var
uuid
=
uuidInit
.
v4
();
String
sessionId
;
if
(
currentSessionId
!=
''
)
{
sessionId
=
currentSessionId
;
}
else
{
sessionId
=
uuid
;
}
try
{
Map
data
=
{
"branch_code"
:
branchCode
,
"brand_code"
:
brandCode
,
"role"
:
role
,
"cashier_name"
:
cashierName
,
"order_id"
:
orderId
,
"session_id"
:
sessionId
,
"from"
:
fromByod
};
...
...
@@ -63,17 +75,17 @@ class Api {
if
(
jsonObject
!=
false
)
{
if
(
jsonObject
[
'status'
].
toString
().
toLowerCase
()
==
'ok'
)
{
//** save sessionID and Table Mode*/
List
<
String
>
listHistory
=
prefs
.
getStringList
(
'list_history'
)
??
[]
;
String
tableNumber
=
prefs
.
getString
(
'table_number'
)
??
''
;
String
userName
=
prefs
.
getString
(
'userName'
)
??
''
;
String
totalOrder
=
prefs
.
getString
(
'total_order'
)
??
'0'
;
String
dateOrder
=
prefs
.
getString
(
'date_order'
)
??
''
;
String
branchCode
=
prefs
.
getString
(
"outlet"
)
??
''
;
String
brandCode
=
prefs
.
getString
(
"brand"
)
??
''
;
String
token
=
prefs
.
getString
(
"token"
)
??
''
;
if
(
sessionId
!=
jsonObject
[
'data'
][
'session
_id'
])
{
List
<
String
>
listHistory
=
getListHistory
()
;
String
tableNumber
=
getTabelNumber
()
;
String
userName
=
getCustomerName
()
;
String
totalOrder
=
getTotalOrder
()
;
String
dateOrder
=
getOrderDate
()
;
String
branchCode
=
getBranchPref
()
;
String
brandCode
=
getBrand
()
;
String
token
=
getToken
()
;
if
(
orderId
!=
jsonObject
[
'data'
][
'order
_id'
])
{
Map
historyOrder
=
{
"
session"
:
session
Id
,
"
order_id"
:
order
Id
,
"table"
:
tableNumber
,
"user_name"
:
userName
,
"total_order"
:
totalOrder
,
...
...
@@ -87,12 +99,14 @@ class Api {
};
String
historySave
=
jsonEncode
(
historyOrder
);
listHistory
.
add
(
historySave
);
await
prefs
.
setStringList
(
'list_history'
,
listHistory
);
setListHistory
(
listHistory
);
}
await
prefs
.
setString
(
'sessionId'
,
jsonObject
[
'data'
][
'session_id'
]);
await
prefs
.
setInt
(
'table_mode'
,
jsonObject
[
'data'
][
'table_mode'
]);
await
prefs
.
setString
(
'logoUrl'
,
jsonObject
[
'data'
][
'logo'
]);
setOrderId
(
jsonObject
[
'data'
][
'order_id'
]);
setTableMode
(
jsonObject
[
'data'
][
'table_mode'
]);
setLogoUrl
(
jsonObject
[
'data'
][
'logo'
]);
setSesssionId
(
jsonObject
[
'data'
][
'session_id'
]);
setSecretKey
(
jsonObject
[
'data'
][
'secret_key'
]);
setSessionCounter
(
jsonObject
[
'data'
][
'session_counter'
]);
//** save sessionID and Table Mode */
// return jsonObject['data']['name'];
...
...
@@ -296,13 +310,21 @@ class Api {
String
role
,
String
cashierName
,
String
tokenUser
)
async
{
String
baseUrl
=
prefs
.
getString
(
'baseUrl'
)
??
''
;
String
apiUrl
=
'
${baseUrl}
romi/api/v2/byod/get_menu'
;
String
baseUrl
=
getBaseUrl
();
String
apiUrl
=
'
$baseUrl${endPoint}
get_menu'
;
String
sessionId
=
getSessionId
();
String
signString
=
signApi
();
int
sessionC
=
getSessionCounter
();
// List<FilterMenu> filterMenu = [];
List
<
FilterMenu
>
filterMenu
=
[];
// List<FilterMenu> filterMenuResult = [];
try
{
Map
data
=
{
"session_id"
:
sessionId
,
"count"
:
sessionC
,
"sign"
:
signString
,
"branch_code"
:
branchCode
,
"brand_code"
:
brandCode
,
"role"
:
role
,
...
...
@@ -564,166 +586,172 @@ class Api {
}
}
static
Future
<
List
<
FavMenu
>>
getFavorite
(
String
branchCode
,
String
brandCode
,
String
role
,
String
cashierName
,
String
tokenUser
)
async
{
String
baseUrl
=
prefs
.
getString
(
'baseUrl'
)
??
''
;
String
apiUrl
=
'
${baseUrl}
romi/api/byod/
get_menu'
;
// List<FilterMenu> filterMenu = [];
// List<Category> category = [];
List
<
FavMenu
>
favMenu
=
[];
// List<FilterMenu> filterMenuResult = [];
try
{
Map
data
=
{
"branch_code"
:
branchCode
,
"brand_code"
:
brandCode
,
"role"
:
role
,
"cashier_name"
:
cashierName
,
"secure_token"
:
tokenUser
,
"from"
:
fromByod
};
var
bodies
=
jsonEncode
(
data
);
// var apiResult = await http.post(Uri.parse(apiUrl), body: bodies);
// var jsonObject = jsonDecode(apiResult.body);
var
jsonObject
=
await
httpPost
(
apiUrl
,
bodies
,
'getFavorite'
);
if
(
jsonObject
!=
false
)
{
if
(
jsonObject
[
'status'
].
toString
().
toLowerCase
()
==
'ok'
)
{
List
<
dynamic
>
dataFav
=
(
jsonObject
as
Map
<
dynamic
,
dynamic
>)[
'data'
][
'fav_group'
];
List
<
dynamic
>
menuFav
=
(
jsonObject
as
Map
<
dynamic
,
dynamic
>)[
'data'
][
'fav_group_detail'
];
for
(
int
d
=
0
;
d
<
dataFav
.
length
;
d
++)
{
// List<dynamic> menuList = dataCat[d]['items'];
for
(
int
i
=
0
;
i
<
menuFav
.
length
;
i
++)
{
// cocokin category id dengan item, ribet gak sih ?
if
(
menuFav
[
i
][
'favorite_group_id'
]
==
dataFav
[
d
][
'id'
])
{
List
<
dynamic
>
variantCat
=
menuFav
[
i
][
'variants'
];
List
<
VariantCategories
>
variantCategories
=
[];
for
(
int
o
=
0
;
o
<
variantCat
.
length
;
o
++)
{
List
<
Variants
>
variants
=
[];
for
(
int
j
=
0
;
j
<
variantCat
.
length
;
j
++)
{
if
(
variantCat
[
j
][
'category_variant_id'
]
==
variantCat
[
o
][
'category_variant_id'
])
{
variants
.
add
(
Variants
.
createVariant
(
variantCat
[
j
]));
}
}
Map
<
String
,
dynamic
>
dataVariantCat
=
{
"id"
:
variantCat
[
o
][
'category_variant_id'
],
"caption"
:
variantCat
[
o
][
'category_variant_caption'
],
"type"
:
variantCat
[
o
][
'category_variant_type'
],
"variants"
:
variants
};
variantCategories
.
add
(
VariantCategories
.
createVariantCategory
(
dataVariantCat
));
}
//
static Future<List<FavMenu>> getFavorite(String branchCode, String brandCode,
//
String role, String cashierName, String tokenUser) async {
// String baseUrl = getBaseUrl()
;
// String apiUrl = '$baseUrl${endPoint}
get_menu';
//
// List<FilterMenu> filterMenu = [];
//
// List<Category> category = [];
//
List<FavMenu> favMenu = [];
//
// List<FilterMenu> filterMenuResult = [];
//
try {
//
Map data = {
//
"branch_code": branchCode,
//
"brand_code": brandCode,
//
"role": role,
//
"cashier_name": cashierName,
//
"secure_token": tokenUser,
//
"from": fromByod
//
};
//
var bodies = jsonEncode(data);
//
// var apiResult = await http.post(Uri.parse(apiUrl), body: bodies);
//
// var jsonObject = jsonDecode(apiResult.body);
//
var jsonObject = await httpPost(apiUrl, bodies, 'getFavorite');
//
if (jsonObject != false) {
//
if (jsonObject['status'].toString().toLowerCase() == 'ok') {
//
List<dynamic> dataFav =
//
(jsonObject as Map<dynamic, dynamic>)['data']['fav_group'];
//
List<dynamic> menuFav =
//
(jsonObject as Map<dynamic, dynamic>)['data']['fav_group_detail'];
//
for (int d = 0; d < dataFav.length; d++) {
//
// List<dynamic> menuList = dataCat[d]['items'];
//
for (int i = 0; i < menuFav.length; i++) {
//
// cocokin category id dengan item, ribet gak sih ?
//
if (menuFav[i]['favorite_group_id'] == dataFav[d]['id']) {
//
List<dynamic> variantCat = menuFav[i]['variants'];
//
List<VariantCategories> variantCategories = [];
//
for (int o = 0; o < variantCat.length; o++) {
//
List<Variants> variants = [];
//
for (int j = 0; j < variantCat.length; j++) {
//
if (variantCat[j]['category_variant_id'] ==
//
variantCat[o]['category_variant_id']) {
//
variants.add(Variants.createVariant(variantCat[j]));
//
}
//
}
//
Map<String, dynamic> dataVariantCat = {
//
"id": variantCat[o]['category_variant_id'],
//
"caption": variantCat[o]['category_variant_caption'],
//
"type": variantCat[o]['category_variant_type'],
//
"variants": variants
//
};
//
variantCategories.add(
//
VariantCategories.createVariantCategory(dataVariantCat));
//
}
//filter yang type menu
Map
<
String
,
dynamic
>
dataFavorite
=
{
"id"
:
menuFav
[
i
][
'id'
],
"name"
:
menuFav
[
i
][
'name'
],
"price"
:
menuFav
[
i
][
'price'
],
"original_price"
:
menuFav
[
i
][
'original_price'
],
"image_medium"
:
menuFav
[
i
][
'image_medium'
],
"image_thumbnail"
:
menuFav
[
i
][
'image_thumbnail'
],
"sold_in_store"
:
menuFav
[
i
][
'sold_in_store'
],
"favorite_group_id"
:
menuFav
[
i
][
'favorite_group_id'
],
"description"
:
menuFav
[
i
][
'description'
],
"favorite_group_name"
:
menuFav
[
i
][
'favorite_group_name'
],
"group_id"
:
menuFav
[
i
][
'group_id'
],
"variant_cat"
:
variantCategories
};
//
//filter yang type menu
//
Map<String, dynamic> dataFavorite = {
//
"id": menuFav[i]['id'],
//
"name": menuFav[i]['name'],
//
"price": menuFav[i]['price'],
//
"original_price": menuFav[i]['original_price'],
//
"image_medium": menuFav[i]['image_medium'],
//
"image_thumbnail": menuFav[i]['image_thumbnail'],
//
"sold_in_store": menuFav[i]['sold_in_store'],
//
"favorite_group_id": menuFav[i]['favorite_group_id'],
//
"description": menuFav[i]['description'],
//
"favorite_group_name": menuFav[i]['favorite_group_name'],
//
"group_id": menuFav[i]['group_id'],
//
"variant_cat": variantCategories
//
};
// Map<String, dynamic> menuData = {
// "id": menuList[i]['id'],
// "name": menuList[i]['name'],
// "price": menuList[i]['price'],
// "original_price": menuList[i]['original_price'],
// "image_medium": menuList[i]['image_medium'],
// "image_thumbnail": menuList[i]['image_thumbnail'],
// "sold_in_store": menuList[i]['sold_in_store'],
// "variant_cat": variantCategories
// };
// menu.add(Menu.createMenu(menuData));
favMenu
.
add
(
FavMenu
.
createFav
(
dataFavorite
));
}
}
// Map<String, dynamic> cat = {
// "id": dataCat[d]['id'],
// "name": dataCat[d]['name'],
// "menu": menu
// };
// category.add(Category.createCategory(cat));
// Map<String, dynamic> catList = {
// "id": dataCat[d]['id'],
// "name": dataCat[d]['name'],
// };
// categoryList.add(CategoryList.createCategoryList(catList));
// filterMenuResult = filterMenu;
}
return
favMenu
;
}
else
{
FavMenu
favMenuFailed
=
FavMenu
(
id:
'0'
,
name:
''
,
price:
''
,
originalPrice:
''
,
imageUrlMedium:
''
,
imageUrlThumbnail:
''
,
isSell:
false
,
favGroupId:
''
,
description:
''
,
favGroupName:
''
,
);
//
// Map<String, dynamic> menuData = {
//
// "id": menuList[i]['id'],
//
// "name": menuList[i]['name'],
//
// "price": menuList[i]['price'],
//
// "original_price": menuList[i]['original_price'],
//
// "image_medium": menuList[i]['image_medium'],
//
// "image_thumbnail": menuList[i]['image_thumbnail'],
//
// "sold_in_store": menuList[i]['sold_in_store'],
//
// "variant_cat": variantCategories
//
// };
//
// menu.add(Menu.createMenu(menuData));
//
favMenu.add(FavMenu.createFav(dataFavorite));
//
}
//
}
//
// Map<String, dynamic> cat = {
//
// "id": dataCat[d]['id'],
//
// "name": dataCat[d]['name'],
//
// "menu": menu
//
// };
//
// category.add(Category.createCategory(cat));
//
// Map<String, dynamic> catList = {
//
// "id": dataCat[d]['id'],
//
// "name": dataCat[d]['name'],
//
// };
//
// categoryList.add(CategoryList.createCategoryList(catList));
//
// filterMenuResult = filterMenu;
//
}
//
return favMenu;
//
} else {
//
FavMenu favMenuFailed = FavMenu(
//
id: '0',
//
name: '',
//
price: '',
//
originalPrice: '',
//
imageUrlMedium: '',
//
imageUrlThumbnail: '',
//
isSell: false,
//
favGroupId: '',
//
description: '',
//
favGroupName: '',
//
);
return
[
favMenuFailed
];
}
}
else
{
return
favMenu
;
}
}
catch
(
e
)
{
if
(
debug
)
{
logd
(
'API CLASS ON API.DART, FUNGSI: getFavorite, URL :
$apiUrl
'
,
'ERROR CONNECT TO SERVER, ERROR CATCH :
$e
'
);
}
return
[];
}
}
//
return [favMenuFailed];
//
}
//
} else {
//
return favMenu;
//
}
//
} catch (e) {
//
if (debug) {
//
logd('API CLASS ON API.DART, FUNGSI: getFavorite, URL : $apiUrl',
//
'ERROR CONNECT TO SERVER, ERROR CATCH : $e');
//
}
//
return [];
//
}
//
}
static
Future
<
List
<
Bill
>>
getBill
(
String
branchCode
,
String
brandCode
,
String
tableNumber
,
String
token
,
{
String
session
IdH
=
''
,
String
order
IdH
=
''
,
String
userNameH
=
''
,
})
async
{
String
baseUrl
=
prefs
.
getString
(
'baseUrl'
)
??
''
;
String
apiUrl
=
"
$
{baseUrl}
romi/api/byod/view
_bill"
;
String
baseUrl
=
getBaseUrl
()
;
String
apiUrl
=
"
$
baseUrl${endPoint}
get
_bill"
;
String
role
=
prefs
.
getString
(
'role'
)
??
'customer'
;
String
cashierName
=
prefs
.
getString
(
'cashier_name'
)
??
''
;
String
role
=
getRole
()
;
String
cashierName
=
getCashierName
()
;
String
userName
;
String
session
Id
;
if
(
session
IdH
==
''
)
{
userName
=
prefs
.
getString
(
'userName'
)
??
''
;
sessionId
=
prefs
.
getString
(
'sessionId'
)
??
''
;
String
order
Id
;
if
(
order
IdH
==
''
)
{
userName
=
getCustomerName
()
;
orderId
=
getOrderId
()
;
}
else
{
userName
=
userNameH
;
sessionId
=
session
IdH
;
orderId
=
order
IdH
;
}
String
sessionId
=
getSessionId
();
String
signString
=
signApi
();
int
sessionC
=
getSessionCounter
();
try
{
Map
data
=
{
"session_id"
:
sessionId
,
"count"
:
sessionC
,
"sign"
:
signString
,
"branch_code"
:
branchCode
,
"brand_code"
:
brandCode
,
"table_number"
:
tableNumber
,
"role"
:
role
,
"cashier_name"
:
cashierName
,
"
session_id"
:
session
Id
,
"
order_id"
:
order
Id
,
"customer_name"
:
userName
,
"from"
:
fromByod
};
...
...
@@ -851,22 +879,29 @@ class Api {
}
static
Future
<
List
<
dynamic
>>
checkVoucher
(
String
codeVoucher
)
async
{
String
baseUrl
=
prefs
.
getString
(
'baseUrl'
)
??
''
;
String
apiUrl
=
"
$
{baseUrl}
romi/api/byod/
check_voucher"
;
String
baseUrl
=
getBaseUrl
()
;
String
apiUrl
=
"
$
baseUrl${endPoint}
check_voucher"
;
List
<
dynamic
>
voucherDetail
=
[];
String
token
=
prefs
.
getString
(
'token'
)
??
''
;
String
role
=
prefs
.
getString
(
'role'
)
??
''
;
String
cashierName
=
prefs
.
getString
(
'cashier_name'
)
??
''
;
String
brandCode
=
prefs
.
getString
(
'brand'
)
??
''
;
String
branchCode
=
prefs
.
getString
(
'outlet'
)
??
''
;
String
orderId
=
prefs
.
getString
(
'sessionId'
)
??
''
;
String
token
=
getToken
()
;
String
role
=
getRole
()
;
String
cashierName
=
getCashierName
()
;
String
brandCode
=
getBrand
()
;
String
branchCode
=
getBranchPref
()
;
String
orderId
=
getOrderId
()
;
await
EasyLoading
.
show
(
status:
'Check Voucher....'
,
maskType:
EasyLoadingMaskType
.
none
,
);
String
sessionId
=
getSessionId
();
String
signString
=
signApi
();
int
sessionC
=
getSessionCounter
();
try
{
Map
data
=
{
"session_id"
:
sessionId
,
"count"
:
sessionC
,
"sign"
:
signString
,
"voucher_code"
:
codeVoucher
,
"secure_token"
:
token
,
"role"
:
role
,
...
...
@@ -911,17 +946,24 @@ class Api {
}
static
Future
<
List
<
VoucherList
>>
getVoucherList
()
async
{
String
baseUrl
=
prefs
.
getString
(
'baseUrl'
)
??
''
;
String
apiUrl
=
"
$
{baseUrl}
romi/api/byod/
get_voucher_list"
;
String
baseUrl
=
getBaseUrl
()
;
String
apiUrl
=
"
$
baseUrl${endPoint}
get_voucher_list"
;
List
<
VoucherList
>
voucherList
=
[];
String
token
=
prefs
.
getString
(
'token'
)
??
''
;
String
role
=
prefs
.
getString
(
'role'
)
??
''
;
String
cashierName
=
prefs
.
getString
(
'cashier_name'
)
??
''
;
String
brandCode
=
prefs
.
getString
(
'brand'
)
??
''
;
String
branchCode
=
prefs
.
getString
(
'outlet'
)
??
''
;
String
token
=
getToken
();
String
role
=
getRole
();
String
cashierName
=
getCashierName
();
String
brandCode
=
getBrand
();
String
branchCode
=
getBranchPref
();
String
sessionId
=
getSessionId
();
String
signString
=
signApi
();
int
sessionC
=
getSessionCounter
();
try
{
Map
data
=
{
"session_id"
:
sessionId
,
"count"
:
sessionC
,
"sign"
:
signString
,
"secure_token"
:
token
,
"role"
:
role
,
"cashier_name"
:
cashierName
,
...
...
@@ -973,16 +1015,23 @@ class Api {
static
Future
<
bool
>
setWaiting
(
String
orderId
,
String
branchCode
,
String
brandCode
,
String
customerName
)
async
{
String
baseUrl
=
prefs
.
getString
(
'baseUrl'
)
??
''
;
String
apiUrl
=
"
$
{baseUrl}
romi/api/byod/
waiting_order"
;
String
baseUrl
=
getBaseUrl
()
;
String
apiUrl
=
"
$
baseUrl${endPoint}
waiting_order"
;
await
EasyLoading
.
show
(
status:
'Harap tunggu...'
,
maskType:
EasyLoadingMaskType
.
none
,
);
String
sessionId
=
getSessionId
();
String
signString
=
signApi
();
int
sessionC
=
getSessionCounter
();
try
{
Map
data
=
{
"session_id"
:
sessionId
,
"count"
:
sessionC
,
"sign"
:
signString
,
"branch_code"
:
branchCode
,
"brand_code"
:
brandCode
,
"order_id"
:
orderId
,
...
...
@@ -1026,16 +1075,23 @@ class Api {
int
paymentType
,
String
codeVoucher
,
int
amount
)
async
{
String
baseUrl
=
prefs
.
getString
(
'baseUrl'
)
??
''
;
String
apiUrl
=
"
$
{baseUrl}
romi/api/byod/
add_payments"
;
String
token
=
prefs
.
getString
(
'token'
)
??
''
;
String
baseUrl
=
getBaseUrl
()
;
String
apiUrl
=
"
$
baseUrl${endPoint}
add_payments"
;
String
token
=
getToken
()
;
await
EasyLoading
.
show
(
status:
'Harap tunggu...'
,
maskType:
EasyLoadingMaskType
.
none
,
);
String
sessionId
=
getSessionId
();
String
signString
=
signApi
();
int
sessionC
=
getSessionCounter
();
try
{
Map
data
=
{
"session_id"
:
sessionId
,
"count"
:
sessionC
,
"sign"
:
signString
,
"branch_code"
:
branchCode
,
"brand_code"
:
brandCode
,
"order_id"
:
orderId
,
...
...
@@ -1056,13 +1112,13 @@ class Api {
if
(
jsonObject
[
'status'
].
toString
().
toLowerCase
()
==
'ok'
)
{
await
EasyLoading
.
dismiss
();
if
(
method
==
payCard
)
{
if
(
jsonObject
[
'url'
]
!=
null
)
{
if
(
jsonObject
[
'
data'
][
'
url'
]
!=
null
)
{
await
EasyLoading
.
dismiss
();
// Navigator.pushReplacement(
// context, MaterialPageRoute(builder: (_) => const ViewBill()));
// js.context.callMethod('open', [jsonObject['url']]);
htmlOpenLink
(
jsonObject
[
'url'
]);
return
jsonObject
[
'url'
];
// js.context.callMethod('open', [
['data']
jsonObject['url']]);
htmlOpenLink
(
jsonObject
[
'
data'
][
'
url'
]);
return
jsonObject
[
'
data'
][
'
url'
];
}
else
{
await
EasyLoading
.
dismiss
();
EasyLoading
.
showToast
(
...
...
@@ -1114,16 +1170,23 @@ class Api {
static
Future
<
bool
>
deletePayment
(
String
branchCode
,
String
brandCode
,
String
paymentId
,
String
customerName
,
String
cashierName
)
async
{
String
baseUrl
=
prefs
.
getString
(
'baseUrl'
)
??
''
;
String
apiUrl
=
"
$
{baseUrl}
romi/api/byod/
delete_payment"
;
String
baseUrl
=
getBaseUrl
()
;
String
apiUrl
=
"
$
baseUrl${endPoint}
delete_payment"
;
await
EasyLoading
.
show
(
status:
'Harap tunggu...'
,
maskType:
EasyLoadingMaskType
.
none
,
);
String
sessionId
=
getSessionId
();
String
signString
=
signApi
();
int
sessionC
=
getSessionCounter
();
try
{
Map
data
=
{
"session_id"
:
sessionId
,
"count"
:
sessionC
,
"sign"
:
signString
,
"branch_code"
:
branchCode
,
"brand_code"
:
brandCode
,
"payment_id"
:
paymentId
,
...
...
@@ -1170,22 +1233,29 @@ class Api {
String
brand
,
String
tableNumber
,
String
namaPelangganFix
)
async
{
String
baseUrl
=
prefs
.
getString
(
'baseUrl'
)
??
''
;
String
apiUrl
=
"
${baseUrl}
romi/api/byod/checkout"
;
String
role
=
prefs
.
getString
(
'role'
)
??
'custome'
;
String
cashierName
=
prefs
.
getString
(
'cashier_name'
)
??
''
;
String
sessionId
=
prefs
.
getString
(
'sessionId'
)
??
''
;
String
secureToken
=
prefs
.
getString
(
'token'
)
??
''
;
String
baseUrl
=
getBaseUrl
();
String
apiUrl
=
"
$baseUrl${endPoint}
checkout"
;
String
role
=
getRole
();
String
cashierName
=
getCashierName
();
String
orderId
=
getOrderId
();
String
secureToken
=
getToken
();
String
sessionId
=
getSessionId
();
String
signString
=
signApi
();
int
sessionC
=
getSessionCounter
();
try
{
Map
data
=
{
"session_id"
:
sessionId
,
"count"
:
sessionC
,
"sign"
:
signString
,
"branch_code"
:
branchCode
,
"brand_code"
:
brand
,
"table_number"
:
tableNumber
,
"customer_name"
:
namaPelangganFix
,
"role"
:
role
,
"cashier_name"
:
cashierName
,
"
session_id"
:
session
Id
,
"
order_id"
:
order
Id
,
"menu"
:
variantData
,
'secure_token'
:
secureToken
,
"from"
:
fromByod
...
...
@@ -1233,14 +1303,21 @@ class Api {
static
Future
<
bool
>
softLockTable
(
String
branchCode
,
String
brandCode
,
String
orderId
,
{
String
role
=
''
,
String
cashierName
=
''
})
async
{
String
baseUrl
=
prefs
.
getString
(
'baseUrl'
)
??
''
;
String
apiUrl
=
"
$
{baseUrl}
romi/api/byod/
softlock_table"
;
String
baseUrl
=
getBaseUrl
()
;
String
apiUrl
=
"
$
baseUrl${endPoint}
softlock_table"
;
await
EasyLoading
.
show
(
status:
'Harap tunggu...'
,
maskType:
EasyLoadingMaskType
.
none
,
);
String
sessionId
=
getSessionId
();
String
signString
=
signApi
();
int
sessionC
=
getSessionCounter
();
try
{
Map
data
=
{
"session_id"
:
sessionId
,
"count"
:
sessionC
,
"sign"
:
signString
,
"branch_code"
:
branchCode
,
"brand_code"
:
brandCode
,
"order_id"
:
orderId
,
...
...
@@ -1275,19 +1352,26 @@ class Api {
}
static
Future
<
bool
>
deleteOrderDetail
(
String
orderIdDetail
)
async
{
String
branchCode
=
prefs
.
getString
(
'outlet'
)
??
''
;
String
customerName
=
prefs
.
getString
(
'userName'
)
??
''
;
String
brandCode
=
prefs
.
getString
(
'brand'
)
??
''
;
String
role
=
prefs
.
getString
(
'role'
)
??
'customer'
;
String
cashierName
=
prefs
.
getString
(
'cashier_name'
)
??
'customer'
;
String
baseUrl
=
prefs
.
getString
(
'baseUrl'
)
??
''
;
String
apiUrl
=
"
$
{baseUrl}
romi/api/byod/
delete_order_detail"
;
String
branchCode
=
getBranchPref
()
;
String
customerName
=
getCustomerName
()
;
String
brandCode
=
getBrand
()
;
String
role
=
getRole
()
;
String
cashierName
=
getCashierName
()
;
String
baseUrl
=
getBaseUrl
()
;
String
apiUrl
=
"
$
baseUrl${endPoint}
delete_order_detail"
;
await
EasyLoading
.
show
(
status:
'Harap tunggu...'
,
maskType:
EasyLoadingMaskType
.
none
,
);
String
sessionId
=
getSessionId
();
String
signString
=
signApi
();
int
sessionC
=
getSessionCounter
();
try
{
Map
data
=
{
"session_id"
:
sessionId
,
"count"
:
sessionC
,
"sign"
:
signString
,
"branch_code"
:
branchCode
,
"brand_code"
:
brandCode
,
"order_detail_id"
:
orderIdDetail
,
...
...
@@ -1367,14 +1451,21 @@ class Api {
promotionCode:
''
,
tier:
''
,
balance:
''
);
String
baseUrl
=
prefs
.
getString
(
'baseUrl'
)
??
''
;
String
apiUrl
=
"
${baseUrl}
romi/api/byod/get_member_info"
;
String
branchCode
=
prefs
.
getString
(
'outlet'
)
??
''
;
String
brandCode
=
prefs
.
getString
(
'brand'
)
??
''
;
String
role
=
prefs
.
getString
(
'role'
)
??
'customer'
;
String
cashierName
=
prefs
.
getString
(
'cashier_name'
)
??
''
;
String
baseUrl
=
getBaseUrl
();
String
apiUrl
=
"
$baseUrl${endPoint}
get_member_info"
;
String
branchCode
=
getBranchPref
();
String
brandCode
=
getBrand
();
String
role
=
getRole
();
String
cashierName
=
getCashierName
();
String
sessionId
=
getSessionId
();
String
signString
=
signApi
();
int
sessionC
=
getSessionCounter
();
try
{
Map
data
=
{
"session_id"
:
sessionId
,
"count"
:
sessionC
,
"sign"
:
signString
,
"secure_token"
:
token
,
"role"
:
role
,
"cashier_name"
:
cashierName
,
...
...
@@ -1388,7 +1479,7 @@ class Api {
if
(
jsonObject
[
'status'
].
toString
().
toLowerCase
()
==
'ok'
)
{
memberInfo
=
MemberInfo
.
getInfo
((
jsonObject
as
Map
<
dynamic
,
dynamic
>)[
'data'
]);
await
prefs
.
setString
(
'userName'
,
jsonObject
[
'data'
][
'name'
]);
setCustomerName
(
jsonObject
[
'data'
][
'name'
]);
}
return
memberInfo
;
}
else
{
...
...
@@ -1410,18 +1501,25 @@ class Api {
String
brandCode
,
String
customerName
,
int
amount
)
async
{
String
baseUrl
=
prefs
.
getString
(
'baseUrl'
)
??
''
;
String
apiUrl
=
"
$
{baseUrl}
romi/api/byod/
add_payment_balance"
;
String
baseUrl
=
getBaseUrl
()
;
String
apiUrl
=
"
$
baseUrl${endPoint}
add_payment_balance"
;
await
EasyLoading
.
show
(
status:
'Harap tunggu...'
,
maskType:
EasyLoadingMaskType
.
none
,
);
String
role
=
prefs
.
getString
(
'role'
)
??
'customer'
;
String
cashierName
=
prefs
.
getString
(
'cashier_name'
)
??
''
;
String
token
=
prefs
.
getString
(
'token'
)
??
''
;
String
role
=
getRole
();
String
cashierName
=
getCashierName
();
String
token
=
getToken
();
String
sessionId
=
getSessionId
();
String
signString
=
signApi
();
int
sessionC
=
getSessionCounter
();
try
{
Map
data
=
{
"session_id"
:
sessionId
,
"count"
:
sessionC
,
"sign"
:
signString
,
"branch_code"
:
branchCode
,
"brand_code"
:
brandCode
,
"order_id"
:
orderId
,
...
...
@@ -1467,19 +1565,26 @@ class Api {
}
static
Future
<
String
>
checkStatusPaymentUrl
(
String
paymentId
)
async
{
String
baseUrl
=
prefs
.
getString
(
'baseUrl'
)
??
''
;
String
apiUrl
=
"
$
{baseUrl}
romi/api/byod/
check_status"
;
String
baseUrl
=
getBaseUrl
()
;
String
apiUrl
=
"
$
baseUrl${endPoint}
check_status"
;
String
branchCode
=
prefs
.
getString
(
'outlet'
)
??
''
;
String
brandCode
=
prefs
.
getString
(
'brand'
)
??
''
;
String
role
=
prefs
.
getString
(
'role'
)
??
'customer'
;
String
cashierName
=
prefs
.
getString
(
'cashier_name'
)
??
''
;
String
branchCode
=
getBranchPref
()
;
String
brandCode
=
getBrand
()
;
String
role
=
getRole
()
;
String
cashierName
=
getCashierName
()
;
await
EasyLoading
.
show
(
status:
'Geting url...'
,
maskType:
EasyLoadingMaskType
.
none
,
);
String
sessionId
=
getSessionId
();
String
signString
=
signApi
();
int
sessionC
=
getSessionCounter
();
try
{
Map
data
=
{
"session_id"
:
sessionId
,
"count"
:
sessionC
,
"sign"
:
signString
,
"branch_code"
:
branchCode
,
"brand_code"
:
brandCode
,
"role"
:
role
,
...
...
@@ -1521,16 +1626,23 @@ class Api {
static
Future
<
bool
>
changeOrderDetail
(
BuildContext
context
,
String
orderDetail
,
int
quantity
,
String
notes
)
async
{
String
baseUrl
=
prefs
.
getString
(
'baseUrl'
)
??
''
;
String
apiUrl
=
"
$
{baseUrl}
romi/api/byod/
update_order_detail"
;
String
baseUrl
=
getBaseUrl
()
;
String
apiUrl
=
"
$
baseUrl${endPoint}
update_order_detail"
;
String
branchCode
=
prefs
.
getString
(
'outlet'
)
??
''
;
String
brandCode
=
prefs
.
getString
(
'brand'
)
??
''
;
String
role
=
prefs
.
getString
(
'role'
)
??
'customer'
;
String
cashierName
=
prefs
.
getString
(
'cashier_name'
)
??
''
;
String
branchCode
=
getBranchPref
();
String
brandCode
=
getBrand
();
String
role
=
getRole
();
String
cashierName
=
getCashierName
();
String
sessionId
=
getSessionId
();
String
signString
=
signApi
();
int
sessionC
=
getSessionCounter
();
try
{
Map
data
=
{
"session_id"
:
sessionId
,
"count"
:
sessionC
,
"sign"
:
signString
,
"branch_code"
:
branchCode
,
"brand_code"
:
brandCode
,
"order_detail_id"
:
orderDetail
,
...
...
@@ -1569,22 +1681,29 @@ class Api {
static
Future
<
bool
>
sendFeedBack
(
int
feedBack
,
String
message
,
String
orderId
,
List
<
String
>
feedbackOptions
)
async
{
String
baseUrl
=
prefs
.
getString
(
'baseUrl'
)
??
''
;
String
apiUrl
=
"
$
{baseUrl}
romi/api/byod/
feedback"
;
String
baseUrl
=
getBaseUrl
()
;
String
apiUrl
=
"
$
baseUrl${endPoint}
send_
feedback"
;
String
branchCode
=
prefs
.
getString
(
'outlet'
)
??
''
;
String
brandCode
=
prefs
.
getString
(
'brand'
)
??
''
;
String
role
=
prefs
.
getString
(
'role'
)
??
'customer'
;
String
cashierName
=
prefs
.
getString
(
'cashier_name'
)
??
''
;
String
userName
=
prefs
.
getString
(
'userName'
)
??
''
;
String
branchCode
=
getBranchPref
()
;
String
brandCode
=
getBrand
()
;
String
role
=
getRole
()
;
String
cashierName
=
getCashierName
()
;
String
userName
=
getCustomerName
()
;
await
EasyLoading
.
show
(
status:
'Mengirim penilaian'
,
maskType:
EasyLoadingMaskType
.
none
,
);
String
sessionId
=
getSessionId
();
String
signString
=
signApi
();
int
sessionC
=
getSessionCounter
();
try
{
Map
data
=
{
"session_id"
:
sessionId
,
"count"
:
sessionC
,
"sign"
:
signString
,
"branch_code"
:
branchCode
,
"brand_code"
:
brandCode
,
"role"
:
role
,
...
...
@@ -1625,18 +1744,25 @@ class Api {
}
static
Future
<
List
<
FeedBackOption
>>
getOptionFeedback
()
async
{
String
baseUrl
=
prefs
.
getString
(
'baseUrl'
)
??
''
;
String
apiUrl
=
"
$
{baseUrl}
romi/api/byod/
get_feedback_options"
;
String
branchCode
=
prefs
.
getString
(
'outlet'
)
??
''
;
String
brandCode
=
prefs
.
getString
(
'brand'
)
??
''
;
String
role
=
prefs
.
getString
(
'role'
)
??
'customer'
;
String
cashierName
=
prefs
.
getString
(
'cashier_name'
)
??
''
;
String
userName
=
prefs
.
getString
(
'userName'
)
??
''
;
String
baseUrl
=
getBaseUrl
()
;
String
apiUrl
=
"
$
baseUrl${endPoint}
get_feedback_options"
;
String
branchCode
=
getBranchPref
()
;
String
brandCode
=
getBrand
()
;
String
role
=
getRole
()
;
String
cashierName
=
getCashierName
()
;
String
userName
=
getCustomerName
()
;
List
<
FeedBackOption
>
feedBack
=
[];
String
sessionId
=
getSessionId
();
String
signString
=
signApi
();
int
sessionC
=
getSessionCounter
();
try
{
Map
data
=
{
"session_id"
:
sessionId
,
"count"
:
sessionC
,
"sign"
:
signString
,
"branch_code"
:
branchCode
,
"brand_code"
:
brandCode
,
"role"
:
role
,
...
...
lib/bloc/branch_exist.dart
View file @
f80b3813
import
'package:flutter/cupertino.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'../api/api.dart'
;
import
'../helper/helper.dart'
;
import
'filter_menu.dart'
;
class
BranchExist
extends
Cubit
<
String
>
{
BranchExist
()
:
super
(
responseApiWaiting
);
Future
<
String
>
getBranch
(
String
branchCode
,
String
brandCode
,
String
role
,
String
cashierName
,
String
session
Id
)
async
{
var
apiGetBranch
=
await
Api
.
getBranch
(
branchCode
,
brandCode
,
role
,
cashierName
,
session
Id
);
String
cashierName
,
String
order
Id
)
async
{
var
apiGetBranch
=
await
Api
.
getBranch
(
branchCode
,
brandCode
,
role
,
cashierName
,
order
Id
);
return
apiGetBranch
;
}
void
branchExist
(
String
branchCode
,
String
brandCode
,
String
role
,
String
cashierName
,
String
sessionId
)
{
getBranch
(
branchCode
,
brandCode
,
role
,
cashierName
,
sessionId
)
.
then
((
value
)
{
String
cashierName
,
String
orderId
,
BuildContext
context
,
{
bool
getMenu
=
false
})
{
getBranch
(
branchCode
,
brandCode
,
role
,
cashierName
,
orderId
).
then
((
value
)
{
if
(
getMenu
)
{
context
.
read
<
FilterMenuBloc
>()
.
catAndMenu
(
branchCode
,
brandCode
,
role
,
cashierName
,
orderId
);
}
emit
(
value
);
});
}
...
...
lib/bloc/view_bill.dart
View file @
f80b3813
import
'package:byod/helper/prefs.dart'
;
import
'package:byod/models/bill.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'../api/api.dart'
;
import
'../helper/helper.dart'
;
import
'../main.dart'
;
class
ViewBillBloc
extends
Cubit
<
List
<
Bill
>>
{
ViewBillBloc
()
...
...
@@ -29,7 +29,7 @@ class ViewBillBloc extends Cubit<List<Bill>> {
)
]);
void
getBill
({
String
session
IdH
=
''
,
String
order
IdH
=
''
,
String
branchCodeH
=
''
,
String
brandCodeH
=
''
,
String
tableNumberH
=
''
,
...
...
@@ -40,20 +40,20 @@ class ViewBillBloc extends Cubit<List<Bill>> {
String
brandCode
;
String
tableNumber
;
String
token
;
if
(
session
IdH
!=
''
)
{
if
(
order
IdH
!=
''
)
{
// for history view
branchCode
=
branchCodeH
;
brandCode
=
brandCodeH
;
tableNumber
=
tableNumberH
;
token
=
tokenH
;
}
else
{
branchCode
=
prefs
.
getString
(
"outlet"
)
??
''
;
brandCode
=
prefs
.
getString
(
"brand"
)
??
''
;
tableNumber
=
prefs
.
getString
(
"table_number"
)
??
''
;
token
=
prefs
.
getString
(
"token"
)
??
''
;
branchCode
=
getBranchPref
()
;
brandCode
=
getBrand
()
;
tableNumber
=
getTabelNumber
()
;
token
=
getToken
()
;
}
List
<
Bill
>
bill
;
if
(
session
IdH
==
''
)
{
if
(
order
IdH
==
''
)
{
bill
=
await
Api
.
getBill
(
branchCode
,
brandCode
,
...
...
@@ -66,7 +66,7 @@ class ViewBillBloc extends Cubit<List<Bill>> {
brandCode
,
tableNumber
,
token
,
sessionIdH:
session
IdH
,
orderIdH:
order
IdH
,
userNameH:
userNameH
,
);
}
...
...
lib/helper/helper.dart
View file @
f80b3813
...
...
@@ -2,6 +2,8 @@
import
'dart:convert'
;
import
'package:byod/helper/prefs.dart'
;
import
'package:crypto/crypto.dart'
;
import
'package:flutter/material.dart'
;
import
'package:intl/intl.dart'
;
import
'package:http/http.dart'
as
http
;
...
...
@@ -244,6 +246,21 @@ String localDate(String date, {isHistory = false}) {
//** convert UTC to local */
//** Generate SIGN */
String
signApi
(
)
{
String
secretKey
=
getSecretKey
();
int
sessionCounter
=
getSessionCounter
();
int
sessionC
=
sessionCounter
+
1
;
List
<
int
>
bytes
=
utf8
.
encode
(
"
$secretKey$sessionC
"
);
Digest
digest
=
sha256
.
convert
(
bytes
);
String
signString
=
digest
.
toString
();
setSessionCounterPlus
(
sessionCounter
);
return
signString
;
}
//** Generate SIGN */
//** END FUNCTION */
//** START CONSTANT */
...
...
lib/helper/prefs.dart
0 → 100644
View file @
f80b3813
import
'package:byod/helper/helper.dart'
;
import
'../main.dart'
;
const
String
_orderId
=
'order_id'
;
const
String
_secretKey
=
'secret_key'
;
const
String
_sessionCounter
=
'session_counter'
;
const
String
_sessionId
=
'session_id'
;
const
String
_baseUrl
=
'baseUrl'
;
const
String
_tableNumber
=
'table_number'
;
const
String
_tableMode
=
'table_mode'
;
const
String
_customerName
=
'userName'
;
const
String
_totalOrder
=
'total_order'
;
const
String
_dateOrder
=
'date_order'
;
const
String
_branch
=
'outlet'
;
const
String
_brand
=
'brand'
;
const
String
_token
=
'token'
;
const
String
_listHistory
=
'list_history'
;
const
String
_logo
=
'logo'
;
const
String
_role
=
'role'
;
const
String
_cashierName
=
'cashier_name'
;
String
getBaseUrl
(
)
{
return
prefs
.
getString
(
_baseUrl
)
??
''
;
}
Future
<
void
>
setBaseUrl
(
String
value
)
async
{
prefs
.
setString
(
_baseUrl
,
value
);
}
String
getOrderId
(
)
{
return
prefs
.
getString
(
_orderId
)
??
''
;
}
Future
<
void
>
setOrderId
(
String
value
)
async
{
prefs
.
setString
(
_orderId
,
value
);
}
String
getSecretKey
(
)
{
return
prefs
.
getString
(
_secretKey
)
??
''
;
}
Future
<
void
>
setSecretKey
(
String
value
)
async
{
prefs
.
setString
(
_secretKey
,
value
);
}
int
getSessionCounter
(
)
{
return
prefs
.
getInt
(
_sessionCounter
)
??
0
;
}
Future
<
void
>
setSessionCounter
(
int
value
)
async
{
prefs
.
setInt
(
_sessionCounter
,
value
);
}
Future
<
void
>
setSessionCounterPlus
(
int
value
)
async
{
prefs
.
setInt
(
_sessionCounter
,
value
+
1
);
}
String
getSessionId
(
)
{
return
prefs
.
getString
(
_sessionId
)
??
''
;
}
Future
<
void
>
setSesssionId
(
String
value
)
async
{
prefs
.
setString
(
_sessionId
,
value
);
}
String
getTabelNumber
(
)
{
return
prefs
.
getString
(
_tableNumber
)
??
''
;
}
Future
<
void
>
setTableNumber
(
String
value
)
async
{
prefs
.
setString
(
_tableNumber
,
value
);
}
String
getCustomerName
(
)
{
return
prefs
.
getString
(
_customerName
)
??
''
;
}
Future
<
void
>
setCustomerName
(
String
value
)
async
{
prefs
.
setString
(
_customerName
,
value
);
}
String
getTotalOrder
(
)
{
return
prefs
.
getString
(
_totalOrder
)
??
''
;
}
Future
<
void
>
setTotalOrder
(
String
value
)
async
{
prefs
.
setString
(
_totalOrder
,
value
);
}
String
getOrderDate
(
)
{
return
prefs
.
getString
(
_dateOrder
)
??
''
;
}
Future
<
void
>
setOrderDate
(
String
value
)
async
{
prefs
.
setString
(
_dateOrder
,
value
);
}
String
getBranchPref
(
)
{
return
prefs
.
getString
(
_branch
)
??
''
;
}
Future
<
void
>
setBranch
(
String
value
)
async
{
prefs
.
setString
(
_branch
,
value
);
}
String
getBrand
(
)
{
return
prefs
.
getString
(
_brand
)
??
''
;
}
Future
<
void
>
setBrand
(
String
value
)
async
{
prefs
.
setString
(
_brand
,
value
);
}
String
getToken
(
)
{
return
prefs
.
getString
(
_token
)
??
''
;
}
Future
<
void
>
setToken
(
String
value
)
async
{
prefs
.
setString
(
_token
,
value
);
}
List
<
String
>
getListHistory
()
{
return
prefs
.
getStringList
(
_listHistory
)
??
[];
}
Future
<
void
>
setListHistory
(
List
<
String
>
value
)
async
{
prefs
.
setStringList
(
_listHistory
,
value
);
}
int
getTableMode
(
)
{
return
prefs
.
getInt
(
_tableMode
)
??
defaultTable
;
}
Future
<
void
>
setTableMode
(
int
value
)
async
{
prefs
.
setInt
(
_tableMode
,
value
);
}
String
getLogoUrl
(
)
{
return
prefs
.
getString
(
_logo
)
??
''
;
}
Future
<
void
>
setLogoUrl
(
String
value
)
async
{
prefs
.
setString
(
_logo
,
value
);
}
String
getRole
(
)
{
return
prefs
.
getString
(
_role
)
??
'customer'
;
}
Future
<
void
>
setRole
(
String
value
)
async
{
prefs
.
setString
(
_role
,
value
);
}
String
getCashierName
(
)
{
return
prefs
.
getString
(
_cashierName
)
??
''
;
}
Future
<
void
>
setCashierName
(
String
value
)
async
{
prefs
.
setString
(
_cashierName
,
value
);
}
lib/helper/widget/emoticon_rate.dart
View file @
f80b3813
...
...
@@ -3,6 +3,7 @@
import
'dart:convert'
;
import
'package:byod/bloc/feedback_option.dart'
;
import
'package:byod/helper/prefs.dart'
;
import
'package:byod/main.dart'
;
import
'package:byod/models/bill.dart'
;
import
'package:byod/models/feedback_option.dart'
;
...
...
@@ -298,19 +299,18 @@ class _EmoticonRateState extends State<EmoticonRate> {
if
(!
widget
.
isHistory
)
{
context
.
read
<
ViewBillBloc
>().
getBill
();
}
else
{
List
<
String
>
listHistory
=
prefs
.
getStringList
(
'list_history'
)
??
[];
List
<
String
>
listHistory
=
getListHistory
();
if
(
listHistory
.
isNotEmpty
)
{
int
indexHistory
=
listHistory
.
indexWhere
(
(
listHistory
)
=>
jsonDecode
(
listHistory
)[
'
session
'
]
==
jsonDecode
(
listHistory
)[
'
order_id
'
]
==
widget
.
sessionId
,
);
if
(
indexHistory
!=
-
1
)
{
dynamic
jsonDecodeHistory
=
jsonDecode
(
listHistory
[
indexHistory
]);
context
.
read
<
ViewBillBloc
>().
getBill
(
sessionIdH:
jsonDecodeHistory
[
'session
'
],
orderIdH:
jsonDecodeHistory
[
'order_id
'
],
branchCodeH:
jsonDecodeHistory
[
'branch_code'
],
brandCodeH:
jsonDecodeHistory
[
'brand'
],
...
...
lib/helper/widget/emoticon_rate_new.dart
View file @
f80b3813
import
'dart:convert'
;
import
'package:byod/helper/prefs.dart'
;
import
'package:byod/helper/widget/style.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
...
...
@@ -22,14 +23,14 @@ class EmoticonRateNew extends StatelessWidget {
required
this
.
rateNote
,
required
this
.
isHistory
,
required
this
.
dataBill
,
this
.
sessionID
=
''
,
this
.
orderId
=
''
,
})
:
super
(
key:
key
);
final
double
sizeImage
;
final
TextEditingController
rateNote
;
final
bool
isHistory
;
final
List
<
Bill
>
dataBill
;
final
String
sessionID
;
final
String
orderId
;
@override
Widget
build
(
BuildContext
context
)
{
...
...
@@ -242,19 +243,18 @@ class EmoticonRateNew extends StatelessWidget {
if
(!
isHistory
)
{
context
.
read
<
ViewBillBloc
>().
getBill
();
}
else
{
List
<
String
>
listHistory
=
prefs
.
getStringList
(
'list_history'
)
??
[];
List
<
String
>
listHistory
=
getListHistory
();
if
(
listHistory
.
isNotEmpty
)
{
int
indexHistory
=
listHistory
.
indexWhere
(
(
listHistory
)
=>
jsonDecode
(
listHistory
)[
'
session
'
]
==
sessionID
,
jsonDecode
(
listHistory
)[
'
order_id
'
]
==
orderId
,
);
if
(
indexHistory
!=
-
1
)
{
dynamic
jsonDecodeHistory
=
jsonDecode
(
listHistory
[
indexHistory
]);
context
.
read
<
ViewBillBloc
>().
getBill
(
sessionIdH:
jsonDecodeHistory
[
'session
'
],
orderIdH:
jsonDecodeHistory
[
'order_id
'
],
branchCodeH:
jsonDecodeHistory
[
'branch_code'
],
brandCodeH:
jsonDecodeHistory
[
'brand'
],
...
...
lib/main.dart
View file @
f80b3813
...
...
@@ -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/prefs.dart'
;
import
'package:byod/ui/no_route.dart'
;
import
'package:byod/ui/splash.dart'
;
import
'package:flutter/material.dart'
;
...
...
@@ -123,12 +124,12 @@ class MyApp extends StatelessWidget {
//** UUID */
//** Check Session ID */
String
current
SessionId
=
prefs
.
getString
(
'sessionId'
)
??
''
;
String
session
Id
;
if
(
current
Session
Id
!=
''
)
{
sessionId
=
currentSession
Id
;
String
current
OrderId
=
getOrderId
()
;
String
order
Id
;
if
(
current
Order
Id
!=
''
)
{
orderId
=
currentOrder
Id
;
}
else
{
session
Id
=
uuid
;
order
Id
=
uuid
;
}
//** Check Session ID */
...
...
@@ -186,7 +187,7 @@ class MyApp extends StatelessWidget {
role:
roleStrg
,
cashierName:
cashierNameStrg
,
toBill:
toBill
,
sessionId:
session
Id
,
orderId:
order
Id
,
token:
tokenUser
));
}
else
if
(
uri
.
pathSegments
.
length
==
4
)
{
brandStrg
=
uri
.
pathSegments
.
first
;
...
...
@@ -208,7 +209,7 @@ class MyApp extends StatelessWidget {
role:
roleStrg
,
cashierName:
cashierNameStrg
,
toBill:
toBill
,
sessionId:
session
Id
,
orderId:
order
Id
,
token:
tokenUser
));
}
else
if
(
uri
.
pathSegments
.
length
==
5
)
{
brandStrg
=
uri
.
pathSegments
.
first
;
...
...
@@ -232,7 +233,7 @@ class MyApp extends StatelessWidget {
role:
roleStrg
,
cashierName:
cashierNameStrg
,
toBill:
toBill
,
sessionId:
session
Id
,
orderId:
order
Id
,
token:
tokenUser
));
}
return
null
;
...
...
lib/ui/checkout/checkout.dart
View file @
f80b3813
// ignore_for_file: unnecessary_brace_in_string_interps, sized_box_for_whitespace
import
'package:byod/bloc/order_bloc.dart'
;
import
'package:byod/helper/prefs.dart'
;
import
'package:byod/helper/widget/style.dart'
;
import
'package:byod/ui/screen_responsive.dart'
;
import
'package:flutter/material.dart'
;
...
...
@@ -80,7 +81,7 @@ class _CheckOutState extends State<CheckOut> {
double
widthScreen
=
responsiveWidthScreen
(
context
);
double
currentScreen
=
MediaQuery
.
of
(
context
).
size
.
width
;
double
maxWidthScreen
=
getMaxWidthScreen
(
context
,
useResponsive
);
int
tableMode
=
prefs
.
getInt
(
'table_mode'
)
??
defaultTable
;
int
tableMode
=
getTableMode
()
;
return
SafeArea
(
child:
Scaffold
(
backgroundColor:
backgroundColor
,
...
...
@@ -338,12 +339,12 @@ class _CheckOutState extends State<CheckOut> {
bottom:
MediaQuery
.
of
(
context
).
size
.
height
*
positionedBottom
,
child:
GestureDetector
(
onTap:
()
{
String
namaPelanggan
=
prefs
.
getString
(
"userName"
)
??
''
;
String
namaPelanggan
=
getCustomerName
()
;
if
(
tableMode
==
singleTable
&&
namaPelanggan
!=
''
)
{
checkOut
(
context
,
listOrders
,
namaPelanggan
);
}
else
{
String
namaPelanggan
=
prefs
.
getString
(
"userName"
)
??
''
;
String
namaPelanggan
=
getCustomerName
()
;
buttonDialog
(
context
,
namaPelanggan
,
listOrders
,
tableMode
,
widthScreen
);
}
...
...
lib/ui/checkout/fuction.dart
View file @
f80b3813
import
'package:byod/helper/prefs.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_easyloading/flutter_easyloading.dart'
;
import
'../../api/api.dart'
;
import
'../../main.dart'
;
import
'../../models/orders.dart'
;
checkOut
(
BuildContext
context
,
List
<
Orders
>
listOrders
,
String
name
)
async
{
String
namaPelanggan
=
prefs
.
getString
(
"userName"
)
??
''
;
String
namaPelanggan
=
getCustomerName
()
;
String
namaPelangganFix
=
''
;
if
(
namaPelanggan
==
''
)
{
await
prefs
.
setString
(
"userName"
,
name
);
setCustomerName
(
name
);
namaPelangganFix
=
name
;
}
else
{
namaPelangganFix
=
namaPelanggan
;
...
...
@@ -18,10 +18,10 @@ checkOut(BuildContext context, List<Orders> listOrders, String name) async {
status:
'Memproses pesanan...'
,
maskType:
EasyLoadingMaskType
.
none
,
);
String
branchCode
=
prefs
.
getString
(
'outlet'
)
??
''
;
String
brand
=
prefs
.
getString
(
'brand'
)
??
''
;
String
branchCode
=
getBranchPref
()
;
String
brand
=
getBrand
()
;
String
tableNumber
=
prefs
.
getString
(
'table_number'
)
??
''
;
String
tableNumber
=
getTabelNumber
()
;
// String baseUrl = prefs.getString('baseUrl') ?? '';
// String urlCheckout = "${baseUrl}checkout";
...
...
lib/ui/history_order/history.dart
View file @
f80b3813
...
...
@@ -108,7 +108,7 @@ class HistoryOrder extends StatelessWidget {
MaterialPageRoute
(
builder:
(
_
)
=>
ViewBillNew
(
isHistory:
true
,
sessionId:
jsonDecodeHistory
[
'session
'
],
orderId:
jsonDecodeHistory
[
'order_id
'
],
branchCodeH:
jsonDecodeHistory
[
'branch_code'
],
brandCodeH:
jsonDecodeHistory
[
'brand'
],
token:
jsonDecodeHistory
[
'token'
],
...
...
lib/ui/history_order/history_new.dart
View file @
f80b3813
...
...
@@ -62,7 +62,7 @@ class HistoryOrderNew extends StatelessWidget {
MaterialPageRoute
(
builder:
(
_
)
=>
ViewBillNew
(
isHistory:
true
,
sessionId:
jsonDecodeHistory
[
'session
'
],
orderId:
jsonDecodeHistory
[
'order_id
'
],
branchCodeH:
jsonDecodeHistory
[
'branch_code'
],
brandCodeH:
jsonDecodeHistory
[
'brand'
],
token:
jsonDecodeHistory
[
'token'
],
...
...
lib/ui/home/bottom_sheet_menu_new.dart
View file @
f80b3813
...
...
@@ -62,13 +62,21 @@ class ShowMenuBottomSheet extends StatelessWidget {
),
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
21
),
child:
Image
(
width:
widthImage
,
height:
widthImage
,
image:
NetworkImage
(
menuDetail
[
i
].
imageUrlMedium
,
),
),
child:
(
menuDetail
[
i
].
imageUrlMedium
!=
''
)
?
Image
(
width:
widthImage
,
height:
widthImage
,
image:
NetworkImage
(
menuDetail
[
i
].
imageUrlMedium
,
),
)
:
Image
(
width:
widthImage
,
height:
widthImage
,
image:
const
AssetImage
(
'assets/noimage.png'
,
),
),
),
const
SizedBox
(
height:
20
,
...
...
lib/ui/home/home.dart
View file @
f80b3813
...
...
@@ -6,6 +6,7 @@ import 'package:byod/bloc/filter_menu.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/helper/widget/style.dart'
;
import
'package:byod/models/category_list.dart'
;
import
'package:byod/models/filter_menu.dart'
;
...
...
@@ -32,8 +33,8 @@ class Home extends StatefulWidget {
}
class
_HomeState
extends
State
<
Home
>
{
String
tableNumber
=
prefs
.
getString
(
"table_number"
)
??
""
;
String
userName
=
prefs
.
getString
(
"userName"
)
??
""
;
String
tableNumber
=
getTabelNumber
()
;
String
userName
=
getCustomerName
()
;
final
searchController
=
TextEditingController
();
final
_scrollController
=
ScrollController
();
bool
isSearch
=
true
;
...
...
@@ -75,7 +76,7 @@ class _HomeState extends State<Home> {
@override
Widget
build
(
BuildContext
context
)
{
int
tableMode
=
prefs
.
getInt
(
'table_mode'
)
??
defaultTable
;
int
tableMode
=
getTableMode
()
;
// context.read<FeedBackOptionBloc>().getOptionFeedback();
double
widthScreen
=
responsiveWidthScreen
(
context
);
double
maxWidthScreen
=
getMaxWidthScreen
(
context
,
useResponsive
);
...
...
@@ -485,12 +486,12 @@ class _HomeState extends State<Home> {
}
return
GestureDetector
(
onTap:
()
{
String
namaPelanggan
=
prefs
.
getString
(
"userName"
)
??
''
;
String
namaPelanggan
=
getCustomerName
()
;
if
(
tableMode
==
singleTable
)
{
if
(
tableMode
==
singleTable
&&
namaPelanggan
!=
''
)
{
checkOut
(
context
,
listOrders
,
namaPelanggan
);
}
else
{
String
namaPelanggan
=
prefs
.
getString
(
"userName"
)
??
''
;
String
namaPelanggan
=
getCustomerName
()
;
buttonDialog
(
context
,
namaPelanggan
,
listOrders
,
tableMode
,
widthScreen
);
}
...
...
lib/ui/home/new_home2.dart
View file @
f80b3813
...
...
@@ -7,6 +7,7 @@ import 'package:byod/bloc/order_bloc.dart';
import
'package:byod/bloc/search_active.dart'
;
import
'package:byod/bloc/search_menu.dart'
;
import
'package:byod/helper/helper.dart'
;
import
'package:byod/helper/prefs.dart'
;
import
'package:byod/helper/widget/style.dart'
;
import
'package:byod/models/filter_menu.dart'
;
import
'package:byod/models/orders.dart'
;
...
...
@@ -201,9 +202,9 @@ class _NewHome2State extends State<NewHome2> {
// categoryFont -
// spacerAboveCatList;
int
tableMode
=
prefs
.
getInt
(
'table_mode'
)
??
defaultTable
;
String
tableNumber
=
prefs
.
getString
(
"table_number"
)
??
""
;
String
userName
=
prefs
.
getString
(
"userName"
)
??
""
;
int
tableMode
=
getTableMode
()
;
String
tableNumber
=
getTabelNumber
()
;
String
userName
=
getCustomerName
()
;
double
widthScreen
=
responsiveWidthScreen
(
context
);
double
maxWidthScreen
=
getMaxWidthScreen
(
context
,
useResponsive
);
return
BlocBuilder
<
BranchExist
,
String
>(
...
...
@@ -582,7 +583,7 @@ class _NewHome2State extends State<NewHome2> {
int
tableMode
,
bool
isSearchActive
,
)
{
String
logoUrl
=
prefs
.
getString
(
"logoUrl"
)
??
""
;
String
logoUrl
=
getLogoUrl
()
;
return
Stack
(
children:
[
Container
(
...
...
lib/ui/payment/payment.dart
View file @
f80b3813
...
...
@@ -2,6 +2,7 @@
import
'package:byod/bloc/check_voucher.dart'
;
import
'package:byod/helper/helper.dart'
;
import
'package:byod/helper/prefs.dart'
;
import
'package:byod/helper/widget/style.dart'
;
import
'package:byod/ui/screen_responsive.dart'
;
import
'package:byod/ui/viewbill/view_bill.dart'
;
...
...
@@ -56,9 +57,9 @@ class _PaymentState extends State<Payment> {
double
currentScreen
=
MediaQuery
.
of
(
context
).
size
.
width
;
double
maxWidthScreen
=
getMaxWidthScreen
(
context
,
useResponsive
);
double
paddingLeftRight
=
widthScreen
*
0.05
;
String
branchCode
=
prefs
.
getString
(
"outlet"
)
??
''
;
String
brandCode
=
prefs
.
getString
(
"brand"
)
??
''
;
String
customerName
=
prefs
.
getString
(
"userName"
)
??
''
;
String
branchCode
=
getBranchPref
()
;
String
brandCode
=
getBrand
()
;
String
customerName
=
getCustomerName
()
;
context
.
read
<
VoucherCheck
>()
.
changeVoucher
();
// user dipaksa input ulang voucher
...
...
lib/ui/payment/payment_balance.dart
View file @
f80b3813
...
...
@@ -2,13 +2,13 @@
import
'dart:math'
;
import
'package:byod/helper/prefs.dart'
;
import
'package:byod/helper/widget/button_modal.dart'
;
import
'package:byod/ui/payment/function.dart'
;
import
'package:flutter/material.dart'
;
import
'../../helper/helper.dart'
;
import
'../../helper/widget/style.dart'
;
import
'../../main.dart'
;
import
'../screen_responsive.dart'
;
import
'../viewbill/view_bill_new.dart'
;
...
...
@@ -58,9 +58,9 @@ class CorePaymentBalance extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
int
outStandingTopayMember
=
min
(
outStanding
,
balanceMember
);
double
widthScreen
=
responsiveWidthScreen
(
context
);
String
branchCode
=
prefs
.
getString
(
"outlet"
)
??
''
;
String
brandCode
=
prefs
.
getString
(
"brand"
)
??
''
;
String
customerName
=
prefs
.
getString
(
"userName"
)
??
''
;
String
branchCode
=
getBranchPref
()
;
String
brandCode
=
getBrand
()
;
String
customerName
=
getCustomerName
()
;
return
Container
(
width:
widthScreen
,
child:
Stack
(
...
...
lib/ui/payment/payment_voucher.dart
View file @
f80b3813
...
...
@@ -3,6 +3,7 @@
import
'package:byod/bloc/check_voucher.dart'
;
import
'package:byod/bloc/voucher_list.dart'
;
import
'package:byod/helper/helper.dart'
;
import
'package:byod/helper/prefs.dart'
;
import
'package:byod/helper/widget/button_modal.dart'
;
import
'package:byod/main.dart'
;
import
'package:byod/ui/screen_responsive.dart'
;
...
...
@@ -51,13 +52,13 @@ class CorePaymentVoucher extends StatelessWidget {
final
int
outstandingAll
;
final
List
<
Bill
>
dataBill
;
final
String
branchCode
=
prefs
.
getString
(
"outlet"
)
??
''
;
final
String
brandCode
=
prefs
.
getString
(
"brand"
)
??
''
;
final
String
customerName
=
prefs
.
getString
(
"userName"
)
??
''
;
final
String
branchCode
=
getBranchPref
()
;
final
String
brandCode
=
getBrand
()
;
final
String
customerName
=
getCustomerName
()
;
@override
Widget
build
(
BuildContext
context
)
{
double
widthScreen
=
responsiveWidthScreen
(
context
);
String
logoUrl
=
prefs
.
getString
(
'logoUrl'
)
??
''
;
String
logoUrl
=
getLogoUrl
()
;
return
Container
(
width:
widthScreen
,
child:
BlocBuilder
<
VoucherCheck
,
List
<
dynamic
>>(
...
...
lib/ui/splash.dart
View file @
f80b3813
...
...
@@ -2,9 +2,9 @@
import
'dart:convert'
;
import
'package:byod/bloc/filter_menu.dart'
;
import
'package:byod/bloc/member_info.dart'
;
import
'package:byod/helper/helper.dart'
;
import
'package:byod/helper/prefs.dart'
;
import
'package:byod/ui/no_route.dart'
;
import
'package:byod/ui/viewbill/view_bill_new.dart'
;
import
'package:flutter/material.dart'
;
...
...
@@ -18,7 +18,7 @@ import 'home/shimmer_menu.dart';
import
'screen_responsive.dart'
;
class
Splash
extends
StatefulWidget
{
final
String
param
,
brand
,
tn
,
role
,
cashierName
,
toBill
,
session
Id
,
token
;
final
String
param
,
brand
,
tn
,
role
,
cashierName
,
toBill
,
order
Id
,
token
;
const
Splash
(
{
Key
?
key
,
required
this
.
param
,
...
...
@@ -27,7 +27,7 @@ class Splash extends StatefulWidget {
required
this
.
role
,
required
this
.
cashierName
,
required
this
.
toBill
,
required
this
.
session
Id
,
required
this
.
order
Id
,
required
this
.
token
})
:
super
(
key:
key
);
...
...
@@ -54,30 +54,32 @@ class _SplashState extends State<Splash> {
@override
void
initState
()
{
loadBaseUrl
().
then
((
baseUrl
)
{
prefs
.
setString
(
'baseUrl'
,
baseUrl
);
setBaseUrl
(
baseUrl
);
context
.
read
<
BranchExist
>().
branchExist
(
widget
.
param
,
widget
.
brand
,
widget
.
role
,
widget
.
cashierName
,
widget
.
sessionId
,
widget
.
orderId
,
context
,
getMenu:
true
,
);
// context.read<CategoryMenu>().catAndMenu(widget.param, widget.brand,
// widget.role, widget.cashierName, widget.token);
context
.
read
<
FilterMenuBloc
>().
catAndMenu
(
widget
.
param
,
widget
.
brand
,
widget
.
role
,
widget
.
cashierName
,
widget
.
token
);
//
context.read<FilterMenuBloc>().catAndMenu(widget.param, widget.brand,
//
widget.role, widget.cashierName, widget.token);
if
(
widget
.
token
!=
''
)
{
context
.
read
<
MemberInfoBloc
>().
getMemberInfo
(
widget
.
token
);
}
Future
.
delayed
(
const
Duration
(
milliseconds:
1000
),
()
async
{
await
prefs
.
setString
(
'token'
,
widget
.
token
);
await
prefs
.
setString
(
'outlet'
,
widget
.
param
);
await
prefs
.
setString
(
'brand'
,
widget
.
brand
);
await
prefs
.
setString
(
'table_number'
,
widget
.
tn
);
await
prefs
.
setString
(
'role'
,
widget
.
role
);
await
prefs
.
setString
(
'cashier_name'
,
widget
.
cashierName
);
setToken
(
widget
.
token
);
setBranch
(
widget
.
param
);
setBrand
(
widget
.
brand
);
setTableNumber
(
widget
.
tn
);
setRole
(
widget
.
role
);
setCashierName
(
widget
.
cashierName
);
// ignore: use_build_context_synchronously
if
(
widget
.
toBill
==
'go'
)
{
...
...
lib/ui/viewbill/app_bar.dart
View file @
f80b3813
// ignore_for_file: sized_box_for_whitespace
import
'package:byod/helper/prefs.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'../../bloc/branch_exist.dart'
;
import
'../../helper/helper.dart'
;
import
'../../helper/widget/style.dart'
;
import
'../../main.dart'
;
import
'../home/new_home2.dart'
;
class
CustomAppBar
extends
StatelessWidget
{
...
...
@@ -19,11 +19,11 @@ class CustomAppBar extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
String
branchCode
=
prefs
.
getString
(
'outlet'
)
??
''
;
String
brandCode
=
prefs
.
getString
(
'brand'
)
??
''
;
String
role
=
prefs
.
getString
(
'role'
)
??
''
;
String
cashierName
=
prefs
.
getString
(
'cashier_name'
)
??
''
;
String
sessionId
=
prefs
.
getString
(
'sessionId'
)
??
''
;
String
branchCode
=
getBranchPref
()
;
String
brandCode
=
getBrand
()
;
String
role
=
getRole
()
;
String
cashierName
=
getCashierName
()
;
String
sessionId
=
getOrderId
()
;
return
Container
(
padding:
const
EdgeInsets
.
only
(
top:
15
,
...
...
@@ -42,7 +42,13 @@ class CustomAppBar extends StatelessWidget {
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
NewHome2
()));
context
.
read
<
BranchExist
>().
branchExist
(
branchCode
,
brandCode
,
role
,
cashierName
,
sessionId
);
branchCode
,
brandCode
,
role
,
cashierName
,
sessionId
,
context
,
);
}
else
{
Navigator
.
pop
(
context
);
}
...
...
lib/ui/viewbill/order_view_bill_new.dart
View file @
f80b3813
...
...
@@ -149,14 +149,23 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
children:
[
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
5
),
child:
Image
(
width:
80
,
height:
80
,
fit:
BoxFit
.
fill
,
image:
NetworkImage
(
widget
.
billDetail
.
imageUrl
,
),
),
child:
(
widget
.
billDetail
.
imageUrl
!=
''
)
?
Image
(
width:
80
,
height:
80
,
fit:
BoxFit
.
fill
,
image:
NetworkImage
(
widget
.
billDetail
.
imageUrl
,
),
)
:
const
Image
(
width:
80
,
height:
80
,
fit:
BoxFit
.
fill
,
image:
AssetImage
(
'assets/noimage.png'
,
),
),
),
const
SizedBox
(
width:
8
,
...
...
lib/ui/viewbill/view_bill.dart
View file @
f80b3813
...
...
@@ -37,7 +37,7 @@ import 'order_view_bill.dart';
class
ViewBill
extends
StatefulWidget
{
// ini berlaku ketika lihat history
bool
isHistory
;
String
session
Id
;
String
order
Id
;
String
branchCode
;
String
brandCode
;
String
tableNumber
;
...
...
@@ -46,7 +46,7 @@ class ViewBill extends StatefulWidget {
ViewBill
({
Key
?
key
,
this
.
isHistory
=
false
,
this
.
session
Id
=
''
,
this
.
order
Id
=
''
,
this
.
branchCode
=
''
,
this
.
brandCode
=
''
,
this
.
tableNumber
=
''
,
...
...
@@ -81,7 +81,7 @@ class _ViewBillState extends State<ViewBill> {
context
.
read
<
ViewBillBloc
>().
getBill
();
}
else
{
context
.
read
<
ViewBillBloc
>().
getBill
(
sessionIdH:
widget
.
session
Id
,
orderIdH:
widget
.
order
Id
,
branchCodeH:
widget
.
branchCode
,
brandCodeH:
widget
.
brandCode
,
tableNumberH:
widget
.
tableNumber
,
...
...
@@ -227,7 +227,7 @@ class _ViewBillState extends State<ViewBill> {
context
,
dataBill
,
widget
.
isHistory
,
sessionID:
widget
.
session
Id
,
sessionID:
widget
.
order
Id
,
);
}
});
...
...
@@ -415,6 +415,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
role
,
cashierName
,
sessionID
,
context
,
);
Navigator
.
push
(
context
,
...
...
@@ -648,7 +649,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
context
,
dataBill
,
widget
.
isHistory
,
sessionID:
widget
.
session
Id
,
sessionID:
widget
.
order
Id
,
);
},
child:
Container
(
...
...
@@ -750,6 +751,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
role
,
cashierName
,
sessionID
,
context
,
);
Navigator
.
push
(
context
,
...
...
@@ -1250,7 +1252,13 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
NewHome2
()));
context
.
read
<
BranchExist
>().
branchExist
(
branchCode
,
brandCode
,
role
,
cashierName
,
sessionId
);
branchCode
,
brandCode
,
role
,
cashierName
,
sessionId
,
context
,
);
}
else
{
Navigator
.
pop
(
context
);
}
...
...
lib/ui/viewbill/view_bill_new.dart
View file @
f80b3813
...
...
@@ -3,6 +3,7 @@
import
'dart:math'
;
import
'package:byod/bloc/member_info.dart'
;
import
'package:byod/helper/helper.dart'
;
import
'package:byod/helper/prefs.dart'
;
import
'package:byod/helper/widget/button_modal.dart'
;
import
'package:byod/helper/widget/style.dart'
;
import
'package:byod/ui/history_order/history_new.dart'
;
...
...
@@ -22,7 +23,6 @@ import '../../helper/widget/button_dialog.dart';
import
'../../helper/widget/emoticon_rate_new.dart'
;
import
'../../helper/widget/open_url.dart'
;
import
'../../helper/widget/thousand_formatter.dart'
;
import
'../../main.dart'
;
import
'../../models/bill.dart'
;
import
'../../models/member_info.dart'
;
import
'../build_version.dart'
;
...
...
@@ -39,7 +39,7 @@ class ViewBillNew extends StatelessWidget {
// const ViewBillNew({Key? key}) : super(key: key);
final
bool
isHistory
;
final
String
session
Id
;
final
String
order
Id
;
final
String
branchCodeH
;
final
String
brandCodeH
;
final
String
tableNumberH
;
...
...
@@ -48,7 +48,7 @@ class ViewBillNew extends StatelessWidget {
const
ViewBillNew
({
Key
?
key
,
this
.
isHistory
=
false
,
this
.
session
Id
=
''
,
this
.
order
Id
=
''
,
this
.
branchCodeH
=
''
,
this
.
brandCodeH
=
''
,
this
.
tableNumberH
=
''
,
...
...
@@ -60,8 +60,8 @@ class ViewBillNew extends StatelessWidget {
// RefreshController(initialRefresh: false);
void
saveBillDetail
(
List
<
Bill
>
dataBill
)
async
{
await
prefs
.
setString
(
'total_order'
,
dataBill
[
0
].
totalSeluruhOrderan
);
await
prefs
.
setString
(
'date_order'
,
dataBill
[
0
].
dateOrder
);
setTotalOrder
(
dataBill
[
0
].
totalSeluruhOrderan
);
setOrderDate
(
dataBill
[
0
].
dateOrder
);
}
void
getBillFunc
(
BuildContext
context
)
{
...
...
@@ -69,7 +69,7 @@ class ViewBillNew extends StatelessWidget {
context
.
read
<
ViewBillBloc
>().
getBill
();
}
else
{
context
.
read
<
ViewBillBloc
>().
getBill
(
sessionIdH:
session
Id
,
orderIdH:
order
Id
,
branchCodeH:
branchCodeH
,
brandCodeH:
brandCodeH
,
tableNumberH:
tableNumberH
,
...
...
@@ -92,16 +92,16 @@ class ViewBillNew extends StatelessWidget {
const
uuidInit
=
Uuid
();
var
uuid
=
uuidInit
.
v4
();
//** UUID */
String
branchCode
=
prefs
.
getString
(
"outlet"
)
??
''
;
String
brandCode
=
prefs
.
getString
(
"brand"
)
??
''
;
String
tableNumber
=
prefs
.
getString
(
"table_number"
)
??
''
;
String
role
=
prefs
.
getString
(
"role"
)
??
''
;
String
customerName
=
prefs
.
getString
(
"userName"
)
??
''
;
String
cashierName
=
prefs
.
getString
(
"cashier_name"
)
??
''
;
String
branchCode
=
getBranchPref
()
;
String
brandCode
=
getBrand
()
;
String
tableNumber
=
getTabelNumber
()
;
String
role
=
getRole
()
;
String
customerName
=
getCustomerName
()
;
String
cashierName
=
getCashierName
()
;
// String token = prefs.getString("token") ?? '';
String
sessionID
=
prefs
.
getString
(
"sessionId"
)
??
uuid
;
int
tableMode
=
prefs
.
getInt
(
'table_mode'
)
??
defaultTable
;
List
<
String
>
historyOrder
=
prefs
.
getStringList
(
'list_history'
)
??
[]
;
String
orderId
=
getOrderId
()
;
int
tableMode
=
getTableMode
()
;
List
<
String
>
historyOrder
=
getListHistory
()
;
return
SafeArea
(
child:
Scaffold
(
...
...
@@ -222,7 +222,7 @@ class ViewBillNew extends StatelessWidget {
context
,
dataBill
,
isHistory
,
sessionID:
session
Id
,
orderId:
order
Id
,
);
}
});
...
...
@@ -281,7 +281,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
onTapCashier:
onTapCashier
,
branchCode:
branchCode
,
brandCode:
brandCode
,
sessionId:
session
Id
,
orderId:
order
Id
,
),
widthScreen:
MediaQuery
.
of
(
context
).
size
.
width
,
isCoreLayout:
true
,
...
...
@@ -295,7 +295,6 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
brandCode:
brandCode
,
customerName:
customerName
,
isHistory:
isHistory
,
sessionId:
sessionID
,
historyOrder:
historyOrder
,
),
widthScreen:
currentScreen
,
...
...
@@ -344,7 +343,7 @@ class CoreBill extends StatelessWidget {
required
this
.
onTapCashier
,
required
this
.
branchCode
,
required
this
.
brandCode
,
required
this
.
session
Id
,
required
this
.
order
Id
,
})
:
super
(
key:
key
);
final
double
widthScreen
;
...
...
@@ -358,7 +357,7 @@ class CoreBill extends StatelessWidget {
final
void
Function
()
onTapCashier
;
final
String
branchCode
;
final
String
brandCode
;
final
String
session
Id
;
final
String
order
Id
;
@override
Widget
build
(
BuildContext
context
)
{
...
...
@@ -879,8 +878,7 @@ class CoreBill extends StatelessWidget {
onTap:
()
{
String
titlePayment
;
String
customerName
=
prefs
.
getString
(
'userName'
)
??
''
;
getCustomerName
();
bool
isIndividu
;
if
(
tableMode
==
multiTable
)
{
isIndividu
=
true
;
...
...
@@ -1117,7 +1115,7 @@ class CoreBill extends StatelessWidget {
context
,
dataBill
,
isHistory
,
sessionID:
session
Id
,
orderId:
order
Id
,
);
}
}
...
...
@@ -1175,7 +1173,6 @@ class EmptyBill extends StatelessWidget {
required
this
.
customerName
,
required
this
.
branchCode
,
required
this
.
brandCode
,
required
this
.
sessionId
,
required
this
.
historyOrder
,
})
:
super
(
key:
key
);
...
...
@@ -1184,13 +1181,12 @@ class EmptyBill extends StatelessWidget {
final
String
customerName
;
final
String
branchCode
;
final
String
brandCode
;
final
String
sessionId
;
final
String
tableNumber
=
prefs
.
getString
(
"table_number"
)
??
''
;
final
String
tableNumber
=
getTabelNumber
();
final
List
<
String
>
historyOrder
;
final
String
role
=
prefs
.
getString
(
'role'
)
??
''
;
final
String
cashierName
=
prefs
.
getString
(
'cashier_name'
)
??
''
;
final
String
sessionID
=
prefs
.
getString
(
'sessionId'
)
??
''
;
final
String
role
=
getRole
()
;
final
String
cashierName
=
getCashierName
()
;
final
String
orderId
=
getOrderId
()
;
@override
Widget
build
(
BuildContext
context
)
{
return
BlocBuilder
<
MemberInfoBloc
,
MemberInfo
>(
...
...
@@ -1308,7 +1304,8 @@ class EmptyBill extends StatelessWidget {
brandCode
,
role
,
cashierName
,
sessionID
,
orderId
,
context
,
);
Navigator
.
push
(
context
,
...
...
@@ -1357,7 +1354,7 @@ class EmptyBill extends StatelessWidget {
Future
<
dynamic
>
ratingModal
(
BuildContext
context
,
List
<
Bill
>
dataBill
,
bool
isHistory
,
{
String
sessionID
=
''
})
{
{
String
orderId
=
''
})
{
double
sizeImage
=
76
;
final
rateNote
=
TextEditingController
();
return
showDialog
(
...
...
@@ -1368,7 +1365,7 @@ Future<dynamic> ratingModal(
rateNote:
rateNote
,
isHistory:
isHistory
,
dataBill:
dataBill
,
sessionID:
sessionID
,
orderId:
orderId
,
),
),
);
...
...
@@ -1550,7 +1547,7 @@ Future<dynamic> buttonDialogAllPayment(
GestureDetector
(
onTap:
()
{
String
titlePayment
;
String
customerName
=
prefs
.
getString
(
'userName'
)
??
''
;
String
customerName
=
getCustomerName
()
;
bool
isIndividu
;
if
(
tableMode
==
multiTable
)
{
isIndividu
=
true
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment