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
375f32da
Commit
375f32da
authored
Oct 19, 2022
by
Jasa Digital
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
19/10/22
parent
300ca720
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
264 additions
and
138 deletions
+264
-138
api.dart
lib/api/api.dart
+13
-10
change_delivery_pickup.dart
lib/bloc/change_delivery_pickup.dart
+1
-1
helper.dart
lib/helper/helper.dart
+26
-22
prefs.dart
lib/helper/prefs.dart
+9
-0
new_home2.dart
lib/ui/home/new_home2.dart
+11
-5
splash.dart
lib/ui/splash.dart
+15
-6
component_name_user.dart
lib/ui/viewbill/component_name_user.dart
+3
-1
view_bill_new.dart
lib/ui/viewbill/view_bill_new.dart
+186
-93
No files found.
lib/api/api.dart
View file @
375f32da
...
...
@@ -75,15 +75,20 @@ class Api {
jsonDecode
(
element
)[
'url_type'
]
!=
typeUrlSatu
,
);
if
(
indexTypeUrl
!=
-
1
)
{
currentOrderId
=
jsonDecode
(
listTypeUrl
[
indexTypeUrl
])[
'order_id'
];
}
else
{
currentOrderId
=
getOrderId
();
}
var
uuidOrderId
=
uuidInit
.
v4
();
String
orderID
;
if
(
currentOrderId
!=
''
)
{
orderID
=
currentOrderId
;
if
(
getIsNewOrder
()
==
false
)
{
if
(
indexTypeUrl
!=
-
1
)
{
currentOrderId
=
jsonDecode
(
listTypeUrl
[
indexTypeUrl
])[
'order_id'
];
}
else
{
currentOrderId
=
getOrderId
();
}
if
(
currentOrderId
!=
''
)
{
orderID
=
currentOrderId
;
}
else
{
orderID
=
uuidOrderId
;
}
}
else
{
orderID
=
uuidOrderId
;
}
...
...
@@ -193,6 +198,7 @@ class Api {
}
else
{
setIsCustomerDelivery
(
false
);
}
setIsNewOrder
(
false
);
return
responseByodBranchExist
;
}
else
if
(
jsonObject
[
'status'
]
==
'error'
&&
(
jsonObject
[
'code'
]
==
'BYOD_ALWAYS_OFF'
||
...
...
@@ -982,9 +988,6 @@ class Api {
"rdm_staff_courier_mobile"
:
jsonObject
[
'data'
][
'rdm_staff_courier_mobile'
]
??
""
,
};
if
(
jsonObject
[
'data'
][
'delivery_fee'
]
!=
""
)
{
setIsCustomerDelivery
(
true
);
}
bill
.
add
(
Bill
.
createBill
(
i
));
// billDetail.add(BillDetail.createBillDetail(orderDetail[d]));
}
...
...
lib/bloc/change_delivery_pickup.dart
View file @
375f32da
import
'package:flutter_bloc/flutter_bloc.dart'
;
class
ChangeDeliveryPickupBloc
extends
Cubit
<
bool
>
{
ChangeDeliveryPickupBloc
()
:
super
(
fals
e
);
ChangeDeliveryPickupBloc
()
:
super
(
tru
e
);
void
toDelivery
(
bool
status
)
{
emit
(
status
);
...
...
lib/helper/helper.dart
View file @
375f32da
...
...
@@ -354,30 +354,34 @@ iscanTapAddRemoveQtyViewBill(int orderState) {
return
false
;
}
String
textButtonCheckout
(
int
orderState
)
{
String
textButtonCheckout
(
int
orderState
,
bool
isHistory
)
{
int
paymentMethod
=
getPaymentMode
();
if
(
paymentMethod
==
closebill
&&
orderState
==
orderStateCreated
)
{
return
'Pesan'
;
}
else
if
(
paymentMethod
==
closebill
&&
(
orderState
==
orderStatePending
||
orderState
==
orderStateApproved
)
||
paymentMethod
==
openBill
&&
(
orderState
==
orderStateCreated
||
orderState
==
orderStatePending
))
{
return
'Bayar'
;
}
else
if
(
paymentMethod
==
closebill
&&
(
orderState
==
orderStatePaid
||
orderState
==
orderStateInproses
||
orderState
==
orderStateReady
))
{
return
'Pesanan Diproses'
;
}
else
if
(
paymentMethod
==
openBill
&&
orderState
!=
orderStateCanceled
)
{
return
'Bayar'
;
}
else
if
(
orderState
==
orderStateCanceled
)
{
return
'Transaksi Dibatalkan'
;
}
else
if
(
orderState
==
orderStateDone
)
{
return
'Buat Pesanan Baru'
;
if
(
isHistory
)
{
return
'Kembali'
;
}
else
{
return
'Bayar'
;
if
(
paymentMethod
==
closebill
&&
orderState
==
orderStateCreated
)
{
return
'Pesan'
;
}
else
if
(
paymentMethod
==
closebill
&&
(
orderState
==
orderStatePending
||
orderState
==
orderStateApproved
)
||
paymentMethod
==
openBill
&&
(
orderState
==
orderStateCreated
||
orderState
==
orderStatePending
))
{
return
'Bayar'
;
}
else
if
(
paymentMethod
==
closebill
&&
(
orderState
==
orderStatePaid
||
orderState
==
orderStateInproses
||
orderState
==
orderStateReady
))
{
return
'Pesanan Diproses'
;
}
else
if
(
paymentMethod
==
openBill
&&
orderState
!=
orderStateCanceled
)
{
return
'Bayar'
;
}
else
if
(
orderState
==
orderStateCanceled
)
{
return
'Transaksi Dibatalkan'
;
}
else
if
(
orderState
==
orderStateDone
)
{
return
'Buat Pesanan Baru'
;
}
else
{
return
'Bayar'
;
}
}
}
...
...
lib/helper/prefs.dart
View file @
375f32da
...
...
@@ -43,6 +43,7 @@ const String _addressOutlet = 'addressOutlet';
const
String
_phoneOutlet
=
'phoneOutlet'
;
const
String
_serviceRadius
=
'sr'
;
const
String
_distanceOutletCustomer
=
'doc'
;
const
String
_isNewOrder
=
'ino'
;
String
getBaseUrl
(
)
{
return
prefs
.
getString
(
_baseUrl
)
??
''
;
...
...
@@ -375,3 +376,11 @@ double getDistance() {
Future
<
void
>
setDistance
(
double
value
)
async
{
prefs
.
setDouble
(
_distanceOutletCustomer
,
value
);
}
bool
getIsNewOrder
(
)
{
return
prefs
.
getBool
(
_isNewOrder
)
??
false
;
}
Future
<
void
>
setIsNewOrder
(
bool
value
)
async
{
prefs
.
setBool
(
_isNewOrder
,
value
);
}
lib/ui/home/new_home2.dart
View file @
375f32da
...
...
@@ -19,6 +19,7 @@ import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
import
'package:sliver_tools/sliver_tools.dart'
;
import
'../../bloc/address_user_bloc.dart'
;
import
'../../bloc/change_delivery_pickup.dart'
;
import
'../../bloc/filter_menu.dart'
;
import
'../../bloc/outlet_detail.dart'
;
import
'../../helper/mq.dart'
;
...
...
@@ -678,11 +679,16 @@ class _NewHome2State extends State<NewHome2> {
),
),
(
getIsDeliveryPickup
())
?
const
SliverToBoxAdapter
(
child:
ComponentNameUser
(
isDeliveryPickuup:
true
,
backgroundColorComponent:
backgroundColor
,
isFromMenu:
true
,
?
SliverToBoxAdapter
(
child:
BlocBuilder
<
ChangeDeliveryPickupBloc
,
bool
>(
builder:
(
ctx
,
isDelivery
)
{
return
ComponentNameUser
(
isDeliveryPickuup:
true
,
backgroundColorComponent:
backgroundColor
,
isFromMenu:
true
,
isdelivery:
isDelivery
,
);
},
),
)
:
const
SliverToBoxAdapter
(
...
...
lib/ui/splash.dart
View file @
375f32da
...
...
@@ -13,6 +13,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import
'package:geolocator/geolocator.dart'
;
import
'../bloc/branch_exist.dart'
;
import
'../bloc/change_delivery_pickup.dart'
;
import
'../bloc/filter_menu.dart'
;
import
'../main.dart'
;
import
'package:flutter/services.dart'
as
bundle_root
;
...
...
@@ -49,6 +50,8 @@ class _SplashState extends State<Splash> {
}
}
int
durationDelayBeforToMenu
=
2000
;
@override
void
initState
()
{
loadBaseUrl
().
then
((
baseUrl
)
{
...
...
@@ -88,7 +91,7 @@ class _SplashState extends State<Splash> {
widget
.
context
,
getBrancList:
true
,
);
Future
.
delayed
(
const
Duration
(
milliseconds:
2000
),
()
async
{
Future
.
delayed
(
Duration
(
milliseconds:
durationDelayBeforToMenu
),
()
async
{
// if (getStatusOrderCreated()) {
context
.
read
<
FilterMenuBloc
>().
catAndMenu
(
getBranchPref
(),
...
...
@@ -97,6 +100,9 @@ class _SplashState extends State<Splash> {
getCashierName
(),
getOrderId
(),
);
context
.
read
<
ChangeDeliveryPickupBloc
>()
.
toDelivery
(
getIsCustomerDelivery
());
Navigator
.
pushReplacement
(
widget
.
context
,
MaterialPageRoute
(
...
...
@@ -160,7 +166,7 @@ class _SplashState extends State<Splash> {
widget
.
context
,
getBrancList:
true
,
);
Future
.
delayed
(
const
Duration
(
milliseconds:
2000
),
()
async
{
Future
.
delayed
(
Duration
(
milliseconds:
durationDelayBeforToMenu
),
()
async
{
// if (getStatusOrderCreated()) {
context
.
read
<
FilterMenuBloc
>().
catAndMenu
(
getBranchPref
(),
...
...
@@ -169,6 +175,9 @@ class _SplashState extends State<Splash> {
getCashierName
(),
getOrderId
(),
);
context
.
read
<
ChangeDeliveryPickupBloc
>()
.
toDelivery
(
getIsCustomerDelivery
());
Navigator
.
pushReplacement
(
widget
.
context
,
MaterialPageRoute
(
...
...
@@ -297,7 +306,7 @@ class _SplashState extends State<Splash> {
widget
.
context
,
getMenu:
true
,
);
Future
.
delayed
(
const
Duration
(
milliseconds:
2000
),
()
async
{
Future
.
delayed
(
Duration
(
milliseconds:
durationDelayBeforToMenu
),
()
async
{
// if (getStatusOrderCreated()) {
context
.
read
<
FilterMenuBloc
>().
catAndMenu
(
getBranchPref
(),
...
...
@@ -408,7 +417,7 @@ class _SplashState extends State<Splash> {
widget
.
context
,
getMenu:
true
,
);
Future
.
delayed
(
const
Duration
(
milliseconds:
2000
),
()
async
{
Future
.
delayed
(
Duration
(
milliseconds:
durationDelayBeforToMenu
),
()
async
{
// if (getStatusOrderCreated()) {
context
.
read
<
FilterMenuBloc
>().
catAndMenu
(
getBranchPref
(),
...
...
@@ -497,7 +506,7 @@ class _SplashState extends State<Splash> {
widget
.
context
,
getMenu:
true
,
);
Future
.
delayed
(
const
Duration
(
milliseconds:
2000
),
()
async
{
Future
.
delayed
(
Duration
(
milliseconds:
durationDelayBeforToMenu
),
()
async
{
// if (getStatusOrderCreated()) {
context
.
read
<
FilterMenuBloc
>().
catAndMenu
(
getBranchPref
(),
...
...
@@ -566,7 +575,7 @@ class _SplashState extends State<Splash> {
}
void
goToMenu
(
contexts
)
{
Future
.
delayed
(
const
Duration
(
milliseconds:
2000
),
()
async
{
Future
.
delayed
(
Duration
(
milliseconds:
durationDelayBeforToMenu
),
()
async
{
Navigator
.
pushReplacement
(
contexts
,
MaterialPageRoute
(
...
...
lib/ui/viewbill/component_name_user.dart
View file @
375f32da
...
...
@@ -13,12 +13,14 @@ class ComponentNameUser extends StatelessWidget {
this
.
dataBill
=
const
[],
required
this
.
backgroundColorComponent
,
this
.
isFromMenu
=
false
,
required
this
.
isdelivery
,
})
:
super
(
key:
key
);
final
bool
isDeliveryPickuup
;
final
List
<
Bill
>
dataBill
;
final
Color
backgroundColorComponent
;
final
bool
isFromMenu
;
final
bool
isdelivery
;
@override
Widget
build
(
BuildContext
context
)
{
...
...
@@ -48,7 +50,7 @@ class ComponentNameUser extends StatelessWidget {
child:
defaultText
(
context
,
(
isDeliveryPickuup
)
?
(
getIsCustomerDelivery
()
)
?
(
isdelivery
)
?
'Delivery'
:
'Pickup'
:
'Meja
${dataBill[0].tableName}
'
,
...
...
lib/ui/viewbill/view_bill_new.dart
View file @
375f32da
This diff is collapsed.
Click to expand it.
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