| class Dung { | class Dung { | ||||
| int id; | int id; | ||||
| int activityId; | |||||
| int cropId; | int cropId; | ||||
| String executeDate; | String executeDate; | ||||
| String description; | String description; | ||||
| String media; | |||||
| num quarantinePeriod; | num quarantinePeriod; | ||||
| String weatherConditions; | String weatherConditions; | ||||
| String purpose; | String purpose; | ||||
| String executeBy; | |||||
| List<SuppliesUsing> suppliesUsing; | List<SuppliesUsing> suppliesUsing; | ||||
| Dung( | Dung( | ||||
| {this.id, | {this.id, | ||||
| this.activityId, | |||||
| this.cropId, | this.cropId, | ||||
| this.executeDate, | this.executeDate, | ||||
| this.description, | this.description, | ||||
| this.media, | |||||
| this.quarantinePeriod, | this.quarantinePeriod, | ||||
| this.weatherConditions, | this.weatherConditions, | ||||
| this.purpose, | this.purpose, | ||||
| this.executeBy, | |||||
| this.suppliesUsing}); | this.suppliesUsing}); | ||||
| Dung.fromJson(Map<String, dynamic> json) { | Dung.fromJson(Map<String, dynamic> json) { | ||||
| id = json['id']; | id = json['id']; | ||||
| cropId = json['cropId']; | cropId = json['cropId']; | ||||
| activityId = json['activityId']; | |||||
| executeDate = json['executeDate']; | executeDate = json['executeDate']; | ||||
| description = json['description']; | description = json['description']; | ||||
| media = json['media']; | |||||
| quarantinePeriod = json['quarantinePeriod']; | quarantinePeriod = json['quarantinePeriod']; | ||||
| weatherConditions = json['weatherConditions']; | weatherConditions = json['weatherConditions']; | ||||
| purpose = json['purpose']; | purpose = json['purpose']; | ||||
| executeBy = json['executeBy']; | |||||
| if (json['suppliesUsing'] != null) { | if (json['suppliesUsing'] != null) { | ||||
| suppliesUsing = new List<SuppliesUsing>(); | suppliesUsing = new List<SuppliesUsing>(); | ||||
| json['suppliesUsing'].forEach((v) { | json['suppliesUsing'].forEach((v) { | ||||
| final Map<String, dynamic> data = new Map<String, dynamic>(); | final Map<String, dynamic> data = new Map<String, dynamic>(); | ||||
| data['id'] = this.id; | data['id'] = this.id; | ||||
| data['cropId'] = this.cropId; | data['cropId'] = this.cropId; | ||||
| data['activityId'] = this.activityId; | |||||
| data['executeDate'] = this.executeDate; | data['executeDate'] = this.executeDate; | ||||
| data['description'] = this.description; | data['description'] = this.description; | ||||
| data['media'] = this.media; | |||||
| data['quarantinePeriod'] = this.quarantinePeriod; | data['quarantinePeriod'] = this.quarantinePeriod; | ||||
| data['weatherConditions'] = this.weatherConditions; | data['weatherConditions'] = this.weatherConditions; | ||||
| data['purpose'] = this.purpose; | data['purpose'] = this.purpose; | ||||
| data['executeBy'] = this.executeBy; | |||||
| if (this.suppliesUsing != null) { | if (this.suppliesUsing != null) { | ||||
| data['suppliesUsing'] = | data['suppliesUsing'] = | ||||
| this.suppliesUsing.map((v) => v.toJson()).toList(); | this.suppliesUsing.map((v) => v.toJson()).toList(); |
| import 'package:get/get.dart'; | |||||
| class ChangeButtonInForm extends GetxController { | |||||
| bool isEdit; | |||||
| void resetValue() { | |||||
| isEdit = false; | |||||
| update(); | |||||
| } | |||||
| void updateToEdit(bool isChangeEdit) { | |||||
| isEdit = isChangeEdit; | |||||
| update(); | |||||
| } | |||||
| } |
| import 'package:farm_tpf/custom_model/SuppliesUsing.dart'; | |||||
| import 'package:get/get.dart'; | |||||
| class ChangeSupplyUsing extends GetxController { | |||||
| List<SuppliesUsing> currentItems; | |||||
| SuppliesUsing currentSupplyUsing; | |||||
| int currentIndex; | |||||
| void init(List<SuppliesUsing> initItems) { | |||||
| currentItems = initItems; | |||||
| currentSupplyUsing = SuppliesUsing(); | |||||
| currentIndex = -1; | |||||
| update(); | |||||
| } | |||||
| void changeIndexEdit(int index) { | |||||
| currentIndex = index; | |||||
| update(); | |||||
| } | |||||
| void changeInitList(List<SuppliesUsing> sups) { | |||||
| currentItems = sups; | |||||
| update(); | |||||
| } | |||||
| void addSupply(SuppliesUsing supplyUsing) { | |||||
| currentItems.insert(0, supplyUsing); | |||||
| currentSupplyUsing = SuppliesUsing(); | |||||
| update(); | |||||
| } | |||||
| void deleteSupply(int index) { | |||||
| currentItems.removeAt(index); | |||||
| currentSupplyUsing = SuppliesUsing(); | |||||
| update(); | |||||
| } | |||||
| void editSupply(int index, SuppliesUsing supplyUsing) { | |||||
| currentItems[index] = supplyUsing; | |||||
| currentSupplyUsing = SuppliesUsing(); | |||||
| update(); | |||||
| } | |||||
| } |
| import 'package:get/get.dart'; | |||||
| class ChangeUnit extends GetxController { | |||||
| List<String> currentUnits; | |||||
| String selectedUnit; | |||||
| initValue() { | |||||
| currentUnits = []; | |||||
| selectedUnit = ""; | |||||
| update(); | |||||
| } | |||||
| updateListByUnitName(String unitName) { | |||||
| if (unitName == "kg" || unitName == "g") { | |||||
| currentUnits = ["kg", "g"]; | |||||
| selectedUnit = unitName; | |||||
| } else if (unitName == "l" || unitName == "m") { | |||||
| currentUnits = ["l", "ml"]; | |||||
| selectedUnit = unitName; | |||||
| } else if (unitName == "m" || unitName == "cm" || unitName == "mm") { | |||||
| currentUnits = ["m", "cm", "mm"]; | |||||
| selectedUnit = unitName; | |||||
| } else { | |||||
| currentUnits = []; | |||||
| } | |||||
| update(); | |||||
| } | |||||
| updateSelected(String selected) { | |||||
| selectedUnit = selected; | |||||
| update(); | |||||
| } | |||||
| } |
| import 'dart:convert'; | |||||
| import 'package:farm_tpf/custom_model/Dung.dart'; | |||||
| import 'package:farm_tpf/custom_model/SuppliesUsing.dart'; | |||||
| import 'package:farm_tpf/data/api/app_exception.dart'; | |||||
| import 'package:farm_tpf/data/repository/repository.dart'; | |||||
| import 'package:farm_tpf/presentation/custom_widgets/bloc/media_helper_bloc.dart'; | |||||
| import 'package:farm_tpf/presentation/custom_widgets/widget_loading.dart'; | |||||
| import 'package:farm_tpf/presentation/custom_widgets/widget_media_picker.dart'; | |||||
| import 'package:farm_tpf/presentation/screens/actions/bloc/action_detail_bloc.dart'; | |||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeSupplyUsing.dart'; | |||||
| import 'package:farm_tpf/presentation/screens/actions/dung/widget_dung_supply.dart'; | |||||
| import 'package:farm_tpf/presentation/screens/actions/state_management_helper/change_file_controller.dart'; | |||||
| import 'package:farm_tpf/utils/const_common.dart'; | |||||
| import 'package:farm_tpf/utils/const_string.dart'; | import 'package:farm_tpf/utils/const_string.dart'; | ||||
| import 'package:farm_tpf/utils/const_style.dart'; | |||||
| import 'package:farm_tpf/utils/pref.dart'; | |||||
| import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
| import 'package:flutter_bloc/flutter_bloc.dart'; | |||||
| import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; | |||||
| import 'package:get/get.dart'; | |||||
| import 'package:intl/intl.dart'; | |||||
| import 'package:keyboard_dismisser/keyboard_dismisser.dart'; | |||||
| import 'package:pattern_formatter/pattern_formatter.dart'; | |||||
| import 'package:farm_tpf/utils/formatter.dart'; | |||||
| import '../util_action.dart'; | |||||
| class EditActionDungScreen extends StatefulWidget { | class EditActionDungScreen extends StatefulWidget { | ||||
| final int cropId; | |||||
| final bool isEdit; | |||||
| final int activityId; | |||||
| EditActionDungScreen( | |||||
| {@required this.cropId, this.isEdit = false, this.activityId}); | |||||
| @override | @override | ||||
| _EditActionDungScreenState createState() => _EditActionDungScreenState(); | _EditActionDungScreenState createState() => _EditActionDungScreenState(); | ||||
| } | } | ||||
| class _EditActionDungScreenState extends State<EditActionDungScreen> { | class _EditActionDungScreenState extends State<EditActionDungScreen> { | ||||
| final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>(); | |||||
| final _repository = Repository(); | |||||
| GlobalKey<FormState> _formKey = GlobalKey(); | |||||
| bool _autoValidate = false; | |||||
| Dung _dung = Dung(); | |||||
| var pref = LocalPref(); | |||||
| final _descriptionController = TextEditingController(); | |||||
| final _purposeController = TextEditingController(); | |||||
| final _weatherController = TextEditingController(); | |||||
| final _executeByController = TextEditingController(); | |||||
| final _quarantinePeriodController = TextEditingController(); | |||||
| List<SuppliesUsing> suppliesUsing = new List<SuppliesUsing>(); | |||||
| String executeTimeView; | |||||
| DateTime executeTime = DateTime.now(); | |||||
| List<String> filePaths = List<String>(); | |||||
| var changeFileController = Get.put(ChangeFileController()); | |||||
| Future<Null> getSharedPrefs() async { | |||||
| var currentFullName = await pref.getString(DATA_CONST.CURRENT_FULL_NAME); | |||||
| _executeByController.text = currentFullName ?? ""; | |||||
| } | |||||
| @override | @override | ||||
| Widget build(BuildContext context) { | |||||
| return Scaffold( | |||||
| appBar: AppBar( | |||||
| title: Text(plot_action_dung), | |||||
| ), | |||||
| void initState() { | |||||
| super.initState(); | |||||
| getSharedPrefs(); | |||||
| changeFileController.initValue(); | |||||
| _dung.suppliesUsing = new List<SuppliesUsing>(); | |||||
| var parsedExecuteDate = | |||||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(executeTime); | |||||
| _dung.executeDate = "$parsedExecuteDate"; | |||||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(executeTime); | |||||
| _dung.cropId = widget.cropId; | |||||
| } | |||||
| _validateInputs() async { | |||||
| if (_formKey.currentState.validate()) { | |||||
| _formKey.currentState.save(); | |||||
| LoadingDialog.showLoadingDialog(context); | |||||
| filePaths = Get.find<ChangeFileController>().files; | |||||
| List<SuppliesUsing> newSups = []; | |||||
| suppliesUsing.forEach((sup) { | |||||
| var newSup = sup; | |||||
| newSup.suppliesInWarehouseId = sup.tbSuppliesInWarehouseId; | |||||
| newSups.add(newSup); | |||||
| }); | |||||
| _dung.suppliesUsing = newSups; | |||||
| var activityDung = jsonEncode(_dung.toJson()).toString(); | |||||
| //ADD NEW | |||||
| if (_dung.activityId == null) { | |||||
| _repository.createAction((value) { | |||||
| LoadingDialog.hideLoadingDialog(context); | |||||
| Get.back(result: value); | |||||
| Get.snackbar(label_add_success, "Hoạt động bón phân", | |||||
| snackPosition: SnackPosition.BOTTOM); | |||||
| }, (error) { | |||||
| LoadingDialog.hideLoadingDialog(context); | |||||
| _scaffoldKey.currentState.showSnackBar(SnackBar( | |||||
| content: Row( | |||||
| mainAxisAlignment: MainAxisAlignment.spaceBetween, | |||||
| children: <Widget>[ | |||||
| Flexible(child: Text(AppException.handleError(error))), | |||||
| Icon(Icons.error), | |||||
| ], | |||||
| ), | |||||
| backgroundColor: Colors.red, | |||||
| duration: Duration(seconds: 3), | |||||
| )); | |||||
| }, | |||||
| apiAddAction: ConstCommon.apiAddDung, | |||||
| paramActivity: ConstCommon.paramsActionDung, | |||||
| activityAction: activityDung, | |||||
| filePaths: filePaths); | |||||
| } else { | |||||
| //UPDATE | |||||
| _repository.updateAction((value) { | |||||
| LoadingDialog.hideLoadingDialog(context); | |||||
| Get.back(result: value); | |||||
| Get.snackbar(label_update_success, "Hoạt động bón phân", | |||||
| snackPosition: SnackPosition.BOTTOM); | |||||
| }, (error) { | |||||
| LoadingDialog.hideLoadingDialog(context); | |||||
| _scaffoldKey.currentState.showSnackBar(SnackBar( | |||||
| content: Row( | |||||
| mainAxisAlignment: MainAxisAlignment.spaceBetween, | |||||
| children: <Widget>[ | |||||
| Flexible(child: Text(AppException.handleError(error))), | |||||
| Icon(Icons.error), | |||||
| ], | |||||
| ), | |||||
| backgroundColor: Colors.red, | |||||
| duration: Duration(seconds: 3), | |||||
| )); | |||||
| }, | |||||
| apiUpdateAction: ConstCommon.apiUpdateDung, | |||||
| paramActivity: ConstCommon.paramsActionDung, | |||||
| activityAction: activityDung, | |||||
| filePaths: filePaths); | |||||
| } | |||||
| } else { | |||||
| _autoValidate = true; | |||||
| } | |||||
| } | |||||
| Widget _btnExecuteTimePicker() { | |||||
| return FlatButton( | |||||
| padding: EdgeInsets.only(top: 0.0, right: 0.0, bottom: 0.0, left: 0.0), | |||||
| onPressed: () { | |||||
| DatePicker.showDateTimePicker(context, | |||||
| showTitleActions: true, onChanged: (date) {}, onConfirm: (date) { | |||||
| setState(() { | |||||
| var parsedDate = | |||||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(date); | |||||
| _dung.executeDate = "$parsedDate"; | |||||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(date); | |||||
| }); | |||||
| }, currentTime: executeTime, locale: LocaleType.vi); | |||||
| }, | |||||
| child: Container( | |||||
| padding: | |||||
| EdgeInsets.only(top: 0.0, right: 0.0, bottom: 10.5, left: 0.0), | |||||
| decoration: BoxDecoration( | |||||
| border: kBorderTextField, | |||||
| ), | |||||
| child: Row( | |||||
| children: [ | |||||
| Expanded( | |||||
| child: Text( | |||||
| //TODO: check condition | |||||
| executeTimeView == null ? "$executeTime" : executeTimeView, | |||||
| style: TextStyle(fontSize: 14.0, color: Colors.black87), | |||||
| )), | |||||
| Icon( | |||||
| Icons.date_range, | |||||
| color: Colors.blue, | |||||
| ), | |||||
| ], | |||||
| ))); | |||||
| } | |||||
| Widget _purposeField() { | |||||
| return TextFormField( | |||||
| keyboardType: TextInputType.text, | |||||
| decoration: InputDecoration(labelText: "Lý do sử dụng"), | |||||
| controller: _purposeController, | |||||
| onSaved: (newValue) { | |||||
| _dung.purpose = newValue; | |||||
| }, | |||||
| ); | |||||
| } | |||||
| Widget _quarantinePeriodField() { | |||||
| return TextFormField( | |||||
| keyboardType: TextInputType.numberWithOptions(decimal: true), | |||||
| inputFormatters: [ | |||||
| ThousandsFormatter( | |||||
| formatter: NumberFormat("#,###.##", "es"), allowFraction: true) | |||||
| ], | |||||
| decoration: InputDecoration(labelText: "Thời gian cách ly"), | |||||
| controller: _quarantinePeriodController, | |||||
| onSaved: (newValue) { | |||||
| _dung.quarantinePeriod = newValue.parseDoubleThousand(); | |||||
| }, | |||||
| ); | ); | ||||
| } | } | ||||
| Widget _weatherField() { | |||||
| return TextFormField( | |||||
| keyboardType: TextInputType.text, | |||||
| decoration: InputDecoration(labelText: "Thời tiết"), | |||||
| controller: _weatherController, | |||||
| onSaved: (newValue) { | |||||
| _dung.weatherConditions = newValue; | |||||
| }, | |||||
| ); | |||||
| } | |||||
| Widget _desciptionField() { | |||||
| return TextFormField( | |||||
| keyboardType: TextInputType.text, | |||||
| decoration: InputDecoration(labelText: "Ghi chú"), | |||||
| controller: _descriptionController, | |||||
| onSaved: (newValue) { | |||||
| _dung.description = newValue; | |||||
| }, | |||||
| ); | |||||
| } | |||||
| Widget _executeByField() { | |||||
| return TextFormField( | |||||
| keyboardType: TextInputType.text, | |||||
| decoration: InputDecoration(labelText: "Người thực hiện"), | |||||
| enabled: false, | |||||
| controller: _executeByController, | |||||
| onSaved: (newValue) {}, | |||||
| ); | |||||
| } | |||||
| _actionAppBar() { | |||||
| IconButton iconButton; | |||||
| if (1 == 1) { | |||||
| iconButton = IconButton( | |||||
| icon: Icon( | |||||
| Icons.done, | |||||
| color: Colors.black, | |||||
| ), | |||||
| onPressed: () { | |||||
| FocusScopeNode currentFocus = FocusScope.of(context); | |||||
| if (!currentFocus.hasPrimaryFocus) { | |||||
| currentFocus.unfocus(); | |||||
| } | |||||
| _validateInputs(); | |||||
| }, | |||||
| ); | |||||
| return <Widget>[iconButton]; | |||||
| } | |||||
| return <Widget>[Container()]; | |||||
| } | |||||
| @override | |||||
| Widget build(BuildContext context) => KeyboardDismisser( | |||||
| gestures: [ | |||||
| GestureType.onTap, | |||||
| GestureType.onPanUpdateDownDirection, | |||||
| ], | |||||
| child: Scaffold( | |||||
| key: _scaffoldKey, | |||||
| appBar: AppBar( | |||||
| centerTitle: true, | |||||
| title: Text(plot_action_dung), | |||||
| actions: _actionAppBar()), | |||||
| body: KeyboardDismisser( | |||||
| child: MultiBlocProvider( | |||||
| providers: [ | |||||
| BlocProvider<ActionDetailBloc>( | |||||
| create: (context) => | |||||
| ActionDetailBloc(repository: Repository()) | |||||
| ..add(FetchData( | |||||
| isNeedFetchData: widget.isEdit, | |||||
| apiActivity: ConstCommon.apiDetailDung, | |||||
| activityId: widget.activityId))), | |||||
| BlocProvider<MediaHelperBloc>( | |||||
| create: (context) => | |||||
| MediaHelperBloc()..add(ChangeListMedia(items: [])), | |||||
| ) | |||||
| ], | |||||
| child: Form( | |||||
| key: _formKey, | |||||
| autovalidate: _autoValidate, | |||||
| child: SingleChildScrollView( | |||||
| padding: EdgeInsets.all(8.0), | |||||
| child: BlocConsumer<ActionDetailBloc, | |||||
| ActionDetailState>( | |||||
| listener: (context, state) async { | |||||
| if (state is ActionDetailFailure) { | |||||
| LoadingDialog.hideLoadingDialog(context); | |||||
| } else if (state is ActionDetailSuccess) { | |||||
| LoadingDialog.hideLoadingDialog(context); | |||||
| _dung = Dung.fromJson(state.item); | |||||
| _dung.activityId = widget.activityId; | |||||
| _purposeController.text = _dung.purpose ?? ""; | |||||
| _quarantinePeriodController.text = _dung | |||||
| .quarantinePeriod | |||||
| .formatNumtoStringDecimal(); | |||||
| _weatherController.text = | |||||
| _dung.weatherConditions ?? ""; | |||||
| _descriptionController.text = | |||||
| _dung.description; | |||||
| _executeByController.text = _dung.executeBy; | |||||
| try { | |||||
| executeTime = | |||||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'") | |||||
| .parse(_dung.executeDate); | |||||
| } catch (_) {} | |||||
| executeTimeView = | |||||
| DateFormat("dd/MM/yyyy HH:mm") | |||||
| .format(executeTime); | |||||
| //Show media | |||||
| if (_dung.media != null) { | |||||
| await UtilAction.cacheFiles(_dung.media) | |||||
| .then((value) { | |||||
| BlocProvider.of<MediaHelperBloc>(context) | |||||
| .add(ChangeListMedia(items: value)); | |||||
| }).whenComplete(() { | |||||
| print("completed"); | |||||
| }); | |||||
| } | |||||
| //list supply | |||||
| suppliesUsing = _dung.suppliesUsing; | |||||
| Get.find<ChangeSupplyUsing>() | |||||
| .changeInitList(suppliesUsing); | |||||
| } else if (state is ActionDetailInitial) { | |||||
| print("init"); | |||||
| } else if (state is ActionDetailLoading) { | |||||
| print("loading"); | |||||
| LoadingDialog.showLoadingDialog(context); | |||||
| } | |||||
| }, | |||||
| builder: (context, state) { | |||||
| return Column( | |||||
| children: <Widget>[ | |||||
| Container( | |||||
| width: double.infinity, | |||||
| child: Text( | |||||
| "Ngày thực hiện *", | |||||
| style: TextStyle( | |||||
| color: Colors.black54, | |||||
| fontSize: 13.0), | |||||
| ), | |||||
| ), | |||||
| _btnExecuteTimePicker(), | |||||
| SizedBox( | |||||
| height: 8.0, | |||||
| ), | |||||
| _purposeField(), | |||||
| SizedBox( | |||||
| height: 8.0, | |||||
| ), | |||||
| _quarantinePeriodField(), | |||||
| SizedBox( | |||||
| height: 8.0, | |||||
| ), | |||||
| _weatherField(), | |||||
| SizedBox( | |||||
| height: 8.0, | |||||
| ), | |||||
| _desciptionField(), | |||||
| SizedBox( | |||||
| height: 8.0, | |||||
| ), | |||||
| _executeByField(), | |||||
| SizedBox( | |||||
| height: 8.0, | |||||
| ), | |||||
| WidgetDungSupply( | |||||
| currentItems: [], | |||||
| onChangeSupplies: (value) { | |||||
| suppliesUsing = value; | |||||
| }), | |||||
| SizedBox( | |||||
| height: 8.0, | |||||
| ), | |||||
| BlocBuilder<MediaHelperBloc, | |||||
| MediaHelperState>( | |||||
| builder: (context, state) { | |||||
| if (state is MediaHelperSuccess) { | |||||
| return WidgetMediaPicker( | |||||
| currentItems: state.items, | |||||
| onChangeFiles: (filePaths) async { | |||||
| Get.find<ChangeFileController>() | |||||
| .addAllFile(filePaths); | |||||
| }); | |||||
| } else { | |||||
| return Center( | |||||
| child: CircularProgressIndicator()); | |||||
| } | |||||
| }), | |||||
| ], | |||||
| ); | |||||
| }, | |||||
| ), | |||||
| )))))); | |||||
| @override | |||||
| void dispose() { | |||||
| _quarantinePeriodController.dispose(); | |||||
| _purposeController.dispose(); | |||||
| _weatherController.dispose(); | |||||
| _descriptionController.dispose(); | |||||
| _executeByController.dispose(); | |||||
| super.dispose(); | |||||
| } | |||||
| } | } |
| import 'package:farm_tpf/custom_model/SuppliesUsing.dart'; | |||||
| import 'package:farm_tpf/custom_model/Supply.dart'; | |||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeFormButton.dart'; | |||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeSupplyUsing.dart'; | |||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeUnit.dart'; | |||||
| import 'package:farm_tpf/presentation/screens/actions/state_management_helper/change_supply.dart'; | |||||
| import 'package:farm_tpf/presentation/screens/resources/sc_resource_helper.dart'; | |||||
| import 'package:farm_tpf/utils/const_color.dart'; | |||||
| import 'package:farm_tpf/utils/const_common.dart'; | |||||
| import 'package:farm_tpf/utils/const_style.dart'; | |||||
| import 'package:flutter/material.dart'; | |||||
| import 'package:get/get.dart'; | |||||
| import 'package:farm_tpf/utils/formatter.dart'; | |||||
| import 'package:intl/intl.dart'; | |||||
| import 'package:pattern_formatter/pattern_formatter.dart'; | |||||
| import '../util_action.dart'; | |||||
| class WidgetDungSupply extends StatefulWidget { | |||||
| final List<SuppliesUsing> currentItems; | |||||
| final Function(List<SuppliesUsing> supplyChanges) onChangeSupplies; | |||||
| WidgetDungSupply({this.currentItems, @required this.onChangeSupplies}); | |||||
| @override | |||||
| _WidgetDungSupplyState createState() => _WidgetDungSupplyState(); | |||||
| } | |||||
| class _WidgetDungSupplyState extends State<WidgetDungSupply> { | |||||
| final _dosageController = TextEditingController(); | |||||
| final _quantityController = TextEditingController(); | |||||
| final changeSelectedSupply = Get.put(ChangeSupply()); | |||||
| final changeSupplyUsing = Get.put(ChangeSupplyUsing()); | |||||
| final changeUnit = Get.put(ChangeUnit()); | |||||
| final changeButton = Get.put(ChangeButtonInForm()); | |||||
| @override | |||||
| void initState() { | |||||
| super.initState(); | |||||
| changeSelectedSupply.initValue(); | |||||
| changeSupplyUsing.init(widget.currentItems); | |||||
| changeUnit.initValue(); | |||||
| changeButton.resetValue(); | |||||
| } | |||||
| Widget _buildListSupply() { | |||||
| return GetBuilder<ChangeSupplyUsing>(builder: (value) { | |||||
| widget.onChangeSupplies(value.currentItems); | |||||
| if (value.currentItems.isEmpty) { | |||||
| return Container(); | |||||
| } else { | |||||
| return Container( | |||||
| height: 80, | |||||
| child: ListView.builder( | |||||
| physics: ClampingScrollPhysics(), | |||||
| scrollDirection: Axis.horizontal, | |||||
| shrinkWrap: true, | |||||
| itemCount: value.currentItems.length, | |||||
| itemBuilder: (context, index) { | |||||
| return GestureDetector( | |||||
| onTap: () { | |||||
| print("edit"); | |||||
| changeSupplyUsing.changeIndexEdit(index); | |||||
| changeButton.updateToEdit(true); | |||||
| var editedSupplyUsing = value.currentItems[index]; | |||||
| var editedSupply = Supply() | |||||
| ..id = editedSupplyUsing.tbSuppliesInWarehouseId | |||||
| ..tbSuppliesName = editedSupplyUsing.supplyName | |||||
| ..unit = editedSupplyUsing.supplyUnit; | |||||
| changeSelectedSupply.change(editedSupply); | |||||
| changeUnit | |||||
| .updateListByUnitName(editedSupplyUsing.supplyUnit); | |||||
| changeUnit.updateSelected(editedSupplyUsing.supplyUnit); | |||||
| _dosageController.text = editedSupplyUsing.dosage; | |||||
| _quantityController.text = editedSupplyUsing.quantity | |||||
| .formatNumtoStringDecimal(); | |||||
| }, | |||||
| child: Card( | |||||
| child: Stack( | |||||
| alignment: Alignment.bottomCenter, | |||||
| overflow: Overflow.visible, | |||||
| children: <Widget>[ | |||||
| Positioned( | |||||
| child: ClipRRect( | |||||
| borderRadius: BorderRadius.circular(8), | |||||
| child: Container( | |||||
| padding: EdgeInsets.all(4), | |||||
| width: 150, | |||||
| child: Column( | |||||
| children: [ | |||||
| SizedBox( | |||||
| height: 12.0, | |||||
| ), | |||||
| Flexible( | |||||
| child: Text( | |||||
| value.currentItems[index].supplyName ?? | |||||
| "", | |||||
| overflow: TextOverflow.ellipsis, | |||||
| maxLines: 1), | |||||
| ), | |||||
| Flexible( | |||||
| child: Text( | |||||
| "${value.currentItems[index].dosage ?? ""}")), | |||||
| Flexible( | |||||
| child: Text( | |||||
| "${value.currentItems[index].quantity.formatNumtoStringDecimal() ?? ""} ${value.currentItems[index].supplyUnit ?? ""}")), | |||||
| ], | |||||
| ), | |||||
| ), | |||||
| )), | |||||
| Positioned( | |||||
| top: -10, | |||||
| right: -10, | |||||
| child: IconButton( | |||||
| icon: Icon( | |||||
| Icons.cancel, | |||||
| color: Colors.redAccent, | |||||
| ), | |||||
| onPressed: () { | |||||
| changeSupplyUsing.deleteSupply(index); | |||||
| }), | |||||
| ) | |||||
| ], | |||||
| ))); | |||||
| })); | |||||
| } | |||||
| }); | |||||
| } | |||||
| Widget _btnSelectSubstrates() { | |||||
| return GetBuilder<ChangeSupply>(builder: (data) { | |||||
| return FlatButton( | |||||
| padding: | |||||
| EdgeInsets.only(top: 0.0, right: 0.0, bottom: 0.0, left: 0.0), | |||||
| onPressed: () { | |||||
| Navigator.of(context) | |||||
| .push(MaterialPageRoute( | |||||
| builder: (_) => ResourceHelperScreen( | |||||
| titleName: "Phân bón", | |||||
| type: ConstCommon.supplyTypeDung, | |||||
| selectedId: changeSelectedSupply.selectedSupplyId), | |||||
| fullscreenDialog: false)) | |||||
| .then((value) { | |||||
| if (value != null) { | |||||
| var result = value as Supply; | |||||
| changeSelectedSupply.change(result); | |||||
| changeUnit.updateListByUnitName(result.unit); | |||||
| } | |||||
| }); | |||||
| }, | |||||
| child: Container( | |||||
| padding: EdgeInsets.only( | |||||
| top: 0.0, right: 0.0, bottom: 10.5, left: 0.0), | |||||
| decoration: BoxDecoration( | |||||
| border: kBorderTextField, | |||||
| ), | |||||
| child: Row( | |||||
| children: [ | |||||
| GetBuilder<ChangeSupply>( | |||||
| builder: (_) => Expanded( | |||||
| child: Text( | |||||
| changeSelectedSupply.selectedSupplyName ?? | |||||
| "Tên thương mại", | |||||
| style: TextStyle( | |||||
| fontSize: 14.0, color: Colors.black87)))), | |||||
| Icon( | |||||
| Icons.arrow_drop_down, | |||||
| color: Colors.grey, | |||||
| ), | |||||
| ], | |||||
| ))); | |||||
| }); | |||||
| } | |||||
| Widget _dropdownUnitTypes() { | |||||
| return GetBuilder<ChangeUnit>(builder: (data) { | |||||
| return DropdownButtonFormField<String>( | |||||
| itemHeight: 100, | |||||
| value: data.selectedUnit.isEmpty ? null : data.selectedUnit, | |||||
| items: data.currentUnits | |||||
| .map((label) => DropdownMenuItem( | |||||
| child: Text(label), | |||||
| value: label, | |||||
| )) | |||||
| .toList(), | |||||
| onChanged: (value) { | |||||
| var currentQuantity = _quantityController.text; | |||||
| num assignValue = currentQuantity.parseDoubleThousand(); | |||||
| if (assignValue != null) { | |||||
| var oldSelected = data.selectedUnit; | |||||
| if (oldSelected == value) { | |||||
| } else { | |||||
| assignValue = UtilAction.convertUnit( | |||||
| inputValue: assignValue, | |||||
| oldUnit: oldSelected, | |||||
| newUnit: value); | |||||
| } | |||||
| _quantityController.text = assignValue.formatNumtoStringDecimal(); | |||||
| } | |||||
| changeUnit.updateSelected(value); | |||||
| }, | |||||
| ); | |||||
| }); | |||||
| } | |||||
| _quantityField() { | |||||
| return TextFormField( | |||||
| keyboardType: TextInputType.numberWithOptions(decimal: true), | |||||
| inputFormatters: [ | |||||
| ThousandsFormatter( | |||||
| formatter: NumberFormat("#,###.##", "es"), allowFraction: true) | |||||
| ], | |||||
| decoration: InputDecoration(labelText: "Tổng lượng sử dụng *"), | |||||
| controller: _quantityController); | |||||
| } | |||||
| _buttonInForm() { | |||||
| return GetBuilder<ChangeButtonInForm>(builder: (_) { | |||||
| return Align( | |||||
| alignment: Alignment.centerRight, | |||||
| child: Row( | |||||
| mainAxisAlignment: MainAxisAlignment.spaceBetween, | |||||
| children: [ | |||||
| _.isEdit | |||||
| ? OutlineButton( | |||||
| shape: RoundedRectangleBorder( | |||||
| borderRadius: new BorderRadius.circular(8.0)), | |||||
| child: Text("Huỷ"), | |||||
| onPressed: () { | |||||
| changeButton.resetValue(); | |||||
| _resetForm(); | |||||
| _hidenKeyboard(context); | |||||
| }) | |||||
| : SizedBox(), | |||||
| _.isEdit | |||||
| ? FlatButton( | |||||
| color: COLOR_CONST.DEFAULT, | |||||
| shape: RoundedRectangleBorder( | |||||
| borderRadius: new BorderRadius.circular(8.0)), | |||||
| onPressed: () { | |||||
| var currentSupply = changeSelectedSupply.currentSupply; | |||||
| if (currentSupply.id != null) { | |||||
| var quantityWithCurrentSupplyUnit = | |||||
| UtilAction.convertUnit( | |||||
| inputValue: _quantityController.text | |||||
| .parseDoubleThousand(), | |||||
| oldUnit: changeUnit.selectedUnit, | |||||
| newUnit: | |||||
| changeSelectedSupply.currentSupply.unit); | |||||
| SuppliesUsing newSup = SuppliesUsing() | |||||
| ..dosage = _dosageController.text | |||||
| ..quantity = quantityWithCurrentSupplyUnit | |||||
| ..tbSuppliesInWarehouseId = currentSupply.id | |||||
| ..suppliesInWarehouseId = currentSupply.id | |||||
| ..supplyName = currentSupply.tbSuppliesName | |||||
| ..supplyUnit = currentSupply.unit | |||||
| ..unit = currentSupply.unit; | |||||
| changeSupplyUsing.editSupply( | |||||
| changeSupplyUsing.currentIndex, newSup); | |||||
| _resetForm(); | |||||
| _hidenKeyboard(context); | |||||
| } | |||||
| }, | |||||
| child: Text( | |||||
| "Sửa", | |||||
| style: TextStyle(color: Colors.white), | |||||
| )) | |||||
| : FlatButton( | |||||
| color: COLOR_CONST.DEFAULT, | |||||
| shape: RoundedRectangleBorder( | |||||
| borderRadius: new BorderRadius.circular(8.0)), | |||||
| onPressed: () { | |||||
| var currentSupply = changeSelectedSupply.currentSupply; | |||||
| if (currentSupply.id != null) { | |||||
| var quantityWithCurrentSupplyUnit = | |||||
| UtilAction.convertUnit( | |||||
| inputValue: _quantityController.text | |||||
| .parseDoubleThousand(), | |||||
| oldUnit: changeUnit.selectedUnit, | |||||
| newUnit: | |||||
| changeSelectedSupply.currentSupply.unit); | |||||
| SuppliesUsing newSup = SuppliesUsing() | |||||
| ..dosage = _dosageController.text | |||||
| ..quantity = quantityWithCurrentSupplyUnit | |||||
| ..tbSuppliesInWarehouseId = currentSupply.id | |||||
| ..suppliesInWarehouseId = currentSupply.id | |||||
| ..supplyName = currentSupply.tbSuppliesName | |||||
| ..supplyUnit = currentSupply.unit | |||||
| ..unit = currentSupply.unit; | |||||
| changeSupplyUsing.addSupply(newSup); | |||||
| _resetForm(); | |||||
| _hidenKeyboard(context); | |||||
| } | |||||
| }, | |||||
| child: Text( | |||||
| "Thêm", | |||||
| style: TextStyle(color: Colors.white), | |||||
| )) | |||||
| ], | |||||
| ), | |||||
| ); | |||||
| }); | |||||
| } | |||||
| Widget _formEdit() { | |||||
| return Container( | |||||
| padding: EdgeInsets.all(8.0), | |||||
| decoration: BoxDecoration( | |||||
| shape: BoxShape.rectangle, | |||||
| borderRadius: BorderRadius.circular(10), | |||||
| color: Colors.white, | |||||
| border: Border.all(color: COLOR_CONST.DEFAULT)), | |||||
| child: Column( | |||||
| children: [ | |||||
| Container( | |||||
| width: double.infinity, | |||||
| child: Text( | |||||
| "Tên thương mại", | |||||
| style: TextStyle(color: Colors.black54, fontSize: 13.0), | |||||
| ), | |||||
| ), | |||||
| _btnSelectSubstrates(), | |||||
| TextFormField( | |||||
| keyboardType: TextInputType.text, | |||||
| controller: _dosageController, | |||||
| decoration: InputDecoration(labelText: "Liều lượng sử dụng"), | |||||
| onSaved: (newValue) {}, | |||||
| ), | |||||
| Row( | |||||
| mainAxisSize: MainAxisSize.min, | |||||
| mainAxisAlignment: MainAxisAlignment.spaceEvenly, | |||||
| crossAxisAlignment: CrossAxisAlignment.center, | |||||
| children: [ | |||||
| Expanded( | |||||
| flex: 2, | |||||
| child: Container( | |||||
| height: 70, | |||||
| child: _quantityField(), | |||||
| ), | |||||
| ), | |||||
| SizedBox( | |||||
| width: 16.0, | |||||
| ), | |||||
| Expanded( | |||||
| flex: 1, | |||||
| child: Align( | |||||
| alignment: Alignment.bottomCenter, | |||||
| child: _dropdownUnitTypes(), | |||||
| )), | |||||
| ]), | |||||
| _buttonInForm() | |||||
| ], | |||||
| )); | |||||
| } | |||||
| _resetForm() { | |||||
| changeSupplyUsing.changeIndexEdit(-1); | |||||
| changeButton.resetValue(); | |||||
| _dosageController.text = ""; | |||||
| _quantityController.text = ""; | |||||
| changeUnit.initValue(); | |||||
| changeSelectedSupply.initValue(); | |||||
| } | |||||
| _hidenKeyboard(BuildContext context) { | |||||
| FocusScopeNode currentFocus = FocusScope.of(context); | |||||
| if (!currentFocus.hasPrimaryFocus) { | |||||
| currentFocus.unfocus(); | |||||
| } | |||||
| } | |||||
| @override | |||||
| Widget build(BuildContext context) { | |||||
| return Column( | |||||
| children: [_formEdit(), _buildListSupply()], | |||||
| ); | |||||
| } | |||||
| } |
| import 'package:farm_tpf/presentation/custom_widgets/widget_loading.dart'; | import 'package:farm_tpf/presentation/custom_widgets/widget_loading.dart'; | ||||
| import 'package:farm_tpf/presentation/custom_widgets/widget_media_picker.dart'; | import 'package:farm_tpf/presentation/custom_widgets/widget_media_picker.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/bloc/action_detail_bloc.dart'; | import 'package:farm_tpf/presentation/screens/actions/bloc/action_detail_bloc.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeSupplyUsing.dart'; | |||||
| import 'package:farm_tpf/presentation/screens/actions/plant/widget_plant_supply.dart'; | import 'package:farm_tpf/presentation/screens/actions/plant/widget_plant_supply.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/state_management_helper/change_file_controller.dart'; | import 'package:farm_tpf/presentation/screens/actions/state_management_helper/change_file_controller.dart'; | ||||
| import 'package:farm_tpf/utils/const_common.dart'; | import 'package:farm_tpf/utils/const_common.dart'; |
| import 'package:farm_tpf/app.dart'; | |||||
| import 'package:flutter/material.dart'; | |||||
| class ActionPlantScreen extends StatefulWidget { | |||||
| @override | |||||
| _ActionPlantScreenState createState() => _ActionPlantScreenState(); | |||||
| } | |||||
| class _ActionPlantScreenState extends State<ActionPlantScreen> { | |||||
| @override | |||||
| void initState() { | |||||
| super.initState(); | |||||
| } | |||||
| @override | |||||
| Widget build(BuildContext context) { | |||||
| return Scaffold( | |||||
| appBar: AppBar( | |||||
| title: Text("Plant"), | |||||
| ), | |||||
| ); | |||||
| } | |||||
| } |
| import 'package:farm_tpf/custom_model/SuppliesUsing.dart'; | import 'package:farm_tpf/custom_model/SuppliesUsing.dart'; | ||||
| import 'package:farm_tpf/custom_model/Supply.dart'; | import 'package:farm_tpf/custom_model/Supply.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeFormButton.dart'; | |||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeSupplyUsing.dart'; | |||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeUnit.dart'; | |||||
| import 'package:farm_tpf/presentation/screens/actions/state_management_helper/change_supply.dart'; | import 'package:farm_tpf/presentation/screens/actions/state_management_helper/change_supply.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/util_action.dart'; | import 'package:farm_tpf/presentation/screens/actions/util_action.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/resources/sc_resource_helper.dart'; | import 'package:farm_tpf/presentation/screens/resources/sc_resource_helper.dart'; | ||||
| ); | ); | ||||
| } | } | ||||
| } | } | ||||
| class ChangeUnit extends GetxController { | |||||
| List<String> currentUnits; | |||||
| String selectedUnit; | |||||
| initValue() { | |||||
| currentUnits = []; | |||||
| selectedUnit = ""; | |||||
| update(); | |||||
| } | |||||
| updateListByUnitName(String unitName) { | |||||
| if (unitName == "kg" || unitName == "g") { | |||||
| currentUnits = ["kg", "g"]; | |||||
| selectedUnit = unitName; | |||||
| } else if (unitName == "l" || unitName == "m") { | |||||
| currentUnits = ["l", "ml"]; | |||||
| selectedUnit = unitName; | |||||
| } else if (unitName == "m" || unitName == "cm" || unitName == "mm") { | |||||
| currentUnits = ["m", "cm", "mm"]; | |||||
| selectedUnit = unitName; | |||||
| } else { | |||||
| currentUnits = []; | |||||
| } | |||||
| update(); | |||||
| } | |||||
| updateSelected(String selected) { | |||||
| selectedUnit = selected; | |||||
| update(); | |||||
| } | |||||
| } | |||||
| class ChangeButtonInForm extends GetxController { | |||||
| bool isEdit; | |||||
| void resetValue() { | |||||
| isEdit = false; | |||||
| update(); | |||||
| } | |||||
| void updateToEdit(bool isChangeEdit) { | |||||
| isEdit = isChangeEdit; | |||||
| update(); | |||||
| } | |||||
| } | |||||
| class ChangeSupplyUsing extends GetxController { | |||||
| List<SuppliesUsing> currentItems; | |||||
| SuppliesUsing currentSupplyUsing; | |||||
| int currentIndex; | |||||
| void init(List<SuppliesUsing> initItems) { | |||||
| currentItems = initItems; | |||||
| currentSupplyUsing = SuppliesUsing(); | |||||
| currentIndex = -1; | |||||
| update(); | |||||
| } | |||||
| void changeIndexEdit(int index) { | |||||
| currentIndex = index; | |||||
| update(); | |||||
| } | |||||
| void changeInitList(List<SuppliesUsing> sups) { | |||||
| currentItems = sups; | |||||
| update(); | |||||
| } | |||||
| void addSupply(SuppliesUsing supplyUsing) { | |||||
| currentItems.insert(0, supplyUsing); | |||||
| currentSupplyUsing = SuppliesUsing(); | |||||
| update(); | |||||
| } | |||||
| void deleteSupply(int index) { | |||||
| currentItems.removeAt(index); | |||||
| currentSupplyUsing = SuppliesUsing(); | |||||
| update(); | |||||
| } | |||||
| void editSupply(int index, SuppliesUsing supplyUsing) { | |||||
| currentItems[index] = supplyUsing; | |||||
| currentSupplyUsing = SuppliesUsing(); | |||||
| update(); | |||||
| } | |||||
| } |
| import 'package:dio/dio.dart'; | import 'package:dio/dio.dart'; | ||||
| import 'package:farm_tpf/data/repository/user_repository.dart'; | import 'package:farm_tpf/data/repository/user_repository.dart'; | ||||
| import 'package:farm_tpf/main.dart'; | import 'package:farm_tpf/main.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/plant/sc_plant.dart'; | |||||
| import 'package:farm_tpf/presentation/screens/plot/sc_plot.dart'; | import 'package:farm_tpf/presentation/screens/plot/sc_plot.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/plot_detail/sc_plot_detail.dart'; | import 'package:farm_tpf/presentation/screens/plot_detail/sc_plot_detail.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/resources/sc_resource_helper.dart'; | import 'package:farm_tpf/presentation/screens/resources/sc_resource_helper.dart'; | ||||
| mainAxisSize: MainAxisSize.min, | mainAxisSize: MainAxisSize.min, | ||||
| children: <Widget>[ | children: <Widget>[ | ||||
| Text("logged in."), | Text("logged in."), | ||||
| MaterialButton( | |||||
| child: Text("Plant action"), | |||||
| onPressed: () { | |||||
| Navigator.of(context).push( | |||||
| MaterialPageRoute(builder: (_) => ActionPlantScreen())); | |||||
| }), | |||||
| MaterialButton( | MaterialButton( | ||||
| child: Text("Chi tiết lô"), | child: Text("Chi tiết lô"), | ||||
| onPressed: () { | onPressed: () { |
| EditActionEnvironmentUpdate( | EditActionEnvironmentUpdate( | ||||
| cropId: widget.cropId, | cropId: widget.cropId, | ||||
| ))); | ))); | ||||
| actions.add(ActionType(plot_action_dung, null, EditActionDungScreen())); | |||||
| actions.add(ActionType( | |||||
| plot_action_dung, | |||||
| null, | |||||
| EditActionDungScreen( | |||||
| cropId: widget.cropId, | |||||
| ))); | |||||
| actions.add( | actions.add( | ||||
| ActionType(plot_action_spraying, null, EditActionSprayingScreen())); | ActionType(plot_action_spraying, null, EditActionSprayingScreen())); | ||||
| actions.add(ActionType( | actions.add(ActionType( | ||||
| activityId: item.id, | activityId: item.id, | ||||
| isEdit: true, | isEdit: true, | ||||
| )); | )); | ||||
| } else if (item.activityTypeName == "ACTIVE_TYPE_MANURING") { | |||||
| Get.to(EditActionDungScreen( | |||||
| cropId: item.cropId, | |||||
| activityId: item.id, | |||||
| isEdit: true, | |||||
| )); | |||||
| } else { | } else { | ||||
| //TODO: Check other types | //TODO: Check other types | ||||
| Get.to(EditActionOtherScreen( | Get.to(EditActionOtherScreen( |
| static const String apiDetailEnd = "api/activity-end"; | static const String apiDetailEnd = "api/activity-end"; | ||||
| static const String apiDetailOther = "api/activity-other"; | static const String apiDetailOther = "api/activity-other"; | ||||
| static const String apiDetailPlant = "api/activity-planting"; | static const String apiDetailPlant = "api/activity-planting"; | ||||
| static const String apiDetailDung = "api/activity-manuring"; | |||||
| //nursery | //nursery | ||||
| static const String paramsActionNursery = "activityNursery"; | static const String paramsActionNursery = "activityNursery"; | ||||
| static const String paramsActionPlant = "activityPlanting"; | static const String paramsActionPlant = "activityPlanting"; | ||||
| static const String apiUpdatePlant = "api/updatePlanting"; | static const String apiUpdatePlant = "api/updatePlanting"; | ||||
| static const String apiAddPlant = "api/createPlanting"; | static const String apiAddPlant = "api/createPlanting"; | ||||
| //Dung | |||||
| static const String paramsActionDung = "activityManuring"; | |||||
| static const String apiUpdateDung = "api/updateManuring"; | |||||
| static const String apiAddDung = "api/createManuring"; | |||||
| static const String supplyTypeSeed = "GIONG"; | static const String supplyTypeSeed = "GIONG"; | ||||
| static const String supplyTypeDung = "PHANBON"; | static const String supplyTypeDung = "PHANBON"; |