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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    company: '',
    
    
    
    
    name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    channel: 'email',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    event_key: 'booking_created',
    
    
    
    
    
    
    
    subject_template: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    body_template: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    is_active: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/notification_templates/notification_templates-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="TemplateName"
  >
      <Field
          name="name"
          placeholder="TemplateName"
      />
  </FormField>









































  <FormField label="Channel" labelFor="channel">
      <Field name="channel" id="channel" component="select">
      
        <option value="email">email</option>
      
        <option value="whatsapp">whatsapp</option>
      
        <option value="sms">sms</option>
      
      </Field>
  </FormField>



























  <FormField label="EventKey" labelFor="event_key">
      <Field name="event_key" id="event_key" component="select">
      
        <option value="booking_created">booking_created</option>
      
        <option value="payment_succeeded">payment_succeeded</option>
      
        <option value="booking_confirmed">booking_confirmed</option>
      
        <option value="booking_cancelled">booking_cancelled</option>
      
        <option value="pickup_reminder">pickup_reminder</option>
      
        <option value="dropoff_reminder">dropoff_reminder</option>
      
        <option value="checkin_completed">checkin_completed</option>
      
        <option value="invoice_issued">invoice_issued</option>
      
      </Field>
  </FormField>













  <FormField
      label="SubjectTemplate"
  >
      <Field
          name="subject_template"
          placeholder="SubjectTemplate"
      />
  </FormField>































      <FormField label='BodyTemplate' hasTextareaHeight>
          <Field
              name='body_template'
              id='body_template'
              component={RichTextField}
          ></Field>
      </FormField>







































  <FormField label='IsActive' labelFor='is_active'>
      <Field
          name='is_active'
          id='is_active'
          component={SwitchField}
      ></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('/notification_templates/notification_templates-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Notification_templatesNew
