|
|
|
|
@ -74,10 +74,9 @@ class _UpdateTaskRequestState extends State<UpdateTaskRequest> {
|
|
|
|
|
UserProvider _userProvider = Provider.of<UserProvider>(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<UpdateTaskRequest> {
|
|
|
|
|
? 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,
|
|
|
|
|
|