-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1279 from DFE-Digital/feature/148313-build-transf…
…ers-export-journey (148313) Transfers export journey for Grant management and finance team
- Loading branch information
Showing
16 changed files
with
339 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...controllers/all/export/grant_management_and_finance_unit/transfers/projects_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
class All::Export::GrantManagementAndFinanceUnit::Transfers::ProjectsController < ApplicationController | ||
def index | ||
authorize Project, :index? | ||
|
||
@data = export_months.map do |month| | ||
{ | ||
month: month, | ||
count: ProjectsForExportService.new.grant_management_and_finance_unit_transfer_projects(month: month.month, year: month.year).count | ||
} | ||
end | ||
end | ||
|
||
def show | ||
authorize Project, :show? | ||
@month = Date.new(year, month) | ||
end | ||
|
||
def csv | ||
authorize Project, :index? | ||
|
||
projects = ProjectsForExportService.new.grant_management_and_finance_unit_transfer_projects(month: month, year: year) | ||
csv = Export::Transfers::GrantManagementAndFinanceUnitCsvExportService.new(projects).call | ||
|
||
send_data csv, filename: "#{year}-#{month}_grant_management_and_finance_unit_transfers_export.csv", type: :csv, disposition: "attachment" | ||
end | ||
|
||
private def month | ||
params[:month].to_i | ||
end | ||
|
||
private def year | ||
params[:year].to_i | ||
end | ||
|
||
private def export_months | ||
12.times.map do |index| | ||
Date.today.at_beginning_of_month - index.months | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
app/views/all/export/grant_management_and_finance_unit/conversions/projects/show.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<% content_for :primary_navigation do %> | ||
<%= render partial: "shared/navigation/all_projects_primary_navigation" %> | ||
<% end %> | ||
|
||
<% content_for :page_title do %> | ||
<%= page_title(t("export.grant_management_and_finance_unit.conversions.show.title", date: @month.to_fs(:govuk_month))) %> | ||
<% end %> | ||
|
||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
<%= govuk_back_link(href: all_export_grant_management_and_finance_unit_conversions_projects_path) %> | ||
<h1 class="govuk-heading-l"><%= t("export.grant_management_and_finance_unit.conversions.show.title", date: @month.to_fs(:govuk_month)) %></h1> | ||
<%= t("export.grant_management_and_finance_unit.conversions.show.body_html") %> | ||
<div class="govuk-form-group"> | ||
<%= govuk_button_link_to t("export.funding_agreement_letters.show.button"), "/projects/all/export/grant-management-and-finance-unit/conversions/#{@month.month}/#{@month.year}/csv" %> | ||
</div> | ||
</div> | ||
</div> |
49 changes: 49 additions & 0 deletions
49
app/views/all/export/grant_management_and_finance_unit/transfers/projects/index.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<% content_for :primary_navigation do %> | ||
<%= render partial: "shared/navigation/all_projects_primary_navigation" %> | ||
<% end %> | ||
|
||
<% content_for :page_title do %> | ||
<%= page_title(t("export.grant_management_and_finance_unit.transfers.index.title")) %> | ||
<% end %> | ||
|
||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-full"> | ||
|
||
<h1 class="govuk-heading-l"> | ||
<%= t("export.grant_management_and_finance_unit.transfers.index.title") %> | ||
</h1> | ||
<p><%= t("export.grant_management_and_finance_unit.transfers.index.body") %></p> | ||
|
||
<nav class="moj-sub-navigation" aria-label="Project index sub-navigation"> | ||
<ul class="moj-sub-navigation__list"> | ||
<%= render partial: "shared/sub_navigation_item", | ||
locals: {name: t("subnavigation.conversions"), | ||
path: all_export_grant_management_and_finance_unit_conversions_projects_path} %> | ||
<%= render partial: "shared/sub_navigation_item", | ||
locals: {name: t("subnavigation.transfers"), | ||
path: all_export_grant_management_and_finance_unit_transfers_projects_path} %> | ||
</ul> | ||
</nav> | ||
|
||
<table class="govuk-table" name="projects_table" aria-label="Grant management and finance unit exports"> | ||
<thead class="govuk-table__head"> | ||
<tr class="govuk-table__row"> | ||
<th class="govuk-table__header" scope="col"><%= t("project.table.headers.date") %></th> | ||
<th class="govuk-table__header" scope="col"><%= t("project.table.headers.number_of_transfers") %></th> | ||
<th class="govuk-table__header" scope="col"><%= t("project.table.headers.export") %></th> | ||
</tr> | ||
</thead> | ||
<tbody class="govuk-table__body"> | ||
<% @data.each do |month| %> | ||
<tr class="govuk-table__row" id="<%= month[:month].to_fs(:govuk_month).tr(" ", "_") %>"> | ||
<td class="govuk-table__header govuk-table__cell"><%= month[:month].to_fs(:govuk_month) %></td> | ||
<td class="govuk-table__cell"><%= month[:count] %></td> | ||
<td class="govuk-table__cell"> | ||
<%= link_to t("project.table.body.export_for_html", date: month[:month].to_fs(:govuk_month)), show_all_export_grant_management_and_finance_unit_transfers_projects_path(month[:month].month, month[:month].year) %> | ||
</td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> |
18 changes: 18 additions & 0 deletions
18
app/views/all/export/grant_management_and_finance_unit/transfers/projects/show.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<% content_for :primary_navigation do %> | ||
<%= render partial: "shared/navigation/all_projects_primary_navigation" %> | ||
<% end %> | ||
|
||
<% content_for :page_title do %> | ||
<%= page_title(t("export.grant_management_and_finance_unit.transfers.show.title", date: @month.to_fs(:govuk_month))) %> | ||
<% end %> | ||
|
||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
<%= govuk_back_link(href: all_export_grant_management_and_finance_unit_transfers_projects_path) %> | ||
<h1 class="govuk-heading-l"><%= t("export.grant_management_and_finance_unit.transfers.show.title", date: @month.to_fs(:govuk_month)) %></h1> | ||
<%= t("export.grant_management_and_finance_unit.transfers.show.body_html") %> | ||
<div class="govuk-form-group"> | ||
<%= govuk_button_link_to t("export.funding_agreement_letters.show.button"), "/projects/all/export/grant-management-and-finance-unit/transfers/#{@month.month}/#{@month.year}/csv" %> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.