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", "title": "Ravintola Dev BYOD",
"isResponsive": true, "isResponsive": true,
"debug": true "debug": true
......
...@@ -93,7 +93,11 @@ class Api { ...@@ -93,7 +93,11 @@ class Api {
"order_id": orderID, "order_id": orderID,
"session_id": sessionId, "session_id": sessionId,
"from": fromByod, "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_lat": latitude,
"customer_long": longitude, "customer_long": longitude,
"type_url": urlType, "type_url": urlType,
...@@ -162,6 +166,7 @@ class Api { ...@@ -162,6 +166,7 @@ class Api {
setIsPickup(jsonObject['data']['is_pickup']); setIsPickup(jsonObject['data']['is_pickup']);
setOpenTime(jsonObject['data']['open_time']); setOpenTime(jsonObject['data']['open_time']);
setCloseTime(jsonObject['data']['close_time']); setCloseTime(jsonObject['data']['close_time']);
setTableNumber(jsonObject['data']['table_number'] ?? '');
if (jsonObject['data']['payment_mode'] != null) { if (jsonObject['data']['payment_mode'] != null) {
setPaymentMode(jsonObject['data']['payment_mode']); setPaymentMode(jsonObject['data']['payment_mode']);
} }
......
...@@ -67,11 +67,13 @@ Future<dynamic> sendTele(String teks, String namaFungsi) async { ...@@ -67,11 +67,13 @@ Future<dynamic> sendTele(String teks, String namaFungsi) async {
//**get orderStatus and color status */ //**get orderStatus and color status */
String getOrderStatus(int status) { String getOrderStatus(int status) {
if (status == completeOrder) { if (status == completeOrder) {
return 'Complete'; return 'Processed';
} else if (status == cancelOrder) { } else if (status == cancelOrder) {
return 'Canceld'; return 'Canceled';
} else if (status == processingOrder) { } else if (status == processingOrder) {
return 'Preparing'; return 'Processing';
} else if (status == approvedOrder) {
return 'Approved';
} else { } else {
return 'Pending'; return 'Pending';
} }
...@@ -81,9 +83,11 @@ Color getOrderStatusColor(int status) { ...@@ -81,9 +83,11 @@ Color getOrderStatusColor(int status) {
if (status == completeOrder) { if (status == completeOrder) {
return successColor; return successColor;
} else if (status == cancelOrder) { } else if (status == cancelOrder) {
return cancelColorButton; return dangerColor;
} else if (status == processingOrder) { } else if (status == processingOrder) {
return processingColor; return processingColor;
} else if (status == approvedOrder) {
return approvedColor;
} else { } else {
return pendingColor; return pendingColor;
} }
...@@ -348,12 +352,12 @@ String textButtonCheckout(int orderState) { ...@@ -348,12 +352,12 @@ String textButtonCheckout(int orderState) {
orderState == orderStateInproses || orderState == orderStateInproses ||
orderState == orderStateReady)) { orderState == orderStateReady)) {
return 'Pesanan Diproses'; return 'Pesanan Diproses';
} else if (orderState == orderStateDone) { } else if (paymentMethod == openBill && orderState != orderStateCanceled) {
return 'Buat Pesanan Baru'; return 'Bayar';
} else if (orderState == orderStateCanceled) { } else if (orderState == orderStateCanceled) {
return 'Transaksi Dibatalkan'; return 'Transaksi Dibatalkan';
} else { } else {
return ''; return 'Bayar';
} }
} }
...@@ -426,6 +430,7 @@ const Color textInButton = Colors.white; ...@@ -426,6 +430,7 @@ const Color textInButton = Colors.white;
const Color textCancelColor = Color(0xff333333); const Color textCancelColor = Color(0xff333333);
const Color successColor = Colors.green; const Color successColor = Colors.green;
const Color processingColor = Colors.blue; const Color processingColor = Colors.blue;
const Color approvedColor = Colors.blue;
const Color pendingColor = Colors.amber; const Color pendingColor = Colors.amber;
const Color disabledColor = Colors.grey; const Color disabledColor = Colors.grey;
// const Color selectedColor = Color.fromARGB(255, 225, 250, 5); // const Color selectedColor = Color.fromARGB(255, 225, 250, 5);
...@@ -480,9 +485,10 @@ const int maxLengthTextField = 100; ...@@ -480,9 +485,10 @@ const int maxLengthTextField = 100;
//** untuk nampilin orderan preparing atau compelete */ //** untuk nampilin orderan preparing atau compelete */
const int cancelOrder = -1; const int cancelOrder = -1;
const int completeOrder = 2;
const int pendingOrder = 0; 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 */ //** untuk nampilin orderan preparing atau compelete */
//** constanta order status bill */ //** constanta order status bill */
......
...@@ -43,7 +43,7 @@ bool isExcelso = false; ...@@ -43,7 +43,7 @@ bool isExcelso = false;
bool isResponsive = false; bool isResponsive = false;
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>(); final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
String defaultTitle = 'Ravintola - BYOD'; 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 browserName = 'Wrong platform';
String browserVersion = ''; String browserVersion = '';
......
...@@ -917,392 +917,35 @@ class CoreBill extends StatelessWidget { ...@@ -917,392 +917,35 @@ class CoreBill extends StatelessWidget {
width: widthScreen, width: widthScreen,
child: Column( child: Column(
children: [ children: [
GestureDetector( (!getIsDeliveryPickup() &&
onTap: () { dataBill[0].tableStatus == tableStatusOpen)
if (dataBill[0].tableStatus == tableStatusOpen) { ? ButtonPayment(
if (isCanButtonCheckoutToTap(dataBill[0].state)) { dataBill: dataBill,
if (dataBill[0].state == orderStateCreated) { paymentMode: paymentMode,
Api.setToPendingOrder(); branchCode: branchCode,
context.read<ViewBillBloc>().getBill(); brandCode: brandCode,
} else if (dataBill[0].state == customerName: customerName,
orderStatePending && outStandingAll: outStandingAll,
getTableMode() == tableIndividu) { widthScreen: widthScreen,
EasyLoading.showToast( outStandingTopayMember: outStandingTopayMember,
'Status orderan anda menunggu untuk disetujui'); indexDataIndividu: indexDataIndividu,
} else { memberinfo: memberinfo,
if (paymentMode == closebill && )
memberinfo.id == '') { : const SizedBox(),
addPayment( (getIsDeliveryPickup())
context, ? ButtonPayment(
dataBill[0].id, dataBill: dataBill,
branchCode, paymentMode: paymentMode,
brandCode, branchCode: branchCode,
customerName, brandCode: brandCode,
payCard, customerName: customerName,
fullPayment, outStandingAll: outStandingAll,
'', widthScreen: widthScreen,
outStandingAll, outStandingTopayMember: outStandingTopayMember,
); indexDataIndividu: indexDataIndividu,
} else if (paymentMode == closebill && memberinfo: memberinfo,
memberinfo.id != '') { )
showDialog( : const SizedBox(),
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: defaultText(
context,
"Pilih cara pembayaran",
style: modalPaymentStyle(),
),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
defaultText(
context,
'Pembayaran online menggunakan saldo eWallet atau Virtual Account',
textAlign: TextAlign.left,
style: modalPaymentStyle(
font: 12,
fontWeight: FontWeight.w400,
),
),
const SizedBox(
height: 8,
),
GestureDetector(
onTap: () {
String titlePayment;
String customerName =
getCustomerName();
bool isIndividu;
if (paymentMode == openBill) {
isIndividu = true;
titlePayment = 'Semua Bill';
} else {
isIndividu = false;
titlePayment = customerName;
}
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');
}
},
child: ButtonComponent(
buttonColor: buttonColor,
teksButton:
'Online - Rp ${formatNumber().format(outStandingAll)}'),
),
const SizedBox(
height: 16,
),
defaultText(
context,
'Pembayaran dengan saldo member excelso CRM',
textAlign: TextAlign.left,
style: modalPaymentStyle(
font: 12,
fontWeight: FontWeight.w400,
),
),
const SizedBox(
height: 8,
),
GestureDetector(
onTap: () {
if (outStandingAll > 0) {
if (outStandingTopayMember <=
0) {
EasyLoading.showToast(
'Tidak ada tagihan / Tidak ada balance');
} else {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (_) => Payment(
// dataBill: dataBill,
// isIndividu: true,
// outstandingIndividu:
// outStandingTopayMember, // karena hanya excelso untuk saat ini jadi overide outstandingindividu dulu
// outstandingAll:
// outStandingAll,
// title:
// 'Dengan Balance',
// isUsingBalance:
// true)));
Navigator.push(
context,
MaterialPageRoute(
builder: (_) =>
PaymentBalance(
outStanding:
outStandingAll,
balanceMember:
amountParseToIntCrm(
memberinfo
.balance),
orderId:
dataBill[0].id,
),
),
);
}
} else {
EasyLoading.showToast(
'Semua Tagihan Sudah Dibayar');
}
},
child: ButtonComponent(
buttonColor: buttonColor,
teksButton:
'Excelso CRM Balance - Rp ${formatNumber().format(outStandingTopayMember)}'),
),
const SizedBox(
height: 16,
),
defaultText(
context,
'Pembayaran dengan e-Voucher excelso CRM',
textAlign: TextAlign.left,
style: modalPaymentStyle(
font: 12,
fontWeight: FontWeight.w400,
),
),
const SizedBox(
height: 8,
),
GestureDetector(
onTap: () {
int indexVoucher = dataBill[0]
.paymentList
.indexWhere((element) =>
element.method ==
payVoucher);
if (indexVoucher != -1) {
// check apakah sudah pernah melakukan pembayran voucher
EasyLoading.showToast(
'Voucher telah digunakan pada orderan ini');
} else if (outStandingAll > 0) {
if (indexDataIndividu == -1) {
EasyLoading.showToast(
'Kamu Belum Memiliki Orderan');
} else {
context
.read<VoucherListBloc>()
.getVoucherList();
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (_) => Payment(
// dataBill: dataBill,
// isIndividu: false,
// indexIndividu:
// indexDataIndividu,
// isVoucher: true,
// outstandingIndividu:
// outStandingIndividu,
// outstandingAll:
// outStandingAll,
// title: 'Voucher',
// ),
// ),
// );
Navigator.push(
context,
MaterialPageRoute(
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');
}
},
child: ButtonComponent(
buttonColor: buttonColor,
teksButton: 'Bayar Sebagian'),
),
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,
),
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(),
),
),
),
),
(!getIsDeliveryPickup()) (!getIsDeliveryPickup())
? (dataBill[0].tableStatus == tableStatusOpen) ? (dataBill[0].tableStatus == tableStatusOpen)
? Column( ? Column(
...@@ -1555,6 +1198,397 @@ Note: Ganti outlet akan menyebabkan orderan anda saat ini hilang ...@@ -1555,6 +1198,397 @@ Note: Ganti outlet akan menyebabkan orderan anda saat ini hilang
} }
} }
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 &&
getTableMode() == tableIndividu) {
EasyLoading.showToast(
'Status orderan anda menunggu untuk disetujui');
} else {
if (paymentMode == closebill && memberinfo.id == '') {
addPayment(
context,
dataBill[0].id,
branchCode,
brandCode,
customerName,
payCard,
fullPayment,
'',
outStandingAll,
);
} else if (paymentMode == closebill && memberinfo.id != '') {
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: [
defaultText(
context,
'Pembayaran online menggunakan saldo eWallet atau Virtual Account',
textAlign: TextAlign.left,
style: modalPaymentStyle(
font: 12,
fontWeight: FontWeight.w400,
),
),
const SizedBox(
height: 8,
),
GestureDetector(
onTap: () {
String titlePayment;
String customerName = getCustomerName();
bool isIndividu;
if (paymentMode == openBill) {
isIndividu = true;
titlePayment = 'Semua Bill';
} else {
isIndividu = false;
titlePayment = customerName;
}
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');
}
},
child: ButtonComponent(
buttonColor: buttonColor,
teksButton:
'Online - Rp ${formatNumber().format(outStandingAll)}'),
),
const SizedBox(
height: 16,
),
defaultText(
context,
'Pembayaran dengan saldo member excelso CRM',
textAlign: TextAlign.left,
style: modalPaymentStyle(
font: 12,
fontWeight: FontWeight.w400,
),
),
const SizedBox(
height: 8,
),
GestureDetector(
onTap: () {
if (outStandingAll > 0) {
if (outStandingTopayMember <= 0) {
EasyLoading.showToast(
'Tidak ada tagihan / Tidak ada balance');
} else {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (_) => Payment(
// dataBill: dataBill,
// isIndividu: true,
// outstandingIndividu:
// outStandingTopayMember, // karena hanya excelso untuk saat ini jadi overide outstandingindividu dulu
// outstandingAll:
// outStandingAll,
// title:
// 'Dengan Balance',
// isUsingBalance:
// true)));
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => PaymentBalance(
outStanding: outStandingAll,
balanceMember: amountParseToIntCrm(
memberinfo.balance),
orderId: dataBill[0].id,
),
),
);
}
} else {
EasyLoading.showToast(
'Semua Tagihan Sudah Dibayar');
}
},
child: ButtonComponent(
buttonColor: buttonColor,
teksButton:
'Excelso CRM Balance - Rp ${formatNumber().format(outStandingTopayMember)}'),
),
const SizedBox(
height: 16,
),
defaultText(
context,
'Pembayaran dengan e-Voucher excelso CRM',
textAlign: TextAlign.left,
style: modalPaymentStyle(
font: 12,
fontWeight: FontWeight.w400,
),
),
const SizedBox(
height: 8,
),
GestureDetector(
onTap: () {
int indexVoucher = dataBill[0]
.paymentList
.indexWhere((element) =>
element.method == payVoucher);
if (indexVoucher != -1) {
// check apakah sudah pernah melakukan pembayran voucher
EasyLoading.showToast(
'Voucher telah digunakan pada orderan ini');
} else if (outStandingAll > 0) {
if (indexDataIndividu == -1) {
EasyLoading.showToast(
'Kamu Belum Memiliki Orderan');
} else {
context
.read<VoucherListBloc>()
.getVoucherList();
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (_) => Payment(
// dataBill: dataBill,
// isIndividu: false,
// indexIndividu:
// indexDataIndividu,
// isVoucher: true,
// outstandingIndividu:
// outStandingIndividu,
// outstandingAll:
// outStandingAll,
// title: 'Voucher',
// ),
// ),
// );
Navigator.push(
context,
MaterialPageRoute(
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');
}
},
child: ButtonComponent(
buttonColor: buttonColor,
teksButton: 'Bayar Sebagian'),
),
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,
),
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(),
),
),
),
);
}
}
class DeliveryPickupDetail extends StatelessWidget { class DeliveryPickupDetail extends StatelessWidget {
DeliveryPickupDetail({ DeliveryPickupDetail({
Key? key, Key? key,
...@@ -1610,14 +1644,8 @@ class DeliveryPickupDetail extends StatelessWidget { ...@@ -1610,14 +1644,8 @@ class DeliveryPickupDetail extends StatelessWidget {
children: [ children: [
defaultText( defaultText(
context, context,
"Close: ", "Open Hour: ${getOpenTime()} - ${getCloseTime()}",
maxLines: 1, maxLines: 2,
overFlow: TextOverflow.ellipsis,
),
defaultText(
context,
getCloseTime(),
maxLines: 1,
overFlow: TextOverflow.ellipsis, overFlow: TextOverflow.ellipsis,
), ),
], ],
...@@ -1635,7 +1663,7 @@ class DeliveryPickupDetail extends StatelessWidget { ...@@ -1635,7 +1663,7 @@ class DeliveryPickupDetail extends StatelessWidget {
), ),
defaultText( defaultText(
context, context,
getPickupTime(), "${getPickupTime()}:00",
maxLines: 1, maxLines: 1,
overFlow: TextOverflow.ellipsis, overFlow: TextOverflow.ellipsis,
), ),
...@@ -1765,6 +1793,9 @@ Apakah ingin melanjutkan ?'''; ...@@ -1765,6 +1793,9 @@ Apakah ingin melanjutkan ?''';
String closeOutlet = getCloseTime(); String closeOutlet = getCloseTime();
String hourClose = closeOutlet.split(':')[0]; String hourClose = closeOutlet.split(':')[0];
String minuteClose = closeOutlet.split(':')[1]; String minuteClose = closeOutlet.split(':')[1];
String openOutlet = getOpenTime();
String hourOpen = openOutlet.split(':')[0];
String minuteOpen = openOutlet.split(':')[1];
// TimeOfDay timeClose = TimeOfDay( // TimeOfDay timeClose = TimeOfDay(
// hour: int.parse(hourClose), // hour: int.parse(hourClose),
// minute: int.parse(minuteClose), // minute: int.parse(minuteClose),
...@@ -1773,12 +1804,20 @@ Apakah ingin melanjutkan ?'''; ...@@ -1773,12 +1804,20 @@ Apakah ingin melanjutkan ?''';
var dateNow = DateFormat('yyyy-MM-dd').format(now); var dateNow = DateFormat('yyyy-MM-dd').format(now);
String dateTimeCloseOutletString = String dateTimeCloseOutletString =
"$dateNow $hourClose:$minuteClose:00"; "$dateNow $hourClose:$minuteClose:00";
String dateTimeOpenOutletString =
"$dateNow $hourOpen:$minuteOpen:00";
DateTime dateTimeCloseOutlet = DateTime dateTimeCloseOutlet =
DateTime.parse(dateTimeCloseOutletString); DateTime.parse(dateTimeCloseOutletString);
DateTime dateTimeOpenOutlet =
DateTime.parse(dateTimeOpenOutletString);
DateTime dateSelectedPickupTime = DateTime( DateTime dateSelectedPickupTime = DateTime(
now.year, now.month, now.day, value.hour, value.minute); now.year, now.month, now.day, value.hour, value.minute);
final difference = final differenceClose =
dateTimeCloseOutlet.difference(dateSelectedPickupTime); dateTimeCloseOutlet.difference(dateSelectedPickupTime);
final differenceOpen =
dateTimeOpenOutlet.difference(dateSelectedPickupTime);
final differenceFromNow = final differenceFromNow =
dateSelectedPickupTime.difference(now); dateSelectedPickupTime.difference(now);
if (differenceFromNow.inMinutes < 0) { if (differenceFromNow.inMinutes < 0) {
...@@ -1794,7 +1833,7 @@ Apakah ingin melanjutkan ?'''; ...@@ -1794,7 +1833,7 @@ Apakah ingin melanjutkan ?''';
); );
return; return;
} }
if (difference.inMinutes < 59) { if (differenceClose.inMinutes < 59) {
buttonDialogGlobal( buttonDialogGlobal(
context, context,
'Informasi', 'Informasi',
...@@ -1807,6 +1846,20 @@ Apakah ingin melanjutkan ?'''; ...@@ -1807,6 +1846,20 @@ Apakah ingin melanjutkan ?''';
); );
return; 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); // String timeToset = value.format(context);
final hourString = value.hour.toString().padLeft(2, '0'); final hourString = value.hour.toString().padLeft(2, '0');
final minuteString = 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