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 = {
    
    
    store_name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    default_language: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    default_currency: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    rtl_enabled: false,
    
    
    
    
    
    
    
    
    
    
    adsense_head_code: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    footer_bottom_text: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    store_logo: [],
    
    
    
    
    
    
    
    
    
    
    
    footer_partner_banner_enabled: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    footer_partner_banner_image: [],
    
    
    
    
    
    
    
    footer_partner_banner_text: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    footer_partner_banner_url: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
}


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="StoreName"
  >
      <Field
          name="store_name"
          placeholder="StoreName"
      />
  </FormField>



























  <FormField
      label="DefaultLanguage"
  >
      <Field
          name="default_language"
          placeholder="DefaultLanguage"
      />
  </FormField>



























  <FormField
      label="DefaultCurrency"
  >
      <Field
          name="default_currency"
          placeholder="DefaultCurrency"
      />
  </FormField>











































  <FormField label='RTLEnabled' labelFor='rtl_enabled'>
      <Field
          name='rtl_enabled'
          id='rtl_enabled'
          component={SwitchField}
      ></Field>
  </FormField>













    <FormField label="AdSenseHeadCode" hasTextareaHeight>
        <Field name="adsense_head_code" as="textarea" placeholder="AdSenseHeadCode" />
    </FormField>

























  <FormField
      label="FooterBottomText"
  >
      <Field
          name="footer_bottom_text"
          placeholder="FooterBottomText"
      />
  </FormField>

















































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





















  <FormField label='FooterPartnerBannerEnabled' labelFor='footer_partner_banner_enabled'>
      <Field
          name='footer_partner_banner_enabled'
          id='footer_partner_banner_enabled'
          component={SwitchField}
      ></Field>
  </FormField>

































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









      <FormField label='FooterPartnerBannerText' hasTextareaHeight>
          <Field
              name='footer_partner_banner_text'
              id='footer_partner_banner_text'
              component={RichTextField}
          ></Field>
      </FormField>























  <FormField
      label="FooterPartnerBannerURL"
  >
      <Field
          name="footer_partner_banner_url"
          placeholder="FooterPartnerBannerURL"
      />
  </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
