40 lines
1.4 KiB
Python
40 lines
1.4 KiB
Python
import re
|
|
|
|
with open('kifi-app/lib/features/projects/presentation/project_board_screen.dart', 'r') as f:
|
|
content = f.read()
|
|
|
|
nav_logic = """
|
|
onGenerateInvoice: () {
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (_) => InvoiceBuilderScreen(
|
|
initialCustomerId: widget.project.customerId,
|
|
initialItems: [
|
|
InvoiceItem(
|
|
id: 0,
|
|
invoiceId: 0,
|
|
productId: null,
|
|
productName: t.title,
|
|
quantity: t.hoursLogged,
|
|
price: t.hourlyRate,
|
|
taxPercentage: 0,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
"""
|
|
|
|
content = content.replace(' onGenerateInvoice: () {\n // TODO: Navigate to AddInvoiceScreen with task data\n },', nav_logic.strip())
|
|
|
|
# Add imports
|
|
content = content.replace(
|
|
'import \'widgets/task_card.dart\';',
|
|
'import \'widgets/task_card.dart\';\nimport \'../../sales/presentation/invoice_builder_screen.dart\';\nimport \'../../sales/domain/invoice.dart\';'
|
|
)
|
|
|
|
with open('kifi-app/lib/features/projects/presentation/project_board_screen.dart', 'w') as f:
|
|
f.write(content)
|