added new pages

This commit is contained in:
@jcarymuhammedow
2026-05-04 19:06:18 +05:00
parent f834f29e53
commit 648ce5a172
35 changed files with 2857 additions and 177 deletions

View File

@@ -13,7 +13,7 @@ export default function DashboardPage() {
<main className="grid gap-6">
<div className="grid grid-cols-1 md:grid-cols-3 gap-6">
<div className="p-6 bg-card rounded-lg border border-border shadow-sm flex flex-col relative overflow-hidden">
<div className="p-6 bg-card rounded-md border border-border shadow-sm flex flex-col relative overflow-hidden">
<div className="flex justify-between items-start mb-4">
<h3 className="font-medium text-muted-foreground">{t('Loan orders (all)', 'Karz sargytlary (ählisi)')}</h3>
<div className="bg-accent text-xs px-2 py-1 rounded text-muted-foreground">30 gün</div>
@@ -30,7 +30,7 @@ export default function DashboardPage() {
</div>
</div>
<div className="p-6 bg-card rounded-lg border border-border shadow-sm flex flex-col relative overflow-hidden">
<div className="p-6 bg-card rounded-md border border-border shadow-sm flex flex-col relative overflow-hidden">
<div className="flex justify-between items-start mb-4">
<h3 className="font-medium text-muted-foreground">{t('Loan orders (all)', 'Karz sargytlary (ählisi)')}</h3>
<div className="bg-accent text-xs px-2 py-1 rounded text-muted-foreground">30 gün</div>
@@ -48,7 +48,7 @@ export default function DashboardPage() {
</div>
</div>
<div className="p-6 bg-card rounded-lg border border-border shadow-sm flex flex-col">
<div className="p-6 bg-card rounded-md border border-border shadow-sm flex flex-col">
<div className="flex justify-between items-start mb-4">
<h3 className="font-medium text-muted-foreground">{t('Loan orders (all)', 'Karz sargytlary (ählisi)')}</h3>
<div className="text-xs text-muted-foreground">(6,968 jemi)</div>

View File

@@ -0,0 +1,733 @@
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 (
<div className={cn('bg-card border border-border rounded-xl overflow-hidden', className)}>
<div className="px-5 py-3.5 border-b border-border">
<h2 className="text-sm font-semibold text-foreground">{title}</h2>
</div>
<div className="p-5">{children}</div>
</div>
)
}
// ─── 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<Record<keyof FormState, string>>
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 ─────────────────────────────────────────────────────────────────────
export default function LoanOrderCreatePage() {
const { t } = useTranslation()
const navigate = useNavigate()
const createMutation = useCreateLoanOrder()
const [form, setForm] = useState<FormState>(INITIAL_STATE)
const [errors, setErrors] = useState<FormErrors>({})
const [submitted, setSubmitted] = useState(false)
// Generic field updater
const set = useCallback(<K extends keyof FormState>(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 (
<div className="flex flex-col gap-5">
{/* Page title */}
<div>
<h1 className="text-xl font-semibold text-foreground">
{t('Loan order') || 'Karz sargyt döredüň'}
</h1>
</div>
{/* ── Status & Unique ──────────────────────────────────────────────── */}
<Section title={t('New Loan Order') || 'Täze Karz sargyt'}>
<div className={grid2}>
<div id="field-status">
<FormInput
type="select"
label={t('Status') || 'Status'}
required
value={form.status}
onChange={(v) => set('status', v)}
options={STATUS_OPTIONS}
error={errors.status}
placeholder="Saýlaň"
/>
</div>
<div id="field-uniqueCode">
<FormInput
type="text"
label={t('Unique code') || 'Unikal belgi'}
value={form.uniqueCode}
onChange={(v) => set('uniqueCode', v)}
placeholder={t('Unique code') || 'Bellik'}
error={errors.uniqueCode}
/>
</div>
</div>
</Section>
{/* ── Loan Type ────────────────────────────────────────────────────── */}
<Section title={t('Loan') || 'Karz'}>
<div id="field-loanType">
<FormInput
type="searchable-select"
label={t('Loan type') || 'Karz görnüşi'}
required
value={form.loanType}
onChange={(v) => set('loanType', v)}
options={LOAN_TYPE_OPTIONS}
placeholder="Saýlamak üçin basyň"
error={errors.loanType}
/>
</div>
</Section>
{/* ── Location ─────────────────────────────────────────────────────── */}
<Section title={t('Location') || 'Lokasiýa'}>
<div className={grid2}>
<div id="field-region">
<FormInput
type="searchable-select"
label={t('Region') || 'Welaýat'}
required
value={form.region}
onChange={(v) => set('region', v)}
options={REGION_OPTIONS}
placeholder="Saýlamak üçin basyň"
error={errors.region}
/>
</div>
<div id="field-branch">
<FormInput
type="searchable-select"
label={t('Branch') || 'Şahamça'}
required
value={form.branch}
onChange={(v) => set('branch', v)}
options={[]}
placeholder="Saýlamak üçin basyň"
error={errors.branch}
/>
</div>
</div>
</Section>
{/* ── Personal Data ─────────────────────────────────────────────────── */}
<Section title={t('Personal data') || 'Şahsy maglumatlar'}>
<div className="flex flex-col gap-6">
<div className={grid3}>
<div id="field-firstName">
<FormInput
type="text"
label={t('Name') || 'Ady'}
required
value={form.firstName}
onChange={(v) => set('firstName', v)}
placeholder={t('Name') || 'Ady'}
error={errors.firstName}
/>
</div>
<div id="field-lastName">
<FormInput
type="text"
label={t('Surname') || 'Familiýasy'}
required
value={form.lastName}
onChange={(v) => set('lastName', v)}
placeholder={t('Surname') || 'Familiýasy'}
error={errors.lastName}
/>
</div>
<div id="field-patronicName">
<FormInput
type="text"
label={t('Patronic name') || 'Atasynyň ady'}
value={form.patronicName}
onChange={(v) => set('patronicName', v)}
placeholder={t('Patronic name') || 'Atasynyň ady'}
/>
</div>
</div>
<div className={grid3}>
<div id="field-education">
<FormInput
type="select"
label={t('Education') || 'Bilimi'}
required
value={form.education}
onChange={(v) => set('education', v)}
options={EDUCATION_OPTIONS}
placeholder="Saýlaň"
error={errors.education}
/>
</div>
<div id="field-marriageStatus">
<FormInput
type="select"
label={t('Marriage status') || 'Maşgala ýagdaýy'}
required
value={form.marriageStatus}
onChange={(v) => set('marriageStatus', v)}
options={MARRIAGE_OPTIONS}
placeholder="Saýlaň"
error={errors.marriageStatus}
/>
</div>
<div id="field-dateOfBirth">
<FormInput
type="date"
label={t('Date of birth') || 'Doglan güni'}
required
value={form.dateOfBirth}
onChange={(v) => set('dateOfBirth', v)}
error={errors.dateOfBirth}
/>
</div>
</div>
<div className={grid2}>
<div id="field-residence">
<FormInput
type="text"
label={t('Residence (passport)') || 'Ýazgy edilen salgyňyz'}
required
value={form.residence}
onChange={(v) => set('residence', v)}
placeholder={t('Residence (passport)') || 'Ýazgy edilen salgyňyz'}
error={errors.residence}
/>
</div>
<div id="field-currentResidence">
<FormInput
type="text"
label={t('Current Residence') || 'Häzirki ýaşaýyş ýeri'}
value={form.currentResidence}
onChange={(v) => set('currentResidence', v)}
placeholder={t('Current Residence') || 'Häzirki ýaşaýyş ýeri'}
/>
</div>
</div>
</div>
</Section>
{/* ── Passport ──────────────────────────────────────────────────────── */}
<Section title={t('Passport') || 'Pasport'}>
<div className="flex flex-col gap-6">
<div className={grid3}>
<div id="field-passportSerie">
<FormInput
type="searchable-select"
label={t('Passport serie') || 'Pasport seriýasy'}
required
value={form.passportSerie}
onChange={(v) => set('passportSerie', v)}
options={PASSPORT_SERIES_OPTIONS}
placeholder="Saýlamak üçin basyň"
error={errors.passportSerie}
/>
</div>
<div id="field-passportNumber">
<FormInput
type="text"
label={t('Passport number') || 'Pasport belgisi'}
required
value={form.passportNumber}
onChange={(v) => set('passportNumber', v)}
placeholder={t('Passport number') || 'Pasport belgisi'}
error={errors.passportNumber}
/>
</div>
<div id="field-passportDateOfIssue">
<FormInput
type="date"
label={t('Passport date of issue') || 'Pasport berlen senesi'}
required
value={form.passportDateOfIssue}
onChange={(v) => set('passportDateOfIssue', v)}
error={errors.passportDateOfIssue}
/>
</div>
</div>
<div className={grid2}>
<div id="field-passportGivenBy">
<FormInput
type="text"
label={t('Passport given by') || 'Kim tarapyndan berildi'}
required
value={form.passportGivenBy}
onChange={(v) => set('passportGivenBy', v)}
placeholder={t('Passport given by') || 'Kim tarapyndan berildi'}
error={errors.passportGivenBy}
/>
</div>
<div id="field-bornPlace">
<FormInput
type="text"
label={t('Born place (passport)') || 'Doglan ýeri (pasport)'}
value={form.bornPlace}
onChange={(v) => set('bornPlace', v)}
placeholder={t('Born place (passport)') || 'Doglan ýeri (pasport)'}
/>
</div>
</div>
</div>
</Section>
{/* ── Contact ───────────────────────────────────────────────────────── */}
<Section title={t('Contact data') || 'Habarlaşmak üçin maglumatlar'}>
<div className={grid4}>
<div id="field-email">
<FormInput
type="email"
label={t('Email') || 'E-poçta'}
value={form.email}
onChange={(v) => set('email', v)}
placeholder="E-poçta"
/>
</div>
<div id="field-phone">
<FormInput
type="phone"
label={t('Phone') || 'Telefon'}
required
value={form.phone}
onChange={(v) => set('phone', v)}
placeholder="61 097 651"
error={errors.phone}
/>
</div>
<div id="field-phoneAdditional">
<FormInput
type="phone"
label={t('Phone Additional') || 'Telefon goşmaça'}
value={form.phoneAdditional}
onChange={(v) => set('phoneAdditional', v)}
placeholder="61 097 651"
/>
</div>
<div id="field-homePhone">
<FormInput
type="phone"
label={t('Home phone') || 'Öý telefony'}
value={form.homePhone}
onChange={(v) => set('homePhone', v)}
placeholder="61 097 651"
/>
</div>
</div>
</Section>
{/* ── Job ───────────────────────────────────────────────────────────── */}
<Section title={t('Job') || 'Iş'}>
<div className="flex flex-col gap-6">
<div className={grid2}>
<div id="field-workCompany">
<FormInput
type="text"
label={t('Work company name') || 'Işleýän edaranyň/kärhananyň ady'}
required
value={form.workCompany}
onChange={(v) => set('workCompany', v)}
placeholder={t('Work company name') || 'Işleýän edaranyň/kärhananyň ady'}
error={errors.workCompany}
/>
</div>
<div id="field-workHrPhone">
<FormInput
type="phone"
label={t('HR department work number') || 'Işgärler bölüminiň iş belgisi'}
value={form.workHrPhone}
onChange={(v) => set('workHrPhone', v)}
placeholder="61 097 651"
/>
</div>
</div>
<div className={grid2}>
<div id="field-workRegion">
<FormInput
type="searchable-select"
label={t('Work region') || 'Işleýän welaýatyňyz'}
value={form.workRegion}
onChange={(v) => set('workRegion', v)}
options={REGION_OPTIONS}
placeholder="Saýlamak üçin basyň"
/>
</div>
<div id="field-workProvince">
<FormInput
type="searchable-select"
label={t('Work province') || 'Işleýän etrabyňyz'}
value={form.workProvince}
onChange={(v) => set('workProvince', v)}
options={[]}
placeholder="Saýlamak üçin basyň"
/>
</div>
</div>
<div className={grid3}>
<div id="field-position">
<FormInput
type="text"
label={t('Position') || 'Wezipe'}
required
value={form.position}
onChange={(v) => set('position', v)}
placeholder={t('Position') || 'Wezipe'}
error={errors.position}
/>
</div>
<div id="field-salary">
<FormInput
type="number"
label={t('Salary') || 'Zähmet haky'}
required
value={form.salary}
onChange={(v) => set('salary', v)}
placeholder={t('Salary') || 'Zähmet haky'}
error={errors.salary}
/>
</div>
<div id="field-workStartedAt">
<FormInput
type="date"
label={t('Work started at') || 'Işe başlan wagtyňyz'}
required
value={form.workStartedAt}
onChange={(v) => set('workStartedAt', v)}
error={errors.workStartedAt}
/>
</div>
</div>
</div>
</Section>
{/* ── Passport Files ────────────────────────────────────────────────── */}
<Section title={t('Passport files') || 'Pasport faýýlar'}>
<div className={grid2}>
<div id="field-passportPage1">
<FormInput
type="file"
label={t('Passport (page 1)') || 'Pasport (sahypa 1)'}
required
accept="image/*"
fileValue={form.passportPage1}
onFileChange={(f) => set('passportPage1', f)}
placeholder="Faýl saýlaň ýa-da salmak üçin basyň"
error={errors.passportPage1}
/>
</div>
<div id="field-passportPage23">
<FormInput
type="file"
label={t('Passport (page 2-3)') || 'Pasport (2-3-nji sahypa)'}
required
accept="image/*"
fileValue={form.passportPage23}
onFileChange={(f) => set('passportPage23', f)}
placeholder="Faýl saýlaň ýa-da salmak üçin basyň"
error={errors.passportPage23}
/>
</div>
<div id="field-passportPage89">
<FormInput
type="file"
label={t('Passport (page 8-9)') || 'Pasport (8-9 sahypa)'}
accept="image/*"
fileValue={form.passportPage89}
onFileChange={(f) => set('passportPage89', f)}
placeholder="Faýl saýlaň ýa-da salmak üçin basyň"
/>
</div>
<div id="field-passportPage32">
<FormInput
type="file"
label={t('Passport (page 32)') || 'Pasport (32-nji sahypa)'}
accept="image/*"
fileValue={form.passportPage32}
onFileChange={(f) => set('passportPage32', f)}
placeholder="Faýl saýlaň ýa-da salmak üçin basyň"
/>
</div>
</div>
</Section>
{/* ── Footer Actions ────────────────────────────────────────────────── */}
<div className="flex items-center justify-end gap-3 pb-8">
<Button
type="button"
variant="outline"
onClick={() => navigate(-1)}
disabled={createMutation.isPending}
>
{t('Cancel') || 'Ýatyr'}
</Button>
<Button
type="button"
onClick={handleSubmit}
disabled={createMutation.isPending}
className="min-w-[160px]"
>
{createMutation.isPending
? (t('Loading') || 'Ýüklenilýär...')
: (t('loanOrderMobiles.createButton') || 'Karz sargyt döredüň')}
</Button>
</div>
</div>
)
}

View File

@@ -28,21 +28,9 @@ const COLUMN_IDS = [
// ─── Filter options ────────────────────────────────────────────────────────────
const REGION_OPTIONS = [
{ value: 'Balkan', label: 'Balkan' },
{ value: 'Ahal', label: 'Ahal' },
{ value: 'Daşoguz', label: 'Daşoguz' },
{ value: 'Lebap', label: 'Lebap' },
{ value: 'Mary', label: 'Mary' },
{ value: 'Aşgabat', label: 'Aşgabat' },
]
const STATUS_OPTIONS: { value: LoanOrderMobileStatus; label: string }[] = [
{ value: 'GARAŞYLÝAR', label: 'GARAŞYLÝAR' },
{ value: 'KANAGATLANDYRYLAN', label: 'KANAGATLANDYRYLAN' },
{ value: 'RED_EDILDI', label: 'RED EDILDI' },
{ value: 'IŞLENÝÄR', label: 'IŞLENÝÄR' },
]
// ─── Filter options (Internal keys/values) ───────────────────────────────────
const REGION_OPTIONS = ['Balkan', 'Ahal', 'Daşoguz', 'Lebap', 'Mary', 'Aşgabat']
const STATUS_OPTIONS: LoanOrderMobileStatus[] = ['GARAŞYLÝAR', 'KANAGATLANDYRYLAN', 'RED_EDILDI', 'IŞLENÝÄR']
// ─── Page Component ────────────────────────────────────────────────────────────
@@ -105,7 +93,7 @@ export default function LoanOrderMobilesPage() {
{
id: 'id',
accessorKey: 'id',
header: t('ID', 'ID'),
header: t('loanOrderMobiles.columns.id', 'ID'),
cell: ({ row }) => (
<span className="text-xs font-mono text-muted-foreground">{row.original.id}</span>
),
@@ -189,13 +177,13 @@ export default function LoanOrderMobilesPage() {
cell: ({ row }) => (
<div className="flex items-center gap-1.5 justify-end">
<button
className="p-1.5 rounded hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors"
className="p-1.5 cursor-pointer rounded hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors"
title={t('common.view', 'Görmek')}
>
<Eye size={15} />
</button>
<button
className="p-1.5 rounded hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors"
className="p-1.5 cursor-pointer rounded hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors"
title={t('common.edit', 'Üýtgetmek')}
>
<Pencil size={15} />
@@ -203,7 +191,7 @@ export default function LoanOrderMobilesPage() {
<button
onClick={() => handleDelete(row.original.id)}
disabled={deleteMutation.isPending}
className="p-1.5 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors disabled:opacity-50"
className="p-1.5 cursor-pointer rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors disabled:opacity-50"
title={t('common.delete', 'Pozmak')}
>
<Trash2 size={15} />
@@ -227,12 +215,12 @@ export default function LoanOrderMobilesPage() {
{
id: 'region',
label: t('loanOrderMobiles.filters.region', 'WELAÝAT'),
options: REGION_OPTIONS,
options: REGION_OPTIONS.map((v) => ({ value: v, label: t(v) })),
},
{
id: 'status',
label: t('loanOrderMobiles.filters.status', 'STATUS'),
options: STATUS_OPTIONS,
options: STATUS_OPTIONS.map((v) => ({ value: v, label: t(`loanOrderStatus.${v}`) })),
},
{
id: 'branch',
@@ -266,7 +254,7 @@ export default function LoanOrderMobilesPage() {
<DataTableToolbar
searchValue={search}
onSearchChange={(v) => { setSearch(v); setPage(1) }}
searchPlaceholder={t('loanOrderMobiles.searchPlaceholder', 'Gözlemek')}
searchPlaceholder={t('common.search', 'Gözlemek')}
columns={toggleableColumns}
columnVisibility={columnVisibility}
onColumnVisibilityChange={setColumnVisibility}

View File

@@ -0,0 +1,412 @@
import { useNavigate, useParams } from 'react-router-dom'
import { useTranslation } from 'react-i18next'
import { Trash2, Pencil, Download, ChevronRight, Eye } from 'lucide-react'
import { useLoanOrderById, useDeleteLoanOrder } from '@/features/loanOrders/hooks/useLoanOrders'
import { LoanOrderStatusBadge } from '@/features/loanOrders/components/loanOrderStatusBadge'
import { Skeleton } from '@/components/ui/skeleton'
import { toast } from 'sonner'
// ─── Sub-component Types ──────────────────────────────────────────────────────
interface InfoRowProps {
label: string
value?: string | null
isLink?: boolean
}
interface SectionProps {
title: string
children: React.ReactNode
}
interface PassportImageProps {
label: string
src?: string | null
}
interface AuditRowProps {
id: string
action: string
by: string
target: string
status: string
date: string
}
// ─── InfoRow ─────────────────────────────────────────────────────────────────
function InfoRow({ label, value, isLink }: InfoRowProps) {
return (
<div className="grid grid-cols-[220px_1fr] items-center py-2.5 px-4 border-b border-border last:border-0">
<span className="text-sm text-muted-foreground">{label}</span>
{value ? (
<span className={`text-sm ${isLink ? 'text-primary font-medium' : 'text-foreground'}`}>
{value}
</span>
) : (
<span className="text-muted-foreground/40 text-sm">—</span>
)}
</div>
)
}
// ─── Section ─────────────────────────────────────────────────────────────────
function Section({ title, children }: SectionProps) {
return (
<div className="mb-6">
<h2 className="text-base font-semibold text-foreground mb-2">{title}</h2>
<div className="bg-card border border-border rounded-xl overflow-hidden">{children}</div>
</div>
)
}
// ─── PassportImage ────────────────────────────────────────────────────────────
function PassportImage({ label, src }: PassportImageProps) {
const { t } = useTranslation()
return (
<div className="grid grid-cols-[220px_1fr] items-start py-3 px-4 border-b border-border last:border-0">
<span className="text-sm text-muted-foreground pt-1">{label}</span>
<div className="flex flex-col gap-2">
{src ? (
<img
src={src}
alt={label}
className="w-28 h-20 object-cover rounded-md border border-border"
/>
) : (
<div className="w-28 h-20 bg-muted rounded-md border border-border flex items-center justify-center">
<span className="text-xs text-muted-foreground">—</span>
</div>
)}
<button className="flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors w-fit">
<Download size={12} />
{t('common.download', 'Göçürip al')}
</button>
</div>
</div>
)
}
// ─── AuditRow ─────────────────────────────────────────────────────────────────
function AuditRow({ id, action, by, target, status, date }: AuditRowProps) {
return (
<tr className="border-b border-border last:border-0 hover:bg-muted/30 transition-colors">
<td className="px-4 py-2.5 text-xs font-mono text-primary">{id}</td>
<td className="px-4 py-2.5 text-sm text-foreground">{action}</td>
<td className="px-4 py-2.5 text-sm text-foreground">{by}</td>
<td className="px-4 py-2.5 text-sm text-foreground">{target}</td>
<td className="px-4 py-2.5">
<span className="inline-flex items-center gap-1.5 text-xs font-medium text-emerald-400 bg-emerald-400/10 border border-emerald-400/30 px-2 py-0.5 rounded-full">
<span className="w-1.5 h-1.5 rounded-full bg-emerald-400" />
{status}
</span>
</td>
<td className="px-4 py-2.5 text-xs text-muted-foreground whitespace-nowrap">{date}</td>
<td className="px-4 py-2.5">
<button className="p-1 rounded hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors">
<Eye size={13} />
</button>
</td>
</tr>
)
}
// ─── Skeleton ─────────────────────────────────────────────────────────────────
function LoanOrderViewSkeleton() {
return (
<div className="flex flex-col gap-4">
<Skeleton className="h-7 w-64" />
{[...Array(5)].map((_, i) => (
<div key={i} className="bg-card border border-border rounded-xl p-4 flex flex-col gap-3">
<Skeleton className="h-4 w-32 mb-1" />
{[...Array(3)].map((_, j) => (
<Skeleton key={j} className="h-4 w-full" />
))}
</div>
))}
</div>
)
}
// ─── Page ─────────────────────────────────────────────────────────────────────
export default function LoanOrderViewPage() {
const { t } = useTranslation()
const navigate = useNavigate()
const { id } = useParams<{ id: string }>()
const deleteMutation = useDeleteLoanOrder()
const { data: order, isLoading } = useLoanOrderById(id!)
const handleDelete = () => {
if (!window.confirm(t('loanOrders.deleteConfirm', 'Bu sargyt pozulsynmy?'))) return
deleteMutation.mutate(id!, {
onSuccess: () => {
toast.success(t('loanOrders.deleteSuccess', 'Sargyt pozuldy'))
navigate('/loan-orders')
},
onError: () => {
toast.error(t('loanOrders.deleteError', 'Pozma wagty ýalňyşlyk ýüze çykdy'))
},
})
}
if (isLoading) return <LoanOrderViewSkeleton />
if (!order) {
return (
<div className="flex items-center justify-center h-64 text-muted-foreground text-sm">
{t('common.notFound', 'Tapylmady')}
</div>
)
}
// Replace with real audit data from API when available
const auditLogs: AuditRowProps[] = [
{
id: '44548',
action: t('audit.actions.view', 'Görmek'),
by: order.createdBy ?? '',
target: `${t('loanOrders.title', 'Karz sargyt')}: ${order.id}`,
status: 'FINISHED',
date: order.createdAt ?? '',
},
]
return (
<div className="flex flex-col">
{/* Page Header */}
<div className="flex items-center justify-between mb-5">
<h1 className="text-xl font-semibold text-foreground">
{t('loanOrders.view.title', 'Karz sargyt giriş')}: {order.id}
</h1>
<div className="flex items-center gap-1.5">
<button
onClick={handleDelete}
disabled={deleteMutation.isPending}
className="p-2 rounded-md cursor-pointer hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors disabled:opacity-50"
title={t('common.delete', 'Poz')}
>
<Trash2 size={16} />
</button>
<button
onClick={() => navigate(`/loan-orders/${order.id}/edit`)}
className="p-2 rounded-md cursor-pointer hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors"
title={t('common.edit', 'Redaktirle')}
>
<Pencil size={16} />
</button>
</div>
</div>
{/* ── Basic Info ─────────────────────────────────────────────────────── */}
<div className="bg-card border border-border rounded-xl overflow-hidden mb-6">
<InfoRow label="ID" value={order.id} />
<InfoRow
label={t('loanOrders.columns.createdAt', 'Döredilen wagty')}
value={order.createdAt}
/>
{/* Status row — special render */}
<div className="grid grid-cols-[220px_1fr] items-center py-2.5 px-4 border-b border-border">
<span className="text-sm text-muted-foreground">
{t('loanOrders.columns.status', 'Status')}
</span>
<LoanOrderStatusBadge status={order.status} />
</div>
<InfoRow
label={t('loanOrders.fields.amount', 'Berlik')}
value={order.amount ?? undefined}
/>
<InfoRow
label={t('loanOrders.fields.createdBy', 'Sargyt eden')}
value={order.createdBy ?? undefined}
isLink
/>
</div>
{/* ── Loan ───────────────────────────────────────────────────────────── */}
<Section title={t('loanOrders.sections.loan', 'Karz')}>
<InfoRow
label={t('loanOrders.columns.loanType', 'Karz görnüşi')}
value={order.loanType}
isLink
/>
<InfoRow
label={t('loanOrders.fields.loanAmount', 'Karz mukdary')}
value={order.loanAmount ?? undefined}
/>
</Section>
{/* ── Location ───────────────────────────────────────────────────────── */}
<Section title={t('loanOrders.sections.location', 'Lokasiýa')}>
<InfoRow label={t('loanOrders.columns.region', 'Welaýat')} value={order.region} />
<InfoRow
label={t('loanOrders.columns.branch', 'Şahamça')}
value={order.branch}
isLink
/>
</Section>
{/* ── Personal Info ──────────────────────────────────────────────────── */}
<Section title={t('loanOrders.sections.personal', 'Şahsy maglumatlar')}>
<InfoRow
label={t('loanOrders.fields.fullName', 'Doly ady')}
value={order.fullName ?? `${order.firstName} ${order.lastName}`}
/>
<InfoRow
label={t('loanOrders.fields.education', 'Bilimi')}
value={order.education ?? undefined}
/>
<InfoRow
label={t('loanOrders.fields.maritalStatus', 'Maşgala ýagdaýy')}
value={order.maritalStatus ?? undefined}
/>
<InfoRow
label={t('loanOrders.fields.birthDate', 'Doglan güni')}
value={order.birthDate ?? undefined}
/>
<InfoRow
label={t('loanOrders.fields.registeredAddress', 'Ýazgy edilen salgyňyz')}
value={order.registeredAddress ?? undefined}
/>
<InfoRow
label={t('loanOrders.fields.currentAddress', 'Häzirki ýaşaýyş ýeri')}
value={order.currentAddress ?? undefined}
/>
</Section>
{/* ── Contacts ───────────────────────────────────────────────────────── */}
<Section title={t('loanOrders.sections.contacts', 'Habarlaşmak üçin maglumatlar')}>
<InfoRow
label={t('loanOrders.fields.email', 'E-poçta')}
value={order.email ?? undefined}
/>
<InfoRow label={t('loanOrders.columns.phone', 'Telefon')} value={order.phone} />
<InfoRow
label={t('loanOrders.fields.phoneAlt', 'Telefon goşmaça')}
value={order.phoneAlt ?? undefined}
/>
<InfoRow
label={t('loanOrders.fields.homePhone', 'Öý telefony')}
value={order.homePhone ?? undefined}
/>
</Section>
{/* ── Employment ─────────────────────────────────────────────────────── */}
<Section title={t('loanOrders.sections.employment', 'Iş')}>
<InfoRow
label={t('loanOrders.fields.employer', 'Işleýän edaranyň/kärhananyn ady')}
value={order.employer ?? undefined}
/>
<InfoRow
label={t('loanOrders.fields.deptPhone', 'Işgärler bölüminiň iş belgisi')}
value={order.deptPhone ?? undefined}
/>
<InfoRow
label={t('loanOrders.fields.workRegion', 'Işleýän welaýatyňyz')}
value={order.workRegion ?? undefined}
/>
<InfoRow
label={t('loanOrders.fields.workCity', 'Işleýän etrabyňyz')}
value={order.workCity ?? undefined}
isLink
/>
<InfoRow
label={t('loanOrders.fields.position', 'Wezipe')}
value={order.position ?? undefined}
/>
<InfoRow
label={t('loanOrders.fields.salary', 'Zähmet haky')}
value={order.salary ?? undefined}
/>
<InfoRow
label={t('loanOrders.fields.employedSince', 'Işe başlan wagtyňyz')}
value={order.employedSince ?? undefined}
/>
</Section>
{/* ── Passport ───────────────────────────────────────────────────────── */}
<Section title={t('loanOrders.sections.passport', 'Pasport')}>
<InfoRow
label={t('loanOrders.fields.passportNumber', 'Pasport')}
value={order.passportNumber ?? undefined}
/>
<InfoRow
label={t('loanOrders.fields.passportIssuedBy', 'Kim tarapyndan berildi')}
value={order.passportIssuedBy ?? undefined}
/>
<InfoRow
label={t('loanOrders.fields.passportBirthPlace', 'Doglan ýeri (pasport)')}
value={order.passportBirthPlace ?? undefined}
/>
<PassportImage
label={t('loanOrders.fields.passportPage1', 'Pasport (sahypa 1)')}
src={order.passportPage1Url ?? undefined}
/>
<PassportImage
label={t('loanOrders.fields.passportPage23', 'Pasport (2-3-nji sahypa)')}
src={order.passportPage23Url ?? undefined}
/>
<PassportImage
label={t('loanOrders.fields.passportPage89', 'Pasport (8-9 sahypa)')}
src={order.passportPage89Url ?? undefined}
/>
<PassportImage
label={t('loanOrders.fields.passportPage32', 'Pasport (32-nji sahypa)')}
src={order.passportPage32Url ?? undefined}
/>
</Section>
{/* ── Audit Log ──────────────────────────────────────────────────────── */}
<div className="mb-6">
<details open>
<summary className="text-base font-semibold text-foreground mb-2 cursor-pointer select-none list-none flex items-center gap-1.5 w-fit">
{t('loanOrders.sections.audit', 'Ammallar')}
<ChevronRight size={15} className="text-muted-foreground" />
</summary>
<div className="bg-card border border-border rounded-xl overflow-hidden mt-2">
<div className="overflow-x-auto">
<table className="w-full text-sm">
<thead>
<tr className="border-b border-border bg-muted/30">
{[
'ID',
t('audit.columns.action', 'AMALYŇ ADY'),
t('audit.columns.by', 'KIM TARAPYNDAN'),
t('audit.columns.target', 'AMALYŇ NYŞANY (TARIBESI)'),
t('audit.columns.status', 'AMALYŇ STATUSY'),
t('audit.columns.date', 'SENE'),
'',
].map((col, i) => (
<th
key={i}
className="px-4 py-2.5 text-left text-xs font-medium text-muted-foreground uppercase tracking-wide whitespace-nowrap"
>
{col}
</th>
))}
</tr>
</thead>
<tbody>
{auditLogs.map((log) => (
<AuditRow key={log.id} {...log} />
))}
</tbody>
</table>
</div>
<div className="flex items-center justify-between px-4 py-2.5 border-t border-border text-xs text-muted-foreground">
<span>{t('common.prev', 'Öňki')}</span>
<span>1–{auditLogs.length} / {auditLogs.length}</span>
<span>{t('common.next', 'Soňky')}</span>
</div>
</div>
</details>
</div>
</div>
)
}

View File

@@ -1,4 +1,5 @@
import { useState, useMemo, useCallback } from 'react'
import { useNavigate } from 'react-router-dom'
import { useTranslation } from 'react-i18next'
import { Eye, Pencil, Trash2 } from 'lucide-react'
import type { ColumnDef, VisibilityState } from '@tanstack/react-table'
@@ -38,12 +39,13 @@ const STATUS_OPTIONS: { value: LoanOrderStatus; label: string }[] = [
export default function LoanOrdersPage() {
const { t } = useTranslation()
const navigate = useNavigate()
const deleteMutation = useDeleteLoanOrder()
// ── State ──────────────────────────────────────────────────────────────────
const [search, setSearch] = useState('')
const [page, setPage] = useState(1)
const [perPage, setPerPage] = useState(25)
const [perPage, setPerPage] = useState(10)
const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({})
const [columnOrder, setColumnOrder] = useState<string[]>([...COLUMN_IDS])
const [activeFilters, setActiveFilters] = useState<ActiveFilter[]>([
@@ -180,13 +182,14 @@ export default function LoanOrdersPage() {
cell: ({ row }) => (
<div className="flex items-center gap-1.5 justify-end">
<button
className="p-1.5 rounded hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors"
className="p-1.5 cursor-pointer rounded hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors"
title={t('common.view', 'View')}
onClick={() => navigate(`/loan-orders/${row.original.id}`)}
>
<Eye size={15} />
</button>
<button
className="p-1.5 rounded hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors"
className="p-1.5 cursor-pointer rounded hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors"
title={t('common.edit', 'Edit')}
>
<Pencil size={15} />
@@ -194,7 +197,7 @@ export default function LoanOrdersPage() {
<button
onClick={() => handleDelete(row.original.id)}
disabled={deleteMutation.isPending}
className="p-1.5 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors disabled:opacity-50"
className="p-1.5 cursor-pointer rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors disabled:opacity-50"
title={t('common.delete', 'Delete')}
>
<Trash2 size={15} />
@@ -272,7 +275,7 @@ export default function LoanOrdersPage() {
onPerPageChange={(v) => { setPerPage(v); setPage(1) }}
actionLabel={t('loanOrders.createButton', 'Karz sargyt dörediñ')}
onAction={() => {
// navigate to create page or open modal
navigate('/loan-orders/create')
}}
/>

View File

@@ -44,7 +44,7 @@ function EmptyState({ onCreate }: { onCreate: () => void }) {
</p>
<button
onClick={onCreate}
className="px-4 py-2 rounded-lg border border-border text-sm text-foreground hover:bg-muted/60 transition-colors"
className="px-4 py-2 rounded-md border border-border text-sm text-foreground hover:bg-muted/60 transition-colors"
>
{t(
"loanPaidOffLetters.createButton",
@@ -179,13 +179,13 @@ export default function LoanPaidOffLettersPage() {
cell: ({ row }) => (
<div className="flex items-center gap-1.5 justify-end">
<button
className="p-1.5 rounded hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors"
className="p-1.5 cursor-pointer rounded hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors"
title={t("common.view", "Görmek")}
>
<Eye size={15} />
</button>
<button
className="p-1.5 rounded hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors"
className="p-1.5 cursor-pointer rounded hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors"
title={t("common.edit", "Üýtgetmek")}
>
<Pencil size={15} />
@@ -193,7 +193,7 @@ export default function LoanPaidOffLettersPage() {
<button
onClick={() => handleDelete(row.original.id)}
disabled={deleteMutation.isPending}
className="p-1.5 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors disabled:opacity-50"
className="p-1.5 cursor-pointer rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors disabled:opacity-50"
title={t("common.delete", "Pozmak")}
>
<Trash2 size={15} />

View File

@@ -99,13 +99,13 @@ export default function LoanRemainingPage() {
cell: ({ row }) => (
<div className="flex items-center gap-1.5 justify-end">
<button
className="p-1.5 rounded hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors"
className="p-1.5 cursor-pointer rounded hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors"
title={t('common.view', 'Görmek')}
>
<Eye size={15} />
</button>
<button
className="p-1.5 rounded hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors"
className="p-1.5 cursor-pointer rounded hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors"
title={t('common.edit', 'Üýtgetmek')}
>
<Pencil size={15} />
@@ -113,7 +113,7 @@ export default function LoanRemainingPage() {
<button
onClick={() => handleDelete(row.original.id)}
disabled={deleteMutation.isPending}
className="p-1.5 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors disabled:opacity-50"
className="p-1.5 cursor-pointer rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors disabled:opacity-50"
title={t('common.delete', 'Pozmak')}
>
<Trash2 size={15} />

View File

@@ -82,7 +82,7 @@ function FormInput({
<Input
value={value}
onChange={(e) => onChange(e.target.value)}
className="bg-background border-input focus-visible:ring-primary"
className="bg-background border-input focus-visible:ring-primary h-11"
{...props}
/>
</div>
@@ -106,8 +106,12 @@ export default function AuthPage() {
}
loginMutation.mutate({ email: username, password }, {
onError: () => {
toast.error(t("Server Error", "An error occurred during login"));
onSuccess: () => {
toast.success(t("Success login", "Login successful"));
},
onError: (error: any) => {
const message = error?.response?.data?.message || t("Server Error", "An error occurred during login");
toast.error(message);
}
});
};
@@ -124,7 +128,8 @@ export default function AuthPage() {
<LeftPanel />
<div className="w-full md:w-[45%] flex flex-col bg-background">
<div className="flex-1 flex flex-col justify-center px-8 sm:px-12 py-10 overflow-y-auto">
<div className="flex-1 flex flex-col justify-center items-center px-8 sm:px-12 py-10 overflow-y-auto">
<div className="w-full max-w-[400px]">
{view === "login" && (
<>
<h2 className="text-[22px] font-normal text-foreground text-center mb-2 tracking-wide uppercase">
@@ -154,14 +159,14 @@ export default function AuthPage() {
</span>
</div>
<div className="flex flex-col gap-3">
<Button onClick={handleLogin} disabled={loginMutation.isPending}>
{loginMutation.isPending ? t("Loading") + "..." : t("Login")}
</Button>
<Button variant="outline" onClick={() => setView("register")}>
{t("Register")}
</Button>
</div>
<div className="flex flex-col gap-3">
<Button onClick={handleLogin} disabled={loginMutation.isPending} className="h-11">
{loginMutation.isPending ? t("Loading") + "..." : t("Login")}
</Button>
<Button variant="outline" onClick={() => setView("register")} className="h-11">
{t("Register")}
</Button>
</div>
<div className="text-center mt-8">
<span className="text-[13px] text-muted-foreground underline cursor-pointer hover:text-foreground transition-colors">
@@ -203,10 +208,10 @@ export default function AuthPage() {
/>
<div className="flex flex-col gap-3 mt-4">
<Button onClick={handleOtherSubmit}>
<Button onClick={handleOtherSubmit} className="h-11">
{t("Register")}
</Button>
<Button variant="outline" onClick={() => setView("login")}>
<Button variant="outline" onClick={() => setView("login")} className="h-11">
{t("Go to login page")}
</Button>
</div>
@@ -233,10 +238,10 @@ export default function AuthPage() {
/>
<div className="mt-4 flex flex-col gap-3">
<Button onClick={handleOtherSubmit}>
<Button onClick={handleOtherSubmit} className="h-11">
{t("Submit")}
</Button>
<Button variant="outline" onClick={() => setView("login")}>
<Button variant="outline" onClick={() => setView("login")} className="h-11">
{t("Go to login page")}
</Button>
</div>
@@ -248,6 +253,7 @@ export default function AuthPage() {
</div>
</>
)}
</div>
</div>
</div>
</div>