|
|
@ -1,4 +1,5 @@
|
|
|
|
// Flutter imports:
|
|
|
|
// Flutter imports:
|
|
|
|
|
|
|
|
import 'package:common_utils/common_utils.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
|
|
|
|
// Package imports:
|
|
|
|
// Package imports:
|
|
|
@ -90,17 +91,23 @@ class AppProvider extends ChangeNotifier {
|
|
|
|
DateTime get clockOutTime => _clockOutTime;
|
|
|
|
DateTime get clockOutTime => _clockOutTime;
|
|
|
|
|
|
|
|
|
|
|
|
initClock() {
|
|
|
|
initClock() {
|
|
|
|
|
|
|
|
DateUtil.isToday(_dateRecord.millisecondsSinceEpoch.abs());
|
|
|
|
|
|
|
|
// if (_dateRecord == null ||
|
|
|
|
|
|
|
|
// (_dateRecord !=
|
|
|
|
|
|
|
|
// DateTime.utc(DateTime.now().year, DateTime.now().month,
|
|
|
|
|
|
|
|
// DateTime.now().day))) {
|
|
|
|
|
|
|
|
// resetClock();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
if (_dateRecord == null ||
|
|
|
|
if (_dateRecord == null ||
|
|
|
|
(_dateRecord !=
|
|
|
|
(!DateUtils.isSameDay(_dateRecord, DateTime.now()))) {
|
|
|
|
DateTime.utc(DateTime.now().year, DateTime.now().month,
|
|
|
|
|
|
|
|
DateTime.now().day))) {
|
|
|
|
|
|
|
|
resetClock();
|
|
|
|
resetClock();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
setClockInTime(DateTime dateTime) {
|
|
|
|
setClockInTime(DateTime dateTime) {
|
|
|
|
if (_clockStatus == WORKCLOCK.NOTIN) {
|
|
|
|
if (_clockStatus == WORKCLOCK.NOTIN) {
|
|
|
|
_dateRecord = DateTime.utc(dateTime.year, dateTime.month, dateTime.day);
|
|
|
|
_dateRecord = dateTime;
|
|
|
|
_clockInTime = dateTime;
|
|
|
|
_clockInTime = dateTime;
|
|
|
|
_clockStatus = WORKCLOCK.IN;
|
|
|
|
_clockStatus = WORKCLOCK.IN;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -108,14 +115,18 @@ class AppProvider extends ChangeNotifier {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
setClockOutTime(DateTime dateTime) {
|
|
|
|
setClockOutTime(DateTime dateTime) {
|
|
|
|
|
|
|
|
// if (_dateRecord != null &&
|
|
|
|
|
|
|
|
// (_dateRecord !=
|
|
|
|
|
|
|
|
// DateTime.utc(DateTime.now().year, DateTime.now().month,
|
|
|
|
|
|
|
|
// DateTime.now().day))) {
|
|
|
|
|
|
|
|
// resetClock();
|
|
|
|
|
|
|
|
// }
|
|
|
|
if (_dateRecord != null &&
|
|
|
|
if (_dateRecord != null &&
|
|
|
|
(_dateRecord !=
|
|
|
|
(!DateUtils.isSameDay(_dateRecord, DateTime.now()))) {
|
|
|
|
DateTime.utc(DateTime.now().year, DateTime.now().month,
|
|
|
|
|
|
|
|
DateTime.now().day))) {
|
|
|
|
|
|
|
|
resetClock();
|
|
|
|
resetClock();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (_clockStatus == WORKCLOCK.IN) {
|
|
|
|
if (_clockStatus == WORKCLOCK.IN) {
|
|
|
|
_dateRecord = DateTime.utc(dateTime.year, dateTime.month, dateTime.day);
|
|
|
|
_dateRecord = dateTime;
|
|
|
|
_clockOutTime = dateTime;
|
|
|
|
_clockOutTime = dateTime;
|
|
|
|
_clockStatus = WORKCLOCK.OUT;
|
|
|
|
_clockStatus = WORKCLOCK.OUT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|