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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    receipt: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    merchant: '',
    
    
    
    
    
    
    
    
    
    processed_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    engine: 'tesseract',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    status: 'success',
    
    
    
    
    
    
    
    invoice_number_text: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    seller_name_text: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    buyer_name_text: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    tin_number_text: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    invoice_date: '',
    
    
    
    
    
    
    
    
    
    
    subtotal_amount: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    vat_amount: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    tot_amount: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    total_amount: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    raw_text: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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



























  <FormField label="Merchant" labelFor="merchant">
      <Field name="merchant" id="merchant" component={SelectField} options={[]} itemRef={'merchants'}></Field>
  </FormField>



















  <FormField
      label="ProcessedAt"
  >
      <Field
          type="datetime-local"
          name="processed_at"
          placeholder="ProcessedAt"
      />
  </FormField>































  <FormField label="OCREngine" labelFor="engine">
      <Field name="engine" id="engine" component="select">
      
        <option value="tesseract">tesseract</option>
      
        <option value="google_vision">google_vision</option>
      
        <option value="aws_textract">aws_textract</option>
      
        <option value="other">other</option>
      
      </Field>
  </FormField>



























  <FormField label="Status" labelFor="status">
      <Field name="status" id="status" component="select">
      
        <option value="success">success</option>
      
        <option value="partial">partial</option>
      
        <option value="failed">failed</option>
      
      </Field>
  </FormField>













  <FormField
      label="InvoiceNumber(Text)"
  >
      <Field
          name="invoice_number_text"
          placeholder="InvoiceNumber(Text)"
      />
  </FormField>



























  <FormField
      label="SellerName(Text)"
  >
      <Field
          name="seller_name_text"
          placeholder="SellerName(Text)"
      />
  </FormField>



























  <FormField
      label="BuyerName(Text)"
  >
      <Field
          name="buyer_name_text"
          placeholder="BuyerName(Text)"
      />
  </FormField>



























  <FormField
      label="TINNumber(Text)"
  >
      <Field
          name="tin_number_text"
          placeholder="TINNumber(Text)"
      />
  </FormField>





































  <FormField
      label="InvoiceDate"
  >
      <Field
          type="datetime-local"
          name="invoice_date"
          placeholder="InvoiceDate"
      />
  </FormField>























    <FormField
        label="SubtotalAmount"
    >
        <Field
            type="number"
            name="subtotal_amount"
            placeholder="SubtotalAmount"
        />
    </FormField>



























    <FormField
        label="VATAmount"
    >
        <Field
            type="number"
            name="vat_amount"
            placeholder="VATAmount"
        />
    </FormField>



























    <FormField
        label="TOTAmount"
    >
        <Field
            type="number"
            name="tot_amount"
            placeholder="TOTAmount"
        />
    </FormField>



























    <FormField
        label="TotalAmount"
    >
        <Field
            type="number"
            name="total_amount"
            placeholder="TotalAmount"
        />
    </FormField>























    <FormField label="RawText" hasTextareaHeight>
        <Field name="raw_text" as="textarea" placeholder="RawText" />
    </FormField>











































  <FormField label="organizations" labelFor="organizations">
      <Field name="organizations" id="organizations" component={SelectField} options={[]} itemRef={'organizations'}></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('/ocr_extractions/ocr_extractions-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Ocr_extractionsNew
