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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    recipient: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    type: 'like',
    
    
    
    
    
    
    
    title: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    body: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    media_item: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    event: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    album: '',
    
    
    
    
    
    
    
    
    
    
    is_read: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    read_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    sent_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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























  <FormField label="Type" labelFor="type">
      <Field name="type" id="type" component="select">
      
        <option value="like">like</option>
      
        <option value="comment">comment</option>
      
        <option value="reply">reply</option>
      
        <option value="tag">tag</option>
      
        <option value="mention">mention</option>
      
        <option value="share">share</option>
      
        <option value="upload_complete">upload_complete</option>
      
        <option value="album_update">album_update</option>
      
        <option value="event_update">event_update</option>
      
        <option value="moderation">moderation</option>
      
        <option value="system">system</option>
      
      </Field>
  </FormField>













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





























    <FormField label="Body" hasTextareaHeight>
        <Field name="body" as="textarea" placeholder="Body" />
    </FormField>











































  <FormField label="MediaItem" labelFor="media_item">
      <Field name="media_item" id="media_item" component={SelectField} options={[]} itemRef={'media_items'}></Field>
  </FormField>



























  <FormField label="Event" labelFor="event">
      <Field name="event" id="event" component={SelectField} options={[]} itemRef={'events'}></Field>
  </FormField>



























  <FormField label="Album" labelFor="album">
      <Field name="album" id="album" component={SelectField} options={[]} itemRef={'albums'}></Field>
  </FormField>

























  <FormField label='IsRead' labelFor='is_read'>
      <Field
          name='is_read'
          id='is_read'
          component={SwitchField}
      ></Field>
  </FormField>





















  <FormField
      label="ReadAt"
  >
      <Field
          type="datetime-local"
          name="read_at"
          placeholder="ReadAt"
      />
  </FormField>



























  <FormField
      label="SentAt"
  >
      <Field
          type="datetime-local"
          name="sent_at"
          placeholder="SentAt"
      />
  </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('/notifications/notifications-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default NotificationsNew
