Dropped the JIRA Count to 18

aamir_dev
Faiz Hashmi 1 year ago
parent d1fe3163f3
commit e79af29c8e

@ -736,5 +736,9 @@
"pleaseSelectService": "يرجى اختيار خدمة واحدة على الأقل", "pleaseSelectService": "يرجى اختيار خدمة واحدة على الأقل",
"operationalIssue": "مشكلة تشغيلية", "operationalIssue": "مشكلة تشغيلية",
"materialIssue": "مشكلة في المواد", "materialIssue": "مشكلة في المواد",
"selectReasonBeforeCancel": "يرجى اختيار سبب قبل إلغاء هذا الموعد. لا يمكن التراجع عن هذا الإجراء." "selectReasonBeforeCancel": "يرجى اختيار سبب قبل إلغاء هذا الموعد. لا يمكن التراجع عن هذا الإجراء.",
"blockedByAdmin": "تم حظرها من قبل المسؤول",
"active": "نشط",
"paymentType": "نوع الدفع",
"searchByCreatedDate": "البحث حسب تاريخ الإنشاء"
} }

@ -734,5 +734,9 @@
"pleaseSelectService": "Please select at least one service.", "pleaseSelectService": "Please select at least one service.",
"operationalIssue": "Operational Issue", "operationalIssue": "Operational Issue",
"materialIssue": "Material Issue", "materialIssue": "Material Issue",
"selectReasonBeforeCancel": "Please select a reason before cancelling this appointment. This action cannot be undone." "selectReasonBeforeCancel": "Please select a reason before cancelling this appointment. This action cannot be undone.",
"blockedByAdmin": "Blocked by admin",
"active": "Active",
"paymentType": "Payment Type",
"searchByCreatedDate": "Search By Created Date"
} }

@ -642,6 +642,33 @@ extension ServiceEnum on int {
} }
} }
extension BranchServiceEnumStatusToInt on ServiceStatusEnum {
int getIdFromServiceStatusEnum() {
switch (this) {
case ServiceStatusEnum.pending:
return 1;
case ServiceStatusEnum.review:
return 2;
case ServiceStatusEnum.approvedOrActive:
return 3;
case ServiceStatusEnum.rejected:
return 4;
case ServiceStatusEnum.blocked:
return 5;
case ServiceStatusEnum.deactivated:
return 6;
default:
return 1;
}
}
}
extension DateTimeConversions on DateTime { extension DateTimeConversions on DateTime {
String getTimeAgo({bool numericDates = true}) { String getTimeAgo({bool numericDates = true}) {
final date2 = DateTime.now(); final date2 = DateTime.now();

@ -752,7 +752,11 @@ class CodegenLoader extends AssetLoader{
"pleaseSelectService": "يرجى اختيار خدمة واحدة على الأقل", "pleaseSelectService": "يرجى اختيار خدمة واحدة على الأقل",
"operationalIssue": "مشكلة تشغيلية", "operationalIssue": "مشكلة تشغيلية",
"materialIssue": "مشكلة في المواد", "materialIssue": "مشكلة في المواد",
"selectReasonBeforeCancel": "يرجى اختيار سبب قبل إلغاء هذا الموعد. لا يمكن التراجع عن هذا الإجراء." "selectReasonBeforeCancel": "يرجى اختيار سبب قبل إلغاء هذا الموعد. لا يمكن التراجع عن هذا الإجراء.",
"blockedByAdmin": "تم حظرها من قبل المسؤول",
"active": "نشط",
"paymentType": "نوع الدفع",
"searchByCreatedDate": "البحث حسب تاريخ الإنشاء"
}; };
static const Map<String,dynamic> en_US = { static const Map<String,dynamic> en_US = {
"firstTimeLogIn": "First Time Log In", "firstTimeLogIn": "First Time Log In",
@ -1490,7 +1494,11 @@ static const Map<String,dynamic> en_US = {
"pleaseSelectService": "Please select at least one service.", "pleaseSelectService": "Please select at least one service.",
"operationalIssue": "Operational Issue", "operationalIssue": "Operational Issue",
"materialIssue": "Material Issue", "materialIssue": "Material Issue",
"selectReasonBeforeCancel": "Please select a reason before cancelling this appointment. This action cannot be undone." "selectReasonBeforeCancel": "Please select a reason before cancelling this appointment. This action cannot be undone.",
"blockedByAdmin": "Blocked by admin",
"active": "Active",
"paymentType": "Payment Type",
"searchByCreatedDate": "Search By Created Date"
}; };
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};
} }

@ -716,5 +716,9 @@ abstract class LocaleKeys {
static const operationalIssue = 'operationalIssue'; static const operationalIssue = 'operationalIssue';
static const materialIssue = 'materialIssue'; static const materialIssue = 'materialIssue';
static const selectReasonBeforeCancel = 'selectReasonBeforeCancel'; static const selectReasonBeforeCancel = 'selectReasonBeforeCancel';
static const blockedByAdmin = 'blockedByAdmin';
static const active = 'active';
static const paymentType = 'paymentType';
static const searchByCreatedDate = 'searchByCreatedDate';
} }

@ -21,6 +21,10 @@ class AppointmentListModel {
String? providerName; String? providerName;
String? duration; String? duration;
String? appointmentDate; String? appointmentDate;
String? paymentType;
String? appointmentAddress;
String? appointmentLatitude;
String? appointmentLongitude;
String? branchName; String? branchName;
int? branchId; int? branchId;
int? servicePaymentStatus; int? servicePaymentStatus;
@ -34,7 +38,8 @@ class AppointmentListModel {
List<AppointmentListModel>? customerAppointmentList; List<AppointmentListModel>? customerAppointmentList;
List<MergeAppointmentList>? mergeAppointmentList; List<MergeAppointmentList>? mergeAppointmentList;
AppointmentListModel({this.id, AppointmentListModel({
this.id,
this.serviceSlotID, this.serviceSlotID,
this.appointmentStatusID, this.appointmentStatusID,
this.appointmentStatusText, this.appointmentStatusText,
@ -49,7 +54,10 @@ class AppointmentListModel {
this.appointmentType, this.appointmentType,
this.appointmentTypeEnum, this.appointmentTypeEnum,
this.providerName, this.providerName,
this.duration, this.paymentType,
this.appointmentAddress,
this.appointmentLatitude,
this.appointmentLongitude,
this.branchName, this.branchName,
this.branchId, this.branchId,
this.servicePaymentStatus, this.servicePaymentStatus,
@ -58,7 +66,9 @@ class AppointmentListModel {
this.isSelected, this.isSelected,
this.appointmentDate, this.appointmentDate,
this.appointmentServicesList, this.appointmentServicesList,
this.customerAppointmentList, this.mergeAppointmentList,}); this.customerAppointmentList,
this.mergeAppointmentList,
});
@override @override
String toString() { String toString() {
@ -83,28 +93,25 @@ class AppointmentListModel {
providerName = json['providerName']; providerName = json['providerName'];
duration = json['duration']; duration = json['duration'];
appointmentDate = json['appointmentDate']; appointmentDate = json['appointmentDate'];
paymentType = json['paymentType'];
appointmentAddress = json['address'] ?? "";
appointmentLatitude = json['branchLatitude'];
appointmentLongitude = json['branchLongitude'];
branchName = json['branchName']; branchName = json['branchName'];
branchId = json['branchID']; branchId = json['branchID'];
servicePaymentStatus = json['servicePaymentStatus']; servicePaymentStatus = json['servicePaymentStatus'];
totalAmount = json['amountTotal']; totalAmount = json['amountTotal'];
remainingAmount = json['amountRem']; remainingAmount = json['amountRem'];
isSelected = false; isSelected = false;
appointmentStatusEnum = appointmentStatusEnum = (json['appointmentStatusID'] as int).toAppointmentStatusEnum();
(json['appointmentStatusID'] as int).toAppointmentStatusEnum(); appointmentPaymentStatusEnum = (json['servicePaymentStatus'] as int).toAppointmentPaymentStatusEnum();
appointmentPaymentStatusEnum =
(json['servicePaymentStatus'] as int).toAppointmentPaymentStatusEnum();
if (json['serviceList'] != null) { if (json['serviceList'] != null) {
appointmentServicesList = <ServiceModel>[]; appointmentServicesList = <ServiceModel>[];
json['serviceList'].forEach((v) { json['serviceList'].forEach((v) {
appointmentServicesList! appointmentServicesList!.add(ServiceModel.fromJson(v, isForAppointment: true));
.add(ServiceModel.fromJson(v, isForAppointment: true));
}); });
} }
mergeAppointmentList = mergeAppointmentList = json["mergeAppointmentList"] == null ? [] : List<MergeAppointmentList>.from(json["mergeAppointmentList"]!.map((x) => MergeAppointmentList.fromJson(x)));
json["mergeAppointmentList"] == null ? [] : List<MergeAppointmentList>.from(
json["mergeAppointmentList"]!.map((x) =>
MergeAppointmentList.fromJson(x)));
} }
} }
@ -114,10 +121,7 @@ class ServiceAppointmentItems {
String? serviceItemName; String? serviceItemName;
String? serviceItemDescription; String? serviceItemDescription;
ServiceAppointmentItems({this.id, ServiceAppointmentItems({this.id, this.serviceItemID, this.serviceItemName, this.serviceItemDescription});
this.serviceItemID,
this.serviceItemName,
this.serviceItemDescription});
ServiceAppointmentItems.fromJson(Map<String, dynamic> json) { ServiceAppointmentItems.fromJson(Map<String, dynamic> json) {
id = json['id']; id = json['id'];
@ -142,12 +146,9 @@ class CustomerData {
final String customerName; final String customerName;
final List<AppointmentListModel> appointmentList; final List<AppointmentListModel> appointmentList;
CustomerData({required this.customerID, CustomerData({required this.customerID, required this.customerName, required this.appointmentList});
required this.customerName,
required this.appointmentList});
} }
class MergeAppointmentList { class MergeAppointmentList {
int? id; int? id;
int? mergeAppointmentId; int? mergeAppointmentId;
@ -159,15 +160,13 @@ class MergeAppointmentList {
this.serviceAppointmentId, this.serviceAppointmentId,
}); });
factory MergeAppointmentList.fromJson(Map<String, dynamic> json) => factory MergeAppointmentList.fromJson(Map<String, dynamic> json) => MergeAppointmentList(
MergeAppointmentList(
id: json["id"], id: json["id"],
mergeAppointmentId: json["mergeAppointmentID"], mergeAppointmentId: json["mergeAppointmentID"],
serviceAppointmentId: json["serviceAppointmentID"], serviceAppointmentId: json["serviceAppointmentID"],
); );
Map<String, dynamic> toJson() => Map<String, dynamic> toJson() => {
{
"id": id, "id": id,
"mergeAppointmentID": mergeAppointmentId, "mergeAppointmentID": mergeAppointmentId,
"serviceAppointmentID": serviceAppointmentId, "serviceAppointmentID": serviceAppointmentId,

@ -1,5 +1,6 @@
import 'package:mc_common_app/extensions/string_extensions.dart';
import 'package:mc_common_app/models/services_models/item_model.dart'; import 'package:mc_common_app/models/services_models/item_model.dart';
import 'package:mc_common_app/view_models/appointments_view_model.dart'; import 'package:mc_common_app/utils/enums.dart';
class ServiceModel { class ServiceModel {
final int? serviceProviderServiceId; final int? serviceProviderServiceId;
@ -10,6 +11,7 @@ class ServiceModel {
final String? serviceDescription; final String? serviceDescription;
final String? serviceDescriptionN; final String? serviceDescriptionN;
final int? serviceStatus; final int? serviceStatus;
final ServiceStatusEnum? serviceStatusEnum;
final dynamic statusText; final dynamic statusText;
final bool? isAllowAppointment; final bool? isAllowAppointment;
final bool? isAllowAppointmentHome; final bool? isAllowAppointmentHome;
@ -23,6 +25,7 @@ class ServiceModel {
bool isHomeSelected; bool isHomeSelected;
double currentTotalServicePrice; double currentTotalServicePrice;
CurrentLocationInfoModel servicelocationInfo; CurrentLocationInfoModel servicelocationInfo;
bool isActive;
ServiceModel({ ServiceModel({
this.serviceProviderServiceId, this.serviceProviderServiceId,
@ -33,6 +36,7 @@ class ServiceModel {
this.serviceDescription, this.serviceDescription,
this.serviceDescriptionN, this.serviceDescriptionN,
this.serviceStatus, this.serviceStatus,
this.serviceStatusEnum,
this.statusText, this.statusText,
this.isAllowAppointment, this.isAllowAppointment,
this.isAllowAppointmentHome, this.isAllowAppointmentHome,
@ -42,6 +46,7 @@ class ServiceModel {
this.serviceItems, this.serviceItems,
this.isHomeSelected = false, this.isHomeSelected = false,
this.currentTotalServicePrice = 0.0, this.currentTotalServicePrice = 0.0,
this.isActive = true,
required this.isExpandedOrSelected, required this.isExpandedOrSelected,
required this.providerServiceId, required this.providerServiceId,
required this.providerServiceName, required this.providerServiceName,
@ -57,6 +62,7 @@ class ServiceModel {
serviceDescription: json["serviceDescription"] ?? json["serviceName"], serviceDescription: json["serviceDescription"] ?? json["serviceName"],
serviceDescriptionN: json["serviceDescriptionN"] ?? json["serviceNameN"], serviceDescriptionN: json["serviceDescriptionN"] ?? json["serviceNameN"],
serviceStatus: json["serviceStatus"], serviceStatus: json["serviceStatus"],
serviceStatusEnum: ((json["serviceStatus"] ?? 0) as int).toServiceStatusEnum(),
statusText: json["statusText"], statusText: json["statusText"],
isAllowAppointment: json["isAllowAppointment"], isAllowAppointment: json["isAllowAppointment"],
isAllowAppointmentHome: json["isAllowAppointmentHome"], isAllowAppointmentHome: json["isAllowAppointmentHome"],
@ -74,6 +80,7 @@ class ServiceModel {
providerServiceId: 0, providerServiceId: 0,
providerServiceName: "", providerServiceName: "",
isHomeSelected: false, isHomeSelected: false,
isActive: json["isActive"] ?? true,
servicelocationInfo: CurrentLocationInfoModel(address: '', distanceToBranch: 0.0, homeChargesInCurrentService: 0.0, latitude: 0.0, longitude: 0.0), servicelocationInfo: CurrentLocationInfoModel(address: '', distanceToBranch: 0.0, homeChargesInCurrentService: 0.0, latitude: 0.0, longitude: 0.0),
); );

@ -24,7 +24,14 @@ abstract class AdsRepo {
Future<List<AdDetailsModel>> getAllAds({required bool isMyAds, AdPostStatus? adPostStatus, CreatedByRoleEnum? createdByRoleEnum}); Future<List<AdDetailsModel>> getAllAds({required bool isMyAds, AdPostStatus? adPostStatus, CreatedByRoleEnum? createdByRoleEnum});
Future<List<AdDetailsModel>> getExploreAdsBasedOnFilters({List<String>? cityIdsList, List<String>? vehicleModelYearIdsList, List<String>? vehicleBrandIdsList, List<String>? createdByRolesIdsList}); Future<List<AdDetailsModel>> getExploreAdsBasedOnFilters({
List<String>? cityIdsList,
List<String>? vehicleModelYearIdsList,
List<String>? vehicleBrandIdsList,
List<String>? createdByRolesIdsList,
List<String>? vehicleAdConditionIdsList,
List<String>? vehicleAdCreatedDateList,
});
Future<List<AdDetailsModel>> getMyReservedAds(); Future<List<AdDetailsModel>> getMyReservedAds();
@ -197,6 +204,8 @@ class AdsRepoImp implements AdsRepo {
List<String>? vehicleModelYearIdsList, List<String>? vehicleModelYearIdsList,
List<String>? vehicleBrandIdsList, List<String>? vehicleBrandIdsList,
List<String>? createdByRolesIdsList, List<String>? createdByRolesIdsList,
List<String>? vehicleAdConditionIdsList,
List<String>? vehicleAdCreatedDateList,
}) async { }) async {
var parameters = { var parameters = {
"CityIDs": cityIdsList ?? [], "CityIDs": cityIdsList ?? [],
@ -204,6 +213,10 @@ class AdsRepoImp implements AdsRepo {
"VehicleModelYearIDs": vehicleModelYearIdsList ?? [], "VehicleModelYearIDs": vehicleModelYearIdsList ?? [],
"CreatedByRoles": createdByRolesIdsList ?? [], "CreatedByRoles": createdByRolesIdsList ?? [],
"AdsStatuses": ["${AdPostStatus.active.getIdFromAdPostStatusEnum()}"], //only Active ADS "AdsStatuses": ["${AdPostStatus.active.getIdFromAdPostStatusEnum()}"], //only Active ADS
// TODO: This has to be converted into list
"VehicleNew": (vehicleAdConditionIdsList != null && vehicleAdConditionIdsList.isNotEmpty) ? vehicleAdConditionIdsList.first.toString() : "",
"CreatedOn": (vehicleAdCreatedDateList != null && vehicleAdCreatedDateList.isNotEmpty) ? vehicleAdCreatedDateList.first.toString() : "",
"isActive": "true", //only Active ADS "isActive": "true", //only Active ADS
"isExplore": "true", "isExplore": "true",
"PageSize": "30", "PageSize": "30",

@ -11,6 +11,7 @@
class AppEnums { class AppEnums {
static const int requestFilterEnumId = 16; // Requests Filter Enums static const int requestFilterEnumId = 16; // Requests Filter Enums
static const int branchServicesEnumId = 6; // Branch Services Filter Enums
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
@ -136,6 +137,7 @@ enum ServiceStatusEnum {
rejected, //4 rejected, //4
blocked, //5 blocked, //5
deactivated, //6 deactivated, //6
allServices, //0
} }
enum DocumentStatusEnum { enum DocumentStatusEnum {

@ -364,7 +364,7 @@ class Utils {
return MyColors.adCancelledStatusColor; return MyColors.adCancelledStatusColor;
case BranchStatusEnum.blocked: case BranchStatusEnum.blocked:
return MyColors.adPendingStatusColor; return MyColors.expiredColor;
case BranchStatusEnum.approvedOrActive: case BranchStatusEnum.approvedOrActive:
return MyColors.greenColor; return MyColors.greenColor;

@ -114,10 +114,7 @@ class AdVM extends BaseVM {
} }
void removeSpecialServiceCard(int index) { void removeSpecialServiceCard(int index) {
String option = specialServiceCards String option = specialServiceCards.elementAt(index).serviceSelectedId!.selectedOption;
.elementAt(index)
.serviceSelectedId!
.selectedOption;
for (var value in vehicleAdsSpecialServices) { for (var value in vehicleAdsSpecialServices) {
if (value.name == option) { if (value.name == option) {
@ -550,8 +547,17 @@ class AdVM extends BaseVM {
SelectionModel vehicleConditionId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: ""); SelectionModel vehicleConditionId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
void updateSelectionVehicleConditionId(SelectionModel id) { void updateSelectionVehicleConditionId(SelectionModel id, {bool showSelectionInDropdown = true, bool isForSearch = false}) {
if (isForSearch) {
EnumsModel owner = vehicleConditionsEnum.firstWhere((element) => element.enumValue == id.selectedId);
DropValue ownerValue = DropValue(owner.enumValue, owner.enumValueStr, "");
if (!ifAlreadyExist(list: vehicleAdConditionSearchHistory, value: ownerValue)) {
addToVehicleAdConditionSearchHistory(value: ownerValue);
}
}
if (showSelectionInDropdown) {
vehicleConditionId = id; vehicleConditionId = id;
}
notifyListeners(); notifyListeners();
} }
@ -1249,10 +1255,7 @@ class AdVM extends BaseVM {
} }
void removeDamagePartCard(int index) { void removeDamagePartCard(int index) {
String option = vehicleDamageCards String option = vehicleDamageCards.elementAt(index).partSelectedId!.selectedOption;
.elementAt(index)
.partSelectedId!
.selectedOption;
for (var value in vehicleDamageParts) { for (var value in vehicleDamageParts) {
if (value.partName == option) { if (value.partName == option) {
@ -1530,9 +1533,7 @@ class AdVM extends BaseVM {
File file = File(imageModel.filePath!); File file = File(imageModel.filePath!);
List<int> imageBytes = await file.readAsBytes(); List<int> imageBytes = await file.readAsBytes();
String image = base64Encode(imageBytes); String image = base64Encode(imageBytes);
String fileName = file.path String fileName = file.path.split('/').last;
.split('/')
.last;
vehiclePostingImages = VehiclePostingImages( vehiclePostingImages = VehiclePostingImages(
imageName: fileName, imageName: fileName,
imageStr: image, imageStr: image,
@ -1567,8 +1568,15 @@ class AdVM extends BaseVM {
// ************ ADS SEARCH VIEW **************** // ************ ADS SEARCH VIEW ****************
List<EnumsModel> vehicleConditionsEnum = [];
Future<void> populateDataForAdFilter() async { Future<void> populateDataForAdFilter() async {
setState(ViewState.busy); setState(ViewState.busy);
if (vehicleConditionsEnum.isEmpty) {
vehicleConditionsEnum = await commonRepo.getEnumTypeValues(enumTypeID: AppEnums.conditionEnumId);
}
if (vehicleBrands.isEmpty) { if (vehicleBrands.isEmpty) {
vehicleBrands = await commonRepo.getVehicleBrands(vehicleTypeId: -1); vehicleBrands = await commonRepo.getVehicleBrands(vehicleTypeId: -1);
} }
@ -1704,6 +1712,55 @@ class AdVM extends BaseVM {
notifyListeners(); notifyListeners();
} }
// Created Date
List<DropValue> vehicleAdCreatedDateSearchHistory = [];
void removeVehicleAdCreatedDateSearchHistory({bool isClear = false, required int index}) {
if (isClear) {
vehicleAdCreatedDateSearchHistory.clear();
notifyListeners();
return;
}
vehicleAdCreatedDateSearchHistory.removeAt(index);
if (vehicleAdCreatedDateSearchHistory.isEmpty) {
updateAdsFiltersCounter(adsFiltersCounter - 1);
}
notifyListeners();
}
void addToVehicleAdCreatedDateSearchHistory({required DropValue value}) {
if (vehicleAdCreatedDateSearchHistory.isEmpty) {
updateAdsFiltersCounter(adsFiltersCounter + 1);
}
vehicleAdCreatedDateSearchHistory.add(value);
notifyListeners();
}
// Ad Condition
List<DropValue> vehicleAdConditionSearchHistory = [];
void removeVehicleAdConditionSearchHistory({bool isClear = false, required int index}) {
if (isClear) {
vehicleAdConditionSearchHistory.clear();
notifyListeners();
return;
}
vehicleAdConditionSearchHistory.removeAt(index);
if (vehicleAdConditionSearchHistory.isEmpty) {
updateAdsFiltersCounter(adsFiltersCounter - 1);
}
notifyListeners();
}
void addToVehicleAdConditionSearchHistory({required DropValue value}) {
if (vehicleAdConditionSearchHistory.isEmpty) {
updateAdsFiltersCounter(adsFiltersCounter + 1);
}
vehicleAdConditionSearchHistory.add(value);
notifyListeners();
}
int adsFiltersCounter = 0; int adsFiltersCounter = 0;
updateAdsFiltersCounter(int value) { updateAdsFiltersCounter(int value) {
@ -1716,6 +1773,8 @@ class AdVM extends BaseVM {
vehicleAdOwnerSearchHistory.clear(); vehicleAdOwnerSearchHistory.clear();
vehicleLocationAdSearchHistory.clear(); vehicleLocationAdSearchHistory.clear();
vehicleYearAdSearchHistory.clear(); vehicleYearAdSearchHistory.clear();
vehicleAdCreatedDateSearchHistory.clear();
vehicleAdConditionSearchHistory.clear();
adsFiltersCounter = 0; adsFiltersCounter = 0;
getExploreAds(); getExploreAds();
notifyListeners(); notifyListeners();
@ -1758,11 +1817,27 @@ class AdVM extends BaseVM {
} }
} }
List<String> conditionsIdsList = [];
if (vehicleAdConditionSearchHistory.isNotEmpty) {
for (var element in vehicleAdConditionSearchHistory) {
conditionsIdsList.add(element.id.toString());
}
}
List<String> createdDatesList = [];
if (vehicleAdCreatedDateSearchHistory.isNotEmpty) {
for (var element in vehicleAdCreatedDateSearchHistory) {
createdDatesList.add(element.value.toString());
}
}
exploreAdsFilteredList = await adsRepo.getExploreAdsBasedOnFilters( exploreAdsFilteredList = await adsRepo.getExploreAdsBasedOnFilters(
cityIdsList: cityIdsList, cityIdsList: cityIdsList,
createdByRolesIdsList: adOwnerIdsList, createdByRolesIdsList: adOwnerIdsList,
vehicleBrandIdsList: brandsIdsList, vehicleBrandIdsList: brandsIdsList,
vehicleModelYearIdsList: vehicleYearIdsList, vehicleModelYearIdsList: vehicleYearIdsList,
vehicleAdConditionIdsList: conditionsIdsList,
vehicleAdCreatedDateList: createdDatesList,
); );
setState(ViewState.idle); setState(ViewState.idle);
} }

@ -82,6 +82,7 @@ class DashboardVMProvider extends BaseVM {
appointmentVM.populateAppointmentsFilterList(); appointmentVM.populateAppointmentsFilterList();
shippingManagementVM.populateShippingRequestFilterList(); shippingManagementVM.populateShippingRequestFilterList();
await serviceVM.getBranchAndServices(); await serviceVM.getBranchAndServices();
await serviceVM.populateBranchServiceFilters();
await appointmentVM.getMyAppointmentsForProvider({"ServiceProviderID": injector.get<AppState>().getUser.data?.userInfo?.providerId.toString() ?? "0"}); await appointmentVM.getMyAppointmentsForProvider({"ServiceProviderID": injector.get<AppState>().getUser.data?.userInfo?.providerId.toString() ?? "0"});
adVM.populateAdsFilterList(); adVM.populateAdsFilterList();
await subscriptionsVM.getSubscriptionBySP(AppState().getUser.data?.userInfo?.providerId.toString() ?? "", true); await subscriptionsVM.getSubscriptionBySP(AppState().getUser.data?.userInfo?.providerId.toString() ?? "", true);

@ -46,6 +46,7 @@ class RequestsVM extends BaseVM {
List<EnumsModel> myRequestsTypeEnum = []; List<EnumsModel> myRequestsTypeEnum = [];
List<EnumsModel> vehicleConditionsEnum = []; List<EnumsModel> vehicleConditionsEnum = [];
List<EnumsModel> requestStatusesEnum = []; List<EnumsModel> requestStatusesEnum = [];
RequestModel? currentSelectedRequest; RequestModel? currentSelectedRequest;

@ -6,8 +6,11 @@ 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';
import 'package:mc_common_app/extensions/string_extensions.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/enums_model.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/general_models/widgets_models.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';
import 'package:mc_common_app/models/provider_branches_models/profile/document.dart'; import 'package:mc_common_app/models/provider_branches_models/profile/document.dart';
@ -176,6 +179,31 @@ class ServiceVM extends BaseVM {
notifyListeners(); notifyListeners();
} }
List<EnumsModel> branchServiceEnums = [];
populateBranchServiceFilters() async {
if (branchServiceEnums.isEmpty) {
branchServiceEnums = await commonRepo.getEnumTypeValues(enumTypeID: AppEnums.branchServicesEnumId);
}
branchServicesFilterOptions.clear();
for (int i = 0; i < branchServiceEnums.length; i++) {
branchServicesFilterOptions.add(FilterListModel(title: branchServiceEnums[i].enumValueStr, isSelected: false, id: branchServiceEnums[i].enumValue));
}
}
List<FilterListModel> branchServicesFilterOptions = [];
applyFilterOnBranchServices({required ServiceStatusEnum serviceStatusEnum}) async {
if (branchServicesFilterOptions.isEmpty) return;
for (var value in branchServicesFilterOptions) {
value.isSelected = false;
}
branchServicesFilterOptions[serviceStatusEnum.getIdFromServiceStatusEnum() - 1].isSelected = true; // -1 to match with the index
}
// Future<String?> selectFile(BuildContext context, int index) async { // Future<String?> selectFile(BuildContext context, int index) async {
// final status = await AppPermissions.checkStoragePermissions(context); // final status = await AppPermissions.checkStoragePermissions(context);
// if (status) { // if (status) {
@ -236,7 +264,11 @@ class ServiceVM extends BaseVM {
context, context,
allowMultiple: false, allowMultiple: false,
); );
if (files != null && files.any((element) => element.path.split('.').last.toLowerCase() != 'pdf')) { if (files != null && files.any((element) =>
element.path
.split('.')
.last
.toLowerCase() != 'pdf')) {
Utils.showToast("Only PDF Files are allowed"); Utils.showToast("Only PDF Files are allowed");
return; return;
} }
@ -625,7 +657,9 @@ class ServiceVM extends BaseVM {
File file = File(imageModel.filePath!); File file = File(imageModel.filePath!);
List<int> imageBytes = await file.readAsBytes(); List<int> imageBytes = await file.readAsBytes();
String image = base64Encode(imageBytes); String image = base64Encode(imageBytes);
String fileName = file.path.split('/').last; String fileName = file.path
.split('/')
.last;
branchPostingImages = BranchPostingImages( branchPostingImages = BranchPostingImages(
imageName: fileName, imageName: fileName,
imageStr: image, imageStr: image,

@ -9,12 +9,14 @@ import 'package:mc_common_app/generated/locale_keys.g.dart';
import 'package:mc_common_app/models/general_models/widgets_models.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/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/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/widgets/button/show_fill_button.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/app_bar.dart';
import 'package:mc_common_app/widgets/common_widgets/search_entity_widget.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/dropdown/dropdow_field.dart';
import 'package:mc_common_app/widgets/extensions/extensions_widget.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:provider/provider.dart';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
@ -134,22 +136,45 @@ class _AdsFilterViewState extends State<AdsFilterView> {
), ),
const Divider(thickness: 1.2).paddingOnly(top: 7, bottom: 7), const Divider(thickness: 1.2).paddingOnly(top: 7, bottom: 7),
SearchEntityWidget( SearchEntityWidget(
title: LocaleKeys.searchByAdOwner.tr(), title: LocaleKeys.searchByCondition.tr(),
actionWidget: Builder(builder: (context) { actionWidget: Builder(
builder: (context) {
List<DropValue> vehicleOwnerDrop = []; List<DropValue> vehicleOwnerDrop = [];
for (var element in adVM.exploreAdsEnums) { for (var element in adVM.vehicleConditionsEnum) {
vehicleOwnerDrop.add(DropValue(element.enumValue.toInt(), "${element.enumValueStr} Ads", "")); vehicleOwnerDrop.add(DropValue(element.id.toInt(), element.enumValueStr, ""));
} }
return DropdownField( return DropdownField(
(DropValue value) => adVM.updateSelectionVehicleAdOwnerId(SelectionModel(selectedId: value.id, selectedOption: value.value), isForSearch: true), (DropValue value) =>
adVM.updateSelectionVehicleConditionId(SelectionModel(selectedId: value.id, selectedOption: value.value), isForSearch: true, showSelectionInDropdown: false),
list: vehicleOwnerDrop, list: vehicleOwnerDrop,
dropdownValue: adVM.vehicleOwnerId.selectedId != -1 ? DropValue(adVM.vehicleOwnerId.selectedId, adVM.vehicleOwnerId.selectedOption, "") : null, dropdownValue: adVM.vehicleConditionId.selectedId != -1 ? DropValue(adVM.vehicleConditionId.selectedId, adVM.vehicleConditionId.selectedOption, "") : null,
hint: LocaleKeys.selectOwner.tr(), hint: LocaleKeys.selectCondition.tr(),
errorValue: adVM.vehicleOwnerId.errorValue, errorValue: adVM.vehicleConditionId.errorValue,
); );
}), },
historyContent: adVM.vehicleAdOwnerSearchHistory, ),
onHistoryItemDeleted: (index) => adVM.removeVehicleAdOwnerSearchHistory(index: index), historyContent: adVM.vehicleAdConditionSearchHistory,
onHistoryItemDeleted: (index) => adVM.removeVehicleAdConditionSearchHistory(index: index),
onHistoryItemTapped: (DropValue value) => null,
),
const Divider(thickness: 1.2).paddingOnly(top: 7, bottom: 7),
SearchEntityWidget(
title: LocaleKeys.searchByCreatedDate.tr(),
actionWidget: TxtField(
isNeedBorder: true,
hint: LocaleKeys.createdOn.tr(),
value: adVM.vehicleAdDurationId.selectedOption,
isNeedClickAll: true,
postFixDataColor: MyColors.darkTextColor,
onTap: () async {
final formattedDate = await Utils.pickDateFromDatePicker(context);
adVM.updateSelectionDurationStartDate(formattedDate);
DropValue value = DropValue(0, formattedDate, "");
adVM.addToVehicleAdCreatedDateSearchHistory(value: value);
},
),
historyContent: adVM.vehicleAdCreatedDateSearchHistory,
onHistoryItemDeleted: (index) => adVM.removeVehicleAdCreatedDateSearchHistory(index: index),
onHistoryItemTapped: (DropValue value) => null, onHistoryItemTapped: (DropValue value) => null,
) )
], ],

@ -78,7 +78,6 @@ class AdsFragment extends StatelessWidget {
txtColor: adVM.isExploreAdsTapped ? MyColors.white : MyColors.darkTextColor, txtColor: adVM.isExploreAdsTapped ? MyColors.white : MyColors.darkTextColor,
onPressed: () { onPressed: () {
print("accessToken: ${AppState().getUser.data!.accessToken}"); print("accessToken: ${AppState().getUser.data!.accessToken}");
adVM.populateAdsFilterList();
if (adVM.myAds.isEmpty) { if (adVM.myAds.isEmpty) {
adVM.getMyAds(); adVM.getMyAds();
} }
@ -135,9 +134,7 @@ class AdsFragment extends StatelessWidget {
} }
}, },
child: adVM.state == ViewState.busy child: adVM.state == ViewState.busy
? const Center( ? const Center(child: CircularProgressIndicator())
child: CircularProgressIndicator(),
)
: AdsListWidget(isAdsFragment: true, shouldShowAdStatus: !adVM.isExploreAdsTapped, adsList: getAdsList(adVM)), : AdsListWidget(isAdsFragment: true, shouldShowAdStatus: !adVM.isExploreAdsTapped, adsList: getAdsList(adVM)),
), ),
) )

@ -90,13 +90,15 @@ class _SettingOptionsContactUsState extends State<SettingOptionsContactUs> {
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
itemBuilder: (context, index) { itemBuilder: (context, index) {
ContactInfoModel contactInfoModel = settingsOptionsVM.contactInfosList[index]; ContactInfoModel contactInfoModel = settingsOptionsVM.contactInfosList[index];
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
contactInfoModel.companyName.toString().toText(fontSize: 16), contactInfoModel.companyName.toString().toText(fontSize: 16),
5.height, 5.height,
if (contactInfoModel.latitude != null && contactInfoModel.latitude!.isNotEmpty && contactInfoModel.longitude != null && contactInfoModel.longitude!.isNotEmpty) ...[ if (contactInfoModel.latitude != null &&
contactInfoModel.latitude!.isNotEmpty &&
contactInfoModel.longitude != null &&
contactInfoModel.longitude!.isNotEmpty) ...[
LocaleKeys.openMapLocation.tr().toText(isUnderLine: true, color: MyColors.darkPrimaryColor, fontSize: 10).onPress(() async { LocaleKeys.openMapLocation.tr().toText(isUnderLine: true, color: MyColors.darkPrimaryColor, fontSize: 10).onPress(() async {
double latitude, longitude = 0.0; double latitude, longitude = 0.0;
latitude = double.parse(contactInfoModel.latitude!); latitude = double.parse(contactInfoModel.latitude!);

@ -8,8 +8,16 @@ class CheckBoxWithTitleDescription extends StatelessWidget {
final bool isSelected; final bool isSelected;
final String title, description; final String title, description;
final Function(bool) onSelection; final Function(bool) onSelection;
final bool isDisabled;
const CheckBoxWithTitleDescription({required this.isSelected, required this.title, required this.description, required this.onSelection, Key? key}) : super(key: key); const CheckBoxWithTitleDescription({
required this.isSelected,
required this.title,
required this.description,
required this.onSelection,
this.isDisabled = false,
super.key,
});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -21,7 +29,9 @@ class CheckBoxWithTitleDescription extends StatelessWidget {
children: [ children: [
Checkbox( Checkbox(
value: isSelected, value: isSelected,
activeColor: isDisabled ? MyColors.lightIconColor : MyColors.darkPrimaryColor,
onChanged: (bool? v) { onChanged: (bool? v) {
if (isDisabled) return;
onSelection(v ?? false); onSelection(v ?? false);
}, },
), ),

Loading…
Cancel
Save