import { mdiAccount, mdiChartTimelineVariant, mdiMail, mdiUpload } from '@mdi/js'
import Head from 'next/head'
import React, { ReactElement } from 'react'
import CardBox from '../../components/CardBox'
import LayoutAuthenticated from '../../layouts/Authenticated'
import SectionMain from '../../components/SectionMain'
import SectionTitleLineWithButton from '../../components/SectionTitleLineWithButton'
import { getPageTitle } from '../../config'

import { Field, Form, Formik } from 'formik'
import FormField from '../../components/FormField'
import BaseDivider from '../../components/BaseDivider'
import BaseButtons from '../../components/BaseButtons'
import BaseButton from '../../components/BaseButton'
import FormCheckRadio from '../../components/FormCheckRadio'
import FormCheckRadioGroup from '../../components/FormCheckRadioGroup'
import FormFilePicker from '../../components/FormFilePicker'
import FormImagePicker from '../../components/FormImagePicker'
import { SwitchField } from '../../components/SwitchField'

import { SelectField } from '../../components/SelectField'
import { SelectFieldMany } from "../../components/SelectFieldMany";
import {RichTextField} from "../../components/RichTextField";

import { create } from '../../stores/supplement_evidence_items/supplement_evidence_itemsSlice'
import { useAppDispatch } from '../../stores/hooks'
import { useRouter } from 'next/router'
import moment from 'moment';

const initialValues = {
    
    
    supplement_name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    evidence_rating: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    summary: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    mechanism: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    benefits: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    dosing_range: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    timing_recommendations: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    interactions: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    side_effects: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    avoid_who: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
}


const Supplement_evidence_itemsNew = () => {
  const router = useRouter()
  const dispatch = useAppDispatch()

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/supplement_evidence_items/supplement_evidence_items-list')
  }
  return (
    <>
      <Head>
        <title>{getPageTitle('New Item')}</title>
      </Head>
      <SectionMain>
        <SectionTitleLineWithButton icon={mdiChartTimelineVariant} title="New Item" main>
        {''}
        </SectionTitleLineWithButton>
        <CardBox>
          <Formik
            initialValues={
                
                initialValues
                
            }
            onSubmit={(values) => handleSubmit(values)}
          >
            <Form>



  <FormField
      label="SupplementName"
  >
      <Field
          name="supplement_name"
          placeholder="SupplementName"
      />
  </FormField>

































    <FormField
        label="EvidenceRating(1-5)"
    >
        <Field
            type="number"
            name="evidence_rating"
            placeholder="EvidenceRating(1-5)"
        />
    </FormField>























    <FormField label="Summary" hasTextareaHeight>
        <Field name="summary" as="textarea" placeholder="Summary" />
    </FormField>



























    <FormField label="MechanismofAction" hasTextareaHeight>
        <Field name="mechanism" as="textarea" placeholder="MechanismofAction" />
    </FormField>



























    <FormField label="Benefits" hasTextareaHeight>
        <Field name="benefits" as="textarea" placeholder="Benefits" />
    </FormField>

























  <FormField
      label="StandardDosingRange"
  >
      <Field
          name="dosing_range"
          placeholder="StandardDosingRange"
      />
  </FormField>





























    <FormField label="TimingRecommendations" hasTextareaHeight>
        <Field name="timing_recommendations" as="textarea" placeholder="TimingRecommendations" />
    </FormField>



























    <FormField label="KnownInteractions" hasTextareaHeight>
        <Field name="interactions" as="textarea" placeholder="KnownInteractions" />
    </FormField>



























    <FormField label="SideEffects" hasTextareaHeight>
        <Field name="side_effects" as="textarea" placeholder="SideEffects" />
    </FormField>



























    <FormField label="WhoShouldAvoid" hasTextareaHeight>
        <Field name="avoid_who" as="textarea" placeholder="WhoShouldAvoid" />
    </FormField>























              <BaseDivider />
              <BaseButtons>
                <BaseButton type="submit" color="info" label="Submit" />
                <BaseButton type="reset" color="info" outline label="Reset" />
                <BaseButton type='reset' color='danger' outline label='Cancel' onClick={() => router.push('/supplement_evidence_items/supplement_evidence_items-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

Supplement_evidence_itemsNew.getLayout = function getLayout(page: ReactElement) {
  return (
      <LayoutAuthenticated
        
          permission={'CREATE_SUPPLEMENT_EVIDENCE_ITEMS'}
        
      >
          {page}
      </LayoutAuthenticated>
  )
}

export default Supplement_evidence_itemsNew
