| @@ -32,7 +32,7 @@ if (keystorePropertiesFile.exists()) { | |||
| } | |||
| android { | |||
| compileSdkVersion 33 | |||
| compileSdkVersion 34 | |||
| ndkVersion "21.1.6352462" | |||
| sourceSets { | |||
| @@ -47,7 +47,7 @@ android { | |||
| // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). | |||
| applicationId "vn.azteam.farmdemo" | |||
| minSdkVersion 24 | |||
| targetSdkVersion 33 | |||
| targetSdkVersion 34 | |||
| versionCode flutterVersionCode.toInteger() | |||
| versionName flutterVersionName | |||
| } | |||
| @@ -370,7 +370,7 @@ | |||
| CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; | |||
| CODE_SIGN_IDENTITY = "Apple Development"; | |||
| CODE_SIGN_STYLE = Automatic; | |||
| CURRENT_PROJECT_VERSION = 25; | |||
| CURRENT_PROJECT_VERSION = 26; | |||
| DEVELOPMENT_TEAM = C3DTD2JH94; | |||
| ENABLE_BITCODE = NO; | |||
| FRAMEWORK_SEARCH_PATHS = ( | |||
| @@ -512,7 +512,7 @@ | |||
| CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; | |||
| CODE_SIGN_IDENTITY = "Apple Development"; | |||
| CODE_SIGN_STYLE = Automatic; | |||
| CURRENT_PROJECT_VERSION = 25; | |||
| CURRENT_PROJECT_VERSION = 26; | |||
| DEVELOPMENT_TEAM = C3DTD2JH94; | |||
| ENABLE_BITCODE = NO; | |||
| FRAMEWORK_SEARCH_PATHS = ( | |||
| @@ -548,7 +548,7 @@ | |||
| CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; | |||
| CODE_SIGN_IDENTITY = "Apple Development"; | |||
| CODE_SIGN_STYLE = Automatic; | |||
| CURRENT_PROJECT_VERSION = 25; | |||
| CURRENT_PROJECT_VERSION = 26; | |||
| DEVELOPMENT_TEAM = C3DTD2JH94; | |||
| ENABLE_BITCODE = NO; | |||
| FRAMEWORK_SEARCH_PATHS = ( | |||
| @@ -101,30 +101,30 @@ class _CreateTaskPageState extends State<CreateTaskPage> { | |||
| child: Column( | |||
| crossAxisAlignment: CrossAxisAlignment.start, | |||
| children: [ | |||
| ItemColumnWidget( | |||
| title: 'Giao việc cho', | |||
| child: ValueListenableBuilder<String>( | |||
| valueListenable: bloc.selectedPEmployee, | |||
| builder: (context, selected, _) { | |||
| return ValueListenableBuilder<List<ItemDropDown>>( | |||
| valueListenable: bloc.employees, | |||
| builder: (context, employees, _) { | |||
| return DropdownBottomSheet( | |||
| dataSources: employees, | |||
| initValue: selected, | |||
| onSelected: (val) { | |||
| bloc.selectedPEmployee.value = val.key ?? ''; | |||
| }, | |||
| hint: 'Giao việc cho', | |||
| ); | |||
| }, | |||
| ); | |||
| }, | |||
| ), | |||
| ), | |||
| const SizedBox( | |||
| height: 8, | |||
| ), | |||
| // ItemColumnWidget( | |||
| // title: 'Giao việc cho', | |||
| // child: ValueListenableBuilder<String>( | |||
| // valueListenable: bloc.selectedPEmployee, | |||
| // builder: (context, selected, _) { | |||
| // return ValueListenableBuilder<List<ItemDropDown>>( | |||
| // valueListenable: bloc.employees, | |||
| // builder: (context, employees, _) { | |||
| // return DropdownBottomSheet( | |||
| // dataSources: employees, | |||
| // initValue: selected, | |||
| // onSelected: (val) { | |||
| // bloc.selectedPEmployee.value = val.key ?? ''; | |||
| // }, | |||
| // hint: 'Giao việc cho', | |||
| // ); | |||
| // }, | |||
| // ); | |||
| // }, | |||
| // ), | |||
| // ), | |||
| // const SizedBox( | |||
| // height: 8, | |||
| // ), | |||
| ItemColumnWidget( | |||
| title: 'Tiêu đề', | |||
| child: TextFieldNormal( | |||
| @@ -22,9 +22,9 @@ class CreateTaskCubit extends Cubit<CreateTaskState> { | |||
| final detailCtl = TextEditingController(); | |||
| var deadline = ValueNotifier(DateTime.now()); | |||
| var employeeRaws = <Employee>[]; | |||
| var employees = ValueNotifier(<ItemDropDown>[]); | |||
| var selectedPEmployee = ValueNotifier(''); | |||
| // var employeeRaws = <Employee>[]; | |||
| // var employees = ValueNotifier(<ItemDropDown>[]); | |||
| // var selectedPEmployee = ValueNotifier(''); | |||
| // var existedCreateTask = UpdateCreateTask(); | |||
| void dispose() { | |||
| @@ -33,28 +33,29 @@ class CreateTaskCubit extends Cubit<CreateTaskState> { | |||
| } | |||
| Future<void> preparedData({required int cropId}) async { | |||
| try { | |||
| await Future.delayed(const Duration(seconds: 0)); | |||
| emit(CreateTaskLoading()); | |||
| // try { | |||
| // await Future.delayed(const Duration(seconds: 0)); | |||
| // emit(CreateTaskLoading()); | |||
| employeeRaws = await repository.getEmployees(); | |||
| employees.value = employeeRaws | |||
| .map( | |||
| (e) => ItemDropDown(key: e.id?.toString(), value: e.name), | |||
| ) | |||
| .toList(); | |||
| emit(CreateTaskPrepareDataSuccessful()); | |||
| } catch (e) { | |||
| emit(CreateTaskFailure(AppException.handleError(e))); | |||
| } | |||
| // employeeRaws = await repository.getEmployees(); | |||
| // employees.value = employeeRaws | |||
| // .map( | |||
| // (e) => ItemDropDown(key: e.id?.toString(), value: e.name), | |||
| // ) | |||
| // .toList(); | |||
| // emit(CreateTaskPrepareDataSuccessful()); | |||
| // } catch (e) { | |||
| // emit(CreateTaskFailure(AppException.handleError(e))); | |||
| // } | |||
| } | |||
| Future<void> onSubmit(int cropId) async { | |||
| if (formKey.currentState!.validate()) { | |||
| if (selectedPEmployee.value.isEmpty) { | |||
| Utils.showSnackBarWarning(message: 'Vui lòng chọn nhân viên'); | |||
| return; | |||
| } else if (titleNameCtl.text.trim().isEmpty) { | |||
| // if (selectedPEmployee.value.isEmpty) { | |||
| // Utils.showSnackBarWarning(message: 'Vui lòng chọn nhân viên'); | |||
| // return; | |||
| // } | |||
| if (titleNameCtl.text.trim().isEmpty) { | |||
| Utils.showSnackBarWarning(message: 'Vui lòng nhập tiêu đề'); | |||
| return; | |||
| } else if (detailCtl.text.trim().isEmpty) { | |||
| @@ -66,7 +67,7 @@ class CreateTaskCubit extends Cubit<CreateTaskState> { | |||
| ..cropId = cropId | |||
| ..title = titleNameCtl.text | |||
| ..detail = detailCtl.text | |||
| ..userAssignedId = int.tryParse(selectedPEmployee.value) | |||
| // ..userAssignedId = int.tryParse(selectedPEmployee.value) | |||
| ..deadline = deadline.value.convertLocalDateTimeToStringUtcDateTime(); | |||
| print(requestTask.toJson()); | |||
| UtilWidget.showLoading(); | |||
| @@ -2,14 +2,14 @@ class RequestTask { | |||
| String? title; | |||
| String? detail; | |||
| String? deadline; | |||
| int? userAssignedId; | |||
| // int? userAssignedId; | |||
| int? cropId; | |||
| RequestTask({ | |||
| this.title, | |||
| this.detail, | |||
| this.deadline, | |||
| this.userAssignedId, | |||
| // this.userAssignedId, | |||
| this.cropId, | |||
| }); | |||
| @@ -17,7 +17,7 @@ class RequestTask { | |||
| title = json['title']; | |||
| detail = json['detail']; | |||
| deadline = json['deadline']; | |||
| userAssignedId = json['user_assigned_id']; | |||
| // userAssignedId = json['user_assigned_id']; | |||
| cropId = json['crop_id']; | |||
| } | |||
| @@ -26,7 +26,7 @@ class RequestTask { | |||
| data['title'] = this.title; | |||
| data['detail'] = this.detail; | |||
| data['deadline'] = this.deadline; | |||
| data['user_assigned_id'] = this.userAssignedId; | |||
| // data['user_assigned_id'] = this.userAssignedId; | |||
| data['crop_id'] = this.cropId; | |||
| return data; | |||
| } | |||
| @@ -2,7 +2,7 @@ name: farm_tpf | |||
| description: A new Flutter project. | |||
| publish_to: 'none' | |||
| version: 1.1.8+25 | |||
| version: 1.1.9+27 | |||
| environment: | |||
| sdk: ">=3.0.0 <4.0.0" | |||