|
|
|
|
@ -103,6 +103,7 @@ class _UpdateSystemInternalAuditPageState extends State<UpdateSystemInternalAudi
|
|
|
|
|
id: 0,
|
|
|
|
|
startDate: formModel.auditTimePicker!.startAt!.toIso8601String(), // Handle potential null
|
|
|
|
|
endDate: formModel.auditTimePicker!.endAt?.toIso8601String(), // Handle potential null
|
|
|
|
|
// endDate: formModel.auditTimePicker!.startAt?.add(const Duration(hours: 1)).toIso8601String(), // Handle potential null
|
|
|
|
|
totalWorkingHour: ((durationInSecond) / 60 / 60),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
@ -131,18 +132,12 @@ class _UpdateSystemInternalAuditPageState extends State<UpdateSystemInternalAudi
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
log('submit press');
|
|
|
|
|
log('data ${formModel.toJson()}');
|
|
|
|
|
final success = await provider.updateSystemInternalAudit(model: formModel);
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
if (formModel.isComplete == true) {
|
|
|
|
|
//Navigate to List screen.
|
|
|
|
|
} else if (formModel.isComplete == false) {
|
|
|
|
|
if (success) {
|
|
|
|
|
Navigator.of(context).pop(true);
|
|
|
|
|
} else {
|
|
|
|
|
Fluttertoast.showToast(msg: 'Failed to update');
|
|
|
|
|
}
|
|
|
|
|
if (success) {
|
|
|
|
|
Navigator.of(context).pop(true);
|
|
|
|
|
} else {
|
|
|
|
|
Fluttertoast.showToast(msg: 'Failed to update');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -162,6 +157,9 @@ class _UpdateSystemInternalAuditPageState extends State<UpdateSystemInternalAudi
|
|
|
|
|
formModel.startTime = start;
|
|
|
|
|
formModel.endTime = end;
|
|
|
|
|
formModel.totalHours = totalHours;
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -231,7 +229,6 @@ class _UpdateSystemInternalAuditPageState extends State<UpdateSystemInternalAudi
|
|
|
|
|
buttonColor: context.isDark ? AppColor.neutral70 : AppColor.white60,
|
|
|
|
|
textColor: context.isDark ? AppColor.white10 : AppColor.black10,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
log('button press ');
|
|
|
|
|
formModel.isComplete = false;
|
|
|
|
|
_onSubmit(context);
|
|
|
|
|
}).expanded,
|
|
|
|
|
@ -285,6 +282,7 @@ class _UpdateSystemInternalAuditPageState extends State<UpdateSystemInternalAudi
|
|
|
|
|
label: context.translation.workingHours,
|
|
|
|
|
showPicker: false,
|
|
|
|
|
timer: formModel.auditTimerModel,
|
|
|
|
|
// enabled:formModel.endTime==null,
|
|
|
|
|
pickerFromDate: DateTime.tryParse(widget.model?.createdDate ?? ''),
|
|
|
|
|
pickerTimer: formModel.auditTimePicker,
|
|
|
|
|
onPick: (time) {
|
|
|
|
|
|