Browse Source

fix Bug #7817

master
daivph 5 years ago
parent
commit
1e41092336
2 changed files with 23 additions and 8 deletions
  1. +20
    -8
      lib/presentation/screens/actions/spraying/sc_edit_action_spraying.dart
  2. +3
    -0
      lib/utils/const_string.dart

+ 20
- 8
lib/presentation/screens/actions/spraying/sc_edit_action_spraying.dart View File

@@ -136,10 +136,16 @@ class _EditActionSprayingScreenState extends State<EditActionSprayingScreen> {
DatePicker.showDateTimePicker(context,
showTitleActions: true, onChanged: (date) {}, onConfirm: (date) {
setState(() {
var parsedDate =
DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(date);
_spraying.executeDate = "$parsedDate";
executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(date);
if (resultAtTime != null && date.isAfter(resultAtTime)) {
Utils.showSnackBarWarning(
message: label_execute_date_must_after_result_time);
} else {
executeTime = date;
var parsedDate =
DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(date);
_spraying.executeDate = "$parsedDate";
executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(date);
}
});
}, currentTime: executeTime, locale: LocaleType.vi);
},
@@ -172,10 +178,16 @@ class _EditActionSprayingScreenState extends State<EditActionSprayingScreen> {
DatePicker.showDateTimePicker(context,
showTitleActions: true, onChanged: (date) {}, onConfirm: (date) {
setState(() {
var parsedDate =
DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(date);
_spraying.resultAt = "$parsedDate";
resultAtView = DateFormat("dd/MM/yyyy HH:mm").format(date);
if (executeTime.isAfter(date)) {
Utils.showSnackBarWarning(
message: label_execute_date_must_after_result_time);
} else {
resultAtTime = date;
var parsedDate =
DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(date);
_spraying.resultAt = "$parsedDate";
resultAtView = DateFormat("dd/MM/yyyy HH:mm").format(date);
}
});
}, currentTime: resultAtTime, locale: LocaleType.vi);
},

+ 3
- 0
lib/utils/const_string.dart View File

@@ -48,6 +48,9 @@ const String label_district_empty_message = "Quận/Huyện đang trống";

const String label_invalid_number = "Vui lòng nhập số";

const String label_execute_date_must_after_result_time =
"Thời gian ghi nhận kết quả phải sau thời gian thực hiện";

//Exception
const String exception_common = "Đã có lỗi xảy ra";
const String exception_dio_cancle = "Truy vấn đến máy chủ bị huỷ";

Loading…
Cancel
Save