Commit d94265ec authored by Jasa Digital's avatar Jasa Digital

view bill edit

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