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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    tenant: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    owner_user: '',
    
    
    
    
    store_name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    slug: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    store_status: 'draft',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    banner_images: [],
    
    
    
    
    
    tagline: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    about: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    whatsapp_number: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    instagram_handle: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    tiktok_handle: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    custom_domain: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/reseller_stores/reseller_stores-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="Tenant" labelFor="tenant">
      <Field name="tenant" id="tenant" component={SelectField} options={[]} itemRef={'tenants'}></Field>
  </FormField>



























  <FormField label="OwnerUser" labelFor="owner_user">
      <Field name="owner_user" id="owner_user" component={SelectField} options={[]} itemRef={'users'}></Field>
  </FormField>









  <FormField
      label="StoreName"
  >
      <Field
          name="store_name"
          placeholder="StoreName"
      />
  </FormField>



























  <FormField
      label="Slug"
  >
      <Field
          name="slug"
          placeholder="Slug"
      />
  </FormField>









































  <FormField label="StoreStatus" labelFor="store_status">
      <Field name="store_status" id="store_status" component="select">
      
        <option value="draft">draft</option>
      
        <option value="published">published</option>
      
        <option value="suspended">suspended</option>
      
      </Field>
  </FormField>



































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





  <FormField
      label="Tagline"
  >
      <Field
          name="tagline"
          placeholder="Tagline"
      />
  </FormField>































      <FormField label='About' hasTextareaHeight>
          <Field
              name='about'
              id='about'
              component={RichTextField}
          ></Field>
      </FormField>























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



























  <FormField
      label="InstagramHandle"
  >
      <Field
          name="instagram_handle"
          placeholder="InstagramHandle"
      />
  </FormField>



























  <FormField
      label="TikTokHandle"
  >
      <Field
          name="tiktok_handle"
          placeholder="TikTokHandle"
      />
  </FormField>



























  <FormField
      label="CustomDomain"
  >
      <Field
          name="custom_domain"
          placeholder="CustomDomain"
      />
  </FormField>













































  <FormField label="organizations" labelFor="organizations">
      <Field name="organizations" id="organizations" component={SelectField} options={[]} itemRef={'organizations'}></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('/reseller_stores/reseller_stores-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Reseller_storesNew
