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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    entity_type: 'product',
    
    
    
    
    
    
    
    entity_key: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    meta_title_ar: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    meta_title_en: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    meta_description_ar: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    meta_description_en: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    canonical_url: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    open_graph_image_url: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/seo_entries/seo_entries-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="EntityType" labelFor="entity_type">
      <Field name="entity_type" id="entity_type" component="select">
      
        <option value="product">product</option>
      
        <option value="category">category</option>
      
        <option value="collection">collection</option>
      
        <option value="cms_page">cms_page</option>
      
      </Field>
  </FormField>













  <FormField
      label="EntityKey"
  >
      <Field
          name="entity_key"
          placeholder="EntityKey"
      />
  </FormField>



























  <FormField
      label="MetaTitle(Arabic)"
  >
      <Field
          name="meta_title_ar"
          placeholder="MetaTitle(Arabic)"
      />
  </FormField>



























  <FormField
      label="MetaTitle(English)"
  >
      <Field
          name="meta_title_en"
          placeholder="MetaTitle(English)"
      />
  </FormField>





























    <FormField label="MetaDescription(Arabic)" hasTextareaHeight>
        <Field name="meta_description_ar" as="textarea" placeholder="MetaDescription(Arabic)" />
    </FormField>



























    <FormField label="MetaDescription(English)" hasTextareaHeight>
        <Field name="meta_description_en" as="textarea" placeholder="MetaDescription(English)" />
    </FormField>

























  <FormField
      label="CanonicalURL"
  >
      <Field
          name="canonical_url"
          placeholder="CanonicalURL"
      />
  </FormField>



























  <FormField
      label="OpenGraphImageURL"
  >
      <Field
          name="open_graph_image_url"
          placeholder="OpenGraphImageURL"
      />
  </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('/seo_entries/seo_entries-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Seo_entriesNew
