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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    organization: '',
    
    
    
    
    packet_name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    packet_type: 'offboarding',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    framework: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    workflow: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    sampled_subject: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    owner_user: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    packet_status: 'draft',
    
    
    
    
    
    
    
    readiness_score: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    generated_on: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    due_date: '',
    
    
    
    
    
    
    
    
    
    
    
    summary: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    artifacts: [],
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    mapped_controls: [],
    
    
}


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

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/proof_packets/proof_packets-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="PacketName"
  >
      <Field
          name="packet_name"
          placeholder="PacketName"
      />
  </FormField>









































  <FormField label="PacketType" labelFor="packet_type">
      <Field name="packet_type" id="packet_type" component="select">
      
        <option value="offboarding">offboarding</option>
      
        <option value="privileged_access">privileged_access</option>
      
        <option value="mfa">mfa</option>
      
        <option value="access_review">access_review</option>
      
        <option value="service_account">service_account</option>
      
        <option value="exception">exception</option>
      
        <option value="quarterly_summary">quarterly_summary</option>
      
      </Field>
  </FormField>































  <FormField label="Framework" labelFor="framework">
      <Field name="framework" id="framework" component={SelectField} options={[]} itemRef={'control_frameworks'}></Field>
  </FormField>



























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



























  <FormField label="SampledSubject" labelFor="sampled_subject">
      <Field name="sampled_subject" id="sampled_subject" component={SelectField} options={[]} itemRef={'sampled_subjects'}></Field>
  </FormField>



























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























  <FormField label="PacketStatus" labelFor="packet_status">
      <Field name="packet_status" id="packet_status" component="select">
      
        <option value="draft">draft</option>
      
        <option value="in_review">in_review</option>
      
        <option value="ready">ready</option>
      
        <option value="delivered">delivered</option>
      
        <option value="archived">archived</option>
      
      </Field>
  </FormField>



















    <FormField
        label="ReadinessScore"
    >
        <Field
            type="number"
            name="readiness_score"
            placeholder="ReadinessScore"
        />
    </FormField>































  <FormField
      label="GeneratedOn"
  >
      <Field
          type="datetime-local"
          name="generated_on"
          placeholder="GeneratedOn"
      />
  </FormField>



























  <FormField
      label="DueDate"
  >
      <Field
          type="datetime-local"
          name="due_date"
          placeholder="DueDate"
      />
  </FormField>



















    <FormField label="Summary" hasTextareaHeight>
        <Field name="summary" as="textarea" placeholder="Summary" />
    </FormField>













































    <FormField label='Artifacts' labelFor='artifacts'>
        <Field
            name='artifacts'
            id='artifacts'
            itemRef={'artifacts'}
            options={[]}
            component={SelectFieldMany}>
        </Field>
    </FormField>



























    <FormField label='MappedControls' labelFor='mapped_controls'>
        <Field
            name='mapped_controls'
            id='mapped_controls'
            itemRef={'control_requirements'}
            options={[]}
            component={SelectFieldMany}>
        </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('/proof_packets/proof_packets-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Proof_packetsNew
