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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    restaurant: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    event_type: 'commande',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    audience: 'admins',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    order_nature: 'nourriture',
    
    
    
    
    
    
    
    
    
    
    quantity_total: '',
    
    
    
    
    
    
    
    
    
    
    
    
    title: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    message: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    event_time: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    is_read: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    target_user: '',
    
    
    
}


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

    
    

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























  <FormField label="Typed'évènement" labelFor="event_type">
      <Field name="event_type" id="event_type" component="select">
      
        <option value="commande">commande</option>
      
        <option value="paiement">paiement</option>
      
        <option value="reservation">reservation</option>
      
        <option value="avis">avis</option>
      
        <option value="stock">stock</option>
      
        <option value="geofence">geofence</option>
      
      </Field>
  </FormField>



























  <FormField label="Audience" labelFor="audience">
      <Field name="audience" id="audience" component="select">
      
        <option value="admins">admins</option>
      
        <option value="personnel">personnel</option>
      
        <option value="client">client</option>
      
        <option value="role_cible">role_cible</option>
      
        <option value="utilisateur_cible">utilisateur_cible</option>
      
      </Field>
  </FormField>



























  <FormField label="Naturecommande" labelFor="order_nature">
      <Field name="order_nature" id="order_nature" component="select">
      
        <option value="nourriture">nourriture</option>
      
        <option value="boisson">boisson</option>
      
        <option value="mixte">mixte</option>
      
        <option value="na">na</option>
      
      </Field>
  </FormField>



















    <FormField
        label="Quantitétotale"
    >
        <Field
            type="number"
            name="quantity_total"
            placeholder="Quantitétotale"
        />
    </FormField>





















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





























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



































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

































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





























  <FormField label="Utilisateurcible" labelFor="target_user">
      <Field name="target_user" id="target_user" component={SelectField} options={[]} itemRef={'users'}></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('/notification_events/notification_events-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Notification_eventsNew
