finished card pages
This commit is contained in:
1 parent
c7797c3e31
commit
ca3d2f6db9
17 files changed
+1847
-18
No files matched your search
@@ -93,6 +93,10 @@ const VisaMasterPaymentsPage = lazy(() => import("@/pages/internationalPayments/
|
|||||||
const VisaMasterPaymentCreatePage = lazy(() => import("@/pages/internationalPayments/visaMasterPaymentsCreate"));
|
const VisaMasterPaymentCreatePage = lazy(() => import("@/pages/internationalPayments/visaMasterPaymentsCreate"));
|
||||||
const VisaMasterPaymentViewPage = lazy(() => import("@/pages/internationalPayments/visaMasterPaymentsView"));
|
const VisaMasterPaymentViewPage = lazy(() => import("@/pages/internationalPayments/visaMasterPaymentsView"));
|
||||||
const VisaMasterPaymentEditPage = lazy(() => import("@/pages/internationalPayments/visaMasterPaymentsEdit"));
|
const VisaMasterPaymentEditPage = lazy(() => import("@/pages/internationalPayments/visaMasterPaymentsEdit"));
|
||||||
|
const SberPaymentPage = lazy(() => import("@/pages/internationalPayments/sberPayments"));
|
||||||
|
const SberPaymentCreatePage = lazy(() => import("@/pages/internationalPayments/sberPaymentsCreate"));
|
||||||
|
const SberPaymentViewPage = lazy(() => import("@/pages/internationalPayments/sberPaymentsView"));
|
||||||
|
const SberPaymentEditPage = lazy(() => import("@/pages/internationalPayments/sberPaymentsEdit"));
|
||||||
function AuthGuard() {
|
function AuthGuard() {
|
||||||
const isAuthenticated = useAuthStore((s) => s.isAuthenticated);
|
const isAuthenticated = useAuthStore((s) => s.isAuthenticated);
|
||||||
if (!isAuthenticated) return <Navigate to="/login" replace />;
|
if (!isAuthenticated) return <Navigate to="/login" replace />;
|
||||||
@@ -445,6 +449,38 @@ export const router = createBrowserRouter([
|
|||||||
</Suspense>
|
</Suspense>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
{ // Sidebar: /sber-payments
|
||||||
|
path: "/sber-payments",
|
||||||
|
element: (
|
||||||
|
<Suspense fallback={<PageLoader />}>
|
||||||
|
<SberPaymentPage />
|
||||||
|
</Suspense>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/sber-payments/create",
|
||||||
|
element: (
|
||||||
|
<Suspense fallback={<PageLoader />}>
|
||||||
|
<SberPaymentCreatePage />
|
||||||
|
</Suspense>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/sber-payments/:id",
|
||||||
|
element: (
|
||||||
|
<Suspense fallback={<PageLoader />}>
|
||||||
|
<SberPaymentViewPage />
|
||||||
|
</Suspense>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/sber-payments/:id/edit",
|
||||||
|
element: (
|
||||||
|
<Suspense fallback={<PageLoader />}>
|
||||||
|
<SberPaymentEditPage />
|
||||||
|
</Suspense>
|
||||||
|
),
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -0,0 +1,349 @@
|
|||||||
|
|
||||||
|
|
||||||
|
// ─── Sber Payment Order Types ─────────────────────────────────────────────────
|
||||||
|
|
||||||
|
export type PaymentStatus = 'GARASYLYYAR' | 'KANAGATLANDYRYLAN' | 'RET_EDILEN'
|
||||||
|
export type PaymentPaidStatus = 'Tolenmedik' | 'Tolendi'
|
||||||
|
|
||||||
|
export interface SberPaymentOrder {
|
||||||
|
id: string
|
||||||
|
createdAt: string
|
||||||
|
welayat: string
|
||||||
|
sahamca: string
|
||||||
|
firstName: string
|
||||||
|
lastName: string
|
||||||
|
phone: string
|
||||||
|
email: string
|
||||||
|
address: string
|
||||||
|
status: PaymentStatus
|
||||||
|
paidStatus: PaymentPaidStatus
|
||||||
|
bellik: string
|
||||||
|
|
||||||
|
// Payment info
|
||||||
|
accountNumber: string
|
||||||
|
passportSeries: string
|
||||||
|
passportNumber: string
|
||||||
|
fullName: string
|
||||||
|
|
||||||
|
// Documents
|
||||||
|
documents: SberDocument[]
|
||||||
|
|
||||||
|
// Payment history
|
||||||
|
paymentHistory: PaymentHistoryItem[]
|
||||||
|
|
||||||
|
// Activity log
|
||||||
|
activityLog: ActivityLogItem[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SberDocument {
|
||||||
|
id: string
|
||||||
|
name: string
|
||||||
|
label: string
|
||||||
|
fileUrl: string | null
|
||||||
|
fileType: 'image' | 'pdf' | null
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PaymentHistoryItem {
|
||||||
|
id: string
|
||||||
|
date: string
|
||||||
|
amount: number
|
||||||
|
status: 'completed' | 'pending' | 'failed'
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ActivityLogItem {
|
||||||
|
id: string
|
||||||
|
analysisName: string
|
||||||
|
createdBy: string
|
||||||
|
target: string
|
||||||
|
status: 'FINISHED' | 'PENDING' | 'FAILED'
|
||||||
|
createdAt: string
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── API Types ────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
export interface SberPaymentOrdersResponse {
|
||||||
|
data: SberPaymentOrder[]
|
||||||
|
pagination: {
|
||||||
|
currentPage: number
|
||||||
|
totalPages: number
|
||||||
|
totalCount: number
|
||||||
|
perPage: number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreateSberPaymentPayload {
|
||||||
|
welayat: string
|
||||||
|
sahamca: string
|
||||||
|
firstName: string
|
||||||
|
lastName: string
|
||||||
|
phone: string
|
||||||
|
email: string
|
||||||
|
address: string
|
||||||
|
status: PaymentStatus
|
||||||
|
bellik: string
|
||||||
|
accountNumber: string
|
||||||
|
passportSeries: string
|
||||||
|
passportNumber: string
|
||||||
|
fullName: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateSberPaymentPayload extends CreateSberPaymentPayload {
|
||||||
|
id: string
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── Form Types ───────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
export interface SberPaymentFormData {
|
||||||
|
welayat: string
|
||||||
|
sahamca: string
|
||||||
|
firstName: string
|
||||||
|
lastName: string
|
||||||
|
phone: string
|
||||||
|
email: string
|
||||||
|
address: string
|
||||||
|
status: PaymentStatus
|
||||||
|
bellik: string
|
||||||
|
accountNumber: string
|
||||||
|
passportSeries: string
|
||||||
|
passportNumber: string
|
||||||
|
fullName: string
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── Filter Types ─────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
export interface SberPaymentFilters {
|
||||||
|
search: string
|
||||||
|
welayat: string
|
||||||
|
sahamca: string
|
||||||
|
status: string
|
||||||
|
paidStatus: string
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ─── Mock Data ────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
const turkmenNames = [
|
||||||
|
{ first: 'Lale', last: 'Agayewa' },
|
||||||
|
{ first: 'Agamyrat', last: 'Hydyrow' },
|
||||||
|
{ first: 'Rusdem', last: 'Jorayew' },
|
||||||
|
{ first: 'Agajan', last: 'Rejepow' },
|
||||||
|
{ first: 'Cemen', last: 'Mamedowa' },
|
||||||
|
{ first: 'Ussman', last: 'Saberdiyew' },
|
||||||
|
{ first: 'Ogultagan', last: 'Amanowa' },
|
||||||
|
{ first: 'Bahargul', last: 'Dowranowa' },
|
||||||
|
{ first: 'Muhabet', last: 'Hojakulyyewa' },
|
||||||
|
{ first: 'Yusupbay', last: 'Orunow' },
|
||||||
|
{ first: 'Jumagul', last: 'Hasanowa' },
|
||||||
|
{ first: 'Arazgul', last: 'Akmedowa' },
|
||||||
|
{ first: 'Samsat', last: 'Mamedowa' },
|
||||||
|
{ first: 'Anzela', last: 'Metkumyan' },
|
||||||
|
{ first: 'Durmys', last: 'Bahadurow' },
|
||||||
|
{ first: 'Serdar', last: 'Nuryyew' },
|
||||||
|
{ first: 'Kseniya', last: 'Hemrayewa' },
|
||||||
|
{ first: 'Orazgul', last: 'Dowletowa' },
|
||||||
|
{ first: 'Salidahan', last: 'Kazyyewa' },
|
||||||
|
{ first: 'Babamurad', last: 'Abdyraimow' },
|
||||||
|
{ first: 'Ogulnar', last: 'Babakulyyewa' },
|
||||||
|
{ first: 'Derman', last: 'Hudaynazarow' },
|
||||||
|
{ first: 'Hasan', last: 'Tasow' },
|
||||||
|
{ first: 'Yusupjan', last: 'Tasow' },
|
||||||
|
{ first: 'Begnazar', last: 'Weliyew' },
|
||||||
|
]
|
||||||
|
|
||||||
|
const welayatlar = ['Mary', 'Lebap', 'Asgabat', 'Dashoguz', 'Balkan']
|
||||||
|
|
||||||
|
const sahamcalar: Record<string, string[]> = {
|
||||||
|
Mary: ['Bayramaly', 'Mary saheri', 'Sakarçäge'],
|
||||||
|
Lebap: ['Turkmenabat', 'Garlyk', 'Seydi', 'Buzmeyin'],
|
||||||
|
Asgabat: ['Buzmeyin', 'Berkararlyk', 'Köpetdag'],
|
||||||
|
Dashoguz: ['Dashoguz saheri', 'Gubadag', 'Köneurgench'],
|
||||||
|
Balkan: ['Balkanabat', 'Turkmenbasy', 'Serdar'],
|
||||||
|
}
|
||||||
|
|
||||||
|
const statuses: Array<'GARASYLYYAR' | 'KANAGATLANDYRYLAN' | 'RET_EDILEN'> = [
|
||||||
|
'GARASYLYYAR',
|
||||||
|
'KANAGATLANDYRYLAN',
|
||||||
|
'RET_EDILEN',
|
||||||
|
]
|
||||||
|
|
||||||
|
const documentLabels = [
|
||||||
|
{ id: 'rekvezit', name: 'Rekvezit.jpg', label: 'Talyba degisli walýuta "SBERBANK" kartyň rekwizitleri' },
|
||||||
|
{ id: 'sprawka', name: 'sprawka-2026.jpg', label: 'Talybýň daşary ýurt döwletiniň ýokary okuw mekdebinde okaýandygy baradaky güwanamasy' },
|
||||||
|
{ id: 'bildirish', name: 'bildirish.jpg', label: 'Talybýň bildirisli göcürmesi' },
|
||||||
|
{ id: 'passport-copy', name: 'Tkm-pas-Agayewa-Mahllan-(1).jpg', label: 'Talyba degisli Türkmenistanyň raýatynyň içki milli pasportynyň asyl görnüşi we göçürmesi' },
|
||||||
|
{ id: 'zagran-1', name: 'Zagran-(1).jpg', label: 'Talybýň Türkmenistandan çykmak we Türkmenistana girmek üçin (zagran) pasportynyň göçürmesi' },
|
||||||
|
{ id: 'zagran-2', name: 'Zagran-(2).jpg', label: 'Talybýň Türkmenistandan çykmak we Türkmenistana girmek üçin pasportyndaky daşary ýurda çykmak üçin tälynjädägy baradaky beriim miiletti hereket edijan rughsatnamasyniyň (wizasynyň) bellenen sahypasynyň göçürmesi' },
|
||||||
|
]
|
||||||
|
|
||||||
|
function generateMockPaymentOrder(index: number): SberPaymentOrder {
|
||||||
|
const name = turkmenNames[index % turkmenNames.length]
|
||||||
|
const welayat = welayatlar[index % welayatlar.length]
|
||||||
|
const sahamcaList = sahamcalar[welayat]
|
||||||
|
const sahamca = sahamcaList[index % sahamcaList.length]
|
||||||
|
const status = statuses[index % statuses.length]
|
||||||
|
|
||||||
|
const baseDate = new Date(2026, 4, 7) // May 7, 2026
|
||||||
|
const orderDate = new Date(baseDate.getTime() - index * 3 * 60 * 1000) // 3 min apart
|
||||||
|
|
||||||
|
const idPrefix = ['TB7369', 'TB8319', 'TB8318', 'TB8311', 'TB1308'][index % 5]
|
||||||
|
const idNumber = 8137 - index
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: `${idPrefix}-${idNumber}`,
|
||||||
|
createdAt: orderDate.toISOString(),
|
||||||
|
welayat,
|
||||||
|
sahamca,
|
||||||
|
firstName: name.first,
|
||||||
|
lastName: name.last,
|
||||||
|
phone: `+993-${60 + (index % 5)}${index % 10}-${(42 + index) % 99}-${(28 + index * 2) % 99}-${(13 + index * 3) % 99}`,
|
||||||
|
email: `${name.first.toLowerCase()}.${name.last.toLowerCase()}@mail.tm`,
|
||||||
|
address: `Bayramaly saher 1-nji jay toolumy jay1 oy1`,
|
||||||
|
status,
|
||||||
|
paidStatus: index % 3 === 0 ? 'Tolendi' : 'Tolenmedik',
|
||||||
|
bellik: '',
|
||||||
|
accountNumber: `232080100002850`,
|
||||||
|
passportSeries: `II-M${String.fromCharCode(65 + (index % 8))}`,
|
||||||
|
passportNumber: String(100000 + index * 1234),
|
||||||
|
fullName: `${name.first} ${name.last} Sadurdyyewna`,
|
||||||
|
documents: documentLabels.map((doc, i) => ({
|
||||||
|
id: `doc-${index}-${i}`,
|
||||||
|
name: doc.name,
|
||||||
|
label: doc.label,
|
||||||
|
fileUrl: index % 2 === 0 ? `/uploads/${doc.name}` : null,
|
||||||
|
fileType: doc.name.endsWith('.pdf') ? 'pdf' : 'image',
|
||||||
|
})),
|
||||||
|
paymentHistory: [],
|
||||||
|
activityLog: [
|
||||||
|
{
|
||||||
|
id: `activity-${index}-1`,
|
||||||
|
analysisName: 'Gospmak',
|
||||||
|
createdBy: `Agayewa ${name.first} Sadurdyyewna`,
|
||||||
|
target: `Sber töleg (talyplar üçin): ${idPrefix}-${idNumber}`,
|
||||||
|
status: 'FINISHED',
|
||||||
|
createdAt: orderDate.toISOString(),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate 100 mock records
|
||||||
|
const mockPaymentOrders: SberPaymentOrder[] = Array.from({ length: 100 }, (_, i) =>
|
||||||
|
generateMockPaymentOrder(i)
|
||||||
|
)
|
||||||
|
|
||||||
|
// ─── API Functions ────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
export async function getSberPaymentOrders(params: {
|
||||||
|
page?: number
|
||||||
|
perPage?: number
|
||||||
|
search?: string
|
||||||
|
welayat?: string
|
||||||
|
sahamca?: string
|
||||||
|
status?: string
|
||||||
|
}): Promise<SberPaymentOrdersResponse> {
|
||||||
|
// Simulate network delay
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 300))
|
||||||
|
|
||||||
|
let filtered = [...mockPaymentOrders]
|
||||||
|
|
||||||
|
// Apply filters
|
||||||
|
if (params.search) {
|
||||||
|
const q = params.search.toLowerCase()
|
||||||
|
filtered = filtered.filter(
|
||||||
|
(o) =>
|
||||||
|
o.id.toLowerCase().includes(q) ||
|
||||||
|
o.firstName.toLowerCase().includes(q) ||
|
||||||
|
o.lastName.toLowerCase().includes(q) ||
|
||||||
|
o.phone.includes(q)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.welayat) {
|
||||||
|
filtered = filtered.filter((o) => o.welayat === params.welayat)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.sahamca) {
|
||||||
|
filtered = filtered.filter((o) => o.sahamca === params.sahamca)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.status) {
|
||||||
|
filtered = filtered.filter((o) => o.status === params.status)
|
||||||
|
}
|
||||||
|
|
||||||
|
const page = params.page ?? 1
|
||||||
|
const perPage = params.perPage ?? 25
|
||||||
|
const totalCount = filtered.length
|
||||||
|
const totalPages = Math.ceil(totalCount / perPage)
|
||||||
|
const start = (page - 1) * perPage
|
||||||
|
const data = filtered.slice(start, start + perPage)
|
||||||
|
|
||||||
|
return {
|
||||||
|
data,
|
||||||
|
pagination: {
|
||||||
|
currentPage: page,
|
||||||
|
totalPages,
|
||||||
|
totalCount,
|
||||||
|
perPage,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getSberPaymentOrderById(id: string): Promise<SberPaymentOrder | null> {
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 200))
|
||||||
|
return mockPaymentOrders.find((o) => o.id === id) ?? null
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function createSberPaymentOrder(
|
||||||
|
payload: CreateSberPaymentPayload
|
||||||
|
): Promise<SberPaymentOrder> {
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 400))
|
||||||
|
|
||||||
|
const newOrder: SberPaymentOrder = {
|
||||||
|
id: `TB${Math.floor(1000 + Math.random() * 9000)}-${Math.floor(1000 + Math.random() * 9000)}`,
|
||||||
|
createdAt: new Date().toISOString(),
|
||||||
|
...payload,
|
||||||
|
paidStatus: 'Tolenmedik',
|
||||||
|
documents: [],
|
||||||
|
paymentHistory: [],
|
||||||
|
activityLog: [],
|
||||||
|
}
|
||||||
|
|
||||||
|
mockPaymentOrders.unshift(newOrder)
|
||||||
|
return newOrder
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function updateSberPaymentOrder(
|
||||||
|
payload: UpdateSberPaymentPayload
|
||||||
|
): Promise<SberPaymentOrder> {
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 400))
|
||||||
|
|
||||||
|
const index = mockPaymentOrders.findIndex((o) => o.id === payload.id)
|
||||||
|
if (index === -1) {
|
||||||
|
throw new Error('Payment order not found')
|
||||||
|
}
|
||||||
|
|
||||||
|
const updated = {
|
||||||
|
...mockPaymentOrders[index],
|
||||||
|
...payload,
|
||||||
|
}
|
||||||
|
mockPaymentOrders[index] = updated
|
||||||
|
return updated
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function deleteSberPaymentOrder(id: string): Promise<void> {
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 300))
|
||||||
|
const index = mockPaymentOrders.findIndex((o) => o.id === id)
|
||||||
|
if (index !== -1) {
|
||||||
|
mockPaymentOrders.splice(index, 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── Constants for dropdowns ──────────────────────────────────────────────────
|
||||||
|
|
||||||
|
export const WELAYATLAR = welayatlar
|
||||||
|
export const SAHAMCALAR = sahamcalar
|
||||||
|
export const STATUSES = [
|
||||||
|
{ value: 'GARASYLYYAR', label: 'Garasylyyar' },
|
||||||
|
{ value: 'KANAGATLANDYRYLAN', label: 'Kanagatlandyrylan' },
|
||||||
|
{ value: 'RET_EDILEN', label: 'Ret edilen' },
|
||||||
|
]
|
||||||
@@ -0,0 +1,394 @@
|
|||||||
|
'use client'
|
||||||
|
|
||||||
|
import { useState, useEffect } from 'react'
|
||||||
|
import { toast } from 'sonner'
|
||||||
|
import { Plus } from 'lucide-react'
|
||||||
|
|
||||||
|
import { FormInput } from '@/components/formInput'
|
||||||
|
import { Button } from '@/components/ui/button'
|
||||||
|
import { Spinner } from '@/components/ui/spinner'
|
||||||
|
import { useCreateSberPayment, useUpdateSberPayment } from '@/features/sberPayments/hooks/useSberPayments'
|
||||||
|
import { WELAYATLAR, SAHAMCALAR, STATUSES, type SberPaymentOrder, type SberPaymentFormData, type PaymentStatus } from '@/features/sberPayments/api/sberPaymentsApi'
|
||||||
|
import { useNavigate } from 'react-router-dom'
|
||||||
|
|
||||||
|
// ─── Types ────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
interface SberPaymentFormProps {
|
||||||
|
mode: 'create' | 'edit'
|
||||||
|
initialData?: SberPaymentOrder | null
|
||||||
|
orderId?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── Document Labels ──────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
const acceptedDocumentLabels = [
|
||||||
|
'Talyba degisli walýuta "SBERBANK" kartyň rekwizitleri',
|
||||||
|
'Talybýň daşary ýurt döwletiniň ýokary okuw mekdebinde okaýandygy baradaky güwanamasy',
|
||||||
|
'Talybýň bildirisli göcürmesi',
|
||||||
|
'Talyba degisli Türkmenistanyň raýatynyň içki milli pasportynyň asyl görnüşi we göçürmesi',
|
||||||
|
'Talybýň Türkmenistandan çykmak we Türkmenistana girmek üçin (zagran) pasportynyň göçürmesi',
|
||||||
|
'Talybýň Türkmenistandan çykmak we Türkmenistana girmek üçin pasportyndaky daşary ýurda göýberilmegi barada beriim miiletti hereket edijan rughsatnamasyniyň (wizasynyň) bellenen sahypasynyň göçürmesi',
|
||||||
|
'Talybýň Türkmenistandan çykmak we Türkmenistana girmek üçin pasportyndaky Türkmenistandan çykanday we daşary ýurt döwletine girenligi baradaky ştamplaryň (belgi ştamply) bellenen sahypasynyň göçürmesi',
|
||||||
|
'Talybýň daşary ýurt döwletiniň ýokary okuw mekdebinde okaýandygy baradaky güwanamasynyň doly takyk dili wýagdayýnda talyk dili magumatyň sebäpleri baradaky daşary ýurt döwletiniň ýokary okuw mekdebinden haty',
|
||||||
|
]
|
||||||
|
|
||||||
|
const sentDocumentLabels = [
|
||||||
|
'Ugradyjy degisli Türkmenistanyň raýatynyň içki milli pasportynyň asyl görnüşi we göçürmesi',
|
||||||
|
'Ugradyjy degisli Türkmenistandan çykmak we Türkmenistana girmek üçin pasportynyň asyl görnüşi we göçürmesi',
|
||||||
|
'Ugradyjy degisli Türkmenistandan çykmak we Türkmenistana girmek üçin pasportyndaky daşary döwletine girenliği we daşary döwlete baradaky ştamply bellenen sahypasynyň göçürmesi',
|
||||||
|
'Ugradyjynýň we kabul edijinin (talybýň) özara garyndaşlyk denjesini tassyklaýjy resminamalarynýň göçürmesi',
|
||||||
|
'Ugradyjy we kabul ediji (talyp) 2015-nji ýyldan soňra Türkmenistanyň raýatynýň pasportyny kiriş gerek alan bolsa, onda birnji gerek alan pasportynyň seriyasy baradaky maglumat',
|
||||||
|
'Ugradyjy we kabul ediji (talyp) 2015-nji ýyldan soňra Türkmenistanyň raýatynýň pasportyny kiriş gerek alandan soňra birnji gerek alan pasportynyň seriyasy baradaky magumatý bilmeýän, balsa onda polisijyenyň degisli ekedasynýdan birnji alan pasportynyň seriyasy baradaky güwanamasy',
|
||||||
|
]
|
||||||
|
|
||||||
|
// ─── Shared Form Component ────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
export function SberPaymentForm({ mode, initialData, orderId }: SberPaymentFormProps) {
|
||||||
|
const router = useNavigate()
|
||||||
|
const createMutation = useCreateSberPayment()
|
||||||
|
const updateMutation = useUpdateSberPayment()
|
||||||
|
|
||||||
|
const isLoading = createMutation.isPending || updateMutation.isPending
|
||||||
|
|
||||||
|
// Form state
|
||||||
|
const [formData, setFormData] = useState<SberPaymentFormData>({
|
||||||
|
welayat: '',
|
||||||
|
sahamca: '',
|
||||||
|
firstName: '',
|
||||||
|
lastName: '',
|
||||||
|
phone: '',
|
||||||
|
email: '',
|
||||||
|
address: '',
|
||||||
|
status: 'GARASYLYYAR',
|
||||||
|
bellik: '',
|
||||||
|
accountNumber: '',
|
||||||
|
passportSeries: '',
|
||||||
|
passportNumber: '',
|
||||||
|
fullName: '',
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Validation errors
|
||||||
|
const [errors, setErrors] = useState<Partial<Record<keyof SberPaymentFormData, string>>>({})
|
||||||
|
|
||||||
|
// Populate form with initial data in edit mode
|
||||||
|
useEffect(() => {
|
||||||
|
if (mode === 'edit' && initialData) {
|
||||||
|
setFormData({
|
||||||
|
welayat: initialData.welayat,
|
||||||
|
sahamca: initialData.sahamca,
|
||||||
|
firstName: initialData.firstName,
|
||||||
|
lastName: initialData.lastName,
|
||||||
|
phone: initialData.phone,
|
||||||
|
email: initialData.email,
|
||||||
|
address: initialData.address,
|
||||||
|
status: initialData.status,
|
||||||
|
bellik: initialData.bellik,
|
||||||
|
accountNumber: initialData.accountNumber,
|
||||||
|
passportSeries: initialData.passportSeries,
|
||||||
|
passportNumber: initialData.passportNumber,
|
||||||
|
fullName: initialData.fullName,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}, [mode, initialData])
|
||||||
|
|
||||||
|
// Get available branches based on selected welayat
|
||||||
|
const availableBranches = formData.welayat ? SAHAMCALAR[formData.welayat] ?? [] : []
|
||||||
|
|
||||||
|
// Update field helper
|
||||||
|
const updateField = <K extends keyof SberPaymentFormData>(
|
||||||
|
field: K,
|
||||||
|
value: SberPaymentFormData[K]
|
||||||
|
) => {
|
||||||
|
setFormData((prev) => ({ ...prev, [field]: value }))
|
||||||
|
if (errors[field]) {
|
||||||
|
setErrors((prev) => ({ ...prev, [field]: undefined }))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate form
|
||||||
|
const validate = (): boolean => {
|
||||||
|
const newErrors: Partial<Record<keyof SberPaymentFormData, string>> = {}
|
||||||
|
|
||||||
|
if (!formData.welayat) newErrors.welayat = 'Welayat saylanmaly'
|
||||||
|
if (!formData.sahamca) newErrors.sahamca = 'Sahamca saylanmaly'
|
||||||
|
if (!formData.firstName) newErrors.firstName = 'Ady girizmeli'
|
||||||
|
if (!formData.lastName) newErrors.lastName = 'Familiyasy girizmeli'
|
||||||
|
if (!formData.phone) newErrors.phone = 'Telefon girizmeli'
|
||||||
|
if (!formData.address) newErrors.address = 'Salgy girizmeli'
|
||||||
|
if (!formData.passportSeries) newErrors.passportSeries = 'Pasport seriyasy girizmeli'
|
||||||
|
if (!formData.passportNumber) newErrors.passportNumber = 'Pasport nomeri girizmeli'
|
||||||
|
if (!formData.fullName) newErrors.fullName = 'Doly ady girizmeli'
|
||||||
|
if (!formData.accountNumber) newErrors.accountNumber = 'Goyum hasaby girizmeli'
|
||||||
|
|
||||||
|
setErrors(newErrors)
|
||||||
|
return Object.keys(newErrors).length === 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// Submit handler
|
||||||
|
const handleSubmit = async () => {
|
||||||
|
if (!validate()) {
|
||||||
|
toast.error('Meydanlary dolduryň')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (mode === 'create') {
|
||||||
|
await createMutation.mutateAsync(formData)
|
||||||
|
toast.success('Toleg ustunlikli doredildi')
|
||||||
|
router('/sber-payments')
|
||||||
|
} else if (orderId) {
|
||||||
|
await updateMutation.mutateAsync({ ...formData, id: orderId })
|
||||||
|
toast.success('Toleg ustunlikli tazelendi')
|
||||||
|
router(`/sber-payments/${orderId}`)
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
toast.error('Yalnyshlyk yuze cykdy')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="space-y-8 max-w-4xl pb-8">
|
||||||
|
{/* Status Section */}
|
||||||
|
<section className="space-y-4">
|
||||||
|
<h2 className="text-base font-semibold text-foreground">Status</h2>
|
||||||
|
<div className="grid gap-4">
|
||||||
|
<FormInput
|
||||||
|
type="searchable-select"
|
||||||
|
label="Ulanyjy"
|
||||||
|
required
|
||||||
|
placeholder="Saylamak ucin basyn"
|
||||||
|
value=""
|
||||||
|
onChange={() => {}}
|
||||||
|
options={[]}
|
||||||
|
/>
|
||||||
|
<FormInput
|
||||||
|
type="select"
|
||||||
|
label="Status"
|
||||||
|
required
|
||||||
|
value={formData.status}
|
||||||
|
onChange={(val) => updateField('status', val as PaymentStatus)}
|
||||||
|
options={STATUSES}
|
||||||
|
error={errors.status}
|
||||||
|
/>
|
||||||
|
<FormInput
|
||||||
|
type="text"
|
||||||
|
label="Bellik"
|
||||||
|
value={formData.bellik}
|
||||||
|
onChange={(val) => updateField('bellik', val)}
|
||||||
|
placeholder="Bellik"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
{/* Location Section */}
|
||||||
|
<section className="space-y-4">
|
||||||
|
<h2 className="text-base font-semibold text-foreground">Lokasiya</h2>
|
||||||
|
<div className="grid gap-4 md:grid-cols-2">
|
||||||
|
<FormInput
|
||||||
|
type="select"
|
||||||
|
label="Welayat"
|
||||||
|
required
|
||||||
|
value={formData.welayat}
|
||||||
|
onChange={(val) => {
|
||||||
|
updateField('welayat', val)
|
||||||
|
updateField('sahamca', '') // Reset branch when region changes
|
||||||
|
}}
|
||||||
|
options={WELAYATLAR.map((w) => ({ value: w, label: w }))}
|
||||||
|
placeholder="Asgabat"
|
||||||
|
error={errors.welayat}
|
||||||
|
/>
|
||||||
|
<FormInput
|
||||||
|
type="searchable-select"
|
||||||
|
label="Sahamca"
|
||||||
|
required
|
||||||
|
value={formData.sahamca}
|
||||||
|
onChange={(val) => updateField('sahamca', val)}
|
||||||
|
options={availableBranches.map((b) => ({ value: b, label: b }))}
|
||||||
|
placeholder="Saylamak ucin basyn"
|
||||||
|
disabled={!formData.welayat}
|
||||||
|
error={errors.sahamca}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
{/* Personal Info Section */}
|
||||||
|
<section className="space-y-4">
|
||||||
|
<h2 className="text-base font-semibold text-foreground">Sahsy maglumatlar</h2>
|
||||||
|
<div className="grid gap-4">
|
||||||
|
<FormInput
|
||||||
|
type="text"
|
||||||
|
label="Pasportdaky ady"
|
||||||
|
required
|
||||||
|
value={formData.firstName}
|
||||||
|
onChange={(val) => updateField('firstName', val)}
|
||||||
|
placeholder="Pasportdaky ady"
|
||||||
|
error={errors.firstName}
|
||||||
|
/>
|
||||||
|
<FormInput
|
||||||
|
type="text"
|
||||||
|
label="Pasportdaky familiya"
|
||||||
|
required
|
||||||
|
value={formData.lastName}
|
||||||
|
onChange={(val) => updateField('lastName', val)}
|
||||||
|
placeholder="Pasportdaky familiya"
|
||||||
|
error={errors.lastName}
|
||||||
|
/>
|
||||||
|
<FormInput
|
||||||
|
type="phone"
|
||||||
|
label="Telefon"
|
||||||
|
required
|
||||||
|
value={formData.phone}
|
||||||
|
onChange={(val) => updateField('phone', val)}
|
||||||
|
placeholder="61 097 651"
|
||||||
|
error={errors.phone}
|
||||||
|
/>
|
||||||
|
<FormInput
|
||||||
|
type="email"
|
||||||
|
label="E-pocta"
|
||||||
|
value={formData.email}
|
||||||
|
onChange={(val) => updateField('email', val)}
|
||||||
|
placeholder="E-pocta"
|
||||||
|
/>
|
||||||
|
<FormInput
|
||||||
|
type="text"
|
||||||
|
label="Hazirki yasayys yeri"
|
||||||
|
required
|
||||||
|
value={formData.address}
|
||||||
|
onChange={(val) => updateField('address', val)}
|
||||||
|
placeholder="Hazirki yasayys yeri"
|
||||||
|
error={errors.address}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
{/* Payment Info Section */}
|
||||||
|
<section className="space-y-4">
|
||||||
|
<h2 className="text-base font-semibold text-foreground">Tolegi ugradyjynyn maglumatlary</h2>
|
||||||
|
<div className="grid gap-4">
|
||||||
|
<FormInput
|
||||||
|
type="searchable-select"
|
||||||
|
label="Pasport seriyasy"
|
||||||
|
required
|
||||||
|
value={formData.passportSeries}
|
||||||
|
onChange={(val) => updateField('passportSeries', val)}
|
||||||
|
options={[
|
||||||
|
{ value: 'II-MA', label: 'II-MA' },
|
||||||
|
{ value: 'II-MB', label: 'II-MB' },
|
||||||
|
{ value: 'II-MC', label: 'II-MC' },
|
||||||
|
{ value: 'II-MD', label: 'II-MD' },
|
||||||
|
]}
|
||||||
|
placeholder="Saylamak ucin basyn"
|
||||||
|
error={errors.passportSeries}
|
||||||
|
/>
|
||||||
|
<FormInput
|
||||||
|
type="text"
|
||||||
|
label="Pasport nomeri"
|
||||||
|
required
|
||||||
|
value={formData.passportNumber}
|
||||||
|
onChange={(val) => updateField('passportNumber', val)}
|
||||||
|
placeholder="Pasport nomeri"
|
||||||
|
error={errors.passportNumber}
|
||||||
|
/>
|
||||||
|
<FormInput
|
||||||
|
type="text"
|
||||||
|
label="Ady Familiyasy Atasynyn ady"
|
||||||
|
required
|
||||||
|
value={formData.fullName}
|
||||||
|
onChange={(val) => updateField('fullName', val)}
|
||||||
|
placeholder="Ady Familiyasy Atasynyn ady"
|
||||||
|
error={errors.fullName}
|
||||||
|
/>
|
||||||
|
<FormInput
|
||||||
|
type="text"
|
||||||
|
label="Goyum hasaby"
|
||||||
|
required
|
||||||
|
value={formData.accountNumber}
|
||||||
|
onChange={(val) => updateField('accountNumber', val)}
|
||||||
|
placeholder="Goyum hasaby"
|
||||||
|
error={errors.accountNumber}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
{/* Recipient Info Section */}
|
||||||
|
<section className="space-y-4">
|
||||||
|
<h2 className="text-base font-semibold text-foreground">Tolegi kabul edijinin maglumatlary</h2>
|
||||||
|
<div className="bg-card rounded-lg border border-border p-4">
|
||||||
|
<div className="flex items-start gap-4">
|
||||||
|
<span className="text-sm text-muted-foreground shrink-0 w-48">
|
||||||
|
Tolegi kabul edijinin maglumatlary
|
||||||
|
</span>
|
||||||
|
<Button variant="default" className="bg-primary text-primary-foreground">
|
||||||
|
Setir gos
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
{/* Accepted Documents Section */}
|
||||||
|
<section className="space-y-4">
|
||||||
|
<h2 className="text-base font-semibold text-foreground">
|
||||||
|
Kabul ediji talyp boyunca resminamalary
|
||||||
|
</h2>
|
||||||
|
<div className="space-y-3">
|
||||||
|
{acceptedDocumentLabels.map((label, index) => (
|
||||||
|
<div key={index} className="flex items-start gap-4 py-3">
|
||||||
|
<span className="w-80 shrink-0 text-sm text-muted-foreground leading-relaxed">
|
||||||
|
{label}
|
||||||
|
</span>
|
||||||
|
<Button variant="outline" size="sm" className="gap-2">
|
||||||
|
<Plus size={14} />
|
||||||
|
Add New File
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
{/* Sent Documents Section */}
|
||||||
|
<section className="space-y-4">
|
||||||
|
<h2 className="text-base font-semibold text-foreground">
|
||||||
|
Ugradyjy boyunca resminamalary
|
||||||
|
</h2>
|
||||||
|
<div className="space-y-3">
|
||||||
|
{sentDocumentLabels.map((label, index) => (
|
||||||
|
<div key={index} className="flex items-start gap-4 py-3">
|
||||||
|
<span className="w-80 shrink-0 text-sm text-muted-foreground leading-relaxed">
|
||||||
|
{label}
|
||||||
|
</span>
|
||||||
|
<Button variant="outline" size="sm" className="gap-2">
|
||||||
|
<Plus size={14} />
|
||||||
|
Add New File
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
{/* Actions */}
|
||||||
|
<div className="flex items-center justify-end gap-3 pt-4 border-t border-border">
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
disabled={isLoading}
|
||||||
|
>
|
||||||
|
Yatyr
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
onClick={handleSubmit}
|
||||||
|
disabled={isLoading}
|
||||||
|
className="min-w-[180px]"
|
||||||
|
>
|
||||||
|
{isLoading ? (
|
||||||
|
<Spinner className="w-4 h-4" />
|
||||||
|
) : mode === 'create' ? (
|
||||||
|
'Sber toleg (talyplar ucin) doredih'
|
||||||
|
) : (
|
||||||
|
'Yatda sakla'
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
import type { PaymentStatus, PaymentPaidStatus } from '@/features/sberPayments/api/sberPaymentsApi'
|
||||||
|
|
||||||
|
interface StatusBadgeProps {
|
||||||
|
status: PaymentStatus
|
||||||
|
className?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const statusConfig: Record<PaymentStatus, { label: string; className: string }> = {
|
||||||
|
GARASYLYYAR: {
|
||||||
|
label: 'Garasylyyar',
|
||||||
|
className: 'bg-[oklch(0.75_0.18_85)] text-[oklch(0.20_0_0)]',
|
||||||
|
},
|
||||||
|
KANAGATLANDYRYLAN: {
|
||||||
|
label: 'Kanagatlandyrylan',
|
||||||
|
className: 'bg-[oklch(0.72_0.19_160)] text-[oklch(0.15_0_0)]',
|
||||||
|
},
|
||||||
|
RET_EDILEN: {
|
||||||
|
label: 'Ret edilen',
|
||||||
|
className: 'bg-destructive text-destructive-foreground',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
export function StatusBadge({ status, className }: StatusBadgeProps) {
|
||||||
|
const config = statusConfig[status]
|
||||||
|
|
||||||
|
return (
|
||||||
|
<span
|
||||||
|
className={cn(
|
||||||
|
'inline-flex items-center px-2 py-0.5 rounded text-xs font-semibold uppercase tracking-wide',
|
||||||
|
config.className,
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{config.label}
|
||||||
|
</span>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
interface PaidStatusBadgeProps {
|
||||||
|
status: PaymentPaidStatus
|
||||||
|
className?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export function PaidStatusBadge({ status, className }: PaidStatusBadgeProps) {
|
||||||
|
const isPaid = status === 'Tolendi'
|
||||||
|
|
||||||
|
return (
|
||||||
|
<span
|
||||||
|
className={cn(
|
||||||
|
'inline-flex items-center text-sm',
|
||||||
|
isPaid ? 'text-primary' : 'text-muted-foreground',
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{status}
|
||||||
|
</span>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
'use client'
|
||||||
|
|
||||||
|
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
|
||||||
|
import {
|
||||||
|
getSberPaymentOrders,
|
||||||
|
getSberPaymentOrderById,
|
||||||
|
createSberPaymentOrder,
|
||||||
|
updateSberPaymentOrder,
|
||||||
|
deleteSberPaymentOrder,
|
||||||
|
type CreateSberPaymentPayload,
|
||||||
|
type UpdateSberPaymentPayload,
|
||||||
|
} from '../api/sberPaymentsApi'
|
||||||
|
|
||||||
|
// ─── Query Keys ───────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
export const sberPaymentKeys = {
|
||||||
|
all: ['sber-payments'] as const,
|
||||||
|
lists: () => [...sberPaymentKeys.all, 'list'] as const,
|
||||||
|
list: (params: Record<string, unknown>) => [...sberPaymentKeys.lists(), params] as const,
|
||||||
|
details: () => [...sberPaymentKeys.all, 'detail'] as const,
|
||||||
|
detail: (id: string) => [...sberPaymentKeys.details(), id] as const,
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── Hooks ────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
export function useSberPaymentOrders(params: {
|
||||||
|
page?: number
|
||||||
|
perPage?: number
|
||||||
|
search?: string
|
||||||
|
welayat?: string
|
||||||
|
sahamca?: string
|
||||||
|
status?: string
|
||||||
|
}) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: sberPaymentKeys.list(params),
|
||||||
|
queryFn: () => getSberPaymentOrders(params),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useSberPaymentOrder(id: string) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: sberPaymentKeys.detail(id),
|
||||||
|
queryFn: () => getSberPaymentOrderById(id),
|
||||||
|
enabled: !!id,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useCreateSberPayment() {
|
||||||
|
const queryClient = useQueryClient()
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (payload: CreateSberPaymentPayload) => createSberPaymentOrder(payload),
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: sberPaymentKeys.lists() })
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useUpdateSberPayment() {
|
||||||
|
const queryClient = useQueryClient()
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (payload: UpdateSberPaymentPayload) => updateSberPaymentOrder(payload),
|
||||||
|
onSuccess: (data) => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: sberPaymentKeys.lists() })
|
||||||
|
queryClient.setQueryData(sberPaymentKeys.detail(data.id), data)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useDeleteSberPayment() {
|
||||||
|
const queryClient = useQueryClient()
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (id: string) => deleteSberPaymentOrder(id),
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: sberPaymentKeys.lists() })
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
+196
-2
@@ -1,4 +1,4 @@
|
|||||||
@import "tailwindcss";
|
/* @import "tailwindcss";
|
||||||
@import "tw-animate-css";
|
@import "tw-animate-css";
|
||||||
@import "shadcn/tailwind.css";
|
@import "shadcn/tailwind.css";
|
||||||
@import "@fontsource-variable/geist";
|
@import "@fontsource-variable/geist";
|
||||||
@@ -189,4 +189,198 @@ body {
|
|||||||
html {
|
html {
|
||||||
@apply font-sans;
|
@apply font-sans;
|
||||||
}
|
}
|
||||||
}
|
} */
|
||||||
|
|
||||||
|
|
||||||
|
@import "tailwindcss";
|
||||||
|
@import "tw-animate-css";
|
||||||
|
@import "shadcn/tailwind.css";
|
||||||
|
@import "@fontsource-variable/geist";
|
||||||
|
|
||||||
|
@custom-variant dark (&:is(.dark *));
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--text: #6b6375;
|
||||||
|
--text-h: #08060d;
|
||||||
|
--bg: #fff;
|
||||||
|
--border: oklch(0.922 0 0);
|
||||||
|
--code-bg: #f4f3ec;
|
||||||
|
--accent: oklch(0.97 0 0);
|
||||||
|
--accent-bg: rgba(170, 59, 255, 0.1);
|
||||||
|
--accent-border: rgba(170, 59, 255, 0.5);
|
||||||
|
--social-bg: rgba(244, 243, 236, 0.5);
|
||||||
|
--shadow:
|
||||||
|
rgba(0, 0, 0, 0.1) 0 10px 15px -3px, rgba(0, 0, 0, 0.05) 0 4px 6px -2px;
|
||||||
|
|
||||||
|
--background: oklch(1 0 0);
|
||||||
|
--foreground: oklch(0.145 0 0);
|
||||||
|
--card: oklch(1 0 0);
|
||||||
|
--card-foreground: oklch(0.145 0 0);
|
||||||
|
--popover: oklch(1 0 0);
|
||||||
|
--popover-foreground: oklch(0.145 0 0);
|
||||||
|
--primary: oklch(0.205 0 0);
|
||||||
|
--primary-foreground: oklch(0.985 0 0);
|
||||||
|
--secondary: oklch(0.97 0 0);
|
||||||
|
--secondary-foreground: oklch(0.205 0 0);
|
||||||
|
--muted: oklch(0.97 0 0);
|
||||||
|
--muted-foreground: oklch(0.556 0 0);
|
||||||
|
--accent-foreground: oklch(0.205 0 0);
|
||||||
|
--destructive: oklch(0.577 0.245 27.325);
|
||||||
|
--input: oklch(0.922 0 0);
|
||||||
|
--ring: oklch(0.708 0 0);
|
||||||
|
--chart-1: oklch(0.87 0 0);
|
||||||
|
--chart-2: oklch(0.556 0 0);
|
||||||
|
--chart-3: oklch(0.439 0 0);
|
||||||
|
--chart-4: oklch(0.371 0 0);
|
||||||
|
--chart-5: oklch(0.269 0 0);
|
||||||
|
--radius: 0.625rem;
|
||||||
|
--sidebar: oklch(0.985 0 0);
|
||||||
|
--sidebar-foreground: oklch(0.145 0 0);
|
||||||
|
--sidebar-primary: oklch(0.205 0 0);
|
||||||
|
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||||
|
--sidebar-accent: oklch(0.97 0 0);
|
||||||
|
--sidebar-accent-foreground: oklch(0.205 0 0);
|
||||||
|
--sidebar-border: oklch(0.922 0 0);
|
||||||
|
--sidebar-ring: oklch(0.708 0 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
:root {
|
||||||
|
--text: #9ca3af;
|
||||||
|
--text-h: #f3f4f6;
|
||||||
|
--bg: #16171d;
|
||||||
|
--border: #2e303a;
|
||||||
|
--code-bg: #1f2028;
|
||||||
|
--accent: #c084fc;
|
||||||
|
--accent-bg: rgba(192, 132, 252, 0.15);
|
||||||
|
--accent-border: rgba(192, 132, 252, 0.5);
|
||||||
|
--social-bg: rgba(47, 48, 58, 0.5);
|
||||||
|
--shadow:
|
||||||
|
rgba(0, 0, 0, 0.4) 0 10px 15px -3px, rgba(0, 0, 0, 0.25) 0 4px 6px -2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#social .button-icon {
|
||||||
|
filter: invert(1) brightness(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--background: oklch(0.98 0.003 250);
|
||||||
|
--foreground: oklch(0.25 0.02 250);
|
||||||
|
--card: oklch(1 0 0);
|
||||||
|
--card-foreground: oklch(0.25 0.02 250);
|
||||||
|
--primary: oklch(0.45 0.06 250);
|
||||||
|
--primary-foreground: oklch(0.98 0 0);
|
||||||
|
--secondary: oklch(0.96 0.005 250);
|
||||||
|
--secondary-foreground: oklch(0.35 0.02 250);
|
||||||
|
--muted: oklch(0.96 0.005 250);
|
||||||
|
--muted-foreground: oklch(0.50 0.02 250);
|
||||||
|
--accent: oklch(0.96 0.005 250);
|
||||||
|
--accent-foreground: oklch(0.35 0.02 250);
|
||||||
|
--destructive: oklch(0.577 0.245 27.325);
|
||||||
|
--border: oklch(0.90 0.01 250);
|
||||||
|
--input: oklch(0.90 0.01 250);
|
||||||
|
--ring: oklch(0.45 0.06 250);
|
||||||
|
--sidebar: oklch(0.97 0.005 250);
|
||||||
|
--sidebar-foreground: oklch(0.30 0.02 250);
|
||||||
|
--sidebar-primary: oklch(0.45 0.06 250);
|
||||||
|
--sidebar-primary-foreground: oklch(0.98 0 0);
|
||||||
|
--sidebar-accent: oklch(0.93 0.008 250);
|
||||||
|
--sidebar-accent-foreground: oklch(0.30 0.02 250);
|
||||||
|
--sidebar-border: oklch(0.88 0.012 250);
|
||||||
|
--sidebar-ring: oklch(0.45 0.06 250);
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@theme inline {
|
||||||
|
--font-heading: var(--font-sans);
|
||||||
|
--font-sans: "Geist Variable", sans-serif;
|
||||||
|
--color-sidebar-ring: var(--sidebar-ring);
|
||||||
|
--color-sidebar-border: var(--sidebar-border);
|
||||||
|
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
||||||
|
--color-sidebar-accent: var(--sidebar-accent);
|
||||||
|
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
||||||
|
--color-sidebar-primary: var(--sidebar-primary);
|
||||||
|
--color-sidebar-foreground: var(--sidebar-foreground);
|
||||||
|
--color-sidebar: var(--sidebar);
|
||||||
|
--color-chart-5: var(--chart-5);
|
||||||
|
--color-chart-4: var(--chart-4);
|
||||||
|
--color-chart-3: var(--chart-3);
|
||||||
|
--color-chart-2: var(--chart-2);
|
||||||
|
--color-chart-1: var(--chart-1);
|
||||||
|
--color-ring: var(--ring);
|
||||||
|
--color-input: var(--input);
|
||||||
|
--color-border: var(--border);
|
||||||
|
--color-destructive: var(--destructive);
|
||||||
|
--color-accent-foreground: var(--accent-foreground);
|
||||||
|
--color-accent: var(--accent);
|
||||||
|
--color-muted-foreground: var(--muted-foreground);
|
||||||
|
--color-muted: var(--muted);
|
||||||
|
--color-secondary-foreground: var(--secondary-foreground);
|
||||||
|
--color-secondary: var(--secondary);
|
||||||
|
--color-primary-foreground: var(--primary-foreground);
|
||||||
|
--color-primary: var(--primary);
|
||||||
|
--color-popover-foreground: var(--popover-foreground);
|
||||||
|
--color-popover: var(--popover);
|
||||||
|
--color-card-foreground: var(--card-foreground);
|
||||||
|
--color-card: var(--card);
|
||||||
|
--color-foreground: var(--foreground);
|
||||||
|
--color-background: var(--background);
|
||||||
|
--radius-sm: calc(var(--radius) * 0.6);
|
||||||
|
--radius-md: calc(var(--radius) * 0.8);
|
||||||
|
--radius-lg: var(--radius);
|
||||||
|
--radius-xl: calc(var(--radius) * 1.4);
|
||||||
|
--radius-2xl: calc(var(--radius) * 1.8);
|
||||||
|
--radius-3xl: calc(var(--radius) * 2.2);
|
||||||
|
--radius-4xl: calc(var(--radius) * 2.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark {
|
||||||
|
--background: oklch(0.18 0.015 250);
|
||||||
|
--foreground: oklch(0.92 0.01 250);
|
||||||
|
--card: oklch(0.22 0.018 250);
|
||||||
|
--card-foreground: oklch(0.92 0.01 250);
|
||||||
|
--popover: oklch(0.22 0.018 250);
|
||||||
|
--popover-foreground: oklch(0.92 0.01 250);
|
||||||
|
--primary: oklch(0.65 0.08 250);
|
||||||
|
--primary-foreground: oklch(0.12 0.01 250);
|
||||||
|
--secondary: oklch(0.28 0.02 250);
|
||||||
|
--secondary-foreground: oklch(0.90 0.01 250);
|
||||||
|
--muted: oklch(0.28 0.02 250);
|
||||||
|
--muted-foreground: oklch(0.65 0.02 250);
|
||||||
|
--accent: oklch(0.30 0.025 250);
|
||||||
|
--accent-foreground: oklch(0.90 0.01 250);
|
||||||
|
--destructive: oklch(0.65 0.22 25);
|
||||||
|
--border: oklch(0.35 0.025 250);
|
||||||
|
--input: oklch(0.28 0.02 250);
|
||||||
|
--ring: oklch(0.60 0.08 250);
|
||||||
|
--sidebar: oklch(0.16 0.012 250);
|
||||||
|
--sidebar-foreground: oklch(0.90 0.01 250);
|
||||||
|
--sidebar-primary: oklch(0.65 0.08 250);
|
||||||
|
--sidebar-primary-foreground: oklch(0.98 0 0);
|
||||||
|
--sidebar-accent: oklch(0.24 0.018 250);
|
||||||
|
--sidebar-accent-foreground: oklch(0.90 0.01 250);
|
||||||
|
--sidebar-border: oklch(0.30 0.02 250);
|
||||||
|
--sidebar-ring: oklch(0.60 0.08 250);
|
||||||
|
|
||||||
|
--chart-1: oklch(0.65 0.08 250);
|
||||||
|
--chart-2: oklch(0.65 0.12 180);
|
||||||
|
--chart-3: oklch(0.72 0.10 90);
|
||||||
|
--chart-4: oklch(0.65 0.15 25);
|
||||||
|
--chart-5: oklch(0.62 0.12 330);
|
||||||
|
}
|
||||||
|
|
||||||
|
@layer base {
|
||||||
|
* {
|
||||||
|
@apply border-border outline-ring/50;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
@apply bg-background text-foreground;
|
||||||
|
}
|
||||||
|
html {
|
||||||
|
@apply font-sans;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -215,7 +215,7 @@ function AppSidebar() {
|
|||||||
title: t('International payments', 'HALKARA TÖLEGLER'),
|
title: t('International payments', 'HALKARA TÖLEGLER'),
|
||||||
items: [
|
items: [
|
||||||
{ title: t('Visa/Master payments', 'Visa/Master tölegleri'), url: '/visa-master' },
|
{ title: t('Visa/Master payments', 'Visa/Master tölegleri'), url: '/visa-master' },
|
||||||
{ title: t('Sber payments', 'Sber tölegleri'), url: '/sber' },
|
{ title: t('Sber payments', 'Sber tölegleri'), url: '/sber-payments' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -176,12 +176,17 @@ export default function CardPinsPage() {
|
|||||||
];
|
];
|
||||||
|
|
||||||
const columnMeta = columns
|
const columnMeta = columns
|
||||||
.filter((c) => "accessorKey" in c && c.id !== "actions")
|
.filter((c) => ("accessorKey" in c || "id" in c) && c.id !== "actions")
|
||||||
.map((c) => ({
|
.map((c) => {
|
||||||
id: ("accessorKey" in c ? String(c.accessorKey) : c.id) as string,
|
const id = ("accessorKey" in c ? String(c.accessorKey) : c.id) as string;
|
||||||
label:
|
const label =
|
||||||
typeof c.header === "string" ? c.header : String(c.accessorKey ?? ""),
|
typeof c.header === "string"
|
||||||
}));
|
? c.header
|
||||||
|
: "accessorKey" in c
|
||||||
|
? String(c.accessorKey)
|
||||||
|
: id;
|
||||||
|
return { id, label };
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useParams, useNavigate, Link } from 'react-router-dom'
|
import { useParams, useNavigate } from 'react-router-dom'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { useCardPin, useDeleteCardPin } from '@/features/cardPins/hooks/useCardPins'
|
import { useCardPin, useDeleteCardPin } from '@/features/cardPins/hooks/useCardPins'
|
||||||
import type { CardPinStatus } from '@/features/cardPins/api/cardPinApi'
|
import type { CardPinStatus } from '@/features/cardPins/api/cardPinApi'
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ function PassportImageRow({ label, url }: { label: string; url?: string }) {
|
|||||||
className="flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors w-fit"
|
className="flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors w-fit"
|
||||||
>
|
>
|
||||||
<DownloadCloud size={13} />
|
<DownloadCloud size={13} />
|
||||||
{('Download', 'Göçürip al')}
|
{( 'Göçürip al')}
|
||||||
</a>
|
</a>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -0,0 +1,312 @@
|
|||||||
|
|
||||||
|
import { useState, useMemo } from 'react'
|
||||||
|
import { format } from 'date-fns'
|
||||||
|
import { Eye, Edit, ArrowUpDown, Trash2 } from 'lucide-react'
|
||||||
|
import type { ColumnDef, VisibilityState } from '@tanstack/react-table'
|
||||||
|
import { useNavigate } from 'react-router-dom'
|
||||||
|
import { DataTable } from '@/components/dataTable'
|
||||||
|
import { DataTableToolbar, type ColumnMeta, type FilterField, type ActiveFilter } from '@/components/dataTableToolbar'
|
||||||
|
import { StatusBadge, PaidStatusBadge } from '@/features/sberPayments/components/statusBadge'
|
||||||
|
import { useSberPaymentOrders, useDeleteSberPayment } from '@/features/sberPayments/hooks/useSberPayments'
|
||||||
|
import { WELAYATLAR, STATUSES, type SberPaymentOrder } from '@/features/sberPayments/api/sberPaymentsApi'
|
||||||
|
|
||||||
|
import {
|
||||||
|
Select,
|
||||||
|
SelectContent,
|
||||||
|
SelectItem,
|
||||||
|
SelectTrigger,
|
||||||
|
SelectValue,
|
||||||
|
} from '@/components/ui/select'
|
||||||
|
|
||||||
|
// ─── Column Definitions ───────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ─── Column Meta for Toolbar ──────────────────────────────────────────────────
|
||||||
|
|
||||||
|
const columnMeta: ColumnMeta[] = [
|
||||||
|
{ id: 'id', label: 'ID' },
|
||||||
|
{ id: 'createdAt', label: 'Doredilen wagty' },
|
||||||
|
{ id: 'welayat', label: 'Welayat' },
|
||||||
|
{ id: 'sahamca', label: 'Sahamca' },
|
||||||
|
{ id: 'firstName', label: 'Ady' },
|
||||||
|
{ id: 'lastName', label: 'Familiyasy' },
|
||||||
|
{ id: 'phone', label: 'Telefon' },
|
||||||
|
{ id: 'status', label: 'Status' },
|
||||||
|
{ id: 'paidStatus', label: 'Tolenen (sul ay)' },
|
||||||
|
]
|
||||||
|
|
||||||
|
// ─── Filter Fields ────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
const filterFields: FilterField[] = [
|
||||||
|
{
|
||||||
|
id: 'welayat',
|
||||||
|
label: 'Welayat',
|
||||||
|
options: WELAYATLAR.map((w) => ({ value: w, label: w })),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'status',
|
||||||
|
label: 'Status',
|
||||||
|
options: STATUSES,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
// ─── List Page Component ──────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
export default function SberPaymentsListPage() {
|
||||||
|
const navigate = useNavigate()
|
||||||
|
const deleteMutation = useDeleteSberPayment()
|
||||||
|
|
||||||
|
const columns = useMemo<ColumnDef<SberPaymentOrder>[]>(() => [
|
||||||
|
{
|
||||||
|
accessorKey: 'id',
|
||||||
|
header: ({ column }) => (
|
||||||
|
<button
|
||||||
|
className="flex items-center gap-1 hover:text-foreground transition-colors"
|
||||||
|
onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
|
||||||
|
>
|
||||||
|
ID
|
||||||
|
<ArrowUpDown size={12} />
|
||||||
|
</button>
|
||||||
|
),
|
||||||
|
cell: ({ row }) => (
|
||||||
|
<span className="font-medium text-foreground">{row.getValue('id')}</span>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: 'createdAt',
|
||||||
|
header: 'Doredilen wagty',
|
||||||
|
cell: ({ row }) => {
|
||||||
|
const date = new Date(row.getValue('createdAt'))
|
||||||
|
return (
|
||||||
|
<div className="text-sm">
|
||||||
|
<div>{format(date, 'HH:mm, dd.MM.yyyy')}</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: 'welayat',
|
||||||
|
header: 'Welayat',
|
||||||
|
cell: ({ row }) => <span>{row.getValue('welayat')}</span>,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: 'sahamca',
|
||||||
|
header: ({ column }) => (
|
||||||
|
<button
|
||||||
|
className="flex items-center gap-1 hover:text-foreground transition-colors"
|
||||||
|
onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
|
||||||
|
>
|
||||||
|
Sahamca
|
||||||
|
<ArrowUpDown size={12} />
|
||||||
|
</button>
|
||||||
|
),
|
||||||
|
cell: ({ row }) => (
|
||||||
|
<span className="text-primary font-medium">{row.getValue('sahamca')}</span>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: 'firstName',
|
||||||
|
header: 'Ady',
|
||||||
|
cell: ({ row }) => <span>{row.getValue('firstName')}</span>,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: 'lastName',
|
||||||
|
header: 'Familiyasy',
|
||||||
|
cell: ({ row }) => <span>{row.getValue('lastName')}</span>,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: 'phone',
|
||||||
|
header: 'Telefon',
|
||||||
|
cell: ({ row }) => <span className="text-muted-foreground">{row.getValue('phone')}</span>,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: 'status',
|
||||||
|
header: ({ column }) => (
|
||||||
|
<button
|
||||||
|
className="flex items-center gap-1 hover:text-foreground transition-colors"
|
||||||
|
onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
|
||||||
|
>
|
||||||
|
Status
|
||||||
|
<ArrowUpDown size={12} />
|
||||||
|
</button>
|
||||||
|
),
|
||||||
|
cell: ({ row }) => <StatusBadge status={row.getValue('status')} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: 'paidStatus',
|
||||||
|
header: 'Tolenen (sul ay)',
|
||||||
|
cell: ({ row }) => <PaidStatusBadge status={row.getValue('paidStatus')} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'actions',
|
||||||
|
header: '',
|
||||||
|
cell: ({ row }) => {
|
||||||
|
const order = row.original
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex items-center gap-1">
|
||||||
|
<button
|
||||||
|
onClick={() => navigate(`/sber-payments/${order.id}`)}
|
||||||
|
className="p-1.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors"
|
||||||
|
title="View"
|
||||||
|
>
|
||||||
|
<Eye size={16} />
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
onClick={() => navigate(`/sber-payments/${order.id}/edit`)}
|
||||||
|
className="p-1.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors"
|
||||||
|
title="Edit"
|
||||||
|
>
|
||||||
|
<Edit size={16} />
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
onClick={async () => {
|
||||||
|
if (confirm('Bu tolegi pozmak isleyanizmi?')) {
|
||||||
|
await deleteMutation.mutateAsync(order.id)
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
className="p-1.5 rounded hover:bg-accent text-destructive hover:bg-destructive/10 transition-colors"
|
||||||
|
title="Delete"
|
||||||
|
>
|
||||||
|
<Trash2 size={16} />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
], [navigate, deleteMutation])
|
||||||
|
|
||||||
|
// Pagination state
|
||||||
|
const [page, setPage] = useState(1)
|
||||||
|
const [perPage, setPerPage] = useState(25)
|
||||||
|
|
||||||
|
// Search state
|
||||||
|
const [search, setSearch] = useState('')
|
||||||
|
|
||||||
|
// Filter state
|
||||||
|
const [activeFilters, setActiveFilters] = useState<ActiveFilter[]>([])
|
||||||
|
|
||||||
|
// Column visibility & order
|
||||||
|
const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({})
|
||||||
|
const [columnOrder, setColumnOrder] = useState<string[]>(columnMeta.map((c) => c.id))
|
||||||
|
|
||||||
|
// Month filter
|
||||||
|
const [selectedMonth, setSelectedMonth] = useState<string>('')
|
||||||
|
|
||||||
|
// Get filter values
|
||||||
|
const welayatFilter = activeFilters.find((f) => f.fieldId === 'welayat')?.value ?? ''
|
||||||
|
const statusFilter = activeFilters.find((f) => f.fieldId === 'status')?.value ?? ''
|
||||||
|
|
||||||
|
// Fetch data
|
||||||
|
const { data, isLoading } = useSberPaymentOrders({
|
||||||
|
page,
|
||||||
|
perPage,
|
||||||
|
search,
|
||||||
|
welayat: welayatFilter,
|
||||||
|
status: statusFilter,
|
||||||
|
})
|
||||||
|
|
||||||
|
const handleFilterChange = (fieldId: string, value: string) => {
|
||||||
|
setActiveFilters((prev) => {
|
||||||
|
const existing = prev.find((f) => f.fieldId === fieldId)
|
||||||
|
if (existing) {
|
||||||
|
return prev.map((f) => (f.fieldId === fieldId ? { ...f, value } : f))
|
||||||
|
}
|
||||||
|
return [...prev, { fieldId, value }]
|
||||||
|
})
|
||||||
|
setPage(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleFilterReset = () => {
|
||||||
|
setActiveFilters([])
|
||||||
|
setPage(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="space-y-4">
|
||||||
|
{/* Month Filter Card */}
|
||||||
|
<div className="bg-card border border-border rounded-lg p-4 max-w-xs">
|
||||||
|
<label className="block text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-2">
|
||||||
|
Ay Tolegi
|
||||||
|
</label>
|
||||||
|
<Select value={selectedMonth} onValueChange={setSelectedMonth}>
|
||||||
|
<SelectTrigger className="w-full">
|
||||||
|
<SelectValue placeholder="--" />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
<SelectItem value="01">Yanwar</SelectItem>
|
||||||
|
<SelectItem value="02">Fewral</SelectItem>
|
||||||
|
<SelectItem value="03">Mart</SelectItem>
|
||||||
|
<SelectItem value="04">Aprel</SelectItem>
|
||||||
|
<SelectItem value="05">May</SelectItem>
|
||||||
|
<SelectItem value="06">Iýun</SelectItem>
|
||||||
|
<SelectItem value="07">Iýul</SelectItem>
|
||||||
|
<SelectItem value="08">Awgust</SelectItem>
|
||||||
|
<SelectItem value="09">Sentýabr</SelectItem>
|
||||||
|
<SelectItem value="10">Oktýabr</SelectItem>
|
||||||
|
<SelectItem value="11">Noýabr</SelectItem>
|
||||||
|
<SelectItem value="12">Dekabr</SelectItem>
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Page Title */}
|
||||||
|
<h1 className="text-xl font-semibold text-foreground">
|
||||||
|
Sber tolegier (talyplar ucin)
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
{/* Toolbar */}
|
||||||
|
<DataTableToolbar
|
||||||
|
searchValue={search}
|
||||||
|
onSearchChange={(val) => {
|
||||||
|
setSearch(val)
|
||||||
|
setPage(1)
|
||||||
|
}}
|
||||||
|
searchPlaceholder="Gozlemek"
|
||||||
|
columns={columnMeta}
|
||||||
|
columnVisibility={columnVisibility}
|
||||||
|
onColumnVisibilityChange={setColumnVisibility}
|
||||||
|
columnOrder={columnOrder}
|
||||||
|
onColumnOrderChange={setColumnOrder}
|
||||||
|
filterFields={filterFields}
|
||||||
|
activeFilters={activeFilters}
|
||||||
|
onFilterChange={handleFilterChange}
|
||||||
|
onFilterReset={handleFilterReset}
|
||||||
|
perPage={perPage}
|
||||||
|
onPerPageChange={(val) => {
|
||||||
|
setPerPage(val)
|
||||||
|
setPage(1)
|
||||||
|
}}
|
||||||
|
actionLabel="Sber toleg (talyplar ucin) doredih"
|
||||||
|
onAction={() => navigate('/sber-payments/create')}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* Data Table */}
|
||||||
|
<DataTable
|
||||||
|
columns={columns}
|
||||||
|
data={data?.data ?? []}
|
||||||
|
isLoading={isLoading}
|
||||||
|
columnVisibility={columnVisibility}
|
||||||
|
onColumnVisibilityChange={setColumnVisibility}
|
||||||
|
columnOrder={columnOrder}
|
||||||
|
onColumnOrderChange={setColumnOrder}
|
||||||
|
enableRowSelection
|
||||||
|
getRowId={(row) => row.id}
|
||||||
|
currentPage={data?.pagination.currentPage ?? 1}
|
||||||
|
totalPages={data?.pagination.totalPages ?? 1}
|
||||||
|
totalCount={data?.pagination.totalCount ?? 0}
|
||||||
|
onPageChange={setPage}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* Pagination Info */}
|
||||||
|
<div className="flex items-center justify-between text-sm text-muted-foreground">
|
||||||
|
<span>
|
||||||
|
{data?.pagination.currentPage && data?.pagination.perPage && data?.pagination.totalCount
|
||||||
|
? `${(data.pagination.currentPage - 1) * data.pagination.perPage + 1}-${Math.min(data.pagination.currentPage * data.pagination.perPage, data.pagination.totalCount)} of ${data.pagination.totalCount}`
|
||||||
|
: ''}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
'use client'
|
||||||
|
|
||||||
|
import { SberPaymentForm } from '@/features/sberPayments/components/sberPaymentsForm'
|
||||||
|
|
||||||
|
export default function SberPaymentCreatePage() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<h1 className="text-xl font-semibold text-foreground mb-6">
|
||||||
|
Sber toleg (talyplar ucin) doredih
|
||||||
|
</h1>
|
||||||
|
<SberPaymentForm mode="create" />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import { useParams } from 'react-router-dom'
|
||||||
|
import { SberPaymentForm } from '@/features/sberPayments/components/sberPaymentsForm'
|
||||||
|
import { useSberPaymentOrder } from '@/features/sberPayments/hooks/useSberPayments'
|
||||||
|
import { Spinner } from '@/components/ui/spinner'
|
||||||
|
|
||||||
|
export default function SberPaymentEditPage() {
|
||||||
|
const params = useParams()
|
||||||
|
const id = params.id as string
|
||||||
|
|
||||||
|
const { data: order, isLoading } = useSberPaymentOrder(id)
|
||||||
|
|
||||||
|
if (isLoading) {
|
||||||
|
return (
|
||||||
|
<div className="flex items-center justify-center min-h-[400px]">
|
||||||
|
<Spinner className="w-8 h-8" />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<h1 className="text-xl font-semibold text-foreground mb-6">
|
||||||
|
Sber toleg (talyplar ucin) uytgetmek: {id}
|
||||||
|
</h1>
|
||||||
|
<SberPaymentForm mode="edit" initialData={order} orderId={id} />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,352 @@
|
|||||||
|
|
||||||
|
import { format } from 'date-fns'
|
||||||
|
import { Trash2, Edit, Search, Download, Clock } from 'lucide-react'
|
||||||
|
|
||||||
|
import { useSberPaymentOrder, useDeleteSberPayment } from '@/features/sberPayments/hooks/useSberPayments'
|
||||||
|
import { StatusBadge, PaidStatusBadge } from '@/features/sberPayments/components/statusBadge'
|
||||||
|
import { Button } from '@/components/ui/button'
|
||||||
|
import { Spinner } from '@/components/ui/spinner'
|
||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
import { useParams, useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
|
// ─── Info Row Component ───────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
function InfoRow({
|
||||||
|
label,
|
||||||
|
value,
|
||||||
|
highlight = false
|
||||||
|
}: {
|
||||||
|
label: string
|
||||||
|
value: React.ReactNode
|
||||||
|
highlight?: boolean
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<div className="flex items-start py-2.5 border-b border-border last:border-b-0">
|
||||||
|
<span className="w-64 shrink-0 text-sm text-muted-foreground">{label}</span>
|
||||||
|
<span className={cn(
|
||||||
|
'flex-1 text-sm',
|
||||||
|
highlight ? 'text-primary font-medium' : 'text-foreground'
|
||||||
|
)}>
|
||||||
|
{value || '—'}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── Section Component ────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
function Section({
|
||||||
|
title,
|
||||||
|
children,
|
||||||
|
className
|
||||||
|
}: {
|
||||||
|
title: string
|
||||||
|
children: React.ReactNode
|
||||||
|
className?: string
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<div className={cn('space-y-1', className)}>
|
||||||
|
<h2 className="text-base font-semibold text-foreground mb-3">{title}</h2>
|
||||||
|
<div className="bg-card rounded-lg border border-border">
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── Document Item Component ──────────────────────────────────────────────────
|
||||||
|
|
||||||
|
function DocumentItem({
|
||||||
|
label,
|
||||||
|
fileName,
|
||||||
|
fileUrl
|
||||||
|
}: {
|
||||||
|
label: string
|
||||||
|
fileName: string | null
|
||||||
|
fileUrl: string | null
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<div className="flex items-start gap-4 py-3 border-b border-border last:border-b-0 px-4">
|
||||||
|
<span className="w-80 shrink-0 text-sm text-muted-foreground leading-relaxed">
|
||||||
|
{label}
|
||||||
|
</span>
|
||||||
|
<div className="flex-1">
|
||||||
|
{fileUrl ? (
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<button className="p-1.5 rounded bg-muted hover:bg-accent transition-colors">
|
||||||
|
<Search size={14} className="text-muted-foreground" />
|
||||||
|
</button>
|
||||||
|
<button className="p-1.5 rounded bg-muted hover:bg-accent transition-colors">
|
||||||
|
<Download size={14} className="text-muted-foreground" />
|
||||||
|
</button>
|
||||||
|
<span className="px-3 py-1.5 bg-primary/20 text-primary text-xs font-medium rounded">
|
||||||
|
{fileName}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<span className="text-sm text-muted-foreground">—</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── View Page Component ──────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
export default function SberPaymentViewPage() {
|
||||||
|
const params = useParams()
|
||||||
|
const navigate = useNavigate()
|
||||||
|
const id = params.id as string
|
||||||
|
|
||||||
|
const { data: order, isLoading } = useSberPaymentOrder(id)
|
||||||
|
const deleteMutation = useDeleteSberPayment()
|
||||||
|
|
||||||
|
const handleDelete = async () => {
|
||||||
|
if (confirm('Bu tolegi pozmak isleyanizmi?')) {
|
||||||
|
await deleteMutation.mutateAsync(id)
|
||||||
|
navigate('/sber-payments')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isLoading) {
|
||||||
|
return (
|
||||||
|
<div className="flex items-center justify-center min-h-[400px]">
|
||||||
|
<Spinner className="w-8 h-8" />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!order) {
|
||||||
|
return (
|
||||||
|
<div className="flex flex-col items-center justify-center min-h-[400px] text-muted-foreground">
|
||||||
|
<p>Toleg tapylmady</p>
|
||||||
|
<Button variant="outline" onClick={() => navigate('/sber-payments')} className="mt-4">
|
||||||
|
Yza
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="space-y-6 max-w-4xl">
|
||||||
|
{/* Header Actions */}
|
||||||
|
<div className="flex items-center justify-end gap-2">
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
size="icon"
|
||||||
|
onClick={handleDelete}
|
||||||
|
className="text-destructive hover:text-destructive hover:bg-destructive/10"
|
||||||
|
>
|
||||||
|
<Trash2 size={18} />
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
size="icon"
|
||||||
|
onClick={() => navigate(`/sber-payments/${id}/edit`)}
|
||||||
|
>
|
||||||
|
<Edit size={18} />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Status Section */}
|
||||||
|
<Section title="Status">
|
||||||
|
<div className="px-4">
|
||||||
|
<InfoRow label="ID" value={order.id} />
|
||||||
|
<InfoRow label="Status" value={<StatusBadge status={order.status} />} />
|
||||||
|
<InfoRow label="Tolenen (Sul ay)" value={<PaidStatusBadge status={order.paidStatus} />} />
|
||||||
|
<InfoRow label="Bellik" value={order.bellik} />
|
||||||
|
</div>
|
||||||
|
</Section>
|
||||||
|
|
||||||
|
{/* Location Section */}
|
||||||
|
<Section title="Lokasiya">
|
||||||
|
<div className="px-4">
|
||||||
|
<InfoRow label="Welayat" value={order.welayat} />
|
||||||
|
<InfoRow label="Sahamca" value={order.sahamca} highlight />
|
||||||
|
</div>
|
||||||
|
</Section>
|
||||||
|
|
||||||
|
{/* Personal Info Section */}
|
||||||
|
<Section title="Sahsy maglumatlar">
|
||||||
|
<div className="px-4">
|
||||||
|
<InfoRow label="Pasportdaky ady" value={order.firstName} />
|
||||||
|
<InfoRow label="Pasportdaky familiya" value={order.lastName} />
|
||||||
|
<InfoRow label="Telefon" value={order.phone} />
|
||||||
|
<InfoRow label="E-pocta" value={order.email} />
|
||||||
|
<InfoRow label="Hazirki yasayys yeri" value={order.address} />
|
||||||
|
</div>
|
||||||
|
</Section>
|
||||||
|
|
||||||
|
{/* Payment Info Section */}
|
||||||
|
<Section title="Toleg">
|
||||||
|
<div className="px-4">
|
||||||
|
<InfoRow
|
||||||
|
label="Tolegi ugradyjynyn maglumatlary"
|
||||||
|
value={`I-M${order.passportNumber?.slice(0, 2) ?? 'XX'}-${order.passportNumber ?? ''} ${order.fullName}`}
|
||||||
|
/>
|
||||||
|
<InfoRow label="Toleg ugradyjynyn goyum hasaby" value={order.accountNumber} />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="px-4 py-3 bg-muted/30 border-t border-border">
|
||||||
|
<div className="text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-2">
|
||||||
|
Tolegi kabul edijinin maglumatlary
|
||||||
|
</div>
|
||||||
|
<div className="grid grid-cols-3 gap-4 text-sm">
|
||||||
|
<div>
|
||||||
|
<span className="text-muted-foreground">Pasport seriyasy</span>
|
||||||
|
<p className="font-medium">{order.passportSeries}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span className="text-muted-foreground">Pasport nomeri</span>
|
||||||
|
<p className="font-medium">{order.passportNumber}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span className="text-muted-foreground">Ady Familiyasy Atasynyn ady</span>
|
||||||
|
<p className="font-medium">{order.fullName}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Section>
|
||||||
|
|
||||||
|
{/* Documents - Accepted */}
|
||||||
|
<div className="space-y-3">
|
||||||
|
<h2 className="text-base font-semibold text-foreground">
|
||||||
|
Kabul ediji talyp boyunca resminamalary
|
||||||
|
</h2>
|
||||||
|
<div className="bg-card rounded-lg border border-border">
|
||||||
|
{order.documents?.slice(0, 6).map((doc) => (
|
||||||
|
<DocumentItem
|
||||||
|
key={doc.id}
|
||||||
|
label={doc.label}
|
||||||
|
fileName={doc.name}
|
||||||
|
fileUrl={doc.fileUrl}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Documents - Sent */}
|
||||||
|
<div className="space-y-3">
|
||||||
|
<h2 className="text-base font-semibold text-foreground">
|
||||||
|
Ugradyjy boyunca resminamalary
|
||||||
|
</h2>
|
||||||
|
<div className="bg-card rounded-lg border border-border">
|
||||||
|
{order.documents?.slice(6).map((doc) => (
|
||||||
|
<DocumentItem
|
||||||
|
key={doc.id}
|
||||||
|
label={doc.label}
|
||||||
|
fileName={doc.name}
|
||||||
|
fileUrl={doc.fileUrl}
|
||||||
|
/>
|
||||||
|
)) || (
|
||||||
|
<div className="px-4 py-8 text-center text-muted-foreground text-sm">
|
||||||
|
Resminamalar yok
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Payment History */}
|
||||||
|
<div className="space-y-3">
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<h2 className="text-base font-semibold text-foreground">Toleg taryhy</h2>
|
||||||
|
<button className="text-muted-foreground hover:text-foreground transition-colors">
|
||||||
|
<svg width="12" height="12" viewBox="0 0 12 12" fill="currentColor">
|
||||||
|
<path d="M6 0L7.5 4.5L12 6L7.5 7.5L6 12L4.5 7.5L0 6L4.5 4.5L6 0Z" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="bg-card rounded-lg border border-border">
|
||||||
|
<div className="flex items-center gap-2 px-4 py-3 border-b border-border">
|
||||||
|
<Search size={14} className="text-muted-foreground" />
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
placeholder="Gozlemek"
|
||||||
|
className="flex-1 bg-transparent text-sm placeholder:text-muted-foreground/50 focus:outline-none"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex items-center justify-center py-12 text-muted-foreground">
|
||||||
|
<div className="text-center">
|
||||||
|
<div className="w-12 h-12 mx-auto mb-3 rounded-lg bg-muted/50 flex items-center justify-center">
|
||||||
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5">
|
||||||
|
<rect x="3" y="3" width="18" height="18" rx="2" />
|
||||||
|
<line x1="3" y1="9" x2="21" y2="9" />
|
||||||
|
<line x1="9" y1="21" x2="9" y2="9" />
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
<p className="text-sm">Berlen kriteriyalara Toleg gabat gelmedi.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex items-center justify-end">
|
||||||
|
<button className="p-1.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors">
|
||||||
|
<Clock size={16} />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Activity Log */}
|
||||||
|
<div className="space-y-3">
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<h2 className="text-base font-semibold text-foreground">Ammallar</h2>
|
||||||
|
<button className="text-muted-foreground hover:text-foreground transition-colors">
|
||||||
|
<svg width="12" height="12" viewBox="0 0 12 12" fill="currentColor">
|
||||||
|
<path d="M6 0L7.5 4.5L12 6L7.5 7.5L6 12L4.5 7.5L0 6L4.5 4.5L6 0Z" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="bg-card rounded-lg border border-border overflow-hidden">
|
||||||
|
{/* Table Header */}
|
||||||
|
<div className="grid grid-cols-6 gap-4 px-4 py-2 bg-muted/40 text-xs font-semibold text-muted-foreground uppercase tracking-wider">
|
||||||
|
<span>ID</span>
|
||||||
|
<span>Analys ady</span>
|
||||||
|
<span>Kim tarapyndan</span>
|
||||||
|
<span>Analys nysany (Targets)</span>
|
||||||
|
<span>Analys statusy</span>
|
||||||
|
<span>Sene</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Table Body */}
|
||||||
|
{order.activityLog?.length ? (
|
||||||
|
order.activityLog.map((log) => (
|
||||||
|
<div key={log.id} className="grid grid-cols-6 gap-4 px-4 py-3 border-t border-border text-sm">
|
||||||
|
<span className="text-primary font-medium">{log.id.split('-')[1] ?? '45384'}</span>
|
||||||
|
<span>{log.analysisName}</span>
|
||||||
|
<span className="text-muted-foreground">{log.createdBy}</span>
|
||||||
|
<span className="text-muted-foreground">{log.target}</span>
|
||||||
|
<span>
|
||||||
|
<span className={cn(
|
||||||
|
'inline-flex items-center px-2 py-0.5 rounded text-xs font-semibold',
|
||||||
|
log.status === 'FINISHED'
|
||||||
|
? 'bg-primary/20 text-primary'
|
||||||
|
: 'bg-muted text-muted-foreground'
|
||||||
|
)}>
|
||||||
|
{log.status}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<span className="text-muted-foreground">
|
||||||
|
{format(new Date(log.createdAt), 'dd/MM/yyyy, HH:mm:ss')} GMT+5
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<div className="px-4 py-8 text-center text-muted-foreground text-sm border-t border-border">
|
||||||
|
Ammallar yok
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Pagination */}
|
||||||
|
<div className="flex items-center justify-between text-sm text-muted-foreground">
|
||||||
|
<span>Onki</span>
|
||||||
|
<span>1-1 of 1</span>
|
||||||
|
<span>Indiki</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -185,11 +185,17 @@ export default function IntlPaymentsPage() {
|
|||||||
]
|
]
|
||||||
|
|
||||||
const columnMeta = columns
|
const columnMeta = columns
|
||||||
.filter((c) => 'accessorKey' in c)
|
.filter((c) => ('accessorKey' in c || 'id' in c) && c.id !== 'actions')
|
||||||
.map((c) => ({
|
.map((c) => {
|
||||||
id: ('accessorKey' in c ? String(c.accessorKey) : c.id) as string,
|
const id = ('accessorKey' in c ? String(c.accessorKey) : c.id) as string
|
||||||
label: typeof c.header === 'string' ? c.header : String(('accessorKey' in c ? c.accessorKey : '') ?? ''),
|
const label =
|
||||||
}))
|
typeof c.header === "string"
|
||||||
|
? c.header
|
||||||
|
: "accessorKey" in c
|
||||||
|
? String(c.accessorKey)
|
||||||
|
: id;
|
||||||
|
return { id, label };
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import { IntlPaymentForm } from '@/features/visaMasterPayments/components/IntlPaymentForm'
|
import { IntlPaymentForm } from '@/features/visaMasterPayments/components/intlPaymentForm'
|
||||||
import { useCreateIntlPayment } from '@/features/visaMasterPayments/hooks/useVisaMasterPayments'
|
import { useCreateIntlPayment } from '@/features/visaMasterPayments/hooks/useVisaMasterPayments'
|
||||||
import type { IntlPaymentCreatePayload } from '@/features/visaMasterPayments/api/visaMasterPaymentsApi'
|
import type { IntlPaymentCreatePayload } from '@/features/visaMasterPayments/api/visaMasterPaymentsApi'
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useParams, useNavigate } from 'react-router-dom'
|
import { useParams, useNavigate } from 'react-router-dom'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { IntlPaymentForm } from '@/features/visaMasterPayments/components/IntlPaymentForm'
|
import { IntlPaymentForm } from '@/features/visaMasterPayments/components/intlPaymentForm'
|
||||||
import { useIntlPayment, useUpdateIntlPayment } from '@/features/visaMasterPayments/hooks/useVisaMasterPayments'
|
import { useIntlPayment, useUpdateIntlPayment } from '@/features/visaMasterPayments/hooks/useVisaMasterPayments'
|
||||||
import type { IntlPaymentUpdatePayload } from '@/features/visaMasterPayments/api/visaMasterPaymentsApi'
|
import type { IntlPaymentUpdatePayload } from '@/features/visaMasterPayments/api/visaMasterPaymentsApi'
|
||||||
import { Spinner } from '@/components/ui/spinner'
|
import { Spinner } from '@/components/ui/spinner'
|
||||||
|
|||||||
Reference in new issue
Block a user