Skip to content

Commit

Permalink
PR requests, needs rebasing when other PR is done
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter York committed Sep 30, 2024
1 parent ccf2c2e commit b3682bc
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 75 deletions.
49 changes: 10 additions & 39 deletions src/routes/planning/report/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,48 +1,19 @@
<script lang="ts">
import { state } from "../data";
import { criteria } from "../lists";
import Report from "./Report.svelte";
import { DefaultButton } from "govuk-svelte";
import { base } from "$app/paths";
function openReportInNewTab() {
window.open(`${base}/planning/report/printable`, '_blank').focus();
}
function openReportInNewTab() {
window.open(`${base}/planning/report/printable`, "_blank");
}
</script>

<div class="govuk-width-container">
<Report>
<div>
<p>The export to PDF button will open a new tab. Right-click the page and select 'Print'. Then you can export to PDF.</p>
<p>
The export to PDF button will open a new tab. Right-click the page and
select 'Print'. Then you can export to PDF.
</p>
<DefaultButton on:click={openReportInNewTab}>Export to PDF</DefaultButton>
</div>
<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>
</Report>
45 changes: 45 additions & 0 deletions src/routes/planning/report/Report.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<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">
<slot />
<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>
38 changes: 2 additions & 36 deletions src/routes/planning/report/printable/+page@.svelte
Original file line number Diff line number Diff line change
@@ -1,38 +1,4 @@
<script lang="ts">
import { state } from "../../data";
import { criteria } from "../../lists";
import Report from "../Report.svelte";
</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>
<Report/>

0 comments on commit b3682bc

Please sign in to comment.