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

2 lines
13 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{z as s,m as S,u as f,j as e,n as P,o as r,p as D,q as y,r as v,L as u,s as N,t as o,B as h,v as V,w as E,x as q,y as B,D as z,E as H,C as L,G as U}from"./ui-library-GY7_vKUX.js";import{a as C}from"./react-vendor-OnsDvTPE.js";import{a as A}from"./axios-upsvKRUO.js";import{R as T,a as G}from"./radio-group-DcXtiKO-.js";import{u as j}from"./use-scroll-top-ByehxtTO.js";const I=s.object({type:s.string(),company_name:s.string().min(3,{message:"Название компании должно быть не менее 3 символов"}),representative_name:s.string().min(3,{message:"Имя представителя должно быть не менее 3 символов"}),job_title:s.string().min(3,{message:"Должность должна быть не менее 3 символов"}),participants_number:s.string().min(1,{message:"Укажите количество участников"}),country:s.string().min(3,{message:"Название страны должно быть не менее 3 символов"}),email_address:s.string().email({message:"Укажите корректный email"}),phone_number:s.string().min(8,{message:"Номер телефона должен быть не менее 8 символов"}),website:s.string().optional(),meeting_objective:s.string().min(3,{message:"Укажите цель встречи"}),proposal_description:s.string().optional(),government_agency:s.string().optional(),sector_industry:s.string().optional(),key_services:s.string().optional(),government_experience:s.string().optional(),preferred_meeting_datetime:s.string().optional(),meeting_mode:s.string().optional(),language_preference:s.string().optional(),technical_requirements:s.string().optional(),company_profile:s.custom(n=>n instanceof File,{message:"Выберите корректный файл"}).refine(n=>n&&["image/jpeg","image/png","application/pdf"].includes(n.type),{message:"Допускаются только файлы JPG, PNG и PDF"}).optional(),proposal_presentation:s.custom(n=>n instanceof File,{message:"Выберите корректный файл"}).refine(n=>n&&["image/jpeg","image/png","application/pdf"].includes(n.type),{message:"Допускаются только файлы JPG, PNG и PDF"}).optional(),relevant_certification:s.custom(n=>n instanceof File,{message:"Выберите корректный файл"}).refine(n=>n&&["image/jpeg","image/png","application/pdf"].includes(n.type),{message:"Допускаются только файлы JPG, PNG и PDF"}).optional()}),J={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:""},m=[{h2:"Информация об экспоненте:",data:[{label:"Название компании/организации"},{label:"Имя представителя"},{label:"Название должности/позиция"},{label:"Количество участников"},{label:"Страна"},{label:"Email адрес"},{label:"Номер телефона"},{label:"Веб-сайт"}]},{h2:"Applicant Information:",data:[{label:"Company/Organization Name"},{label:"Name of Representative"},{label:"Job title/Position"},{label:"Number of the participants"},{label:"Country"},{label:"Email"},{label:"Phone number"},{label:"Website"}]}],p=[{h2:"Цели встречи:",secondH2:"Информация о компании/организации:",data:[{label:"Основная цель встречи"},{label:"Краткое описание вашего предложения/проекта/запроса"},{label:"Соответствующее государственное учреждение/департамент"},{label:"Отраслевая промышленность"},{label:"Ключевые услуги/продукты"},{label:"Предыдущий опыт работы с правительствами (если применимо)"}]},{h2:"Meeting Purpose: ",secondH2:"Company/Organization Profile:",data:[{label:"Primary objective of the meeting"},{label:"Brief description of your proposal/project/request"},{label:"Relevant government agency/department"},{label:"Sector Industry "},{label:"Key Services/Products"},{label:"Previous Experience working with Governments (if applicable)"}]}],c=[{h2:"Логистика встречи:",secondH2:"Логистика встречи:",subtitle:"(Пожалуйста приложите следующие документы, если это необходимо)",data:[{label:"Предпочтительная дата и время"},{label:"Предпочтительный способ проведения встречи (лично, виртуально (через zoom/ teams/другое), гибридный)"},{label:"Предпочитаемый язык (английский, туркменский, русский, другой)"},{label:"Дополнительные технические или логистические требования (например, аудио-видео оборудование, переводчики и т.д.)"},{label:"Название компании/организации"},{label:"Предложение/презентация"},{label:"Соответствующие сертификаты/лицензии"}],button:"Отправить"},{h2:"Приложения:",secondH2:"Attachments",subtitle:"(Please attach the following documents as applicable)",data:[{label:"Preferred date and time for the meeting"},{label:"Preferred mode of meeting (in-person, virtual (via zoom/teams/other), hybrid)"},{label:"Language preference (English, turkmen, Russian, other)"},{label:"Additional technical or logistical requirements (e.g. AV equipment, interpreters, etc)"},{label:"Company/organization profile"},{label:"Proposal presentation"},{label:"Relevant certification/licenses"}],button:"Send"}],O=({handleNext:n})=>{j();const{control:l,formState:t}=S(),a=f(i=>i.lang);return e.jsxs(P.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,y:"100%",transition:{duration:.2}},className:"w-full",children:[e.jsx("h2",{className:"h2 mb-8",children:m[r(a)].h2}),e.jsxs("div",{className:"flex flex-col gap-8",children:[e.jsx(D,{defaultValue:1,control:l,name:"type",render:({field:i})=>e.jsxs(y,{className:"space-y-3",children:[e.jsx(v,{className:"text-xl",children:a===u.RU?"Тип:":"Type:"}),e.jsx(N,{children:e.jsxs(T,{onValueChange:i.onChange,defaultValue:i.value,className:"flex flex-col space-y-4",children:[e.jsxs(y,{className:"flex items-center space-x-3 space-y-0",children:[e.jsx(N,{children:e.jsx(G,{value:"B2B",checked:i.value==="B2B"})}),e.jsx(v,{className:"text-base",children:"B2B"})]}),e.jsxs(y,{className:"flex items-center space-x-3 space-y-0",children:[e.jsx(N,{children:e.jsx(G,{value:"B2G",checked:i.value==="B2G"})}),e.jsx(v,{className:"text-base",children:"B2G"})]})]})})]})}),e.jsx(o,{control:l,name:"company_name",error:t.errors.company_name,placeholder:"",label:m[r(a)].data[0].label}),e.jsx(o,{control:l,name:"representative_name",error:t.errors.representative_name,placeholder:"",label:m[r(a)].data[1].label}),e.jsx(o,{control:l,name:"job_title",error:t.errors.job_title,placeholder:"",label:m[r(a)].data[2].label}),e.jsx(o,{control:l,name:"participants_number",error:t.errors.participants_number,placeholder:"",label:m[r(a)].data[3].label}),e.jsx(o,{control:l,name:"country",error:t.errors.country,placeholder:"",label:m[r(a)].data[4].label}),e.jsx(o,{control:l,name:"email_address",error:t.errors.email_address,placeholder:"",label:m[r(a)].data[5].label}),e.jsx(o,{control:l,name:"phone_number",error:t.errors.phone_number,placeholder:"",label:m[r(a)].data[6].label}),e.jsx(o,{control:l,name:"website",placeholder:"",label:m[r(a)].data[7].label})]}),e.jsx(h,{variant:"secondary",type:"button",onClick:n,className:"w-full mt-10",children:a===u.RU?"Далее":"Next"})]})},$=({handleNext:n,handlePrev:l})=>{j();const t=f(x=>x.lang),{control:a,formState:i}=S();return e.jsxs(P.div,{initial:{opacity:0,y:-100},animate:{opacity:1,y:0,transition:{delay:.5,duration:.3}},exit:{opacity:0,y:100},children:[e.jsx("h2",{className:"h2 mb-8",children:p[r(t)].h2}),e.jsxs("div",{className:"flex flex-col gap-8",children:[e.jsx(o,{control:a,name:"meeting_objective",error:i.errors.meeting_objective,placeholder:"",label:p[r(t)].data[0].label}),e.jsx(o,{control:a,name:"proposal_description",error:i.errors.proposal_description,placeholder:"",label:p[r(t)].data[1].label}),e.jsx(o,{control:a,name:"government_agency",error:i.errors.government_agency,placeholder:"",label:p[r(t)].data[2].label}),e.jsx("h2",{className:"h2 mt-4",children:p[r(t)].secondH2}),e.jsx(o,{control:a,name:"sector_industry",error:i.errors.sector_industry,placeholder:"",label:p[r(t)].data[3].label}),e.jsx(o,{control:a,name:"key_services",error:i.errors.key_services,placeholder:"",label:p[r(t)].data[4].label}),e.jsx(o,{control:a,name:"government_experience",error:i.errors.government_experience,placeholder:"",label:p[r(t)].data[5].label})]}),e.jsxs("div",{className:"flex items-center gap-6 mt-10",children:[e.jsx(h,{type:"button",onClick:l,variant:"outline",className:"text-on_surface",children:t===u.RU?"Вернуться назад":"Back"}),e.jsx(h,{variant:"secondary",type:"button",onClick:n,className:"w-full",children:t===u.RU?"Далее":"Next"})]})]})},K=({handlePrev:n})=>{j();const{control:l,formState:t}=S(),a=f(i=>i.lang);return e.jsxs(P.div,{initial:{opacity:0,y:-100},animate:{opacity:1,y:0,transition:{delay:.5,duration:.3}},transition:{duration:1},children:[e.jsx("h2",{className:"h2 mb-8",children:c[r(a)].h2}),e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx(o,{control:l,name:"preferred_meeting_datetime",error:t.errors.preferred_meeting_datetime,placeholder:"",label:c[r(a)].data[0].label}),e.jsx(o,{control:l,name:"preferred_mode",error:t.errors.preferred_mode,placeholder:"",label:c[r(a)].data[1].label}),e.jsx(o,{control:l,name:"language_preference",error:t.errors.language_preference,placeholder:"",label:c[r(a)].data[2].label}),e.jsx(o,{control:l,name:"additional_technical",error:t.errors.additional_technical,placeholder:"",label:c[r(a)].data[3].label})]}),e.jsxs("div",{className:"flex flex-col gap-8",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"h2 mt-10",children:c[r(a)].secondH2}),e.jsx("h5",{className:"text-on_surface_v",children:c[r(a)].subtitle})]}),e.jsx(o,{control:l,name:"company_profile",label:c[r(a)].data[4].label,type:"file",textDark:!0}),e.jsx(o,{control:l,name:"proposal_presentation",label:c[r(a)].data[5].label,type:"file",textDark:!0}),e.jsx(o,{control:l,name:"relevant_certification",label:c[r(a)].data[6].label,type:"file",textDark:!0})]}),e.jsxs("div",{className:"flex items-center gap-6 mt-10",children:[e.jsx(h,{type:"button",onClick:n,variant:"outline",className:"text-on_surface",children:a===u.RU?"Вернуться назад":"Back"}),e.jsx(h,{disabled:t.isSubmitting,type:"submit",className:"w-full",children:t.isSubmitting?e.jsx(V,{className:"animate-spin"}):c[r(a)].button})]})]})},M=({stage:n,setStage:l,success:t,setSuccess:a})=>{const i=E({resolver:H(I),defaultValues:J,mode:"onChange"}),x=d=>{switch(d){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 d=x(n);await i.trigger(d)&&l(w=>w+1)},k=()=>l(d=>d-1),R=async d=>{try{const b=new FormData;Object.entries(d).forEach(([_,g])=>{g instanceof File?(console.log(`Добавляем файл: ${_}`,g),b.append(_,g)):g!==void 0&&(console.log(`Добавляем поле: ${_}`,g),b.append(_,g))}),(await A.post("https://turkmentextile.turkmenexpo.com/app/api/v1/form",b,{headers:{"Content-Type":"multipart/form-data"}})).status===201&&a(!0)}catch(b){console.error("Ошибка при отправке B2B формы:",b)}};return e.jsx(q,{...i,children:e.jsx("form",{onSubmit:i.handleSubmit(R),children:e.jsxs("div",{className:"relative",children:[e.jsx(B,{children:n===1&&e.jsx(O,{handleNext:F})}),e.jsx(B,{children:n===2&&e.jsx($,{handleNext:F,handlePrev:k})}),e.jsx(B,{children:n===3&&t===!1&&e.jsx(K,{handlePrev:k})}),t&&e.jsx(z,{})]})})})};function ee(){j();const n=f(x=>x.lang),[l,t]=C.useState(1),[a,i]=C.useState(!1);return e.jsxs("div",{className:"pb-[120px]",children:[e.jsx(L,{title:n===u.RU?"B2B | B2G встречи":"B2B | B2G meetings"}),!a&&l!==0&&e.jsx(U,{stage:l}),e.jsx("div",{className:"max-w-[808px] md:mx-auto mx-5",children:e.jsx(M,{success:a,setSuccess:i,stage:l,setStage:t})})]})}export{ee as default};