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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    organization: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    invoice: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    receipt: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    document_type: 'invoice',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    submission_status: 'queued',
    
    
    
    
    
    
    
    
    
    
    
    
    submitted_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    last_attempt_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    attempt_count: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    request_payload_json: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    response_payload_json: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    efris_invoice_no: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    efris_receipt_no: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    verification_code: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    qr_code_data: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    error_code: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    error_message: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

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



























  <FormField label="Receipt" labelFor="receipt">
      <Field name="receipt" id="receipt" component={SelectField} options={[]} itemRef={'receipts'}></Field>
  </FormField>























  <FormField label="DocumentType" labelFor="document_type">
      <Field name="document_type" id="document_type" component="select">
      
        <option value="invoice">invoice</option>
      
        <option value="receipt">receipt</option>
      
        <option value="credit_note">credit_note</option>
      
        <option value="debit_note">debit_note</option>
      
      </Field>
  </FormField>



























  <FormField label="SubmissionStatus" labelFor="submission_status">
      <Field name="submission_status" id="submission_status" component="select">
      
        <option value="queued">queued</option>
      
        <option value="submitted">submitted</option>
      
        <option value="accepted">accepted</option>
      
        <option value="rejected">rejected</option>
      
        <option value="failed">failed</option>
      
        <option value="cancelled">cancelled</option>
      
      </Field>
  </FormField>























  <FormField
      label="SubmittedAt"
  >
      <Field
          type="datetime-local"
          name="submitted_at"
          placeholder="SubmittedAt"
      />
  </FormField>



























  <FormField
      label="LastAttemptAt"
  >
      <Field
          type="datetime-local"
          name="last_attempt_at"
          placeholder="LastAttemptAt"
      />
  </FormField>























    <FormField
        label="AttemptCount"
    >
        <Field
            type="number"
            name="attempt_count"
            placeholder="AttemptCount"
        />
    </FormField>























    <FormField label="RequestPayloadJSON" hasTextareaHeight>
        <Field name="request_payload_json" as="textarea" placeholder="RequestPayloadJSON" />
    </FormField>



























    <FormField label="ResponsePayloadJSON" hasTextareaHeight>
        <Field name="response_payload_json" as="textarea" placeholder="ResponsePayloadJSON" />
    </FormField>

























  <FormField
      label="EFRISInvoiceNumber"
  >
      <Field
          name="efris_invoice_no"
          placeholder="EFRISInvoiceNumber"
      />
  </FormField>



























  <FormField
      label="EFRISReceiptNumber"
  >
      <Field
          name="efris_receipt_no"
          placeholder="EFRISReceiptNumber"
      />
  </FormField>



























  <FormField
      label="VerificationCode"
  >
      <Field
          name="verification_code"
          placeholder="VerificationCode"
      />
  </FormField>





























    <FormField label="QRCodeData" hasTextareaHeight>
        <Field name="qr_code_data" as="textarea" placeholder="QRCodeData" />
    </FormField>

























  <FormField
      label="ErrorCode"
  >
      <Field
          name="error_code"
          placeholder="ErrorCode"
      />
  </FormField>





























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

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

export default Efris_submissionsNew
