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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    merchant: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    tax_period: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    status: 'draft',
    
    
    
    
    
    
    
    total_sales_amount: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    taxable_sales_amount: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    output_vat_amount: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    total_purchases_amount: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    input_vat_amount: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    vat_payable_amount: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    generated_by: '',
    
    
    
    
    
    
    
    
    
    generated_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    reviewed_by: '',
    
    
    
    
    
    
    
    
    
    reviewed_at: '',
    
    
    
    
    
    
    
    
    
    
    
    notes: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    pdf_file: [],
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    excel_file: [],
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    revenue_office_export_file: [],
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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



























  <FormField label="TaxPeriod" labelFor="tax_period">
      <Field name="tax_period" id="tax_period" component={SelectField} options={[]} itemRef={'tax_periods'}></Field>
  </FormField>























  <FormField label="Status" labelFor="status">
      <Field name="status" id="status" component="select">
      
        <option value="draft">draft</option>
      
        <option value="generated">generated</option>
      
        <option value="reviewed">reviewed</option>
      
        <option value="submitted">submitted</option>
      
        <option value="accepted">accepted</option>
      
        <option value="rejected">rejected</option>
      
        <option value="amended">amended</option>
      
      </Field>
  </FormField>



















    <FormField
        label="TotalSalesAmount"
    >
        <Field
            type="number"
            name="total_sales_amount"
            placeholder="TotalSalesAmount"
        />
    </FormField>



























    <FormField
        label="TaxableSalesAmount"
    >
        <Field
            type="number"
            name="taxable_sales_amount"
            placeholder="TaxableSalesAmount"
        />
    </FormField>



























    <FormField
        label="OutputVATAmount"
    >
        <Field
            type="number"
            name="output_vat_amount"
            placeholder="OutputVATAmount"
        />
    </FormField>



























    <FormField
        label="TotalPurchasesAmount"
    >
        <Field
            type="number"
            name="total_purchases_amount"
            placeholder="TotalPurchasesAmount"
        />
    </FormField>



























    <FormField
        label="InputVATAmount"
    >
        <Field
            type="number"
            name="input_vat_amount"
            placeholder="InputVATAmount"
        />
    </FormField>



























    <FormField
        label="VATPayableAmount"
    >
        <Field
            type="number"
            name="vat_payable_amount"
            placeholder="VATPayableAmount"
        />
    </FormField>







































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



















  <FormField
      label="GeneratedAt"
  >
      <Field
          type="datetime-local"
          name="generated_at"
          placeholder="GeneratedAt"
      />
  </FormField>



































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



















  <FormField
      label="ReviewedAt"
  >
      <Field
          type="datetime-local"
          name="reviewed_at"
          placeholder="ReviewedAt"
      />
  </FormField>



















    <FormField label="Notes" hasTextareaHeight>
        <Field name="notes" as="textarea" placeholder="Notes" />
    </FormField>
















































  <FormField>
      <Field
          label='PDFFile'
          color='info'
          icon={mdiUpload}
          path={'vat_declarations/pdf_file'}
          name='pdf_file'
          id='pdf_file'
          schema={{
            size: undefined,
            formats: undefined,
          }}
          component={FormFilePicker}
      ></Field>
  </FormField>



























  <FormField>
      <Field
          label='ExcelFile'
          color='info'
          icon={mdiUpload}
          path={'vat_declarations/excel_file'}
          name='excel_file'
          id='excel_file'
          schema={{
            size: undefined,
            formats: undefined,
          }}
          component={FormFilePicker}
      ></Field>
  </FormField>



























  <FormField>
      <Field
          label='RevenueOfficeExportFile'
          color='info'
          icon={mdiUpload}
          path={'vat_declarations/revenue_office_export_file'}
          name='revenue_office_export_file'
          id='revenue_office_export_file'
          schema={{
            size: undefined,
            formats: undefined,
          }}
          component={FormFilePicker}
      ></Field>
  </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('/vat_declarations/vat_declarations-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Vat_declarationsNew
