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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    patient: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    article: '',
    
    
    
    
    
    
    
    
    
    recommended_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    reason_type: 'stage_based',
    
    
    
    
    
    
    
    
    
    reason_text: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    state: 'new',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    accounts: '',
    
    
    
}


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

    
    

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



























  <FormField label="Article" labelFor="article">
      <Field name="article" id="article" component={SelectField} options={[]} itemRef={'scientific_articles'}></Field>
  </FormField>



















  <FormField
      label="Recommendedat"
  >
      <Field
          type="datetime-local"
          name="recommended_at"
          placeholder="Recommendedat"
      />
  </FormField>































  <FormField label="Reasontype" labelFor="reason_type">
      <Field name="reason_type" id="reason_type" component="select">
      
        <option value="stage_based">stage_based</option>
      
        <option value="symptom_based">symptom_based</option>
      
        <option value="caregiver_interest">caregiver_interest</option>
      
        <option value="clinician_selected">clinician_selected</option>
      
        <option value="trending">trending</option>
      
      </Field>
  </FormField>

















      <FormField label='Reasontext' hasTextareaHeight>
          <Field
              name='reason_text'
              id='reason_text'
              component={RichTextField}
          ></Field>
      </FormField>





































  <FormField label="State" labelFor="state">
      <Field name="state" id="state" component="select">
      
        <option value="new">new</option>
      
        <option value="viewed">viewed</option>
      
        <option value="saved">saved</option>
      
        <option value="dismissed">dismissed</option>
      
      </Field>
  </FormField>































  <FormField label="accounts" labelFor="accounts">
      <Field name="accounts" id="accounts" component={SelectField} options={[]} itemRef={'accounts'}></Field>
  </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('/article_recommendations/article_recommendations-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Article_recommendationsNew
