feat: add company create page

This commit is contained in:
hamid zarghami
2025-05-11 16:02:13 +03:30
parent 35591cde47
commit f2bef6c9d4
3 changed files with 147 additions and 5 deletions
+12 -2
View File
@@ -522,7 +522,7 @@
"text": "متن اطلاعیه",
"publish_date": "زمان انتشار",
"info_publishdata": "اگر مایلید اطلاعیه در زمان دیگری منتشر شود تاریخ انتشار مورد نظر را انتخاب کنید",
"label_importance": "لیبل مهم در اطلاعیه درج شود",
"label_importance": "لیبل مهم در اطلاعیه درج شود",
"select_service": "انتخاب سرویس",
"select_customer": "انتخاب مشتری",
"contact_announcement": "مخاطب این اطلاعیه",
@@ -806,6 +806,16 @@
"users": "کاربران"
},
"company": {
"count_company": "تعداد شرکت ها"
"count_company": "تعداد شرکت ها",
"company_name": "نام شرکت",
"ceo_first_name": "نام مدیر عامل",
"ceo_last_name": "نام خانوادگی مدیر عامل",
"phone_number": "شماره تماس",
"email": "ایمیل",
"national_id": "شناسه ملی",
"establishment_date": "تاریخ تاسیس",
"address": "آدرس",
"map_link": "لینک نقشه شرکت",
"short_description": "توضیح کوتاه شرکت"
}
}
+118 -3
View File
@@ -3,7 +3,43 @@ import Button from '../../components/Button'
import { TickCircle } from 'iconsax-react'
import Input from '../../components/Input'
import CreateSidebar from './components/CreateSidebar'
import { useTranslation } from 'react-i18next'
import { useFormik } from 'formik'
import * as Yup from 'yup'
const CreateCompany: FC = () => {
const { t } = useTranslation('global')
const formik = useFormik({
initialValues: {
name: '',
ceoFirstName: '',
ceoLastName: '',
phoneNumber: '',
email: '',
nationalId: '',
establishmentDate: '',
address: '',
mapLink: '',
shortDescription: ''
},
validationSchema: Yup.object({
name: Yup.string().required(t('errors.required')),
ceoFirstName: Yup.string().required(t('errors.required')),
ceoLastName: Yup.string().required(t('errors.required')),
phoneNumber: Yup.string().required(t('errors.required')),
email: Yup.string().email(t('errors.invalid_email')).required(t('errors.required')),
nationalId: Yup.string().required(t('errors.required')),
establishmentDate: Yup.string().required(t('errors.required')),
address: Yup.string().required(t('errors.required')),
mapLink: Yup.string().url(t('errors.invalid_url')),
shortDescription: Yup.string().required(t('errors.required'))
}),
onSubmit: (values) => {
console.log(values)
}
})
return (
<div className='mt-4'>
<div className='flex justify-between items-center'>
@@ -13,6 +49,7 @@ const CreateCompany: FC = () => {
<Button
className='w-fit px-4'
onClick={() => formik.handleSubmit()}
>
<div className='flex items-center gap-2'>
<TickCircle size={20} color='white' />
@@ -28,12 +65,90 @@ const CreateCompany: FC = () => {
<div className='rowTwoInput mt-6'>
<Input
label='نام شرکت'
label={t('company.company_name')}
name='name'
onChange={() => { }}
error_text=''
value={formik.values.name}
onChange={formik.handleChange}
error_text={formik.touched.name && formik.errors.name ? formik.errors.name : ''}
/>
<Input
label={t('company.ceo_first_name')}
name='ceoFirstName'
value={formik.values.ceoFirstName}
onChange={formik.handleChange}
error_text={formik.touched.ceoFirstName && formik.errors.ceoFirstName ? formik.errors.ceoFirstName : ''}
/>
</div>
<div className='rowTwoInput mt-6'>
<Input
label={t('company.ceo_last_name')}
name='ceoLastName'
value={formik.values.ceoLastName}
onChange={formik.handleChange}
error_text={formik.touched.ceoLastName && formik.errors.ceoLastName ? formik.errors.ceoLastName : ''}
/>
<Input
label={t('company.phone_number')}
name='phoneNumber'
value={formik.values.phoneNumber}
onChange={formik.handleChange}
error_text={formik.touched.phoneNumber && formik.errors.phoneNumber ? formik.errors.phoneNumber : ''}
/>
</div>
<div className='rowTwoInput mt-6'>
<Input
label={t('company.email')}
name='email'
value={formik.values.email}
onChange={formik.handleChange}
error_text={formik.touched.email && formik.errors.email ? formik.errors.email : ''}
/>
<Input
label={t('company.national_id')}
name='nationalId'
value={formik.values.nationalId}
onChange={formik.handleChange}
error_text={formik.touched.nationalId && formik.errors.nationalId ? formik.errors.nationalId : ''}
/>
</div>
<div className='rowTwoInput mt-6'>
<Input
label={t('company.establishment_date')}
name='establishmentDate'
value={formik.values.establishmentDate}
onChange={formik.handleChange}
error_text={formik.touched.establishmentDate && formik.errors.establishmentDate ? formik.errors.establishmentDate : ''}
/>
<Input
label={t('company.map_link')}
name='mapLink'
value={formik.values.mapLink}
onChange={formik.handleChange}
error_text={formik.touched.mapLink && formik.errors.mapLink ? formik.errors.mapLink : ''}
/>
</div>
<div className='mt-6'>
<Input
label={t('company.address')}
name='address'
value={formik.values.address}
onChange={formik.handleChange}
error_text={formik.touched.address && formik.errors.address ? formik.errors.address : ''}
/>
</div>
<div className='mt-6'>
<Input
label={t('company.short_description')}
name='shortDescription'
value={formik.values.shortDescription}
onChange={formik.handleChange}
error_text={formik.touched.shortDescription && formik.errors.shortDescription ? formik.errors.shortDescription : ''}
/>
</div>
</div>
</div>
+17
View File
@@ -11,3 +11,20 @@ export type IndustryItemType = {
title: string;
companiesCount: number;
};
export type CreateCompanyType = {
name: string;
chiefExecutive: string;
phone: string;
email: string;
identificationNumber: string;
dateOfEstablishment: string;
address: string;
mapAddressLink: string;
description: string;
websiteUrl: string;
profileImageUrl: string;
coverImageUrl: string;
isActive: boolean;
industryId: string;
};