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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    organization: '',
    
    
    
    
    default_currency_code: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    default_language: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    default_timezone: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    invoice_prefix: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    quote_prefix: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    receipt_prefix: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    default_vat_rate: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    prices_include_tax: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    enable_inventory: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    enable_projects: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    enable_approvals: false,
    
    
    
    
    
    
    
    
    
    
    
    invoice_footer_note: '',
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

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



























  <FormField
      label="DefaultLanguage"
  >
      <Field
          name="default_language"
          placeholder="DefaultLanguage"
      />
  </FormField>



























  <FormField
      label="DefaultTimezone"
  >
      <Field
          name="default_timezone"
          placeholder="DefaultTimezone"
      />
  </FormField>



























  <FormField
      label="InvoicePrefix"
  >
      <Field
          name="invoice_prefix"
          placeholder="InvoicePrefix"
      />
  </FormField>



























  <FormField
      label="QuotePrefix"
  >
      <Field
          name="quote_prefix"
          placeholder="QuotePrefix"
      />
  </FormField>



























  <FormField
      label="ReceiptPrefix"
  >
      <Field
          name="receipt_prefix"
          placeholder="ReceiptPrefix"
      />
  </FormField>

































    <FormField
        label="DefaultVATRate"
    >
        <Field
            type="number"
            name="default_vat_rate"
            placeholder="DefaultVATRate"
        />
    </FormField>





































  <FormField label='PricesIncludeTax' labelFor='prices_include_tax'>
      <Field
          name='prices_include_tax'
          id='prices_include_tax'
          component={SwitchField}
      ></Field>
  </FormField>



























  <FormField label='EnableInventory' labelFor='enable_inventory'>
      <Field
          name='enable_inventory'
          id='enable_inventory'
          component={SwitchField}
      ></Field>
  </FormField>



























  <FormField label='EnableProjects' labelFor='enable_projects'>
      <Field
          name='enable_projects'
          id='enable_projects'
          component={SwitchField}
      ></Field>
  </FormField>



























  <FormField label='EnableApprovals' labelFor='enable_approvals'>
      <Field
          name='enable_approvals'
          id='enable_approvals'
          component={SwitchField}
      ></Field>
  </FormField>















      <FormField label='InvoiceFooterNote' hasTextareaHeight>
          <Field
              name='invoice_footer_note'
              id='invoice_footer_note'
              component={RichTextField}
          ></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('/organization_settings/organization_settings-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Organization_settingsNew
