Budget views

Erwan Rouchet
2025-03-04T16:52:48Z

https://redmine.teklia.com/issues/10050

Requires enterprise#46, enterprise#47, enterprise#48

In src/types/rights.ts, the MembershipContentTypeParameters needs to be updated to support the new budget query parameter on ListMemberships.

A new useBudgetStore Pinia store provides the list, get and listEntries action, corresponding to the ListBudgets, RetrieveBudget and ListBudgetEntries APIs.

The API bindings should be in src/api/budget.ts, and should be re-exported from api/index.ts.

The type definitions should be in src/types/budget.ts.

A new view src/views/Budget/List.vue at /budget lists the budgets that the user has access to.

This view requires the enterprise feature flag and a verified email.

The usual paginated table shows the name, with a clickable link to the budget details view, as well as the current total.

A new, very smol component src/components/Budget/Value.vue shows a BudgetEntry.value decimal in a simple , followed by €. When the value is negative, it should be in red.

A new view src/views/Budget/Details.vue at /budget/:id allows viewing the details of a budget and its entries.

This view requires the enterprise feature flag and a verified email.

A shows the budget name, with an ItemId as the subtitle.

A single read-only field shows the current total using the Value component.

Nothing is editable since there is no API to edit a budget.

A paragraph can state "To edit a budget, please contact an instance administrator."

If the user is an admin, "To edit a budget, use the administration interface" with a link to /admin/budget_enterprise/budget/${id}/change/.

Just like on the worker details view, a ← Budgets button allows users to go back to the budgets list.

A paginated table shows the budget entries, with the following columns:

Date, using the ago helper;

Description;

User: the user email, or &mdash; when there is none;

Process: a link to the process details view, or &mdash; when there is no process ID;

Amount: value of the entry using the Value component.

Under the user menu on the top-right corner, a new Budgets button leads to the /budget view. It is only shown when the enterprise feature flag is set.