added new pages
This commit is contained in:
1 parent
f834f29e53
commit
648ce5a172
35 files changed
+2857
-177
No files matched your search
@@ -22,39 +22,6 @@ const MOCK_DATA: LoanOrder[] = [
|
||||
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',
|
||||
}
|
||||
];
|
||||
|
||||
@@ -104,6 +71,39 @@ export interface CreateLoanOrderPayload {
|
||||
phone: string
|
||||
}
|
||||
|
||||
// Add this to your existing loanOrdersApi.ts
|
||||
|
||||
export interface LoanOrderCreatePayload {
|
||||
status: string
|
||||
loanType: string
|
||||
region: string
|
||||
branch: string
|
||||
firstName: string
|
||||
lastName: string
|
||||
patronicName?: string
|
||||
education: string
|
||||
marriageStatus: string
|
||||
dateOfBirth: string
|
||||
residence: string
|
||||
currentResidence?: string
|
||||
passportSerie: string
|
||||
passportNumber: string
|
||||
passportDateOfIssue: string
|
||||
passportGivenBy: string
|
||||
bornPlace?: string
|
||||
email?: string
|
||||
phone: string
|
||||
phoneAdditional?: string
|
||||
homePhone?: string
|
||||
workCompany: string
|
||||
workHrPhone?: string
|
||||
workRegion?: string
|
||||
workProvince?: string
|
||||
position: string
|
||||
salary: number
|
||||
workStartedAt: string
|
||||
}
|
||||
|
||||
// ─── API Functions ────────────────────────────────────────────────────────────
|
||||
|
||||
export async function fetchLoanOrders(
|
||||
@@ -112,6 +112,9 @@ export async function fetchLoanOrders(
|
||||
// Hakyky API ýok wagty simulator (800ms garaşdyrýar)
|
||||
await new Promise((resolve) => setTimeout(resolve, 800));
|
||||
|
||||
const page = params.page || 1;
|
||||
const perPage = params.perPage || 25;
|
||||
|
||||
// Gözleg (search) logic-ni simulirlemek (optional)
|
||||
const filtered = MOCK_DATA.filter(item =>
|
||||
!params.search ||
|
||||
@@ -119,12 +122,18 @@ export async function fetchLoanOrders(
|
||||
item.id.toLowerCase().includes(params.search.toLowerCase())
|
||||
);
|
||||
|
||||
// Sayfalama mantığı (slice)
|
||||
const start = (page - 1) * perPage;
|
||||
const end = start + perPage;
|
||||
const paginatedData = filtered.slice(start, end);
|
||||
|
||||
return {
|
||||
data: filtered,
|
||||
data: paginatedData,
|
||||
total: filtered.length,
|
||||
page: params.page || 1,
|
||||
perPage: params.perPage || 25,
|
||||
};}
|
||||
page,
|
||||
perPage,
|
||||
};
|
||||
}
|
||||
|
||||
// export async function fetchLoanOrders(
|
||||
// params: LoanOrdersParams
|
||||
@@ -159,4 +168,69 @@ export async function updateLoanOrder(
|
||||
|
||||
export async function deleteLoanOrder(id: string): Promise<void> {
|
||||
await apiClient.delete(`/resources/loan-orders/${id}`)
|
||||
}
|
||||
|
||||
// ─── Extend this into your existing loanOrdersApi.ts ─────────────────────────
|
||||
// Add the fields below to your existing LoanOrder interface.
|
||||
// The list page already uses: id, loanType, createdAt, region, branch,
|
||||
// firstName, lastName, phone, status.
|
||||
|
||||
export interface LoanOrder {
|
||||
// ── List fields (already exist) ──────────────────────────────────────────
|
||||
id: string
|
||||
loanType: string
|
||||
createdAt: string
|
||||
region: string
|
||||
branch: string
|
||||
firstName: string
|
||||
lastName: string
|
||||
phone: string
|
||||
status: LoanOrderStatus
|
||||
|
||||
// ── Detail-only fields ────────────────────────────────────────────────────
|
||||
amount?: string | null
|
||||
loanAmount?: string | null
|
||||
createdBy?: string | null
|
||||
|
||||
// Personal
|
||||
fullName?: string | null
|
||||
education?: string | null
|
||||
maritalStatus?: string | null
|
||||
birthDate?: string | null
|
||||
registeredAddress?: string | null
|
||||
currentAddress?: string | null
|
||||
|
||||
// Contacts
|
||||
email?: string | null
|
||||
phoneAlt?: string | null
|
||||
homePhone?: string | null
|
||||
|
||||
// Employment
|
||||
employer?: string | null
|
||||
deptPhone?: string | null
|
||||
workRegion?: string | null
|
||||
workCity?: string | null
|
||||
position?: string | null
|
||||
salary?: string | null
|
||||
employedSince?: string | null
|
||||
|
||||
// Passport
|
||||
passportNumber?: string | null
|
||||
passportIssuedBy?: string | null
|
||||
passportBirthPlace?: string | null
|
||||
passportPage1Url?: string | null
|
||||
passportPage23Url?: string | null
|
||||
passportPage89Url?: string | null
|
||||
passportPage32Url?: string | null
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ─── Add this function to your existing loanOrdersApi.ts ──────────────────────
|
||||
// import { apiClient } from '@/lib/api/client'
|
||||
|
||||
export async function getLoanOrderById(id: string): Promise<LoanOrder> {
|
||||
const { data } = await apiClient.get<LoanOrder>(`/loan-orders/${id}`)
|
||||
return data
|
||||
}
|
||||
Reference in new issue
Block a user