Project management related changes
This commit is contained in:
39
scratch/patch_add_project.py
Normal file
39
scratch/patch_add_project.py
Normal file
@@ -0,0 +1,39 @@
|
||||
import re
|
||||
|
||||
with open('kifi-app/lib/features/projects/presentation/widgets/add_project_sheet.dart', 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
# Add import
|
||||
content = content.replace(
|
||||
'import \'../../../sales/providers/customers_provider.dart\';',
|
||||
'import \'../../../sales/providers/customers_provider.dart\';\nimport \'../../../sales/domain/customer.dart\';'
|
||||
)
|
||||
|
||||
# Fix SmartSearchDropdown
|
||||
old_dropdown = """ SmartSearchDropdown(
|
||||
label: 'Client (Optional)',
|
||||
items: customersState.value!.map((c) => DropdownMenuItem(value: c.id.toString(), child: Text(c.name))).toList(),
|
||||
value: _selectedCustomerId?.toString(),
|
||||
onChanged: (val) {
|
||||
setState(() {
|
||||
_selectedCustomerId = val != null ? int.parse(val) : null;
|
||||
});
|
||||
},
|
||||
),"""
|
||||
|
||||
new_dropdown = """ SmartSearchDropdown<Customer>(
|
||||
labelText: 'Client (Optional)',
|
||||
items: customersState.value!,
|
||||
itemAsString: (c) => c.name,
|
||||
value: customersState.value!.where((c) => c.id == _selectedCustomerId).firstOrNull,
|
||||
onChanged: (val) {
|
||||
setState(() {
|
||||
_selectedCustomerId = val?.id;
|
||||
});
|
||||
},
|
||||
),"""
|
||||
|
||||
content = content.replace(old_dropdown, new_dropdown)
|
||||
|
||||
with open('kifi-app/lib/features/projects/presentation/widgets/add_project_sheet.dart', 'w') as f:
|
||||
f.write(content)
|
||||
Reference in New Issue
Block a user