diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 0e1df59..9556085 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -679,5 +679,6 @@ "inviteFriendsByWhatsApp": "دعوة الأصدقاء عبر واتساب", "inviteFriendsByEmail": "دعوة الأصدقاء عبر البريد الإلكتروني", "noFAQsToShow": "لا توجد أسئلة شائعة في الوقت الحالي. يرجى الاتصال بنا إذا كان لديك أي استفسار.", - "appInfo": "معلومات التطبيق" + "appInfo": "معلومات التطبيق", + "attachPDF": "إرفاق قوات الدفاع الشعبي" } \ No newline at end of file diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index a4cf2bd..f2508db 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -677,5 +677,6 @@ "inviteFriendsByWhatsApp": "Invite Friends By WhatsApp", "inviteFriendsByEmail": "Invite Friends By Email", "noFAQsToShow": "There are no Frequently asked Questions Right now. Please contact us if you have any query.", - "appInfo": "App Info" + "appInfo": "App Info", + "attachPDF": "Attach PDF" } \ No newline at end of file diff --git a/lib/config/dependency_injection.dart b/lib/config/dependency_injection.dart index 8a42acd..f79770c 100644 --- a/lib/config/dependency_injection.dart +++ b/lib/config/dependency_injection.dart @@ -18,6 +18,7 @@ import 'package:mc_common_app/repositories/user_repo.dart'; import 'package:mc_common_app/services/common_services.dart'; import 'package:mc_common_app/services/firebase_service.dart'; import 'package:mc_common_app/services/payments_service.dart'; +import 'package:mc_common_app/utils/location/Location.dart'; import '../repositories/request_repo.dart'; @@ -46,6 +47,7 @@ class AppDependencies { injector.registerSingleton(() => BranchRepoImp()); injector.registerSingleton(() => ShippingRepoImp()); injector.registerSingleton(() => SettingOptionsRepoImp()); + injector.registerSingleton(() => LocationService()); // } diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index 5e42c42..5317da0 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -695,7 +695,8 @@ class CodegenLoader extends AssetLoader{ "inviteFriendsByWhatsApp": "دعوة الأصدقاء عبر واتساب", "inviteFriendsByEmail": "دعوة الأصدقاء عبر البريد الإلكتروني", "noFAQsToShow": "لا توجد أسئلة شائعة في الوقت الحالي. يرجى الاتصال بنا إذا كان لديك أي استفسار.", - "appInfo": "معلومات التطبيق" + "appInfo": "معلومات التطبيق", + "attachPDF": "إرفاق قوات الدفاع الشعبي" }; static const Map en_US = { "firstTimeLogIn": "First Time Log In", @@ -1376,7 +1377,8 @@ static const Map en_US = { "inviteFriendsByWhatsApp": "Invite Friends By WhatsApp", "inviteFriendsByEmail": "Invite Friends By Email", "noFAQsToShow": "There are no Frequently asked Questions Right now. Please contact us if you have any query.", - "appInfo": "App Info" + "appInfo": "App Info", + "attachPDF": "Attach PDF" }; static const Map> mapLocales = {"ar_SA": ar_SA, "en_US": en_US}; } diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index 9734eae..92b01c9 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -659,5 +659,6 @@ abstract class LocaleKeys { static const inviteFriendsByEmail = 'inviteFriendsByEmail'; static const noFAQsToShow = 'noFAQsToShow'; static const appInfo = 'appInfo'; + static const attachPDF = 'attachPDF'; } diff --git a/lib/services/common_services.dart b/lib/services/common_services.dart index 53ffe31..b1788e5 100644 --- a/lib/services/common_services.dart +++ b/lib/services/common_services.dart @@ -6,6 +6,7 @@ import 'package:geolocator/geolocator.dart'; import 'package:image_picker/image_picker.dart'; import 'package:mc_common_app/main.dart'; import 'package:mc_common_app/utils/app_permission_handler.dart'; +import 'package:mc_common_app/utils/utils.dart'; abstract class CommonAppServices { Future> pickMultipleImages(); diff --git a/lib/services/payments_service.dart b/lib/services/payments_service.dart index 4f8901d..1a495f8 100644 --- a/lib/services/payments_service.dart +++ b/lib/services/payments_service.dart @@ -26,13 +26,29 @@ abstract class PaymentService { class PaymentServiceImp implements PaymentService { MyInAppBrowser? myInAppBrowser; - var inAppBrowserOptions = InAppBrowserClassOptions( - inAppWebViewGroupOptions: - InAppWebViewGroupOptions(crossPlatform: InAppWebViewOptions(useShouldOverrideUrlLoading: true, transparentBackground: false), ios: IOSInAppWebViewOptions(applePayAPIEnabled: true)), - crossPlatform: InAppBrowserOptions(hideUrlBar: true, toolbarTopBackgroundColor: Colors.black), - android: AndroidInAppBrowserOptions(), - ios: - IOSInAppBrowserOptions(hideToolbarBottom: true, toolbarBottomBackgroundColor: Colors.white, closeButtonColor: Colors.white, presentationStyle: IOSUIModalPresentationStyle.OVER_FULL_SCREEN)); + var inAppBrowserOptions = InAppBrowserClassSettings( + + webViewSettings: InAppWebViewSettings( + useShouldOverrideUrlLoading: false, + transparentBackground: false, + isInspectable: false, + applePayAPIEnabled: true, + cacheEnabled: false, + ), + browserSettings: InAppBrowserSettings( + hideUrlBar: true, + hideTitleBar: true, + hideDefaultMenuItems: true, + hideToolbarBottom: true, + hideToolbarTop: false, + hideCloseButton: false, + allowGoBackWithBackButton: true, + toolbarBottomBackgroundColor: Colors.black, + closeButtonColor: Colors.white, + presentationStyle: ModalPresentationStyle.FULL_SCREEN, + // toolbarTopBackgroundColor: Colors.black + ), + ); String getUrlRequestByPaymentId({required int id, List? appointmentIds, required PaymentTypes paymentType}) { String urlRequest = ""; @@ -89,8 +105,13 @@ class PaymentServiceImp implements PaymentService { onBrowserLoadStart(onFailure: onFailure, onSuccess: onSuccess, url: url); }); await myInAppBrowser!.openUrlRequest( - urlRequest: URLRequest(url: WebUri(urlRequest, forceToStringRawValue: true)), - options: inAppBrowserOptions, + urlRequest: URLRequest( + url: WebUri(urlRequest, forceToStringRawValue: true), + allowsCellularAccess: true, + allowsConstrainedNetworkAccess: true, + allowsExpensiveNetworkAccess: true, + ), + settings: inAppBrowserOptions, ); } diff --git a/lib/utils/location/Location.dart b/lib/utils/location/Location.dart index bdb67b4..0c6b6a7 100644 --- a/lib/utils/location/Location.dart +++ b/lib/utils/location/Location.dart @@ -7,17 +7,29 @@ import 'package:flutter/rendering.dart'; import 'package:geolocator/geolocator.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:mc_common_app/classes/app_state.dart'; import 'package:mc_common_app/utils/app_permission_handler.dart'; import 'package:mc_common_app/utils/utils.dart'; // import 'package:geodesy/geodesy.dart' as geodesy; -//Created By Mr.Zohaib -class Location { +abstract class Location { + void handleLocationPermission(); + + void havePermission(Function(bool) callback); + + void isEnabled(Function(bool) callback); + + void listenGPS({bool change = true, Function(bool)? onChange}); + + void getCurrentLocation(Function(LatLng?) callback); +} + +class LocationService implements Location { static _Map map = _Map(); - static void havePermission(Function(bool) callback) { + void havePermission(Function(bool) callback) { Geolocator.checkPermission().then((value) async { if (value == LocationPermission.denied) { value = await Geolocator.requestPermission(); @@ -28,13 +40,26 @@ class Location { }); } - static void isEnabled(Function(bool) callback) { + void isEnabled(Function(bool) callback) { Geolocator.isLocationServiceEnabled().then((value) => callback(value)); } + void handleLocationPermission() { + havePermission((val) { + if (val) { + print(val); + getCurrentLocation((LatLng? latlng) { + print(latlng); + AppState().currentLocation = latlng ?? const LatLng(0, 0); + print("App State Location" + AppState().currentLocation.toJson().toString()); + }); + } + }); + } + static bool _listeningSettingChange = true; - static void listenGPS({bool change = true, Function(bool)? onChange}) async { + void listenGPS({bool change = true, Function(bool)? onChange}) async { _listeningSettingChange = change; if (change == false) return; @@ -46,10 +71,8 @@ class Location { }); } - static void getCurrentLocation(Function(LatLng?) callback) { + void getCurrentLocation(Function(LatLng?) callback) { void done(Position position) { - //AppStorage.sp.saveLocation(position); - LatLng? myCurrentLocation = LatLng(position.latitude, position.longitude); callback(myCurrentLocation); } @@ -88,8 +111,7 @@ class Location { } class _Map { - Marker createMarker( - String id, { + Marker createMarker(String id, { required LatLng coordinates, BitmapDescriptor? icon, VoidCallback? onTap, @@ -139,7 +161,7 @@ class _Map { } void goToCurrentLocation({Completer? mapController, double? direction = 0.0, bool? animation}) { - Location.getCurrentLocation((location) { + LocationService().getCurrentLocation((location) { moveTo(location!, zoom: 17, mapController: mapController!, animation: animation, direction: direction!); }); } diff --git a/lib/view_models/payment_view_model.dart b/lib/view_models/payment_view_model.dart index 96a9af7..db53fb0 100644 --- a/lib/view_models/payment_view_model.dart +++ b/lib/view_models/payment_view_model.dart @@ -199,7 +199,7 @@ class PaymentVM extends ChangeNotifier { void onAppointmentSuccess(BuildContext context) { context.read().onNavbarTapped(1); navigateReplaceWithNameUntilRoute(context, AppRoutes.dashboard); - } + } Future onVisaCardSelected(BuildContext context, PaymentTypes paymentType) async { currentPaymentType = paymentType; diff --git a/lib/view_models/service_view_model.dart b/lib/view_models/service_view_model.dart index 90ad442..7644d40 100644 --- a/lib/view_models/service_view_model.dart +++ b/lib/view_models/service_view_model.dart @@ -93,15 +93,34 @@ class ServiceVM extends BaseVM { Future getServiceProviderDocument(int providerId) async { setState(ViewState.busy); + commerceCertificates.clear(); + commercialCertificates.clear(); + vatCertificates.clear(); + // 0 Need To Upload + //1 Pending + //2 + //3 Approved + //4 Rejected + // document = await branchRepo.getServiceProviderDocument(providerId); + // if (document != null && document!.data != null && document!.data!.isNotEmpty) { + // print(document!.data!.length); + // for (var doc in document!.data!) { + // print("doc: ${doc.status}"); + // if (doc.status != 3 || doc.status == 1) { + // updateIsAllDocsApproved(false); + // } + // } + // } + + // + document = await branchRepo.getServiceProviderDocument(providerId); - if (document != null && document!.data != null && document!.data!.isNotEmpty) { - for (var doc in document!.data!) { - log("doc: ${doc.status}"); - if (doc.status != 3) { - updateIsAllDocsApproved(false); - } - } - } + + // 0 Need To Upload + //1 Pending + //2 + //3 Approved + //4 Rejected setState(ViewState.idle); } @@ -210,10 +229,10 @@ class ServiceVM extends BaseVM { // return null; // } - bool isAllDocsApproved = false; + bool isShowContinue = true; - updateIsAllDocsApproved(var value) { - isAllDocsApproved = value; + updateIsShowContinue(var value) { + isShowContinue = value; notifyListeners(); } @@ -223,7 +242,12 @@ class ServiceVM extends BaseVM { context, allowMultiple: false, ); + if (files != null && files.any((file) => file.path.split('.').last.toLowerCase() != 'pdf')) { + Utils.showToast("Only PDF files are allowed"); + return; + } if (files == null) return; + for (var element in files) { imageModels.add(ImageModel( filePath: element.path, diff --git a/lib/view_models/subscriptions_view_model.dart b/lib/view_models/subscriptions_view_model.dart index deefeef..ddc0f84 100644 --- a/lib/view_models/subscriptions_view_model.dart +++ b/lib/view_models/subscriptions_view_model.dart @@ -3,6 +3,7 @@ import 'package:mc_common_app/models/general_models/generic_resp_model.dart'; import 'package:mc_common_app/models/subscriptions_models/branch_user_selection_model.dart'; import 'package:mc_common_app/models/subscriptions_models/subscription_model.dart'; import 'package:mc_common_app/utils/enums.dart'; +import 'package:mc_common_app/utils/utils.dart'; import 'package:mc_common_app/view_models/base_view_model.dart'; import 'package:mc_common_app/widgets/dropdown/dropdow_field.dart'; import '../repositories/subscription_repo.dart'; @@ -61,21 +62,22 @@ class SubscriptionsVM extends BaseVM { monthlyTabs.first.isEnabled = true; selectedMonthlyTab = monthlyTabs.first; - filterSubscriptions(); - getMySubscriptionsBySP(); + await filterSubscriptions(); + await getMySubscriptionsBySP(); setState(ViewState.idle); } else { setState(ViewState.error); } } - String newPrice = ""; + String newPrice = "0.0"; calculationUpgradePrice(String? serviceProviderID, String? newSubscription) async { setState(ViewState.busy); GenericRespModel genericRespModel = await subscriptionRepo.calculationUpgradePrice(serviceProviderID, newSubscription); if (genericRespModel.messageStatus == 1) { setState(ViewState.idle); + print("=========== ${genericRespModel.data.toString()}================="); newPrice = genericRespModel.data.toString(); } else { setState(ViewState.error); @@ -114,7 +116,12 @@ class SubscriptionsVM extends BaseVM { } Future createSubscriptionOrder(int subscriptionId, bool isStartNow, bool isRenew, {bool isDegrade = false, List? listOfBranches, List? listOfUsers}) async { - Map map = {"providerID": AppState().getUser.data?.userInfo?.providerId.toString() ?? "", "subscriptionID": subscriptionId.toString(), "isStartNow": isStartNow.toString(), "isRenew": isRenew.toString()}; + Map map = { + "providerID": AppState().getUser.data?.userInfo?.providerId.toString() ?? "", + "subscriptionID": subscriptionId.toString(), + "isStartNow": isStartNow.toString(), + "isRenew": isRenew.toString() + }; GenericRespModel genericRespModel = await subscriptionRepo.payForProviderSubscription(map); return genericRespModel; } @@ -185,6 +192,7 @@ class SubscriptionsVM extends BaseVM { // My Provider Subscription getMySubscriptionsBySP() async { setState(ViewState.busy); + mySubscriptionsBySp.clear(); if (mySubscriptionsBySp.isEmpty) { // allSubscriptions.data for (var element in allSubscriptions.data!) { @@ -192,9 +200,9 @@ class SubscriptionsVM extends BaseVM { mySubscriptionsBySp.add(element); } } - // mySubscriptionsBySp = await subscriptionRepo.getProviderSubscription(serviceProviderID: serviceProviderID); AppState().setproviderSubscription = mySubscriptionsBySp; } setState(ViewState.idle); } + } diff --git a/lib/views/location_views/map_selection_widget.dart b/lib/views/location_views/map_selection_widget.dart index dc28656..2275466 100644 --- a/lib/views/location_views/map_selection_widget.dart +++ b/lib/views/location_views/map_selection_widget.dart @@ -7,13 +7,14 @@ import 'package:google_maps_flutter/google_maps_flutter.dart'; class AppMap extends StatefulWidget { final CameraPositionCallback onCameraMove; + final VoidCallback onCameraIdle; Map initialCamera; late AppMapState _state; final Function onMapCreated; AppMap(this.initialCamera, - {required this.onCameraMove, required this.onMapCreated}); + {required this.onCameraMove, required this.onCameraIdle, required this.onMapCreated}); @override State createState() => _state = AppMapState(); @@ -59,6 +60,7 @@ class AppMapState extends State { const CameraPosition( target: LatLng(-26.1711459, 27.9002758), zoom: 2.0), onCameraMove: widget.onCameraMove, + onCameraIdle: widget.onCameraIdle, onMapCreated: (GoogleMapController controller) { googleMapController = controller; _googleMapControllerComp.complete(controller); diff --git a/lib/views/location_views/pick_location_page.dart b/lib/views/location_views/pick_location_page.dart index a4d4176..516b6a0 100644 --- a/lib/views/location_views/pick_location_page.dart +++ b/lib/views/location_views/pick_location_page.dart @@ -6,6 +6,7 @@ import 'package:flutter/material.dart'; import 'package:geolocator/geolocator.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:mc_common_app/classes/app_state.dart'; import 'package:mc_common_app/generated/locale_keys.g.dart'; import 'package:mc_common_app/utils/navigator.dart'; import 'package:mc_common_app/widgets/button/show_fill_button.dart'; @@ -32,12 +33,11 @@ class _PickLocationPageState extends State { final Set markers = {}; late AppMap appMap; - static CameraPosition _kGooglePlex = const CameraPosition( - target: LatLng(37.42796133580664, -122.085749655962), + static CameraPosition _kGooglePlex = CameraPosition( + target: AppState().currentLocation, zoom: 14.4746, ); late LatLng currentPosition; - Completer mapController = Completer(); final ValueNotifier _counter = ValueNotifier(""); @override @@ -47,11 +47,15 @@ class _PickLocationPageState extends State { onCameraMove: (camera) { _updatePosition(camera); }, + onCameraIdle: (){ + print("===== Idle Triggered ====="); + updateAddress(latitude, longitude); + }, onMapCreated: () { - // goToCurrentLocation(); _getUserLocation(); setState(() {}); }, + ); super.initState(); } @@ -125,9 +129,7 @@ class _PickLocationPageState extends State { Future _updatePosition(CameraPosition position) async { latitude = position.target.latitude; longitude = position.target.longitude; - log(latitude.toString()); - log(latitude.toString()); - updateAddress(latitude, longitude); + // updateAddress(latitude, longitude); } void _getUserLocation() async { @@ -152,21 +154,28 @@ class _PickLocationPageState extends State { }, ); } + setState(() {}); } updateAddress(double latitude, double longitude) async { - List placemarks = await placemarkFromCoordinates(latitude, longitude); + print("========="); + List placemarks = await placemarkFromCoordinates(latitude, longitude).catchError((e) { + print(e); + }); + print(placemarks.length); + print("====end====="); _counter.value = '${placemarks.first.street}, ${placemarks.first.subLocality}, ${placemarks.first.locality}, ${placemarks.first.postalCode}, ${placemarks.first.country}'; + } setMap() { - setState(() { - _kGooglePlex = CameraPosition( - target: currentPosition, - zoom: 14.4746, - ); - appMap.moveTo(cameraPostion: _kGooglePlex); - }); + // setState(() { + _kGooglePlex = CameraPosition( + target: currentPosition, + zoom: 14.4746, + ); + appMap.moveTo(cameraPostion: _kGooglePlex); + // }); } Future getCurrentAddress() async { diff --git a/lib/views/setting_options/provider_license_page.dart b/lib/views/setting_options/provider_license_page.dart index 6ae4eea..ab535bd 100644 --- a/lib/views/setting_options/provider_license_page.dart +++ b/lib/views/setting_options/provider_license_page.dart @@ -58,40 +58,43 @@ class _ProviderLicensePageState extends State { 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 { 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 updateDocument(ServiceVM model) async { try { Utils.showLoading(context); @@ -115,7 +131,7 @@ class _ProviderLicensePageState extends State { 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 { 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 isLocalOrNetworkFiles({required ServiceVM model, required DocumentData document}) {