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
c9417de6
Commit
c9417de6
authored
Oct 21, 2022
by
Jasa Digital
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
variant fixed
parent
33a2e00c
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
831 additions
and
507 deletions
+831
-507
api.dart
lib/api/api.dart
+38
-1
helper.dart
lib/helper/helper.dart
+10
-0
prefs.dart
lib/helper/prefs.dart
+9
-0
bottom_sheet_variant_new.dart
lib/ui/home/bottom_sheet_variant_new.dart
+240
-215
fav_grid_menu.dart
lib/ui/home/fav_grid_menu.dart
+67
-24
new_home2.dart
lib/ui/home/new_home2.dart
+88
-78
bottom_sheet_pickup_delivery.dart
lib/ui/viewbill/bottom_sheet_pickup_delivery.dart
+2
-3
component_name_user.dart
lib/ui/viewbill/component_name_user.dart
+7
-1
view_bill_new.dart
lib/ui/viewbill/view_bill_new.dart
+345
-163
app_bar_webview.dart
lib/ui/webview/app_bar_webview.dart
+25
-22
No files found.
lib/api/api.dart
View file @
c9417de6
...
...
@@ -186,6 +186,7 @@ class Api {
setTableNumber
(
jsonObject
[
'data'
][
'table_number'
]
??
''
);
setServiceRadius
(
jsonObject
[
'data'
][
'service_radius'
]
??
0
);
setDistance
(
jsonObject
[
'data'
][
'distance'
]
??
'0'
);
setIsCanChangeDeliveryPickupFunc
(
jsonObject
[
'data'
][
'order_state'
]);
if
(
jsonObject
[
'data'
][
'payment_mode'
]
!=
null
)
{
setPaymentMode
(
jsonObject
[
'data'
][
'payment_mode'
]);
}
...
...
@@ -573,7 +574,7 @@ class Api {
if
(
favDetail
[
i
][
'favorite_group_id'
]
==
favGroup
[
s
][
'id'
])
{
// List<dynamic> variantCat = favDetail[i]['variants'];
List
<
VariantCategories
>
variantCategories
=
[];
//
List<VariantCategories> variantCategories = [];
// for (int o = 0; o < variantCat.length; o++) {
// List<Variants> variants = [];
...
...
@@ -593,6 +594,35 @@ class Api {
// VariantCategories.createVariantCategory(dataVariantCat));
// }
List
<
dynamic
>
variantCat
=
favDetail
[
i
][
'variants'
];
List
<
VariantCategories
>
variantCategories
=
[];
// for (int o = 0; o < variantCat.length; o++) {
for
(
int
j
=
0
;
j
<
variantCat
.
length
;
j
++)
{
int
index
=
variantCategories
.
indexWhere
((
varCat
)
=>
varCat
.
id
==
variantCat
[
j
][
'category_variant_id'
]);
if
(
index
==
-
1
)
{
List
<
Variants
>
variants
=
[];
for
(
int
k
=
0
;
k
<
variantCat
.
length
;
k
++)
{
if
(
variantCat
[
j
][
'category_variant_id'
]
==
variantCat
[
k
][
'category_variant_id'
])
{
variants
.
add
(
Variants
.
createVariant
(
variantCat
[
k
]));
}
}
Map
<
String
,
dynamic
>
dataVariantCat
=
{
"id"
:
variantCat
[
j
][
'category_variant_id'
],
"caption"
:
variantCat
[
j
][
'category_variant_caption'
],
"type"
:
variantCat
[
j
][
'category_variant_type'
],
"variants"
:
variants
};
variantCategories
.
add
(
VariantCategories
.
createVariantCategory
(
dataVariantCat
));
}
}
// pemisahan type group
if
(
favDetail
[
i
][
'group_id'
]
!=
groupIdForFiltering
)
{
groupIdForFiltering
=
favDetail
[
i
][
'group_id'
];
...
...
@@ -953,6 +983,8 @@ class Api {
billDetail
.
add
(
BillDetail
.
createBillDetail
(
z
));
int
totalPerCustomer
=
amountParseToInt
(
z
[
'total'
]);
setIsCanChangeDeliveryPickupFunc
(
jsonObject
[
'data'
][
'order_state'
]);
var
i
=
{
"id"
:
jsonObject
[
'data'
][
'id'
],
"total"
:
jsonObject
[
'data'
][
'total'
],
...
...
@@ -987,6 +1019,11 @@ class Api {
"rdm_staff_courier_mobile"
:
jsonObject
[
'data'
][
'rdm_staff_courier_mobile'
]
??
""
,
};
if
(
jsonObject
[
'data'
][
'type'
]
==
typeOrderDelivery
)
{
setIsCustomerDelivery
(
true
);
}
else
{
setIsCustomerDelivery
(
false
);
}
bill
.
add
(
Bill
.
createBill
(
i
));
// billDetail.add(BillDetail.createBillDetail(orderDetail[d]));
}
...
...
lib/helper/helper.dart
View file @
c9417de6
...
...
@@ -184,6 +184,14 @@ String formatDate(String timeString, {toLocal = false}) {
return
dateResult
;
}
void
setIsCanChangeDeliveryPickupFunc
(
int
orderState
)
{
if
(
orderState
>=
orderStatePaid
)
{
setIsCanChangeDeliveryPickup
(
false
);
}
else
{
setIsCanChangeDeliveryPickup
(
true
);
}
}
String
localDate
(
String
date
,
{
isHistory
=
false
})
{
String
day
;
String
year
;
...
...
@@ -361,6 +369,8 @@ String textButtonCheckout(int orderState, bool isHistory) {
}
else
{
if
(
paymentMethod
==
closebill
&&
orderState
==
orderStateCreated
)
{
return
'Pesan'
;
}
else
if
(
paymentMethod
==
closebill
&&
orderState
==
orderStatePending
)
{
return
'Menunggu konfirmasi outlet'
;
}
else
if
(
paymentMethod
==
closebill
&&
(
orderState
==
orderStatePending
||
orderState
==
orderStateApproved
)
||
...
...
lib/helper/prefs.dart
View file @
c9417de6
...
...
@@ -44,6 +44,7 @@ const String _phoneOutlet = 'phoneOutlet';
const
String
_serviceRadius
=
'sr'
;
const
String
_distanceOutletCustomer
=
'doc'
;
const
String
_isNewOrder
=
'ino'
;
const
String
_isCanChangeDeliveryPickup
=
'iccdp'
;
String
getBaseUrl
(
)
{
return
prefs
.
getString
(
_baseUrl
)
??
''
;
...
...
@@ -384,3 +385,11 @@ bool getIsNewOrder() {
Future
<
void
>
setIsNewOrder
(
bool
value
)
async
{
prefs
.
setBool
(
_isNewOrder
,
value
);
}
bool
getIsCanChangeDeliveryPickup
(
)
{
return
prefs
.
getBool
(
_isCanChangeDeliveryPickup
)
??
true
;
}
Future
<
void
>
setIsCanChangeDeliveryPickup
(
bool
value
)
async
{
prefs
.
setBool
(
_isCanChangeDeliveryPickup
,
value
);
}
lib/ui/home/bottom_sheet_variant_new.dart
View file @
c9417de6
...
...
@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'../../bloc/order_bloc.dart'
;
import
'../../bloc/trigger_refresh_in_confirmation_page.dart'
;
import
'../../helper/helper.dart'
;
import
'../../main.dart'
;
import
'../../models/order_details.dart'
;
...
...
@@ -30,167 +31,185 @@ class _CustomizeVariantNewState extends State<CustomizeVariantNew> {
@override
Widget
build
(
BuildContext
context
)
{
// double widthScreen = responsiveWidthScreen(context);
return
Container
(
// width: widthScreen,
height:
MediaQuery
.
of
(
context
).
size
.
height
*
0.7
,
decoration:
const
BoxDecoration
(
borderRadius:
BorderRadius
.
only
(
topLeft:
Radius
.
circular
(
19
),
topRight:
Radius
.
circular
(
19
),
),
color:
backgroundWhite
,
),
child:
BlocBuilder
<
OrdersBloc
,
List
<
Orders
>>(
builder:
(
context
,
listCurrentOrder
)
{
int
indexOrders
=
listCurrentOrder
.
indexWhere
((
value
)
=>
value
==
widget
.
orders
);
if
(
indexOrders
==
-
1
)
{
Navigator
.
pop
(
context
);
}
return
Stack
(
children:
[
Container
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
paddingLeftRight
),
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
const
SizedBox
(
height:
8
,
),
Center
(
child:
Container
(
width:
50
,
height:
3
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
7
),
color:
disabledColor
,
return
BlocBuilder
<
TriggerRefresh
,
bool
>(
builder:
(
context
,
trigger
)
{
return
Container
(
// width: widthScreen,
height:
MediaQuery
.
of
(
context
).
size
.
height
*
0.7
,
decoration:
const
BoxDecoration
(
borderRadius:
BorderRadius
.
only
(
topLeft:
Radius
.
circular
(
19
),
topRight:
Radius
.
circular
(
19
),
),
color:
backgroundWhite
,
),
child:
BlocBuilder
<
OrdersBloc
,
List
<
Orders
>>(
builder:
(
context
,
listCurrentOrder
)
{
int
indexOrders
=
listCurrentOrder
.
indexWhere
((
value
)
=>
value
==
widget
.
orders
);
if
(
indexOrders
==
-
1
)
{
Navigator
.
pop
(
context
);
}
return
Stack
(
children:
[
Container
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
paddingLeftRight
),
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
const
SizedBox
(
height:
8
,
),
),
),
const
SizedBox
(
height:
28
,
),
defaultText
(
context
,
widget
.
orders
.
namaMenu
,
maxLines:
2
,
overFlow:
TextOverflow
.
ellipsis
,
style:
textStyleVariantModal
(
font:
20
,
fontWeight:
FontWeight
.
w600
,
),
),
const
SizedBox
(
height:
12
,
),
Expanded
(
child:
ListView
.
builder
(
itemCount:
widget
.
orders
.
orderDetail
.
length
,
itemBuilder:
(
context
,
i
)
{
int
totalHarga
=
widget
.
orders
.
orderDetail
[
i
].
totalHarga
.
toInt
();
int
totalItem
=
widget
.
orders
.
orderDetail
[
i
].
totalItem
.
toInt
();
int
satuanHarga
=
totalHarga
~/
totalItem
;
List
<
String
>
variantCaption
=
[
''
];
List
<
String
>
variantName
=
[
''
];
for
(
int
y
=
0
;
y
<
widget
.
orders
.
orderDetail
[
i
].
orderVariant
.
length
;
y
++)
{
int
indexCaption
=
variantCaption
.
indexWhere
(
(
element
)
=>
element
==
widget
.
orders
.
orderDetail
[
i
]
.
orderVariant
[
y
].
caption
);
if
(
indexCaption
==
-
1
)
{
variantCaption
.
add
(
widget
.
orders
.
orderDetail
[
i
]
.
orderVariant
[
y
].
caption
);
variantName
.
add
(
widget
.
orders
.
orderDetail
[
i
]
.
orderVariant
[
y
].
name
);
}
else
{
variantName
[
indexCaption
]
+=
",
${widget.orders.orderDetail[i].orderVariant[y].name}
"
;
}
}
return
Column
(
children:
[
Row
(
Center
(
child:
Container
(
width:
50
,
height:
3
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
7
),
color:
disabledColor
,
),
),
),
const
SizedBox
(
height:
28
,
),
defaultText
(
context
,
widget
.
orders
.
namaMenu
,
maxLines:
2
,
overFlow:
TextOverflow
.
ellipsis
,
style:
textStyleVariantModal
(
font:
20
,
fontWeight:
FontWeight
.
w600
,
),
),
const
SizedBox
(
height:
12
,
),
Expanded
(
child:
ListView
.
builder
(
itemCount:
widget
.
orders
.
orderDetail
.
length
,
itemBuilder:
(
context
,
i
)
{
int
totalHarga
=
widget
.
orders
.
orderDetail
[
i
].
totalHarga
.
toInt
();
int
totalItem
=
widget
.
orders
.
orderDetail
[
i
].
totalItem
.
toInt
();
int
satuanHarga
=
totalHarga
~/
totalItem
;
List
<
String
>
variantCaption
=
[
''
];
List
<
String
>
variantName
=
[
''
];
for
(
int
y
=
0
;
y
<
widget
.
orders
.
orderDetail
[
i
]
.
orderVariant
.
length
;
y
++)
{
int
indexCaption
=
variantCaption
.
indexWhere
(
(
element
)
=>
element
==
widget
.
orders
.
orderDetail
[
i
]
.
orderVariant
[
y
].
caption
);
if
(
indexCaption
==
-
1
)
{
variantCaption
.
add
(
widget
.
orders
.
orderDetail
[
i
]
.
orderVariant
[
y
]
.
caption
);
variantName
.
add
(
widget
.
orders
.
orderDetail
[
i
]
.
orderVariant
[
y
].
name
);
}
else
{
variantName
[
indexCaption
]
+=
",
${widget.orders.orderDetail[i].orderVariant[y].name}
"
;
}
}
return
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
end
,
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Column
(
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
CrossAxisAlignment
.
end
,
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Container
(
padding:
const
EdgeInsets
.
only
(
bottom:
8
),
child:
defaultText
(
context
,
"Rp
${formatNumber().format(widget.orders.orderDetail[i].totalHarga)}
"
,
maxLines:
1
,
overFlow:
TextOverflow
.
ellipsis
,
style:
textStyleVariantModal
(
fontWeight:
FontWeight
.
w600
,
),
),
),
Column
(
mainAxisSize:
MainAxisSize
.
min
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
for
(
int
d
=
0
;
d
<
variantCaption
.
length
;
d
++)
if
(
variantCaption
[
d
]
!=
''
)
Row
(
children:
[
defaultText
(
context
,
"
${variantCaption[d]}
: "
,
maxLines:
2
,
overFlow:
TextOverflow
.
ellipsis
,
style:
textStyleVariantModal
(),
Container
(
padding:
const
EdgeInsets
.
only
(
bottom:
8
),
child:
defaultText
(
context
,
"Rp
${formatNumber().format(widget.orders.orderDetail[i].totalHarga)}
"
,
maxLines:
1
,
overFlow:
TextOverflow
.
ellipsis
,
style:
textStyleVariantModal
(
fontWeight:
FontWeight
.
w600
,
),
),
),
Column
(
mainAxisSize:
MainAxisSize
.
min
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
for
(
int
d
=
0
;
d
<
variantCaption
.
length
;
d
++)
if
(
variantCaption
[
d
]
!=
''
)
Row
(
children:
[
defaultText
(
context
,
"
${variantCaption[d]}
: "
,
maxLines:
2
,
overFlow:
TextOverflow
.
ellipsis
,
style:
textStyleVariantModal
(),
),
defaultText
(
context
,
variantName
[
d
],
maxLines:
2
,
overFlow:
TextOverflow
.
ellipsis
,
style:
textStyleVariantModal
(),
),
],
)
],
),
(
widget
.
orders
.
orderDetail
[
i
]
.
note
!=
''
)
?
Container
(
padding:
const
EdgeInsets
.
only
(
bottom:
8
,
top:
8
,
),
defaultText
(
width:
MediaQuery
.
of
(
context
)
.
size
.
width
-
(
2
*
paddingLeftRight
),
child:
defaultText
(
context
,
variantName
[
d
]
,
maxLines:
2
,
'Catatan:
${widget.orders.orderDetail[i].note}
'
,
maxLines:
3
,
overFlow:
TextOverflow
.
ellipsis
,
style:
textStyleVariantModal
(),
),
],
)
)
:
const
SizedBox
(
)
],
),
(
widget
.
orders
.
orderDetail
[
i
].
note
!=
''
)
?
Container
(
padding:
const
EdgeInsets
.
only
(
bottom:
8
,
top:
8
,
),
child:
defaultText
(
context
,
'Catatan:
${widget.orders.orderDetail[i].note}
'
,
maxLines:
3
,
overFlow:
TextOverflow
.
ellipsis
,
style:
textStyleVariantModal
(),
),
)
:
const
SizedBox
()
],
),
Stack
(
...
...
@@ -250,6 +269,9 @@ class _CustomizeVariantNewState extends State<CustomizeVariantNew> {
context
.
read
<
OrdersBloc
>()
.
insertData
(
insertData
);
context
.
read
<
TriggerRefresh
>()
.
trigger
(!
trigger
);
setState
(()
{});
},
child:
Container
(
...
...
@@ -300,6 +322,9 @@ class _CustomizeVariantNewState extends State<CustomizeVariantNew> {
context
.
read
<
OrdersBloc
>()
.
insertData
(
insertData
);
context
.
read
<
TriggerRefresh
>()
.
trigger
(!
trigger
);
setState
(()
{});
// context
// .read<OrderDetailVariant>()
...
...
@@ -337,85 +362,85 @@ class _CustomizeVariantNewState extends State<CustomizeVariantNew> {
)
],
),
const
SizedBox
(
height:
12
,
),
(
i
!=
widget
.
orders
.
orderDetail
.
length
-
1
)
?
const
Divider
(
thickness:
1
,
height:
1
,
color:
dividerGrey
,
)
:
const
SizedBox
(),
(
i
!=
widget
.
orders
.
orderDetail
.
length
-
1
)
?
const
SizedBox
(
height:
16
,
)
:
const
SizedBox
(),
(
i
==
widget
.
orders
.
orderDetail
.
length
-
1
)
?
const
SizedBox
(
height:
65
,
)
:
const
SizedBox
()
],
),
const
SizedBox
(
height:
12
,
),
(
i
!=
widget
.
orders
.
orderDetail
.
length
-
1
)
?
const
Divider
(
thickness:
1
,
height:
1
,
color:
dividerGrey
,
)
:
const
SizedBox
(),
(
i
!=
widget
.
orders
.
orderDetail
.
length
-
1
)
?
const
SizedBox
(
height:
16
,
)
:
const
SizedBox
(),
(
i
==
widget
.
orders
.
orderDetail
.
length
-
1
)
?
const
SizedBox
(
height:
65
,
)
:
const
SizedBox
()
],
);
}),
)
],
),
),
Positioned
(
bottom:
0
,
child:
Container
(
height:
59
,
width:
MediaQuery
.
of
(
context
).
size
.
width
,
padding:
const
EdgeInsets
.
only
(
left:
paddingLeftRight
,
right:
paddingLeftRight
,
bottom:
16
,
);
}),
)
],
),
),
color:
backgroundWhite
,
child:
GestureDetector
(
onTap:
()
{
Navigator
.
pop
(
context
);
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
VariantCatNew
(
initPrice:
widget
.
orders
.
satuanHarga
,
variantCategories:
widget
.
variantCat
,
namaMenu:
widget
.
orders
.
namaMenu
,
idItem:
widget
.
orders
.
id
,
imageUrl:
widget
.
orders
.
imageUrl
,
listCurrentOrder:
listCurrentOrder
,
),
),
);
},
Positioned
(
bottom:
0
,
child:
Container
(
height:
43
,
width:
double
.
infinity
,
decoration:
BoxDecoration
(
color:
buttonColor
,
borderRadius:
BorderRadius
.
circular
(
48
),
height:
59
,
width:
MediaQuery
.
of
(
context
).
size
.
width
,
padding:
const
EdgeInsets
.
only
(
left:
paddingLeftRight
,
right:
paddingLeftRight
,
bottom:
16
,
),
child:
Center
(
child:
defaultText
(
context
,
'Tambah Variant'
,
style:
addButton
(),
color:
backgroundWhite
,
child:
GestureDetector
(
onTap:
()
{
Navigator
.
pop
(
context
);
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
VariantCatNew
(
initPrice:
widget
.
orders
.
satuanHarga
,
variantCategories:
widget
.
variantCat
,
namaMenu:
widget
.
orders
.
namaMenu
,
idItem:
widget
.
orders
.
id
,
imageUrl:
widget
.
orders
.
imageUrl
,
listCurrentOrder:
listCurrentOrder
,
),
),
);
},
child:
Container
(
height:
43
,
width:
double
.
infinity
,
decoration:
BoxDecoration
(
color:
buttonColor
,
borderRadius:
BorderRadius
.
circular
(
48
),
),
child:
Center
(
child:
defaultText
(
context
,
'Tambah Variant'
,
style:
addButton
(),
),
),
),
),
),
)
,
)
,
)
]
,
)
;
},
)
,
)
]
,
)
;
}
,
)
,
);
}
,
);
}
}
...
...
lib/ui/home/fav_grid_menu.dart
View file @
c9417de6
...
...
@@ -17,7 +17,9 @@ import '../../models/order_variants.dart';
import
'../screen_responsive.dart'
;
import
'bottom_sheet_menu_new.dart'
;
import
'bottom_sheet_variant.dart'
;
import
'bottom_sheet_variant_new.dart'
;
import
'variant_cat.dart'
;
import
'variant_cat_new.dart'
;
class
FavGridMenu
extends
StatelessWidget
{
const
FavGridMenu
({
...
...
@@ -192,7 +194,7 @@ class FavGridMenu extends StatelessWidget {
addCondition
;
// true untuk menampilkan tambah, false untuk menampilkan quantity plus minus
int
indexListOrderan
=
list
.
indexWhere
((
listOrderan
)
=>
listOrderan
.
id
==
menuFav
.
id
);
int
initialValue
;
int
initialValue
=
0
;
if
(
indexListOrderan
!=
-
1
)
{
if
(
menuFav
.
variantCat
.
isNotEmpty
)
{
addCondition
=
true
;
// kalau menu itu ada variantnya, biarin true
...
...
@@ -200,11 +202,20 @@ class FavGridMenu extends StatelessWidget {
addCondition
=
false
;
}
initialValue
=
list
[
indexListOrderan
].
totalItem
;
if
(
list
[
indexListOrderan
].
orderDetail
.
isNotEmpty
)
{
for
(
int
d
=
0
;
d
<
list
[
indexListOrderan
].
orderDetail
.
length
;
d
++)
{
initialValue
+=
list
[
indexListOrderan
].
orderDetail
[
d
].
totalItem
;
}
}
else
{
initialValue
=
list
[
indexListOrderan
].
totalItem
;
}
}
else
{
addCondition
=
true
;
initialValue
=
0
;
}
String
variantButtonCount
=
''
;
if
(
initialValue
==
1
&&
menuFav
.
variantCat
.
isNotEmpty
)
{
variantButtonCount
=
'
$initialValue
Item'
;
...
...
@@ -270,7 +281,7 @@ class FavGridMenu extends StatelessWidget {
key:
const
Key
(
'AddButton'
),
onTap:
()
{
FocusScopeNode
currentFocus
=
FocusScope
.
of
(
context
);
print
(
"Panjangnya :
${menuFav.variantCat.length}
"
);
if
(!
currentFocus
.
hasPrimaryFocus
)
{
currentFocus
.
unfocus
();
}
...
...
@@ -285,34 +296,66 @@ class FavGridMenu extends StatelessWidget {
1
,
[],
);
// check pada bloc untuk mengethui list arraynya
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (_) => VariantCat(
// namaMenu: menuFav.name,
// variantCategories: menuFav.variantCat,
// initPrice: amountParseToInt(menuFav.price),
// idItem: menuFav.id,
// imageUrl: menuFav.imageUrlThumbnail,
// listCurrentOrder: list,
// orderDetail: OrderDetail(
// allIdVariant: '',
// totalItem: 0,
// totalHarga: 0,
// note: '',
// orderVariant: [],
// ),
// ),
// ),
// );
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
VariantCat
(
namaMenu:
menuFav
.
name
,
variantCategories:
menuFav
.
variantCat
,
initPrice:
amountParseToInt
(
menuFav
.
price
),
idItem:
menuFav
.
id
,
imageUrl:
menuFav
.
imageUrlThumbnail
,
listCurrentOrder:
list
,
orderDetail:
OrderDetail
(
allIdVariant:
''
,
totalItem:
0
,
totalHarga:
0
,
note:
''
,
orderVariant:
[],
),
)));
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
VariantCatNew
(
initPrice:
amountParseToInt
(
menuFav
.
price
),
variantCategories:
menuFav
.
variantCat
,
namaMenu:
menuFav
.
name
,
idItem:
menuFav
.
id
,
imageUrl:
menuFav
.
imageUrlMedium
,
listCurrentOrder:
list
,
),
),
);
}
else
{
// showModalBottomSheet(
// backgroundColor: Colors.white.withOpacity(0),
// isScrollControlled: true,
// context: context,
// builder: (context) {
// return CustomizeVariant(
// orders: list[indexListOrderan],
// variantCat: menuFav.variantCat);
// },
// );
showModalBottomSheet
(
backgroundColor:
Colors
.
white
.
withOpacity
(
0
),
isScrollControlled:
true
,
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
19
),
),
context:
context
,
builder:
(
context
)
{
return
CustomizeVariant
(
orders:
list
[
indexListOrderan
],
variantCat:
menuFav
.
variantCat
);
// return CustomizeVariant(
// orders: list[indexListOrderan],
// variantCat: menuUtama.variantCat,
// );
return
CustomizeVariantNew
(
orders:
list
[
indexListOrderan
],
variantCat:
menuFav
.
variantCat
,
);
},
);
}
...
...
lib/ui/home/new_home2.dart
View file @
c9417de6
...
...
@@ -22,6 +22,7 @@ import '../../bloc/address_user_bloc.dart';
import
'../../bloc/change_delivery_pickup.dart'
;
import
'../../bloc/filter_menu.dart'
;
import
'../../bloc/outlet_detail.dart'
;
import
'../../bloc/trigger_refresh_in_confirmation_page.dart'
;
import
'../../helper/mq.dart'
;
import
'../../helper/widget/button_dialog.dart'
;
import
'../../helper/widget/modal_input_name.dart'
;
...
...
@@ -461,88 +462,97 @@ class _NewHome2State extends State<NewHome2> {
}
}
return
BlocBuilder
<
OrdersBloc
,
List
<
Orders
>>(
builder:
(
contextOrders
,
listOrders
)
{
int
totalItem
=
0
;
int
totalHarga
=
0
;
if
(
listOrders
.
isNotEmpty
)
{
int
fixTotalHarga
=
0
;
int
totalHargaOrderDetail
=
0
;
int
totalHargaBukanOrderDetail
=
0
;
return
BlocBuilder
<
TriggerRefresh
,
bool
>(
builder:
(
context
,
trigger
)
{
return
BlocBuilder
<
OrdersBloc
,
List
<
Orders
>>(
builder:
(
contextOrders
,
listOrders
)
{
int
totalItem
=
0
;
int
totalHarga
=
0
;
if
(
listOrders
.
isNotEmpty
)
{
int
fixTotalHarga
=
0
;
int
totalHargaOrderDetail
=
0
;
int
totalHargaBukanOrderDetail
=
0
;
int
fixTotalItem
=
0
;
int
totalItemOrderDetail
=
0
;
int
totalItemBukanOrderDetail
=
0
;
for
(
var
i
=
0
;
i
<
listOrders
.
length
;
i
++)
{
// totalItem += listOrders[i].totalItem;
// check apakah ada order detail. kalau ada rekalkulasi total harga sesuai order detail
if
(
listOrders
[
i
]
.
orderDetail
.
isEmpty
)
{
totalHargaBukanOrderDetail
+=
(
listOrders
[
i
].
totalItem
*
int
fixTotalItem
=
0
;
int
totalItemOrderDetail
=
0
;
int
totalItemBukanOrderDetail
=
0
;
for
(
var
i
=
0
;
i
<
listOrders
.
length
;
i
++)
{
// totalItem += listOrders[i].totalItem;
// check apakah ada order detail. kalau ada rekalkulasi total harga sesuai order detail
if
(
listOrders
[
i
]
.
orderDetail
.
isEmpty
)
{
totalHargaBukanOrderDetail
+=
(
listOrders
[
i
]
.
totalItem
*
listOrders
[
i
]
.
totalHarga
);
totalItemBukanOrderDetail
+=
listOrders
[
i
]
.
totalHarga
);
totalItemBukanOrderDetail
+=
listOrders
[
i
].
totalItem
;
}
else
{
for
(
int
kk
=
0
;
kk
<
listOrders
[
i
]
.
orderDetail
.
length
;
kk
++)
{
totalHargaOrderDetail
+=
listOrders
[
i
]
.
orderDetail
[
kk
]
.
totalHarga
;
totalItemOrderDetail
+=
listOrders
[
i
]
.
orderDetail
[
kk
]
.
totalItem
;
.
totalItem
;
}
else
{
for
(
int
kk
=
0
;
kk
<
listOrders
[
i
]
.
orderDetail
.
length
;
kk
++)
{
totalHargaOrderDetail
+=
listOrders
[
i
]
.
orderDetail
[
kk
]
.
totalHarga
;
totalItemOrderDetail
+=
listOrders
[
i
]
.
orderDetail
[
kk
]
.
totalItem
;
}
fixTotalHarga
=
totalHargaOrderDetail
;
fixTotalItem
=
totalItemOrderDetail
;
}
}
fixTotalHarga
=
totalHargaOrderDetail
;
fixTotalItem
=
totalItemOrderDetail
;
totalHarga
=
fixTotalHarga
+
totalHarga
Bukan
OrderDetail
;
totalItem
=
fixTotalItem
+
totalItem
Bukan
OrderDetail
;
}
}
totalHarga
=
fixTotalHarga
+
totalHargaBukanOrderDetail
;
totalItem
=
fixTotalItem
+
totalItemBukanOrderDetail
;
}
return
ScreenResponsive
(
widget:
coreHome
(
context
,
widthScreen
,
maxWidthScreen
,
appBarHeight
,
tableNumber
,
userName
,
searchFieldHeight
,
spacerHeight
,
favListHeight
,
favItemHeight
,
spacerAboveCat
,
spacerAboveCatList
,
catListHeight
,
spacerAboveMenuItem
,
totalItem
,
listOrders
,
totalHarga
,
paymentMode
,
isSearchActive
,
),
widthScreen:
MediaQuery
.
of
(
context
)
.
size
.
width
,
isCoreLayout:
true
,
return
ScreenResponsive
(
widget:
coreHome
(
context
,
widthScreen
,
maxWidthScreen
,
appBarHeight
,
tableNumber
,
userName
,
searchFieldHeight
,
spacerHeight
,
favListHeight
,
favItemHeight
,
spacerAboveCat
,
spacerAboveCatList
,
catListHeight
,
spacerAboveMenuItem
,
totalItem
,
listOrders
,
totalHarga
,
paymentMode
,
isSearchActive
,
),
widthScreen:
MediaQuery
.
of
(
context
)
.
size
.
width
,
isCoreLayout:
true
,
);
},
);
},
);
...
...
lib/ui/viewbill/bottom_sheet_pickup_delivery.dart
View file @
c9417de6
...
...
@@ -13,6 +13,7 @@ import '../select_branch.dart';
Future
<
dynamic
>
modalBottomSelectOption
(
BuildContext
context
)
{
void
ontapOkeChangeOutlet
()
{
Navigator
.
pop
(
context
);
Navigator
.
push
(
context
,
MaterialPageRoute
(
...
...
@@ -145,9 +146,7 @@ Note: Ganti outlet akan menyebabkan orderan anda saat ini hilang
Api
.
changeTypeOrder
(
typeOrderDelivery
).
then
((
value
)
{
if
(
value
)
{
setIsCustomerDelivery
(
true
);
context
.
read
<
ChangeDeliveryPickupBloc
>()
.
toDelivery
(
true
);
context
.
read
<
ChangeDeliveryPickupBloc
>().
toDelivery
(
true
);
context
.
read
<
ViewBillBloc
>().
getBill
();
setTypeOrder
(
typeOrderDelivery
);
}
...
...
lib/ui/viewbill/component_name_user.dart
View file @
c9417de6
import
'package:flutter/material.dart'
;
import
'package:flutter_easyloading/flutter_easyloading.dart'
;
import
'../../helper/helper.dart'
;
import
'../../helper/prefs.dart'
;
...
...
@@ -72,7 +73,12 @@ class ComponentNameUser extends StatelessWidget {
(
isDeliveryPickuup
)
?
GestureDetector
(
onTap:
()
{
modalBottomSelectOption
(
context
);
if
(
getIsCanChangeDeliveryPickup
())
{
modalBottomSelectOption
(
context
);
}
else
{
EasyLoading
.
showToast
(
'Tidak dapat ganti tipe order karena status orderan sedang diproses / telah selesai'
);
}
},
child:
Container
(
height:
30
,
...
...
lib/ui/viewbill/view_bill_new.dart
View file @
c9417de6
...
...
@@ -143,7 +143,7 @@ class _ViewBillNewState extends State<ViewBillNew> {
}
context
.
read
<
FeedBackOptionBloc
>().
getOptionFeedback
();
context
.
read
<
ViewBillBloc
>().
backToDefault
();
//
context.read<ViewBillBloc>().backToDefault();
getBillFunc
(
context
);
double
widthScreen
=
responsiveWidthScreen
(
context
);
double
maxWidthScreen
=
getMaxWidthScreen
(
context
,
useResponsive
);
...
...
@@ -196,50 +196,6 @@ class _ViewBillNewState extends State<ViewBillNew> {
isCoreLayout:
true
,
);
}
else
{
if
(!
widget
.
isHistory
)
{
List
<
String
>
listHistoryOrder
=
getListHistory
();
int
indexListhIstory
=
listHistoryOrder
.
indexWhere
(
(
listHistoryOrders
)
=>
jsonDecode
(
listHistoryOrders
)[
'order_id'
]
==
dataBill
[
0
].
id
);
if
(
indexListhIstory
==
-
1
)
{
Map
historyOrder
=
{
"order_id"
:
dataBill
[
0
].
id
,
"table"
:
dataBill
[
0
].
tableName
,
"user_name"
:
dataBill
[
0
].
customerName
,
"total_order"
:
dataBill
[
0
].
totalSeluruhOrderan
,
"date_order"
:
localDate
(
dataBill
[
0
].
dateOrder
,
isHistory:
true
,
),
"branch_code"
:
branchCode
,
"brand"
:
brandCode
,
"token"
:
widget
.
token
,
};
String
historySave
=
jsonEncode
(
historyOrder
);
listHistoryOrder
.
add
(
historySave
);
setListHistory
(
listHistoryOrder
);
}
else
{
listHistoryOrder
.
removeAt
(
indexListhIstory
);
Map
historyOrder
=
{
"order_id"
:
dataBill
[
0
].
id
,
"table"
:
dataBill
[
0
].
tableName
,
"user_name"
:
dataBill
[
0
].
customerName
,
"total_order"
:
dataBill
[
0
].
totalSeluruhOrderan
,
"date_order"
:
localDate
(
dataBill
[
0
].
dateOrder
,
isHistory:
true
,
),
"branch_code"
:
branchCode
,
"brand"
:
brandCode
,
"token"
:
widget
.
token
,
};
String
historySave
=
jsonEncode
(
historyOrder
);
listHistoryOrder
.
add
(
historySave
);
setListHistory
(
listHistoryOrder
);
}
}
saveBillDetail
(
dataBill
);
// int totalService = 0;
...
...
@@ -261,6 +217,53 @@ class _ViewBillNewState extends State<ViewBillNew> {
// bool isStillHavePaymentPending = false;
if
(
dataBill
.
isNotEmpty
)
{
// karna dia looping 2x, jadi kalau orderID nya sama dengan current order ID baru diupdate, kalau gak berarti history
if
(
dataBill
[
0
].
id
==
getOrderId
())
{
if
(
widget
.
isHistory
==
false
)
{
List
<
String
>
listHistoryOrder
=
getListHistory
();
int
indexListhIstory
=
listHistoryOrder
.
indexWhere
(
(
listHistoryOrders
)
=>
jsonDecode
(
listHistoryOrders
)[
'order_id'
]
==
dataBill
[
0
].
id
);
if
(
indexListhIstory
==
-
1
)
{
Map
historyOrder
=
{
"order_id"
:
dataBill
[
0
].
id
,
"table"
:
dataBill
[
0
].
tableName
,
"user_name"
:
dataBill
[
0
].
customerName
,
"total_order"
:
dataBill
[
0
].
totalSeluruhOrderan
,
"date_order"
:
localDate
(
dataBill
[
0
].
dateOrder
,
isHistory:
true
,
),
"branch_code"
:
branchCode
,
"brand"
:
brandCode
,
"token"
:
widget
.
token
,
};
String
historySave
=
jsonEncode
(
historyOrder
);
listHistoryOrder
.
add
(
historySave
);
setListHistory
(
listHistoryOrder
);
}
else
{
listHistoryOrder
.
removeAt
(
indexListhIstory
);
Map
historyOrder
=
{
"order_id"
:
dataBill
[
0
].
id
,
"table"
:
dataBill
[
0
].
tableName
,
"user_name"
:
dataBill
[
0
].
customerName
,
"total_order"
:
dataBill
[
0
].
totalSeluruhOrderan
,
"date_order"
:
localDate
(
dataBill
[
0
].
dateOrder
,
isHistory:
true
,
),
"branch_code"
:
branchCode
,
"brand"
:
brandCode
,
"token"
:
widget
.
token
,
};
String
historySave
=
jsonEncode
(
historyOrder
);
listHistoryOrder
.
add
(
historySave
);
setListHistory
(
listHistoryOrder
);
}
}
}
// int indexWherePendingPayment = dataBill[0]
// .paymentList
// .indexWhere((element) => element.isApproved == false);
...
...
@@ -1841,6 +1844,59 @@ class DeliveryPickupDetail extends StatelessWidget {
const
Spacer
(),
BlocBuilder
<
TriggerRefresh
,
bool
>(
builder:
(
_
,
trigger
)
{
void
ontapClose
()
{
Navigator
.
pop
(
context
);
}
void
setPickupTimeUser
(
int
time
)
{
String
closeOutlet
=
getCloseTime
();
String
hourClose
=
closeOutlet
.
split
(
':'
)[
0
];
String
minuteClose
=
closeOutlet
.
split
(
':'
)[
1
];
var
now
=
DateTime
.
now
().
toLocal
();
var
dateNow
=
DateFormat
(
'yyyy-MM-dd'
).
format
(
now
);
String
dateTimeCloseOutletString
=
"
$dateNow
$hourClose
:
$minuteClose
:00"
;
DateTime
dateTimeCloseOutlet
=
DateTime
.
parse
(
dateTimeCloseOutletString
);
String
hourTime
=
DateFormat
.
H
().
format
(
dateTime
);
String
minuteTime
=
DateFormat
.
m
().
format
(
dateTime
);
DateTime
dateSelectedPickupTime
=
DateTime
(
now
.
year
,
now
.
month
,
now
.
day
,
int
.
parse
(
hourTime
)
+
time
,
int
.
parse
(
minuteTime
));
final
differenceClose
=
dateTimeCloseOutlet
.
difference
(
dateSelectedPickupTime
);
if
(
differenceClose
.
inMinutes
<
59
)
{
buttonDialogGlobal
(
context
,
'Informasi'
,
'Pickup Hanya Bisa Dilakukan 1 Jam sebelum outlet tutup'
,
'OK'
,
'Close'
,
ontapClose
,
ontapClose
,
isOkeButtonShow:
false
,
);
return
;
}
TimeOfDay
timeOfDayPickup
=
TimeOfDay
(
hour:
int
.
parse
(
hourTime
)
+
time
,
minute:
int
.
parse
(
minuteTime
));
// String timeToset = timeOfDayPickup.format(context);
final
hourString
=
timeOfDayPickup
.
hour
.
toString
().
padLeft
(
2
,
'0'
);
final
minuteString
=
timeOfDayPickup
.
minute
.
toString
().
padLeft
(
2
,
'0'
);
// String amPM = timeToset.split(' ')[1];
String
setPickup
=
"
$hourString
:
$minuteString
"
;
setPickupTime
(
setPickup
);
context
.
read
<
TriggerRefresh
>().
trigger
(!
trigger
);
context
.
read
<
ViewBillBloc
>().
getBill
();
Navigator
.
pop
(
context
);
}
return
Column
(
children:
[
changeOutlet
(
context
),
...
...
@@ -1849,98 +1905,205 @@ class DeliveryPickupDetail extends StatelessWidget {
),
GestureDetector
(
onTap:
()
{
showTimePicker
(
context:
context
,
initialTime:
timeOfDayPickup
,
).
then
((
value
)
{
if
(
value
==
null
)
{
return
;
}
else
{
void
ontapClose
()
{
Navigator
.
pop
(
context
);
}
String
closeOutlet
=
getCloseTime
();
String
hourClose
=
closeOutlet
.
split
(
':'
)[
0
];
String
minuteClose
=
closeOutlet
.
split
(
':'
)[
1
];
String
openOutlet
=
getOpenTime
();
String
hourOpen
=
openOutlet
.
split
(
':'
)[
0
];
String
minuteOpen
=
openOutlet
.
split
(
':'
)[
1
];
// TimeOfDay timeClose = TimeOfDay(
// hour: int.parse(hourClose),
// minute: int.parse(minuteClose),
// );
var
now
=
DateTime
.
now
().
toLocal
();
var
dateNow
=
DateFormat
(
'yyyy-MM-dd'
).
format
(
now
);
String
dateTimeCloseOutletString
=
"
$dateNow
$hourClose
:
$minuteClose
:00"
;
String
dateTimeOpenOutletString
=
"
$dateNow
$hourOpen
:
$minuteOpen
:00"
;
DateTime
dateTimeCloseOutlet
=
DateTime
.
parse
(
dateTimeCloseOutletString
);
DateTime
dateTimeOpenOutlet
=
DateTime
.
parse
(
dateTimeOpenOutletString
);
DateTime
dateSelectedPickupTime
=
DateTime
(
now
.
year
,
now
.
month
,
now
.
day
,
value
.
hour
,
value
.
minute
);
final
differenceClose
=
dateTimeCloseOutlet
.
difference
(
dateSelectedPickupTime
);
final
differenceOpen
=
dateSelectedPickupTime
.
difference
(
dateTimeOpenOutlet
);
final
differenceFromNow
=
dateSelectedPickupTime
.
difference
(
now
);
if
(
differenceFromNow
.
inMinutes
<
0
)
{
buttonDialogGlobal
(
context
,
'Informasi'
,
'Pickup time tidak dapat dipilih pada waktu yang sudah berlalu'
,
'OK'
,
'Close'
,
ontapClose
,
ontapClose
,
isOkeButtonShow:
false
,
);
return
;
}
if
(
differenceClose
.
inMinutes
<
59
)
{
buttonDialogGlobal
(
context
,
'Informasi'
,
'Pickup Hanya Bisa Dilakukan 1 Jam sebelum outlet tutup'
,
'OK'
,
'Close'
,
ontapClose
,
ontapClose
,
isOkeButtonShow:
false
,
);
return
;
}
if
(
getIsCanChangeDeliveryPickup
())
{
showDialog
(
context:
context
,
builder:
(
BuildContext
ctx
)
=>
AlertDialog
(
title:
defaultText
(
context
,
'Silahkan pilih jam pickup'
,
style:
viewbillStyle
(),
),
content:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
[
GestureDetector
(
onTap:
()
{
setPickupTimeUser
(
0
);
},
child:
ButtonComponent
(
buttonColor:
buttonColor
,
teksButton:
'Sekarang'
),
),
const
SizedBox
(
height:
10
,
),
GestureDetector
(
onTap:
()
{
setPickupTimeUser
(
1
);
},
child:
ButtonComponent
(
buttonColor:
buttonColor
,
teksButton:
'1 Jam'
),
),
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
(
context:
context
,
initialTime:
timeOfDayPickup
,
).
then
((
value
)
{
if
(
value
==
null
)
{
return
;
}
else
{
String
closeOutlet
=
getCloseTime
();
String
hourClose
=
closeOutlet
.
split
(
':'
)[
0
];
String
minuteClose
=
closeOutlet
.
split
(
':'
)[
1
];
String
openOutlet
=
getOpenTime
();
String
hourOpen
=
openOutlet
.
split
(
':'
)[
0
];
String
minuteOpen
=
openOutlet
.
split
(
':'
)[
1
];
// TimeOfDay timeClose = TimeOfDay(
// hour: int.parse(hourClose),
// minute: int.parse(minuteClose),
// );
var
now
=
DateTime
.
now
().
toLocal
();
var
dateNow
=
DateFormat
(
'yyyy-MM-dd'
)
.
format
(
now
);
String
dateTimeCloseOutletString
=
"
$dateNow
$hourClose
:
$minuteClose
:00"
;
String
dateTimeOpenOutletString
=
"
$dateNow
$hourOpen
:
$minuteOpen
:00"
;
DateTime
dateTimeCloseOutlet
=
DateTime
.
parse
(
dateTimeCloseOutletString
);
DateTime
dateTimeOpenOutlet
=
DateTime
.
parse
(
dateTimeOpenOutletString
);
DateTime
dateSelectedPickupTime
=
DateTime
(
now
.
year
,
now
.
month
,
now
.
day
,
value
.
hour
,
value
.
minute
);
final
differenceClose
=
dateTimeCloseOutlet
.
difference
(
dateSelectedPickupTime
);
final
differenceOpen
=
dateSelectedPickupTime
.
difference
(
dateTimeOpenOutlet
);
final
differenceFromNow
=
dateSelectedPickupTime
.
difference
(
now
);
if
(
differenceFromNow
.
inMinutes
<
0
)
{
buttonDialogGlobal
(
context
,
'Informasi'
,
'Pickup time tidak dapat dipilih pada waktu yang sudah berlalu'
,
'OK'
,
'Close'
,
ontapClose
,
ontapClose
,
isOkeButtonShow:
false
,
);
return
;
}
if
(
differenceClose
.
inMinutes
<
59
)
{
buttonDialogGlobal
(
context
,
'Informasi'
,
'Pickup Hanya Bisa Dilakukan 1 Jam sebelum outlet tutup'
,
'OK'
,
'Close'
,
ontapClose
,
ontapClose
,
isOkeButtonShow:
false
,
);
return
;
}
if
(
differenceOpen
.
inMinutes
<
0
)
{
buttonDialogGlobal
(
context
,
'Informasi'
,
'Pickup Hanya Bisa Dilakukan Setelah Outlet Buka'
,
'OK'
,
'Close'
,
ontapClose
,
ontapClose
,
isOkeButtonShow:
false
,
);
return
;
}
// String timeToset = value.format(context);
final
hourString
=
value
.
hour
.
toString
().
padLeft
(
2
,
'0'
);
final
minuteString
=
value
.
minute
.
toString
().
padLeft
(
2
,
'0'
);
// String amPM = timeToset.split(' ')[1];
String
setPickup
=
"
$hourString
:
$minuteString
"
;
setPickupTime
(
setPickup
);
context
.
read
<
TriggerRefresh
>().
trigger
(!
trigger
);
context
.
read
<
ViewBillBloc
>().
getBill
();
}
});
if
(
differenceOpen
.
inMinutes
<
0
)
{
buttonDialogGlobal
(
context
,
'Informasi'
,
'Pickup Hanya Bisa Dilakukan Setelah Outlet Buka'
,
'OK'
,
'Close'
,
ontapClose
,
ontapClose
,
isOkeButtonShow:
false
,
);
return
;
}
// String timeToset = value.format(context);
final
hourString
=
value
.
hour
.
toString
()
.
padLeft
(
2
,
'0'
);
final
minuteString
=
value
.
minute
.
toString
()
.
padLeft
(
2
,
'0'
);
// String amPM = timeToset.split(' ')[1];
String
setPickup
=
"
$hourString
:
$minuteString
"
;
setPickupTime
(
setPickup
);
context
.
read
<
TriggerRefresh
>()
.
trigger
(!
trigger
);
context
.
read
<
ViewBillBloc
>()
.
getBill
();
}
});
},
child:
ButtonComponent
(
buttonColor:
buttonColor
,
teksButton:
'Atur Sendiri'
,
),
),
const
SizedBox
(
height:
10
,
),
GestureDetector
(
onTap:
()
{
Navigator
.
pop
(
context
);
},
child:
const
ButtonComponent
(
buttonColor:
Colors
.
transparent
,
teksButton:
'Close'
,
teksButtonColor:
textColorBlack
,
),
)
],
),
));
}
else
{
EasyLoading
.
showToast
(
'Tidak dapat pilih jam pikcup karena status orderan sedang diproses / telah selesai'
);
}
// ketika user click OK
},
child:
Container
(
...
...
@@ -2028,6 +2191,7 @@ class DeliveryPickupDetail extends StatelessWidget {
return
GestureDetector
(
onTap:
()
{
void
ontapOkeChange
()
{
Navigator
.
pop
(
context
);
Navigator
.
push
(
context
,
MaterialPageRoute
(
...
...
@@ -2049,16 +2213,22 @@ class DeliveryPickupDetail extends StatelessWidget {
Ganti outlet akan menyebabkan orderan anda saat ini hilang.
Apakah ingin melanjutkan ?'''
;
buttonDialogGlobal
(
context
,
title
,
description
,
textOnOk
,
textOnCancel
,
ontapOkeChange
,
onTapCancelChange
,
okButtonColor:
buttonColor
,
);
if
(
getIsCanChangeDeliveryPickup
())
{
buttonDialogGlobal
(
context
,
title
,
description
,
textOnOk
,
textOnCancel
,
ontapOkeChange
,
onTapCancelChange
,
okButtonColor:
buttonColor
,
);
}
else
{
EasyLoading
.
showToast
(
'Tidak dapat ganti outlet karena status orderan sedang diproses / telah selesai'
);
}
},
child:
Container
(
width:
98
,
...
...
@@ -2249,17 +2419,22 @@ Apakah ingin melanjutkan ?''';
children:
[
GestureDetector
(
onTap:
()
{
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
WebViewMap
(
titleAppBar:
'Ganti Alamat'
,
url:
'
${getBaseUrl()}
rdm/address/add/?session_id=
${getSessionId()}
'
,
isFromMenu:
isFromMenu
,
if
(
getIsCanChangeDeliveryPickup
())
{
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
WebViewMap
(
titleAppBar:
'Ganti Alamat'
,
url:
'
${getBaseUrl()}
rdm/address/add/?session_id=
${getSessionId()}
'
,
isFromMenu:
isFromMenu
,
),
),
),
);
);
}
else
{
EasyLoading
.
showToast
(
'Tidak dapat ganti alamat karena status orderan sedang diproses / telah selesai'
);
}
},
child:
Container
(
width:
98
,
...
...
@@ -2463,15 +2638,22 @@ Apakah ingin melanjutkan ?''';
children:
[
GestureDetector
(
onTap:
()
{
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
WebViewMap
(
if
(
getIsCanChangeDeliveryPickup
())
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
WebViewMap
(
titleAppBar:
'Pilih Alamat'
,
url:
'
${getBaseUrl()}
rdm/address/add/?session_id=
${getSessionId()}
'
),
),
);
'
${getBaseUrl()}
rdm/address/add/?session_id=
${getSessionId()}
'
,
isFromMenu:
isFromMenu
,
),
),
);
}
else
{
EasyLoading
.
showToast
(
'Tidak dapat pilih alamat karena status orderan sedang diproses / telah selesai'
);
}
},
child:
Container
(
width:
98
,
...
...
lib/ui/webview/app_bar_webview.dart
View file @
c9417de6
...
...
@@ -40,33 +40,36 @@ class CustomAppBar extends StatelessWidget {
children:
[
GestureDetector
(
onTap:
()
{
if
(
isFromSelectBranch
)
{
if
(
isFromSelectBranch
||
isFromMenu
)
{
context
.
read
<
AddressUser
>().
getAddressUser
(
context
,
isGetBranchList:
true
,
isCallDeliveryCharge:
false
,
);
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
SelectBranch
(
isFormBill:
true
,
),
),
);
}
else
if
(
isFromMenu
)
{
context
.
read
<
AddressUser
>().
getAddressUser
(
context
,
isGetBranchList:
true
,
isCallDeliveryCharge:
false
,
);
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
NewHome2
(),
),
);
}
else
{
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (_) => const SelectBranch(
// isFormBill: true,
// ),
// ),
// );
Navigator
.
pop
(
context
);
}
// else if (isFromMenu) {
// context.read<AddressUser>().getAddressUser(
// context,
// isGetBranchList: true,
// isCallDeliveryCharge: false,
// );
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (_) => const NewHome2(),
// ),
// );
// }
else
{
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
...
...
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