From a9434b3836106c93b31c1ace22e2496fa7dd7292 Mon Sep 17 00:00:00 2001 From: Anders Refsahl Date: Fri, 8 Nov 2024 10:07:49 +0100 Subject: [PATCH] Endret til brevmal kode. Fikset input feltets bredde vha react. Co-authored-by: hakon.roed@nav.no --- app/routes/batch-opprett._index.tsx | 29 +++++++++++++++++++------- app/routes/batch-opprett.adhocbrev.tsx | 2 +- app/services/batch.adhocBrev.server.ts | 4 ++-- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/app/routes/batch-opprett._index.tsx b/app/routes/batch-opprett._index.tsx index af42cae..36b718e 100644 --- a/app/routes/batch-opprett._index.tsx +++ b/app/routes/batch-opprett._index.tsx @@ -1,7 +1,7 @@ import { Form, NavLink, useSubmit } from '@remix-run/react' import { json } from '@remix-run/node' import { env } from '~/services/env.server' -import React, { useState } from 'react' +import React, { useState, useRef, useEffect } from 'react' import { Select } from '@navikt/ds-react' export const loader = async () => { @@ -18,6 +18,18 @@ export default function BatchOpprett_index() { const submit = useSubmit() const handleSubmit = (e:any)=> {submit(e.target.form); setIsClicked(true)} + const inputRef = useRef(null) + + const handleInput = () => { + if (inputRef.current) { + inputRef.current.style.width = `${inputRef.current.value.length + 1}ch` + } + } + + useEffect(() => { + handleInput() + }) + return (

Opprett BPEN005 batchkjøring

@@ -87,16 +99,19 @@ export default function BatchOpprett_index() {

-

Opprett ADHOC Brevbestilling batchkjøring

+

Opprett ADHOC Brevbestilling batchkjøring på brevmal for sak

- InternBatchBrevkode + Brevmal kode for Sak

diff --git a/app/routes/batch-opprett.adhocbrev.tsx b/app/routes/batch-opprett.adhocbrev.tsx index d2d1041..4c5c5c7 100644 --- a/app/routes/batch-opprett.adhocbrev.tsx +++ b/app/routes/batch-opprett.adhocbrev.tsx @@ -9,7 +9,7 @@ export const action = async ({ request }: ActionFunctionArgs) => { const updates = Object.fromEntries(formData) const accessToken = await requireAccessToken(request) - let response = await opprettAdhocBrevBehandling(accessToken, updates.internBatchBrevkode as string) + let response = await opprettAdhocBrevBehandling(accessToken, updates.brevmal as string) return redirect(`/behandling/${response.behandlingId}`) } diff --git a/app/services/batch.adhocBrev.server.ts b/app/services/batch.adhocBrev.server.ts index 97f96ab..b365022 100644 --- a/app/services/batch.adhocBrev.server.ts +++ b/app/services/batch.adhocBrev.server.ts @@ -3,11 +3,11 @@ import type { StartBatchResponse } from '~/types' export async function opprettAdhocBrevBehandling( accessToken: string, - internBatchBrevkode: string, + brevmal: string, ): Promise { const body: any = { - batchBrevkode: internBatchBrevkode, + brevmal: brevmal, } const response = await fetch(