diff --git a/package.json b/package.json index 191ea7b..7c466b9 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "lodash": "^4.17.21", "lucide-react": "^0.501.0", "next": "15.3.1", + "next-redux-wrapper": "^8.1.0", "next-themes": "^0.4.6", "react": "^19.0.0", "react-day-picker": "8.10.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 212d6d8..0e7278d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -77,6 +77,9 @@ importers: next: specifier: 15.3.1 version: 15.3.1(react-dom@19.1.0(react@19.1.0))(react@19.1.0) + next-redux-wrapper: + specifier: ^8.1.0 + version: 8.1.0(next@15.3.1(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(react-redux@9.2.0(@types/react@19.1.2)(react@19.1.0)(redux@5.0.1))(react@19.1.0) next-themes: specifier: ^0.4.6 version: 0.4.6(react-dom@19.1.0(react@19.1.0))(react@19.1.0) @@ -2129,6 +2132,13 @@ packages: natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} + next-redux-wrapper@8.1.0: + resolution: {integrity: sha512-2hIau0hcI6uQszOtrvAFqgc0NkZegKYhBB7ZAKiG3jk7zfuQb4E7OV9jfxViqqojh3SEHdnFfPkN9KErttUKuw==} + peerDependencies: + next: '>=9' + react: '*' + react-redux: '*' + next-themes@0.4.6: resolution: {integrity: sha512-pZvgD5L0IEvX5/9GWyHMf3m8BKiVQwsCMHfoFosXtXBMnaS0ZnIJ9ST4b4NqLVKDEm8QBxoNNGNaBv2JNF6XNA==} peerDependencies: @@ -4739,6 +4749,12 @@ snapshots: natural-compare@1.4.0: {} + next-redux-wrapper@8.1.0(next@15.3.1(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(react-redux@9.2.0(@types/react@19.1.2)(react@19.1.0)(redux@5.0.1))(react@19.1.0): + dependencies: + next: 15.3.1(react-dom@19.1.0(react@19.1.0))(react@19.1.0) + react: 19.1.0 + react-redux: 9.2.0(@types/react@19.1.2)(react@19.1.0)(redux@5.0.1) + next-themes@0.4.6(react-dom@19.1.0(react@19.1.0))(react@19.1.0): dependencies: react: 19.1.0 diff --git a/src/app/(dashboard)/corporate-dashboard/page.tsx b/src/app/(dashboard)/corporate-dashboard/page.tsx index ca8ed83..834effd 100644 --- a/src/app/(dashboard)/corporate-dashboard/page.tsx +++ b/src/app/(dashboard)/corporate-dashboard/page.tsx @@ -1,308 +1,5 @@ -'use client'; +import { CorporateDashboard } from "@/pages-templates/(dashboard)/corporate-dashboard"; -import { format, subMonths } from 'date-fns'; -import { ru } from 'date-fns/locale'; -import { Building2, CalendarIcon, LogOut, Wallet } from 'lucide-react'; -import { useState } from 'react'; - -import { Button } from '@/shared/shadcn-ui/button'; -import { Calendar } from '@/shared/shadcn-ui/calendar'; -import { - Card, - CardContent, - CardDescription, - CardHeader, - CardTitle, -} from '@/shared/shadcn-ui/card'; -import { Label } from '@/shared/shadcn-ui/label'; -import { - Popover, - PopoverContent, - PopoverTrigger, -} from '@/shared/shadcn-ui/popover'; -import { - Table, - TableBody, - TableCell, - TableHead, - TableHeader, - TableRow, -} from '@/shared/shadcn-ui/table'; - -// import { CardsList } from '@/widgets/cards-list'; - -// Sample company data -const companyData = { - companyName: 'ООО «ТаджикТранс»', - numberOfCards: 12, - fund: 25000, - overdraft: 5000, - totalFund: 30000, - registrationDate: '10.03.2019', -}; - -// Sample transaction data -const generateTransactions = () => { - const stations = [ - 'АЗС Душанбе-Центр', - 'АЗС Душанбе-Запад', - 'АЗС Душанбе-Восток', - 'АЗС Худжанд', - 'АЗС Куляб', - ]; - - const products = [ - { name: 'ДТ', price: 8.5 }, - { name: 'АИ-92', price: 9.2 }, - { name: 'АИ-95', price: 10.5 }, - { name: 'Z-100 Power', price: 11.8 }, - { name: 'Пропан', price: 6.3 }, - ]; - - const transactions = []; - - // Generate 50 random transactions over the last 6 months - for (let i = 0; i < 50; i++) { - const date = subMonths(new Date(), Math.random() * 6); - const station = stations[Math.floor(Math.random() * stations.length)]; - const product = products[Math.floor(Math.random() * products.length)]; - const quantity = Math.floor(Math.random() * 40) + 10; // 10-50 liters - const cost = product.price; - const total = quantity * cost; - - transactions.push({ - id: i + 1, - date, - station, - product: product.name, - quantity, - cost, - total, - }); - } - - // Sort by date (newest first) - return transactions.sort((a, b) => b.date.getTime() - a.date.getTime()); -}; - -const transactions = generateTransactions(); - -export default function CorporateDashboard() { - const [startDate, setStartDate] = useState( - subMonths(new Date(), 1), - ); - const [endDate, setEndDate] = useState(new Date()); - const [filteredTransactions, setFilteredTransactions] = - useState(transactions); - - // Filter transactions by date range - const filterTransactions = () => { - if (!startDate || !endDate) return; - - const filtered = transactions.filter((transaction) => { - const transactionDate = new Date(transaction.date); - return transactionDate >= startDate && transactionDate <= endDate; - }); - - setFilteredTransactions(filtered); - }; - - return ( -
-
-
-
-

Корпоративный кабинет

- -
- -
- {/* Company Card */} - - - - - Информация о компании - - - -
-
-
-

Название компании

-

{companyData.companyName}

-
-
-

Количество карт

-

{companyData.numberOfCards}

-
-
-

Дата регистрации

-

- {companyData.registrationDate} -

-
-
-
-
-

Фонд

-

- {companyData.fund.toLocaleString()} сомони -

-
-
-

Овердрафт

-

- {companyData.overdraft.toLocaleString()} сомони -

-
-
-
-
-
- - {/* Fund Card */} - - - - - Общий фонд - - - Доступные средства - - - -
-

- {companyData.totalFund.toLocaleString()} -

-

сомони

-
-
-
-
- - {/* */} - - {/* Transactions */} -
-
-

История операций

- -
-
-
- - - - - - - - - -
- -
- - - - - - - - - -
-
- - -
-
- -
- - - - Дата - Станция - Продукт - Кол-во (л) - Стоимость - Сумма - - - - {filteredTransactions.length > 0 ? ( - filteredTransactions.map((transaction) => ( - - - {format(transaction.date, 'dd.MM.yyyy')} - - {transaction.station} - {transaction.product} - - {transaction.quantity} - - - {transaction.cost.toFixed(2)} сомони - - - {transaction.total.toFixed(2)} сомони - - - )) - ) : ( - - - Нет операций за выбранный период - - - )} - -
-
-
-
-
-
- ); +export default function Corporate() { + return } diff --git a/src/app/(dashboard)/customer-dashboard/page.tsx b/src/app/(dashboard)/customer-dashboard/page.tsx index aa2f7ea..f4cb147 100644 --- a/src/app/(dashboard)/customer-dashboard/page.tsx +++ b/src/app/(dashboard)/customer-dashboard/page.tsx @@ -1,110 +1,5 @@ -import { ArrowUpRight, Clock, CreditCard, LogOut, User } from 'lucide-react'; +import { CustomerDashboard } from "@/pages-templates/(dashboard)/customer-dashboard"; -import { Button } from '@/shared/shadcn-ui/button'; -import { - Card, - CardContent, - CardDescription, - CardHeader, - CardTitle, -} from '@/shared/shadcn-ui/card'; - -import { TransactionsTable } from '@/widgets/transactions-table'; - -// Sample customer data -const customerData = { - firstName: 'Алишер', - lastName: 'Рахмонов', - passportNumber: 'A12345678', - bonusPoints: 1250, - cardNumber: '5678-9012-3456-7890', - expiryDate: '12/2025', - registrationDate: '15.06.2020', -}; - -export default function CustomerDashboard() { - return ( -
-
-
-
-

Личный кабинет

- -
- -
- {/* Bonus Card */} - - - - - Бонусная карта - - - Ваши накопленные бонусы - - - -
-

- {customerData.bonusPoints} -

-

бонусных баллов

-
-
-
- - Действует до: 31.12.2023 -
- -
-
-
- {/* Customer Card */} - - - - - Информация о клиенте - - - -
-
-
-

ФИО

-

- {customerData.firstName} {customerData.lastName} -

-
-
-

Дата регистрации

-

- {customerData.registrationDate} -

-
-
-
-
-

Номер карты

-

{customerData.cardNumber}

-
-
-

Срок действия

-

{customerData.expiryDate}

-
-
-
-
-
-
- - -
-
-
- ); -} +export default function Customer() { + return +} \ No newline at end of file diff --git a/src/app/api-utlities/@types/index.ts b/src/app/api-utlities/@types/index.ts index 326bc14..aa1e81d 100644 --- a/src/app/api-utlities/@types/index.ts +++ b/src/app/api-utlities/@types/index.ts @@ -48,3 +48,8 @@ export type Station = Root<{ _region: Select[]; _foto: Image[]; }>; + +export type TextResponse = Root<{ + _name: string; + _znachenie: string | null; +}>; diff --git a/src/app/api-utlities/presenters/index.ts b/src/app/api-utlities/presenters/index.ts index 6d18dc7..7fd3220 100644 --- a/src/app/api-utlities/presenters/index.ts +++ b/src/app/api-utlities/presenters/index.ts @@ -1,6 +1,13 @@ import { isEmpty } from 'lodash'; -import { Discount, Image, Job, Partner, Station } from '../@types'; +import { + Discount, + Image, + Job, + Partner, + Station, + TextResponse, +} from '../@types'; export const presentImage = (images: Image[]) => isEmpty(images) ? null : `${process.env.TAYLOR_MEDIA_URL}/${images[0].url}`; @@ -50,3 +57,9 @@ export const presentStations = (stations: Station) => region: !isEmpty(station._region) ? station._region[0].name : null, image: presentImage(station._foto), })); + +export const presentTexts = (texts: TextResponse) => + texts.records.map((item) => ({ + key: item._name, + value: item._znachenie, + })); diff --git a/src/app/api-utlities/requests/common.ts b/src/app/api-utlities/requests/common.ts index f49887a..ff001c0 100644 --- a/src/app/api-utlities/requests/common.ts +++ b/src/app/api-utlities/requests/common.ts @@ -67,3 +67,12 @@ export const discountsRequest = { }, }, }; + +export const textsRequest = { + _kontentSajta: { + records: { + _name: true, + _znachenie: true, + }, + }, +}; diff --git a/src/app/api/text/route.ts b/src/app/api/text/route.ts new file mode 100644 index 0000000..a5bf3df --- /dev/null +++ b/src/app/api/text/route.ts @@ -0,0 +1,14 @@ +import { presentTexts } from '@/app/api-utlities/presenters'; +import { textsRequest } from '@/app/api-utlities/requests/common'; +import { requestTaylor } from '@/app/api-utlities/utilities/taylor.client'; + +export async function GET(request: Request) { + const response = await requestTaylor(textsRequest); + + return new Response( + JSON.stringify(presentTexts(response.data._kontentSajta)), + { + headers: { 'Content-Type': 'application/json' }, + }, + ); +} diff --git a/src/app/charity/page.tsx b/src/app/charity/page.tsx index 2b38a2e..4fc8510 100644 --- a/src/app/charity/page.tsx +++ b/src/app/charity/page.tsx @@ -1,304 +1,5 @@ -import { - Calendar, - CheckCircle, - Heart, - Landmark, - MapPin, - Users, -} from 'lucide-react'; -import Image from 'next/image'; +import { CharityPage } from "@/pages-templates/charity" -import { Button } from '@/shared/shadcn-ui/button'; -import { - Card, - CardContent, - CardFooter, - CardHeader, - CardTitle, -} from '@/shared/shadcn-ui/card'; - -import { CtaSection } from '@/widgets/cta-section'; - -export const metadata = { - title: 'Благотворительность | GasNetwork - Сеть заправок в Таджикистане', - description: - 'Благотворительные проекты и инициативы GasNetwork. Мы помогаем обществу и заботимся о будущем.', -}; - -export default function CharityPage() { - return ( -
-
- {/* Hero Section */} -
-
- Благотворительный фонд GasNetwork -
-
-
-
- -
-

- Благотворительный фонд GasNetwork -

-

- Мы верим, что бизнес должен быть социально ответственным. - Наш фонд поддерживает образование, здравоохранение и - экологические инициативы в Таджикистане. -

-
-
-
-
-
- - {/* Mission Section */} -
-
-
-
-
- -
-

- Наша миссия -

-

- Благотворительный фонд GasNetwork был создан в 2020 году с - целью поддержки социально значимых проектов в Таджикистане. Мы - стремимся внести свой вклад в развитие общества и помочь тем, - кто в этом нуждается. -

-

- Наша миссия — создавать возможности для улучшения жизни людей - через образование, здравоохранение, экологические инициативы и - поддержку уязвимых групп населения. -

- -
-
- -
-

Прозрачность

-

- Мы публикуем ежегодные отчеты о всех наших проектах и - расходах, обеспечивая полную прозрачность нашей - деятельности. -

-
-
-
- -
-

Эффективность

-

- Мы тщательно выбираем проекты, которые могут принести - максимальную пользу обществу и имеют долгосрочное - влияние. -

-
-
-
- -
-

Сотрудничество

-

- Мы сотрудничаем с местными и международными - организациями для достижения наибольшего эффекта от - наших инициатив. -

-
-
-
-
-
- Наша миссия -
-
-
-
- - {/* Key Figures */} -
-
-
-

- Наш вклад в цифрах -

-

- За время существования нашего фонда мы достигли значительных - результатов -

-
-
-
-

15+

-

Реализованных проектов

-
-
-

1.2M

-

Сомони пожертвований

-
-
-

5000+

-

Людей получили помощь

-
-
-
-
- - {/* Upcoming Events */} -
-
-
-
- -
-

- Предстоящие мероприятия -

-

- Присоединяйтесь к нашим благотворительным мероприятиям и внесите - свой вклад в общее дело -

-
- -
- {[ - { - title: 'Благотворительный марафон', - description: - 'Ежегодный благотворительный марафон в поддержку детей с особыми потребностями.', - date: '15 июня 2023', - location: 'Парк Рудаки, Душанбе', - image: '/placeholder.svg?height=200&width=300&text=Марафон', - }, - { - title: 'Экологическая акция', - description: - 'Очистка берегов реки Варзоб от мусора и посадка деревьев.', - date: '22 июля 2023', - location: 'Река Варзоб, Душанбе', - image: - '/placeholder.svg?height=200&width=300&text=Экологическая+акция', - }, - { - title: 'Сбор школьных принадлежностей', - description: - 'Сбор школьных принадлежностей для детей из малообеспеченных семей к новому учебному году.', - date: '1-20 августа 2023', - location: 'Все заправки GasNetwork', - image: - '/placeholder.svg?height=200&width=300&text=Школьные+принадлежности', - }, - ].map((event, index) => ( - -
- {event.title} -
- - {event.title} - - -

{event.description}

-
- - {event.date} -
-
- - {event.location} -
-
- - - -
- ))} -
-
-
- - {/* How to Help */} -
-
-
-
- -
-

- Как вы можете помочь -

-

- Есть много способов внести свой вклад в наши благотворительные - инициативы -

-
- -
- {[ - { - title: 'Сделать пожертвование', - description: - 'Ваше пожертвование поможет нам реализовать больше проектов и помочь большему количеству людей.', - icon: , - }, - { - title: 'Стать волонтером', - description: - 'Присоединяйтесь к нашей команде волонтеров и помогайте нам в реализации благотворительных проектов.', - icon: , - }, - { - title: 'Участвовать в мероприятиях', - description: - 'Принимайте участие в наших благотворительных мероприятиях и акциях.', - icon: , - }, - { - title: 'Распространять информацию', - description: - 'Расскажите о нашем фонде и его деятельности своим друзьям и знакомым.', - icon: , - }, - ].map((item, index) => ( - - -
{item.icon}
- - {item.title} - -
- -

{item.description}

-
-
- ))} -
-
-
- -
-
- ); -} +export default function Charity() { + return +} \ No newline at end of file diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 6fcee9d..7766960 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,7 +1,10 @@ import type { Metadata } from 'next'; import { Inter } from 'next/font/google'; +import { textControlApi } from '@/shared/language/api/text-control.api'; import { Providers } from '@/shared/providers/providers'; +import { makeStore } from '@/shared/store'; +import { TextItem } from '@/shared/types/text.types'; import { Footer } from '@/widgets/footer'; import { Header } from '@/widgets/header/ui'; @@ -16,20 +19,26 @@ export const metadata: Metadata = { 'Качественное топливо, удобное расположение и отличный сервис для наших клиентов', }; -export default function RootLayout({ +export default async function RootLayout({ children, }: Readonly<{ children: React.ReactNode; }>) { + const store = makeStore(); + + const response = await store.dispatch( + textControlApi.endpoints.fetchText.initiate(), + ); + return ( - +
{children}