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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    user: '',
    
    
    
    
    full_name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    date_of_birth: '',
    
    
    
    
    
    
    
    
    
    
    blood_type: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    critical_allergies: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    critical_conditions: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    critical_medications: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    emergency_contacts: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    treating_doctor_contact: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organ_donor_status: 'yes',
    
    
    
    
    
    
    
    
    advance_directives_summary: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

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









  <FormField
      label="FullName"
  >
      <Field
          name="full_name"
          placeholder="FullName"
      />
  </FormField>





































  <FormField
      label="DateofBirth"
  >
      <Field
          type="datetime-local"
          name="date_of_birth"
          placeholder="DateofBirth"
      />
  </FormField>

















  <FormField
      label="BloodType"
  >
      <Field
          name="blood_type"
          placeholder="BloodType"
      />
  </FormField>





























    <FormField label="CriticalAllergies" hasTextareaHeight>
        <Field name="critical_allergies" as="textarea" placeholder="CriticalAllergies" />
    </FormField>



























    <FormField label="CriticalConditions" hasTextareaHeight>
        <Field name="critical_conditions" as="textarea" placeholder="CriticalConditions" />
    </FormField>



























    <FormField label="CriticalMedications" hasTextareaHeight>
        <Field name="critical_medications" as="textarea" placeholder="CriticalMedications" />
    </FormField>



























    <FormField label="EmergencyContacts" hasTextareaHeight>
        <Field name="emergency_contacts" as="textarea" placeholder="EmergencyContacts" />
    </FormField>



























    <FormField label="TreatingDoctorContact" hasTextareaHeight>
        <Field name="treating_doctor_contact" as="textarea" placeholder="TreatingDoctorContact" />
    </FormField>







































  <FormField label="OrganDonorStatus" labelFor="organ_donor_status">
      <Field name="organ_donor_status" id="organ_donor_status" component="select">
      
        <option value="yes">yes</option>
      
        <option value="no">no</option>
      
        <option value="specific_organs">specific_organs</option>
      
        <option value="unknown">unknown</option>
      
      </Field>
  </FormField>















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

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

export default Emergency_medical_cardsNew
