diff --git a/src/components/IssueList.tsx b/src/components/IssueList.tsx index d248d62..557d5cb 100644 --- a/src/components/IssueList.tsx +++ b/src/components/IssueList.tsx @@ -3,7 +3,7 @@ import React, {ChangeEvent, useCallback, useEffect, useState} from 'react'; import {deleteIssue, getNewspapersForBoxOnTitle, postNewIssuesForTitle} from '@/services/local.data'; import {ErrorMessage, Field, FieldArray, Form, Formik, FormikErrors, FormikValues} from 'formik'; import {FaTrash} from 'react-icons/fa'; -import {Button, CalendarDate, DatePicker, Spinner, Table} from '@nextui-org/react'; +import {Button, CalendarDate, DatePicker, Spinner, Switch, Table} from '@nextui-org/react'; import {TableBody, TableCell, TableColumn, TableHeader, TableRow} from '@nextui-org/table'; import ErrorModal from '@/components/ErrorModal'; import {newNewspapersContainsDuplicateEditions, newspapersContainsEdition} from '@/utils/validationUtils'; @@ -223,7 +223,6 @@ export default function IssueList(props: {title: title; box: box}) { Dag Dato Nummer - Ikke mottatt Mottatt Kommentar Slett @@ -267,29 +266,13 @@ export default function IssueList(props: {title: title; box: box}) { className="field-error text-lg" /> - - setFieldValue(`issues.${index}.received`, false)} - /> - - - + - + isSelected={issue.received ?? false} + isDisabled={newspaperIsSaved(index, values.issues.length)} + onChange={value => void setFieldValue(`issues.${index}.received`, value.target.checked)} + > {issue.received ? 'Mottatt' : 'Ikke mottatt'}