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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    organization: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    location: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    patient: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    payer_plan: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    cpt_code: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    procedure_family: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    stage: 'intake',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    urgency: 'routine',
    
    
    
    
    
    
    
    ordering_provider_name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    rendering_provider_name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    site_of_service: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    scheduled_date: '',
    
    
    
    
    
    
    
    
    
    
    dollars_at_risk: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    owner_user: '',
    
    
    
    
    
    
    
    
    
    due_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    sla_state: 'on_track',
    
    
    
    
    
    
    
    
    internal_notes: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

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



























  <FormField label="Location" labelFor="location">
      <Field name="location" id="location" component={SelectField} options={[]} itemRef={'locations'}></Field>
  </FormField>



























  <FormField label="Patient" labelFor="patient">
      <Field name="patient" id="patient" component={SelectField} options={[]} itemRef={'patients'}></Field>
  </FormField>



























  <FormField label="PayerPlan" labelFor="payer_plan">
      <Field name="payer_plan" id="payer_plan" component={SelectField} options={[]} itemRef={'payer_plans'}></Field>
  </FormField>



























  <FormField label="CPTCode" labelFor="cpt_code">
      <Field name="cpt_code" id="cpt_code" component={SelectField} options={[]} itemRef={'cpt_codes'}></Field>
  </FormField>



























  <FormField label="ProcedureFamily" labelFor="procedure_family">
      <Field name="procedure_family" id="procedure_family" component={SelectField} options={[]} itemRef={'procedure_families'}></Field>
  </FormField>























  <FormField label="Stage" labelFor="stage">
      <Field name="stage" id="stage" component="select">
      
        <option value="intake">intake</option>
      
        <option value="needs_evidence">needs_evidence</option>
      
        <option value="ready_to_submit">ready_to_submit</option>
      
        <option value="submitted">submitted</option>
      
        <option value="pending_decision">pending_decision</option>
      
        <option value="approved">approved</option>
      
        <option value="denied">denied</option>
      
        <option value="appeal_in_progress">appeal_in_progress</option>
      
        <option value="closed">closed</option>
      
      </Field>
  </FormField>



























  <FormField label="Urgency" labelFor="urgency">
      <Field name="urgency" id="urgency" component="select">
      
        <option value="routine">routine</option>
      
        <option value="urgent">urgent</option>
      
        <option value="stat">stat</option>
      
      </Field>
  </FormField>













  <FormField
      label="OrderingProviderName"
  >
      <Field
          name="ordering_provider_name"
          placeholder="OrderingProviderName"
      />
  </FormField>



























  <FormField
      label="RenderingProviderName"
  >
      <Field
          name="rendering_provider_name"
          placeholder="RenderingProviderName"
      />
  </FormField>



























  <FormField
      label="SiteOfService"
  >
      <Field
          name="site_of_service"
          placeholder="SiteOfService"
      />
  </FormField>





































  <FormField
      label="ScheduledDate"
  >
      <Field
          type="datetime-local"
          name="scheduled_date"
          placeholder="ScheduledDate"
      />
  </FormField>























    <FormField
        label="DollarsAtRisk"
    >
        <Field
            type="number"
            name="dollars_at_risk"
            placeholder="DollarsAtRisk"
        />
    </FormField>







































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



















  <FormField
      label="DueAt"
  >
      <Field
          type="datetime-local"
          name="due_at"
          placeholder="DueAt"
      />
  </FormField>































  <FormField label="SLAState" labelFor="sla_state">
      <Field name="sla_state" id="sla_state" component="select">
      
        <option value="on_track">on_track</option>
      
        <option value="due_soon">due_soon</option>
      
        <option value="overdue">overdue</option>
      
      </Field>
  </FormField>















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

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

export default Authorization_casesNew
