Add tender details page

This commit is contained in:
anime committed 2024-09-03 23:37:54 +06:00
1 parent 7eedb5ec39
commit 1d68743bc8
8 files changed
+206 -21

No files matched your search

+144
View File
@@ -0,0 +1,144 @@
import { apiInstance } from "@/shared/config/apiConfig";
import { ITenders } from "@/shared/types/tenders-type";
import { Container, Title } from "@/shared/ui";
const TenderDetails = async ({
params,
}: {
params: { id: string; новость: string };
}) => {
const getTendersById = async () => {
const response = await apiInstance.get<ITenders>(
`/procurements/${params.id}/`
);
return response.data;
};
const data = await getTendersById();
const formatNumber = (number: number | string): string => {
if (typeof number === "string") {
number = parseFloat(number);
}
if (isNaN(number)) return "";
return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ");
};
const months: Record<string, string> = {
"01": "Январь",
"02": "Февраль",
"03": "Март",
"04": "Апрель",
"05": "Май",
"06": "Июнь",
"07": "Июль",
"08": "Август",
"09": "Сентябрь",
"10": "Октябрь",
"11": "Ноябрь",
"12": "Декабрь",
};
return (
<Container>
<Title
text={`№ ${data.id_of_card}`}
size="lg"
className="font-bold text-[24px] mb-[30px]"
/>
<div className="flex flex-col gap-[27px] w-full mb-[83px]">
<div className="flex gap-[108px]">
<Title
text="Наименование закупки"
className="text-[18px] text-gray-500 w-[242px]"
/>
<Title
text={data.name_of_buy}
className="text-light-blue text-[20px] leading-8 font-semibold"
/>
</div>
<div className="flex gap-[108px]">
<Title
text="Закупающая организация"
className="text-[18px] text-gray-500 w-[242px]"
/>
<Title
text={data.name_of_organization}
className="text-light-blue text-[20px] leading-8 font-semibold"
/>
</div>
<div className="flex gap-[108px]">
<Title
text="Планируемая сумма"
className="text-[18px] text-gray-500 w-[242px]"
/>
<Title
text={formatNumber(data.plan_summ)}
className="text-light-blue text-[20px] leading-8 font-semibold"
/>
</div>
<div className="flex gap-[108px]">
<Title
text="Статус"
className="text-[18px] text-gray-50 w-[242px] "
/>
<Title text={"Статус"} className=" text-[20px] leading-8" />
</div>
<div className="flex gap-[108px]">
<Title
text="Дата публикации"
className="text-[18px] text-gray-500 w-[242px]"
/>
<p className="text-[20px] leading-8">
{data.date_of_publication_datetime.slice(8, 10)}{" "}
{months[data.date_of_publication_datetime.slice(5, 7)]}{" "}
{data.date_of_publication_datetime.slice(0, 4)}
</p>
{months[data.date_of_publication_datetime.slice(0, 5)]}
</div>
<div className="flex gap-[108px]">
<Title
text="Окончание приема заявок"
className="text-[18px] text-gray-500 w-[242px]"
/>
<p className="text-[20px] leading-8">
{data.date_of_publication_datetime.slice(8, 10)}{" "}
{months[data.date_of_publication_datetime.slice(5, 7)]}{" "}
{data.date_of_publication_datetime.slice(0, 4)}
</p>
</div>
<div className="flex gap-[108px]">
<Title
text="Рабочий телефон"
className="text-[18px] text-gray-500 w-[242px]"
/>
<Title text={data.tel_number} className="text-[20px] leading-8" />
</div>
<div className="flex gap-[108px]">
<Title
text="Больше информации"
className="text-[18px] text-gray-500 w-[242px]"
/>
<Title text={data.more_info_url} className="text-[20px] leading-8" />
</div>
<div className="flex gap-[108px]">
<Title
text="Больше информации в PDF"
className="text-[18px] text-gray-500 w-[242px]"
/>
<Title text={data.more_info_pdf} className="text-[20px] leading-8" />
</div>
</div>
<Title
text={"Лоты"}
size="lg"
className="font-bold text-[24px] mb-[30px]"
/>
</Container>
);
};
export default TenderDetails;
+8 -2
View File
@@ -2,7 +2,13 @@ import { Container, Title } from "@/shared/ui";
import TendersList from "@/widgets/TendersList/TendersList";
import React from "react";
const Tenders = () => {
const Tenders = ({
searchParams,
}: {
searchParams: {
["страница-тендеров"]: string;
};
}) => {
return (
<div className="bg-[#FAFCFF]">
<Container>
@@ -11,7 +17,7 @@ const Tenders = () => {
size="md"
className="text-lg font-bold mb-[39px] pt-[101px]"
/>
<TendersList />
<TendersList searchParams={searchParams} />
</Container>
</div>
);