Skip to content

Commit

Permalink
initial combination of subschemes with new forms
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter York committed Nov 3, 2023
1 parent 7a741d9 commit 68bcb74
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 29 deletions.
6 changes: 4 additions & 2 deletions src/lib/sidebar/EntireSubscheme.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
} from "lib/govuk";
import { gjScheme, mode } from "stores";
import { onMount } from "svelte";
import type { FeatureUnion, Scheme, Subscheme } from "types";
import type { FeatureUnion, Scheme, PipelineScheme } from "types";
import ListedIntervention from "./ListedIntervention.svelte";
import { interventionWarning } from "./scheme_data";
import PipelineSchemeForm from "./PipelineSchemeForm.svelte";
export let subscheme: Subscheme;
export let subscheme: PipelineScheme;
export let superscheme: Scheme;
export let getSubschemeNameUpdater: Function;
Expand Down Expand Up @@ -57,6 +58,7 @@
value={subscheme.name}
on:change={getSubschemeNameUpdater(subscheme.name)}
/>
<PipelineSchemeForm {subscheme}/>
<WarningButton
disabled={disabledSubschemeDeletion}
on:click={() => (displayDeleteConfirmation = true)}
Expand Down
39 changes: 13 additions & 26 deletions src/lib/sidebar/PipelineSchemeForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,10 @@
TextArea,
} from "lib/govuk";
import { gjScheme } from "stores";
import type { PipelineScheme } from "types";
import ATF4Type from "../forms/ATF4Type.svelte";
$gjScheme.pipeline ||= {
scheme_type: "",
status: "",
timescale: "",
atf4_lead_type: "",
scheme_description: "",
funding_source: "",
funded: false,
};
// Guaranteed to exist
let pipelineProps = $gjScheme.pipeline;
export let subscheme: PipelineScheme;
let showModal = false;
Expand All @@ -45,13 +36,13 @@
]}
inlineSmall
required
bind:value={pipelineProps.scheme_type}
bind:value={subscheme.scheme_type}
/>

<ATF4Type
label="Type of the main intervention"
id="atf4-lead-type"
bind:value={pipelineProps.atf4_lead_type}
bind:value={subscheme.atf4_lead_type}
/>

<fieldset class="govuk-fieldset">
Expand All @@ -68,7 +59,7 @@
]}
inlineSmall
required
bind:value={pipelineProps.status}
bind:value={subscheme.status}
/>

<Radio
Expand All @@ -81,7 +72,7 @@
]}
inlineSmall
required
bind:value={pipelineProps.timescale}
bind:value={subscheme.timescale}
/>
<div>
<label>
Expand All @@ -90,15 +81,15 @@
type="number"
min="2023"
max="2100"
bind:value={pipelineProps.timescale_year}
bind:value={subscheme.timescale_year}
/>
</label>
</div>
</fieldset>

<TextArea
label="Scheme description"
bind:value={pipelineProps.scheme_description}
bind:value={subscheme.scheme_description}
/>

<fieldset class="govuk-fieldset">
Expand All @@ -107,17 +98,13 @@
<div>
<label>
GBP funded
<input type="number" min="0" bind:value={pipelineProps.budget_funded} />
<input type="number" min="0" bind:value={subscheme.budget_funded} />
</label>
</div>
<div>
<label>
GBP unfunded
<input
type="number"
min="0"
bind:value={pipelineProps.budget_unfunded}
/>
<input type="number" min="0" bind:value={subscheme.budget_unfunded} />
</label>
</div>

Expand All @@ -133,10 +120,10 @@
repeat("LUF"),
]}
inlineSmall
bind:value={pipelineProps.funding_source}
bind:value={subscheme.funding_source}
/>

<Checkbox id="scheme-funded" bind:checked={pipelineProps.funded}>
<Checkbox id="scheme-funded" bind:checked={subscheme.funded}>
Is the scheme fully funded?
</Checkbox>
</fieldset>
Expand All @@ -148,7 +135,7 @@
type="number"
min="2010"
max="2100"
bind:value={pipelineProps.source_data_year}
bind:value={subscheme.source_data_year}
/>
</label>
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface Scheme {
features: FeatureUnion[];
// Foreign members
scheme_name?: string;
subschemes?: Subscheme[];
subschemes?: PipelineScheme[];
authority?: string;
origin?: string;
pipeline?: PipelineScheme;
Expand All @@ -22,6 +22,7 @@ export interface Scheme {
// a blank form. Mandatory fields are marked in the form UI. Optional string
// types are encoded as "".
export interface PipelineScheme {
id: number;
// TODO "intersection" is unclear
scheme_type:
| "cycling route"
Expand Down

0 comments on commit 68bcb74

Please sign in to comment.