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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    repair_order: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    event_type: 'order_created',
    
    
    
    
    
    
    
    to_number: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    message_body: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    status: 'queued',
    
    
    
    
    
    
    
    
    
    
    
    
    queued_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    sent_at: '',
    
    
    
    
    
    
    
    
    
    
    provider_message_id: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    error_details: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

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























  <FormField label="EventType" labelFor="event_type">
      <Field name="event_type" id="event_type" component="select">
      
        <option value="order_created">order_created</option>
      
        <option value="status_changed">status_changed</option>
      
        <option value="payment_received">payment_received</option>
      
        <option value="invoice_issued">invoice_issued</option>
      
        <option value="custom">custom</option>
      
      </Field>
  </FormField>













  <FormField
      label="ToNumber"
  >
      <Field
          name="to_number"
          placeholder="ToNumber"
      />
  </FormField>





























    <FormField label="MessageBody" hasTextareaHeight>
        <Field name="message_body" as="textarea" placeholder="MessageBody" />
    </FormField>







































  <FormField label="Status" labelFor="status">
      <Field name="status" id="status" component="select">
      
        <option value="queued">queued</option>
      
        <option value="sent">sent</option>
      
        <option value="failed">failed</option>
      
      </Field>
  </FormField>























  <FormField
      label="QueuedAt"
  >
      <Field
          type="datetime-local"
          name="queued_at"
          placeholder="QueuedAt"
      />
  </FormField>



























  <FormField
      label="SentAt"
  >
      <Field
          type="datetime-local"
          name="sent_at"
          placeholder="SentAt"
      />
  </FormField>

















  <FormField
      label="ProviderMessageId"
  >
      <Field
          name="provider_message_id"
          placeholder="ProviderMessageId"
      />
  </FormField>





























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

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

export default Whatsapp_notificationsNew
