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
Expand all
Show 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
This diff is collapsed.
Click to expand it.
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
;
}
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
,
builder:
(
_
)
=>
VariantCatNew
(
initPrice:
amountParseToInt
(
menuFav
.
price
)
,
variantCategories:
menuFav
.
variantCat
,
initPrice:
amountParseToInt
(
menuFav
.
price
),
namaMenu:
menuFav
.
name
,
idItem:
menuFav
.
id
,
imageUrl:
menuFav
.
imageUrlThumbnail
,
imageUrl:
menuFav
.
imageUrlMedium
,
listCurrentOrder:
list
,
orderDetail:
OrderDetail
(
allIdVariant:
''
,
totalItem:
0
,
totalHarga:
0
,
note:
''
,
orderVariant:
[],
),
)));
),
);
}
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
(
// return CustomizeVariant(
// orders: list[indexListOrderan],
// variantCat: menuUtama.variantCat,
// );
return
CustomizeVariantNew
(
orders:
list
[
indexListOrderan
],
variantCat:
menuFav
.
variantCat
);
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,9 +462,13 @@ class _NewHome2State extends State<NewHome2> {
}
}
return
BlocBuilder
<
TriggerRefresh
,
bool
>(
builder:
(
context
,
trigger
)
{
return
BlocBuilder
<
OrdersBloc
,
List
<
Orders
>>(
builder:
(
contextOrders
,
listOrders
)
{
builder:
(
contextOrders
,
listOrders
)
{
int
totalItem
=
0
;
int
totalHarga
=
0
;
if
(
listOrders
.
isNotEmpty
)
{
...
...
@@ -474,7 +479,8 @@ class _NewHome2State extends State<NewHome2> {
int
fixTotalItem
=
0
;
int
totalItemOrderDetail
=
0
;
int
totalItemBukanOrderDetail
=
0
;
int
totalItemBukanOrderDetail
=
0
;
for
(
var
i
=
0
;
i
<
listOrders
.
length
;
i
++)
{
...
...
@@ -484,11 +490,13 @@ class _NewHome2State extends State<NewHome2> {
.
orderDetail
.
isEmpty
)
{
totalHargaBukanOrderDetail
+=
(
listOrders
[
i
].
totalItem
*
(
listOrders
[
i
]
.
totalItem
*
listOrders
[
i
]
.
totalHarga
);
totalItemBukanOrderDetail
+=
listOrders
[
i
].
totalItem
;
listOrders
[
i
]
.
totalItem
;
}
else
{
for
(
int
kk
=
0
;
kk
<
...
...
@@ -552,6 +560,8 @@ class _NewHome2State extends State<NewHome2> {
);
},
);
},
);
});
},
)
...
...
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:
()
{
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
This diff is collapsed.
Click to expand it.
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