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

const initialValues = {
    
    
    brand_name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    logo_images: [],
    
    
    
    
    
    
    footer_tagline: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    primary_color_hex: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    secondary_color_hex: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    accent_color_hex: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    default_meta_title: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    default_meta_description: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    default_meta_keywords: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    maintenance_mode: false,
    
    
    
    
    
    
    
    
}


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

    
    

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

















































  <FormField>
      <Field
          label='LogoImages'
          color='info'
          icon={mdiUpload}
          path={'site_settings/logo_images'}
          name='logo_images'
          id='logo_images'
          schema={{
            size: undefined,
            formats: undefined,
          }}
          component={FormImagePicker}
      ></Field>
  </FormField>







    <FormField label="FooterTagline" hasTextareaHeight>
        <Field name="footer_tagline" as="textarea" placeholder="FooterTagline" />
    </FormField>

























  <FormField
      label="PrimaryColorHex"
  >
      <Field
          name="primary_color_hex"
          placeholder="PrimaryColorHex"
      />
  </FormField>



























  <FormField
      label="SecondaryColorHex"
  >
      <Field
          name="secondary_color_hex"
          placeholder="SecondaryColorHex"
      />
  </FormField>



























  <FormField
      label="AccentColorHex"
  >
      <Field
          name="accent_color_hex"
          placeholder="AccentColorHex"
      />
  </FormField>



























  <FormField
      label="DefaultMetaTitle"
  >
      <Field
          name="default_meta_title"
          placeholder="DefaultMetaTitle"
      />
  </FormField>





























    <FormField label="DefaultMetaDescription" hasTextareaHeight>
        <Field name="default_meta_description" as="textarea" placeholder="DefaultMetaDescription" />
    </FormField>



























    <FormField label="DefaultMetaKeywords" hasTextareaHeight>
        <Field name="default_meta_keywords" as="textarea" placeholder="DefaultMetaKeywords" />
    </FormField>









































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

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

export default Site_settingsNew
