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/menstrual_day_logs/menstrual_day_logsSlice'
import { useAppDispatch } from '../../stores/hooks'
import { useRouter } from 'next/router'
import moment from 'moment';

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    cycle: '',
    
    
    
    
    
    
    
    
    
    log_date: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    flow_intensity: 'spotting',
    
    
    
    
    
    
    
    
    
    
    cramping: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    bloating: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    acne: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    breast_tenderness: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    headache: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    fatigue: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    food_cravings: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    lower_back_pain: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    clotting: false,
    
    
    
    
    
    
    
    
    
    
    notes: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/menstrual_day_logs/menstrual_day_logs-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="Cycle" labelFor="cycle">
      <Field name="cycle" id="cycle" component={SelectField} options={[]} itemRef={'menstrual_cycles'}></Field>
  </FormField>



















  <FormField
      label="LogDate"
  >
      <Field
          type="datetime-local"
          name="log_date"
          placeholder="LogDate"
      />
  </FormField>































  <FormField label="FlowIntensity" labelFor="flow_intensity">
      <Field name="flow_intensity" id="flow_intensity" component="select">
      
        <option value="spotting">spotting</option>
      
        <option value="light">light</option>
      
        <option value="medium">medium</option>
      
        <option value="heavy">heavy</option>
      
        <option value="very_heavy">very_heavy</option>
      
      </Field>
  </FormField>



















    <FormField
        label="Cramping(1-10)"
    >
        <Field
            type="number"
            name="cramping"
            placeholder="Cramping(1-10)"
        />
    </FormField>



























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





































  <FormField label='Acne' labelFor='acne'>
      <Field
          name='acne'
          id='acne'
          component={SwitchField}
      ></Field>
  </FormField>



























  <FormField label='BreastTenderness' labelFor='breast_tenderness'>
      <Field
          name='breast_tenderness'
          id='breast_tenderness'
          component={SwitchField}
      ></Field>
  </FormField>



























  <FormField label='Headache' labelFor='headache'>
      <Field
          name='headache'
          id='headache'
          component={SwitchField}
      ></Field>
  </FormField>



























  <FormField label='Fatigue' labelFor='fatigue'>
      <Field
          name='fatigue'
          id='fatigue'
          component={SwitchField}
      ></Field>
  </FormField>



























  <FormField label='FoodCravings' labelFor='food_cravings'>
      <Field
          name='food_cravings'
          id='food_cravings'
          component={SwitchField}
      ></Field>
  </FormField>



























  <FormField label='LowerBackPain' labelFor='lower_back_pain'>
      <Field
          name='lower_back_pain'
          id='lower_back_pain'
          component={SwitchField}
      ></Field>
  </FormField>



























  <FormField label='Clotting' labelFor='clotting'>
      <Field
          name='clotting'
          id='clotting'
          component={SwitchField}
      ></Field>
  </FormField>













    <FormField label="Notes" hasTextareaHeight>
        <Field name="notes" as="textarea" placeholder="Notes" />
    </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('/menstrual_day_logs/menstrual_day_logs-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Menstrual_day_logsNew
