|
|
|
|
@ -58,40 +58,43 @@ class _ProviderLicensePageState extends State<ProviderLicensePage> {
|
|
|
|
|
child: CircularProgressIndicator(),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: SingleChildScrollView(child: buildContent(serviceVM)),
|
|
|
|
|
),
|
|
|
|
|
if (!serviceVM.isAllDocsApproved) ...[
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(12.0),
|
|
|
|
|
child: ShowFillButton(
|
|
|
|
|
title: LocaleKeys.continu.tr(),
|
|
|
|
|
maxWidth: double.infinity,
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
bool status = false;
|
|
|
|
|
if (AppState().getUser.data!.userInfo!.roleId == 5) {
|
|
|
|
|
if (validateDocuments(serviceVM)) {
|
|
|
|
|
status = await updateDocument(serviceVM);
|
|
|
|
|
return GestureDetector(
|
|
|
|
|
onTap: () => FocusScope.of(context).focusedChild?.unfocus(),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: SingleChildScrollView(child: buildContent(serviceVM)),
|
|
|
|
|
),
|
|
|
|
|
if (isAllowContinue(serviceVM)) ...[
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(12.0),
|
|
|
|
|
child: ShowFillButton(
|
|
|
|
|
title: LocaleKeys.continu.tr(),
|
|
|
|
|
maxWidth: double.infinity,
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
bool status = false;
|
|
|
|
|
if (AppState().getUser.data!.userInfo!.roleId == 5) {
|
|
|
|
|
if (validateDocuments(serviceVM)) {
|
|
|
|
|
status = await updateDocument(serviceVM);
|
|
|
|
|
} else {
|
|
|
|
|
Utils.showToast(LocaleKeys.allDocumentMandatoryDealershipProvider.tr());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
Utils.showToast(LocaleKeys.allDocumentMandatoryDealershipProvider.tr());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
status = await updateDocument(serviceVM);
|
|
|
|
|
}
|
|
|
|
|
Future.delayed(const Duration(seconds: 1), () {
|
|
|
|
|
if (status) {
|
|
|
|
|
pop(context);
|
|
|
|
|
status = await updateDocument(serviceVM);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
Future.delayed(const Duration(seconds: 1), () {
|
|
|
|
|
if (status != null && status) {
|
|
|
|
|
pop(context);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
@ -108,6 +111,19 @@ class _ProviderLicensePageState extends State<ProviderLicensePage> {
|
|
|
|
|
return valid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool isAllowContinue(ServiceVM model) {
|
|
|
|
|
bool isShow = false;
|
|
|
|
|
if (model.document != null && model.document!.data != null && model.document!.data!.isNotEmpty) {
|
|
|
|
|
for (var doc in model.document!.data!) {
|
|
|
|
|
print("doc: ${doc.status}");
|
|
|
|
|
if (doc.status == 4 || doc.status == 0) {
|
|
|
|
|
isShow = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return isShow;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<bool> updateDocument(ServiceVM model) async {
|
|
|
|
|
try {
|
|
|
|
|
Utils.showLoading(context);
|
|
|
|
|
@ -115,7 +131,7 @@ class _ProviderLicensePageState extends State<ProviderLicensePage> {
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
if (res.messageStatus == 1) {
|
|
|
|
|
Utils.showToast(LocaleKeys.documentsUploadedSuccessfully.tr());
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
Utils.showToast(res.message ?? "");
|
|
|
|
|
@ -130,77 +146,77 @@ class _ProviderLicensePageState extends State<ProviderLicensePage> {
|
|
|
|
|
return serviceVM.document!.data!.isEmpty
|
|
|
|
|
? Text(LocaleKeys.somethingWrong.tr())
|
|
|
|
|
: ListView.separated(
|
|
|
|
|
separatorBuilder: (context, index) {
|
|
|
|
|
return 20.height;
|
|
|
|
|
},
|
|
|
|
|
itemCount: serviceVM.document!.data!.length,
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
DocumentData? document = serviceVM.document?.data![index];
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
10.height,
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
(document!.documentName!).toText(fontSize: 16, letterSpacing: -0.56, fontWeight: MyFonts.SemiBold),
|
|
|
|
|
if (document.statusText != null && document.statusText!.isNotEmpty) ...[
|
|
|
|
|
10.width,
|
|
|
|
|
Utils.statusContainerChip(text: document.statusText!.replaceFirst('OrActive', ''), chipColor: getColorByStatus(document.status ?? 1)),
|
|
|
|
|
separatorBuilder: (context, index) {
|
|
|
|
|
return 20.height;
|
|
|
|
|
},
|
|
|
|
|
itemCount: serviceVM.document!.data!.length,
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
DocumentData? document = serviceVM.document?.data![index];
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
10.height,
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
(document!.documentName!).toText(fontSize: 16, letterSpacing: -0.56, fontWeight: MyFonts.SemiBold),
|
|
|
|
|
if (document.statusText != null && document.statusText!.isNotEmpty) ...[
|
|
|
|
|
10.width,
|
|
|
|
|
Utils.statusContainerChip(text: document.statusText!.replaceFirst('OrActive', ''), chipColor: getColorByStatus(document.status ?? 1)),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
if (document.status != 1 && document.status != 3) ...[
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(top: 4, bottom: 8),
|
|
|
|
|
child: LocaleKeys.enter_licence_detail.tr().toText(fontSize: 14, color: MyColors.lightTextColor),
|
|
|
|
|
),
|
|
|
|
|
// TxtField(
|
|
|
|
|
// hint: LocaleKeys.description.tr(),
|
|
|
|
|
// maxLines: 3,
|
|
|
|
|
// isBackgroundEnabled: true,
|
|
|
|
|
// value: document.description != null ? document.description : "",
|
|
|
|
|
// onChanged: (val) {
|
|
|
|
|
// document.description = val;
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
],
|
|
|
|
|
10.height,
|
|
|
|
|
if (isNeedToShow(model: serviceVM, document: document)) ...[
|
|
|
|
|
PickedFilesContainer(
|
|
|
|
|
//|| document.status == 3 || document.status != 4
|
|
|
|
|
isReview: document.status != 0 && document.status == 1 || document.status == 3,
|
|
|
|
|
allowAdButton: false,
|
|
|
|
|
pickedFiles: isLocalOrNetworkFiles(model: serviceVM, document: document),
|
|
|
|
|
onCrossPressedPrimary: isNetworkImage(document: document)
|
|
|
|
|
? serviceVM.removeNetworkImage
|
|
|
|
|
: document.documentId == 1
|
|
|
|
|
? serviceVM.commerceRemove
|
|
|
|
|
: document.documentId == 2
|
|
|
|
|
? serviceVM.commercialRemove
|
|
|
|
|
: serviceVM.vatRemove,
|
|
|
|
|
isPdf: true,
|
|
|
|
|
isFromNetwork: !(document.isLocalFile ?? false),
|
|
|
|
|
onAddFilePressed: () {
|
|
|
|
|
serviceVM.pickPdfReceiptFile(context, document.documentId!, index);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
buildCommentContainer(document: document),
|
|
|
|
|
] else ...[
|
|
|
|
|
10.height,
|
|
|
|
|
DottedRectContainer(
|
|
|
|
|
onTap: () => serviceVM.pickPdfReceiptFile(context, document.documentId!, index) ?? "",
|
|
|
|
|
text: LocaleKeys.attachPDF.tr(),
|
|
|
|
|
icon: MyAssets.attachmentIcon.buildSvg(),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
if (document.status != 1 && document.status != 3) ...[
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(top: 4, bottom: 8),
|
|
|
|
|
child: LocaleKeys.enter_licence_detail.tr().toText(fontSize: 14, color: MyColors.lightTextColor),
|
|
|
|
|
),
|
|
|
|
|
TxtField(
|
|
|
|
|
hint: LocaleKeys.description.tr(),
|
|
|
|
|
maxLines: 3,
|
|
|
|
|
isBackgroundEnabled: true,
|
|
|
|
|
value: document.description != null ? document.description : "",
|
|
|
|
|
onChanged: (val) {
|
|
|
|
|
document.description = val;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
10.height,
|
|
|
|
|
if (isNeedToShow(model: serviceVM, document: document)) ...[
|
|
|
|
|
PickedFilesContainer(
|
|
|
|
|
isReview: document.status == 4,
|
|
|
|
|
allowAdButton: false,
|
|
|
|
|
pickedFiles: isLocalOrNetworkFiles(model: serviceVM, document: document),
|
|
|
|
|
onCrossPressedPrimary: isNetworkImage(document: document)
|
|
|
|
|
? serviceVM.removeNetworkImage
|
|
|
|
|
: document.documentId == 1
|
|
|
|
|
? serviceVM.commerceRemove
|
|
|
|
|
: document.documentId == 2
|
|
|
|
|
? serviceVM.commercialRemove
|
|
|
|
|
: serviceVM.vatRemove,
|
|
|
|
|
isPdf: serviceVM.document!.data![index].fileExt == "pdf",
|
|
|
|
|
isFromNetwork: !(document.isLocalFile ?? false),
|
|
|
|
|
onAddFilePressed: () {
|
|
|
|
|
serviceVM.pickPdfReceiptFile(context, document.documentId!, index);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
buildCommentContainer(document: document),
|
|
|
|
|
] else
|
|
|
|
|
...[
|
|
|
|
|
10.height,
|
|
|
|
|
DottedRectContainer(
|
|
|
|
|
onTap: () => serviceVM.pickPdfReceiptFile(context, document.documentId!, index) ?? "",
|
|
|
|
|
text: LocaleKeys.attachImage.tr(),
|
|
|
|
|
icon: MyAssets.attachmentIcon.buildSvg(),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<ImageModel> isLocalOrNetworkFiles({required ServiceVM model, required DocumentData document}) {
|
|
|
|
|
|