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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    organization: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    sample_type: 'terminated_user',
    
    
    
    
    
    
    
    display_name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    identifier: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    department: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    role_name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    manager: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    event_date: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    risk_tier: 'low',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    workflow: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    status: 'new',
    
    
    
    
    
    
    
    
    notes: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/sampled_subjects/sampled_subjects-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="SampleType" labelFor="sample_type">
      <Field name="sample_type" id="sample_type" component="select">
      
        <option value="terminated_user">terminated_user</option>
      
        <option value="onboarded_user">onboarded_user</option>
      
        <option value="privileged_admin">privileged_admin</option>
      
        <option value="reviewed_user">reviewed_user</option>
      
        <option value="service_account">service_account</option>
      
        <option value="exception_case">exception_case</option>
      
      </Field>
  </FormField>













  <FormField
      label="DisplayName"
  >
      <Field
          name="display_name"
          placeholder="DisplayName"
      />
  </FormField>



























  <FormField
      label="Identifier"
  >
      <Field
          name="identifier"
          placeholder="Identifier"
      />
  </FormField>



























  <FormField
      label="Department"
  >
      <Field
          name="department"
          placeholder="Department"
      />
  </FormField>



























  <FormField
      label="Role"
  >
      <Field
          name="role_name"
          placeholder="Role"
      />
  </FormField>



























  <FormField
      label="Manager"
  >
      <Field
          name="manager"
          placeholder="Manager"
      />
  </FormField>





































  <FormField
      label="EventDate"
  >
      <Field
          type="datetime-local"
          name="event_date"
          placeholder="EventDate"
      />
  </FormField>































  <FormField label="RiskTier" labelFor="risk_tier">
      <Field name="risk_tier" id="risk_tier" component="select">
      
        <option value="low">low</option>
      
        <option value="medium">medium</option>
      
        <option value="high">high</option>
      
        <option value="critical">critical</option>
      
      </Field>
  </FormField>































  <FormField label="Workflow" labelFor="workflow">
      <Field name="workflow" id="workflow" component={SelectField} options={[]} itemRef={'identity_workflows'}></Field>
  </FormField>























  <FormField label="Status" labelFor="status">
      <Field name="status" id="status" component="select">
      
        <option value="new">new</option>
      
        <option value="in_progress">in_progress</option>
      
        <option value="packet_ready">packet_ready</option>
      
        <option value="closed">closed</option>
      
        <option value="archived">archived</option>
      
      </Field>
  </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('/sampled_subjects/sampled_subjects-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Sampled_subjectsNew
