fixed button color, some select components

This commit is contained in:
Jelaletdin12
2026-05-24 22:36:29 +05:00
parent 6f0f88af3c
commit c4d3ee0191
7 changed files with 246 additions and 215 deletions

View File

@@ -7,19 +7,12 @@ import { useNavigate } from 'react-router-dom'
import { useTranslation } from 'react-i18next'
import { DataTable } from '@/components/dataTable'
import { DataTableToolbar, type ColumnMeta, type FilterField, type ActiveFilter } from '@/components/dataTableToolbar'
import { MonthSelect } from '@/components/monthSelect'
import { useSberPaymentOrders, useDeleteSberPayment } from '@/features/sberPayments/hooks/useSberPayments'
import { type SberPaymentOrder, WELAYATLAR, STATUSES, type PaymentStatus, type PaymentPaidStatus } from '@/features/sberPayments/api/sberPaymentsApi'
import { StatusBadge, type StatusBadgeVariant } from '@/components/ui/statusBadge'
import { AlertCircle, CheckCircle2, XCircle } from 'lucide-react'
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from '@/components/ui/select'
// ─── Status badge ─────────────────────────────────────────────────────────────
@@ -73,7 +66,6 @@ function PaymentStatusBadge({ status, t }: { status: PaymentStatus; t: (key: str
// ─── Column Definitions ───────────────────────────────────────────────────────
// ─── Column Meta for Toolbar ──────────────────────────────────────────────────
function getColumnMeta(t: (key: string, fallback?: string) => string): ColumnMeta[] {
@@ -302,32 +294,6 @@ export default function SberPaymentsListPage() {
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">
{t('sberPayments.list.monthLabel', 'Aý tölegi')}
</label>
<Select value={selectedMonth} onValueChange={setSelectedMonth}>
<SelectTrigger className="w-full">
<SelectValue placeholder="--" />
</SelectTrigger>
<SelectContent>
<SelectItem value="01">{t('months.january', 'Ýanwar')}</SelectItem>
<SelectItem value="02">{t('months.february', 'Fewral')}</SelectItem>
<SelectItem value="03">{t('months.march', 'Mart')}</SelectItem>
<SelectItem value="04">{t('months.april', 'Aprel')}</SelectItem>
<SelectItem value="05">{t('months.may', 'Maý')}</SelectItem>
<SelectItem value="06">{t('months.june', 'Iýun')}</SelectItem>
<SelectItem value="07">{t('months.july', 'Iýul')}</SelectItem>
<SelectItem value="08">{t('months.august', 'Awgust')}</SelectItem>
<SelectItem value="09">{t('months.september', 'Sentýabr')}</SelectItem>
<SelectItem value="10">{t('months.october', 'Oktýabr')}</SelectItem>
<SelectItem value="11">{t('months.november', 'Noýabr')}</SelectItem>
<SelectItem value="12">{t('months.december', 'Dekabr')}</SelectItem>
</SelectContent>
</Select>
</div>
{/* Page Title */}
<h1 className="text-xl font-semibold text-foreground">
{t('sberPayments.list.title', 'Sber tölegler (talyplar üçin)')}
@@ -358,6 +324,12 @@ export default function SberPaymentsListPage() {
}}
actionLabel={t('sberPayments.list.actionLabel', 'Sber töleg (talyplar üçin) dörediň')}
onAction={() => navigate('/sber-payments/create')}
extraActions={
<MonthSelect
value={selectedMonth}
onChange={(v) => { setSelectedMonth(v); setPage(1) }}
/>
}
/>
{/* Data Table */}

View File

@@ -7,9 +7,9 @@ import { DataTableToolbar } from '@/components/dataTableToolbar'
import { useIntlPayments, useDeleteIntlPayment } from '@/features/visaMasterPayments/hooks/useVisaMasterPayments'
import type { IntlPaymentItem, IntlPaymentStatus } from '@/features/visaMasterPayments/api/visaMasterPaymentsApi'
import { Button } from '@/components/ui/button'
import { Eye, Pencil, Trash2, ChevronDown } from 'lucide-react'
import { Eye, Pencil, Trash2 } from 'lucide-react'
import { ConfirmDialog } from '@/components/confirmDialog'
import { cn } from '@/lib/utils'
import { MonthSelect } from '@/components/monthSelect'
import { StatusBadge, type StatusBadgeVariant } from '@/components/ui/statusBadge'
import { AlertCircle, CheckCircle2, XCircle } from 'lucide-react'
// ─── Status badge ─────────────────────────────────────────────────────────────
@@ -38,51 +38,6 @@ function IntlPaymentStatusStatusBadge({ status }: { status: IntlPaymentStatus })
return <StatusBadge label={cfg.label} variant={cfg.variant} icon={cfg.icon} />
}
// ─── Month selector (AÝ TOLEGI) ───────────────────────────────────────────────
const MONTHS = [
{ value: '01', label: 'Ýanwar' },
{ value: '02', label: 'Fewral' },
{ value: '03', label: 'Mart' },
{ value: '04', label: 'Aprel' },
{ value: '05', label: 'Maý' },
{ value: '06', label: 'Iýun' },
{ value: '07', label: 'Iýul' },
{ value: '08', label: 'Awgust' },
{ value: '09', label: 'Sentýabr' },
{ value: '10', label: 'Oktýabr' },
{ value: '11', label: 'Noýabr' },
{ value: '12', label: 'Dekabr' },
]
function MonthSelector({ value, onChange }: { value: string; onChange: (v: string) => void }) {
const { t } = useTranslation()
return (
<div className="bg-card border border-border rounded-lg p-4 mb-4 inline-flex flex-col gap-2">
<span className="text-xs font-bold uppercase tracking-wider text-muted-foreground">
{t('intlPayment.monthFilter', 'AÝ TÖLEGI')}
</span>
<div className="relative">
<select
value={value}
onChange={(e) => onChange(e.target.value)}
className={cn(
'h-9 pl-3 pr-8 rounded-md border border-border bg-background',
'text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-ring',
'appearance-none cursor-pointer min-w-[120px]',
)}
>
<option value="">—</option>
{MONTHS.map((m) => (
<option key={m.value} value={m.value}>{m.label}</option>
))}
</select>
<ChevronDown size={13} className="absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none" />
</div>
</div>
)
}
// ─── Page ─────────────────────────────────────────────────────────────────────
export default function IntlPaymentsPage() {
@@ -205,7 +160,6 @@ export default function IntlPaymentsPage() {
{t("intlPayment.title", "Halkara tölegler (Visa/Mastercard)")}
</h1>
</div>
<MonthSelector value={month} onChange={(v) => { setMonth(v); setPage(1) }} />
<div className="bg-card border border-border rounded-xl p-4">
<DataTableToolbar
@@ -238,6 +192,12 @@ export default function IntlPaymentsPage() {
onPerPageChange={(v) => { setPerPage(v); setPage(1) }}
actionLabel={t('intlPayment.createBtn', 'Visa/Master tölegler (talyplar üçin) dörediň')}
onAction={() => navigate('/visa-master/create')}
extraActions={
<MonthSelect
value={month}
onChange={(v) => { setMonth(v); setPage(1) }}
/>
}
/>
<DataTable