|
|
|
@ -184,10 +184,13 @@ class _AddSchedulesPageState extends State<AddSchedulesPage> {
|
|
|
|
initial: tomorrowDate,
|
|
|
|
initial: tomorrowDate,
|
|
|
|
firstDate: DateTime.now(),
|
|
|
|
firstDate: DateTime.now(),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
if (scheduleID != null) {
|
|
|
|
|
|
|
|
endDate = "";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (endDate.isNotEmpty) {
|
|
|
|
if (endDate.isNotEmpty) {
|
|
|
|
DateTime sDate = DateTime.parse(startDate);
|
|
|
|
DateTime sDate = DateHelper.parseStringToDate(startDate);
|
|
|
|
DateTime eDate = DateTime.parse(endDate);
|
|
|
|
DateTime eDate = DateHelper.parseStringToDate(endDate);
|
|
|
|
|
|
|
|
|
|
|
|
if (sDate.isAfter(eDate)) {
|
|
|
|
if (sDate.isAfter(eDate)) {
|
|
|
|
startDate = "";
|
|
|
|
startDate = "";
|
|
|
|
@ -215,18 +218,24 @@ class _AddSchedulesPageState extends State<AddSchedulesPage> {
|
|
|
|
Utils.showToast(LocaleKeys.pleaseEnterStartDateFirst.tr());
|
|
|
|
Utils.showToast(LocaleKeys.pleaseEnterStartDateFirst.tr());
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
sDate = DateTime.parse(startDate);
|
|
|
|
// sDate = DateTime.parse(startDate);
|
|
|
|
|
|
|
|
sDate = DateHelper.parseStringToDate(startDate);
|
|
|
|
|
|
|
|
|
|
|
|
firstDate = sDate.add(const Duration(days: 1)).subtract(
|
|
|
|
firstDate = sDate.add(const Duration(days: 1)).subtract(
|
|
|
|
Duration(hours: DateTime.now().hour, minutes: DateTime.now().minute, seconds: DateTime.now().second, microseconds: DateTime.now().microsecond),
|
|
|
|
Duration(hours: DateTime.now().hour, minutes: DateTime.now().minute, seconds: DateTime.now().second, microseconds: DateTime.now().microsecond),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (startDate != null && startDate.isNotEmpty) {
|
|
|
|
|
|
|
|
tomorrowDate = firstDate;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
endDate = await Utils.pickDateFromDatePicker(
|
|
|
|
endDate = await Utils.pickDateFromDatePicker(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
initial: tomorrowDate,
|
|
|
|
initial: tomorrowDate,
|
|
|
|
firstDate: firstDate ?? tomorrowDate,
|
|
|
|
firstDate: firstDate ?? tomorrowDate,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
DateTime eDate = DateTime.parse(endDate);
|
|
|
|
DateTime eDate = DateHelper.parseStringToDate(endDate);
|
|
|
|
|
|
|
|
|
|
|
|
if (!eDate.isAfter(sDate)) {
|
|
|
|
if (!eDate.isAfter(sDate)) {
|
|
|
|
endDate = "";
|
|
|
|
endDate = "";
|
|
|
|
@ -259,6 +268,7 @@ class _AddSchedulesPageState extends State<AddSchedulesPage> {
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|
child: TxtField(
|
|
|
|
child: TxtField(
|
|
|
|
hint: LocaleKeys.shiftStartTime.tr(),
|
|
|
|
hint: LocaleKeys.shiftStartTime.tr(),
|
|
|
|
|
|
|
|
maxLines: 1,
|
|
|
|
postfixWidget: const Icon(
|
|
|
|
postfixWidget: const Icon(
|
|
|
|
Icons.access_time_filled_outlined,
|
|
|
|
Icons.access_time_filled_outlined,
|
|
|
|
size: 16,
|
|
|
|
size: 16,
|
|
|
|
@ -286,6 +296,7 @@ class _AddSchedulesPageState extends State<AddSchedulesPage> {
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|
child: TxtField(
|
|
|
|
child: TxtField(
|
|
|
|
hint: LocaleKeys.shiftEndTime.tr(),
|
|
|
|
hint: LocaleKeys.shiftEndTime.tr(),
|
|
|
|
|
|
|
|
maxLines: 1,
|
|
|
|
postfixWidget: const Icon(
|
|
|
|
postfixWidget: const Icon(
|
|
|
|
Icons.access_time_filled_outlined,
|
|
|
|
Icons.access_time_filled_outlined,
|
|
|
|
size: 16,
|
|
|
|
size: 16,
|
|
|
|
|