Add view action
This commit is contained in:
parent
6bca9c4913
commit
f15bed7f4c
|
|
@ -591,14 +591,14 @@ abstract class ClientEntity extends Object
|
|||
List<EntityAction> getActions(
|
||||
{UserCompanyEntity userCompany,
|
||||
ClientEntity client,
|
||||
bool includeView = false,
|
||||
bool includePreview = false,
|
||||
bool includeEdit = false,
|
||||
bool multiselect = false}) {
|
||||
final actions = <EntityAction>[];
|
||||
|
||||
if (!isDeleted && !multiselect) {
|
||||
if (includeView) {
|
||||
actions.add(EntityAction.view);
|
||||
if (includePreview) {
|
||||
actions.add(EntityAction.preview);
|
||||
}
|
||||
|
||||
if (includeEdit && userCompany.canEditEntity(this)) {
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ abstract class CompanyGatewayEntity extends Object
|
|||
{UserCompanyEntity userCompany,
|
||||
ClientEntity client,
|
||||
bool includeEdit = false,
|
||||
bool includeView = false,
|
||||
bool includePreview = false,
|
||||
bool multiselect = false}) {
|
||||
final actions = <EntityAction>[];
|
||||
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ abstract class DesignEntity extends Object
|
|||
{UserCompanyEntity userCompany,
|
||||
ClientEntity client,
|
||||
bool includeEdit = false,
|
||||
bool includeView = false,
|
||||
bool includePreview = false,
|
||||
bool multiselect = false}) {
|
||||
final actions = <EntityAction>[];
|
||||
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ abstract class DocumentEntity extends Object
|
|||
{UserCompanyEntity userCompany,
|
||||
ClientEntity client,
|
||||
bool includeEdit = false,
|
||||
bool includeView = false,
|
||||
bool includePreview = false,
|
||||
bool multiselect = false}) {
|
||||
final actions = <EntityAction>[];
|
||||
|
||||
|
|
|
|||
|
|
@ -399,7 +399,7 @@ abstract class BaseEntity implements SelectableEntity {
|
|||
{UserCompanyEntity userCompany,
|
||||
ClientEntity client,
|
||||
bool includeEdit = false,
|
||||
bool includeView = false,
|
||||
bool includePreview = false,
|
||||
bool multiselect = false}) {
|
||||
final actions = <EntityAction>[];
|
||||
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ abstract class ExpenseCategoryEntity extends Object
|
|||
{UserCompanyEntity userCompany,
|
||||
ClientEntity client,
|
||||
bool includeEdit = false,
|
||||
bool includeView = false,
|
||||
bool includePreview = false,
|
||||
bool multiselect = false}) {
|
||||
final actions = <EntityAction>[];
|
||||
|
||||
|
|
|
|||
|
|
@ -315,7 +315,7 @@ abstract class ExpenseEntity extends Object
|
|||
{UserCompanyEntity userCompany,
|
||||
ClientEntity client,
|
||||
bool includeEdit = false,
|
||||
bool includeView = false,
|
||||
bool includePreview = false,
|
||||
bool multiselect = false}) {
|
||||
final actions = <EntityAction>[];
|
||||
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ abstract class GatewayTokenEntity extends Object
|
|||
{UserCompanyEntity userCompany,
|
||||
ClientEntity client,
|
||||
bool includeEdit = false,
|
||||
bool includeView = false,
|
||||
bool includePreview = false,
|
||||
bool multiselect = false}) {
|
||||
final actions = <EntityAction>[];
|
||||
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ abstract class GroupEntity extends Object
|
|||
{UserCompanyEntity userCompany,
|
||||
ClientEntity client,
|
||||
bool includeEdit = false,
|
||||
bool includeView = false,
|
||||
bool includePreview = false,
|
||||
bool multiselect = false}) {
|
||||
final actions = <EntityAction>[];
|
||||
|
||||
|
|
|
|||
|
|
@ -754,7 +754,7 @@ abstract class InvoiceEntity extends Object
|
|||
{UserCompanyEntity userCompany,
|
||||
ClientEntity client,
|
||||
bool includeEdit = false,
|
||||
bool includeView = false,
|
||||
bool includePreview = false,
|
||||
bool multiselect = false}) {
|
||||
final actions = <EntityAction>[];
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class EntityAction extends EnumClass {
|
|||
|
||||
static Serializer<EntityAction> get serializer => _$entityActionSerializer;
|
||||
|
||||
static const EntityAction view = _$view;
|
||||
static const EntityAction preview = _$preview;
|
||||
static const EntityAction edit = _$edit;
|
||||
static const EntityAction archive = _$archive;
|
||||
static const EntityAction delete = _$delete;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ part of 'models.dart';
|
|||
// BuiltValueGenerator
|
||||
// **************************************************************************
|
||||
|
||||
const EntityAction _$view = const EntityAction._('view');
|
||||
const EntityAction _$preview = const EntityAction._('preview');
|
||||
const EntityAction _$edit = const EntityAction._('edit');
|
||||
const EntityAction _$archive = const EntityAction._('archive');
|
||||
const EntityAction _$delete = const EntityAction._('delete');
|
||||
|
|
@ -70,8 +70,8 @@ const EntityAction _$resendInvite = const EntityAction._('resendInvite');
|
|||
|
||||
EntityAction _$valueOf(String name) {
|
||||
switch (name) {
|
||||
case 'view':
|
||||
return _$view;
|
||||
case 'preview':
|
||||
return _$preview;
|
||||
case 'edit':
|
||||
return _$edit;
|
||||
case 'archive':
|
||||
|
|
@ -185,7 +185,7 @@ EntityAction _$valueOf(String name) {
|
|||
|
||||
final BuiltSet<EntityAction> _$values =
|
||||
new BuiltSet<EntityAction>(const <EntityAction>[
|
||||
_$view,
|
||||
_$preview,
|
||||
_$edit,
|
||||
_$archive,
|
||||
_$delete,
|
||||
|
|
|
|||
|
|
@ -380,7 +380,7 @@ abstract class PaymentEntity extends Object
|
|||
{UserCompanyEntity userCompany,
|
||||
ClientEntity client,
|
||||
bool includeEdit = false,
|
||||
bool includeView = false,
|
||||
bool includePreview = false,
|
||||
bool multiselect = false}) {
|
||||
final actions = <EntityAction>[];
|
||||
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ abstract class ProductEntity extends Object
|
|||
{UserCompanyEntity userCompany,
|
||||
ClientEntity client,
|
||||
bool includeEdit = false,
|
||||
bool includeView = false,
|
||||
bool includePreview = false,
|
||||
bool multiselect = false}) {
|
||||
final actions = <EntityAction>[];
|
||||
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ abstract class ProjectEntity extends Object
|
|||
{UserCompanyEntity userCompany,
|
||||
ClientEntity client,
|
||||
bool includeEdit = false,
|
||||
bool includeView = false,
|
||||
bool includePreview = false,
|
||||
bool multiselect = false}) {
|
||||
final actions = <EntityAction>[];
|
||||
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ abstract class SubscriptionEntity extends Object
|
|||
{UserCompanyEntity userCompany,
|
||||
ClientEntity client,
|
||||
bool includeEdit = false,
|
||||
bool includeView = false,
|
||||
bool includePreview = false,
|
||||
bool multiselect = false}) {
|
||||
final actions = <EntityAction>[];
|
||||
|
||||
|
|
|
|||
|
|
@ -542,7 +542,7 @@ abstract class TaskEntity extends Object
|
|||
{UserCompanyEntity userCompany,
|
||||
ClientEntity client,
|
||||
bool includeEdit = false,
|
||||
bool includeView = false,
|
||||
bool includePreview = false,
|
||||
bool multiselect = false}) {
|
||||
final actions = <EntityAction>[];
|
||||
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ abstract class TaskStatusEntity extends Object
|
|||
{UserCompanyEntity userCompany,
|
||||
ClientEntity client,
|
||||
bool includeEdit = false,
|
||||
bool includeView = false,
|
||||
bool includePreview = false,
|
||||
bool multiselect = false}) {
|
||||
final actions = <EntityAction>[];
|
||||
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ abstract class TaxRateEntity extends Object
|
|||
{UserCompanyEntity userCompany,
|
||||
ClientEntity client,
|
||||
bool includeEdit = false,
|
||||
bool includeView = false,
|
||||
bool includePreview = false,
|
||||
bool multiselect = false}) {
|
||||
final actions = <EntityAction>[];
|
||||
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ abstract class TokenEntity extends Object
|
|||
{UserCompanyEntity userCompany,
|
||||
ClientEntity client,
|
||||
bool includeEdit = false,
|
||||
bool includeView = false,
|
||||
bool includePreview = false,
|
||||
bool multiselect = false}) {
|
||||
final actions = <EntityAction>[];
|
||||
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ abstract class UserEntity extends Object
|
|||
{UserCompanyEntity userCompany,
|
||||
ClientEntity client,
|
||||
bool includeEdit = false,
|
||||
bool includeView = false,
|
||||
bool includePreview = false,
|
||||
bool multiselect = false}) {
|
||||
final actions = <EntityAction>[];
|
||||
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ abstract class VendorEntity extends Object
|
|||
{UserCompanyEntity userCompany,
|
||||
ClientEntity client,
|
||||
bool includeEdit = false,
|
||||
bool includeView = false,
|
||||
bool includePreview = false,
|
||||
bool multiselect = false}) {
|
||||
final actions = <EntityAction>[];
|
||||
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ abstract class WebhookEntity extends Object
|
|||
{UserCompanyEntity userCompany,
|
||||
ClientEntity client,
|
||||
bool includeEdit = false,
|
||||
bool includeView = false,
|
||||
bool includePreview = false,
|
||||
bool multiselect = false}) {
|
||||
final actions = <EntityAction>[];
|
||||
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ void handleClientAction(
|
|||
case EntityAction.edit:
|
||||
editEntity(context: context, entity: client);
|
||||
break;
|
||||
case EntityAction.view:
|
||||
case EntityAction.preview:
|
||||
store.dispatch(UpdateUserPreferences(isPreviewEnabled: true));
|
||||
viewEntity(entity: client);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -431,7 +431,7 @@ Future handleCreditAction(
|
|||
case EntityAction.edit:
|
||||
editEntity(context: context, entity: credit);
|
||||
break;
|
||||
case EntityAction.view:
|
||||
case EntityAction.preview:
|
||||
store.dispatch(UpdateUserPreferences(isPreviewEnabled: true));
|
||||
viewEntity(entity: credit);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ void handleExpenseAction(
|
|||
case EntityAction.edit:
|
||||
editEntity(context: context, entity: expense);
|
||||
break;
|
||||
case EntityAction.view:
|
||||
case EntityAction.preview:
|
||||
store.dispatch(UpdateUserPreferences(isPreviewEnabled: true));
|
||||
viewEntity(entity: expense);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -520,7 +520,7 @@ void handleInvoiceAction(BuildContext context, List<BaseEntity> invoices,
|
|||
case EntityAction.edit:
|
||||
editEntity(context: context, entity: invoice);
|
||||
break;
|
||||
case EntityAction.view:
|
||||
case EntityAction.preview:
|
||||
store.dispatch(UpdateUserPreferences(isPreviewEnabled: true));
|
||||
viewEntity(entity: invoice);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -320,7 +320,7 @@ void handlePaymentAction(
|
|||
case EntityAction.edit:
|
||||
editEntity(context: context, entity: payment);
|
||||
break;
|
||||
case EntityAction.view:
|
||||
case EntityAction.preview:
|
||||
store.dispatch(UpdateUserPreferences(isPreviewEnabled: true));
|
||||
viewEntity(entity: payment);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ void handleProductAction(
|
|||
case EntityAction.edit:
|
||||
editEntity(context: context, entity: product);
|
||||
break;
|
||||
case EntityAction.view:
|
||||
case EntityAction.preview:
|
||||
store.dispatch(UpdateUserPreferences(isPreviewEnabled: true));
|
||||
viewEntity(entity: product);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ void handleProjectAction(
|
|||
case EntityAction.edit:
|
||||
editEntity(context: context, entity: project);
|
||||
break;
|
||||
case EntityAction.view:
|
||||
case EntityAction.preview:
|
||||
store.dispatch(UpdateUserPreferences(isPreviewEnabled: true));
|
||||
viewEntity(entity: project);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -450,7 +450,7 @@ Future handleQuoteAction(
|
|||
case EntityAction.edit:
|
||||
editEntity(context: context, entity: quote);
|
||||
break;
|
||||
case EntityAction.view:
|
||||
case EntityAction.preview:
|
||||
store.dispatch(UpdateUserPreferences(isPreviewEnabled: true));
|
||||
viewEntity(entity: quote);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -347,7 +347,7 @@ void handleRecurringExpenseAction(BuildContext context,
|
|||
case EntityAction.edit:
|
||||
editEntity(context: context, entity: recurringExpense);
|
||||
break;
|
||||
case EntityAction.view:
|
||||
case EntityAction.preview:
|
||||
store.dispatch(UpdateUserPreferences(isPreviewEnabled: true));
|
||||
viewEntity(entity: recurringExpense);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -438,7 +438,7 @@ void handleRecurringInvoiceAction(BuildContext context,
|
|||
case EntityAction.edit:
|
||||
editEntity(context: context, entity: recurringInvoice);
|
||||
break;
|
||||
case EntityAction.view:
|
||||
case EntityAction.preview:
|
||||
store.dispatch(UpdateUserPreferences(isPreviewEnabled: true));
|
||||
viewEntity(entity: recurringInvoice);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -317,7 +317,7 @@ void handleTaskAction(
|
|||
case EntityAction.edit:
|
||||
editEntity(context: context, entity: task);
|
||||
break;
|
||||
case EntityAction.view:
|
||||
case EntityAction.preview:
|
||||
store.dispatch(UpdateUserPreferences(isPreviewEnabled: true));
|
||||
viewEntity(entity: task);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ void handleVendorAction(
|
|||
case EntityAction.edit:
|
||||
editEntity(context: context, entity: vendor);
|
||||
break;
|
||||
case EntityAction.view:
|
||||
case EntityAction.preview:
|
||||
store.dispatch(UpdateUserPreferences(isPreviewEnabled: true));
|
||||
viewEntity(entity: vendor);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ class EntityDataTableSource extends AppDataTableSource {
|
|||
entityActions: entity.getActions(
|
||||
userCompany: state.userCompany,
|
||||
includeEdit: true,
|
||||
includeView: !state.prefState.isPreviewEnabled,
|
||||
includePreview: !state.prefState.isPreviewEnabled,
|
||||
client: entity is BelongsToClient
|
||||
? state.clientState
|
||||
.map[(entity as BelongsToClient)?.clientId]
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import 'package:invoiceninja_flutter/data/models/system_log_model.dart';
|
|||
|
||||
IconData getEntityActionIcon(EntityAction entityAction) {
|
||||
switch (entityAction) {
|
||||
case EntityAction.view:
|
||||
case EntityAction.preview:
|
||||
return Icons.chrome_reader_mode;
|
||||
case EntityAction.edit:
|
||||
return Icons.edit;
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ void handleStubAction(
|
|||
case EntityAction.edit:
|
||||
editEntity(context: context, entity: stub);
|
||||
break;
|
||||
case EntityAction.view:
|
||||
case EntityAction.preview:
|
||||
store.dispatch(UpdateUserPreferences(isPreviewEnabled: true));
|
||||
viewEntity(entity: stub);
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in New Issue