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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    authorization_case: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    document_type: 'order',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    source_channel: 'upload',
    
    
    
    
    
    
    
    storage_key: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    original_filename: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    checksum: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    uploaded_by_user: '',
    
    
    
    
    
    
    
    
    
    uploaded_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    version_number: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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























  <FormField label="DocumentType" labelFor="document_type">
      <Field name="document_type" id="document_type" component="select">
      
        <option value="order">order</option>
      
        <option value="clinical_notes">clinical_notes</option>
      
        <option value="imaging_report">imaging_report</option>
      
        <option value="labs">labs</option>
      
        <option value="prior_auth_form">prior_auth_form</option>
      
        <option value="denial_letter">denial_letter</option>
      
        <option value="appeal_letter">appeal_letter</option>
      
        <option value="insurance_card">insurance_card</option>
      
        <option value="other">other</option>
      
      </Field>
  </FormField>



























  <FormField label="SourceChannel" labelFor="source_channel">
      <Field name="source_channel" id="source_channel" component="select">
      
        <option value="upload">upload</option>
      
        <option value="fax">fax</option>
      
        <option value="email">email</option>
      
        <option value="portal_download">portal_download</option>
      
        <option value="integration">integration</option>
      
        <option value="other">other</option>
      
      </Field>
  </FormField>













  <FormField
      label="StorageKey"
  >
      <Field
          name="storage_key"
          placeholder="StorageKey"
      />
  </FormField>



























  <FormField
      label="OriginalFilename"
  >
      <Field
          name="original_filename"
          placeholder="OriginalFilename"
      />
  </FormField>



























  <FormField
      label="Checksum"
  >
      <Field
          name="checksum"
          placeholder="Checksum"
      />
  </FormField>













































  <FormField label="UploadedByUser" labelFor="uploaded_by_user">
      <Field name="uploaded_by_user" id="uploaded_by_user" component={SelectField} options={[]} itemRef={'users'}></Field>
  </FormField>



















  <FormField
      label="UploadedAt"
  >
      <Field
          type="datetime-local"
          name="uploaded_at"
          placeholder="UploadedAt"
      />
  </FormField>























    <FormField
        label="VersionNumber"
    >
        <Field
            type="number"
            name="version_number"
            placeholder="VersionNumber"
        />
    </FormField>







































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

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

export default Case_documentsNew
