diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index 31e27dc..bbb2e66 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -47,6 +47,7 @@ class ApiConsts { static String ServiceProviderService_Create = "${baseUrlServices}api/ServiceProviders/ServiceProviderService_Create"; static String ServiceProviderService_Update = "${baseUrlServices}api/ServiceProviders/ServiceProviderService_Update"; static String GetProviderServices = "${baseUrlServices}api/ServiceProviders/ServiceProviderService_Get"; + static String setScheduleInactive = "${baseUrlServices}api/ServiceProviders/BranchAppointmentSchedule_IsActiveUpdate"; static String ServiceProviderService_Get = "${baseUrlServices}api/ServiceProviders/ServiceProviderService_Get"; static String BranchesAndServices = "${baseUrlServices}api/ServiceProviders/ServiceProviderDetail_Get"; diff --git a/lib/models/appointments_models/schedule_model.dart b/lib/models/appointments_models/schedule_model.dart index 2f65cd2..9c0f829 100644 --- a/lib/models/appointments_models/schedule_model.dart +++ b/lib/models/appointments_models/schedule_model.dart @@ -58,6 +58,7 @@ class ScheduleData { final List? scheduleServices; final List? selectedServices; String branchId; + int? appointmentType; ScheduleData({ this.id, @@ -77,6 +78,7 @@ class ScheduleData { this.scheduleServices, this.selectedServices, this.branchId = "", + this.appointmentType }); factory ScheduleData.fromJson(Map json) => @@ -94,6 +96,7 @@ class ScheduleData { address: json["address"], latitude: json["latitude"], longitude: json["longitude"], + appointmentType: json["appointmentType"] == null ? null : json["appointmentType"], weeklyOffDays: json["weeklyOffDays"] == null ? [] : List.from(json["weeklyOffDays"]!.map((x) => WeeklyOffDay.fromJson(x))), scheduleServices: json["scheduleServices"] == null ? [] : List.from(json["scheduleServices"]!.map((x) => ServiceModel.fromJson(x))), selectedServices: [], @@ -114,6 +117,7 @@ class ScheduleData { "address": address, "latitude": latitude, "longitude": longitude, + "appointmentType": appointmentType, "scheduleServices": scheduleServices == null ? [] : List.from(scheduleServices!.map((x) => x.toJson())), }; diff --git a/lib/models/provider_branches_models/profile/services.dart b/lib/models/provider_branches_models/profile/services.dart index f45abcb..f007aa3 100644 --- a/lib/models/provider_branches_models/profile/services.dart +++ b/lib/models/provider_branches_models/profile/services.dart @@ -55,7 +55,7 @@ class ServicesData { String? descriptionN; dynamic? serviceIconUrl; dynamic? serviceImageUrl; - int? serviceCategoryId; + dynamic? serviceCategoryId; dynamic? categoryName; bool? isSelected; diff --git a/lib/repositories/branch_repo.dart b/lib/repositories/branch_repo.dart index 46ad07a..5de2eee 100644 --- a/lib/repositories/branch_repo.dart +++ b/lib/repositories/branch_repo.dart @@ -111,9 +111,9 @@ class BranchRepoImp implements BranchRepo { @override Future fetchServicesByCategoryId({required int serviceCategoryId}) async { - var postParams = {"ServiceCategoryID": serviceCategoryId}; + var postParams = {"ServiceCategoryID": serviceCategoryId.toString()}; String t = AppState().getUser.data!.accessToken ?? ""; - return await apiClient.getJsonForObject((json) => Services.fromJson(json), ApiConsts.Services_Get, queryParameters: serviceCategoryId != -1 ? postParams : null, token: t); + return await apiClient.getJsonForObject((json) => Services.fromJson(json), ApiConsts.Services_Get, queryParameters: serviceCategoryId.toString() != "-1" ? postParams : null, token: t); } @override diff --git a/lib/repositories/schedule_repo.dart b/lib/repositories/schedule_repo.dart index e906cda..59b0629 100644 --- a/lib/repositories/schedule_repo.dart +++ b/lib/repositories/schedule_repo.dart @@ -18,6 +18,8 @@ abstract class ScheduleRepo { Future getSchedules(String branchId); Future updateServicesInSchedule(Map map); + + Future setScheduleInActive(int scheduleId, int branchId); } class ScheduleRepoImp implements ScheduleRepo { @@ -47,6 +49,17 @@ class ScheduleRepoImp implements ScheduleRepo { return await injector.get().getJsonForObject((json) => Schedule.fromJson(json), ApiConsts.getSchedule, token: t, queryParameters: map); } + @override + Future setScheduleInActive(int scheduleId, int branchId) async { + Map map = { + "id": scheduleId, + "serviceProviderBranchID": branchId, + "isActive": false, + }; + String t = AppState().getUser.data!.accessToken ?? ""; + return injector.get().postJsonForObject((json) => MResponse.fromJson(json), ApiConsts.setScheduleInactive, token: t, map); + } + @override Future updateSchedule(Map map) async { String t = AppState().getUser.data!.accessToken ?? ""; diff --git a/lib/utils/app_permission_handler.dart b/lib/utils/app_permission_handler.dart index 0d8bfd5..b9e2e87 100644 --- a/lib/utils/app_permission_handler.dart +++ b/lib/utils/app_permission_handler.dart @@ -1,4 +1,5 @@ import 'dart:developer'; +import 'dart:io'; import 'package:device_info_plus/device_info_plus.dart'; import 'package:flutter/material.dart'; @@ -66,16 +67,22 @@ class AppPermissions { message: "You need to give storage permission to select files.", onTap: () { Navigator.pop(context); + openAppSettings(); }, ), ); } + Future getAndroidDeviceInfo() async { + AndroidDeviceInfo deviceInfo = await DeviceInfoPlugin().androidInfo; + return deviceInfo.version.sdkInt; + } + static Future checkStoragePermissions(BuildContext context) async { bool permissionStatus; final deviceInfo = await DeviceInfoPlugin().androidInfo; - if (deviceInfo.version.sdkInt! > 32) { + if (deviceInfo.version.sdkInt > 32) { permissionStatus = await Permission.photos.request().isGranted; if (permissionStatus) { return true; @@ -89,7 +96,6 @@ class AppPermissions { return true; } else { getDialog(context); - return false; } } diff --git a/lib/views/advertisement/ads_detail_view.dart b/lib/views/advertisement/ads_detail_view.dart index 42c01c2..5e0e3db 100644 --- a/lib/views/advertisement/ads_detail_view.dart +++ b/lib/views/advertisement/ads_detail_view.dart @@ -252,7 +252,25 @@ class _AdsDetailViewState extends State { ).toWhiteContainer(width: double.infinity, allPading: 12); } return const SizedBox.shrink(); - }) + }), + 12.height, + if (widget.adDetails.adPostStatus == AdPostStatus.rejected) + Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "Rejection Comments".toText(fontSize: 18, isBold: true), + Row( + children: [ + (widget.adDetails.comment ?? "").toText( + color: MyColors.redColor, + fontSize: 12, + isItalic: true, + ), + ], + ), + ], + ).toWhiteContainer(width: double.infinity, allPading: 12), ], ), ), @@ -1195,6 +1213,7 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget { case AdPostStatus.buyingService: case AdPostStatus.reserveCancel: case AdPostStatus.rejected: + return pendingForReviewAction(pendingText: "Rejected form admin"); case AdPostStatus.cancelled: case AdPostStatus.pendingForPost: return pendingForReviewAction(pendingText: "Waiting for admin to post"); diff --git a/lib/views/user/login_with_password_page.dart b/lib/views/user/login_with_password_page.dart index eec65c6..bdc96f9 100644 --- a/lib/views/user/login_with_password_page.dart +++ b/lib/views/user/login_with_password_page.dart @@ -46,8 +46,10 @@ class _LoginWithPasswordState extends State { void initState() { super.initState(); if (AppState().currentAppType == AppType.provider) { - phoneNum = "966580816976"; - password = "123@Shf"; + // phoneNum = "966580816976"; + // password = "123@Shf"; + phoneNum = "966530896018"; + password = "Amir@123"; } scheduleMicrotask(() { userVM = Provider.of(context, listen: false); diff --git a/lib/views/user/register_provider_page.dart b/lib/views/user/register_provider_page.dart index 121a3f2..ca78f1c 100644 --- a/lib/views/user/register_provider_page.dart +++ b/lib/views/user/register_provider_page.dart @@ -29,15 +29,18 @@ class _RegisterPageState extends State { String phoneNum = "", countryCode = ""; int role = -1, countryId = -1; + DropValue? selectedDrop; TextEditingController emailController = TextEditingController(); Future? futureRoles; Future? futureCountries; + UserVM? userVM; @override void initState() { super.initState(); + userVM = context.read(); fetchData(); } @@ -57,7 +60,6 @@ class _RegisterPageState extends State { @override Widget build(BuildContext context) { - final UserVM userVM = context.read(); return Scaffold( appBar: const CustomAppBar(isRemoveBackButton: false, title: ""), body: Container( @@ -129,13 +131,15 @@ class _RegisterPageState extends State { 10.height, DropdownField( (DropValue value) { + selectedDrop = value; setState(() { countryCode = value.subValue; countryId = value.id; }); }, + dropdownValue: selectedDrop, list: dropList, - hint: LocaleKeys.chooseCountry.tr(), + hint: LocaleKeys.chooseCountry .tr(), ), ], ); @@ -205,7 +209,7 @@ class _RegisterPageState extends State { title: LocaleKeys.continu.tr(), maxWidth: double.infinity, onPressed: () { - if (validation()) userVM.performBasicOtpRegisterPage(context, countryCode: countryCode, phoneNum: phoneNum, role: role); + if (validation()) userVM!.performBasicOtpRegisterPage(context, countryCode: countryCode, phoneNum: phoneNum, role: role); // if (validation()) performBasicOtp(context); }, ), diff --git a/lib/widgets/tab/role_type_tab.dart b/lib/widgets/tab/role_type_tab.dart index fa363ba..a3983cf 100644 --- a/lib/widgets/tab/role_type_tab.dart +++ b/lib/widgets/tab/role_type_tab.dart @@ -31,19 +31,21 @@ class _RoleTypeTabState extends State { }); }, child: Container( - width: widget.width ?? (MediaQuery - .of(context) - .size - .width / 2) - 30, + width: widget.width ?? (MediaQuery.of(context).size.width / 2) - 30, height: 45, decoration: BoxDecoration( color: widget.selectedIndex == index ? MyColors.darkPrimaryColor : Colors.grey[200], // border: Border.all(color: type == ClassType.NUMBER ? MyColors.darkPrimaryColor : Colors.transparent, width: 2), - borderRadius: const BorderRadius.all(Radius.circular(0)), + borderRadius: const BorderRadius.all( + Radius.circular(0), + ), ), child: Center( child: Text( - widget.dropList[index].value, + (widget.dropList[index].value) == "ServiceProvider_Dealership" || (widget.dropList[index].value) == "ServiceProvider_Individual" + ? widget.dropList[index].value.split("_").first + "\n" + widget.dropList[index].value.split("_").last + : widget.dropList[index].value, + textAlign: TextAlign.center, style: TextStyle( color: widget.selectedIndex == index ? MyColors.white : Colors.black, fontSize: 15, diff --git a/pubspec.yaml b/pubspec.yaml index ef145ea..a85049c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -17,7 +17,7 @@ dependencies: provider: ^6.0.0 easy_localization: ^3.0.3 http: ^0.13.3 - permission_handler: ^10.2.0 + permission_handler: ^11.3.1 flutter_svg: ^1.0.3 sizer: ^2.0.15 fluttertoast: ^8.0.8