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
6dd4cfb5
Commit
6dd4cfb5
authored
Oct 11, 2022
by
Dio Maulana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pickup info dan datetimepicker
parent
f95c5dae
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
807 additions
and
418 deletions
+807
-418
api.dart
lib/api/api.dart
+82
-1
order_variant_value.dart
lib/bloc/order_variant_value.dart
+6
-4
helper.dart
lib/helper/helper.dart
+1
-1
mq.dart
lib/helper/mq.dart
+12
-4
prefs.dart
lib/helper/prefs.dart
+27
-0
confirm_order.dart
lib/ui/confirm_order/confirm_order.dart
+145
-42
bottom_sheet_variant_new.dart
lib/ui/home/bottom_sheet_variant_new.dart
+46
-10
variant_cat_new.dart
lib/ui/home/variant_cat_new.dart
+76
-88
list_order.dart
lib/ui/viewbill/list_order.dart
+4
-1
order_view_bill_new.dart
lib/ui/viewbill/order_view_bill_new.dart
+217
-220
view_bill_new.dart
lib/ui/viewbill/view_bill_new.dart
+191
-47
No files found.
lib/api/api.dart
View file @
6dd4cfb5
...
...
@@ -18,6 +18,7 @@ import 'package:byod/ui/viewbill/view_bill_new.dart';
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:flutter_easyloading/flutter_easyloading.dart'
;
import
'package:intl/intl.dart'
;
import
'package:uuid/uuid.dart'
;
import
'../bloc/order_bloc.dart'
;
import
'../helper/widget/open_url.dart'
;
...
...
@@ -158,6 +159,8 @@ class Api {
setLongOutlet
(
jsonObject
[
'data'
][
'long'
]);
setIsDelivery
(
jsonObject
[
'data'
][
'is_delivery'
]);
setIsPickup
(
jsonObject
[
'data'
][
'is_pickup'
]);
setOpenTime
(
jsonObject
[
'data'
][
'open_time'
]);
setCloseTime
(
jsonObject
[
'data'
][
'close_time'
]);
if
(
jsonObject
[
'data'
][
'payment_mode'
]
!=
null
)
{
setPaymentMode
(
jsonObject
[
'data'
][
'payment_mode'
]);
}
...
...
@@ -1327,6 +1330,23 @@ class Api {
var
jsonObject
=
await
httpPost
(
apiUrl
,
bodies
,
'checkOut'
);
if
(
jsonObject
!=
false
)
{
if
(
jsonObject
[
'status'
].
toString
().
toLowerCase
()
==
'ok'
)
{
int
typeUrl
=
getUrlType
();
//hanya ketika delivery pickup, set pickup time
if
(
typeUrl
==
typeUrlTiga
)
{
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
));
// 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
);
}
setStatusOrderCreated
(
true
);
await
EasyLoading
.
dismiss
();
// Navigator.pushAndRemoveUntil(
...
...
@@ -2000,9 +2020,11 @@ class Api {
if
(
jsonObject
!=
false
)
{
if
(
jsonObject
[
'status'
].
toString
().
toLowerCase
()
==
'ok'
)
{
setBranch
(
newBranch
);
setBranchName
(
jsonObject
[
'data'
][
'
branch_nam
e'
]);
setBranchName
(
jsonObject
[
'data'
][
'
cod
e'
]);
setLatOutlet
(
jsonObject
[
'data'
][
'lat'
]);
setLongOutlet
(
jsonObject
[
'data'
][
'long'
]);
setOpenTime
(
jsonObject
[
'data'
][
'open_time'
]);
setCloseTime
(
jsonObject
[
'data'
][
'close_time'
]);
return
true
;
}
return
false
;
...
...
@@ -2061,4 +2083,63 @@ class Api {
return
defaultResult
;
}
}
static
Future
<
bool
>
addCancelPromotion
(
bool
isAdd
)
async
{
await
EasyLoading
.
show
(
status:
'Please wait...'
,
maskType:
EasyLoadingMaskType
.
none
,
);
String
baseUrl
=
prefs
.
getString
(
'baseUrl'
)
??
''
;
String
apiUrl
;
if
(
isAdd
)
{
apiUrl
=
"
${baseUrl}
romi/api/byod/add_promotions"
;
}
else
{
apiUrl
=
"
${baseUrl}
romi/api/byod/cancel_promotions"
;
}
String
branchCode
=
getBranchPref
();
String
brandCode
=
getBrand
();
String
role
=
getRole
();
String
cashierName
=
getCashierName
();
String
orderID
=
getOrderId
();
try
{
Map
data
=
{
"branch_code"
:
branchCode
,
"brand_code"
:
brandCode
,
"role"
:
role
,
"cashier_name"
:
cashierName
,
"from"
:
fromByod
,
"order_id"
:
orderID
,
};
var
bodies
=
jsonEncode
(
data
);
var
jsonObject
=
await
httpPost
(
apiUrl
,
bodies
,
'addPromotion'
);
if
(
jsonObject
!=
false
)
{
if
(
jsonObject
[
'status'
].
toString
().
toLowerCase
()
==
'ok'
)
{
if
(
isAdd
)
{
await
prefs
.
setBool
(
'isPromoActive'
,
true
);
EasyLoading
.
showToast
(
'Promosi aktif'
);
}
else
{
await
prefs
.
setBool
(
'isPromoActive'
,
false
);
EasyLoading
.
showToast
(
'Promosi tidak aktif'
);
}
return
true
;
}
else
{
EasyLoading
.
showToast
(
jsonObject
[
'msg'
]);
return
false
;
}
}
else
{
EasyLoading
.
showToast
(
'Something went wrong'
);
return
false
;
}
}
catch
(
e
)
{
if
(
debug
)
{
logd
(
'API CLASS ON API.DART, FUNGSI: addPromotion, URL :
$apiUrl
'
,
'ERROR CONNECT TO SERVER, ERROR CATCH :
$e
'
);
}
EasyLoading
.
showToast
(
'Cant connect to server'
);
return
false
;
}
}
}
lib/bloc/order_variant_value.dart
View file @
6dd4cfb5
...
...
@@ -30,7 +30,7 @@ class OrderVariantValueBloc extends Cubit<List<OrderVariant>> {
'price'
:
orderVariants
[
z
].
price
,
'name'
:
orderVariants
[
z
].
name
,
'type'
:
type
,
'caption'
:
caption
'caption'
:
orderVariants
[
z
].
caption
};
orderVariantResult
.
add
(
OrderVariant
.
createVariant
(
x
));
}
...
...
@@ -45,7 +45,9 @@ class OrderVariantValueBloc extends Cubit<List<OrderVariant>> {
'type'
:
type
,
'caption'
:
caption
};
orderVariantResult
.
add
(
OrderVariant
.
createVariant
(
x
));
orderVariantResult
.
add
(
OrderVariant
.
createVariant
(
x
),
);
}
}
else
if
(
type
==
typeOptional
)
{
if
(
orderVariants
.
isNotEmpty
)
{
...
...
@@ -67,7 +69,7 @@ class OrderVariantValueBloc extends Cubit<List<OrderVariant>> {
'price'
:
orderVariants
[
x
].
price
,
'name'
:
orderVariants
[
x
].
name
,
'type'
:
type
,
'caption'
:
caption
'caption'
:
orderVariants
[
x
].
caption
};
orderVariantResult
.
add
(
OrderVariant
.
createVariant
(
l
));
}
...
...
@@ -96,7 +98,7 @@ class OrderVariantValueBloc extends Cubit<List<OrderVariant>> {
'price'
:
orderVariants
[
x
].
price
,
'name'
:
orderVariants
[
x
].
name
,
'type'
:
type
,
'caption'
:
caption
'caption'
:
orderVariants
[
x
].
caption
};
orderVariantResult
.
add
(
OrderVariant
.
createVariant
(
l
));
}
...
...
lib/helper/helper.dart
View file @
6dd4cfb5
...
...
@@ -325,7 +325,7 @@ bool isVisibleAddRemoveQuantityButtonCheckout(bool isHistory, int orderStatus) {
String
textButtonCheckout
(
int
orderState
)
{
int
paymentMethod
=
getPaymentMode
();
if
(
paymentMethod
==
closebill
&&
orderState
==
orderStateCreated
)
{
return
'
Pes
an'
;
return
'
Kirim Pesan
an'
;
}
else
if
(
paymentMethod
==
closebill
&&
(
orderState
==
orderStatePending
||
orderState
==
orderStateApproved
)
||
...
...
lib/helper/mq.dart
View file @
6dd4cfb5
// ignore_for_file: unused_catch_clause
import
'dart:io'
;
import
'dart:js'
;
import
'package:byod/bloc/view_bill.dart'
;
import
'package:byod/helper/logger.dart'
;
import
'package:byod/helper/prefs.dart'
;
import
'package:byod/main.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:mqtt_client/mqtt_browser_client.dart'
;
import
'package:mqtt_client/mqtt_client.dart'
;
import
'package:uuid/uuid.dart'
;
...
...
@@ -80,14 +83,19 @@ Future<int> runMqTT(BuildContext context) async {
// print('');
if
(
c
[
0
].
topic
==
topic
&&
pt
==
queueMessage
)
{
// update bill disini
context
.
read
<
ViewBillBloc
>().
getBill
();
if
(
debug
)
{
logd
(
'CHECK TOPIC'
,
'TOPIC MASUK::
$topic
, MESSAGE::
$queueMessage
'
);
}
}
if
(
debug
)
{
logd
(
'CHECK TOPIC'
,
'TOPIC TIDAK SAMA YANG -> MASUK::
$topic
, MESSAGE::
$pt
'
);
}
else
{
if
(
debug
)
{
logd
(
'CHECK TOPIC'
,
'TOPIC TIDAK SAMA, YANG MASUK::
$topic
, MESSAGE::
$pt
'
);
}
}
});
// final builder = MqttClientPayloadBuilder();
// builder.addString('Hello from mqtt_client');
// mqClient.publishMessage(topic, MqttQos.exactlyOnce, builder.payload!);
return
0
;
}
lib/helper/prefs.dart
View file @
6dd4cfb5
...
...
@@ -36,6 +36,9 @@ const String _branchName = 'bN';
const
String
_orderCreated
=
'oC'
;
const
String
_latOutlet
=
'latO'
;
const
String
_longOutlet
=
'longO'
;
const
String
_openTime
=
'oT'
;
const
String
_closeTime
=
'cT'
;
const
String
_pickupTime
=
'puT'
;
String
getBaseUrl
(
)
{
return
prefs
.
getString
(
_baseUrl
)
??
''
;
...
...
@@ -312,3 +315,27 @@ String getLongOutlet() {
Future
<
void
>
setLongOutlet
(
String
value
)
async
{
prefs
.
setString
(
_longOutlet
,
value
);
}
String
getOpenTime
(
)
{
return
prefs
.
getString
(
_openTime
)
??
''
;
}
Future
<
void
>
setOpenTime
(
String
value
)
async
{
prefs
.
setString
(
_openTime
,
value
);
}
String
getCloseTime
(
)
{
return
prefs
.
getString
(
_closeTime
)
??
''
;
}
Future
<
void
>
setCloseTime
(
String
value
)
async
{
prefs
.
setString
(
_closeTime
,
value
);
}
String
getPickupTime
(
)
{
return
prefs
.
getString
(
_pickupTime
)
??
''
;
}
Future
<
void
>
setPickupTime
(
String
value
)
async
{
prefs
.
setString
(
_pickupTime
,
value
);
}
lib/ui/confirm_order/confirm_order.dart
View file @
6dd4cfb5
This diff is collapsed.
Click to expand it.
lib/ui/home/bottom_sheet_variant_new.dart
View file @
6dd4cfb5
...
...
@@ -98,6 +98,28 @@ class _CustomizeVariantNewState extends State<CustomizeVariantNew> {
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
(
...
...
@@ -128,17 +150,31 @@ class _CustomizeVariantNewState extends State<CustomizeVariantNew> {
CrossAxisAlignment
.
start
,
children:
[
for
(
int
d
=
0
;
d
<
widget
.
orders
.
orderDetail
[
i
]
.
orderVariant
.
length
;
d
<
variantCaption
.
length
;
d
++)
defaultText
(
context
,
widget
.
orders
.
orderDetail
[
i
]
.
orderVariant
[
d
].
name
,
maxLines:
1
,
overFlow:
TextOverflow
.
ellipsis
,
)
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
!=
...
...
lib/ui/home/variant_cat_new.dart
View file @
6dd4cfb5
...
...
@@ -212,72 +212,18 @@ class CoreVariant extends StatelessWidget {
child:
ListView
(
children:
[
ListView
.
builder
(
physics:
const
NeverScrollableScrollPhysics
(),
// to disable GridView's scrolling
shrinkWrap:
true
,
itemCount:
widget
.
variantCategories
.
length
,
itemBuilder:
((
context
,
index
)
{
return
Container
(
width:
double
.
infinity
,
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Container
(
margin:
EdgeInsets
.
only
(
bottom:
MediaQuery
.
of
(
context
).
size
.
height
*
0.01
,
top:
MediaQuery
.
of
(
context
).
size
.
height
*
0.01
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
defaultText
(
context
,
widget
.
variantCategories
[
index
].
caption
,
style:
variantStyleText
(),
),
defaultText
(
context
,
(
widget
.
variantCategories
[
index
]
.
type
==
typeMandatory
)
?
'Pilih Salah Satu'
:
(
widget
.
variantCategories
[
index
]
.
type
==
typeAutoInsert
)
?
'Sudah termasuk'
:
'Optional'
,
style:
variantStyleText
(
font:
12
,
fontWeight:
FontWeight
.
w300
,
),
)
],
),
),
const
Divider
(
thickness:
0.5
,
color:
textColorBlack
,
),
VariantNew
(
variants:
widget
.
variantCategories
[
index
].
variant
,
captioncategories:
widget
.
variantCategories
[
index
].
caption
,
type:
widget
.
variantCategories
[
index
].
type
,
initPrice:
widget
.
initPrice
,
idCategory:
widget
.
variantCategories
[
index
].
id
,
orderDetail:
orderDetail
,
),
],
),
);
})),
physics:
const
NeverScrollableScrollPhysics
(),
// to disable GridView's scrolling
shrinkWrap:
true
,
itemCount:
widget
.
variantCategories
.
length
,
itemBuilder:
((
context
,
index
)
{
return
VariantDetail
(
widget:
widget
,
orderDetail:
orderDetail
,
index:
index
,
);
}),
),
const
SizedBox
(
height:
74
,
),
...
...
@@ -292,28 +238,6 @@ class CoreVariant extends StatelessWidget {
const
SizedBox
(
height:
12
,
),
// TextField(
// maxLength: maxLengthTextField,
// maxLines: 2,
// autofocus: false,
// keyboardType: TextInputType.text,
// controller: noteCatController,
// style: textStyleNormalFont(context),
// decoration: InputDecoration(
// prefixIcon: Image(
// image: const AssetImage('assets/icons/search.png'),
// color: Colors.grey.withOpacity(0.8),
// height: 20,
// width: 20,
// ),
// hintText: placeHolderNote,
// hintStyle: TextStyle(
// color: Colors.grey,
// fontSize:
// MediaQuery.of(context).size.height * normalFont,
// ),
// ),
// ),
Container
(
height:
35
,
child:
TextField
(
...
...
@@ -464,3 +388,67 @@ class CoreVariant extends StatelessWidget {
);
}
}
class
VariantDetail
extends
StatelessWidget
{
const
VariantDetail
({
Key
?
key
,
required
this
.
widget
,
required
this
.
orderDetail
,
required
this
.
index
,
})
:
super
(
key:
key
);
final
VariantCatNew
widget
;
final
OrderDetail
orderDetail
;
final
int
index
;
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
width:
double
.
infinity
,
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Container
(
margin:
EdgeInsets
.
only
(
bottom:
MediaQuery
.
of
(
context
).
size
.
height
*
0.01
,
top:
MediaQuery
.
of
(
context
).
size
.
height
*
0.01
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
defaultText
(
context
,
widget
.
variantCategories
[
index
].
caption
,
style:
variantStyleText
(),
),
defaultText
(
context
,
(
widget
.
variantCategories
[
index
].
type
==
typeMandatory
)
?
'Pilih Salah Satu'
:
(
widget
.
variantCategories
[
index
].
type
==
typeAutoInsert
)
?
'Sudah termasuk'
:
'Optional'
,
style:
variantStyleText
(
font:
12
,
fontWeight:
FontWeight
.
w300
,
),
)
],
),
),
const
Divider
(
thickness:
0.5
,
color:
textColorBlack
,
),
VariantNew
(
variants:
widget
.
variantCategories
[
index
].
variant
,
captioncategories:
widget
.
variantCategories
[
index
].
caption
,
type:
widget
.
variantCategories
[
index
].
type
,
initPrice:
widget
.
initPrice
,
idCategory:
widget
.
variantCategories
[
index
].
id
,
orderDetail:
orderDetail
,
),
],
),
);
}
}
lib/ui/viewbill/list_order.dart
View file @
6dd4cfb5
...
...
@@ -32,7 +32,10 @@ class ListOrder extends StatelessWidget {
itemBuilder:
(
ctx
,
d
)
{
return
OrderViewBillNew
(
billDetail:
bill
[
i
].
billDetail
[
d
],
lastItem:
(
i
+
1
==
bill
[
i
].
billDetail
.
length
)
?
true
:
false
,
lastItem:
(
i
+
1
==
bill
.
length
&&
d
+
1
==
bill
[
i
].
billDetail
.
length
)
?
true
:
false
,
isHistory:
isHistory
,
tableStatus:
tableStatus
,
);
...
...
lib/ui/viewbill/order_view_bill_new.dart
View file @
6dd4cfb5
This diff is collapsed.
Click to expand it.
lib/ui/viewbill/view_bill_new.dart
View file @
6dd4cfb5
...
...
@@ -15,6 +15,7 @@ import 'package:dotted_line/dotted_line.dart';
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:flutter_easyloading/flutter_easyloading.dart'
;
import
'package:intl/intl.dart'
;
import
'package:uuid/uuid.dart'
;
import
'../../api/api.dart'
;
...
...
@@ -1438,6 +1439,11 @@ class DeliveryPickupDetail extends StatelessWidget {
}
Row
pickupOption
(
BuildContext
context
)
{
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
));
return
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
start
,
...
...
@@ -1453,6 +1459,7 @@ class DeliveryPickupDetail extends StatelessWidget {
),
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisSize:
MainAxisSize
.
min
,
children:
[
defaultText
(
context
,
...
...
@@ -1463,6 +1470,44 @@ class DeliveryPickupDetail extends StatelessWidget {
const
SizedBox
(
height:
5
,
),
Row
(
children:
[
defaultText
(
context
,
"Close: "
,
maxLines:
1
,
overFlow:
TextOverflow
.
ellipsis
,
),
defaultText
(
context
,
getCloseTime
(),
maxLines:
1
,
overFlow:
TextOverflow
.
ellipsis
,
),
],
),
const
SizedBox
(
height:
5
,
),
Row
(
children:
[
defaultText
(
context
,
"Pickup: "
,
maxLines:
1
,
overFlow:
TextOverflow
.
ellipsis
,
),
defaultText
(
context
,
getPickupTime
(),
maxLines:
1
,
overFlow:
TextOverflow
.
ellipsis
,
),
],
),
const
SizedBox
(
height:
5
,
),
GestureDetector
(
onTap:
()
{
htmlOpenLink
(
...
...
@@ -1506,62 +1551,161 @@ class DeliveryPickupDetail extends StatelessWidget {
width:
12
,
),
const
Spacer
(),
GestureDetector
(
onTap:
()
{
void
ontapOkeChange
()
{
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
SelectBranch
(
isFormBill:
true
,
),
),
);
}
Column
(
children:
[
GestureDetector
(
onTap:
()
{
void
ontapOkeChange
()
{
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
SelectBranch
(
isFormBill:
true
,
),
),
);
}
void
onTapCancelChange
()
{
Navigator
.
pop
(
context
);
}
void
onTapCancelChange
()
{
Navigator
.
pop
(
context
);
}
String
textOnOk
=
'OK'
;
String
textOnCancel
=
'Batal'
;
String
title
=
'Ganti Outlet'
;
String
description
=
'''
String
textOnOk
=
'OK'
;
String
textOnCancel
=
'Batal'
;
String
title
=
'Ganti Outlet'
;
String
description
=
'''
Ganti outlet akan menyebabkan orderan anda saat ini hilang.
Apakah ingin melanjutkan ?'''
;
buttonDialogGlobal
(
context
,
title
,
description
,
textOnOk
,
textOnCancel
,
ontapOkeChange
,
onTapCancelChange
,
okButtonColor:
buttonColor
,
);
},
child:
Container
(
width:
98
,
height:
30
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
40
),
color:
backgroundWhite
,
border:
Border
.
all
(
color:
buttonColor
,
buttonDialogGlobal
(
context
,
title
,
description
,
textOnOk
,
textOnCancel
,
ontapOkeChange
,
onTapCancelChange
,
okButtonColor:
buttonColor
,
);
},
child:
Container
(
width:
98
,
height:
30
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
40
),
color:
backgroundWhite
,
border:
Border
.
all
(
color:
buttonColor
,
),
),
child:
Center
(
child:
defaultText
(
context
,
'Ganti Outlet'
,
style:
addButton
(
font:
8
,
color:
buttonColor
,
),
),
),
),
),
child:
Center
(
child:
defaultText
(
context
,
'Ganti Outlet'
,
style:
addButton
(
font:
8
,
color:
buttonColor
,
const
SizedBox
(
height:
5
,
),
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
];
// 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"
;
DateTime
dateTimeCloseOutlet
=
DateTime
.
parse
(
dateTimeCloseOutletString
);
DateTime
dateSelectedPickupTime
=
DateTime
(
now
.
year
,
now
.
month
,
now
.
day
,
value
.
hour
,
value
.
minute
);
final
difference
=
dateTimeCloseOutlet
.
difference
(
dateSelectedPickupTime
);
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
(
difference
.
inMinutes
<
59
)
{
buttonDialogGlobal
(
context
,
'Informasi'
,
'Pickup Hanya Bisa Dilakukan 1 Jam sebelum outlet tutup'
,
'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
<
ViewBillBloc
>().
getBill
();
}
});
// ketika user click OK
},
child:
Container
(
width:
98
,
height:
30
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
40
),
color:
backgroundWhite
,
border:
Border
.
all
(
color:
buttonColor
,
),
),
child:
Center
(
child:
defaultText
(
context
,
'Pickup Time'
,
style:
addButton
(
font:
8
,
color:
buttonColor
,
),
),
),
),
)
,
)
,
)
]
,
)
],
);
...
...
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