mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-15 01:04:03 +00:00
build passes Create all missing components (modals, dropdowns, icons, tabs, mail drivers, customer partials), fix all @/scripts/ imports to @v2/, wire up vite entry point and blade template. 382 files, 48883 lines. - 27 settings components: modals (tax, payment, custom field, note, category, role, exchange rate, unit, mail test), dropdowns (6), customization tabs (4), mail driver forms (4) - 22 icon components: 5 utility icons, 4 dashboard icons, 13 editor toolbar icons with typed barrel export - 3 customer components: info, chart placeholder, custom fields single - Fixed usePopper composable, client/format-money import patterns - Zero remaining @/scripts/ imports in scripts-v2/ Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
115 lines
3.1 KiB
TypeScript
115 lines
3.1 KiB
TypeScript
import { client } from '../client'
|
|
import { API } from '../endpoints'
|
|
import type { Estimate, CreateEstimatePayload } from '@v2/types/domain/estimate'
|
|
import type { Invoice } from '@v2/types/domain/invoice'
|
|
import type {
|
|
ApiResponse,
|
|
ListParams,
|
|
DateRangeParams,
|
|
NextNumberResponse,
|
|
DeletePayload,
|
|
} from '@v2/types/api'
|
|
|
|
export interface EstimateListParams extends ListParams, DateRangeParams {
|
|
status?: string
|
|
customer_id?: number
|
|
}
|
|
|
|
export interface EstimateListMeta {
|
|
current_page: number
|
|
last_page: number
|
|
per_page: number
|
|
total: number
|
|
estimate_total_count: number
|
|
}
|
|
|
|
export interface EstimateListResponse {
|
|
data: Estimate[]
|
|
meta: EstimateListMeta
|
|
}
|
|
|
|
export interface SendEstimatePayload {
|
|
id: number
|
|
subject?: string
|
|
body?: string
|
|
from?: string
|
|
to?: string
|
|
is_preview?: boolean
|
|
}
|
|
|
|
export interface EstimateStatusPayload {
|
|
id: number
|
|
status: string
|
|
}
|
|
|
|
export interface EstimateTemplate {
|
|
name: string
|
|
path: string
|
|
}
|
|
|
|
export interface EstimateTemplatesResponse {
|
|
estimateTemplates: EstimateTemplate[]
|
|
}
|
|
|
|
export const estimateService = {
|
|
async list(params?: EstimateListParams): Promise<EstimateListResponse> {
|
|
const { data } = await client.get(API.ESTIMATES, { params })
|
|
return data
|
|
},
|
|
|
|
async get(id: number): Promise<ApiResponse<Estimate>> {
|
|
const { data } = await client.get(`${API.ESTIMATES}/${id}`)
|
|
return data
|
|
},
|
|
|
|
async create(payload: CreateEstimatePayload): Promise<ApiResponse<Estimate>> {
|
|
const { data } = await client.post(API.ESTIMATES, payload)
|
|
return data
|
|
},
|
|
|
|
async update(id: number, payload: Partial<CreateEstimatePayload>): Promise<ApiResponse<Estimate>> {
|
|
const { data } = await client.put(`${API.ESTIMATES}/${id}`, payload)
|
|
return data
|
|
},
|
|
|
|
async delete(payload: DeletePayload): Promise<{ success: boolean }> {
|
|
const { data } = await client.post(API.ESTIMATES_DELETE, payload)
|
|
return data
|
|
},
|
|
|
|
async send(payload: SendEstimatePayload): Promise<ApiResponse<Estimate>> {
|
|
const { data } = await client.post(`${API.ESTIMATES}/${payload.id}/send`, payload)
|
|
return data
|
|
},
|
|
|
|
async sendPreview(id: number, params?: Record<string, unknown>): Promise<ApiResponse<string>> {
|
|
const { data } = await client.get(`${API.ESTIMATES}/${id}/send/preview`, { params })
|
|
return data
|
|
},
|
|
|
|
async clone(id: number): Promise<ApiResponse<Estimate>> {
|
|
const { data } = await client.post(`${API.ESTIMATES}/${id}/clone`)
|
|
return data
|
|
},
|
|
|
|
async changeStatus(payload: EstimateStatusPayload): Promise<ApiResponse<Estimate>> {
|
|
const { data } = await client.post(`${API.ESTIMATES}/${payload.id}/status`, payload)
|
|
return data
|
|
},
|
|
|
|
async convertToInvoice(id: number): Promise<ApiResponse<Invoice>> {
|
|
const { data } = await client.post(`${API.ESTIMATES}/${id}/convert-to-invoice`)
|
|
return data
|
|
},
|
|
|
|
async getNextNumber(params?: { key?: string }): Promise<NextNumberResponse> {
|
|
const { data } = await client.get(API.NEXT_NUMBER, { params: { key: 'estimate', ...params } })
|
|
return data
|
|
},
|
|
|
|
async getTemplates(): Promise<EstimateTemplatesResponse> {
|
|
const { data } = await client.get(API.ESTIMATE_TEMPLATES)
|
|
return data
|
|
},
|
|
}
|