Commit d94265ec authored by Jasa Digital's avatar Jasa Digital

view bill edit

parent b9532527
...@@ -1997,6 +1997,9 @@ class DeliveryPickupDetail extends StatelessWidget { ...@@ -1997,6 +1997,9 @@ class DeliveryPickupDetail extends StatelessWidget {
} }
void setPickupTimeUser(int time, {String typeSatuan = 'jam'}) { void setPickupTimeUser(int time, {String typeSatuan = 'jam'}) {
String openOutlet = getOpenTime();
String hourOpen = openOutlet.split(':')[0];
String minuteOpen = openOutlet.split(':')[1];
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];
...@@ -2006,7 +2009,10 @@ class DeliveryPickupDetail extends StatelessWidget { ...@@ -2006,7 +2009,10 @@ class DeliveryPickupDetail extends StatelessWidget {
"$dateNow $hourClose:$minuteClose:00"; "$dateNow $hourClose:$minuteClose:00";
DateTime dateTimeCloseOutlet = DateTime dateTimeCloseOutlet =
DateTime.parse(dateTimeCloseOutletString); DateTime.parse(dateTimeCloseOutletString);
String dateTimeOpenOutletString =
"$dateNow $hourOpen:$minuteOpen:00";
DateTime dateTimeOpenOutlet =
DateTime.parse(dateTimeOpenOutletString);
String hourTime = DateFormat.H().format(dateTime); String hourTime = DateFormat.H().format(dateTime);
String minuteTime = DateFormat.m().format(dateTime); String minuteTime = DateFormat.m().format(dateTime);
DateTime dateSelectedPickupTime; DateTime dateSelectedPickupTime;
...@@ -2043,6 +2049,35 @@ class DeliveryPickupDetail extends StatelessWidget { ...@@ -2043,6 +2049,35 @@ class DeliveryPickupDetail extends StatelessWidget {
); );
return; return;
} }
final differenceOpen =
dateSelectedPickupTime.difference(dateTimeOpenOutlet);
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 (differenceOpen.inMinutes < 0) {
buttonDialogGlobal(
context,
'Informasi',
'Pickup Hanya Bisa Dilakukan Setelah Outlet Buka',
'OK',
'Close',
ontapClose,
ontapClose,
isOkeButtonShow: false,
);
return;
}
TimeOfDay timeOfDayPickup; TimeOfDay timeOfDayPickup;
if (typeSatuan == 'jam') { if (typeSatuan == 'jam') {
timeOfDayPickup = TimeOfDay( timeOfDayPickup = TimeOfDay(
...@@ -2174,7 +2209,8 @@ class DeliveryPickupDetail extends StatelessWidget { ...@@ -2174,7 +2209,8 @@ class DeliveryPickupDetail extends StatelessWidget {
now.month, now.month,
now.day, now.day,
value.hour, value.hour,
value.minute); value.minute,
);
final differenceClose = final differenceClose =
dateTimeCloseOutlet.difference( dateTimeCloseOutlet.difference(
dateSelectedPickupTime); dateSelectedPickupTime);
...@@ -2688,70 +2724,83 @@ Apakah ingin melanjutkan ?'''; ...@@ -2688,70 +2724,83 @@ Apakah ingin melanjutkan ?''';
const SizedBox( const SizedBox(
height: 5, height: 5,
), ),
GestureDetector( // GestureDetector(
onTap: () { // onTap: () {
if (getIsCanChangeDeliveryPickup()) { // if (getIsCanChangeDeliveryPickup()) {
void ontapOkeChange() { // void ontapOkeChange() {
Navigator.push( // EasyLoading.show(
context, // status: 'Getting outlet...',
MaterialPageRoute( // maskType: EasyLoadingMaskType.none,
builder: (_) => const SelectBranch( // );
isFormBill: true, // Api.getBranchList().then((value) {
), // EasyLoading.dismiss();
), // if (value.isNotEmpty) {
); // Navigator.push(
} // context,
// MaterialPageRoute(
void onTapCancelChange() { // builder: (_) => const SelectBranch(
Navigator.pop(context); // isFormBill: true,
} // ),
// ),
String textOnOk = 'OK'; // );
String textOnCancel = 'Batal'; // } else {
String title = 'Ganti Outlet'; // EasyLoading.showToast(
String description = ''' // 'List outlet tidak ditemukan');
Ganti outlet akan menyebabkan orderan anda saat ini hilang. // }
// });
Apakah ingin melanjutkan ?'''; // }
buttonDialogGlobal(
context, // void onTapCancelChange() {
title, // Navigator.pop(context);
description, // }
textOnOk,
textOnCancel, // String textOnOk = 'OK';
ontapOkeChange, // String textOnCancel = 'Batal';
onTapCancelChange, // String title = 'Ganti Outlet';
okButtonColor: buttonColor, // String description = '''
); // Ganti outlet akan menyebabkan orderan anda saat ini hilang.
} else {
EasyLoading.showToast( // Apakah ingin melanjutkan ?''';
'Tidak dapat ganti oulet karena status orderan sedang diproses / telah selesai'); // buttonDialogGlobal(
} // context,
}, // title,
child: Container( // description,
width: 98, // textOnOk,
height: 30, // textOnCancel,
decoration: BoxDecoration( // ontapOkeChange,
borderRadius: BorderRadius.circular(40), // onTapCancelChange,
color: (isFromMenu) // okButtonColor: buttonColor,
? backgroundColor // );
: backgroundWhite, // } else {
border: Border.all( // EasyLoading.showToast(
color: buttonColor, // 'Tidak dapat ganti oulet karena status orderan sedang diproses / telah selesai');
), // }
), // },
child: Center( // child: Container(
child: defaultText( // width: 98,
context, // height: 30,
'Ganti Outlet', // decoration: BoxDecoration(
style: addButton( // borderRadius: BorderRadius.circular(40),
font: 8, // color: (isFromMenu)
color: buttonColor, // ? backgroundColor
), // : backgroundWhite,
), // border: Border.all(
), // color: buttonColor,
), // ),
), // ),
// child: Center(
// child: defaultText(
// context,
// 'Ganti Outlet',
// style: addButton(
// font: 8,
// color: buttonColor,
// ),
// ),
// ),
// ),
// ),
changeOutlet(context),
const SizedBox( const SizedBox(
height: 5, height: 5,
), ),
......
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