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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    tenant: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    created_by_user: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    service_type: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    workflow_definition: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    document_template: '',
    
    
    
    
    title: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    status: 'draft',
    
    
    
    
    
    
    
    
    
    
    
    
    started_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    deadline_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    completed_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    requires_notary: false,
    
    
    
    
    
    
    
    
    
    
    service_warning: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    location: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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



























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



























  <FormField label="Servicetype" labelFor="service_type">
      <Field name="service_type" id="service_type" component={SelectField} options={[]} itemRef={'service_types'}></Field>
  </FormField>



























  <FormField label="Workflowdefinition" labelFor="workflow_definition">
      <Field name="workflow_definition" id="workflow_definition" component={SelectField} options={[]} itemRef={'workflow_definitions'}></Field>
  </FormField>



























  <FormField label="Documenttemplate(optional)" labelFor="document_template">
      <Field name="document_template" id="document_template" component={SelectField} options={[]} itemRef={'document_templates'}></Field>
  </FormField>









  <FormField
      label="Foldertitle"
  >
      <Field
          name="title"
          placeholder="Foldertitle"
      />
  </FormField>









































  <FormField label="Status" labelFor="status">
      <Field name="status" id="status" component="select">
      
        <option value="draft">draft</option>
      
        <option value="awaiting_payment">awaiting_payment</option>
      
        <option value="in_authentication">in_authentication</option>
      
        <option value="in_signing">in_signing</option>
      
        <option value="changes_requested">changes_requested</option>
      
        <option value="revoked">revoked</option>
      
        <option value="expired">expired</option>
      
        <option value="completed">completed</option>
      
        <option value="blocked">blocked</option>
      
      </Field>
  </FormField>























  <FormField
      label="Startedat"
  >
      <Field
          type="datetime-local"
          name="started_at"
          placeholder="Startedat"
      />
  </FormField>



























  <FormField
      label="Deadlineat"
  >
      <Field
          type="datetime-local"
          name="deadline_at"
          placeholder="Deadlineat"
      />
  </FormField>



























  <FormField
      label="Completedat"
  >
      <Field
          type="datetime-local"
          name="completed_at"
          placeholder="Completedat"
      />
  </FormField>

































  <FormField label='Requiresnotary' labelFor='requires_notary'>
      <Field
          name='requires_notary'
          id='requires_notary'
          component={SwitchField}
      ></Field>
  </FormField>













    <FormField label="Servicewarning" hasTextareaHeight>
        <Field name="service_warning" as="textarea" placeholder="Servicewarning" />
    </FormField>











































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

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

export default Contract_foldersNew
