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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    user: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    export_type: 'doctor_report_pdf',
    
    
    
    
    
    
    
    
    
    
    
    
    requested_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    completed_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    range_start: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    range_end: '',
    
    
    
    
    
    
    
    
    
    
    
    included_sections: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    chief_complaint: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    questions_for_doctor: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    status: 'queued',
    
    
    
    
    
    
    
    
    error_message: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/export_jobs/export_jobs-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="ExportType" labelFor="export_type">
      <Field name="export_type" id="export_type" component="select">
      
        <option value="doctor_report_pdf">doctor_report_pdf</option>
      
        <option value="lab_results_pdf">lab_results_pdf</option>
      
        <option value="medication_card_pdf">medication_card_pdf</option>
      
        <option value="emergency_card_pdf">emergency_card_pdf</option>
      
        <option value="vaccination_record_pdf">vaccination_record_pdf</option>
      
        <option value="fitness_report_pdf">fitness_report_pdf</option>
      
        <option value="nutrition_report_pdf">nutrition_report_pdf</option>
      
        <option value="menstrual_cycle_report_pdf">menstrual_cycle_report_pdf</option>
      
        <option value="mental_health_report_pdf">mental_health_report_pdf</option>
      
        <option value="sleep_report_pdf">sleep_report_pdf</option>
      
        <option value="comprehensive_health_summary_pdf">comprehensive_health_summary_pdf</option>
      
        <option value="raw_backup_json">raw_backup_json</option>
      
        <option value="section_csv">section_csv</option>
      
      </Field>
  </FormField>























  <FormField
      label="RequestedAt"
  >
      <Field
          type="datetime-local"
          name="requested_at"
          placeholder="RequestedAt"
      />
  </FormField>



























  <FormField
      label="CompletedAt"
  >
      <Field
          type="datetime-local"
          name="completed_at"
          placeholder="CompletedAt"
      />
  </FormField>



























  <FormField
      label="RangeStart"
  >
      <Field
          type="datetime-local"
          name="range_start"
          placeholder="RangeStart"
      />
  </FormField>



























  <FormField
      label="RangeEnd"
  >
      <Field
          type="datetime-local"
          name="range_end"
          placeholder="RangeEnd"
      />
  </FormField>



















    <FormField label="IncludedSections" hasTextareaHeight>
        <Field name="included_sections" as="textarea" placeholder="IncludedSections" />
    </FormField>



























    <FormField label="ChiefComplaint" hasTextareaHeight>
        <Field name="chief_complaint" as="textarea" placeholder="ChiefComplaint" />
    </FormField>



























    <FormField label="QuestionsforDoctor" hasTextareaHeight>
        <Field name="questions_for_doctor" as="textarea" placeholder="QuestionsforDoctor" />
    </FormField>







































  <FormField label="Status" labelFor="status">
      <Field name="status" id="status" component="select">
      
        <option value="queued">queued</option>
      
        <option value="running">running</option>
      
        <option value="completed">completed</option>
      
        <option value="failed">failed</option>
      
      </Field>
  </FormField>















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

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

export default Export_jobsNew
