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 = {
    
    
    site_name_ar: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    site_tagline_ar: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    logo: [],
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    favicon: [],
    
    
    
    
    
    primary_font: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    direction: 'rtl',
    
    
    
    
    
    
    
    primary_color_hex: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    accent_color_hex: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    seo_default_title_ar: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    seo_default_description_ar: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    brand_guidelines: [],
    
    
    
    
    
}


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="SiteNameArabic"
  >
      <Field
          name="site_name_ar"
          placeholder="SiteNameArabic"
      />
  </FormField>



























  <FormField
      label="SiteTaglineArabic"
  >
      <Field
          name="site_tagline_ar"
          placeholder="SiteTaglineArabic"
      />
  </FormField>

















































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



























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





  <FormField
      label="PrimaryFont"
  >
      <Field
          name="primary_font"
          placeholder="PrimaryFont"
      />
  </FormField>









































  <FormField label="Direction" labelFor="direction">
      <Field name="direction" id="direction" component="select">
      
        <option value="rtl">rtl</option>
      
        <option value="ltr">ltr</option>
      
      </Field>
  </FormField>













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



























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



























  <FormField
      label="SEODefaultTitleArabic"
  >
      <Field
          name="seo_default_title_ar"
          placeholder="SEODefaultTitleArabic"
      />
  </FormField>





























    <FormField label="SEODefaultDescriptionArabic" hasTextareaHeight>
        <Field name="seo_default_description_ar" as="textarea" placeholder="SEODefaultDescriptionArabic" />
    </FormField>
















































  <FormField>
      <Field
          label='BrandGuidelines'
          color='info'
          icon={mdiUpload}
          path={'site_settings/brand_guidelines'}
          name='brand_guidelines'
          id='brand_guidelines'
          schema={{
            size: undefined,
            formats: undefined,
          }}
          component={FormFilePicker}
      ></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
