Skip to content

Commit

Permalink
Initial pass at printable report
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter York committed Sep 26, 2024
1 parent 4af165c commit 4518de3
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/routes/planning/report/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
<script lang="ts">
import { state } from "../data";
import { criteria } from "../lists";
import { DefaultButton } from "govuk-svelte";
import { base } from "$app/paths";
function openReportInNewTab() {
window.open(`${base}/planning/report/printable`, '_blank').focus();
}
</script>

<div class="govuk-width-container">
<div>
<DefaultButton on:click={openReportInNewTab}>Export to PDF</DefaultButton>
<p>This button will open a new tab where you should right-click, "print", and print/export to PDF.</p>
</div>
<table>
<caption class="govuk-table__caption govuk-table__caption--m">
Application details
Expand Down
38 changes: 38 additions & 0 deletions src/routes/planning/report/printable/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<script lang="ts">
import { state } from "../../data";
import { criteria } from "../../lists";
</script>

<div class="govuk-width-container">
<table>
<caption class="govuk-table__caption govuk-table__caption--m">
Application details
</caption>
{#each [["Site address", $state.summary.siteAddress], ["Local authority reference", $state.summary.localAuthorityReference], ["ATE reference", $state.summary.ateReference], ["Local planning authority", $state.summary.localPlanningAuthority], ["Local highway authority", $state.summary.localHighwayAuthority], ["Completed by", $state.summary.completedBy], ["Date", $state.summary.date], ["Application type", $state.summary.applicationType], ["Summary of proposal", $state.summary.proposalSummary]] as [key, value]}
<tr>
<th>{key}</th>
<td>{value}</td>
</tr>
{/each}
</table>

<table>
<caption class="govuk-table__caption govuk-table__caption--m">
Assessment report
</caption>
<tr>
<th>Criterion</th>
<th>Rating</th>
<th>Appraiser Comments</th>
<th>Relevant Policy & Guidance</th>
</tr>
{#each criteria as criterion, idx}
<tr>
<td>{idx + 1}. {criterion}</td>
<td>{$state.ratings[idx]}</td>
<td>{$state.appraiserComments[idx]}</td>
<td>{$state.localGuidance[idx]}</td>
</tr>
{/each}
</table>
</div>

0 comments on commit 4518de3

Please sign in to comment.