|
|
|
@ -60,84 +60,82 @@ class _AssetRetiredState extends State<AssetRetired> with TickerProviderStateMix
|
|
|
|
key: _scaffoldKey,
|
|
|
|
key: _scaffoldKey,
|
|
|
|
appBar: DefaultAppBar(title: context.translation.assetToBeRetired),
|
|
|
|
appBar: DefaultAppBar(title: context.translation.assetToBeRetired),
|
|
|
|
body: Consumer<ServiceRequestDetailProvider>(builder: (context, ServiceRequestDetailProvider requestDetailProvider, child) {
|
|
|
|
body: Consumer<ServiceRequestDetailProvider>(builder: (context, ServiceRequestDetailProvider requestDetailProvider, child) {
|
|
|
|
return SafeArea(
|
|
|
|
return LoadingManager(
|
|
|
|
child: LoadingManager(
|
|
|
|
isLoading: _isLoading,
|
|
|
|
isLoading: _isLoading,
|
|
|
|
isFailedLoading: false,
|
|
|
|
isFailedLoading: false,
|
|
|
|
stateCode: 200,
|
|
|
|
stateCode: 200,
|
|
|
|
onRefresh: () async {},
|
|
|
|
onRefresh: () async {},
|
|
|
|
child: Form(
|
|
|
|
child: Form(
|
|
|
|
key: _formKey,
|
|
|
|
key: _formKey,
|
|
|
|
child: Column(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
SingleChildScrollView(
|
|
|
|
SingleChildScrollView(
|
|
|
|
child: Card(
|
|
|
|
child: Card(
|
|
|
|
child: Column(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
SingleItemDropDownMenu<Lookup, RetirementTypeProvider>(
|
|
|
|
SingleItemDropDownMenu<Lookup, RetirementTypeProvider>(
|
|
|
|
context: context,
|
|
|
|
context: context,
|
|
|
|
title: context.translation.retirementType,
|
|
|
|
title: context.translation.retirementType,
|
|
|
|
backgroundColor: AppColor.fieldBgColor(context),
|
|
|
|
backgroundColor: AppColor.fieldBgColor(context),
|
|
|
|
showAsBottomSheet: true,
|
|
|
|
showAsBottomSheet: true,
|
|
|
|
height: 56.toScreenHeight,
|
|
|
|
height: 56.toScreenHeight,
|
|
|
|
showShadow: false,
|
|
|
|
showShadow: false,
|
|
|
|
initialValue: requestDetailProvider.assetRetiredHelperModel?.retirmentReason,
|
|
|
|
initialValue: requestDetailProvider.assetRetiredHelperModel?.retirmentReason,
|
|
|
|
onSelect: (value) {
|
|
|
|
onSelect: (value) {
|
|
|
|
if (value != null) {
|
|
|
|
if (value != null) {
|
|
|
|
requestDetailProvider.assetRetiredHelperModel?.retirmentReason = value;
|
|
|
|
requestDetailProvider.assetRetiredHelperModel?.retirmentReason = value;
|
|
|
|
setState(() {});
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
8.height,
|
|
|
|
8.height,
|
|
|
|
AppTextFormField(
|
|
|
|
AppTextFormField(
|
|
|
|
labelText: context.translation.comments,
|
|
|
|
labelText: context.translation.comments,
|
|
|
|
textInputType: TextInputType.multiline,
|
|
|
|
textInputType: TextInputType.multiline,
|
|
|
|
showWithoutDecoration: true,
|
|
|
|
showWithoutDecoration: true,
|
|
|
|
labelStyle: AppTextStyles.textFieldLabelStyle,
|
|
|
|
labelStyle: AppTextStyles.textFieldLabelStyle,
|
|
|
|
backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral100,
|
|
|
|
backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral100,
|
|
|
|
alignLabelWithHint: true,
|
|
|
|
alignLabelWithHint: true,
|
|
|
|
onChange: (text) {
|
|
|
|
onChange: (text) {
|
|
|
|
requestDetailProvider.assetRetiredHelperModel?.retirementComment = text;
|
|
|
|
requestDetailProvider.assetRetiredHelperModel?.retirementComment = text;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
onSaved: (text) {
|
|
|
|
onSaved: (text) {
|
|
|
|
requestDetailProvider.assetRetiredHelperModel?.retirementComment = text;
|
|
|
|
requestDetailProvider.assetRetiredHelperModel?.retirementComment = text;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
23.height,
|
|
|
|
23.height,
|
|
|
|
AttachmentPicker(
|
|
|
|
AttachmentPicker(
|
|
|
|
label: context.translation.attachFiles,
|
|
|
|
label: context.translation.attachFiles,
|
|
|
|
attachment: attachments,
|
|
|
|
attachment: attachments,
|
|
|
|
buttonIcon: 'image-plus'.toSvgAsset(),
|
|
|
|
buttonIcon: 'image-plus'.toSvgAsset(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
).paddingOnly(start: 13, end: 13, top: 14, bottom: 16),
|
|
|
|
).paddingOnly(start: 13, end: 13, top: 14, bottom: 16),
|
|
|
|
).paddingAll(16),
|
|
|
|
).paddingAll(16),
|
|
|
|
).expanded,
|
|
|
|
).expanded,
|
|
|
|
FooterActionButton.footerContainer(
|
|
|
|
FooterActionButton.footerContainer(
|
|
|
|
context: context,
|
|
|
|
context: context,
|
|
|
|
child: AppFilledButton(
|
|
|
|
child: AppFilledButton(
|
|
|
|
label: context.translation.submit,
|
|
|
|
label: context.translation.submit,
|
|
|
|
buttonColor: AppColor.primary10,
|
|
|
|
buttonColor: AppColor.primary10,
|
|
|
|
loading: requestDetailProvider.isLoading,
|
|
|
|
loading: requestDetailProvider.isLoading,
|
|
|
|
onPressed: () async {
|
|
|
|
onPressed: () async {
|
|
|
|
requestDetailProvider.assetRetiredHelperModel?.activityAssetToBeRetiredAttachments = [];
|
|
|
|
requestDetailProvider.assetRetiredHelperModel?.activityAssetToBeRetiredAttachments = [];
|
|
|
|
for (var attachment in attachments) {
|
|
|
|
for (var attachment in attachments) {
|
|
|
|
String fileName = ServiceRequestUtils.isLocalUrl(attachment.name??'') ? ("${attachment.name??''.split("/").last}|${base64Encode(File(attachment.name??'').readAsBytesSync())}") :attachment.name??'';
|
|
|
|
String fileName = ServiceRequestUtils.isLocalUrl(attachment.name??'') ? ("${attachment.name??''.split("/").last}|${base64Encode(File(attachment.name??'').readAsBytesSync())}") :attachment.name??'';
|
|
|
|
requestDetailProvider.assetRetiredHelperModel?.activityAssetToBeRetiredAttachments
|
|
|
|
requestDetailProvider.assetRetiredHelperModel?.activityAssetToBeRetiredAttachments
|
|
|
|
?.add(ActivityAssetToBeRetiredAttachments(id: attachment.id, name: fileName));
|
|
|
|
?.add(ActivityAssetToBeRetiredAttachments(id: attachment.id, name: fileName));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int status = await requestDetailProvider.createActivityAssetToBeRetired();
|
|
|
|
int status = await requestDetailProvider.createActivityAssetToBeRetired();
|
|
|
|
if (status == 200) {
|
|
|
|
if (status == 200) {
|
|
|
|
Navigator.pop(context);
|
|
|
|
Navigator.pop(context);
|
|
|
|
requestDetailProvider.stopTimer();
|
|
|
|
requestDetailProvider.stopTimer();
|
|
|
|
const SizedBox().flushBar(context: context, title: '', message: context.translation.assetRetirementRequestSubmittedSuccessfully);
|
|
|
|
const SizedBox().flushBar(context: context, title: '', message: context.translation.assetRetirementRequestSubmittedSuccessfully);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|