Skip to content

Commit

Permalink
Update stønadsmottakere function to return a string array
Browse files Browse the repository at this point in the history
  • Loading branch information
RamziAbuQassim committed May 6, 2024
1 parent 34955ac commit 1abda46
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/api/driftApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export async function konsistensavstemming(args: {
export async function stønadsmottakere(args: {
fraOgMed: Nullable<string>;
inkluderEPS: boolean;
}): Promise<ApiClientResult<{ dato: string; fnr: string[] }>> {
}): Promise<ApiClientResult<string[]>> {
return apiClient({
url: `/stønadsmottakere`,
method: 'POST',
Expand Down
13 changes: 12 additions & 1 deletion src/components/inputs/datePicker/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export const DatePicker = (props: {

export const MonthPicker = (props: {
label: string;
hjelpetekst?: string;
value: Nullable<Date>;
size?: 'medium' | 'small';
fromDate?: Nullable<Date>;
Expand All @@ -76,7 +77,17 @@ export const MonthPicker = (props: {
return (
<div>
<MonthPickerDS {...monthpickerProps} selected={props.value ?? undefined}>
<MonthPickerDS.Input {...inputProps} label={props.label} size={props.size} error={props.error} />
<MonthPickerDS.Input
{...inputProps}
label={
<div className={styles.datepickerLabelContainer}>
{props.label}
{props.hjelpetekst ? <HelpText placement="bottom">{props.hjelpetekst}</HelpText> : null}
</div>
}
size={props.size}
error={props.error}
/>
</MonthPickerDS>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ const StønadsmottakereModal = (props: { open: boolean; onClose: () => void }) =
<div>
<div className={styles.form}>
<div className={styles.formInputs}>
<MonthPicker label="Fra og med" value={fraOgMed} onChange={(dato) => setFraOgMed(dato)} />
<MonthPicker
label="Fra og med"
hjelpetekst="Bruker dagens måned dersom den ikke blir fylt ut"
value={fraOgMed}
onChange={(dato) => setFraOgMed(dato)}
/>
<Checkbox onChange={() => setMedEps(!medEps)} checked={medEps}>
Med eps
</Checkbox>
Expand All @@ -60,12 +65,11 @@ const StønadsmottakereModal = (props: { open: boolean; onClose: () => void }) =
)}
{RemoteData.isSuccess(stønadsmottakereStatus) && (
<div className={styles.resultContainer}>
<Label as="p">For dato: {stønadsmottakereStatus.value.dato}</Label>
<Label as="p">Antall: {stønadsmottakereStatus.value.fnr.length}</Label>
<Label as="p">Antall: {stønadsmottakereStatus.value.length}</Label>
<Label as="p">Fødselsnummere: </Label>
<div>
<ul className={styles.result}>
{stønadsmottakereStatus.value.fnr.map((s) => (
{stønadsmottakereStatus.value.map((s) => (
<li key={s}>{s}</li>
))}
</ul>
Expand Down

0 comments on commit 1abda46

Please sign in to comment.