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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    album: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    uploader: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    storage_object: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    media_type: 'photo',
    
    
    
    
    
    
    
    title: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    caption: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    captured_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    uploaded_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    width: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    height: '',
    
    
    
    
    
    
    
    
    
    
    
    
    duration_seconds: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    camera_make: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    camera_model: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    gps_latitude: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    gps_longitude: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    visibility: 'visible',
    
    
    
    
    
    
    
    
    
    
    
    
    
    is_duplicate: false,
    
    
    
    
    
    
    
    
    
    duplicate_group_key: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    ai_tags: [],
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    user_tags: [],
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    likes: [],
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    comments: [],
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    saves: [],
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    mentions: [],
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    face_detections: [],
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    watermarked_downloads: [],
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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



























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



























  <FormField label="StorageObject" labelFor="storage_object">
      <Field name="storage_object" id="storage_object" component={SelectField} options={[]} itemRef={'storage_objects'}></Field>
  </FormField>























  <FormField label="MediaType" labelFor="media_type">
      <Field name="media_type" id="media_type" component="select">
      
        <option value="photo">photo</option>
      
        <option value="video">video</option>
      
      </Field>
  </FormField>













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































      <FormField label='Caption' hasTextareaHeight>
          <Field
              name='caption'
              id='caption'
              component={RichTextField}
          ></Field>
      </FormField>

































  <FormField
      label="CapturedAt"
  >
      <Field
          type="datetime-local"
          name="captured_at"
          placeholder="CapturedAt"
      />
  </FormField>



























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























    <FormField
        label="Width"
    >
        <Field
            type="number"
            name="width"
            placeholder="Width"
        />
    </FormField>



























    <FormField
        label="Height"
    >
        <Field
            type="number"
            name="height"
            placeholder="Height"
        />
    </FormField>



























    <FormField
        label="DurationSeconds"
    >
        <Field
            type="number"
            name="duration_seconds"
            placeholder="DurationSeconds"
        />
    </FormField>





















  <FormField
      label="CameraMake"
  >
      <Field
          name="camera_make"
          placeholder="CameraMake"
      />
  </FormField>



























  <FormField
      label="CameraModel"
  >
      <Field
          name="camera_model"
          placeholder="CameraModel"
      />
  </FormField>

































    <FormField
        label="GPSLatitude"
    >
        <Field
            type="number"
            name="gps_latitude"
            placeholder="GPSLatitude"
        />
    </FormField>



























    <FormField
        label="GPSLongitude"
    >
        <Field
            type="number"
            name="gps_longitude"
            placeholder="GPSLongitude"
        />
    </FormField>



































  <FormField label="Visibility" labelFor="visibility">
      <Field name="visibility" id="visibility" component="select">
      
        <option value="visible">visible</option>
      
        <option value="hidden">hidden</option>
      
        <option value="flagged">flagged</option>
      
        <option value="deleted">deleted</option>
      
      </Field>
  </FormField>





























  <FormField label='IsDuplicate' labelFor='is_duplicate'>
      <Field
          name='is_duplicate'
          id='is_duplicate'
          component={SwitchField}
      ></Field>
  </FormField>











  <FormField
      label="DuplicateGroupKey"
  >
      <Field
          name="duplicate_group_key"
          placeholder="DuplicateGroupKey"
      />
  </FormField>















































    <FormField label='AITags' labelFor='ai_tags'>
        <Field
            name='ai_tags'
            id='ai_tags'
            itemRef={'media_ai_tags'}
            options={[]}
            component={SelectFieldMany}>
        </Field>
    </FormField>



























    <FormField label='UserTags' labelFor='user_tags'>
        <Field
            name='user_tags'
            id='user_tags'
            itemRef={'media_user_tags'}
            options={[]}
            component={SelectFieldMany}>
        </Field>
    </FormField>



























    <FormField label='Likes' labelFor='likes'>
        <Field
            name='likes'
            id='likes'
            itemRef={'likes'}
            options={[]}
            component={SelectFieldMany}>
        </Field>
    </FormField>



























    <FormField label='Comments' labelFor='comments'>
        <Field
            name='comments'
            id='comments'
            itemRef={'comments'}
            options={[]}
            component={SelectFieldMany}>
        </Field>
    </FormField>



























    <FormField label='Saves' labelFor='saves'>
        <Field
            name='saves'
            id='saves'
            itemRef={'favourites'}
            options={[]}
            component={SelectFieldMany}>
        </Field>
    </FormField>



























    <FormField label='Mentions' labelFor='mentions'>
        <Field
            name='mentions'
            id='mentions'
            itemRef={'mentions'}
            options={[]}
            component={SelectFieldMany}>
        </Field>
    </FormField>



























    <FormField label='FaceDetections' labelFor='face_detections'>
        <Field
            name='face_detections'
            id='face_detections'
            itemRef={'face_detections'}
            options={[]}
            component={SelectFieldMany}>
        </Field>
    </FormField>



























    <FormField label='WatermarkedDownloads' labelFor='watermarked_downloads'>
        <Field
            name='watermarked_downloads'
            id='watermarked_downloads'
            itemRef={'download_jobs'}
            options={[]}
            component={SelectFieldMany}>
        </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('/media_items/media_items-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Media_itemsNew
