mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-15 01:04:03 +00:00
Create the complete TypeScript foundation for the Vue 3 migration in a parallel scripts-v2/ directory. 72 files, 5430 lines, zero any types, strict mode. - types/ (21 files): Domain interfaces for all 17 entities derived from actual Laravel models and API resources. Enums for all statuses. Generic API response wrappers. - api/ (29 files): Typed axios client with interceptors, endpoint constants from routes/api.php, 25 typed service classes covering every API endpoint. - composables/ (14 files): Vue 3 composition functions for auth, notifications, dialogs, modals, pagination, filters, currency, dates, theme, sidebar, company context, and permissions. - utils/ (5 files): Pure typed utilities for money formatting, date formatting (date-fns), localStorage, and error handling. - config/ (3 files): Typed ability constants, app constants. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
102 lines
2.5 KiB
TypeScript
102 lines
2.5 KiB
TypeScript
/**
|
|
* App-wide constants for the InvoiceShelf application.
|
|
*/
|
|
|
|
/** Document status values */
|
|
export const DOCUMENT_STATUS = {
|
|
DRAFT: 'DRAFT',
|
|
SENT: 'SENT',
|
|
VIEWED: 'VIEWED',
|
|
EXPIRED: 'EXPIRED',
|
|
ACCEPTED: 'ACCEPTED',
|
|
REJECTED: 'REJECTED',
|
|
PAID: 'PAID',
|
|
UNPAID: 'UNPAID',
|
|
PARTIALLY_PAID: 'PARTIALLY PAID',
|
|
COMPLETED: 'COMPLETED',
|
|
DUE: 'DUE',
|
|
} as const
|
|
|
|
export type DocumentStatus = typeof DOCUMENT_STATUS[keyof typeof DOCUMENT_STATUS]
|
|
|
|
/** Badge color configuration for document statuses */
|
|
export interface BadgeColor {
|
|
bgColor: string
|
|
color: string
|
|
}
|
|
|
|
export const STATUS_BADGE_COLORS: Record<string, BadgeColor> = {
|
|
DRAFT: { bgColor: '#F8EDCB', color: '#744210' },
|
|
PAID: { bgColor: '#D5EED0', color: '#276749' },
|
|
UNPAID: { bgColor: '#F8EDC', color: '#744210' },
|
|
SENT: { bgColor: 'rgba(246, 208, 154, 0.4)', color: '#975a16' },
|
|
REJECTED: { bgColor: '#E1E0EA', color: '#1A1841' },
|
|
ACCEPTED: { bgColor: '#D5EED0', color: '#276749' },
|
|
VIEWED: { bgColor: '#C9E3EC', color: '#2c5282' },
|
|
EXPIRED: { bgColor: '#FED7D7', color: '#c53030' },
|
|
'PARTIALLY PAID': { bgColor: '#C9E3EC', color: '#2c5282' },
|
|
COMPLETED: { bgColor: '#D5EED0', color: '#276749' },
|
|
DUE: { bgColor: '#F8EDCB', color: '#744210' },
|
|
YES: { bgColor: '#D5EED0', color: '#276749' },
|
|
NO: { bgColor: '#FED7D7', color: '#c53030' },
|
|
}
|
|
|
|
/** Theme options */
|
|
export const THEME = {
|
|
LIGHT: 'light',
|
|
DARK: 'dark',
|
|
SYSTEM: 'system',
|
|
} as const
|
|
|
|
export type Theme = typeof THEME[keyof typeof THEME]
|
|
|
|
/** Local storage keys used throughout the app */
|
|
export const LS_KEYS = {
|
|
AUTH_TOKEN: 'auth.token',
|
|
SELECTED_COMPANY: 'selectedCompany',
|
|
IS_ADMIN_MODE: 'isAdminMode',
|
|
SIDEBAR_COLLAPSED: 'sidebarCollapsed',
|
|
THEME: 'theme',
|
|
} as const
|
|
|
|
/** Notification types */
|
|
export const NOTIFICATION_TYPE = {
|
|
SUCCESS: 'success',
|
|
ERROR: 'error',
|
|
INFO: 'info',
|
|
WARNING: 'warning',
|
|
} as const
|
|
|
|
export type NotificationType = typeof NOTIFICATION_TYPE[keyof typeof NOTIFICATION_TYPE]
|
|
|
|
/** Pagination defaults */
|
|
export const PAGINATION_DEFAULTS = {
|
|
PAGE: 1,
|
|
LIMIT: 15,
|
|
} as const
|
|
|
|
/** Dialog variant options */
|
|
export const DIALOG_VARIANT = {
|
|
PRIMARY: 'primary',
|
|
DANGER: 'danger',
|
|
} as const
|
|
|
|
export type DialogVariant = typeof DIALOG_VARIANT[keyof typeof DIALOG_VARIANT]
|
|
|
|
/** Modal size options */
|
|
export const MODAL_SIZE = {
|
|
SM: 'sm',
|
|
MD: 'md',
|
|
LG: 'lg',
|
|
XL: 'xl',
|
|
} as const
|
|
|
|
export type ModalSize = typeof MODAL_SIZE[keyof typeof MODAL_SIZE]
|
|
|
|
/** Valid image MIME types for uploads */
|
|
export const VALID_IMAGE_TYPES = [
|
|
'image/gif',
|
|
'image/jpeg',
|
|
'image/png',
|
|
] as const
|