mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-19 03:04:05 +00:00
Rename resources/scripts-v2 to resources/scripts and drop @v2 alias
Now that the legacy v1 frontend (commit 064bdf53) is gone, the v2 directory is the only frontend and the v2 suffix is just noise. Renames resources/scripts-v2 to resources/scripts via git mv (so git records the move as renames, preserving blame and log --follow), then bulk-rewrites the 152 files that imported via @v2/... to use @/scripts/... instead. The existing @ alias (resources/) covers the new path with no extra config needed.
Drops the now-unused @v2 alias from vite.config.js and points the laravel-vite-plugin entry at resources/scripts/main.ts. Updates the only blade reference (resources/views/app.blade.php) to match. The package.json test script (eslint ./resources/scripts) automatically targets the right place after the rename without any edit.
Verified: npm run build exits clean and the Vite warning lines now reference resources/scripts/plugins/i18n.ts, confirming every import resolved through the new path. git log --follow on any moved file walks back through its scripts-v2 history.
This commit is contained in:
41
resources/scripts/types/api.ts
Normal file
41
resources/scripts/types/api.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
export interface ApiResponse<T> {
|
||||
data: T
|
||||
}
|
||||
|
||||
export interface PaginatedResponse<T> {
|
||||
data: T[]
|
||||
meta: PaginationMeta
|
||||
}
|
||||
|
||||
export interface PaginationMeta {
|
||||
current_page: number
|
||||
last_page: number
|
||||
per_page: number
|
||||
total: number
|
||||
}
|
||||
|
||||
export interface ApiError {
|
||||
message: string
|
||||
errors?: Record<string, string[]>
|
||||
}
|
||||
|
||||
export interface ListParams {
|
||||
page?: number
|
||||
limit?: number | 'all'
|
||||
orderByField?: string
|
||||
orderBy?: 'asc' | 'desc'
|
||||
search?: string
|
||||
}
|
||||
|
||||
export interface DateRangeParams {
|
||||
from_date?: string
|
||||
to_date?: string
|
||||
}
|
||||
|
||||
export interface NextNumberResponse {
|
||||
nextNumber: string
|
||||
}
|
||||
|
||||
export interface DeletePayload {
|
||||
ids: number[]
|
||||
}
|
||||
48
resources/scripts/types/domain/company.ts
Normal file
48
resources/scripts/types/domain/company.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import type { Address } from './user'
|
||||
import type { Role } from './role'
|
||||
import type { User } from './user'
|
||||
|
||||
export interface Company {
|
||||
id: number
|
||||
name: string
|
||||
vat_id: string | null
|
||||
tax_id: string | null
|
||||
logo: string | null
|
||||
logo_path: string | null
|
||||
unique_hash: string
|
||||
owner_id: number
|
||||
slug: string
|
||||
created_at: string
|
||||
updated_at: string
|
||||
address?: Address
|
||||
owner?: User
|
||||
roles: Role[]
|
||||
user_role?: string | null
|
||||
}
|
||||
|
||||
export interface CompanySetting {
|
||||
id: number
|
||||
company_id: number
|
||||
option: string
|
||||
value: string | null
|
||||
}
|
||||
|
||||
export interface CompanyInvitation {
|
||||
id: number
|
||||
company_id: number
|
||||
email: string
|
||||
token: string
|
||||
status: CompanyInvitationStatus
|
||||
expires_at: string
|
||||
created_at: string
|
||||
company?: Company
|
||||
role?: Role
|
||||
invited_by?: User
|
||||
}
|
||||
|
||||
export enum CompanyInvitationStatus {
|
||||
PENDING = 'pending',
|
||||
ACCEPTED = 'accepted',
|
||||
DECLINED = 'declined',
|
||||
EXPIRED = 'expired',
|
||||
}
|
||||
32
resources/scripts/types/domain/currency.ts
Normal file
32
resources/scripts/types/domain/currency.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
export interface Currency {
|
||||
id: number
|
||||
name: string
|
||||
code: string
|
||||
symbol: string
|
||||
precision: number
|
||||
thousand_separator: string
|
||||
decimal_separator: string
|
||||
swap_currency_symbol: boolean
|
||||
exchange_rate: number
|
||||
}
|
||||
|
||||
export interface ExchangeRateLog {
|
||||
id: number
|
||||
company_id: number
|
||||
base_currency_id: number
|
||||
currency_id: number
|
||||
exchange_rate: number
|
||||
created_at: string
|
||||
updated_at: string
|
||||
}
|
||||
|
||||
export interface ExchangeRateProvider {
|
||||
id: number
|
||||
key: string
|
||||
driver: string
|
||||
currencies: string[]
|
||||
driver_config: Record<string, string>
|
||||
company_id: number
|
||||
active: boolean
|
||||
company?: import('./company').Company
|
||||
}
|
||||
62
resources/scripts/types/domain/custom-field.ts
Normal file
62
resources/scripts/types/domain/custom-field.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
import type { Company } from './company'
|
||||
|
||||
export type CustomFieldType =
|
||||
| 'Text'
|
||||
| 'Textarea'
|
||||
| 'Phone'
|
||||
| 'URL'
|
||||
| 'Number'
|
||||
| 'Dropdown'
|
||||
| 'Switch'
|
||||
| 'Date'
|
||||
| 'Time'
|
||||
| 'DateTime'
|
||||
|
||||
export type CustomFieldModelType =
|
||||
| 'Customer'
|
||||
| 'Invoice'
|
||||
| 'Estimate'
|
||||
| 'Payment'
|
||||
| 'Expense'
|
||||
|
||||
export interface CustomField {
|
||||
id: number
|
||||
name: string
|
||||
slug: string
|
||||
label: string
|
||||
model_type: CustomFieldModelType
|
||||
type: CustomFieldType
|
||||
placeholder: string | null
|
||||
options: string[] | null
|
||||
boolean_answer: boolean | null
|
||||
date_answer: string | null
|
||||
time_answer: string | null
|
||||
string_answer: string | null
|
||||
number_answer: number | null
|
||||
date_time_answer: string | null
|
||||
is_required: boolean
|
||||
in_use: boolean
|
||||
order: number | null
|
||||
company_id: number
|
||||
default_answer: string | boolean | number | null
|
||||
company?: Company
|
||||
}
|
||||
|
||||
export interface CustomFieldValue {
|
||||
id: number
|
||||
custom_field_valuable_type: string
|
||||
custom_field_valuable_id: number
|
||||
type: CustomFieldType
|
||||
boolean_answer: boolean | null
|
||||
date_answer: string | null
|
||||
time_answer: string | null
|
||||
string_answer: string | null
|
||||
number_answer: number | null
|
||||
date_time_answer: string | null
|
||||
custom_field_id: number
|
||||
company_id: number
|
||||
default_answer: string | boolean | number | null
|
||||
default_formatted_answer: string | null
|
||||
custom_field?: CustomField
|
||||
company?: Company
|
||||
}
|
||||
57
resources/scripts/types/domain/customer.ts
Normal file
57
resources/scripts/types/domain/customer.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
import type { Currency } from './currency'
|
||||
import type { Company } from './company'
|
||||
import type { Address } from './user'
|
||||
import type { CustomFieldValue } from './custom-field'
|
||||
|
||||
export interface Country {
|
||||
id: number
|
||||
code: string
|
||||
name: string
|
||||
phone_code: number
|
||||
}
|
||||
|
||||
export interface Customer {
|
||||
id: number
|
||||
name: string
|
||||
email: string | null
|
||||
phone: string | null
|
||||
contact_name: string | null
|
||||
company_name: string | null
|
||||
website: string | null
|
||||
enable_portal: boolean
|
||||
password_added: boolean
|
||||
currency_id: number | null
|
||||
company_id: number
|
||||
facebook_id: string | null
|
||||
google_id: string | null
|
||||
github_id: string | null
|
||||
created_at: string
|
||||
updated_at: string
|
||||
formatted_created_at: string
|
||||
avatar: string | number
|
||||
due_amount: number | null
|
||||
base_due_amount: number | null
|
||||
prefix: string | null
|
||||
tax_id: string | null
|
||||
billing?: Address
|
||||
shipping?: Address
|
||||
fields?: CustomFieldValue[]
|
||||
company?: Company
|
||||
currency?: Currency
|
||||
}
|
||||
|
||||
export interface CreateCustomerPayload {
|
||||
name: string
|
||||
contact_name?: string
|
||||
email?: string
|
||||
phone?: string | null
|
||||
password?: string
|
||||
confirm_password?: string
|
||||
currency_id: number | null
|
||||
website?: string | null
|
||||
billing?: Partial<Address>
|
||||
shipping?: Partial<Address>
|
||||
enable_portal?: boolean
|
||||
customFields?: CustomFieldValue[]
|
||||
fields?: CustomFieldValue[]
|
||||
}
|
||||
119
resources/scripts/types/domain/estimate.ts
Normal file
119
resources/scripts/types/domain/estimate.ts
Normal file
@@ -0,0 +1,119 @@
|
||||
import type { Customer } from './customer'
|
||||
import type { User } from './user'
|
||||
import type { Company } from './company'
|
||||
import type { Currency } from './currency'
|
||||
import type { Tax } from './tax'
|
||||
import type { CustomFieldValue } from './custom-field'
|
||||
import type { DiscountType } from './invoice'
|
||||
|
||||
export enum EstimateStatus {
|
||||
DRAFT = 'DRAFT',
|
||||
SENT = 'SENT',
|
||||
VIEWED = 'VIEWED',
|
||||
EXPIRED = 'EXPIRED',
|
||||
ACCEPTED = 'ACCEPTED',
|
||||
REJECTED = 'REJECTED',
|
||||
}
|
||||
|
||||
export interface EstimateItem {
|
||||
id: number | string
|
||||
name: string
|
||||
description: string | null
|
||||
discount_type: DiscountType
|
||||
quantity: number
|
||||
unit_name: string | null
|
||||
discount: number
|
||||
discount_val: number
|
||||
price: number
|
||||
tax: number
|
||||
total: number
|
||||
item_id: number | null
|
||||
estimate_id: number | null
|
||||
company_id: number
|
||||
exchange_rate: number
|
||||
base_discount_val: number
|
||||
base_price: number
|
||||
base_tax: number
|
||||
base_total: number
|
||||
taxes?: Tax[]
|
||||
fields?: CustomFieldValue[]
|
||||
}
|
||||
|
||||
export interface Estimate {
|
||||
id: number
|
||||
estimate_date: string
|
||||
expiry_date: string
|
||||
estimate_number: string
|
||||
status: EstimateStatus
|
||||
reference_number: string | null
|
||||
tax_per_item: string | null
|
||||
tax_included: boolean | null
|
||||
discount_per_item: string | null
|
||||
notes: string | null
|
||||
discount: number
|
||||
discount_type: DiscountType
|
||||
discount_val: number
|
||||
sub_total: number
|
||||
total: number
|
||||
tax: number
|
||||
unique_hash: string
|
||||
creator_id: number
|
||||
template_name: string | null
|
||||
customer_id: number
|
||||
exchange_rate: number
|
||||
base_discount_val: number
|
||||
base_sub_total: number
|
||||
base_total: number
|
||||
base_tax: number
|
||||
sequence_number: number
|
||||
currency_id: number
|
||||
formatted_expiry_date: string
|
||||
formatted_estimate_date: string
|
||||
estimate_pdf_url: string
|
||||
sales_tax_type: string | null
|
||||
sales_tax_address_type: string | null
|
||||
items?: EstimateItem[]
|
||||
customer?: Customer
|
||||
creator?: User
|
||||
taxes?: Tax[]
|
||||
fields?: CustomFieldValue[]
|
||||
company?: Company
|
||||
currency?: Currency
|
||||
}
|
||||
|
||||
export interface CreateEstimatePayload {
|
||||
estimate_date: string
|
||||
expiry_date: string
|
||||
estimate_number: string
|
||||
reference_number?: string | null
|
||||
customer_id: number
|
||||
template_name?: string | null
|
||||
notes?: string | null
|
||||
discount_type?: DiscountType
|
||||
discount?: number
|
||||
discount_val?: number
|
||||
tax_per_item?: string | null
|
||||
tax_included?: boolean | null
|
||||
discount_per_item?: string | null
|
||||
sales_tax_type?: string | null
|
||||
sales_tax_address_type?: string | null
|
||||
items: CreateEstimateItemPayload[]
|
||||
taxes?: Partial<Tax>[]
|
||||
customFields?: CustomFieldValue[]
|
||||
fields?: CustomFieldValue[]
|
||||
}
|
||||
|
||||
export interface CreateEstimateItemPayload {
|
||||
item_id?: number | null
|
||||
name: string
|
||||
description?: string | null
|
||||
quantity: number
|
||||
price: number
|
||||
discount_type?: DiscountType
|
||||
discount?: number
|
||||
discount_val?: number
|
||||
tax?: number
|
||||
total?: number
|
||||
taxes?: Partial<Tax>[]
|
||||
unit_name?: string | null
|
||||
}
|
||||
72
resources/scripts/types/domain/expense.ts
Normal file
72
resources/scripts/types/domain/expense.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
import type { Customer } from './customer'
|
||||
import type { User } from './user'
|
||||
import type { Company } from './company'
|
||||
import type { Currency } from './currency'
|
||||
import type { PaymentMethod } from './payment'
|
||||
import type { CustomFieldValue } from './custom-field'
|
||||
|
||||
export interface ExpenseCategory {
|
||||
id: number
|
||||
name: string
|
||||
description: string | null
|
||||
company_id: number
|
||||
amount: number | null
|
||||
formatted_created_at: string
|
||||
company?: Company
|
||||
}
|
||||
|
||||
export interface ReceiptUrl {
|
||||
url: string
|
||||
type: string
|
||||
}
|
||||
|
||||
export interface ReceiptMeta {
|
||||
id: number
|
||||
name: string
|
||||
file_name: string
|
||||
mime_type: string
|
||||
size: number
|
||||
disk: string
|
||||
collection_name: string
|
||||
}
|
||||
|
||||
export interface Expense {
|
||||
id: number
|
||||
expense_date: string
|
||||
expense_number: string | null
|
||||
amount: number
|
||||
notes: string | null
|
||||
customer_id: number | null
|
||||
attachment_receipt_url: ReceiptUrl | null
|
||||
attachment_receipt: string | null
|
||||
attachment_receipt_meta: ReceiptMeta | null
|
||||
company_id: number
|
||||
expense_category_id: number | null
|
||||
creator_id: number
|
||||
formatted_expense_date: string
|
||||
formatted_created_at: string
|
||||
exchange_rate: number
|
||||
currency_id: number
|
||||
base_amount: number
|
||||
payment_method_id: number | null
|
||||
customer?: Customer
|
||||
expense_category?: ExpenseCategory
|
||||
creator?: User
|
||||
fields?: CustomFieldValue[]
|
||||
company?: Company
|
||||
currency?: Currency
|
||||
payment_method?: PaymentMethod
|
||||
}
|
||||
|
||||
export interface CreateExpensePayload {
|
||||
expense_date: string
|
||||
amount: number
|
||||
expense_category_id?: number | null
|
||||
customer_id?: number | null
|
||||
payment_method_id?: number | null
|
||||
notes?: string | null
|
||||
exchange_rate?: number
|
||||
currency_id?: number
|
||||
customFields?: CustomFieldValue[]
|
||||
fields?: CustomFieldValue[]
|
||||
}
|
||||
79
resources/scripts/types/domain/index.ts
Normal file
79
resources/scripts/types/domain/index.ts
Normal file
@@ -0,0 +1,79 @@
|
||||
export type { Currency, ExchangeRateLog, ExchangeRateProvider } from './currency'
|
||||
|
||||
export type { Role, Ability } from './role'
|
||||
|
||||
export type { Company, CompanySetting, CompanyInvitation } from './company'
|
||||
export { CompanyInvitationStatus } from './company'
|
||||
|
||||
export type { Address, User, UserSetting } from './user'
|
||||
export { AddressType } from './user'
|
||||
|
||||
export type { Country, Customer, CreateCustomerPayload } from './customer'
|
||||
|
||||
export type {
|
||||
Invoice,
|
||||
InvoiceItem,
|
||||
CreateInvoicePayload,
|
||||
CreateInvoiceItemPayload,
|
||||
DiscountType,
|
||||
} from './invoice'
|
||||
export { InvoiceStatus, InvoicePaidStatus } from './invoice'
|
||||
|
||||
export type {
|
||||
Estimate,
|
||||
EstimateItem,
|
||||
CreateEstimatePayload,
|
||||
CreateEstimateItemPayload,
|
||||
} from './estimate'
|
||||
export { EstimateStatus } from './estimate'
|
||||
|
||||
export type {
|
||||
RecurringInvoice,
|
||||
CreateRecurringInvoicePayload,
|
||||
} from './recurring-invoice'
|
||||
export {
|
||||
RecurringInvoiceStatus,
|
||||
RecurringInvoiceLimitBy,
|
||||
} from './recurring-invoice'
|
||||
|
||||
export type {
|
||||
Payment,
|
||||
PaymentMethod,
|
||||
Transaction,
|
||||
CreatePaymentPayload,
|
||||
} from './payment'
|
||||
|
||||
export type {
|
||||
Expense,
|
||||
ExpenseCategory,
|
||||
ReceiptUrl,
|
||||
ReceiptMeta,
|
||||
CreateExpensePayload,
|
||||
} from './expense'
|
||||
|
||||
export type { Item, Unit } from './item'
|
||||
|
||||
export type { TaxType, Tax } from './tax'
|
||||
export { TaxTypeCategory } from './tax'
|
||||
|
||||
export type {
|
||||
CustomField,
|
||||
CustomFieldValue,
|
||||
CustomFieldType,
|
||||
CustomFieldModelType,
|
||||
} from './custom-field'
|
||||
|
||||
export type { Note, NoteType } from './note'
|
||||
|
||||
export type {
|
||||
Module,
|
||||
InstalledModule,
|
||||
ModuleAuthor,
|
||||
ModuleVersion,
|
||||
ModuleLink,
|
||||
ModuleReview,
|
||||
ModuleScreenshot,
|
||||
ModuleFaq,
|
||||
} from './module'
|
||||
|
||||
export type { Setting, CompanySettingsMap } from './setting'
|
||||
135
resources/scripts/types/domain/invoice.ts
Normal file
135
resources/scripts/types/domain/invoice.ts
Normal file
@@ -0,0 +1,135 @@
|
||||
import type { Customer } from './customer'
|
||||
import type { User } from './user'
|
||||
import type { Company } from './company'
|
||||
import type { Currency } from './currency'
|
||||
import type { Tax } from './tax'
|
||||
import type { CustomFieldValue } from './custom-field'
|
||||
|
||||
export enum InvoiceStatus {
|
||||
DRAFT = 'DRAFT',
|
||||
SENT = 'SENT',
|
||||
VIEWED = 'VIEWED',
|
||||
COMPLETED = 'COMPLETED',
|
||||
}
|
||||
|
||||
export enum InvoicePaidStatus {
|
||||
UNPAID = 'UNPAID',
|
||||
PARTIALLY_PAID = 'PARTIALLY_PAID',
|
||||
PAID = 'PAID',
|
||||
}
|
||||
|
||||
export type DiscountType = 'fixed' | 'percentage'
|
||||
|
||||
export interface InvoiceItem {
|
||||
id: number | string
|
||||
name: string
|
||||
description: string | null
|
||||
discount_type: DiscountType
|
||||
price: number
|
||||
quantity: number
|
||||
unit_name: string | null
|
||||
discount: number
|
||||
discount_val: number
|
||||
tax: number
|
||||
total: number
|
||||
invoice_id: number | null
|
||||
item_id: number | null
|
||||
company_id: number
|
||||
base_price: number
|
||||
exchange_rate: number
|
||||
base_discount_val: number
|
||||
base_tax: number
|
||||
base_total: number
|
||||
recurring_invoice_id: number | null
|
||||
taxes?: Tax[]
|
||||
fields?: CustomFieldValue[]
|
||||
}
|
||||
|
||||
export interface Invoice {
|
||||
id: number
|
||||
invoice_date: string
|
||||
due_date: string
|
||||
invoice_number: string
|
||||
reference_number: string | null
|
||||
status: InvoiceStatus
|
||||
paid_status: InvoicePaidStatus
|
||||
tax_per_item: string | null
|
||||
tax_included: boolean | null
|
||||
discount_per_item: string | null
|
||||
notes: string | null
|
||||
discount_type: DiscountType
|
||||
discount: number
|
||||
discount_val: number
|
||||
sub_total: number
|
||||
total: number
|
||||
tax: number
|
||||
due_amount: number
|
||||
sent: boolean | null
|
||||
viewed: boolean | null
|
||||
unique_hash: string
|
||||
template_name: string | null
|
||||
customer_id: number
|
||||
recurring_invoice_id: number | null
|
||||
sequence_number: number
|
||||
exchange_rate: number
|
||||
base_discount_val: number
|
||||
base_sub_total: number
|
||||
base_total: number
|
||||
creator_id: number
|
||||
base_tax: number
|
||||
base_due_amount: number
|
||||
currency_id: number
|
||||
formatted_created_at: string
|
||||
invoice_pdf_url: string
|
||||
formatted_invoice_date: string
|
||||
formatted_due_date: string
|
||||
allow_edit: boolean
|
||||
payment_module_enabled: boolean
|
||||
sales_tax_type: string | null
|
||||
sales_tax_address_type: string | null
|
||||
overdue: boolean | null
|
||||
items?: InvoiceItem[]
|
||||
customer?: Customer
|
||||
creator?: User
|
||||
taxes?: Tax[]
|
||||
fields?: CustomFieldValue[]
|
||||
company?: Company
|
||||
currency?: Currency
|
||||
}
|
||||
|
||||
export interface CreateInvoicePayload {
|
||||
invoice_date: string
|
||||
due_date: string
|
||||
invoice_number: string
|
||||
reference_number?: string | null
|
||||
customer_id: number
|
||||
template_name?: string | null
|
||||
notes?: string | null
|
||||
discount_type?: DiscountType
|
||||
discount?: number
|
||||
discount_val?: number
|
||||
tax_per_item?: string | null
|
||||
tax_included?: boolean | null
|
||||
discount_per_item?: string | null
|
||||
sales_tax_type?: string | null
|
||||
sales_tax_address_type?: string | null
|
||||
items: CreateInvoiceItemPayload[]
|
||||
taxes?: Partial<Tax>[]
|
||||
customFields?: CustomFieldValue[]
|
||||
fields?: CustomFieldValue[]
|
||||
}
|
||||
|
||||
export interface CreateInvoiceItemPayload {
|
||||
item_id?: number | null
|
||||
name: string
|
||||
description?: string | null
|
||||
quantity: number
|
||||
price: number
|
||||
discount_type?: DiscountType
|
||||
discount?: number
|
||||
discount_val?: number
|
||||
tax?: number
|
||||
total?: number
|
||||
taxes?: Partial<Tax>[]
|
||||
unit_name?: string | null
|
||||
}
|
||||
29
resources/scripts/types/domain/item.ts
Normal file
29
resources/scripts/types/domain/item.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import type { Company } from './company'
|
||||
import type { Currency } from './currency'
|
||||
import type { Tax } from './tax'
|
||||
|
||||
export interface Unit {
|
||||
id: number
|
||||
name: string
|
||||
company_id: number
|
||||
company?: Company
|
||||
}
|
||||
|
||||
export interface Item {
|
||||
id: number
|
||||
name: string
|
||||
description: string | null
|
||||
price: number
|
||||
unit_id: number | null
|
||||
company_id: number
|
||||
creator_id: number
|
||||
currency_id: number | null
|
||||
created_at: string
|
||||
updated_at: string
|
||||
tax_per_item: string | null
|
||||
formatted_created_at: string
|
||||
unit?: Unit
|
||||
company?: Company
|
||||
taxes?: Tax[]
|
||||
currency?: Currency
|
||||
}
|
||||
76
resources/scripts/types/domain/module.ts
Normal file
76
resources/scripts/types/domain/module.ts
Normal file
@@ -0,0 +1,76 @@
|
||||
export interface ModuleAuthor {
|
||||
name: string
|
||||
avatar: string
|
||||
}
|
||||
|
||||
export interface ModuleVersion {
|
||||
module_version: string
|
||||
invoiceshelf_version: string
|
||||
created_at: string
|
||||
}
|
||||
|
||||
export interface ModuleLink {
|
||||
name: string
|
||||
url: string
|
||||
}
|
||||
|
||||
export interface ModuleReview {
|
||||
id: number
|
||||
rating: number
|
||||
comment: string
|
||||
user: string
|
||||
created_at: string
|
||||
}
|
||||
|
||||
export interface ModuleScreenshot {
|
||||
url: string
|
||||
title: string | null
|
||||
}
|
||||
|
||||
export interface ModuleFaq {
|
||||
question: string
|
||||
answer: string
|
||||
}
|
||||
|
||||
export interface Module {
|
||||
id: number
|
||||
average_rating: number | null
|
||||
cover: string | null
|
||||
slug: string
|
||||
module_name: string
|
||||
faq: ModuleFaq[] | null
|
||||
highlights: string[] | null
|
||||
installed_module_version: string | null
|
||||
installed_module_version_updated_at: string | null
|
||||
latest_module_version: string
|
||||
latest_module_version_updated_at: string
|
||||
is_dev: boolean
|
||||
license: string | null
|
||||
long_description: string | null
|
||||
monthly_price: number | null
|
||||
name: string
|
||||
purchased: boolean
|
||||
reviews: ModuleReview[]
|
||||
screenshots: ModuleScreenshot[] | null
|
||||
short_description: string | null
|
||||
type: string | null
|
||||
yearly_price: number | null
|
||||
author_name: string
|
||||
author_avatar: string
|
||||
installed: boolean
|
||||
enabled: boolean
|
||||
update_available: boolean
|
||||
video_link: string | null
|
||||
video_thumbnail: string | null
|
||||
links: ModuleLink[] | null
|
||||
}
|
||||
|
||||
export interface InstalledModule {
|
||||
id: number
|
||||
name: string
|
||||
version: string
|
||||
installed: boolean
|
||||
enabled: boolean
|
||||
created_at: string
|
||||
updated_at: string
|
||||
}
|
||||
12
resources/scripts/types/domain/note.ts
Normal file
12
resources/scripts/types/domain/note.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { Company } from './company'
|
||||
|
||||
export type NoteType = 'Invoice' | 'Estimate' | 'Payment'
|
||||
|
||||
export interface Note {
|
||||
id: number
|
||||
type: NoteType
|
||||
name: string
|
||||
notes: string
|
||||
is_default: boolean | null
|
||||
company?: Company
|
||||
}
|
||||
67
resources/scripts/types/domain/payment.ts
Normal file
67
resources/scripts/types/domain/payment.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
import type { Customer } from './customer'
|
||||
import type { Invoice } from './invoice'
|
||||
import type { Company } from './company'
|
||||
import type { Currency } from './currency'
|
||||
import type { User } from './user'
|
||||
import type { CustomFieldValue } from './custom-field'
|
||||
|
||||
export interface PaymentMethod {
|
||||
id: number
|
||||
name: string
|
||||
company_id: number
|
||||
type: string | null
|
||||
company?: Company
|
||||
}
|
||||
|
||||
export interface Transaction {
|
||||
id: number
|
||||
transaction_id: string
|
||||
type: string
|
||||
status: string
|
||||
transaction_date: string
|
||||
invoice_id: number | null
|
||||
invoice?: Invoice
|
||||
company?: Company
|
||||
}
|
||||
|
||||
export interface Payment {
|
||||
id: number
|
||||
payment_number: string
|
||||
payment_date: string
|
||||
notes: string | null
|
||||
amount: number
|
||||
unique_hash: string
|
||||
invoice_id: number | null
|
||||
company_id: number
|
||||
payment_method_id: number | null
|
||||
creator_id: number
|
||||
customer_id: number
|
||||
exchange_rate: number
|
||||
base_amount: number
|
||||
currency_id: number
|
||||
transaction_id: number | null
|
||||
sequence_number: number
|
||||
formatted_created_at: string
|
||||
formatted_payment_date: string
|
||||
payment_pdf_url: string
|
||||
customer?: Customer
|
||||
invoice?: Invoice
|
||||
payment_method?: PaymentMethod
|
||||
fields?: CustomFieldValue[]
|
||||
company?: Company
|
||||
currency?: Currency
|
||||
transaction?: Transaction
|
||||
}
|
||||
|
||||
export interface CreatePaymentPayload {
|
||||
payment_date: string
|
||||
payment_number: string
|
||||
customer_id: number
|
||||
amount: number
|
||||
invoice_id?: number | null
|
||||
payment_method_id?: number | null
|
||||
notes?: string | null
|
||||
exchange_rate?: number
|
||||
customFields?: CustomFieldValue[]
|
||||
fields?: CustomFieldValue[]
|
||||
}
|
||||
86
resources/scripts/types/domain/recurring-invoice.ts
Normal file
86
resources/scripts/types/domain/recurring-invoice.ts
Normal file
@@ -0,0 +1,86 @@
|
||||
import type { Customer } from './customer'
|
||||
import type { User } from './user'
|
||||
import type { Company } from './company'
|
||||
import type { Currency } from './currency'
|
||||
import type { Tax } from './tax'
|
||||
import type { Invoice, InvoiceItem } from './invoice'
|
||||
import type { CustomFieldValue } from './custom-field'
|
||||
import type { DiscountType } from './invoice'
|
||||
|
||||
export enum RecurringInvoiceStatus {
|
||||
ACTIVE = 'ACTIVE',
|
||||
ON_HOLD = 'ON_HOLD',
|
||||
COMPLETED = 'COMPLETED',
|
||||
}
|
||||
|
||||
export enum RecurringInvoiceLimitBy {
|
||||
NONE = 'NONE',
|
||||
COUNT = 'COUNT',
|
||||
DATE = 'DATE',
|
||||
}
|
||||
|
||||
export interface RecurringInvoice {
|
||||
id: number
|
||||
starts_at: string
|
||||
formatted_starts_at: string
|
||||
formatted_created_at: string
|
||||
formatted_next_invoice_at: string
|
||||
formatted_limit_date: string
|
||||
send_automatically: boolean
|
||||
customer_id: number
|
||||
company_id: number
|
||||
creator_id: number
|
||||
status: RecurringInvoiceStatus
|
||||
next_invoice_at: string
|
||||
frequency: string
|
||||
limit_by: RecurringInvoiceLimitBy
|
||||
limit_count: number | null
|
||||
limit_date: string | null
|
||||
exchange_rate: number
|
||||
tax_per_item: string | null
|
||||
tax_included: boolean | null
|
||||
discount_per_item: string | null
|
||||
notes: string | null
|
||||
discount_type: DiscountType
|
||||
discount: number
|
||||
discount_val: number
|
||||
sub_total: number
|
||||
total: number
|
||||
tax: number
|
||||
due_amount: number
|
||||
template_name: string | null
|
||||
sales_tax_type: string | null
|
||||
sales_tax_address_type: string | null
|
||||
fields?: CustomFieldValue[]
|
||||
items?: InvoiceItem[]
|
||||
customer?: Customer
|
||||
company?: Company
|
||||
invoices?: Invoice[]
|
||||
taxes?: Tax[]
|
||||
creator?: User
|
||||
currency?: Currency
|
||||
}
|
||||
|
||||
export interface CreateRecurringInvoicePayload {
|
||||
starts_at: string
|
||||
frequency: string
|
||||
customer_id: number
|
||||
send_automatically?: boolean
|
||||
limit_by?: RecurringInvoiceLimitBy
|
||||
limit_count?: number | null
|
||||
limit_date?: string | null
|
||||
template_name?: string | null
|
||||
notes?: string | null
|
||||
discount_type?: DiscountType
|
||||
discount?: number
|
||||
discount_val?: number
|
||||
tax_per_item?: string | null
|
||||
tax_included?: boolean | null
|
||||
discount_per_item?: string | null
|
||||
sales_tax_type?: string | null
|
||||
sales_tax_address_type?: string | null
|
||||
items: Partial<InvoiceItem>[]
|
||||
taxes?: Partial<Tax>[]
|
||||
customFields?: CustomFieldValue[]
|
||||
fields?: CustomFieldValue[]
|
||||
}
|
||||
20
resources/scripts/types/domain/role.ts
Normal file
20
resources/scripts/types/domain/role.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
export interface Ability {
|
||||
id: number
|
||||
name: string
|
||||
title: string | null
|
||||
entity_id: number | null
|
||||
entity_type: string | null
|
||||
only_owned: boolean
|
||||
scope: number | null
|
||||
created_at: string
|
||||
updated_at: string
|
||||
}
|
||||
|
||||
export interface Role {
|
||||
id: number
|
||||
name: string
|
||||
title: string | null
|
||||
level: number | null
|
||||
formatted_created_at: string
|
||||
abilities: Ability[]
|
||||
}
|
||||
58
resources/scripts/types/domain/setting.ts
Normal file
58
resources/scripts/types/domain/setting.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* Global application setting (not company-scoped).
|
||||
* Corresponds to the `settings` table.
|
||||
*/
|
||||
export interface Setting {
|
||||
id: number
|
||||
option: string
|
||||
value: string | null
|
||||
}
|
||||
|
||||
/**
|
||||
* Common company settings that are frequently accessed on the frontend.
|
||||
* These correspond to key-value pairs in the company_settings table.
|
||||
* Use this typed map when reading settings from the store, rather than
|
||||
* accessing raw CompanySetting rows.
|
||||
*/
|
||||
export interface CompanySettingsMap {
|
||||
currency: string
|
||||
time_zone: string
|
||||
language: string
|
||||
fiscal_year: string
|
||||
carbon_date_format: string
|
||||
carbon_time_format: string
|
||||
moment_date_format: string
|
||||
notification_email: string
|
||||
tax_per_item: 'YES' | 'NO'
|
||||
discount_per_item: 'YES' | 'NO'
|
||||
invoice_prefix: string
|
||||
invoice_auto_generate: string
|
||||
estimate_prefix: string
|
||||
estimate_auto_generate: string
|
||||
payment_prefix: string
|
||||
payment_auto_generate: string
|
||||
invoice_mail_body: string
|
||||
estimate_mail_body: string
|
||||
payment_mail_body: string
|
||||
invoice_company_address_format: string
|
||||
invoice_shipping_address_format: string
|
||||
invoice_billing_address_format: string
|
||||
estimate_company_address_format: string
|
||||
estimate_shipping_address_format: string
|
||||
estimate_billing_address_format: string
|
||||
payment_company_address_format: string
|
||||
payment_from_customer_address_format: string
|
||||
invoice_email_attachment: 'YES' | 'NO'
|
||||
estimate_email_attachment: 'YES' | 'NO'
|
||||
payment_email_attachment: 'YES' | 'NO'
|
||||
retrospective_edits: string
|
||||
invoice_set_due_date_automatically: 'YES' | 'NO'
|
||||
invoice_due_date_days: string
|
||||
estimate_set_expiry_date_automatically: 'YES' | 'NO'
|
||||
estimate_expiry_date_days: string
|
||||
estimate_convert_action: string
|
||||
invoice_use_time: 'YES' | 'NO'
|
||||
sales_tax_type: string | null
|
||||
sales_tax_address_type: string | null
|
||||
[key: string]: string | null
|
||||
}
|
||||
44
resources/scripts/types/domain/tax.ts
Normal file
44
resources/scripts/types/domain/tax.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import type { Currency } from './currency'
|
||||
import type { Company } from './company'
|
||||
|
||||
export enum TaxTypeCategory {
|
||||
GENERAL = 'GENERAL',
|
||||
MODULE = 'MODULE',
|
||||
}
|
||||
|
||||
export interface TaxType {
|
||||
id: number
|
||||
name: string
|
||||
percent: number
|
||||
fixed_amount: number
|
||||
calculation_type: string | null
|
||||
type: TaxTypeCategory
|
||||
compound_tax: boolean
|
||||
collective_tax: number | null
|
||||
description: string | null
|
||||
company_id: number
|
||||
company?: Company
|
||||
}
|
||||
|
||||
export interface Tax {
|
||||
id: number
|
||||
tax_type_id: number
|
||||
invoice_id: number | null
|
||||
estimate_id: number | null
|
||||
invoice_item_id: number | null
|
||||
estimate_item_id: number | null
|
||||
item_id: number | null
|
||||
company_id: number
|
||||
name: string
|
||||
amount: number
|
||||
percent: number
|
||||
calculation_type: string | null
|
||||
fixed_amount: number
|
||||
compound_tax: boolean
|
||||
base_amount: number
|
||||
currency_id: number | null
|
||||
type: TaxTypeCategory
|
||||
recurring_invoice_id: number | null
|
||||
tax_type?: TaxType
|
||||
currency?: Currency
|
||||
}
|
||||
60
resources/scripts/types/domain/user.ts
Normal file
60
resources/scripts/types/domain/user.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
import type { Currency } from './currency'
|
||||
import type { Company } from './company'
|
||||
import type { Role } from './role'
|
||||
import type { Country } from './customer'
|
||||
|
||||
export interface Address {
|
||||
id: number
|
||||
name: string | null
|
||||
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
|
||||
fax: string | null
|
||||
type: AddressType
|
||||
user_id: number | null
|
||||
company_id: number | null
|
||||
customer_id: number | null
|
||||
country?: Country
|
||||
user?: User
|
||||
}
|
||||
|
||||
export enum AddressType {
|
||||
BILLING = 'billing',
|
||||
SHIPPING = 'shipping',
|
||||
}
|
||||
|
||||
export interface User {
|
||||
id: number
|
||||
name: string
|
||||
email: string
|
||||
phone: string | null
|
||||
role: string | null
|
||||
contact_name: string | null
|
||||
company_name: string | null
|
||||
website: string | null
|
||||
enable_portal: boolean | null
|
||||
currency_id: number | null
|
||||
facebook_id: string | null
|
||||
google_id: string | null
|
||||
github_id: string | null
|
||||
created_at: string
|
||||
updated_at: string
|
||||
avatar: string | number
|
||||
is_owner: boolean
|
||||
is_super_admin: boolean
|
||||
roles: Role[]
|
||||
formatted_created_at: string
|
||||
currency?: Currency
|
||||
companies?: Company[]
|
||||
}
|
||||
|
||||
export interface UserSetting {
|
||||
id: number
|
||||
key: string
|
||||
value: string | null
|
||||
user_id: number
|
||||
}
|
||||
9
resources/scripts/types/env.d.ts
vendored
Normal file
9
resources/scripts/types/env.d.ts
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
interface ImportMetaEnv {
|
||||
readonly VITE_APP_TITLE: string
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
readonly env: ImportMetaEnv
|
||||
}
|
||||
78
resources/scripts/types/index.ts
Normal file
78
resources/scripts/types/index.ts
Normal file
@@ -0,0 +1,78 @@
|
||||
export type {
|
||||
ApiResponse,
|
||||
PaginatedResponse,
|
||||
PaginationMeta,
|
||||
ApiError,
|
||||
ListParams,
|
||||
DateRangeParams,
|
||||
NextNumberResponse,
|
||||
DeletePayload,
|
||||
} from './api'
|
||||
|
||||
export type {
|
||||
Currency,
|
||||
ExchangeRateLog,
|
||||
ExchangeRateProvider,
|
||||
Role,
|
||||
Ability,
|
||||
Company,
|
||||
CompanySetting,
|
||||
CompanyInvitation,
|
||||
Address,
|
||||
User,
|
||||
UserSetting,
|
||||
Country,
|
||||
Customer,
|
||||
CreateCustomerPayload,
|
||||
Invoice,
|
||||
InvoiceItem,
|
||||
CreateInvoicePayload,
|
||||
CreateInvoiceItemPayload,
|
||||
DiscountType,
|
||||
Estimate,
|
||||
EstimateItem,
|
||||
CreateEstimatePayload,
|
||||
CreateEstimateItemPayload,
|
||||
RecurringInvoice,
|
||||
CreateRecurringInvoicePayload,
|
||||
Payment,
|
||||
PaymentMethod,
|
||||
Transaction,
|
||||
CreatePaymentPayload,
|
||||
Expense,
|
||||
ExpenseCategory,
|
||||
ReceiptUrl,
|
||||
ReceiptMeta,
|
||||
CreateExpensePayload,
|
||||
Item,
|
||||
Unit,
|
||||
TaxType,
|
||||
Tax,
|
||||
CustomField,
|
||||
CustomFieldValue,
|
||||
CustomFieldType,
|
||||
CustomFieldModelType,
|
||||
Note,
|
||||
NoteType,
|
||||
Module,
|
||||
InstalledModule,
|
||||
ModuleAuthor,
|
||||
ModuleVersion,
|
||||
ModuleLink,
|
||||
ModuleReview,
|
||||
ModuleScreenshot,
|
||||
ModuleFaq,
|
||||
Setting,
|
||||
CompanySettingsMap,
|
||||
} from './domain'
|
||||
|
||||
export {
|
||||
CompanyInvitationStatus,
|
||||
AddressType,
|
||||
InvoiceStatus,
|
||||
InvoicePaidStatus,
|
||||
EstimateStatus,
|
||||
RecurringInvoiceStatus,
|
||||
RecurringInvoiceLimitBy,
|
||||
TaxTypeCategory,
|
||||
} from './domain'
|
||||
9
resources/scripts/types/vue-shims.d.ts
vendored
Normal file
9
resources/scripts/types/vue-shims.d.ts
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
declare module '*.vue' {
|
||||
import type { DefineComponent } from 'vue'
|
||||
const component: DefineComponent<
|
||||
Record<string, unknown>,
|
||||
Record<string, unknown>,
|
||||
unknown
|
||||
>
|
||||
export default component
|
||||
}
|
||||
Reference in New Issue
Block a user