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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    actor: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    entity_type: 'purchase_requisition',
    
    
    
    
    
    
    
    entity_reference: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    action: 'created',
    
    
    
    
    
    
    
    
    
    
    
    
    event_time: '',
    
    
    
    
    
    
    
    
    
    
    
    message: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    ip_address: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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























  <FormField label="EntityType" labelFor="entity_type">
      <Field name="entity_type" id="entity_type" component="select">
      
        <option value="purchase_requisition">purchase_requisition</option>
      
        <option value="purchase_order">purchase_order</option>
      
        <option value="goods_receipt">goods_receipt</option>
      
        <option value="vendor_invoice">vendor_invoice</option>
      
        <option value="payment">payment</option>
      
        <option value="document">document</option>
      
        <option value="product">product</option>
      
        <option value="vendor">vendor</option>
      
      </Field>
  </FormField>













  <FormField
      label="EntityReference"
  >
      <Field
          name="entity_reference"
          placeholder="EntityReference"
      />
  </FormField>









































  <FormField label="Action" labelFor="action">
      <Field name="action" id="action" component="select">
      
        <option value="created">created</option>
      
        <option value="updated">updated</option>
      
        <option value="submitted">submitted</option>
      
        <option value="approved">approved</option>
      
        <option value="rejected">rejected</option>
      
        <option value="sent">sent</option>
      
        <option value="posted">posted</option>
      
        <option value="received">received</option>
      
        <option value="paid">paid</option>
      
        <option value="archived">archived</option>
      
        <option value="commented">commented</option>
      
        <option value="attached_file">attached_file</option>
      
      </Field>
  </FormField>























  <FormField
      label="EventTime"
  >
      <Field
          type="datetime-local"
          name="event_time"
          placeholder="EventTime"
      />
  </FormField>



















    <FormField label="Message" hasTextareaHeight>
        <Field name="message" as="textarea" placeholder="Message" />
    </FormField>

























  <FormField
      label="IPAddress"
  >
      <Field
          name="ip_address"
          placeholder="IPAddress"
      />
  </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('/activity_logs/activity_logs-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Activity_logsNew
