added loan remaing pages
This commit is contained in:
@@ -18,6 +18,114 @@ export interface LoanOrderMobile {
|
||||
lastName: string
|
||||
phone: string
|
||||
status: LoanOrderMobileStatus
|
||||
createdBy?: string
|
||||
|
||||
// ── Detail fields ─────────────────────────────────────────────────────────
|
||||
patronicName?: string | null
|
||||
education?: string | null
|
||||
marriageStatus?: string | null
|
||||
dateOfBirth?: string | null
|
||||
residence?: string | null
|
||||
currentResidence?: string | null
|
||||
|
||||
// Passport
|
||||
passportSerie?: string | null
|
||||
passportNumber?: string | null
|
||||
passportDateOfIssue?: string | null
|
||||
passportGivenBy?: string | null
|
||||
bornPlace?: string | null
|
||||
passportPage1Url?: string | null
|
||||
passportPage23Url?: string | null
|
||||
passportPage89Url?: string | null
|
||||
passportPage32Url?: string | null
|
||||
|
||||
// Contact
|
||||
email?: string | null
|
||||
phoneAdditional?: string | null
|
||||
homePhone?: string | null
|
||||
|
||||
// Employment
|
||||
workCompany?: string | null
|
||||
workHrPhone?: string | null
|
||||
workRegion?: string | null
|
||||
workProvince?: string | null
|
||||
position?: string | null
|
||||
salary?: number | null
|
||||
workStartedAt?: string | null
|
||||
|
||||
// New fields
|
||||
note?: string | null
|
||||
loanAmount?: number | null
|
||||
loanHistory?: string | null
|
||||
|
||||
// Card (Zähmet haky)
|
||||
cardNumber?: string | null
|
||||
cardName?: string | null
|
||||
cardExpMonth?: string | null
|
||||
cardExpYear?: string | null
|
||||
|
||||
// Guarantor (Zamun)
|
||||
guarantor1Name?: string | null
|
||||
guarantor1Surname?: string | null
|
||||
guarantor1Patronic?: string | null
|
||||
guarantor1PassportSerie?: string | null
|
||||
guarantor1PassportNumber?: string | null
|
||||
guarantor1CardNumber?: string | null
|
||||
guarantor1CardName?: string | null
|
||||
guarantor1CardExpMonth?: string | null
|
||||
guarantor1CardExpYear?: string | null
|
||||
guarantor1Salary?: number | null
|
||||
}
|
||||
|
||||
export interface LoanOrderMobilePayload {
|
||||
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
|
||||
|
||||
note?: string
|
||||
loanAmount?: number
|
||||
loanHistory?: string
|
||||
|
||||
cardNumber?: string
|
||||
cardName?: string
|
||||
cardExpMonth?: string
|
||||
cardExpYear?: string
|
||||
|
||||
guarantor1Name?: string
|
||||
guarantor1Surname?: string
|
||||
guarantor1Patronic?: string
|
||||
guarantor1PassportSerie?: string
|
||||
guarantor1PassportNumber?: string
|
||||
guarantor1CardNumber?: string
|
||||
guarantor1CardName?: string
|
||||
guarantor1CardExpMonth?: string
|
||||
guarantor1CardExpYear?: string
|
||||
guarantor1Salary?: number
|
||||
}
|
||||
|
||||
export interface LoanOrderMobileListParams {
|
||||
@@ -102,4 +210,45 @@ export async function deleteLoanOrderMobile(id: string): Promise<void> {
|
||||
return
|
||||
}
|
||||
await apiClient.delete(`/loan-order-mobiles/${id}`)
|
||||
}
|
||||
|
||||
export async function getLoanOrderMobileById(id: string): Promise<LoanOrderMobile> {
|
||||
if (USE_MOCK) {
|
||||
const order = MOCK_DATA.find((r) => r.id === id)
|
||||
if (!order) throw new Error('Not found')
|
||||
return order
|
||||
}
|
||||
const { data } = await apiClient.get<LoanOrderMobile>(`/loan-order-mobiles/${id}`)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function createLoanOrderMobile(
|
||||
payload: LoanOrderMobilePayload
|
||||
): Promise<LoanOrderMobile> {
|
||||
if (USE_MOCK) {
|
||||
const newOrder: LoanOrderMobile = {
|
||||
...payload,
|
||||
id: `LOM-${String(MOCK_DATA.length + 1).padStart(4, '0')}`,
|
||||
createdAt: new Date().toISOString().slice(0, 16).replace('T', ' '),
|
||||
status: payload.status as LoanOrderMobileStatus,
|
||||
}
|
||||
MOCK_DATA.unshift(newOrder)
|
||||
return newOrder
|
||||
}
|
||||
const { data } = await apiClient.post<LoanOrderMobile>('/loan-order-mobiles', payload)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function updateLoanOrderMobile(
|
||||
id: string,
|
||||
payload: Partial<LoanOrderMobilePayload>
|
||||
): Promise<LoanOrderMobile> {
|
||||
if (USE_MOCK) {
|
||||
const idx = MOCK_DATA.findIndex((r) => r.id === id)
|
||||
if (idx === -1) throw new Error('Not found')
|
||||
MOCK_DATA[idx] = { ...MOCK_DATA[idx], ...payload } as LoanOrderMobile
|
||||
return MOCK_DATA[idx]
|
||||
}
|
||||
const { data } = await apiClient.put<LoanOrderMobile>(`/loan-order-mobiles/${id}`, payload)
|
||||
return data
|
||||
}
|
||||
Reference in New Issue
Block a user