mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-15 17:24:10 +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>
101 lines
2.9 KiB
TypeScript
101 lines
2.9 KiB
TypeScript
import { client } from '../client'
|
|
import { API } from '../endpoints'
|
|
import type { Company } from '@v2/types/domain/company'
|
|
import type { ApiResponse } from '@v2/types/api'
|
|
|
|
export interface UpdateCompanyPayload {
|
|
name: string
|
|
vat_id?: string | null
|
|
tax_id?: string | null
|
|
phone?: string | null
|
|
address?: {
|
|
address_street_1?: string | null
|
|
address_street_2?: string | null
|
|
city?: string | null
|
|
state?: string | null
|
|
country_id?: number | null
|
|
zip?: string | null
|
|
phone?: string | null
|
|
}
|
|
}
|
|
|
|
export interface CompanySettingsPayload {
|
|
settings: Record<string, string | number | boolean | null>
|
|
}
|
|
|
|
export interface CreateCompanyPayload {
|
|
name: string
|
|
currency?: number
|
|
address?: Record<string, unknown>
|
|
}
|
|
|
|
export const companyService = {
|
|
async update(payload: UpdateCompanyPayload): Promise<ApiResponse<Company>> {
|
|
const { data } = await client.put(API.COMPANY, payload)
|
|
return data
|
|
},
|
|
|
|
async uploadLogo(payload: FormData): Promise<ApiResponse<Company>> {
|
|
const { data } = await client.post(API.COMPANY_UPLOAD_LOGO, payload)
|
|
return data
|
|
},
|
|
|
|
async getSettings(settings?: string[]): Promise<Record<string, string>> {
|
|
const { data } = await client.get(API.COMPANY_SETTINGS, {
|
|
params: { settings },
|
|
})
|
|
return data
|
|
},
|
|
|
|
async updateSettings(payload: CompanySettingsPayload): Promise<{ success: boolean }> {
|
|
const { data } = await client.post(API.COMPANY_SETTINGS, payload)
|
|
return data
|
|
},
|
|
|
|
async hasTransactions(): Promise<{ has_transactions: boolean }> {
|
|
const { data } = await client.get(API.COMPANY_HAS_TRANSACTIONS)
|
|
return data
|
|
},
|
|
|
|
async create(payload: CreateCompanyPayload): Promise<ApiResponse<Company>> {
|
|
const { data } = await client.post(API.COMPANIES, payload)
|
|
return data
|
|
},
|
|
|
|
async listUserCompanies(): Promise<ApiResponse<Company[]>> {
|
|
const { data } = await client.get(API.COMPANIES)
|
|
return data
|
|
},
|
|
|
|
async delete(payload: { id: number }): Promise<{ success: boolean }> {
|
|
const { data } = await client.post(API.COMPANIES_DELETE, payload)
|
|
return data
|
|
},
|
|
|
|
async transferOwnership(userId: number): Promise<{ success: boolean }> {
|
|
const { data } = await client.post(`${API.TRANSFER_OWNERSHIP}/${userId}`)
|
|
return data
|
|
},
|
|
|
|
// Company Mail Configuration
|
|
async getMailDefaultConfig(): Promise<Record<string, unknown>> {
|
|
const { data } = await client.get(API.COMPANY_MAIL_DEFAULT_CONFIG)
|
|
return data
|
|
},
|
|
|
|
async getMailConfig(): Promise<Record<string, unknown>> {
|
|
const { data } = await client.get(API.COMPANY_MAIL_CONFIG)
|
|
return data
|
|
},
|
|
|
|
async saveMailConfig(payload: Record<string, unknown>): Promise<{ success: boolean }> {
|
|
const { data } = await client.post(API.COMPANY_MAIL_CONFIG, payload)
|
|
return data
|
|
},
|
|
|
|
async testMailConfig(payload: Record<string, unknown>): Promise<{ success: boolean }> {
|
|
const { data } = await client.post(API.COMPANY_MAIL_TEST, payload)
|
|
return data
|
|
},
|
|
}
|