Add Event Type for Create Event Page and Send SMS

This commit is contained in:
mohammad javad fesahat committed 2024-08-27 12:00:33 +03:30
1 parent 9804625270
commit ad2a3ee70f
4 files changed
+72 -6

No files matched your search

+1 -1
View File
@@ -237,7 +237,7 @@ const LeadIdPage = ({params}:{params: {id: number} })=>{
return (
<div className="w-full md:w-[60%] lg:w-[70%] m-auto " dir="rtl">
<div className="w-full md:w-[60%] lg:w-[90%] m-auto " dir="rtl">
<div className="bg-white rounded-md p-4 flex flex-row mt-7 mb-3 justify-between items-center">
+69 -3
View File
@@ -28,6 +28,12 @@ interface IFormValues {
title: String
},
],
lead_event: [
{
id: Number,
title: String
},
],
product_types: [
{
id: Number,
@@ -65,11 +71,15 @@ interface IShahr {
interface IFormNewLead {
title: string,
mobile1: number,
mobile2: number,
phone: number
customer_id: number,
desc: string,
product_type_id: number ,
lead_type_id: number,
lead_source_id: number,
lead_event_id: number,
ostan: number,
city_id: number,
lead_step_id: number,
@@ -108,6 +118,17 @@ const newLead = ()=>{
await setSubmitButtonEnable(false)
try {
//if data.phone is empty remove
if(data.phone == 0 || data.phone == null || data.phone == undefined || data.phone.toString() == ''){
delete data.phone
}
if(data.mobile2 == 0 || data.mobile2 == null || data.mobile2 == undefined || data.mobile2.toString() == ''){
delete data.mobile2
}
//if data.lead_event_id is empty remove
if(data.lead_event_id == 0 || data.lead_event_id == null || data.lead_event_id == undefined || data.lead_event_id.toString() == '' || data.lead_event_id.toString() == '0'){
delete data.lead_event_id
}
const result = await axiosInstance.post('/lead/new/', data)
if(result.status == 201){
@@ -156,7 +177,7 @@ const newLead = ()=>{
return (
<div className="w-full md:w-[60%] lg:w-[70%] m-auto " dir="rtl">
<div className="w-full md:w-[60%] lg:w-[90%] m-auto " dir="rtl">
<div className="bg-white rounded-md p-4 flex flex-row mt-7 mb-3 justify-between items-center">
@@ -175,12 +196,12 @@ const newLead = ()=>{
<div className='title'>
<Label htmlFor="title">عنوان سرنخ</Label>
<Input {...register("title", { required: 'عنوان ضروری است', minLength: {value: 5, message: 'عنوان مناسب تری بنویسید'} } )} id="title" />
<Input placeholder='مثال: فروش لوله 110 به آقای محمدی از تهران' {...register("title", { required: 'عنوان ضروری است', minLength: {value: 5, message: 'عنوان مناسب تری بنویسید'} } )} id="title" />
</div>
<div className='customer relative w-full'>
<Label htmlFor="title">مشتری</Label>
<Label htmlFor="title">شخص حقیقی یا حقوقی</Label>
<Controller
name="customer_id"
@@ -205,14 +226,59 @@ const newLead = ()=>{
)}
/>
<p className='text-sm text-red-700'>
در صورتی که ایجاد شخص جدید ضرورت ندارد، لطفا آن را به شخصیت بازاریابی خود اضافه کنید.
</p>
</div>
<div className='grid grid-cols-4 gap-x-4 gap-y-4'>
<div className='phoneasli-1'>
<Label>تلفن همراه 1</Label>
<Input {...register("mobile1", { required: 'تلفن همراه 1 ضروری است', pattern: { value: /^(\+98|0)?9\d{9}$/, message: 'فرمت تلفن همراه 1 صحیح نیست'} } )} />
</div>
<div className='phoneasli-2'>
<Label>تلفن همراه 2</Label>
<Input {...register("mobile2", { required: false, pattern: { value: /^(\+98|0)?9\d{9}$/, message: 'فرمت تلفن همراه 2 صحیح نیست'} } )} />
</div>
<div className='phoneasli-2'>
<Label>تلفن ثابت</Label>
<Input {...register("phone", { required: false })} />
</div>
<div className='event w-full'>
<Label>رویداد</Label>
<select {...register("lead_event_id", { required: 'رویداد را انتخاب کنید'} )} className='border rounded-sm w-full h-10'>
<option value={''}>انتخاب کنید</option>
<option value={'0'}>رویداد ندارد</option>
{formValues?.lead_event.map((item, key)=>{
return (<option value={item.id} key={key}>{item.name}</option>)
})}
</select>
</div>
</div>
<div className='desc w-full'>
<Label htmlFor="desc">توضیحات</Label>
<Textarea {...register("desc", { required: 'توضیحات سرنخ ضروری است', minLength: {value: 30, message: 'توضیحات کامل تری بنویسید'} } )} id="desc" />
</div>
<div className='types grid grid-cols-3 gap-x-4 gap-y-4'>
+1 -1
View File
@@ -168,7 +168,7 @@ const leadesPage = ()=>{
}
return (
<div className="w-full md:w-[60%] lg:w-[75%] m-auto " dir="rtl">
<div className="w-full md:w-[60%] lg:w-[90%] m-auto " dir="rtl">
<div className="bg-white rounded-md p-4 flex flex-row mt-7 mb-3 justify-between items-center">
+1 -1
View File
@@ -68,7 +68,7 @@ const marketingPage = ()=>{
}
return (
<div className="w-full md:w-[60%] lg:w-[75%] m-auto " dir="rtl">
<div className="w-full md:w-[60%] lg:w-[90%] m-auto " dir="rtl">
<div className="bg-white rounded-md p-4 flex flex-row mt-7 mb-3 justify-between items-center">