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
e92aa2ba
Commit
e92aa2ba
authored
Nov 02, 2022
by
Jasa Digital
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
02/11/22
parent
1d782096
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
693 additions
and
386 deletions
+693
-386
api.dart
lib/api/api.dart
+21
-7
helper.dart
lib/helper/helper.dart
+13
-1
emoticon_rate_new.dart
lib/helper/widget/emoticon_rate_new.dart
+2
-2
bill.dart
lib/models/bill.dart
+10
-0
app_bar_confirm.dart
lib/ui/confirm_order/app_bar_confirm.dart
+1
-1
history_new.dart
lib/ui/history_order/history_new.dart
+9
-1
menu_list_utama.dart
lib/ui/home/menu_list_utama.dart
+4
-1
new_home2.dart
lib/ui/home/new_home2.dart
+5
-1
splash.dart
lib/ui/splash.dart
+4
-4
rincian_pembayaran.dart
lib/ui/viewbill/rincian_pembayaran.dart
+42
-8
view_bill_new.dart
lib/ui/viewbill/view_bill_new.dart
+574
-360
pubspec.lock
pubspec.lock
+7
-0
pubspec.yaml
pubspec.yaml
+1
-0
No files found.
lib/api/api.dart
View file @
e92aa2ba
...
...
@@ -14,6 +14,7 @@ import 'package:byod/models/filter_menu.dart';
import
'package:byod/models/member_info.dart'
;
import
'package:byod/models/payment_list.dart'
;
import
'package:byod/models/voucher_list.dart'
;
import
'package:byod/ui/home/new_home2.dart'
;
import
'package:byod/ui/viewbill/view_bill_new.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
...
...
@@ -1020,6 +1021,9 @@ class Api {
jsonObject
[
'data'
][
'rdm_staff_courier_name'
]
??
""
,
"rdm_staff_courier_mobile"
:
jsonObject
[
'data'
][
'rdm_staff_courier_mobile'
]
??
""
,
"branch_name"
:
jsonObject
[
'data'
][
'branch_name'
],
"type"
:
jsonObject
[
'data'
][
'type'
],
"payment_mode"
:
jsonObject
[
'data'
][
'payment_mode'
],
};
if
(
jsonObject
[
'data'
][
'type'
]
==
typeOrderDelivery
)
{
...
...
@@ -1483,10 +1487,17 @@ class Api {
// MaterialPageRoute(
// builder: (_) => FinishOrder(pinOrder: jsonObject['pin'])));
context
.
read
<
OrdersBloc
>().
clearOrder
();
if
(
getPaymentMode
()
==
openBill
)
{
Navigator
.
pushAndRemoveUntil
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
NewHome2
()),
(
route
)
=>
false
);
}
else
{
Navigator
.
pushAndRemoveUntil
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
ViewBillNew
()),
(
route
)
=>
false
);
}
}
else
if
(
jsonObject
[
'code'
]
==
'ORDER_LOCK'
)
{
await
EasyLoading
.
dismiss
();
EasyLoading
.
showToast
(
jsonObject
[
'msg'
]);
...
...
@@ -2156,12 +2167,16 @@ class Api {
if
(
jsonObject
!=
false
)
{
if
(
jsonObject
[
'status'
].
toString
().
toLowerCase
()
==
'ok'
)
{
setBranch
(
newBranch
);
setBranchName
(
jsonObject
[
'data'
][
'
cod
e'
]);
setBranchName
(
jsonObject
[
'data'
][
'
nam
e'
]);
setLatOutlet
(
jsonObject
[
'data'
][
'lat'
]);
setLongOutlet
(
jsonObject
[
'data'
][
'long'
]);
setOpenTime
(
jsonObject
[
'data'
][
'open_time'
]);
setCloseTime
(
jsonObject
[
'data'
][
'close_time'
]);
setServiceRadius
(
jsonObject
[
'data'
][
'service_radius'
]);
setAddressOutlet
(
jsonObject
[
'data'
][
'address'
]);
setIsDelivery
(
jsonObject
[
'data'
][
'is_delivery'
]);
setIsPickup
(
jsonObject
[
'data'
][
'is_pickup'
]);
setPhoneOutlet
(
jsonObject
[
'data'
][
'mobile'
]);
}
Map
<
String
,
dynamic
>
returnResult
=
{
"status"
:
jsonObject
[
'status'
],
...
...
@@ -2196,8 +2211,6 @@ class Api {
String
baseUrl
=
getBaseUrl
();
String
apiUrl
=
"
$baseUrl${endPointRdm}
get_address/"
;
String
sessionId
=
getSessionId
();
Address
defaultResult
=
Address
(
id:
''
,
label:
''
,
...
...
@@ -2209,6 +2222,7 @@ class Api {
recepientPhone:
''
,
notes:
''
,
);
String
sessionId
=
getSessionId
();
try
{
Map
data
=
{
"session_id"
:
sessionId
,
...
...
lib/helper/helper.dart
View file @
e92aa2ba
...
...
@@ -80,6 +80,18 @@ String getOrderStatus(int status) {
}
}
String
typeOrderString
(
int
typeOrder
)
{
if
(
typeOrder
==
typeOrderDineIn
)
{
return
'Dine In'
;
}
else
if
(
typeOrder
==
typeOrderDelivery
)
{
return
'Delivery'
;
}
else
if
(
typeOrder
==
typeOrderPickup
)
{
return
'Pickup'
;
}
else
{
return
'Unknown'
;
}
}
Color
getOrderStatusColor
(
int
status
)
{
if
(
status
==
completeOrder
)
{
return
successColor
;
...
...
@@ -185,7 +197,7 @@ String formatDate(String timeString, {toLocal = false}) {
}
void
setIsCanChangeDeliveryPickupFunc
(
int
orderState
)
{
if
(
orderState
>=
orderStateP
aid
)
{
if
(
orderState
>=
orderStateP
ending
)
{
setIsCanChangeDeliveryPickup
(
false
);
}
else
{
setIsCanChangeDeliveryPickup
(
true
);
...
...
lib/helper/widget/emoticon_rate_new.dart
View file @
e92aa2ba
...
...
@@ -201,7 +201,7 @@ class EmoticonRateNew extends StatelessWidget {
controller:
rateNote
,
maxLength:
maxLengthTextField
,
decoration:
const
InputDecoration
(
labelText:
'Beri
Masuk
an'
,
labelText:
'Beri
Penilai
an'
,
labelStyle:
TextStyle
(
fontFamily:
'OpenSans'
,
fontSize:
12
,
...
...
@@ -280,7 +280,7 @@ class EmoticonRateNew extends StatelessWidget {
child:
Center
(
child:
defaultText
(
context
,
'Kirim
Masuk
an'
,
'Kirim
Penilai
an'
,
style:
rincianPembayaran
(
color:
textInButton
,
fontWeight:
FontWeight
.
w400
,
...
...
lib/models/bill.dart
View file @
e92aa2ba
import
'package:byod/helper/helper.dart'
;
import
'package:byod/models/payment_list.dart'
;
import
'bill_detail.dart'
;
...
...
@@ -29,6 +30,9 @@ class Bill {
int
deliveryState
;
String
courierName
;
String
courierPhone
;
String
branchName
;
int
typeOrder
;
int
paymentMode
;
// List<MemberInfo> memberInfo;
Bill
({
...
...
@@ -58,6 +62,9 @@ class Bill {
this
.
deliveryState
=
0
,
this
.
courierName
=
''
,
this
.
courierPhone
=
''
,
this
.
branchName
=
''
,
this
.
typeOrder
=
typeOrderDineIn
,
this
.
paymentMode
=
openBill
// this.memberInfo = const []
});
...
...
@@ -89,6 +96,9 @@ class Bill {
deliveryState:
json
[
'delivery_state'
]
??
0
,
courierName:
json
[
'rdm_staff_courier_name'
]
??
''
,
courierPhone:
json
[
'rdm_staff_courier_mobile'
]
??
''
,
branchName:
json
[
'branch_name'
]
??
''
,
typeOrder:
json
[
'type'
]
??
typeOrderDineIn
,
paymentMode:
json
[
'payment_mode'
]
??
openBill
,
// memberInfo: json['member_info']
);
}
...
...
lib/ui/confirm_order/app_bar_confirm.dart
View file @
e92aa2ba
...
...
@@ -44,7 +44,7 @@ class CustomAppBarConfirm extends StatelessWidget {
Center
(
child:
defaultText
(
context
,
'Konfirmasi
Order
an'
,
'Konfirmasi
Pesan
an'
,
maxLines:
1
,
overFlow:
TextOverflow
.
ellipsis
,
style:
appBarNameViewBill
(),
...
...
lib/ui/history_order/history_new.dart
View file @
e92aa2ba
...
...
@@ -81,7 +81,7 @@ class HistoryOrderNew extends StatelessWidget {
borderRadius:
BorderRadius
.
circular
(
6
),
color:
backgroundWhite
,
),
height:
72
,
//
height: 72,
child:
Container
(
padding:
const
EdgeInsets
.
only
(
left:
16
,
...
...
@@ -109,6 +109,14 @@ class HistoryOrderNew extends StatelessWidget {
context
,
"Rp
${formatNumber().format(amountParseToInt(jsonDecodeHistory['total_order']))}
"
,
style:
historyOrderStyle
(),
),
const
SizedBox
(
height:
4
,
),
defaultText
(
context
,
jsonDecodeHistory
[
'typeOrder'
],
style:
historyOrderStyle
(),
)
],
),
...
...
lib/ui/home/menu_list_utama.dart
View file @
e92aa2ba
...
...
@@ -78,7 +78,9 @@ class MenuListUtama extends StatelessWidget {
categoryNonFav
[
i
].
name
,
style:
menuNameStyle
(),
),
const
Spacer
(),
const
SizedBox
(
height:
10
,
),
defaultText
(
maxLines:
2
,
overFlow:
TextOverflow
.
ellipsis
,
...
...
@@ -86,6 +88,7 @@ class MenuListUtama extends StatelessWidget {
categoryNonFav
[
i
].
description
,
style:
deskripsiMenuStyle
(),
),
const
Spacer
(),
const
SizedBox
(
height:
4
,
),
...
...
lib/ui/home/new_home2.dart
View file @
e92aa2ba
...
...
@@ -192,6 +192,10 @@ class _NewHome2State extends State<NewHome2> {
isCallDeliveryCharge:
false
,
isGetBranchList:
true
,
);
context
.
read
<
ChangeDeliveryPickupBloc
>()
.
toDelivery
(
getIsCustomerDelivery
());
}
// double heightTotal = MediaQuery.of(context).size.height;
double
appBarHeight
=
50
;
...
...
@@ -694,7 +698,7 @@ class _NewHome2State extends State<NewHome2> {
child:
BlocBuilder
<
ChangeDeliveryPickupBloc
,
bool
>(
builder:
(
ctx
,
isDelivery
)
{
return
ComponentNameUser
(
isDeliveryPickuup:
true
,
isDeliveryPickuup:
getIsDeliveryPickup
()
,
backgroundColorComponent:
backgroundColor
,
isFromMenu:
true
,
isdelivery:
isDelivery
,
...
...
lib/ui/splash.dart
View file @
e92aa2ba
...
...
@@ -49,7 +49,7 @@ class _SplashState extends State<Splash> {
}
}
int
durationDelayBeforToMenu
=
2
000
;
int
durationDelayBeforToMenu
=
3
000
;
@override
void
initState
()
{
...
...
@@ -82,13 +82,13 @@ class _SplashState extends State<Splash> {
}
widget
.
context
.
read
<
BranchExist
>().
branchExist
(
getBranchPref
()
,
getBrand
()
,
''
,
''
,
getRole
(),
getCashierName
(),
''
,
widget
.
context
,
getBrancList:
true
,
//
getBrancList: true,
);
Future
.
delayed
(
Duration
(
milliseconds:
durationDelayBeforToMenu
),
()
async
{
// if (getStatusOrderCreated()) {
...
...
lib/ui/viewbill/rincian_pembayaran.dart
View file @
e92aa2ba
...
...
@@ -11,11 +11,13 @@ class RincianPembayaran extends StatelessWidget {
required
this
.
dataBill
,
required
this
.
totalDiscount
,
required
this
.
outStandingAll
,
this
.
serviceCharge
=
0
,
})
:
super
(
key:
key
);
final
List
<
Bill
>
dataBill
;
final
int
totalDiscount
;
final
int
outStandingAll
;
final
int
serviceCharge
;
@override
Widget
build
(
BuildContext
context
)
{
...
...
@@ -89,15 +91,47 @@ class RincianPembayaran extends StatelessWidget {
),
],
),
(
getIsDeliveryPickup
())
?
(
getTypeOrder
()
==
typeOrderDelivery
)
(
dataBill
[
0
].
paymentMode
==
openBill
)
?
Column
(
children:
[
const
SizedBox
(
height:
8
,
),
Row
(
children:
[
defaultText
(
context
,
'Service'
,
style:
rincianPembayaran
(
font:
12
,
color:
textGreyBill
,
),
),
const
Spacer
(),
defaultText
(
context
,
(
serviceCharge
==
0
)
?
'-'
:
'Rp
${formatNumber().format(serviceCharge)}
'
,
style:
rincianPembayaran
(
font:
12
,
color:
textGreyBill
,
),
),
],
),
],
)
:
const
SizedBox
(),
(
dataBill
[
0
].
typeOrder
!=
typeOrderDineIn
)
?
(
dataBill
[
0
].
typeOrder
==
typeOrderDelivery
)
?
const
SizedBox
(
height:
8
,
)
:
const
SizedBox
()
:
const
SizedBox
(),
(
getIsDeliveryPickup
()
)
?
(
getTypeOrder
()
==
typeOrderDelivery
)
(
dataBill
[
0
].
typeOrder
!=
typeOrderDineIn
)
?
(
dataBill
[
0
].
typeOrder
==
typeOrderDelivery
)
?
Row
(
children:
[
defaultText
(
...
...
@@ -123,12 +157,12 @@ class RincianPembayaran extends StatelessWidget {
)
:
const
SizedBox
()
:
const
SizedBox
(),
(
getIsDeliveryPickup
()
)
(
dataBill
[
0
].
typeOrder
!=
typeOrderDineIn
)
?
const
SizedBox
(
height:
8
,
)
:
const
SizedBox
(),
(
getIsDeliveryPickup
()
)
(
dataBill
[
0
].
typeOrder
!=
typeOrderDineIn
)
?
Row
(
children:
[
defaultText
(
...
...
@@ -153,12 +187,12 @@ class RincianPembayaran extends StatelessWidget {
],
)
:
const
SizedBox
(),
(
getIsDeliveryPickup
()
)
(
dataBill
[
0
].
typeOrder
!=
typeOrderDineIn
)
?
const
SizedBox
(
height:
8
,
)
:
const
SizedBox
(),
(
getIsDeliveryPickup
()
)
(
dataBill
[
0
].
typeOrder
!=
typeOrderDineIn
)
?
Row
(
children:
[
defaultText
(
...
...
lib/ui/viewbill/view_bill_new.dart
View file @
e92aa2ba
...
...
@@ -18,6 +18,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import
'package:flutter_easyloading/flutter_easyloading.dart'
;
import
'package:intl/intl.dart'
;
import
'package:mqtt_client/mqtt_client.dart'
;
import
'package:time_picker_widget/time_picker_widget.dart'
;
import
'../../api/api.dart'
;
import
'../../bloc/address_user_bloc.dart'
;
...
...
@@ -73,7 +74,6 @@ class ViewBillNew extends StatefulWidget {
this
.
isRepeatViewBill
=
false
,
})
:
super
(
key:
key
);
@override
State
<
ViewBillNew
>
createState
()
=>
_ViewBillNewState
();
}
...
...
@@ -178,7 +178,9 @@ class _ViewBillNewState extends State<ViewBillNew> {
},
);
},
child:
BlocBuilder
<
ViewBillBloc
,
List
<
Bill
>>(
child:
BlocBuilder
<
AddressUser
,
Address
>(
builder:
(
_
,
addressUser
)
{
return
BlocBuilder
<
ViewBillBloc
,
List
<
Bill
>>(
builder:
(
ctxViewBill
,
dataBill
)
{
if
(
dataBill
.
isNotEmpty
)
{
if
(
dataBill
[
0
].
id
==
defaultViewBill
)
{
...
...
@@ -209,6 +211,7 @@ class _ViewBillNewState extends State<ViewBillNew> {
// int allPaymentPaid = 0;
int
outStandingAll
=
0
;
int
totalDiscount
=
0
;
int
serviceCharge
=
0
;
// bool isIndividuHaveWaitingPayment = false;
// String paymentToRedirect = '';
...
...
@@ -239,7 +242,31 @@ class _ViewBillNewState extends State<ViewBillNew> {
"branch_code"
:
branchCode
,
"brand"
:
brandCode
,
"token"
:
widget
.
token
,
"typeOrder"
:
typeOrderString
(
dataBill
[
0
].
typeOrder
),
"outlet_name"
:
getBranchName
()
};
if
(
dataBill
[
0
].
typeOrder
!=
typeOrderDineIn
)
{
historyOrder
[
'address_outlet'
]
=
getAddressOutlet
();
historyOrder
[
'phone_outlet'
]
=
getPhoneOutlet
();
historyOrder
[
'open_hour'
]
=
"
${getOpenTime().split(':')[0]}
:
${getOpenTime().split(':')[1]}
-
${getCloseTime().split(':')[0]}
:
${getCloseTime().split(':')[1]}
"
;
historyOrder
[
'lat_outlet'
]
=
getLatOutlet
();
historyOrder
[
'long_outlet'
]
=
getLongOutlet
();
if
(
dataBill
[
0
].
typeOrder
==
typeOrderDelivery
&&
addressUser
.
id
!=
''
)
{
historyOrder
[
'recepient_name'
]
=
addressUser
.
recepientName
;
historyOrder
[
'recepient_phone'
]
=
addressUser
.
recepientPhone
;
historyOrder
[
'address'
]
=
addressUser
.
address
;
historyOrder
[
'detail_loc'
]
=
addressUser
.
locationDetail
;
historyOrder
[
'note_loc'
]
=
addressUser
.
notes
;
}
}
String
historySave
=
jsonEncode
(
historyOrder
);
listHistoryOrder
.
add
(
historySave
);
setListHistory
(
listHistoryOrder
);
...
...
@@ -257,7 +284,31 @@ class _ViewBillNewState extends State<ViewBillNew> {
"branch_code"
:
branchCode
,
"brand"
:
brandCode
,
"token"
:
widget
.
token
,
"typeOrder"
:
typeOrderString
(
dataBill
[
0
].
typeOrder
),
"outlet_name"
:
getBranchName
()
};
if
(
dataBill
[
0
].
typeOrder
!=
typeOrderDineIn
)
{
historyOrder
[
'address_outlet'
]
=
getAddressOutlet
();
historyOrder
[
'phone_outlet'
]
=
getPhoneOutlet
();
historyOrder
[
'open_hour'
]
=
"
${getOpenTime().split(':')[0]}
:
${getOpenTime().split(':')[1]}
-
${getCloseTime().split(':')[0]}
:
${getCloseTime().split(':')[1]}
"
;
historyOrder
[
'lat_outlet'
]
=
getLatOutlet
();
historyOrder
[
'long_outlet'
]
=
getLongOutlet
();
if
(
dataBill
[
0
].
typeOrder
==
typeOrderDelivery
&&
addressUser
.
id
!=
''
)
{
historyOrder
[
'recepient_name'
]
=
addressUser
.
recepientName
;
historyOrder
[
'recepient_phone'
]
=
addressUser
.
recepientPhone
;
historyOrder
[
'address'
]
=
addressUser
.
address
;
historyOrder
[
'detail_loc'
]
=
addressUser
.
locationDetail
;
historyOrder
[
'note_loc'
]
=
addressUser
.
notes
;
}
}
String
historySave
=
jsonEncode
(
historyOrder
);
listHistoryOrder
.
add
(
historySave
);
setListHistory
(
listHistoryOrder
);
...
...
@@ -308,7 +359,11 @@ class _ViewBillNewState extends State<ViewBillNew> {
// }
outStandingAll
=
amountParseToInt
(
dataBill
[
0
].
outStandingPay
);
totalDiscount
=
amountParseToInt
(
dataBill
[
0
].
discountTotal
);
totalDiscount
=
amountParseToInt
(
dataBill
[
0
].
discountTotal
);
serviceCharge
=
amountParseToInt
(
dataBill
[
0
].
totalService
)
+
amountParseToInt
(
dataBill
[
0
].
totalServiceTax
);
outStandingIndividu
=
amountParseToInt
(
dataBill
[
0
].
outStandingIndividu
);
}
...
...
@@ -352,9 +407,9 @@ class _ViewBillNewState extends State<ViewBillNew> {
// Navigator.pop(context);
title
=
'Tutup Pesanan'
;
description
=
'''
Selesaikan transaksi dan tutup pesanan ?
Selesaikan transaksi dan tutup pesanan ?
Mohon menuju kasir untuk meminta bukti pembayaran'''
;
Mohon menuju kasir untuk meminta bukti pembayaran'''
;
// } else {
// // // Navigator.pop(context);
// // EasyLoading.showInfo('Tidak ada tagihan yang perlu dibayar');
...
...
@@ -393,6 +448,7 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
brandCode:
brandCode
,
orderId:
orderId
,
isShowOutletDetail:
isShowOutletDetail
,
serviceCharge:
serviceCharge
,
),
widthScreen:
MediaQuery
.
of
(
context
).
size
.
width
,
isCoreLayout:
true
,
...
...
@@ -415,6 +471,8 @@ Mohon menuju kasir untuk meminta bukti pembayaran''';
);
}
},
);
},
),
),
),
...
...
@@ -438,6 +496,7 @@ class CoreBill extends StatelessWidget {
required
this
.
brandCode
,
required
this
.
orderId
,
required
this
.
isShowOutletDetail
,
required
this
.
serviceCharge
,
})
:
super
(
key:
key
);
final
double
widthScreen
;
...
...
@@ -453,6 +512,7 @@ class CoreBill extends StatelessWidget {
final
String
brandCode
;
final
String
orderId
;
final
bool
isShowOutletDetail
;
final
int
serviceCharge
;
void
getBillFunction
(
BuildContext
context
)
{
context
.
read
<
ViewBillBloc
>().
getBill
();
...
...
@@ -460,7 +520,8 @@ class CoreBill extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
final
bool
isDeliveryPickuup
=
getIsDeliveryPickup
();
final
bool
isDeliveryPickuup
=
(
dataBill
[
0
].
typeOrder
!=
typeOrderDineIn
)
?
true
:
false
;
return
BlocBuilder
<
MemberInfoBloc
,
MemberInfo
>(
builder:
(
contextMember
,
memberinfo
)
{
int
outStandingTopayMember
=
0
;
...
...
@@ -487,14 +548,14 @@ class CoreBill extends StatelessWidget {
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
(
getIsDeliveryPickup
()
)
(
dataBill
[
0
].
typeOrder
!=
typeOrderDineIn
)
?
(
dataBill
[
0
].
state
==
orderStateDone
)
?
const
SizedBox
(
height:
24
,
)
:
const
SizedBox
()
:
const
SizedBox
(),
(
getIsDeliveryPickup
()
)
(
dataBill
[
0
].
typeOrder
!=
typeOrderDineIn
)
?
DeliveryPickupStatus
(
dataBill:
dataBill
)
:
const
SizedBox
(),
ComponentNameUser
(
...
...
@@ -516,6 +577,7 @@ class CoreBill extends StatelessWidget {
?
DeliveryPickupDetail
(
isShowOutletDetail:
isShowOutletDetail
,
databill:
dataBill
,
isHistory:
isHistory
,
)
:
const
SizedBox
(),
(
isDeliveryPickuup
)
...
...
@@ -531,7 +593,10 @@ class CoreBill extends StatelessWidget {
:
const
SizedBox
(),
(
isDeliveryPickuup
)
?
(
isShowOutletDetail
)
?
const
OutletDetail
()
?
OutletDetail
(
isHistory:
isHistory
,
dataBill:
dataBill
,
)
:
const
SizedBox
()
:
const
SizedBox
(),
const
SizedBox
(
...
...
@@ -659,6 +724,7 @@ class CoreBill extends StatelessWidget {
dataBill:
dataBill
,
totalDiscount:
totalDiscount
,
outStandingAll:
outStandingAll
,
serviceCharge:
serviceCharge
,
),
(
dataBill
[
0
].
paymentList
.
isNotEmpty
)
?
Column
(
...
...
@@ -963,7 +1029,7 @@ class CoreBill extends StatelessWidget {
width:
widthScreen
,
child:
Column
(
children:
[
(
!
getIsDeliveryPickup
()
&&
(
dataBill
[
0
].
typeOrder
==
typeOrderDineIn
&&
dataBill
[
0
].
tableStatus
==
tableStatusOpen
)
?
ButtonPayment
(
dataBill:
dataBill
,
...
...
@@ -979,7 +1045,7 @@ class CoreBill extends StatelessWidget {
isHistory:
isHistory
,
)
:
const
SizedBox
(),
(
getIsDeliveryPickup
()
)
(
dataBill
[
0
].
typeOrder
!=
typeOrderDineIn
)
?
ButtonPayment
(
dataBill:
dataBill
,
paymentMode:
paymentMode
,
...
...
@@ -994,7 +1060,7 @@ class CoreBill extends StatelessWidget {
isHistory:
isHistory
,
)
:
const
SizedBox
(),
(
!
getIsDeliveryPickup
()
)
(
dataBill
[
0
].
typeOrder
==
typeOrderDineIn
)
?
(
dataBill
[
0
].
tableStatus
==
tableStatusOpen
&&
dataBill
[
0
].
state
!=
orderStateDone
)
?
Column
(
...
...
@@ -1052,6 +1118,7 @@ class CoreBill extends StatelessWidget {
getOrderId
(),
context
,
);
setPickupTime
(
''
);
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
...
...
@@ -1182,7 +1249,7 @@ class ButtonPayment extends StatelessWidget {
if
(
dataBill
[
0
].
tableStatus
==
tableStatusOpen
)
{
if
(
isCanButtonCheckoutToTap
(
dataBill
[
0
].
state
))
{
if
(
dataBill
[
0
].
state
==
orderStateCreated
)
{
if
(
getIsDeliveryPickup
()
)
{
if
(
dataBill
[
0
].
typeOrder
!=
typeOrderDineIn
)
{
if
(
getIsCustomerDelivery
())
{
if
(
addressUser
.
id
==
''
)
{
EasyLoading
.
showToast
(
...
...
@@ -1238,7 +1305,10 @@ class ButtonPayment extends StatelessWidget {
getCashierName
(),
getOrderId
(),
context
,
getMenu:
true
,
getBrancList:
true
,
);
setPickupTime
(
''
);
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
...
...
@@ -1607,11 +1677,35 @@ class OutletDetail extends StatelessWidget {
const
OutletDetail
({
super
.
key
,
this
.
isFromMenu
=
false
,
this
.
isHistory
=
false
,
this
.
dataBill
=
const
[],
});
final
bool
isFromMenu
;
final
bool
isHistory
;
final
List
<
Bill
>
dataBill
;
@override
Widget
build
(
BuildContext
context
)
{
List
<
String
>
listHistoryOrder
=
getListHistory
();
int
indexListhIstory
=
listHistoryOrder
.
indexWhere
((
listHistoryOrders
)
=>
jsonDecode
(
listHistoryOrders
)[
'order_id'
]
==
dataBill
[
0
].
id
);
String
openHours
=
"
${timeHm(getOpenTime())}
-
${timeHm(getCloseTime())}
"
;
String
phoneOutlet
=
getPhoneOutlet
();
bool
isDeliveryCustomer
=
getIsCustomerDelivery
();
String
latOutlet
=
getLatOutlet
();
String
longOutlet
=
getLongOutlet
();
if
(
isHistory
&&
indexListhIstory
!=
-
1
)
{
var
historyOrder
=
jsonDecode
(
listHistoryOrder
[
indexListhIstory
]);
openHours
=
historyOrder
[
'open_hour'
];
phoneOutlet
=
historyOrder
[
'phone_outlet'
];
latOutlet
=
historyOrder
[
'lat_outlet'
];
longOutlet
=
historyOrder
[
'long_outlet'
];
if
(
historyOrder
[
'typeOrder'
]
==
'Delivery'
)
{
isDeliveryCustomer
=
true
;
}
else
{
isDeliveryCustomer
=
false
;
}
}
return
Container
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
paddingLeftRight
,
...
...
@@ -1622,7 +1716,7 @@ class OutletDetail extends StatelessWidget {
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
(
getIsCustomerDelivery
()
)
(
isDeliveryCustomer
)
?
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
...
...
@@ -1640,7 +1734,7 @@ class OutletDetail extends StatelessWidget {
children:
[
defaultText
(
context
,
"Open Hour:
$
{timeHm(getOpenTime())}
-
${timeHm(getCloseTime())}
"
,
"Open Hour:
$
openHours
"
,
maxLines:
2
,
overFlow:
TextOverflow
.
ellipsis
,
style:
viewbillStyle
(),
...
...
@@ -1664,7 +1758,7 @@ class OutletDetail extends StatelessWidget {
GestureDetector
(
onTap:
()
{
htmlOpenLink
(
'https://wa.me/
$
{getPhoneOutlet()}
'
,
'https://wa.me/
$
phoneOutlet
'
,
self:
false
,
);
},
...
...
@@ -1693,7 +1787,7 @@ class OutletDetail extends StatelessWidget {
String
latUser
=
getLatitude
();
String
longUser
=
getLongitude
();
String
urlDirection
=
'https://www.google.com/maps/dir/
$latUser
,
$longUser
/
$
{getLatOutlet()}
,
${getLongOutlet()}
'
;
'https://www.google.com/maps/dir/
$latUser
,
$longUser
/
$
latOutlet
,
$longOutlet
'
;
// Geolocator.getCurrentPosition().then((position) {
htmlOpenLink
(
urlDirection
,
...
...
@@ -1743,12 +1837,14 @@ class DeliveryPickupDetail extends StatelessWidget {
required
this
.
isShowOutletDetail
,
this
.
isFromMenu
=
false
,
this
.
databill
=
const
[],
this
.
isHistory
=
false
,
})
:
super
(
key:
key
);
// final bool isDelivery = getIsCustomerDelivery();
final
bool
isShowOutletDetail
;
final
bool
isFromMenu
;
final
List
<
Bill
>
databill
;
final
bool
isHistory
;
@override
Widget
build
(
BuildContext
context
)
{
...
...
@@ -1761,20 +1857,46 @@ class DeliveryPickupDetail extends StatelessWidget {
),
color:
(
isFromMenu
)
?
backgroundColor
:
backgroundWhite
.
withOpacity
(
0.9
),
child:
(
isDelivery
)
?
deliveryOption
(
context
,
isFromMenu
,
databill
)
:
pickupOption
(
context
),
child:
(
isHistory
==
false
)
?
(
isDelivery
)
?
deliveryOption
(
context
,
isFromMenu
,
databill
,
)
:
pickupOption
(
context
,
databill:
databill
,
)
:
(
databill
[
0
].
typeOrder
==
typeOrderDelivery
)
?
deliveryOption
(
context
,
isFromMenu
,
databill
,
isHistory:
isHistory
,
)
:
(
databill
[
0
].
typeOrder
==
typeOrderPickup
)
?
pickupOption
(
context
,
databill:
databill
,
isHistory:
isHistory
,
)
:
const
SizedBox
(),
);
},
);
}
Row
pickupOption
(
BuildContext
context
)
{
Row
pickupOption
(
BuildContext
context
,
{
List
<
Bill
>
databill
=
const
[],
bool
isHistory
=
false
,
})
{
DateTime
dateTime
=
DateTime
.
now
().
toLocal
();
String
hourTime
=
DateFormat
.
H
().
format
(
dateTime
);
String
minuteTime
=
DateFormat
.
m
().
format
(
dateTime
);
TimeOfDay
timeOfDayPickup
=
TimeOfDay
(
hour:
int
.
parse
(
hourTime
)
+
1
,
minute:
int
.
parse
(
minuteTime
)
);
TimeOfDay
(
hour:
int
.
parse
(
hourTime
)
+
1
,
minute:
0
);
return
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
start
,
...
...
@@ -1794,10 +1916,13 @@ class DeliveryPickupDetail extends StatelessWidget {
children:
[
defaultText
(
context
,
getBranchName
(),
(
isHistory
)
?
databill
[
0
].
branchName
:
getBranchName
(),
maxLines:
2
,
overFlow:
TextOverflow
.
ellipsis
,
),
(
isHistory
==
false
)
?
Column
(
children:
[
const
SizedBox
(
height:
5
,
),
...
...
@@ -1811,12 +1936,16 @@ class DeliveryPickupDetail extends StatelessWidget {
),
],
),
],
)
:
const
SizedBox
(),
const
SizedBox
(
height:
5
,
),
BlocBuilder
<
TriggerRefresh
,
bool
>(
builder:
(
_
,
trigger
)
{
return
Row
(
return
(
isHistory
==
false
)
?
Row
(
children:
[
defaultText
(
context
,
...
...
@@ -1831,7 +1960,8 @@ class DeliveryPickupDetail extends StatelessWidget {
overFlow:
TextOverflow
.
ellipsis
,
),
],
);
)
:
const
SizedBox
();
},
),
const
SizedBox
(
...
...
@@ -1849,7 +1979,7 @@ class DeliveryPickupDetail extends StatelessWidget {
Navigator
.
pop
(
context
);
}
void
setPickupTimeUser
(
int
time
)
{
void
setPickupTimeUser
(
int
time
,
{
String
typeSatuan
=
'jam'
}
)
{
String
closeOutlet
=
getCloseTime
();
String
hourClose
=
closeOutlet
.
split
(
':'
)[
0
];
String
minuteClose
=
closeOutlet
.
split
(
':'
)[
1
];
...
...
@@ -1862,9 +1992,24 @@ class DeliveryPickupDetail extends StatelessWidget {
String
hourTime
=
DateFormat
.
H
().
format
(
dateTime
);
String
minuteTime
=
DateFormat
.
m
().
format
(
dateTime
);
DateTime
dateSelectedPickupTime
;
if
(
typeSatuan
==
'jam'
)
{
dateSelectedPickupTime
=
DateTime
(
now
.
year
,
now
.
month
,
now
.
day
,
int
.
parse
(
hourTime
)
+
time
,
int
.
parse
(
minuteTime
));
}
else
{
int
hourMod
;
int
minuteMod
;
if
(
int
.
parse
(
minuteTime
)
+
time
>
60
)
{
hourMod
=
1
;
minuteMod
=
(
int
.
parse
(
minuteTime
)
+
time
)
%
60
;
}
else
{
hourMod
=
0
;
minuteMod
=
int
.
parse
(
minuteTime
)
+
time
;
}
dateSelectedPickupTime
=
DateTime
(
now
.
year
,
now
.
month
,
now
.
day
,
int
.
parse
(
hourTime
)
+
hourMod
,
minuteMod
);
}
DateTime
dateSelectedPickupTime
=
DateTime
(
now
.
year
,
now
.
month
,
now
.
day
,
int
.
parse
(
hourTime
)
+
time
,
int
.
parse
(
minuteTime
));
final
differenceClose
=
dateTimeCloseOutlet
.
difference
(
dateSelectedPickupTime
);
...
...
@@ -1881,10 +2026,28 @@ class DeliveryPickupDetail extends StatelessWidget {
);
return
;
}
TimeOfDay
timeOfDayPickup
=
TimeOfDay
(
TimeOfDay
timeOfDayPickup
;
if
(
typeSatuan
==
'jam'
)
{
timeOfDayPickup
=
TimeOfDay
(
hour:
int
.
parse
(
hourTime
)
+
time
,
minute:
int
.
parse
(
minuteTime
));
minute:
int
.
parse
(
minuteTime
),
);
}
else
{
int
hourMod
;
int
minuteMod
;
if
(
int
.
parse
(
minuteTime
)
+
time
>
60
)
{
hourMod
=
1
;
minuteMod
=
(
int
.
parse
(
minuteTime
)
+
time
)
%
60
;
}
else
{
hourMod
=
0
;
minuteMod
=
int
.
parse
(
minuteTime
)
+
time
;
}
timeOfDayPickup
=
TimeOfDay
(
hour:
int
.
parse
(
hourTime
)
+
hourMod
,
minute:
minuteMod
,
);
}
// String timeToset = timeOfDayPickup.format(context);
final
hourString
=
timeOfDayPickup
.
hour
.
toString
().
padLeft
(
2
,
'0'
);
...
...
@@ -1920,11 +2083,14 @@ class DeliveryPickupDetail extends StatelessWidget {
children:
[
GestureDetector
(
onTap:
()
{
setPickupTimeUser
(
0
);
setPickupTimeUser
(
30
,
typeSatuan:
'menit'
,
);
},
child:
ButtonComponent
(
buttonColor:
buttonColor
,
teksButton:
'
Sekarang
'
),
teksButton:
'
30 Menit
'
),
),
const
SizedBox
(
height:
10
,
...
...
@@ -1940,34 +2106,19 @@ class DeliveryPickupDetail extends StatelessWidget {
const
SizedBox
(
height:
10
,
),
GestureDetector
(
onTap:
()
{
setPickupTimeUser
(
3
);
},
child:
ButtonComponent
(
buttonColor:
buttonColor
,
teksButton:
'3 Jam'
),
),
const
SizedBox
(
height:
10
,
),
GestureDetector
(
onTap:
()
{
setPickupTimeUser
(
5
);
},
child:
ButtonComponent
(
buttonColor:
buttonColor
,
teksButton:
'5 Jam'
),
),
const
SizedBox
(
height:
10
,
),
GestureDetector
(
onTap:
()
{
Navigator
.
pop
(
context
);
showTimePicker
(
show
Custom
TimePicker
(
context:
context
,
onFailValidation:
(
context
)
=>
EasyLoading
.
showToast
(
'Unavailable selection time'
),
initialTime:
timeOfDayPickup
,
selectableTimePredicate:
(
time
)
=>
time
!.
hour
>
1
&&
time
.
hour
<
25
&&
time
.
minute
%
15
==
0
,
).
then
((
value
)
{
if
(
value
==
null
)
{
return
;
...
...
@@ -2193,6 +2344,13 @@ class DeliveryPickupDetail extends StatelessWidget {
onTap:
()
{
void
ontapOkeChange
()
{
Navigator
.
pop
(
context
);
EasyLoading
.
show
(
status:
'Getting outlet...'
,
maskType:
EasyLoadingMaskType
.
none
,
);
Api
.
getBranchList
().
then
((
value
)
{
EasyLoading
.
dismiss
();
if
(
value
.
isNotEmpty
)
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
...
...
@@ -2201,6 +2359,10 @@ class DeliveryPickupDetail extends StatelessWidget {
),
),
);
}
else
{
EasyLoading
.
showToast
(
'List outlet tidak ditemukan'
);
}
});
}
void
onTapCancelChange
()
{
...
...
@@ -2256,7 +2418,11 @@ Apakah ingin melanjutkan ?''';
}
BlocBuilder
deliveryOption
(
BuildContext
context
,
bool
isFromMenu
,
List
<
Bill
>
databill
)
{
BuildContext
context
,
bool
isFromMenu
,
List
<
Bill
>
databill
,
{
bool
isHistory
=
false
,
})
{
void
ontapAddressDetail
()
{
Navigator
.
pop
(
context
);
}
...
...
@@ -2266,6 +2432,33 @@ Apakah ingin melanjutkan ?''';
if
(
address
.
id
!=
''
)
{
setLatitude
(
address
.
lat
);
setLongitude
(
address
.
long
);
String
recepientName
=
''
;
String
recepientPhone
=
''
;
String
recepientAddress
=
''
;
String
recepientDetailLoc
=
''
;
String
recepientNotes
=
''
;
if
(
isHistory
)
{
List
<
String
>
listHistoryOrder
=
getListHistory
();
int
indexListhIstory
=
listHistoryOrder
.
indexWhere
(
(
listHistoryOrders
)
=>
jsonDecode
(
listHistoryOrders
)[
'order_id'
]
==
databill
[
0
].
id
);
if
(
indexListhIstory
!=
-
1
)
{
var
historyOrder
=
jsonDecode
(
listHistoryOrder
[
indexListhIstory
]);
recepientName
=
historyOrder
[
'recepient_name'
]
??
''
;
recepientPhone
=
historyOrder
[
'recepient_phone'
]
??
''
;
recepientAddress
=
historyOrder
[
'address'
]
??
''
;
recepientDetailLoc
=
historyOrder
[
'detail_loc'
]
??
''
;
recepientNotes
=
historyOrder
[
'note_loc'
]
??
''
;
}
}
else
{
recepientName
=
address
.
recepientName
;
recepientPhone
=
address
.
recepientPhone
;
recepientAddress
=
address
.
address
;
recepientDetailLoc
=
address
.
locationDetail
;
recepientNotes
=
address
.
notes
;
}
return
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
...
...
@@ -2288,7 +2481,7 @@ Apakah ingin melanjutkan ?''';
),
defaultText
(
context
,
address
.
recepientName
,
recepientName
,
style:
addressStyle
(
font:
10
,
),
...
...
@@ -2298,7 +2491,7 @@ Apakah ingin melanjutkan ?''';
),
defaultText
(
context
,
address
.
recepientPhone
,
recepientPhone
,
style:
addressStyle
(
font:
10
,
),
...
...
@@ -2308,7 +2501,7 @@ Apakah ingin melanjutkan ?''';
),
defaultText
(
context
,
address
.
a
ddress
,
recepientA
ddress
,
style:
addressStyle
(
font:
10
,
),
...
...
@@ -2316,7 +2509,7 @@ Apakah ingin melanjutkan ?''';
(
address
.
locationDetail
!=
''
)
?
defaultText
(
context
,
"Detail Lokasi:
$
{address.locationDetail}
"
,
"Detail Lokasi:
$
recepientDetailLoc
"
,
style:
addressStyle
(
font:
10
,
),
...
...
@@ -2325,7 +2518,7 @@ Apakah ingin melanjutkan ?''';
(
address
.
notes
!=
''
)
?
defaultText
(
context
,
"Catatan :
$
{address.notes}
"
,
"Catatan :
$
recepientNotes
"
,
style:
addressStyle
(
font:
10
,
),
...
...
@@ -2343,7 +2536,7 @@ Apakah ingin melanjutkan ?''';
databill
[
0
].
courierPhone
!=
''
)
?
defaultText
(
context
,
'
Kurir Detail
:'
,
'
Detail Kurir
:'
,
style:
addressStyle
(
font:
10
,
),
...
...
@@ -2352,7 +2545,7 @@ Apakah ingin melanjutkan ?''';
(
databill
.
isNotEmpty
&&
databill
[
0
].
courierName
!=
''
)
?
defaultText
(
context
,
"
Kurir Name
:
${databill[0].courierName}
"
,
"
Nama
:
${databill[0].courierName}
"
,
style:
addressStyle
(
font:
10
,
),
...
...
@@ -2366,7 +2559,22 @@ Apakah ingin melanjutkan ?''';
self:
false
,
);
},
child:
Container
(
width:
120
,
// height: 30,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
40
),
color:
(
isFromMenu
)
?
backgroundColor
:
backgroundWhite
,
border:
Border
.
all
(
color:
buttonColor
,
),
),
padding:
const
EdgeInsets
.
all
(
3
),
margin:
const
EdgeInsets
.
only
(
top:
5
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
fontAwesomeNew
(
phoneIcon
,
...
...
@@ -2377,13 +2585,14 @@ Apakah ingin melanjutkan ?''';
),
defaultText
(
context
,
"Kurir Mobile :
${databill[0].courierPhone}
"
,
databill
[
0
].
courierPhone
,
style:
addressStyle
(
font:
10
,
),
)
],
),
),
)
:
const
SizedBox
(),
// (address.locationDetail != '')
...
...
@@ -2464,6 +2673,7 @@ Apakah ingin melanjutkan ?''';
),
GestureDetector
(
onTap:
()
{
if
(
getIsCanChangeDeliveryPickup
())
{
void
ontapOkeChange
()
{
Navigator
.
push
(
context
,
...
...
@@ -2496,6 +2706,10 @@ Apakah ingin melanjutkan ?''';
onTapCancelChange
,
okButtonColor:
buttonColor
,
);
}
else
{
EasyLoading
.
showToast
(
'Tidak dapat ganti oulet karena status orderan sedang diproses / telah selesai'
);
}
},
child:
Container
(
width:
98
,
...
...
pubspec.lock
View file @
e92aa2ba
...
...
@@ -483,6 +483,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.12"
time_picker_widget:
dependency: "direct main"
description:
name: time_picker_widget
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0+10"
timeline_tile:
dependency: "direct main"
description:
...
...
pubspec.yaml
View file @
e92aa2ba
...
...
@@ -45,6 +45,7 @@ dependencies:
shared_preferences
:
^2.0.15
shimmer
:
^2.0.0
sliver_tools
:
^0.2.8
time_picker_widget
:
^1.0.0+10
timeline_tile
:
^2.0.0
url_launcher
:
^6.1.5
url_strategy
:
^0.2.0
...
...
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