Browse Source

supply using with action plant

smf
daivp 4 years ago
parent
commit
12425dc856
3 changed files with 23 additions and 23 deletions
  1. +1
    -1
      lib/custom_model/action_form/RequestActivity.dart
  2. +1
    -4
      lib/presentation/screens/actions/plant/widget_plant_supply.dart
  3. +21
    -18
      lib/presentation/screens/actions/sc_action.dart

+ 1
- 1
lib/custom_model/action_form/RequestActivity.dart View File

@@ -94,7 +94,7 @@ class TbObjectUpdateDTO {
class TbSuppliesUsingDetailsDTOs {
int tbSuppliesInWarehouseId;
String dosage;
int quantity;
num quantity;
int tbEquipmentOfCustomerId;
String howToUse;


+ 1
- 4
lib/presentation/screens/actions/plant/widget_plant_supply.dart View File

@@ -54,7 +54,7 @@ class _WidgetPlantSupplyState extends State<WidgetPlantSupply> {
return Container();
} else {
return Container(
height: 80,
height: 90,
child: ListView.builder(
physics: ClampingScrollPhysics(),
scrollDirection: Axis.horizontal,
@@ -477,9 +477,6 @@ class _WidgetPlantSupplyState extends State<WidgetPlantSupply> {
),
),
_buildListSupply(),
SizedBox(
height: 8.0,
),
_formEdit()
],
);

+ 21
- 18
lib/presentation/screens/actions/sc_action.dart View File

@@ -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;

Loading…
Cancel
Save