Not able to create invoice for project in sidebar filter

This commit is contained in:
Hillel Coren 2022-09-05 15:00:22 +03:00
parent 34d6281666
commit d71c333f8f
3 changed files with 10 additions and 1 deletions

View File

@ -272,6 +272,12 @@ void handleProjectAction(
..projectId = project.id ..projectId = project.id
..clientId = project.clientId)); ..clientId = project.clientId));
break; break;
case EntityAction.newInvoice:
createEntity(
context: context,
entity: InvoiceEntity(state: state, client: client)
.rebuild((b) => b..projectId = project.id));
break;
case EntityAction.invoiceProject: case EntityAction.invoiceProject:
String lastClientId = ''; String lastClientId = '';
bool hasMultipleClients = false; bool hasMultipleClients = false;
@ -373,6 +379,8 @@ void handleProjectAction(
), ),
); );
break; break;
default:
print('## Error: action $action not handled in project_actions');
} }
} }

View File

@ -181,10 +181,12 @@ class _EntitiesListTileState extends State<EntitiesListTile> {
final store = StoreProvider.of<AppState>(context); final store = StoreProvider.of<AppState>(context);
final uiState = store.state.uiState; final uiState = store.state.uiState;
final entity = widget.entity; final entity = widget.entity;
if (uiState.filterEntityId != entity.id || if (uiState.filterEntityId != entity.id ||
uiState.filterEntityType != entity.entityType) { uiState.filterEntityType != entity.entityType) {
store.dispatch(FilterByEntity(entity: entity)); store.dispatch(FilterByEntity(entity: entity));
} }
handleEntityAction(entity, EntityAction.newEntityType(widget.entityType)); handleEntityAction(entity, EntityAction.newEntityType(widget.entityType));
} }

View File

@ -148,7 +148,6 @@ class _ProjectOverviewState extends State<ProjectOverview> {
subtitle: memoizedInvoiceStatsForProject( subtitle: memoizedInvoiceStatsForProject(
project.id, state.invoiceState.map) project.id, state.invoiceState.map)
.present(localization.active, localization.archived), .present(localization.active, localization.archived),
hideNew: true,
), ),
]; ];