import useSWR from "swr"; import { Field, reduxForm } from "redux-form"; import router from "next/router"; import DatePicker from "react-datepicker"; import React, { useState } from "react"; import "react-datepicker/dist/react-datepicker.css"; import moment from "moment"; export function Textfield(props) { const { name, label } = props; return (
); } export function MultiLinefield(props) { const { name, label } = props; return (

Do not include personal or financial information, like your National Insurance number or credit card details.
); } const RenderDatePicker = ({ datafieldname, name, label, input: { onChange, value }, meta: { touched, error }, ...custom }) => { return ( <> {touched && error && {error}} ); }; export function DateFieldPicker(props) { const { name, label } = props; return (
); } export function DateField(props) { const { name, label } = props; return (
); } export function YesNofield(props) { const { name, label } = props; const yesNo = ["Yes", "No"]; return (
{Object.keys(yesNo).map((key, index) => (
))}
); } const RenderPickList = ({ datafieldname, name, label, input, meta: { touched, error }, }) => { const fetcher = (url) => fetch(url).then((res) => res.json()); const { data, errorStr } = useSWR("/api/lookups/" + datafieldname, fetcher); if (errorStr) return (
); if (!data) return (
{label} loading...
); console.log(JSON.stringify(data.GlobalOptionSet.Options)); const dropdownObj = data.GlobalOptionSet.Options; return (
{touched && error && {error}}
); }; export function PickList(props) { const { name, label, datafieldname } = props; return (
); } export function NumericField(props) { const { name, label } = props; return (
); } export function DecimalField(props) { const { name, label } = props; return (
); } const RenderCaseID = {}; export function ReadOnlyfield(props) { const { name, label, value } = props; console.log(props.value.refno); return (
); }