2026-06-11 18:30:02 +00:00
|
|
|
export interface BaseRecord {
|
|
|
|
|
id: string;
|
|
|
|
|
created: string;
|
|
|
|
|
updated: string;
|
|
|
|
|
collectionId: string;
|
|
|
|
|
collectionName: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface Customer extends BaseRecord {
|
|
|
|
|
customer: string;
|
|
|
|
|
email: string;
|
|
|
|
|
alternative_email: string;
|
|
|
|
|
buyer_email: string;
|
|
|
|
|
number: string;
|
|
|
|
|
company: string;
|
|
|
|
|
dateadded: string;
|
|
|
|
|
lastvisiteddate: string;
|
|
|
|
|
rep: string;
|
|
|
|
|
coordinates: string;
|
|
|
|
|
description: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface Company extends BaseRecord {
|
|
|
|
|
company: string;
|
|
|
|
|
address: string;
|
|
|
|
|
vendor: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface CompanyDetails extends BaseRecord {
|
|
|
|
|
company_name: string;
|
|
|
|
|
address: string;
|
|
|
|
|
number: string;
|
|
|
|
|
email: string;
|
|
|
|
|
vat_number: string;
|
|
|
|
|
registration_number: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface Supplier extends BaseRecord {
|
|
|
|
|
suppliername: string;
|
|
|
|
|
email: string;
|
|
|
|
|
suppliernumber: string;
|
|
|
|
|
supplieraddress: string;
|
|
|
|
|
supply_tags: string;
|
|
|
|
|
coordinates: string;
|
|
|
|
|
closingtime: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type QuoteStatus =
|
|
|
|
|
| "new"
|
|
|
|
|
| "claimed"
|
|
|
|
|
| "processed"
|
|
|
|
|
| "emailed"
|
|
|
|
|
| "approval_pending"
|
|
|
|
|
| "approved"
|
|
|
|
|
| "rejected"
|
|
|
|
|
| "problem"
|
|
|
|
|
| "complete"
|
|
|
|
|
| "cancelled"
|
|
|
|
|
| "follow_up"
|
|
|
|
|
| "email_failed"
|
|
|
|
|
| "unmatched_bounce";
|
|
|
|
|
|
|
|
|
|
export interface Quote extends BaseRecord {
|
|
|
|
|
quote_number: string;
|
|
|
|
|
quote_reference: string;
|
|
|
|
|
external_number: string;
|
|
|
|
|
rfq_number: string;
|
|
|
|
|
markup: number;
|
|
|
|
|
customer: string;
|
|
|
|
|
company: string;
|
|
|
|
|
claimed_by: string;
|
|
|
|
|
description: string;
|
|
|
|
|
status: QuoteStatus;
|
|
|
|
|
approved_by: string;
|
|
|
|
|
notes: string;
|
|
|
|
|
email_sender: string;
|
|
|
|
|
email_subject: string;
|
|
|
|
|
email_body: string;
|
|
|
|
|
has_attachments: boolean;
|
|
|
|
|
company_letterhead: string;
|
|
|
|
|
email_delivered: boolean;
|
|
|
|
|
email_delivered_at: string;
|
|
|
|
|
email_opened: boolean;
|
|
|
|
|
email_opened_at: string;
|
|
|
|
|
email_tracking_id: string;
|
|
|
|
|
has_new_reply: boolean;
|
|
|
|
|
last_reply_at: string;
|
|
|
|
|
email_failed_at: string;
|
|
|
|
|
pdf_generated_at: string;
|
|
|
|
|
expand?: {
|
|
|
|
|
customer?: Customer;
|
|
|
|
|
company?: Company;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface QuoteItem extends BaseRecord {
|
|
|
|
|
quote: string;
|
|
|
|
|
description: string;
|
|
|
|
|
quote_number: string;
|
|
|
|
|
quote_reference: string;
|
|
|
|
|
quantity: number;
|
|
|
|
|
supplier: string;
|
|
|
|
|
cost_price: number;
|
|
|
|
|
selling_price: number;
|
|
|
|
|
notes: string;
|
|
|
|
|
is_processed: boolean;
|
|
|
|
|
markup: number;
|
|
|
|
|
included_in_quote: boolean;
|
|
|
|
|
quote_pdf_id: string;
|
|
|
|
|
expand?: {
|
|
|
|
|
supplier?: Supplier;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type OrderStatus =
|
|
|
|
|
| "new"
|
|
|
|
|
| "processing"
|
|
|
|
|
| "order_ready"
|
|
|
|
|
| "po_generated"
|
|
|
|
|
| "completed"
|
|
|
|
|
| "cancelled";
|
|
|
|
|
|
|
|
|
|
export type ItemStatus =
|
|
|
|
|
| "pending"
|
|
|
|
|
| "processed"
|
|
|
|
|
| "po_generated"
|
|
|
|
|
| "driver_pool"
|
|
|
|
|
| "assigned"
|
|
|
|
|
| "collected"
|
|
|
|
|
| "stock_verified"
|
|
|
|
|
| "picking"
|
|
|
|
|
| "ready_delivery"
|
|
|
|
|
| "delivered"
|
|
|
|
|
| "cancelled";
|
|
|
|
|
|
|
|
|
|
export interface Order extends BaseRecord {
|
|
|
|
|
order_number: string;
|
|
|
|
|
company: string;
|
|
|
|
|
customer: string;
|
|
|
|
|
quote: string;
|
|
|
|
|
status: OrderStatus;
|
|
|
|
|
notes: string;
|
|
|
|
|
quote_matching_attempted: boolean;
|
|
|
|
|
quote_match_confidence: number;
|
|
|
|
|
potential_quote: string;
|
|
|
|
|
potential_quote_confidence: number;
|
|
|
|
|
is_repair_order: boolean;
|
|
|
|
|
expand?: {
|
|
|
|
|
company?: Company;
|
|
|
|
|
customer?: Customer;
|
|
|
|
|
quote?: Quote;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
feat: add UI components for separator, sheet, sonner, switch, table, tabs, textarea, tooltip
- Introduced a new Separator component for visual separation in UI.
- Added Sheet component for modal-like functionality with triggers and overlays.
- Implemented Toaster component for notifications using Sonner library.
- Created Switch component for toggle functionality.
- Developed Table component with headers, body, footer, and rows for structured data display.
- Added Tabs component for organizing content into tabbed interfaces.
- Implemented Textarea component for multi-line text input.
- Created Tooltip component for displaying additional information on hover.
feat: add PocketBase helpers and types
- Implemented various helper functions for interacting with PocketBase collections (customers, companies, suppliers, quotes, orders).
- Added type definitions for entities such as Customer, Company, Supplier, Quote, Order, and their respective items.
- Included utility functions for generating unique identifiers for quotes, orders, and purchase orders.
- Added functions for calculating totals and formatting currency and dates.
chore: add TypeScript configuration
- Added tsconfig.json for TypeScript support with strict type checking and module resolution.
2026-05-24 14:31:01 +00:00
|
|
|
export interface OrderItem extends BaseRecord {
|
2026-06-11 18:30:02 +00:00
|
|
|
order: string;
|
|
|
|
|
description: string;
|
|
|
|
|
po_description: string;
|
|
|
|
|
quantity: number;
|
|
|
|
|
order_qty: number;
|
|
|
|
|
selling_price: number;
|
|
|
|
|
supplier: string;
|
|
|
|
|
cost_price: number;
|
|
|
|
|
markup: number;
|
feat: add UI components for separator, sheet, sonner, switch, table, tabs, textarea, tooltip
- Introduced a new Separator component for visual separation in UI.
- Added Sheet component for modal-like functionality with triggers and overlays.
- Implemented Toaster component for notifications using Sonner library.
- Created Switch component for toggle functionality.
- Developed Table component with headers, body, footer, and rows for structured data display.
- Added Tabs component for organizing content into tabbed interfaces.
- Implemented Textarea component for multi-line text input.
- Created Tooltip component for displaying additional information on hover.
feat: add PocketBase helpers and types
- Implemented various helper functions for interacting with PocketBase collections (customers, companies, suppliers, quotes, orders).
- Added type definitions for entities such as Customer, Company, Supplier, Quote, Order, and their respective items.
- Included utility functions for generating unique identifiers for quotes, orders, and purchase orders.
- Added functions for calculating totals and formatting currency and dates.
chore: add TypeScript configuration
- Added tsconfig.json for TypeScript support with strict type checking and module resolution.
2026-05-24 14:31:01 +00:00
|
|
|
purchase_order: string;
|
|
|
|
|
item_status: ItemStatus;
|
Add PocketBase collections, APIs & migration docs
Introduce PocketBase workflow support, migration tooling, server APIs and documentation. Adds a set of PocketBase collection JSONs (order_items, order_items_v2, collection_pool, delivery_notes, delivery_note_items, repairs) and a large import manifest for workflow collections; includes docs describing MCP/API layer, migration audit, order-item schema and rollout plans. Adds server-side agent/MCP endpoints and services (api/mcp, api/v1/orders, collection-pool, order-items status, health) plus helper modules (pocketbase-admin, orders-service, order-item-status, agent-auth) and a migration script to create order_items_v2/collection_pool. UI: new pages for collection-pool, delivery-notes, repairs and several updates to orders/quotes pages, sidebar, tooltip and pb helpers/types. Also updates package.json (migration script and related changes) and global styles. Required env vars and suggested migration command are documented (e.g. NEXT_PUBLIC_POCKETBASE_URL, PB_ADMIN_EMAIL, PB_ADMIN_PASSWORD, ORDER_ITEMS_COLLECTION; run npm run pb:migrate:orders-v2).
2026-05-25 16:39:33 +00:00
|
|
|
drv_status?: "unassigned" | "assigned" | "en_route" | "collected" | "failed";
|
|
|
|
|
drv_id?: string;
|
feat: add UI components for separator, sheet, sonner, switch, table, tabs, textarea, tooltip
- Introduced a new Separator component for visual separation in UI.
- Added Sheet component for modal-like functionality with triggers and overlays.
- Implemented Toaster component for notifications using Sonner library.
- Created Switch component for toggle functionality.
- Developed Table component with headers, body, footer, and rows for structured data display.
- Added Tabs component for organizing content into tabbed interfaces.
- Implemented Textarea component for multi-line text input.
- Created Tooltip component for displaying additional information on hover.
feat: add PocketBase helpers and types
- Implemented various helper functions for interacting with PocketBase collections (customers, companies, suppliers, quotes, orders).
- Added type definitions for entities such as Customer, Company, Supplier, Quote, Order, and their respective items.
- Included utility functions for generating unique identifiers for quotes, orders, and purchase orders.
- Added functions for calculating totals and formatting currency and dates.
chore: add TypeScript configuration
- Added tsconfig.json for TypeScript support with strict type checking and module resolution.
2026-05-24 14:31:01 +00:00
|
|
|
notes: string;
|
|
|
|
|
expand?: {
|
|
|
|
|
supplier?: Supplier;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
Add PocketBase collections, APIs & migration docs
Introduce PocketBase workflow support, migration tooling, server APIs and documentation. Adds a set of PocketBase collection JSONs (order_items, order_items_v2, collection_pool, delivery_notes, delivery_note_items, repairs) and a large import manifest for workflow collections; includes docs describing MCP/API layer, migration audit, order-item schema and rollout plans. Adds server-side agent/MCP endpoints and services (api/mcp, api/v1/orders, collection-pool, order-items status, health) plus helper modules (pocketbase-admin, orders-service, order-item-status, agent-auth) and a migration script to create order_items_v2/collection_pool. UI: new pages for collection-pool, delivery-notes, repairs and several updates to orders/quotes pages, sidebar, tooltip and pb helpers/types. Also updates package.json (migration script and related changes) and global styles. Required env vars and suggested migration command are documented (e.g. NEXT_PUBLIC_POCKETBASE_URL, PB_ADMIN_EMAIL, PB_ADMIN_PASSWORD, ORDER_ITEMS_COLLECTION; run npm run pb:migrate:orders-v2).
2026-05-25 16:39:33 +00:00
|
|
|
export interface CollectionPool extends BaseRecord {
|
|
|
|
|
order: string;
|
|
|
|
|
order_item: string;
|
|
|
|
|
supplier?: string;
|
|
|
|
|
drv_id?: string;
|
|
|
|
|
pool_status: "queued" | "assigned" | "in_progress" | "completed" | "failed";
|
|
|
|
|
priority?: "low" | "normal" | "high" | "urgent";
|
|
|
|
|
pool_notes?: string;
|
|
|
|
|
assigned_at?: string;
|
|
|
|
|
completed_at?: string;
|
|
|
|
|
expand?: {
|
|
|
|
|
order?: Order;
|
|
|
|
|
order_item?: OrderItem;
|
|
|
|
|
supplier?: Supplier;
|
|
|
|
|
};
|
|
|
|
|
}
|
2026-06-11 18:30:02 +00:00
|
|
|
|
feat: add UI components for separator, sheet, sonner, switch, table, tabs, textarea, tooltip
- Introduced a new Separator component for visual separation in UI.
- Added Sheet component for modal-like functionality with triggers and overlays.
- Implemented Toaster component for notifications using Sonner library.
- Created Switch component for toggle functionality.
- Developed Table component with headers, body, footer, and rows for structured data display.
- Added Tabs component for organizing content into tabbed interfaces.
- Implemented Textarea component for multi-line text input.
- Created Tooltip component for displaying additional information on hover.
feat: add PocketBase helpers and types
- Implemented various helper functions for interacting with PocketBase collections (customers, companies, suppliers, quotes, orders).
- Added type definitions for entities such as Customer, Company, Supplier, Quote, Order, and their respective items.
- Included utility functions for generating unique identifiers for quotes, orders, and purchase orders.
- Added functions for calculating totals and formatting currency and dates.
chore: add TypeScript configuration
- Added tsconfig.json for TypeScript support with strict type checking and module resolution.
2026-05-24 14:31:01 +00:00
|
|
|
export interface PurchaseOrder extends BaseRecord {
|
|
|
|
|
po_number: string;
|
|
|
|
|
order: string;
|
|
|
|
|
supplier: string;
|
2026-06-11 18:30:02 +00:00
|
|
|
status: string;
|
|
|
|
|
total_amount: number;
|
|
|
|
|
expand?: {
|
|
|
|
|
order?: Order;
|
|
|
|
|
supplier?: Supplier;
|
feat: add UI components for separator, sheet, sonner, switch, table, tabs, textarea, tooltip
- Introduced a new Separator component for visual separation in UI.
- Added Sheet component for modal-like functionality with triggers and overlays.
- Implemented Toaster component for notifications using Sonner library.
- Created Switch component for toggle functionality.
- Developed Table component with headers, body, footer, and rows for structured data display.
- Added Tabs component for organizing content into tabbed interfaces.
- Implemented Textarea component for multi-line text input.
- Created Tooltip component for displaying additional information on hover.
feat: add PocketBase helpers and types
- Implemented various helper functions for interacting with PocketBase collections (customers, companies, suppliers, quotes, orders).
- Added type definitions for entities such as Customer, Company, Supplier, Quote, Order, and their respective items.
- Included utility functions for generating unique identifiers for quotes, orders, and purchase orders.
- Added functions for calculating totals and formatting currency and dates.
chore: add TypeScript configuration
- Added tsconfig.json for TypeScript support with strict type checking and module resolution.
2026-05-24 14:31:01 +00:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
Add PocketBase collections, APIs & migration docs
Introduce PocketBase workflow support, migration tooling, server APIs and documentation. Adds a set of PocketBase collection JSONs (order_items, order_items_v2, collection_pool, delivery_notes, delivery_note_items, repairs) and a large import manifest for workflow collections; includes docs describing MCP/API layer, migration audit, order-item schema and rollout plans. Adds server-side agent/MCP endpoints and services (api/mcp, api/v1/orders, collection-pool, order-items status, health) plus helper modules (pocketbase-admin, orders-service, order-item-status, agent-auth) and a migration script to create order_items_v2/collection_pool. UI: new pages for collection-pool, delivery-notes, repairs and several updates to orders/quotes pages, sidebar, tooltip and pb helpers/types. Also updates package.json (migration script and related changes) and global styles. Required env vars and suggested migration command are documented (e.g. NEXT_PUBLIC_POCKETBASE_URL, PB_ADMIN_EMAIL, PB_ADMIN_PASSWORD, ORDER_ITEMS_COLLECTION; run npm run pb:migrate:orders-v2).
2026-05-25 16:39:33 +00:00
|
|
|
export interface DeliveryNote extends BaseRecord {
|
|
|
|
|
delivery_note_number: string;
|
|
|
|
|
order: string;
|
|
|
|
|
company?: string;
|
|
|
|
|
customer?: string;
|
|
|
|
|
status: "draft" | "ready" | "delivered" | "cancelled";
|
|
|
|
|
delivery_date?: string;
|
|
|
|
|
notes?: string;
|
|
|
|
|
expand?: {
|
|
|
|
|
order?: Order;
|
|
|
|
|
company?: Company;
|
|
|
|
|
customer?: Customer;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface DeliveryNoteItem extends BaseRecord {
|
|
|
|
|
delivery_note: string;
|
|
|
|
|
order_item: string;
|
|
|
|
|
description: string;
|
|
|
|
|
quantity: number;
|
|
|
|
|
expand?: {
|
|
|
|
|
delivery_note?: DeliveryNote;
|
|
|
|
|
order_item?: OrderItem;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface Repair extends BaseRecord {
|
|
|
|
|
repair_number: string;
|
|
|
|
|
customer?: string;
|
|
|
|
|
company?: string;
|
|
|
|
|
order?: string;
|
|
|
|
|
status: "new" | "assessing" | "quoted" | "approved" | "in_progress" | "completed" | "cancelled";
|
|
|
|
|
item_description: string;
|
|
|
|
|
fault_description: string;
|
|
|
|
|
notes?: string;
|
|
|
|
|
expand?: {
|
|
|
|
|
customer?: Customer;
|
|
|
|
|
company?: Company;
|
|
|
|
|
order?: Order;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
feat: add UI components for separator, sheet, sonner, switch, table, tabs, textarea, tooltip
- Introduced a new Separator component for visual separation in UI.
- Added Sheet component for modal-like functionality with triggers and overlays.
- Implemented Toaster component for notifications using Sonner library.
- Created Switch component for toggle functionality.
- Developed Table component with headers, body, footer, and rows for structured data display.
- Added Tabs component for organizing content into tabbed interfaces.
- Implemented Textarea component for multi-line text input.
- Created Tooltip component for displaying additional information on hover.
feat: add PocketBase helpers and types
- Implemented various helper functions for interacting with PocketBase collections (customers, companies, suppliers, quotes, orders).
- Added type definitions for entities such as Customer, Company, Supplier, Quote, Order, and their respective items.
- Included utility functions for generating unique identifiers for quotes, orders, and purchase orders.
- Added functions for calculating totals and formatting currency and dates.
chore: add TypeScript configuration
- Added tsconfig.json for TypeScript support with strict type checking and module resolution.
2026-05-24 14:31:01 +00:00
|
|
|
export interface DashboardStats {
|
|
|
|
|
totalCustomers: number;
|
|
|
|
|
activeQuotes: number;
|
2026-06-11 18:30:02 +00:00
|
|
|
ordersThisMonth: number;
|
|
|
|
|
totalRevenue: number;
|
|
|
|
|
}
|