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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    company: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    stop: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    type: 'POD_SIGNED',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    provider: 'S3',
    
    
    
    
    
    
    
    file_key: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    file_name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    mime_type: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    size_bytes: '',
    
    
    
    
    
    
    
    
    
    
    
    
    file_url: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    checksum_sha256: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    uploaded_at: '',
    
    
    
    
    
    
    
    
    
    
    uploaded_by: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    notes: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

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



























  <FormField label="Stop" labelFor="stop">
      <Field name="stop" id="stop" component={SelectField} options={[]} itemRef={'load_stops'}></Field>
  </FormField>























  <FormField label="PODType" labelFor="type">
      <Field name="type" id="type" component="select">
      
        <option value="POD_SIGNED">POD_SIGNED</option>
      
        <option value="CMR_SIGNED">CMR_SIGNED</option>
      
        <option value="DELIVERY_NOTE">DELIVERY_NOTE</option>
      
        <option value="DAMAGE_REPORT">DAMAGE_REPORT</option>
      
        <option value="OTHER">OTHER</option>
      
      </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>





























    <FormField label="Notes" hasTextareaHeight>
        <Field name="notes" as="textarea" placeholder="Notes" />
    </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('/pod_files/pod_files-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Pod_filesNew
