Fixed the notes list

master_new_changes
Faiz Hashmi 1 year ago
parent 15577c3cfb
commit f0a9c294c2

@ -630,5 +630,20 @@
"cancelRequestPrompt": "هل تريد إلغاء هذا الطلب؟", "cancelRequestPrompt": "هل تريد إلغاء هذا الطلب؟",
"requestPermanentlyCancelled": "سيتم إلغاء طلبك بشكل نهائي. لا يمكنك التراجع عن هذا الإجراء.", "requestPermanentlyCancelled": "سيتم إلغاء طلبك بشكل نهائي. لا يمكنك التراجع عن هذا الإجراء.",
"awaitingResponseFromCustomer": "في انتظار الرد من العميل", "awaitingResponseFromCustomer": "في انتظار الرد من العميل",
"acknowledgePaymentToMowater": "أقر بأنه عند إكمال هذه الصفقة، سأدفع 2٪ من إجمالي هذه الصفقة لشركة مواتر مقابل خدماتهم." "acknowledgePaymentToMowater": "أقر بأنه عند إكمال هذه الصفقة، سأدفع 2٪ من إجمالي هذه الصفقة لشركة مواتر مقابل خدماتهم.",
"requestsFilter": "تصفية الطلبات",
"searchByCondition": "البحث حسب الحالة",
"selectCondition": "حدد الحالة",
"searchByRequestType": "البحث حسب نوع الطلب",
"searchByCustomerName": "البحث حسب اسم العميل",
"searchByProviderName": "البحث حسب اسم المزود",
"searchByRequestStatus": "البحث حسب حالة الطلب",
"selectRequestType": "اختر نوع الطلب",
"selectRequestStatus": "اختر حالة الطلب",
"searchByRequestedDate": "البحث حسب تاريخ الطلب",
"selectDate": "اختر التاريخ",
"searchByVehicleModel": "البحث حسب طراز المركبة",
"customerCarePrompt": "هل لديك أي استفسار؟ نحن هنا لخدمتك. انقر هنا للتحدث مع خدمة العملاء لدينا الآن.",
"callNow": "اتصل الآن",
"condition": "الحالة"
} }

@ -631,5 +631,20 @@
"cancelRequestPrompt": "Do you want to cancel this request?", "cancelRequestPrompt": "Do you want to cancel this request?",
"requestPermanentlyCancelled": "Your request will be permanently cancelled. You cannot undo this action.", "requestPermanentlyCancelled": "Your request will be permanently cancelled. You cannot undo this action.",
"awaitingResponseFromCustomer": "Awaiting Response From Customer", "awaitingResponseFromCustomer": "Awaiting Response From Customer",
"acknowledgePaymentToMowater": "I acknowledge that upon completion of this deal, I will pay 2% of this total deal to the Mowater company for their service." "acknowledgePaymentToMowater": "I acknowledge that upon completion of this deal, I will pay 2% of this total deal to the Mowater company for their service.",
"requestsFilter": "Requests Filter",
"searchByCondition": "Search By Condition",
"selectCondition": "Select Condition",
"searchByRequestType": "Search By Request Type",
"searchByCustomerName": "Search By Customer Name",
"searchByProviderName": "Search By Provider Name",
"searchByRequestStatus": "Search By Request Status",
"selectRequestStatus": "Select Request Status",
"selectRequestType": "Select Request Type",
"searchByRequestedDate": "Search by Requested Date",
"selectDate": "Select Date",
"searchByVehicleModel": "Search By Vehicle Model",
"customerCarePrompt": "Got any question? We are here to service. Click here to talk to our customer care right now.",
"callNow": "Call Now",
"condition": "Condition"
} }

@ -56,8 +56,7 @@ class APIError {
} }
abstract class ApiClient { abstract class ApiClient {
Future<U> postJsonForObject<T, U>(FactoryConstructor<U> factoryConstructor, String url, T jsonObject, Future<U> postJsonForObject<T, U>(FactoryConstructor<U> factoryConstructor, String url, T jsonObject, {String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0});
{String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0});
Future<Response> postJsonForResponse<T>(String url, T jsonObject, {String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0}); Future<Response> postJsonForResponse<T>(String url, T jsonObject, {String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0});
@ -68,8 +67,7 @@ abstract class ApiClient {
class ApiClientImp implements ApiClient { class ApiClientImp implements ApiClient {
@override @override
Future<U> postJsonForObject<T, U>(FactoryConstructor<U> factoryConstructor, String url, T jsonObject, Future<U> postJsonForObject<T, U>(FactoryConstructor<U> factoryConstructor, String url, T jsonObject, {String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0}) async {
{String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0}) async {
var headers0 = {'Accept': 'application/json'}; var headers0 = {'Accept': 'application/json'};
if (headers != null && headers.isNotEmpty) { if (headers != null && headers.isNotEmpty) {
headers0.addAll(headers); headers0.addAll(headers);
@ -195,8 +193,7 @@ class ApiClientImp implements ApiClient {
Future<Response> _post(url, {Map<String, String>? headers, body, Encoding? encoding}) => _withClient((client) => client.post(url, headers: headers, body: body, encoding: encoding)); Future<Response> _post(url, {Map<String, String>? headers, body, Encoding? encoding}) => _withClient((client) => client.post(url, headers: headers, body: body, encoding: encoding));
@override @override
Future<U> getJsonForObject<T, U>(FactoryConstructor<U> factoryConstructor, String url, Future<U> getJsonForObject<T, U>(FactoryConstructor<U> factoryConstructor, String url, {String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0}) async {
{String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0}) async {
var headers0 = {'Accept': 'application/json'}; var headers0 = {'Accept': 'application/json'};
if (headers != null && headers.isNotEmpty) { if (headers != null && headers.isNotEmpty) {
headers0.addAll(headers); headers0.addAll(headers);

@ -123,6 +123,7 @@ class ApiConsts {
static String adsMCBankAccountAdGet = "${baseUrlServices}api/Advertisement/MCBankAccountAd_Get"; static String adsMCBankAccountAdGet = "${baseUrlServices}api/Advertisement/MCBankAccountAd_Get";
static String adsReserveCreate = "${baseUrlServices}api/Advertisement/AdsReserve_Create"; static String adsReserveCreate = "${baseUrlServices}api/Advertisement/AdsReserve_Create";
static String reserveAdPaymentOnDealDoneCreate = "${baseUrlServices}api/Advertisement/ReserveAdPaymentOnDealDone_Create"; static String reserveAdPaymentOnDealDoneCreate = "${baseUrlServices}api/Advertisement/ReserveAdPaymentOnDealDone_Create";
static String adsExtendDurationCreate = "${baseUrlServices}api/Advertisement/Ads_ExtendDuration_Create";
//Subscription //Subscription
static String getMySubscriptions = "${baseUrlServices}api/ServiceProviders/ProviderSubscription_Get"; static String getMySubscriptions = "${baseUrlServices}api/ServiceProviders/ProviderSubscription_Get";
@ -196,6 +197,7 @@ class GlobalConsts {
static String adReservablePriceErrorConst = "Ad Reservable price cannot be empty"; static String adReservablePriceErrorConst = "Ad Reservable price cannot be empty";
static String homeLocationEmptyError = "Home location cannot be empty"; static String homeLocationEmptyError = "Home location cannot be empty";
static String fillAllFields = "Please fill out all the fields."; static String fillAllFields = "Please fill out all the fields.";
static String requestTypeCannotBeEmpty = "Request type cannot be empty.";
static String reserveAdPriceInfo = "Some dummy description to explain the following concept. This price will be for 24 hours and if a user cancels the reservations before 24 hours then the amount will be automatically refunded to the buyer."; static String reserveAdPriceInfo = "Some dummy description to explain the following concept. This price will be for 24 hours and if a user cancels the reservations before 24 hours then the amount will be automatically refunded to the buyer.";
} }

@ -15,6 +15,7 @@ import 'package:mc_common_app/views/profile/profile_view.dart';
import 'package:mc_common_app/views/requests/create_request_page.dart'; import 'package:mc_common_app/views/requests/create_request_page.dart';
import 'package:mc_common_app/views/requests/offer_list_page.dart'; import 'package:mc_common_app/views/requests/offer_list_page.dart';
import 'package:mc_common_app/views/requests/request_detail_page.dart'; import 'package:mc_common_app/views/requests/request_detail_page.dart';
import 'package:mc_common_app/views/requests/requests_filter_view.dart';
import 'package:mc_common_app/views/requests/review_request_offer.dart'; import 'package:mc_common_app/views/requests/review_request_offer.dart';
import 'package:mc_common_app/views/setting_options/provider_license_page.dart'; import 'package:mc_common_app/views/setting_options/provider_license_page.dart';
import 'package:mc_common_app/views/setting_options/setting_option_help.dart'; import 'package:mc_common_app/views/setting_options/setting_option_help.dart';
@ -96,6 +97,7 @@ class AppRoutes {
//Requests //Requests
static const String myRequestsPage = "/myRequestsPage"; static const String myRequestsPage = "/myRequestsPage";
static const String requestsFilterView = "/requestsFilterView";
static const String createRequestPage = "/createRequestPage"; static const String createRequestPage = "/createRequestPage";
static const String offersListPage = "/offersListPage"; static const String offersListPage = "/offersListPage";
static const String requestsDetailPage = "/requestsDetailPage"; static const String requestsDetailPage = "/requestsDetailPage";
@ -160,6 +162,7 @@ class AppRoutes {
AppRoutes.createRequestPage: (context) => const CreateRequestPage(), AppRoutes.createRequestPage: (context) => const CreateRequestPage(),
AppRoutes.offersListPage: (context) => OfferListPage(offerListPageArguments: ModalRoute.of(context)!.settings.arguments as OfferListPageArguments), AppRoutes.offersListPage: (context) => OfferListPage(offerListPageArguments: ModalRoute.of(context)!.settings.arguments as OfferListPageArguments),
AppRoutes.reviewRequestOffer: (context) => const ReviewRequestOffer(), AppRoutes.reviewRequestOffer: (context) => const ReviewRequestOffer(),
AppRoutes.requestsFilterView: (context) => const RequestsFilterView(),
}; };
} }

@ -5,6 +5,7 @@ import 'package:mc_common_app/classes/app_state.dart';
import 'package:mc_common_app/classes/consts.dart'; import 'package:mc_common_app/classes/consts.dart';
import 'package:mc_common_app/main.dart'; import 'package:mc_common_app/main.dart';
import 'package:mc_common_app/theme/colors.dart'; import 'package:mc_common_app/theme/colors.dart';
import 'package:mc_common_app/utils/date_helper.dart';
import 'package:mc_common_app/utils/enums.dart'; import 'package:mc_common_app/utils/enums.dart';
extension EmailValidator on String { extension EmailValidator on String {
@ -575,8 +576,9 @@ extension DateTimeConversions on DateTime {
String getTimeAgo({bool numericDates = true}) { String getTimeAgo({bool numericDates = true}) {
final date2 = DateTime.now(); final date2 = DateTime.now();
final difference = date2.difference(this); final difference = date2.difference(this);
if ((difference.inDays / 7).floor() >= 2) {
if ((difference.inDays / 7).floor() >= 1) { return DateHelper.formatAsDayMonthYear(date2);
} else if ((difference.inDays / 7).floor() >= 1) {
return (numericDates) ? '1 week ago' : 'Last week'; return (numericDates) ? '1 week ago' : 'Last week';
} else if (difference.inDays >= 2) { } else if (difference.inDays >= 2) {
return '${difference.inDays} days ago'; return '${difference.inDays} days ago';

@ -646,7 +646,22 @@ class CodegenLoader extends AssetLoader{
"cancelRequestPrompt": "هل تريد إلغاء هذا الطلب؟", "cancelRequestPrompt": "هل تريد إلغاء هذا الطلب؟",
"requestPermanentlyCancelled": "سيتم إلغاء طلبك بشكل نهائي. لا يمكنك التراجع عن هذا الإجراء.", "requestPermanentlyCancelled": "سيتم إلغاء طلبك بشكل نهائي. لا يمكنك التراجع عن هذا الإجراء.",
"awaitingResponseFromCustomer": "في انتظار الرد من العميل", "awaitingResponseFromCustomer": "في انتظار الرد من العميل",
"acknowledgePaymentToMowater": "أقر بأنه عند إكمال هذه الصفقة، سأدفع 2٪ من إجمالي هذه الصفقة لشركة مواتر مقابل خدماتهم." "acknowledgePaymentToMowater": "أقر بأنه عند إكمال هذه الصفقة، سأدفع 2٪ من إجمالي هذه الصفقة لشركة مواتر مقابل خدماتهم.",
"requestsFilter": "تصفية الطلبات",
"searchByCondition": "البحث حسب الحالة",
"selectCondition": "حدد الحالة",
"searchByRequestType": "البحث حسب نوع الطلب",
"searchByCustomerName": "البحث حسب اسم العميل",
"searchByProviderName": "البحث حسب اسم المزود",
"searchByRequestStatus": "البحث حسب حالة الطلب",
"selectRequestType": "اختر نوع الطلب",
"selectRequestStatus": "اختر حالة الطلب",
"searchByRequestedDate": "البحث حسب تاريخ الطلب",
"selectDate": "اختر التاريخ",
"searchByVehicleModel": "البحث حسب طراز المركبة",
"customerCarePrompt": "هل لديك أي استفسار؟ نحن هنا لخدمتك. انقر هنا للتحدث مع خدمة العملاء لدينا الآن.",
"callNow": "اتصل الآن",
"condition": "الحالة"
}; };
static const Map<String,dynamic> en_US = { static const Map<String,dynamic> en_US = {
"firstTimeLogIn": "First Time Log In", "firstTimeLogIn": "First Time Log In",
@ -1281,7 +1296,22 @@ static const Map<String,dynamic> en_US = {
"cancelRequestPrompt": "Do you want to cancel this request?", "cancelRequestPrompt": "Do you want to cancel this request?",
"requestPermanentlyCancelled": "Your request will be permanently cancelled. You cannot undo this action.", "requestPermanentlyCancelled": "Your request will be permanently cancelled. You cannot undo this action.",
"awaitingResponseFromCustomer": "Awaiting Response From Customer", "awaitingResponseFromCustomer": "Awaiting Response From Customer",
"acknowledgePaymentToMowater": "I acknowledge that upon completion of this deal, I will pay 2% of this total deal to the Mowater company for their service." "acknowledgePaymentToMowater": "I acknowledge that upon completion of this deal, I will pay 2% of this total deal to the Mowater company for their service.",
"requestsFilter": "Requests Filter",
"searchByCondition": "Search By Condition",
"selectCondition": "Select Condition",
"searchByRequestType": "Search By Request Type",
"searchByCustomerName": "Search By Customer Name",
"searchByProviderName": "Search By Provider Name",
"searchByRequestStatus": "Search By Request Status",
"selectRequestStatus": "Select Request Status",
"selectRequestType": "Select Request Type",
"searchByRequestedDate": "Search by Requested Date",
"selectDate": "Select Date",
"searchByVehicleModel": "Search By Vehicle Model",
"customerCarePrompt": "Got any question? We are here to service. Click here to talk to our customer care right now.",
"callNow": "Call Now",
"condition": "Condition"
}; };
static const Map<String, Map<String,dynamic>> mapLocales = {"ar_SA": ar_SA, "en_US": en_US}; static const Map<String, Map<String,dynamic>> mapLocales = {"ar_SA": ar_SA, "en_US": en_US};
} }

@ -610,5 +610,20 @@ abstract class LocaleKeys {
static const requestPermanentlyCancelled = 'requestPermanentlyCancelled'; static const requestPermanentlyCancelled = 'requestPermanentlyCancelled';
static const awaitingResponseFromCustomer = 'awaitingResponseFromCustomer'; static const awaitingResponseFromCustomer = 'awaitingResponseFromCustomer';
static const acknowledgePaymentToMowater = 'acknowledgePaymentToMowater'; static const acknowledgePaymentToMowater = 'acknowledgePaymentToMowater';
static const requestsFilter = 'requestsFilter';
static const searchByCondition = 'searchByCondition';
static const selectCondition = 'selectCondition';
static const searchByRequestType = 'searchByRequestType';
static const searchByCustomerName = 'searchByCustomerName';
static const searchByProviderName = 'searchByProviderName';
static const searchByRequestStatus = 'searchByRequestStatus';
static const selectRequestType = 'selectRequestType';
static const selectRequestStatus = 'selectRequestStatus';
static const searchByRequestedDate = 'searchByRequestedDate';
static const selectDate = 'selectDate';
static const searchByVehicleModel = 'searchByVehicleModel';
static const customerCarePrompt = 'customerCarePrompt';
static const callNow = 'callNow';
static const condition = 'condition';
} }

@ -60,10 +60,21 @@ class ServiceProvidersOffers {
String? mobileNo; String? mobileNo;
String? email; String? email;
String? companyName; String? companyName;
String? createdOn;
int? offerCount; int? offerCount;
List<ChatMessageModel>? chatMessages; List<ChatMessageModel>? chatMessages;
ServiceProvidersOffers({this.providerId, this.name, this.mobileNo, this.email, this.companyName, this.offerCount, this.chatMessages, this.providerUserId}); ServiceProvidersOffers({
this.providerId,
this.name,
this.mobileNo,
this.email,
this.companyName,
this.offerCount,
this.chatMessages,
this.providerUserId,
this.createdOn,
});
ServiceProvidersOffers.fromJson(Map<String, dynamic> json) { ServiceProvidersOffers.fromJson(Map<String, dynamic> json) {
providerId = json['providerID']; providerId = json['providerID'];
@ -73,11 +84,12 @@ class ServiceProvidersOffers {
email = json['email']; email = json['email'];
companyName = json['companyName']; companyName = json['companyName'];
offerCount = json['offerCount']; offerCount = json['offerCount'];
createdOn = json['createdOn'];
chatMessages = []; chatMessages = [];
} }
@override @override
String toString() { String toString() {
return 'ServiceProvidersOffers{providerUserId: $providerUserId, providerId: $providerId, name: $name, mobileNo: $mobileNo, email: $email, companyName: $companyName, offerCount: $offerCount, chatMessages: $chatMessages}'; return 'ServiceProvidersOffers{providerUserId: $providerUserId, providerId: $providerId, name: $name, mobileNo: $mobileNo, email: $email, companyName: $companyName,offeredItemCreatedOn: $createdOn, offerCount: $offerCount, chatMessages: $chatMessages}';
} }
} }

@ -13,6 +13,7 @@ class RequestModel {
String countryName; String countryName;
String customerName; String customerName;
String customerID; String customerID;
String address;
dynamic serviceProviders; dynamic serviceProviders;
int offerCount; int offerCount;
int id; int id;
@ -57,6 +58,7 @@ class RequestModel {
required this.isChatted, required this.isChatted,
required this.customerUserID, required this.customerUserID,
required this.customer, required this.customer,
required this.address,
required this.brand, required this.brand,
required this.model, required this.model,
required this.year, required this.year,
@ -98,6 +100,7 @@ class RequestModel {
vehicleTypeName: json["vehicleTypeName"], vehicleTypeName: json["vehicleTypeName"],
countryName: json["countryName"], countryName: json["countryName"],
customerName: json["customerName"] ?? "", customerName: json["customerName"] ?? "",
address: json["address"] ?? "",
customerID: json["customerUserID"], customerID: json["customerUserID"],
serviceProviders: json["serviceProviders"], serviceProviders: json["serviceProviders"],
offerCount: json["offerCount"], offerCount: json["offerCount"],

@ -70,8 +70,7 @@ class AdsRepoImp implements AdsRepo {
var params = { var params = {
"SpecialServiceType": specialServiceId.toString(), "SpecialServiceType": specialServiceId.toString(),
}; };
GenericRespModel adsGenericModel = GenericRespModel adsGenericModel = await apiClient.getJsonForObject(token: appState.getUser.data!.accessToken, (json) => GenericRespModel.fromJson(json), ApiConsts.vehicleAdsSpecialServicesGet, queryParameters: params);
await apiClient.getJsonForObject(token: appState.getUser.data!.accessToken, (json) => GenericRespModel.fromJson(json), ApiConsts.vehicleAdsSpecialServicesGet, queryParameters: params);
List<SpecialServiceModel> vehicleAdsDuration = List.generate(adsGenericModel.data.length, (index) => SpecialServiceModel.fromJson(adsGenericModel.data[index])); List<SpecialServiceModel> vehicleAdsDuration = List.generate(adsGenericModel.data.length, (index) => SpecialServiceModel.fromJson(adsGenericModel.data[index]));
return vehicleAdsDuration; return vehicleAdsDuration;
} }
@ -93,14 +92,7 @@ class AdsRepoImp implements AdsRepo {
List vehiclePostingDamageParts = []; List vehiclePostingDamageParts = [];
adsCreationPayloadModel.vehiclePosting!.vehiclePostingDamageParts?.forEach((element) { adsCreationPayloadModel.vehiclePosting!.vehiclePostingDamageParts?.forEach((element) {
var imageMap = { var imageMap = {"id": element.id ?? 0, "comment": element.comment, "vehicleImageBase64": element.vehicleImageBase64, "vehicleDamagePartID": element.vehicleDamagePartID, "vehiclePostingID": element.vehiclePostingID ?? 0, "isActive": true};
"id": element.id ?? 0,
"comment": element.comment,
"vehicleImageBase64": element.vehicleImageBase64,
"vehicleDamagePartID": element.vehicleDamagePartID,
"vehiclePostingID": element.vehiclePostingID ?? 0,
"isActive": true
};
vehiclePostingDamageParts.add(imageMap); vehiclePostingDamageParts.add(imageMap);
}); });
var postParams = { var postParams = {
@ -172,8 +164,12 @@ class AdsRepoImp implements AdsRepo {
} }
@override @override
Future<List<AdDetailsModel>> getExploreAdsBasedOnFilters( Future<List<AdDetailsModel>> getExploreAdsBasedOnFilters({
{List<String>? cityIdsList, List<String>? vehicleModelYearIdsList, List<String>? vehicleBrandIdsList, List<String>? createdByRolesIdsList}) async { List<String>? cityIdsList,
List<String>? vehicleModelYearIdsList,
List<String>? vehicleBrandIdsList,
List<String>? createdByRolesIdsList,
}) async {
var parameters = { var parameters = {
"CityIDs": cityIdsList ?? [], "CityIDs": cityIdsList ?? [],
"VehicleBrandIDs": vehicleBrandIdsList ?? [], "VehicleBrandIDs": vehicleBrandIdsList ?? [],

@ -48,8 +48,6 @@ abstract class AppointmentRepo {
Future<GenericRespModel> createServiceAppointment({required List<ServiceAppointmentScheduleModel> schedules, required int serviceProviderID}); Future<GenericRespModel> createServiceAppointment({required List<ServiceAppointmentScheduleModel> schedules, required int serviceProviderID});
Future<GenericRespModel> cancelOrRescheduleServiceAppointment({required int serviceAppointmentID, required int serviceSlotID, required int appointmentScheduleAction}); Future<GenericRespModel> cancelOrRescheduleServiceAppointment({required int serviceAppointmentID, required int serviceSlotID, required int appointmentScheduleAction});
} }
class AppointmentRepoImp implements AppointmentRepo { class AppointmentRepoImp implements AppointmentRepo {
@ -102,6 +100,7 @@ class AppointmentRepoImp implements AppointmentRepo {
return await apiClient.postJsonForObject((json) => GenericRespModel.fromJson(json), ApiConsts.updateGroup, map, token: t); return await apiClient.postJsonForObject((json) => GenericRespModel.fromJson(json), ApiConsts.updateGroup, map, token: t);
} }
@override
Future<List<ServiceAppointmentScheduleModel>> mergeServiceIntoAvailableSchedules({ Future<List<ServiceAppointmentScheduleModel>> mergeServiceIntoAvailableSchedules({
required List<String> serviceItemIdsForHome, required List<String> serviceItemIdsForHome,
required List<String> serviceItemIdsForWorkshop, required List<String> serviceItemIdsForWorkshop,
@ -251,6 +250,4 @@ class AppointmentRepoImp implements AppointmentRepo {
String t = appState.getUser.data!.accessToken ?? ""; String t = appState.getUser.data!.accessToken ?? "";
return await apiClient.postJsonForObject((json) => GenericRespModel.fromJson(json), ApiConsts.createMergeAppointment, map, token: t); return await apiClient.postJsonForObject((json) => GenericRespModel.fromJson(json), ApiConsts.createMergeAppointment, map, token: t);
} }
} }

@ -45,7 +45,6 @@ abstract class CommonRepo {
Future<Role> getRoles(); Future<Role> getRoles();
Future<SSCarCheckScheduleModel> getCarCheckServiceScheduleDetails({required double lat, required double long}); Future<SSCarCheckScheduleModel> getCarCheckServiceScheduleDetails({required double lat, required double long});
Future<List<SSPhotoOfficeScheduleModel>> getPhotographyServiceScheduleListByOffices({required double lat, required double long}); Future<List<SSPhotoOfficeScheduleModel>> getPhotographyServiceScheduleListByOffices({required double lat, required double long});
@ -78,8 +77,6 @@ class CommonRepoImp implements CommonRepo {
return await apiClient.getJsonForObject((json) => Role.fromJson(json), ApiConsts.GetProviderRoles); return await apiClient.getJsonForObject((json) => Role.fromJson(json), ApiConsts.GetProviderRoles);
} }
@override @override
Future<SSCarCheckScheduleModel> getCarCheckServiceScheduleDetails({required double lat, required double long}) async { Future<SSCarCheckScheduleModel> getCarCheckServiceScheduleDetails({required double lat, required double long}) async {
var params = { var params = {
@ -124,6 +121,17 @@ class CommonRepoImp implements CommonRepo {
@override @override
Future<List<EnumsModel>> getEnumTypeValues({int? enumTypeID, String? enumTypeName}) async { Future<List<EnumsModel>> getEnumTypeValues({int? enumTypeID, String? enumTypeName}) async {
if (enumTypeID == -1) {
// This is for the vehicle type condition (old, new) which will be added to API later
final Map<String, dynamic> json = {
"data": [
{"id": 1, "enumTypeID": 0, "enumValueStr": "New", "enumValue": 1, "isActive": true},
{"id": 2, "enumTypeID": 0, "enumValueStr": "Used", "enumValue": 2, "isActive": true},
],
};
List<EnumsModel> enums = List.generate((json['data'] as List).length, (index) => EnumsModel.fromJson(json['data'][index]));
return enums;
}
var postParams = {"enumTypeID": (enumTypeID ?? 0).toString(), "enumTypeName": enumTypeName ?? ""}; var postParams = {"enumTypeID": (enumTypeID ?? 0).toString(), "enumTypeName": enumTypeName ?? ""};
GenericRespModel enumGenericModel = await apiClient.postJsonForObject( GenericRespModel enumGenericModel = await apiClient.postJsonForObject(
(json) => GenericRespModel.fromJson(json), (json) => GenericRespModel.fromJson(json),
@ -141,8 +149,7 @@ class CommonRepoImp implements CommonRepo {
var postParams = { var postParams = {
"VehicleType": vehicleTypeId.toString(), "VehicleType": vehicleTypeId.toString(),
}; };
GenericRespModel adsGenericModel = GenericRespModel adsGenericModel = await apiClient.getJsonForObject(token: appState.getUser.data!.accessToken, (json) => GenericRespModel.fromJson(json), ApiConsts.vehicleCategoryGet, queryParameters: postParams);
await apiClient.getJsonForObject(token: appState.getUser.data!.accessToken, (json) => GenericRespModel.fromJson(json), ApiConsts.vehicleCategoryGet, queryParameters: postParams);
List<VehicleCategoryModel> vehicleCategories = List.generate(adsGenericModel.data.length, (index) => VehicleCategoryModel.fromJson(adsGenericModel.data[index])); List<VehicleCategoryModel> vehicleCategories = List.generate(adsGenericModel.data.length, (index) => VehicleCategoryModel.fromJson(adsGenericModel.data[index]));
return vehicleCategories; return vehicleCategories;
} }
@ -152,8 +159,7 @@ class CommonRepoImp implements CommonRepo {
var postParams = { var postParams = {
"CountryID": countryId.toString(), "CountryID": countryId.toString(),
}; };
GenericRespModel adsGenericModel = await apiClient.getJsonForObject( GenericRespModel adsGenericModel = await apiClient.getJsonForObject(token: appState.getUser.data!.accessToken, (json) => GenericRespModel.fromJson(json), ApiConsts.vehicleCityGet, queryParameters: countryId != -1 ? postParams : null);
token: appState.getUser.data!.accessToken, (json) => GenericRespModel.fromJson(json), ApiConsts.vehicleCityGet, queryParameters: countryId != -1 ? postParams : null);
List<VehicleCityModel> vehicleCities = List.generate(adsGenericModel.data.length, (index) => VehicleCityModel.fromJson(adsGenericModel.data[index])); List<VehicleCityModel> vehicleCities = List.generate(adsGenericModel.data.length, (index) => VehicleCityModel.fromJson(adsGenericModel.data[index]));
return vehicleCities; return vehicleCities;
} }
@ -163,8 +169,7 @@ class CommonRepoImp implements CommonRepo {
var postParams = { var postParams = {
"VehicleType": vehicleTypeId.toString(), "VehicleType": vehicleTypeId.toString(),
}; };
GenericRespModel adsGenericModel = GenericRespModel adsGenericModel = await apiClient.getJsonForObject(token: appState.getUser.data!.accessToken, (json) => GenericRespModel.fromJson(json), ApiConsts.vehicleColorGet, queryParameters: postParams);
await apiClient.getJsonForObject(token: appState.getUser.data!.accessToken, (json) => GenericRespModel.fromJson(json), ApiConsts.vehicleColorGet, queryParameters: postParams);
List<VehicleColorModel> vehicleColors = List.generate(adsGenericModel.data.length, (index) => VehicleColorModel.fromJson(adsGenericModel.data[index])); List<VehicleColorModel> vehicleColors = List.generate(adsGenericModel.data.length, (index) => VehicleColorModel.fromJson(adsGenericModel.data[index]));
return vehicleColors; return vehicleColors;
} }
@ -174,8 +179,7 @@ class CommonRepoImp implements CommonRepo {
var postParams = { var postParams = {
"VehicleType": vehicleTypeId.toString(), "VehicleType": vehicleTypeId.toString(),
}; };
GenericRespModel adsGenericModel = GenericRespModel adsGenericModel = await apiClient.getJsonForObject(token: appState.getUser.data!.accessToken, (json) => GenericRespModel.fromJson(json), ApiConsts.vehicleConditionGet, queryParameters: postParams);
await apiClient.getJsonForObject(token: appState.getUser.data!.accessToken, (json) => GenericRespModel.fromJson(json), ApiConsts.vehicleConditionGet, queryParameters: postParams);
List<VehicleConditionModel> vehicleConditions = List.generate(adsGenericModel.data.length, (index) => VehicleConditionModel.fromJson(adsGenericModel.data[index])); List<VehicleConditionModel> vehicleConditions = List.generate(adsGenericModel.data.length, (index) => VehicleConditionModel.fromJson(adsGenericModel.data[index]));
return vehicleConditions; return vehicleConditions;
} }
@ -196,8 +200,7 @@ class CommonRepoImp implements CommonRepo {
var postParams = { var postParams = {
"VehicleType": vehicleTypeId.toString(), "VehicleType": vehicleTypeId.toString(),
}; };
GenericRespModel adsGenericModel = GenericRespModel adsGenericModel = await apiClient.getJsonForObject(token: appState.getUser.data!.accessToken, (json) => GenericRespModel.fromJson(json), ApiConsts.vehicleMileageGet, queryParameters: postParams);
await apiClient.getJsonForObject(token: appState.getUser.data!.accessToken, (json) => GenericRespModel.fromJson(json), ApiConsts.vehicleMileageGet, queryParameters: postParams);
List<VehicleMileageModel> vehicleMileages = List.generate(adsGenericModel.data.length, (index) => VehicleMileageModel.fromJson(adsGenericModel.data[index])); List<VehicleMileageModel> vehicleMileages = List.generate(adsGenericModel.data.length, (index) => VehicleMileageModel.fromJson(adsGenericModel.data[index]));
return vehicleMileages; return vehicleMileages;
} }

@ -1,8 +1,11 @@
import 'dart:developer';
import 'package:mc_common_app/api/api_client.dart'; import 'package:mc_common_app/api/api_client.dart';
import 'package:mc_common_app/classes/app_state.dart'; import 'package:mc_common_app/classes/app_state.dart';
import 'package:mc_common_app/classes/consts.dart'; import 'package:mc_common_app/classes/consts.dart';
import 'package:mc_common_app/config/dependency_injection.dart'; import 'package:mc_common_app/config/dependency_injection.dart';
import 'package:mc_common_app/extensions/string_extensions.dart'; import 'package:mc_common_app/extensions/string_extensions.dart';
import 'package:mc_common_app/main.dart';
import 'package:mc_common_app/models/general_models/generic_resp_model.dart'; import 'package:mc_common_app/models/general_models/generic_resp_model.dart';
import 'package:mc_common_app/models/requests_models/offers_model.dart'; import 'package:mc_common_app/models/requests_models/offers_model.dart';
import 'package:mc_common_app/models/requests_models/provider_offers_model.dart'; import 'package:mc_common_app/models/requests_models/provider_offers_model.dart';
@ -16,6 +19,7 @@ abstract class RequestRepo {
required String brand, required String brand,
required String model, required String model,
required String year, required String year,
required bool isNew,
required int countryID, required int countryID,
required int cityID, required int cityID,
required String price, required String price,
@ -31,6 +35,19 @@ abstract class RequestRepo {
Future<List<RequestModel>> getRequests({required int providerOrCustomerID}); Future<List<RequestModel>> getRequests({required int providerOrCustomerID});
Future<List<RequestModel>> getRequestsBasedOnFilters({
required int requestTypeId,
int requestStatusId = 0,
int? cityId = 0,
int? vehicleYearId = 0,
String? vehicleModel = "",
String? vehicleBrand = "",
String? requestedDate = "",
int? conditionId = 0,
int pageIndex = 0,
int pageSize = 100,
});
Future<List<RequestModel>> getServiceRequestsForProviders({required int serviceProviderID}); Future<List<RequestModel>> getServiceRequestsForProviders({required int serviceProviderID});
Future<GenericRespModel> updateRequestStatus({required RequestStatusEnum requestStatusEnum, required int requestId}); Future<GenericRespModel> updateRequestStatus({required RequestStatusEnum requestStatusEnum, required int requestId});
@ -49,6 +66,7 @@ class RequestRepoImp implements RequestRepo {
required String brand, required String brand,
required String model, required String model,
required String year, required String year,
required bool isNew,
required int countryID, required int countryID,
required int cityID, required int cityID,
required String price, required String price,
@ -58,13 +76,13 @@ class RequestRepoImp implements RequestRepo {
required List requestImages, required List requestImages,
}) async { }) async {
Map<String, dynamic> postParams = { Map<String, dynamic> postParams = {
"customerID": AppState().getUser.data!.userInfo!.customerId ?? 0, "customerID": appState.getUser.data!.userInfo!.customerId ?? 0,
"requestType": requestTypeId, "requestType": requestTypeId,
"vehicleTypeID": vehicleTypeId, "vehicleTypeID": vehicleTypeId,
"brand": brand, "brand": brand,
"model": model, "model": model,
"year": year, "year": year,
"isNew": true, "isNew": isNew,
"countryID": countryID, "countryID": countryID,
"cityID": cityID, "cityID": cityID,
"price": price, "price": price,
@ -89,7 +107,7 @@ class RequestRepoImp implements RequestRepo {
"pageIndex": 0, "pageIndex": 0,
}; };
if (AppState().currentAppType == AppType.provider) { if (appState.currentAppType == AppType.provider) {
paramsForGetRequests.addEntries([MapEntry("providerID", providerOrCustomerID)]); paramsForGetRequests.addEntries([MapEntry("providerID", providerOrCustomerID)]);
} else { } else {
paramsForGetRequests.addEntries([MapEntry("customerID", providerOrCustomerID)]); paramsForGetRequests.addEntries([MapEntry("customerID", providerOrCustomerID)]);
@ -109,6 +127,106 @@ class RequestRepoImp implements RequestRepo {
return requests; return requests;
} }
@override
Future<List<RequestModel>> getRequestsBasedOnFilters({
required int requestTypeId,
int requestStatusId = 0,
int? cityId = 0,
int? vehicleYearId = 0,
String? vehicleModel = "",
String? vehicleBrand = "",
String? requestedDate = "",
int? conditionId = 0,
int pageIndex = 0,
int pageSize = 100,
}) async {
final paramsForGetRequests = {
"pageIndex": pageIndex,
"pageSize": pageSize,
"doPagination": true,
"requestType": requestTypeId.toString(),
"requestStatus": requestStatusId.toString(),
"brand": vehicleBrand.toString(),
"requestedDate": requestedDate,
"model": vehicleModel.toString(),
"year": vehicleYearId.toString(),
"cityID": cityId.toString(),
"isNew": conditionId == 0 ? "" : conditionId == 1,
};
if (appState.currentAppType == AppType.customer) {
paramsForGetRequests.addEntries([MapEntry("customerID", appState.getUser.data!.userInfo!.customerId ?? 0)]);
} else {
paramsForGetRequests.addEntries([MapEntry("providerID", appState.getUser.data!.userInfo!.providerId.toString())]);
}
paramsForGetRequests.removeWhere((key, value) => value == "" || value == "0");
if (appState.currentAppType == AppType.provider && requestTypeId == 2) {
List<RequestModel> requests = await getRequestBasedOnFiltersForProvidersServiceRequest(paramsForGetRequests);
return requests;
}
GenericRespModel enumGenericModel = await apiClient.postJsonForObject(
(json) => GenericRespModel.fromJson(json),
ApiConsts.getRequest,
paramsForGetRequests,
token: appState.getUser.data!.accessToken,
);
List<RequestModel> requests = List.generate(
enumGenericModel.data.length,
(index) => RequestModel.fromJson(enumGenericModel.data[index]),
);
return requests;
}
Future<List<RequestModel>> getRequestBasedOnFiltersForProvidersServiceRequest(Map<String, Object?> parameters) async {
List<String> requestStatusList = [
RequestStatusEnum.submitted.getIdFromRequestStatusEnum().toString(),
RequestStatusEnum.completed.getIdFromRequestStatusEnum().toString(),
RequestStatusEnum.inProgress.getIdFromRequestStatusEnum().toString(),
RequestStatusEnum.paid.getIdFromRequestStatusEnum().toString(),
RequestStatusEnum.delivery.getIdFromRequestStatusEnum().toString(),
RequestStatusEnum.shipping.getIdFromRequestStatusEnum().toString(),
];
if (parameters['requestStatus'] != null && parameters['requestStatus'] != "0") {
parameters.addEntries([
MapEntry("RequestStatuses", [parameters['requestStatus'].toString()])
]);
} else {
parameters.removeWhere((key, value) => key == "requestStatus");
parameters.addEntries([MapEntry("RequestStatuses", requestStatusList)]);
}
parameters.removeWhere((key, value) => key == "providerID");
parameters.removeWhere((key, value) => key == "pageIndex");
parameters.removeWhere((key, value) => key == "pageSize");
parameters.removeWhere((key, value) => key == "doPagination");
parameters.addEntries([MapEntry("ServiceProviderId", appState.getUser.data!.userInfo!.providerId.toString())]);
log("parameters: ${parameters}");
// final parameters = {
// "ServiceProviderId": serviceProviderID.toString(),
// "RequestType": "2", // Only to get the Service Request
// "RequestStatuses": requestStatusList,
// };
GenericRespModel genericRespModel = await apiClient.getJsonForObject(
(json) => GenericRespModel.fromJson(json),
ApiConsts.getServiceRequestsForProvider,
queryParameters: parameters,
token: appState.getUser.data!.accessToken,
);
List<RequestModel> requests = List.generate(
genericRespModel.data.length,
(index) => RequestModel.fromJson(
genericRespModel.data[index],
),
);
return requests;
}
@override @override
Future<List<RequestModel>> getServiceRequestsForProviders({required int serviceProviderID}) async { Future<List<RequestModel>> getServiceRequestsForProviders({required int serviceProviderID}) async {
List<String> requestStatusList = [ List<String> requestStatusList = [
@ -121,7 +239,7 @@ class RequestRepoImp implements RequestRepo {
]; ];
final parameters = { final parameters = {
"ServiceProviderId": serviceProviderID.toString(), "ServiceProviderId": serviceProviderID.toString(),
"RequestTypeId": "2", // Only to get the Service Request "RequestType": "2", // Only to get the Service Request
"RequestStatuses": requestStatusList, "RequestStatuses": requestStatusList,
}; };
GenericRespModel genericRespModel = await apiClient.getJsonForObject( GenericRespModel genericRespModel = await apiClient.getJsonForObject(

@ -37,7 +37,7 @@ Future<ConfirmAction?> showConfirmDialogs(context, msg, positiveText, negativeTe
); );
} }
void actionConfirmationBottomSheet({required BuildContext context, required Widget title, required subtitle, required Widget actionButtonYes, required Widget actionButtonNo, Widget? confirmationWidget, bool isOnlyOneButton = false}) { void actionConfirmationBottomSheet({required BuildContext context, required Widget title, required subtitle, required Widget actionButtonYes, required Widget actionButtonNo, Widget? checkBoxConfirmationWidget, bool isOnlyOneButton = false}) {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
@ -49,9 +49,9 @@ void actionConfirmationBottomSheet({required BuildContext context, required Widg
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
"$subtitle".toText(fontSize: 14, fontWeight: MyFonts.Medium), "$subtitle".toText(fontSize: 14, fontWeight: MyFonts.Medium),
if (confirmationWidget != null) ...[ if (checkBoxConfirmationWidget != null) ...[
10.height, 10.height,
confirmationWidget, checkBoxConfirmationWidget,
], ],
25.height, 25.height,
if (isOnlyOneButton) ...[ if (isOnlyOneButton) ...[

@ -14,6 +14,8 @@ class AppEnums {
static const int myAdsFilterEnumId = 18; // My Ads Filter Enums static const int myAdsFilterEnumId = 18; // My Ads Filter Enums
static const int exploreAdsFilterEnumId = 23; // Explore Ads Filter Enums static const int exploreAdsFilterEnumId = 23; // Explore Ads Filter Enums
static const int appointmentsFilterEnumId = 13; // Appointments Filter Enums static const int appointmentsFilterEnumId = 13; // Appointments Filter Enums
static const int requestStatusesFilterEnumId = 15; // Appointments Filter Enums
static const int conditionEnumId = -1; // to get the Condition Filter Enums
} }
enum VehicleType { enum VehicleType {

@ -2,8 +2,12 @@ import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:mc_common_app/generated/locale_keys.g.dart';
import 'package:mc_common_app/utils/date_helper.dart'; import 'package:mc_common_app/utils/date_helper.dart';
import 'package:mc_common_app/utils/dialogs_and_bottomsheets.dart';
import 'package:mc_common_app/widgets/button/show_fill_button.dart';
import 'package:path/path.dart' as p; import 'package:path/path.dart' as p;
import 'package:fluttertoast/fluttertoast.dart'; import 'package:fluttertoast/fluttertoast.dart';
@ -473,15 +477,25 @@ class Utils {
} }
static String getAdsPaymentBrowserForm({required int paymentId, required int adId}) { static String getAdsPaymentBrowserForm({required int paymentId, required int adId}) {
return '<html> ' + return '<html> <head></head><body><form id="paymentForm" action="${ApiConsts.paymentWebViewUrl}" method="post"><input type="hidden" name="PaymentType" value="$paymentId"><input type="hidden" name="AdsID" value="$adId"></form><script type="text/javascript"> document.getElementById("paymentForm").submit(); </script></body></html>';
'<head></head>' + }
'<body>' +
'<form id="paymentForm" action="${ApiConsts.paymentWebViewUrl}" method="post">' + // BOTTOM SHEETS
'<input type="hidden" name="PaymentType" value="$paymentId">' + static void showHelpBottomSheet(BuildContext context) {
'<input type="hidden" name="AdsID" value="$adId">' + return actionConfirmationBottomSheet(
'</form>' + context: context,
'<script type="text/javascript"> document.getElementById("paymentForm").submit(); </script>' + title: LocaleKeys.help.tr().toText(fontSize: 28, isBold: true, letterSpacing: -1.44),
'</body>' + subtitle: LocaleKeys.customerCarePrompt.tr(),
'</html>'; isOnlyOneButton: true,
actionButtonYes: Expanded(
child: ShowFillButton(
maxHeight: 55,
title: LocaleKeys.callNow.tr(),
fontSize: 18,
onPressed: () {},
),
),
actionButtonNo: const SizedBox(),
);
} }
} }

@ -1554,7 +1554,7 @@ class AdVM extends BaseVM {
if (isForSearch) { if (isForSearch) {
EnumsModel owner = exploreAdsEnums.firstWhere((element) => element.enumValue == id.selectedId); EnumsModel owner = exploreAdsEnums.firstWhere((element) => element.enumValue == id.selectedId);
DropValue ownerValue = DropValue(owner.enumValue, "${owner.enumValueStr} Ads", ""); DropValue ownerValue = DropValue(owner.enumValue, "${owner.enumValueStr} Ads", "");
if (!ifAlreadyExist(list: vehicleYearAdSearchHistory, value: ownerValue)) { if (!ifAlreadyExist(list: vehicleAdOwnerSearchHistory, value: ownerValue)) {
addToVehicleAdOwnerSearchHistory(value: ownerValue); addToVehicleAdOwnerSearchHistory(value: ownerValue);
} }
notifyListeners(); notifyListeners();

@ -74,6 +74,8 @@ class AppointmentsVM extends BaseVM {
List<ServiceAppointmentScheduleModel> serviceAppointmentScheduleList = []; List<ServiceAppointmentScheduleModel> serviceAppointmentScheduleList = [];
List<ItemData> allSelectedItemsInAppointments = [];
bool ifItemAlreadySelected(int id) { bool ifItemAlreadySelected(int id) {
int indexFound = allSelectedItemsInAppointments.indexWhere((element) => element.id == id); int indexFound = allSelectedItemsInAppointments.indexWhere((element) => element.id == id);
if (indexFound != -1) { if (indexFound != -1) {
@ -82,18 +84,6 @@ class AppointmentsVM extends BaseVM {
return false; return false;
} }
List<ItemData> allSelectedItemsInAppointments = [];
// setupProviderAppointmentFilter() {
// appointmentsFilterOptions.clear();
// appointmentsFilterOptions.add(FilterListModel(id: 0, title: "All Appointments", isSelected: true));
// appointmentsFilterOptions.add(FilterListModel(id: 2, title: "Confirmed", isSelected: false));
// appointmentsFilterOptions.add(FilterListModel(id: 3, title: "Arrived", isSelected: false));
// appointmentsFilterOptions.add(FilterListModel(id: 7, title: "Work In Progress", isSelected: false));
// appointmentsFilterOptions.add(FilterListModel(id: 8, title: "Completed", isSelected: false));
// appointmentsFilterOptions.add(FilterListModel(id: 4, title: "Canceled", isSelected: false));
// }
Future<void> onItemsSelectedInService() async { Future<void> onItemsSelectedInService() async {
if (currentServiceSelection != null) { if (currentServiceSelection != null) {
int index = servicesInCurrentAppointment.indexWhere((element) => element.serviceId == currentServiceSelection!.serviceId!); int index = servicesInCurrentAppointment.indexWhere((element) => element.serviceId == currentServiceSelection!.serviceId!);
@ -483,12 +473,17 @@ class AppointmentsVM extends BaseVM {
int selectedSubServicesCounter = 0; int selectedSubServicesCounter = 0;
onItemUpdateOrSelected(int index, bool selected, int itemId) { void onItemUpdateOrSelected(int index, bool selected, int itemId) {
int serviceIndex = servicesInCurrentAppointment.indexWhere((element) => element.serviceId == currentServiceSelection!.serviceId!); int serviceIndex = servicesInCurrentAppointment.indexWhere((element) => element.serviceId == currentServiceSelection!.serviceId!);
// print("servicesInCurrentAppointment: ${servicesInCurrentAppointment.length}"); // print("servicesInCurrentAppointment: ${servicesInCurrentAppointment.length}");
// if (serviceIndex == -1) { if (serviceIndex == -1) {
// return; return;
// } }
log("index: $index");
log("selected: $selected");
log("itemId: $itemId");
log("servicesInCurrentAppointment: ${servicesInCurrentAppointment.length}");
serviceItemsFromApi[index].isUpdateOrSelected = selected; serviceItemsFromApi[index].isUpdateOrSelected = selected;
serviceItemsFromApi[index].isHomeSelected = isHomeTapped; serviceItemsFromApi[index].isHomeSelected = isHomeTapped;
@ -503,10 +498,13 @@ class AppointmentsVM extends BaseVM {
servicesInCurrentAppointment[serviceIndex].currentTotalServicePrice = servicesInCurrentAppointment[serviceIndex].currentTotalServicePrice + double.parse((serviceItemsFromApi[index].price) ?? "0.0"); servicesInCurrentAppointment[serviceIndex].currentTotalServicePrice = servicesInCurrentAppointment[serviceIndex].currentTotalServicePrice + double.parse((serviceItemsFromApi[index].price) ?? "0.0");
} }
} }
} } else {
if (!selected) { log("currentServiceSelection!.serviceItems: ${currentServiceSelection!.serviceItems!.length}");
selectedSubServicesCounter = selectedSubServicesCounter - 1; selectedSubServicesCounter = selectedSubServicesCounter - 1;
currentServiceSelection!.serviceItems!.removeWhere((element) => element.id == itemId); currentServiceSelection!.serviceItems!.removeWhere((element) => element.id == itemId);
log("currentServiceSelection!.serviceItems: ${currentServiceSelection!.serviceItems!.length}");
allSelectedItemsInAppointments.removeWhere((element) => element.id == itemId); allSelectedItemsInAppointments.removeWhere((element) => element.id == itemId);
servicesInCurrentAppointment[serviceIndex].currentTotalServicePrice = servicesInCurrentAppointment[serviceIndex].currentTotalServicePrice - double.parse((serviceItemsFromApi[index].price) ?? "0.0"); servicesInCurrentAppointment[serviceIndex].currentTotalServicePrice = servicesInCurrentAppointment[serviceIndex].currentTotalServicePrice - double.parse((serviceItemsFromApi[index].price) ?? "0.0");
servicesInCurrentAppointment[serviceIndex].serviceItems!.removeWhere((element) => element.id == itemId); servicesInCurrentAppointment[serviceIndex].serviceItems!.removeWhere((element) => element.id == itemId);

@ -69,14 +69,13 @@ class DashboardVmCustomer extends BaseVM {
appointmentsVM.populateBranchesFilterList(); appointmentsVM.populateBranchesFilterList();
appointmentsVM.populateAppointmentsFilterList(); appointmentsVM.populateAppointmentsFilterList();
adVM.populateAdsFilterList(); adVM.populateAdsFilterList();
requestsVM.populateRequestsFilterList(); requestsVM.populateDataForRequestsFilter();
await appointmentsVM.getMyAppointments(); await appointmentsVM.getMyAppointments();
await appointmentsVM.applyFilterOnBranches(index: 0); // to get all branches! await appointmentsVM.applyFilterOnBranches(index: 0); // to get all branches!
await appointmentsVM.getMyRecentBranches(); // to get my recent branches! await appointmentsVM.getMyRecentBranches(); // to get my recent branches!
await adVM.getMyAds(); await adVM.getMyAds();
await adVM.getExploreAds(); await adVM.getExploreAds();
await requestsVM.getRequests(appType: AppType.customer); await requestsVM.getRequests();
await adVM.getVehicleTypes(); await adVM.getVehicleTypes();
await adVM.getVehicleAdsDuration(); await adVM.getVehicleAdsDuration();
await chatVM.buildHubConnection(context); await chatVM.buildHubConnection(context);

@ -20,13 +20,13 @@ import 'package:mc_common_app/models/general_models/widgets_models.dart';
import 'package:mc_common_app/repositories/common_repo.dart'; import 'package:mc_common_app/repositories/common_repo.dart';
import 'package:mc_common_app/repositories/request_repo.dart'; import 'package:mc_common_app/repositories/request_repo.dart';
import 'package:mc_common_app/services/common_services.dart'; import 'package:mc_common_app/services/common_services.dart';
import 'package:mc_common_app/utils/date_helper.dart';
import 'package:mc_common_app/utils/enums.dart'; import 'package:mc_common_app/utils/enums.dart';
import 'package:mc_common_app/utils/navigator.dart'; import 'package:mc_common_app/utils/navigator.dart';
import 'package:mc_common_app/utils/utils.dart'; import 'package:mc_common_app/utils/utils.dart';
import 'package:mc_common_app/view_models/ad_view_model.dart'; import 'package:mc_common_app/view_models/ad_view_model.dart';
import 'package:mc_common_app/view_models/base_view_model.dart'; import 'package:mc_common_app/view_models/base_view_model.dart';
import 'package:mc_common_app/view_models/chat_view_model.dart'; import 'package:mc_common_app/view_models/chat_view_model.dart';
import 'package:mc_common_app/widgets/dropdown/dropdow_field.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
@ -44,6 +44,9 @@ class RequestsVM extends BaseVM {
List<EnumsModel> myRequestsTypeEnum = []; List<EnumsModel> myRequestsTypeEnum = [];
List<EnumsModel> vehicleConditionsEnum = [];
List<EnumsModel> requestStatusesEnum = [];
RequestModel? currentSelectedRequest; RequestModel? currentSelectedRequest;
void updateCurrentSelectedRequest(RequestModel value) { void updateCurrentSelectedRequest(RequestModel value) {
@ -64,32 +67,61 @@ class RequestsVM extends BaseVM {
notifyListeners(); notifyListeners();
} }
populateRequestsFilterList() async { Future<void> getRequests({bool isNeedToRebuild = false}) async {
if (requestsTypeFilterOptions.isNotEmpty) return; if (isNeedToRebuild) setState(ViewState.busy);
applyFilterOnRequestsVM(requestsTypeEnum: RequestsTypeEnum.specialCarRequest);
if (myRequestsTypeEnum.isEmpty) { setState(ViewState.idle);
myRequestsTypeEnum = await commonRepo.getEnumTypeValues(enumTypeID: AppEnums.requestFilterEnumId);
}
for (int i = 0; i < myRequestsTypeEnum.length; i++) {
requestsTypeFilterOptions.add(FilterListModel(title: myRequestsTypeEnum[i].enumValueStr, isSelected: false, id: myRequestsTypeEnum[i].enumValue));
}
notifyListeners();
} }
Future<void> getRequests({bool isNeedToRebuild = false, required AppType appType}) async { Future<bool> getRequestsBasedOnFilters() async {
if (isNeedToRebuild) setState(ViewState.busy); myFilteredRequests.clear();
setState(ViewState.busy);
int requestTypeIdApi = requestsTypeFilterOptions.firstWhere((element) => element.isSelected).id;
int providerOrCustomerID = 0; int requestCityIdApi = 0;
if (appType == AppType.provider) { if (vehicleCityId.selectedId != -1) {
providerOrCustomerID = AppState().getUser.data!.userInfo!.providerId ?? 0; requestCityIdApi = vehicleCityId.selectedId;
} else {
providerOrCustomerID = AppState().getUser.data!.userInfo!.customerId ?? 0;
} }
myRequests = await requestRepo.getRequests(providerOrCustomerID: providerOrCustomerID); int requestConditionIdApi = 0;
applyFilterOnRequestsVM(requestsTypeEnum: RequestsTypeEnum.specialCarRequest); if (vehicleConditionId.selectedId != -1) {
requestConditionIdApi = vehicleConditionId.selectedId;
}
int requestVehicleYearIdApi = 0;
if (vehicleYearId.selectedId != -1) {
requestVehicleYearIdApi = vehicleYearId.selectedId;
}
int requestStatusIdApi = 0;
if (requestStatusId.selectedId != -1) {
requestStatusIdApi = requestStatusId.selectedId;
}
log("requestTypeIdApi: $requestTypeIdApi");
log("requestCityIdApi: $requestCityIdApi");
log("requestConditionIdApi: $requestConditionIdApi");
log("requestVehicleBrandApi: $brand");
log("requestVehicleModelApi: $model");
log("requestVehicleYearIdApi: $requestVehicleYearIdApi");
log("requestStatusIdApi: $requestStatusIdApi");
// try {
myFilteredRequests = await requestRepo.getRequestsBasedOnFilters(
requestTypeId: requestTypeIdApi,
cityId: requestCityIdApi,
conditionId: requestConditionIdApi,
vehicleBrand: brandForSearch,
vehicleModel: modelForSearch,
vehicleYearId: requestVehicleYearIdApi,
requestStatusId: requestStatusIdApi,
requestedDate: requestedDateFilter,
);
setState(ViewState.idle); setState(ViewState.idle);
notifyListeners(); return true;
// } catch (e, s) {
// logger.i("e: ${e.toString()}");
// Utils.showToast("Need to ask Zahoor Bhai to add params for this API: /api/RequestManagement/Request_ServiceProvider");
// setState(ViewState.idle);
// return false;
// }
} }
Future<List<RequestModel>> getServiceRequestsForProviders() async { Future<List<RequestModel>> getServiceRequestsForProviders() async {
@ -127,11 +159,7 @@ class RequestsVM extends BaseVM {
value.isSelected = false; value.isSelected = false;
} }
requestsTypeFilterOptions[requestsTypeEnum.getIdFromRequestTypeStatusEnum() - 1].isSelected = true; // -1 to match with the index requestsTypeFilterOptions[requestsTypeEnum.getIdFromRequestTypeStatusEnum() - 1].isSelected = true; // -1 to match with the index
if (AppState().currentAppType == AppType.provider && requestsTypeEnum == RequestsTypeEnum.serviceRequest) { await getRequestsBasedOnFilters();
myFilteredRequests = await getServiceRequestsForProviders();
return;
}
myFilteredRequests = myRequests.where((element) => element.requestType == requestsTypeEnum.getIdFromRequestTypeStatusEnum()).toList();
notifyListeners(); notifyListeners();
} }
@ -165,18 +193,362 @@ class RequestsVM extends BaseVM {
VehicleDetailsModel? vehicleDetails; VehicleDetailsModel? vehicleDetails;
List<VehicleBrandsModel> vehicleBrands = []; List<VehicleBrandsModel> vehicleBrands = [];
List<VehicleModel> vehicleModels = []; List<VehicleModel> vehicleModels = [];
List<VehicleYearModel> vehicleModelYears = []; List<VehicleYearModel> vehicleYears = [];
List<VehicleCountryModel> vehicleCountries = []; List<VehicleCountryModel> vehicleCountries = [];
List<VehicleCityModel> vehicleCities = []; List<VehicleCityModel> vehicleCities = [];
// ************ REQUESTS SEARCH FILTER ****************
Future<void> populateDataForRequestsFilter() async {
setState(ViewState.busy);
if (myRequestsTypeEnum.isEmpty) {
myRequestsTypeEnum = await commonRepo.getEnumTypeValues(enumTypeID: AppEnums.requestFilterEnumId);
}
if (vehicleConditionsEnum.isEmpty) {
vehicleConditionsEnum = await commonRepo.getEnumTypeValues(enumTypeID: AppEnums.conditionEnumId); // to get the vehicle Condition Enum
}
if (requestStatusesEnum.isEmpty) {
requestStatusesEnum = await commonRepo.getEnumTypeValues(enumTypeID: AppEnums.requestStatusesFilterEnumId);
}
if (requestsTypeFilterOptions.isEmpty) {
for (int i = 0; i < myRequestsTypeEnum.length; i++) {
requestsTypeFilterOptions.add(FilterListModel(title: myRequestsTypeEnum[i].enumValueStr, isSelected: false, id: myRequestsTypeEnum[i].enumValue));
}
}
if (vehicleBrands.isEmpty) {
vehicleBrands = await commonRepo.getVehicleBrands(vehicleTypeId: -1);
}
if (vehicleYears.isEmpty) {
vehicleYears = await commonRepo.getVehicleModelYears(vehicleTypeId: -1);
}
if (vehicleCities.isEmpty) {
vehicleCities = await commonRepo.getVehicleCities(countryId: -1); // fetch all the cities
}
setState(ViewState.idle);
}
ifAlreadyExist({required List<DropValue> list, required DropValue value}) {
int index = list.indexWhere((element) {
return element.id == value.id;
});
if (index != -1) {
return true;
}
return false;
}
String requestedDateFilter = "";
void updateRequestedDate(String v) {
if (v.isNotEmpty) {
updateRequestsFiltersCounter(requestsFiltersCounter + 1);
} else {
updateRequestsFiltersCounter(requestsFiltersCounter - 1);
}
requestedDateFilter = v;
notifyListeners();
}
SelectionModel requestTypeId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: ""); SelectionModel requestTypeId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
void updateSelectionRequestTypeId(SelectionModel id) async { void updateSelectionRequestTypeId(SelectionModel id, {bool isForSearch = false, bool shouldCallVehicleTypes = true, bool showSelectionInDropValue = true}) async {
requestTypeId = id; if (isForSearch) {
getVehicleTypes(); EnumsModel requestEnum = myRequestsTypeEnum.firstWhere((element) => element.id == id.selectedId);
DropValue cityValue = DropValue(requestEnum.id, requestEnum.enumValueStr, "");
if (!ifAlreadyExist(list: requestTypeSearchHistory, value: cityValue)) {
addToRequestTypeSearchHistory(value: cityValue);
}
}
if (showSelectionInDropValue) {
requestTypeId = id;
}
if (shouldCallVehicleTypes) {
getVehicleTypes();
}
notifyListeners(); notifyListeners();
} }
SelectionModel requestStatusId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
void updateRequestStatusId(SelectionModel id, {bool isForSearch = false, bool showSelectionInDropValue = true}) async {
if (isForSearch) {
EnumsModel requestStatues = requestStatusesEnum.firstWhere((element) => element.enumValue == id.selectedId);
DropValue cityValue = DropValue(requestStatues.id, requestStatues.enumValueStr, "");
if (!ifAlreadyExist(list: requestStatusesSearchHistory, value: cityValue)) {
addToRequestStatusesSearchHistory(value: cityValue);
}
}
if (showSelectionInDropValue) {
requestStatusId = id;
}
notifyListeners();
}
//BRANDS
List<DropValue> vehicleBrandsSearchHistory = [];
void removeVehicleBrandsAdSearchHistory({bool isClear = false, required int index}) {
if (isClear) {
vehicleBrandsSearchHistory.clear();
notifyListeners();
return;
}
vehicleBrandsSearchHistory.removeAt(index);
if (vehicleBrandsSearchHistory.isEmpty) {
updateRequestsFiltersCounter(requestsFiltersCounter - 1);
}
notifyListeners();
}
void addToVehicleBrandsAdSearchHistory({required DropValue value}) {
if (vehicleBrandsSearchHistory.isEmpty) {
updateRequestsFiltersCounter(requestsFiltersCounter + 1);
}
vehicleBrandsSearchHistory.add(value);
notifyListeners();
} //BRANDS
List<DropValue> requestStatusesSearchHistory = [];
void removeRequestStatusesSearchHistory({bool isClear = false, required int index}) {
if (isClear) {
requestStatusesSearchHistory.clear();
notifyListeners();
return;
}
requestStatusesSearchHistory.removeAt(index);
if (requestStatusesSearchHistory.isEmpty) {
updateRequestsFiltersCounter(requestsFiltersCounter - 1);
}
notifyListeners();
}
void addToRequestStatusesSearchHistory({required DropValue value}) {
if (requestStatusesSearchHistory.isEmpty) {
updateRequestsFiltersCounter(requestsFiltersCounter + 1);
}
requestStatusesSearchHistory.add(value);
notifyListeners();
}
// REQUEST TYPE
List<DropValue> requestTypeSearchHistory = [];
void removeRequestTypeSearchHistory({bool isClear = false, required int index}) {
if (isClear) {
requestTypeSearchHistory.clear();
notifyListeners();
return;
}
requestTypeSearchHistory.removeAt(index);
if (requestTypeSearchHistory.isEmpty) {
updateRequestsFiltersCounter(requestsFiltersCounter - 1);
}
notifyListeners();
}
void addToRequestTypeSearchHistory({required DropValue value}) {
if (requestTypeSearchHistory.isEmpty) {
updateRequestsFiltersCounter(requestsFiltersCounter + 1);
}
requestTypeSearchHistory.add(value);
notifyListeners();
}
// LOCATION
List<DropValue> vehicleLocationSearchHistory = [];
void removeVehicleLocationAdSearchHistory({bool isClear = false, required int index}) {
if (isClear) {
vehicleLocationSearchHistory.clear();
notifyListeners();
return;
}
vehicleLocationSearchHistory.removeAt(index);
if (vehicleLocationSearchHistory.isEmpty) {
updateRequestsFiltersCounter(requestsFiltersCounter - 1);
}
notifyListeners();
}
void addToVehicleLocationAdSearchHistory({required DropValue value}) {
if (vehicleLocationSearchHistory.isEmpty) {
updateRequestsFiltersCounter(requestsFiltersCounter + 1);
}
vehicleLocationSearchHistory.add(value);
notifyListeners();
}
// OWNER
SelectionModel vehicleConditionId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
void updateSelectionVehicleConditionId(SelectionModel id, {bool isForSearch = false, bool showSelectionInDropValue = true}) {
if (isForSearch) {
EnumsModel owner = vehicleConditionsEnum.firstWhere((element) => element.enumValue == id.selectedId);
DropValue ownerValue = DropValue(owner.enumValue, owner.enumValueStr, "");
if (!ifAlreadyExist(list: vehicleConditionSearchHistory, value: ownerValue)) {
addToVehicleConditionSearchHistory(value: ownerValue);
}
}
if (showSelectionInDropValue) {
vehicleConditionId = id;
}
notifyListeners();
}
List<DropValue> vehicleConditionSearchHistory = [];
void removeVehicleConditionSearchHistory({bool isClear = false, required int index}) {
if (isClear) {
vehicleConditionSearchHistory.clear();
notifyListeners();
return;
}
vehicleConditionSearchHistory.removeAt(index);
if (vehicleConditionSearchHistory.isEmpty) {
updateRequestsFiltersCounter(requestsFiltersCounter - 1);
}
notifyListeners();
}
void addToVehicleConditionSearchHistory({required DropValue value}) {
if (vehicleConditionSearchHistory.isEmpty) {
updateRequestsFiltersCounter(requestsFiltersCounter + 1);
}
vehicleConditionSearchHistory.add(value);
notifyListeners();
}
// YEAR
List<DropValue> vehicleYearSearchHistory = [];
void removeVehicleYearAdSearchHistory({bool isClear = false, required int index}) {
if (isClear) {
vehicleYearSearchHistory.clear();
notifyListeners();
return;
}
vehicleYearSearchHistory.removeAt(index);
if (vehicleYearSearchHistory.isEmpty) {
updateRequestsFiltersCounter(requestsFiltersCounter - 1);
}
notifyListeners();
}
void addToVehicleYearAdSearchHistory({required DropValue value}) {
if (vehicleYearSearchHistory.isEmpty) {
updateRequestsFiltersCounter(requestsFiltersCounter + 1);
}
vehicleYearSearchHistory.add(value);
notifyListeners();
}
int requestsFiltersCounter = 0;
updateRequestsFiltersCounter(int value) {
requestsFiltersCounter = value;
notifyListeners();
}
SelectionModel vehicleBrandId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
void updateSelectionVehicleBrandId(SelectionModel id, {bool isForSearch = false, bool showSelectionInDropValue = true}) {
if (isForSearch) {
VehicleBrandsModel brand = vehicleBrands.firstWhere((element) => element.id == id.selectedId);
DropValue brandValue = DropValue(brand.id ?? 0, brand.vehicleBrandDescription ?? "", "");
if (!ifAlreadyExist(list: vehicleBrandsSearchHistory, value: brandValue)) {
addToVehicleBrandsAdSearchHistory(value: brandValue);
}
}
if (showSelectionInDropValue) {
vehicleBrandId = id;
}
vehicleModelId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
vehicleYearId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
notifyListeners();
}
SelectionModel vehicleModelId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
void updateSelectionVehicleModelId(SelectionModel id) {
vehicleModelId = id;
vehicleYearId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
notifyListeners();
}
SelectionModel vehicleYearId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
void updateSelectionVehicleYearId(SelectionModel id, {bool isForSearch = false, bool shouldSelectionInDropValue = true}) {
if (isForSearch) {
VehicleYearModel year = vehicleYears.firstWhere((element) => element.id == id.selectedId);
DropValue yearValue = DropValue(year.id ?? 0, year.modelYear ?? "", "");
if (!ifAlreadyExist(list: vehicleYearSearchHistory, value: yearValue)) {
addToVehicleYearAdSearchHistory(value: yearValue);
}
}
if (shouldSelectionInDropValue) {
vehicleYearId = id;
}
notifyListeners();
}
SelectionModel vehicleCountryId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
void updateSelectionVehicleCountryId(SelectionModel id) async {
vehicleCountryId = id;
isCountryFetching = true;
notifyListeners();
vehicleCities = await commonRepo.getVehicleCities(countryId: vehicleCountryId.selectedId);
isCountryFetching = false;
notifyListeners();
}
SelectionModel vehicleCityId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
void updateSelectionVehicleCityId(SelectionModel id, {bool isForSearch = false, bool shouldSelectionInDropValue = true}) async {
if (isForSearch) {
VehicleCityModel city = vehicleCities.firstWhere((element) => element.id == id.selectedId);
DropValue cityValue = DropValue(city.id ?? 0, city.cityName ?? "", "");
if (!ifAlreadyExist(list: vehicleLocationSearchHistory, value: cityValue)) {
addToVehicleLocationAdSearchHistory(value: cityValue);
}
}
if (shouldSelectionInDropValue) {
vehicleCityId = id;
}
notifyListeners();
}
void clearRequestsFilters() {
clearRequestFilterSelections();
vehicleBrandsSearchHistory.clear();
vehicleConditionSearchHistory.clear();
vehicleLocationSearchHistory.clear();
vehicleYearSearchHistory.clear();
requestStatusesSearchHistory.clear();
requestsFiltersCounter = 0;
notifyListeners();
}
void clearRequestFilterSelections() {
requestedDateFilter = '';
vehicleCityId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
vehicleYearId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
vehicleConditionId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
requestStatusId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
brandForSearch = "";
modelForSearch = "";
}
SelectionModel vehicleTypeId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: ""); SelectionModel vehicleTypeId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
Future<void> getVehicleTypes() async { Future<void> getVehicleTypes() async {
@ -191,12 +563,16 @@ class RequestsVM extends BaseVM {
vehicleTypeId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: ""); vehicleTypeId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
vehicleBrandId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: ""); vehicleBrandId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
vehicleModelId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: ""); vehicleModelId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
vehicleModelYearId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: ""); vehicleYearId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
vehicleCountryId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: ""); vehicleCountryId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
vehicleCityId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: ""); vehicleCityId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
vehicleConditionId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
pickedVehicleImages.clear(); pickedVehicleImages.clear();
price = ''; price = '';
model = "";
brand = "";
description = ''; description = '';
address = '';
} }
void updateSelectionVehicleTypeId(SelectionModel id) async { void updateSelectionVehicleTypeId(SelectionModel id) async {
@ -216,37 +592,14 @@ class RequestsVM extends BaseVM {
if (vehicleDetails != null) { if (vehicleDetails != null) {
vehicleBrands = vehicleDetails!.vehicleBrands!; vehicleBrands = vehicleDetails!.vehicleBrands!;
vehicleModels = vehicleDetails!.vehicleModels!; vehicleModels = vehicleDetails!.vehicleModels!;
vehicleModelYears = vehicleDetails!.vehicleModelYears!; vehicleYears = vehicleDetails!.vehicleModelYears!;
vehicleCountries = vehicleDetails!.vehicleCountries!; vehicleCountries = vehicleDetails!.vehicleCountries!;
vehicleConditionsEnum = await commonRepo.getEnumTypeValues(enumTypeID: AppEnums.conditionEnumId);
} }
isFetchingVehicleDetail = false; isFetchingVehicleDetail = false;
notifyListeners(); notifyListeners();
} }
SelectionModel vehicleBrandId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
void updateSelectionVehicleBrandId(SelectionModel id) {
vehicleBrandId = id;
vehicleModelId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
vehicleModelYearId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
notifyListeners();
}
SelectionModel vehicleModelId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
void updateSelectionVehicleModelId(SelectionModel id) {
vehicleModelId = id;
vehicleModelYearId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
notifyListeners();
}
SelectionModel vehicleModelYearId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
void updateSelectionVehicleModelYearId(SelectionModel id) {
vehicleModelYearId = id;
notifyListeners();
}
bool shippingEnabled = false; bool shippingEnabled = false;
void updateShippingEnabled(bool v) { void updateShippingEnabled(bool v) {
@ -255,28 +608,16 @@ class RequestsVM extends BaseVM {
} }
bool isCountryFetching = false; bool isCountryFetching = false;
SelectionModel vehicleCountryId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
void updateSelectionVehicleCountryId(SelectionModel id) async {
vehicleCountryId = id;
isCountryFetching = true;
notifyListeners();
vehicleCities = await commonRepo.getVehicleCities(countryId: vehicleCountryId.selectedId);
isCountryFetching = false;
notifyListeners();
}
SelectionModel vehicleCityId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
void updateSelectionVehicleCityId(SelectionModel id) {
vehicleCityId = id;
notifyListeners();
}
//Request Management //Request Management
String price = ""; String price = "";
String description = ""; String description = "";
String address = ""; String address = "";
String model = "";
String brand = "";
String modelForSearch = "";
String brandForSearch = "";
void updatePrice(String v) { void updatePrice(String v) {
price = v; price = v;
@ -290,6 +631,32 @@ class RequestsVM extends BaseVM {
address = v; address = v;
} }
void updateModel(String v) {
model = v;
}
void updateBrand(String v) {
brand = v;
}
void updateModelForSearch(String v) {
if (v.isNotEmpty) {
updateRequestsFiltersCounter(requestsFiltersCounter + 1);
} else {
updateRequestsFiltersCounter(requestsFiltersCounter - 1);
}
modelForSearch = v;
}
void updateBrandForSearch(String v) {
if (v.isNotEmpty) {
updateRequestsFiltersCounter(requestsFiltersCounter + 1);
} else {
updateRequestsFiltersCounter(requestsFiltersCounter - 1);
}
brandForSearch = v;
}
Future<RequestPostingImages> convertFileToRequestPostingImages({required File file}) async { Future<RequestPostingImages> convertFileToRequestPostingImages({required File file}) async {
List<int> imageBytes = await file.readAsBytes(); List<int> imageBytes = await file.readAsBytes();
String image = base64Encode(imageBytes); String image = base64Encode(imageBytes);
@ -299,7 +666,6 @@ class RequestsVM extends BaseVM {
Future<List<RequestPostingImages>> getVehiclePostingImageList() async { Future<List<RequestPostingImages>> getVehiclePostingImageList() async {
List<RequestPostingImages> requestImages = []; List<RequestPostingImages> requestImages = [];
log("requestImages: ${pickedVehicleImages.length}");
for (var image in pickedVehicleImages) { for (var image in pickedVehicleImages) {
var value = await convertFileToRequestPostingImages(file: File(image.filePath!)); var value = await convertFileToRequestPostingImages(file: File(image.filePath!));
@ -323,9 +689,11 @@ class RequestsVM extends BaseVM {
GenericRespModel respModel = await requestRepo.createRequest( GenericRespModel respModel = await requestRepo.createRequest(
requestTypeId: requestTypeId.selectedId, requestTypeId: requestTypeId.selectedId,
vehicleTypeId: vehicleTypeId.selectedId, vehicleTypeId: vehicleTypeId.selectedId,
brand: vehicleBrandId.selectedOption, brand: brand,
model: vehicleModelId.selectedOption, model: model,
year: vehicleModelYearId.selectedOption, year: vehicleYearId.selectedOption,
isNew: vehicleConditionId.selectedId == 1,
// 1 for new, 2 for Used
countryID: vehicleCountryId.selectedId, countryID: vehicleCountryId.selectedId,
cityID: vehicleCityId.selectedId, cityID: vehicleCityId.selectedId,
price: price, price: price,
@ -339,7 +707,7 @@ class RequestsVM extends BaseVM {
Utils.showToast(LocaleKeys.requestSuccessfullyCreated.tr()); Utils.showToast(LocaleKeys.requestSuccessfullyCreated.tr());
Navigator.pop(context); Navigator.pop(context);
resetRequestCreationForm(); resetRequestCreationForm();
await getRequests(appType: AppType.customer); await getRequests();
} else { } else {
Utils.showToast(respModel.message.toString()); Utils.showToast(respModel.message.toString());
} }
@ -358,15 +726,6 @@ class RequestsVM extends BaseVM {
} else if (vehicleTypeId.selectedId == -1) { } else if (vehicleTypeId.selectedId == -1) {
Utils.showToast(LocaleKeys.vehicle_selectValidVehicleType.tr()); Utils.showToast(LocaleKeys.vehicle_selectValidVehicleType.tr());
isValid = false; isValid = false;
} else if (vehicleBrandId.selectedId == -1) {
Utils.showToast(LocaleKeys.selectValidBrand.tr());
isValid = false;
} else if (vehicleModelId.selectedId == -1) {
Utils.showToast(LocaleKeys.selectValidModel.tr());
isValid = false;
} else if (vehicleModelYearId.selectedId == -1) {
Utils.showToast(LocaleKeys.selectValidYear.tr());
isValid = false;
} else if (vehicleCountryId.selectedId == -1) { } else if (vehicleCountryId.selectedId == -1) {
Utils.showToast(LocaleKeys.selectValidCountry.tr()); Utils.showToast(LocaleKeys.selectValidCountry.tr());
isValid = false; isValid = false;

@ -6,7 +6,6 @@ import 'package:mc_common_app/classes/consts.dart';
import 'package:mc_common_app/generated/locale_keys.g.dart'; import 'package:mc_common_app/generated/locale_keys.g.dart';
import 'package:mc_common_app/models/general_models/generic_resp_model.dart'; import 'package:mc_common_app/models/general_models/generic_resp_model.dart';
import 'package:mc_common_app/repositories/branch_repo.dart'; import 'package:mc_common_app/repositories/branch_repo.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:mc_common_app/models/provider_branches_models/branch_detail_model.dart'; import 'package:mc_common_app/models/provider_branches_models/branch_detail_model.dart';
import 'package:mc_common_app/models/provider_branches_models/profile/categroy.dart'; import 'package:mc_common_app/models/provider_branches_models/profile/categroy.dart';
@ -20,7 +19,6 @@ import 'package:mc_common_app/models/user_models/cities.dart';
import 'package:mc_common_app/models/user_models/country.dart'; import 'package:mc_common_app/models/user_models/country.dart';
import 'package:mc_common_app/repositories/common_repo.dart'; import 'package:mc_common_app/repositories/common_repo.dart';
import 'package:mc_common_app/services/common_services.dart'; import 'package:mc_common_app/services/common_services.dart';
import 'package:mc_common_app/utils/app_permission_handler.dart';
import 'package:mc_common_app/utils/enums.dart'; import 'package:mc_common_app/utils/enums.dart';
import 'package:mc_common_app/utils/navigator.dart'; import 'package:mc_common_app/utils/navigator.dart';
import 'package:mc_common_app/utils/utils.dart'; import 'package:mc_common_app/utils/utils.dart';
@ -65,6 +63,7 @@ class ServiceVM extends BaseVM {
List<ImageModel> commerceCertificates = []; List<ImageModel> commerceCertificates = [];
List<ImageModel> commercialCertificates = []; List<ImageModel> commercialCertificates = [];
List<ImageModel> vatCertificates = []; List<ImageModel> vatCertificates = [];
List<BranchDetailModel> homePageBranches = [];
void updateSelectionOpenTime(String date) { void updateSelectionOpenTime(String date) {
openTime = date; openTime = date;
@ -219,6 +218,7 @@ class ServiceVM extends BaseVM {
Future<void> getBranchAndServices() async { Future<void> getBranchAndServices() async {
setState(ViewState.busy); setState(ViewState.busy);
branches = await branchRepo.getBranchAndServices(); branches = await branchRepo.getBranchAndServices();
homePageBranches = branches!.data!.serviceProviderBranch!.where((element) => element.branchStatus == BranchStatusEnum.approvedOrActive).toList();
setState(ViewState.idle); setState(ViewState.idle);
} }

@ -647,7 +647,8 @@ class UserVM extends BaseVM {
void otherLogin(BuildContext context) { void otherLogin(BuildContext context) {
_loginOtherAccount = true; _loginOtherAccount = true;
navigateReplaceWithName(context, AppRoutes.loginWithPassword); navigateReplaceWithName(context, AppRoutes.registerSelection);
// navigateReplaceWithName(context, AppRoutes.loginWithPassword);
} }
void changeLanguage(BuildContext context) { void changeLanguage(BuildContext context) {

@ -8,7 +8,6 @@ import 'package:mc_common_app/models/general_models/widgets_models.dart';
import 'package:mc_common_app/theme/colors.dart'; import 'package:mc_common_app/theme/colors.dart';
import 'package:mc_common_app/view_models/ad_view_model.dart'; import 'package:mc_common_app/view_models/ad_view_model.dart';
import 'package:mc_common_app/views/advertisement/ad_creation_steps/ad_creation_steps_containers.dart'; import 'package:mc_common_app/views/advertisement/ad_creation_steps/ad_creation_steps_containers.dart';
import 'package:mc_common_app/views/advertisement/components/network_images_container_widget.dart';
import 'package:mc_common_app/views/advertisement/components/picked_images_container_widget.dart'; import 'package:mc_common_app/views/advertisement/components/picked_images_container_widget.dart';
import 'package:mc_common_app/widgets/dropdown/dropdow_field.dart'; import 'package:mc_common_app/widgets/dropdown/dropdow_field.dart';
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart'; import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';

@ -113,13 +113,9 @@ class _AdsDetailViewState extends State<AdsDetailView> {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Flexible( Flexible(
child: "${widget.adDetails.vehicle!.vehicleTitle} | ${widget.adDetails.vehicle!.color!.label} | ${widget.adDetails.id}".toText( child: "${widget.adDetails.vehicle!.vehicleTitle} | ${widget.adDetails.vehicle!.color!.label}".toText(fontSize: 16, maxLines: 2),
fontSize: 18,
isBold: true,
maxLines: 2,
),
), ),
(widget.adDetails.vehicle!.cityName ?? "").toText(fontSize: 10, isBold: true, color: MyColors.lightTextColor), (widget.adDetails.vehicle!.cityName ?? "").toText(fontSize: 10, color: MyColors.lightTextColor),
], ],
), ),
Row( Row(
@ -127,14 +123,11 @@ class _AdsDetailViewState extends State<AdsDetailView> {
children: [ children: [
Row( Row(
children: [ children: [
("${LocaleKeys.model.tr()}: ").toText(fontSize: 14, isBold: true, color: MyColors.lightTextColor), ("${LocaleKeys.model.tr()}: ").toText(fontSize: 12, color: MyColors.lightTextColor),
"${widget.adDetails.vehicle!.modelyear!.label}".toText( "${widget.adDetails.vehicle!.modelyear!.label}".toText(fontSize: 12),
fontSize: 14,
isBold: true,
),
], ],
), ),
"${widget.adDetails.vehicle!.countryID}".toText(fontSize: 10, isBold: true, color: MyColors.lightTextColor), "${widget.adDetails.vehicle!.countryID}".toText(fontSize: 10, color: MyColors.lightTextColor),
], ],
), ),
Row( Row(
@ -142,39 +135,30 @@ class _AdsDetailViewState extends State<AdsDetailView> {
children: [ children: [
Row( Row(
children: [ children: [
("${LocaleKeys.mileage.tr()}: ").toText(fontSize: 14, isBold: true, color: MyColors.lightTextColor), ("${LocaleKeys.mileage.tr()}: ").toText(fontSize: 12, color: MyColors.lightTextColor),
"${widget.adDetails.vehicle!.mileage!.mileageEnd}Km".toText( "${widget.adDetails.vehicle!.mileage!.mileageEnd} Km".toText(fontSize: 12),
fontSize: 14,
isBold: true,
),
], ],
), ),
widget.adDetails.createdOn != null ? DateTime.parse(widget.adDetails.createdOn!).getTimeAgo().toText(fontSize: 10, isBold: true, color: MyColors.lightTextColor) : const SizedBox(), widget.adDetails.createdOn != null ? DateTime.parse(widget.adDetails.createdOn!).getTimeAgo().toText(fontSize: 10, color: MyColors.lightTextColor) : const SizedBox(),
], ],
), ),
Row( Row(
children: [ children: [
("${LocaleKeys.transmission.tr()}: ").toText(fontSize: 14, isBold: true, color: MyColors.lightTextColor), ("${LocaleKeys.transmission.tr()}: ").toText(fontSize: 12, color: MyColors.lightTextColor),
"${widget.adDetails.vehicle!.transmission!.label}".toText( "${widget.adDetails.vehicle!.transmission!.label}".toText(fontSize: 12),
fontSize: 14,
isBold: true,
),
], ],
), ),
8.height, 8.height,
("${LocaleKeys.description.tr()}: ").toText(fontSize: 14, isBold: true, color: MyColors.lightTextColor), ("${LocaleKeys.description.tr()}: ").toText(fontSize: 12, color: MyColors.lightTextColor),
"${widget.adDetails.vehicle!.vehicleDescription}".toText( "${widget.adDetails.vehicle!.vehicleDescription}".toText(fontSize: 14),
fontSize: 14,
isBold: true,
),
if (widget.adDetails.isMyAd ?? false) ...[ if (widget.adDetails.isMyAd ?? false) ...[
8.height, 8.height,
("${LocaleKeys.demand.tr()}: ").toText(fontSize: 14, isBold: true, color: MyColors.lightTextColor), ("${LocaleKeys.demand.tr()}: ").toText(fontSize: 12, color: MyColors.lightTextColor),
Row( Row(
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
widget.adDetails.vehicle!.demandAmount!.toInt().toString().toText(fontSize: 30, height: 1.2, isBold: true), widget.adDetails.vehicle!.demandAmount!.toInt().toString().toText(fontSize: 30, height: 1.2, isBold: true),
LocaleKeys.sar.tr().toText(fontSize: 15, isBold: true, color: MyColors.lightTextColor).paddingOnly(bottom: 5), LocaleKeys.sar.tr().toText(fontSize: 15, color: MyColors.lightTextColor).paddingOnly(bottom: 5),
], ],
), ),
if (widget.adDetails.adPostStatus == AdPostStatus.expired) ...[ if (widget.adDetails.adPostStatus == AdPostStatus.expired) ...[
@ -199,7 +183,7 @@ class _AdsDetailViewState extends State<AdsDetailView> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
LocaleKeys.bankDetails.tr().toText(fontSize: 18, isBold: true), LocaleKeys.bankDetails.tr().toText(fontSize: 18),
// Row( // Row(
// children: [ // children: [
// "Full Name: ".toText(fontSize: 14, isBold: true, color: MyColors.lightTextColor), // "Full Name: ".toText(fontSize: 14, isBold: true, color: MyColors.lightTextColor),
@ -211,20 +195,14 @@ class _AdsDetailViewState extends State<AdsDetailView> {
// ), // ),
Row( Row(
children: [ children: [
("${LocaleKeys.bankName.tr()}: ").toText(fontSize: 14, isBold: true, color: MyColors.lightTextColor), ("${LocaleKeys.bankName.tr()}: ").toText(fontSize: 14, color: MyColors.lightTextColor),
(adVM.adsBankDetailsModel!.bankName ?? "").toText( (adVM.adsBankDetailsModel!.bankName ?? "").toText(fontSize: 14),
fontSize: 14,
isBold: true,
),
], ],
), ),
Row( Row(
children: [ children: [
("${LocaleKeys.iban.tr()}: ").toText(fontSize: 14, isBold: true, color: MyColors.lightTextColor), ("${LocaleKeys.iban.tr()}: ").toText(fontSize: 14, color: MyColors.lightTextColor),
(adVM.adsBankDetailsModel!.iban ?? "").toText( (adVM.adsBankDetailsModel!.iban ?? "").toText(fontSize: 14),
fontSize: 14,
isBold: true,
),
], ],
), ),
], ],
@ -243,12 +221,12 @@ class _AdsDetailViewState extends State<AdsDetailView> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
LocaleKeys.rejectionComments.tr().toText(fontSize: 13, isBold: true, color: MyColors.lightTextColor), LocaleKeys.rejectionComments.tr().toText(fontSize: 12),
Row( Row(
children: [ children: [
LocaleKeys.editAd.tr().toText(fontSize: 10, isBold: true), LocaleKeys.editAd.tr().toText(fontSize: 12),
2.width, 6.width,
const Icon(Icons.edit, size: 15), MyAssets.icEdit.buildSvg(height: 12).paddingOnly(bottom: 5),
], ],
).onPress(() async { ).onPress(() async {
Utils.showLoading(context); Utils.showLoading(context);
@ -283,7 +261,7 @@ class _AdsDetailViewState extends State<AdsDetailView> {
children: [ children: [
MyAssets.carHitIcon.buildSvg(color: MyColors.darkTextColor), MyAssets.carHitIcon.buildSvg(color: MyColors.darkTextColor),
10.width, 10.width,
LocaleKeys.damagePartPictures.tr().toText(fontSize: 16), LocaleKeys.damagePartPictures.tr().toText(fontSize: 14),
], ],
), ),
const Icon(Icons.arrow_forward_ios_rounded, size: 20) const Icon(Icons.arrow_forward_ios_rounded, size: 20)

@ -496,22 +496,35 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget {
} }
Widget pendingForReviewAction({required String pendingText}) { Widget pendingForReviewAction({required String pendingText}) {
return Column( bool isForShippingOrDelivery = false;
crossAxisAlignment: CrossAxisAlignment.center, return Center(
children: [ child: pendingText.toText(
Row( color: isForShippingOrDelivery ? MyColors.lightTextColor : MyColors.adPendingStatusColor,
children: [ fontSize: isForShippingOrDelivery ? 14 : 16,
Expanded( // isItalic: true,
child: ShowFillButton( ),
isDisabled: true, ).toContainer(
maxHeight: 55, marginAll: 5,
title: pendingText, paddingAll: 12,
onPressed: () {}, borderRadius: 8,
), width: double.infinity,
), backgroundColor: isForShippingOrDelivery ? MyColors.grey98Color.withOpacity(0.1) : MyColors.adPendingStatusColor.withOpacity(0.16),
], );
), }
],
Widget buildStatusContainer(String text, {bool isForShippingOrDelivery = true}) {
return Center(
child: text.toText(
color: isForShippingOrDelivery ? MyColors.lightTextColor : MyColors.adPendingStatusColor,
fontSize: isForShippingOrDelivery ? 14 : 16,
// isItalic: true,
),
).toContainer(
marginAll: 12,
paddingAll: 12,
borderRadius: 8,
width: double.infinity,
backgroundColor: isForShippingOrDelivery ? MyColors.grey98Color.withOpacity(0.1) : MyColors.adPendingStatusColor.withOpacity(0.16),
); );
} }

@ -90,30 +90,44 @@ class AdCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
if (isAdsFragment && !context if (isAdsFragment && !context.read<AdVM>().isExploreAdsTapped) ...[
.read<AdVM>()
.isExploreAdsTapped) ...[
Utils.statusContainerChip(text: adDetails.statuslabel!, chipColor: Utils.getChipColorByAdStatus(adDetails.adPostStatus!)), Utils.statusContainerChip(text: adDetails.statuslabel!, chipColor: Utils.getChipColorByAdStatus(adDetails.adPostStatus!)),
], ],
(adDetails.vehicle!.vehicleTitle ?? "").toText(fontSize: 16, letterSpacing: -0.64, height: 25 / 16,), (adDetails.vehicle!.vehicleTitle ?? "").toText(
fontSize: 16,
letterSpacing: -0.64,
height: 25 / 16,
),
Row( Row(
children: [ children: [
("${LocaleKeys.model.tr()}:").toText( ("${LocaleKeys.model.tr()}:").toText(
fontSize: 12,
color: MyColors.lightTextColor, color: MyColors.lightTextColor,
letterSpacing: -0.48, height: 18 / 12, letterSpacing: -0.48,
height: 18 / 12,
), ),
2.width, 2.width,
(adDetails.vehicle!.modelyear!.label ?? "").toText(fontSize: 12, letterSpacing: -0.48, height: 18 / 12,), (adDetails.vehicle!.modelyear!.label ?? "").toText(
fontSize: 12,
letterSpacing: -0.48,
height: 18 / 12,
),
], ],
), ),
Row( Row(
children: [ children: [
("${LocaleKeys.mileage.tr()}:").toText( ("${LocaleKeys.mileage.tr()}:").toText(
color: MyColors.lightTextColor, color: MyColors.lightTextColor,
fontSize: 12, letterSpacing: -0.48, height: 18 / 12, fontSize: 12,
letterSpacing: -0.48,
height: 18 / 12,
), ),
2.width, 2.width,
(adDetails.vehicle!.mileage!.mileageEnd ?? "").toText(fontSize: 12, letterSpacing: -0.48, height: 18 / 12,), (adDetails.vehicle!.mileage!.mileageEnd ?? "").toText(
fontSize: 12,
letterSpacing: -0.48,
height: 18 / 12,
),
], ],
), ),
], ],
@ -128,8 +142,8 @@ class AdCard extends StatelessWidget {
), ),
adDetails.createdOn != null adDetails.createdOn != null
? DateTime.parse(adDetails.createdOn!).getTimeAgo().toText( ? DateTime.parse(adDetails.createdOn!).getTimeAgo().toText(
color: MyColors.lightTextColor, color: MyColors.lightTextColor,
) )
: const SizedBox(), : const SizedBox(),
], ],
), ),
@ -143,13 +157,9 @@ class AdCard extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
(adDetails.vehicle!.demandAmount!.toInt().toString()).toText(fontSize: 19, isBold: true, letterSpacing: -1.16, height: 29/19), (adDetails.vehicle!.demandAmount!.toInt().toString()).toText(fontSize: 19, isBold: true, letterSpacing: -1.16, height: 29 / 19),
2.width, 2.width,
LocaleKeys.sar.tr().toText( LocaleKeys.sar.tr().toText(color: MyColors.lightTextColor, fontSize: 10, letterSpacing: -0.4, height: 16 / 10),
color: MyColors.lightTextColor,
fontSize: 10,
letterSpacing: -0.4,height: 16/10
),
], ],
), ),
), ),
@ -159,7 +169,6 @@ class AdCard extends StatelessWidget {
width: 13, width: 13,
), ),
// const Icon(Icons.arrow_forward) // const Icon(Icons.arrow_forward)
], ],
), ),

@ -46,7 +46,7 @@ class AppointmentDetailView extends StatelessWidget {
child: Row( child: Row(
children: [ children: [
getBaseActionButtonWidget( getBaseActionButtonWidget(
color: MyColors.grey98Color.withOpacity(0.3), color: MyColors.grey98Color.withOpacity(0.1),
textColor: MyColors.lightTextColor, textColor: MyColors.lightTextColor,
onPressed: () {}, onPressed: () {},
text: LocaleKeys.workInProgress.tr(), text: LocaleKeys.workInProgress.tr(),

@ -28,8 +28,7 @@ class BookAppointmentsItemView extends StatelessWidget {
onBackButtonTapped: () => Navigator.pop(context), onBackButtonTapped: () => Navigator.pop(context),
), ),
body: Consumer( body: Consumer(
builder: (BuildContext context, AppointmentsVM appointmentsVM, builder: (BuildContext context, AppointmentsVM appointmentsVM, Widget? child) {
Widget? child) {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -38,74 +37,46 @@ class BookAppointmentsItemView extends StatelessWidget {
width: double.infinity, width: double.infinity,
color: MyColors.darkTextColor, color: MyColors.darkTextColor,
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: ("${appointmentsVM.selectedSubServicesCounter} " + child: ("${appointmentsVM.selectedSubServicesCounter} " + LocaleKeys.itemsSelected.tr()).toText(fontSize: 16, color: MyColors.white).horPaddingMain(),
LocaleKeys.itemsSelected.tr())
.toText(fontSize: 16, color: MyColors.white)
.horPaddingMain(),
), ),
16.height, 16.height,
Column( Column(
children: [ children: [
LocaleKeys.workshopFullAccessServices.tr().toText( LocaleKeys.workshopFullAccessServices.tr().toText(fontSize: 12, isItalic: true, color: MyColors.lightTextColor),
fontSize: 12,
isItalic: true,
color: MyColors.lightTextColor),
8.height, 8.height,
Row( Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
LocaleKeys.changeLocationService LocaleKeys.changeLocationService.tr().toText(fontSize: 14, isBold: true),
.tr() LocaleKeys.edit.tr().toText(fontSize: 14, isBold: true, isUnderLine: true, color: MyColors.adPendingStatusColor),
.toText(fontSize: 14, isBold: true),
LocaleKeys.edit.tr().toText(
fontSize: 14,
isBold: true,
isUnderLine: true,
color: MyColors.adPendingStatusColor),
5.width, 5.width,
MyAssets.icEdit.buildSvg(width: 17), MyAssets.icEdit.buildSvg(width: 17),
], ],
).onPress(() {}), ).onPress(() {}),
16.height, 16.height,
Divider(), const Divider(),
], ],
).horPaddingMain(), ).horPaddingMain(),
appointmentsVM.serviceItemsFromApi.isEmpty appointmentsVM.serviceItemsFromApi.isEmpty
? Expanded( ? Expanded(child: Center(child: LocaleKeys.noItemstoShow.toText(fontSize: 16, color: MyColors.lightTextColor)))
child: Center(
child: LocaleKeys.noItemstoShow.toText(
fontSize: 16, color: MyColors.lightTextColor)))
: ListView.separated( : ListView.separated(
separatorBuilder: (BuildContext context, int index) => separatorBuilder: (BuildContext context, int index) => const Divider(),
Divider(),
itemCount: appointmentsVM.serviceItemsFromApi.length, itemCount: appointmentsVM.serviceItemsFromApi.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
ItemData itemData = ItemData itemData = appointmentsVM.serviceItemsFromApi[index];
appointmentsVM.serviceItemsFromApi[index];
return ServiceItemWithPriceCheckBox( return ServiceItemWithPriceCheckBox(
description: itemData.description ?? description: itemData.description ?? LocaleKeys.someDescriptionSubServices.tr(),
LocaleKeys.someDescriptionSubServices.tr(),
title: itemData.name!, title: itemData.name!,
isSelected: itemData.isUpdateOrSelected!, isSelected: itemData.isUpdateOrSelected!,
onSelection: (bool value) { onSelection: (bool value) {
print("itemId: ${itemData.id}"); print("itemId: ${itemData.id}");
appointmentsVM.onItemUpdateOrSelected(index, appointmentsVM.onItemUpdateOrSelected(index, !itemData.isUpdateOrSelected!, itemData.id!);
!itemData.isUpdateOrSelected!, itemData.id!);
}, },
priceWidget: Row( priceWidget: Row(
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
itemData.price! itemData.price!.split(".").first.toText(fontSize: 30, isBold: true),
.split(".") LocaleKeys.sar.tr().toText(fontSize: 15, isBold: true, color: MyColors.lightTextColor).paddingOnly(bottom: 5),
.first
.toText(fontSize: 30, isBold: true),
LocaleKeys.sar
.tr()
.toText(
fontSize: 15,
isBold: true,
color: MyColors.lightTextColor)
.paddingOnly(bottom: 5),
], ],
), ),
); );
@ -113,17 +84,13 @@ class BookAppointmentsItemView extends StatelessWidget {
).expand(), ).expand(),
Column( Column(
children: [ children: [
Divider( const Divider(height: 1, thickness: 0.7),
height: 1,
thickness: 0.7,
),
8.height, 8.height,
if (appointmentsVM.selectSubServicesError != "") if (appointmentsVM.selectSubServicesError != "")
Row( Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
appointmentsVM.selectSubServicesError appointmentsVM.selectSubServicesError.toText(fontSize: 14, color: Colors.red),
.toText(fontSize: 14, color: Colors.red),
], ],
).paddingOnly(right: 10), ).paddingOnly(right: 10),
8.height, 8.height,
@ -135,8 +102,7 @@ class BookAppointmentsItemView extends StatelessWidget {
maxHeight: 55, maxHeight: 55,
title: LocaleKeys.cancel.tr(), title: LocaleKeys.cancel.tr(),
onPressed: () { onPressed: () {
appointmentsVM appointmentsVM.resetCategorySelectionBottomSheet();
.resetCategorySelectionBottomSheet();
pop(context); pop(context);
}, },
backgroundColor: MyColors.greyButtonColor, backgroundColor: MyColors.greyButtonColor,
@ -150,8 +116,7 @@ class BookAppointmentsItemView extends StatelessWidget {
maxHeight: 55, maxHeight: 55,
title: LocaleKeys.next.tr(), title: LocaleKeys.next.tr(),
onPressed: () async { onPressed: () async {
bool resp = bool resp = appointmentsVM.validateItemsSelection();
appointmentsVM.validateItemsSelection();
if (resp) { if (resp) {
appointmentsVM.onItemsSelectedInService(); appointmentsVM.onItemsSelectedInService();
Navigator.pop(context); Navigator.pop(context);
@ -165,10 +130,7 @@ class BookAppointmentsItemView extends StatelessWidget {
// Navigator.of(context).pushReplacementNamed(AppRoutes.bookAppointmenServicesView); // Navigator.of(context).pushReplacementNamed(AppRoutes.bookAppointmenServicesView);
// } // }
}, },
backgroundColor: !appointmentsVM backgroundColor: !appointmentsVM.isServiceSelectionValidated() ? MyColors.lightTextColor.withOpacity(0.6) : MyColors.darkPrimaryColor,
.isServiceSelectionValidated()
? MyColors.lightTextColor.withOpacity(0.6)
: MyColors.darkPrimaryColor,
); );
}, },
), ),

@ -49,27 +49,30 @@ class ReviewAppointment extends StatelessWidget {
children: [ children: [
(appointmentsVM.selectedBranchModel!.branchName ?? "").toText(fontSize: 16, isBold: true), (appointmentsVM.selectedBranchModel!.branchName ?? "").toText(fontSize: 16, isBold: true),
Row( Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
LocaleKeys.location.tr().toText(color: MyColors.lightTextColor, fontSize: 12), Flexible(
2.width, child: (appointmentsVM.selectedBranchModel!.branchDescription ?? "").toText(fontSize: 12),
": ${appointmentsVM.selectedBranchModel!.branchDescription ?? ""}".toText(fontSize: 12), ),
], ],
), ),
], ],
), ),
), ),
Row( if (appointmentsVM.selectedBranchModel!.branchRateAvg != null && appointmentsVM.selectedBranchModel!.branchRateAvg != 0.0) ...[
mainAxisAlignment: MainAxisAlignment.start, Row(
children: [ mainAxisAlignment: MainAxisAlignment.start,
"4.9".toText( children: [
isUnderLine: true, "${appointmentsVM.selectedBranchModel!.branchRateAvg}".toText(
isBold: true, isUnderLine: true,
fontSize: 12, isBold: true,
), fontSize: 12,
2.width, ),
MyAssets.starIcon.buildSvg(width: 12), 2.width,
], MyAssets.starIcon.buildSvg(width: 12),
), ],
),
]
], ],
), ),
], ],
@ -152,11 +155,11 @@ class ReviewAppointment extends StatelessWidget {
LocaleKeys.timeLocation.tr().toText(fontSize: 16, isBold: true), LocaleKeys.timeLocation.tr().toText(fontSize: 16, isBold: true),
3.height, 3.height,
Row(children: [ Row(children: [
LocaleKeys.dateAndTime.tr().toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true), "${LocaleKeys.dateAndTime.tr()}: ".toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true),
"${scheduleData.selectedCustomTimeDateSlotModel!.date!.date} at ${selectedTimeSlot}".toText(fontSize: 12, isBold: true), "${scheduleData.selectedCustomTimeDateSlotModel!.date!.date} at ${selectedTimeSlot}".toText(fontSize: 12, isBold: true),
]), ]),
Row(children: [ Row(children: [
("${LocaleKeys.location.tr()} ").toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true), ("${LocaleKeys.location.tr()}: ").toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true),
(scheduleData.appointmentType == 2 ? LocaleKeys.home.tr() : LocaleKeys.workshop.tr()).toText(fontSize: 12, isBold: true), (scheduleData.appointmentType == 2 ? LocaleKeys.home.tr() : LocaleKeys.workshop.tr()).toText(fontSize: 12, isBold: true),
]), ]),
], ],
@ -202,7 +205,7 @@ class ReviewAppointment extends StatelessWidget {
], ],
), ),
], ],
).toWhiteContainer(width: double.infinity, allPading: 12, margin: const EdgeInsets.fromLTRB(21 , 0, 21, 12)); ).toWhiteContainer(width: double.infinity, allPading: 12, margin: const EdgeInsets.fromLTRB(21, 0, 21, 12));
}, },
); );
} }

@ -78,7 +78,7 @@ class CommonAppointmentSliderWidget extends StatelessWidget {
decoration: const BoxDecoration(shape: BoxShape.circle, color: MyColors.darkTextColor), decoration: const BoxDecoration(shape: BoxShape.circle, color: MyColors.darkTextColor),
child: const Icon(Icons.add, color: MyColors.white), child: const Icon(Icons.add, color: MyColors.white),
), ),
).padding(const EdgeInsets.symmetric(vertical: 10, horizontal: 21)); ).padding(const EdgeInsets.symmetric(vertical: 10, horizontal: 0));
} else { } else {
return getCarouselSliderWidget(AppState().currentAppType, model); return getCarouselSliderWidget(AppState().currentAppType, model);
} }

@ -23,7 +23,7 @@ void dealCompletedConfirmationBottomSheet({required BuildContext mainContext, re
context: mainContext, context: mainContext,
title: LocaleKeys.doYouWantToCompleteThisDeal.tr().toText(fontSize: 26, isBold: true, letterSpacing: -1.44), title: LocaleKeys.doYouWantToCompleteThisDeal.tr().toText(fontSize: 26, isBold: true, letterSpacing: -1.44),
subtitle: AppState().currentAppType == AppType.provider ? LocaleKeys.providerCompletingDealMeansThat.tr() : LocaleKeys.customerCompletingDealMeansThat.tr(), subtitle: AppState().currentAppType == AppType.provider ? LocaleKeys.providerCompletingDealMeansThat.tr() : LocaleKeys.customerCompletingDealMeansThat.tr(),
confirmationWidget: Consumer(builder: (BuildContext context, ChatVM chatVM, Widget? child) { checkBoxConfirmationWidget: Consumer(builder: (BuildContext context, ChatVM chatVM, Widget? child) {
return Row( return Row(
children: [ children: [
Expanded( Expanded(

@ -3,7 +3,6 @@ import 'package:mc_common_app/classes/app_state.dart';
import 'package:mc_common_app/classes/consts.dart'; import 'package:mc_common_app/classes/consts.dart';
import 'package:mc_common_app/config/routes.dart'; import 'package:mc_common_app/config/routes.dart';
import 'package:mc_common_app/generated/locale_keys.g.dart'; import 'package:mc_common_app/generated/locale_keys.g.dart';
import 'package:mc_common_app/models/requests_models/request_model.dart';
import 'package:mc_common_app/utils/dialogs_and_bottomsheets.dart'; import 'package:mc_common_app/utils/dialogs_and_bottomsheets.dart';
import 'package:mc_common_app/utils/navigator.dart'; import 'package:mc_common_app/utils/navigator.dart';
import 'package:mc_common_app/view_models/requests_view_model.dart'; import 'package:mc_common_app/view_models/requests_view_model.dart';
@ -40,7 +39,7 @@ class MyRequestsFragment extends StatelessWidget {
bool status = await requestVM.onActionRequestTapped(context: context, requestStatusEnum: RequestStatusEnum.cancelled, requestId: requestId); bool status = await requestVM.onActionRequestTapped(context: context, requestStatusEnum: RequestStatusEnum.cancelled, requestId: requestId);
if (status) { if (status) {
await requestVM.getRequests(isNeedToRebuild: true, appType: AppType.provider); await requestVM.getRequests(isNeedToRebuild: true);
} }
}, },
), ),
@ -70,22 +69,36 @@ class MyRequestsFragment extends StatelessWidget {
return true; return true;
} }
return false; return false;
;
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Consumer(builder: (BuildContext context, RequestsVM requestsVM, Widget? child) {
appBar: CustomAppBar( return Scaffold(
title: LocaleKeys.myRequests.tr(), appBar: CustomAppBar(
isRemoveBackButton: true, title: LocaleKeys.myRequests.tr(),
), isRemoveBackButton: true,
body: Container( actions: [
color: MyColors.backgroundColor, Padding(
width: double.infinity, padding: EdgeInsets.only(top: requestsVM.requestsFiltersCounter > 0 ? 20 : 0, right: 21),
height: double.infinity, child: Badge(
child: Consumer(builder: (BuildContext context, RequestsVM requestsVM, Widget? child) { isLabelVisible: requestsVM.requestsFiltersCounter > 0,
return Column( largeSize: 15,
smallSize: 20,
backgroundColor: MyColors.darkPrimaryColor,
label: Text('${requestsVM.requestsFiltersCounter}'),
child: MyAssets.searchIcon.buildSvg(),
),
).onPress(() {
navigateWithName(context, AppRoutes.requestsFilterView);
})
],
),
body: Container(
color: MyColors.backgroundColor,
width: double.infinity,
height: double.infinity,
child: Column(
children: [ children: [
16.height, 16.height,
FiltersList( FiltersList(
@ -97,7 +110,7 @@ class MyRequestsFragment extends StatelessWidget {
8.height, 8.height,
Expanded( Expanded(
child: RefreshIndicator( child: RefreshIndicator(
onRefresh: () async => await requestsVM.getRequests(isNeedToRebuild: true, appType: AppType.provider), onRefresh: () async => await requestsVM.getRequests(isNeedToRebuild: true),
child: requestsVM.state == ViewState.busy child: requestsVM.state == ViewState.busy
? const Center(child: CircularProgressIndicator()) ? const Center(child: CircularProgressIndicator())
: requestsVM.myFilteredRequests.isEmpty : requestsVM.myFilteredRequests.isEmpty
@ -105,6 +118,20 @@ class MyRequestsFragment extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
LocaleKeys.noRequeststoShow.tr().toText(fontSize: 16, color: MyColors.lightTextColor), LocaleKeys.noRequeststoShow.tr().toText(fontSize: 16, color: MyColors.lightTextColor),
if (requestsVM.requestsFiltersCounter > 0) ...[
8.height,
InkWell(
onTap: () async {
requestsVM.clearRequestsFilters();
await requestsVM.getRequestsBasedOnFilters();
},
child: LocaleKeys.clearFilters.tr().toText(
fontSize: 14,
isBold: true,
color: MyColors.darkPrimaryColor,
),
),
],
], ],
) )
: ListView.separated( : ListView.separated(
@ -126,6 +153,7 @@ class MyRequestsFragment extends StatelessWidget {
direction: shouldDismiss(requestsVM.myFilteredRequests[index].requestStatus) ? DismissDirection.endToStart : DismissDirection.none, direction: shouldDismiss(requestsVM.myFilteredRequests[index].requestStatus) ? DismissDirection.endToStart : DismissDirection.none,
confirmDismiss: (DismissDirection direction) async { confirmDismiss: (DismissDirection direction) async {
cancelRequestBottomSheet(context, requestsVM.myFilteredRequests[index].id); cancelRequestBottomSheet(context, requestsVM.myFilteredRequests[index].id);
return;
}, },
child: RequestItem(request: requestsVM.myFilteredRequests[index], appType: AppState().currentAppType, requestIndex: index), child: RequestItem(request: requestsVM.myFilteredRequests[index], appType: AppState().currentAppType, requestIndex: index),
); );
@ -138,19 +166,19 @@ class MyRequestsFragment extends StatelessWidget {
), ),
)) ))
], ],
); ),
}), ),
), floatingActionButton: AppState().currentAppType == AppType.customer
floatingActionButton: AppState().currentAppType == AppType.customer ? FloatingActionButton(
? FloatingActionButton( onPressed: () => navigateWithName(context, AppRoutes.createRequestPage),
onPressed: () => navigateWithName(context, AppRoutes.createRequestPage), backgroundColor: MyColors.darkPrimaryColor,
backgroundColor: MyColors.darkPrimaryColor, child: const Icon(
child: const Icon( Icons.add,
Icons.add, color: MyColors.white,
color: MyColors.white, ),
), )
) : null,
: null, );
); });
} }
} }

@ -87,49 +87,49 @@ class CreateRequestPage extends StatelessWidget {
] else ...[ ] else ...[
Column( Column(
children: [ children: [
Builder(builder: (context) { TxtField(
List<DropValue> vehicleBrandsDrop = []; hint: LocaleKeys.brand.tr(),
for (var element in requestsVM.vehicleBrands) { value: requestsVM.brand,
vehicleBrandsDrop.add(DropValue(element.id?.toInt() ?? 0, element.vehicleBrandDescription ?? "", "")); onChanged: (e) => requestsVM.updateBrand(e),
} ),
return DropdownField(
(DropValue value) => requestsVM.updateSelectionVehicleBrandId(SelectionModel(selectedId: value.id, selectedOption: value.value)),
list: vehicleBrandsDrop,
dropdownValue: requestsVM.vehicleBrandId.selectedId != -1 ? DropValue(requestsVM.vehicleBrandId.selectedId, requestsVM.vehicleBrandId.selectedOption, "") : null,
hint: LocaleKeys.brand.tr(),
errorValue: requestsVM.vehicleBrandId.errorValue,
);
}),
8.height, 8.height,
Builder(builder: (context) { TxtField(
List<DropValue> vehicleModelsDrop = []; hint: LocaleKeys.model.tr(),
for (var element in requestsVM.vehicleModels) { value: requestsVM.model,
if (requestsVM.vehicleBrandId.selectedId == element.vehicleBrandID) vehicleModelsDrop.add(DropValue(element.id?.toInt() ?? 0, element.model ?? "", "")); onChanged: (e) => requestsVM.updateModel(e),
} ),
return DropdownField(
(DropValue value) => requestsVM.updateSelectionVehicleModelId(SelectionModel(selectedId: value.id, selectedOption: value.value)),
list: vehicleModelsDrop,
dropdownValue: requestsVM.vehicleModelId.selectedId != -1 ? DropValue(requestsVM.vehicleModelId.selectedId, requestsVM.vehicleModelId.selectedOption, "") : null,
hint: LocaleKeys.model.tr(),
errorValue: requestsVM.vehicleModelId.errorValue,
);
}),
8.height, 8.height,
Builder(builder: (context) { Builder(builder: (context) {
List<DropValue> vehicleYearModelsDrop = []; List<DropValue> vehicleYearModelsDrop = [];
for (var element in requestsVM.vehicleModelYears) { for (var element in requestsVM.vehicleYears) {
vehicleYearModelsDrop.add(DropValue(element.id?.toInt() ?? 0, element.modelYear ?? "", "")); vehicleYearModelsDrop.add(DropValue(element.id?.toInt() ?? 0, element.modelYear ?? "", ""));
} }
return DropdownField( return DropdownField(
(DropValue value) => requestsVM.updateSelectionVehicleModelYearId(SelectionModel(selectedId: value.id, selectedOption: value.value)), (DropValue value) => requestsVM.updateSelectionVehicleYearId(SelectionModel(selectedId: value.id, selectedOption: value.value)),
list: vehicleYearModelsDrop, list: vehicleYearModelsDrop,
dropdownValue: requestsVM.vehicleModelYearId.selectedId != -1 ? DropValue(requestsVM.vehicleModelYearId.selectedId, requestsVM.vehicleModelYearId.selectedOption, "") : null, dropdownValue: requestsVM.vehicleYearId.selectedId != -1 ? DropValue(requestsVM.vehicleYearId.selectedId, requestsVM.vehicleYearId.selectedOption, "") : null,
hint: LocaleKeys.year.tr(), hint: LocaleKeys.year.tr(),
errorValue: requestsVM.vehicleModelYearId.errorValue, errorValue: requestsVM.vehicleYearId.errorValue,
); );
}), }),
8.height, 8.height,
Builder(
builder: (context) {
List<DropValue> vehicleOwnerDrop = [];
for (var element in requestsVM.vehicleConditionsEnum) {
vehicleOwnerDrop.add(DropValue(element.id.toInt(), element.enumValueStr, ""));
}
return DropdownField(
(DropValue value) => requestsVM.updateSelectionVehicleConditionId(SelectionModel(selectedId: value.id, selectedOption: value.value), isForSearch: true),
list: vehicleOwnerDrop,
dropdownValue: requestsVM.vehicleConditionId.selectedId != -1 ? DropValue(requestsVM.vehicleConditionId.selectedId, requestsVM.vehicleConditionId.selectedOption, "") : null,
hint: LocaleKeys.condition.tr(),
errorValue: requestsVM.vehicleConditionId.errorValue,
);
},
),
8.height,
Builder(builder: (context) { Builder(builder: (context) {
List<DropValue> vehicleCountriesDrop = []; List<DropValue> vehicleCountriesDrop = [];
for (var element in requestsVM.vehicleCountries) { for (var element in requestsVM.vehicleCountries) {

@ -62,28 +62,17 @@ class OfferListPage extends StatelessWidget {
children: [ children: [
Row( Row(
children: [ children: [
"${offersModel.companyName}".toText( "${offersModel.companyName}".toText(color: MyColors.lightTextColor, fontSize: 14),
color: MyColors.lightTextColor, if (offersModel.createdOn != null && offersModel.createdOn!.isNotEmpty) ...[
fontSize: 12, " | ${DateTime.parse(offersModel.createdOn!).getTimeAgo()}".toText(color: MyColors.lightTextColor, fontSize: 14),
), ],
// " | 1 hour ago".toText(
//TODO: createdOn parameter need to be added in the backend // color: MyColors.lightTextColor,
// if (offersModel.createdOn != null) ...[ // fontSize: 12,
// DateTime.parse(offersModel.createdOn!).getTimeAgo().toText( // ),
// color: MyColors.lightTextColor,
// ),
// ],
" | 1 hour ago".toText(
color: MyColors.lightTextColor,
fontSize: 12,
),
], ],
), ),
const Icon( const Icon(Icons.arrow_forward, color: MyColors.darkIconColor, size: 18),
Icons.arrow_forward,
color: MyColors.darkIconColor,
size: 18,
),
], ],
), ),
], ],

@ -8,8 +8,6 @@ import 'package:mc_common_app/theme/colors.dart';
import 'package:mc_common_app/utils/enums.dart'; import 'package:mc_common_app/utils/enums.dart';
import 'package:mc_common_app/utils/navigator.dart'; import 'package:mc_common_app/utils/navigator.dart';
import 'package:mc_common_app/utils/utils.dart'; import 'package:mc_common_app/utils/utils.dart';
import 'package:mc_common_app/view_models/chat_view_model.dart';
import 'package:mc_common_app/view_models/dashboard_view_model_customer.dart';
import 'package:mc_common_app/view_models/requests_view_model.dart'; import 'package:mc_common_app/view_models/requests_view_model.dart';
import 'package:mc_common_app/widgets/button/show_fill_button.dart'; import 'package:mc_common_app/widgets/button/show_fill_button.dart';
import 'package:mc_common_app/widgets/checkbox_with_title_desc.dart'; import 'package:mc_common_app/widgets/checkbox_with_title_desc.dart';
@ -168,7 +166,7 @@ Future buildRequestStatusUpdateSheetForProvider({required BuildContext mainConte
status = await requestVM.onActionRequestTapped(context: mainContext, requestStatusEnum: RequestStatusEnum.delivery, requestId: requestId); status = await requestVM.onActionRequestTapped(context: mainContext, requestStatusEnum: RequestStatusEnum.delivery, requestId: requestId);
} }
if (status) { if (status) {
await requestVM.getRequests(isNeedToRebuild: true, appType: AppType.provider); await requestVM.getRequests(isNeedToRebuild: true);
pop(mainContext); pop(mainContext);
} }
}, },

@ -0,0 +1,272 @@
import 'dart:async';
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:mc_common_app/classes/consts.dart';
import 'package:mc_common_app/extensions/int_extensions.dart';
import 'package:mc_common_app/extensions/string_extensions.dart';
import 'package:mc_common_app/generated/locale_keys.g.dart';
import 'package:mc_common_app/main.dart';
import 'package:mc_common_app/models/general_models/widgets_models.dart';
import 'package:mc_common_app/theme/colors.dart';
import 'package:mc_common_app/utils/enums.dart';
import 'package:mc_common_app/utils/utils.dart';
import 'package:mc_common_app/view_models/requests_view_model.dart';
import 'package:mc_common_app/widgets/button/show_fill_button.dart';
import 'package:mc_common_app/widgets/common_widgets/app_bar.dart';
import 'package:mc_common_app/widgets/common_widgets/search_entity_widget.dart';
import 'package:mc_common_app/widgets/dropdown/dropdow_field.dart';
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
import 'package:mc_common_app/widgets/txt_field.dart';
import 'package:provider/provider.dart';
import 'package:easy_localization/easy_localization.dart';
class RequestsFilterView extends StatefulWidget {
const RequestsFilterView({super.key});
@override
State<RequestsFilterView> createState() => _RequestsFilterViewState();
}
class _RequestsFilterViewState extends State<RequestsFilterView> {
late RequestsVM requestsVM;
@override
void initState() {
requestsVM = context.read<RequestsVM>();
scheduleMicrotask(() async {
await requestsVM.populateDataForRequestsFilter();
});
super.initState();
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: CustomAppBar(
title: LocaleKeys.requestsFilter.tr(),
profileImageUrl: MyAssets.bnCar,
isRemoveBackButton: false,
isDrawerEnabled: false,
onBackButtonTapped: () {
// context.read<RequestsVM>().resetValues();
Navigator.pop(context);
},
),
body: Consumer<RequestsVM>(
builder: (BuildContext context, RequestsVM requestVM, Widget? child) {
if (requestVM.state == ViewState.busy) {
return const Center(
child: CircularProgressIndicator(),
);
}
return WillPopScope(
onWillPop: () async {
requestVM.clearRequestFilterSelections();
return true;
},
child: Column(
children: [
ListView(
children: [
20.height,
// SearchEntityWidget(
// title: LocaleKeys.searchByRequestType.tr(),
// actionWidget: Builder(builder: (context) {
// List<DropValue> requestTypeDrop = [];
// for (var element in requestsVM.myRequestsTypeEnum) {
// requestTypeDrop.add(DropValue(element.id.toInt(), element.enumValueStr, ""));
// }
// return DropdownField(
// (DropValue value) => requestsVM.updateSelectionRequestTypeId(SelectionModel(selectedId: value.id, selectedOption: value.value), shouldCallVehicleTypes: false, isForSearch: true),
// list: requestTypeDrop,
// dropdownValue: requestsVM.requestTypeId.selectedId != -1 ? DropValue(requestsVM.requestTypeId.selectedId, requestsVM.requestTypeId.selectedOption, "") : null,
// hint: LocaleKeys.selectRequestType.tr(),
// errorValue: requestsVM.requestTypeId.errorValue,
// );
// }),
// historyContent: const [],
// // This is commented out because in the document it is only single value search not with the list value search. May be we can do that in future
// onHistoryItemDeleted: (index) => requestVM.removeRequestTypeSearchHistory(index: index),
// onHistoryItemTapped: (DropValue value) => null,
// ),
// const Divider(thickness: 1.2).paddingOnly(top: 7, bottom: 7),
SearchEntityWidget(
title: LocaleKeys.searchByRequestStatus.tr(),
actionWidget: Builder(builder: (context) {
List<DropValue> requestTypeDrop = [];
for (var element in requestsVM.requestStatusesEnum) {
requestTypeDrop.add(DropValue(element.enumValue.toInt(), element.enumValueStr, ""));
}
return DropdownField(
(DropValue value) => requestsVM.updateRequestStatusId(SelectionModel(selectedId: value.id, selectedOption: value.value), isForSearch: true),
list: requestTypeDrop,
dropdownValue: requestsVM.requestStatusId.selectedId != -1 ? DropValue(requestsVM.requestStatusId.selectedId, requestsVM.requestStatusId.selectedOption, "") : null,
hint: LocaleKeys.selectRequestStatus.tr(),
errorValue: requestsVM.requestStatusId.errorValue,
);
}),
historyContent: const [],
onHistoryItemDeleted: (index) => requestVM.removeRequestStatusesSearchHistory(index: index),
onHistoryItemTapped: (DropValue value) => null,
),
const Divider(thickness: 1.2).paddingOnly(top: 7, bottom: 7),
SearchEntityWidget(
title: LocaleKeys.searchByCity.tr(),
actionWidget: Builder(builder: (context) {
List<DropValue> vehicleBrandsDrop = [];
for (var element in requestVM.vehicleCities) {
vehicleBrandsDrop.add(DropValue(element.id?.toInt() ?? 0, element.cityName ?? "", ""));
}
return DropdownField(
(DropValue value) => requestVM.updateSelectionVehicleCityId(SelectionModel(selectedId: value.id, selectedOption: value.value), isForSearch: true),
list: vehicleBrandsDrop,
dropdownValue: requestVM.vehicleCityId.selectedId != -1 ? DropValue(requestVM.vehicleCityId.selectedId, requestVM.vehicleCityId.selectedOption, "") : null,
hint: LocaleKeys.selectCity.tr(),
errorValue: requestVM.vehicleCityId.errorValue,
);
}),
historyContent: const [],
onHistoryItemDeleted: (index) => requestVM.removeVehicleLocationAdSearchHistory(index: index),
onHistoryItemTapped: (DropValue value) => null,
),
const Divider(thickness: 1.2).paddingOnly(top: 7, bottom: 7),
SearchEntityWidget(
title: LocaleKeys.searchByBrandName.tr(),
actionWidget: TxtField(
hint: LocaleKeys.brand.tr(),
value: requestsVM.brandForSearch,
onChanged: (e) => requestsVM.updateBrandForSearch(e),
),
historyContent: const [],
onHistoryItemDeleted: (index) => requestVM.removeVehicleBrandsAdSearchHistory(index: index),
onHistoryItemTapped: (DropValue value) => null,
),
const Divider(thickness: 1.2).paddingOnly(top: 7, bottom: 7),
SearchEntityWidget(
title: LocaleKeys.searchByVehicleModel.tr(),
actionWidget: TxtField(
hint: LocaleKeys.model.tr(),
value: requestsVM.modelForSearch,
onChanged: (e) => requestsVM.updateModelForSearch(e),
),
historyContent: const [],
onHistoryItemDeleted: (index) => requestVM.removeVehicleBrandsAdSearchHistory(index: index),
onHistoryItemTapped: (DropValue value) => null,
),
const Divider(thickness: 1.2).paddingOnly(top: 7, bottom: 7),
SearchEntityWidget(
title: LocaleKeys.searchByVehicleYear.tr(),
actionWidget: Builder(
builder: (context) {
List<DropValue> vehicleBrandsDrop = [];
for (var element in requestVM.vehicleYears) {
vehicleBrandsDrop.add(DropValue(element.id?.toInt() ?? 0, element.modelYear ?? "", ""));
}
return DropdownField(
(DropValue value) => requestVM.updateSelectionVehicleYearId(SelectionModel(selectedId: value.id, selectedOption: value.value), isForSearch: true),
list: vehicleBrandsDrop,
dropdownValue: requestVM.vehicleYearId.selectedId != -1 ? DropValue(requestVM.vehicleYearId.selectedId, requestVM.vehicleYearId.selectedOption, "") : null,
hint: LocaleKeys.selectYear.tr(),
errorValue: requestVM.vehicleYearId.errorValue,
);
},
),
historyContent: const [],
onHistoryItemDeleted: (index) => requestVM.removeVehicleYearAdSearchHistory(index: index),
onHistoryItemTapped: (DropValue value) => null,
),
const Divider(thickness: 1.2).paddingOnly(top: 7, bottom: 7),
SearchEntityWidget(
title: LocaleKeys.searchByRequestedDate.tr(),
actionWidget: TxtField(
isBackgroundEnabled: true,
isNeedBorder: true,
hint: LocaleKeys.selectDate.tr(),
value: requestVM.requestedDateFilter,
isNeedClickAll: true,
postFixDataColor: MyColors.darkTextColor,
onTap: () async {
final formattedDate = await Utils.pickDateFromDatePicker(context, lastDate: DateTime.now(), firstDate: DateTime(2020));
requestsVM.updateRequestedDate(formattedDate);
},
),
historyContent: const [],
onHistoryItemDeleted: (index) => requestVM.removeVehicleConditionSearchHistory(index: index),
onHistoryItemTapped: (DropValue value) => null,
),
const Divider(thickness: 1.2).paddingOnly(top: 7, bottom: 7),
SearchEntityWidget(
title: LocaleKeys.searchByCondition.tr(),
actionWidget: Builder(
builder: (context) {
List<DropValue> vehicleOwnerDrop = [];
for (var element in requestVM.vehicleConditionsEnum) {
vehicleOwnerDrop.add(DropValue(element.id.toInt(), element.enumValueStr, ""));
}
return DropdownField(
(DropValue value) => requestVM.updateSelectionVehicleConditionId(SelectionModel(selectedId: value.id, selectedOption: value.value), isForSearch: true),
list: vehicleOwnerDrop,
dropdownValue: requestVM.vehicleConditionId.selectedId != -1 ? DropValue(requestVM.vehicleConditionId.selectedId, requestVM.vehicleConditionId.selectedOption, "") : null,
hint: LocaleKeys.selectCondition.tr(),
errorValue: requestVM.vehicleConditionId.errorValue,
);
},
),
historyContent: const [],
onHistoryItemDeleted: (index) => requestVM.removeVehicleConditionSearchHistory(index: index),
onHistoryItemTapped: (DropValue value) => null,
),
],
).expand(),
Container(
color: MyColors.white,
child: Column(
children: [
5.height,
Row(
children: [
Expanded(
child: ShowFillButton(
maxHeight: 55,
title: LocaleKeys.search.tr(),
onPressed: () async {
bool status = await requestVM.getRequestsBasedOnFilters();
if (status) {
Navigator.pop(context);
}
},
backgroundColor: MyColors.darkPrimaryColor,
txtColor: MyColors.white,
fontSize: 18,
),
)
],
),
8.height,
InkWell(
onTap: () {
requestsVM.clearRequestsFilters();
},
child: LocaleKeys.clearFilters.tr().toText(
fontSize: 14,
isBold: true,
color: MyColors.darkPrimaryColor,
),
),
10.height,
],
),
),
],
).horPaddingMain(),
);
},
),
);
}
}

@ -1,5 +1,4 @@
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:mc_common_app/classes/app_state.dart'; import 'package:mc_common_app/classes/app_state.dart';
import 'package:mc_common_app/classes/consts.dart'; import 'package:mc_common_app/classes/consts.dart';
@ -11,6 +10,7 @@ import 'package:mc_common_app/models/user_models/user.dart';
import 'package:mc_common_app/utils/date_helper.dart'; import 'package:mc_common_app/utils/date_helper.dart';
import 'package:mc_common_app/utils/enums.dart'; import 'package:mc_common_app/utils/enums.dart';
import 'package:mc_common_app/utils/navigator.dart'; import 'package:mc_common_app/utils/navigator.dart';
import 'package:mc_common_app/utils/utils.dart';
import 'package:mc_common_app/view_models/requests_view_model.dart'; import 'package:mc_common_app/view_models/requests_view_model.dart';
import 'package:mc_common_app/views/advertisement/ad_creation_steps/ad_review_containers.dart'; import 'package:mc_common_app/views/advertisement/ad_creation_steps/ad_review_containers.dart';
import 'package:mc_common_app/widgets/button/show_fill_button.dart'; import 'package:mc_common_app/widgets/button/show_fill_button.dart';
@ -64,7 +64,7 @@ class ReviewRequestOffer extends StatelessWidget {
} }
Widget buildLocationInformation(BuildContext context) { Widget buildLocationInformation(BuildContext context) {
// final requestVM = context.read<RequestsVM>(); final requestVM = context.read<RequestsVM>();
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -79,7 +79,7 @@ class ReviewRequestOffer extends StatelessWidget {
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SingleDetailWidget(text: "${"Will get from API"} }", type: LocaleKeys.location.tr()), SingleDetailWidget(text: requestVM.currentSelectedRequest!.address ?? "", type: LocaleKeys.location.tr()),
16.height, 16.height,
SingleDetailWidget(text: "N/A", type: "${LocaleKeys.email.tr()} / ${LocaleKeys.additionalAddressDetails.tr()}"), SingleDetailWidget(text: "N/A", type: "${LocaleKeys.email.tr()} / ${LocaleKeys.additionalAddressDetails.tr()}"),
], ],
@ -163,6 +163,12 @@ class ReviewRequestOffer extends StatelessWidget {
isRemoveBackButton: false, isRemoveBackButton: false,
isDrawerEnabled: false, isDrawerEnabled: false,
onBackButtonTapped: () => Navigator.pop(context), onBackButtonTapped: () => Navigator.pop(context),
actions: [
IconButton(
onPressed: () => Utils.showHelpBottomSheet(context),
icon: const Icon(Icons.help_outline_outlined).paddingOnly(right: 21),
),
],
), ),
body: Column( body: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,

@ -45,7 +45,9 @@ class RequestItem extends StatelessWidget {
6.height, 6.height,
"${request.brand} ${request.model}".toText(fontSize: 16, letterSpacing: -0.64), "${request.brand} ${request.model}".toText(fontSize: 16, letterSpacing: -0.64),
showItem("${LocaleKeys.model.tr()}:", "${request.year}"), showItem("${LocaleKeys.model.tr()}:", "${request.year}"),
showItem("${LocaleKeys.customerName.tr()}:", request.customerName), if (request.customerName.isNotEmpty) ...[
showItem("${LocaleKeys.customerName.tr()}:", request.customerName),
],
], ],
), ),
), ),
@ -103,7 +105,7 @@ class RequestItem extends StatelessWidget {
).toContainer(isShadowEnabled: true).onPress(() async { ).toContainer(isShadowEnabled: true).onPress(() async {
RequestsVM requestsVM = context.read<RequestsVM>(); RequestsVM requestsVM = context.read<RequestsVM>();
requestsVM.updateCurrentSelectedRequest(request); requestsVM.updateCurrentSelectedRequest(request);
if (request.requestStatus == RequestStatusEnum.pending || request.requestStatus == RequestStatusEnum.cancelled) { if (request.requestStatus == RequestStatusEnum.pending || request.requestStatus == RequestStatusEnum.cancelled || request.requestStatus == RequestStatusEnum.expired) {
return; return;
} }
if (appType == AppType.provider) { if (appType == AppType.provider) {

@ -1,3 +1,4 @@
import 'package:mc_common_app/classes/consts.dart';
import 'package:mc_common_app/theme/colors.dart'; import 'package:mc_common_app/theme/colors.dart';
import 'package:mc_common_app/extensions/int_extensions.dart'; import 'package:mc_common_app/extensions/int_extensions.dart';
import 'package:mc_common_app/extensions/string_extensions.dart'; import 'package:mc_common_app/extensions/string_extensions.dart';
@ -112,6 +113,8 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
), ),
50.height, 50.height,
Row( Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Consumer(builder: (BuildContext context, UserVM userVM, Widget? child) { Consumer(builder: (BuildContext context, UserVM userVM, Widget? child) {
return Checkbox( return Checkbox(
@ -122,21 +125,40 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
}, },
); );
}), }),
Expanded( Expanded(
child: Column( child: Text.rich(
children: [ TextSpan(
LocaleKeys.termsOfService.tr().toText(fontSize: 12), children: [
LocaleKeys.terms.tr().toText(fontSize: 12, color: MyColors.darkPrimaryColor), TextSpan(
], text: LocaleKeys.termsOfService.tr(),
), style: const TextStyle(fontSize: 12, fontWeight: MyFonts.Medium),
), ),
Theme( TextSpan(
data: ThemeData(unselectedWidgetColor: Colors.transparent), text: " ${LocaleKeys.terms.tr()}",
child: Checkbox( style: const TextStyle(
value: false, decoration: TextDecoration.underline,
onChanged: (_) {}, fontSize: 12,
color: MyColors.darkPrimaryColor,
fontWeight: MyFonts.Bold,
))
],
),
), ),
) )
// Column(
// children: [
// LocaleKeys.termsOfService.tr().toText(fontSize: 12),
// LocaleKeys.terms.tr().toText(fontSize: 12, color: MyColors.darkPrimaryColor),
// ],
// ),
// Theme(
// data: ThemeData(unselectedWidgetColor: Colors.transparent),
// child: Checkbox(
// value: false,
// onChanged: (_) {},
// ),
// )
], ],
), ),
16.height, 16.height,

@ -26,11 +26,13 @@ class _RegisterPageState extends State<RegisterCustomerPage> {
TextEditingController emailController = TextEditingController(); TextEditingController emailController = TextEditingController();
DropValue? selectedDrop;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final UserVM userVM = context.read<UserVM>(); final UserVM userVM = context.read<UserVM>();
return Scaffold( return Scaffold(
appBar: CustomAppBar( isRemoveBackButton: true, title: ""), appBar: CustomAppBar(isRemoveBackButton: true, title: ""),
body: Container( body: Container(
width: double.infinity, width: double.infinity,
height: double.infinity, height: double.infinity,
@ -41,13 +43,16 @@ class _RegisterPageState extends State<RegisterCustomerPage> {
child: Column( child: Column(
children: [ children: [
12.height, 12.height,
LocaleKeys.signUp.tr().toText(fontSize: 20, letterSpacing: -1.44,), LocaleKeys.signUp.tr().toText(
fontSize: 20,
letterSpacing: -1.44,
),
20.height, 20.height,
LocaleKeys.enterPhoneNumber.tr().toText( LocaleKeys.enterPhoneNumber.tr().toText(
color: MyColors.lightTextColor, color: MyColors.lightTextColor,
textAlign: TextAlign.center, textAlign: TextAlign.center,
fontSize: 14, fontSize: 14,
height: 23 / 24, height: 23 / 24,
letterSpacing: -0.48, letterSpacing: -0.48,
), ),
30.height, 30.height,
@ -57,12 +62,8 @@ class _RegisterPageState extends State<RegisterCustomerPage> {
if (snapshot.hasData) { if (snapshot.hasData) {
List<DropValue> dropList = []; List<DropValue> dropList = [];
snapshot.data?.data?.forEach((element) { snapshot.data?.data?.forEach((element) {
dropList.add(DropValue( dropList.add(DropValue(element.id ?? 0,
element.id ?? 0, EasyLocalization.of(context)?.currentLocale?.countryCode == "SA" ? "${element.countryNameN ?? ""} ${element.countryCode ?? ""}" : "${element.countryName ?? ""} ${element.countryCode ?? ""}", element.countryCode ?? ""));
EasyLocalization.of(context)?.currentLocale?.countryCode == "SA"
? "${element.countryNameN ?? ""} ${element.countryCode ?? ""}"
: "${element.countryName ?? ""} ${element.countryCode ?? ""}",
element.countryCode ?? ""));
}); });
return Column( return Column(
children: [ children: [
@ -70,12 +71,15 @@ class _RegisterPageState extends State<RegisterCustomerPage> {
color: MyColors.lightTextColor, color: MyColors.lightTextColor,
textAlign: TextAlign.center, textAlign: TextAlign.center,
fontSize: 14, fontSize: 14,
height: 23 / 24, height: 23 / 24,
letterSpacing: -0.48, letterSpacing: -0.48,
), ),
10.height, 10.height,
DropdownField( DropdownField(
dropdownValue: selectedDrop,
(DropValue value) { (DropValue value) {
selectedDrop = value;
setState(() { setState(() {
countryCode = value.subValue; countryCode = value.subValue;
countryId = value.id; countryId = value.id;
@ -96,7 +100,7 @@ class _RegisterPageState extends State<RegisterCustomerPage> {
color: MyColors.lightTextColor, color: MyColors.lightTextColor,
textAlign: TextAlign.center, textAlign: TextAlign.center,
fontSize: 14, fontSize: 14,
height: 23 / 24, height: 23 / 24,
letterSpacing: -0.48, letterSpacing: -0.48,
), ),
10.height, 10.height,

@ -1,3 +1,5 @@
import 'dart:developer';
import 'package:mc_common_app/config/dependency_injection.dart'; import 'package:mc_common_app/config/dependency_injection.dart';
import 'package:mc_common_app/extensions/int_extensions.dart'; import 'package:mc_common_app/extensions/int_extensions.dart';
import 'package:mc_common_app/extensions/string_extensions.dart'; import 'package:mc_common_app/extensions/string_extensions.dart';
@ -76,6 +78,8 @@ class _RegisterPageState extends State<RegisterProviderPage> {
fontSize: 20, fontSize: 20,
letterSpacing: -1.44, letterSpacing: -1.44,
), ),
20.height,
LocaleKeys.enterPhoneNumber.tr().toText( LocaleKeys.enterPhoneNumber.tr().toText(
color: MyColors.lightTextColor, color: MyColors.lightTextColor,
textAlign: TextAlign.center, textAlign: TextAlign.center,

@ -28,8 +28,8 @@ class ShowFillButton extends StatelessWidget {
this.isDisabled = false, this.isDisabled = false,
this.radius = 0, this.radius = 0,
this.maxWidth = 88, this.maxWidth = 88,
this.maxHeight = 45, this.maxHeight = 55,
this.fontSize = 15, this.fontSize = 18,
this.horizontalPadding = 16, this.horizontalPadding = 16,
this.isFlatButton = false, this.isFlatButton = false,
this.isBold = false, this.isBold = false,
@ -44,25 +44,25 @@ class ShowFillButton extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return isFlatButton return isFlatButton
? Container( ? Container(
height: maxHeight, height: maxHeight,
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
left: 20, left: 20,
right: 20, right: 20,
), ),
child: showButton(), child: showButton(),
) )
: Padding( : Padding(
padding: margin ?? const EdgeInsets.all(0.0), padding: margin ?? const EdgeInsets.all(0.0),
child: ConstrainedBox( child: ConstrainedBox(
constraints: BoxConstraints( constraints: BoxConstraints(
minHeight: maxHeight, minHeight: maxHeight,
minWidth: maxWidth, minWidth: maxWidth,
maxHeight: maxHeight, maxHeight: maxHeight,
maxWidth: maxWidth, maxWidth: maxWidth,
), ),
child: showButton(), child: showButton(),
), ),
); );
} }
Widget showButton() { Widget showButton() {
@ -71,10 +71,10 @@ class ShowFillButton extends StatelessWidget {
color: isDisabled color: isDisabled
? MyColors.grey98Color.withOpacity(0.3) ? MyColors.grey98Color.withOpacity(0.3)
: (isFlatButton : (isFlatButton
? null ? null
: isFilled : isFilled
? backgroundColor ? backgroundColor
: null), : null),
margin: EdgeInsets.symmetric(horizontal: horizontalMargin, vertical: verticalMargin), margin: EdgeInsets.symmetric(horizontal: horizontalMargin, vertical: verticalMargin),
child: MaterialButton( child: MaterialButton(
onPressed: onPressed, onPressed: onPressed,
@ -84,25 +84,25 @@ class ShowFillButton extends StatelessWidget {
), ),
child: iconWidget != null child: iconWidget != null
? Row( ? Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
iconWidget!, iconWidget!,
title.toText( title.toText(
fontSize: fontSize, fontSize: fontSize,
isBold: isBold, isBold: isBold,
fontWeight: MyFonts.Medium, fontWeight: MyFonts.Medium,
color: isDisabled ? MyColors.lightTextColor : txtColor, color: isDisabled ? MyColors.lightTextColor : txtColor,
maxLines: 1, maxLines: 1,
), ),
], ],
) )
: title.toText( : title.toText(
fontSize: fontSize, fontSize: fontSize,
isBold: isBold, isBold: isBold,
fontWeight: MyFonts.Medium, fontWeight: MyFonts.Medium,
color: isDisabled ? MyColors.lightTextColor : txtColor, color: isDisabled ? MyColors.lightTextColor : txtColor,
maxLines: 1, maxLines: 1,
), ),
), ),
); );
} }

@ -25,7 +25,6 @@ class CustomAddButton extends StatelessWidget {
const SizedBox(width: 10), const SizedBox(width: 10),
text.toText( text.toText(
fontSize: 15, fontSize: 15,
isBold: true,
color: MyColors.lightTextColor, color: MyColors.lightTextColor,
), ),
], ],

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:mc_common_app/classes/consts.dart';
import 'package:mc_common_app/extensions/int_extensions.dart'; import 'package:mc_common_app/extensions/int_extensions.dart';
import 'package:mc_common_app/extensions/string_extensions.dart'; import 'package:mc_common_app/extensions/string_extensions.dart';
import 'package:mc_common_app/theme/colors.dart'; import 'package:mc_common_app/theme/colors.dart';
@ -32,7 +33,7 @@ class CustomRectangleChip extends StatelessWidget {
height: height, height: height,
child: Row( child: Row(
children: [ children: [
text.toText(fontSize: 15, color: MyColors.darkTextColor), text.toText(fontSize: 15, color: MyColors.darkTextColor, fontWeight: MyFonts.Medium),
8.width, 8.width,
Container( Container(
height: 15, height: 15,

@ -68,8 +68,11 @@ class _DropdownFieldState extends State<DropdownField> {
iconEnabledColor: borderColor, iconEnabledColor: borderColor,
iconDisabledColor: borderColor, iconDisabledColor: borderColor,
isExpanded: true, isExpanded: true,
style: TextStyle(color: borderColor, fontSize: 15, ), style: const TextStyle(
hint: (widget.hint ?? "").toText(color: borderColor, fontSize: 15,), color: borderColor,
fontSize: 15,
),
hint: (widget.hint ?? "").toText(color: borderColor, fontSize: 15, fontWeight: MyFonts.Medium),
underline: Container(height: 0), underline: Container(height: 0),
onChanged: (DropValue? newValue) { onChanged: (DropValue? newValue) {
setState(() { setState(() {

@ -351,7 +351,7 @@ extension BuildSVG on String? {
return SizedBox( return SizedBox(
height: height, height: height,
width: width, width: width,
child: const Icon(Icons.error_outline_rounded), child: SvgPicture.asset(MyAssets.providersIcon, color: MyColors.darkPrimaryColor).paddingAll(15),
); );
} }

@ -127,8 +127,8 @@ class TxtField extends StatelessWidget {
) )
: postfixWidget, : postfixWidget,
prefixIcon: prefixData != null ? Icon(prefixData, color: borderColor) : preFixWidget, prefixIcon: prefixData != null ? Icon(prefixData, color: borderColor) : preFixWidget,
labelStyle: TextStyle(color: borderColor, fontSize: 15, fontWeight: MyFonts.Medium), labelStyle: const TextStyle(color: borderColor, fontSize: 15, fontWeight: MyFonts.Medium),
hintStyle: TextStyle(color: borderColor, fontSize: 15, fontWeight: MyFonts.Medium), hintStyle: const TextStyle(color: borderColor, fontSize: 15, fontWeight: MyFonts.Medium),
hintText: hint ?? "", hintText: hint ?? "",
contentPadding: prefixData == null contentPadding: prefixData == null
? EdgeInsets.only( ? EdgeInsets.only(

Loading…
Cancel
Save