Commit 7a75e7bb authored by Dio Maulana's avatar Dio Maulana

minor change pada viewbill page

parent b29fe28b
{
"base_url": "https://cc79-125-165-111-49.ap.ngrok.io/",
"base_url": "https://neo.ravku.com/",
"title": "Ravintola Dev BYOD",
"isResponsive": true,
"debug": true
......
......@@ -93,7 +93,11 @@ class Api {
"order_id": orderID,
"session_id": sessionId,
"from": fromByod,
"url_lookup": (debug) ? 'https://www.ravintola.web.id/' : (urlType == typeUrlTiga) ? getUrlLookUp() : '',
"url_lookup": (debug)
? 'https://www.ravintola.web.id/'
: (urlType == typeUrlTiga)
? getUrlLookUp()
: '',
"customer_lat": latitude,
"customer_long": longitude,
"type_url": urlType,
......@@ -162,6 +166,7 @@ class Api {
setIsPickup(jsonObject['data']['is_pickup']);
setOpenTime(jsonObject['data']['open_time']);
setCloseTime(jsonObject['data']['close_time']);
setTableNumber(jsonObject['data']['table_number'] ?? '');
if (jsonObject['data']['payment_mode'] != null) {
setPaymentMode(jsonObject['data']['payment_mode']);
}
......
......@@ -67,11 +67,13 @@ Future<dynamic> sendTele(String teks, String namaFungsi) async {
//**get orderStatus and color status */
String getOrderStatus(int status) {
if (status == completeOrder) {
return 'Complete';
return 'Processed';
} else if (status == cancelOrder) {
return 'Canceld';
return 'Canceled';
} else if (status == processingOrder) {
return 'Preparing';
return 'Processing';
} else if (status == approvedOrder) {
return 'Approved';
} else {
return 'Pending';
}
......@@ -81,9 +83,11 @@ Color getOrderStatusColor(int status) {
if (status == completeOrder) {
return successColor;
} else if (status == cancelOrder) {
return cancelColorButton;
return dangerColor;
} else if (status == processingOrder) {
return processingColor;
} else if (status == approvedOrder) {
return approvedColor;
} else {
return pendingColor;
}
......@@ -348,12 +352,12 @@ String textButtonCheckout(int orderState) {
orderState == orderStateInproses ||
orderState == orderStateReady)) {
return 'Pesanan Diproses';
} else if (orderState == orderStateDone) {
return 'Buat Pesanan Baru';
} else if (paymentMethod == openBill && orderState != orderStateCanceled) {
return 'Bayar';
} else if (orderState == orderStateCanceled) {
return 'Transaksi Dibatalkan';
} else {
return '';
return 'Bayar';
}
}
......@@ -426,6 +430,7 @@ const Color textInButton = Colors.white;
const Color textCancelColor = Color(0xff333333);
const Color successColor = Colors.green;
const Color processingColor = Colors.blue;
const Color approvedColor = Colors.blue;
const Color pendingColor = Colors.amber;
const Color disabledColor = Colors.grey;
// const Color selectedColor = Color.fromARGB(255, 225, 250, 5);
......@@ -480,9 +485,10 @@ const int maxLengthTextField = 100;
//** untuk nampilin orderan preparing atau compelete */
const int cancelOrder = -1;
const int completeOrder = 2;
const int pendingOrder = 0;
const int processingOrder = 1;
const int approvedOrder = 1;
const int processingOrder = 2;
const int completeOrder = 99;
//** untuk nampilin orderan preparing atau compelete */
//** constanta order status bill */
......
......@@ -43,7 +43,7 @@ bool isExcelso = false;
bool isResponsive = false;
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
String defaultTitle = 'Ravintola - BYOD';
bool debug = false; // set true pada config.json jika ingin ada log print
bool debug = false; // set true pada config.json jika ingin mode development
String browserName = 'Wrong platform';
String browserVersion = '';
......
......@@ -917,21 +917,328 @@ class CoreBill extends StatelessWidget {
width: widthScreen,
child: Column(
children: [
(!getIsDeliveryPickup() &&
dataBill[0].tableStatus == tableStatusOpen)
? ButtonPayment(
dataBill: dataBill,
paymentMode: paymentMode,
branchCode: branchCode,
brandCode: brandCode,
customerName: customerName,
outStandingAll: outStandingAll,
widthScreen: widthScreen,
outStandingTopayMember: outStandingTopayMember,
indexDataIndividu: indexDataIndividu,
memberinfo: memberinfo,
)
: const SizedBox(),
(getIsDeliveryPickup())
? ButtonPayment(
dataBill: dataBill,
paymentMode: paymentMode,
branchCode: branchCode,
brandCode: brandCode,
customerName: customerName,
outStandingAll: outStandingAll,
widthScreen: widthScreen,
outStandingTopayMember: outStandingTopayMember,
indexDataIndividu: indexDataIndividu,
memberinfo: memberinfo,
)
: const SizedBox(),
(!getIsDeliveryPickup())
? (dataBill[0].tableStatus == tableStatusOpen)
? Column(
children: [
const SizedBox(
height: 12,
),
GestureDetector(
onTap: () {
if (dataBill[0].tableStatus ==
tableStatusOpen) {
onTapCashier();
}
},
child: const ButtonComponent(
buttonColor: successColor,
teksButton:
'Tutup Pesanan & Minta Bill',
),
),
],
)
: (dataBill[0].tableStatus != tableStatusOpen)
? GestureDetector(
onTap: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (_) => const NewHome2()),
);
context.read<BranchExist>().branchExist(
getBranchPref(),
getBrand(),
getRole(),
getCashierName(),
getOrderId(),
context,
);
},
child: Column(
children: [
const SizedBox(
height: 12,
),
GestureDetector(
onTap: () {
// if (dataBill[0].tableStatus ==
// tableStatusOpen) {
// onTapCashier();
// }
},
child: const ButtonComponent(
buttonColor: successColor,
teksButton: 'Buat Pesanan Baru',
),
),
],
),
)
: const SizedBox()
: const SizedBox(),
const SizedBox(
height: 5,
),
const BuildVersion()
],
),
),
)
],
),
);
},
);
}
Future<dynamic> modalBottomSelectOption(BuildContext context) {
void ontapOkeChangeOutlet() {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (_) => const SelectBranch(
isFormBill: true,
),
),
);
}
void onTapCancelChange() {
Navigator.pop(context);
}
return showModalBottomSheet(
backgroundColor: backgroundWhite,
context: context,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(19),
topRight: Radius.circular(19),
),
),
barrierColor: Colors.grey.withOpacity(0.9),
builder: (contextModal) {
return Container(
padding: const EdgeInsets.symmetric(
horizontal: paddingLeftRight,
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Center(
child: Container(
margin: const EdgeInsets.only(
top: 8,
bottom: 28,
),
width: 50,
height: 3,
color: disabledColor,
),
),
defaultText(
context,
'Pilih Tipe Order',
style: pickUpdeliveryStyleFont(),
),
GestureDetector(
onTap: () {
if (getIsPickup()) {
setIsCustomerDelivery(false);
Api.changeTypeOrder(typeOrderPickup).then((value) {
if (value) {
context.read<ViewBillBloc>().getBill();
setTypeOrder(typeOrderPickup);
}
});
Navigator.pop(context);
} else {
String textOnOk = 'OK';
String textOnCancel = 'Batal';
String title = 'Info';
String description = '''
Outlet ini tidak dapat menerima pickup order,
ingin ganti outlet ?
Note: Ganti outlet akan menyebabkan orderan anda saat ini hilang
''';
buttonDialogGlobal(
context,
title,
description,
textOnOk,
textOnCancel,
ontapOkeChangeOutlet,
onTapCancelChange,
okButtonColor: buttonColor,
);
}
},
child: Container(
padding: const EdgeInsets.only(top: 19, bottom: 25, left: 10),
color: backgroundWhite,
child: Row(
children: [
const Image(
image: AssetImage('assets/icons/pickup-icon.png'),
),
const SizedBox(
width: 12,
),
defaultText(
context,
'Pick Up',
style: pickUpdeliveryStyleFont(),
)
],
),
),
),
GestureDetector(
onTap: () {
if (!getIsDelivery()) {
String textOnOk = 'OK';
String textOnCancel = 'Batal';
String title = 'Info';
String description = '''
Outlet ini tidak dapat delivery order,
ingin ganti outlet ?
Note: Ganti outlet akan menyebabkan orderan anda saat ini hilang
''';
buttonDialogGlobal(
context,
title,
description,
textOnOk,
textOnCancel,
ontapOkeChangeOutlet,
onTapCancelChange,
okButtonColor: buttonColor,
);
} else {
setIsCustomerDelivery(true);
Api.changeTypeOrder(typeOrderDelivery).then((value) {
if (value) {
context.read<ViewBillBloc>().getBill();
setTypeOrder(typeOrderDelivery);
}
});
Navigator.pop(context);
}
},
child: Container(
padding: const EdgeInsets.only(left: 10, bottom: 24),
color: backgroundWhite,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
const Image(
image: AssetImage('assets/icons/delivery-icon.png'),
),
const SizedBox(
width: 12,
),
defaultText(
context,
'Delivery',
style: pickUpdeliveryStyleFont(),
)
],
),
defaultText(
context,
'23 Menit',
style: pickUpdeliveryStyleFont(),
)
],
),
),
)
],
),
);
},
);
}
}
class ButtonPayment extends StatelessWidget {
const ButtonPayment({
Key? key,
required this.dataBill,
required this.paymentMode,
required this.branchCode,
required this.brandCode,
required this.customerName,
required this.outStandingAll,
required this.widthScreen,
required this.outStandingTopayMember,
required this.indexDataIndividu,
required this.memberinfo,
}) : super(key: key);
final List<Bill> dataBill;
final int paymentMode;
final String branchCode;
final String brandCode;
final String customerName;
final int outStandingAll;
final double widthScreen;
final int outStandingTopayMember;
final int indexDataIndividu;
final MemberInfo memberinfo;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
if (dataBill[0].tableStatus == tableStatusOpen) {
if (isCanButtonCheckoutToTap(dataBill[0].state)) {
if (dataBill[0].state == orderStateCreated) {
Api.setToPendingOrder();
context.read<ViewBillBloc>().getBill();
} else if (dataBill[0].state ==
orderStatePending &&
} else if (dataBill[0].state == orderStatePending &&
getTableMode() == tableIndividu) {
EasyLoading.showToast(
'Status orderan anda menunggu untuk disetujui');
} else {
if (paymentMode == closebill &&
memberinfo.id == '') {
if (paymentMode == closebill && memberinfo.id == '') {
addPayment(
context,
dataBill[0].id,
......@@ -943,8 +1250,7 @@ class CoreBill extends StatelessWidget {
'',
outStandingAll,
);
} else if (paymentMode == closebill &&
memberinfo.id != '') {
} else if (paymentMode == closebill && memberinfo.id != '') {
showDialog(
context: context,
builder: (BuildContext context) {
......@@ -956,8 +1262,7 @@ class CoreBill extends StatelessWidget {
),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
defaultText(
context,
......@@ -974,8 +1279,7 @@ class CoreBill extends StatelessWidget {
GestureDetector(
onTap: () {
String titlePayment;
String customerName =
getCustomerName();
String customerName = getCustomerName();
bool isIndividu;
if (paymentMode == openBill) {
isIndividu = true;
......@@ -985,8 +1289,7 @@ class CoreBill extends StatelessWidget {
titlePayment = customerName;
}
if (outStandingAll > 0) {
if (paymentMode ==
closebill) {
if (paymentMode == closebill) {
addPayment(
context,
dataBill[0].id,
......@@ -1000,11 +1303,8 @@ class CoreBill extends StatelessWidget {
);
} else {
Navigator.pop(context);
buttonDialog(
context,
dataBill,
outStandingAll,
widthScreen);
buttonDialog(context, dataBill,
outStandingAll, widthScreen);
}
} else {
EasyLoading.showToast(
......@@ -1034,8 +1334,7 @@ class CoreBill extends StatelessWidget {
GestureDetector(
onTap: () {
if (outStandingAll > 0) {
if (outStandingTopayMember <=
0) {
if (outStandingTopayMember <= 0) {
EasyLoading.showToast(
'Tidak ada tagihan / Tidak ada balance');
} else {
......@@ -1056,16 +1355,11 @@ class CoreBill extends StatelessWidget {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) =>
PaymentBalance(
outStanding:
outStandingAll,
balanceMember:
amountParseToIntCrm(
memberinfo
.balance),
orderId:
dataBill[0].id,
builder: (_) => PaymentBalance(
outStanding: outStandingAll,
balanceMember: amountParseToIntCrm(
memberinfo.balance),
orderId: dataBill[0].id,
),
),
);
......@@ -1100,8 +1394,7 @@ class CoreBill extends StatelessWidget {
int indexVoucher = dataBill[0]
.paymentList
.indexWhere((element) =>
element.method ==
payVoucher);
element.method == payVoucher);
if (indexVoucher != -1) {
// check apakah sudah pernah melakukan pembayran voucher
EasyLoading.showToast(
......@@ -1134,118 +1427,21 @@ class CoreBill extends StatelessWidget {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) =>
PaymentVoucher(
outstandingAll:
outStandingAll,
builder: (_) => PaymentVoucher(
outstandingAll: outStandingAll,
dataBill: dataBill,
),
),
);
}
} else {
EasyLoading.showToast(
'Tidak ada tagihan');
}
},
child: ButtonComponent(
buttonColor: buttonColor,
teksButton:
'Excelso CRM Voucher',
),
),
const SizedBox(
height: 16,
),
GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: const ButtonComponent(
buttonColor: Colors.transparent,
teksButton: 'Batal',
teksButtonColor: textColorBlack,
),
)
],
),
);
},
);
} else {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: defaultText(
context,
"Pilih cara pembayaran",
style: modalPaymentStyle(),
),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
GestureDetector(
onTap: () {
if (outStandingAll > 0) {
if (paymentMode ==
closebill) {
addPayment(
context,
dataBill[0].id,
branchCode,
brandCode,
customerName,
payCard,
fullPayment,
'',
outStandingAll,
);
} else {
Navigator.pop(context);
buttonDialog(
context,
dataBill,
outStandingAll,
widthScreen);
}
} else {
EasyLoading.showToast(
'Semua Tagihan Sudah Dibayar');
EasyLoading.showToast('Tidak ada tagihan');
}
},
child: ButtonComponent(
buttonColor: buttonColor,
teksButton: 'Bayar Sebagian'),
teksButton: 'Excelso CRM Voucher',
),
const SizedBox(
height: 16,
),
GestureDetector(
onTap: () {
if (outStandingAll > 0) {
addPayment(
context,
dataBill[0].id,
branchCode,
brandCode,
customerName,
payCard,
fullPayment,
'',
outStandingAll,
);
} else {
EasyLoading.showToast(
'Semua Tagihan Sudah Dibayar');
}
},
child: ButtonComponent(
buttonColor: buttonColor,
teksButton:
'Bayar Seluruhnya - Rp ${formatNumber().format(outStandingAll)}'),
),
const SizedBox(
height: 16,
......@@ -1257,119 +1453,7 @@ class CoreBill extends StatelessWidget {
child: const ButtonComponent(
buttonColor: Colors.transparent,
teksButton: 'Batal',
teksButtonColor: textColorBlack,
),
),
],
),
);
},
);
// buttonDialogAllPayment(
// context,
// dataBill,
// customerName,
// outStandingIndividu,
// outStandingAll,
// paymentMode,
// onTapCashier,
// widthScreen,
// memberinfo,
// branchCode,
// brandCode,
// );
}
}
}
}
},
child: Container(
margin: const EdgeInsets.only(top: 12),
height: 43,
width: double.infinity,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(roundedButtonComponent),
color: (isCanButtonCheckoutToTap(dataBill[0].state))
? buttonColor
: disabledColor,
),
child: Center(
child: defaultText(
context,
textButtonCheckout(dataBill[0].state),
style: buttonBottomBill(),
),
),
),
),
(!getIsDeliveryPickup())
? (dataBill[0].tableStatus == tableStatusOpen)
? Column(
children: [
const SizedBox(
height: 12,
),
GestureDetector(
onTap: () {
if (dataBill[0].tableStatus ==
tableStatusOpen) {
onTapCashier();
}
},
child: const ButtonComponent(
buttonColor: successColor,
teksButton:
'Tutup Pesanan & Minta Bill',
),
),
],
)
: (dataBill[0].tableStatus != tableStatusOpen)
? GestureDetector(
onTap: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (_) => const NewHome2()),
);
context.read<BranchExist>().branchExist(
getBranchPref(),
getBrand(),
getRole(),
getCashierName(),
getOrderId(),
context,
);
},
child: Column(
children: [
const SizedBox(
height: 12,
),
GestureDetector(
onTap: () {
// if (dataBill[0].tableStatus ==
// tableStatusOpen) {
// onTapCashier();
// }
},
child: const ButtonComponent(
buttonColor: successColor,
teksButton: 'Buat Pesanan Baru',
),
),
],
),
)
: const SizedBox()
: const SizedBox(),
const SizedBox(
height: 5,
),
const BuildVersion()
],
),
teksButtonColor: textColorBlack,
),
)
],
......@@ -1377,181 +1461,131 @@ class CoreBill extends StatelessWidget {
);
},
);
}
Future<dynamic> modalBottomSelectOption(BuildContext context) {
void ontapOkeChangeOutlet() {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (_) => const SelectBranch(
isFormBill: true,
),
),
);
}
void onTapCancelChange() {
Navigator.pop(context);
}
return showModalBottomSheet(
backgroundColor: backgroundWhite,
} else {
showDialog(
context: context,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(19),
topRight: Radius.circular(19),
),
),
barrierColor: Colors.grey.withOpacity(0.9),
builder: (contextModal) {
return Container(
padding: const EdgeInsets.symmetric(
horizontal: paddingLeftRight,
builder: (BuildContext context) {
return AlertDialog(
title: defaultText(
context,
"Pilih cara pembayaran",
style: modalPaymentStyle(),
),
child: Column(
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Center(
child: Container(
margin: const EdgeInsets.only(
top: 8,
bottom: 28,
),
width: 50,
height: 3,
color: disabledColor,
),
),
defaultText(
context,
'Pilih Tipe Order',
style: pickUpdeliveryStyleFont(),
),
GestureDetector(
onTap: () {
if (getIsPickup()) {
setIsCustomerDelivery(false);
Api.changeTypeOrder(typeOrderPickup).then((value) {
if (value) {
context.read<ViewBillBloc>().getBill();
setTypeOrder(typeOrderPickup);
}
});
Navigator.pop(context);
} else {
String textOnOk = 'OK';
String textOnCancel = 'Batal';
String title = 'Info';
String description = '''
Outlet ini tidak dapat menerima pickup order,
ingin ganti outlet ?
Note: Ganti outlet akan menyebabkan orderan anda saat ini hilang
''';
buttonDialogGlobal(
if (outStandingAll > 0) {
if (paymentMode == closebill) {
addPayment(
context,
title,
description,
textOnOk,
textOnCancel,
ontapOkeChangeOutlet,
onTapCancelChange,
okButtonColor: buttonColor,
dataBill[0].id,
branchCode,
brandCode,
customerName,
payCard,
fullPayment,
'',
outStandingAll,
);
} else {
Navigator.pop(context);
buttonDialog(context, dataBill,
outStandingAll, widthScreen);
}
} else {
EasyLoading.showToast(
'Semua Tagihan Sudah Dibayar');
}
},
child: Container(
padding: const EdgeInsets.only(top: 19, bottom: 25, left: 10),
color: backgroundWhite,
child: Row(
children: [
const Image(
image: AssetImage('assets/icons/pickup-icon.png'),
child: ButtonComponent(
buttonColor: buttonColor,
teksButton: 'Bayar Sebagian'),
),
const SizedBox(
width: 12,
),
defaultText(
context,
'Pick Up',
style: pickUpdeliveryStyleFont(),
)
],
),
),
height: 16,
),
GestureDetector(
onTap: () {
if (!getIsDelivery()) {
String textOnOk = 'OK';
String textOnCancel = 'Batal';
String title = 'Info';
String description = '''
Outlet ini tidak dapat delivery order,
ingin ganti outlet ?
Note: Ganti outlet akan menyebabkan orderan anda saat ini hilang
''';
buttonDialogGlobal(
if (outStandingAll > 0) {
addPayment(
context,
title,
description,
textOnOk,
textOnCancel,
ontapOkeChangeOutlet,
onTapCancelChange,
okButtonColor: buttonColor,
dataBill[0].id,
branchCode,
brandCode,
customerName,
payCard,
fullPayment,
'',
outStandingAll,
);
} else {
setIsCustomerDelivery(true);
Api.changeTypeOrder(typeOrderDelivery).then((value) {
if (value) {
context.read<ViewBillBloc>().getBill();
setTypeOrder(typeOrderDelivery);
}
});
Navigator.pop(context);
EasyLoading.showToast(
'Semua Tagihan Sudah Dibayar');
}
},
child: Container(
padding: const EdgeInsets.only(left: 10, bottom: 24),
color: backgroundWhite,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
const Image(
image: AssetImage('assets/icons/delivery-icon.png'),
child: ButtonComponent(
buttonColor: buttonColor,
teksButton:
'Bayar Seluruhnya - Rp ${formatNumber().format(outStandingAll)}'),
),
const SizedBox(
width: 12,
),
defaultText(
context,
'Delivery',
style: pickUpdeliveryStyleFont(),
)
],
height: 16,
),
defaultText(
context,
'23 Menit',
style: pickUpdeliveryStyleFont(),
)
],
GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: const ButtonComponent(
buttonColor: Colors.transparent,
teksButton: 'Batal',
teksButtonColor: textColorBlack,
),
),
)
],
),
);
},
);
// buttonDialogAllPayment(
// context,
// dataBill,
// customerName,
// outStandingIndividu,
// outStandingAll,
// paymentMode,
// onTapCashier,
// widthScreen,
// memberinfo,
// branchCode,
// brandCode,
// );
}
}
}
}
},
child: Container(
margin: const EdgeInsets.only(top: 12),
height: 43,
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(roundedButtonComponent),
color: (isCanButtonCheckoutToTap(dataBill[0].state))
? buttonColor
: disabledColor,
),
child: Center(
child: defaultText(
context,
textButtonCheckout(dataBill[0].state),
style: buttonBottomBill(),
),
),
),
);
}
}
......@@ -1610,14 +1644,8 @@ class DeliveryPickupDetail extends StatelessWidget {
children: [
defaultText(
context,
"Close: ",
maxLines: 1,
overFlow: TextOverflow.ellipsis,
),
defaultText(
context,
getCloseTime(),
maxLines: 1,
"Open Hour: ${getOpenTime()} - ${getCloseTime()}",
maxLines: 2,
overFlow: TextOverflow.ellipsis,
),
],
......@@ -1635,7 +1663,7 @@ class DeliveryPickupDetail extends StatelessWidget {
),
defaultText(
context,
getPickupTime(),
"${getPickupTime()}:00",
maxLines: 1,
overFlow: TextOverflow.ellipsis,
),
......@@ -1765,6 +1793,9 @@ Apakah ingin melanjutkan ?''';
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),
......@@ -1773,12 +1804,20 @@ Apakah ingin melanjutkan ?''';
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 difference =
final differenceClose =
dateTimeCloseOutlet.difference(dateSelectedPickupTime);
final differenceOpen =
dateTimeOpenOutlet.difference(dateSelectedPickupTime);
final differenceFromNow =
dateSelectedPickupTime.difference(now);
if (differenceFromNow.inMinutes < 0) {
......@@ -1794,7 +1833,7 @@ Apakah ingin melanjutkan ?''';
);
return;
}
if (difference.inMinutes < 59) {
if (differenceClose.inMinutes < 59) {
buttonDialogGlobal(
context,
'Informasi',
......@@ -1807,6 +1846,20 @@ Apakah ingin melanjutkan ?''';
);
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 =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment