added loan pages
This commit is contained in:
77
PROJECT_STANDARDS.md
Normal file
77
PROJECT_STANDARDS.md
Normal file
@@ -0,0 +1,77 @@
|
||||
# Proje Geliştirme Standartları ve AI/Agent Rehberi (TBBank Admin)
|
||||
|
||||
Bu doküman, projenin büyümesiyle yapının bozulmaması ve projede çalışacak olan yapay zeka (AI) asistanlarının / agent'ların mimariyi karıştırmaması için hazırlanmıştır. Geliştirme yaparken aşağıdaki kurallara **kesinlikle** uyulmalıdır.
|
||||
|
||||
## 1. Temel Teknoloji Yığını ve Kullanım Yerleri
|
||||
|
||||
- **State Management:** `zustand`
|
||||
- **Path:** `src/app/store/` (Örn: `authStore.ts`, `themeStore.ts`, `i18nStore.ts`)
|
||||
- Sadece global state (kullanıcı oturumu, tema, dil vb.) için kullanılmalıdır. Component içi basit stateler için `useState` kullanın.
|
||||
|
||||
- **Data Fetching & Caching:** `@tanstack/react-query`
|
||||
- **Path:** `src/features/[feature-name]/hooks/` (Örn: `src/features/auth/hooks/useLogin.ts`)
|
||||
- Bütün API istekleri custom hook'lar içerisine sarmalanmalı ve doğrudan component içinde `useQuery` veya `useMutation` yazılmamalıdır.
|
||||
|
||||
- **HTTP Client:** `axios`
|
||||
- **Path:** `src/lib/api/client.ts`
|
||||
- Tüm istekler merkezi axios instance'ı üzerinden yapılmalıdır. Interceptor'lar (token ekleme, hata yakalama vb.) bu dosyada yönetilir.
|
||||
|
||||
## 2. Kullanıcı Deneyimi (UX) ve UI Kuralları
|
||||
|
||||
- **Smooth UX:**
|
||||
- Yükleme durumları (loading states) her zaman gösterilmelidir (`src/components/ui/spinner.tsx` veya `skeleton.tsx`).
|
||||
- İşlem beklerken butonlar `disabled` duruma geçmelidir.
|
||||
- Geçişler ve animasyonlar pürüzsüz olmalıdır.
|
||||
|
||||
- **Bildirimler (Toast):** `sonner`
|
||||
- **Path:** `import { toast } from 'sonner'` (Bileşen Provider'ı: `src/components/ui/sonner.tsx`)
|
||||
- Her başarılı `mutation` (ekleme/güncelleme/silme) işleminden sonra **kesinlikle** başarı mesajı (`toast.success()`) gösterilmelidir.
|
||||
- Hatalı işlemlerde **kesinlikle** hata mesajı (`toast.error()`) gösterilmelidir.
|
||||
|
||||
- **Tema (Light / Dark Mode):**
|
||||
- Projede açık ve koyu tema desteği zorunludur.
|
||||
- Ui component olarak shadcn ui kullanilmaktadir.
|
||||
- Renklendirmeler Tailwind CSS sınıfları ile yapılmalıdır (Örn: `bg-white dark:bg-gray-900`).
|
||||
- Tema durumu `src/app/store/themeStore.ts` (veya proje yapısına göre `next-themes`) üzerinden kontrol edilmektedir.
|
||||
|
||||
- **Çoklu Dil Desteği (i18n):**
|
||||
- **Path:** `src/lib/i18n/` ve çeviri dosyaları `src/lib/i18n/locales/`
|
||||
- Desteklenen diller: İngilizce (`en`), Rusça (`ru`), Türkmence (`tk`).
|
||||
- Arayüzde hard-coded metin (string) yazmak **yasaktır**. Tüm metinler çeviri dosyalarından `useTranslation` kancası ile çekilmelidir.
|
||||
|
||||
## 3. Kod Kalitesi ve TypeScript Kuralları
|
||||
|
||||
- **Kesinlikle `any` Kullanımı Yasaktır!**
|
||||
- Proje genelinde `any` tipi kullanmak kesinlikle yasaktır (`eslint` kurallarıyla da desteklenmelidir).
|
||||
- Tipler tam olarak bilinmiyorsa `unknown` kullanılmalı veya uygun `interface` / `type` tanımlamaları yapılmalıdır.
|
||||
- Tüm API yanıtları, payload'lar ve component propları için mutlaka tip tanımlamaları oluşturulmalıdır.
|
||||
|
||||
- **Clean Code (Temiz Kod):**
|
||||
- Modüler yapı (Feature-Sliced Design) korunmalıdır. Her özellik kendi klasöründe (`src/features/[feature-name]/`) api, hooks, components olarak ayrılmalıdır.
|
||||
- Fonksiyonlar tek bir iş yapmalı (Single Responsibility).
|
||||
- İsimlendirmeler açıklayıcı olmalı (Örn: `handleData` yerine `submitLoginForm`).
|
||||
|
||||
## 4. Dosya Yapısı Özeti
|
||||
```text
|
||||
src/
|
||||
├── app/ # Global provider'lar, store'lar ve router konfigürasyonları
|
||||
├── assets/ # Görseller, fontlar vb. statik dosyalar
|
||||
├── components/ # Global ve UI bileşenleri (shadcn vb. ortak bileşenler)
|
||||
├── features/ # Özellik bazlı modüller (auth, dashboard, users vb.)
|
||||
│ └── [feature]/
|
||||
│ ├── api/ # Feature'a özel axios istek fonksiyonları
|
||||
│ ├── hooks/ # Feature'a özel React Query hook'ları (useQuery, useMutation)
|
||||
│ └── components/# Feature'a özel bileşenler
|
||||
├── hooks/ # Global custom hook'lar
|
||||
├── layouts/ # Sayfa düzenleri (DashboardLayout, AuthLayout vb.)
|
||||
├── lib/ # API client, i18n ayarları ve utils (yardımcı fonksiyonlar)
|
||||
└── pages/ # Router tarafından çağrılan ana sayfalar
|
||||
```
|
||||
|
||||
## AI / Agent İçin Katı Talimatlar (System Instructions)
|
||||
1. Yeni bir bileşen veya özellik ekleneceğinde her zaman önce `src/features/` altına eklenip eklenmeyeceğini değerlendir.
|
||||
2. UI bileşeni oluştururken önce `src/components/ui/` dizininde mevcut bir yapı olup olmadığını kontrol et.
|
||||
3. Asla `any` tipi tanımlama. TypeScript hatalarını doğru tipler (interface/type) yazarak çöz.
|
||||
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.
|
||||
@@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<link rel="icon" type="image/svg+xml" href="./src/assets/icon.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>tbbank-admin</title>
|
||||
</head>
|
||||
|
||||
75
package-lock.json
generated
75
package-lock.json
generated
@@ -10,6 +10,7 @@
|
||||
"dependencies": {
|
||||
"@fontsource-variable/geist": "^5.2.8",
|
||||
"@tanstack/react-query": "^5.100.8",
|
||||
"@tanstack/react-table": "^8.21.3",
|
||||
"axios": "^1.15.2",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
@@ -89,6 +90,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.0.tgz",
|
||||
"integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.29.0",
|
||||
"@babel/generator": "^7.29.0",
|
||||
@@ -644,29 +646,6 @@
|
||||
"@noble/ciphers": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@emnapi/core": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz",
|
||||
"integrity": "sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"@emnapi/wasi-threads": "1.2.1",
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@emnapi/runtime": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.10.0.tgz",
|
||||
"integrity": "sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@emnapi/wasi-threads": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz",
|
||||
@@ -1167,6 +1146,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-1.3.0.tgz",
|
||||
"integrity": "sha512-2I0gnIVPtfnMw9ee9h1dJG7tp81+8Ob3OJb3Mv37rx5L40/b0i7djjCVvGOVqc9AEIQyvyu1i6ypKdFw8R8gQw==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": "^14.21.3 || >=16"
|
||||
},
|
||||
@@ -3345,6 +3325,39 @@
|
||||
"react": "^18 || ^19"
|
||||
}
|
||||
},
|
||||
"node_modules/@tanstack/react-table": {
|
||||
"version": "8.21.3",
|
||||
"resolved": "https://registry.npmjs.org/@tanstack/react-table/-/react-table-8.21.3.tgz",
|
||||
"integrity": "sha512-5nNMTSETP4ykGegmVkhjcS8tTLW6Vl4axfEGQN3v0zdHYbK4UfoqfPChclTrJ4EoK9QynqAu9oUf8VEmrpZ5Ww==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@tanstack/table-core": "8.21.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/tannerlinsley"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=16.8",
|
||||
"react-dom": ">=16.8"
|
||||
}
|
||||
},
|
||||
"node_modules/@tanstack/table-core": {
|
||||
"version": "8.21.3",
|
||||
"resolved": "https://registry.npmjs.org/@tanstack/table-core/-/table-core-8.21.3.tgz",
|
||||
"integrity": "sha512-ldZXEhOBb8Is7xLs01fR3YEc3DERiz5silj8tnGkFZytt1abEvl/GhUmCE0PMLaMPTa3Jk4HbKmRlHmu+gCftg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/tannerlinsley"
|
||||
}
|
||||
},
|
||||
"node_modules/@ts-morph/common": {
|
||||
"version": "0.27.0",
|
||||
"resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.27.0.tgz",
|
||||
@@ -3393,6 +3406,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.12.2.tgz",
|
||||
"integrity": "sha512-A1sre26ke7HDIuY/M23nd9gfB+nrmhtYyMINbjI1zHJxYteKR6qSMX56FsmjMcDb3SMcjJg5BiRRgOCC/yBD0g==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"undici-types": "~7.16.0"
|
||||
}
|
||||
@@ -3403,6 +3417,7 @@
|
||||
"integrity": "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==",
|
||||
"devOptional": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"csstype": "^3.2.2"
|
||||
}
|
||||
@@ -3413,6 +3428,7 @@
|
||||
"integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==",
|
||||
"devOptional": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"peerDependencies": {
|
||||
"@types/react": "^19.2.0"
|
||||
}
|
||||
@@ -3483,6 +3499,7 @@
|
||||
"integrity": "sha512-HDQH9O/47Dxi1ceDhBXdaldtf/WV9yRYMjbjCuNk3qnaTD564qwv61Y7+gTxwxRKzSrgO5uhtw584igXVuuZkA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "8.59.1",
|
||||
"@typescript-eslint/types": "8.59.1",
|
||||
@@ -3726,6 +3743,7 @@
|
||||
"integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
},
|
||||
@@ -4007,6 +4025,7 @@
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"baseline-browser-mapping": "^2.10.12",
|
||||
"caniuse-lite": "^1.0.30001782",
|
||||
@@ -4714,6 +4733,7 @@
|
||||
"integrity": "sha512-XbEXaRva5cF0ZQB8w6MluHA0kZZfV2DuCMJ3ozyEOHLwDpZX2Lmm/7Pp0xdJmI0GL1W05VH5VwIFHEm1Vcw2gw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.8.0",
|
||||
"@eslint-community/regexpp": "^4.12.2",
|
||||
@@ -4964,6 +4984,7 @@
|
||||
"resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz",
|
||||
"integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"accepts": "^2.0.0",
|
||||
"body-parser": "^2.2.1",
|
||||
@@ -5629,6 +5650,7 @@
|
||||
"resolved": "https://registry.npmjs.org/hono/-/hono-4.12.16.tgz",
|
||||
"integrity": "sha512-jN0ZewiNAWSe5khM3EyCmBb250+b40wWbwNILNfEvq84VREWwOIkuUsFONk/3i3nqkz7Oe1PcpM2mwQEK2L9Kg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=16.9.0"
|
||||
}
|
||||
@@ -5703,6 +5725,7 @@
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"peerDependencies": {
|
||||
"typescript": "^5 || ^6"
|
||||
},
|
||||
@@ -7081,6 +7104,7 @@
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"nanoid": "^3.3.11",
|
||||
"picocolors": "^1.1.1",
|
||||
@@ -7342,6 +7366,7 @@
|
||||
"resolved": "https://registry.npmjs.org/react/-/react-19.2.5.tgz",
|
||||
"integrity": "sha512-llUJLzz1zTUBrskt2pwZgLq59AemifIftw4aB7JxOqf1HY2FDaGDxgwpAPVzHU1kdWabH7FauP4i1oEeer2WCA==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
@@ -7351,6 +7376,7 @@
|
||||
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.5.tgz",
|
||||
"integrity": "sha512-J5bAZz+DXMMwW/wV3xzKke59Af6CHY7G4uYLN1OvBcKEsWOs4pQExj86BBKamxl/Ik5bx9whOrvBlSDfWzgSag==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"scheduler": "^0.27.0"
|
||||
},
|
||||
@@ -8276,6 +8302,7 @@
|
||||
"integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==",
|
||||
"devOptional": true,
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
@@ -8488,6 +8515,7 @@
|
||||
"integrity": "sha512-rZuUu9j6J5uotLDs+cAA4O5H4K1SfPliUlQwqa6YEwSrWDZzP4rhm00oJR5snMewjxF5V/K3D4kctsUTsIU9Mw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"lightningcss": "^1.32.0",
|
||||
"picomatch": "^4.0.4",
|
||||
@@ -8811,6 +8839,7 @@
|
||||
"resolved": "https://registry.npmjs.org/zod/-/zod-4.4.2.tgz",
|
||||
"integrity": "sha512-IynmDyxsEsb9RKzO3J9+4SxXnl2FTFSzNBaKKaMV6tsSk0rw9gYw9gs+JFCq/qk2LCZ78KDwyj+Z289TijSkUw==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/colinhacks"
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
"dependencies": {
|
||||
"@fontsource-variable/geist": "^5.2.8",
|
||||
"@tanstack/react-query": "^5.100.8",
|
||||
"@tanstack/react-table": "^8.21.3",
|
||||
"axios": "^1.15.2",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
|
||||
184
src/App.css
184
src/App.css
@@ -1,184 +0,0 @@
|
||||
.counter {
|
||||
font-size: 16px;
|
||||
padding: 5px 10px;
|
||||
border-radius: 5px;
|
||||
color: var(--accent);
|
||||
background: var(--accent-bg);
|
||||
border: 2px solid transparent;
|
||||
transition: border-color 0.3s;
|
||||
margin-bottom: 24px;
|
||||
|
||||
&:hover {
|
||||
border-color: var(--accent-border);
|
||||
}
|
||||
&:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.hero {
|
||||
position: relative;
|
||||
|
||||
.base,
|
||||
.framework,
|
||||
.vite {
|
||||
inset-inline: 0;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.base {
|
||||
width: 170px;
|
||||
position: relative;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.framework,
|
||||
.vite {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.framework {
|
||||
z-index: 1;
|
||||
top: 34px;
|
||||
height: 28px;
|
||||
transform: perspective(2000px) rotateZ(300deg) rotateX(44deg) rotateY(39deg)
|
||||
scale(1.4);
|
||||
}
|
||||
|
||||
.vite {
|
||||
z-index: 0;
|
||||
top: 107px;
|
||||
height: 26px;
|
||||
width: auto;
|
||||
transform: perspective(2000px) rotateZ(300deg) rotateX(40deg) rotateY(39deg)
|
||||
scale(0.8);
|
||||
}
|
||||
}
|
||||
|
||||
#center {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 25px;
|
||||
place-content: center;
|
||||
place-items: center;
|
||||
flex-grow: 1;
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
padding: 32px 20px 24px;
|
||||
gap: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
#next-steps {
|
||||
display: flex;
|
||||
border-top: 1px solid var(--border);
|
||||
text-align: left;
|
||||
|
||||
& > div {
|
||||
flex: 1 1 0;
|
||||
padding: 32px;
|
||||
@media (max-width: 1024px) {
|
||||
padding: 24px 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.icon {
|
||||
margin-bottom: 16px;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
flex-direction: column;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
#docs {
|
||||
border-right: 1px solid var(--border);
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
border-right: none;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
}
|
||||
|
||||
#next-steps ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
margin: 32px 0 0;
|
||||
|
||||
.logo {
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--text-h);
|
||||
font-size: 16px;
|
||||
border-radius: 6px;
|
||||
background: var(--social-bg);
|
||||
display: flex;
|
||||
padding: 6px 12px;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
text-decoration: none;
|
||||
transition: box-shadow 0.3s;
|
||||
|
||||
&:hover {
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
.button-icon {
|
||||
height: 18px;
|
||||
width: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
margin-top: 20px;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
|
||||
li {
|
||||
flex: 1 1 calc(50% - 8px);
|
||||
}
|
||||
|
||||
a {
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#spacer {
|
||||
height: 88px;
|
||||
border-top: 1px solid var(--border);
|
||||
@media (max-width: 1024px) {
|
||||
height: 48px;
|
||||
}
|
||||
}
|
||||
|
||||
.ticks {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
|
||||
&::before,
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: -4.5px;
|
||||
border: 5px solid transparent;
|
||||
}
|
||||
|
||||
&::before {
|
||||
left: 0;
|
||||
border-left-color: var(--border);
|
||||
}
|
||||
&::after {
|
||||
right: 0;
|
||||
border-right-color: var(--border);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,38 +1,35 @@
|
||||
import { lazy, Suspense } from 'react'
|
||||
import { createBrowserRouter, Navigate, Outlet } from 'react-router-dom'
|
||||
import { useAuthStore } from '../store/authStore'
|
||||
import { Spinner } from '@/components/ui/spinner'
|
||||
import { lazy, Suspense } from "react";
|
||||
import { createBrowserRouter, Navigate, Outlet } from "react-router-dom";
|
||||
import { useAuthStore } from "../store/authStore";
|
||||
import { Spinner } from "@/components/ui/spinner";
|
||||
import { DashboardLayout } from "@/layouts/DashboardLayout";
|
||||
|
||||
const LoginPage = lazy(() => import('@/pages/login'))
|
||||
const DashboardPage = lazy(() => import('@/pages/dashboard'))
|
||||
|
||||
const LoginPage = lazy(() => import("@/pages/login"));
|
||||
const DashboardPage = lazy(() => import("@/pages/dashboard"));
|
||||
const LoanOrdersPage = lazy(() => import("@/pages/loanOrders"));
|
||||
const LoanOrderMobilesPage = lazy(() => import("@/pages/loanOrderMobiles"));
|
||||
const LoanRemainingPage = lazy(() => import("@/pages/loanRemaining"));
|
||||
const LoanPaidOffLettersPage = lazy(() => import("@/pages/loanPaidOffLetters"));
|
||||
|
||||
function AuthGuard() {
|
||||
const isAuthenticated = useAuthStore((s) => s.isAuthenticated)
|
||||
|
||||
if (!isAuthenticated) {
|
||||
return <Navigate to="/login" replace />
|
||||
}
|
||||
|
||||
return <Outlet />
|
||||
const isAuthenticated = useAuthStore((s) => s.isAuthenticated);
|
||||
if (!isAuthenticated) return <Navigate to="/login" replace />;
|
||||
return <Outlet />;
|
||||
}
|
||||
|
||||
function PublicGuard() {
|
||||
const isAuthenticated = useAuthStore((s) => s.isAuthenticated)
|
||||
|
||||
if (isAuthenticated) {
|
||||
return <Navigate to="/dashboard" replace />
|
||||
}
|
||||
|
||||
return <Outlet />
|
||||
const isAuthenticated = useAuthStore((s) => s.isAuthenticated);
|
||||
if (isAuthenticated) return <Navigate to="/dashboard" replace />;
|
||||
return <Outlet />;
|
||||
}
|
||||
|
||||
function PageLoader() {
|
||||
return (
|
||||
<div className="min-h-screen flex items-center justify-center bg-[var(--bg-base)]">
|
||||
<Spinner className="size-8 text-[var(--brand-500)]" />
|
||||
<div className="min-h-screen flex items-center justify-center bg-(--bg-base)">
|
||||
<Spinner className="size-8 text-(--brand-500)" />
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export const router = createBrowserRouter([
|
||||
@@ -40,7 +37,7 @@ export const router = createBrowserRouter([
|
||||
element: <PublicGuard />,
|
||||
children: [
|
||||
{
|
||||
path: '/login',
|
||||
path: "/login",
|
||||
element: (
|
||||
<Suspense fallback={<PageLoader />}>
|
||||
<LoginPage />
|
||||
@@ -53,21 +50,61 @@ export const router = createBrowserRouter([
|
||||
element: <AuthGuard />,
|
||||
children: [
|
||||
{
|
||||
path: '/dashboard',
|
||||
element: (
|
||||
<Suspense fallback={<PageLoader />}>
|
||||
<DashboardPage />
|
||||
</Suspense>
|
||||
),
|
||||
},
|
||||
{
|
||||
path: '/',
|
||||
element: <Navigate to="/dashboard" replace />,
|
||||
element: <DashboardLayout />,
|
||||
children: [
|
||||
{
|
||||
path: "/dashboard",
|
||||
element: (
|
||||
<Suspense fallback={<PageLoader />}>
|
||||
<DashboardPage />
|
||||
</Suspense>
|
||||
),
|
||||
},
|
||||
|
||||
{ path: "/", element: <Navigate to="/dashboard" replace /> },
|
||||
|
||||
// ── KARZ BÖLÜMI ──────────────────────────────────────────────────
|
||||
{
|
||||
path: "/resources/loan-orders",
|
||||
element: (
|
||||
<Suspense fallback={<PageLoader />}>
|
||||
<LoanOrdersPage />
|
||||
</Suspense>
|
||||
),
|
||||
},
|
||||
{
|
||||
// Sidebar: /resources/loan-order-mobiles
|
||||
path: "/resources/loan-order-mobiles",
|
||||
element: (
|
||||
<Suspense fallback={<PageLoader />}>
|
||||
<LoanOrderMobilesPage />
|
||||
</Suspense>
|
||||
),
|
||||
},
|
||||
{
|
||||
// Sidebar: /resources/loan-remaining
|
||||
path: "/resources/loan-remaining",
|
||||
element: (
|
||||
<Suspense fallback={<PageLoader />}>
|
||||
<LoanRemainingPage />
|
||||
</Suspense>
|
||||
),
|
||||
},
|
||||
{
|
||||
// Sidebar: /resources/loan-paid-off-letters
|
||||
path: "/resources/loan-paid-off-letters",
|
||||
element: (
|
||||
<Suspense fallback={<PageLoader />}>
|
||||
<LoanPaidOffLettersPage />
|
||||
</Suspense>
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '*',
|
||||
path: "*",
|
||||
element: <Navigate to="/" replace />,
|
||||
},
|
||||
])
|
||||
]);
|
||||
|
||||
3013
src/assets/icon.svg
Normal file
3013
src/assets/icon.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 979 KiB |
456
src/components/dataTable.tsx
Normal file
456
src/components/dataTable.tsx
Normal file
@@ -0,0 +1,456 @@
|
||||
import { useRef, useState } from 'react'
|
||||
import {
|
||||
flexRender,
|
||||
getCoreRowModel,
|
||||
useReactTable,
|
||||
type ColumnDef,
|
||||
type VisibilityState,
|
||||
type RowSelectionState,
|
||||
type SortingState,
|
||||
getSortedRowModel,
|
||||
} from '@tanstack/react-table'
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from '@/components/ui/table'
|
||||
import { Checkbox } from '@/components/ui/checkbox'
|
||||
import {
|
||||
Pagination,
|
||||
PaginationContent,
|
||||
PaginationEllipsis,
|
||||
PaginationItem,
|
||||
PaginationLink,
|
||||
PaginationNext,
|
||||
PaginationPrevious,
|
||||
} from '@/components/ui/pagination'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { useOutsideClick } from '@/lib/hooks/useOutsideClick'
|
||||
import { ChevronDown } from 'lucide-react'
|
||||
|
||||
export type { ColumnDef }
|
||||
|
||||
// ─── Pagination ───────────────────────────────────────────────────────────────
|
||||
|
||||
interface DataTablePaginationProps {
|
||||
currentPage: number
|
||||
totalPages: number
|
||||
onPageChange: (page: number) => void
|
||||
}
|
||||
|
||||
function DataTablePagination({
|
||||
currentPage,
|
||||
totalPages,
|
||||
onPageChange,
|
||||
}: DataTablePaginationProps) {
|
||||
if (totalPages <= 1) return null
|
||||
|
||||
const getPages = (): (number | 'ellipsis')[] => {
|
||||
if (totalPages <= 7) return Array.from({ length: totalPages }, (_, i) => i + 1)
|
||||
|
||||
const pages: (number | 'ellipsis')[] = [1]
|
||||
|
||||
if (currentPage > 3) pages.push('ellipsis')
|
||||
|
||||
const start = Math.max(2, currentPage - 1)
|
||||
const end = Math.min(totalPages - 1, currentPage + 1)
|
||||
|
||||
for (let i = start; i <= end; i++) pages.push(i)
|
||||
|
||||
if (currentPage < totalPages - 2) pages.push('ellipsis')
|
||||
|
||||
pages.push(totalPages)
|
||||
return pages
|
||||
}
|
||||
|
||||
return (
|
||||
<Pagination className="justify-center mt-3">
|
||||
<PaginationContent>
|
||||
<PaginationItem>
|
||||
<PaginationPrevious
|
||||
href="#"
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
if (currentPage > 1) onPageChange(currentPage - 1)
|
||||
}}
|
||||
className={cn(currentPage === 1 && 'pointer-events-none opacity-40')}
|
||||
/>
|
||||
</PaginationItem>
|
||||
|
||||
{getPages().map((page, i) =>
|
||||
page === 'ellipsis' ? (
|
||||
<PaginationItem key={`ellipsis-${i}`}>
|
||||
<PaginationEllipsis />
|
||||
</PaginationItem>
|
||||
) : (
|
||||
<PaginationItem key={page}>
|
||||
<PaginationLink
|
||||
href="#"
|
||||
isActive={page === currentPage}
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
onPageChange(page)
|
||||
}}
|
||||
>
|
||||
{page}
|
||||
</PaginationLink>
|
||||
</PaginationItem>
|
||||
)
|
||||
)}
|
||||
|
||||
<PaginationItem>
|
||||
<PaginationNext
|
||||
href="#"
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
if (currentPage < totalPages) onPageChange(currentPage + 1)
|
||||
}}
|
||||
className={cn(currentPage === totalPages && 'pointer-events-none opacity-40')}
|
||||
/>
|
||||
</PaginationItem>
|
||||
</PaginationContent>
|
||||
</Pagination>
|
||||
)
|
||||
}
|
||||
|
||||
// ─── Select All Dropdown ──────────────────────────────────────────────────────
|
||||
|
||||
interface SelectAllDropdownProps {
|
||||
isAllPageSelected: boolean
|
||||
isSomePageSelected: boolean
|
||||
isAllTotalSelected: boolean
|
||||
totalCount: number
|
||||
pageCount: number
|
||||
onSelectPage: (checked: boolean) => void
|
||||
onSelectAll: () => void
|
||||
onClearAll: () => void
|
||||
}
|
||||
|
||||
function SelectAllDropdown({
|
||||
isAllPageSelected,
|
||||
isSomePageSelected,
|
||||
isAllTotalSelected,
|
||||
totalCount,
|
||||
pageCount,
|
||||
onSelectPage,
|
||||
onSelectAll,
|
||||
onClearAll,
|
||||
}: SelectAllDropdownProps) {
|
||||
const [open, setOpen] = useState(false)
|
||||
const ref = useRef<HTMLDivElement>(null)
|
||||
useOutsideClick(ref, () => setOpen(false))
|
||||
|
||||
const checkboxChecked = isAllPageSelected || (isSomePageSelected && 'indeterminate')
|
||||
|
||||
return (
|
||||
<div ref={ref} className="flex items-center gap-0.5">
|
||||
<Checkbox
|
||||
checked={checkboxChecked as boolean | 'indeterminate'}
|
||||
onCheckedChange={(value) => onSelectPage(!!value)}
|
||||
aria-label="Select all on page"
|
||||
/>
|
||||
<button
|
||||
onClick={() => setOpen((v) => !v)}
|
||||
className="flex items-center text-muted-foreground hover:text-foreground transition-colors p-0.5"
|
||||
aria-label="Selection options"
|
||||
>
|
||||
<ChevronDown size={11} />
|
||||
</button>
|
||||
|
||||
{open && (
|
||||
<div className="absolute top-10 left-0 z-50 w-52 bg-card border border-border rounded-lg shadow-lg py-1">
|
||||
<button
|
||||
onClick={() => {
|
||||
onSelectPage(true)
|
||||
setOpen(false)
|
||||
}}
|
||||
className="w-full text-left px-3 py-2 text-sm hover:bg-muted/50 transition-colors"
|
||||
>
|
||||
Select this page
|
||||
<span className="ml-1 text-muted-foreground text-xs">({pageCount})</span>
|
||||
</button>
|
||||
<button
|
||||
onClick={() => {
|
||||
onSelectAll()
|
||||
setOpen(false)
|
||||
}}
|
||||
className="w-full text-left px-3 py-2 text-sm hover:bg-muted/50 transition-colors"
|
||||
>
|
||||
Select all records
|
||||
<span className="ml-1 text-muted-foreground text-xs">({totalCount})</span>
|
||||
</button>
|
||||
{(isAllPageSelected || isAllTotalSelected || isSomePageSelected) && (
|
||||
<>
|
||||
<div className="border-t border-border my-1" />
|
||||
<button
|
||||
onClick={() => {
|
||||
onClearAll()
|
||||
setOpen(false)
|
||||
}}
|
||||
className="w-full text-left px-3 py-2 text-sm text-destructive hover:bg-destructive/10 transition-colors"
|
||||
>
|
||||
Clear selection
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
// ─── DataTable ────────────────────────────────────────────────────────────────
|
||||
|
||||
interface DataTableProps<TData> {
|
||||
columns: ColumnDef<TData>[]
|
||||
data: TData[]
|
||||
isLoading?: boolean
|
||||
columnVisibility?: VisibilityState
|
||||
onColumnVisibilityChange?: (visibility: VisibilityState) => void
|
||||
columnOrder?: string[]
|
||||
onColumnOrderChange?: (order: string[]) => void
|
||||
enableRowSelection?: boolean
|
||||
onRowSelectionChange?: (rows: TData[]) => void
|
||||
getRowId?: (row: TData) => string
|
||||
|
||||
// Pagination — server-side
|
||||
currentPage?: number
|
||||
totalPages?: number
|
||||
totalCount?: number
|
||||
onPageChange?: (page: number) => void
|
||||
}
|
||||
|
||||
export function DataTable<TData>({
|
||||
columns,
|
||||
data,
|
||||
isLoading = false,
|
||||
columnVisibility,
|
||||
onColumnVisibilityChange,
|
||||
columnOrder,
|
||||
onColumnOrderChange,
|
||||
enableRowSelection = false,
|
||||
onRowSelectionChange,
|
||||
getRowId,
|
||||
currentPage = 1,
|
||||
totalPages = 1,
|
||||
totalCount,
|
||||
onPageChange,
|
||||
}: DataTableProps<TData>) {
|
||||
const [sorting, setSorting] = useState<SortingState>([])
|
||||
const [rowSelection, setRowSelection] = useState<RowSelectionState>({})
|
||||
// Tracks whether ALL records (across pages) are logically selected
|
||||
const [allTotalSelected, setAllTotalSelected] = useState(false)
|
||||
|
||||
const resolvedTotalCount = totalCount ?? data.length
|
||||
|
||||
// ── Build selection column ──────────────────────────────────────────────────
|
||||
const selectionColumn: ColumnDef<TData> = {
|
||||
id: 'select',
|
||||
header: ({ table }) => (
|
||||
<div className="relative">
|
||||
<SelectAllDropdown
|
||||
isAllPageSelected={table.getIsAllPageRowsSelected()}
|
||||
isSomePageSelected={table.getIsSomePageRowsSelected()}
|
||||
isAllTotalSelected={allTotalSelected}
|
||||
totalCount={resolvedTotalCount}
|
||||
pageCount={data.length}
|
||||
onSelectPage={(checked) => {
|
||||
table.toggleAllPageRowsSelected(checked)
|
||||
if (!checked) setAllTotalSelected(false)
|
||||
}}
|
||||
onSelectAll={() => {
|
||||
table.toggleAllPageRowsSelected(true)
|
||||
setAllTotalSelected(true)
|
||||
}}
|
||||
onClearAll={() => {
|
||||
table.toggleAllPageRowsSelected(false)
|
||||
setAllTotalSelected(false)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
),
|
||||
cell: ({ row }) => (
|
||||
<Checkbox
|
||||
checked={row.getIsSelected()}
|
||||
onCheckedChange={(value) => row.toggleSelected(!!value)}
|
||||
aria-label="Select row"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
/>
|
||||
),
|
||||
enableSorting: false,
|
||||
enableHiding: false,
|
||||
size: 48,
|
||||
}
|
||||
|
||||
const allColumns: ColumnDef<TData>[] = enableRowSelection
|
||||
? [selectionColumn, ...columns]
|
||||
: columns
|
||||
|
||||
const effectiveColumnOrder: string[] = enableRowSelection
|
||||
? columnOrder && columnOrder.length > 0
|
||||
? columnOrder[0] === 'select'
|
||||
? columnOrder
|
||||
: ['select', ...columnOrder.filter((id) => id !== 'select')]
|
||||
: []
|
||||
: (columnOrder ?? [])
|
||||
|
||||
const table = useReactTable({
|
||||
data,
|
||||
columns: allColumns,
|
||||
state: {
|
||||
sorting,
|
||||
rowSelection,
|
||||
columnVisibility: columnVisibility ?? {},
|
||||
columnOrder: effectiveColumnOrder,
|
||||
},
|
||||
getRowId,
|
||||
enableRowSelection,
|
||||
onRowSelectionChange: (updater) => {
|
||||
const newSelection =
|
||||
typeof updater === 'function' ? updater(rowSelection) : updater
|
||||
setRowSelection(newSelection)
|
||||
// If deselecting anything, clear allTotalSelected
|
||||
if (Object.keys(newSelection).length < data.length) {
|
||||
setAllTotalSelected(false)
|
||||
}
|
||||
if (onRowSelectionChange) {
|
||||
const selectedRows = data.filter((_, index) =>
|
||||
newSelection[getRowId ? getRowId(data[index]) : String(index)]
|
||||
)
|
||||
onRowSelectionChange(selectedRows)
|
||||
}
|
||||
},
|
||||
onSortingChange: setSorting,
|
||||
onColumnVisibilityChange: (updater) => {
|
||||
if (!onColumnVisibilityChange) return
|
||||
const next =
|
||||
typeof updater === 'function' ? updater(columnVisibility ?? {}) : updater
|
||||
onColumnVisibilityChange(next)
|
||||
},
|
||||
onColumnOrderChange: (updater) => {
|
||||
if (!onColumnOrderChange) return
|
||||
const next =
|
||||
typeof updater === 'function' ? updater(columnOrder ?? []) : updater
|
||||
onColumnOrderChange(next)
|
||||
},
|
||||
getCoreRowModel: getCoreRowModel(),
|
||||
getSortedRowModel: getSortedRowModel(),
|
||||
})
|
||||
|
||||
// ── Selection banner ────────────────────────────────────────────────────────
|
||||
const selectedCount = Object.keys(rowSelection).length
|
||||
const showBanner = enableRowSelection && (selectedCount > 0 || allTotalSelected)
|
||||
|
||||
return (
|
||||
<div className="space-y-0">
|
||||
{/* Selection banner */}
|
||||
{showBanner && (
|
||||
<div className="flex items-center justify-between px-3 py-2 bg-primary/5 border border-primary/20 rounded-t-lg text-sm border-b-0">
|
||||
<span className="text-primary font-medium">
|
||||
{allTotalSelected
|
||||
? `All ${resolvedTotalCount} records selected`
|
||||
: `${selectedCount} row${selectedCount !== 1 ? 's' : ''} selected`}
|
||||
</span>
|
||||
<button
|
||||
onClick={() => {
|
||||
table.toggleAllPageRowsSelected(false)
|
||||
setAllTotalSelected(false)
|
||||
}}
|
||||
className="text-xs text-muted-foreground hover:text-foreground transition-colors"
|
||||
>
|
||||
Clear
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Table */}
|
||||
<div
|
||||
className={cn(
|
||||
'border border-border overflow-hidden',
|
||||
showBanner ? 'rounded-b-lg rounded-t-none' : 'rounded-lg'
|
||||
)}
|
||||
>
|
||||
<Table>
|
||||
<TableHeader>
|
||||
{table.getHeaderGroups().map((headerGroup) => (
|
||||
<TableRow key={headerGroup.id} className="bg-muted/40 hover:bg-muted/40">
|
||||
{headerGroup.headers.map((header) => (
|
||||
<TableHead
|
||||
key={header.id}
|
||||
style={{
|
||||
width: header.getSize() !== 150 ? header.getSize() : undefined,
|
||||
}}
|
||||
className={cn(
|
||||
'text-xs font-semibold text-muted-foreground uppercase tracking-wider whitespace-nowrap',
|
||||
header.column.getCanSort() && 'cursor-pointer select-none'
|
||||
)}
|
||||
onClick={header.column.getToggleSortingHandler()}
|
||||
>
|
||||
{header.isPlaceholder
|
||||
? null
|
||||
: flexRender(header.column.columnDef.header, header.getContext())}
|
||||
</TableHead>
|
||||
))}
|
||||
</TableRow>
|
||||
))}
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{isLoading ? (
|
||||
Array.from({ length: 7 }).map((_, i) => (
|
||||
<TableRow key={i}>
|
||||
{allColumns.map((_, j) => (
|
||||
<TableCell key={j}>
|
||||
<div className="h-4 bg-muted rounded animate-pulse" />
|
||||
</TableCell>
|
||||
))}
|
||||
</TableRow>
|
||||
))
|
||||
) : table.getRowModel().rows.length === 0 ? (
|
||||
<TableRow>
|
||||
<TableCell
|
||||
colSpan={allColumns.length}
|
||||
className="text-center py-16 text-muted-foreground"
|
||||
>
|
||||
No data found
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
) : (
|
||||
table.getRowModel().rows.map((row) => (
|
||||
<TableRow
|
||||
key={row.id}
|
||||
data-state={row.getIsSelected() ? 'selected' : undefined}
|
||||
className="hover:bg-muted/30 transition-colors border-border"
|
||||
>
|
||||
{row.getVisibleCells().map((cell) => (
|
||||
<TableCell key={cell.id} className="py-3">
|
||||
{flexRender(cell.column.columnDef.cell, cell.getContext())}
|
||||
</TableCell>
|
||||
))}
|
||||
</TableRow>
|
||||
))
|
||||
)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
|
||||
{/* Pagination */}
|
||||
{onPageChange && (
|
||||
<DataTablePagination
|
||||
currentPage={currentPage}
|
||||
totalPages={totalPages}
|
||||
onPageChange={(page) => {
|
||||
// Clear selection on page change (server-side pattern)
|
||||
if (!allTotalSelected) {
|
||||
table.toggleAllPageRowsSelected(false)
|
||||
setRowSelection({})
|
||||
}
|
||||
onPageChange(page)
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
393
src/components/dataTableToolbar.tsx
Normal file
393
src/components/dataTableToolbar.tsx
Normal file
@@ -0,0 +1,393 @@
|
||||
import { useRef, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { SlidersHorizontal, Clock, Filter, ChevronDown, X, GripVertical } from 'lucide-react'
|
||||
import type { VisibilityState } from '@tanstack/react-table'
|
||||
import { useOutsideClick } from '@/lib/hooks/useOutsideClick'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { TableSearchInput } from '@/components/tableSearch'
|
||||
import { TableActionButton } from '@/components/tableButton'
|
||||
|
||||
// ─── Types ────────────────────────────────────────────────────────────────────
|
||||
|
||||
export interface ColumnMeta {
|
||||
id: string
|
||||
label: string
|
||||
}
|
||||
|
||||
export interface FilterField {
|
||||
id: string
|
||||
label: string
|
||||
options: { value: string; label: string }[]
|
||||
}
|
||||
|
||||
export interface ActiveFilter {
|
||||
fieldId: string
|
||||
value: string
|
||||
}
|
||||
|
||||
interface DataTableToolbarProps {
|
||||
searchValue: string
|
||||
onSearchChange: (value: string) => void
|
||||
searchPlaceholder?: string
|
||||
|
||||
columns: ColumnMeta[]
|
||||
columnVisibility: VisibilityState
|
||||
onColumnVisibilityChange: (visibility: VisibilityState) => void
|
||||
columnOrder: string[]
|
||||
onColumnOrderChange: (order: string[]) => void
|
||||
|
||||
filterFields?: FilterField[]
|
||||
activeFilters?: ActiveFilter[]
|
||||
onFilterChange?: (fieldId: string, value: string) => void
|
||||
onFilterReset?: () => void
|
||||
|
||||
perPageOptions?: number[]
|
||||
perPage?: number
|
||||
onPerPageChange?: (value: number) => void
|
||||
|
||||
actionLabel?: string
|
||||
onAction?: () => void
|
||||
|
||||
hideSearch?: boolean
|
||||
hideAction?: boolean
|
||||
}
|
||||
|
||||
// ─── Toggle Columns Dropdown ──────────────────────────────────────────────────
|
||||
|
||||
interface ToggleColumnsDropdownProps {
|
||||
columns: ColumnMeta[]
|
||||
columnVisibility: VisibilityState
|
||||
onColumnVisibilityChange: (visibility: VisibilityState) => void
|
||||
columnOrder: string[]
|
||||
onColumnOrderChange: (order: string[]) => void
|
||||
}
|
||||
|
||||
function ToggleColumnsDropdown({
|
||||
columns,
|
||||
columnVisibility,
|
||||
onColumnVisibilityChange,
|
||||
columnOrder,
|
||||
onColumnOrderChange,
|
||||
}: ToggleColumnsDropdownProps) {
|
||||
const { t } = useTranslation()
|
||||
const [open, setOpen] = useState(false)
|
||||
const ref = useRef<HTMLDivElement>(null)
|
||||
const dragIdRef = useRef<string | null>(null)
|
||||
const [dragOverId, setDragOverId] = useState<string | null>(null)
|
||||
|
||||
useOutsideClick(ref, () => setOpen(false))
|
||||
|
||||
const isVisible = (id: string) =>
|
||||
columnVisibility[id] === undefined ? true : columnVisibility[id]
|
||||
|
||||
const toggle = (id: string) => {
|
||||
onColumnVisibilityChange({ ...columnVisibility, [id]: !isVisible(id) })
|
||||
}
|
||||
|
||||
// columnOrder'a göre sırala; columnOrder'da olmayan kolonları sona at
|
||||
const orderedColumns = [...columns].sort((a, b) => {
|
||||
const ai = columnOrder.indexOf(a.id)
|
||||
const bi = columnOrder.indexOf(b.id)
|
||||
if (ai === -1 && bi === -1) return 0
|
||||
if (ai === -1) return 1
|
||||
if (bi === -1) return -1
|
||||
return ai - bi
|
||||
})
|
||||
|
||||
const handleDragStart = (id: string) => {
|
||||
dragIdRef.current = id
|
||||
}
|
||||
|
||||
const handleDragOver = (e: React.DragEvent, id: string) => {
|
||||
e.preventDefault()
|
||||
if (dragIdRef.current !== id) setDragOverId(id)
|
||||
}
|
||||
|
||||
const handleDrop = (targetId: string) => {
|
||||
const sourceId = dragIdRef.current
|
||||
if (!sourceId || sourceId === targetId) return
|
||||
|
||||
const next = [...columnOrder]
|
||||
const from = next.indexOf(sourceId)
|
||||
const to = next.indexOf(targetId)
|
||||
|
||||
// columnOrder'da yoksa ekle
|
||||
const safeFrom = from === -1 ? next.length : from
|
||||
const safeTo = to === -1 ? next.length : to
|
||||
|
||||
next.splice(safeFrom, 1)
|
||||
next.splice(safeTo, 0, sourceId)
|
||||
onColumnOrderChange(next)
|
||||
|
||||
dragIdRef.current = null
|
||||
setDragOverId(null)
|
||||
}
|
||||
|
||||
const handleDragEnd = () => {
|
||||
dragIdRef.current = null
|
||||
setDragOverId(null)
|
||||
}
|
||||
|
||||
return (
|
||||
<div ref={ref} className="relative">
|
||||
<button
|
||||
onClick={() => setOpen((v) => !v)}
|
||||
className={cn(
|
||||
'flex items-center gap-1.5 h-9 px-3 rounded-md border border-border',
|
||||
'text-sm text-muted-foreground bg-background',
|
||||
'hover:bg-muted/50 hover:text-foreground transition-colors',
|
||||
open && 'bg-muted/50 text-foreground border-ring'
|
||||
)}
|
||||
>
|
||||
<SlidersHorizontal size={14} />
|
||||
<ChevronDown size={12} />
|
||||
</button>
|
||||
|
||||
{open && (
|
||||
<div className="absolute right-0 mt-1.5 w-52 bg-card border border-border rounded-lg shadow-lg z-50 py-2">
|
||||
<p className="px-3 pb-1.5 text-[11px] font-semibold text-muted-foreground uppercase tracking-wider">
|
||||
{t('table.toggleColumns', 'Toggle Columns')}
|
||||
</p>
|
||||
{orderedColumns.map((col) => (
|
||||
<div
|
||||
key={col.id}
|
||||
draggable
|
||||
onDragStart={() => handleDragStart(col.id)}
|
||||
onDragOver={(e) => handleDragOver(e, col.id)}
|
||||
onDrop={() => handleDrop(col.id)}
|
||||
onDragEnd={handleDragEnd}
|
||||
className={cn(
|
||||
'flex items-center gap-2.5 px-3 py-1.5 transition-colors cursor-default',
|
||||
'hover:bg-muted/40',
|
||||
dragOverId === col.id && 'bg-primary/10 border-l-2 border-primary'
|
||||
)}
|
||||
>
|
||||
<GripVertical
|
||||
size={13}
|
||||
className="text-muted-foreground cursor-grab shrink-0 active:cursor-grabbing"
|
||||
/>
|
||||
<input
|
||||
type="checkbox"
|
||||
id={`col-toggle-${col.id}`}
|
||||
checked={isVisible(col.id)}
|
||||
onChange={() => toggle(col.id)}
|
||||
className="w-4 h-4 rounded cursor-pointer accent-primary"
|
||||
/>
|
||||
<label
|
||||
htmlFor={`col-toggle-${col.id}`}
|
||||
className="text-sm text-foreground cursor-pointer flex-1 truncate select-none"
|
||||
>
|
||||
{col.label}
|
||||
</label>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
// ─── Date Filter Button ───────────────────────────────────────────────────────
|
||||
|
||||
function DateFilterButton() {
|
||||
return (
|
||||
<button
|
||||
className={cn(
|
||||
'flex items-center h-9 px-3 rounded-md border border-border',
|
||||
'text-muted-foreground bg-background',
|
||||
'hover:bg-muted/50 hover:text-foreground transition-colors'
|
||||
)}
|
||||
>
|
||||
<Clock size={14} />
|
||||
</button>
|
||||
)
|
||||
}
|
||||
|
||||
// ─── Filter Dropdown ──────────────────────────────────────────────────────────
|
||||
|
||||
interface FilterDropdownProps {
|
||||
filterFields: FilterField[]
|
||||
activeFilters: ActiveFilter[]
|
||||
onFilterChange: (fieldId: string, value: string) => void
|
||||
onFilterReset: () => void
|
||||
perPageOptions?: number[]
|
||||
perPage?: number
|
||||
onPerPageChange?: (value: number) => void
|
||||
}
|
||||
|
||||
function FilterDropdown({
|
||||
filterFields,
|
||||
activeFilters,
|
||||
onFilterChange,
|
||||
onFilterReset,
|
||||
perPageOptions = [10, 25, 50, 100],
|
||||
perPage = 25,
|
||||
onPerPageChange,
|
||||
}: FilterDropdownProps) {
|
||||
const { t } = useTranslation()
|
||||
const [open, setOpen] = useState(false)
|
||||
const ref = useRef<HTMLDivElement>(null)
|
||||
useOutsideClick(ref, () => setOpen(false))
|
||||
|
||||
const activeCount = activeFilters.filter((f) => f.value !== '').length
|
||||
const hasActive = activeCount > 0
|
||||
|
||||
const getActiveValue = (fieldId: string) =>
|
||||
activeFilters.find((f) => f.fieldId === fieldId)?.value ?? ''
|
||||
|
||||
return (
|
||||
<div ref={ref} className="relative">
|
||||
<button
|
||||
onClick={() => setOpen((v) => !v)}
|
||||
className={cn(
|
||||
'flex items-center gap-1.5 h-9 px-3 rounded-md border border-border',
|
||||
'text-muted-foreground bg-background',
|
||||
'hover:bg-muted/50 hover:text-foreground transition-colors',
|
||||
open && 'bg-muted/50 text-foreground border-ring',
|
||||
// emerald yerine primary token
|
||||
hasActive && 'border-primary text-primary'
|
||||
)}
|
||||
>
|
||||
<Filter size={14} />
|
||||
{hasActive && (
|
||||
<span className="text-xs font-semibold bg-primary text-primary-foreground rounded-full w-4 h-4 flex items-center justify-center leading-none">
|
||||
{activeCount}
|
||||
</span>
|
||||
)}
|
||||
<ChevronDown size={12} />
|
||||
</button>
|
||||
|
||||
{open && (
|
||||
<div className="absolute right-0 mt-1.5 w-64 bg-card border border-border rounded-lg shadow-lg z-50 py-3">
|
||||
<div className="flex items-center justify-between px-3 pb-2 border-b border-border mb-2">
|
||||
<p className="text-[11px] font-semibold text-muted-foreground uppercase tracking-wider">
|
||||
{t('table.filters', 'Filters')}
|
||||
</p>
|
||||
{hasActive && (
|
||||
<button
|
||||
onClick={onFilterReset}
|
||||
className="flex items-center gap-1 text-xs text-destructive hover:text-destructive/80 transition-colors"
|
||||
>
|
||||
<X size={11} />
|
||||
{t('table.reset', 'Reset')}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="px-3 space-y-3">
|
||||
{filterFields.map((field) => (
|
||||
<div key={field.id}>
|
||||
<label className="block text-[11px] font-semibold text-muted-foreground uppercase tracking-wider mb-1">
|
||||
{field.label}
|
||||
</label>
|
||||
<select
|
||||
value={getActiveValue(field.id)}
|
||||
onChange={(e) => onFilterChange(field.id, e.target.value)}
|
||||
className={cn(
|
||||
'w-full h-8 px-2 rounded-md border border-border bg-background',
|
||||
'text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-ring',
|
||||
'transition-colors appearance-none cursor-pointer'
|
||||
)}
|
||||
>
|
||||
<option value="">—</option>
|
||||
{field.options.map((opt) => (
|
||||
<option key={opt.value} value={opt.value}>
|
||||
{opt.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
))}
|
||||
|
||||
{onPerPageChange && (
|
||||
<div>
|
||||
<label className="block text-[11px] font-semibold text-muted-foreground uppercase tracking-wider mb-1">
|
||||
{t('table.perPage', 'Sahypa başyna')}
|
||||
</label>
|
||||
<select
|
||||
value={perPage}
|
||||
onChange={(e) => onPerPageChange(Number(e.target.value))}
|
||||
className={cn(
|
||||
'w-full h-8 px-2 rounded-md border border-border bg-background',
|
||||
'text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-ring',
|
||||
'transition-colors appearance-none cursor-pointer'
|
||||
)}
|
||||
>
|
||||
{perPageOptions.map((n) => (
|
||||
<option key={n} value={n}>
|
||||
{n}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
// ─── DataTableToolbar ─────────────────────────────────────────────────────────
|
||||
|
||||
export function DataTableToolbar({
|
||||
searchValue,
|
||||
onSearchChange,
|
||||
searchPlaceholder,
|
||||
columns,
|
||||
columnVisibility,
|
||||
onColumnVisibilityChange,
|
||||
columnOrder,
|
||||
onColumnOrderChange,
|
||||
filterFields = [],
|
||||
activeFilters = [],
|
||||
onFilterChange,
|
||||
onFilterReset,
|
||||
perPageOptions,
|
||||
perPage,
|
||||
onPerPageChange,
|
||||
actionLabel,
|
||||
onAction,
|
||||
hideSearch = false,
|
||||
hideAction = false,
|
||||
}: DataTableToolbarProps) {
|
||||
return (
|
||||
<div className={cn("flex items-center gap-3 mb-3", hideSearch ? "justify-end" : "justify-between")}>
|
||||
{!hideSearch && (
|
||||
<TableSearchInput
|
||||
value={searchValue}
|
||||
onChange={onSearchChange}
|
||||
placeholder={searchPlaceholder}
|
||||
/>
|
||||
)}
|
||||
|
||||
<div className="flex items-center gap-2">
|
||||
<ToggleColumnsDropdown
|
||||
columns={columns}
|
||||
columnVisibility={columnVisibility}
|
||||
onColumnVisibilityChange={onColumnVisibilityChange}
|
||||
columnOrder={columnOrder}
|
||||
onColumnOrderChange={onColumnOrderChange}
|
||||
/>
|
||||
|
||||
<DateFilterButton />
|
||||
|
||||
{filterFields.length > 0 && onFilterChange && onFilterReset && (
|
||||
<FilterDropdown
|
||||
filterFields={filterFields}
|
||||
activeFilters={activeFilters}
|
||||
onFilterChange={onFilterChange}
|
||||
onFilterReset={onFilterReset}
|
||||
perPageOptions={perPageOptions}
|
||||
perPage={perPage}
|
||||
onPerPageChange={onPerPageChange}
|
||||
/>
|
||||
)}
|
||||
|
||||
{!hideAction && actionLabel && onAction && (
|
||||
<TableActionButton label={actionLabel} onClick={onAction} />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
36
src/components/tableButton.tsx
Normal file
36
src/components/tableButton.tsx
Normal file
@@ -0,0 +1,36 @@
|
||||
import { Plus } from 'lucide-react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
interface TableActionButtonProps {
|
||||
label: string
|
||||
onClick: () => void
|
||||
icon?: React.ReactNode
|
||||
disabled?: boolean
|
||||
className?: string
|
||||
variant?: 'primary' | 'destructive' | 'secondary'
|
||||
}
|
||||
|
||||
export function TableActionButton({
|
||||
label,
|
||||
onClick,
|
||||
icon,
|
||||
disabled = false,
|
||||
className,
|
||||
variant = 'primary',
|
||||
}: TableActionButtonProps) {
|
||||
return (
|
||||
<Button
|
||||
onClick={onClick}
|
||||
disabled={disabled}
|
||||
variant={variant === 'destructive' ? 'destructive' : variant === 'secondary' ? 'secondary' : 'default'}
|
||||
className={cn(
|
||||
'font-medium text-sm h-9 px-4 transition-colors shadow-sm',
|
||||
className
|
||||
)}
|
||||
>
|
||||
{icon ?? <Plus size={15} className="mr-1.5" />}
|
||||
{label}
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
40
src/components/tableSearch.tsx
Normal file
40
src/components/tableSearch.tsx
Normal file
@@ -0,0 +1,40 @@
|
||||
import { Search } from 'lucide-react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
interface TableSearchInputProps {
|
||||
value: string
|
||||
onChange: (value: string) => void
|
||||
placeholder?: string
|
||||
className?: string
|
||||
}
|
||||
|
||||
export function TableSearchInput({
|
||||
value,
|
||||
onChange,
|
||||
placeholder,
|
||||
className,
|
||||
}: TableSearchInputProps) {
|
||||
const { t } = useTranslation()
|
||||
|
||||
return (
|
||||
<div className={cn('relative', className)}>
|
||||
<Search
|
||||
size={15}
|
||||
className="absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
value={value}
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
placeholder={placeholder ?? t('table.search', 'Search...')}
|
||||
className={cn(
|
||||
'h-9 w-64 rounded-md border border-border bg-background pl-9 pr-3',
|
||||
'text-sm text-foreground placeholder:text-muted-foreground',
|
||||
'focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent',
|
||||
'transition-colors'
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { cva } from "class-variance-authority"
|
||||
|
||||
export const buttonVariants = cva(
|
||||
"group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
||||
"group/button inline-flex shrink-0 cursor-pointer items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
|
||||
@@ -8,7 +8,7 @@ function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
||||
type={type}
|
||||
data-slot="input"
|
||||
className={cn(
|
||||
"h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
|
||||
"h-8 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
|
||||
@@ -4,7 +4,7 @@ import * as React from "react"
|
||||
import { cva, type VariantProps } from "class-variance-authority"
|
||||
import { Slot } from "radix-ui"
|
||||
|
||||
import { useIsMobile } from "@/hooks/use-mobile"
|
||||
import { useIsMobile } from "@/lib/hooks/useMobile"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Input } from "@/components/ui/input"
|
||||
|
||||
33
src/components/ui/statusBadge.tsx
Normal file
33
src/components/ui/statusBadge.tsx
Normal file
@@ -0,0 +1,33 @@
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
export type StatusBadgeVariant = 'warning' | 'success' | 'error' | 'info' | 'default'
|
||||
|
||||
interface StatusBadgeProps {
|
||||
label: string
|
||||
variant: StatusBadgeVariant
|
||||
icon?: React.ElementType
|
||||
className?: string
|
||||
}
|
||||
|
||||
const VARIANT_STYLES: Record<StatusBadgeVariant, string> = {
|
||||
warning: 'bg-amber-500/15 text-amber-500 border-amber-500/30',
|
||||
success: 'bg-emerald-500/15 text-emerald-500 border-emerald-500/30',
|
||||
error: 'bg-red-500/15 text-red-500 border-red-500/30',
|
||||
info: 'bg-blue-500/15 text-blue-500 border-blue-500/30',
|
||||
default: 'bg-muted/50 text-muted-foreground border-border',
|
||||
}
|
||||
|
||||
export function StatusBadge({ label, variant, icon: Icon, className }: StatusBadgeProps) {
|
||||
return (
|
||||
<span
|
||||
className={cn(
|
||||
'inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md text-[11px] font-bold border whitespace-nowrap',
|
||||
VARIANT_STYLES[variant],
|
||||
className
|
||||
)}
|
||||
>
|
||||
{Icon && <Icon size={11} />}
|
||||
{label}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
114
src/components/ui/table.tsx
Normal file
114
src/components/ui/table.tsx
Normal file
@@ -0,0 +1,114 @@
|
||||
import * as React from "react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
function Table({ className, ...props }: React.ComponentProps<"table">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="table-container"
|
||||
className="relative w-full overflow-x-auto"
|
||||
>
|
||||
<table
|
||||
data-slot="table"
|
||||
className={cn("w-full caption-bottom text-sm", className)}
|
||||
{...props}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function TableHeader({ className, ...props }: React.ComponentProps<"thead">) {
|
||||
return (
|
||||
<thead
|
||||
data-slot="table-header"
|
||||
className={cn("[&_tr]:border-b", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function TableBody({ className, ...props }: React.ComponentProps<"tbody">) {
|
||||
return (
|
||||
<tbody
|
||||
data-slot="table-body"
|
||||
className={cn("[&_tr:last-child]:border-0", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) {
|
||||
return (
|
||||
<tfoot
|
||||
data-slot="table-footer"
|
||||
className={cn(
|
||||
"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
|
||||
return (
|
||||
<tr
|
||||
data-slot="table-row"
|
||||
className={cn(
|
||||
"border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function TableHead({ className, ...props }: React.ComponentProps<"th">) {
|
||||
return (
|
||||
<th
|
||||
data-slot="table-head"
|
||||
className={cn(
|
||||
"h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function TableCell({ className, ...props }: React.ComponentProps<"td">) {
|
||||
return (
|
||||
<td
|
||||
data-slot="table-cell"
|
||||
className={cn(
|
||||
"p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function TableCaption({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<"caption">) {
|
||||
return (
|
||||
<caption
|
||||
data-slot="table-caption"
|
||||
className={cn("mt-4 text-sm text-muted-foreground", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export {
|
||||
Table,
|
||||
TableHeader,
|
||||
TableBody,
|
||||
TableFooter,
|
||||
TableHead,
|
||||
TableRow,
|
||||
TableCell,
|
||||
TableCaption,
|
||||
}
|
||||
@@ -48,7 +48,7 @@ function TooltipContent({
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
<TooltipPrimitive.Arrow className="z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" />
|
||||
<TooltipPrimitive.Arrow className="z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" />
|
||||
</TooltipPrimitive.Content>
|
||||
</TooltipPrimitive.Portal>
|
||||
)
|
||||
|
||||
@@ -13,8 +13,8 @@ export interface LoginResponse {
|
||||
// Mock credentials
|
||||
const MOCK_USERS: Array<{ email: string; password: string; user: AuthUser; token: string }> = [
|
||||
{
|
||||
email: 'admin@tbbank.tm',
|
||||
password: 'Admin123!',
|
||||
email: 'jelaletdin',
|
||||
password: '123',
|
||||
token: 'mock-jwt-token-admin-xyz123',
|
||||
user: {
|
||||
id: '1',
|
||||
|
||||
105
src/features/loanOrderMobiles/api/loanOrderMobilesApi.ts
Normal file
105
src/features/loanOrderMobiles/api/loanOrderMobilesApi.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
import { apiClient } from '@/lib/api/client'
|
||||
|
||||
// ─── Types ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
export type LoanOrderMobileStatus =
|
||||
| 'GARAŞYLÝAR'
|
||||
| 'KANAGATLANDYRYLAN'
|
||||
| 'RED_EDILDI'
|
||||
| 'IŞLENÝÄR'
|
||||
|
||||
export interface LoanOrderMobile {
|
||||
id: string
|
||||
loanType: string
|
||||
createdAt: string
|
||||
region: string
|
||||
branch: string
|
||||
firstName: string
|
||||
lastName: string
|
||||
phone: string
|
||||
status: LoanOrderMobileStatus
|
||||
}
|
||||
|
||||
export interface LoanOrderMobileListParams {
|
||||
search?: string
|
||||
region?: string
|
||||
status?: LoanOrderMobileStatus
|
||||
branch?: string
|
||||
archived?: string
|
||||
page?: number
|
||||
perPage?: number
|
||||
}
|
||||
|
||||
export interface PaginatedResponse<T> {
|
||||
data: T[]
|
||||
total: number
|
||||
}
|
||||
|
||||
// ─── Mock Data ─────────────────────────────────────────────────────────────────
|
||||
|
||||
const USE_MOCK = true // gerçek API hazır olunca false yap
|
||||
|
||||
const MOCK_DATA: LoanOrderMobile[] = [
|
||||
{ id: 'LOM-0001', loanType: 'Sarp etmek karzy', createdAt: '2025-01-15 09:42', region: 'Aşgabat', branch: 'Merkezi', firstName: 'Oraz', lastName: 'Annaýew', phone: '+99361123456', status: 'GARAŞYLÝAR' },
|
||||
{ id: 'LOM-0002', loanType: 'Awtoulag karzy', createdAt: '2025-01-18 11:05', region: 'Ahal', branch: 'Änew', firstName: 'Merjen', lastName: 'Hudaýewa', phone: '+99362234567', status: 'KANAGATLANDYRYLAN' },
|
||||
{ id: 'LOM-0003', loanType: 'Ipoteka karzy', createdAt: '2025-01-20 14:30', region: 'Balkan', branch: 'Türkmenbaşy', firstName: 'Serdar', lastName: 'Durdyýew', phone: '+99363345678', status: 'IŞLENÝÄR' },
|
||||
{ id: 'LOM-0004', loanType: 'Telekeçilik karzy', createdAt: '2025-01-22 08:15', region: 'Lebap', branch: 'Türkmenabat', firstName: 'Aýna', lastName: 'Meredowa', phone: '+99365456789', status: 'RED_EDILDI' },
|
||||
{ id: 'LOM-0005', loanType: 'Sarp etmek karzy', createdAt: '2025-01-25 16:00', region: 'Mary', branch: 'Mary', firstName: 'Begmyrat',lastName: 'Oraz', phone: '+99366567890', status: 'GARAŞYLÝAR' },
|
||||
{ id: 'LOM-0006', loanType: 'Bilim karzy', createdAt: '2025-01-28 10:20', region: 'Daşoguz', branch: 'Daşoguz', firstName: 'Gülälek', lastName: 'Saparowa', phone: '+99361678901', status: 'KANAGATLANDYRYLAN' },
|
||||
{ id: 'LOM-0007', loanType: 'Awtoulag karzy', createdAt: '2025-02-01 13:45', region: 'Aşgabat', branch: 'Çoganly', firstName: 'Myrat', lastName: 'Ataýew', phone: '+99362789012', status: 'IŞLENÝÄR' },
|
||||
{ id: 'LOM-0008', loanType: 'Ipoteka karzy', createdAt: '2025-02-03 09:00', region: 'Ahal', branch: 'Tejen', firstName: 'Ogulnur', lastName: 'Berdiýewa', phone: '+99363890123', status: 'GARAŞYLÝAR' },
|
||||
{ id: 'LOM-0009', loanType: 'Telekeçilik karzy', createdAt: '2025-02-05 15:30', region: 'Balkan', branch: 'Balkanabat', firstName: 'Döwlet', lastName: 'Çaryýew', phone: '+99364901234', status: 'RED_EDILDI' },
|
||||
{ id: 'LOM-0010', loanType: 'Sarp etmek karzy', createdAt: '2025-02-08 11:15', region: 'Lebap', branch: 'Farap', firstName: 'Maral', lastName: 'Ýollyýewa', phone: '+99365012345', status: 'KANAGATLANDYRYLAN' },
|
||||
{ id: 'LOM-0011', loanType: 'Bilim karzy', createdAt: '2025-02-10 08:45', region: 'Mary', branch: 'Baýramaly', firstName: 'Nurmuhammet', lastName: 'Garaýew', phone: '+99366123456', status: 'GARAŞYLÝAR' },
|
||||
{ id: 'LOM-0012', loanType: 'Awtoulag karzy', createdAt: '2025-02-12 14:00', region: 'Daşoguz', branch: 'Köneürgenç', firstName: 'Şemşat', lastName: 'Jumaýewa', phone: '+99361234567', status: 'IŞLENÝÄR' },
|
||||
]
|
||||
|
||||
function applyMockFilters(
|
||||
params: LoanOrderMobileListParams,
|
||||
): PaginatedResponse<LoanOrderMobile> {
|
||||
let result = [...MOCK_DATA]
|
||||
|
||||
if (params.search) {
|
||||
const q = params.search.toLowerCase()
|
||||
result = result.filter(
|
||||
(r) =>
|
||||
r.firstName.toLowerCase().includes(q) ||
|
||||
r.lastName.toLowerCase().includes(q) ||
|
||||
r.phone.includes(q) ||
|
||||
r.id.toLowerCase().includes(q),
|
||||
)
|
||||
}
|
||||
if (params.region) result = result.filter((r) => r.region === params.region)
|
||||
if (params.status) result = result.filter((r) => r.status === params.status)
|
||||
if (params.branch) result = result.filter((r) => r.branch === params.branch)
|
||||
|
||||
const total = result.length
|
||||
const page = params.page ?? 1
|
||||
const perPage = params.perPage ?? 25
|
||||
const start = (page - 1) * perPage
|
||||
|
||||
return { data: result.slice(start, start + perPage), total }
|
||||
}
|
||||
|
||||
// ─── API Functions ─────────────────────────────────────────────────────────────
|
||||
|
||||
export async function fetchLoanOrderMobiles(
|
||||
params: LoanOrderMobileListParams,
|
||||
): Promise<PaginatedResponse<LoanOrderMobile>> {
|
||||
if (USE_MOCK) return applyMockFilters(params)
|
||||
|
||||
const { data } = await apiClient.get<PaginatedResponse<LoanOrderMobile>>(
|
||||
'/loan-order-mobiles',
|
||||
{ params },
|
||||
)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function deleteLoanOrderMobile(id: string): Promise<void> {
|
||||
if (USE_MOCK) {
|
||||
const idx = MOCK_DATA.findIndex((r) => r.id === id)
|
||||
if (idx !== -1) MOCK_DATA.splice(idx, 1)
|
||||
return
|
||||
}
|
||||
await apiClient.delete(`/loan-order-mobiles/${id}`)
|
||||
}
|
||||
42
src/features/loanOrderMobiles/hooks/useLoanOrderMobiles.ts
Normal file
42
src/features/loanOrderMobiles/hooks/useLoanOrderMobiles.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
|
||||
import { toast } from 'sonner'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
import {
|
||||
fetchLoanOrderMobiles,
|
||||
deleteLoanOrderMobile,
|
||||
type LoanOrderMobileListParams,
|
||||
} from '../api/loanOrderMobilesApi'
|
||||
|
||||
// ─── Query keys ────────────────────────────────────────────────────────────────
|
||||
|
||||
export const loanOrderMobileKeys = {
|
||||
all: ['loanOrderMobiles'] as const,
|
||||
lists: () => [...loanOrderMobileKeys.all, 'list'] as const,
|
||||
list: (params: LoanOrderMobileListParams) => [...loanOrderMobileKeys.lists(), params] as const,
|
||||
}
|
||||
|
||||
// ─── Hooks ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
export function useLoanOrderMobiles(params: LoanOrderMobileListParams) {
|
||||
return useQuery({
|
||||
queryKey: loanOrderMobileKeys.list(params),
|
||||
queryFn: () => fetchLoanOrderMobiles(params),
|
||||
})
|
||||
}
|
||||
|
||||
export function useDeleteLoanOrderMobile() {
|
||||
const queryClient = useQueryClient()
|
||||
const { t } = useTranslation()
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (id: string) => deleteLoanOrderMobile(id),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: loanOrderMobileKeys.lists() })
|
||||
toast.success(t('loanOrderMobiles.deleteSuccess', 'Sargyt üstünlikli pozuldy'))
|
||||
},
|
||||
onError: () => {
|
||||
toast.error(t('loanOrderMobiles.deleteError', 'Pozmak başartmady, gaýtadan synanyşyň'))
|
||||
},
|
||||
})
|
||||
}
|
||||
162
src/features/loanOrders/api/loanOrdersApi.ts
Normal file
162
src/features/loanOrders/api/loanOrdersApi.ts
Normal file
@@ -0,0 +1,162 @@
|
||||
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',
|
||||
},
|
||||
{
|
||||
id: 'L-1003',
|
||||
loanType: 'Biznes karzy',
|
||||
createdAt: '2024-03-18 09:00',
|
||||
region: 'Lebap',
|
||||
branch: 'Türkmenabat şahamçasy',
|
||||
firstName: 'Myrat',
|
||||
lastName: 'Hallyýew',
|
||||
phone: '+993 64 778899',
|
||||
status: 'KANAGATLANDYRYLAN',
|
||||
},
|
||||
{
|
||||
id: 'L-1004',
|
||||
loanType: 'Talyp karzy',
|
||||
createdAt: '2024-03-17 16:45',
|
||||
region: 'Balkan',
|
||||
branch: 'Türkmenbaşy şahamçasy',
|
||||
firstName: 'Jeren',
|
||||
lastName: 'Saparowa',
|
||||
phone: '+993 62 001122',
|
||||
status: 'RED_EDILDI',
|
||||
},
|
||||
{
|
||||
id: 'L-1005',
|
||||
loanType: 'Awtoulag karzy',
|
||||
createdAt: '2024-03-16 11:20',
|
||||
region: 'Daşoguz',
|
||||
branch: 'Daşoguz-2 şahamçasy',
|
||||
firstName: 'Döwlet',
|
||||
lastName: 'Meredow',
|
||||
phone: '+993 63 334455',
|
||||
status: 'GARAŞYLÝAR',
|
||||
}
|
||||
];
|
||||
|
||||
// ─── Types ───────────────────────────────────────────────────────────────────
|
||||
|
||||
export type LoanOrderStatus =
|
||||
| 'GARAŞYLÝAR'
|
||||
| 'KANAGATLANDYRYLAN'
|
||||
| 'RED_EDILDI'
|
||||
| 'IŞLENÝÄR'
|
||||
|
||||
export interface LoanOrder {
|
||||
id: string
|
||||
loanType: string
|
||||
createdAt: string
|
||||
region: string
|
||||
branch: string
|
||||
firstName: string
|
||||
lastName: string
|
||||
phone: string
|
||||
status: LoanOrderStatus
|
||||
}
|
||||
|
||||
export interface LoanOrdersParams {
|
||||
search?: string
|
||||
region?: string
|
||||
status?: LoanOrderStatus | ''
|
||||
branch?: string
|
||||
archived?: string
|
||||
page?: number
|
||||
perPage?: number
|
||||
}
|
||||
|
||||
export interface LoanOrdersResponse {
|
||||
data: LoanOrder[]
|
||||
total: number
|
||||
page: number
|
||||
perPage: number
|
||||
}
|
||||
|
||||
export interface CreateLoanOrderPayload {
|
||||
loanType: string
|
||||
region: string
|
||||
branch: string
|
||||
firstName: string
|
||||
lastName: string
|
||||
phone: string
|
||||
}
|
||||
|
||||
// ─── API Functions ────────────────────────────────────────────────────────────
|
||||
|
||||
export async function fetchLoanOrders(
|
||||
params: LoanOrdersParams
|
||||
): Promise<LoanOrdersResponse> {
|
||||
// Hakyky API ýok wagty simulator (800ms garaşdyrýar)
|
||||
await new Promise((resolve) => setTimeout(resolve, 800));
|
||||
|
||||
// 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())
|
||||
);
|
||||
|
||||
return {
|
||||
data: filtered,
|
||||
total: filtered.length,
|
||||
page: params.page || 1,
|
||||
perPage: params.perPage || 25,
|
||||
};}
|
||||
|
||||
// export async function fetchLoanOrders(
|
||||
// params: LoanOrdersParams
|
||||
// ): Promise<LoanOrdersResponse> {
|
||||
// const { data } = await apiClient.get<LoanOrdersResponse>(
|
||||
// '/resources/loan-orders',
|
||||
// { params }
|
||||
// )
|
||||
// return data
|
||||
// }
|
||||
|
||||
export async function createLoanOrder(
|
||||
payload: CreateLoanOrderPayload
|
||||
): Promise<LoanOrder> {
|
||||
const { data } = await apiClient.post<LoanOrder>(
|
||||
'/resources/loan-orders',
|
||||
payload
|
||||
)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function updateLoanOrder(
|
||||
id: string,
|
||||
payload: Partial<CreateLoanOrderPayload>
|
||||
): Promise<LoanOrder> {
|
||||
const { data } = await apiClient.put<LoanOrder>(
|
||||
`/resources/loan-orders/${id}`,
|
||||
payload
|
||||
)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function deleteLoanOrder(id: string): Promise<void> {
|
||||
await apiClient.delete(`/resources/loan-orders/${id}`)
|
||||
}
|
||||
25
src/features/loanOrders/components/loanOrderStatusBadge.tsx
Normal file
25
src/features/loanOrders/components/loanOrderStatusBadge.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import { AlertCircle, CheckCircle2, XCircle, Loader2 } from 'lucide-react'
|
||||
import { StatusBadge, type StatusBadgeVariant } from '@/components/ui/statusBadge'
|
||||
import type { LoanOrderStatus } from '../api/loanOrdersApi'
|
||||
|
||||
interface LoanOrderStatusConfig {
|
||||
label: string
|
||||
variant: StatusBadgeVariant
|
||||
icon: React.ElementType
|
||||
}
|
||||
|
||||
const STATUS_CONFIG: Record<LoanOrderStatus, LoanOrderStatusConfig> = {
|
||||
GARAŞYLÝAR: { label: 'GARAŞYLÝAR', variant: 'warning', icon: AlertCircle },
|
||||
KANAGATLANDYRYLAN: { label: 'KANAGATLANDYRYLAN', variant: 'success', icon: CheckCircle2 },
|
||||
RED_EDILDI: { label: 'RED EDILDI', variant: 'error', icon: XCircle },
|
||||
IŞLENÝÄR: { label: 'IŞLENÝÄR', variant: 'info', icon: Loader2 },
|
||||
}
|
||||
|
||||
interface LoanOrderStatusBadgeProps {
|
||||
status: LoanOrderStatus
|
||||
}
|
||||
|
||||
export function LoanOrderStatusBadge({ status }: LoanOrderStatusBadgeProps) {
|
||||
const config = STATUS_CONFIG[status]
|
||||
return <StatusBadge label={config.label} variant={config.variant} icon={config.icon} />
|
||||
}
|
||||
70
src/features/loanOrders/hooks/useLoanOrders.ts
Normal file
70
src/features/loanOrders/hooks/useLoanOrders.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
|
||||
import { toast } from 'sonner'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import {
|
||||
fetchLoanOrders,
|
||||
createLoanOrder,
|
||||
updateLoanOrder,
|
||||
deleteLoanOrder,
|
||||
type LoanOrdersParams,
|
||||
type CreateLoanOrderPayload,
|
||||
} from '../api/loanOrdersApi'
|
||||
|
||||
const LOAN_ORDERS_KEY = 'loan-orders'
|
||||
|
||||
export function useLoanOrders(params: LoanOrdersParams) {
|
||||
return useQuery({
|
||||
queryKey: [LOAN_ORDERS_KEY, params],
|
||||
queryFn: () => fetchLoanOrders(params),
|
||||
placeholderData: (prev) => prev,
|
||||
})
|
||||
}
|
||||
|
||||
export function useCreateLoanOrder() {
|
||||
const { t } = useTranslation()
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (payload: CreateLoanOrderPayload) => createLoanOrder(payload),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: [LOAN_ORDERS_KEY] })
|
||||
toast.success(t('loanOrders.createSuccess', 'Karz sargyt üstünlikli döredildi'))
|
||||
},
|
||||
onError: () => {
|
||||
toast.error(t('loanOrders.createError', 'Karz sargyt döretmekde säwlik ýüze çykdy'))
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export function useUpdateLoanOrder() {
|
||||
const { t } = useTranslation()
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation({
|
||||
mutationFn: ({ id, payload }: { id: string; payload: Partial<CreateLoanOrderPayload> }) =>
|
||||
updateLoanOrder(id, payload),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: [LOAN_ORDERS_KEY] })
|
||||
toast.success(t('loanOrders.updateSuccess', 'Karz sargyt üstünlikli üýtgedildi'))
|
||||
},
|
||||
onError: () => {
|
||||
toast.error(t('loanOrders.updateError', 'Karz sargyt üýtgetmekde säwlik ýüze çykdy'))
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export function useDeleteLoanOrder() {
|
||||
const { t } = useTranslation()
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (id: string) => deleteLoanOrder(id),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: [LOAN_ORDERS_KEY] })
|
||||
toast.success(t('loanOrders.deleteSuccess', 'Karz sargyt üstünlikli pozuldy'))
|
||||
},
|
||||
onError: () => {
|
||||
toast.error(t('loanOrders.deleteError', 'Karz sargyt pozmakda säwlik ýüze çykdy'))
|
||||
},
|
||||
})
|
||||
}
|
||||
84
src/features/loanPaidOffLetters/api/loanPaidOffLettersApi.ts
Normal file
84
src/features/loanPaidOffLetters/api/loanPaidOffLettersApi.ts
Normal file
@@ -0,0 +1,84 @@
|
||||
import { apiClient } from '@/lib/api/client'
|
||||
|
||||
// ─── Types ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
export interface LoanPaidOffLetter {
|
||||
id: number
|
||||
passportSeries: string
|
||||
passportNumber: string
|
||||
loanAccount: string
|
||||
issuedAt: string
|
||||
}
|
||||
|
||||
export interface LoanPaidOffLetterListParams {
|
||||
search?: string
|
||||
page?: number
|
||||
perPage?: number
|
||||
}
|
||||
|
||||
export interface PaginatedResponse<T> {
|
||||
data: T[]
|
||||
total: number
|
||||
}
|
||||
|
||||
// ─── Mock Data ─────────────────────────────────────────────────────────────────
|
||||
|
||||
const USE_MOCK = true
|
||||
|
||||
const MOCK_DATA: LoanPaidOffLetter[] = [
|
||||
{ id: 1, passportSeries: 'TM', passportNumber: 'A123456', loanAccount: 'LOAN-2024-001', issuedAt: '2025-01-10' },
|
||||
{ id: 2, passportSeries: 'TM', passportNumber: 'B234567', loanAccount: 'LOAN-2024-002', issuedAt: '2025-01-14' },
|
||||
{ id: 3, passportSeries: 'TM', passportNumber: 'C345678', loanAccount: 'LOAN-2024-003', issuedAt: '2025-01-17' },
|
||||
{ id: 4, passportSeries: 'TM', passportNumber: 'D456789', loanAccount: 'LOAN-2023-115', issuedAt: '2025-01-20' },
|
||||
{ id: 5, passportSeries: 'TM', passportNumber: 'E567890', loanAccount: 'LOAN-2023-116', issuedAt: '2025-01-23' },
|
||||
{ id: 6, passportSeries: 'TM', passportNumber: 'F678901', loanAccount: 'LOAN-2024-044', issuedAt: '2025-01-27' },
|
||||
{ id: 7, passportSeries: 'TM', passportNumber: 'G789012', loanAccount: 'LOAN-2024-055', issuedAt: '2025-02-01' },
|
||||
{ id: 8, passportSeries: 'TM', passportNumber: 'H890123', loanAccount: 'LOAN-2024-066', issuedAt: '2025-02-05' },
|
||||
{ id: 9, passportSeries: 'TM', passportNumber: 'I901234', loanAccount: 'LOAN-2024-077', issuedAt: '2025-02-09' },
|
||||
{ id: 10, passportSeries: 'TM', passportNumber: 'J012345', loanAccount: 'LOAN-2024-088', issuedAt: '2025-02-12' },
|
||||
]
|
||||
|
||||
function applyMockFilters(
|
||||
params: LoanPaidOffLetterListParams,
|
||||
): PaginatedResponse<LoanPaidOffLetter> {
|
||||
let result = [...MOCK_DATA]
|
||||
|
||||
if (params.search) {
|
||||
const q = params.search.toLowerCase()
|
||||
result = result.filter(
|
||||
(r) =>
|
||||
r.passportNumber.toLowerCase().includes(q) ||
|
||||
r.loanAccount.toLowerCase().includes(q),
|
||||
)
|
||||
}
|
||||
|
||||
const total = result.length
|
||||
const page = params.page ?? 1
|
||||
const perPage = params.perPage ?? 25
|
||||
const start = (page - 1) * perPage
|
||||
|
||||
return { data: result.slice(start, start + perPage), total }
|
||||
}
|
||||
|
||||
// ─── API Functions ─────────────────────────────────────────────────────────────
|
||||
|
||||
export async function fetchLoanPaidOffLetters(
|
||||
params: LoanPaidOffLetterListParams,
|
||||
): Promise<PaginatedResponse<LoanPaidOffLetter>> {
|
||||
if (USE_MOCK) return applyMockFilters(params)
|
||||
|
||||
const { data } = await apiClient.get<PaginatedResponse<LoanPaidOffLetter>>(
|
||||
'/loan-paid-off-letter-orders',
|
||||
{ params },
|
||||
)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function deleteLoanPaidOffLetter(id: number): Promise<void> {
|
||||
if (USE_MOCK) {
|
||||
const idx = MOCK_DATA.findIndex((r) => r.id === id)
|
||||
if (idx !== -1) MOCK_DATA.splice(idx, 1)
|
||||
return
|
||||
}
|
||||
await apiClient.delete(`/loan-paid-off-letter-orders/${id}`)
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
|
||||
import { toast } from 'sonner'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
import {
|
||||
fetchLoanPaidOffLetters,
|
||||
deleteLoanPaidOffLetter,
|
||||
type LoanPaidOffLetterListParams,
|
||||
} from '../api/loanPaidOffLettersApi'
|
||||
|
||||
// ─── Query keys ────────────────────────────────────────────────────────────────
|
||||
|
||||
export const loanPaidOffLetterKeys = {
|
||||
all: ['loanPaidOffLetters'] as const,
|
||||
lists: () => [...loanPaidOffLetterKeys.all, 'list'] as const,
|
||||
list: (params: LoanPaidOffLetterListParams) =>
|
||||
[...loanPaidOffLetterKeys.lists(), params] as const,
|
||||
}
|
||||
|
||||
// ─── Hooks ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
export function useLoanPaidOffLetters(params: LoanPaidOffLetterListParams) {
|
||||
return useQuery({
|
||||
queryKey: loanPaidOffLetterKeys.list(params),
|
||||
queryFn: () => fetchLoanPaidOffLetters(params),
|
||||
})
|
||||
}
|
||||
|
||||
export function useDeleteLoanPaidOffLetter() {
|
||||
const queryClient = useQueryClient()
|
||||
const { t } = useTranslation()
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (id: number) => deleteLoanPaidOffLetter(id),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: loanPaidOffLetterKeys.lists() })
|
||||
toast.success(t('loanPaidOffLetters.deleteSuccess', 'Güwanama üstünlikli pozuldy'))
|
||||
},
|
||||
onError: () => {
|
||||
toast.error(t('loanPaidOffLetters.deleteError', 'Pozmak başartmady, gaýtadan synanyşyň'))
|
||||
},
|
||||
})
|
||||
}
|
||||
83
src/features/loanRemaining/api/loanRemainingApi.ts
Normal file
83
src/features/loanRemaining/api/loanRemainingApi.ts
Normal file
@@ -0,0 +1,83 @@
|
||||
import { apiClient } from '@/lib/api/client'
|
||||
|
||||
// ─── Types ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
export interface LoanRemaining {
|
||||
id: number
|
||||
passportSeries: string
|
||||
passportNumber: string
|
||||
loanAccount: string
|
||||
}
|
||||
|
||||
export interface LoanRemainingListParams {
|
||||
search?: string
|
||||
page?: number
|
||||
perPage?: number
|
||||
}
|
||||
|
||||
export interface PaginatedResponse<T> {
|
||||
data: T[]
|
||||
total: number
|
||||
}
|
||||
|
||||
// ─── Mock Data ─────────────────────────────────────────────────────────────────
|
||||
|
||||
const USE_MOCK = true
|
||||
|
||||
const MOCK_DATA: LoanRemaining[] = [
|
||||
{ id: 1, passportSeries: 'TM', passportNumber: 'A111111', loanAccount: 'NOVA-2024-001' },
|
||||
{ id: 2, passportSeries: 'TM', passportNumber: 'B222222', loanAccount: 'NOVA-2024-002' },
|
||||
{ id: 3, passportSeries: 'TM', passportNumber: 'C333333', loanAccount: 'NOVA-2023-078' },
|
||||
{ id: 4, passportSeries: 'TM', passportNumber: 'D444444', loanAccount: 'NOVA-2023-079' },
|
||||
{ id: 5, passportSeries: 'TM', passportNumber: 'E555555', loanAccount: 'NOVA-2024-033' },
|
||||
{ id: 6, passportSeries: 'TM', passportNumber: 'F666666', loanAccount: 'NOVA-2024-034' },
|
||||
{ id: 7, passportSeries: 'TM', passportNumber: 'G777777', loanAccount: 'NOVA-2024-051' },
|
||||
{ id: 8, passportSeries: 'TM', passportNumber: 'H888888', loanAccount: 'NOVA-2024-052' },
|
||||
{ id: 9, passportSeries: 'TM', passportNumber: 'I999999', loanAccount: 'NOVA-2024-063' },
|
||||
{ id: 10, passportSeries: 'TM', passportNumber: 'J000000', loanAccount: 'NOVA-2024-064' },
|
||||
]
|
||||
|
||||
function applyMockFilters(
|
||||
params: LoanRemainingListParams,
|
||||
): PaginatedResponse<LoanRemaining> {
|
||||
let result = [...MOCK_DATA]
|
||||
|
||||
if (params.search) {
|
||||
const q = params.search.toLowerCase()
|
||||
result = result.filter(
|
||||
(r) =>
|
||||
r.passportNumber.toLowerCase().includes(q) ||
|
||||
r.loanAccount.toLowerCase().includes(q),
|
||||
)
|
||||
}
|
||||
|
||||
const total = result.length
|
||||
const page = params.page ?? 1
|
||||
const perPage = params.perPage ?? 25
|
||||
const start = (page - 1) * perPage
|
||||
|
||||
return { data: result.slice(start, start + perPage), total }
|
||||
}
|
||||
|
||||
// ─── API Functions ─────────────────────────────────────────────────────────────
|
||||
|
||||
export async function fetchLoanRemaining(
|
||||
params: LoanRemainingListParams,
|
||||
): Promise<PaginatedResponse<LoanRemaining>> {
|
||||
if (USE_MOCK) return applyMockFilters(params)
|
||||
|
||||
const { data } = await apiClient.get<PaginatedResponse<LoanRemaining>>(
|
||||
'/nova-loan-remaining-orders',
|
||||
{ params },
|
||||
)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function deleteLoanRemaining(id: number): Promise<void> {
|
||||
if (USE_MOCK) {
|
||||
const idx = MOCK_DATA.findIndex((r) => r.id === id)
|
||||
if (idx !== -1) MOCK_DATA.splice(idx, 1)
|
||||
return
|
||||
}
|
||||
await apiClient.delete(`/nova-loan-remaining-orders/${id}`)
|
||||
}
|
||||
42
src/features/loanRemaining/hooks/useLoanRemaining.ts
Normal file
42
src/features/loanRemaining/hooks/useLoanRemaining.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
|
||||
import { toast } from 'sonner'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
import {
|
||||
fetchLoanRemaining,
|
||||
deleteLoanRemaining,
|
||||
type LoanRemainingListParams,
|
||||
} from '../api/loanRemainingApi'
|
||||
|
||||
// ─── Query keys ────────────────────────────────────────────────────────────────
|
||||
|
||||
export const loanRemainingKeys = {
|
||||
all: ['loanRemaining'] as const,
|
||||
lists: () => [...loanRemainingKeys.all, 'list'] as const,
|
||||
list: (params: LoanRemainingListParams) => [...loanRemainingKeys.lists(), params] as const,
|
||||
}
|
||||
|
||||
// ─── Hooks ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
export function useLoanRemaining(params: LoanRemainingListParams) {
|
||||
return useQuery({
|
||||
queryKey: loanRemainingKeys.list(params),
|
||||
queryFn: () => fetchLoanRemaining(params),
|
||||
})
|
||||
}
|
||||
|
||||
export function useDeleteLoanRemaining() {
|
||||
const queryClient = useQueryClient()
|
||||
const { t } = useTranslation()
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (id: number) => deleteLoanRemaining(id),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: loanRemainingKeys.lists() })
|
||||
toast.success(t('loanRemaining.deleteSuccess', 'Ýazgy üstünlikli pozuldy'))
|
||||
},
|
||||
onError: () => {
|
||||
toast.error(t('loanRemaining.deleteError', 'Pozmak başartmady, gaýtadan synanyşyň'))
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -148,49 +148,12 @@ body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2 {
|
||||
font-family: var(--heading);
|
||||
font-weight: 500;
|
||||
color: var(--text-h);
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 56px;
|
||||
letter-spacing: -1.68px;
|
||||
margin: 32px 0;
|
||||
@media (max-width: 1024px) {
|
||||
font-size: 36px;
|
||||
margin: 20px 0;
|
||||
}
|
||||
}
|
||||
h2 {
|
||||
font-size: 24px;
|
||||
line-height: 118%;
|
||||
letter-spacing: -0.24px;
|
||||
margin: 0 0 8px;
|
||||
@media (max-width: 1024px) {
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
code,
|
||||
.counter {
|
||||
font-family: var(--mono);
|
||||
display: inline-flex;
|
||||
border-radius: 4px;
|
||||
color: var(--text-h);
|
||||
}
|
||||
|
||||
code {
|
||||
font-size: 15px;
|
||||
line-height: 135%;
|
||||
padding: 4px 8px;
|
||||
background: var(--code-bg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@theme inline {
|
||||
--font-heading: var(--font-sans);
|
||||
|
||||
@@ -1,126 +0,0 @@
|
||||
import type { ReactNode } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useThemeStore } from '@/app/store/themeStore'
|
||||
import { useI18nStore } from '@/app/store/i18nStore'
|
||||
import type { SupportedLanguage } from '@/lib/i18n'
|
||||
|
||||
const LANG_LABELS: Record<SupportedLanguage, string> = {
|
||||
en: 'EN',
|
||||
ru: 'RU',
|
||||
tk: 'TK',
|
||||
}
|
||||
|
||||
interface AuthLayoutProps {
|
||||
children: ReactNode
|
||||
}
|
||||
|
||||
export function AuthLayout({ children }: AuthLayoutProps) {
|
||||
const { t } = useTranslation()
|
||||
const { theme, toggleTheme } = useThemeStore()
|
||||
const { language, setLanguage } = useI18nStore()
|
||||
|
||||
return (
|
||||
<div className="min-h-dvh relative flex items-center justify-center overflow-hidden
|
||||
bg-[var(--bg-base)] transition-colors duration-[var(--transition-slow)]">
|
||||
|
||||
{/* Animated Background */}
|
||||
<div className="absolute inset-0 pointer-events-none overflow-hidden" aria-hidden="true">
|
||||
{/* Gradient orbs */}
|
||||
<div
|
||||
className="absolute -top-40 -left-40 w-[600px] h-[600px] rounded-full opacity-20 dark:opacity-10
|
||||
bg-gradient-to-br from-[var(--brand-500)] to-blue-400
|
||||
animate-[pulse_8s_ease-in-out_infinite]"
|
||||
/>
|
||||
<div
|
||||
className="absolute -bottom-40 -right-20 w-[500px] h-[500px] rounded-full opacity-15 dark:opacity-10
|
||||
bg-gradient-to-tl from-[var(--gold-400)] to-[var(--brand-500)]
|
||||
animate-[pulse_10s_ease-in-out_2s_infinite]"
|
||||
/>
|
||||
{/* Grid pattern */}
|
||||
<div
|
||||
className="absolute inset-0 opacity-[0.03] dark:opacity-[0.06]"
|
||||
style={{
|
||||
backgroundImage: `
|
||||
linear-gradient(var(--text-primary) 1px, transparent 1px),
|
||||
linear-gradient(90deg, var(--text-primary) 1px, transparent 1px)
|
||||
`,
|
||||
backgroundSize: '60px 60px',
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Top bar — theme & lang switchers */}
|
||||
<div className="absolute top-0 left-0 right-0 flex justify-between items-center px-6 py-4 z-10">
|
||||
{/* Logo */}
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="w-8 h-8 rounded-lg bg-[var(--brand-500)] flex items-center justify-center flex-shrink-0">
|
||||
<span className="text-white font-bold text-sm">TB</span>
|
||||
</div>
|
||||
<span className="font-bold text-[var(--text-primary)] text-sm tracking-wide hidden sm:block">
|
||||
TBBank
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-2">
|
||||
{/* Language switcher */}
|
||||
<div className="flex items-center gap-1 bg-[var(--bg-surface)] border border-[var(--border-default)]
|
||||
rounded-[var(--radius-md)] p-1 shadow-[var(--shadow-sm)]">
|
||||
{(Object.keys(LANG_LABELS) as SupportedLanguage[]).map((lang) => (
|
||||
<button
|
||||
key={lang}
|
||||
id={`lang-btn-${lang}`}
|
||||
type="button"
|
||||
onClick={() => setLanguage(lang)}
|
||||
className={`px-2.5 py-1 rounded-[var(--radius-sm)] text-xs font-semibold transition-all
|
||||
duration-[var(--transition-fast)] cursor-pointer
|
||||
${
|
||||
language === lang
|
||||
? 'bg-[var(--brand-500)] text-white'
|
||||
: 'text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-muted)]'
|
||||
}`}
|
||||
>
|
||||
{LANG_LABELS[lang]}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Theme toggle */}
|
||||
<button
|
||||
id="theme-toggle-btn"
|
||||
type="button"
|
||||
onClick={toggleTheme}
|
||||
aria-label={theme === 'light' ? t('theme.dark') : t('theme.light')}
|
||||
className="w-9 h-9 rounded-[var(--radius-md)] flex items-center justify-center
|
||||
bg-[var(--bg-surface)] border border-[var(--border-default)]
|
||||
text-[var(--text-secondary)] hover:text-[var(--text-primary)]
|
||||
hover:bg-[var(--bg-muted)] transition-all duration-[var(--transition-fast)]
|
||||
shadow-[var(--shadow-sm)] cursor-pointer"
|
||||
>
|
||||
{theme === 'light' ? (
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
||||
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/>
|
||||
</svg>
|
||||
) : (
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
||||
<circle cx="12" cy="12" r="4"/>
|
||||
<path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"/>
|
||||
</svg>
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Main content */}
|
||||
<main className="relative z-10 w-full max-w-md mx-auto px-4 py-8">
|
||||
{children}
|
||||
</main>
|
||||
|
||||
{/* Footer */}
|
||||
<div className="absolute bottom-4 left-0 right-0 text-center z-10">
|
||||
<p className="text-xs text-[var(--text-muted)]">
|
||||
© {new Date().getFullYear()} TBBank. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
500
src/layouts/DashboardLayout.tsx
Normal file
500
src/layouts/DashboardLayout.tsx
Normal file
@@ -0,0 +1,500 @@
|
||||
import React, { useState } from 'react'
|
||||
import { Outlet, Link, useLocation } from 'react-router-dom'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import {
|
||||
Sidebar,
|
||||
SidebarContent,
|
||||
SidebarMenu,
|
||||
SidebarMenuButton,
|
||||
SidebarMenuItem,
|
||||
SidebarMenuSub,
|
||||
SidebarMenuSubButton,
|
||||
SidebarMenuSubItem,
|
||||
SidebarProvider,
|
||||
SidebarHeader,
|
||||
} from '@/components/ui/sidebar'
|
||||
import { useAuthStore } from '@/app/store/authStore'
|
||||
import { useThemeStore } from '@/app/store/themeStore'
|
||||
import { useI18nStore } from '@/app/store/i18nStore'
|
||||
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible'
|
||||
import {
|
||||
Sun,
|
||||
Moon,
|
||||
Bell,
|
||||
ChevronDown,
|
||||
LayoutDashboard,
|
||||
FileText,
|
||||
Users,
|
||||
Settings,
|
||||
DollarSign,
|
||||
CreditCard,
|
||||
Database,
|
||||
Globe,
|
||||
Terminal,
|
||||
ChevronRight,
|
||||
} from 'lucide-react'
|
||||
import { TooltipProvider } from '@/components/ui/tooltip'
|
||||
import {
|
||||
Breadcrumb,
|
||||
BreadcrumbItem,
|
||||
BreadcrumbLink,
|
||||
BreadcrumbList,
|
||||
BreadcrumbPage,
|
||||
BreadcrumbSeparator,
|
||||
} from '@/components/ui/breadcrumb'
|
||||
import { cn } from '@/lib/utils'
|
||||
import Icon from "@/assets/icon.svg"
|
||||
|
||||
// ─── Collapsible wrappers ──────────────────────────────────────────────────────
|
||||
|
||||
const Collapsible = CollapsiblePrimitive.Root
|
||||
const CollapsibleTrigger = CollapsiblePrimitive.Trigger
|
||||
const CollapsibleContent = CollapsiblePrimitive.Content
|
||||
|
||||
// ─── Header ───────────────────────────────────────────────────────────────────
|
||||
|
||||
function DashboardHeader() {
|
||||
const { t } = useTranslation()
|
||||
const location = useLocation()
|
||||
const { theme, toggleTheme } = useThemeStore()
|
||||
const { language, setLanguage } = useI18nStore()
|
||||
const user = useAuthStore((s) => s.user)
|
||||
const logout = useAuthStore((s) => s.clearAuth)
|
||||
const [userMenuOpen, setUserMenuOpen] = useState(false)
|
||||
const [langMenuOpen, setLangMenuOpen] = useState(false)
|
||||
|
||||
const languages = [
|
||||
{ code: 'en', label: 'English' },
|
||||
{ code: 'ru', label: 'Русский' },
|
||||
{ code: 'tk', label: 'Türkmençe' },
|
||||
] as const
|
||||
|
||||
const generateBreadcrumbs = () => {
|
||||
const paths = location.pathname.split('/').filter(Boolean)
|
||||
if (paths.length === 0 || (paths.length === 1 && paths[0] === 'dashboard')) {
|
||||
return (
|
||||
<BreadcrumbList>
|
||||
<BreadcrumbItem>
|
||||
<BreadcrumbPage>{t('Dashboard', 'Baş sahypa')}</BreadcrumbPage>
|
||||
</BreadcrumbItem>
|
||||
</BreadcrumbList>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<BreadcrumbList>
|
||||
<BreadcrumbItem>
|
||||
<BreadcrumbLink asChild>
|
||||
<Link to="/dashboard">Dashboards</Link>
|
||||
</BreadcrumbLink>
|
||||
</BreadcrumbItem>
|
||||
<BreadcrumbSeparator />
|
||||
{paths.map((path, index) => {
|
||||
const isLast = index === paths.length - 1
|
||||
const url = `/${paths.slice(0, index + 1).join('/')}`
|
||||
const formattedPath = path
|
||||
.replace(/-/g, ' ')
|
||||
.split(' ')
|
||||
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
||||
.join(' ')
|
||||
const title = t(formattedPath, formattedPath)
|
||||
|
||||
return (
|
||||
<React.Fragment key={url}>
|
||||
<BreadcrumbItem>
|
||||
{isLast ? (
|
||||
<BreadcrumbPage>{title}</BreadcrumbPage>
|
||||
) : (
|
||||
<BreadcrumbLink asChild>
|
||||
<Link to={url}>{title}</Link>
|
||||
</BreadcrumbLink>
|
||||
)}
|
||||
</BreadcrumbItem>
|
||||
{!isLast && <BreadcrumbSeparator />}
|
||||
</React.Fragment>
|
||||
)
|
||||
})}
|
||||
</BreadcrumbList>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<header className="h-14 border-b border-border bg-background flex items-center justify-between px-6 sticky top-0 z-30">
|
||||
<div className="flex items-center gap-2 text-sm text-muted-foreground">
|
||||
<Breadcrumb>{generateBreadcrumbs()}</Breadcrumb>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-4">
|
||||
{/* Language Switcher */}
|
||||
<div className="relative">
|
||||
<button
|
||||
onClick={() => setLangMenuOpen(!langMenuOpen)}
|
||||
className="flex items-center gap-2 p-2 rounded-md hover:bg-accent text-muted-foreground hover:text-foreground transition-colors"
|
||||
aria-label="Toggle language"
|
||||
>
|
||||
<Globe size={18} />
|
||||
<span className="text-sm font-medium uppercase">{language}</span>
|
||||
</button>
|
||||
|
||||
{langMenuOpen && (
|
||||
<div className="absolute right-0 mt-1 w-32 bg-card border border-border rounded-md shadow-md py-1 z-50">
|
||||
{languages.map((lang) => (
|
||||
<button
|
||||
key={lang.code}
|
||||
onClick={() => {
|
||||
setLanguage(lang.code)
|
||||
setLangMenuOpen(false)
|
||||
}}
|
||||
className={`w-full text-left px-4 py-2 text-sm hover:bg-accent transition-colors ${
|
||||
language === lang.code
|
||||
? 'text-primary font-medium bg-accent/50'
|
||||
: 'text-foreground'
|
||||
}`}
|
||||
>
|
||||
{lang.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<button
|
||||
onClick={toggleTheme}
|
||||
className="p-2 rounded-full hover:bg-accent text-muted-foreground hover:text-foreground transition-colors"
|
||||
aria-label="Toggle theme"
|
||||
>
|
||||
{theme === 'dark' ? <Sun size={18} /> : <Moon size={18} />}
|
||||
</button>
|
||||
|
||||
<button className="p-2 rounded-full hover:bg-accent text-muted-foreground hover:text-foreground transition-colors relative">
|
||||
<Bell size={18} />
|
||||
<span className="absolute top-1.5 right-1.5 w-2 h-2 bg-destructive rounded-full" />
|
||||
</button>
|
||||
|
||||
<div className="relative">
|
||||
<button
|
||||
className="flex items-center gap-2 hover:bg-accent py-1.5 px-3 rounded-md transition-colors"
|
||||
onClick={() => setUserMenuOpen(!userMenuOpen)}
|
||||
>
|
||||
<span className="text-sm font-medium text-foreground">{user?.name || 'Admin'}</span>
|
||||
<ChevronDown size={14} className="text-muted-foreground" />
|
||||
</button>
|
||||
|
||||
{userMenuOpen && (
|
||||
<div className="absolute right-0 mt-1 w-48 bg-card border border-border rounded-md shadow-md py-1 z-50">
|
||||
<button
|
||||
onClick={logout}
|
||||
className="w-full text-left px-4 py-2 text-sm text-destructive hover:bg-accent transition-colors"
|
||||
>
|
||||
{t('Logout', 'Çykmak')}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
)
|
||||
}
|
||||
|
||||
// ─── Sidebar ──────────────────────────────────────────────────────────────────
|
||||
|
||||
type NavSubSubItem = { title: string; url: string }
|
||||
type NavSubItem = { title: string; url?: string; items?: NavSubSubItem[] }
|
||||
type NavItem = { title: string; url?: string; icon: React.ElementType; items?: NavSubItem[] }
|
||||
|
||||
/**
|
||||
* Checks if a nav item (or any of its children) matches the current path.
|
||||
*/
|
||||
function isNavItemActive(item: NavItem | NavSubItem, pathname: string): boolean {
|
||||
if ('url' in item && item.url) {
|
||||
if (pathname === item.url) return true
|
||||
}
|
||||
if (item.items) {
|
||||
return item.items.some((child) => isNavItemActive(child, pathname))
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Sub-sub-level collapsible: renders a category header (non-link)
|
||||
* with its leaf link items inside a Radix Collapsible.
|
||||
*
|
||||
* Using Radix Collapsible instead of Accordion eliminates the
|
||||
* --radix-accordion-content-height measurement bug that causes
|
||||
* nested accordions to show incorrect heights.
|
||||
*/
|
||||
function NavSubGroup({
|
||||
subItem,
|
||||
pathname,
|
||||
}: {
|
||||
subItem: NavSubItem
|
||||
pathname: string
|
||||
}) {
|
||||
const isActive = subItem.items?.some((s) => pathname === s.url) ?? false
|
||||
const [open, setOpen] = useState(isActive)
|
||||
|
||||
return (
|
||||
<Collapsible open={open} onOpenChange={setOpen}>
|
||||
<CollapsibleTrigger asChild>
|
||||
<button
|
||||
className={cn(
|
||||
'group flex w-full items-center justify-between px-2 py-1.5',
|
||||
'text-xs font-semibold uppercase tracking-wider',
|
||||
'text-sidebar-foreground/60 hover:text-sidebar-foreground',
|
||||
'transition-colors rounded-sm',
|
||||
)}
|
||||
>
|
||||
<span>{subItem.title}</span>
|
||||
<ChevronRight
|
||||
size={12}
|
||||
className={cn('transition-transform duration-200', open && 'rotate-90')}
|
||||
/>
|
||||
</button>
|
||||
</CollapsibleTrigger>
|
||||
|
||||
{/* No overflow:hidden animation — content renders at natural height */}
|
||||
<CollapsibleContent>
|
||||
<SidebarMenuSub className="border-l-0 pl-2 pr-0 mt-0">
|
||||
{subItem.items?.map((subSubItem, i) => (
|
||||
<SidebarMenuSubItem key={i}>
|
||||
<SidebarMenuSubButton asChild isActive={pathname === subSubItem.url} size='sm'>
|
||||
<Link to={subSubItem.url}>
|
||||
<span>{subSubItem.title}</span>
|
||||
</Link>
|
||||
</SidebarMenuSubButton>
|
||||
</SidebarMenuSubItem>
|
||||
))}
|
||||
</SidebarMenuSub>
|
||||
</CollapsibleContent>
|
||||
</Collapsible>
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Top-level nav item that has children (both sub-groups and direct links).
|
||||
*/
|
||||
function NavGroupItem({ item }: { item: NavItem }) {
|
||||
const pathname = useLocation().pathname
|
||||
const isActive = isNavItemActive(item, pathname)
|
||||
const [open, setOpen] = useState(isActive)
|
||||
|
||||
return (
|
||||
<Collapsible open={open} onOpenChange={setOpen}>
|
||||
<SidebarMenuItem>
|
||||
<CollapsibleTrigger asChild>
|
||||
<SidebarMenuButton isActive={isActive} tooltip={item.title}>
|
||||
<item.icon />
|
||||
<span>{item.title}</span>
|
||||
<ChevronRight
|
||||
size={12}
|
||||
className={cn(
|
||||
'ml-auto transition-transform duration-200',
|
||||
open && 'rotate-90',
|
||||
)}
|
||||
/>
|
||||
</SidebarMenuButton>
|
||||
</CollapsibleTrigger>
|
||||
</SidebarMenuItem>
|
||||
|
||||
<CollapsibleContent>
|
||||
<SidebarMenuSub>
|
||||
{item.items?.map((subItem, subIndex) => {
|
||||
// Sub-item has further children → render as collapsible group
|
||||
if (subItem.items) {
|
||||
return (
|
||||
<NavSubGroup key={subIndex} subItem={subItem} pathname={pathname} />
|
||||
)
|
||||
}
|
||||
|
||||
// Sub-item is a direct link
|
||||
return (
|
||||
<SidebarMenuSubItem key={subIndex}>
|
||||
<SidebarMenuSubButton asChild isActive={pathname === subItem.url}>
|
||||
<Link to={subItem.url ?? '#'}>
|
||||
<span>{subItem.title}</span>
|
||||
</Link>
|
||||
</SidebarMenuSubButton>
|
||||
</SidebarMenuSubItem>
|
||||
)
|
||||
})}
|
||||
</SidebarMenuSub>
|
||||
</CollapsibleContent>
|
||||
</Collapsible>
|
||||
)
|
||||
}
|
||||
|
||||
function AppSidebar() {
|
||||
const { t } = useTranslation()
|
||||
const location = useLocation()
|
||||
|
||||
const navItems: NavItem[] = [
|
||||
{
|
||||
title: t('Dashboard', 'Baş sahypa'),
|
||||
url: '/dashboard',
|
||||
icon: LayoutDashboard,
|
||||
},
|
||||
{
|
||||
title: t('Orders', 'Sargytlar'),
|
||||
icon: FileText,
|
||||
items: [
|
||||
{
|
||||
title: t('Loan department', 'KARZ BÖLÜMI'),
|
||||
items: [
|
||||
{ title: t('Loan orders', 'Karz sargytlary'), url: '/resources/loan-orders' },
|
||||
{ title: t('Loan order (Mobile)', 'Karz sargyt (Mobile)'), url: '/resources/loan-order-mobiles' },
|
||||
{ title: t('Loan balance', 'Karzyň galyndysy'), url: '/resources/loan-remaining' },
|
||||
{ title: t('Certificates of loan repayment', 'Karzyň ýapylandygy barada güwanamalar'), url: '/resources/loan-paid-off-letters' },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: t('Card department', 'KART BÖLÜMI'),
|
||||
items: [
|
||||
{ title: t('Order new card', 'Täze kart açmak'), url: '/resources/card-new' },
|
||||
{ title: t('Card transactions', 'Kart hereketleri'), url: '/resources/card-transactions' },
|
||||
{ title: t('Card requisites', 'Kart rekwizitler'), url: '/resources/card-requisites' },
|
||||
{ title: t('Card balances', 'Kart galyndylary'), url: '/resources/card-balances' },
|
||||
{ title: t('Card pins', 'Kart pin bukjalar'), url: '/resources/card-pins' },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: t('International payments', 'HALKARA TÖLEGLER'),
|
||||
items: [
|
||||
{ title: t('Visa/Master payments', 'Visa/Master tölegleri'), url: '/resources/intl-payments/visa-master' },
|
||||
{ title: t('Sber payments', 'Sber tölegleri'), url: '/resources/intl-payments/sber' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: t('Users', 'Ulanyjylar'),
|
||||
icon: Users,
|
||||
items: [
|
||||
{ title: t('Operators', 'Operatorlar'), url: '/users/operators' },
|
||||
{ title: t('Clients', 'Müşderiler'), url: '/users/clients' },
|
||||
{ title: t('All users', 'Ähli ulanyjylar'), url: '/users/all' },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: t('Settings', 'Sazlamalar'),
|
||||
icon: Settings,
|
||||
items: [
|
||||
{
|
||||
title: t('Users', 'ULANYJYLAR'),
|
||||
items: [
|
||||
{ title: t('Roles', 'Rollar'), url: '/settings/users/roles' },
|
||||
{ title: t('Permissions', 'Rugsatlar'), url: '/settings/users/permissions' },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: t('Loan', 'KARZ'),
|
||||
items: [
|
||||
{ title: t('Loan Types', 'Karz görnüşleri'), url: '/settings/loan/types' },
|
||||
{ title: t('Required Documents', 'Karz gerekli resminamalary'), url: '/settings/loan/documents' },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: t('Card', 'KART'),
|
||||
items: [
|
||||
{ title: t('Card Issuance Reasons', 'Kartyň çykarylmagynyň sebäpleri'), url: '/settings/card/reasons' },
|
||||
{ title: t('Card Types', 'Kart görnüşleri'), url: '/settings/card/types' },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: t('Location', 'LOKASIÝA'),
|
||||
items: [
|
||||
{ title: t('Districts', 'Etraplar'), url: '/settings/location/districts' },
|
||||
{ title: t('Branches', 'Şahamçalar'), url: '/settings/location/branches' },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: t('Language', 'DIL'),
|
||||
items: [
|
||||
{ title: t('Locale Manager', 'Locale Manager'), url: '/settings/language/locale-manager' },
|
||||
{ title: t('Resources', 'Resources'), url: '/settings/language/resources' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: t('Currencies', 'Walýutalar'),
|
||||
icon: DollarSign,
|
||||
items: [
|
||||
{ title: t('Currency rates', 'Walýuta kurslary'), url: '/currencies/rates' },
|
||||
{ title: t('Visa/Master, Sber Settings', 'Visa/Master, Sber sazlamalary'), url: '/currencies/settings' },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: t('Online payment history', 'Onlaýn töleg taryhy'),
|
||||
url: '/online-payments',
|
||||
icon: CreditCard,
|
||||
},
|
||||
{
|
||||
title: t('Backups', 'Bekaplar'),
|
||||
url: '/backups',
|
||||
icon: Database,
|
||||
},
|
||||
{
|
||||
title: t('Logs', 'Loglar'),
|
||||
url: '/logs',
|
||||
icon: Terminal,
|
||||
},
|
||||
]
|
||||
|
||||
return (
|
||||
<Sidebar className="border-r border-sidebar-border">
|
||||
<SidebarHeader className="h-14 flex items-center px-4 border-b border-sidebar-border">
|
||||
<div className="flex items-center gap-2 font-bold text-lg text-sidebar-primary">
|
||||
<img className='h-10' src={Icon} alt="" />
|
||||
<span>TBBANK</span>
|
||||
</div>
|
||||
</SidebarHeader>
|
||||
|
||||
<SidebarContent>
|
||||
<SidebarMenu className="mt-4 gap-1 px-2 text-sm">
|
||||
{navItems.map((item, index) => {
|
||||
// Leaf item (no children)
|
||||
if (!item.items) {
|
||||
return (
|
||||
<SidebarMenuItem key={index}>
|
||||
<SidebarMenuButton
|
||||
asChild
|
||||
isActive={location.pathname === item.url}
|
||||
tooltip={item.title}
|
||||
className='text-sm'
|
||||
>
|
||||
<Link to={item.url ?? '#'}>
|
||||
<item.icon />
|
||||
<span className='text-sm'>{item.title}</span>
|
||||
</Link>
|
||||
</SidebarMenuButton>
|
||||
</SidebarMenuItem>
|
||||
)
|
||||
}
|
||||
|
||||
return <NavGroupItem key={index} item={item} />
|
||||
})}
|
||||
</SidebarMenu>
|
||||
</SidebarContent>
|
||||
</Sidebar>
|
||||
)
|
||||
}
|
||||
|
||||
// ─── Layout ───────────────────────────────────────────────────────────────────
|
||||
|
||||
export function DashboardLayout() {
|
||||
return (
|
||||
<TooltipProvider>
|
||||
<SidebarProvider>
|
||||
<div className="flex min-h-screen w-full bg-background text-foreground">
|
||||
<AppSidebar />
|
||||
<div className="flex-1 flex flex-col min-w-0">
|
||||
<DashboardHeader />
|
||||
<main className="flex-1 p-6 overflow-auto">
|
||||
<Outlet />
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
</SidebarProvider>
|
||||
</TooltipProvider>
|
||||
)
|
||||
}
|
||||
17
src/lib/hooks/useOutsideClick.ts
Normal file
17
src/lib/hooks/useOutsideClick.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { useEffect, type RefObject } from 'react'
|
||||
|
||||
export function useOutsideClick<T extends HTMLElement>(
|
||||
ref: RefObject<T | null>,
|
||||
callback: () => void
|
||||
) {
|
||||
useEffect(() => {
|
||||
function handleClick(event: MouseEvent) {
|
||||
if (ref.current && !ref.current.contains(event.target as Node)) {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('mousedown', handleClick)
|
||||
return () => document.removeEventListener('mousedown', handleClick)
|
||||
}, [ref, callback])
|
||||
}
|
||||
@@ -1,55 +1,359 @@
|
||||
{
|
||||
"common": {
|
||||
"loading": "Loading...",
|
||||
"error": "An error occurred",
|
||||
"save": "Save",
|
||||
"cancel": "Cancel",
|
||||
"confirm": "Confirm",
|
||||
"delete": "Delete",
|
||||
"edit": "Edit",
|
||||
"close": "Close",
|
||||
"back": "Back",
|
||||
"next": "Next",
|
||||
"search": "Search",
|
||||
"noData": "No data available"
|
||||
},
|
||||
"auth": {
|
||||
"signIn": "Sign In",
|
||||
"signOut": "Sign Out",
|
||||
"email": "Email",
|
||||
"password": "Password",
|
||||
"emailPlaceholder": "admin@tbbank.tm",
|
||||
"passwordPlaceholder": "Enter your password",
|
||||
"forgotPassword": "Forgot password?",
|
||||
"signingIn": "Signing in...",
|
||||
"welcomeBack": "Welcome back",
|
||||
"signInSubtitle": "Sign in to your admin account",
|
||||
"invalidCredentials": "Invalid email or password",
|
||||
"emailRequired": "Email is required",
|
||||
"passwordRequired": "Password is required",
|
||||
"emailInvalid": "Please enter a valid email"
|
||||
},
|
||||
"nav": {
|
||||
"dashboard": "Dashboard",
|
||||
"accounts": "Accounts",
|
||||
"transactions": "Transactions",
|
||||
"customers": "Customers",
|
||||
"loans": "Loans",
|
||||
"reports": "Reports",
|
||||
"settings": "Settings"
|
||||
},
|
||||
"theme": {
|
||||
"light": "Light",
|
||||
"dark": "Dark",
|
||||
"system": "System"
|
||||
},
|
||||
"lang": {
|
||||
"en": "English",
|
||||
"ru": "Русский",
|
||||
"tk": "Türkmen"
|
||||
},
|
||||
"dashboard": {
|
||||
"title": "Dashboard",
|
||||
"subtitle": "Welcome to TBBank Admin Panel"
|
||||
}
|
||||
}
|
||||
"(and :count more error)": "(and :count more error)",
|
||||
"(and :count more errors)": "(and :count more errors)",
|
||||
"A fresh verification link has been sent to your email address.": "A fresh verification link has been sent to your email address.",
|
||||
"A Timeout Occurred": "A Timeout Occurred",
|
||||
"Accepted": "Accepted",
|
||||
"Activity": "Activity",
|
||||
"Active": "Active",
|
||||
"Inactive": "Inactive",
|
||||
"Address": "Address",
|
||||
"Agree": "Agree",
|
||||
"Ahal": "Ahal",
|
||||
"All rights reserved.": "All rights reserved.",
|
||||
"All users": "All users",
|
||||
"all": "all",
|
||||
"Already Reported": "Already Reported",
|
||||
"Amount of loan": "Amount of loan",
|
||||
"Application type": "Application type",
|
||||
"Arkadag": "Arkadag",
|
||||
"Ashgabat": "Ashgabat",
|
||||
"Bad Gateway": "Bad Gateway",
|
||||
"Bad Request": "Bad Request",
|
||||
"Backups": "Backups",
|
||||
"Balkan": "Balkan",
|
||||
"Bandwidth Limit Exceeded": "Bandwidth Limit Exceeded",
|
||||
"Before proceeding, please check your email for a verification link.": "Before proceeding, please check your email for a verification link.",
|
||||
"Billing password": "Billing password",
|
||||
"Billing username": "Billing username",
|
||||
"Born place (passport)": "Born place (passport)",
|
||||
"Branch": "Branch",
|
||||
"Branches": "Branches",
|
||||
"Cancelled": "Cancelled",
|
||||
"Card": "Card",
|
||||
"Card balance": "Card balance",
|
||||
"Card balances": "Card balances",
|
||||
"Card department": "Card department",
|
||||
"Card holder name": "Card holder name",
|
||||
"Card number": "Card number",
|
||||
"Card order": "Card order",
|
||||
"Card orders": "Card orders",
|
||||
"Card pin": "Card pin",
|
||||
"Card pins": "Card pins",
|
||||
"Card requisite": "Card requisite",
|
||||
"Card requisites": "Card requisites",
|
||||
"Card state": "Card state",
|
||||
"Card states": "Card states",
|
||||
"Card transaction": "Card transaction",
|
||||
"Card transactions": "Card transactions",
|
||||
"Card type": "Card type",
|
||||
"Card types": "Card types",
|
||||
"Certificate of loan repayment": "Certificate of loan repayment",
|
||||
"Certificates of loan repayment": "Certificates of loan repayment",
|
||||
"Citizenship": "Citizenship",
|
||||
"click here to request another": "click here to request another",
|
||||
"Click to read": "Click to read",
|
||||
"Client": "Client",
|
||||
"Client Closed Request": "Client Closed Request",
|
||||
"Clients": "Clients",
|
||||
"Code": "Code",
|
||||
"Completed": "Completed",
|
||||
"Confirm Password": "Confirm Password",
|
||||
"Conflict": "Conflict",
|
||||
"Connection Closed Without Response": "Connection Closed Without Response",
|
||||
"Connection Timed Out": "Connection Timed Out",
|
||||
"Contact data": "Contact data",
|
||||
"Continue": "Continue",
|
||||
"Created": "Created",
|
||||
"Created at": "Created at",
|
||||
"Created by": "Created by",
|
||||
"Currencies": "Currencies",
|
||||
"Currency rate": "Currency rate",
|
||||
"Current Residence": "Current Residence",
|
||||
"Dashboard": "Dashboard",
|
||||
"Dashoguz": "Dashoguz",
|
||||
"Date of birth": "Date of birth",
|
||||
"Divorced": "Divorced",
|
||||
"Education": "Education",
|
||||
"Email": "Email",
|
||||
"Email Address": "Email Address",
|
||||
"End date": "End date",
|
||||
"Expectation Failed": "Expectation Failed",
|
||||
"Expiration": "Expiration",
|
||||
"Expiration month": "Expiration month",
|
||||
"Expiration year": "Expiration year",
|
||||
"Expiry date": "Expiry date",
|
||||
"Failed Dependency": "Failed Dependency",
|
||||
"Fetch loan history": "Fetch loan history",
|
||||
"For students": "For students",
|
||||
"Forbidden": "Forbidden",
|
||||
"Forgot your password?": "Forgot your password?",
|
||||
"Found": "Found",
|
||||
"Full Name": "Full Name",
|
||||
"Gateway Timeout": "Gateway Timeout",
|
||||
"Go to home": "Go to home",
|
||||
"Go to login page": "Go to login page",
|
||||
"Go to page :page": "Go to page :page",
|
||||
"Gone": "Gone",
|
||||
"Guard name": "Guard name",
|
||||
"Guarantor": "Guarantor",
|
||||
"Guarantor name": "Guarantor name",
|
||||
"Guarantor Surname": "Guarantor Surname",
|
||||
"Guarantor Patronic name": "Guarantor Patronic name",
|
||||
"Hello!": "Hello!",
|
||||
"Help": "Help",
|
||||
"Hide Cards": "Hide Cards",
|
||||
"High education": "High education",
|
||||
"Home phone": "Home phone",
|
||||
"Homepage": "Homepage",
|
||||
"HR department work number": "HR department work number",
|
||||
"HTTP Version Not Supported": "HTTP Version Not Supported",
|
||||
"I accept terms of contract": "I accept terms of contract",
|
||||
"I have read the contract": "I have read the contract",
|
||||
"I'm a teapot": "I'm a teapot",
|
||||
"If you did not create an account, no further action is required.": "If you did not create an account, no further action is required.",
|
||||
"If you did not receive the email": "If you did not receive the email",
|
||||
"If you did not request a password reset, no further action is required.": "If you did not request a password reset, no further action is required.",
|
||||
"If you're having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "If you're having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:",
|
||||
"IM Used": "IM Used",
|
||||
"Incorrect verification code": "Incorrect verification code",
|
||||
"Insufficient": "Insufficient",
|
||||
"Insufficient Storage": "Insufficient Storage",
|
||||
"Internal Server Error": "Internal Server Error",
|
||||
"International payments": "International payments",
|
||||
"Invalid JSON was returned from the route.": "Invalid JSON was returned from the route.",
|
||||
"Invalid SSL Certificate": "Invalid SSL Certificate",
|
||||
"Job": "Job",
|
||||
"Laon maturity": "Laon maturity",
|
||||
"Lebap": "Lebap",
|
||||
"Legal Marriage": "Legal Marriage",
|
||||
"Length Required": "Length Required",
|
||||
"Loading": "Loading",
|
||||
"Loan": "Loan",
|
||||
"Loan Card": "Loan Card",
|
||||
"Loan department": "Loan department",
|
||||
"Loan order": "Loan order",
|
||||
"Loan order created": "Loan order created",
|
||||
"Loan order deleted": "Loan order deleted",
|
||||
"Loan order required docs": "Loan order required docs",
|
||||
"Loan order updated": "Loan order updated",
|
||||
"Loan orders": "Loan orders",
|
||||
"Loan type": "Loan type",
|
||||
"Loan types": "Loan types",
|
||||
"Locale": "Locale",
|
||||
"Location": "Location",
|
||||
"Locked": "Locked",
|
||||
"Login": "Login",
|
||||
"Logout": "Logout",
|
||||
"Loop Detected": "Loop Detected",
|
||||
"Maintenance Mode": "Maintenance Mode",
|
||||
"Make payment": "Make payment",
|
||||
"Marriage status": "Marriage status",
|
||||
"Married": "Married",
|
||||
"Mary": "Mary",
|
||||
"Masters ED": "Masters ED",
|
||||
"Maturity": "Maturity",
|
||||
"Method Not Allowed": "Method Not Allowed",
|
||||
"Middle school": "Middle school",
|
||||
"Misdirected Request": "Misdirected Request",
|
||||
"Money Balance": "Money Balance",
|
||||
"Moved Permanently": "Moved Permanently",
|
||||
"Multi-Status": "Multi-Status",
|
||||
"Multiple Choices": "Multiple Choices",
|
||||
"My Profile": "My Profile",
|
||||
"Name": "Name",
|
||||
"Name on card": "Name on card",
|
||||
"Network Authentication Required": "Network Authentication Required",
|
||||
"Network Connect Timeout Error": "Network Connect Timeout Error",
|
||||
"Network Read Timeout Error": "Network Read Timeout Error",
|
||||
"Next": "Next",
|
||||
"No Content": "No Content",
|
||||
"Non-Authoritative Information": "Non-Authoritative Information",
|
||||
"None": "None",
|
||||
"Not Acceptable": "Not Acceptable",
|
||||
"Not Extended": "Not Extended",
|
||||
"Not Found": "Not Found",
|
||||
"Not Implemented": "Not Implemented",
|
||||
"Not Modified": "Not Modified",
|
||||
"Note": "Note",
|
||||
"Notes": "Notes",
|
||||
"Now you can set your password, but please make sure that you don't forget it!": "Now you can set your password, but please make sure that you don't forget it!",
|
||||
"of": "of",
|
||||
"OK": "OK",
|
||||
"Online panel": "Online panel",
|
||||
"Online payment": "Online payment",
|
||||
"Online payment history": "Online payment history",
|
||||
"Operator": "Operator",
|
||||
"Operators": "Operators",
|
||||
"or": "or",
|
||||
"Order a cart requisite": "Order a cart requisite",
|
||||
"Order new card": "Order new card",
|
||||
"Orders": "Orders",
|
||||
"Origin Is Unreachable": "Origin Is Unreachable",
|
||||
"Page Expired": "Page Expired",
|
||||
"Pagination Navigation": "Pagination Navigation",
|
||||
"Partial Content": "Partial Content",
|
||||
"Passport": "Passport",
|
||||
"Passport (page 1)": "Passport (page 1)",
|
||||
"Passport (page 2-3)": "Passport (page 2-3)",
|
||||
"Passport (page 32)": "Passport (page 32)",
|
||||
"Passport (page 8-9)": "Passport (page 8-9)",
|
||||
"Passport date of issue": "Passport date of issue",
|
||||
"Passport files": "Passport files",
|
||||
"Passport given by": "Passport given by",
|
||||
"Passport id": "Passport id",
|
||||
"Passport name": "Passport name",
|
||||
"Passport number": "Passport number",
|
||||
"Passport serie": "Passport serie",
|
||||
"Passport surname": "Passport surname",
|
||||
"Password": "Password",
|
||||
"Patronic name": "Patronic name",
|
||||
"Payload Too Large": "Payload Too Large",
|
||||
"Payee information": "Payee information",
|
||||
"Payment": "Payment",
|
||||
"Payment has failed": "Payment has failed",
|
||||
"Payment is successful": "Payment is successful",
|
||||
"Payment items": "Payment items",
|
||||
"Payment Required": "Payment Required",
|
||||
"Payment sender data": "Payment sender data",
|
||||
"Payments": "Payments",
|
||||
"Paid": "Paid",
|
||||
"Pending": "Pending",
|
||||
"Permanent Redirect": "Permanent Redirect",
|
||||
"Permission": "Permission",
|
||||
"Permissions": "Permissions",
|
||||
"Personal data": "Personal data",
|
||||
"PHD": "PHD",
|
||||
"Phone": "Phone",
|
||||
"Phone Additional": "Phone Additional",
|
||||
"Phone additional": "Phone additional",
|
||||
"Phone verified": "Phone verified",
|
||||
"Please click the button below to verify your email address.": "Please click the button below to verify your email address.",
|
||||
"Please confirm your password before continuing.": "Please confirm your password before continuing.",
|
||||
"Please wait while we redirect you to your personal account": "Please wait while we redirect you to your personal account",
|
||||
"Please, now verify your phone number to continue": "Please, now verify your phone number to continue",
|
||||
"Please, verify your phone": "Please, verify your phone",
|
||||
"Position": "Position",
|
||||
"Precondition Failed": "Precondition Failed",
|
||||
"Precondition Required": "Precondition Required",
|
||||
"Press continue": "Press continue",
|
||||
"Previus": "Previus",
|
||||
"Price": "Price",
|
||||
"Processing": "Processing",
|
||||
"Province": "Province",
|
||||
"Provinces": "Provinces",
|
||||
"Proxy Authentication Required": "Proxy Authentication Required",
|
||||
"Railgun Error": "Railgun Error",
|
||||
"Range Not Satisfiable": "Range Not Satisfiable",
|
||||
"Ready files": "Ready files",
|
||||
"Reason": "Reason",
|
||||
"Reason for issuing the card": "Reason for issuing the card",
|
||||
"Reciver files": "Reciver files",
|
||||
"Regards": "Regards",
|
||||
"Region": "Region",
|
||||
"Regions": "Regions",
|
||||
"Register": "Register",
|
||||
"Registered": "Registered",
|
||||
"Remember me": "Remember me",
|
||||
"Request Header Fields Too Large": "Request Header Fields Too Large",
|
||||
"Request Timeout": "Request Timeout",
|
||||
"Required docs": "Required docs",
|
||||
"Reset Content": "Reset Content",
|
||||
"Reset Password": "Reset Password",
|
||||
"Reset Password Notification": "Reset Password Notification",
|
||||
"Residence (passport)": "Residence (passport)",
|
||||
"results": "results",
|
||||
"Retry payment": "Retry payment",
|
||||
"Retry With": "Retry With",
|
||||
"Role": "Role",
|
||||
"Roles": "Roles",
|
||||
"Salary": "Salary",
|
||||
"Satisfiable": "Satisfiable",
|
||||
"Sber payment": "Sber payment",
|
||||
"Sber payments": "Sber payments",
|
||||
"School": "School",
|
||||
"School drop out": "School drop out",
|
||||
"See": "See",
|
||||
"See Other": "See Other",
|
||||
"Select payment method": "Select payment method",
|
||||
"Send Password Reset Link": "Send Password Reset Link",
|
||||
"Send payment": "Send payment",
|
||||
"Sender files": "Sender files",
|
||||
"Server Error": "Server Error",
|
||||
"Service Unavailable": "Service Unavailable",
|
||||
"Session Has Expired": "Session Has Expired",
|
||||
"Settings": "Settings",
|
||||
"Show Cards": "Show Cards",
|
||||
"Showing": "Showing",
|
||||
"Single": "Single",
|
||||
"SSL Handshake Failed": "SSL Handshake Failed",
|
||||
"Start date": "Start date",
|
||||
"Submit": "Submit",
|
||||
"Successfully created": "Successfully created",
|
||||
"Successfully logged in": "Successfully logged in",
|
||||
"Successfully registered": "Successfully registered",
|
||||
"Successfully updated": "Successfully updated",
|
||||
"Surname": "Surname",
|
||||
"Swift payment": "Swift payment",
|
||||
"Swift payments": "Swift payments",
|
||||
"Switching Protocols": "Switching Protocols",
|
||||
"Sync with system": "Sync with system",
|
||||
"Synced with system": "Synced with system",
|
||||
"System": "System",
|
||||
"Tax": "Tax",
|
||||
"Temporary Redirect": "Temporary Redirect",
|
||||
"The given data was invalid.": "The given data was invalid.",
|
||||
"The response is not a streamed response.": "The response is not a streamed response.",
|
||||
"The response is not a view.": "The response is not a view.",
|
||||
"This month": "This month",
|
||||
"This password reset link will expire in :count minutes.": "This password reset link will expire in :count minutes.",
|
||||
"to": "to",
|
||||
"Toggle navigation": "Toggle navigation",
|
||||
"Too Early": "Too Early",
|
||||
"Too Many Requests": "Too Many Requests",
|
||||
"Unauthorized": "Unauthorized",
|
||||
"Unavailable For Legal Reasons": "Unavailable For Legal Reasons",
|
||||
"Unfinished high education": "Unfinished high education",
|
||||
"Unique code": "Unique code",
|
||||
"Unique id": "Unique id",
|
||||
"Unknown": "Unknown",
|
||||
"Unknown Error": "Unknown Error",
|
||||
"Unpaid": "Unpaid",
|
||||
"Unprocessable Entity": "Unprocessable Entity",
|
||||
"Unsupported Media Type": "Unsupported Media Type",
|
||||
"Update cart requisite": "Update cart requisite",
|
||||
"Updated by": "Updated by",
|
||||
"Upgrade Required": "Upgrade Required",
|
||||
"URI Too Long": "URI Too Long",
|
||||
"Use Proxy": "Use Proxy",
|
||||
"User": "User",
|
||||
"Username": "Username",
|
||||
"Users": "Users",
|
||||
"Variant Also Negotiates": "Variant Also Negotiates",
|
||||
"Verification": "Verification",
|
||||
"verification": "verification",
|
||||
"Verification code": "Verification code",
|
||||
"Verify Email Address": "Verify Email Address",
|
||||
"Verify Phone Number": "Verify Phone Number",
|
||||
"Verify Your Email Address": "Verify Your Email Address",
|
||||
"Visa, Master, Sber, WU": "Visa, Master, Sber, WU",
|
||||
"Visa/Master payment": "Visa/Master payment",
|
||||
"Visa/Master payments": "Visa/Master payments",
|
||||
"Visa/Master, Sber Settings": "Visa/Master, Sber Settings",
|
||||
"We send you a verification code to": "We send you a verification code to",
|
||||
"Web Server is Down": "Web Server is Down",
|
||||
"Welcome Back!": "Welcome Back!",
|
||||
"Whoops!": "Whoops!",
|
||||
"Widow": "Widow",
|
||||
"Work company name": "Work company name",
|
||||
"Work location and your position": "Work location and your position",
|
||||
"Work province": "Work province",
|
||||
"Work region": "Work region",
|
||||
"Work started at": "Work started at",
|
||||
"Write a correct data please": "Write a correct data please",
|
||||
"You are logged in!": "You are logged in!",
|
||||
"You are receiving this email because we received a password reset request for your account.": "You are receiving this email because we received a password reset request for your account.",
|
||||
"Your password has been updated": "Your password has been updated",
|
||||
"Enter your username to continue": "Enter your username to continue",
|
||||
"Old surname (if changed)": "Old surname (if changed)"
|
||||
}
|
||||
@@ -1,55 +1,359 @@
|
||||
{
|
||||
"common": {
|
||||
"loading": "Загрузка...",
|
||||
"error": "Произошла ошибка",
|
||||
"save": "Сохранить",
|
||||
"cancel": "Отмена",
|
||||
"confirm": "Подтвердить",
|
||||
"delete": "Удалить",
|
||||
"edit": "Редактировать",
|
||||
"close": "Закрыть",
|
||||
"back": "Назад",
|
||||
"next": "Далее",
|
||||
"search": "Поиск",
|
||||
"noData": "Нет данных"
|
||||
},
|
||||
"auth": {
|
||||
"signIn": "Войти",
|
||||
"signOut": "Выйти",
|
||||
"email": "Эл. почта",
|
||||
"password": "Пароль",
|
||||
"emailPlaceholder": "admin@tbbank.tm",
|
||||
"passwordPlaceholder": "Введите пароль",
|
||||
"forgotPassword": "Забыли пароль?",
|
||||
"signingIn": "Вход...",
|
||||
"welcomeBack": "Добро пожаловать",
|
||||
"signInSubtitle": "Войдите в панель администратора",
|
||||
"invalidCredentials": "Неверный email или пароль",
|
||||
"emailRequired": "Введите email",
|
||||
"passwordRequired": "Введите пароль",
|
||||
"emailInvalid": "Введите корректный email"
|
||||
},
|
||||
"nav": {
|
||||
"dashboard": "Панель управления",
|
||||
"accounts": "Счета",
|
||||
"transactions": "Транзакции",
|
||||
"customers": "Клиенты",
|
||||
"loans": "Кредиты",
|
||||
"reports": "Отчёты",
|
||||
"settings": "Настройки"
|
||||
},
|
||||
"theme": {
|
||||
"light": "Светлая",
|
||||
"dark": "Тёмная",
|
||||
"system": "Системная"
|
||||
},
|
||||
"lang": {
|
||||
"en": "English",
|
||||
"ru": "Русский",
|
||||
"tk": "Türkmen"
|
||||
},
|
||||
"dashboard": {
|
||||
"title": "Панель управления",
|
||||
"subtitle": "Добро пожаловать в TBBank Admin"
|
||||
}
|
||||
}
|
||||
"(and :count more error)": "(и ещё :count ошибка)",
|
||||
"(and :count more errors)": "(и ещё :count ошибок)",
|
||||
"A fresh verification link has been sent to your email address.": "Новая ссылка подтверждения отправлена на Ваш адрес электронной почты.",
|
||||
"A Timeout Occurred": "Время ожидания истекло",
|
||||
"Accepted": "Принято",
|
||||
"Activity": "Активность",
|
||||
"Active": "Активный",
|
||||
"Inactive": "Неактивный",
|
||||
"Address": "Адрес",
|
||||
"Agree": "Согласен",
|
||||
"Ahal": "Ахал",
|
||||
"All rights reserved.": "Все права защищены.",
|
||||
"All users": "Все пользователи",
|
||||
"all": "все",
|
||||
"Already Reported": "Уже сообщалось",
|
||||
"Amount of loan": "Сумма кредита",
|
||||
"Application type": "Тип заявки",
|
||||
"Arkadag": "Аркадаг",
|
||||
"Ashgabat": "Ашгабат",
|
||||
"Bad Gateway": "Плохой шлюз",
|
||||
"Bad Request": "Некорректный запрос",
|
||||
"Backups": "Резервные копии",
|
||||
"Balkan": "Балкан",
|
||||
"Bandwidth Limit Exceeded": "Исчерпана пропускная ширина канала",
|
||||
"Before proceeding, please check your email for a verification link.": "Прежде чем продолжить, проверьте свою электронную почту на наличие ссылки для подтверждения.",
|
||||
"Billing password": "Пароль биллинга",
|
||||
"Billing username": "Логин биллинга",
|
||||
"Born place (passport)": "Место рождения (паспорт)",
|
||||
"Branch": "Филиал",
|
||||
"Branches": "Филиалы",
|
||||
"Cancelled": "Отменено",
|
||||
"Card": "Карта",
|
||||
"Card balance": "Баланс карты",
|
||||
"Card balances": "Балансы карт",
|
||||
"Card department": "Карточный отдел",
|
||||
"Card holder name": "Имя держателя карты",
|
||||
"Card number": "Номер карты",
|
||||
"Card order": "Заявка на карту",
|
||||
"Card orders": "Заявки на карты",
|
||||
"Card pin": "Заявка на ПИН конверт",
|
||||
"Card pins": "Заявки на ПИН конверт",
|
||||
"Card requisite": "Реквизит карты",
|
||||
"Card requisites": "Реквизиты карты",
|
||||
"Card state": "Состояние карты",
|
||||
"Card states": "Состояния карты",
|
||||
"Card transaction": "Транзакция карты",
|
||||
"Card transactions": "Транзакции карты",
|
||||
"Card type": "Тип карты",
|
||||
"Card types": "Типы карт",
|
||||
"Certificate of loan repayment": "Получить справку о погашении кредита",
|
||||
"Certificates of loan repayment": "Свидетельства о погашении кредита",
|
||||
"Citizenship": "Гражданство",
|
||||
"click here to request another": "нажмите здесь для запроса другой ссылки",
|
||||
"Click to read": "Нажмите, чтобы прочитать",
|
||||
"Client": "Клиент",
|
||||
"Client Closed Request": "Клиент прервал запрос",
|
||||
"Clients": "Клиенты",
|
||||
"Code": "Код",
|
||||
"Completed": "Завершённый",
|
||||
"Confirm Password": "Подтвердить пароль",
|
||||
"Conflict": "Конфликт",
|
||||
"Connection Closed Without Response": "Соединение закрыто без ответа",
|
||||
"Connection Timed Out": "Соединение не отвечает",
|
||||
"Contact data": "Контактные данные",
|
||||
"Continue": "Продолжить",
|
||||
"Created": "Создано",
|
||||
"Created at": "Дата создания",
|
||||
"Created by": "Создано кем",
|
||||
"Currencies": "Валюты",
|
||||
"Currency rate": "Курс валюты",
|
||||
"Current Residence": "Фактическое место проживания",
|
||||
"Dashboard": "Панель управления",
|
||||
"Dashoguz": "Дашогуз",
|
||||
"Date of birth": "Дата рождения",
|
||||
"Divorced": "Разведён(а)",
|
||||
"Education": "Образование",
|
||||
"Email": "Электронная почта",
|
||||
"Email Address": "Адрес электронной почты",
|
||||
"End date": "Дата окончания",
|
||||
"Expectation Failed": "Ожидание не удалось",
|
||||
"Expiration": "Срок действия",
|
||||
"Expiration month": "Срок действия (месяц)",
|
||||
"Expiration year": "Срок действия (год)",
|
||||
"Expiry date": "Дата истечения",
|
||||
"Failed Dependency": "Ошибка зависимости",
|
||||
"Fetch loan history": "Получить историю кредита",
|
||||
"For students": "Для студентов",
|
||||
"Forbidden": "Запрещено",
|
||||
"Forgot your password?": "Забыли пароль?",
|
||||
"Found": "Найдено",
|
||||
"Full Name": "Полное имя",
|
||||
"Gateway Timeout": "Шлюз не отвечает",
|
||||
"Go to home": "На главную",
|
||||
"Go to login page": "Перейти на страницу входа",
|
||||
"Go to page :page": "Перейти к :page-й странице",
|
||||
"Gone": "Удалено",
|
||||
"Guard name": "Имя охранника",
|
||||
"Guarantor": "Поручитель",
|
||||
"Guarantor name": "Имя поручителя",
|
||||
"Guarantor Surname": "Фамилия поручителя",
|
||||
"Guarantor Patronic name": "Отчество поручителя",
|
||||
"Hello!": "Здравствуйте!",
|
||||
"Help": "Помощь",
|
||||
"Hide Cards": "Скрыть карточки",
|
||||
"High education": "Высшее образование",
|
||||
"Home phone": "Домашний телефон",
|
||||
"Homepage": "Домашняя страница",
|
||||
"HR department work number": "Рабочий номер отдела кадров",
|
||||
"HTTP Version Not Supported": "Версия HTTP не поддерживается",
|
||||
"I accept terms of contract": "Я принимаю условия договора",
|
||||
"I have read the contract": "Я прочитал договор",
|
||||
"I'm a teapot": "Я - чайник",
|
||||
"If you did not create an account, no further action is required.": "Если Вы не создавали учетную запись, никаких дополнительных действий не требуется.",
|
||||
"If you did not receive the email": "Если Вы не получили письмо",
|
||||
"If you did not request a password reset, no further action is required.": "Если Вы не запрашивали восстановление пароля, никаких дополнительных действий не требуется.",
|
||||
"If you're having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "Если у Вас возникли проблемы с нажатием кнопки \":actionText\", скопируйте и вставьте приведенный ниже URL-адрес в свой браузер:",
|
||||
"IM Used": "Использовано IM",
|
||||
"Incorrect verification code": "Неверный код подтверждения",
|
||||
"Insufficient": "Недостаточно",
|
||||
"Insufficient Storage": "Переполнение хранилища",
|
||||
"Internal Server Error": "Внутренняя ошибка сервера",
|
||||
"International payments": "Международные платежи",
|
||||
"Invalid JSON was returned from the route.": "Маршрут вернул некорректный JSON.",
|
||||
"Invalid SSL Certificate": "Недействительный SSL сертификат",
|
||||
"Job": "Работа",
|
||||
"Laon maturity": "Срок кредита",
|
||||
"Lebap": "Лебап",
|
||||
"Legal Marriage": "Официальный брак",
|
||||
"Length Required": "Необходима длина",
|
||||
"Loading": "Загрузка",
|
||||
"Loan": "Кредит",
|
||||
"Loan Card": "Кредитная карта",
|
||||
"Loan department": "Кредитный отдел",
|
||||
"Loan order": "Заявка на кредит",
|
||||
"Loan order created": "Заявка на кредит создана",
|
||||
"Loan order deleted": "Заявка на кредит удалена",
|
||||
"Loan order required docs": "Необходимые документы для кредита",
|
||||
"Loan order updated": "Заявка на кредит обновлена",
|
||||
"Loan orders": "Заявки на кредит",
|
||||
"Loan type": "Тип кредита",
|
||||
"Loan types": "Типы кредитов",
|
||||
"Locale": "Языковой стандарт",
|
||||
"Location": "Местоположение",
|
||||
"Locked": "Доступ заблокирован",
|
||||
"Login": "Войти",
|
||||
"Logout": "Выйти",
|
||||
"Loop Detected": "Обнаружено бесконечное перенаправление",
|
||||
"Maintenance Mode": "Ведутся технические работы",
|
||||
"Make payment": "Совершить платёж",
|
||||
"Marriage status": "Семейное положение",
|
||||
"Married": "Женат/Замужем",
|
||||
"Mary": "Мары",
|
||||
"Masters ED": "Магистр",
|
||||
"Maturity": "Зрелость",
|
||||
"Method Not Allowed": "Метод запрещен",
|
||||
"Middle school": "Среднее образование",
|
||||
"Misdirected Request": "Неверный запрос",
|
||||
"Money Balance": "Денежный остаток",
|
||||
"Moved Permanently": "Перемещено навсегда",
|
||||
"Multi-Status": "Много статусов",
|
||||
"Multiple Choices": "Множество выбора",
|
||||
"My Profile": "Мой профиль",
|
||||
"Name": "Имя",
|
||||
"Name on card": "Имя на карте",
|
||||
"Network Authentication Required": "Требуется сетевая аутентификация",
|
||||
"Network Connect Timeout Error": "Истекло время подключения",
|
||||
"Network Read Timeout Error": "Истекло время ожидания",
|
||||
"Next": "Далее",
|
||||
"No Content": "Содержимое отсутствует",
|
||||
"Non-Authoritative Information": "Информация не авторитетна",
|
||||
"None": "Нет",
|
||||
"Not Acceptable": "Неприемлемо",
|
||||
"Not Extended": "Не расширено",
|
||||
"Not Found": "Не найдено",
|
||||
"Not Implemented": "Не реализовано",
|
||||
"Not Modified": "Не изменялось",
|
||||
"Note": "Примечание",
|
||||
"Notes": "Примечания",
|
||||
"Now you can set your password, but please make sure that you don't forget it!": "Теперь вы можете установить пароль, но не забудьте его!",
|
||||
"of": "из",
|
||||
"OK": "ОК",
|
||||
"Online panel": "Онлайн панель",
|
||||
"Online payment": "Онлайн платёж",
|
||||
"Online payment history": "История онлайн платежей",
|
||||
"Operator": "Оператор",
|
||||
"Operators": "Операторы",
|
||||
"or": "или",
|
||||
"Order a cart requisite": "Заказать реквизит карты",
|
||||
"Order new card": "Заявки на карты",
|
||||
"Orders": "Заявки",
|
||||
"Origin Is Unreachable": "Источник недоступен",
|
||||
"Page Expired": "Страница устарела",
|
||||
"Pagination Navigation": "Навигация",
|
||||
"Partial Content": "Частичное содержимое",
|
||||
"Passport": "Паспорт",
|
||||
"Passport (page 1)": "Паспорт (страница 1)",
|
||||
"Passport (page 2-3)": "Паспорт (страницы 2-3)",
|
||||
"Passport (page 32)": "Паспорт (страница 32)",
|
||||
"Passport (page 8-9)": "Паспорт (страницы 8-9)",
|
||||
"Passport date of issue": "Дата выдачи паспорта",
|
||||
"Passport files": "Паспортные файлы",
|
||||
"Passport given by": "Кем выдан паспорт",
|
||||
"Passport id": "Номер паспорта",
|
||||
"Passport name": "Имя в паспорте",
|
||||
"Passport number": "Номер паспорта",
|
||||
"Passport serie": "Серия паспорта",
|
||||
"Passport surname": "Фамилия в паспорте",
|
||||
"Password": "Пароль",
|
||||
"Patronic name": "Отчество",
|
||||
"Payload Too Large": "Полезная нагрузка слишком велика",
|
||||
"Payee information": "Данные получателя платежа",
|
||||
"Payment": "Платёж",
|
||||
"Payment has failed": "Платёж не прошёл",
|
||||
"Payment is successful": "Платёж успешно выполнен",
|
||||
"Payment items": "История платежей",
|
||||
"Payment Required": "Требуется оплата",
|
||||
"Payment sender data": "Данные отправителя платежа",
|
||||
"Payments": "Платежи",
|
||||
"Paid": "Оплачено",
|
||||
"Pending": "В ожидании",
|
||||
"Permanent Redirect": "Постоянное перенаправление",
|
||||
"Permission": "Разрешение",
|
||||
"Permissions": "Разрешения",
|
||||
"Personal data": "Персональные данные",
|
||||
"PHD": "Кандидат/доктор наук",
|
||||
"Phone": "Мобильный телефон",
|
||||
"Phone Additional": "Дополнительный телефон",
|
||||
"Phone additional": "Дополнительный телефон",
|
||||
"Phone verified": "Телефон подтверждён",
|
||||
"Please click the button below to verify your email address.": "Пожалуйста, нажмите кнопку ниже, чтобы подтвердить свой адрес электронной почты.",
|
||||
"Please confirm your password before continuing.": "Пожалуйста, подтвердите свой пароль, прежде чем продолжить.",
|
||||
"Please wait while we redirect you to your personal account": "Пожалуйста, подождите, пока мы перенаправляем вас в личный кабинет",
|
||||
"Please, now verify your phone number to continue": "Пожалуйста, подтвердите свой номер телефона, чтобы продолжить.",
|
||||
"Please, verify your phone": "Пожалуйста, подтвердите ваш телефон",
|
||||
"Position": "Должность",
|
||||
"Precondition Failed": "Условие ложно",
|
||||
"Precondition Required": "Требуется предусловие",
|
||||
"Press continue": "Нажмите продолжить",
|
||||
"Previus": "Назад",
|
||||
"Price": "Цена",
|
||||
"Processing": "В процессе",
|
||||
"Province": "Район",
|
||||
"Provinces": "Районы",
|
||||
"Proxy Authentication Required": "Требуется аутентификация прокси",
|
||||
"Railgun Error": "Ошибка соединения с Railgun",
|
||||
"Range Not Satisfiable": "Диапазон недостижим",
|
||||
"Ready files": "Готовые файлы",
|
||||
"Reason": "Причина",
|
||||
"Reason for issuing the card": "Причина выдачи карты",
|
||||
"Reciver files": "Документы получателя",
|
||||
"Regards": "С уважением",
|
||||
"Region": "Велаят",
|
||||
"Regions": "Велаяты",
|
||||
"Register": "Регистрация",
|
||||
"Registered": "Зарегистрировано",
|
||||
"Remember me": "Запомнить меня",
|
||||
"Request Header Fields Too Large": "Поля заголовка слишком большие",
|
||||
"Request Timeout": "Истекло время ожидания",
|
||||
"Required docs": "Необходимые документы",
|
||||
"Reset Content": "Сбросить содержимое",
|
||||
"Reset Password": "Сбросить пароль",
|
||||
"Reset Password Notification": "Оповещение о сбросе пароля",
|
||||
"Residence (passport)": "Прописка (паспорт)",
|
||||
"results": "результатов",
|
||||
"Retry payment": "Повторить платёж",
|
||||
"Retry With": "Повторить с",
|
||||
"Role": "Роль",
|
||||
"Roles": "Роли",
|
||||
"Salary": "Заработная плата",
|
||||
"Satisfiable": "Удовлетворительно",
|
||||
"Sber payment": "Sber платёж",
|
||||
"Sber payments": "Sber платежи",
|
||||
"School": "Среднее образование",
|
||||
"School drop out": "Неполное среднее образование",
|
||||
"See": "Просмотреть",
|
||||
"See Other": "Смотри другое",
|
||||
"Select payment method": "Выберите способ оплаты",
|
||||
"Send Password Reset Link": "Отправить ссылку сброса пароля",
|
||||
"Send payment": "Отправить платёж",
|
||||
"Sender files": "Документы отправителя",
|
||||
"Server Error": "Ошибка сервера",
|
||||
"Service Unavailable": "Сервис недоступен",
|
||||
"Session Has Expired": "Сессия устарела",
|
||||
"Settings": "Настройки",
|
||||
"Show Cards": "Показать карточки",
|
||||
"Showing": "Показано с",
|
||||
"Single": "Не женат/Не замужем",
|
||||
"SSL Handshake Failed": "Квитирование SSL не удалось",
|
||||
"Start date": "Дата начала",
|
||||
"Submit": "Отправить",
|
||||
"Successfully created": "Успешно создано",
|
||||
"Successfully logged in": "Успешно авторизован",
|
||||
"Successfully registered": "Успешно зарегистрирован",
|
||||
"Successfully updated": "Успешно обновлено",
|
||||
"Surname": "Фамилия",
|
||||
"Swift payment": "Swift платёж",
|
||||
"Swift payments": "Swift платежи",
|
||||
"Switching Protocols": "Переключение протоколов",
|
||||
"Sync with system": "Синхронизировать с системой",
|
||||
"Synced with system": "Синхронизировано с системой",
|
||||
"System": "Система",
|
||||
"Tax": "Налог",
|
||||
"Temporary Redirect": "Временное перенаправление",
|
||||
"The given data was invalid.": "Указанные данные недействительны.",
|
||||
"The response is not a streamed response.": "Ответ не является потоковым.",
|
||||
"The response is not a view.": "Ответ не является представлением.",
|
||||
"This month": "Этот месяц",
|
||||
"This password reset link will expire in :count minutes.": "Срок действия ссылки для сброса пароля истекает через :count минут.",
|
||||
"to": "по",
|
||||
"Toggle navigation": "Переключить навигацию",
|
||||
"Too Early": "Слишком рано",
|
||||
"Too Many Requests": "Слишком много запросов",
|
||||
"Unauthorized": "Не авторизован",
|
||||
"Unavailable For Legal Reasons": "Недоступно по юридическим причинам",
|
||||
"Unfinished high education": "Неоконченное высшее образование",
|
||||
"Unique code": "Уникальный код",
|
||||
"Unique id": "Уникальный идентификатор",
|
||||
"Unknown": "Неизвестно",
|
||||
"Unknown Error": "Неизвестная ошибка",
|
||||
"Unpaid": "Не оплачено",
|
||||
"Unprocessable Entity": "Необрабатываемый экземпляр",
|
||||
"Unsupported Media Type": "Неподдерживаемый тип данных",
|
||||
"Update cart requisite": "Обновить реквизит карты",
|
||||
"Updated by": "Обновлено кем",
|
||||
"Upgrade Required": "Требуется обновление",
|
||||
"URI Too Long": "URI слишком длинный",
|
||||
"Use Proxy": "Используй прокси",
|
||||
"User": "Пользователь",
|
||||
"Username": "Логин",
|
||||
"Users": "Пользователи",
|
||||
"Variant Also Negotiates": "Вариант тоже проводит согласование",
|
||||
"Verification": "Подтверждение",
|
||||
"verification": "подтверждение",
|
||||
"Verification code": "Проверочный код",
|
||||
"Verify Email Address": "Подтвердить адрес электронной почты",
|
||||
"Verify Phone Number": "Подтвердить номер телефона",
|
||||
"Verify Your Email Address": "Подтвердите Ваш адрес электронной почты",
|
||||
"Visa, Master, Sber, WU": "Visa, Master, Sber, WU",
|
||||
"Visa/Master payment": "Visa/Master платёж",
|
||||
"Visa/Master payments": "Visa/Master платежи",
|
||||
"Visa/Master, Sber Settings": "Настройки Visa/Master, Sber",
|
||||
"We send you a verification code to": "Мы отправили вам код подтверждения на",
|
||||
"Web Server is Down": "Веб-сервер не работает",
|
||||
"Welcome Back!": "С возвращением!",
|
||||
"Whoops!": "Упс!",
|
||||
"Widow": "Вдова/Вдовец",
|
||||
"Work company name": "Название организации/предприятия",
|
||||
"Work location and your position": "Место работы и ваша должность",
|
||||
"Work province": "Район работы",
|
||||
"Work region": "Велаят работы",
|
||||
"Work started at": "Дата начала работы",
|
||||
"Write a correct data please": "Пожалуйста, введите корректные данные.",
|
||||
"You are logged in!": "Вы вошли в систему.",
|
||||
"You are receiving this email because we received a password reset request for your account.": "Вы получили это письмо, потому что мы получили запрос на сброс пароля для Вашей учётной записи.",
|
||||
"Your password has been updated": "Ваш пароль был обновлён",
|
||||
"Enter your username to continue": "Введите свое имя пользователя, чтобы продолжить",
|
||||
"Old surname (if changed)": "Старая фамилия (если менялась)"
|
||||
}
|
||||
@@ -1,55 +1,359 @@
|
||||
{
|
||||
"common": {
|
||||
"loading": "Ýüklenýär...",
|
||||
"error": "Ýalňyşlyk ýüze çykdy",
|
||||
"save": "Ýatda sakla",
|
||||
"cancel": "Ýatyr",
|
||||
"confirm": "Tassykla",
|
||||
"delete": "Poz",
|
||||
"edit": "Düzelt",
|
||||
"close": "Ýap",
|
||||
"back": "Yza",
|
||||
"next": "Öňe",
|
||||
"search": "Gözle",
|
||||
"noData": "Maglumat ýok"
|
||||
},
|
||||
"auth": {
|
||||
"signIn": "Giriş",
|
||||
"signOut": "Çykyş",
|
||||
"email": "E-poçta",
|
||||
"password": "Açar söz",
|
||||
"emailPlaceholder": "admin@tbbank.tm",
|
||||
"passwordPlaceholder": "Açar sözüňizi giriziň",
|
||||
"forgotPassword": "Açar sözi unutdyňyzmy?",
|
||||
"signingIn": "Girýär...",
|
||||
"welcomeBack": "Hoş geldiňiz",
|
||||
"signInSubtitle": "Admin paneline giriş",
|
||||
"invalidCredentials": "E-poçta ýa-da açar söz ýalňyş",
|
||||
"emailRequired": "E-poçta hökmanydyr",
|
||||
"passwordRequired": "Açar söz hökmanydyr",
|
||||
"emailInvalid": "Dogry e-poçta girizin"
|
||||
},
|
||||
"nav": {
|
||||
"dashboard": "Dolandyryş paneli",
|
||||
"accounts": "Hasaplar",
|
||||
"transactions": "Geçirimler",
|
||||
"customers": "Müşderiler",
|
||||
"loans": "Karzlar",
|
||||
"reports": "Hasabatlar",
|
||||
"settings": "Sazlamalar"
|
||||
},
|
||||
"theme": {
|
||||
"light": "Açyk",
|
||||
"dark": "Garaňky",
|
||||
"system": "Ulgam"
|
||||
},
|
||||
"lang": {
|
||||
"en": "English",
|
||||
"ru": "Русский",
|
||||
"tk": "Türkmen"
|
||||
},
|
||||
"dashboard": {
|
||||
"title": "Dolandyryş paneli",
|
||||
"subtitle": "TBBank Admin paneliňize hoş geldiňiz"
|
||||
}
|
||||
}
|
||||
"(and :count more error)": "(we ýene :count ýalňyşlyk)",
|
||||
"(and :count more errors)": "(we ýene :count ýalňyşlyk)",
|
||||
"A fresh verification link has been sent to your email address.": "E-poçta salgyňyza täze tassyklama baglanyşygy iberildi.",
|
||||
"A Timeout Occurred": "Wagt gutardy",
|
||||
"Accepted": "Kabul edildi",
|
||||
"Activity": "Işjeňlik",
|
||||
"Active": "Işjeň",
|
||||
"Inactive": "Işjeň däl",
|
||||
"Address": "Salgysy",
|
||||
"Agree": "Razylaşýaryn",
|
||||
"Ahal": "Ahal",
|
||||
"All rights reserved.": "Ähli hukuklar goralandyr.",
|
||||
"All users": "Ähli ulanyjylar",
|
||||
"all": "ählisi",
|
||||
"Already Reported": "Eýýäm habar berildi",
|
||||
"Amount of loan": "Karz mukdary",
|
||||
"Application type": "Ýüztutmanyň görnüşi",
|
||||
"Arkadag": "Arkadag",
|
||||
"Ashgabat": "Aşgabat",
|
||||
"Bad Gateway": "Erbet şlıuz",
|
||||
"Bad Request": "Erbet haýyş",
|
||||
"Backups": "Bekaplar",
|
||||
"Balkan": "Balkan",
|
||||
"Bandwidth Limit Exceeded": "Zolak giňligi çäklendirildi",
|
||||
"Before proceeding, please check your email for a verification link.": "Dowam etmezden ozal tassyklama baglanyşygy üçin e-poçtaňyzy barlaň.",
|
||||
"Billing password": "Billing paroly",
|
||||
"Billing username": "Billing ulanyjy ady",
|
||||
"Born place (passport)": "Doglan ýeri (pasport)",
|
||||
"Branch": "Şahamça",
|
||||
"Branches": "Şahamçalar",
|
||||
"Cancelled": "Ýatyrylan",
|
||||
"Card": "Kart",
|
||||
"Card balance": "Kart galyndysy",
|
||||
"Card balances": "Kart galyndylary",
|
||||
"Card department": "Kart bölümi",
|
||||
"Card holder name": "Kartyň eýesiniň ady",
|
||||
"Card number": "Kart belgisi",
|
||||
"Card order": "Kart sargyt",
|
||||
"Card orders": "Kart sargytlary",
|
||||
"Card pin": "Kart pin bukja",
|
||||
"Card pins": "Kart pin bukjalar",
|
||||
"Card requisite": "Kart rekwizit",
|
||||
"Card requisites": "Kart rekwizitler",
|
||||
"Card state": "Kartyň çykarylmagynyň sebäbi",
|
||||
"Card states": "Kartyň çykarylmagynyň sebäpleri",
|
||||
"Card transaction": "Kart herekedi",
|
||||
"Card transactions": "Kart hereketleri",
|
||||
"Card type": "Kart görnüşi",
|
||||
"Card types": "Kart görnüşleri",
|
||||
"Certificate of loan repayment": "Karzyň ýapylandygy barada güwanama almak",
|
||||
"Certificates of loan repayment": "Karzyň ýapylandygy barada güwanamalar",
|
||||
"Citizenship": "Raýatlyk",
|
||||
"click here to request another": "başga birini soramak üçin şu ýere basyň",
|
||||
"Click to read": "Okamak üçin bas",
|
||||
"Client": "Müşderi",
|
||||
"Client Closed Request": "Müşderiniň ýapyk haýyşy",
|
||||
"Clients": "Müşderiler",
|
||||
"Code": "Kod",
|
||||
"Completed": "Kanagatlandyrylan",
|
||||
"Confirm Password": "Açar sözüni tassykla",
|
||||
"Conflict": "Konflikt",
|
||||
"Connection Closed Without Response": "Jogapsyz birikme ýapyldy",
|
||||
"Connection Timed Out": "Baglanyşyk wagty gutardy",
|
||||
"Contact data": "Habarlaşmak üçin maglumatlar",
|
||||
"Continue": "Dowam etmek",
|
||||
"Created": "Döredildi",
|
||||
"Created at": "Döredilen wagty",
|
||||
"Created by": "Sargyt eden",
|
||||
"Currencies": "Walýutalar",
|
||||
"Currency rate": "Walýuta kursy",
|
||||
"Current Residence": "Häzirki ýaşaýyş ýeri",
|
||||
"Dashboard": "Dolandyryş paneli",
|
||||
"Dashoguz": "Daşoguz",
|
||||
"Date of birth": "Doglan güni",
|
||||
"Divorced": "Aýrylşan",
|
||||
"Education": "Bilimi",
|
||||
"Email": "E-poçta",
|
||||
"Email Address": "Email adres",
|
||||
"End date": "Ahyrky sene",
|
||||
"Expectation Failed": "Garaşmak başa barmady",
|
||||
"Expiration": "Möhleti",
|
||||
"Expiration month": "Möhleti (aý)",
|
||||
"Expiration year": "Möhleti (ýyl)",
|
||||
"Expiry date": "Möhleti",
|
||||
"Failed Dependency": "Şowsuzlyk",
|
||||
"Fetch loan history": "Karz taryhyny görmek",
|
||||
"For students": "Talyplar üçin",
|
||||
"Forbidden": "Gadagan",
|
||||
"Forgot your password?": "Açar sözüni ýatdan çykardyňyzmy?",
|
||||
"Found": "Tapyldy",
|
||||
"Full Name": "Doly ady",
|
||||
"Gateway Timeout": "Derweze wagty",
|
||||
"Go to home": "Baş sahypa git",
|
||||
"Go to login page": "Login sahypa geç",
|
||||
"Go to page :page": ":Page-nji sahypa geçiň",
|
||||
"Gone": "Boldy",
|
||||
"Guard name": "Guard name",
|
||||
"Guarantor": "Zamun",
|
||||
"Guarantor name": "Zamunyň ady",
|
||||
"Guarantor Surname": "Zamunyň familiýasy",
|
||||
"Guarantor Patronic name": "Zamunyň atasynyň ady",
|
||||
"Hello!": "Salam!",
|
||||
"Help": "Kömek",
|
||||
"Hide Cards": "Metrikalary gizle",
|
||||
"High education": "Ýokary bilim",
|
||||
"Home phone": "Öý telefony",
|
||||
"Homepage": "Baş sahypa",
|
||||
"HR department work number": "Işgärler bölüminiň iş belgisi",
|
||||
"HTTP Version Not Supported": "HTTP wersiýasy goldanylmaýar",
|
||||
"I accept terms of contract": "Şertnama bilen razylaşýaryn",
|
||||
"I have read the contract": "Şertnama bilen tanyşdym",
|
||||
"I'm a teapot": "Men çaýdan",
|
||||
"If you did not create an account, no further action is required.": "Hasap açmadyk bolsaňyz, mundan başga çäre görülmeli däl.",
|
||||
"If you did not receive the email": "E-poçta almadyk bolsaňyz",
|
||||
"If you did not request a password reset, no further action is required.": "Paroly täzeden dikeltmegi talap etmedik bolsaňyz, mundan başga çäre görülmeli däl.",
|
||||
"If you're having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "\":actionText\" düwmesine basmakda kynçylyk çekýän bolsaňyz, aşakdaky URL-i göçüriň\nweb brauzeriňize:",
|
||||
"IM Used": "SH ulanylýar",
|
||||
"Incorrect verification code": "Nädogry belgi",
|
||||
"Insufficient": "Kanagatlanarsyz",
|
||||
"Insufficient Storage": "Ammary ýeterlik däl",
|
||||
"Internal Server Error": "Içerki serwer säwligi",
|
||||
"International payments": "Halkara tölegler",
|
||||
"Invalid JSON was returned from the route.": "Nädogry JSON ugurdan yzyna berildi.",
|
||||
"Invalid SSL Certificate": "Nädogry SSL şahadatnamasy",
|
||||
"Job": "Iş",
|
||||
"Laon maturity": "Karz möhleti",
|
||||
"Lebap": "Lebap",
|
||||
"Legal Marriage": "Raýat nika",
|
||||
"Length Required": "Uzynlyk talap edilýär",
|
||||
"Loading": "Ýüklenilýär",
|
||||
"Loan": "Karz",
|
||||
"Loan Card": "Karz karty",
|
||||
"Loan department": "Karz bölümi",
|
||||
"Loan order": "Karz sargyt",
|
||||
"Loan order created": "Karz sargydy döredildi",
|
||||
"Loan order deleted": "Karz sargydy pozuldy",
|
||||
"Loan order required docs": "Karz gerekli resminamalary",
|
||||
"Loan order updated": "Karz sargydy üýtgedildi",
|
||||
"Loan orders": "Karz sargytlary",
|
||||
"Loan type": "Karz görnüşi",
|
||||
"Loan types": "Karz görnüşleri",
|
||||
"Locale": "Dil",
|
||||
"Location": "Lokasiýa",
|
||||
"Locked": "Gulply",
|
||||
"Login": "Giriş",
|
||||
"Logout": "Hasapdan çykmak",
|
||||
"Loop Detected": "Aýlaw tapyldy",
|
||||
"Maintenance Mode": "Bejeriş tertibi",
|
||||
"Make payment": "Töleg",
|
||||
"Marriage status": "Maşgala ýagdaýy",
|
||||
"Married": "Öýlenen/Durmuşa çykan",
|
||||
"Mary": "Mary",
|
||||
"Masters ED": "Magistr",
|
||||
"Maturity": "Kämillik",
|
||||
"Method Not Allowed": "Usul rugsat berilmedi",
|
||||
"Middle school": "Orta mekdep",
|
||||
"Misdirected Request": "Nädogry haýyş",
|
||||
"Money Balance": "Galyndy",
|
||||
"Moved Permanently": "Hemişelik göçürildi",
|
||||
"Multi-Status": "Köp ýagdaý",
|
||||
"Multiple Choices": "Birnäçe saýlaw",
|
||||
"My Profile": "Meniň profilim",
|
||||
"Name": "Ady",
|
||||
"Name on card": "Kartdaky ady",
|
||||
"Network Authentication Required": "Tor tanamak hökmany",
|
||||
"Network Connect Timeout Error": "Ulgam birikdirmesiniň gutarmak säwligi",
|
||||
"Network Read Timeout Error": "Tor okamak wagtynyň ýalňyşlygy",
|
||||
"Next": "Indiki",
|
||||
"No Content": "Mazmuny ýok",
|
||||
"Non-Authoritative Information": "Ygtyýarly däl maglumatlar",
|
||||
"None": "Hiç",
|
||||
"Not Acceptable": "Kabul ederliksiz",
|
||||
"Not Extended": "Giňeldilmedik",
|
||||
"Not Found": "Tapylmady",
|
||||
"Not Implemented": "Durmuşa geçirilmedi",
|
||||
"Not Modified": "Üýtgedilmedi",
|
||||
"Note": "Bellik",
|
||||
"Notes": "Bellikler",
|
||||
"Now you can set your password, but please make sure that you don't forget it!": "Indi açar sözüni täzeläp bilersiňiz, ýöne ýatdan çykarmaň!",
|
||||
"of": "of",
|
||||
"OK": "Bolýar",
|
||||
"Online panel": "Onlaýn kabulhana",
|
||||
"Online payment": "Onlaýn töleg",
|
||||
"Online payment history": "Onlaýn töleg taryhy",
|
||||
"Operator": "Operator",
|
||||
"Operators": "Operatorlar",
|
||||
"or": "ýada",
|
||||
"Order a cart requisite": "Kart rekwiziti üçin sargyt dörediň",
|
||||
"Order new card": "Täze kart açmak",
|
||||
"Orders": "Sargytlar",
|
||||
"Origin Is Unreachable": "Gelip çykyşy elýeterli däl",
|
||||
"Page Expired": "Sahypanyň möhleti gutardy",
|
||||
"Pagination Navigation": "Sahypa nawigasiýasy",
|
||||
"Partial Content": "Bölekleýin mazmun",
|
||||
"Passport": "Pasport",
|
||||
"Passport (page 1)": "Pasport (sahypa 1)",
|
||||
"Passport (page 2-3)": "Pasport (2-3-nji sahypa)",
|
||||
"Passport (page 32)": "Pasport (32-nji sahypa)",
|
||||
"Passport (page 8-9)": "Pasport (8-9 sahypa)",
|
||||
"Passport date of issue": "Pasport berlen senesi",
|
||||
"Passport files": "Pasport faýýlar",
|
||||
"Passport given by": "Kim tarapyndan berildi",
|
||||
"Passport id": "Pasport belgisi",
|
||||
"Passport name": "Pasportdaky ady",
|
||||
"Passport number": "Pasport nomeri",
|
||||
"Passport serie": "Pasport seriýasy",
|
||||
"Passport surname": "Pasportdaky familiýa",
|
||||
"Password": "Açar sözi",
|
||||
"Patronic name": "Atasynyň ady",
|
||||
"Payload Too Large": "Loadük gaty uly",
|
||||
"Payee information": "Tölegi kabul edijiniň maglumatlary",
|
||||
"Payment": "Töleg",
|
||||
"Payment has failed": "Töleg geçmedi",
|
||||
"Payment is successful": "Töleg geçdi",
|
||||
"Payment items": "Töleg taryhy",
|
||||
"Payment Required": "Töleg talap edilýär",
|
||||
"Payment sender data": "Tölegi ugradyjynyň maglumatlary",
|
||||
"Payments": "Tölegler",
|
||||
"Paid": "Tölenen",
|
||||
"Pending": "Garaşylýar",
|
||||
"Permanent Redirect": "Hemişelik gönükdirme",
|
||||
"Permission": "Rugsat",
|
||||
"Permissions": "Rugsatlar",
|
||||
"Personal data": "Şahsy maglumatlar",
|
||||
"PHD": "Ylymlaryň doktory",
|
||||
"Phone": "Telefon",
|
||||
"Phone Additional": "Telefon goşmaça",
|
||||
"Phone additional": "Telefon goşmaça",
|
||||
"Phone verified": "Telefon tassyklanan",
|
||||
"Please click the button below to verify your email address.": "E-poçta salgyňyzy barlamak üçin aşakdaky düwmä basyň.",
|
||||
"Please confirm your password before continuing.": "Dowam etmezden ozal açar sözüni tassyklaň.",
|
||||
"Please wait while we redirect you to your personal account": "Şahsy hasabyňyza geçýänçä garaşyň",
|
||||
"Please, now verify your phone number to continue": "Dowam etmek üçin telefon belgiňizi tassyklaň",
|
||||
"Please, verify your phone": "Telefon beligiňizi tassyklamagyňyzy haýyş edýäris.",
|
||||
"Position": "Wezipe",
|
||||
"Precondition Failed": "Deslapky şert şowsuz",
|
||||
"Precondition Required": "Deslapky şert",
|
||||
"Press continue": "Dowam etmek düwme basyň",
|
||||
"Previus": "Yza",
|
||||
"Price": "Baha",
|
||||
"Processing": "Işlenilýär",
|
||||
"Province": "Etrap",
|
||||
"Provinces": "Etraplar",
|
||||
"Proxy Authentication Required": "Proksi tanamak zerur",
|
||||
"Railgun Error": "Demirýol säwligi",
|
||||
"Range Not Satisfiable": "Aralyk doýmaýar",
|
||||
"Ready files": "Taýýar faýllar",
|
||||
"Reason": "Sebäp",
|
||||
"Reason for issuing the card": "Kartyň çykarylmagynyň sebäbi",
|
||||
"Reciver files": "Kabul ediji talyp boýunça resminamalary",
|
||||
"Regards": "Hormat bilen",
|
||||
"Region": "Welaýat",
|
||||
"Regions": "Welaýatlar",
|
||||
"Register": "Agza bolmak",
|
||||
"Registered": "Bellige alyndy",
|
||||
"Remember me": "Meni ýatda sakla",
|
||||
"Request Header Fields Too Large": "Sözbaşy meýdanlaryny gaty uly haýyş",
|
||||
"Request Timeout": "Wagt gutarmagyny haýyş",
|
||||
"Required docs": "Gerekli resminamalar",
|
||||
"Reset Content": "Mazmuny täzeden düzmek",
|
||||
"Reset Password": "Açar sözüni täzelemek",
|
||||
"Reset Password Notification": "Reset Password Notification",
|
||||
"Residence (passport)": "Ýazgy edilen salgyňyz",
|
||||
"results": "Netijeler",
|
||||
"Retry payment": "Tölegi täzeden geçir",
|
||||
"Retry With": "Gaýtadan synanyşyň",
|
||||
"Role": "Rol",
|
||||
"Roles": "Rollar",
|
||||
"Salary": "Zähmet haky",
|
||||
"Satisfiable": "Kanagatlanarly",
|
||||
"Sber payment": "Sber töleg",
|
||||
"Sber payments": "Sber tölegler",
|
||||
"School": "Orta bilim",
|
||||
"School drop out": "Gutarylmadyk orta bilim",
|
||||
"See": "Görmek",
|
||||
"See Other": "Başgalaryna serediň",
|
||||
"Select payment method": "Töleg görnüşini saýlaň",
|
||||
"Send Password Reset Link": "Paroly täzeden düzmek baglanyşygyny iber",
|
||||
"Send payment": "Tölegi geçir",
|
||||
"Sender files": "Ugradyjy boýunça resminamalary",
|
||||
"Server Error": "Serwer ýalňyşlygy",
|
||||
"Service Unavailable": "Hyzmat elýeterli däl",
|
||||
"Session Has Expired": "Sessiýa gutardy",
|
||||
"Settings": "Sazlamalar",
|
||||
"Show Cards": "Metrikalary görkez",
|
||||
"Showing": "Görkezmek",
|
||||
"Single": "Öýlenmedik/Durmuşa çykmadyk",
|
||||
"SSL Handshake Failed": "SSL el çarpmak şowsuz boldy",
|
||||
"Start date": "Başlangyç sene",
|
||||
"Submit": "Tassyklamak",
|
||||
"Successfully created": "Üstünlikli döredildi",
|
||||
"Successfully logged in": "Üstünlik bilen girdiňiz",
|
||||
"Successfully registered": "Üstünlikli hasaba alyndyňyz",
|
||||
"Successfully updated": "Üstünlikli üýtgedildi",
|
||||
"Surname": "Familiýasy",
|
||||
"Swift payment": "Swift töleg",
|
||||
"Swift payments": "Swift tölegler",
|
||||
"Switching Protocols": "Protokollary çalyşmak",
|
||||
"Sync with system": "Ulgam bn birikdirmek",
|
||||
"Synced with system": "Ulgam bn birikdirilen",
|
||||
"System": "Ulgam",
|
||||
"Tax": "Salgyt",
|
||||
"Temporary Redirect": "Wagtlaýyn gönükdirme",
|
||||
"The given data was invalid.": "Berlen maglumatlar nädogry",
|
||||
"The response is not a streamed response.": "Jogap akymly jogap däl.",
|
||||
"The response is not a view.": "Jogap görünmeýär.",
|
||||
"This month": "Şul aý",
|
||||
"This password reset link will expire in :count minutes.": "Bu paroly täzeden dikeltmek baglanyşygy :count minutda gutarar.",
|
||||
"to": "to",
|
||||
"Toggle navigation": "Nawigasiýany üýtgediň",
|
||||
"Too Early": "Örän ir",
|
||||
"Too Many Requests": "Gaty köp haýyş",
|
||||
"Unauthorized": "Rugsat berilmedik",
|
||||
"Unavailable For Legal Reasons": "Hukuk sebäpleri üçin elýeterli däl",
|
||||
"Unfinished high education": "Gutarylmadyk ýokary bilim",
|
||||
"Unique code": "Unikal belgi",
|
||||
"Unique id": "Unikal belgi",
|
||||
"Unknown": "Näbelli",
|
||||
"Unknown Error": "Näbelli säwlik",
|
||||
"Unpaid": "Tölenmedik",
|
||||
"Unprocessable Entity": "Işlenip bilinmeýän kärhana",
|
||||
"Unsupported Media Type": "Goldaw berilmeýän media görnüşi",
|
||||
"Update cart requisite": "Üýtget",
|
||||
"Updated by": "Üýtgeden",
|
||||
"Upgrade Required": "Döwrebaplaşdyrmak zerur",
|
||||
"URI Too Long": "URI gaty uzyn",
|
||||
"Use Proxy": "Proksi ulanyň",
|
||||
"User": "Ulanyjy",
|
||||
"Username": "Ulanyjy ady",
|
||||
"Users": "Ulanyjylar",
|
||||
"Variant Also Negotiates": "Wariant hem gepleşik geçirýär",
|
||||
"Verification": "Tassyklamak",
|
||||
"verification": "tassyklamak",
|
||||
"Verification code": "Tassyklaýyş belgi",
|
||||
"Verify Email Address": "E-poçta salgysyny barlaň",
|
||||
"Verify Phone Number": "Telefon beligiňizi tassyklaň",
|
||||
"Verify Your Email Address": "E-poçta salgyňyzy barlaň",
|
||||
"Visa, Master, Sber, WU": "Visa, Master, Sber, WU",
|
||||
"Visa/Master payment": "Visa/Master tölegler",
|
||||
"Visa/Master payments": "Visa/Master tölegleri",
|
||||
"Visa/Master, Sber Settings": "Visa/Master, Sber sazlamalar",
|
||||
"We send you a verification code to": "Tassyklama belgini şu belgä ugratdyk",
|
||||
"Web Server is Down": "Web Serwer ýapyk",
|
||||
"Welcome Back!": "Hoş geldiňiz!",
|
||||
"Whoops!": "Sahypa tapylmady!",
|
||||
"Widow": "Adamsy ýa-da aýaly aradan çykan",
|
||||
"Work company name": "Işleýän edaranyň/kärhananyň ady",
|
||||
"Work location and your position": "Işleýän ýeriňiz we wezipäňiz",
|
||||
"Work province": "Işleýän etrabyňyz",
|
||||
"Work region": "Işleýän welaýatyňyz",
|
||||
"Work started at": "Işe başlan wagtyňyz",
|
||||
"Write a correct data please": "Dogry maglumat girizmegiňizi Sizden haýyş edýäris.",
|
||||
"You are logged in!": "Sessiýa açdyňyz",
|
||||
"You are receiving this email because we received a password reset request for your account.": "Bu e-poçta alýarsyňyz, sebäbi hasabyňyz üçin paroly täzeden düzmek haýyşyny aldyk.",
|
||||
"Your password has been updated": "Siziň açar sözüňiz üýtgedildi",
|
||||
"Enter your username to continue": "Dowam etmek üçin ulanyjy adyny giriziň",
|
||||
"Old surname (if changed)": "Köne familiýaňyz (eger üýtgän bolsa)"
|
||||
}
|
||||
@@ -1,36 +1,76 @@
|
||||
import { useAuthStore } from '@/app/store/authStore'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { TrendingDown, CreditCard } from 'lucide-react'
|
||||
|
||||
export default function DashboardPage() {
|
||||
const logout = useAuthStore((s) => s.logout)
|
||||
const user = useAuthStore((s) => s.user)
|
||||
const { t } = useTranslation()
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-[var(--bg-base)] p-8">
|
||||
<div className="max-w-4xl mx-auto">
|
||||
<header className="flex justify-between items-center mb-8">
|
||||
<h1 className="text-3xl font-bold text-[var(--text-primary)]">Dashboard</h1>
|
||||
<Button onClick={logout} variant="outline">
|
||||
Logout
|
||||
</Button>
|
||||
</header>
|
||||
|
||||
<main className="grid gap-6">
|
||||
<div className="p-6 bg-[var(--bg-surface)] rounded-[var(--radius-lg)] shadow-[var(--shadow-sm)] border border-[var(--border-default)]">
|
||||
<h2 className="text-xl font-semibold text-[var(--text-primary)] mb-2">Welcome, {user?.username || 'Admin'}!</h2>
|
||||
<p className="text-[var(--text-secondary)]">This is your TBBank Admin Dashboard.</p>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
|
||||
{[1, 2, 3].map((i) => (
|
||||
<div key={i} className="p-4 bg-[var(--bg-surface)] rounded-[var(--radius-md)] border border-[var(--border-default)]">
|
||||
<h3 className="font-medium text-[var(--text-primary)]">Stat {i}</h3>
|
||||
<p className="text-2xl font-bold text-[var(--brand-500)]">0</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</main>
|
||||
<div className="w-full">
|
||||
<div className="mb-6">
|
||||
<h1 className="text-2xl font-semibold text-foreground">{t('Dashboard', 'Baş sahypa')}</h1>
|
||||
</div>
|
||||
|
||||
<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="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>
|
||||
</div>
|
||||
<div className="flex items-center gap-4">
|
||||
<div className="bg-primary/20 p-3 rounded-md">
|
||||
<CreditCard className="text-primary size-6" />
|
||||
</div>
|
||||
<p className="text-4xl font-bold text-foreground">135</p>
|
||||
</div>
|
||||
<div className="mt-4 flex items-center text-destructive text-sm font-medium">
|
||||
<TrendingDown size={16} className="mr-1" />
|
||||
12.34% Pese gaçmak
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="p-6 bg-card rounded-lg 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>
|
||||
</div>
|
||||
<div className="flex items-center">
|
||||
<p className="text-4xl font-bold text-foreground">0</p>
|
||||
</div>
|
||||
<div className="mt-4 h-12 w-full flex items-end">
|
||||
{/* Mock chart */}
|
||||
<svg className="w-full h-full" viewBox="0 0 200 40" preserveAspectRatio="none">
|
||||
<path d="M0,35 L20,30 L40,32 L60,20 L80,25 L100,10 L120,15 L140,5 L160,25 L180,20 L200,30" fill="none" stroke="hsl(var(--primary))" strokeWidth="2" strokeLinejoin="round" />
|
||||
<circle cx="100" cy="10" r="3" fill="hsl(var(--primary))" />
|
||||
<circle cx="140" cy="5" r="3" fill="hsl(var(--primary))" />
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="p-6 bg-card rounded-lg 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>
|
||||
</div>
|
||||
<div className="flex gap-4 items-center">
|
||||
<div className="flex-1 space-y-2 text-sm">
|
||||
<div className="flex items-center gap-2"><span className="size-2 rounded-full bg-yellow-500"></span><span className="text-muted-foreground">Bellige alyndy (1 - 0%)</span></div>
|
||||
<div className="flex items-center gap-2"><span className="size-2 rounded-full bg-green-500"></span><span className="text-muted-foreground">Kanagatlandyrylan (6,746 - 97%)</span></div>
|
||||
<div className="flex items-center gap-2"><span className="size-2 rounded-full bg-red-500"></span><span className="text-muted-foreground">Ýatyrylan (5 - 0%)</span></div>
|
||||
<div className="flex items-center gap-2"><span className="size-2 rounded-full bg-orange-500"></span><span className="text-muted-foreground">Garaşylýar (208 - 3%)</span></div>
|
||||
<div className="flex items-center gap-2"><span className="size-2 rounded-full bg-blue-500"></span><span className="text-muted-foreground">Işlenilýär (8 - 0%)</span></div>
|
||||
</div>
|
||||
<div className="size-20 rounded-full border-8 border-green-500 flex-shrink-0"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div className="text-center text-xs text-muted-foreground mt-8">
|
||||
© 2026 TBBANK.GOV.TM.
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
306
src/pages/loanOrderMobiles/index.tsx
Normal file
306
src/pages/loanOrderMobiles/index.tsx
Normal file
@@ -0,0 +1,306 @@
|
||||
import { useState, useMemo, useCallback } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { Eye, Pencil, Trash2 } from 'lucide-react'
|
||||
import type { ColumnDef, VisibilityState } from '@tanstack/react-table'
|
||||
|
||||
import { DataTable } from '@/components/dataTable'
|
||||
import { DataTableToolbar, type ActiveFilter, type FilterField } from '@/components/dataTableToolbar'
|
||||
import { LoanOrderStatusBadge } from '@/features/loanOrders/components/loanOrderStatusBadge'
|
||||
import {
|
||||
useLoanOrderMobiles,
|
||||
useDeleteLoanOrderMobile,
|
||||
} from '@/features/loanOrderMobiles/hooks/useLoanOrderMobiles'
|
||||
import type { LoanOrderMobile, LoanOrderMobileStatus } from '@/features/loanOrderMobiles/api/loanOrderMobilesApi'
|
||||
|
||||
// ─── Column IDs ────────────────────────────────────────────────────────────────
|
||||
|
||||
const COLUMN_IDS = [
|
||||
'id',
|
||||
'loanType',
|
||||
'createdAt',
|
||||
'region',
|
||||
'branch',
|
||||
'firstName',
|
||||
'lastName',
|
||||
'phone',
|
||||
'status',
|
||||
] as const
|
||||
|
||||
// ─── 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' },
|
||||
]
|
||||
|
||||
// ─── Page Component ────────────────────────────────────────────────────────────
|
||||
|
||||
export default function LoanOrderMobilesPage() {
|
||||
const { t } = useTranslation()
|
||||
const deleteMutation = useDeleteLoanOrderMobile()
|
||||
|
||||
// ── State ──────────────────────────────────────────────────────────────────
|
||||
const [search, setSearch] = useState('')
|
||||
const [page, setPage] = useState(1)
|
||||
const [perPage, setPerPage] = useState(25)
|
||||
const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({})
|
||||
const [columnOrder, setColumnOrder] = useState<string[]>([...COLUMN_IDS])
|
||||
const [activeFilters, setActiveFilters] = useState<ActiveFilter[]>([
|
||||
{ fieldId: 'region', value: '' },
|
||||
{ fieldId: 'status', value: '' },
|
||||
{ fieldId: 'branch', value: '' },
|
||||
{ fieldId: 'archived', value: '' },
|
||||
])
|
||||
|
||||
// ── Query params ───────────────────────────────────────────────────────────
|
||||
const queryParams = useMemo(() => {
|
||||
const filterMap = Object.fromEntries(activeFilters.map((f) => [f.fieldId, f.value]))
|
||||
return {
|
||||
search: search || undefined,
|
||||
region: filterMap.region || undefined,
|
||||
status: (filterMap.status as LoanOrderMobileStatus) || undefined,
|
||||
branch: filterMap.branch || undefined,
|
||||
archived: filterMap.archived || undefined,
|
||||
page,
|
||||
perPage,
|
||||
}
|
||||
}, [search, activeFilters, page, perPage])
|
||||
|
||||
const { data, isLoading } = useLoanOrderMobiles(queryParams)
|
||||
const totalPages = data ? Math.ceil(data.total / perPage) : 1
|
||||
|
||||
// ── Handlers ───────────────────────────────────────────────────────────────
|
||||
const handleFilterChange = useCallback((fieldId: string, value: string) => {
|
||||
setActiveFilters((prev) => prev.map((f) => (f.fieldId === fieldId ? { ...f, value } : f)))
|
||||
setPage(1)
|
||||
}, [])
|
||||
|
||||
const handleFilterReset = useCallback(() => {
|
||||
setActiveFilters((prev) => prev.map((f) => ({ ...f, value: '' })))
|
||||
setPage(1)
|
||||
}, [])
|
||||
|
||||
const handleDelete = useCallback(
|
||||
(id: string) => {
|
||||
if (!window.confirm(t('loanOrderMobiles.deleteConfirm', 'Bu sargyt pozulsynmy?'))) return
|
||||
deleteMutation.mutate(id)
|
||||
},
|
||||
[deleteMutation, t],
|
||||
)
|
||||
|
||||
// ── Columns ────────────────────────────────────────────────────────────────
|
||||
const columns = useMemo<ColumnDef<LoanOrderMobile>[]>(
|
||||
() => [
|
||||
{
|
||||
id: 'id',
|
||||
accessorKey: 'id',
|
||||
header: t('ID', 'ID'),
|
||||
cell: ({ row }) => (
|
||||
<span className="text-xs font-mono text-muted-foreground">{row.original.id}</span>
|
||||
),
|
||||
size: 130,
|
||||
},
|
||||
{
|
||||
id: 'loanType',
|
||||
accessorKey: 'loanType',
|
||||
header: t('loanOrderMobiles.columns.loanType', 'KARZ GÖRNÜŞI'),
|
||||
cell: ({ row }) => (
|
||||
<span className="text-sm font-medium text-primary hover:underline cursor-pointer">
|
||||
{row.original.loanType}
|
||||
</span>
|
||||
),
|
||||
},
|
||||
{
|
||||
id: 'createdAt',
|
||||
accessorKey: 'createdAt',
|
||||
header: t('loanOrderMobiles.columns.createdAt', 'DÖREDILEN WAGTY'),
|
||||
cell: ({ row }) => (
|
||||
<span className="text-sm text-foreground whitespace-nowrap">{row.original.createdAt}</span>
|
||||
),
|
||||
size: 160,
|
||||
},
|
||||
{
|
||||
id: 'region',
|
||||
accessorKey: 'region',
|
||||
header: t('loanOrderMobiles.columns.region', 'WELAÝAT'),
|
||||
cell: ({ row }) => (
|
||||
<span className="text-sm text-foreground">{row.original.region}</span>
|
||||
),
|
||||
size: 100,
|
||||
},
|
||||
{
|
||||
id: 'branch',
|
||||
accessorKey: 'branch',
|
||||
header: t('loanOrderMobiles.columns.branch', 'ŞAHAMÇA'),
|
||||
cell: ({ row }) => (
|
||||
<span className="text-sm text-emerald-500 font-medium">{row.original.branch}</span>
|
||||
),
|
||||
size: 100,
|
||||
},
|
||||
{
|
||||
id: 'firstName',
|
||||
accessorKey: 'firstName',
|
||||
header: t('loanOrderMobiles.columns.firstName', 'ADY'),
|
||||
cell: ({ row }) => (
|
||||
<span className="text-sm text-foreground">{row.original.firstName}</span>
|
||||
),
|
||||
size: 110,
|
||||
},
|
||||
{
|
||||
id: 'lastName',
|
||||
accessorKey: 'lastName',
|
||||
header: t('loanOrderMobiles.columns.lastName', 'FAMILIÝASY'),
|
||||
cell: ({ row }) => (
|
||||
<span className="text-sm text-foreground">{row.original.lastName}</span>
|
||||
),
|
||||
size: 120,
|
||||
},
|
||||
{
|
||||
id: 'phone',
|
||||
accessorKey: 'phone',
|
||||
header: t('loanOrderMobiles.columns.phone', 'TELEFON'),
|
||||
cell: ({ row }) => (
|
||||
<span className="text-sm font-mono text-foreground">{row.original.phone}</span>
|
||||
),
|
||||
size: 110,
|
||||
},
|
||||
{
|
||||
id: 'status',
|
||||
accessorKey: 'status',
|
||||
header: t('loanOrderMobiles.columns.status', 'STATUS'),
|
||||
cell: ({ row }) => <LoanOrderStatusBadge status={row.original.status} />,
|
||||
size: 180,
|
||||
},
|
||||
{
|
||||
id: 'actions',
|
||||
header: '',
|
||||
enableHiding: false,
|
||||
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"
|
||||
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"
|
||||
title={t('common.edit', 'Üýtgetmek')}
|
||||
>
|
||||
<Pencil size={15} />
|
||||
</button>
|
||||
<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"
|
||||
title={t('common.delete', 'Pozmak')}
|
||||
>
|
||||
<Trash2 size={15} />
|
||||
</button>
|
||||
</div>
|
||||
),
|
||||
size: 100,
|
||||
},
|
||||
],
|
||||
[t, handleDelete, deleteMutation.isPending],
|
||||
)
|
||||
|
||||
// ── Column meta for toolbar ────────────────────────────────────────────────
|
||||
const toggleableColumns = useMemo(
|
||||
() => COLUMN_IDS.map((id) => ({ id, label: t(`loanOrderMobiles.columns.${id}`, id) })),
|
||||
[t],
|
||||
)
|
||||
|
||||
const filterFields = useMemo<FilterField[]>(
|
||||
() => [
|
||||
{
|
||||
id: 'region',
|
||||
label: t('loanOrderMobiles.filters.region', 'WELAÝAT'),
|
||||
options: REGION_OPTIONS,
|
||||
},
|
||||
{
|
||||
id: 'status',
|
||||
label: t('loanOrderMobiles.filters.status', 'STATUS'),
|
||||
options: STATUS_OPTIONS,
|
||||
},
|
||||
{
|
||||
id: 'branch',
|
||||
label: t('loanOrderMobiles.filters.branch', 'ŞAHAMÇA'),
|
||||
options: [],
|
||||
},
|
||||
{
|
||||
id: 'archived',
|
||||
label: t('loanOrderMobiles.filters.archived', 'ARHIWLENEN'),
|
||||
options: [
|
||||
{ value: 'true', label: t('common.yes', 'Hawa') },
|
||||
{ value: 'false', label: t('common.no', 'Ýok') },
|
||||
],
|
||||
},
|
||||
],
|
||||
[t],
|
||||
)
|
||||
|
||||
// ──────────────────────────────────────────────────────────────────────────
|
||||
return (
|
||||
<div className="flex flex-col gap-4">
|
||||
{/* Page Header */}
|
||||
<div className="flex items-center justify-between">
|
||||
<h1 className="text-xl font-semibold text-foreground">
|
||||
{t('loanOrderMobiles.title', 'Karz sargytlary')}
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
{/* Table Card */}
|
||||
<div className="bg-card border border-border rounded-xl p-4">
|
||||
<DataTableToolbar
|
||||
searchValue={search}
|
||||
onSearchChange={(v) => { setSearch(v); setPage(1) }}
|
||||
searchPlaceholder={t('loanOrderMobiles.searchPlaceholder', 'Gözlemek')}
|
||||
columns={toggleableColumns}
|
||||
columnVisibility={columnVisibility}
|
||||
onColumnVisibilityChange={setColumnVisibility}
|
||||
columnOrder={columnOrder}
|
||||
onColumnOrderChange={setColumnOrder}
|
||||
filterFields={filterFields}
|
||||
activeFilters={activeFilters}
|
||||
onFilterChange={handleFilterChange}
|
||||
onFilterReset={handleFilterReset}
|
||||
perPageOptions={[10, 25, 50, 100]}
|
||||
perPage={perPage}
|
||||
onPerPageChange={(v) => { setPerPage(v); setPage(1) }}
|
||||
actionLabel={t('loanOrderMobiles.createButton', 'Karz sargyt dörediň')}
|
||||
onAction={() => {
|
||||
// navigate to create page or open modal
|
||||
}}
|
||||
/>
|
||||
|
||||
<DataTable
|
||||
columns={columns}
|
||||
data={data?.data ?? []}
|
||||
isLoading={isLoading}
|
||||
columnVisibility={columnVisibility}
|
||||
onColumnVisibilityChange={setColumnVisibility}
|
||||
columnOrder={columnOrder}
|
||||
onColumnOrderChange={setColumnOrder}
|
||||
enableRowSelection
|
||||
getRowId={(row) => row.id}
|
||||
currentPage={page}
|
||||
totalPages={totalPages}
|
||||
totalCount={data?.total}
|
||||
onPageChange={setPage}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
297
src/pages/loanOrders/index.tsx
Normal file
297
src/pages/loanOrders/index.tsx
Normal file
@@ -0,0 +1,297 @@
|
||||
import { useState, useMemo, useCallback } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { Eye, Pencil, Trash2 } from 'lucide-react'
|
||||
import type { ColumnDef, VisibilityState } from '@tanstack/react-table'
|
||||
|
||||
import { DataTable } from '@/components/dataTable'
|
||||
import { DataTableToolbar, type ActiveFilter, type FilterField } from '@/components/dataTableToolbar'
|
||||
import { LoanOrderStatusBadge } from '@/features/loanOrders/components/loanOrderStatusBadge'
|
||||
import { useLoanOrders, useDeleteLoanOrder } from '@/features/loanOrders/hooks/useLoanOrders'
|
||||
import type { LoanOrder, LoanOrderStatus } from '@/features/loanOrders/api/loanOrdersApi'
|
||||
|
||||
// ─── Column meta for toggle dropdown ─────────────────────────────────────────
|
||||
|
||||
const COLUMN_IDS = [
|
||||
'id', 'loanType', 'createdAt', 'region', 'branch',
|
||||
'firstName', 'lastName', 'phone', 'status',
|
||||
] as const
|
||||
|
||||
// ─── Filter fields ────────────────────────────────────────────────────────────
|
||||
|
||||
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: LoanOrderStatus; 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' },
|
||||
]
|
||||
|
||||
// ─── Page Component ───────────────────────────────────────────────────────────
|
||||
|
||||
export default function LoanOrdersPage() {
|
||||
const { t } = useTranslation()
|
||||
const deleteMutation = useDeleteLoanOrder()
|
||||
|
||||
// ── State ──────────────────────────────────────────────────────────────────
|
||||
const [search, setSearch] = useState('')
|
||||
const [page, setPage] = useState(1)
|
||||
const [perPage, setPerPage] = useState(25)
|
||||
const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({})
|
||||
const [columnOrder, setColumnOrder] = useState<string[]>([...COLUMN_IDS])
|
||||
const [activeFilters, setActiveFilters] = useState<ActiveFilter[]>([
|
||||
{ fieldId: 'region', value: '' },
|
||||
{ fieldId: 'status', value: '' },
|
||||
{ fieldId: 'branch', value: '' },
|
||||
{ fieldId: 'archived', value: '' },
|
||||
])
|
||||
|
||||
// ── Query params ───────────────────────────────────────────────────────────
|
||||
const queryParams = useMemo(() => {
|
||||
const filterMap = Object.fromEntries(activeFilters.map((f) => [f.fieldId, f.value]))
|
||||
return {
|
||||
search: search || undefined,
|
||||
region: filterMap.region || undefined,
|
||||
status: (filterMap.status as LoanOrderStatus) || undefined,
|
||||
branch: filterMap.branch || undefined,
|
||||
archived: filterMap.archived || undefined,
|
||||
page,
|
||||
perPage,
|
||||
}
|
||||
}, [search, activeFilters, page, perPage])
|
||||
|
||||
const { data, isLoading } = useLoanOrders(queryParams)
|
||||
|
||||
const totalPages = data ? Math.ceil(data.total / perPage) : 1
|
||||
|
||||
// ── Handlers ───────────────────────────────────────────────────────────────
|
||||
const handleFilterChange = useCallback((fieldId: string, value: string) => {
|
||||
setActiveFilters((prev) => prev.map((f) => (f.fieldId === fieldId ? { ...f, value } : f)))
|
||||
setPage(1)
|
||||
}, [])
|
||||
|
||||
const handleFilterReset = useCallback(() => {
|
||||
setActiveFilters((prev) => prev.map((f) => ({ ...f, value: '' })))
|
||||
setPage(1)
|
||||
}, [])
|
||||
|
||||
const handleDelete = useCallback(
|
||||
(id: string) => {
|
||||
if (!window.confirm(t('loanOrders.deleteConfirm', 'Bu sargyt pozulsynmy?'))) return
|
||||
deleteMutation.mutate(id)
|
||||
},
|
||||
[deleteMutation, t]
|
||||
)
|
||||
|
||||
// ── Columns ────────────────────────────────────────────────────────────────
|
||||
const columns = useMemo<ColumnDef<LoanOrder>[]>(
|
||||
() => [
|
||||
{
|
||||
id: 'id',
|
||||
accessorKey: 'id',
|
||||
header: t('ID', 'ID'),
|
||||
cell: ({ row }) => (
|
||||
<span className="text-xs font-mono text-muted-foreground">{row.original.id}</span>
|
||||
),
|
||||
size: 130,
|
||||
},
|
||||
{
|
||||
id: 'loanType',
|
||||
accessorKey: 'loanType',
|
||||
header: t('Loan type', 'KARZ GÖRNÜŞI'),
|
||||
cell: ({ row }) => (
|
||||
<span className="text-sm font-medium text-primary hover:underline cursor-pointer">
|
||||
{row.original.loanType}
|
||||
</span>
|
||||
),
|
||||
},
|
||||
{
|
||||
id: 'createdAt',
|
||||
accessorKey: 'createdAt',
|
||||
header: t('Created at', 'DÖREDILEN WAGTY'),
|
||||
cell: ({ row }) => (
|
||||
<span className="text-sm text-foreground whitespace-nowrap">{row.original.createdAt}</span>
|
||||
),
|
||||
size: 160,
|
||||
},
|
||||
{
|
||||
id: 'region',
|
||||
accessorKey: 'region',
|
||||
header: t('Region', 'WELAÝAT'),
|
||||
cell: ({ row }) => (
|
||||
<span className="text-sm text-foreground">{row.original.region}</span>
|
||||
),
|
||||
size: 100,
|
||||
},
|
||||
{
|
||||
id: 'branch',
|
||||
accessorKey: 'branch',
|
||||
header: t('Branch', 'ŞAHAMÇA'),
|
||||
cell: ({ row }) => (
|
||||
<span className="text-sm text-emerald-500 font-medium">{row.original.branch}</span>
|
||||
),
|
||||
size: 100,
|
||||
},
|
||||
{
|
||||
id: 'firstName',
|
||||
accessorKey: 'firstName',
|
||||
header: t('Name', 'ADY'),
|
||||
cell: ({ row }) => (
|
||||
<span className="text-sm text-foreground">{row.original.firstName}</span>
|
||||
),
|
||||
size: 110,
|
||||
},
|
||||
{
|
||||
id: 'lastName',
|
||||
accessorKey: 'lastName',
|
||||
header: t('Surname', 'FAMILIÝASY'),
|
||||
cell: ({ row }) => (
|
||||
<span className="text-sm text-foreground">{row.original.lastName}</span>
|
||||
),
|
||||
size: 120,
|
||||
},
|
||||
{
|
||||
id: 'phone',
|
||||
accessorKey: 'phone',
|
||||
header: t('Phone', 'TELEFON'),
|
||||
cell: ({ row }) => (
|
||||
<span className="text-sm font-mono text-foreground">{row.original.phone}</span>
|
||||
),
|
||||
size: 110,
|
||||
},
|
||||
{
|
||||
id: 'status',
|
||||
accessorKey: 'status',
|
||||
header: t('Status', 'STATUS'),
|
||||
cell: ({ row }) => <LoanOrderStatusBadge status={row.original.status} />,
|
||||
size: 180,
|
||||
},
|
||||
{
|
||||
id: 'actions',
|
||||
header: '',
|
||||
enableHiding: false,
|
||||
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"
|
||||
title={t('common.view', 'View')}
|
||||
>
|
||||
<Eye size={15} />
|
||||
</button>
|
||||
<button
|
||||
className="p-1.5 rounded hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors"
|
||||
title={t('common.edit', 'Edit')}
|
||||
>
|
||||
<Pencil size={15} />
|
||||
</button>
|
||||
<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"
|
||||
title={t('common.delete', 'Delete')}
|
||||
>
|
||||
<Trash2 size={15} />
|
||||
</button>
|
||||
</div>
|
||||
),
|
||||
size: 100,
|
||||
},
|
||||
],
|
||||
[t, handleDelete, deleteMutation.isPending]
|
||||
)
|
||||
|
||||
// ── Column meta for toolbar ────────────────────────────────────────────────
|
||||
const toggleableColumns = useMemo(
|
||||
() => COLUMN_IDS.map((id) => ({ id, label: t(`loanOrders.columns.${id}`, id) })),
|
||||
[t]
|
||||
)
|
||||
|
||||
const filterFields = useMemo<FilterField[]>(
|
||||
() => [
|
||||
{
|
||||
id: 'region',
|
||||
label: t('Region', 'WELAÝAT'),
|
||||
options: REGION_OPTIONS,
|
||||
},
|
||||
{
|
||||
id: 'status',
|
||||
label: t('Status', 'STATUS'),
|
||||
options: STATUS_OPTIONS,
|
||||
},
|
||||
{
|
||||
id: 'branch',
|
||||
label: t('Branch', 'ŞAHAMÇA'),
|
||||
options: [],
|
||||
},
|
||||
{
|
||||
id: 'archived',
|
||||
label: t('loanOrders.filters.archived', 'ARHIWLENEN'),
|
||||
options: [
|
||||
{ value: 'true', label: t('common.yes', 'Hawa') },
|
||||
{ value: 'false', label: t('common.no', 'Ýok') },
|
||||
],
|
||||
},
|
||||
],
|
||||
[t]
|
||||
)
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────
|
||||
return (
|
||||
<div className="flex flex-col gap-4">
|
||||
{/* Page Header */}
|
||||
<div className="flex items-center justify-between">
|
||||
<h1 className="text-xl font-semibold text-foreground">
|
||||
{t('loanOrders.title', 'Karz sargytlary')}
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
{/* Table Card */}
|
||||
<div className="bg-card border border-border rounded-xl p-4">
|
||||
<DataTableToolbar
|
||||
searchValue={search}
|
||||
onSearchChange={(v) => { setSearch(v); setPage(1) }}
|
||||
searchPlaceholder={t('loanOrders.searchPlaceholder', 'Gözlemek')}
|
||||
columns={toggleableColumns}
|
||||
columnVisibility={columnVisibility}
|
||||
onColumnVisibilityChange={setColumnVisibility}
|
||||
columnOrder={columnOrder}
|
||||
onColumnOrderChange={setColumnOrder}
|
||||
filterFields={filterFields}
|
||||
activeFilters={activeFilters}
|
||||
onFilterChange={handleFilterChange}
|
||||
onFilterReset={handleFilterReset}
|
||||
perPageOptions={[10, 25, 50, 100]}
|
||||
perPage={perPage}
|
||||
onPerPageChange={(v) => { setPerPage(v); setPage(1) }}
|
||||
actionLabel={t('loanOrders.createButton', 'Karz sargyt dörediñ')}
|
||||
onAction={() => {
|
||||
// navigate to create page or open modal
|
||||
}}
|
||||
/>
|
||||
|
||||
<DataTable
|
||||
columns={columns}
|
||||
data={data?.data ?? []}
|
||||
isLoading={isLoading}
|
||||
columnVisibility={columnVisibility}
|
||||
onColumnVisibilityChange={setColumnVisibility}
|
||||
columnOrder={columnOrder}
|
||||
onColumnOrderChange={setColumnOrder}
|
||||
enableRowSelection
|
||||
getRowId={(row) => row.id}
|
||||
currentPage={page}
|
||||
totalPages={totalPages}
|
||||
totalCount={data?.total}
|
||||
onPageChange={setPage}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
293
src/pages/loanPaidOffLetters/index.tsx
Normal file
293
src/pages/loanPaidOffLetters/index.tsx
Normal file
@@ -0,0 +1,293 @@
|
||||
import { useState, useMemo, useCallback } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Eye, Pencil, Trash2, TableProperties } from "lucide-react";
|
||||
import type { ColumnDef, VisibilityState } from "@tanstack/react-table";
|
||||
|
||||
import { DataTable } from "@/components/dataTable";
|
||||
import {
|
||||
DataTableToolbar,
|
||||
type ActiveFilter,
|
||||
type FilterField,
|
||||
} from "@/components/dataTableToolbar";
|
||||
import {
|
||||
useLoanPaidOffLetters,
|
||||
useDeleteLoanPaidOffLetter,
|
||||
} from "@/features/loanPaidOffLetters/hooks/useLoanPaidOffLetters";
|
||||
import type { LoanPaidOffLetter } from "@/features/loanPaidOffLetters/api/loanPaidOffLettersApi";
|
||||
|
||||
// ─── Column IDs ────────────────────────────────────────────────────────────────
|
||||
|
||||
const COLUMN_IDS = [
|
||||
"id",
|
||||
"passportSeries",
|
||||
"passportNumber",
|
||||
"loanAccount",
|
||||
"issuedAt",
|
||||
] as const;
|
||||
|
||||
// ─── Empty state component ─────────────────────────────────────────────────────
|
||||
|
||||
function EmptyState({ onCreate }: { onCreate: () => void }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<div className="flex flex-col items-center justify-center py-20 gap-5">
|
||||
{/* Grid icon matching screenshot */}
|
||||
<div className="text-muted-foreground/40">
|
||||
<TableProperties size={64} strokeWidth={1} />
|
||||
</div>
|
||||
<p className="text-sm text-muted-foreground text-center max-w-sm">
|
||||
{t(
|
||||
"loanPaidOffLetters.emptyMessage",
|
||||
"Berlen kriteriýalara Karzyň ýapylandygy barada güwanama almak gabat gelmedi.",
|
||||
)}
|
||||
</p>
|
||||
<button
|
||||
onClick={onCreate}
|
||||
className="px-4 py-2 rounded-lg border border-border text-sm text-foreground hover:bg-muted/60 transition-colors"
|
||||
>
|
||||
{t(
|
||||
"loanPaidOffLetters.createButton",
|
||||
"Karzyň ýapylandygy barada güwanama almak dörediň",
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// ─── Page Component ────────────────────────────────────────────────────────────
|
||||
|
||||
export default function LoanPaidOffLettersPage() {
|
||||
const { t } = useTranslation();
|
||||
const deleteMutation = useDeleteLoanPaidOffLetter();
|
||||
|
||||
// ── State ──────────────────────────────────────────────────────────────────
|
||||
const [search, setSearch] = useState("");
|
||||
const [page, setPage] = useState(1);
|
||||
const [perPage, setPerPage] = useState(25);
|
||||
const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({});
|
||||
const [columnOrder, setColumnOrder] = useState<string[]>([...COLUMN_IDS]);
|
||||
const [activeFilters, setActiveFilters] = useState<ActiveFilter[]>([]);
|
||||
|
||||
// ── Query ──────────────────────────────────────────────────────────────────
|
||||
const queryParams = useMemo(
|
||||
() => ({ search: search || undefined, page, perPage }),
|
||||
[search, page, perPage],
|
||||
);
|
||||
|
||||
const { data, isLoading } = useLoanPaidOffLetters(queryParams);
|
||||
const totalPages = data ? Math.ceil(data.total / perPage) : 1;
|
||||
const isEmpty = !isLoading && (data?.data?.length ?? 0) === 0;
|
||||
|
||||
// ── Handlers ───────────────────────────────────────────────────────────────
|
||||
const handleFilterChange = useCallback((fieldId: string, value: string) => {
|
||||
setActiveFilters((prev) =>
|
||||
prev.map((f) => (f.fieldId === fieldId ? { ...f, value } : f)),
|
||||
);
|
||||
setPage(1);
|
||||
}, []);
|
||||
|
||||
const handleFilterReset = useCallback(() => {
|
||||
setActiveFilters((prev) => prev.map((f) => ({ ...f, value: "" })));
|
||||
setPage(1);
|
||||
}, []);
|
||||
|
||||
const handleDelete = useCallback(
|
||||
(id: number) => {
|
||||
if (
|
||||
!window.confirm(
|
||||
t("loanPaidOffLetters.deleteConfirm", "Bu ýazgy pozulsynmy?"),
|
||||
)
|
||||
)
|
||||
return;
|
||||
deleteMutation.mutate(id);
|
||||
},
|
||||
[deleteMutation, t],
|
||||
);
|
||||
|
||||
const handleCreate = useCallback(() => {
|
||||
// navigate to create page or open modal
|
||||
}, []);
|
||||
|
||||
// ── Columns ────────────────────────────────────────────────────────────────
|
||||
const columns = useMemo<ColumnDef<LoanPaidOffLetter>[]>(
|
||||
() => [
|
||||
{
|
||||
id: "id",
|
||||
accessorKey: "id",
|
||||
header: t("loanPaidOffLetters.columns.id", "ID"),
|
||||
cell: ({ row }) => (
|
||||
<span className="text-sm font-semibold text-primary">
|
||||
{row.original.id}
|
||||
</span>
|
||||
),
|
||||
size: 80,
|
||||
},
|
||||
{
|
||||
id: "passportSeries",
|
||||
accessorKey: "passportSeries",
|
||||
header: t(
|
||||
"loanPaidOffLetters.columns.passportSeries",
|
||||
"PASPORT SERIÝASY",
|
||||
),
|
||||
cell: ({ row }) => (
|
||||
<span className="text-sm text-foreground">
|
||||
{row.original.passportSeries}
|
||||
</span>
|
||||
),
|
||||
size: 160,
|
||||
},
|
||||
{
|
||||
id: "passportNumber",
|
||||
accessorKey: "passportNumber",
|
||||
header: t(
|
||||
"loanPaidOffLetters.columns.passportNumber",
|
||||
"PASPORT BELGISI",
|
||||
),
|
||||
cell: ({ row }) => (
|
||||
<span className="text-sm font-mono text-foreground">
|
||||
{row.original.passportNumber}
|
||||
</span>
|
||||
),
|
||||
size: 140,
|
||||
},
|
||||
{
|
||||
id: "loanAccount",
|
||||
accessorKey: "loanAccount",
|
||||
header: t("loanPaidOffLetters.columns.loanAccount", "KARZ HASABY"),
|
||||
cell: ({ row }) => (
|
||||
<span className="text-sm font-mono text-foreground">
|
||||
{row.original.loanAccount}
|
||||
</span>
|
||||
),
|
||||
},
|
||||
{
|
||||
id: "issuedAt",
|
||||
accessorKey: "issuedAt",
|
||||
header: t("loanPaidOffLetters.columns.issuedAt", "BERLEN WAGTY"),
|
||||
cell: ({ row }) => (
|
||||
<span className="text-sm text-foreground whitespace-nowrap">
|
||||
{row.original.issuedAt}
|
||||
</span>
|
||||
),
|
||||
size: 160,
|
||||
},
|
||||
{
|
||||
id: "actions",
|
||||
header: "",
|
||||
enableHiding: false,
|
||||
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"
|
||||
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"
|
||||
title={t("common.edit", "Üýtgetmek")}
|
||||
>
|
||||
<Pencil size={15} />
|
||||
</button>
|
||||
<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"
|
||||
title={t("common.delete", "Pozmak")}
|
||||
>
|
||||
<Trash2 size={15} />
|
||||
</button>
|
||||
</div>
|
||||
),
|
||||
size: 100,
|
||||
},
|
||||
],
|
||||
[t, handleDelete, deleteMutation.isPending],
|
||||
);
|
||||
|
||||
// ── Toggleable columns meta ────────────────────────────────────────────────
|
||||
const toggleableColumns = useMemo(
|
||||
() =>
|
||||
COLUMN_IDS.map((id) => ({
|
||||
id,
|
||||
label: t(`loanPaidOffLetters.columns.${id}`, id),
|
||||
})),
|
||||
[t],
|
||||
);
|
||||
|
||||
const filterFields = useMemo<FilterField[]>(() => [], []);
|
||||
|
||||
// ──────────────────────────────────────────────────────────────────────────
|
||||
return (
|
||||
<div className="flex flex-col gap-4">
|
||||
{/* Page Header */}
|
||||
<div className="flex items-center justify-between">
|
||||
<h1 className="text-xl font-semibold text-foreground">
|
||||
{t(
|
||||
"loanPaidOffLetters.title",
|
||||
"Karzyň ýapylandygy barada güwanamalar",
|
||||
)}
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
{/* Table Card */}
|
||||
<div className="bg-card border border-border rounded-xl">
|
||||
{/* Toolbar: column toggle + filter (right side only, matches screenshot) */}
|
||||
<div className="px-4 pt-3 pb-2 border-b border-border">
|
||||
<DataTableToolbar
|
||||
searchValue={search}
|
||||
onSearchChange={(v) => {
|
||||
setSearch(v);
|
||||
setPage(1);
|
||||
}}
|
||||
searchPlaceholder={t("common.search", "Gözlemek")}
|
||||
columns={toggleableColumns}
|
||||
columnVisibility={columnVisibility}
|
||||
onColumnVisibilityChange={setColumnVisibility}
|
||||
columnOrder={columnOrder}
|
||||
onColumnOrderChange={setColumnOrder}
|
||||
filterFields={filterFields}
|
||||
activeFilters={activeFilters}
|
||||
onFilterChange={handleFilterChange}
|
||||
onFilterReset={handleFilterReset}
|
||||
perPageOptions={[10, 25, 50, 100]}
|
||||
perPage={perPage}
|
||||
onPerPageChange={(v) => {
|
||||
setPerPage(v);
|
||||
setPage(1);
|
||||
}}
|
||||
actionLabel={t(
|
||||
"loanPaidOffLetters.createButton",
|
||||
"Karzyň ýapylandygy barada güwanama almak dörediň",
|
||||
)}
|
||||
onAction={handleCreate}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Empty state OR table */}
|
||||
{isEmpty ? (
|
||||
<EmptyState onCreate={handleCreate} />
|
||||
) : (
|
||||
<div className="p-4">
|
||||
<DataTable
|
||||
columns={columns}
|
||||
data={data?.data ?? []}
|
||||
isLoading={isLoading}
|
||||
columnVisibility={columnVisibility}
|
||||
onColumnVisibilityChange={setColumnVisibility}
|
||||
columnOrder={columnOrder}
|
||||
onColumnOrderChange={setColumnOrder}
|
||||
enableRowSelection
|
||||
getRowId={(row) => String(row.id)}
|
||||
currentPage={page}
|
||||
totalPages={totalPages}
|
||||
totalCount={data?.total}
|
||||
onPageChange={setPage}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
189
src/pages/loanRemaining/index.tsx
Normal file
189
src/pages/loanRemaining/index.tsx
Normal file
@@ -0,0 +1,189 @@
|
||||
import { useState, useMemo, useCallback } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { Eye, Pencil, Trash2 } from 'lucide-react'
|
||||
import type { ColumnDef, VisibilityState } from '@tanstack/react-table'
|
||||
|
||||
import { DataTable } from '@/components/dataTable'
|
||||
import { DataTableToolbar, type ActiveFilter, type FilterField } from '@/components/dataTableToolbar'
|
||||
import { useLoanRemaining, useDeleteLoanRemaining } from '@/features/loanRemaining/hooks/useLoanRemaining'
|
||||
import type { LoanRemaining } from '@/features/loanRemaining/api/loanRemainingApi'
|
||||
|
||||
// ─── Column IDs ────────────────────────────────────────────────────────────────
|
||||
|
||||
const COLUMN_IDS = ['id', 'passportSeries', 'passportNumber', 'loanAccount'] as const
|
||||
|
||||
// ─── Page Component ────────────────────────────────────────────────────────────
|
||||
|
||||
export default function LoanRemainingPage() {
|
||||
const { t } = useTranslation()
|
||||
const deleteMutation = useDeleteLoanRemaining()
|
||||
|
||||
// ── State ──────────────────────────────────────────────────────────────────
|
||||
const [search, setSearch] = useState('')
|
||||
const [page, setPage] = useState(1)
|
||||
const [perPage, setPerPage] = useState(25)
|
||||
const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({})
|
||||
const [columnOrder, setColumnOrder] = useState<string[]>([...COLUMN_IDS])
|
||||
const [activeFilters, setActiveFilters] = useState<ActiveFilter[]>([])
|
||||
|
||||
// ── Query ──────────────────────────────────────────────────────────────────
|
||||
const queryParams = useMemo(
|
||||
() => ({ search: search || undefined, page, perPage }),
|
||||
[search, page, perPage],
|
||||
)
|
||||
|
||||
const { data, isLoading } = useLoanRemaining(queryParams)
|
||||
const totalPages = data ? Math.ceil(data.total / perPage) : 1
|
||||
|
||||
// ── Handlers ───────────────────────────────────────────────────────────────
|
||||
const handleFilterChange = useCallback((fieldId: string, value: string) => {
|
||||
setActiveFilters((prev) => prev.map((f) => (f.fieldId === fieldId ? { ...f, value } : f)))
|
||||
setPage(1)
|
||||
}, [])
|
||||
|
||||
const handleFilterReset = useCallback(() => {
|
||||
setActiveFilters((prev) => prev.map((f) => ({ ...f, value: '' })))
|
||||
setPage(1)
|
||||
}, [])
|
||||
|
||||
const handleDelete = useCallback(
|
||||
(id: number) => {
|
||||
if (!window.confirm(t('loanRemaining.deleteConfirm', 'Bu ýazgy pozulsynmy?'))) return
|
||||
deleteMutation.mutate(id)
|
||||
},
|
||||
[deleteMutation, t],
|
||||
)
|
||||
|
||||
// ── Columns ────────────────────────────────────────────────────────────────
|
||||
const columns = useMemo<ColumnDef<LoanRemaining>[]>(
|
||||
() => [
|
||||
{
|
||||
id: 'id',
|
||||
accessorKey: 'id',
|
||||
header: t('loanRemaining.columns.id', 'ID'),
|
||||
cell: ({ row }) => (
|
||||
<span className="text-sm font-semibold text-primary">{row.original.id}</span>
|
||||
),
|
||||
size: 80,
|
||||
},
|
||||
{
|
||||
id: 'passportSeries',
|
||||
accessorKey: 'passportSeries',
|
||||
header: t('loanRemaining.columns.passportSeries', 'PASPORT SERIÝASY'),
|
||||
cell: ({ row }) => (
|
||||
<span className="text-sm text-foreground">{row.original.passportSeries}</span>
|
||||
),
|
||||
size: 160,
|
||||
},
|
||||
{
|
||||
id: 'passportNumber',
|
||||
accessorKey: 'passportNumber',
|
||||
header: t('loanRemaining.columns.passportNumber', 'PASPORT BELGISI'),
|
||||
cell: ({ row }) => (
|
||||
<span className="text-sm font-mono text-foreground">{row.original.passportNumber}</span>
|
||||
),
|
||||
size: 140,
|
||||
},
|
||||
{
|
||||
id: 'loanAccount',
|
||||
accessorKey: 'loanAccount',
|
||||
header: t('loanRemaining.columns.loanAccount', 'KARZ HASABY'),
|
||||
cell: ({ row }) => (
|
||||
<span className="text-sm font-mono text-foreground">{row.original.loanAccount}</span>
|
||||
),
|
||||
},
|
||||
{
|
||||
id: 'actions',
|
||||
header: '',
|
||||
enableHiding: false,
|
||||
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"
|
||||
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"
|
||||
title={t('common.edit', 'Üýtgetmek')}
|
||||
>
|
||||
<Pencil size={15} />
|
||||
</button>
|
||||
<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"
|
||||
title={t('common.delete', 'Pozmak')}
|
||||
>
|
||||
<Trash2 size={15} />
|
||||
</button>
|
||||
</div>
|
||||
),
|
||||
size: 100,
|
||||
},
|
||||
],
|
||||
[t, handleDelete, deleteMutation.isPending],
|
||||
)
|
||||
|
||||
// ── Toggleable columns meta ────────────────────────────────────────────────
|
||||
const toggleableColumns = useMemo(
|
||||
() => COLUMN_IDS.map((id) => ({ id, label: t(`loanRemaining.columns.${id}`, id) })),
|
||||
[t],
|
||||
)
|
||||
|
||||
const filterFields = useMemo<FilterField[]>(() => [], [])
|
||||
|
||||
// ──────────────────────────────────────────────────────────────────────────
|
||||
return (
|
||||
<div className="flex flex-col gap-4">
|
||||
{/* Page Header */}
|
||||
<div className="flex items-center justify-between">
|
||||
<h1 className="text-xl font-semibold text-foreground">
|
||||
{t('loanRemaining.title', 'Karzyň galyndysy')}
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
{/* Table Card */}
|
||||
<div className="bg-card border border-border rounded-xl p-4">
|
||||
<DataTableToolbar
|
||||
searchValue={search}
|
||||
onSearchChange={(v) => { setSearch(v); setPage(1) }}
|
||||
searchPlaceholder={t('common.search', 'Gözlemek')}
|
||||
columns={toggleableColumns}
|
||||
columnVisibility={columnVisibility}
|
||||
onColumnVisibilityChange={setColumnVisibility}
|
||||
columnOrder={columnOrder}
|
||||
onColumnOrderChange={setColumnOrder}
|
||||
filterFields={filterFields}
|
||||
activeFilters={activeFilters}
|
||||
onFilterChange={handleFilterChange}
|
||||
onFilterReset={handleFilterReset}
|
||||
perPageOptions={[10, 25, 50, 100]}
|
||||
perPage={perPage}
|
||||
onPerPageChange={(v) => { setPerPage(v); setPage(1) }}
|
||||
actionLabel={t('loanRemaining.createButton', 'Karzyň galyndysy dörediň')}
|
||||
onAction={() => {
|
||||
// navigate to create page or open modal
|
||||
}}
|
||||
/>
|
||||
|
||||
<DataTable
|
||||
columns={columns}
|
||||
data={data?.data ?? []}
|
||||
isLoading={isLoading}
|
||||
columnVisibility={columnVisibility}
|
||||
onColumnVisibilityChange={setColumnVisibility}
|
||||
columnOrder={columnOrder}
|
||||
onColumnOrderChange={setColumnOrder}
|
||||
enableRowSelection
|
||||
getRowId={(row) => String(row.id)}
|
||||
currentPage={page}
|
||||
totalPages={totalPages}
|
||||
totalCount={data?.total}
|
||||
onPageChange={setPage}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1,54 +1,256 @@
|
||||
import { AuthLayout } from "@/layouts/AuthLayout";
|
||||
import React, { useState } from "react";
|
||||
import BankImage from "@/assets/bank-img.png";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { useLogin } from "@/features/auth/hooks/useLogin";
|
||||
import { useState } from "react";
|
||||
import { useThemeStore } from "@/app/store/themeStore";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Sun, Moon, Globe } from "lucide-react";
|
||||
import { toast } from "sonner";
|
||||
|
||||
export default function LoginPage() {
|
||||
const [username, setUsername] = useState("");
|
||||
const [password, setPassword] = useState("");
|
||||
const { login, isLoading } = useLogin();
|
||||
type AuthView = "login" | "register" | "reset-password";
|
||||
|
||||
const handleSubmit = (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
login({ username, password });
|
||||
function LeftPanel() {
|
||||
return (
|
||||
<div className="w-[55%] hidden md:block overflow-hidden min-w-0 bg-muted">
|
||||
<img src={BankImage} alt="Bank Logo" className="w-full h-full object-cover opacity-90 dark:opacity-80" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function Header() {
|
||||
const { theme, toggleTheme } = useThemeStore();
|
||||
const { i18n } = useTranslation();
|
||||
|
||||
const changeLanguage = (lang: string) => {
|
||||
i18n.changeLanguage(lang);
|
||||
localStorage.setItem("tbbank-lang", lang);
|
||||
};
|
||||
|
||||
return (
|
||||
<AuthLayout>
|
||||
<div className="w-full max-w-md p-8 bg-[var(--bg-surface)] rounded-[var(--radius-lg)] shadow-[var(--shadow-lg)] border border-[var(--border-default)]">
|
||||
<h1 className="text-2xl font-bold text-[var(--text-primary)] mb-6 text-center">
|
||||
Login
|
||||
</h1>
|
||||
<form onSubmit={handleSubmit} className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-medium text-[var(--text-secondary)]">
|
||||
Username
|
||||
</label>
|
||||
<Input
|
||||
value={username}
|
||||
onChange={(e) => setUsername(e.target.value)}
|
||||
placeholder="Enter your username"
|
||||
required
|
||||
/>
|
||||
<div className="flex justify-between items-center px-6 py-3 border-b border-border text-[13px] bg-background">
|
||||
<span className="font-semibold text-foreground">"TÜRKMENBAŞY" PTB ©</span>
|
||||
<div className="flex items-center gap-4 text-muted-foreground">
|
||||
<span className="hidden sm:inline">(+99312) 44-42-34</span>
|
||||
<button
|
||||
onClick={toggleTheme}
|
||||
className="p-1.5 rounded-md hover:bg-accent text-foreground transition-colors"
|
||||
aria-label="Toggle theme"
|
||||
>
|
||||
{theme === "dark" ? <Sun size={16} /> : <Moon size={16} />}
|
||||
</button>
|
||||
<div className="flex items-center gap-1.5 bg-accent/50 px-2 py-1 rounded-md">
|
||||
<Globe size={14} className="text-foreground" />
|
||||
<div className="flex gap-1 items-center ml-1">
|
||||
{["tk", "ru", "en"].map((lang, idx) => (
|
||||
<React.Fragment key={lang}>
|
||||
<span
|
||||
onClick={() => changeLanguage(lang)}
|
||||
className={`cursor-pointer uppercase font-medium transition-colors hover:text-foreground ${
|
||||
i18n.language === lang ? "text-foreground" : "text-muted-foreground"
|
||||
}`}
|
||||
>
|
||||
{lang}
|
||||
</span>
|
||||
{idx < 2 && <span className="text-border">|</span>}
|
||||
</React.Fragment>
|
||||
))}
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-medium text-[var(--text-secondary)]">
|
||||
Password
|
||||
</label>
|
||||
<Input
|
||||
type="password"
|
||||
value={password}
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
placeholder="Enter your password"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<Button type="submit" className="w-full" isLoading={isLoading}>
|
||||
Sign In
|
||||
</Button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</AuthLayout>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
interface FormInputProps extends Omit<React.ComponentProps<typeof Input>, "onChange" | "value"> {
|
||||
label: string;
|
||||
value: string;
|
||||
onChange: (val: string) => void;
|
||||
}
|
||||
|
||||
function FormInput({
|
||||
label,
|
||||
value,
|
||||
onChange,
|
||||
...props
|
||||
}: FormInputProps) {
|
||||
return (
|
||||
<div className="mb-4">
|
||||
<label className="block text-[13px] font-medium text-foreground mb-1.5">
|
||||
{label}
|
||||
</label>
|
||||
<Input
|
||||
value={value}
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
className="bg-background border-input focus-visible:ring-primary"
|
||||
{...props}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default function AuthPage() {
|
||||
const { t } = useTranslation();
|
||||
const loginMutation = useLogin();
|
||||
const [view, setView] = useState<AuthView>("login");
|
||||
const [username, setUsername] = useState("");
|
||||
const [password, setPassword] = useState("");
|
||||
const [confirmPassword, setConfirmPassword] = useState("");
|
||||
const [phone, setPhone] = useState("");
|
||||
const [fullName, setFullName] = useState("");
|
||||
|
||||
const handleLogin = () => {
|
||||
if (!username || !password) {
|
||||
toast.error(t("Write a correct data please", "Please enter valid data"));
|
||||
return;
|
||||
}
|
||||
|
||||
loginMutation.mutate({ email: username, password }, {
|
||||
onError: () => {
|
||||
toast.error(t("Server Error", "An error occurred during login"));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Mock submit for other views
|
||||
const handleOtherSubmit = async () => {
|
||||
toast.info(t("Not Implemented", "This feature is not implemented yet"));
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex flex-col h-screen bg-background text-foreground font-sans">
|
||||
<Header />
|
||||
<div className="flex flex-1 w-full overflow-hidden">
|
||||
<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">
|
||||
{view === "login" && (
|
||||
<>
|
||||
<h2 className="text-[22px] font-normal text-foreground text-center mb-2 tracking-wide uppercase">
|
||||
{t("Online panel", "ONLAÝN KABULHANA")}
|
||||
</h2>
|
||||
<div className="w-14 h-0.5 bg-primary mx-auto mb-7" />
|
||||
|
||||
<FormInput
|
||||
label={t("Phone or username", "Telefon ýada ulanyjy ady")}
|
||||
value={username}
|
||||
onChange={setUsername}
|
||||
placeholder="65999990 ýada ulanyjy_ady"
|
||||
/>
|
||||
<FormInput
|
||||
label={t("Password")}
|
||||
type="password"
|
||||
value={password}
|
||||
onChange={setPassword}
|
||||
/>
|
||||
|
||||
<div className="text-right mb-6 -mt-2">
|
||||
<span
|
||||
onClick={() => setView("reset-password")}
|
||||
className="text-[13px] text-primary cursor-pointer hover:underline"
|
||||
>
|
||||
{t("Forgot your password?")}
|
||||
</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="text-center mt-8">
|
||||
<span className="text-[13px] text-muted-foreground underline cursor-pointer hover:text-foreground transition-colors">
|
||||
Privacy Policy
|
||||
</span>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{view === "register" && (
|
||||
<>
|
||||
<h2 className="text-xl font-normal text-foreground text-center mb-2">
|
||||
{t("Online panel", "Onlaýn kabulhana")}
|
||||
</h2>
|
||||
<div className="w-14 h-0.5 bg-primary mx-auto mb-7" />
|
||||
|
||||
<FormInput
|
||||
label={t("Full Name")}
|
||||
value={fullName}
|
||||
onChange={setFullName}
|
||||
/>
|
||||
<FormInput label={t("Phone")} value={phone} onChange={setPhone} />
|
||||
<FormInput
|
||||
label={t("Username")}
|
||||
value={username}
|
||||
onChange={setUsername}
|
||||
/>
|
||||
<FormInput
|
||||
label={t("Password")}
|
||||
type="password"
|
||||
value={password}
|
||||
onChange={setPassword}
|
||||
/>
|
||||
<FormInput
|
||||
label={t("Confirm Password")}
|
||||
type="password"
|
||||
value={confirmPassword}
|
||||
onChange={setConfirmPassword}
|
||||
/>
|
||||
|
||||
<div className="flex flex-col gap-3 mt-4">
|
||||
<Button onClick={handleOtherSubmit}>
|
||||
{t("Register")}
|
||||
</Button>
|
||||
<Button variant="outline" onClick={() => setView("login")}>
|
||||
{t("Go to login page")}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className="text-center mt-8">
|
||||
<span className="text-[13px] text-muted-foreground underline cursor-pointer hover:text-foreground transition-colors">
|
||||
Privacy Policy
|
||||
</span>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{view === "reset-password" && (
|
||||
<>
|
||||
<h2 className="text-lg font-normal text-foreground text-center mb-2 leading-relaxed">
|
||||
{t("Enter your username to continue")}
|
||||
</h2>
|
||||
<div className="w-14 h-0.5 bg-primary mx-auto mb-7" />
|
||||
|
||||
<FormInput
|
||||
label={t("Username")}
|
||||
value={username}
|
||||
onChange={setUsername}
|
||||
/>
|
||||
|
||||
<div className="mt-4 flex flex-col gap-3">
|
||||
<Button onClick={handleOtherSubmit}>
|
||||
{t("Submit")}
|
||||
</Button>
|
||||
<Button variant="outline" onClick={() => setView("login")}>
|
||||
{t("Go to login page")}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className="text-center mt-8">
|
||||
<span className="text-[13px] text-muted-foreground underline cursor-pointer hover:text-foreground transition-colors">
|
||||
Privacy Policy
|
||||
</span>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user