ifixkart-admin/services/api/billingFinanceService.ts

41 lines
1.1 KiB
TypeScript

import { apiFetch } from './client';
export interface BulkQuotation {
quote_id: string;
tenant_id?: string;
quote_number: string;
customer_id?: string;
customer_name?: string;
customer_phone?: string;
customer_email?: string;
company_name?: string;
gst_number?: string;
status: string; // DRAFT, SENT, APPROVED, REJECTED, CONVERTED_TO_INVOICE
subtotal: number;
discount_amount?: number;
tax_amount: number;
grand_total: number;
notes?: string;
items?: any[];
created_at: string;
}
export const billingFinanceService = {
getQuotations: async (status?: string) => {
const query = status ? `?status=${encodeURIComponent(status)}` : '';
return apiFetch<BulkQuotation[]>(`/api/v1/billing-finance/quotations${query}`);
},
createQuotation: async (data: any) => {
return apiFetch<BulkQuotation>('/api/v1/billing-finance/quotations', {
method: 'POST',
body: JSON.stringify(data),
});
},
convertToInvoice: async (quoteId: string) => {
return apiFetch(`/api/v1/billing-finance/quotations/${quoteId}/convert`, {
method: 'POST',
});
}
};