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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    organization: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    payer: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    payer_plan: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    procedure_family: '',
    
    
    
    
    version_label: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    version_status: 'draft',
    
    
    
    
    
    
    
    
    
    
    
    
    effective_from: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    effective_to: '',
    
    
    
    
    
    
    
    
    
    
    
    notes: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/payer_rules/payer_rules-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="Payer" labelFor="payer">
      <Field name="payer" id="payer" component={SelectField} options={[]} itemRef={'payers'}></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="ProcedureFamily" labelFor="procedure_family">
      <Field name="procedure_family" id="procedure_family" component={SelectField} options={[]} itemRef={'procedure_families'}></Field>
  </FormField>









  <FormField
      label="VersionLabel"
  >
      <Field
          name="version_label"
          placeholder="VersionLabel"
      />
  </FormField>









































  <FormField label="VersionStatus" labelFor="version_status">
      <Field name="version_status" id="version_status" component="select">
      
        <option value="draft">draft</option>
      
        <option value="active">active</option>
      
        <option value="archived">archived</option>
      
      </Field>
  </FormField>























  <FormField
      label="EffectiveFrom"
  >
      <Field
          type="datetime-local"
          name="effective_from"
          placeholder="EffectiveFrom"
      />
  </FormField>



























  <FormField
      label="EffectiveTo"
  >
      <Field
          type="datetime-local"
          name="effective_to"
          placeholder="EffectiveTo"
      />
  </FormField>



















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

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

export default Payer_rulesNew
