Prepare supplied financial directory with product coverage and native dossier continuity
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
import {
|
||||
InstitutionFields,
|
||||
emptyInstitution,
|
||||
type InstitutionDetails,
|
||||
} from '@/components/funding-institution';
|
||||
import { Link, router, useForm } from '@inertiajs/react';
|
||||
import { useState } from 'react';
|
||||
import type { ReactNode } from 'react';
|
||||
@@ -21,7 +26,8 @@ type WindowDraft = {
|
||||
application_url: string;
|
||||
criteria: Criterion[];
|
||||
};
|
||||
type Draft = {
|
||||
type Draft = InstitutionDetails & {
|
||||
funding_needs: string[];
|
||||
title: string;
|
||||
kind: string;
|
||||
summary: string;
|
||||
@@ -51,6 +57,8 @@ type RecordData = {
|
||||
};
|
||||
type Plan = { version: number; hash: string; payload: Draft };
|
||||
const empty: Draft = {
|
||||
...emptyInstitution,
|
||||
funding_needs: [],
|
||||
title: '',
|
||||
kind: 'fund',
|
||||
summary: '',
|
||||
@@ -239,6 +247,8 @@ function Editor({
|
||||
kinds,
|
||||
windowModes,
|
||||
history,
|
||||
institutionNatures = {},
|
||||
needs = {},
|
||||
}: {
|
||||
record: RecordData | null;
|
||||
references: Record<
|
||||
@@ -247,6 +257,8 @@ function Editor({
|
||||
>;
|
||||
kinds: Record<string, string>;
|
||||
windowModes: Record<string, string>;
|
||||
institutionNatures?: Record<string, string>;
|
||||
needs?: Record<string, string>;
|
||||
history: { version: number; reason: string; published_at: string }[];
|
||||
}) {
|
||||
const form = useForm({
|
||||
@@ -359,6 +371,31 @@ function Editor({
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
{draft.kind !== 'institution' && (
|
||||
<label>
|
||||
Finalidades documentadas
|
||||
<select
|
||||
multiple
|
||||
className={input}
|
||||
value={draft.funding_needs}
|
||||
onChange={(e) =>
|
||||
change({
|
||||
funding_needs: Array.from(
|
||||
e.target.selectedOptions,
|
||||
(o) => o.value,
|
||||
),
|
||||
})
|
||||
}
|
||||
>
|
||||
{Object.entries(needs).map(([id, label]) => (
|
||||
<option key={id} value={id}>
|
||||
{label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<span>Sem selecção: finalidade por confirmar.</span>
|
||||
</label>
|
||||
)}
|
||||
<Field label="Resumo">
|
||||
<textarea
|
||||
className={input}
|
||||
@@ -419,8 +456,17 @@ function Editor({
|
||||
</select>
|
||||
</Field>
|
||||
</section>
|
||||
{draft.kind === 'institution' && (
|
||||
<InstitutionFields
|
||||
value={draft}
|
||||
change={change}
|
||||
territories={references.territories}
|
||||
natures={institutionNatures}
|
||||
needs={needs}
|
||||
/>
|
||||
)}
|
||||
<section className={card}>
|
||||
<Field label="Cobertura do programa">
|
||||
<Field label="Cobertura do programa/instituição — distinta da presença física">
|
||||
<select
|
||||
className={input}
|
||||
value={draft.coverage}
|
||||
|
||||
Reference in New Issue
Block a user