Skip to content

Commit

Permalink
BehandlingerTable.tsx dekonstruerer props for å sette defaultverdi på…
Browse files Browse the repository at this point in the history
… visBehandlingTypeSoek
  • Loading branch information
Anders Refsahl committed Nov 28, 2024
1 parent bae1fa6 commit 1e4da3a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions app/components/behandlinger-table/BehandlingerTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface Props {
behandlingerResponse: BehandlingerPage,
}

export default function BehandlingerTable(props: Props) {
export default function BehandlingerTable({visStatusSoek, visBehandlingTypeSoek = true, behandlingerResponse}: Props) {
const [searchParams, setSearchParams] = useSearchParams()

let sortParam = searchParams.get("sort")?.split(",")
Expand Down Expand Up @@ -63,7 +63,7 @@ export default function BehandlingerTable(props: Props) {
function behandlingtypeOptions() {
let ekstraBehandlingType
let currentBehandlingType = searchParams.get('behandlingType')
if (currentBehandlingType && !props.behandlingerResponse.behandlingTyper.includes(currentBehandlingType)) {
if (currentBehandlingType && !behandlingerResponse.behandlingTyper.includes(currentBehandlingType)) {
ekstraBehandlingType = (<option value={currentBehandlingType}>{decodeBehandling(currentBehandlingType)}</option>)
} else {
ekstraBehandlingType = (<></>)
Expand All @@ -85,8 +85,8 @@ export default function BehandlingerTable(props: Props) {
ekstraBehandlingType
}

{ props.behandlingerResponse.behandlingTyper ?
props.behandlingerResponse.behandlingTyper.sort((a,b) => a.localeCompare(b)).map((type) => {
{ behandlingerResponse.behandlingTyper ?
behandlingerResponse.behandlingTyper.sort((a,b) => a.localeCompare(b)).map((type) => {
return (<option key={type} value={type}>{decodeBehandling(type)}</option>)
})
: <></>
Expand Down Expand Up @@ -137,7 +137,7 @@ export default function BehandlingerTable(props: Props) {
<Table.DataCell style={{ paddingTop: 0 }}>
</Table.DataCell>
<Table.DataCell style={{ paddingTop: 0 }}>
{props.visBehandlingTypeSoek ? behandlingtypeOptions() : <></>}
{visBehandlingTypeSoek ? behandlingtypeOptions() : <></>}
</Table.DataCell>
<Table.DataCell style={{ paddingTop: 0 }}>
</Table.DataCell>
Expand All @@ -146,14 +146,14 @@ export default function BehandlingerTable(props: Props) {
<Table.DataCell style={{ paddingTop: 0 }}>
</Table.DataCell>
<Table.DataCell style={{ paddingTop: 0 }}>
{props.visStatusSoek ?
{visStatusSoek ?
statusOptions()
: <></>}
</Table.DataCell>
</Table.Row>
</Table.Header>
<Table.Body>
{props.behandlingerResponse.content?.map((it: BehandlingDto) => {
{behandlingerResponse.content?.map((it: BehandlingDto) => {
return (
<Table.Row key={it.uuid}>
<Table.DataCell>
Expand All @@ -178,8 +178,8 @@ export default function BehandlingerTable(props: Props) {
</Table.Body>
</Table>
<Pagination
page={props.behandlingerResponse.number + 1}
count={props.behandlingerResponse.totalPages}
page={behandlingerResponse.number + 1}
count={behandlingerResponse.totalPages}
boundaryCount={1}
siblingCount={1}
prevNextTexts={true}
Expand Down

0 comments on commit 1e4da3a

Please sign in to comment.