101 lines
2.3 KiB
TypeScript
101 lines
2.3 KiB
TypeScript
export interface Supplier {
|
|
id: string;
|
|
suppliername: string;
|
|
supplieraddress: string;
|
|
coordinates?: string; // Raw coordinates text (e.g. "-33.9249, 18.4241")
|
|
latitude?: number;
|
|
longitude?: number;
|
|
}
|
|
|
|
export interface OrderItem {
|
|
id: string;
|
|
description: string;
|
|
quantity: number;
|
|
order_qty: number;
|
|
unit: string;
|
|
selling_price?: number;
|
|
item_status: string;
|
|
expand?: {
|
|
orders_order?: { order_number: string };
|
|
orders_purchaseorder?: { po_number: string };
|
|
};
|
|
}
|
|
|
|
export interface Collection {
|
|
id: string;
|
|
orders_orderitem: string;
|
|
wfdash_suppliers: string;
|
|
auth_user: string;
|
|
status: 'pending' | 'assigned' | 'collected' | 'problem';
|
|
quantity: number;
|
|
planned_date: string;
|
|
actual_date: string;
|
|
received_qty: number;
|
|
notes: string;
|
|
created_at: string;
|
|
updated_at: string;
|
|
is_manual: boolean;
|
|
description: string;
|
|
unit: string;
|
|
// Expanded fields use the relation field names from PocketBase
|
|
expand?: {
|
|
orders_orderitem?: OrderItem;
|
|
wfdash_suppliers?: Supplier;
|
|
auth_user?: Driver;
|
|
};
|
|
}
|
|
|
|
export interface CollectionProblem {
|
|
id: string;
|
|
driver_list_collection: string;
|
|
problem_type: 'out_of_stock' | 'partial_stock' | 'quality_issue' | 'wrong_item' | 'other';
|
|
description: string;
|
|
photo?: string;
|
|
reported_at: string;
|
|
}
|
|
|
|
export interface Driver {
|
|
id: string;
|
|
email: string;
|
|
name: string;
|
|
username: string;
|
|
}
|
|
|
|
export interface DriverLocation {
|
|
id: string;
|
|
driver: string;
|
|
latitude: number;
|
|
longitude: number;
|
|
accuracy?: number;
|
|
altitude?: number;
|
|
speed?: number;
|
|
heading?: number;
|
|
timestamp: string;
|
|
battery_level?: number;
|
|
}
|
|
|
|
export interface AppSettings {
|
|
locationInterval: number; // in seconds
|
|
minimumAccuracy: number; // in meters
|
|
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;
|