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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    user: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    recommendation_type: 'feed_post',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    post: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    suggested_user: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    group: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    hashtag: '',
    
    
    
    
    score: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    reason_text: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    generated_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    expires_at: '',
    
    
    
    
    
    
    
    
    
}


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

    
    

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























  <FormField label="RecommendationType" labelFor="recommendation_type">
      <Field name="recommendation_type" id="recommendation_type" component="select">
      
        <option value="feed_post">feed_post</option>
      
        <option value="suggested_user">suggested_user</option>
      
        <option value="suggested_group">suggested_group</option>
      
        <option value="suggested_hashtag">suggested_hashtag</option>
      
      </Field>
  </FormField>































  <FormField label="Post" labelFor="post">
      <Field name="post" id="post" component={SelectField} options={[]} itemRef={'posts'}></Field>
  </FormField>



























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



























  <FormField label="Group" labelFor="group">
      <Field name="group" id="group" component={SelectField} options={[]} itemRef={'groups'}></Field>
  </FormField>



























  <FormField label="Hashtag" labelFor="hashtag">
      <Field name="hashtag" id="hashtag" component={SelectField} options={[]} itemRef={'hashtags'}></Field>
  </FormField>















    <FormField
        label="Score"
    >
        <Field
            type="number"
            name="score"
            placeholder="Score"
        />
    </FormField>























    <FormField label="Reason" hasTextareaHeight>
        <Field name="reason_text" as="textarea" placeholder="Reason" />
    </FormField>



































  <FormField
      label="GeneratedAt"
  >
      <Field
          type="datetime-local"
          name="generated_at"
          placeholder="GeneratedAt"
      />
  </FormField>



























  <FormField
      label="ExpiresAt"
  >
      <Field
          type="datetime-local"
          name="expires_at"
          placeholder="ExpiresAt"
      />
  </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('/ai_recommendations/ai_recommendations-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Ai_recommendationsNew
