Merge branch 'faiz_development_common' into 'master'
Added Ads Repo See merge request mirza.shafique/car_common_app!11merge-requests/12/merge
|
After Width: | Height: | Size: 6.4 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 16 KiB |
@ -1 +0,0 @@
|
||||
|
||||
@ -0,0 +1,117 @@
|
||||
class SSCarCheckScheduleModel {
|
||||
int? serviceProviderID;
|
||||
int? serviceProviderBranchID;
|
||||
int? branchAppointmentScheduleID;
|
||||
String? branchName;
|
||||
String? address;
|
||||
String? latitude;
|
||||
String? longitude;
|
||||
List<ScheduleServices>? scheduleServices;
|
||||
List<BranchScheduleSlots>? branchScheduleSlots;
|
||||
int? totalItemsCount;
|
||||
int? distanceKM;
|
||||
|
||||
SSCarCheckScheduleModel(
|
||||
{this.serviceProviderID,
|
||||
this.serviceProviderBranchID,
|
||||
this.branchAppointmentScheduleID,
|
||||
this.branchName,
|
||||
this.address,
|
||||
this.latitude,
|
||||
this.longitude,
|
||||
this.scheduleServices,
|
||||
this.branchScheduleSlots,
|
||||
this.distanceKM,
|
||||
this.totalItemsCount});
|
||||
|
||||
SSCarCheckScheduleModel.fromJson(Map<String, dynamic> json) {
|
||||
serviceProviderID = json['serviceProviderID'];
|
||||
serviceProviderBranchID = json['serviceProviderBranchID'];
|
||||
branchAppointmentScheduleID = json['branchAppointmentScheduleID'];
|
||||
branchName = json['branchName'];
|
||||
address = json['address'];
|
||||
latitude = json['latitude'];
|
||||
longitude = json['longitude'];
|
||||
if (json['scheduleServices'] != null) {
|
||||
scheduleServices = <ScheduleServices>[];
|
||||
json['scheduleServices'].forEach((v) {
|
||||
scheduleServices!.add(ScheduleServices.fromJson(v));
|
||||
});
|
||||
}
|
||||
if (json['branchScheduleSlots'] != null) {
|
||||
branchScheduleSlots = <BranchScheduleSlots>[];
|
||||
json['branchScheduleSlots'].forEach((v) {
|
||||
branchScheduleSlots!.add(BranchScheduleSlots.fromJson(v));
|
||||
});
|
||||
}
|
||||
totalItemsCount = json['totalItemsCount'];
|
||||
|
||||
//TODO: We will update this when Backend team will add this value
|
||||
distanceKM = 0;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['serviceProviderID'] = serviceProviderID;
|
||||
data['serviceProviderBranchID'] = serviceProviderBranchID;
|
||||
data['branchAppointmentScheduleID'] = branchAppointmentScheduleID;
|
||||
data['branchName'] = branchName;
|
||||
data['address'] = address;
|
||||
data['latitude'] = latitude;
|
||||
data['longitude'] = longitude;
|
||||
if (scheduleServices != null) {
|
||||
data['scheduleServices'] = scheduleServices!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
if (branchScheduleSlots != null) {
|
||||
data['branchScheduleSlots'] = branchScheduleSlots!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['totalItemsCount'] = totalItemsCount;
|
||||
data['distanceKM'] = distanceKM;
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ScheduleServices {
|
||||
int? providerServiceID;
|
||||
String? providerServiceName;
|
||||
|
||||
ScheduleServices({this.providerServiceID, this.providerServiceName});
|
||||
|
||||
ScheduleServices.fromJson(Map<String, dynamic> json) {
|
||||
providerServiceID = json['providerServiceID'];
|
||||
providerServiceName = json['providerServiceName'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['providerServiceID'] = providerServiceID;
|
||||
data['providerServiceName'] = providerServiceName;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class BranchScheduleSlots {
|
||||
int? id;
|
||||
String? slotDate;
|
||||
String? startTime;
|
||||
String? endTime;
|
||||
|
||||
BranchScheduleSlots({this.id, this.slotDate, this.startTime, this.endTime});
|
||||
|
||||
BranchScheduleSlots.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
slotDate = json['slotDate'];
|
||||
startTime = json['startTime'];
|
||||
endTime = json['endTime'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['id'] = id;
|
||||
data['slotDate'] = slotDate;
|
||||
data['startTime'] = startTime;
|
||||
data['endTime'] = endTime;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,95 @@
|
||||
class SSPhotoScheduleModel {
|
||||
int? photoOfficeID;
|
||||
String? fromDate;
|
||||
String? toDate;
|
||||
int? photoOfficeAppointmentScheduleID;
|
||||
String? photoOfficeName;
|
||||
String? description;
|
||||
String? areaName;
|
||||
String? latitude;
|
||||
String? longitude;
|
||||
int? distanceKM;
|
||||
int? totalItemsCount;
|
||||
List<PhotoOfficeScheduleSlots>? photoOfficeScheduleSlots;
|
||||
|
||||
SSPhotoScheduleModel(
|
||||
{this.photoOfficeID,
|
||||
this.fromDate,
|
||||
this.toDate,
|
||||
this.photoOfficeAppointmentScheduleID,
|
||||
this.photoOfficeName,
|
||||
this.description,
|
||||
this.areaName,
|
||||
this.latitude,
|
||||
this.longitude,
|
||||
this.distanceKM,
|
||||
this.totalItemsCount,
|
||||
this.photoOfficeScheduleSlots});
|
||||
|
||||
SSPhotoScheduleModel.fromJson(Map<String, dynamic> json) {
|
||||
photoOfficeID = json['photoOfficeID'];
|
||||
fromDate = json['fromDate'];
|
||||
toDate = json['toDate'];
|
||||
photoOfficeAppointmentScheduleID = json['photoOfficeAppointmentScheduleID'];
|
||||
photoOfficeName = json['photoOfficeName'];
|
||||
description = json['description'];
|
||||
areaName = json['areaName'];
|
||||
latitude = json['latitude'];
|
||||
longitude = json['longitude'];
|
||||
distanceKM = json['distanceKM'];
|
||||
totalItemsCount = json['totalItemsCount'];
|
||||
if (json['photoOfficeScheduleSlots'] != null) {
|
||||
photoOfficeScheduleSlots = <PhotoOfficeScheduleSlots>[];
|
||||
json['photoOfficeScheduleSlots'].forEach((v) {
|
||||
photoOfficeScheduleSlots!.add(PhotoOfficeScheduleSlots.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['photoOfficeID'] = photoOfficeID;
|
||||
data['fromDate'] = fromDate;
|
||||
data['toDate'] = toDate;
|
||||
data['photoOfficeAppointmentScheduleID'] =
|
||||
photoOfficeAppointmentScheduleID;
|
||||
data['photoOfficeName'] = photoOfficeName;
|
||||
data['description'] = description;
|
||||
data['areaName'] = areaName;
|
||||
data['latitude'] = latitude;
|
||||
data['longitude'] = longitude;
|
||||
data['distanceKM'] = distanceKM;
|
||||
data['totalItemsCount'] = totalItemsCount;
|
||||
if (photoOfficeScheduleSlots != null) {
|
||||
data['photoOfficeScheduleSlots'] =
|
||||
photoOfficeScheduleSlots!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class PhotoOfficeScheduleSlots {
|
||||
int? id;
|
||||
String? slotDate;
|
||||
String? startTime;
|
||||
String? endTime;
|
||||
|
||||
PhotoOfficeScheduleSlots(
|
||||
{this.id, this.slotDate, this.startTime, this.endTime});
|
||||
|
||||
PhotoOfficeScheduleSlots.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
slotDate = json['slotDate'];
|
||||
startTime = json['startTime'];
|
||||
endTime = json['endTime'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['id'] = id;
|
||||
data['slotDate'] = slotDate;
|
||||
data['startTime'] = startTime;
|
||||
data['endTime'] = endTime;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,109 @@
|
||||
class AppointmentListModel {
|
||||
int? id;
|
||||
int? serviceSlotID;
|
||||
int? appointmentStatusID;
|
||||
String? appointmentStatusText;
|
||||
int? serviceProviderID;
|
||||
int? customerID;
|
||||
bool? isActive;
|
||||
bool? isPaymentRequired;
|
||||
int? paymentStatus;
|
||||
String? paymentStatusText;
|
||||
String? customerName;
|
||||
String? providerName;
|
||||
String? duration;
|
||||
String? appointmentDate;
|
||||
List<ServiceAppointmentItems>? serviceAppointmentItems;
|
||||
|
||||
AppointmentListModel(
|
||||
{this.id,
|
||||
this.serviceSlotID,
|
||||
this.appointmentStatusID,
|
||||
this.appointmentStatusText,
|
||||
this.serviceProviderID,
|
||||
this.customerID,
|
||||
this.isActive,
|
||||
this.isPaymentRequired,
|
||||
this.paymentStatus,
|
||||
this.paymentStatusText,
|
||||
this.customerName,
|
||||
this.providerName,
|
||||
this.duration,
|
||||
this.appointmentDate,
|
||||
this.serviceAppointmentItems});
|
||||
|
||||
AppointmentListModel.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
serviceSlotID = json['serviceSlotID'];
|
||||
appointmentStatusID = json['appointmentStatusID'];
|
||||
appointmentStatusText = json['appointmentStatusText'];
|
||||
serviceProviderID = json['serviceProviderID'];
|
||||
customerID = json['customerID'];
|
||||
isActive = json['isActive'];
|
||||
isPaymentRequired = json['isPaymentRequired'];
|
||||
paymentStatus = json['paymentStatus'];
|
||||
paymentStatusText = json['paymentStatusText'];
|
||||
customerName = json['customerName'];
|
||||
providerName = json['providerName'];
|
||||
duration = json['duration'];
|
||||
appointmentDate = json['appointmentDate'];
|
||||
if (json['serviceAppointmentItems'] != null) {
|
||||
serviceAppointmentItems = <ServiceAppointmentItems>[];
|
||||
json['serviceAppointmentItems'].forEach((v) {
|
||||
serviceAppointmentItems!.add(ServiceAppointmentItems.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['id'] = id;
|
||||
data['serviceSlotID'] = serviceSlotID;
|
||||
data['appointmentStatusID'] = appointmentStatusID;
|
||||
data['appointmentStatusText'] = appointmentStatusText;
|
||||
data['serviceProviderID'] = serviceProviderID;
|
||||
data['customerID'] = customerID;
|
||||
data['isActive'] = isActive;
|
||||
data['isPaymentRequired'] = isPaymentRequired;
|
||||
data['paymentStatus'] = paymentStatus;
|
||||
data['paymentStatusText'] = paymentStatusText;
|
||||
data['customerName'] = customerName;
|
||||
data['providerName'] = providerName;
|
||||
data['duration'] = duration;
|
||||
data['appointmentDate'] = appointmentDate;
|
||||
if (serviceAppointmentItems != null) {
|
||||
data['serviceAppointmentItems'] =
|
||||
serviceAppointmentItems!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ServiceAppointmentItems {
|
||||
int? id;
|
||||
int? serviceItemID;
|
||||
String? serviceItemName;
|
||||
String? serviceItemDescription;
|
||||
|
||||
ServiceAppointmentItems(
|
||||
{this.id,
|
||||
this.serviceItemID,
|
||||
this.serviceItemName,
|
||||
this.serviceItemDescription});
|
||||
|
||||
ServiceAppointmentItems.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
serviceItemID = json['serviceItemID'];
|
||||
serviceItemName = json['serviceItemName'];
|
||||
serviceItemDescription = json['serviceItemDescription'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['id'] = id;
|
||||
data['serviceItemID'] = serviceItemID;
|
||||
data['serviceItemName'] = serviceItemName;
|
||||
data['serviceItemDescription'] = serviceItemDescription;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
class ProviderCategoryModel {
|
||||
int? id;
|
||||
String? categoryName;
|
||||
String? categoryNameN;
|
||||
String? serviceCategoryIconUrl;
|
||||
String? serviceCategoryImageUrl;
|
||||
bool? isActive;
|
||||
bool? isSelected;
|
||||
|
||||
ProviderCategoryModel({this.id, this.categoryName, this.categoryNameN, this.serviceCategoryIconUrl, this.serviceCategoryImageUrl, this.isActive, this.isSelected = false});
|
||||
|
||||
ProviderCategoryModel.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
categoryName = json['categoryName'];
|
||||
categoryNameN = json['categoryNameN'];
|
||||
serviceCategoryIconUrl = json['serviceCategoryIconUrl'];
|
||||
serviceCategoryImageUrl = json['serviceCategoryImageUrl'];
|
||||
isActive = json['isActive'];
|
||||
isSelected = false;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['id'] = id;
|
||||
data['categoryName'] = categoryName;
|
||||
data['categoryNameN'] = categoryNameN;
|
||||
data['serviceCategoryIconUrl'] = serviceCategoryIconUrl;
|
||||
data['serviceCategoryImageUrl'] = serviceCategoryImageUrl;
|
||||
data['isActive'] = isActive;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
class ProviderServiceModel {
|
||||
int? id;
|
||||
String? description;
|
||||
String? descriptionN;
|
||||
String? serviceIconUrl;
|
||||
String? serviceImageUrl;
|
||||
int? serviceCategoryID;
|
||||
bool? isActive;
|
||||
String? categoryName;
|
||||
bool? ispartial;
|
||||
int? appointmentPricePercentage;
|
||||
int? refundAmountPercentage;
|
||||
bool? isSelected;
|
||||
|
||||
ProviderServiceModel(
|
||||
{this.id,
|
||||
this.description,
|
||||
this.descriptionN,
|
||||
this.serviceIconUrl,
|
||||
this.serviceImageUrl,
|
||||
this.serviceCategoryID,
|
||||
this.isActive,
|
||||
this.categoryName,
|
||||
this.ispartial,
|
||||
this.appointmentPricePercentage,
|
||||
this.refundAmountPercentage,
|
||||
this.isSelected = false,
|
||||
});
|
||||
|
||||
ProviderServiceModel.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
description = json['description'];
|
||||
descriptionN = json['descriptionN'];
|
||||
serviceIconUrl = json['serviceIconUrl'];
|
||||
serviceImageUrl = json['serviceImageUrl'];
|
||||
serviceCategoryID = json['serviceCategoryID'];
|
||||
isActive = json['isActive'];
|
||||
categoryName = json['categoryName'];
|
||||
ispartial = json['ispartial'];
|
||||
appointmentPricePercentage = json['appointmentPricePercentage'];
|
||||
refundAmountPercentage = json['refundAmountPercentage'];
|
||||
isSelected = false;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['id'] = id;
|
||||
data['description'] = description;
|
||||
data['descriptionN'] = descriptionN;
|
||||
data['serviceIconUrl'] = serviceIconUrl;
|
||||
data['serviceImageUrl'] = serviceImageUrl;
|
||||
data['serviceCategoryID'] = serviceCategoryID;
|
||||
data['isActive'] = isActive;
|
||||
data['categoryName'] = categoryName;
|
||||
data['ispartial'] = ispartial;
|
||||
data['appointmentPricePercentage'] = appointmentPricePercentage;
|
||||
data['refundAmountPercentage'] = refundAmountPercentage;
|
||||
return data;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ProviderServiceModel{id: $id, description: $description, descriptionN: $descriptionN, serviceIconUrl: $serviceIconUrl, serviceImageUrl: $serviceImageUrl, serviceCategoryID: $serviceCategoryID, isActive: $isActive, categoryName: $categoryName, ispartial: $ispartial, appointmentPricePercentage: $appointmentPricePercentage, refundAmountPercentage: $refundAmountPercentage, isSelected: $isSelected}';
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,34 @@
|
||||
class FilterListModel {
|
||||
String title;
|
||||
int id;
|
||||
bool isSelected;
|
||||
|
||||
FilterListModel({required this.isSelected, required this.title});
|
||||
FilterListModel({required this.id, required this.isSelected, required this.title});
|
||||
}
|
||||
|
||||
|
||||
class SelectionModel {
|
||||
String selectedOption;
|
||||
int selectedId;
|
||||
String errorValue;
|
||||
String itemPrice;
|
||||
|
||||
SelectionModel({
|
||||
this.selectedOption = "",
|
||||
this.errorValue = "",
|
||||
this.selectedId = 0,
|
||||
this.itemPrice = "",
|
||||
});
|
||||
}
|
||||
|
||||
class TimeSlotModel {
|
||||
int slotId;
|
||||
bool isSelected;
|
||||
String slot;
|
||||
|
||||
TimeSlotModel({
|
||||
this.slot = "",
|
||||
this.slotId = 0,
|
||||
this.isSelected = false,
|
||||
});
|
||||
}
|
||||
@ -0,0 +1,337 @@
|
||||
import 'package:mc_common_app/api/api_client.dart';
|
||||
import 'package:mc_common_app/classes/app_state.dart';
|
||||
import 'package:mc_common_app/classes/consts.dart';
|
||||
import 'package:mc_common_app/config/dependencies.dart';
|
||||
import 'package:mc_common_app/models/advertisment_models/ad_details_model.dart';
|
||||
import 'package:mc_common_app/models/advertisment_models/ads_duration_model.dart';
|
||||
import 'package:mc_common_app/models/advertisment_models/special_service_model.dart';
|
||||
import 'package:mc_common_app/models/advertisment_models/vehicle_details_models.dart';
|
||||
import 'package:mc_common_app/models/generic_resp_model.dart';
|
||||
|
||||
abstract class AdsRepo {
|
||||
Future<List<VehicleTypeModel>> getVehicleTypes();
|
||||
|
||||
Future<List<VehicleModel>> getVehicleModels({required int vehicleTypeId});
|
||||
|
||||
Future<List<VehicleYearModel>> getVehicleModelYears({required int vehicleTypeId});
|
||||
|
||||
Future<List<VehicleColorModel>> getVehicleColors({required int vehicleTypeId});
|
||||
|
||||
Future<List<VehicleConditionModel>> getVehicleConditions({required int vehicleTypeId});
|
||||
|
||||
Future<List<VehicleCategoryModel>> getVehicleCategories({required int vehicleTypeId});
|
||||
|
||||
Future<List<VehicleMileageModel>> getVehicleMileages({required int vehicleTypeId});
|
||||
|
||||
Future<List<VehicleTransmissionModel>> getVehicleTransmission({required int vehicleTypeId});
|
||||
|
||||
Future<List<VehicleSellerTypeModel>> getVehicleSellerTypes({required int vehicleTypeId});
|
||||
|
||||
Future<List<VehicleCountryModel>> getVehicleCountries();
|
||||
|
||||
Future<List<VehicleCityModel>> getVehicleCities({required int countryId});
|
||||
|
||||
Future<List<VehiclePartModel>> getVehicleDamageParts();
|
||||
|
||||
Future<VehicleDetailsModel> getVehicleDetails({required int vehicleTypeId});
|
||||
|
||||
Future<List<AdsDurationModel>> getAdsDuration();
|
||||
|
||||
Future<List<SpecialServiceModel>> getSpecialServices({required int specialServiceId});
|
||||
|
||||
Future<GenericRespModel> createNewAd({required AdsCreationPayloadModel adsCreationPayloadModel});
|
||||
|
||||
Future<List<AdDetailsModel>> getAllAds({required bool isMyAds});
|
||||
|
||||
Future<List<AdDetailsModel>> getMyAds();
|
||||
}
|
||||
|
||||
class AdsRepoImp implements AdsRepo {
|
||||
ApiClient apiClient = injector.get<ApiClient>();
|
||||
AppState appState = injector.get<AppState>();
|
||||
|
||||
@override
|
||||
Future<List<VehicleTypeModel>> getVehicleTypes() async {
|
||||
GenericRespModel adsGenericModel = await apiClient.getJsonForObject(token: appState.getUser.data!.accessToken, (json) => GenericRespModel.fromJson(json), ApiConsts.vehicleTypeGet);
|
||||
List<VehicleTypeModel> vehicleTypes = List.generate(adsGenericModel.data.length, (index) => VehicleTypeModel.fromJson(adsGenericModel.data[index]));
|
||||
return vehicleTypes;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<VehicleCategoryModel>> getVehicleCategories({required int vehicleTypeId}) async {
|
||||
var postParams = {
|
||||
"VehicleType": vehicleTypeId.toString(),
|
||||
};
|
||||
GenericRespModel adsGenericModel =
|
||||
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]));
|
||||
return vehicleCategories;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<VehicleCityModel>> getVehicleCities({required int countryId}) async {
|
||||
var postParams = {
|
||||
"CountryID": countryId.toString(),
|
||||
};
|
||||
GenericRespModel adsGenericModel =
|
||||
await apiClient.getJsonForObject(token: appState.getUser.data!.accessToken, (json) => GenericRespModel.fromJson(json), ApiConsts.vehicleCityGet, queryParameters: postParams);
|
||||
List<VehicleCityModel> vehicleCities = List.generate(adsGenericModel.data.length, (index) => VehicleCityModel.fromJson(adsGenericModel.data[index]));
|
||||
return vehicleCities;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<VehicleColorModel>> getVehicleColors({required int vehicleTypeId}) async {
|
||||
var postParams = {
|
||||
"VehicleType": vehicleTypeId.toString(),
|
||||
};
|
||||
GenericRespModel adsGenericModel =
|
||||
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]));
|
||||
return vehicleColors;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<VehicleConditionModel>> getVehicleConditions({required int vehicleTypeId}) async {
|
||||
var postParams = {
|
||||
"VehicleType": vehicleTypeId.toString(),
|
||||
};
|
||||
GenericRespModel adsGenericModel =
|
||||
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]));
|
||||
return vehicleConditions;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<VehicleCountryModel>> getVehicleCountries() async {
|
||||
GenericRespModel adsGenericModel = await apiClient.getJsonForObject(
|
||||
token: appState.getUser.data!.accessToken,
|
||||
(json) => GenericRespModel.fromJson(json),
|
||||
ApiConsts.vehicleCountryGet,
|
||||
);
|
||||
List<VehicleCountryModel> vehicleConditions = List.generate(adsGenericModel.data.length, (index) => VehicleCountryModel.fromJson(adsGenericModel.data[index]));
|
||||
return vehicleConditions;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<VehicleMileageModel>> getVehicleMileages({required int vehicleTypeId}) async {
|
||||
var postParams = {
|
||||
"VehicleType": vehicleTypeId.toString(),
|
||||
};
|
||||
GenericRespModel adsGenericModel =
|
||||
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]));
|
||||
return vehicleMileages;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<VehicleYearModel>> getVehicleModelYears({required int vehicleTypeId}) async {
|
||||
var postParams = {
|
||||
"VehicleType": vehicleTypeId.toString(),
|
||||
};
|
||||
GenericRespModel adsGenericModel =
|
||||
await apiClient.getJsonForObject(token: appState.getUser.data!.accessToken, (json) => GenericRespModel.fromJson(json), ApiConsts.vehicleModelYearGet, queryParameters: postParams);
|
||||
List<VehicleYearModel> vehicleModelYears = List.generate(adsGenericModel.data.length, (index) => VehicleYearModel.fromJson(adsGenericModel.data[index]));
|
||||
return vehicleModelYears;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<VehicleModel>> getVehicleModels({required int vehicleTypeId}) async {
|
||||
var postParams = {
|
||||
"VehicleType": vehicleTypeId.toString(),
|
||||
};
|
||||
GenericRespModel adsGenericModel =
|
||||
await apiClient.getJsonForObject(token: appState.getUser.data!.accessToken, (json) => GenericRespModel.fromJson(json), ApiConsts.vehicleModelGet, queryParameters: postParams);
|
||||
List<VehicleModel> vehicleModels = List.generate(adsGenericModel.data.length, (index) => VehicleModel.fromJson(adsGenericModel.data[index]));
|
||||
return vehicleModels;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<VehicleSellerTypeModel>> getVehicleSellerTypes({required int vehicleTypeId}) async {
|
||||
var postParams = {
|
||||
"VehicleType": vehicleTypeId.toString(),
|
||||
};
|
||||
GenericRespModel adsGenericModel =
|
||||
await apiClient.getJsonForObject(token: appState.getUser.data!.accessToken, (json) => GenericRespModel.fromJson(json), ApiConsts.vehicleSellerTypeGet, queryParameters: postParams);
|
||||
List<VehicleSellerTypeModel> vehicleSellerTypes = List.generate(adsGenericModel.data.length, (index) => VehicleSellerTypeModel.fromJson(adsGenericModel.data[index]));
|
||||
return vehicleSellerTypes;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<VehicleTransmissionModel>> getVehicleTransmission({required int vehicleTypeId}) async {
|
||||
var postParams = {
|
||||
"VehicleType": vehicleTypeId.toString(),
|
||||
};
|
||||
GenericRespModel adsGenericModel =
|
||||
await apiClient.getJsonForObject(token: appState.getUser.data!.accessToken, (json) => GenericRespModel.fromJson(json), ApiConsts.vehicleTransmissionGet, queryParameters: postParams);
|
||||
List<VehicleTransmissionModel> vehicleTransmissions = List.generate(adsGenericModel.data.length, (index) => VehicleTransmissionModel.fromJson(adsGenericModel.data[index]));
|
||||
return vehicleTransmissions;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<VehicleDetailsModel> getVehicleDetails({required int vehicleTypeId}) async {
|
||||
var postParams = {
|
||||
"vehicleType": vehicleTypeId.toString(),
|
||||
"isVehicleBrand": "true",
|
||||
"vehicleBrand": "0",
|
||||
"isVehicleCategory": "true",
|
||||
"isVehicleColor": "true",
|
||||
"isVehicleCondition": "true",
|
||||
"isVehicleMileage": "true",
|
||||
"isVehicleModel": "true",
|
||||
"isVehicleModelYear": "true",
|
||||
"isVehiclePriceRange": "true",
|
||||
"isVehiclePricingMethod": "true",
|
||||
"isVehcileSellerType": "true",
|
||||
"isVehicleTransmission": "true",
|
||||
"isCountry": "true"
|
||||
};
|
||||
|
||||
String token = appState.getUser.data!.accessToken ?? "";
|
||||
GenericRespModel adsGenericModel = await apiClient.postJsonForObject(
|
||||
(json) => GenericRespModel.fromJson(json),
|
||||
ApiConsts.vehicleDetailsMaster,
|
||||
postParams,
|
||||
token: token,
|
||||
);
|
||||
VehicleDetailsModel vehicleDetails = VehicleDetailsModel.fromJson(adsGenericModel.data);
|
||||
return vehicleDetails;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<VehiclePartModel>> getVehicleDamageParts() async {
|
||||
GenericRespModel adsGenericModel = await apiClient.getJsonForObject(
|
||||
token: appState.getUser.data!.accessToken,
|
||||
(json) => GenericRespModel.fromJson(json),
|
||||
ApiConsts.vehicleDamagePartGet,
|
||||
);
|
||||
List<VehiclePartModel> vehicleParts = List.generate(adsGenericModel.data.length, (index) => VehiclePartModel.fromJson(adsGenericModel.data[index]));
|
||||
return vehicleParts;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<AdsDurationModel>> getAdsDuration() async {
|
||||
GenericRespModel adsGenericModel = await apiClient.getJsonForObject(
|
||||
token: appState.getUser.data!.accessToken,
|
||||
(json) => GenericRespModel.fromJson(json),
|
||||
ApiConsts.vehicleAdsDurationGet,
|
||||
);
|
||||
List<AdsDurationModel> vehicleAdsDuration = List.generate(adsGenericModel.data.length, (index) => AdsDurationModel.fromJson(adsGenericModel.data[index]));
|
||||
return vehicleAdsDuration;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<SpecialServiceModel>> getSpecialServices({required int specialServiceId}) async {
|
||||
var params = {
|
||||
"SpecialServiceType": specialServiceId.toString(),
|
||||
};
|
||||
GenericRespModel adsGenericModel =
|
||||
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]));
|
||||
return vehicleAdsDuration;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<GenericRespModel> createNewAd({required AdsCreationPayloadModel adsCreationPayloadModel}) async {
|
||||
List vehiclePostingImages = [];
|
||||
adsCreationPayloadModel.vehiclePosting!.vehiclePostingImages?.forEach((element) {
|
||||
var imageMap = {
|
||||
"id": 0,
|
||||
"imageName": element.imageName,
|
||||
"imageUrl": element.imageUrl,
|
||||
"imageStr": element.imageStr,
|
||||
"vehiclePostingID": 0,
|
||||
"vehiclePosting": null,
|
||||
};
|
||||
vehiclePostingImages.add(imageMap);
|
||||
});
|
||||
|
||||
List vehiclePostingDamageParts = [];
|
||||
adsCreationPayloadModel.vehiclePosting!.vehiclePostingDamageParts?.forEach((element) {
|
||||
var imageMap = {
|
||||
"id": 0,
|
||||
"comment": element.comment,
|
||||
"vehicleImageBase64": element.vehicleImageBase64,
|
||||
"vehicleDamagePartID": element.vehicleDamagePartID,
|
||||
"vehiclePostingID": 0,
|
||||
"isActive": true
|
||||
};
|
||||
vehiclePostingDamageParts.add(imageMap);
|
||||
});
|
||||
var postParams = {
|
||||
"ads": {
|
||||
"id": 0,
|
||||
"adsDurationID": adsCreationPayloadModel.ads!.adsDurationID,
|
||||
"startDate": adsCreationPayloadModel.ads!.startDate,
|
||||
"countryId": adsCreationPayloadModel.ads!.countryId,
|
||||
"specialServiceIDs": adsCreationPayloadModel.ads!.specialServiceIDs,
|
||||
"isMCHandled": false
|
||||
},
|
||||
"vehiclePosting": {
|
||||
"id": 0,
|
||||
"userID": adsCreationPayloadModel.vehiclePosting!.userID,
|
||||
"vehicleType": adsCreationPayloadModel.vehiclePosting!.vehicleType,
|
||||
"vehicleModelID": adsCreationPayloadModel.vehiclePosting!.vehicleModelID,
|
||||
"vehicleModelYearID": adsCreationPayloadModel.vehiclePosting!.vehicleModelYearID,
|
||||
"vehicleColorID": adsCreationPayloadModel.vehiclePosting!.vehicleColorID,
|
||||
"vehicleCategoryID": adsCreationPayloadModel.vehiclePosting!.vehicleCategoryID,
|
||||
"vehicleConditionID": adsCreationPayloadModel.vehiclePosting!.vehicleConditionID,
|
||||
"vehicleMileageID": adsCreationPayloadModel.vehiclePosting!.vehicleMileageID,
|
||||
"vehicleTransmissionID": adsCreationPayloadModel.vehiclePosting!.vehicleTransmissionID,
|
||||
"vehicleSellerTypeID": adsCreationPayloadModel.vehiclePosting!.vehicleSellerTypeID,
|
||||
"cityID": adsCreationPayloadModel.vehiclePosting!.cityID,
|
||||
"price": adsCreationPayloadModel.vehiclePosting!.price,
|
||||
"vehicleVIN": adsCreationPayloadModel.vehiclePosting!.vehicleVIN,
|
||||
"vehicleDescription": adsCreationPayloadModel.vehiclePosting!.vehicleDescription,
|
||||
"vehicleTitle": adsCreationPayloadModel.vehiclePosting!.vehicleTitle,
|
||||
"vehicleDescriptionN": adsCreationPayloadModel.vehiclePosting!.vehicleDescription,
|
||||
"isFinanceAvailable": adsCreationPayloadModel.vehiclePosting!.isFinanceAvailable,
|
||||
"warantyYears": adsCreationPayloadModel.vehiclePosting!.warantyYears,
|
||||
"demandAmount": adsCreationPayloadModel.vehiclePosting!.demandAmount,
|
||||
// "adStatus": 1,
|
||||
"vehiclePostingImages": vehiclePostingImages,
|
||||
"vehiclePostingDamageParts": vehiclePostingDamageParts
|
||||
}
|
||||
};
|
||||
|
||||
String token = appState.getUser.data!.accessToken ?? "";
|
||||
GenericRespModel adsGenericModel = await apiClient.postJsonForObject(
|
||||
(json) => GenericRespModel.fromJson(json),
|
||||
ApiConsts.vehicleAdsSingleStepCreate,
|
||||
postParams,
|
||||
token: token,
|
||||
);
|
||||
|
||||
return Future.value(adsGenericModel);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<AdDetailsModel>> getAllAds({required isMyAds}) async {
|
||||
var params = {
|
||||
"userID": appState.getUser.data!.userInfo!.userId ?? "",
|
||||
};
|
||||
|
||||
GenericRespModel adsGenericModel = await apiClient.getJsonForObject(
|
||||
token: appState.getUser.data!.accessToken,
|
||||
(json) => GenericRespModel.fromJson(json),
|
||||
ApiConsts.vehicleAdsGet,
|
||||
queryParameters: isMyAds ? params : null,
|
||||
);
|
||||
List<AdDetailsModel> vehicleAdsDetails = List.generate(adsGenericModel.data.length, (index) => AdDetailsModel.fromJson(adsGenericModel.data[index]));
|
||||
return vehicleAdsDetails;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<AdDetailsModel>> getMyAds() async {
|
||||
var params = {
|
||||
"userID": appState.getUser.data!.userInfo!.userId ?? "",
|
||||
};
|
||||
GenericRespModel adsGenericModel = await apiClient.getJsonForObject(
|
||||
token: appState.getUser.data!.accessToken,
|
||||
(json) => GenericRespModel.fromJson(json),
|
||||
queryParameters: params,
|
||||
ApiConsts.vehicleAdsGet,
|
||||
);
|
||||
List<AdDetailsModel> vehicleAdsDetails = List.generate(adsGenericModel.data.length, (index) => AdDetailsModel.fromJson(adsGenericModel.data[index]));
|
||||
return vehicleAdsDetails;
|
||||
}
|
||||
}
|
||||
@ -1,143 +0,0 @@
|
||||
import 'package:carousel_slider/carousel_slider.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.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/theme/colors.dart';
|
||||
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
|
||||
|
||||
class CustomerAppointmentSliderWidget extends StatelessWidget {
|
||||
const CustomerAppointmentSliderWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CarouselSlider.builder(
|
||||
options: CarouselOptions(
|
||||
height: 140,
|
||||
viewportFraction: 1.0,
|
||||
enlargeCenterPage: false,
|
||||
enableInfiniteScroll: false,
|
||||
//
|
||||
// onPageChanged: (index) {
|
||||
// setState(() {
|
||||
// _current = index;
|
||||
// });
|
||||
// },
|
||||
),
|
||||
itemCount: 10,
|
||||
itemBuilder: (BuildContext context, int itemIndex, int pageViewIndex) => BuildAppointmentContainerForCustomer(
|
||||
isForHome: true,
|
||||
onTapped: () {},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class BuildAppointmentContainerForCustomer extends StatelessWidget {
|
||||
final bool? isForHome;
|
||||
final Function() onTapped;
|
||||
|
||||
const BuildAppointmentContainerForCustomer({Key? key, this.isForHome = false, required this.onTapped}) : super(key: key);
|
||||
|
||||
Widget showServices(String title, String icon) {
|
||||
return Row(
|
||||
children: [
|
||||
SvgPicture.asset(icon),
|
||||
8.width,
|
||||
title.toText(
|
||||
fontSize: 14,
|
||||
isBold: true,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(
|
||||
bottom: 10,
|
||||
left: 21,
|
||||
right: 21,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
isForHome != null && isForHome!
|
||||
? Image.asset(
|
||||
MyAssets.bnCar,
|
||||
width: 56,
|
||||
height: 56,
|
||||
fit: BoxFit.fill,
|
||||
).toCircle(borderRadius: 100)
|
||||
: Image.asset(
|
||||
MyAssets.bnCar,
|
||||
width: 80,
|
||||
height: 85,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
8.width,
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
"Al Aziz Service Station".toText(color: MyColors.black, isBold: true, fontSize: 16),
|
||||
Row(
|
||||
children: [
|
||||
MyAssets.miniClock.buildSvg(height: 12),
|
||||
2.width,
|
||||
"08:00 to 08:30 25 July, 2023".toText(
|
||||
color: MyColors.lightTextColor,
|
||||
fontSize: 12,
|
||||
),
|
||||
],
|
||||
),
|
||||
9.height,
|
||||
isForHome != null && isForHome!
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
"Appointment Details".toText(
|
||||
color: MyColors.primaryColor,
|
||||
isUnderLine: true,
|
||||
isBold: true,
|
||||
fontSize: 14,
|
||||
),
|
||||
const Icon(Icons.arrow_forward),
|
||||
],
|
||||
)
|
||||
: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
showServices("Maintenance", MyAssets.maintenanceIcon),
|
||||
2.height,
|
||||
showServices(
|
||||
"Accessories and Modification",
|
||||
MyAssets.modificationsIcon,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Icon(
|
||||
Icons.arrow_forward,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
).onPress(onTapped).toWhiteContainer(width: double.infinity, allPading: 12),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mc_common_app/extensions/int_extensions.dart';
|
||||
import 'package:mc_common_app/extensions/string_extensions.dart';
|
||||
import 'package:mc_common_app/theme/colors.dart';
|
||||
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
|
||||
|
||||
class InfoBottomSheet extends StatelessWidget {
|
||||
final String title;
|
||||
final String description;
|
||||
|
||||
const InfoBottomSheet({Key? key, required this.title, required this.description}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.4,
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
margin: const EdgeInsets.all(8),
|
||||
height: 8,
|
||||
width: 60,
|
||||
decoration: const BoxDecoration(color: MyColors.lightTextColor, borderRadius: BorderRadius.all(Radius.circular(20))),
|
||||
),
|
||||
12.height,
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
title.toText(fontSize: 24, isBold: true),
|
||||
],
|
||||
),
|
||||
8.height,
|
||||
Flexible(
|
||||
child: description.toText(
|
||||
textAlign: TextAlign.justify,
|
||||
fontSize: 16,
|
||||
color: MyColors.lightTextColor,
|
||||
isBold: true,
|
||||
)),
|
||||
],
|
||||
).horPaddingMain());
|
||||
}
|
||||
}
|
||||