From c612d5bae3891c535646a56cc23c654da230847f Mon Sep 17 00:00:00 2001 From: Jelaletdin12 Date: Tue, 5 May 2026 14:15:18 +0500 Subject: [PATCH] added edit page to loan orders --- PROJECT_STANDARDS.md | 18 + src/app/router/index.tsx | 10 + src/components/formInput.tsx | 59 +- src/features/loanOrders/api/loanOrdersApi.ts | 231 ++--- .../loanOrders/components/loanOrderForm.tsx | 857 ++++++++++++++++++ .../loanOrders/hooks/useLoanOrders.ts | 24 +- src/pages/loanOrderCreate/index.tsx | 732 +-------------- src/pages/loanOrderEdit/index.tsx | 35 + src/pages/loanOrders/index.tsx | 1 + 9 files changed, 1061 insertions(+), 906 deletions(-) create mode 100644 src/features/loanOrders/components/loanOrderForm.tsx create mode 100644 src/pages/loanOrderEdit/index.tsx diff --git a/PROJECT_STANDARDS.md b/PROJECT_STANDARDS.md index 48d69c1..b16e4a0 100644 --- a/PROJECT_STANDARDS.md +++ b/PROJECT_STANDARDS.md @@ -75,3 +75,21 @@ src/ 4. Mutation'lardan (POST, PUT, DELETE) sonra `onSuccess` ve `onError` bloklarında mutlaka `sonner` ile bildirim göster. 5. Kullanıcıya dönen her metni `i18n` dosyalarına ekle ve `t('anahtar')` şeklinde çağır. Hard-coded string kullanma. 6. Kod yazarken temiz, okunabilir ve modüler bir yaklaşım benimse. +7. **Create ve Edit sayfaları için Shared Form Component kullan:** + - Bir özelliğin create ve edit sayfaları aynı form alanlarını (field) kullanıyorsa, her ikisi için ayrı ayrı form yazmak **yasaktır**. + - Bunun yerine `src/features/[feature]/components/[Feature]Form.tsx` adında tek bir shared form component'i oluştur ve `mode: 'create' | 'edit'` prop'u ile davranışı ayarla. + - Create ve Edit sayfaları (`pages/`) sadece bu component'i çağıran birer **wrapper** olmalıdır. + - Edit sayfası `useParams()` ile URL'den `id` alır, ilgili hook ile veriyi fetch eder ve `initialData` prop'u olarak form'a geçer. + - Validation, form state, submit logic — hepsi shared component içinde tek yerde yönetilir. + - Örnek yapı: + ``` + features/[feature]/ + components/ + [Feature]Form.tsx ← mode="create" | mode="edit", shared form + hooks/ + use[Feature]s.ts ← useCreate, useUpdate, useGetById hook'ları + api/ + [feature]Api.ts ← payload tipleri burada tanımlanır + pages/ + [Feature]CreatePage.tsx ← <[Feature]Form mode="create" /> + [Feature]EditPage.tsx ← id fetch → <[Feature]Form mode="edit" initialData={data} loanOrderId={id} /> \ No newline at end of file diff --git a/src/app/router/index.tsx b/src/app/router/index.tsx index 4e0ab38..ce32191 100644 --- a/src/app/router/index.tsx +++ b/src/app/router/index.tsx @@ -3,6 +3,7 @@ import { createBrowserRouter, Navigate, Outlet } from "react-router-dom"; import { useAuthStore } from "../store/authStore"; import { Spinner } from "@/components/ui/spinner"; import { DashboardLayout } from "@/layouts/DashboardLayout"; +import LoanOrderEditPage from "@/pages/loanOrderEdit"; const LoginPage = lazy(() => import("@/pages/login")); const DashboardPage = lazy(() => import("@/pages/dashboard")); @@ -80,6 +81,7 @@ export const router = createBrowserRouter([ ), + }, { path: "/loan-orders/create", @@ -89,6 +91,14 @@ export const router = createBrowserRouter([ ), }, + { + path: "/loan-orders/:id/edit", + element: ( + }> + + + ), + }, { // Sidebar: /loan-order-mobiles path: "/loan-order-mobiles", diff --git a/src/components/formInput.tsx b/src/components/formInput.tsx index c160e84..1877f9c 100644 --- a/src/components/formInput.tsx +++ b/src/components/formInput.tsx @@ -1,4 +1,4 @@ -import { useState, useRef } from 'react' +import { useState, useRef, useEffect } from 'react' import * as CollapsiblePrimitive from '@radix-ui/react-collapsible' import { Check, ChevronsUpDown, Search, X, Eye, EyeOff, Upload, Hash } from 'lucide-react' @@ -529,6 +529,8 @@ function SearchableSelect({ // ─── FileInput ──────────────────────────────────────────────────────────────── +// ─── FileInput ──────────────────────────────────────────────────────────────── + function FileInput({ label, required, @@ -540,17 +542,23 @@ function FileInput({ className, placeholder = 'Faýl saýlaň ýa-da salmak üçin basyň', }: FormInputProps) { - const inputRef = useRef(null) + const inputRef = useRef(null) const [dragOver, setDragOver] = useState(false) const [preview, setPreview] = useState(null) + // fileValue prop'u değişince preview'i güncelle + memory leak önle + useEffect(() => { + if (fileValue?.type.startsWith('image/')) { + const url = URL.createObjectURL(fileValue) + setPreview(url) + return () => URL.revokeObjectURL(url) + } + setPreview(null) + }, [fileValue]) + + // handleFile sadece onFileChange'i çağırıyor — preview useEffect hallediyor const handleFile = (file: File | null) => { onFileChange?.(file) - if (file?.type.startsWith('image/')) { - setPreview(URL.createObjectURL(file)) - } else { - setPreview(null) - } } const handleDrop = (e: React.DragEvent) => { @@ -578,25 +586,34 @@ function FileInput({ 'min-h-[88px] rounded-md border-2 border-dashed cursor-pointer select-none', 'transition-all duration-200', 'focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-2', - dragOver && 'border-primary bg-primary/5 scale-[1.01]', - error ? 'border-destructive/60' : 'border-border', + dragOver && 'border-primary bg-primary/5 scale-[1.01]', + error ? 'border-destructive/60' : 'border-border', !dragOver && !error && 'hover:border-primary/50 hover:bg-muted/20', - disabled && 'opacity-50 cursor-not-allowed pointer-events-none', - fileValue && isImage && '!border-solid !border-border p-0 overflow-hidden', + disabled && 'opacity-50 cursor-not-allowed pointer-events-none', + fileValue && isImage && '!border-solid !border-border overflow-hidden', )} > {fileValue && isImage && preview ? ( <> - preview - + preview +
+ + {fileValue.name} + + +
) : fileValue ? (
diff --git a/src/features/loanOrders/api/loanOrdersApi.ts b/src/features/loanOrders/api/loanOrdersApi.ts index 1999cdc..0cf9f57 100644 --- a/src/features/loanOrders/api/loanOrdersApi.ts +++ b/src/features/loanOrders/api/loanOrdersApi.ts @@ -1,31 +1,6 @@ import { apiClient } from '@/lib/api/client' -const MOCK_DATA: LoanOrder[] = [ - { - id: 'L-1001', - loanType: 'Ipoteka karzy', - createdAt: '2024-03-20 10:30', - region: 'Aşgabat', - branch: 'Merkezi şahamça', - firstName: 'Aman', - lastName: 'Amanow', - phone: '+993 65 112233', - status: 'GARAŞYLÝAR', - }, - { - id: 'L-1002', - loanType: 'Sarp ediş karzy', - createdAt: '2024-03-19 14:15', - region: 'Mary', - branch: 'Mary-1 şahamçasy', - firstName: 'Oguljan', - lastName: 'Berdiýewa', - phone: '+993 61 445566', - status: 'IŞLENÝÄR', - } -]; - -// ─── Types ─────────────────────────────────────────────────────────────────── +// ─── Types ──────────────────────────────────────────────────────────────────── export type LoanOrderStatus = | 'GARAŞYLÝAR' @@ -34,6 +9,7 @@ export type LoanOrderStatus = | 'IŞLENÝÄR' export interface LoanOrder { + // ── List fields ────────────────────────────────────────────────────────── id: string loanType: string createdAt: string @@ -43,6 +19,39 @@ export interface LoanOrder { lastName: string phone: string status: LoanOrderStatus + + // ── Detail fields ───────────────────────────────────────────────────────── + patronicName?: string | null + education?: string | null + marriageStatus?: string | null + dateOfBirth?: string | null + residence?: string | null + currentResidence?: string | null + + // Passport + passportSerie?: string | null + passportNumber?: string | null + passportDateOfIssue?: string | null + passportGivenBy?: string | null + bornPlace?: string | null + passportPage1Url?: string | null + passportPage23Url?: string | null + passportPage89Url?: string | null + passportPage32Url?: string | null + + // Contact + email?: string | null + phoneAdditional?: string | null + homePhone?: string | null + + // Employment + workCompany?: string | null + workHrPhone?: string | null + workRegion?: string | null + workProvince?: string | null + position?: string | null + salary?: number | null + workStartedAt?: string | null } export interface LoanOrdersParams { @@ -62,18 +71,7 @@ export interface LoanOrdersResponse { perPage: number } -export interface CreateLoanOrderPayload { - loanType: string - region: string - branch: string - firstName: string - lastName: string - phone: string -} - -// Add this to your existing loanOrdersApi.ts - -export interface LoanOrderCreatePayload { +export interface LoanOrderPayload { status: string loanType: string region: string @@ -104,133 +102,80 @@ export interface LoanOrderCreatePayload { workStartedAt: string } +// ─── Mock ───────────────────────────────────────────────────────────────────── + +const MOCK_DATA: LoanOrder[] = [ + { + id: 'L-1001', + loanType: 'Ipoteka karzy', + createdAt: '2024-03-20 10:30', + region: 'Aşgabat', + branch: 'Merkezi şahamça', + firstName: 'Aman', + lastName: 'Amanow', + phone: '+993 65 112233', + status: 'GARAŞYLÝAR', + }, + { + id: 'L-1002', + loanType: 'Sarp ediş karzy', + createdAt: '2024-03-19 14:15', + region: 'Mary', + branch: 'Mary-1 şahamçasy', + firstName: 'Oguljan', + lastName: 'Berdiýewa', + phone: '+993 61 445566', + status: 'IŞLENÝÄR', + }, +] + // ─── API Functions ──────────────────────────────────────────────────────────── export async function fetchLoanOrders( params: LoanOrdersParams ): Promise { - // Hakyky API ýok wagty simulator (800ms garaşdyrýar) - await new Promise((resolve) => setTimeout(resolve, 800)); - - const page = params.page || 1; - const perPage = params.perPage || 25; - - // Gözleg (search) logic-ni simulirlemek (optional) - const filtered = MOCK_DATA.filter(item => - !params.search || - item.firstName.toLowerCase().includes(params.search.toLowerCase()) || - item.id.toLowerCase().includes(params.search.toLowerCase()) - ); - - // Sayfalama mantığı (slice) - const start = (page - 1) * perPage; - const end = start + perPage; - const paginatedData = filtered.slice(start, end); - + // Mock — real API hazır bolanda aşakdaky commentden çykar + await new Promise((resolve) => setTimeout(resolve, 800)) + const page = params.page || 1 + const perPage = params.perPage || 25 + const filtered = MOCK_DATA.filter( + (item) => + !params.search || + item.firstName.toLowerCase().includes(params.search.toLowerCase()) || + item.id.toLowerCase().includes(params.search.toLowerCase()) + ) + const start = (page - 1) * perPage return { - data: paginatedData, + data: filtered.slice(start, start + perPage), total: filtered.length, page, perPage, - }; + } + + // const { data } = await apiClient.get('/loan-orders', { params }) + // return data } -// export async function fetchLoanOrders( -// params: LoanOrdersParams -// ): Promise { -// const { data } = await apiClient.get( -// '/resources/loan-orders', -// { params } -// ) -// return data -// } +export async function getLoanOrderById(id: string): Promise { + const { data } = await apiClient.get(`/loan-orders/${id}`) + return data +} export async function createLoanOrder( - payload: CreateLoanOrderPayload + payload: LoanOrderPayload ): Promise { - const { data } = await apiClient.post( - '/resources/loan-orders', - payload - ) + const { data } = await apiClient.post('/loan-orders', payload) return data } export async function updateLoanOrder( id: string, - payload: Partial + payload: Partial ): Promise { - const { data } = await apiClient.put( - `/resources/loan-orders/${id}`, - payload - ) + const { data } = await apiClient.put(`/loan-orders/${id}`, payload) return data } export async function deleteLoanOrder(id: string): Promise { - await apiClient.delete(`/resources/loan-orders/${id}`) -} - -// ─── Extend this into your existing loanOrdersApi.ts ───────────────────────── -// Add the fields below to your existing LoanOrder interface. -// The list page already uses: id, loanType, createdAt, region, branch, -// firstName, lastName, phone, status. - -export interface LoanOrder { - // ── List fields (already exist) ────────────────────────────────────────── - id: string - loanType: string - createdAt: string - region: string - branch: string - firstName: string - lastName: string - phone: string - status: LoanOrderStatus - - // ── Detail-only fields ──────────────────────────────────────────────────── - amount?: string | null - loanAmount?: string | null - createdBy?: string | null - - // Personal - fullName?: string | null - education?: string | null - maritalStatus?: string | null - birthDate?: string | null - registeredAddress?: string | null - currentAddress?: string | null - - // Contacts - email?: string | null - phoneAlt?: string | null - homePhone?: string | null - - // Employment - employer?: string | null - deptPhone?: string | null - workRegion?: string | null - workCity?: string | null - position?: string | null - salary?: string | null - employedSince?: string | null - - // Passport - passportNumber?: string | null - passportIssuedBy?: string | null - passportBirthPlace?: string | null - passportPage1Url?: string | null - passportPage23Url?: string | null - passportPage89Url?: string | null - passportPage32Url?: string | null -} - - - - -// ─── Add this function to your existing loanOrdersApi.ts ────────────────────── -// import { apiClient } from '@/lib/api/client' - -export async function getLoanOrderById(id: string): Promise { - const { data } = await apiClient.get(`/loan-orders/${id}`) - return data + await apiClient.delete(`/loan-orders/${id}`) } \ No newline at end of file diff --git a/src/features/loanOrders/components/loanOrderForm.tsx b/src/features/loanOrders/components/loanOrderForm.tsx new file mode 100644 index 0000000..cdcd5bc --- /dev/null +++ b/src/features/loanOrders/components/loanOrderForm.tsx @@ -0,0 +1,857 @@ +import { useState, useCallback } from 'react' +import { useNavigate } from 'react-router-dom' +import { useTranslation } from 'react-i18next' +import { toast } from 'sonner' +import { FormInput } from '@/components/formInput' +import { Button } from '@/components/ui/button' +import { cn } from '@/lib/utils' +import { useCreateLoanOrder, useUpdateLoanOrder } from '@/features/loanOrders/hooks/useLoanOrders' +import type { LoanOrder, LoanOrderPayload } from '@/features/loanOrders/api/loanOrdersApi' + +// ─── Section Wrapper ────────────────────────────────────────────────────────── + +function Section({ + title, + children, + className, +}: { + title: string + children: React.ReactNode + className?: string +}) { + return ( +
+
+

{title}

+
+
{children}
+
+ ) +} + +// ─── Grid helpers ───────────────────────────────────────────────────────────── + +const grid2 = 'grid grid-cols-1 sm:grid-cols-2 gap-6' +const grid3 = 'grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6' +const grid4 = 'grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6' + +// ─── Static options ─────────────────────────────────────────────────────────── + +const REGION_OPTIONS = [ + { value: 'Aşgabat', label: 'Aşgabat' }, + { value: 'Ahal', label: 'Ahal' }, + { value: 'Balkan', label: 'Balkan' }, + { value: 'Daşoguz', label: 'Daşoguz' }, + { value: 'Lebap', label: 'Lebap' }, + { value: 'Mary', label: 'Mary' }, + { value: 'Arkadag', label: 'Arkadag' }, +] + +const EDUCATION_OPTIONS = [ + { value: 'high', label: 'Ýokary bilim' }, + { value: 'unfinished_high', label: 'Gutarylmadyk ýokary bilim' }, + { value: 'masters', label: 'Magistr' }, + { value: 'phd', label: 'Ylymlaryň doktory' }, + { value: 'middle', label: 'Orta mekdep' }, + { value: 'school', label: 'Orta bilim' }, + { value: 'school_dropout', label: 'Gutarylmadyk orta bilim' }, +] + +const MARRIAGE_OPTIONS = [ + { value: 'MARRIED', label: 'Öýlenen / Durmuşa çykan' }, + { value: 'SINGLE', label: 'Öýlenmedik / Durmuşa çykmadyk' }, + { value: 'DIVORCED', label: 'Aýrylşan' }, + { value: 'WIDOW', label: 'Adamsy ýa-da aýaly aradan çykan' }, + { value: 'LEGAL', label: 'Raýat nika' }, +] + +const STATUS_OPTIONS = [ + { value: 'GARAŞYLÝAR', label: 'Garaşylýar' }, + { value: 'IŞLENÝÄR', label: 'Işlenýär' }, + { value: 'KANAGATLANDYRYLAN', label: 'Kanagatlandyrylan' }, + { value: 'RED_EDILDI', label: 'Red edildi' }, +] + +const LOAN_TYPE_OPTIONS = [ + { value: 'consumer', label: 'Sarp ediş karzy' }, + { value: 'mortgage', label: 'Ipoteka' }, + { value: 'car', label: 'Awtoulag karzy' }, + { value: 'student', label: 'Talyplar üçin' }, + { value: 'business', label: 'Işewürlik karzy' }, +] + +const PASSPORT_SERIES_OPTIONS = [ + { value: 'I', label: 'I' }, + { value: 'II', label: 'II' }, +] + +// ─── Form State ─────────────────────────────────────────────────────────────── + +interface FormState { + status: string + loanType: string + region: string + branch: string + firstName: string + lastName: string + patronicName: string + education: string + marriageStatus: string + dateOfBirth: string + residence: string + currentResidence: string + passportSerie: string + passportNumber: string + passportDateOfIssue: string + passportGivenBy: string + bornPlace: string + email: string + phone: string + phoneAdditional: string + homePhone: string + workCompany: string + workHrPhone: string + workRegion: string + workProvince: string + position: string + salary: string + workStartedAt: string + passportPage1: File | null + passportPage23: File | null + passportPage89: File | null + passportPage32: File | null +} + +type FormErrors = Partial> + +const INITIAL_STATE: FormState = { + status: 'GARAŞYLÝAR', + loanType: '', + region: 'Aşgabat', + branch: '', + firstName: '', + lastName: '', + patronicName: '', + education: '', + marriageStatus: '', + dateOfBirth: '', + residence: '', + currentResidence: '', + passportSerie: '', + passportNumber: '', + passportDateOfIssue: '', + passportGivenBy: '', + bornPlace: '', + email: '', + phone: '', + phoneAdditional: '', + homePhone: '', + workCompany: '', + workHrPhone: '', + workRegion: 'Aşgabat', + workProvince: '', + position: '', + salary: '', + workStartedAt: '', + passportPage1: null, + passportPage23: null, + passportPage89: null, + passportPage32: null, +} + +// ─── Map LoanOrder → FormState (edit modunda başlangıç değerleri) ───────────── + +function mapToFormState(order: LoanOrder): FormState { + return { + status: order.status ?? 'GARAŞYLÝAR', + loanType: order.loanType ?? '', + region: order.region ?? 'Aşgabat', + branch: order.branch ?? '', + firstName: order.firstName ?? '', + lastName: order.lastName ?? '', + patronicName: order.patronicName ?? '', + education: order.education ?? '', + marriageStatus: order.marriageStatus ?? '', + dateOfBirth: order.dateOfBirth ?? '', + residence: order.residence ?? '', + currentResidence: order.currentResidence ?? '', + passportSerie: order.passportSerie ?? '', + passportNumber: order.passportNumber ?? '', + passportDateOfIssue: order.passportDateOfIssue ?? '', + passportGivenBy: order.passportGivenBy ?? '', + bornPlace: order.bornPlace ?? '', + email: order.email ?? '', + phone: order.phone ?? '', + phoneAdditional: order.phoneAdditional ?? '', + homePhone: order.homePhone ?? '', + workCompany: order.workCompany ?? '', + workHrPhone: order.workHrPhone ?? '', + workRegion: order.workRegion ?? 'Aşgabat', + workProvince: order.workProvince ?? '', + position: order.position ?? '', + salary: order.salary != null ? String(order.salary) : '', + workStartedAt: order.workStartedAt ?? '', + // File field'ları edit modunda null kalır — mevcut URL'ler ayrı gösterilir + passportPage1: null, + passportPage23: null, + passportPage89: null, + passportPage32: null, + } +} + +// ─── Validation ─────────────────────────────────────────────────────────────── + +function validate( + form: FormState, + t: (k: string) => string, + mode: 'create' | 'edit' +): FormErrors { + const errors: FormErrors = {} + + const req = (key: keyof FormState, label: string) => { + const val = form[key] + if (!val || (typeof val === 'string' && !val.trim())) { + errors[key] = `${label} — ${t('required') || 'hökmany'}` + } + } + + req('loanType', t('Loan type') || 'Karz görnüşi') + req('region', t('Region') || 'Welaýat') + req('branch', t('Branch') || 'Şahamça') + req('firstName', t('Name') || 'Ady') + req('lastName', t('Surname') || 'Familiýasy') + req('education', t('Education') || 'Bilimi') + req('marriageStatus', t('Marriage status') || 'Maşgala ýagdaýy') + req('dateOfBirth', t('Date of birth') || 'Doglan güni') + req('residence', t('Residence (passport)') || 'Ýazgy edilen salgy') + req('passportSerie', t('Passport serie') || 'Pasport seriýasy') + req('passportNumber', t('Passport number') || 'Pasport belgisi') + req('passportDateOfIssue', t('Passport date of issue') || 'Pasport berlen senesi') + req('passportGivenBy', t('Passport given by') || 'Kim tarapyndan berildi') + req('phone', t('Phone') || 'Telefon') + req('workCompany', t('Work company name') || 'Kärhananyň ady') + req('position', t('Position') || 'Wezipe') + req('salary', t('Salary') || 'Zähmet haky') + req('workStartedAt', t('Work started at') || 'Işe başlan wagty') + + if (form.phone && form.phone.replace(/\D/g, '').length < 8) { + errors.phone = 'Telefon belgisi nädogry' + } + + // File'lar diňe create modunda hökmany + if (mode === 'create') { + if (!form.passportPage1) errors.passportPage1 = 'Pasport (sahypa 1) hökmany' + if (!form.passportPage23) errors.passportPage23 = 'Pasport (sahypa 2-3) hökmany' + } + + return errors +} + +// ─── Props ──────────────────────────────────────────────────────────────────── + +interface LoanOrderFormProps { + mode: 'create' | 'edit' + initialData?: LoanOrder + loanOrderId?: string +} + +// ─── Component ──────────────────────────────────────────────────────────────── + +export function LoanOrderForm({ mode, initialData, loanOrderId }: LoanOrderFormProps) { + const { t } = useTranslation() + const navigate = useNavigate() + + const createMutation = useCreateLoanOrder() + const updateMutation = useUpdateLoanOrder() + + const isPending = createMutation.isPending || updateMutation.isPending + + const [form, setForm] = useState(() => + initialData ? mapToFormState(initialData) : INITIAL_STATE + ) + const [errors, setErrors] = useState({}) + const [submitted, setSubmitted] = useState(false) + + const set = useCallback( + (key: K, value: FormState[K]) => { + setForm((prev) => ({ ...prev, [key]: value })) + if (submitted) { + setErrors((prev) => ({ ...prev, [key]: undefined })) + } + }, + [submitted] + ) + + const handleSubmit = () => { + setSubmitted(true) + const errs = validate(form, t, mode) + if (Object.keys(errs).length > 0) { + setErrors(errs) + toast.error(t('Write a correct data please') || 'Dogry maglumat girizmegiňizi haýyş edýäris.') + const firstKey = Object.keys(errs)[0] + document.getElementById(`field-${firstKey}`)?.scrollIntoView({ behavior: 'smooth', block: 'center' }) + return + } + + const payload: LoanOrderPayload = { + status: form.status, + loanType: form.loanType, + region: form.region, + branch: form.branch, + firstName: form.firstName, + lastName: form.lastName, + patronicName: form.patronicName || undefined, + education: form.education, + marriageStatus: form.marriageStatus, + dateOfBirth: form.dateOfBirth, + residence: form.residence, + currentResidence: form.currentResidence || undefined, + passportSerie: form.passportSerie, + passportNumber: form.passportNumber, + passportDateOfIssue: form.passportDateOfIssue, + passportGivenBy: form.passportGivenBy, + bornPlace: form.bornPlace || undefined, + email: form.email || undefined, + phone: form.phone, + phoneAdditional: form.phoneAdditional || undefined, + homePhone: form.homePhone || undefined, + workCompany: form.workCompany, + workHrPhone: form.workHrPhone || undefined, + workRegion: form.workRegion || undefined, + workProvince: form.workProvince || undefined, + position: form.position, + salary: Number(form.salary), + workStartedAt: form.workStartedAt, + } + + if (mode === 'create') { + createMutation.mutate(payload, { + onSuccess: () => navigate('/loan-orders'), + }) + } else { + updateMutation.mutate( + { id: loanOrderId!, payload }, + { onSuccess: () => navigate('/loan-orders') } + ) + } + } + + // ── Render ────────────────────────────────────────────────────────────────── + return ( +
+ {/* Page title */} +
+

+ {mode === 'create' + ? (t('Loan order create') || 'Karz sargyt döredüň') + : (t('Loan order edit') || 'Karz sargydy üýtget')} +

+
+ + {/* ── Status ─────────────────────────────────────────────────────────── */} +
+
+
+ set('status', v)} + options={STATUS_OPTIONS} + error={errors.status} + placeholder="Saýlaň" + /> +
+
+
+ + {/* ── Loan Type ──────────────────────────────────────────────────────── */} +
+
+ set('loanType', v)} + options={LOAN_TYPE_OPTIONS} + placeholder="Saýlamak üçin basyň" + error={errors.loanType} + /> +
+
+ + {/* ── Location ───────────────────────────────────────────────────────── */} +
+
+
+ set('region', v)} + options={REGION_OPTIONS} + placeholder="Saýlamak üçin basyň" + error={errors.region} + /> +
+
+ set('branch', v)} + options={[]} + placeholder="Saýlamak üçin basyň" + error={errors.branch} + /> +
+
+
+ + {/* ── Personal Data ──────────────────────────────────────────────────── */} +
+
+
+
+ set('firstName', v)} + placeholder={t('Name') || 'Ady'} + error={errors.firstName} + /> +
+
+ set('lastName', v)} + placeholder={t('Surname') || 'Familiýasy'} + error={errors.lastName} + /> +
+
+ set('patronicName', v)} + placeholder={t('Patronic name') || 'Atasynyň ady'} + /> +
+
+ +
+
+ set('education', v)} + options={EDUCATION_OPTIONS} + placeholder="Saýlaň" + error={errors.education} + /> +
+
+ set('marriageStatus', v)} + options={MARRIAGE_OPTIONS} + placeholder="Saýlaň" + error={errors.marriageStatus} + /> +
+
+ set('dateOfBirth', v)} + error={errors.dateOfBirth} + /> +
+
+ +
+
+ set('residence', v)} + placeholder={t('Residence (passport)') || 'Ýazgy edilen salgyňyz'} + error={errors.residence} + /> +
+
+ set('currentResidence', v)} + placeholder={t('Current Residence') || 'Häzirki ýaşaýyş ýeri'} + /> +
+
+
+
+ + {/* ── Passport ───────────────────────────────────────────────────────── */} +
+
+
+
+ set('passportSerie', v)} + options={PASSPORT_SERIES_OPTIONS} + placeholder="Saýlamak üçin basyň" + error={errors.passportSerie} + /> +
+
+ set('passportNumber', v)} + placeholder={t('Passport number') || 'Pasport belgisi'} + error={errors.passportNumber} + /> +
+
+ set('passportDateOfIssue', v)} + error={errors.passportDateOfIssue} + /> +
+
+ +
+
+ set('passportGivenBy', v)} + placeholder={t('Passport given by') || 'Kim tarapyndan berildi'} + error={errors.passportGivenBy} + /> +
+
+ set('bornPlace', v)} + placeholder={t('Born place (passport)') || 'Doglan ýeri (pasport)'} + /> +
+
+
+
+ + {/* ── Contact ────────────────────────────────────────────────────────── */} +
+
+
+ set('email', v)} + placeholder="E-poçta" + /> +
+
+ set('phone', v)} + placeholder="61 097 651" + error={errors.phone} + /> +
+
+ set('phoneAdditional', v)} + placeholder="61 097 651" + /> +
+
+ set('homePhone', v)} + placeholder="61 097 651" + /> +
+
+
+ + {/* ── Job ────────────────────────────────────────────────────────────── */} +
+
+
+
+ set('workCompany', v)} + placeholder={t('Work company name') || 'Işleýän edaranyň/kärhananyň ady'} + error={errors.workCompany} + /> +
+
+ set('workHrPhone', v)} + placeholder="61 097 651" + /> +
+
+ +
+
+ set('workRegion', v)} + options={REGION_OPTIONS} + placeholder="Saýlamak üçin basyň" + /> +
+
+ set('workProvince', v)} + options={[]} + placeholder="Saýlamak üçin basyň" + /> +
+
+ +
+
+ set('position', v)} + placeholder={t('Position') || 'Wezipe'} + error={errors.position} + /> +
+
+ set('salary', v)} + placeholder={t('Salary') || 'Zähmet haky'} + error={errors.salary} + /> +
+
+ set('workStartedAt', v)} + error={errors.workStartedAt} + /> +
+
+
+
+ + {/* ── Passport Files ─────────────────────────────────────────────────── */} +
+ {/* Edit modunda mevcut resimleri göster */} + {mode === 'edit' && initialData && ( +
+ {initialData.passportPage1Url && ( +
+ + {t('Passport (page 1)') || 'Pasport (sahypa 1)'} — {t('current') || 'häzirki'} + + + {t('View file') || 'Faýly gör'} + +
+ )} + {initialData.passportPage23Url && ( +
+ + {t('Passport (page 2-3)') || 'Pasport (2-3-nji sahypa)'} — {t('current') || 'häzirki'} + + + {t('View file') || 'Faýly gör'} + +
+ )} + {initialData.passportPage89Url && ( +
+ + {t('Passport (page 8-9)') || 'Pasport (8-9 sahypa)'} — {t('current') || 'häzirki'} + + + {t('View file') || 'Faýly gör'} + +
+ )} + {initialData.passportPage32Url && ( +
+ + {t('Passport (page 32)') || 'Pasport (32-nji sahypa)'} — {t('current') || 'häzirki'} + + + {t('View file') || 'Faýly gör'} + +
+ )} +
+ )} + +
+
+ set('passportPage1', f)} + placeholder="Faýl saýlaň ýa-da salmak üçin basyň" + error={errors.passportPage1} + /> +
+
+ set('passportPage23', f)} + placeholder="Faýl saýlaň ýa-da salmak üçin basyň" + error={errors.passportPage23} + /> +
+
+ set('passportPage89', f)} + placeholder="Faýl saýlaň ýa-da salmak üçin basyň" + /> +
+
+ set('passportPage32', f)} + placeholder="Faýl saýlaň ýa-da salmak üçin basyň" + /> +
+
+
+ + {/* ── Footer Actions ─────────────────────────────────────────────────── */} +
+ + +
+
+ ) +} \ No newline at end of file diff --git a/src/features/loanOrders/hooks/useLoanOrders.ts b/src/features/loanOrders/hooks/useLoanOrders.ts index ff795ed..bd514f6 100644 --- a/src/features/loanOrders/hooks/useLoanOrders.ts +++ b/src/features/loanOrders/hooks/useLoanOrders.ts @@ -3,12 +3,12 @@ import { toast } from 'sonner' import { useTranslation } from 'react-i18next' import { fetchLoanOrders, + getLoanOrderById, createLoanOrder, updateLoanOrder, deleteLoanOrder, type LoanOrdersParams, - type CreateLoanOrderPayload, - getLoanOrderById, + type LoanOrderPayload, } from '../api/loanOrdersApi' const LOAN_ORDERS_KEY = 'loan-orders' @@ -21,12 +21,20 @@ export function useLoanOrders(params: LoanOrdersParams) { }) } +export function useLoanOrderById(id: string) { + return useQuery({ + queryKey: [LOAN_ORDERS_KEY, id], + queryFn: () => getLoanOrderById(id), + enabled: !!id, + }) +} + export function useCreateLoanOrder() { const { t } = useTranslation() const queryClient = useQueryClient() return useMutation({ - mutationFn: (payload: CreateLoanOrderPayload) => createLoanOrder(payload), + mutationFn: (payload: LoanOrderPayload) => createLoanOrder(payload), onSuccess: () => { queryClient.invalidateQueries({ queryKey: [LOAN_ORDERS_KEY] }) toast.success(t('loanOrders.createSuccess', 'Karz sargyt üstünlikli döredildi')) @@ -42,7 +50,7 @@ export function useUpdateLoanOrder() { const queryClient = useQueryClient() return useMutation({ - mutationFn: ({ id, payload }: { id: string; payload: Partial }) => + mutationFn: ({ id, payload }: { id: string; payload: Partial }) => updateLoanOrder(id, payload), onSuccess: () => { queryClient.invalidateQueries({ queryKey: [LOAN_ORDERS_KEY] }) @@ -68,12 +76,4 @@ export function useDeleteLoanOrder() { toast.error(t('loanOrders.deleteError', 'Karz sargyt pozmakda säwlik ýüze çykdy')) }, }) -} - -export function useLoanOrderById(id: string) { - return useQuery({ - queryKey: ['loanOrders', id], - queryFn: () => getLoanOrderById(id), - enabled: !!id, - }) } \ No newline at end of file diff --git a/src/pages/loanOrderCreate/index.tsx b/src/pages/loanOrderCreate/index.tsx index c84f0dd..2ec2ef4 100644 --- a/src/pages/loanOrderCreate/index.tsx +++ b/src/pages/loanOrderCreate/index.tsx @@ -1,733 +1,5 @@ -import { useState, useCallback } from 'react' -import { useNavigate } from 'react-router-dom' -import { useTranslation } from 'react-i18next' -import { toast } from 'sonner' -import { FormInput } from '@/components/formInput' -import { Button } from '@/components/ui/button' -import { useCreateLoanOrder } from '@/features/loanOrders/hooks/useLoanOrders' -import type { LoanOrderCreatePayload } from '@/features/loanOrders/api/loanOrdersApi' -import { cn } from '@/lib/utils' - -// ─── Section Wrapper ────────────────────────────────────────────────────────── - -function Section({ title, children, className }: { - title: string - children: React.ReactNode - className?: string -}) { - return ( -
-
-

{title}

-
-
{children}
-
- ) -} - -// ─── Grid helpers ───────────────────────────────────────────────────────────── - -const grid2 = 'grid grid-cols-1 sm:grid-cols-2 gap-6' -const grid3 = 'grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6' -const grid4 = 'grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6' - -// ─── Static options ─────────────────────────────────────────────────────────── - -const REGION_OPTIONS = [ - { value: 'Aşgabat', label: 'Aşgabat' }, - { value: 'Ahal', label: 'Ahal' }, - { value: 'Balkan', label: 'Balkan' }, - { value: 'Daşoguz', label: 'Daşoguz' }, - { value: 'Lebap', label: 'Lebap' }, - { value: 'Mary', label: 'Mary' }, - { value: 'Arkadag', label: 'Arkadag' }, -] - -const EDUCATION_OPTIONS = [ - { value: 'high', label: 'Ýokary bilim' }, - { value: 'unfinished_high', label: 'Gutarylmadyk ýokary bilim' }, - { value: 'masters', label: 'Magistr' }, - { value: 'phd', label: 'Ylymlaryň doktory' }, - { value: 'middle', label: 'Orta mekdep' }, - { value: 'school', label: 'Orta bilim' }, - { value: 'school_dropout', label: 'Gutarylmadyk orta bilim' }, -] - -const MARRIAGE_OPTIONS = [ - { value: 'MARRIED', label: 'Öýlenen / Durmuşa çykan' }, - { value: 'SINGLE', label: 'Öýlenmedik / Durmuşa çykmadyk' }, - { value: 'DIVORCED', label: 'Aýrylşan' }, - { value: 'WIDOW', label: 'Adamsy ýa-da aýaly aradan çykan'}, - { value: 'LEGAL', label: 'Raýat nika' }, -] - -const STATUS_OPTIONS = [ - { value: 'GARAŞYLÝAR', label: 'Garaşylýar' }, - { value: 'IŞLENÝÄR', label: 'Işlenýär' }, - { value: 'KANAGATLANDYRYLAN', label: 'Kanagatlandyrylan' }, - { value: 'RED_EDILDI', label: 'Red edildi' }, -] - -const LOAN_TYPE_OPTIONS = [ - { value: 'consumer', label: 'Sarp ediş karzy' }, - { value: 'mortgage', label: 'Ipoteka' }, - { value: 'car', label: 'Awtoulag karzy' }, - { value: 'student', label: 'Talyplar üçin' }, - { value: 'business', label: 'Işewürlik karzy' }, -] - -const PASSPORT_SERIES_OPTIONS = [ - { value: 'I', label: 'I' }, - { value: 'II', label: 'II' }, -] - -// ─── Form State Types ───────────────────────────────────────────────────────── - -interface FormState { - // Status & unique - status: string - uniqueCode: string - // Loan - loanType: string - // Location - region: string - branch: string - // Personal - firstName: string - lastName: string - patronicName: string - education: string - marriageStatus: string - dateOfBirth: string - residence: string - currentResidence: string - // Passport - passportSerie: string - passportNumber: string - passportDateOfIssue: string - passportGivenBy: string - bornPlace: string - // Contact - email: string - phone: string - phoneAdditional: string - homePhone: string - // Job - workCompany: string - workHrPhone: string - workRegion: string - workProvince: string - position: string - salary: string - workStartedAt: string - // Files - passportPage1: File | null - passportPage23: File | null - passportPage89: File | null - passportPage32: File | null -} - -type FormErrors = Partial> - -const INITIAL_STATE: FormState = { - status: 'GARAŞYLÝAR', - uniqueCode: '', - loanType: '', - region: 'Aşgabat', - branch: '', - firstName: '', - lastName: '', - patronicName: '', - education: '', - marriageStatus: '', - dateOfBirth: '', - residence: '', - currentResidence: '', - passportSerie: '', - passportNumber: '', - passportDateOfIssue: '', - passportGivenBy: '', - bornPlace: '', - email: '', - phone: '', - phoneAdditional: '', - homePhone: '', - workCompany: '', - workHrPhone: '', - workRegion: 'Aşgabat', - workProvince: '', - position: '', - salary: '', - workStartedAt: '', - passportPage1: null, - passportPage23: null, - passportPage89: null, - passportPage32: null, -} - -// ─── Validation ─────────────────────────────────────────────────────────────── - -function validate(form: FormState, t: (k: string) => string): FormErrors { - const errors: FormErrors = {} - const req = (key: keyof FormState, label: string) => { - const val = form[key] - if (!val || (typeof val === 'string' && !val.trim())) { - errors[key] = `${label} — ${t('required') || 'hökmany'}` - } - } - - req('loanType', t('Loan type') || 'Karz görnüşi') - req('region', t('Region') || 'Welaýat') - req('branch', t('Branch') || 'Şahamça') - req('firstName', t('Name') || 'Ady') - req('lastName', t('Surname') || 'Familiýasy') - req('education', t('Education') || 'Bilimi') - req('marriageStatus', t('Marriage status') || 'Maşgala ýagdaýy') - req('dateOfBirth', t('Date of birth') || 'Doglan güni') - req('residence', t('Residence (passport)') || 'Ýazgy edilen salgy') - req('passportSerie', t('Passport serie') || 'Pasport seriýasy') - req('passportNumber', t('Passport number') || 'Pasport belgisi') - req('passportDateOfIssue', t('Passport date of issue') || 'Pasport berlen senesi') - req('passportGivenBy', t('Passport given by') || 'Kim tarapyndan berildi') - req('phone', t('Phone') || 'Telefon') - req('workCompany', t('Work company name') || 'Kärhananyň ady') - req('position', t('Position') || 'Wezipe') - req('salary', t('Salary') || 'Zähmet haky') - req('workStartedAt', t('Work started at') || 'Işe başlan wagty') - - if (form.phone && form.phone.replace(/\D/g, '').length < 8) { - errors.phone = 'Telefon belgisi nädogry' - } - - if (!form.passportPage1) errors.passportPage1 = 'Pasport (sahypa 1) hökmany' - if (!form.passportPage23) errors.passportPage23 = 'Pasport (sahypa 2-3) hökmany' - - return errors -} - -// ─── Page ───────────────────────────────────────────────────────────────────── +import { LoanOrderForm } from '@/features/loanOrders/components/loanOrderForm' export default function LoanOrderCreatePage() { - const { t } = useTranslation() - const navigate = useNavigate() - const createMutation = useCreateLoanOrder() - - const [form, setForm] = useState(INITIAL_STATE) - const [errors, setErrors] = useState({}) - const [submitted, setSubmitted] = useState(false) - - // Generic field updater - const set = useCallback((key: K, value: FormState[K]) => { - setForm((prev) => ({ ...prev, [key]: value })) - // Clear error on change - if (submitted) { - setErrors((prev) => ({ ...prev, [key]: undefined })) - } - }, [submitted]) - - const handleSubmit = () => { - setSubmitted(true) - const errs = validate(form, t) - if (Object.keys(errs).length > 0) { - setErrors(errs) - toast.error(t('Write a correct data please') || 'Dogry maglumat girizmegiňizi haýyş edýäris.') - // scroll to first error - const firstErrorKey = Object.keys(errs)[0] - document.getElementById(`field-${firstErrorKey}`)?.scrollIntoView({ behavior: 'smooth', block: 'center' }) - return - } - - const payload: LoanOrderCreatePayload = { - status: form.status, - loanType: form.loanType, - region: form.region, - branch: form.branch, - firstName: form.firstName, - lastName: form.lastName, - patronicName: form.patronicName, - education: form.education, - marriageStatus: form.marriageStatus, - dateOfBirth: form.dateOfBirth, - residence: form.residence, - currentResidence: form.currentResidence, - passportSerie: form.passportSerie, - passportNumber: form.passportNumber, - passportDateOfIssue: form.passportDateOfIssue, - passportGivenBy: form.passportGivenBy, - bornPlace: form.bornPlace, - email: form.email, - phone: form.phone, - phoneAdditional: form.phoneAdditional, - homePhone: form.homePhone, - workCompany: form.workCompany, - workHrPhone: form.workHrPhone, - workRegion: form.workRegion, - workProvince: form.workProvince, - position: form.position, - salary: Number(form.salary), - workStartedAt: form.workStartedAt, - } - - createMutation.mutate(payload, { - onSuccess: () => { - toast.success(t('Loan order created') || 'Karz sargydy döredildi') - navigate('/resources/loan-orders') - }, - onError: () => { - toast.error(t('Server Error') || 'Serwer ýalňyşlygy') - }, - }) - } - - // ── Render ──────────────────────────────────────────────────────────────── - return ( -
- - {/* Page title */} -
-

- {t('Loan order') || 'Karz sargyt döredüň'} -

-
- - {/* ── Status & Unique ──────────────────────────────────────────────── */} -
-
-
- set('status', v)} - options={STATUS_OPTIONS} - error={errors.status} - placeholder="Saýlaň" - /> -
-
- set('uniqueCode', v)} - placeholder={t('Unique code') || 'Bellik'} - error={errors.uniqueCode} - /> -
-
-
- - {/* ── Loan Type ────────────────────────────────────────────────────── */} -
-
- set('loanType', v)} - options={LOAN_TYPE_OPTIONS} - placeholder="Saýlamak üçin basyň" - error={errors.loanType} - /> -
-
- - {/* ── Location ─────────────────────────────────────────────────────── */} -
-
-
- set('region', v)} - options={REGION_OPTIONS} - placeholder="Saýlamak üçin basyň" - error={errors.region} - /> -
-
- set('branch', v)} - options={[]} - placeholder="Saýlamak üçin basyň" - error={errors.branch} - /> -
-
-
- - {/* ── Personal Data ─────────────────────────────────────────────────── */} -
-
-
-
- set('firstName', v)} - placeholder={t('Name') || 'Ady'} - error={errors.firstName} - /> -
-
- set('lastName', v)} - placeholder={t('Surname') || 'Familiýasy'} - error={errors.lastName} - /> -
-
- set('patronicName', v)} - placeholder={t('Patronic name') || 'Atasynyň ady'} - /> -
-
- -
-
- set('education', v)} - options={EDUCATION_OPTIONS} - placeholder="Saýlaň" - error={errors.education} - /> -
-
- set('marriageStatus', v)} - options={MARRIAGE_OPTIONS} - placeholder="Saýlaň" - error={errors.marriageStatus} - /> -
-
- set('dateOfBirth', v)} - error={errors.dateOfBirth} - /> -
-
- -
-
- set('residence', v)} - placeholder={t('Residence (passport)') || 'Ýazgy edilen salgyňyz'} - error={errors.residence} - /> -
-
- set('currentResidence', v)} - placeholder={t('Current Residence') || 'Häzirki ýaşaýyş ýeri'} - /> -
-
-
-
- - {/* ── Passport ──────────────────────────────────────────────────────── */} -
-
-
-
- set('passportSerie', v)} - options={PASSPORT_SERIES_OPTIONS} - placeholder="Saýlamak üçin basyň" - error={errors.passportSerie} - /> -
-
- set('passportNumber', v)} - placeholder={t('Passport number') || 'Pasport belgisi'} - error={errors.passportNumber} - /> -
-
- set('passportDateOfIssue', v)} - error={errors.passportDateOfIssue} - /> -
-
- -
-
- set('passportGivenBy', v)} - placeholder={t('Passport given by') || 'Kim tarapyndan berildi'} - error={errors.passportGivenBy} - /> -
-
- set('bornPlace', v)} - placeholder={t('Born place (passport)') || 'Doglan ýeri (pasport)'} - /> -
-
-
-
- - {/* ── Contact ───────────────────────────────────────────────────────── */} -
-
-
- set('email', v)} - placeholder="E-poçta" - /> -
-
- set('phone', v)} - placeholder="61 097 651" - error={errors.phone} - /> -
-
- set('phoneAdditional', v)} - placeholder="61 097 651" - /> -
-
- set('homePhone', v)} - placeholder="61 097 651" - /> -
-
-
- - {/* ── Job ───────────────────────────────────────────────────────────── */} -
-
-
-
- set('workCompany', v)} - placeholder={t('Work company name') || 'Işleýän edaranyň/kärhananyň ady'} - error={errors.workCompany} - /> -
-
- set('workHrPhone', v)} - placeholder="61 097 651" - /> -
-
- -
-
- set('workRegion', v)} - options={REGION_OPTIONS} - placeholder="Saýlamak üçin basyň" - /> -
-
- set('workProvince', v)} - options={[]} - placeholder="Saýlamak üçin basyň" - /> -
-
- -
-
- set('position', v)} - placeholder={t('Position') || 'Wezipe'} - error={errors.position} - /> -
-
- set('salary', v)} - placeholder={t('Salary') || 'Zähmet haky'} - error={errors.salary} - /> -
-
- set('workStartedAt', v)} - error={errors.workStartedAt} - /> -
-
-
-
- - {/* ── Passport Files ────────────────────────────────────────────────── */} -
-
-
- set('passportPage1', f)} - placeholder="Faýl saýlaň ýa-da salmak üçin basyň" - error={errors.passportPage1} - /> -
-
- set('passportPage23', f)} - placeholder="Faýl saýlaň ýa-da salmak üçin basyň" - error={errors.passportPage23} - /> -
-
- set('passportPage89', f)} - placeholder="Faýl saýlaň ýa-da salmak üçin basyň" - /> -
-
- set('passportPage32', f)} - placeholder="Faýl saýlaň ýa-da salmak üçin basyň" - /> -
-
-
- - {/* ── Footer Actions ────────────────────────────────────────────────── */} -
- - -
-
- ) + return } \ No newline at end of file diff --git a/src/pages/loanOrderEdit/index.tsx b/src/pages/loanOrderEdit/index.tsx new file mode 100644 index 0000000..aea2f90 --- /dev/null +++ b/src/pages/loanOrderEdit/index.tsx @@ -0,0 +1,35 @@ +import { useParams } from 'react-router-dom' +import { Loader2 } from 'lucide-react' +import { LoanOrderForm } from '@/features/loanOrders/components/loanOrderForm' +import { useLoanOrderById } from '@/features/loanOrders/hooks/useLoanOrders' + +export default function LoanOrderEditPage() { + const { id } = useParams<{ id: string }>() + const { data, isLoading, isError } = useLoanOrderById(id ?? '') + + if (isLoading) { + return ( +
+ +
+ ) + } + + if (isError || !data) { + return ( +
+

+ Maglumat ýüklenilmedi. Sahypany täzeleläň. +

+
+ ) + } + + return ( + + ) +} \ No newline at end of file diff --git a/src/pages/loanOrders/index.tsx b/src/pages/loanOrders/index.tsx index 331dd54..291bcfb 100644 --- a/src/pages/loanOrders/index.tsx +++ b/src/pages/loanOrders/index.tsx @@ -191,6 +191,7 @@ export default function LoanOrdersPage() {