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
Expand all
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
This diff is collapsed.
Click to expand it.
lib/bloc/branch_exist.dart
View file @
f80b3813
import
'package:flutter/cupertino.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'../api/api.dart'
;
import
'../api/api.dart'
;
import
'../helper/helper.dart'
;
import
'../helper/helper.dart'
;
import
'filter_menu.dart'
;
class
BranchExist
extends
Cubit
<
String
>
{
class
BranchExist
extends
Cubit
<
String
>
{
BranchExist
()
:
super
(
responseApiWaiting
);
BranchExist
()
:
super
(
responseApiWaiting
);
Future
<
String
>
getBranch
(
String
branchCode
,
String
brandCode
,
String
role
,
Future
<
String
>
getBranch
(
String
branchCode
,
String
brandCode
,
String
role
,
String
cashierName
,
String
session
Id
)
async
{
String
cashierName
,
String
order
Id
)
async
{
var
apiGetBranch
=
await
Api
.
getBranch
(
var
apiGetBranch
=
branchCode
,
brandCode
,
role
,
cashierName
,
session
Id
);
await
Api
.
getBranch
(
branchCode
,
brandCode
,
role
,
cashierName
,
order
Id
);
return
apiGetBranch
;
return
apiGetBranch
;
}
}
void
branchExist
(
String
branchCode
,
String
brandCode
,
String
role
,
void
branchExist
(
String
branchCode
,
String
brandCode
,
String
role
,
String
cashierName
,
String
sessionId
)
{
String
cashierName
,
String
orderId
,
BuildContext
context
,
getBranch
(
branchCode
,
brandCode
,
role
,
cashierName
,
sessionId
)
{
bool
getMenu
=
false
})
{
.
then
((
value
)
{
getBranch
(
branchCode
,
brandCode
,
role
,
cashierName
,
orderId
).
then
((
value
)
{
if
(
getMenu
)
{
context
.
read
<
FilterMenuBloc
>()
.
catAndMenu
(
branchCode
,
brandCode
,
role
,
cashierName
,
orderId
);
}
emit
(
value
);
emit
(
value
);
});
});
}
}
...
...
lib/bloc/view_bill.dart
View file @
f80b3813
import
'package:byod/helper/prefs.dart'
;
import
'package:byod/models/bill.dart'
;
import
'package:byod/models/bill.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'../api/api.dart'
;
import
'../api/api.dart'
;
import
'../helper/helper.dart'
;
import
'../helper/helper.dart'
;
import
'../main.dart'
;
class
ViewBillBloc
extends
Cubit
<
List
<
Bill
>>
{
class
ViewBillBloc
extends
Cubit
<
List
<
Bill
>>
{
ViewBillBloc
()
ViewBillBloc
()
...
@@ -29,7 +29,7 @@ class ViewBillBloc extends Cubit<List<Bill>> {
...
@@ -29,7 +29,7 @@ class ViewBillBloc extends Cubit<List<Bill>> {
)
)
]);
]);
void
getBill
({
void
getBill
({
String
session
IdH
=
''
,
String
order
IdH
=
''
,
String
branchCodeH
=
''
,
String
branchCodeH
=
''
,
String
brandCodeH
=
''
,
String
brandCodeH
=
''
,
String
tableNumberH
=
''
,
String
tableNumberH
=
''
,
...
@@ -40,20 +40,20 @@ class ViewBillBloc extends Cubit<List<Bill>> {
...
@@ -40,20 +40,20 @@ class ViewBillBloc extends Cubit<List<Bill>> {
String
brandCode
;
String
brandCode
;
String
tableNumber
;
String
tableNumber
;
String
token
;
String
token
;
if
(
session
IdH
!=
''
)
{
if
(
order
IdH
!=
''
)
{
// for history view
// for history view
branchCode
=
branchCodeH
;
branchCode
=
branchCodeH
;
brandCode
=
brandCodeH
;
brandCode
=
brandCodeH
;
tableNumber
=
tableNumberH
;
tableNumber
=
tableNumberH
;
token
=
tokenH
;
token
=
tokenH
;
}
else
{
}
else
{
branchCode
=
prefs
.
getString
(
"outlet"
)
??
''
;
branchCode
=
getBranchPref
()
;
brandCode
=
prefs
.
getString
(
"brand"
)
??
''
;
brandCode
=
getBrand
()
;
tableNumber
=
prefs
.
getString
(
"table_number"
)
??
''
;
tableNumber
=
getTabelNumber
()
;
token
=
prefs
.
getString
(
"token"
)
??
''
;
token
=
getToken
()
;
}
}
List
<
Bill
>
bill
;
List
<
Bill
>
bill
;
if
(
session
IdH
==
''
)
{
if
(
order
IdH
==
''
)
{
bill
=
await
Api
.
getBill
(
bill
=
await
Api
.
getBill
(
branchCode
,
branchCode
,
brandCode
,
brandCode
,
...
@@ -66,7 +66,7 @@ class ViewBillBloc extends Cubit<List<Bill>> {
...
@@ -66,7 +66,7 @@ class ViewBillBloc extends Cubit<List<Bill>> {
brandCode
,
brandCode
,
tableNumber
,
tableNumber
,
token
,
token
,
sessionIdH:
session
IdH
,
orderIdH:
order
IdH
,
userNameH:
userNameH
,
userNameH:
userNameH
,
);
);
}
}
...
...
lib/helper/helper.dart
View file @
f80b3813
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
import
'dart:convert'
;
import
'dart:convert'
;
import
'package:byod/helper/prefs.dart'
;
import
'package:crypto/crypto.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:intl/intl.dart'
;
import
'package:intl/intl.dart'
;
import
'package:http/http.dart'
as
http
;
import
'package:http/http.dart'
as
http
;
...
@@ -244,6 +246,21 @@ String localDate(String date, {isHistory = false}) {
...
@@ -244,6 +246,21 @@ String localDate(String date, {isHistory = false}) {
//** convert UTC to local */
//** 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 */
//** END FUNCTION */
//** START CONSTANT */
//** 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 @@
...
@@ -3,6 +3,7 @@
import
'dart:convert'
;
import
'dart:convert'
;
import
'package:byod/bloc/feedback_option.dart'
;
import
'package:byod/bloc/feedback_option.dart'
;
import
'package:byod/helper/prefs.dart'
;
import
'package:byod/main.dart'
;
import
'package:byod/main.dart'
;
import
'package:byod/models/bill.dart'
;
import
'package:byod/models/bill.dart'
;
import
'package:byod/models/feedback_option.dart'
;
import
'package:byod/models/feedback_option.dart'
;
...
@@ -298,19 +299,18 @@ class _EmoticonRateState extends State<EmoticonRate> {
...
@@ -298,19 +299,18 @@ class _EmoticonRateState extends State<EmoticonRate> {
if
(!
widget
.
isHistory
)
{
if
(!
widget
.
isHistory
)
{
context
.
read
<
ViewBillBloc
>().
getBill
();
context
.
read
<
ViewBillBloc
>().
getBill
();
}
else
{
}
else
{
List
<
String
>
listHistory
=
List
<
String
>
listHistory
=
getListHistory
();
prefs
.
getStringList
(
'list_history'
)
??
[];
if
(
listHistory
.
isNotEmpty
)
{
if
(
listHistory
.
isNotEmpty
)
{
int
indexHistory
=
listHistory
.
indexWhere
(
int
indexHistory
=
listHistory
.
indexWhere
(
(
listHistory
)
=>
(
listHistory
)
=>
jsonDecode
(
listHistory
)[
'
session
'
]
==
jsonDecode
(
listHistory
)[
'
order_id
'
]
==
widget
.
sessionId
,
widget
.
sessionId
,
);
);
if
(
indexHistory
!=
-
1
)
{
if
(
indexHistory
!=
-
1
)
{
dynamic
jsonDecodeHistory
=
dynamic
jsonDecodeHistory
=
jsonDecode
(
listHistory
[
indexHistory
]);
jsonDecode
(
listHistory
[
indexHistory
]);
context
.
read
<
ViewBillBloc
>().
getBill
(
context
.
read
<
ViewBillBloc
>().
getBill
(
sessionIdH:
jsonDecodeHistory
[
'session
'
],
orderIdH:
jsonDecodeHistory
[
'order_id
'
],
branchCodeH:
branchCodeH:
jsonDecodeHistory
[
'branch_code'
],
jsonDecodeHistory
[
'branch_code'
],
brandCodeH:
jsonDecodeHistory
[
'brand'
],
brandCodeH:
jsonDecodeHistory
[
'brand'
],
...
...
lib/helper/widget/emoticon_rate_new.dart
View file @
f80b3813
import
'dart:convert'
;
import
'dart:convert'
;
import
'package:byod/helper/prefs.dart'
;
import
'package:byod/helper/widget/style.dart'
;
import
'package:byod/helper/widget/style.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
...
@@ -22,14 +23,14 @@ class EmoticonRateNew extends StatelessWidget {
...
@@ -22,14 +23,14 @@ class EmoticonRateNew extends StatelessWidget {
required
this
.
rateNote
,
required
this
.
rateNote
,
required
this
.
isHistory
,
required
this
.
isHistory
,
required
this
.
dataBill
,
required
this
.
dataBill
,
this
.
sessionID
=
''
,
this
.
orderId
=
''
,
})
:
super
(
key:
key
);
})
:
super
(
key:
key
);
final
double
sizeImage
;
final
double
sizeImage
;
final
TextEditingController
rateNote
;
final
TextEditingController
rateNote
;
final
bool
isHistory
;
final
bool
isHistory
;
final
List
<
Bill
>
dataBill
;
final
List
<
Bill
>
dataBill
;
final
String
sessionID
;
final
String
orderId
;
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
...
@@ -242,19 +243,18 @@ class EmoticonRateNew extends StatelessWidget {
...
@@ -242,19 +243,18 @@ class EmoticonRateNew extends StatelessWidget {
if
(!
isHistory
)
{
if
(!
isHistory
)
{
context
.
read
<
ViewBillBloc
>().
getBill
();
context
.
read
<
ViewBillBloc
>().
getBill
();
}
else
{
}
else
{
List
<
String
>
listHistory
=
List
<
String
>
listHistory
=
getListHistory
();
prefs
.
getStringList
(
'list_history'
)
??
[];
if
(
listHistory
.
isNotEmpty
)
{
if
(
listHistory
.
isNotEmpty
)
{
int
indexHistory
=
listHistory
.
indexWhere
(
int
indexHistory
=
listHistory
.
indexWhere
(
(
listHistory
)
=>
(
listHistory
)
=>
jsonDecode
(
listHistory
)[
'
session
'
]
==
jsonDecode
(
listHistory
)[
'
order_id
'
]
==
sessionID
,
orderId
,
);
);
if
(
indexHistory
!=
-
1
)
{
if
(
indexHistory
!=
-
1
)
{
dynamic
jsonDecodeHistory
=
dynamic
jsonDecodeHistory
=
jsonDecode
(
listHistory
[
indexHistory
]);
jsonDecode
(
listHistory
[
indexHistory
]);
context
.
read
<
ViewBillBloc
>().
getBill
(
context
.
read
<
ViewBillBloc
>().
getBill
(
sessionIdH:
jsonDecodeHistory
[
'session
'
],
orderIdH:
jsonDecodeHistory
[
'order_id
'
],
branchCodeH:
branchCodeH:
jsonDecodeHistory
[
'branch_code'
],
jsonDecodeHistory
[
'branch_code'
],
brandCodeH:
jsonDecodeHistory
[
'brand'
],
brandCodeH:
jsonDecodeHistory
[
'brand'
],
...
...
lib/main.dart
View file @
f80b3813
...
@@ -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/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'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
...
@@ -123,12 +124,12 @@ class MyApp extends StatelessWidget {
...
@@ -123,12 +124,12 @@ class MyApp extends StatelessWidget {
//** UUID */
//** UUID */
//** Check Session ID */
//** Check Session ID */
String
current
SessionId
=
prefs
.
getString
(
'sessionId'
)
??
''
;
String
current
OrderId
=
getOrderId
()
;
String
session
Id
;
String
order
Id
;
if
(
current
Session
Id
!=
''
)
{
if
(
current
Order
Id
!=
''
)
{
sessionId
=
currentSession
Id
;
orderId
=
currentOrder
Id
;
}
else
{
}
else
{
session
Id
=
uuid
;
order
Id
=
uuid
;
}
}
//** Check Session ID */
//** Check Session ID */
...
@@ -186,7 +187,7 @@ class MyApp extends StatelessWidget {
...
@@ -186,7 +187,7 @@ class MyApp extends StatelessWidget {
role:
roleStrg
,
role:
roleStrg
,
cashierName:
cashierNameStrg
,
cashierName:
cashierNameStrg
,
toBill:
toBill
,
toBill:
toBill
,
sessionId:
session
Id
,
orderId:
order
Id
,
token:
tokenUser
));
token:
tokenUser
));
}
else
if
(
uri
.
pathSegments
.
length
==
4
)
{
}
else
if
(
uri
.
pathSegments
.
length
==
4
)
{
brandStrg
=
uri
.
pathSegments
.
first
;
brandStrg
=
uri
.
pathSegments
.
first
;
...
@@ -208,7 +209,7 @@ class MyApp extends StatelessWidget {
...
@@ -208,7 +209,7 @@ class MyApp extends StatelessWidget {
role:
roleStrg
,
role:
roleStrg
,
cashierName:
cashierNameStrg
,
cashierName:
cashierNameStrg
,
toBill:
toBill
,
toBill:
toBill
,
sessionId:
session
Id
,
orderId:
order
Id
,
token:
tokenUser
));
token:
tokenUser
));
}
else
if
(
uri
.
pathSegments
.
length
==
5
)
{
}
else
if
(
uri
.
pathSegments
.
length
==
5
)
{
brandStrg
=
uri
.
pathSegments
.
first
;
brandStrg
=
uri
.
pathSegments
.
first
;
...
@@ -232,7 +233,7 @@ class MyApp extends StatelessWidget {
...
@@ -232,7 +233,7 @@ class MyApp extends StatelessWidget {
role:
roleStrg
,
role:
roleStrg
,
cashierName:
cashierNameStrg
,
cashierName:
cashierNameStrg
,
toBill:
toBill
,
toBill:
toBill
,
sessionId:
session
Id
,
orderId:
order
Id
,
token:
tokenUser
));
token:
tokenUser
));
}
}
return
null
;
return
null
;
...
...
lib/ui/checkout/checkout.dart
View file @
f80b3813
// ignore_for_file: unnecessary_brace_in_string_interps, sized_box_for_whitespace
// ignore_for_file: unnecessary_brace_in_string_interps, sized_box_for_whitespace
import
'package:byod/bloc/order_bloc.dart'
;
import
'package:byod/bloc/order_bloc.dart'
;
import
'package:byod/helper/prefs.dart'
;
import
'package:byod/helper/widget/style.dart'
;
import
'package:byod/helper/widget/style.dart'
;
import
'package:byod/ui/screen_responsive.dart'
;
import
'package:byod/ui/screen_responsive.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
...
@@ -80,7 +81,7 @@ class _CheckOutState extends State<CheckOut> {
...
@@ -80,7 +81,7 @@ class _CheckOutState extends State<CheckOut> {
double
widthScreen
=
responsiveWidthScreen
(
context
);
double
widthScreen
=
responsiveWidthScreen
(
context
);
double
currentScreen
=
MediaQuery
.
of
(
context
).
size
.
width
;
double
currentScreen
=
MediaQuery
.
of
(
context
).
size
.
width
;
double
maxWidthScreen
=
getMaxWidthScreen
(
context
,
useResponsive
);
double
maxWidthScreen
=
getMaxWidthScreen
(
context
,
useResponsive
);
int
tableMode
=
prefs
.
getInt
(
'table_mode'
)
??
defaultTable
;
int
tableMode
=
getTableMode
()
;
return
SafeArea
(
return
SafeArea
(
child:
Scaffold
(
child:
Scaffold
(
backgroundColor:
backgroundColor
,
backgroundColor:
backgroundColor
,
...
@@ -338,12 +339,12 @@ class _CheckOutState extends State<CheckOut> {
...
@@ -338,12 +339,12 @@ class _CheckOutState extends State<CheckOut> {
bottom:
MediaQuery
.
of
(
context
).
size
.
height
*
positionedBottom
,
bottom:
MediaQuery
.
of
(
context
).
size
.
height
*
positionedBottom
,
child:
GestureDetector
(
child:
GestureDetector
(
onTap:
()
{
onTap:
()
{
String
namaPelanggan
=
prefs
.
getString
(
"userName"
)
??
''
;
String
namaPelanggan
=
getCustomerName
()
;
if
(
tableMode
==
singleTable
&&
namaPelanggan
!=
''
)
{
if
(
tableMode
==
singleTable
&&
namaPelanggan
!=
''
)
{
checkOut
(
context
,
listOrders
,
namaPelanggan
);
checkOut
(
context
,
listOrders
,
namaPelanggan
);
}
else
{
}
else
{
String
namaPelanggan
=
prefs
.
getString
(
"userName"
)
??
''
;
String
namaPelanggan
=
getCustomerName
()
;
buttonDialog
(
context
,
namaPelanggan
,
listOrders
,
buttonDialog
(
context
,
namaPelanggan
,
listOrders
,
tableMode
,
widthScreen
);
tableMode
,
widthScreen
);
}
}
...
...
lib/ui/checkout/fuction.dart
View file @
f80b3813
import
'package:byod/helper/prefs.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_easyloading/flutter_easyloading.dart'
;
import
'package:flutter_easyloading/flutter_easyloading.dart'
;
import
'../../api/api.dart'
;
import
'../../api/api.dart'
;
import
'../../main.dart'
;
import
'../../models/orders.dart'
;
import
'../../models/orders.dart'
;
checkOut
(
BuildContext
context
,
List
<
Orders
>
listOrders
,
String
name
)
async
{
checkOut
(
BuildContext
context
,
List
<
Orders
>
listOrders
,
String
name
)
async
{
String
namaPelanggan
=
prefs
.
getString
(
"userName"
)
??
''
;
String
namaPelanggan
=
getCustomerName
()
;
String
namaPelangganFix
=
''
;
String
namaPelangganFix
=
''
;
if
(
namaPelanggan
==
''
)
{
if
(
namaPelanggan
==
''
)
{
await
prefs
.
setString
(
"userName"
,
name
);
setCustomerName
(
name
);
namaPelangganFix
=
name
;
namaPelangganFix
=
name
;
}
else
{
}
else
{
namaPelangganFix
=
namaPelanggan
;
namaPelangganFix
=
namaPelanggan
;
...
@@ -18,10 +18,10 @@ checkOut(BuildContext context, List<Orders> listOrders, String name) async {
...
@@ -18,10 +18,10 @@ checkOut(BuildContext context, List<Orders> listOrders, String name) async {
status:
'Memproses pesanan...'
,
status:
'Memproses pesanan...'
,
maskType:
EasyLoadingMaskType
.
none
,
maskType:
EasyLoadingMaskType
.
none
,
);
);
String
branchCode
=
prefs
.
getString
(
'outlet'
)
??
''
;
String
branchCode
=
getBranchPref
()
;
String
brand
=
prefs
.
getString
(
'brand'
)
??
''
;
String
brand
=
getBrand
()
;
String
tableNumber
=
prefs
.
getString
(
'table_number'
)
??
''
;
String
tableNumber
=
getTabelNumber
()
;
// String baseUrl = prefs.getString('baseUrl') ?? '';
// String baseUrl = prefs.getString('baseUrl') ?? '';
// String urlCheckout = "${baseUrl}checkout";
// String urlCheckout = "${baseUrl}checkout";
...
...
lib/ui/history_order/history.dart
View file @
f80b3813
...
@@ -108,7 +108,7 @@ class HistoryOrder extends StatelessWidget {
...
@@ -108,7 +108,7 @@ class HistoryOrder extends StatelessWidget {
MaterialPageRoute
(
MaterialPageRoute
(
builder:
(
_
)
=>
ViewBillNew
(
builder:
(
_
)
=>
ViewBillNew
(
isHistory:
true
,
isHistory:
true
,
sessionId:
jsonDecodeHistory
[
'session
'
],
orderId:
jsonDecodeHistory
[
'order_id
'
],
branchCodeH:
jsonDecodeHistory
[
'branch_code'
],
branchCodeH:
jsonDecodeHistory
[
'branch_code'
],
brandCodeH:
jsonDecodeHistory
[
'brand'
],
brandCodeH:
jsonDecodeHistory
[
'brand'
],
token:
jsonDecodeHistory
[
'token'
],
token:
jsonDecodeHistory
[
'token'
],
...
...
lib/ui/history_order/history_new.dart
View file @
f80b3813
...
@@ -62,7 +62,7 @@ class HistoryOrderNew extends StatelessWidget {
...
@@ -62,7 +62,7 @@ class HistoryOrderNew extends StatelessWidget {
MaterialPageRoute
(
MaterialPageRoute
(
builder:
(
_
)
=>
ViewBillNew
(
builder:
(
_
)
=>
ViewBillNew
(
isHistory:
true
,
isHistory:
true
,
sessionId:
jsonDecodeHistory
[
'session
'
],
orderId:
jsonDecodeHistory
[
'order_id
'
],
branchCodeH:
jsonDecodeHistory
[
'branch_code'
],
branchCodeH:
jsonDecodeHistory
[
'branch_code'
],
brandCodeH:
jsonDecodeHistory
[
'brand'
],
brandCodeH:
jsonDecodeHistory
[
'brand'
],
token:
jsonDecodeHistory
[
'token'
],
token:
jsonDecodeHistory
[
'token'
],
...
...
lib/ui/home/bottom_sheet_menu_new.dart
View file @
f80b3813
...
@@ -62,13 +62,21 @@ class ShowMenuBottomSheet extends StatelessWidget {
...
@@ -62,13 +62,21 @@ class ShowMenuBottomSheet extends StatelessWidget {
),
),
ClipRRect
(
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
21
),
borderRadius:
BorderRadius
.
circular
(
21
),
child:
Image
(
child:
(
menuDetail
[
i
].
imageUrlMedium
!=
''
)
width:
widthImage
,
?
Image
(
height:
widthImage
,
width:
widthImage
,
image:
NetworkImage
(
height:
widthImage
,
menuDetail
[
i
].
imageUrlMedium
,
image:
NetworkImage
(
),
menuDetail
[
i
].
imageUrlMedium
,
),
),
)
:
Image
(
width:
widthImage
,
height:
widthImage
,
image:
const
AssetImage
(
'assets/noimage.png'
,
),
),
),
),
const
SizedBox
(
const
SizedBox
(
height:
20
,
height:
20
,
...
...
lib/ui/home/home.dart
View file @
f80b3813
...
@@ -6,6 +6,7 @@ import 'package:byod/bloc/filter_menu.dart';
...
@@ -6,6 +6,7 @@ import 'package:byod/bloc/filter_menu.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/helper.dart'
;
import
'package:byod/helper/prefs.dart'
;
import
'package:byod/helper/widget/style.dart'
;
import
'package:byod/helper/widget/style.dart'
;
import
'package:byod/models/category_list.dart'
;
import
'package:byod/models/category_list.dart'
;
import
'package:byod/models/filter_menu.dart'
;
import
'package:byod/models/filter_menu.dart'
;
...
@@ -32,8 +33,8 @@ class Home extends StatefulWidget {
...
@@ -32,8 +33,8 @@ class Home extends StatefulWidget {
}
}
class
_HomeState
extends
State
<
Home
>
{
class
_HomeState
extends
State
<
Home
>
{
String
tableNumber
=
prefs
.
getString
(
"table_number"
)
??
""
;
String
tableNumber
=
getTabelNumber
()
;
String
userName
=
prefs
.
getString
(
"userName"
)
??
""
;
String
userName
=
getCustomerName
()
;
final
searchController
=
TextEditingController
();
final
searchController
=
TextEditingController
();
final
_scrollController
=
ScrollController
();
final
_scrollController
=
ScrollController
();
bool
isSearch
=
true
;
bool
isSearch
=
true
;
...
@@ -75,7 +76,7 @@ class _HomeState extends State<Home> {
...
@@ -75,7 +76,7 @@ class _HomeState extends State<Home> {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
int
tableMode
=
prefs
.
getInt
(
'table_mode'
)
??
defaultTable
;
int
tableMode
=
getTableMode
()
;
// context.read<FeedBackOptionBloc>().getOptionFeedback();
// context.read<FeedBackOptionBloc>().getOptionFeedback();
double
widthScreen
=
responsiveWidthScreen
(
context
);
double
widthScreen
=
responsiveWidthScreen
(
context
);
double
maxWidthScreen
=
getMaxWidthScreen
(
context
,
useResponsive
);
double
maxWidthScreen
=
getMaxWidthScreen
(
context
,
useResponsive
);
...
@@ -485,12 +486,12 @@ class _HomeState extends State<Home> {
...
@@ -485,12 +486,12 @@ class _HomeState extends State<Home> {
}
}
return
GestureDetector
(
return
GestureDetector
(
onTap:
()
{
onTap:
()
{
String
namaPelanggan
=
prefs
.
getString
(
"userName"
)
??
''
;
String
namaPelanggan
=
getCustomerName
()
;
if
(
tableMode
==
singleTable
)
{
if
(
tableMode
==
singleTable
)
{
if
(
tableMode
==
singleTable
&&
namaPelanggan
!=
''
)
{
if
(
tableMode
==
singleTable
&&
namaPelanggan
!=
''
)
{
checkOut
(
context
,
listOrders
,
namaPelanggan
);
checkOut
(
context
,
listOrders
,
namaPelanggan
);
}
else
{
}
else
{
String
namaPelanggan
=
prefs
.
getString
(
"userName"
)
??
''
;
String
namaPelanggan
=
getCustomerName
()
;
buttonDialog
(
buttonDialog
(
context
,
namaPelanggan
,
listOrders
,
tableMode
,
widthScreen
);
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';
...
@@ -7,6 +7,7 @@ import 'package:byod/bloc/order_bloc.dart';
import
'package:byod/bloc/search_active.dart'
;
import
'package:byod/bloc/search_active.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/helper.dart'
;
import
'package:byod/helper/prefs.dart'
;
import
'package:byod/helper/widget/style.dart'
;
import
'package:byod/helper/widget/style.dart'
;
import
'package:byod/models/filter_menu.dart'
;
import
'package:byod/models/filter_menu.dart'
;
import
'package:byod/models/orders.dart'
;
import
'package:byod/models/orders.dart'
;
...
@@ -201,9 +202,9 @@ class _NewHome2State extends State<NewHome2> {
...
@@ -201,9 +202,9 @@ class _NewHome2State extends State<NewHome2> {
// categoryFont -
// categoryFont -
// spacerAboveCatList;
// spacerAboveCatList;
int
tableMode
=
prefs
.
getInt
(
'table_mode'
)
??
defaultTable
;
int
tableMode
=
getTableMode
()
;
String
tableNumber
=
prefs
.
getString
(
"table_number"
)
??
""
;
String
tableNumber
=
getTabelNumber
()
;
String
userName
=
prefs
.
getString
(
"userName"
)
??
""
;
String
userName
=
getCustomerName
()
;
double
widthScreen
=
responsiveWidthScreen
(
context
);
double
widthScreen
=
responsiveWidthScreen
(
context
);
double
maxWidthScreen
=
getMaxWidthScreen
(
context
,
useResponsive
);
double
maxWidthScreen
=
getMaxWidthScreen
(
context
,
useResponsive
);
return
BlocBuilder
<
BranchExist
,
String
>(
return
BlocBuilder
<
BranchExist
,
String
>(
...
@@ -582,7 +583,7 @@ class _NewHome2State extends State<NewHome2> {
...
@@ -582,7 +583,7 @@ class _NewHome2State extends State<NewHome2> {
int
tableMode
,
int
tableMode
,
bool
isSearchActive
,
bool
isSearchActive
,
)
{
)
{
String
logoUrl
=
prefs
.
getString
(
"logoUrl"
)
??
""
;
String
logoUrl
=
getLogoUrl
()
;
return
Stack
(
return
Stack
(
children:
[
children:
[
Container
(
Container
(
...
...
lib/ui/payment/payment.dart
View file @
f80b3813
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
import
'package:byod/bloc/check_voucher.dart'
;
import
'package:byod/bloc/check_voucher.dart'
;
import
'package:byod/helper/helper.dart'
;
import
'package:byod/helper/helper.dart'
;
import
'package:byod/helper/prefs.dart'
;
import
'package:byod/helper/widget/style.dart'
;
import
'package:byod/helper/widget/style.dart'
;
import
'package:byod/ui/screen_responsive.dart'
;
import
'package:byod/ui/screen_responsive.dart'
;
import
'package:byod/ui/viewbill/view_bill.dart'
;
import
'package:byod/ui/viewbill/view_bill.dart'
;
...
@@ -56,9 +57,9 @@ class _PaymentState extends State<Payment> {
...
@@ -56,9 +57,9 @@ class _PaymentState extends State<Payment> {
double
currentScreen
=
MediaQuery
.
of
(
context
).
size
.
width
;
double
currentScreen
=
MediaQuery
.
of
(
context
).
size
.
width
;
double
maxWidthScreen
=
getMaxWidthScreen
(
context
,
useResponsive
);
double
maxWidthScreen
=
getMaxWidthScreen
(
context
,
useResponsive
);
double
paddingLeftRight
=
widthScreen
*
0.05
;
double
paddingLeftRight
=
widthScreen
*
0.05
;
String
branchCode
=
prefs
.
getString
(
"outlet"
)
??
''
;
String
branchCode
=
getBranchPref
()
;
String
brandCode
=
prefs
.
getString
(
"brand"
)
??
''
;
String
brandCode
=
getBrand
()
;
String
customerName
=
prefs
.
getString
(
"userName"
)
??
''
;
String
customerName
=
getCustomerName
()
;
context
context
.
read
<
VoucherCheck
>()
.
read
<
VoucherCheck
>()
.
changeVoucher
();
// user dipaksa input ulang voucher
.
changeVoucher
();
// user dipaksa input ulang voucher
...
...
lib/ui/payment/payment_balance.dart
View file @
f80b3813
...
@@ -2,13 +2,13 @@
...
@@ -2,13 +2,13 @@
import
'dart:math'
;
import
'dart:math'
;
import
'package:byod/helper/prefs.dart'
;
import
'package:byod/helper/widget/button_modal.dart'
;
import
'package:byod/helper/widget/button_modal.dart'
;
import
'package:byod/ui/payment/function.dart'
;
import
'package:byod/ui/payment/function.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'../../helper/helper.dart'
;
import
'../../helper/helper.dart'
;
import
'../../helper/widget/style.dart'
;
import
'../../helper/widget/style.dart'
;
import
'../../main.dart'
;
import
'../screen_responsive.dart'
;
import
'../screen_responsive.dart'
;
import
'../viewbill/view_bill_new.dart'
;
import
'../viewbill/view_bill_new.dart'
;
...
@@ -58,9 +58,9 @@ class CorePaymentBalance extends StatelessWidget {
...
@@ -58,9 +58,9 @@ class CorePaymentBalance extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
int
outStandingTopayMember
=
min
(
outStanding
,
balanceMember
);
int
outStandingTopayMember
=
min
(
outStanding
,
balanceMember
);
double
widthScreen
=
responsiveWidthScreen
(
context
);
double
widthScreen
=
responsiveWidthScreen
(
context
);
String
branchCode
=
prefs
.
getString
(
"outlet"
)
??
''
;
String
branchCode
=
getBranchPref
()
;
String
brandCode
=
prefs
.
getString
(
"brand"
)
??
''
;
String
brandCode
=
getBrand
()
;
String
customerName
=
prefs
.
getString
(
"userName"
)
??
''
;
String
customerName
=
getCustomerName
()
;
return
Container
(
return
Container
(
width:
widthScreen
,
width:
widthScreen
,
child:
Stack
(
child:
Stack
(
...
...
lib/ui/payment/payment_voucher.dart
View file @
f80b3813
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
import
'package:byod/bloc/check_voucher.dart'
;
import
'package:byod/bloc/check_voucher.dart'
;
import
'package:byod/bloc/voucher_list.dart'
;
import
'package:byod/bloc/voucher_list.dart'
;
import
'package:byod/helper/helper.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/button_modal.dart'
;
import
'package:byod/main.dart'
;
import
'package:byod/main.dart'
;
import
'package:byod/ui/screen_responsive.dart'
;
import
'package:byod/ui/screen_responsive.dart'
;
...
@@ -51,13 +52,13 @@ class CorePaymentVoucher extends StatelessWidget {
...
@@ -51,13 +52,13 @@ class CorePaymentVoucher extends StatelessWidget {
final
int
outstandingAll
;
final
int
outstandingAll
;
final
List
<
Bill
>
dataBill
;
final
List
<
Bill
>
dataBill
;
final
String
branchCode
=
prefs
.
getString
(
"outlet"
)
??
''
;
final
String
branchCode
=
getBranchPref
()
;
final
String
brandCode
=
prefs
.
getString
(
"brand"
)
??
''
;
final
String
brandCode
=
getBrand
()
;
final
String
customerName
=
prefs
.
getString
(
"userName"
)
??
''
;
final
String
customerName
=
getCustomerName
()
;
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
double
widthScreen
=
responsiveWidthScreen
(
context
);
double
widthScreen
=
responsiveWidthScreen
(
context
);
String
logoUrl
=
prefs
.
getString
(
'logoUrl'
)
??
''
;
String
logoUrl
=
getLogoUrl
()
;
return
Container
(
return
Container
(
width:
widthScreen
,
width:
widthScreen
,
child:
BlocBuilder
<
VoucherCheck
,
List
<
dynamic
>>(
child:
BlocBuilder
<
VoucherCheck
,
List
<
dynamic
>>(
...
...
lib/ui/splash.dart
View file @
f80b3813
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
import
'dart:convert'
;
import
'dart:convert'
;
import
'package:byod/bloc/filter_menu.dart'
;
import
'package:byod/bloc/member_info.dart'
;
import
'package:byod/bloc/member_info.dart'
;
import
'package:byod/helper/helper.dart'
;
import
'package:byod/helper/helper.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/viewbill/view_bill_new.dart'
;
import
'package:byod/ui/viewbill/view_bill_new.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
...
@@ -18,7 +18,7 @@ import 'home/shimmer_menu.dart';
...
@@ -18,7 +18,7 @@ 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
,
session
Id
,
token
;
final
String
param
,
brand
,
tn
,
role
,
cashierName
,
toBill
,
order
Id
,
token
;
const
Splash
(
const
Splash
(
{
Key
?
key
,
{
Key
?
key
,
required
this
.
param
,
required
this
.
param
,
...
@@ -27,7 +27,7 @@ class Splash extends StatefulWidget {
...
@@ -27,7 +27,7 @@ class Splash extends StatefulWidget {
required
this
.
role
,
required
this
.
role
,
required
this
.
cashierName
,
required
this
.
cashierName
,
required
this
.
toBill
,
required
this
.
toBill
,
required
this
.
session
Id
,
required
this
.
order
Id
,
required
this
.
token
})
required
this
.
token
})
:
super
(
key:
key
);
:
super
(
key:
key
);
...
@@ -54,30 +54,32 @@ class _SplashState extends State<Splash> {
...
@@ -54,30 +54,32 @@ class _SplashState extends State<Splash> {
@override
@override
void
initState
()
{
void
initState
()
{
loadBaseUrl
().
then
((
baseUrl
)
{
loadBaseUrl
().
then
((
baseUrl
)
{
prefs
.
setString
(
'baseUrl'
,
baseUrl
);
setBaseUrl
(
baseUrl
);
context
.
read
<
BranchExist
>().
branchExist
(
context
.
read
<
BranchExist
>().
branchExist
(
widget
.
param
,
widget
.
param
,
widget
.
brand
,
widget
.
brand
,
widget
.
role
,
widget
.
role
,
widget
.
cashierName
,
widget
.
cashierName
,
widget
.
sessionId
,
widget
.
orderId
,
context
,
getMenu:
true
,
);
);
// context.read<CategoryMenu>().catAndMenu(widget.param, widget.brand,
// context.read<CategoryMenu>().catAndMenu(widget.param, 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.param, widget.brand,
widget
.
role
,
widget
.
cashierName
,
widget
.
token
);
//
widget.role, widget.cashierName, widget.token);
if
(
widget
.
token
!=
''
)
{
if
(
widget
.
token
!=
''
)
{
context
.
read
<
MemberInfoBloc
>().
getMemberInfo
(
widget
.
token
);
context
.
read
<
MemberInfoBloc
>().
getMemberInfo
(
widget
.
token
);
}
}
Future
.
delayed
(
const
Duration
(
milliseconds:
1000
),
()
async
{
Future
.
delayed
(
const
Duration
(
milliseconds:
1000
),
()
async
{
await
prefs
.
setString
(
'token'
,
widget
.
token
);
setToken
(
widget
.
token
);
await
prefs
.
setString
(
'outlet'
,
widget
.
param
);
setBranch
(
widget
.
param
);
await
prefs
.
setString
(
'brand'
,
widget
.
brand
);
setBrand
(
widget
.
brand
);
await
prefs
.
setString
(
'table_number'
,
widget
.
tn
);
setTableNumber
(
widget
.
tn
);
await
prefs
.
setString
(
'role'
,
widget
.
role
);
setRole
(
widget
.
role
);
await
prefs
.
setString
(
'cashier_name'
,
widget
.
cashierName
);
setCashierName
(
widget
.
cashierName
);
// ignore: use_build_context_synchronously
// ignore: use_build_context_synchronously
if
(
widget
.
toBill
==
'go'
)
{
if
(
widget
.
toBill
==
'go'
)
{
...
...
lib/ui/viewbill/app_bar.dart
View file @
f80b3813
// ignore_for_file: sized_box_for_whitespace
// ignore_for_file: sized_box_for_whitespace
import
'package:byod/helper/prefs.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'../../bloc/branch_exist.dart'
;
import
'../../bloc/branch_exist.dart'
;
import
'../../helper/helper.dart'
;
import
'../../helper/helper.dart'
;
import
'../../helper/widget/style.dart'
;
import
'../../helper/widget/style.dart'
;
import
'../../main.dart'
;
import
'../home/new_home2.dart'
;
import
'../home/new_home2.dart'
;
class
CustomAppBar
extends
StatelessWidget
{
class
CustomAppBar
extends
StatelessWidget
{
...
@@ -19,11 +19,11 @@ class CustomAppBar extends StatelessWidget {
...
@@ -19,11 +19,11 @@ class CustomAppBar extends StatelessWidget {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
String
branchCode
=
prefs
.
getString
(
'outlet'
)
??
''
;
String
branchCode
=
getBranchPref
()
;
String
brandCode
=
prefs
.
getString
(
'brand'
)
??
''
;
String
brandCode
=
getBrand
()
;
String
role
=
prefs
.
getString
(
'role'
)
??
''
;
String
role
=
getRole
()
;
String
cashierName
=
prefs
.
getString
(
'cashier_name'
)
??
''
;
String
cashierName
=
getCashierName
()
;
String
sessionId
=
prefs
.
getString
(
'sessionId'
)
??
''
;
String
sessionId
=
getOrderId
()
;
return
Container
(
return
Container
(
padding:
const
EdgeInsets
.
only
(
padding:
const
EdgeInsets
.
only
(
top:
15
,
top:
15
,
...
@@ -42,7 +42,13 @@ class CustomAppBar extends StatelessWidget {
...
@@ -42,7 +42,13 @@ class CustomAppBar extends StatelessWidget {
Navigator
.
pushReplacement
(
context
,
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
NewHome2
()));
MaterialPageRoute
(
builder:
(
_
)
=>
const
NewHome2
()));
context
.
read
<
BranchExist
>().
branchExist
(
context
.
read
<
BranchExist
>().
branchExist
(
branchCode
,
brandCode
,
role
,
cashierName
,
sessionId
);
branchCode
,
brandCode
,
role
,
cashierName
,
sessionId
,
context
,
);
}
else
{
}
else
{
Navigator
.
pop
(
context
);
Navigator
.
pop
(
context
);
}
}
...
...
lib/ui/viewbill/order_view_bill_new.dart
View file @
f80b3813
...
@@ -149,14 +149,23 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
...
@@ -149,14 +149,23 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
children:
[
children:
[
ClipRRect
(
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
5
),
borderRadius:
BorderRadius
.
circular
(
5
),
child:
Image
(
child:
(
widget
.
billDetail
.
imageUrl
!=
''
)
width:
80
,
?
Image
(
height:
80
,
width:
80
,
fit:
BoxFit
.
fill
,
height:
80
,
image:
NetworkImage
(
fit:
BoxFit
.
fill
,
widget
.
billDetail
.
imageUrl
,
image:
NetworkImage
(
),
widget
.
billDetail
.
imageUrl
,
),
),
)
:
const
Image
(
width:
80
,
height:
80
,
fit:
BoxFit
.
fill
,
image:
AssetImage
(
'assets/noimage.png'
,
),
),
),
),
const
SizedBox
(
const
SizedBox
(
width:
8
,
width:
8
,
...
...
lib/ui/viewbill/view_bill.dart
View file @
f80b3813
...
@@ -37,7 +37,7 @@ import 'order_view_bill.dart';
...
@@ -37,7 +37,7 @@ import 'order_view_bill.dart';
class
ViewBill
extends
StatefulWidget
{
class
ViewBill
extends
StatefulWidget
{
// ini berlaku ketika lihat history
// ini berlaku ketika lihat history
bool
isHistory
;
bool
isHistory
;
String
session
Id
;
String
order
Id
;
String
branchCode
;
String
branchCode
;
String
brandCode
;
String
brandCode
;
String
tableNumber
;
String
tableNumber
;
...
@@ -46,7 +46,7 @@ class ViewBill extends StatefulWidget {
...
@@ -46,7 +46,7 @@ class ViewBill extends StatefulWidget {
ViewBill
({
ViewBill
({
Key
?
key
,
Key
?
key
,
this
.
isHistory
=
false
,
this
.
isHistory
=
false
,
this
.
session
Id
=
''
,
this
.
order
Id
=
''
,
this
.
branchCode
=
''
,
this
.
branchCode
=
''
,
this
.
brandCode
=
''
,
this
.
brandCode
=
''
,
this
.
tableNumber
=
''
,
this
.
tableNumber
=
''
,
...
@@ -81,7 +81,7 @@ class _ViewBillState extends State<ViewBill> {
...
@@ -81,7 +81,7 @@ class _ViewBillState extends State<ViewBill> {
context
.
read
<
ViewBillBloc
>().
getBill
();
context
.
read
<
ViewBillBloc
>().
getBill
();
}
else
{
}
else
{
context
.
read
<
ViewBillBloc
>().
getBill
(
context
.
read
<
ViewBillBloc
>().
getBill
(
sessionIdH:
widget
.
session
Id
,
orderIdH:
widget
.
order
Id
,
branchCodeH:
widget
.
branchCode
,
branchCodeH:
widget
.
branchCode
,
brandCodeH:
widget
.
brandCode
,
brandCodeH:
widget
.
brandCode
,
tableNumberH:
widget
.
tableNumber
,
tableNumberH:
widget
.
tableNumber
,
...
@@ -227,7 +227,7 @@ class _ViewBillState extends State<ViewBill> {
...
@@ -227,7 +227,7 @@ class _ViewBillState extends State<ViewBill> {
context
,
context
,
dataBill
,
dataBill
,
widget
.
isHistory
,
widget
.
isHistory
,
sessionID:
widget
.
session
Id
,
sessionID:
widget
.
order
Id
,
);
);
}
}
});
});
...
@@ -415,6 +415,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
...
@@ -415,6 +415,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
role
,
role
,
cashierName
,
cashierName
,
sessionID
,
sessionID
,
context
,
);
);
Navigator
.
push
(
Navigator
.
push
(
context
,
context
,
...
@@ -648,7 +649,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
...
@@ -648,7 +649,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
context
,
context
,
dataBill
,
dataBill
,
widget
.
isHistory
,
widget
.
isHistory
,
sessionID:
widget
.
session
Id
,
sessionID:
widget
.
order
Id
,
);
);
},
},
child:
Container
(
child:
Container
(
...
@@ -750,6 +751,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
...
@@ -750,6 +751,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
role
,
role
,
cashierName
,
cashierName
,
sessionID
,
sessionID
,
context
,
);
);
Navigator
.
push
(
Navigator
.
push
(
context
,
context
,
...
@@ -1250,7 +1252,13 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
...
@@ -1250,7 +1252,13 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
Navigator
.
pushReplacement
(
context
,
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
NewHome2
()));
MaterialPageRoute
(
builder:
(
_
)
=>
const
NewHome2
()));
context
.
read
<
BranchExist
>().
branchExist
(
context
.
read
<
BranchExist
>().
branchExist
(
branchCode
,
brandCode
,
role
,
cashierName
,
sessionId
);
branchCode
,
brandCode
,
role
,
cashierName
,
sessionId
,
context
,
);
}
else
{
}
else
{
Navigator
.
pop
(
context
);
Navigator
.
pop
(
context
);
}
}
...
...
lib/ui/viewbill/view_bill_new.dart
View file @
f80b3813
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
import
'dart:math'
;
import
'dart:math'
;
import
'package:byod/bloc/member_info.dart'
;
import
'package:byod/bloc/member_info.dart'
;
import
'package:byod/helper/helper.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/button_modal.dart'
;
import
'package:byod/helper/widget/style.dart'
;
import
'package:byod/helper/widget/style.dart'
;
import
'package:byod/ui/history_order/history_new.dart'
;
import
'package:byod/ui/history_order/history_new.dart'
;
...
@@ -22,7 +23,6 @@ import '../../helper/widget/button_dialog.dart';
...
@@ -22,7 +23,6 @@ import '../../helper/widget/button_dialog.dart';
import
'../../helper/widget/emoticon_rate_new.dart'
;
import
'../../helper/widget/emoticon_rate_new.dart'
;
import
'../../helper/widget/open_url.dart'
;
import
'../../helper/widget/open_url.dart'
;
import
'../../helper/widget/thousand_formatter.dart'
;
import
'../../helper/widget/thousand_formatter.dart'
;
import
'../../main.dart'
;
import
'../../models/bill.dart'
;
import
'../../models/bill.dart'
;
import
'../../models/member_info.dart'
;
import
'../../models/member_info.dart'
;
import
'../build_version.dart'
;
import
'../build_version.dart'
;
...
@@ -39,7 +39,7 @@ class ViewBillNew extends StatelessWidget {
...
@@ -39,7 +39,7 @@ class ViewBillNew extends StatelessWidget {
// const ViewBillNew({Key? key}) : super(key: key);
// const ViewBillNew({Key? key}) : super(key: key);
final
bool
isHistory
;
final
bool
isHistory
;
final
String
session
Id
;
final
String
order
Id
;
final
String
branchCodeH
;
final
String
branchCodeH
;
final
String
brandCodeH
;
final
String
brandCodeH
;
final
String
tableNumberH
;
final
String
tableNumberH
;
...
@@ -48,7 +48,7 @@ class ViewBillNew extends StatelessWidget {
...
@@ -48,7 +48,7 @@ class ViewBillNew extends StatelessWidget {
const
ViewBillNew
({
const
ViewBillNew
({
Key
?
key
,
Key
?
key
,
this
.
isHistory
=
false
,
this
.
isHistory
=
false
,
this
.
session
Id
=
''
,
this
.
order
Id
=
''
,
this
.
branchCodeH
=
''
,
this
.
branchCodeH
=
''
,
this
.
brandCodeH
=
''
,
this
.
brandCodeH
=
''
,
this
.
tableNumberH
=
''
,
this
.
tableNumberH
=
''
,
...
@@ -60,8 +60,8 @@ class ViewBillNew extends StatelessWidget {
...
@@ -60,8 +60,8 @@ class ViewBillNew extends StatelessWidget {
// RefreshController(initialRefresh: false);
// RefreshController(initialRefresh: false);
void
saveBillDetail
(
List
<
Bill
>
dataBill
)
async
{
void
saveBillDetail
(
List
<
Bill
>
dataBill
)
async
{
await
prefs
.
setString
(
'total_order'
,
dataBill
[
0
].
totalSeluruhOrderan
);
setTotalOrder
(
dataBill
[
0
].
totalSeluruhOrderan
);
await
prefs
.
setString
(
'date_order'
,
dataBill
[
0
].
dateOrder
);
setOrderDate
(
dataBill
[
0
].
dateOrder
);
}
}
void
getBillFunc
(
BuildContext
context
)
{
void
getBillFunc
(
BuildContext
context
)
{
...
@@ -69,7 +69,7 @@ class ViewBillNew extends StatelessWidget {
...
@@ -69,7 +69,7 @@ class ViewBillNew extends StatelessWidget {
context
.
read
<
ViewBillBloc
>().
getBill
();
context
.
read
<
ViewBillBloc
>().
getBill
();
}
else
{
}
else
{
context
.
read
<
ViewBillBloc
>().
getBill
(
context
.
read
<
ViewBillBloc
>().
getBill
(
sessionIdH:
session
Id
,
orderIdH:
order
Id
,
branchCodeH:
branchCodeH
,
branchCodeH:
branchCodeH
,
brandCodeH:
brandCodeH
,
brandCodeH:
brandCodeH
,
tableNumberH:
tableNumberH
,
tableNumberH:
tableNumberH
,
...
@@ -92,16 +92,16 @@ class ViewBillNew extends StatelessWidget {
...
@@ -92,16 +92,16 @@ class ViewBillNew extends StatelessWidget {
const
uuidInit
=
Uuid
();
const
uuidInit
=
Uuid
();
var
uuid
=
uuidInit
.
v4
();
var
uuid
=
uuidInit
.
v4
();
//** UUID */
//** UUID */
String
branchCode
=
prefs
.
getString
(
"outlet"
)
??
''
;
String
branchCode
=
getBranchPref
()
;
String
brandCode
=
prefs
.
getString
(
"brand"
)
??
''
;
String
brandCode
=
getBrand
()
;
String
tableNumber
=
prefs
.
getString
(
"table_number"
)
??
''
;
String
tableNumber
=
getTabelNumber
()
;
String
role
=
prefs
.
getString
(
"role"
)
??
''
;
String
role
=
getRole
()
;
String
customerName
=
prefs
.
getString
(
"userName"
)
??
''
;
String
customerName
=
getCustomerName
()
;
String
cashierName
=
prefs
.
getString
(
"cashier_name"
)
??
''
;
String
cashierName
=
getCashierName
()
;
// String token = prefs.getString("token") ?? '';
// String token = prefs.getString("token") ?? '';
String
sessionID
=
prefs
.
getString
(
"sessionId"
)
??
uuid
;
String
orderId
=
getOrderId
()
;
int
tableMode
=
prefs
.
getInt
(
'table_mode'
)
??
defaultTable
;
int
tableMode
=
getTableMode
()
;
List
<
String
>
historyOrder
=
prefs
.
getStringList
(
'list_history'
)
??
[]
;
List
<
String
>
historyOrder
=
getListHistory
()
;
return
SafeArea
(
return
SafeArea
(
child:
Scaffold
(
child:
Scaffold
(
...
@@ -222,7 +222,7 @@ class ViewBillNew extends StatelessWidget {
...
@@ -222,7 +222,7 @@ class ViewBillNew extends StatelessWidget {
context
,
context
,
dataBill
,
dataBill
,
isHistory
,
isHistory
,
sessionID:
session
Id
,
orderId:
order
Id
,
);
);
}
}
});
});
...
@@ -281,7 +281,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
...
@@ -281,7 +281,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
onTapCashier:
onTapCashier
,
onTapCashier:
onTapCashier
,
branchCode:
branchCode
,
branchCode:
branchCode
,
brandCode:
brandCode
,
brandCode:
brandCode
,
sessionId:
session
Id
,
orderId:
order
Id
,
),
),
widthScreen:
MediaQuery
.
of
(
context
).
size
.
width
,
widthScreen:
MediaQuery
.
of
(
context
).
size
.
width
,
isCoreLayout:
true
,
isCoreLayout:
true
,
...
@@ -295,7 +295,6 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
...
@@ -295,7 +295,6 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
brandCode:
brandCode
,
brandCode:
brandCode
,
customerName:
customerName
,
customerName:
customerName
,
isHistory:
isHistory
,
isHistory:
isHistory
,
sessionId:
sessionID
,
historyOrder:
historyOrder
,
historyOrder:
historyOrder
,
),
),
widthScreen:
currentScreen
,
widthScreen:
currentScreen
,
...
@@ -344,7 +343,7 @@ class CoreBill extends StatelessWidget {
...
@@ -344,7 +343,7 @@ class CoreBill extends StatelessWidget {
required
this
.
onTapCashier
,
required
this
.
onTapCashier
,
required
this
.
branchCode
,
required
this
.
branchCode
,
required
this
.
brandCode
,
required
this
.
brandCode
,
required
this
.
session
Id
,
required
this
.
order
Id
,
})
:
super
(
key:
key
);
})
:
super
(
key:
key
);
final
double
widthScreen
;
final
double
widthScreen
;
...
@@ -358,7 +357,7 @@ class CoreBill extends StatelessWidget {
...
@@ -358,7 +357,7 @@ class CoreBill extends StatelessWidget {
final
void
Function
()
onTapCashier
;
final
void
Function
()
onTapCashier
;
final
String
branchCode
;
final
String
branchCode
;
final
String
brandCode
;
final
String
brandCode
;
final
String
session
Id
;
final
String
order
Id
;
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
...
@@ -879,8 +878,7 @@ class CoreBill extends StatelessWidget {
...
@@ -879,8 +878,7 @@ class CoreBill extends StatelessWidget {
onTap:
()
{
onTap:
()
{
String
titlePayment
;
String
titlePayment
;
String
customerName
=
String
customerName
=
prefs
.
getString
(
'userName'
)
??
getCustomerName
();
''
;
bool
isIndividu
;
bool
isIndividu
;
if
(
tableMode
==
multiTable
)
{
if
(
tableMode
==
multiTable
)
{
isIndividu
=
true
;
isIndividu
=
true
;
...
@@ -1117,7 +1115,7 @@ class CoreBill extends StatelessWidget {
...
@@ -1117,7 +1115,7 @@ class CoreBill extends StatelessWidget {
context
,
context
,
dataBill
,
dataBill
,
isHistory
,
isHistory
,
sessionID:
session
Id
,
orderId:
order
Id
,
);
);
}
}
}
}
...
@@ -1175,7 +1173,6 @@ class EmptyBill extends StatelessWidget {
...
@@ -1175,7 +1173,6 @@ class EmptyBill extends StatelessWidget {
required
this
.
customerName
,
required
this
.
customerName
,
required
this
.
branchCode
,
required
this
.
branchCode
,
required
this
.
brandCode
,
required
this
.
brandCode
,
required
this
.
sessionId
,
required
this
.
historyOrder
,
required
this
.
historyOrder
,
})
:
super
(
key:
key
);
})
:
super
(
key:
key
);
...
@@ -1184,13 +1181,12 @@ class EmptyBill extends StatelessWidget {
...
@@ -1184,13 +1181,12 @@ class EmptyBill extends StatelessWidget {
final
String
customerName
;
final
String
customerName
;
final
String
branchCode
;
final
String
branchCode
;
final
String
brandCode
;
final
String
brandCode
;
final
String
sessionId
;
final
String
tableNumber
=
getTabelNumber
();
final
String
tableNumber
=
prefs
.
getString
(
"table_number"
)
??
''
;
final
List
<
String
>
historyOrder
;
final
List
<
String
>
historyOrder
;
final
String
role
=
prefs
.
getString
(
'role'
)
??
''
;
final
String
role
=
getRole
()
;
final
String
cashierName
=
prefs
.
getString
(
'cashier_name'
)
??
''
;
final
String
cashierName
=
getCashierName
()
;
final
String
sessionID
=
prefs
.
getString
(
'sessionId'
)
??
''
;
final
String
orderId
=
getOrderId
()
;
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
BlocBuilder
<
MemberInfoBloc
,
MemberInfo
>(
return
BlocBuilder
<
MemberInfoBloc
,
MemberInfo
>(
...
@@ -1308,7 +1304,8 @@ class EmptyBill extends StatelessWidget {
...
@@ -1308,7 +1304,8 @@ class EmptyBill extends StatelessWidget {
brandCode
,
brandCode
,
role
,
role
,
cashierName
,
cashierName
,
sessionID
,
orderId
,
context
,
);
);
Navigator
.
push
(
Navigator
.
push
(
context
,
context
,
...
@@ -1357,7 +1354,7 @@ class EmptyBill extends StatelessWidget {
...
@@ -1357,7 +1354,7 @@ class EmptyBill extends StatelessWidget {
Future
<
dynamic
>
ratingModal
(
Future
<
dynamic
>
ratingModal
(
BuildContext
context
,
List
<
Bill
>
dataBill
,
bool
isHistory
,
BuildContext
context
,
List
<
Bill
>
dataBill
,
bool
isHistory
,
{
String
sessionID
=
''
})
{
{
String
orderId
=
''
})
{
double
sizeImage
=
76
;
double
sizeImage
=
76
;
final
rateNote
=
TextEditingController
();
final
rateNote
=
TextEditingController
();
return
showDialog
(
return
showDialog
(
...
@@ -1368,7 +1365,7 @@ Future<dynamic> ratingModal(
...
@@ -1368,7 +1365,7 @@ Future<dynamic> ratingModal(
rateNote:
rateNote
,
rateNote:
rateNote
,
isHistory:
isHistory
,
isHistory:
isHistory
,
dataBill:
dataBill
,
dataBill:
dataBill
,
sessionID:
sessionID
,
orderId:
orderId
,
),
),
),
),
);
);
...
@@ -1550,7 +1547,7 @@ Future<dynamic> buttonDialogAllPayment(
...
@@ -1550,7 +1547,7 @@ Future<dynamic> buttonDialogAllPayment(
GestureDetector
(
GestureDetector
(
onTap:
()
{
onTap:
()
{
String
titlePayment
;
String
titlePayment
;
String
customerName
=
prefs
.
getString
(
'userName'
)
??
''
;
String
customerName
=
getCustomerName
()
;
bool
isIndividu
;
bool
isIndividu
;
if
(
tableMode
==
multiTable
)
{
if
(
tableMode
==
multiTable
)
{
isIndividu
=
true
;
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