Add run_template action
This commit is contained in:
parent
774cc158b1
commit
290224a4c9
|
|
@ -5,10 +5,13 @@ import 'package:built_value/serializer.dart';
|
|||
|
||||
// Project imports:
|
||||
import 'package:collection/collection.dart' show IterableExtension;
|
||||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
import 'package:invoiceninja_flutter/constants.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:invoiceninja_flutter/main_app.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/client/client_selectors.dart';
|
||||
import 'package:invoiceninja_flutter/redux/design/design_selectors.dart';
|
||||
import 'package:invoiceninja_flutter/utils/formatting.dart';
|
||||
import 'package:invoiceninja_flutter/utils/strings.dart';
|
||||
|
||||
|
|
@ -441,6 +444,14 @@ abstract class PaymentEntity extends Object
|
|||
}
|
||||
}
|
||||
|
||||
if (!isDeleted!) {
|
||||
final store = StoreProvider.of<AppState>(navigatorKey.currentContext!);
|
||||
if (hasDesignTemplatesForEntityType(
|
||||
store.state.designState.map, entityType)) {
|
||||
actions.add(EntityAction.runTemplate);
|
||||
}
|
||||
}
|
||||
|
||||
if (actions.isNotEmpty && actions.last != null) {
|
||||
actions.add(null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,10 +3,13 @@ import 'package:built_collection/built_collection.dart';
|
|||
import 'package:built_value/built_value.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
import 'package:diacritic/diacritic.dart';
|
||||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
|
||||
// Project imports:
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:invoiceninja_flutter/main_app.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/design/design_selectors.dart';
|
||||
import 'package:invoiceninja_flutter/utils/formatting.dart';
|
||||
import 'package:invoiceninja_flutter/utils/strings.dart';
|
||||
|
||||
|
|
@ -201,6 +204,14 @@ abstract class ProjectEntity extends Object
|
|||
actions.add(EntityAction.documents);
|
||||
}
|
||||
|
||||
if (!isDeleted!) {
|
||||
final store = StoreProvider.of<AppState>(navigatorKey.currentContext!);
|
||||
if (hasDesignTemplatesForEntityType(
|
||||
store.state.designState.map, entityType)) {
|
||||
actions.add(EntityAction.runTemplate);
|
||||
}
|
||||
}
|
||||
|
||||
if (actions.isNotEmpty && actions.last != null) {
|
||||
actions.add(null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import 'package:invoiceninja_flutter/constants.dart';
|
|||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:invoiceninja_flutter/main_app.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/design/design_selectors.dart';
|
||||
import 'package:invoiceninja_flutter/redux/task_status/task_status_selectors.dart';
|
||||
import 'package:invoiceninja_flutter/utils/formatting.dart';
|
||||
import 'package:invoiceninja_flutter/utils/strings.dart';
|
||||
|
|
@ -692,6 +693,14 @@ abstract class TaskEntity extends Object
|
|||
actions.add(EntityAction.documents);
|
||||
}
|
||||
|
||||
if (!isDeleted!) {
|
||||
final store = StoreProvider.of<AppState>(navigatorKey.currentContext!);
|
||||
if (hasDesignTemplatesForEntityType(
|
||||
store.state.designState.map, entityType)) {
|
||||
actions.add(EntityAction.runTemplate);
|
||||
}
|
||||
}
|
||||
|
||||
if (actions.isNotEmpty && actions.last != null) {
|
||||
actions.add(null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import 'dart:async';
|
|||
|
||||
// Flutter imports:
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
// Package imports:
|
||||
import 'package:built_collection/built_collection.dart';
|
||||
|
|
@ -15,6 +14,7 @@ import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
|
|||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/entities/entity_actions_dialog.dart';
|
||||
import 'package:invoiceninja_flutter/utils/completers.dart';
|
||||
import 'package:invoiceninja_flutter/utils/dialogs.dart';
|
||||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||
|
||||
class ViewPaymentList implements PersistUI {
|
||||
|
|
@ -411,5 +411,16 @@ void handlePaymentAction(
|
|||
entities: [payment],
|
||||
);
|
||||
break;
|
||||
case EntityAction.runTemplate:
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (context) => RunTemplateDialog(
|
||||
entityType: EntityType.payment,
|
||||
entities: payments,
|
||||
),
|
||||
);
|
||||
break;
|
||||
default:
|
||||
print('## Error: action $action not handled in client_actions');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import 'dart:async';
|
|||
|
||||
// Flutter imports:
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
// Package imports:
|
||||
import 'package:built_collection/built_collection.dart';
|
||||
|
|
@ -390,6 +389,15 @@ void handleProjectAction(
|
|||
);
|
||||
}
|
||||
break;
|
||||
case EntityAction.runTemplate:
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (context) => RunTemplateDialog(
|
||||
entityType: EntityType.project,
|
||||
entities: projects,
|
||||
),
|
||||
);
|
||||
break;
|
||||
default:
|
||||
print('## Error: action $action not handled in project_actions');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -543,6 +543,15 @@ void handleTaskAction(
|
|||
);
|
||||
}
|
||||
break;
|
||||
case EntityAction.runTemplate:
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (context) => RunTemplateDialog(
|
||||
entityType: EntityType.task,
|
||||
entities: tasks,
|
||||
),
|
||||
);
|
||||
break;
|
||||
default:
|
||||
print('## ERROR: unhandled action $action in task_actions');
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in New Issue