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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    cost_item: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    provider: 'S3',
    
    
    
    
    
    
    
    file_key: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    file_name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    mime_type: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    size_bytes: '',
    
    
    
    
    
    
    
    
    
    
    
    
    file_url: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    checksum_sha256: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    uploaded_at: '',
    
    
    
    
    
    
    
    
    
    
    uploaded_by: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

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























  <FormField label="StorageProvider" labelFor="provider">
      <Field name="provider" id="provider" component="select">
      
        <option value="S3">S3</option>
      
        <option value="AZURE_BLOB">AZURE_BLOB</option>
      
        <option value="GCS">GCS</option>
      
        <option value="LOCAL">LOCAL</option>
      
      </Field>
  </FormField>













  <FormField
      label="FileKey"
  >
      <Field
          name="file_key"
          placeholder="FileKey"
      />
  </FormField>



























  <FormField
      label="FileName"
  >
      <Field
          name="file_name"
          placeholder="FileName"
      />
  </FormField>



























  <FormField
      label="MIMEType"
  >
      <Field
          name="mime_type"
          placeholder="MIMEType"
      />
  </FormField>

































    <FormField
        label="Size(bytes)"
    >
        <Field
            type="number"
            name="size_bytes"
            placeholder="Size(bytes)"
        />
    </FormField>





















  <FormField
      label="FileURL"
  >
      <Field
          name="file_url"
          placeholder="FileURL"
      />
  </FormField>



























  <FormField
      label="ChecksumSHA-256"
  >
      <Field
          name="checksum_sha256"
          placeholder="ChecksumSHA-256"
      />
  </FormField>





































  <FormField
      label="UploadedAt"
  >
      <Field
          type="datetime-local"
          name="uploaded_at"
          placeholder="UploadedAt"
      />
  </FormField>

















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

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

export default Cost_filesNew
