diff --git a/lib/models/new_models/task_request/task_request_model.dart b/lib/models/new_models/task_request/task_request_model.dart index b3892f3d..3bf67b21 100644 --- a/lib/models/new_models/task_request/task_request_model.dart +++ b/lib/models/new_models/task_request/task_request_model.dart @@ -2,11 +2,11 @@ import 'package:test_sa/models/base.dart'; import 'package:test_sa/models/lookup.dart'; import 'package:test_sa/models/new_models/assistant_employee.dart'; import 'package:test_sa/models/new_models/building.dart'; +import 'package:test_sa/models/new_models/department.dart'; import 'package:test_sa/models/new_models/floor.dart'; import 'package:test_sa/models/new_models/mapped_sites.dart'; -import 'package:test_sa/models/new_models/site.dart'; -import 'package:test_sa/models/new_models/department.dart'; import 'package:test_sa/models/new_models/room_model.dart'; +import 'package:test_sa/models/new_models/site.dart'; import 'package:test_sa/models/new_models/work_order_detail_model.dart'; import 'package:test_sa/models/timer_model.dart'; @@ -494,14 +494,14 @@ class TaskJobStatus { class TaskJobAttachment { final int? id; final String? name; - String ?createdBy; + String? createdBy; - TaskJobAttachment({this.id, this.name,this.createdBy}); + TaskJobAttachment({this.id, this.name, this.createdBy}); factory TaskJobAttachment.fromJson(Map json) => TaskJobAttachment( id: json['id'], name: json['name'], - createdBy: json['createdBy'], + createdBy: json['createdBy'], ); Map toJson() => { diff --git a/lib/modules/tm_module/tasks_wo/update_task_request_view.dart b/lib/modules/tm_module/tasks_wo/update_task_request_view.dart index 9ab50370..8a203b12 100644 --- a/lib/modules/tm_module/tasks_wo/update_task_request_view.dart +++ b/lib/modules/tm_module/tasks_wo/update_task_request_view.dart @@ -74,10 +74,9 @@ class _UpdateTaskRequestState extends State { UserProvider _userProvider = Provider.of(context, listen: false); TaskData? taskModel = _taskProvider!.taskRequestModel; - _userAttachments = _taskProvider?.taskRequestModel?.taskJobAttachments?.where((e) => e.createdBy == _userProvider.user?.userID).map((e) => File(e.name ?? '')).toList() ?? []; + _userAttachments = _taskProvider?.taskRequestModel?.taskJobAttachments?.where((e) => e.createdBy == _userProvider.user?.userID).map((e) => File(e.name ?? '')).toList() ?? []; _readOnlyAttachments = _taskProvider?.taskRequestModel?.taskJobAttachments?.where((e) => e.createdBy != _userProvider.user?.userID).toList() ?? []; - _taskProvider?.updateTaskModel(taskModel); } @@ -102,78 +101,78 @@ class _UpdateTaskRequestState extends State { ? const ALoading() : taskProvider.taskRequestModel != null ? Form( - key: _formKey, - child: Column( - children: [ - SingleChildScrollView( - padding: EdgeInsets.all(12 * AppStyle.getScaleFactor(context)), - child: Column( - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _timerWidget(context, true, taskProvider), - 8.height, - if (taskProvider.taskRequestModel?.taskType?.isInstallation == true) ...[installationWidget(taskModel: taskProvider.taskRequestModel!)], - if (taskProvider.taskRequestModel?.taskType?.isRecallAndAlert == true) ...[ - recallAlertTypeWidget(taskModel: taskProvider.taskRequestModel!), + key: _formKey, + child: Column( + children: [ + SingleChildScrollView( + padding: EdgeInsets.all(12 * AppStyle.getScaleFactor(context)), + child: Column( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _timerWidget(context, true, taskProvider), + 8.height, + if (taskProvider.taskRequestModel?.taskType?.isInstallation == true) ...[installationWidget(taskModel: taskProvider.taskRequestModel!)], + if (taskProvider.taskRequestModel?.taskType?.isRecallAndAlert == true) ...[ + recallAlertTypeWidget(taskModel: taskProvider.taskRequestModel!), + ], + // if (previousComments.isNotEmpty) ...[ + // 'Previous Comments'.bodyText2(context).custom(color: AppColor.neutral50), + // 8.height, + buildPreviousComments(taskProvider: taskProvider), + // 8.height, + // ], + AppTextFormField( + initialValue: "", + labelText: context.translation.technicalComment, + textInputType: TextInputType.multiline, + backgroundColor: AppColor.neutral90, + showShadow: false, + alignLabelWithHint: true, + onChange: (value) { + comments = value; + setState(() {}); + }, + onSaved: (value) {}, + ), + 20.height, + MultiFilesPicker( + label: context.translation.attachFiles, + files: _userAttachments, + buttonColor: AppColor.black10, + onlyImages: false, + buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120), + ), ], - // if (previousComments.isNotEmpty) ...[ - // 'Previous Comments'.bodyText2(context).custom(color: AppColor.neutral50), - // 8.height, - buildPreviousComments(taskProvider: taskProvider), - // 8.height, - // ], - AppTextFormField( - initialValue: "", - labelText: context.translation.technicalComment, - textInputType: TextInputType.multiline, - backgroundColor: AppColor.neutral90, - showShadow: false, - alignLabelWithHint: true, - onChange: (value) { - comments = value; - setState(() {}); - }, - onSaved: (value) {}, - ), - 20.height, - MultiFilesPicker( - label: context.translation.attachFiles, - files: _userAttachments, - buttonColor: AppColor.black10, - onlyImages: false, - buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120), - ), - ], - ).toShadowContainer(context), - 16.height, - const AssistantEmployeeCard().toShadowContainer(context, paddingObject: const EdgeInsets.symmetric(horizontal: 16)), - ], - ), - ).expanded, - FooterActionButton.footerContainer( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - AppFilledButton( - label: context.translation.save, - buttonColor: AppColor.white60, - textColor: AppColor.black10, - onPressed: () => _updateTask(context: context, status: 0), - ).expanded, - 12.width, - AppFilledButton( - label: context.translation.complete, - buttonColor: AppColor.primary10, - onPressed: () => _updateTask(context: context, status: 1), - ).expanded, - ], + ).toShadowContainer(context), + 16.height, + const AssistantEmployeeCard().toShadowContainer(context, paddingObject: const EdgeInsets.symmetric(horizontal: 16)), + ], + ), + ).expanded, + FooterActionButton.footerContainer( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + AppFilledButton( + label: context.translation.save, + buttonColor: AppColor.white60, + textColor: AppColor.black10, + onPressed: () => _updateTask(context: context, status: 0), + ).expanded, + 12.width, + AppFilledButton( + label: context.translation.complete, + buttonColor: AppColor.primary10, + onPressed: () => _updateTask(context: context, status: 1), + ).expanded, + ], + ), ), - ), - ], - ), - ) + ], + ), + ) : NoDataFound(message: context.translation.noDataFound).center, ).handlePopScope( cxt: context,