diff --git a/src/app/router/index.tsx b/src/app/router/index.tsx
index 126dd5c..f342435 100644
--- a/src/app/router/index.tsx
+++ b/src/app/router/index.tsx
@@ -127,6 +127,8 @@ const DistrictsViewPage = lazy(() => import("@/pages/settings/location/districts
const DistrictEditPage = lazy(() => import("@/pages/settings/location/districtsEdit"));
const BranchesPage = lazy(() => import("@/pages/settings/location/branches"));
+
+const BackupsPage = lazy(() => import("@/pages/backups"));
const BranchCreatePage = lazy(() => import("@/pages/settings/location/branchesCreate"));
const BranchesViewPage = lazy(() => import("@/pages/settings/location/branchesView"));
const BranchEditPage = lazy(() => import("@/pages/settings/location/branchesEdit"));
@@ -949,6 +951,15 @@ export const router = createBrowserRouter([
),
},
+ {
+ // Sidebar: /backups
+ path: "/backups",
+ element: (
+ }>
+
+
+ ),
+ },
{
// Sidebar: /settings/location/branches
path: "/settings/location/branches",
diff --git a/src/components/creditCardVisual.tsx b/src/components/creditCardVisual.tsx
index c29654b..e895ab7 100644
--- a/src/components/creditCardVisual.tsx
+++ b/src/components/creditCardVisual.tsx
@@ -32,7 +32,7 @@ export function CreditCardVisual({
return (
{/* Glow effects */}
diff --git a/src/components/dataTable.tsx b/src/components/dataTable.tsx
index 44aa8ce..9fd4319 100644
--- a/src/components/dataTable.tsx
+++ b/src/components/dataTable.tsx
@@ -124,7 +124,8 @@ interface SelectAllDropdownProps {
isAllTotalSelected: boolean
totalCount: number
pageCount: number
- onSelectPage: (checked: boolean) => void
+ onTogglePage: (checked: boolean) => void
+ onSelectThisPage: () => void
onSelectAll: () => void
onClearAll: () => void
}
@@ -135,7 +136,8 @@ function SelectAllDropdown({
isAllTotalSelected,
totalCount,
pageCount,
- onSelectPage,
+ onTogglePage,
+ onSelectThisPage,
onSelectAll,
onClearAll,
}: SelectAllDropdownProps) {
@@ -143,28 +145,42 @@ function SelectAllDropdown({
const ref = useRef
(null)
useOutsideClick(ref, () => setOpen(false))
- const checkboxChecked = isAllPageSelected || (isSomePageSelected && 'indeterminate')
+ const checkboxChecked = isAllTotalSelected || isAllPageSelected
+ ? true
+ : isSomePageSelected
+ ? 'indeterminate'
+ : false
return (
-
+
onSelectPage(!!value)}
+ checked={checkboxChecked}
+ onCheckedChange={(value) => onTogglePage(!!value)}
aria-label="Select all on page"
+ onClick={(e) => e.stopPropagation()}
+ className="after:content-none"
/>
{open && (
-
+
),
- cell: ({ row }) => (
-
row.toggleSelected(!!value)}
- aria-label="Select row"
- onClick={(e) => e.stopPropagation()}
- />
- ),
+ cell: ({ row, table }) => {
+ const isSelected = allTotalSelected || row.getIsSelected()
+ return (
+ {
+ if (allTotalSelected && !value) {
+ const newSelection: RowSelectionState = {}
+ table.getRowModel().rows.forEach((r) => {
+ if (r.id !== row.id) {
+ newSelection[r.id] = true
+ }
+ })
+ table.setRowSelection(newSelection)
+ setAllTotalSelected(false)
+ } else {
+ row.toggleSelected(!!value)
+ }
+ }}
+ aria-label="Select row"
+ onClick={(e) => e.stopPropagation()}
+ />
+ )
+ },
enableSorting: false,
enableHiding: false,
size: 48,
@@ -357,6 +405,7 @@ export function DataTable({
{
table.toggleAllPageRowsSelected(false)
+ table.setRowSelection({})
setAllTotalSelected(false)
}}
className="text-xs text-muted-foreground hover:text-foreground transition-colors"
diff --git a/src/features/backups/api/backupsApi.ts b/src/features/backups/api/backupsApi.ts
new file mode 100644
index 0000000..c113fa1
--- /dev/null
+++ b/src/features/backups/api/backupsApi.ts
@@ -0,0 +1,78 @@
+import apiClient from '@/lib/api/client'
+
+export type BackupStatus = 'completed' | 'failed' | 'in_progress'
+
+export interface Backup {
+ id: number
+ fileName: string
+ fileSize: string
+ status: BackupStatus
+ createdAt: string
+ createdBy: string
+}
+
+export interface BackupListResponse {
+ data: Backup[]
+ total: number
+ page: number
+ per_page: number
+}
+
+export interface BackupListParams {
+ page?: number
+ per_page?: number
+ search?: string
+}
+
+const MOCK_BACKUPS: Backup[] = [
+ { id: 1, fileName: 'backup_2026_05_22_01.sql', fileSize: '256 MB', status: 'completed', createdAt: '2026-05-22 03:00', createdBy: 'Admin' },
+ { id: 2, fileName: 'backup_2026_05_21_01.sql', fileSize: '251 MB', status: 'completed', createdAt: '2026-05-21 03:00', createdBy: 'Admin' },
+ { id: 3, fileName: 'backup_2026_05_20_01.sql', fileSize: '248 MB', status: 'completed', createdAt: '2026-05-20 03:00', createdBy: 'Admin' },
+ { id: 4, fileName: 'backup_2026_05_19_01.sql', fileSize: '245 MB', status: 'failed', createdAt: '2026-05-19 03:05', createdBy: 'Admin' },
+ { id: 5, fileName: 'backup_2026_05_18_01.sql', fileSize: '242 MB', status: 'completed', createdAt: '2026-05-18 03:00', createdBy: 'System' },
+]
+
+export const backupsApi = {
+ getAll: async (params?: BackupListParams): Promise => {
+ const { data } = await apiClient.get('/backups', { params }).catch(() => ({ data: null }))
+ if (data) return data
+
+ const { search = '', page = 1, per_page = 25 } = params ?? {}
+ let filtered = [...MOCK_BACKUPS]
+ if (search) {
+ const s = search.toLowerCase()
+ filtered = filtered.filter((b) => b.fileName.toLowerCase().includes(s))
+ }
+ const total = filtered.length
+ const start = (page - 1) * per_page
+ return { data: filtered.slice(start, start + per_page), total, page, per_page }
+ },
+
+ create: async (): Promise => {
+ const { data } = await apiClient.post('/backups').catch(() => ({ data: null }))
+ if (data) return data
+
+ const newBackup: Backup = {
+ id: Math.floor(Math.random() * 10000),
+ fileName: `backup_${new Date().toISOString().slice(0, 10).replace(/-/g, '_')}_01.sql`,
+ fileSize: '0 MB',
+ status: 'in_progress',
+ createdAt: new Date().toLocaleString('tr-TR'),
+ createdBy: 'Admin',
+ }
+ MOCK_BACKUPS.unshift(newBackup)
+ return newBackup
+ },
+
+ download: async (id: number): Promise => {
+ const { data } = await apiClient.get(`/backups/${id}/download`, { responseType: 'blob' }).catch(() => ({ data: null }))
+ if (data) return data
+ return new Blob(['mock backup content'], { type: 'application/sql' })
+ },
+
+ delete: async (id: number): Promise => {
+ await apiClient.delete(`/backups/${id}`).catch(() => {})
+ const index = MOCK_BACKUPS.findIndex((b) => b.id === id)
+ if (index !== -1) MOCK_BACKUPS.splice(index, 1)
+ },
+}
diff --git a/src/features/backups/hooks/useBackups.ts b/src/features/backups/hooks/useBackups.ts
new file mode 100644
index 0000000..b147839
--- /dev/null
+++ b/src/features/backups/hooks/useBackups.ts
@@ -0,0 +1,58 @@
+import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
+import { toast } from 'sonner'
+import { useTranslation } from 'react-i18next'
+import { backupsApi, type BackupListParams } from '../api/backupsApi'
+
+const QUERY_KEY = 'backups'
+
+export function useBackups(params?: BackupListParams) {
+ return useQuery({
+ queryKey: [QUERY_KEY, params],
+ queryFn: () => backupsApi.getAll(params),
+ })
+}
+
+export function useCreateBackup() {
+ const queryClient = useQueryClient()
+ const { t } = useTranslation()
+
+ return useMutation({
+ mutationFn: () => backupsApi.create(),
+ onSuccess: () => {
+ queryClient.invalidateQueries({ queryKey: [QUERY_KEY] })
+ toast.success(t('backups.toast.created', 'Backup üstünlikli döredildi!'))
+ },
+ })
+}
+
+export function useDownloadBackup() {
+ const { t } = useTranslation()
+
+ return useMutation({
+ mutationFn: async (id: number) => {
+ const blob = await backupsApi.download(id)
+ const url = URL.createObjectURL(blob)
+ const a = document.createElement('a')
+ a.href = url
+ a.download = `backup-${id}.sql`
+ a.click()
+ URL.revokeObjectURL(url)
+ },
+ onSuccess: () => {
+ toast.success(t('backups.toast.downloaded', 'Backup üstünlikli ýüklenildi'))
+ },
+ })
+}
+
+export function useDeleteBackup() {
+ const queryClient = useQueryClient()
+ const { t } = useTranslation()
+
+ return useMutation({
+ mutationFn: (id: number) => backupsApi.delete(id),
+ onSuccess: () => {
+ queryClient.invalidateQueries({ queryKey: [QUERY_KEY] })
+ toast.success(t('backups.toast.deleted', 'Backup üstünlikli pozuldy!'))
+ },
+ })
+}
diff --git a/src/features/currencyRates/components/currencyRatesForm.tsx b/src/features/currencyRates/components/currencyRatesForm.tsx
index cc5dd9f..e0cb994 100644
--- a/src/features/currencyRates/components/currencyRatesForm.tsx
+++ b/src/features/currencyRates/components/currencyRatesForm.tsx
@@ -121,7 +121,7 @@ export function CurrencyRateForm({ mode, initialData }: CurrencyRateFormProps) {
? t('currencyRates.createTitle', 'Walýuta kursy dörediň')
: t('currencyRates.editTitle', 'Walýuta kursy üýtgetmek')}
-
+
{/* Currency From */}