Generated by Spark: Fix all reported errors.

This commit is contained in:
2026-01-23 09:01:38 +00:00
committed by GitHub
parent 9284194178
commit 7659d9482e

View File

@@ -12,226 +12,230 @@ export function useSampleData() {
useEffect(() => { useEffect(() => {
if (hasInitialized) return if (hasInitialized) return
const sampleTimesheets: Timesheet[] = [ const initializeData = async () => {
{ const sampleTimesheets: Timesheet[] = [
id: 'TS-001', {
workerId: 'W-001', id: 'TS-001',
workerName: 'John Smith', workerId: 'W-001',
clientName: 'Acme Corporation', workerName: 'John Smith',
weekEnding: '2025-01-17', clientName: 'Acme Corporation',
hours: 40, weekEnding: '2025-01-17',
status: 'pending', hours: 40,
submittedDate: '2025-01-18T09:00:00Z', status: 'pending',
amount: 1200, submittedDate: '2025-01-18T09:00:00Z',
rate: 30 amount: 1200,
}, rate: 30
{ },
id: 'TS-002', {
workerId: 'W-002', id: 'TS-002',
workerName: 'Sarah Johnson', workerId: 'W-002',
clientName: 'Tech Solutions Ltd', workerName: 'Sarah Johnson',
weekEnding: '2025-01-17', clientName: 'Tech Solutions Ltd',
hours: 45, weekEnding: '2025-01-17',
status: 'pending', hours: 45,
submittedDate: '2025-01-18T10:30:00Z', status: 'pending',
amount: 1575, submittedDate: '2025-01-18T10:30:00Z',
rate: 35 amount: 1575,
}, rate: 35
{ },
id: 'TS-003', {
workerId: 'W-001', id: 'TS-003',
workerName: 'John Smith', workerId: 'W-001',
clientName: 'Acme Corporation', workerName: 'John Smith',
weekEnding: '2025-01-10', clientName: 'Acme Corporation',
hours: 37.5, weekEnding: '2025-01-10',
status: 'approved', hours: 37.5,
submittedDate: '2025-01-11T09:00:00Z', status: 'approved',
approvedDate: '2025-01-12T14:00:00Z', submittedDate: '2025-01-11T09:00:00Z',
amount: 1125, approvedDate: '2025-01-12T14:00:00Z',
rate: 30 amount: 1125,
}, rate: 30
{ },
id: 'TS-004', {
workerId: 'W-003', id: 'TS-004',
workerName: 'Michael Brown', workerId: 'W-003',
clientName: 'Global Industries', workerName: 'Michael Brown',
weekEnding: '2025-01-17', clientName: 'Global Industries',
hours: 52, weekEnding: '2025-01-17',
status: 'pending', hours: 52,
submittedDate: '2025-01-18T11:00:00Z', status: 'pending',
amount: 1820, submittedDate: '2025-01-18T11:00:00Z',
rate: 35 amount: 1820,
}, rate: 35
{ },
id: 'TS-005', {
workerId: 'W-004', id: 'TS-005',
workerName: 'Emma Wilson', workerId: 'W-004',
clientName: 'Tech Solutions Ltd', workerName: 'Emma Wilson',
weekEnding: '2025-01-17', clientName: 'Tech Solutions Ltd',
hours: 40, weekEnding: '2025-01-17',
status: 'approved', hours: 40,
submittedDate: '2025-01-18T08:30:00Z', status: 'approved',
approvedDate: '2025-01-18T15:00:00Z', submittedDate: '2025-01-18T08:30:00Z',
amount: 1000, approvedDate: '2025-01-18T15:00:00Z',
rate: 25 amount: 1000,
} rate: 25
] }
]
const sampleInvoices: Invoice[] = [ const sampleInvoices: Invoice[] = [
{ {
id: 'INV-001', id: 'INV-001',
invoiceNumber: 'INV-00001', invoiceNumber: 'INV-00001',
clientName: 'Acme Corporation', clientName: 'Acme Corporation',
issueDate: '2025-01-15', issueDate: '2025-01-15',
dueDate: '2025-02-14', dueDate: '2025-02-14',
amount: 5400, amount: 5400,
status: 'sent', status: 'sent',
currency: 'GBP' currency: 'GBP'
}, },
{ {
id: 'INV-002', id: 'INV-002',
invoiceNumber: 'INV-00002', invoiceNumber: 'INV-00002',
clientName: 'Tech Solutions Ltd', clientName: 'Tech Solutions Ltd',
issueDate: '2025-01-10', issueDate: '2025-01-10',
dueDate: '2025-02-09', dueDate: '2025-02-09',
amount: 3150, amount: 3150,
status: 'paid', status: 'paid',
currency: 'GBP' currency: 'GBP'
}, },
{ {
id: 'INV-003', id: 'INV-003',
invoiceNumber: 'INV-00003', invoiceNumber: 'INV-00003',
clientName: 'Global Industries', clientName: 'Global Industries',
issueDate: '2024-12-20', issueDate: '2024-12-20',
dueDate: '2025-01-19', dueDate: '2025-01-19',
amount: 8900, amount: 8900,
status: 'overdue', status: 'overdue',
currency: 'GBP' currency: 'GBP'
}, },
{ {
id: 'INV-004', id: 'INV-004',
invoiceNumber: 'INV-00004', invoiceNumber: 'INV-00004',
clientName: 'Tech Solutions Ltd', clientName: 'Tech Solutions Ltd',
issueDate: '2025-01-18', issueDate: '2025-01-18',
dueDate: '2025-02-17', dueDate: '2025-02-17',
amount: 2500, amount: 2500,
status: 'draft', status: 'draft',
currency: 'GBP' currency: 'GBP'
} }
] ]
const sampleExpenses: Expense[] = [ const sampleExpenses: Expense[] = [
{ {
id: 'EXP-001', id: 'EXP-001',
workerId: 'W-001', workerId: 'W-001',
workerName: 'John Smith', workerName: 'John Smith',
clientName: 'Acme Corporation', clientName: 'Acme Corporation',
date: '2025-01-15', date: '2025-01-15',
category: 'Travel', category: 'Travel',
description: 'Train ticket to client site', description: 'Train ticket to client site',
amount: 45.50, amount: 45.50,
currency: 'GBP', currency: 'GBP',
status: 'pending', status: 'pending',
submittedDate: '2025-01-16T10:00:00Z', submittedDate: '2025-01-16T10:00:00Z',
billable: true billable: true
}, },
{ {
id: 'EXP-002', id: 'EXP-002',
workerId: 'W-002', workerId: 'W-002',
workerName: 'Sarah Johnson', workerName: 'Sarah Johnson',
clientName: 'Tech Solutions Ltd', clientName: 'Tech Solutions Ltd',
date: '2025-01-14', date: '2025-01-14',
category: 'Meals', category: 'Meals',
description: 'Lunch meeting with client team', description: 'Lunch meeting with client team',
amount: 35.00, amount: 35.00,
currency: 'GBP', currency: 'GBP',
status: 'approved', status: 'approved',
submittedDate: '2025-01-15T09:00:00Z', submittedDate: '2025-01-15T09:00:00Z',
approvedDate: '2025-01-16T11:00:00Z', approvedDate: '2025-01-16T11:00:00Z',
billable: true billable: true
}, },
{ {
id: 'EXP-003', id: 'EXP-003',
workerId: 'W-003', workerId: 'W-003',
workerName: 'Michael Brown', workerName: 'Michael Brown',
clientName: 'Global Industries', clientName: 'Global Industries',
date: '2025-01-16', date: '2025-01-16',
category: 'Accommodation', category: 'Accommodation',
description: 'Hotel stay for 2 nights', description: 'Hotel stay for 2 nights',
amount: 240.00, amount: 240.00,
currency: 'GBP', currency: 'GBP',
status: 'pending', status: 'pending',
submittedDate: '2025-01-17T08:30:00Z', submittedDate: '2025-01-17T08:30:00Z',
billable: true billable: true
}, },
{ {
id: 'EXP-004', id: 'EXP-004',
workerId: 'W-001', workerId: 'W-001',
workerName: 'John Smith', workerName: 'John Smith',
clientName: 'Acme Corporation', clientName: 'Acme Corporation',
date: '2025-01-10', date: '2025-01-10',
category: 'Equipment', category: 'Equipment',
description: 'Laptop accessories', description: 'Laptop accessories',
amount: 85.00, amount: 85.00,
currency: 'GBP', currency: 'GBP',
status: 'rejected', status: 'rejected',
submittedDate: '2025-01-11T14:00:00Z', submittedDate: '2025-01-11T14:00:00Z',
billable: false billable: false
} }
] ]
const sampleComplianceDocs: ComplianceDocument[] = [ const sampleComplianceDocs: ComplianceDocument[] = [
{ {
id: 'DOC-001', id: 'DOC-001',
workerId: 'W-001', workerId: 'W-001',
workerName: 'John Smith', workerName: 'John Smith',
documentType: 'DBS Check', documentType: 'DBS Check',
expiryDate: '2025-02-15', expiryDate: '2025-02-15',
status: 'expiring', status: 'expiring',
daysUntilExpiry: 28 daysUntilExpiry: 28
}, },
{ {
id: 'DOC-002', id: 'DOC-002',
workerId: 'W-002', workerId: 'W-002',
workerName: 'Sarah Johnson', workerName: 'Sarah Johnson',
documentType: 'Right to Work', documentType: 'Right to Work',
expiryDate: '2026-06-30', expiryDate: '2026-06-30',
status: 'valid', status: 'valid',
daysUntilExpiry: 528 daysUntilExpiry: 528
}, },
{ {
id: 'DOC-003', id: 'DOC-003',
workerId: 'W-003', workerId: 'W-003',
workerName: 'Michael Brown', workerName: 'Michael Brown',
documentType: 'Professional License', documentType: 'Professional License',
expiryDate: '2025-01-10', expiryDate: '2025-01-10',
status: 'expired', status: 'expired',
daysUntilExpiry: -8 daysUntilExpiry: -8
}, },
{ {
id: 'DOC-004', id: 'DOC-004',
workerId: 'W-004', workerId: 'W-004',
workerName: 'Emma Wilson', workerName: 'Emma Wilson',
documentType: 'First Aid Certificate', documentType: 'First Aid Certificate',
expiryDate: '2025-03-20', expiryDate: '2025-03-20',
status: 'valid', status: 'valid',
daysUntilExpiry: 61 daysUntilExpiry: 61
}, },
{ {
id: 'DOC-005', id: 'DOC-005',
workerId: 'W-001', workerId: 'W-001',
workerName: 'John Smith', workerName: 'John Smith',
documentType: 'Driving License', documentType: 'Driving License',
expiryDate: '2025-02-05', expiryDate: '2025-02-05',
status: 'expiring', status: 'expiring',
daysUntilExpiry: 18 daysUntilExpiry: 18
} }
] ]
setTimesheets(sampleTimesheets) setTimesheets(sampleTimesheets)
setInvoices(sampleInvoices) setInvoices(sampleInvoices)
setExpenses(sampleExpenses) setExpenses(sampleExpenses)
setComplianceDocs(sampleComplianceDocs) setComplianceDocs(sampleComplianceDocs)
setHasInitialized(true) setHasInitialized(true)
}, [hasInitialized]) }
initializeData()
}, [hasInitialized, setTimesheets, setInvoices, setExpenses, setComplianceDocs, setHasInitialized])
} }