Convert the app from using legacy Collection models to OrderItem-based data. Updated pages (app/page and app/map/page) and all related components (CollectionMap, CollectionItemCard, CollectModal, ProblemModal, LocationTracker) to use OrderItem and new field names (supplier, order, item_status, qty_collected/collected_date, problem_flag/notes, etc.). PocketBase client now queries/updates the order_items collection and maps status/field changes accordingly. Simplified location tracking logic and cleaned up map/navigation UI and Suspense fallbacks. Added import_suppliers.py script for migrating suppliers from NocoDB and included .DS_Store artifacts.
91 lines
1.9 KiB
TypeScript
91 lines
1.9 KiB
TypeScript
export interface Supplier {
|
|
id: string;
|
|
suppliername: string;
|
|
email: string;
|
|
suppliernumber: string;
|
|
supplieraddress: string;
|
|
supply_tags: string;
|
|
coordinates: string; // Raw coordinates text (e.g. "-33.9249, 18.4241")
|
|
closingtime: string;
|
|
}
|
|
|
|
export interface Order {
|
|
id: string;
|
|
order_number: string;
|
|
status: string;
|
|
notes: string;
|
|
}
|
|
|
|
export interface PurchaseOrder {
|
|
id: string;
|
|
po_number: string;
|
|
status: string;
|
|
}
|
|
|
|
export interface OrderItem {
|
|
id: string;
|
|
order: string;
|
|
supplier: string;
|
|
driver: string;
|
|
description: string;
|
|
po_description: string;
|
|
quantity: number;
|
|
order_qty: number;
|
|
selling_price: number;
|
|
cost_price: number;
|
|
item_status: string;
|
|
status: string;
|
|
driver_status: string;
|
|
notes: string;
|
|
problem_type: string;
|
|
problem_flag: boolean;
|
|
problem_notes: string;
|
|
qty_collected: number;
|
|
collected_date: string;
|
|
collection_date: string;
|
|
is_stock_item: boolean;
|
|
// Expanded fields
|
|
expand?: {
|
|
supplier?: Supplier;
|
|
order?: Order;
|
|
purchase_order?: PurchaseOrder;
|
|
};
|
|
}
|
|
|
|
export interface DriverLocation {
|
|
id: string;
|
|
driver: string;
|
|
latitude: number;
|
|
longitude: number;
|
|
accuracy?: number;
|
|
altitude?: number;
|
|
speed?: number;
|
|
heading?: number;
|
|
timestamp: string;
|
|
}
|
|
|
|
export interface AppSettings {
|
|
locationInterval: number;
|
|
minimumAccuracy: number;
|
|
enableHighAccuracy: boolean;
|
|
darkMode: boolean;
|
|
fontSize: 'small' | 'normal' | 'large';
|
|
offlineMode: boolean;
|
|
}
|
|
|
|
export const DEFAULT_SETTINGS: AppSettings = {
|
|
locationInterval: 60,
|
|
minimumAccuracy: 50,
|
|
enableHighAccuracy: true,
|
|
darkMode: false,
|
|
fontSize: 'normal',
|
|
offlineMode: false,
|
|
};
|
|
|
|
export const PROBLEM_TYPES = [
|
|
{ value: 'out_of_stock', label: 'Out of Stock' },
|
|
{ value: 'partial_stock', label: 'Partial Stock' },
|
|
{ value: 'quality_issue', label: 'Quality Issue' },
|
|
{ value: 'wrong_item', label: 'Wrong Item' },
|
|
{ value: 'other', label: 'Other' },
|
|
] as const;
|