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,21 +917,328 @@ class CoreBill extends StatelessWidget { ...@@ -917,21 +917,328 @@ class CoreBill extends StatelessWidget {
width: widthScreen, width: widthScreen,
child: Column( child: Column(
children: [ 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( 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: () { onTap: () {
if (dataBill[0].tableStatus == tableStatusOpen) { if (dataBill[0].tableStatus == tableStatusOpen) {
if (isCanButtonCheckoutToTap(dataBill[0].state)) { if (isCanButtonCheckoutToTap(dataBill[0].state)) {
if (dataBill[0].state == orderStateCreated) { if (dataBill[0].state == orderStateCreated) {
Api.setToPendingOrder(); Api.setToPendingOrder();
context.read<ViewBillBloc>().getBill(); context.read<ViewBillBloc>().getBill();
} else if (dataBill[0].state == } else if (dataBill[0].state == orderStatePending &&
orderStatePending &&
getTableMode() == tableIndividu) { getTableMode() == tableIndividu) {
EasyLoading.showToast( EasyLoading.showToast(
'Status orderan anda menunggu untuk disetujui'); 'Status orderan anda menunggu untuk disetujui');
} else { } else {
if (paymentMode == closebill && if (paymentMode == closebill && memberinfo.id == '') {
memberinfo.id == '') {
addPayment( addPayment(
context, context,
dataBill[0].id, dataBill[0].id,
...@@ -943,8 +1250,7 @@ class CoreBill extends StatelessWidget { ...@@ -943,8 +1250,7 @@ class CoreBill extends StatelessWidget {
'', '',
outStandingAll, outStandingAll,
); );
} else if (paymentMode == closebill && } else if (paymentMode == closebill && memberinfo.id != '') {
memberinfo.id != '') {
showDialog( showDialog(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
...@@ -956,8 +1262,7 @@ class CoreBill extends StatelessWidget { ...@@ -956,8 +1262,7 @@ class CoreBill extends StatelessWidget {
), ),
content: Column( content: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: [ children: [
defaultText( defaultText(
context, context,
...@@ -974,8 +1279,7 @@ class CoreBill extends StatelessWidget { ...@@ -974,8 +1279,7 @@ class CoreBill extends StatelessWidget {
GestureDetector( GestureDetector(
onTap: () { onTap: () {
String titlePayment; String titlePayment;
String customerName = String customerName = getCustomerName();
getCustomerName();
bool isIndividu; bool isIndividu;
if (paymentMode == openBill) { if (paymentMode == openBill) {
isIndividu = true; isIndividu = true;
...@@ -985,8 +1289,7 @@ class CoreBill extends StatelessWidget { ...@@ -985,8 +1289,7 @@ class CoreBill extends StatelessWidget {
titlePayment = customerName; titlePayment = customerName;
} }
if (outStandingAll > 0) { if (outStandingAll > 0) {
if (paymentMode == if (paymentMode == closebill) {
closebill) {
addPayment( addPayment(
context, context,
dataBill[0].id, dataBill[0].id,
...@@ -1000,11 +1303,8 @@ class CoreBill extends StatelessWidget { ...@@ -1000,11 +1303,8 @@ class CoreBill extends StatelessWidget {
); );
} else { } else {
Navigator.pop(context); Navigator.pop(context);
buttonDialog( buttonDialog(context, dataBill,
context, outStandingAll, widthScreen);
dataBill,
outStandingAll,
widthScreen);
} }
} else { } else {
EasyLoading.showToast( EasyLoading.showToast(
...@@ -1034,8 +1334,7 @@ class CoreBill extends StatelessWidget { ...@@ -1034,8 +1334,7 @@ class CoreBill extends StatelessWidget {
GestureDetector( GestureDetector(
onTap: () { onTap: () {
if (outStandingAll > 0) { if (outStandingAll > 0) {
if (outStandingTopayMember <= if (outStandingTopayMember <= 0) {
0) {
EasyLoading.showToast( EasyLoading.showToast(
'Tidak ada tagihan / Tidak ada balance'); 'Tidak ada tagihan / Tidak ada balance');
} else { } else {
...@@ -1056,16 +1355,11 @@ class CoreBill extends StatelessWidget { ...@@ -1056,16 +1355,11 @@ class CoreBill extends StatelessWidget {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (_) => builder: (_) => PaymentBalance(
PaymentBalance( outStanding: outStandingAll,
outStanding: balanceMember: amountParseToIntCrm(
outStandingAll, memberinfo.balance),
balanceMember: orderId: dataBill[0].id,
amountParseToIntCrm(
memberinfo
.balance),
orderId:
dataBill[0].id,
), ),
), ),
); );
...@@ -1100,8 +1394,7 @@ class CoreBill extends StatelessWidget { ...@@ -1100,8 +1394,7 @@ class CoreBill extends StatelessWidget {
int indexVoucher = dataBill[0] int indexVoucher = dataBill[0]
.paymentList .paymentList
.indexWhere((element) => .indexWhere((element) =>
element.method == element.method == payVoucher);
payVoucher);
if (indexVoucher != -1) { if (indexVoucher != -1) {
// check apakah sudah pernah melakukan pembayran voucher // check apakah sudah pernah melakukan pembayran voucher
EasyLoading.showToast( EasyLoading.showToast(
...@@ -1134,118 +1427,21 @@ class CoreBill extends StatelessWidget { ...@@ -1134,118 +1427,21 @@ class CoreBill extends StatelessWidget {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (_) => builder: (_) => PaymentVoucher(
PaymentVoucher( outstandingAll: outStandingAll,
outstandingAll:
outStandingAll,
dataBill: dataBill, dataBill: dataBill,
), ),
), ),
); );
} }
} else { } else {
EasyLoading.showToast( EasyLoading.showToast('Tidak ada tagihan');
'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( child: ButtonComponent(
buttonColor: buttonColor, 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( const SizedBox(
height: 16, height: 16,
...@@ -1257,119 +1453,7 @@ class CoreBill extends StatelessWidget { ...@@ -1257,119 +1453,7 @@ class CoreBill extends StatelessWidget {
child: const ButtonComponent( child: const ButtonComponent(
buttonColor: Colors.transparent, buttonColor: Colors.transparent,
teksButton: 'Batal', teksButton: 'Batal',
teksButtonColor: textColorBlack, 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()
],
),
), ),
) )
], ],
...@@ -1377,181 +1461,131 @@ class CoreBill extends StatelessWidget { ...@@ -1377,181 +1461,131 @@ class CoreBill extends StatelessWidget {
); );
}, },
); );
} } else {
showDialog(
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, context: context,
shape: const RoundedRectangleBorder( builder: (BuildContext context) {
borderRadius: BorderRadius.only( return AlertDialog(
topLeft: Radius.circular(19), title: defaultText(
topRight: Radius.circular(19), context,
), "Pilih cara pembayaran",
), style: modalPaymentStyle(),
barrierColor: Colors.grey.withOpacity(0.9),
builder: (contextModal) {
return Container(
padding: const EdgeInsets.symmetric(
horizontal: paddingLeftRight,
), ),
child: Column( content: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ 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( GestureDetector(
onTap: () { onTap: () {
if (getIsPickup()) { if (outStandingAll > 0) {
setIsCustomerDelivery(false); if (paymentMode == closebill) {
Api.changeTypeOrder(typeOrderPickup).then((value) { addPayment(
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, context,
title, dataBill[0].id,
description, branchCode,
textOnOk, brandCode,
textOnCancel, customerName,
ontapOkeChangeOutlet, payCard,
onTapCancelChange, fullPayment,
okButtonColor: buttonColor, '',
outStandingAll,
); );
} else {
Navigator.pop(context);
buttonDialog(context, dataBill,
outStandingAll, widthScreen);
}
} else {
EasyLoading.showToast(
'Semua Tagihan Sudah Dibayar');
} }
}, },
child: Container( child: ButtonComponent(
padding: const EdgeInsets.only(top: 19, bottom: 25, left: 10), buttonColor: buttonColor,
color: backgroundWhite, teksButton: 'Bayar Sebagian'),
child: Row(
children: [
const Image(
image: AssetImage('assets/icons/pickup-icon.png'),
), ),
const SizedBox( const SizedBox(
width: 12, height: 16,
),
defaultText(
context,
'Pick Up',
style: pickUpdeliveryStyleFont(),
)
],
),
),
), ),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
if (!getIsDelivery()) { if (outStandingAll > 0) {
String textOnOk = 'OK'; addPayment(
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, context,
title, dataBill[0].id,
description, branchCode,
textOnOk, brandCode,
textOnCancel, customerName,
ontapOkeChangeOutlet, payCard,
onTapCancelChange, fullPayment,
okButtonColor: buttonColor, '',
outStandingAll,
); );
} else { } else {
setIsCustomerDelivery(true); EasyLoading.showToast(
Api.changeTypeOrder(typeOrderDelivery).then((value) { 'Semua Tagihan Sudah Dibayar');
if (value) {
context.read<ViewBillBloc>().getBill();
setTypeOrder(typeOrderDelivery);
}
});
Navigator.pop(context);
} }
}, },
child: Container( child: ButtonComponent(
padding: const EdgeInsets.only(left: 10, bottom: 24), buttonColor: buttonColor,
color: backgroundWhite, teksButton:
child: Row( 'Bayar Seluruhnya - Rp ${formatNumber().format(outStandingAll)}'),
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
const Image(
image: AssetImage('assets/icons/delivery-icon.png'),
), ),
const SizedBox( const SizedBox(
width: 12, height: 16,
),
defaultText(
context,
'Delivery',
style: pickUpdeliveryStyleFont(),
)
],
), ),
defaultText( GestureDetector(
context, onTap: () {
'23 Menit', Navigator.pop(context);
style: pickUpdeliveryStyleFont(), },
) 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 { ...@@ -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