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