|
|
|
|
@ -6,6 +6,7 @@ import 'package:test_sa/extensions/int_extensions.dart';
|
|
|
|
|
import 'package:test_sa/extensions/string_extensions.dart';
|
|
|
|
|
import 'package:test_sa/extensions/text_extensions.dart';
|
|
|
|
|
import 'package:test_sa/extensions/widget_extensions.dart';
|
|
|
|
|
import 'package:test_sa/helper/utils.dart';
|
|
|
|
|
import 'package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart';
|
|
|
|
|
import 'package:test_sa/modules/loan_module/models/loan_attachment_model.dart';
|
|
|
|
|
import 'package:test_sa/modules/loan_module/pages/installation_form_view.dart';
|
|
|
|
|
@ -13,6 +14,7 @@ import 'package:test_sa/modules/loan_module/pages/pullout_detail_page.dart';
|
|
|
|
|
import 'package:test_sa/modules/loan_module/provider/loan_provider.dart';
|
|
|
|
|
import 'package:test_sa/new_views/app_style/app_color.dart';
|
|
|
|
|
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
|
|
|
|
|
import 'package:test_sa/new_views/common_widgets/app_text_form_field.dart';
|
|
|
|
|
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/images/files_list.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/loaders/no_data_found.dart';
|
|
|
|
|
@ -105,11 +107,59 @@ class _LoanEquipmentDetailPageState extends State<LoanEquipmentDetailPage> {
|
|
|
|
|
],
|
|
|
|
|
).expanded,
|
|
|
|
|
// @todo ask backend to add loanTypeValue, so we can show or hide the buttons
|
|
|
|
|
if (snapshot.data?.loanTypeName == "Standard" && context.userProvider.isEngineer && (snapshot.data?.loanStatusValue == 5 || snapshot.data?.loanStatusValue == 8))
|
|
|
|
|
if (snapshot.data?.loanTypeName == "Standard" &&
|
|
|
|
|
context.userProvider.isEngineer &&
|
|
|
|
|
(snapshot.data?.loanStatusValue == 4 || snapshot.data?.loanStatusValue == 5 || snapshot.data?.loanStatusValue == 8))
|
|
|
|
|
FooterActionButton.footerContainer(
|
|
|
|
|
context: context,
|
|
|
|
|
child: AppFilledButton(
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
if (snapshot.data?.loanStatusValue == 4) {
|
|
|
|
|
String comment = "";
|
|
|
|
|
context.showBottomSheet(
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
'Estimated Date: ${snapshot.data?.installationEDD?.toAssetDetailsFormat ?? "-"}'.bodyText(context),
|
|
|
|
|
16.height,
|
|
|
|
|
AppTextFormField(
|
|
|
|
|
labelText: context.translation.comments,
|
|
|
|
|
showSpeechToText: true,
|
|
|
|
|
textInputType: TextInputType.multiline,
|
|
|
|
|
labelStyle: AppTextStyles.textFieldLabelStyle,
|
|
|
|
|
showWithoutDecoration: true,
|
|
|
|
|
backgroundColor: context.isDarkNotListen ? AppColor.neutral20 : AppColor.neutral100,
|
|
|
|
|
alignLabelWithHint: true,
|
|
|
|
|
onChange: (text) {
|
|
|
|
|
comment = text;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
16.height,
|
|
|
|
|
AppFilledButton(
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
Utils.showLoading(context);
|
|
|
|
|
LoanProvider loanProvider = Provider.of<LoanProvider>(context, listen: false);
|
|
|
|
|
bool isSuccess = await loanProvider.loanWorkflowAction({
|
|
|
|
|
"userId": context.userProvider.user!.userID,
|
|
|
|
|
"isFromMobile": true,
|
|
|
|
|
"commentsFromMobile": comment,
|
|
|
|
|
'loanId': snapshot.data?.id,
|
|
|
|
|
'loanStatusId': snapshot.data?.loanStatusValue,
|
|
|
|
|
});
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
if (isSuccess) {
|
|
|
|
|
Navigator.pop(context, true);
|
|
|
|
|
setState(() {});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
label: "Delivered"),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
title: "EDD & Comments",
|
|
|
|
|
showCancelButton: true);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (snapshot.data?.loanStatusValue == 5) {
|
|
|
|
|
bool isSuccess = await Navigator.push(context, MaterialPageRoute(builder: (context) => InstallationFormView(loanData: snapshot.data))) ?? false;
|
|
|
|
|
if (isSuccess) {
|
|
|
|
|
@ -122,7 +172,11 @@ class _LoanEquipmentDetailPageState extends State<LoanEquipmentDetailPage> {
|
|
|
|
|
setState(() {});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
label: snapshot.data?.loanStatusValue == 5 ? 'Installation Report' : 'PullOut Report',
|
|
|
|
|
label: snapshot.data?.loanStatusValue == 4
|
|
|
|
|
? "Delivered"
|
|
|
|
|
: snapshot.data?.loanStatusValue == 5
|
|
|
|
|
? 'Installation Report'
|
|
|
|
|
: 'PullOut Report',
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
|