turkmen-textile-front/dist/assets/b2b-Bv9LWoQb.js

2 lines
11 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{u,j as e,m as h,l as F,n as d,o as x,p as g,q as s,B as j,L as S,r as w,s as P,t as _,v as k,C as G,w as C}from"./ui-library-BWmJzXiX.js";import{a as y}from"./react-vendor-DnK_KZAP.js";import{z as n,t as D,a as V}from"./index-XsVNdJkE.js";import{R as E,a as v}from"./radio-group-JZueQgsm.js";import{u as R}from"./use-scroll-top-DE9Ps7OH.js";const q=n.object({type:n.string(),company_name:n.string().min(3,{message:"Название компании должно быть не менее 3 символов"}),representative_name:n.string().min(3,{message:"Имя представителя должно быть не менее 3 символов"}),job_title:n.string().min(3,{message:"Должность должна быть не менее 3 символов"}),participants_number:n.string().min(1,{message:"Укажите количество участников"}),country:n.string().min(3,{message:"Название страны должно быть не менее 3 символов"}),email_address:n.string().email({message:"Укажите корректный email"}),phone_number:n.string().min(8,{message:"Номер телефона должен быть не менее 8 символов"}),website:n.string().optional(),meeting_objective:n.string().min(3,{message:"Укажите цель встречи"}),proposal_description:n.string().optional(),government_agency:n.string().optional(),sector_industry:n.string().optional(),key_services:n.string().optional(),government_experience:n.string().optional(),preferred_meeting_datetime:n.string().optional(),meeting_mode:n.string().optional(),language_preference:n.string().optional(),technical_requirements:n.string().optional(),company_profile:n.custom(r=>r instanceof File,{message:"Выберите корректный файл"}).refine(r=>r&&["image/jpeg","image/png","application/pdf"].includes(r.type),{message:"Допускаются только файлы JPG, PNG и PDF"}).optional(),proposal_presentation:n.custom(r=>r instanceof File,{message:"Выберите корректный файл"}).refine(r=>r&&["image/jpeg","image/png","application/pdf"].includes(r.type),{message:"Допускаются только файлы JPG, PNG и PDF"}).optional(),relevant_certification:n.custom(r=>r instanceof File,{message:"Выберите корректный файл"}).refine(r=>r&&["image/jpeg","image/png","application/pdf"].includes(r.type),{message:"Допускаются только файлы JPG, PNG и PDF"}).optional()}),z={type:"B2B",company_name:"",representative_name:"",job_title:"",participants_number:"",country:"",email_address:"",phone_number:"",website:"",meeting_objective:"",proposal_description:"",government_agency:"",sector_industry:"",key_services:"",government_experience:"",preferred_meeting_datetime:"",meeting_mode:"",language_preference:"",technical_requirements:""},I=({handleNext:r})=>{const{control:a,formState:t}=u();return e.jsxs(h.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,y:"100%",transition:{duration:.2}},className:"w-full",children:[e.jsx("h3",{className:"h2 mb-8",children:"Информация об экспоненте:"}),e.jsxs("div",{className:"flex flex-col gap-8",children:[e.jsx(F,{defaultValue:1,control:a,name:"type",render:({field:o})=>e.jsxs(d,{className:"space-y-3",children:[e.jsx(x,{className:"text-xl",children:"Тип:"}),e.jsx(g,{children:e.jsxs(E,{onValueChange:o.onChange,defaultValue:o.value,className:"flex flex-col space-y-4",children:[e.jsxs(d,{className:"flex items-center space-x-3 space-y-0",children:[e.jsx(g,{children:e.jsx(v,{value:"B2B",checked:o.value==="B2B"})}),e.jsx(x,{className:"text-base",children:"B2B"})]}),e.jsxs(d,{className:"flex items-center space-x-3 space-y-0",children:[e.jsx(g,{children:e.jsx(v,{value:"B2G",checked:o.value==="B2G"})}),e.jsx(x,{className:"text-base",children:"B2G"})]})]})})]})}),e.jsx(s,{control:a,name:"company_name",error:t.errors.company_name,placeholder:"",label:"Название компании/организации"}),e.jsx(s,{control:a,name:"representative_name",error:t.errors.representative_name,placeholder:"",label:"Имя представителя"}),e.jsx(s,{control:a,name:"job_title",error:t.errors.job_title,placeholder:"",label:"Название должности/позиция"}),e.jsx(s,{control:a,name:"participants_number",error:t.errors.participants_number,placeholder:"",label:"Количество участников"}),e.jsx(s,{control:a,name:"country",error:t.errors.country,placeholder:"",label:"Страна"}),e.jsx(s,{control:a,name:"email_address",error:t.errors.email_address,placeholder:"",label:"E-mail адрес"}),e.jsx(s,{control:a,name:"phone_number",error:t.errors.phone_number,placeholder:"",label:"Номер телефона"}),e.jsx(s,{control:a,name:"website",placeholder:"",label:"Вебсайт"})]}),e.jsx(j,{variant:"secondary",type:"button",onClick:r,className:"w-full mt-10",children:"Далее"})]})},J=({handleNext:r})=>{const{control:a,formState:t}=u();return e.jsxs(h.div,{initial:{opacity:0,y:-100},animate:{opacity:1,y:0,transition:{delay:.5,duration:.3}},exit:{opacity:0,y:100},children:[e.jsx("h3",{className:"h2 mb-8",children:"Цели встречи:"}),e.jsxs("div",{className:"flex flex-col gap-8",children:[e.jsx(s,{control:a,name:"meeting_objective",error:t.errors.meeting_objective,placeholder:"",label:"Основная цель встречи"}),e.jsx(s,{control:a,name:"proposal_description",error:t.errors.proposal_description,placeholder:"",label:"Краткое описание вашего предложения/проекта/запроса"}),e.jsx(s,{control:a,name:"government_agency",error:t.errors.government_agency,placeholder:"",label:"Соответствующее государственное учреждение/департамент"}),e.jsx("h3",{className:"h2 mt-4",children:"Информация о компании/организации:"}),e.jsx(s,{control:a,name:"sector_industry",error:t.errors.sector_industry,placeholder:"",label:"Отраслевая промышленность"}),e.jsx(s,{control:a,name:"key_services",error:t.errors.key_services,placeholder:"",label:"Ключевые услуги/продукты"}),e.jsx(s,{control:a,name:"government_experience",error:t.errors.government_experience,placeholder:"",label:"Предыдущий опыт работы с правительствами (если применимо)"})]}),e.jsx(j,{variant:"secondary",type:"button",onClick:r,className:"w-full mt-10",children:"Далее"})]})},L=()=>{const{control:r,formState:a}=u();return e.jsxs(h.div,{initial:{opacity:0,y:-100},animate:{opacity:1,y:0,transition:{delay:.5,duration:.3}},transition:{duration:1},children:[e.jsx("h3",{className:"h2 mb-8",children:"Логистика встречи:"}),e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx(s,{control:r,name:"preferred_meeting_datetime",error:a.errors.preferred_meeting_datetime,placeholder:"",label:"Предпочтительная дата и время "}),e.jsx(s,{control:r,name:"preferred_mode",error:a.errors.preferred_mode,placeholder:"",label:"Предпочтительный способ проведения встречи (лично, виртуально (через zoom/ teams/другое), гибридный)"}),e.jsx(s,{control:r,name:"language_preference",error:a.errors.language_preference,placeholder:"",label:"Предпочитаемый язык (английский, туркменский, русский, другой)"}),e.jsx(s,{control:r,name:"additional_technical",error:a.errors.additional_technical,placeholder:"",label:"Дополнительные технические или логистические требования (например, аудио-видео оборудование, переводчики и т.д.)"}),e.jsx("h3",{className:"h2 mt-4",children:"Название компании/организации"}),e.jsx(s,{control:r,name:"sector_industry",error:a.errors.sector_industry,placeholder:"",label:"Sector Industry"}),e.jsx(s,{control:r,name:"key_services",error:a.errors.key_services,placeholder:"",label:"Key Services/Products"}),e.jsx(s,{control:r,name:"government_experience",error:a.errors.government_experience,placeholder:"",label:"Previous Experience working with Governments (if applicable)"})]}),e.jsxs("div",{className:"flex flex-col gap-8",children:[e.jsxs("div",{className:"",children:[e.jsx("h3",{className:"h2 mt-10",children:"Attachments"}),e.jsx("h5",{className:"text-on_surface_v",children:"(Please attach the following documents as applicable)"})]}),e.jsx(s,{control:r,name:"company_profile",label:"Company/organization profile",type:"file",textDark:!0}),e.jsx(s,{control:r,name:"proposal_presentation",label:"Proposal presentation",type:"file",textDark:!0}),e.jsx(s,{control:r,name:"relevant_certification",label:"Relevant certification/licenses",type:"file",textDark:!0})]}),e.jsx(j,{disabled:a.isSubmitting,type:"submit",className:"w-full mt-10",children:a.isSubmitting?e.jsx(S,{className:"animate-spin"}):"Отправить"})]})},T=({stage:r,setStage:a,success:t,setSuccess:o})=>{const p=w({resolver:D(q),defaultValues:z,mode:"onChange"}),N=c=>{switch(c){case 1:return["type","company_name","representative_name","job_title","participants_number","country","email_address","phone_number","website"];case 2:return["meeting_objective","proposal_description","government_agency","sector_industry","key_services","government_experience"];case 3:return["preferred_meeting_datetime","meeting_mode","language_preference","technical_requirements","company_profile","proposal_presentation","relevant_certification"];default:return[]}},f=async()=>{const c=N(r);await p.trigger(c)&&a(b=>b+1)},B=async c=>{try{const i=new FormData;Object.entries(c).forEach(([m,l])=>{l instanceof File?(console.log(`Добавляем файл: ${m}`,l),i.append(m,l)):l!==void 0&&(console.log(`Добавляем поле: ${m}`,l),i.append(m,l))}),(await V.post("https://turkmentextile.turkmenexpo.com/app/api/v1/form",i,{headers:{"Content-Type":"multipart/form-data"}})).status===201&&(console.log("Форма успешно отправлена!"),o(!0))}catch(i){console.error("Ошибка при отправке B2B формы:",i)}};return e.jsx(P,{...p,children:e.jsx("form",{onSubmit:p.handleSubmit(B),children:e.jsxs("div",{className:"relative",children:[e.jsx(_,{children:r===1&&e.jsx(I,{handleNext:f})}),e.jsx(_,{children:r===2&&e.jsx(J,{handleNext:f})}),e.jsx(_,{children:r===3&&t===!1&&e.jsx(L,{})}),t&&e.jsx(k,{})]})})})};function M(){R();const[r,a]=y.useState(1),[t,o]=y.useState(!1);return e.jsxs("div",{className:"pb-[120px]",children:[e.jsx(G,{title:"B2B | B2G встречи"}),!t&&r!==0&&e.jsx(C,{stage:r}),e.jsx("div",{className:"max-w-[808px] md:mx-auto mx-5",children:e.jsx(T,{success:t,setSuccess:o,stage:r,setStage:a})})]})}export{M as default};