|
|
|
@@ -1,6 +1,6 @@ |
|
|
|
import 'dart:convert'; |
|
|
|
|
|
|
|
import 'package:farm_tpf/custom_model/NurseryDetail.dart'; |
|
|
|
import 'package:farm_tpf/custom_model/SuppliesUsing.dart'; |
|
|
|
import 'package:farm_tpf/custom_model/action_form/ActionUIField.dart'; |
|
|
|
import 'package:farm_tpf/custom_model/action_form/ActionUIForm.dart'; |
|
|
|
import 'package:farm_tpf/custom_model/action_form/RequestActivity.dart'; |
|
|
|
@@ -63,6 +63,7 @@ class _ActionScreenState extends State<ActionScreen> { |
|
|
|
|
|
|
|
var _actionUIForm = ActionUIForm(); |
|
|
|
var _nurseryDetails = <TbNurseryDetailsDTO>[]; |
|
|
|
var _supplyUsings = <SuppliesUsing>[]; |
|
|
|
|
|
|
|
Future<Null> getSharedPrefs() async { |
|
|
|
var currentFullName = await pref.getString(DATA_CONST.CURRENT_FULL_NAME); |
|
|
|
@@ -111,6 +112,16 @@ class _ActionScreenState extends State<ActionScreen> { |
|
|
|
//CHECK NURSERY |
|
|
|
if (widget.activityType == 'ACTIVE_TYPE_NURSERY') { |
|
|
|
_requestActivity.tbNurseryDetailsDTOList = _nurseryDetails; |
|
|
|
} else if (widget.activityType == 'ACTIVE_TYPE_PLANTING') { |
|
|
|
var _listSupplyUsingDetail = <TbSuppliesUsingDetailsDTOs>[]; |
|
|
|
_supplyUsings.forEach((element) { |
|
|
|
var usingSupplyDetail = TbSuppliesUsingDetailsDTOs() |
|
|
|
..tbSuppliesInWarehouseId = element.tbSuppliesInWarehouseId |
|
|
|
..dosage = element.dosage |
|
|
|
..quantity = element.quantity; |
|
|
|
_listSupplyUsingDetail.add(usingSupplyDetail); |
|
|
|
}); |
|
|
|
_requestActivity.tbSuppliesUsingDetailsDTOs = _listSupplyUsingDetail; |
|
|
|
} |
|
|
|
//convert data to json |
|
|
|
var activityCommonData = |
|
|
|
@@ -206,7 +217,8 @@ class _ActionScreenState extends State<ActionScreen> { |
|
|
|
hint: field.description, |
|
|
|
controller: textFieldControllers[field.id.toString()], |
|
|
|
onSaved: (newValue) {}); |
|
|
|
} else if (field.tbControlTypeName == 'dropdown') { |
|
|
|
} else if (field.tbControlTypeName == 'dropdown' || |
|
|
|
field.tbControlTypeName == 'radiobutton') { |
|
|
|
return DropdownSupplyWidget( |
|
|
|
titleName: field.description ?? '', |
|
|
|
tbSupply: field.tbActivityExtendTypeExternalTable ?? '', |
|
|
|
@@ -219,7 +231,6 @@ class _ActionScreenState extends State<ActionScreen> { |
|
|
|
onPressed: (commonData) { |
|
|
|
valueObjects[field.id.toString()] = |
|
|
|
commonData.id.toString(); |
|
|
|
print(valueObjects[field.id.toString()]); |
|
|
|
}); |
|
|
|
} else if (field.tbControlTypeName == 'date') { |
|
|
|
return FieldDateWidget( |
|
|
|
@@ -229,20 +240,8 @@ class _ActionScreenState extends State<ActionScreen> { |
|
|
|
'${field.description} ${field.isMandatory ? '*' : ''}', |
|
|
|
invalidMessage: '', |
|
|
|
onPressed: (selectedDate) { |
|
|
|
print(selectedDate.day); |
|
|
|
}); |
|
|
|
} else if (field.tbControlTypeName == 'radiobutton') { |
|
|
|
return DropdownSupplyWidget( |
|
|
|
titleName: field.description ?? '', |
|
|
|
tbSupply: field.tbActivityExtendTypeExternalTable ?? '', |
|
|
|
tag: field.name, |
|
|
|
value: field.description, |
|
|
|
hint: |
|
|
|
'${field.description} ${field.isMandatory ? '*' : ''}', |
|
|
|
condition: field.tbActivityExtendTypeCondition, |
|
|
|
invalidMessage: '', |
|
|
|
onPressed: (commonData) { |
|
|
|
print(commonData.name); |
|
|
|
valueObjects[field.id.toString()] = selectedDate |
|
|
|
.convertLocalDateTimeToStringUtcDateTime(); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
return Container(); |
|
|
|
@@ -271,7 +270,11 @@ class _ActionScreenState extends State<ActionScreen> { |
|
|
|
height: 16, |
|
|
|
color: Colors.grey[200], |
|
|
|
), |
|
|
|
WidgetPlantSupply(currentItems: [], onChangeSupplies: (value) {}), |
|
|
|
WidgetPlantSupply( |
|
|
|
currentItems: [], |
|
|
|
onChangeSupplies: (value) { |
|
|
|
_supplyUsings = value; |
|
|
|
}), |
|
|
|
], |
|
|
|
); |
|
|
|
break; |