51 lines
1.9 KiB
TypeScript
51 lines
1.9 KiB
TypeScript
import { apiDelete, apiGet, apiPatch, apiPost } from "./axios";
|
|
import type { FeeApiResponse } from "../types/api";
|
|
|
|
export interface ContractFeePayload {
|
|
project_id: string;
|
|
center_id: string;
|
|
contract_amount: number;
|
|
contract_cases: number;
|
|
actual_cases?: number | null;
|
|
settlement_amount?: number | null;
|
|
final_payment_amount?: number | null;
|
|
}
|
|
|
|
export interface ContractFeeUpdatePayload {
|
|
contract_amount?: number;
|
|
contract_cases?: number;
|
|
actual_cases?: number | null;
|
|
settlement_amount?: number | null;
|
|
final_payment_amount?: number | null;
|
|
}
|
|
|
|
export interface ContractPaymentPayload {
|
|
amount: number;
|
|
paid_date?: string | null;
|
|
verified_date?: string | null;
|
|
is_paid?: boolean;
|
|
is_verified?: boolean;
|
|
remark?: string | null;
|
|
}
|
|
|
|
export const listContractFees = (params: { projectId: string; centerId?: string; q?: string }) =>
|
|
apiGet<FeeApiResponse<any[]>>("/api/v1/fees/contracts", { params });
|
|
|
|
export const getContractFee = (contractId: string) => apiGet<FeeApiResponse<any>>(`/api/v1/fees/contracts/${contractId}`);
|
|
|
|
export const createContractFee = (payload: ContractFeePayload) =>
|
|
apiPost<FeeApiResponse<any>>("/api/v1/fees/contracts", payload);
|
|
|
|
export const updateContractFee = (contractId: string, payload: ContractFeeUpdatePayload) =>
|
|
apiPatch<FeeApiResponse<any>>(`/api/v1/fees/contracts/${contractId}`, payload);
|
|
|
|
export const deleteContractFee = (contractId: string) => apiDelete(`/api/v1/fees/contracts/${contractId}`);
|
|
|
|
export const createContractPayment = (contractId: string, payload: ContractPaymentPayload) =>
|
|
apiPost<FeeApiResponse<any>>(`/api/v1/fees/contracts/${contractId}/payments`, payload);
|
|
|
|
export const updateContractPayment = (paymentId: string, payload: ContractPaymentPayload) =>
|
|
apiPatch<FeeApiResponse<any>>(`/api/v1/fees/payments/${paymentId}`, payload);
|
|
|
|
export const deleteContractPayment = (paymentId: string) => apiDelete(`/api/v1/fees/payments/${paymentId}`);
|