|
|
|
@ -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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|