diff --git a/Koha/Plugin/Acquire/Controllers/FundManagement/FundAllocations.pm b/Koha/Plugin/Acquire/Controllers/FundManagement/FundAllocations.pm index cc2dea0..c3e034f 100644 --- a/Koha/Plugin/Acquire/Controllers/FundManagement/FundAllocations.pm +++ b/Koha/Plugin/Acquire/Controllers/FundManagement/FundAllocations.pm @@ -48,7 +48,17 @@ sub list { my $filtered_fund_allocations = Koha::Plugin::Acquire::Controllers::ControllerUtils->filter_data_by_group( { dataset => $fund_allocations } ); - return $c->render( status => 200, openapi => $fund_allocations ); + my @sorted_allocations = + sort { $a->{fund_allocation_id} cmp $b->{fund_allocation_id} } @{$filtered_fund_allocations}; + my $total = 0; + foreach my $allocation_index ( 1 .. scalar(@sorted_allocations) ) { + my $allocation = $sorted_allocations[ $allocation_index - 1 ]; + $allocation->{allocation_index} = $allocation_index; + $total += $allocation->{allocation_amount}; + $allocation->{new_fund_value} = $total; + } + + return $c->render( status => 200, openapi => \@sorted_allocations ); } catch { $c->unhandled_exception($_); }; diff --git a/src/components/DisplayDataFields.vue b/src/components/DisplayDataFields.vue index 2e3012b..b264f07 100644 --- a/src/components/DisplayDataFields.vue +++ b/src/components/DisplayDataFields.vue @@ -9,7 +9,7 @@ /> -
+
{ if(params.fund_allocation_id) { - this.getFundAllocation() + this.getFundAllocation(params.fund_allocation_id) } this.initialized = true }) }, - async getFundAllocation(fund_id) { + async getFundAllocation(fund_allocation_id) { const client = APIClient.acquisition - await client.funds.get(fund_id).then(fund_allocations => { - this.fund_allocations = fund_allocations + await client.fund_allocations.get(fund_allocation_id).then(fund_allocation => { + this.fund_allocation = fund_allocation }) }, async getFunds(params) { diff --git a/src/components/FundManagement/FundShow.vue b/src/components/FundManagement/FundShow.vue index d157633..2bd49be 100644 --- a/src/components/FundManagement/FundShow.vue +++ b/src/components/FundManagement/FundShow.vue @@ -27,16 +27,30 @@ :data="fund" homeRoute="FundList" dataType="fund" + :showClose="false" /> +
+
+

Fund allocations

+ +
+
@@ -110,4 +219,7 @@ export default { font-size: 11px; cursor: pointer; } +#fund_allocations { + margin-top: 2em; +} \ No newline at end of file diff --git a/src/routes/routes.js b/src/routes/routes.js index 9a3ded1..87e251b 100644 --- a/src/routes/routes.js +++ b/src/routes/routes.js @@ -46,7 +46,7 @@ export const routes = [ }, { path: "fiscal_year", - title: "Fiscal year", + title: "Fiscal years", is_navigation_item: false, children: [ { @@ -81,7 +81,7 @@ export const routes = [ }, { path: "ledger", - title: "Ledger", + title: "Ledgers", is_navigation_item: false, children: [ { @@ -116,7 +116,7 @@ export const routes = [ }, { path: "fund", - title: "Fund", + title: "Funds", is_navigation_item: false, children: [ {