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

const initialValues = {
    
    
    store_name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    store_tagline: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    support_email: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    support_phone: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    whatsapp_number: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    currency_code: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    timezone: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    logo_images: [],
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    banner_images: [],
    
    
    
    
    
    primary_color_hex: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    secondary_color_hex: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    maintenance_mode: false,
    
    
    
    
    
    
    
    
}


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

    
    

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



























  <FormField
      label="SupportEmail"
  >
      <Field
          name="support_email"
          placeholder="SupportEmail"
      />
  </FormField>



























  <FormField
      label="SupportPhone"
  >
      <Field
          name="support_phone"
          placeholder="SupportPhone"
      />
  </FormField>



























  <FormField
      label="WhatsAppNumber"
  >
      <Field
          name="whatsapp_number"
          placeholder="WhatsAppNumber"
      />
  </FormField>



























  <FormField
      label="CurrencyCode"
  >
      <Field
          name="currency_code"
          placeholder="CurrencyCode"
      />
  </FormField>



























  <FormField
      label="Timezone"
  >
      <Field
          name="timezone"
          placeholder="Timezone"
      />
  </FormField>

















































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



























  <FormField>
      <Field
          label='BannerImages'
          color='info'
          icon={mdiUpload}
          path={'store_settings/banner_images'}
          name='banner_images'
          id='banner_images'
          schema={{
            size: undefined,
            formats: undefined,
          }}
          component={FormImagePicker}
      ></Field>
  </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='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('/store_settings/store_settings-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Store_settingsNew
