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
bdbf0d11
Commit
bdbf0d11
authored
Oct 18, 2022
by
Jasa Digital
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
18/10/22
parent
22fec12f
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
1249 additions
and
289 deletions
+1249
-289
looking_driver.png
assets/icons/looking_driver.png
+0
-0
order_delivered.png
assets/icons/order_delivered.png
+0
-0
otw_pickup.png
assets/icons/otw_pickup.png
+0
-0
processing_order.png
assets/icons/processing_order.png
+0
-0
api.dart
lib/api/api.dart
+68
-25
address_user_bloc.dart
lib/bloc/address_user_bloc.dart
+11
-4
helper.dart
lib/helper/helper.dart
+7
-3
prefs.dart
lib/helper/prefs.dart
+18
-0
address_user.dart
lib/models/address_user.dart
+2
-2
bill.dart
lib/models/bill.dart
+28
-25
app_bar_select_branch.dart
lib/ui/app_bar_select_branch.dart
+27
-8
home.dart
lib/ui/home/home.dart
+1
-1
new_home2.dart
lib/ui/home/new_home2.dart
+180
-68
no_route.dart
lib/ui/no_route.dart
+2
-2
select_branch.dart
lib/ui/select_branch.dart
+61
-3
splash.dart
lib/ui/splash.dart
+337
-72
timeline.dart
lib/ui/viewbill/timeline.dart
+356
-0
view_bill_new.dart
lib/ui/viewbill/view_bill_new.dart
+84
-59
app_bar_webview.dart
lib/ui/webview/app_bar_webview.dart
+31
-8
webview.dart
lib/ui/webview/webview.dart
+28
-9
pubspec.lock
pubspec.lock
+7
-0
pubspec.yaml
pubspec.yaml
+1
-0
No files found.
assets/icons/looking_driver.png
0 → 100644
View file @
bdbf0d11
638 Bytes
assets/icons/order_delivered.png
0 → 100644
View file @
bdbf0d11
583 Bytes
assets/icons/otw_pickup.png
0 → 100644
View file @
bdbf0d11
692 Bytes
assets/icons/processing_order.png
0 → 100644
View file @
bdbf0d11
612 Bytes
lib/api/api.dart
View file @
bdbf0d11
...
...
@@ -69,13 +69,15 @@ class Api {
List
<
String
>
listTypeUrl
=
getListTypeUrl
();
int
indexTypeUrl
=
listTypeUrl
.
indexWhere
(
(
element
)
=>
jsonDecode
(
element
)[
'url_type'
]
==
urlType
&&
jsonDecode
(
element
)[
'url_type'
]
!=
typeUrlSatu
,
(
element
)
=>
jsonDecode
(
element
)[
'url_type'
]
==
urlType
&&
jsonDecode
(
element
)[
'url_type'
]
!=
typeUrlSatu
,
);
if
(
indexTypeUrl
!=
-
1
)
{
currentOrderId
=
jsonDecode
(
listTypeUrl
[
indexTypeUrl
])[
'order_id'
];
}
else
{
currentOrderId
=
getOrderId
();
currentOrderId
=
getOrderId
();
}
var
uuidOrderId
=
uuidInit
.
v4
();
String
orderID
;
...
...
@@ -150,7 +152,14 @@ class Api {
jsonEncode
(
saveTypeUrlAndOrderId
),
);
setListTypeUrl
(
listTypeUrl
);
if
(
jsonObject
[
'data'
][
'session_id'
]
!=
null
)
{
Api
.
getAddress
().
then
((
address
)
{
if
(
address
.
id
!=
''
)
{
setLatitude
(
address
.
lat
);
setLongitude
(
address
.
long
);
}
});
}
setMqMessage
(
'ORDER-ID-
${jsonObject['data']['order_id']}
'
);
setOrderId
(
jsonObject
[
'data'
][
'order_id'
]);
setTypeOrder
(
jsonObject
[
'data'
][
'type_order'
]);
...
...
@@ -170,6 +179,8 @@ class Api {
setAddressOutlet
(
jsonObject
[
'data'
][
'address'
]);
setPhoneOutlet
(
jsonObject
[
'data'
][
'mobile'
]);
setTableNumber
(
jsonObject
[
'data'
][
'table_number'
]
??
''
);
setServiceRadius
(
jsonObject
[
'data'
][
'service_radius'
]
??
0
);
setDistance
(
jsonObject
[
'data'
][
'distance'
]
??
'0'
);
if
(
jsonObject
[
'data'
][
'payment_mode'
]
!=
null
)
{
setPaymentMode
(
jsonObject
[
'data'
][
'payment_mode'
]);
}
...
...
@@ -835,8 +846,6 @@ class Api {
if
(
jsonObject
!=
false
)
{
if
(
jsonObject
[
'status'
].
toString
().
toLowerCase
()
==
'ok'
&&
jsonObject
[
'msg'
]
==
'Bill ditemukan'
)
{
List
<
Bill
>
bill
=
[];
List
<
PaymentList
>
paymentList
=
[];
// List<MemberInfo> memberInfo = [];
...
...
@@ -935,13 +944,15 @@ class Api {
jsonObject
[
'data'
][
'packaging_fee'
]
??
"0.00"
,
"platform_fee"
:
jsonObject
[
'data'
][
'platform_fee'
]
??
"0.00"
,
"delivery_fee"
:
jsonObject
[
'data'
][
'delivery_fee'
]
??
"0.00"
,
"delivery_state"
:
jsonObject
[
'data'
][
'order_delivery_state'
]
??
0
,
};
bill
.
add
(
Bill
.
createBill
(
i
));
// billDetail.add(BillDetail.createBillDetail(orderDetail[d]));
}
}
}
Api
.
ch
ange
Payment
();
Api
.
ch
eck
Payment
();
return
bill
;
}
else
{
return
[];
...
...
@@ -1166,6 +1177,19 @@ class Api {
String
sessionId
=
getSessionId
();
String
signString
=
signApi
();
int
sessionC
=
getSessionCounter
();
String
uriBase
=
"
${Uri.base}
"
;
var
splitpath
=
uriBase
.
split
(
'/'
);
var
lastPath
=
splitpath
.
last
;
String
returnUrl
;
if
(
lastPath
==
''
)
{
returnUrl
=
"
${Uri.base}
go"
;
}
else
{
if
(
lastPath
==
'go'
)
{
returnUrl
=
"
${Uri.base}
"
;
}
else
{
returnUrl
=
"
${Uri.base}
/go"
;
}
}
try
{
Map
data
=
{
"session_id"
:
sessionId
,
...
...
@@ -1181,7 +1205,8 @@ class Api {
"secure_token"
:
token
,
"amount"
:
amount
,
"time_ready_for_pickup"
:
getPickupTime
(),
"from"
:
fromByod
"from"
:
fromByod
,
"return_url"
:
returnUrl
};
var
bodies
=
jsonEncode
(
data
);
// var apiResult = await http.post(Uri.parse(apiUrl), body: bodies);
...
...
@@ -2017,7 +2042,7 @@ class Api {
}
}
static
Future
<
bool
>
changeBranch
(
String
newBranch
)
async
{
static
Future
<
Map
<
String
,
dynamic
>
>
changeBranch
(
String
newBranch
)
async
{
String
baseUrl
=
getBaseUrl
();
String
apiUrl
=
"
$baseUrl${endPoint}
change_branch"
;
...
...
@@ -2037,6 +2062,8 @@ class Api {
"type_order"
:
getTypeOrder
(),
"cashier_name"
:
getCashierName
(),
"from"
:
fromByod
,
"customer_lat"
:
getLatitude
(),
"customer_long"
:
getLongitude
(),
};
var
bodies
=
jsonEncode
(
data
);
...
...
@@ -2049,22 +2076,38 @@ class Api {
setLongOutlet
(
jsonObject
[
'data'
][
'long'
]);
setOpenTime
(
jsonObject
[
'data'
][
'open_time'
]);
setCloseTime
(
jsonObject
[
'data'
][
'close_time'
]);
return
true
;
setServiceRadius
(
jsonObject
[
'data'
][
'service_radius'
])
;
}
return
false
;
Map
<
String
,
dynamic
>
returnResult
=
{
"status"
:
jsonObject
[
'status'
],
"code"
:
jsonObject
[
'code'
],
"msg"
:
jsonObject
[
'msg'
],
};
return
returnResult
;
}
else
{
return
false
;
Map
<
String
,
dynamic
>
returnResult
=
{
"status"
:
'error_server'
,
"code"
:
''
,
"msg"
:
'Something wrong with oure server'
,
};
return
returnResult
;
}
}
catch
(
e
)
{
if
(
debug
)
{
logd
(
'API CLASS ON API.DART, FUNGSI: changeBranch, URL :
$apiUrl
'
,
'ERROR CONNECT TO SERVER, ERROR CATCH :
$e
'
);
}
return
false
;
Map
<
String
,
dynamic
>
returnResult
=
{
"status"
:
'error_server'
,
"code"
:
''
,
"msg"
:
'Something wrong with oure server'
,
};
return
returnResult
;
}
}
static
Future
<
Address
>
getAddress
({
context
})
async
{
static
Future
<
Address
>
getAddress
(
{
context
,
isCallDeliveryCharge
=
true
})
async
{
String
baseUrl
=
getBaseUrl
();
String
apiUrl
=
"
$baseUrl${endPointRdm}
get_address/"
;
...
...
@@ -2091,14 +2134,17 @@ class Api {
if
(
jsonObject
!=
false
)
{
if
(
jsonObject
[
'status'
].
toString
().
toLowerCase
()
==
'ok'
)
{
Map
<
String
,
dynamic
>
data
=
jsonObject
[
'data'
];
setLatitude
(
jsonObject
[
'data'
][
'lat'
]);
setLongitude
(
jsonObject
[
'data'
][
'long'
]);
Map
<
String
,
dynamic
>
dataAddress
=
jsonObject
[
'data'
];
if
(
getTypeOrder
()
==
typeOrderDelivery
)
{
Api
.
getDeliveryCharge
(
jsonObject
[
'data'
][
'lat'
],
jsonObject
[
'data'
][
'long'
])
.
then
((
value
)
{});
if
(
isCallDeliveryCharge
)
{
Api
.
getDeliveryCharge
(
jsonObject
[
'data'
][
'lat'
],
jsonObject
[
'data'
][
'long'
])
.
then
((
value
)
{});
}
}
return
Address
.
json
(
data
);
return
Address
.
json
(
dataAddress
);
}
return
defaultResult
;
}
else
{
...
...
@@ -2284,7 +2330,7 @@ class Api {
}
}
static
Future
<
bool
>
ch
ange
Payment
()
async
{
static
Future
<
bool
>
ch
eck
Payment
()
async
{
String
baseUrl
=
prefs
.
getString
(
'baseUrl'
)
??
''
;
String
apiUrl
;
apiUrl
=
"
$baseUrl${endPoint}
check_payment"
;
...
...
@@ -2313,24 +2359,21 @@ class Api {
};
var
bodies
=
jsonEncode
(
data
);
var
jsonObject
=
await
httpPost
(
apiUrl
,
bodies
,
'ch
ange
Payment'
);
var
jsonObject
=
await
httpPost
(
apiUrl
,
bodies
,
'ch
eck
Payment'
);
if
(
jsonObject
!=
false
)
{
if
(
jsonObject
[
'status'
].
toString
().
toLowerCase
()
==
'ok'
)
{
return
true
;
}
else
{
EasyLoading
.
showToast
(
jsonObject
[
'msg'
]);
return
false
;
}
}
else
{
EasyLoading
.
showToast
(
'Something went wrong'
);
return
false
;
}
}
catch
(
e
)
{
if
(
debug
)
{
logd
(
'API CLASS ON API.DART, FUNGSI: ch
ange
Payment, URL :
$apiUrl
'
,
logd
(
'API CLASS ON API.DART, FUNGSI: ch
eck
Payment, URL :
$apiUrl
'
,
'ERROR CONNECT TO SERVER, ERROR CATCH :
$e
'
);
}
EasyLoading
.
showToast
(
'Cant connect to server'
);
return
false
;
}
}
...
...
lib/bloc/address_user_bloc.dart
View file @
bdbf0d11
// ignore_for_file: use_build_context_synchronously
import
'package:byod/models/address_user.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'../api/api.dart'
;
import
'branch_list.dart'
;
class
AddressUser
extends
Cubit
<
Address
>
{
AddressUser
()
...
...
@@ -19,9 +22,13 @@ class AddressUser extends Cubit<Address> {
notes:
''
,
),
);
void
getAddressUser
()
async
{
var
result
=
await
Api
.
getAddress
();
emit
(
result
);
void
getAddressUser
(
BuildContext
context
,
{
bool
isGetBranchList
=
false
,
isCallDeliveryCharge
=
true
})
async
{
var
resultAddress
=
await
Api
.
getAddress
(
isCallDeliveryCharge:
isCallDeliveryCharge
);
if
(
isGetBranchList
)
{
context
.
read
<
BranchList
>().
getBranchList
();
}
emit
(
resultAddress
);
}
}
lib/helper/helper.dart
View file @
bdbf0d11
...
...
@@ -400,8 +400,8 @@ bool isCanButtonCheckoutToTap(int orderState) {
}
}
Future
<
bool
>
changeBranch
(
String
newBranch
)
async
{
bool
result
=
await
Api
.
changeBranch
(
newBranch
);
Future
<
Map
<
String
,
dynamic
>
>
changeBranch
(
String
newBranch
)
async
{
Map
<
String
,
dynamic
>
result
=
await
Api
.
changeBranch
(
newBranch
);
return
result
;
}
...
...
@@ -760,6 +760,10 @@ const int typeOrderPickup = 2;
String
mqMessage
=
getMqMessage
();
// String MQmessage
// devliery state
const
int
orderDeliveryStateOtwPickup
=
0
;
const
int
orderDeliveryStateInDelivery
=
1
;
const
int
orderDeliveryStateDelivered
=
99
;
// devliery state
//** END CONSTANT */
lib/helper/prefs.dart
View file @
bdbf0d11
...
...
@@ -41,6 +41,8 @@ const String _closeTime = 'cT';
const
String
_pickupTime
=
'puT'
;
const
String
_addressOutlet
=
'addressOutlet'
;
const
String
_phoneOutlet
=
'phoneOutlet'
;
const
String
_serviceRadius
=
'sr'
;
const
String
_distanceOutletCustomer
=
'doc'
;
String
getBaseUrl
(
)
{
return
prefs
.
getString
(
_baseUrl
)
??
''
;
...
...
@@ -357,3 +359,19 @@ String getPhoneOutlet() {
Future
<
void
>
setPhoneOutlet
(
String
value
)
async
{
prefs
.
setString
(
_phoneOutlet
,
value
);
}
int
getServiceRadius
(
)
{
return
prefs
.
getInt
(
_serviceRadius
)
??
0
;
}
Future
<
void
>
setServiceRadius
(
int
value
)
async
{
prefs
.
setInt
(
_serviceRadius
,
value
);
}
double
getDistance
(
)
{
return
prefs
.
getDouble
(
_distanceOutletCustomer
)
??
0
;
}
Future
<
void
>
setDistance
(
double
value
)
async
{
prefs
.
setDouble
(
_distanceOutletCustomer
,
value
);
}
lib/models/address_user.dart
View file @
bdbf0d11
...
...
@@ -29,8 +29,8 @@ class Address {
locationDetail:
json
[
'location_detail'
],
lat:
json
[
'lat'
],
long:
json
[
'long'
],
recepientName:
json
[
'recipient_name'
],
recepientPhone:
json
[
'recipient_phone'
],
recepientName:
json
[
'recipient_name'
]
.
toString
()
,
recepientPhone:
json
[
'recipient_phone'
]
.
toString
()
,
notes:
json
[
'notes'
],
);
}
...
...
lib/models/bill.dart
View file @
bdbf0d11
...
...
@@ -26,6 +26,7 @@ class Bill {
String
packagingFee
;
String
platformFee
;
String
deliveryFee
;
int
deliveryState
;
// List<MemberInfo> memberInfo;
Bill
({
...
...
@@ -52,35 +53,37 @@ class Bill {
this
.
packagingFee
=
"0.00"
,
this
.
platformFee
=
"0.00"
,
this
.
deliveryFee
=
"0.00"
,
this
.
deliveryState
=
0
,
// this.memberInfo = const []
});
factory
Bill
.
createBill
(
Map
<
String
,
dynamic
>
json
)
{
return
Bill
(
id:
json
[
'id'
],
totalSeluruhOrderan:
json
[
'total'
],
subTotalSeluruhOrderan:
json
[
'subtotal'
],
totalPerCustomer:
json
[
'total_per_customer'
],
customerName:
json
[
'customer_name'
],
tableStatus:
json
[
'table_status'
],
orderStatus:
json
[
'order_status'
],
state:
json
[
'order_state'
],
billDetail:
json
[
'order_detail'
],
paymentList:
json
[
'payment_list'
],
outStandingPay:
json
[
'outstanding'
],
invoice:
json
[
'invoice'
],
totalService:
json
[
'total_service'
],
totalServiceTax:
json
[
'total_service_tax'
],
outStandingIndividu:
json
[
'my_self_outstanding'
],
discountTotal:
json
[
'discount_total'
],
tableName:
json
[
'table_number'
],
isFeedBack:
json
[
'is_feedback'
],
dokuMinPay:
json
[
'doku_minimum_payment'
],
dateOrder:
json
[
'order_date'
],
packagingFee:
json
[
'packaging_fee'
],
platformFee:
json
[
'platform_fee'
],
deliveryFee:
json
[
'delivery_fee'
]
// memberInfo: json['member_info']
);
id:
json
[
'id'
],
totalSeluruhOrderan:
json
[
'total'
],
subTotalSeluruhOrderan:
json
[
'subtotal'
],
totalPerCustomer:
json
[
'total_per_customer'
],
customerName:
json
[
'customer_name'
],
tableStatus:
json
[
'table_status'
],
orderStatus:
json
[
'order_status'
],
state:
json
[
'order_state'
],
billDetail:
json
[
'order_detail'
],
paymentList:
json
[
'payment_list'
],
outStandingPay:
json
[
'outstanding'
],
invoice:
json
[
'invoice'
],
totalService:
json
[
'total_service'
],
totalServiceTax:
json
[
'total_service_tax'
],
outStandingIndividu:
json
[
'my_self_outstanding'
],
discountTotal:
json
[
'discount_total'
],
tableName:
json
[
'table_number'
],
isFeedBack:
json
[
'is_feedback'
],
dokuMinPay:
json
[
'doku_minimum_payment'
],
dateOrder:
json
[
'order_date'
],
packagingFee:
json
[
'packaging_fee'
],
platformFee:
json
[
'platform_fee'
],
deliveryFee:
json
[
'delivery_fee'
],
deliveryState:
json
[
'delivery_state'
]
??
0
// memberInfo: json['member_info']
);
}
}
lib/ui/app_bar_select_branch.dart
View file @
bdbf0d11
...
...
@@ -23,14 +23,33 @@ class CustomAppBar extends StatelessWidget {
horizontal:
paddingLeftRight
,
vertical:
15
),
child:
Column
(
children:
[
Center
(
child:
defaultText
(
context
,
'Silahkan Pilih Outlet'
,
maxLines:
1
,
overFlow:
TextOverflow
.
ellipsis
,
style:
appBarNameViewBill
(),
),
Row
(
children:
[
GestureDetector
(
onTap:
()
{
Navigator
.
pop
(
context
);
},
child:
Container
(
width:
24
,
height:
24
,
child:
fontAwesomeNew
(
arrowBack
,
24
,
),
),
),
Expanded
(
child:
Center
(
child:
defaultText
(
context
,
'Silakan Pilih Outlet'
,
maxLines:
1
,
overFlow:
TextOverflow
.
ellipsis
,
style:
appBarNameViewBill
(),
),
),
),
],
),
const
SizedBox
(
height:
16
,
...
...
lib/ui/home/home.dart
View file @
bdbf0d11
...
...
@@ -124,7 +124,7 @@ class _HomeState extends State<Home> {
if
(
categoryDefault
.
isNotEmpty
&&
categoryDefault
[
0
].
id
==
"0"
)
{
return
errorResponseByod
(
'Gagal mendapatkan menu, sila
h
kan refresh halaman / scan ulang barcode'
);
'Gagal mendapatkan menu, silakan refresh halaman / scan ulang barcode'
);
}
else
if
(
categoryDefault
.
isNotEmpty
)
{
List
<
FilterMenu
>
categoryNonFav
=
[];
List
<
FilterMenu
>
categoryFav
=
[];
...
...
lib/ui/home/new_home2.dart
View file @
bdbf0d11
...
...
@@ -26,6 +26,7 @@ import '../../models/fav_group.dart';
import
'../checkout/fuction.dart'
;
import
'../confirm_order/confirm_order.dart'
;
import
'../screen_responsive.dart'
;
import
'../select_branch.dart'
;
import
'../viewbill/view_bill_new.dart'
;
import
'cat_list.dart'
;
import
'fav_grid_menu.dart'
;
...
...
@@ -181,7 +182,7 @@ class _NewHome2State extends State<NewHome2> {
@override
Widget
build
(
BuildContext
context
)
{
// double heightTotal = MediaQuery.of(context).size.height;
double
appBarHeight
=
4
0
;
double
appBarHeight
=
5
0
;
double
searchFieldHeight
=
50
;
double
spacerHeight
=
20
;
double
favListHeight
=
35
;
...
...
@@ -253,7 +254,7 @@ class _NewHome2State extends State<NewHome2> {
if
(
categoryDefault
.
isNotEmpty
&&
categoryDefault
[
0
].
id
==
"0"
)
{
return
errorResponseByod
(
'Gagal mendapatkan menu, sila
h
kan refresh halaman / scan ulang barcode'
);
'Gagal mendapatkan menu, silakan refresh halaman / scan ulang barcode'
);
}
else
if
(
categoryDefault
.
isNotEmpty
)
{
List
<
FilterMenu
>
categoryFavTemp
=
[];
List
<
FilterMenu
>
categoryNonFavTemp
=
[];
...
...
@@ -656,17 +657,129 @@ class _NewHome2State extends State<NewHome2> {
SliverPersistentHeader
(
pinned:
true
,
delegate:
DelegateAppBar
(
appBarHeight
+
searchFieldHeight
,
appBarHeight
,
customAppBar
(
context
,
paddingLeftRight
,
appBarHeight
+
searchFieldHeight
,
appBarHeight
,
tableNumber
,
userName
,
isSearchActive
,
),
),
),
SliverToBoxAdapter
(
child:
Column
(
children:
[
(
getIsDeliveryPickup
())
?
const
SizedBox
(
height:
5
,
)
:
const
SizedBox
(),
(
getIsDeliveryPickup
())
?
Row
(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children:
[
Expanded
(
child:
defaultText
(
context
,
"Open Hour:
${timeHm(getOpenTime())}
-
${timeHm(getCloseTime())}
"
,
maxLines:
2
,
overFlow:
TextOverflow
.
ellipsis
,
style:
viewbillStyle
(),
),
),
// const Spacer(),
GestureDetector
(
onTap:
()
{
void
ontapOkeChange
()
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
SelectBranch
(
isFormBill:
true
,
),
),
);
}
void
onTapCancelChange
()
{
Navigator
.
pop
(
context
);
}
String
textOnOk
=
'OK'
;
String
textOnCancel
=
'Batal'
;
String
title
=
'Ganti Outlet'
;
String
description
=
'''
Ganti outlet akan menyebabkan orderan anda saat ini hilang.
Apakah ingin melanjutkan ?'''
;
buttonDialogGlobal
(
context
,
title
,
description
,
textOnOk
,
textOnCancel
,
ontapOkeChange
,
onTapCancelChange
,
okButtonColor:
buttonColor
,
);
},
child:
Container
(
width:
64
,
height:
20
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
40
),
color:
backgroundColor
,
border:
Border
.
all
(
color:
textColorBlack
,
),
),
child:
Center
(
child:
defaultText
(
context
,
'Ganti Outlet'
,
style:
addButton
(
font:
8
,
color:
textColorBlack
,
),
),
),
),
),
],
)
:
const
SizedBox
(),
(
getIsDeliveryPickup
())
?
(
getDistance
()
>
getServiceRadius
().
toDouble
())
?
Container
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
5
,
),
child:
Align
(
alignment:
Alignment
.
centerLeft
,
child:
defaultText
(
context
,
'Jarak anda dan outlet terlalu jauh, silahkan ganti outlet'
,
style:
viewbillStyle
(
font:
12
,
color:
dangerColor
,
),
),
),
)
:
const
SizedBox
()
:
const
SizedBox
(),
(
getIsDeliveryPickup
())
?
const
SizedBox
(
height:
10
,
)
:
const
SizedBox
(),
],
),
),
SliverPersistentHeader
(
pinned:
true
,
delegate:
DelegateSearchField
(
...
...
@@ -1072,73 +1185,72 @@ class _NewHome2State extends State<NewHome2> {
}
return
Container
(
padding:
const
EdgeInsets
.
only
(
top:
10
),
height:
appBarHeight
,
color:
backgroundColor
,
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Expanded
(
child:
defaultText
(
context
,
barName
,
maxLines:
2
,
overFlow:
TextOverflow
.
ellipsis
,
style:
tableNameStyle
(),
),
padding:
const
EdgeInsets
.
only
(
top:
10
),
height:
appBarHeight
,
color:
backgroundColor
,
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Expanded
(
child:
defaultText
(
context
,
barName
,
maxLines:
2
,
overFlow:
TextOverflow
.
ellipsis
,
style:
tableNameStyle
(),
),
// const Spacer(),
Container
(
width:
64
,
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
end
,
children:
[
GestureDetector
(
onTap:
()
{
context
.
read
<
SearchActive
>().
searchClick
(
isSearchActive
);
context
.
read
<
MenuSelectedBar
>().
selectedBarMenu
(
0
,
''
);
context
.
read
<
SearchMenu
>().
searchMenu
(
categoryNonFav
,
keyword:
''
,
isSearch:
true
,
);
_scrollController
.
animateTo
(
(
favList
.
isNotEmpty
)
?
heighScrollWithImage
:
imageHeight
,
// 371 sudah dihituing pixelnya untuk awal banget dari menu item
duration:
const
Duration
(
milliseconds:
500
),
curve:
Curves
.
fastOutSlowIn
,
);
},
child:
const
Image
(
image:
AssetImage
(
'assets/icons/search.png'
),
height:
24
,
width:
24
,
),
),
const
SizedBox
(
width:
16
,
),
// const Spacer(),
Container
(
width:
64
,
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
end
,
children:
[
GestureDetector
(
onTap:
()
{
context
.
read
<
SearchActive
>().
searchClick
(
isSearchActive
);
context
.
read
<
MenuSelectedBar
>().
selectedBarMenu
(
0
,
''
);
context
.
read
<
SearchMenu
>().
searchMenu
(
categoryNonFav
,
keyword:
''
,
isSearch:
true
,
);
_scrollController
.
animateTo
(
(
favList
.
isNotEmpty
)
?
heighScrollWithImage
:
imageHeight
,
// 371 sudah dihituing pixelnya untuk awal banget dari menu item
duration:
const
Duration
(
milliseconds:
500
),
curve:
Curves
.
fastOutSlowIn
,
);
},
child:
const
Image
(
image:
AssetImage
(
'assets/icons/search.png'
),
height:
24
,
width:
24
,
),
GestureDetector
(
onTap:
()
{
// Navigator.push(
// context, MaterialPageRoute(builder: (_) => ViewBill()));
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
ViewBillNew
()));
},
child:
const
Image
(
image:
AssetImage
(
'assets/icons/book.png'
),
height:
24
,
width:
24
,
),
),
const
SizedBox
(
width:
16
,
),
GestureDetector
(
onTap:
()
{
// Navigator.push(
// context, MaterialPageRoute(builder: (_) => ViewBill()));
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
ViewBillNew
()));
},
child:
const
Image
(
image:
AssetImage
(
'assets/icons/book.png'
),
height:
24
,
width:
24
,
),
],
),
)
],
));
),
],
),
)
],
),
);
}
Center
errorResponseByod
(
String
message
)
{
...
...
lib/ui/no_route.dart
View file @
bdbf0d11
...
...
@@ -66,7 +66,7 @@ class NoRoute extends StatelessWidget {
:
(
identification
==
locationPermissinDenied
)
?
defaultText
(
context
,
"Delivery/Pickup order memerlukan akses lokasi anda, Sila
h
kan ubah pengaturan lokasi browser anda"
,
"Delivery/Pickup order memerlukan akses lokasi anda, Silakan ubah pengaturan lokasi browser anda"
,
textAlign:
TextAlign
.
center
,
style:
textStyleNormalFont
(
context
),
)
...
...
@@ -92,7 +92,7 @@ class NoRoute extends StatelessWidget {
);
}
else
{
EasyLoading
.
showToast
(
'Sila
h
kan aktifkan lokasi browser anda'
);
'Silakan aktifkan lokasi browser anda'
);
}
});
},
...
...
lib/ui/select_branch.dart
View file @
bdbf0d11
...
...
@@ -7,11 +7,13 @@ import 'package:byod/helper/prefs.dart';
import
'package:byod/models/branchs.dart'
;
import
'package:byod/ui/home/new_home2.dart'
;
import
'package:byod/ui/screen_responsive.dart'
;
import
'package:byod/ui/webview/webview.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:flutter_easyloading/flutter_easyloading.dart'
;
import
'../bloc/search_branch.dart'
;
import
'../helper/widget/button_dialog.dart'
;
import
'../helper/widget/style.dart'
;
import
'app_bar_select_branch.dart'
;
...
...
@@ -80,15 +82,56 @@ class CoreBranch extends StatelessWidget {
itemBuilder:
(
context
,
i
)
{
return
GestureDetector
(
onTap:
()
{
void
ontapOkeChange
()
{
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
WebViewMap
(
titleAppBar:
'Pilih Alamat'
,
url:
'
${getBaseUrl()}
rdm/address/add/?session_id=
${getSessionId()}
'
,
isFromSelectBranch:
true
,
),
),
);
}
String
textOnOk
=
'OK'
;
String
textOnCancel
=
'Batal'
;
String
title
=
'Alamat Terlalu Jauh'
;
String
description
=
'''
Lokasi anda saat ini terlalu jauh dari outlet kami, silakan ganti alamat.
Apakah ingin ganti alamat ?'''
;
void
onTapCancelChange
()
{
Navigator
.
pop
(
context
);
}
if
(
listBranch
[
i
].
isDelivery
==
false
&&
listBranch
[
i
].
isPickup
==
false
)
{
EasyLoading
.
showToast
(
'Outlet tidak menerima delivery dan pickup'
);
}
else
if
(
listBranch
[
i
].
distance
>
getServiceRadius
().
toDouble
())
{
buttonDialogGlobal
(
context
,
title
,
description
,
textOnOk
,
textOnCancel
,
ontapOkeChange
,
onTapCancelChange
,
okButtonColor:
buttonColor
,
);
}
else
{
if
(
isFormBill
)
{
changeBranch
(
listBranch
[
i
].
branchCode
)
.
then
((
value
)
{
if
(
value
)
{
if
(
value
[
'status'
]
.
toString
()
.
toLowerCase
()
==
'ok'
)
{
context
.
read
<
FilterMenuBloc
>().
catAndMenu
(
listBranch
[
i
].
branchCode
,
getBrand
(),
...
...
@@ -104,14 +147,29 @@ class CoreBranch extends StatelessWidget {
}
else
{
setIsCustomerDelivery
(
false
);
}
setDistance
(
listBranch
[
i
].
distance
);
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
NewHome2
()),
);
}
else
{
EasyLoading
.
showToast
(
'Outlet tidak dapat dipilih'
);
if
(
value
[
'status'
]
==
'error'
&&
value
[
'code'
]
==
'SERVICE_OUT_RANGE'
)
{
buttonDialogGlobal
(
context
,
title
,
description
,
textOnOk
,
textOnCancel
,
ontapOkeChange
,
onTapCancelChange
,
okButtonColor:
buttonColor
,
);
}
else
{
EasyLoading
.
showToast
(
value
[
'msg'
]);
}
}
});
}
else
{
...
...
lib/ui/splash.dart
View file @
bdbf0d11
...
...
@@ -6,6 +6,8 @@ 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.dart'
;
import
'package:byod/ui/viewbill/view_bill_new.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:geolocator/geolocator.dart'
;
...
...
@@ -123,17 +125,90 @@ class _SplashState extends State<Splash> {
}
});
}
else
if
(
widget
.
pathSegmentString
.
length
==
1
)
{
setPaymentMode
(
closebill
);
setIsDeliveryPickup
(
false
);
setUrlLookUp
(
''
);
Navigator
.
pushReplacement
(
widget
.
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
NoRoute
(
identification:
emptyUri
,
if
(
widget
.
pathSegmentString
[
0
]
==
'go'
)
{
Geolocator
.
requestPermission
().
then
((
permission
)
{
if
(
permission
!=
LocationPermission
.
denied
&&
permission
!=
LocationPermission
.
deniedForever
)
{
setPaymentMode
(
closebill
);
setIsDeliveryPickup
(
true
);
setUrlLookUp
(
Uri
.
base
.
toString
());
Geolocator
.
getCurrentPosition
().
then
((
position
)
{
setLatitude
(
position
.
latitude
.
toString
());
setLongitude
(
position
.
longitude
.
toString
());
setUrlType
(
typeUrlTiga
);
List
<
String
>
listTypeUrl
=
getListTypeUrl
();
int
indexTypeUrlTiga
=
listTypeUrl
.
indexWhere
(
(
list
)
=>
jsonDecode
(
list
)[
'url_type'
]
==
typeUrlTiga
);
if
(
indexTypeUrlTiga
==
-
1
)
{
Map
saveTypeUrlAndOrderId
=
{
"url_type"
:
typeUrlTiga
,
"order_id"
:
''
,
};
listTypeUrl
.
add
(
jsonEncode
(
saveTypeUrlAndOrderId
),
);
setListTypeUrl
(
listTypeUrl
);
}
widget
.
context
.
read
<
BranchExist
>().
branchExist
(
getBranchPref
(),
getBrand
(),
getRole
(),
getCashierName
(),
''
,
widget
.
context
,
getBrancList:
true
,
);
Future
.
delayed
(
const
Duration
(
milliseconds:
2000
),
()
async
{
// if (getStatusOrderCreated()) {
context
.
read
<
FilterMenuBloc
>().
catAndMenu
(
getBranchPref
(),
getBrand
(),
getRole
(),
getCashierName
(),
getOrderId
(),
);
Navigator
.
pushReplacement
(
widget
.
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
ViewBillNew
(),
),
);
// } else {
// Navigator.pushReplacement(
// widget.context,
// MaterialPageRoute(
// builder: (_) => const SelectBranch(),
// ),
// );
// }
});
});
}
else
{
Navigator
.
pushReplacement
(
widget
.
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
NoRoute
(
identification:
locationPermissinDenied
,
),
),
);
}
});
}
else
{
setPaymentMode
(
closebill
);
setIsDeliveryPickup
(
false
);
setUrlLookUp
(
''
);
Navigator
.
pushReplacement
(
widget
.
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
NoRoute
(
identification:
emptyUri
,
),
),
)
,
);
)
;
}
}
else
if
(
widget
.
pathSegmentString
.
length
==
2
)
{
setPaymentMode
(
openBill
);
setIsDeliveryPickup
(
false
);
...
...
@@ -189,75 +264,265 @@ class _SplashState extends State<Splash> {
);
}
}
else
if
(
widget
.
pathSegmentString
.
length
==
3
)
{
setPaymentMode
(
closebill
);
setIsDeliveryPickup
(
false
);
setUrlLookUp
(
''
);
setBranch
(
widget
.
pathSegmentString
[
1
]);
setBrand
(
widget
.
pathSegmentString
[
0
]);
setTableNumber
(
widget
.
pathSegmentString
[
2
]);
setUrlType
(
typeUrlDua
);
List
<
String
>
listTypeUrl
=
getListTypeUrl
();
int
indextypeUrlDua
=
listTypeUrl
.
indexWhere
((
list
)
=>
jsonDecode
(
list
)[
'url_type'
]
==
typeUrlDua
);
if
(
indextypeUrlDua
==
-
1
)
{
Map
saveTypeUrlAndOrderId
=
{
"url_type"
:
typeUrlDua
,
"order_id"
:
''
,
};
listTypeUrl
.
add
(
jsonEncode
(
saveTypeUrlAndOrderId
),
);
setListTypeUrl
(
listTypeUrl
);
}
goToMenu
(
widget
.
context
);
widget
.
context
.
read
<
BranchExist
>().
branchExist
(
getBranchPref
(),
getBrand
(),
getRole
(),
getCashierName
(),
getOrderId
(),
// ini orderId dari path URL
if
(
widget
.
pathSegmentString
[
2
]
==
'go'
)
{
setPaymentMode
(
openBill
);
setIsDeliveryPickup
(
false
);
setUrlLookUp
(
''
);
if
(
widget
.
pathSegmentString
[
0
]
==
'o'
)
{
if
(
widget
.
pathSegmentString
[
1
]
!=
''
)
{
setOrderId
(
widget
.
pathSegmentString
[
1
]);
setUrlType
(
typeUrlSatu
);
List
<
String
>
listTypeUrl
=
getListTypeUrl
();
int
indexTypeUrlSatu
=
listTypeUrl
.
indexWhere
(
(
list
)
=>
jsonDecode
(
list
)[
'url_type'
]
==
typeUrlSatu
);
if
(
indexTypeUrlSatu
==
1
)
{
listTypeUrl
.
removeWhere
((
element
)
=>
jsonDecode
(
element
)[
'url_type'
]
==
typeUrlSatu
);
}
Map
saveTypeUrlAndOrderId
=
{
"url_type"
:
typeUrlSatu
,
"order_id"
:
widget
.
pathSegmentString
[
1
],
};
listTypeUrl
.
add
(
jsonEncode
(
saveTypeUrlAndOrderId
),
);
setListTypeUrl
(
listTypeUrl
);
widget
.
context
.
read
<
BranchExist
>().
branchExist
(
getBranchPref
(),
getBrand
(),
getRole
(),
getCashierName
(),
getOrderId
(),
// ini orderId dari path URL
widget
.
context
,
getMenu:
true
,
);
Future
.
delayed
(
const
Duration
(
milliseconds:
2000
),
()
async
{
// if (getStatusOrderCreated()) {
context
.
read
<
FilterMenuBloc
>().
catAndMenu
(
getBranchPref
(),
getBrand
(),
getRole
(),
getCashierName
(),
getOrderId
(),
);
Navigator
.
pushReplacement
(
widget
.
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
ViewBillNew
(),
),
);
// } else {
// Navigator.pushReplacement(
// widget.context,
// MaterialPageRoute(
// builder: (_) => const SelectBranch(),
// ),
// );
// }
});
}
else
{
Navigator
.
pushReplacement
(
widget
.
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
NoRoute
(
identification:
emptyUri
,
),
),
);
}
}
else
{
Navigator
.
pushReplacement
(
widget
.
context
,
getMenu:
true
,
MaterialPageRoute
(
builder:
(
_
)
=>
NoRoute
(
identification:
emptyUri
,
),
),
);
goToMenu
(
widget
.
context
);
}
}
else
{
setPaymentMode
(
closebill
);
setIsDeliveryPickup
(
false
);
setUrlLookUp
(
''
);
setBranch
(
widget
.
pathSegmentString
[
1
]);
setBrand
(
widget
.
pathSegmentString
[
0
]);
setTableNumber
(
widget
.
pathSegmentString
[
2
]);
setUrlType
(
typeUrlDua
);
List
<
String
>
listTypeUrl
=
getListTypeUrl
();
int
indextypeUrlDua
=
listTypeUrl
.
indexWhere
((
list
)
=>
jsonDecode
(
list
)[
'url_type'
]
==
typeUrlDua
);
if
(
indextypeUrlDua
==
-
1
)
{
Map
saveTypeUrlAndOrderId
=
{
"url_type"
:
typeUrlDua
,
"order_id"
:
''
,
};
listTypeUrl
.
add
(
jsonEncode
(
saveTypeUrlAndOrderId
),
);
setListTypeUrl
(
listTypeUrl
);
}
widget
.
context
.
read
<
BranchExist
>().
branchExist
(
getBranchPref
(),
getBrand
(),
getRole
(),
getCashierName
(),
getOrderId
(),
// ini orderId dari path URL
widget
.
context
,
getMenu:
true
,
);
goToMenu
(
widget
.
context
);
}
}
else
if
(
widget
.
pathSegmentString
.
length
==
4
)
{
setPaymentMode
(
closebill
);
setIsDeliveryPickup
(
false
);
setUrlLookUp
(
''
);
setBranch
(
widget
.
pathSegmentString
[
1
]);
setBrand
(
widget
.
pathSegmentString
[
0
]);
setTableNumber
(
widget
.
pathSegmentString
[
2
]);
setToken
(
widget
.
pathSegmentString
[
3
]);
context
.
read
<
MemberInfoBloc
>().
getMemberInfo
(
getToken
());
setUrlType
(
typeUrlDua
);
List
<
String
>
listTypeUrl
=
getListTypeUrl
();
int
indextypeUrlDua
=
listTypeUrl
.
indexWhere
((
list
)
=>
jsonDecode
(
list
)[
'url_type'
]
==
typeUrlDua
);
if
(
indextypeUrlDua
==
-
1
)
{
Map
saveTypeUrlAndOrderId
=
{
"url_type"
:
typeUrlDua
,
"order_id"
:
''
,
};
listTypeUrl
.
add
(
jsonEncode
(
saveTypeUrlAndOrderId
),
);
setListTypeUrl
(
listTypeUrl
);
if
(
widget
.
pathSegmentString
[
3
]
==
'go'
)
{
setPaymentMode
(
closebill
);
setIsDeliveryPickup
(
false
);
setUrlLookUp
(
''
);
setBranch
(
widget
.
pathSegmentString
[
1
]);
setBrand
(
widget
.
pathSegmentString
[
0
]);
setTableNumber
(
widget
.
pathSegmentString
[
2
]);
setUrlType
(
typeUrlDua
);
List
<
String
>
listTypeUrl
=
getListTypeUrl
();
int
indextypeUrlDua
=
listTypeUrl
.
indexWhere
((
list
)
=>
jsonDecode
(
list
)[
'url_type'
]
==
typeUrlDua
);
if
(
indextypeUrlDua
==
-
1
)
{
Map
saveTypeUrlAndOrderId
=
{
"url_type"
:
typeUrlDua
,
"order_id"
:
''
,
};
listTypeUrl
.
add
(
jsonEncode
(
saveTypeUrlAndOrderId
),
);
setListTypeUrl
(
listTypeUrl
);
}
widget
.
context
.
read
<
BranchExist
>().
branchExist
(
getBranchPref
(),
getBrand
(),
getRole
(),
getCashierName
(),
getOrderId
(),
// ini orderId dari path URL
widget
.
context
,
getMenu:
true
,
);
Future
.
delayed
(
const
Duration
(
milliseconds:
2000
),
()
async
{
// if (getStatusOrderCreated()) {
context
.
read
<
FilterMenuBloc
>().
catAndMenu
(
getBranchPref
(),
getBrand
(),
getRole
(),
getCashierName
(),
getOrderId
(),
);
Navigator
.
pushReplacement
(
widget
.
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
ViewBillNew
(),
),
);
});
}
else
{
setPaymentMode
(
closebill
);
setIsDeliveryPickup
(
false
);
setUrlLookUp
(
''
);
setBranch
(
widget
.
pathSegmentString
[
1
]);
setBrand
(
widget
.
pathSegmentString
[
0
]);
setTableNumber
(
widget
.
pathSegmentString
[
2
]);
setToken
(
widget
.
pathSegmentString
[
3
]);
context
.
read
<
MemberInfoBloc
>().
getMemberInfo
(
getToken
());
setUrlType
(
typeUrlDua
);
List
<
String
>
listTypeUrl
=
getListTypeUrl
();
int
indextypeUrlDua
=
listTypeUrl
.
indexWhere
((
list
)
=>
jsonDecode
(
list
)[
'url_type'
]
==
typeUrlDua
);
if
(
indextypeUrlDua
==
-
1
)
{
Map
saveTypeUrlAndOrderId
=
{
"url_type"
:
typeUrlDua
,
"order_id"
:
''
,
};
listTypeUrl
.
add
(
jsonEncode
(
saveTypeUrlAndOrderId
),
);
setListTypeUrl
(
listTypeUrl
);
}
widget
.
context
.
read
<
BranchExist
>().
branchExist
(
getBranchPref
(),
getBrand
(),
getRole
(),
getCashierName
(),
getOrderId
(),
// ini orderId dari path URL
widget
.
context
,
getMenu:
true
,
);
goToMenu
(
widget
.
context
);
}
}
else
if
(
widget
.
pathSegmentString
.
length
==
5
)
{
if
(
widget
.
pathSegmentString
[
4
]
==
'go'
)
{
setPaymentMode
(
closebill
);
setIsDeliveryPickup
(
false
);
setUrlLookUp
(
''
);
setBranch
(
widget
.
pathSegmentString
[
1
]);
setBrand
(
widget
.
pathSegmentString
[
0
]);
setTableNumber
(
widget
.
pathSegmentString
[
2
]);
setToken
(
widget
.
pathSegmentString
[
3
]);
context
.
read
<
MemberInfoBloc
>().
getMemberInfo
(
getToken
());
setUrlType
(
typeUrlDua
);
List
<
String
>
listTypeUrl
=
getListTypeUrl
();
widget
.
context
.
read
<
BranchExist
>().
branchExist
(
getBranchPref
(),
getBrand
(),
getRole
(),
getCashierName
(),
getOrderId
(),
// ini orderId dari path URL
int
indextypeUrlDua
=
listTypeUrl
.
indexWhere
((
list
)
=>
jsonDecode
(
list
)[
'url_type'
]
==
typeUrlDua
);
if
(
indextypeUrlDua
==
-
1
)
{
Map
saveTypeUrlAndOrderId
=
{
"url_type"
:
typeUrlDua
,
"order_id"
:
''
,
};
listTypeUrl
.
add
(
jsonEncode
(
saveTypeUrlAndOrderId
),
);
setListTypeUrl
(
listTypeUrl
);
}
widget
.
context
.
read
<
BranchExist
>().
branchExist
(
getBranchPref
(),
getBrand
(),
getRole
(),
getCashierName
(),
getOrderId
(),
// ini orderId dari path URL
widget
.
context
,
getMenu:
true
,
);
Future
.
delayed
(
const
Duration
(
milliseconds:
2000
),
()
async
{
// if (getStatusOrderCreated()) {
context
.
read
<
FilterMenuBloc
>().
catAndMenu
(
getBranchPref
(),
getBrand
(),
getRole
(),
getCashierName
(),
getOrderId
(),
);
Navigator
.
pushReplacement
(
widget
.
context
,
getMenu:
true
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
ViewBillNew
(),
),
);
goToMenu
(
widget
.
context
);
});
}
}
else
{
Navigator
.
pushReplacement
(
widget
.
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
NoRoute
(
identification:
emptyUri
,
),
),
);
}
// context.read<CategoryMenu>().catAndMenu(widget.branch, widget.brand,
...
...
lib/ui/viewbill/timeline.dart
0 → 100644
View file @
bdbf0d11
// ignore_for_file: sized_box_for_whitespace
import
'package:byod/helper/prefs.dart'
;
import
'package:flutter/material.dart'
;
import
'package:timeline_tile/timeline_tile.dart'
;
import
'../../helper/helper.dart'
;
import
'../../helper/widget/style.dart'
;
import
'../../models/bill.dart'
;
class
DeliveryPickupStatus
extends
StatelessWidget
{
const
DeliveryPickupStatus
({
Key
?
key
,
required
this
.
dataBill
,
})
:
super
(
key:
key
);
final
List
<
Bill
>
dataBill
;
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
width:
double
.
infinity
,
color:
backgroundWhite
.
withOpacity
(
0.9
),
padding:
const
EdgeInsets
.
only
(
bottom:
10
,
),
// height: 134,
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
[
Container
(
padding:
const
EdgeInsets
.
only
(
top:
20
,
bottom:
20
,
),
child:
defaultText
(
context
,
(
getIsCustomerDelivery
())
?
'Delivery Status'
:
'Pickup Status'
,
style:
viewbillStyle
(),
),
),
(
getIsCustomerDelivery
())
?
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Container
(
width:
80
,
height:
80
,
child:
TimelineTile
(
axis:
TimelineAxis
.
horizontal
,
isFirst:
true
,
endChild:
defaultText
(
context
,
'Order Processing'
,
maxLines:
2
,
textAlign:
TextAlign
.
center
,
overFlow:
TextOverflow
.
ellipsis
,
style:
viewbillStyle
(
font:
14
),
),
beforeLineStyle:
const
LineStyle
(
color:
successColor
),
afterLineStyle:
const
LineStyle
(
color:
successColor
),
indicatorStyle:
IndicatorStyle
(
width:
42
,
height:
42
,
indicator:
Container
(
width:
42
,
height:
42
,
decoration:
const
BoxDecoration
(
color:
successColor
,
shape:
BoxShape
.
circle
,
),
child:
const
Center
(
child:
Image
(
width:
23
,
image:
AssetImage
(
'assets/icons/processing_order.png'
),
),
),
// child: ,
),
),
),
),
Container
(
width:
80
,
height:
80
,
child:
TimelineTile
(
axis:
TimelineAxis
.
horizontal
,
endChild:
defaultText
(
context
,
'Looking for Driver'
,
maxLines:
2
,
textAlign:
TextAlign
.
center
,
overFlow:
TextOverflow
.
ellipsis
,
style:
viewbillStyle
(
font:
14
),
),
beforeLineStyle:
const
LineStyle
(
color:
successColor
),
afterLineStyle:
const
LineStyle
(
color:
successColor
),
indicatorStyle:
IndicatorStyle
(
width:
42
,
height:
42
,
// height: 42,
indicator:
Container
(
width:
42
,
height:
42
,
decoration:
BoxDecoration
(
color:
(
dataBill
[
0
].
state
==
orderStateDone
&&
dataBill
[
0
].
deliveryState
==
orderDeliveryStateOtwPickup
)
?
successColor
:
disabledColor
,
shape:
BoxShape
.
circle
,
),
child:
const
Center
(
child:
Image
(
width:
23
,
image:
AssetImage
(
'assets/icons/looking_driver.png'
),
),
),
),
),
),
),
Container
(
width:
80
,
height:
80
,
child:
TimelineTile
(
axis:
TimelineAxis
.
horizontal
,
endChild:
defaultText
(
context
,
'Order on the way'
,
maxLines:
2
,
textAlign:
TextAlign
.
center
,
overFlow:
TextOverflow
.
ellipsis
,
style:
viewbillStyle
(
font:
14
),
),
beforeLineStyle:
const
LineStyle
(
color:
successColor
),
afterLineStyle:
const
LineStyle
(
color:
successColor
),
indicatorStyle:
IndicatorStyle
(
width:
42
,
height:
42
,
// height: 42,
indicator:
Container
(
width:
42
,
height:
42
,
decoration:
BoxDecoration
(
color:
(
dataBill
[
0
].
state
==
orderStateDone
&&
dataBill
[
0
].
deliveryState
==
orderDeliveryStateInDelivery
)
?
successColor
:
disabledColor
,
shape:
BoxShape
.
circle
,
),
child:
const
Center
(
child:
Image
(
width:
23
,
image:
AssetImage
(
'assets/icons/otw_pickup.png'
),
),
),
),
),
),
),
Container
(
width:
80
,
height:
80
,
child:
TimelineTile
(
isLast:
true
,
axis:
TimelineAxis
.
horizontal
,
endChild:
defaultText
(
context
,
'Order delivered'
,
maxLines:
2
,
textAlign:
TextAlign
.
center
,
overFlow:
TextOverflow
.
ellipsis
,
style:
viewbillStyle
(
font:
14
),
),
beforeLineStyle:
const
LineStyle
(
color:
successColor
),
afterLineStyle:
const
LineStyle
(
color:
successColor
),
indicatorStyle:
IndicatorStyle
(
width:
42
,
height:
42
,
// height: 42,
indicator:
Container
(
width:
42
,
height:
42
,
decoration:
BoxDecoration
(
color:
(
dataBill
[
0
].
state
==
orderStateDone
&&
dataBill
[
0
].
deliveryState
==
orderDeliveryStateDelivered
)
?
successColor
:
disabledColor
,
shape:
BoxShape
.
circle
,
),
child:
const
Center
(
child:
Image
(
width:
23
,
image:
AssetImage
(
'assets/icons/order_delivered.png'
),
),
),
),
),
),
),
],
)
:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Container
(
width:
80
,
height:
80
,
child:
TimelineTile
(
axis:
TimelineAxis
.
horizontal
,
isFirst:
true
,
endChild:
defaultText
(
context
,
getStateusPickup
(
dataBill
[
0
].
state
,
),
maxLines:
2
,
textAlign:
TextAlign
.
center
,
overFlow:
TextOverflow
.
ellipsis
,
style:
viewbillStyle
(
font:
14
),
),
beforeLineStyle:
const
LineStyle
(
color:
successColor
),
afterLineStyle:
const
LineStyle
(
color:
successColor
),
indicatorStyle:
IndicatorStyle
(
width:
42
,
height:
42
,
indicator:
Container
(
width:
42
,
height:
42
,
decoration:
const
BoxDecoration
(
color:
successColor
,
shape:
BoxShape
.
circle
,
),
child:
const
Center
(
child:
Image
(
width:
23
,
image:
AssetImage
(
'assets/icons/processing_order.png'
),
),
),
// child: ,
),
),
),
),
Container
(
width:
80
,
height:
80
,
child:
TimelineTile
(
axis:
TimelineAxis
.
horizontal
,
endChild:
defaultText
(
context
,
getStateusPickup
(
dataBill
[
0
].
state
,
),
maxLines:
2
,
textAlign:
TextAlign
.
center
,
overFlow:
TextOverflow
.
ellipsis
,
style:
viewbillStyle
(
font:
14
),
),
beforeLineStyle:
const
LineStyle
(
color:
successColor
),
afterLineStyle:
const
LineStyle
(
color:
successColor
),
indicatorStyle:
IndicatorStyle
(
width:
42
,
height:
42
,
// height: 42,
indicator:
Container
(
width:
42
,
height:
42
,
decoration:
BoxDecoration
(
color:
getColorStatusPickUp
(
dataBill
[
0
].
state
),
shape:
BoxShape
.
circle
,
),
child:
const
Center
(
child:
Image
(
width:
23
,
image:
AssetImage
(
'assets/icons/otw_pickup.png'
),
),
),
),
),
),
),
Container
(
width:
80
,
height:
80
,
child:
TimelineTile
(
isLast:
true
,
axis:
TimelineAxis
.
horizontal
,
endChild:
defaultText
(
context
,
getStateusPickup
(
dataBill
[
0
].
state
,
),
maxLines:
2
,
textAlign:
TextAlign
.
center
,
overFlow:
TextOverflow
.
ellipsis
,
style:
viewbillStyle
(
font:
14
),
),
beforeLineStyle:
const
LineStyle
(
color:
successColor
),
afterLineStyle:
const
LineStyle
(
color:
successColor
),
indicatorStyle:
IndicatorStyle
(
width:
42
,
height:
42
,
// height: 42,
indicator:
Container
(
width:
42
,
height:
42
,
decoration:
BoxDecoration
(
color:
getColorStatusPickUp
(
dataBill
[
0
].
state
),
shape:
BoxShape
.
circle
,
),
child:
const
Center
(
child:
Image
(
width:
23
,
image:
AssetImage
(
'assets/icons/order_delivered.png'
),
),
),
),
),
),
),
],
)
],
),
);
}
}
String
getStateusPickup
(
int
orderState
)
{
if
(
orderState
==
orderStateReady
)
{
return
'Ready For Pickup'
;
}
else
if
(
orderState
==
orderStateDone
)
{
return
'Order Picked Up'
;
}
return
'Order Processing'
;
}
Color
getColorStatusPickUp
(
int
orderState
)
{
if
(
orderState
!=
orderStateReady
&&
orderState
!=
orderStateDone
)
{
return
disabledColor
;
}
else
if
(
orderState
==
orderStateReady
&&
orderState
!=
orderStateDone
)
{
return
disabledColor
;
}
return
successColor
;
}
lib/ui/viewbill/view_bill_new.dart
View file @
bdbf0d11
...
...
@@ -47,6 +47,7 @@ import 'app_bar.dart';
import
'list_order.dart'
;
import
'rincian_pembayaran.dart'
;
import
'shimmer_bill.dart'
;
import
'timeline.dart'
;
class
ViewBillNew
extends
StatefulWidget
{
// const ViewBillNew({Key? key}) : super(key: key);
...
...
@@ -76,15 +77,13 @@ class ViewBillNew extends StatefulWidget {
}
class
_ViewBillNewState
extends
State
<
ViewBillNew
>
{
// final RefreshController _refreshController =
Future
<
void
>
getBillTwice
(
BuildContext
context
)
async
{
context
.
read
<
ViewBillBloc
>().
getBill
();
}
Future
<
void
>
getAddressTwice
(
BuildContext
context
)
async
{
context
.
read
<
AddressUser
>().
getAddressUser
();
context
.
read
<
AddressUser
>().
getAddressUser
(
context
);
}
void
saveBillDetail
(
List
<
Bill
>
dataBill
)
async
{
...
...
@@ -122,29 +121,25 @@ class _ViewBillNewState extends State<ViewBillNew> {
String
topic
=
'romi/byod/payment'
;
if
(
mqClient
.
updates
!=
null
)
{
mqClient
.
updates
!.
listen
((
List
<
MqttReceivedMessage
<
MqttMessage
?>>?
c
)
{
final
recMess
=
c
![
0
].
payload
as
MqttPublishMessage
;
final
pt
=
MqttPublishPayload
.
bytesToStringAsString
(
recMess
.
payload
.
message
);
// print('Notifikasi masuk dari topic <${c[0].topic}>, isinya adalah: $pt ');
// print('');
if
(
c
[
0
].
topic
==
topic
&&
pt
==
mqMessage
)
{
// update bill disini
setState
(()
{
});
if
(
debug
)
{
logd
(
'CHECK TOPIC'
,
'TOPIC MASUK::
$topic
, MESSAGE::
$mqMessage
'
);
}
}
else
{
if
(
debug
)
{
logd
(
'CHECK TOPIC'
,
'TOPIC TIDAK SAMA, YANG MASUK::
$topic
, MESSAGE::
$pt
'
);
final
recMess
=
c
![
0
].
payload
as
MqttPublishMessage
;
final
pt
=
MqttPublishPayload
.
bytesToStringAsString
(
recMess
.
payload
.
message
);
// print('Notifikasi masuk dari topic <${c[0].topic}>, isinya adalah: $pt ');
// print('');
if
(
c
[
0
].
topic
==
topic
&&
pt
==
mqMessage
)
{
// update bill disini
setState
(()
{});
if
(
debug
)
{
logd
(
'CHECK TOPIC'
,
'TOPIC MASUK::
$topic
, MESSAGE::
$mqMessage
'
);
}
}
else
{
if
(
debug
)
{
logd
(
'CHECK TOPIC'
,
'TOPIC TIDAK SAMA, YANG MASUK::
$topic
, MESSAGE::
$pt
'
);
}
}
}
});
});
}
context
.
read
<
FeedBackOptionBloc
>().
getOptionFeedback
();
context
.
read
<
ViewBillBloc
>().
backToDefault
();
...
...
@@ -486,10 +481,19 @@ class CoreBill extends StatelessWidget {
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
(
getIsDeliveryPickup
())
?
const
SizedBox
(
height:
24
,
)
:
const
SizedBox
(),
(
getIsDeliveryPickup
())
?
DeliveryPickupStatus
(
dataBill:
dataBill
)
:
const
SizedBox
(),
Container
(
width:
double
.
infinity
,
color:
backgroundWhite
.
withOpacity
(
0.9
),
height:
115
,
padding:
const
EdgeInsets
.
symmetric
(
vertical:
10
),
// height: 40,
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
...
...
@@ -1058,19 +1062,42 @@ class CoreBill extends StatelessWidget {
:
(
dataBill
[
0
].
tableStatus
!=
tableStatusOpen
)
?
GestureDetector
(
onTap:
()
{
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
NewHome2
()),
);
context
.
read
<
BranchExist
>().
branchExist
(
getBranchPref
(),
getBrand
(),
getRole
(),
getCashierName
(),
getOrderId
(),
context
,
);
if
(
dataBill
[
0
].
state
==
orderStateDone
)
{
//**UUID */
const
uuidInit
=
Uuid
();
var
newOrderId
=
uuidInit
.
v4
();
//** UUID */
setOrderId
(
newOrderId
);
context
.
read
<
BranchExist
>()
.
branchExist
(
getBranchPref
(),
getBrand
(),
getRole
(),
getCashierName
(),
getOrderId
(),
context
,
);
}
else
{
context
.
read
<
BranchExist
>()
.
branchExist
(
getBranchPref
(),
getBrand
(),
getRole
(),
getCashierName
(),
getOrderId
(),
context
,
);
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
NewHome2
()),
);
}
},
child:
Column
(
children:
[
...
...
@@ -1111,7 +1138,7 @@ class CoreBill extends StatelessWidget {
Future
<
dynamic
>
modalBottomSelectOption
(
BuildContext
context
)
{
void
ontapOkeChangeOutlet
()
{
Navigator
.
push
Replacement
(
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
SelectBranch
(
...
...
@@ -1320,26 +1347,24 @@ class ButtonPayment extends StatelessWidget {
onTap:
()
{
if
(
dataBill
[
0
].
tableStatus
==
tableStatusOpen
)
{
if
(
isCanButtonCheckoutToTap
(
dataBill
[
0
].
state
))
{
if
(
getIsDeliveryPickup
())
{
if
(
getIsCustomerDelivery
())
{
if
(
addressUser
.
id
==
''
)
{
EasyLoading
.
showToast
(
'Alamat harus dipilih terlebih dahulu'
);
}
else
{
Api
.
setToPendingOrder
();
context
.
read
<
ViewBillBloc
>().
getBill
();
}
}
else
{
if
(
getPickupTime
()
==
''
)
{
EasyLoading
.
showToast
(
'Silahkan pilih jam pickup'
);
}
else
{
Api
.
setToPendingOrder
();
context
.
read
<
ViewBillBloc
>().
getBill
();
if
(
dataBill
[
0
].
state
==
orderStateCreated
)
{
if
(
getIsDeliveryPickup
())
{
if
(
getIsCustomerDelivery
())
{
if
(
addressUser
.
id
==
''
)
{
EasyLoading
.
showToast
(
'Alamat harus dipilih terlebih dahulu'
);
}
else
{
Api
.
setToPendingOrder
();
context
.
read
<
ViewBillBloc
>().
getBill
();
}
if
(
getPickupTime
()
==
''
)
{
EasyLoading
.
showToast
(
'Silakan pilih jam pickup'
);
}
else
{
Api
.
setToPendingOrder
();
context
.
read
<
ViewBillBloc
>().
getBill
();
}
}
}
}
else
if
(
dataBill
[
0
].
state
==
orderStateCreated
)
{
Api
.
setToPendingOrder
();
context
.
read
<
ViewBillBloc
>().
getBill
();
}
else
if
(
dataBill
[
0
].
state
==
orderStatePending
&&
getTableMode
()
==
tableIndividu
)
{
EasyLoading
.
showToast
(
...
...
@@ -2141,7 +2166,7 @@ class DeliveryPickupDetail extends StatelessWidget {
return
GestureDetector
(
onTap:
()
{
void
ontapOkeChange
()
{
Navigator
.
push
Replacement
(
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
SelectBranch
(
...
...
@@ -2341,7 +2366,7 @@ Apakah ingin melanjutkan ?''';
GestureDetector
(
onTap:
()
{
void
ontapOkeChange
()
{
Navigator
.
push
Replacement
(
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
SelectBranch
(
...
...
lib/ui/webview/app_bar_webview.dart
View file @
bdbf0d11
...
...
@@ -2,13 +2,20 @@
import
'package:byod/ui/viewbill/view_bill_new.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'../../bloc/address_user_bloc.dart'
;
import
'../../bloc/branch_list.dart'
;
import
'../../helper/helper.dart'
;
import
'../../helper/widget/style.dart'
;
import
'../select_branch.dart'
;
class
CustomAppBar
extends
StatelessWidget
{
const
CustomAppBar
({
Key
?
key
,
required
this
.
titleAppBar
})
:
super
(
key:
key
);
const
CustomAppBar
(
{
Key
?
key
,
required
this
.
titleAppBar
,
required
this
.
isFromSelectBranch
})
:
super
(
key:
key
);
final
String
titleAppBar
;
final
bool
isFromSelectBranch
;
@override
Widget
build
(
BuildContext
context
)
{
...
...
@@ -28,14 +35,30 @@ class CustomAppBar extends StatelessWidget {
children:
[
GestureDetector
(
onTap:
()
{
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
ViewBillNew
(
isRepeatViewBill:
true
,
if
(
isFromSelectBranch
)
{
context
.
read
<
AddressUser
>().
getAddressUser
(
context
,
isGetBranchList:
true
,
isCallDeliveryCharge:
false
,
);
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
SelectBranch
(
isFormBill:
true
,
),
),
),
);
);
}
else
{
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
ViewBillNew
(
isRepeatViewBill:
true
,
),
),
);
}
},
child:
Container
(
width:
24
,
...
...
lib/ui/webview/webview.dart
View file @
bdbf0d11
...
...
@@ -133,12 +133,14 @@
// }
import
'package:byod/bloc/address_user_bloc.dart'
;
import
'package:byod/ui/select_branch.dart'
;
import
'package:byod/ui/viewbill/view_bill_new.dart'
;
import
'package:byod/ui/webview/app_bar_webview.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:webviewx_plus/webviewx_plus.dart'
;
import
'../../bloc/branch_list.dart'
;
import
'../../helper/helper.dart'
;
import
'../../helper/widget/button_dialog.dart'
;
...
...
@@ -147,9 +149,11 @@ class WebViewMap extends StatefulWidget {
super
.
key
,
required
this
.
titleAppBar
,
required
this
.
url
,
this
.
isFromSelectBranch
=
false
,
});
final
String
titleAppBar
;
final
String
url
;
final
bool
isFromSelectBranch
;
@override
State
<
WebViewMap
>
createState
()
=>
_WebViewMapState
();
...
...
@@ -158,15 +162,28 @@ class WebViewMap extends StatefulWidget {
class
_WebViewMapState
extends
State
<
WebViewMap
>
{
late
WebViewXController
webviewController
;
void
onTapOkPop
()
{
context
.
read
<
AddressUser
>().
getAddressUser
();
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
ViewBillNew
(
isRepeatViewBill:
true
,
if
(
widget
.
isFromSelectBranch
==
true
)
{
context
.
read
<
AddressUser
>().
getAddressUser
(
context
,
isGetBranchList:
true
,
isCallDeliveryCharge:
false
);
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
SelectBranch
(),
),
),
);
);
}
else
{
context
.
read
<
AddressUser
>()
.
getAddressUser
(
context
,
isGetBranchList:
true
);
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
ViewBillNew
(
isRepeatViewBill:
true
,
),
),
);
}
}
@override
...
...
@@ -189,7 +206,9 @@ class _WebViewMapState extends State<WebViewMap> {
},
child:
Column
(
children:
[
CustomAppBar
(
titleAppBar:
widget
.
titleAppBar
),
CustomAppBar
(
titleAppBar:
widget
.
titleAppBar
,
isFromSelectBranch:
widget
.
isFromSelectBranch
),
Expanded
(
child:
WebViewX
(
width:
MediaQuery
.
of
(
context
).
size
.
width
,
...
...
pubspec.lock
View file @
bdbf0d11
...
...
@@ -483,6 +483,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.12"
timeline_tile:
dependency: "direct main"
description:
name: timeline_tile
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
typed_data:
dependency: transitive
description:
...
...
pubspec.yaml
View file @
bdbf0d11
...
...
@@ -45,6 +45,7 @@ dependencies:
shared_preferences
:
^2.0.15
shimmer
:
^2.0.0
sliver_tools
:
^0.2.8
timeline_tile
:
^2.0.0
url_launcher
:
^6.1.5
url_strategy
:
^0.2.0
uuid
:
^3.0.6
...
...
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