Tasks
This commit is contained in:
parent
670aec8d91
commit
7f41420774
|
|
@ -52,6 +52,7 @@ class EntityAction extends EnumClass {
|
||||||
static const EntityAction pdf = _$pdf;
|
static const EntityAction pdf = _$pdf;
|
||||||
static const EntityAction more = _$more;
|
static const EntityAction more = _$more;
|
||||||
static const EntityAction start = _$start;
|
static const EntityAction start = _$start;
|
||||||
|
static const EntityAction resume = _$resume;
|
||||||
static const EntityAction stop = _$stop;
|
static const EntityAction stop = _$stop;
|
||||||
|
|
||||||
static BuiltSet<EntityAction> get values => _$values;
|
static BuiltSet<EntityAction> get values => _$values;
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ const EntityAction _$enterPayment = const EntityAction._('enterPayment');
|
||||||
const EntityAction _$pdf = const EntityAction._('pdf');
|
const EntityAction _$pdf = const EntityAction._('pdf');
|
||||||
const EntityAction _$more = const EntityAction._('more');
|
const EntityAction _$more = const EntityAction._('more');
|
||||||
const EntityAction _$start = const EntityAction._('start');
|
const EntityAction _$start = const EntityAction._('start');
|
||||||
|
const EntityAction _$resume = const EntityAction._('resume');
|
||||||
const EntityAction _$stop = const EntityAction._('stop');
|
const EntityAction _$stop = const EntityAction._('stop');
|
||||||
|
|
||||||
EntityAction _$valueOf(String name) {
|
EntityAction _$valueOf(String name) {
|
||||||
|
|
@ -74,6 +75,8 @@ EntityAction _$valueOf(String name) {
|
||||||
return _$more;
|
return _$more;
|
||||||
case 'start':
|
case 'start':
|
||||||
return _$start;
|
return _$start;
|
||||||
|
case 'resume':
|
||||||
|
return _$resume;
|
||||||
case 'stop':
|
case 'stop':
|
||||||
return _$stop;
|
return _$stop;
|
||||||
default:
|
default:
|
||||||
|
|
@ -100,6 +103,7 @@ final BuiltSet<EntityAction> _$values =
|
||||||
_$pdf,
|
_$pdf,
|
||||||
_$more,
|
_$more,
|
||||||
_$start,
|
_$start,
|
||||||
|
_$resume,
|
||||||
_$stop,
|
_$stop,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -289,9 +289,16 @@ abstract class TaskEntity extends Object
|
||||||
|
|
||||||
if (isRunning) {
|
if (isRunning) {
|
||||||
actions.add(EntityAction.stop);
|
actions.add(EntityAction.stop);
|
||||||
|
} else {
|
||||||
|
if (!isInvoiced) {
|
||||||
|
actions.add(EntityAction.newInvoice);
|
||||||
|
}
|
||||||
|
if (duration > 0) {
|
||||||
|
actions.add(EntityAction.resume);
|
||||||
} else {
|
} else {
|
||||||
actions.add(EntityAction.start);
|
actions.add(EntityAction.start);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return actions..addAll(getBaseActions(user: user));
|
return actions..addAll(getBaseActions(user: user));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,7 @@ class TaskListVM {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case EntityAction.start:
|
case EntityAction.start:
|
||||||
case EntityAction.stop:
|
case EntityAction.stop:
|
||||||
|
case EntityAction.resume:
|
||||||
final Completer<TaskEntity> completer = new Completer<TaskEntity>();
|
final Completer<TaskEntity> completer = new Completer<TaskEntity>();
|
||||||
final localization = AppLocalization.of(context);
|
final localization = AppLocalization.of(context);
|
||||||
store.dispatch(
|
store.dispatch(
|
||||||
|
|
|
||||||
|
|
@ -154,6 +154,7 @@ class TaskViewVM {
|
||||||
onActionSelected: (BuildContext context, EntityAction action) {
|
onActionSelected: (BuildContext context, EntityAction action) {
|
||||||
final localization = AppLocalization.of(context);
|
final localization = AppLocalization.of(context);
|
||||||
switch (action) {
|
switch (action) {
|
||||||
|
case EntityAction.resume:
|
||||||
case EntityAction.start:
|
case EntityAction.start:
|
||||||
case EntityAction.stop:
|
case EntityAction.stop:
|
||||||
_toggleTask(context);
|
_toggleTask(context);
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ IconData getEntityActionIcon(EntityAction entityAction) {
|
||||||
case EntityAction.newInvoice:
|
case EntityAction.newInvoice:
|
||||||
case EntityAction.enterPayment:
|
case EntityAction.enterPayment:
|
||||||
return Icons.add_circle_outline;
|
return Icons.add_circle_outline;
|
||||||
|
case EntityAction.resume:
|
||||||
case EntityAction.start:
|
case EntityAction.start:
|
||||||
return Icons.play_arrow;
|
return Icons.play_arrow;
|
||||||
case EntityAction.stop:
|
case EntityAction.stop:
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ class AppLocalization {
|
||||||
|
|
||||||
static final Map<String, Map<String, String>> _localizedValues = {
|
static final Map<String, Map<String, String>> _localizedValues = {
|
||||||
'en': {
|
'en': {
|
||||||
|
'resume': 'Resume',
|
||||||
'task_errors': 'Please correct any overlapping times',
|
'task_errors': 'Please correct any overlapping times',
|
||||||
'start': 'Start',
|
'start': 'Start',
|
||||||
'stop': 'Stop',
|
'stop': 'Stop',
|
||||||
|
|
@ -10717,6 +10718,9 @@ class AppLocalization {
|
||||||
String get taskErrors =>
|
String get taskErrors =>
|
||||||
_localizedValues[locale.toString()]['task_errors'];
|
_localizedValues[locale.toString()]['task_errors'];
|
||||||
|
|
||||||
|
String get resume =>
|
||||||
|
_localizedValues[locale.toString()]['resume'];
|
||||||
|
|
||||||
|
|
||||||
String lookup(String key) {
|
String lookup(String key) {
|
||||||
final lookupKey = toSnakeCase(key);
|
final lookupKey = toSnakeCase(key);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue