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
Show 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';
...
@@ -18,6 +18,7 @@ import 'package:byod/ui/viewbill/view_bill_new.dart';
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:flutter_easyloading/flutter_easyloading.dart'
;
import
'package:flutter_easyloading/flutter_easyloading.dart'
;
import
'package:intl/intl.dart'
;
import
'package:uuid/uuid.dart'
;
import
'package:uuid/uuid.dart'
;
import
'../bloc/order_bloc.dart'
;
import
'../bloc/order_bloc.dart'
;
import
'../helper/widget/open_url.dart'
;
import
'../helper/widget/open_url.dart'
;
...
@@ -158,6 +159,8 @@ class Api {
...
@@ -158,6 +159,8 @@ class Api {
setLongOutlet
(
jsonObject
[
'data'
][
'long'
]);
setLongOutlet
(
jsonObject
[
'data'
][
'long'
]);
setIsDelivery
(
jsonObject
[
'data'
][
'is_delivery'
]);
setIsDelivery
(
jsonObject
[
'data'
][
'is_delivery'
]);
setIsPickup
(
jsonObject
[
'data'
][
'is_pickup'
]);
setIsPickup
(
jsonObject
[
'data'
][
'is_pickup'
]);
setOpenTime
(
jsonObject
[
'data'
][
'open_time'
]);
setCloseTime
(
jsonObject
[
'data'
][
'close_time'
]);
if
(
jsonObject
[
'data'
][
'payment_mode'
]
!=
null
)
{
if
(
jsonObject
[
'data'
][
'payment_mode'
]
!=
null
)
{
setPaymentMode
(
jsonObject
[
'data'
][
'payment_mode'
]);
setPaymentMode
(
jsonObject
[
'data'
][
'payment_mode'
]);
}
}
...
@@ -1327,6 +1330,23 @@ class Api {
...
@@ -1327,6 +1330,23 @@ class Api {
var
jsonObject
=
await
httpPost
(
apiUrl
,
bodies
,
'checkOut'
);
var
jsonObject
=
await
httpPost
(
apiUrl
,
bodies
,
'checkOut'
);
if
(
jsonObject
!=
false
)
{
if
(
jsonObject
!=
false
)
{
if
(
jsonObject
[
'status'
].
toString
().
toLowerCase
()
==
'ok'
)
{
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
);
setStatusOrderCreated
(
true
);
await
EasyLoading
.
dismiss
();
await
EasyLoading
.
dismiss
();
// Navigator.pushAndRemoveUntil(
// Navigator.pushAndRemoveUntil(
...
@@ -2000,9 +2020,11 @@ class Api {
...
@@ -2000,9 +2020,11 @@ class Api {
if
(
jsonObject
!=
false
)
{
if
(
jsonObject
!=
false
)
{
if
(
jsonObject
[
'status'
].
toString
().
toLowerCase
()
==
'ok'
)
{
if
(
jsonObject
[
'status'
].
toString
().
toLowerCase
()
==
'ok'
)
{
setBranch
(
newBranch
);
setBranch
(
newBranch
);
setBranchName
(
jsonObject
[
'data'
][
'
branch_nam
e'
]);
setBranchName
(
jsonObject
[
'data'
][
'
cod
e'
]);
setLatOutlet
(
jsonObject
[
'data'
][
'lat'
]);
setLatOutlet
(
jsonObject
[
'data'
][
'lat'
]);
setLongOutlet
(
jsonObject
[
'data'
][
'long'
]);
setLongOutlet
(
jsonObject
[
'data'
][
'long'
]);
setOpenTime
(
jsonObject
[
'data'
][
'open_time'
]);
setCloseTime
(
jsonObject
[
'data'
][
'close_time'
]);
return
true
;
return
true
;
}
}
return
false
;
return
false
;
...
@@ -2061,4 +2083,63 @@ class Api {
...
@@ -2061,4 +2083,63 @@ class Api {
return
defaultResult
;
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>> {
...
@@ -30,7 +30,7 @@ class OrderVariantValueBloc extends Cubit<List<OrderVariant>> {
'price'
:
orderVariants
[
z
].
price
,
'price'
:
orderVariants
[
z
].
price
,
'name'
:
orderVariants
[
z
].
name
,
'name'
:
orderVariants
[
z
].
name
,
'type'
:
type
,
'type'
:
type
,
'caption'
:
caption
'caption'
:
orderVariants
[
z
].
caption
};
};
orderVariantResult
.
add
(
OrderVariant
.
createVariant
(
x
));
orderVariantResult
.
add
(
OrderVariant
.
createVariant
(
x
));
}
}
...
@@ -45,7 +45,9 @@ class OrderVariantValueBloc extends Cubit<List<OrderVariant>> {
...
@@ -45,7 +45,9 @@ class OrderVariantValueBloc extends Cubit<List<OrderVariant>> {
'type'
:
type
,
'type'
:
type
,
'caption'
:
caption
'caption'
:
caption
};
};
orderVariantResult
.
add
(
OrderVariant
.
createVariant
(
x
));
orderVariantResult
.
add
(
OrderVariant
.
createVariant
(
x
),
);
}
}
}
else
if
(
type
==
typeOptional
)
{
}
else
if
(
type
==
typeOptional
)
{
if
(
orderVariants
.
isNotEmpty
)
{
if
(
orderVariants
.
isNotEmpty
)
{
...
@@ -67,7 +69,7 @@ class OrderVariantValueBloc extends Cubit<List<OrderVariant>> {
...
@@ -67,7 +69,7 @@ class OrderVariantValueBloc extends Cubit<List<OrderVariant>> {
'price'
:
orderVariants
[
x
].
price
,
'price'
:
orderVariants
[
x
].
price
,
'name'
:
orderVariants
[
x
].
name
,
'name'
:
orderVariants
[
x
].
name
,
'type'
:
type
,
'type'
:
type
,
'caption'
:
caption
'caption'
:
orderVariants
[
x
].
caption
};
};
orderVariantResult
.
add
(
OrderVariant
.
createVariant
(
l
));
orderVariantResult
.
add
(
OrderVariant
.
createVariant
(
l
));
}
}
...
@@ -96,7 +98,7 @@ class OrderVariantValueBloc extends Cubit<List<OrderVariant>> {
...
@@ -96,7 +98,7 @@ class OrderVariantValueBloc extends Cubit<List<OrderVariant>> {
'price'
:
orderVariants
[
x
].
price
,
'price'
:
orderVariants
[
x
].
price
,
'name'
:
orderVariants
[
x
].
name
,
'name'
:
orderVariants
[
x
].
name
,
'type'
:
type
,
'type'
:
type
,
'caption'
:
caption
'caption'
:
orderVariants
[
x
].
caption
};
};
orderVariantResult
.
add
(
OrderVariant
.
createVariant
(
l
));
orderVariantResult
.
add
(
OrderVariant
.
createVariant
(
l
));
}
}
...
...
lib/helper/helper.dart
View file @
6dd4cfb5
...
@@ -325,7 +325,7 @@ bool isVisibleAddRemoveQuantityButtonCheckout(bool isHistory, int orderStatus) {
...
@@ -325,7 +325,7 @@ bool isVisibleAddRemoveQuantityButtonCheckout(bool isHistory, int orderStatus) {
String
textButtonCheckout
(
int
orderState
)
{
String
textButtonCheckout
(
int
orderState
)
{
int
paymentMethod
=
getPaymentMode
();
int
paymentMethod
=
getPaymentMode
();
if
(
paymentMethod
==
closebill
&&
orderState
==
orderStateCreated
)
{
if
(
paymentMethod
==
closebill
&&
orderState
==
orderStateCreated
)
{
return
'
Pes
an'
;
return
'
Kirim Pesan
an'
;
}
else
if
(
paymentMethod
==
closebill
&&
}
else
if
(
paymentMethod
==
closebill
&&
(
orderState
==
orderStatePending
||
(
orderState
==
orderStatePending
||
orderState
==
orderStateApproved
)
||
orderState
==
orderStateApproved
)
||
...
...
lib/helper/mq.dart
View file @
6dd4cfb5
// ignore_for_file: unused_catch_clause
// ignore_for_file: unused_catch_clause
import
'dart:io'
;
import
'dart:io'
;
import
'dart:js'
;
import
'package:byod/bloc/view_bill.dart'
;
import
'package:byod/helper/logger.dart'
;
import
'package:byod/helper/logger.dart'
;
import
'package:byod/helper/prefs.dart'
;
import
'package:byod/helper/prefs.dart'
;
import
'package:byod/main.dart'
;
import
'package:byod/main.dart'
;
import
'package:flutter/cupertino.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_browser_client.dart'
;
import
'package:mqtt_client/mqtt_client.dart'
;
import
'package:mqtt_client/mqtt_client.dart'
;
import
'package:uuid/uuid.dart'
;
import
'package:uuid/uuid.dart'
;
...
@@ -80,14 +83,19 @@ Future<int> runMqTT(BuildContext context) async {
...
@@ -80,14 +83,19 @@ Future<int> runMqTT(BuildContext context) async {
// print('');
// print('');
if
(
c
[
0
].
topic
==
topic
&&
pt
==
queueMessage
)
{
if
(
c
[
0
].
topic
==
topic
&&
pt
==
queueMessage
)
{
// update bill disini
// update bill disini
context
.
read
<
ViewBillBloc
>().
getBill
();
if
(
debug
)
{
if
(
debug
)
{
logd
(
'CHECK TOPIC'
,
'TOPIC MASUK::
$topic
, MESSAGE::
$queueMessage
'
);
logd
(
'CHECK TOPIC'
,
'TOPIC MASUK::
$topic
, MESSAGE::
$queueMessage
'
);
}
}
}
}
else
{
if
(
debug
)
{
if
(
debug
)
{
logd
(
'CHECK TOPIC'
,
logd
(
'CHECK TOPIC'
,
'TOPIC TIDAK SAMA YANG -> MASUK::
$topic
, MESSAGE::
$pt
'
);
'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
;
return
0
;
}
}
lib/helper/prefs.dart
View file @
6dd4cfb5
...
@@ -36,6 +36,9 @@ const String _branchName = 'bN';
...
@@ -36,6 +36,9 @@ const String _branchName = 'bN';
const
String
_orderCreated
=
'oC'
;
const
String
_orderCreated
=
'oC'
;
const
String
_latOutlet
=
'latO'
;
const
String
_latOutlet
=
'latO'
;
const
String
_longOutlet
=
'longO'
;
const
String
_longOutlet
=
'longO'
;
const
String
_openTime
=
'oT'
;
const
String
_closeTime
=
'cT'
;
const
String
_pickupTime
=
'puT'
;
String
getBaseUrl
(
)
{
String
getBaseUrl
(
)
{
return
prefs
.
getString
(
_baseUrl
)
??
''
;
return
prefs
.
getString
(
_baseUrl
)
??
''
;
...
@@ -312,3 +315,27 @@ String getLongOutlet() {
...
@@ -312,3 +315,27 @@ String getLongOutlet() {
Future
<
void
>
setLongOutlet
(
String
value
)
async
{
Future
<
void
>
setLongOutlet
(
String
value
)
async
{
prefs
.
setString
(
_longOutlet
,
value
);
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> {
...
@@ -98,6 +98,28 @@ class _CustomizeVariantNewState extends State<CustomizeVariantNew> {
int
totalItem
=
int
totalItem
=
widget
.
orders
.
orderDetail
[
i
].
totalItem
.
toInt
();
widget
.
orders
.
orderDetail
[
i
].
totalItem
.
toInt
();
int
satuanHarga
=
totalHarga
~/
totalItem
;
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
(
return
Column
(
children:
[
children:
[
Row
(
Row
(
...
@@ -128,16 +150,30 @@ class _CustomizeVariantNewState extends State<CustomizeVariantNew> {
...
@@ -128,16 +150,30 @@ class _CustomizeVariantNewState extends State<CustomizeVariantNew> {
CrossAxisAlignment
.
start
,
CrossAxisAlignment
.
start
,
children:
[
children:
[
for
(
int
d
=
0
;
for
(
int
d
=
0
;
d
<
d
<
variantCaption
.
length
;
widget
.
orders
.
orderDetail
[
i
]
.
orderVariant
.
length
;
d
++)
d
++)
if
(
variantCaption
[
d
]
!=
''
)
Row
(
children:
[
defaultText
(
defaultText
(
context
,
context
,
widget
.
orders
.
orderDetail
[
i
]
"
${variantCaption[d]}
: "
,
.
orderVariant
[
d
].
name
,
maxLines:
2
,
maxLines:
1
,
overFlow:
overFlow:
TextOverflow
.
ellipsis
,
TextOverflow
.
ellipsis
,
style:
textStyleVariantModal
(),
),
defaultText
(
context
,
variantName
[
d
],
maxLines:
2
,
overFlow:
TextOverflow
.
ellipsis
,
style:
textStyleVariantModal
(),
),
],
)
)
],
],
),
),
...
...
lib/ui/home/variant_cat_new.dart
View file @
6dd4cfb5
...
@@ -217,67 +217,13 @@ class CoreVariant extends StatelessWidget {
...
@@ -217,67 +217,13 @@ class CoreVariant extends StatelessWidget {
shrinkWrap:
true
,
shrinkWrap:
true
,
itemCount:
widget
.
variantCategories
.
length
,
itemCount:
widget
.
variantCategories
.
length
,
itemBuilder:
((
context
,
index
)
{
itemBuilder:
((
context
,
index
)
{
return
Container
(
return
VariantDetail
(
width:
double
.
infinity
,
widget:
widget
,
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
,
orderDetail:
orderDetail
,
),
index:
index
,
],
),
);
);
})),
}),
),
const
SizedBox
(
const
SizedBox
(
height:
74
,
height:
74
,
),
),
...
@@ -292,28 +238,6 @@ class CoreVariant extends StatelessWidget {
...
@@ -292,28 +238,6 @@ class CoreVariant extends StatelessWidget {
const
SizedBox
(
const
SizedBox
(
height:
12
,
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
(
Container
(
height:
35
,
height:
35
,
child:
TextField
(
child:
TextField
(
...
@@ -464,3 +388,67 @@ class CoreVariant extends StatelessWidget {
...
@@ -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 {
...
@@ -32,7 +32,10 @@ class ListOrder extends StatelessWidget {
itemBuilder:
(
ctx
,
d
)
{
itemBuilder:
(
ctx
,
d
)
{
return
OrderViewBillNew
(
return
OrderViewBillNew
(
billDetail:
bill
[
i
].
billDetail
[
d
],
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
,
isHistory:
isHistory
,
tableStatus:
tableStatus
,
tableStatus:
tableStatus
,
);
);
...
...
lib/ui/viewbill/order_view_bill_new.dart
View file @
6dd4cfb5
...
@@ -149,8 +149,7 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
...
@@ -149,8 +149,7 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
children:
[
children:
[
Container
(
Container
(
padding:
EdgeInsets
.
only
(
padding:
EdgeInsets
.
only
(
left:
paddingLeftRightBill
,
left:
paddingLeftRightBill
,
right:
paddingLeftRightBill
),
right:
paddingLeftRightBill
),
child:
Row
(
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
...
@@ -239,8 +238,7 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
...
@@ -239,8 +238,7 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
widget
.
isHistory
,
widget
.
billDetail
.
orderStatus
)
widget
.
isHistory
,
widget
.
billDetail
.
orderStatus
)
?
Container
(
?
Container
(
padding:
EdgeInsets
.
only
(
padding:
EdgeInsets
.
only
(
left:
paddingLeftRightBill
,
left:
paddingLeftRightBill
,
right:
paddingLeftRightBill
),
right:
paddingLeftRightBill
),
child:
const
Divider
(
child:
const
Divider
(
thickness:
1
,
thickness:
1
,
color:
backgroundColor
,
color:
backgroundColor
,
...
@@ -257,14 +255,12 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
...
@@ -257,14 +255,12 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
widget
.
isHistory
,
widget
.
billDetail
.
orderStatus
)
widget
.
isHistory
,
widget
.
billDetail
.
orderStatus
)
?
Container
(
?
Container
(
padding:
EdgeInsets
.
only
(
padding:
EdgeInsets
.
only
(
left:
paddingLeftRightBill
,
left:
paddingLeftRightBill
,
right:
paddingLeftRightBill
),
right:
paddingLeftRightBill
),
child:
Row
(
child:
Row
(
children:
[
children:
[
GestureDetector
(
GestureDetector
(
onTap:
()
{
onTap:
()
{
FocusScopeNode
currentFocus
=
FocusScopeNode
currentFocus
=
FocusScope
.
of
(
context
);
FocusScope
.
of
(
context
);
if
(!
currentFocus
.
hasPrimaryFocus
)
{
if
(!
currentFocus
.
hasPrimaryFocus
)
{
currentFocus
.
unfocus
();
currentFocus
.
unfocus
();
...
@@ -363,7 +359,8 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
...
@@ -363,7 +359,8 @@ class _OrderViewBillNewState extends State<OrderViewBillNew> {
)
)
:
const
SizedBox
()
:
const
SizedBox
()
],
],
));
),
);
}
}
Future
<
dynamic
>
deleteOrder
(
BuildContext
context
,
String
menuName
,
Future
<
dynamic
>
deleteOrder
(
BuildContext
context
,
String
menuName
,
...
...
lib/ui/viewbill/view_bill_new.dart
View file @
6dd4cfb5
...
@@ -15,6 +15,7 @@ import 'package:dotted_line/dotted_line.dart';
...
@@ -15,6 +15,7 @@ import 'package:dotted_line/dotted_line.dart';
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:flutter_easyloading/flutter_easyloading.dart'
;
import
'package:flutter_easyloading/flutter_easyloading.dart'
;
import
'package:intl/intl.dart'
;
import
'package:uuid/uuid.dart'
;
import
'package:uuid/uuid.dart'
;
import
'../../api/api.dart'
;
import
'../../api/api.dart'
;
...
@@ -1438,6 +1439,11 @@ class DeliveryPickupDetail extends StatelessWidget {
...
@@ -1438,6 +1439,11 @@ class DeliveryPickupDetail extends StatelessWidget {
}
}
Row
pickupOption
(
BuildContext
context
)
{
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
(
return
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
start
,
...
@@ -1453,6 +1459,7 @@ class DeliveryPickupDetail extends StatelessWidget {
...
@@ -1453,6 +1459,7 @@ class DeliveryPickupDetail extends StatelessWidget {
),
),
Column
(
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisSize:
MainAxisSize
.
min
,
children:
[
children:
[
defaultText
(
defaultText
(
context
,
context
,
...
@@ -1463,6 +1470,44 @@ class DeliveryPickupDetail extends StatelessWidget {
...
@@ -1463,6 +1470,44 @@ class DeliveryPickupDetail extends StatelessWidget {
const
SizedBox
(
const
SizedBox
(
height:
5
,
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
(
GestureDetector
(
onTap:
()
{
onTap:
()
{
htmlOpenLink
(
htmlOpenLink
(
...
@@ -1506,6 +1551,8 @@ class DeliveryPickupDetail extends StatelessWidget {
...
@@ -1506,6 +1551,8 @@ class DeliveryPickupDetail extends StatelessWidget {
width:
12
,
width:
12
,
),
),
const
Spacer
(),
const
Spacer
(),
Column
(
children:
[
GestureDetector
(
GestureDetector
(
onTap:
()
{
onTap:
()
{
void
ontapOkeChange
()
{
void
ontapOkeChange
()
{
...
@@ -1562,6 +1609,103 @@ Apakah ingin melanjutkan ?''';
...
@@ -1562,6 +1609,103 @@ Apakah ingin melanjutkan ?''';
),
),
),
),
),
),
),
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