diff --git a/assets/icons/vehicle_type_buggy.svg b/assets/icons/vehicle_type_buggy.svg
new file mode 100644
index 0000000..fa95ab0
--- /dev/null
+++ b/assets/icons/vehicle_type_buggy.svg
@@ -0,0 +1,9 @@
+
diff --git a/assets/icons/vehicle_type_car.svg b/assets/icons/vehicle_type_car.svg
new file mode 100644
index 0000000..008545c
--- /dev/null
+++ b/assets/icons/vehicle_type_car.svg
@@ -0,0 +1,7 @@
+
diff --git a/assets/icons/vehicle_type_golf_cart.svg b/assets/icons/vehicle_type_golf_cart.svg
new file mode 100644
index 0000000..18a1fd9
--- /dev/null
+++ b/assets/icons/vehicle_type_golf_cart.svg
@@ -0,0 +1,5 @@
+
diff --git a/assets/icons/vehicle_type_motorcycle.svg b/assets/icons/vehicle_type_motorcycle.svg
new file mode 100644
index 0000000..c63fffd
--- /dev/null
+++ b/assets/icons/vehicle_type_motorcycle.svg
@@ -0,0 +1,11 @@
+
diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart
index 7623f20..707b7cc 100644
--- a/lib/classes/consts.dart
+++ b/lib/classes/consts.dart
@@ -50,6 +50,7 @@ class ApiConsts {
static String ServiceProviderService_Get = "${baseUrlServices}api/ServiceProviders/ServiceProviderService_Get";
static String BranchesAndServices = "${baseUrlServices}api/ServiceProviders/ServiceProviderDetail_Get";
static String GetAllNearBranches = "${baseUrlServices}api/ServiceProviders/ServiceProviderBranchDetail_Get";
+ static String GetServiceItemAppointmentScheduleSlots = "${baseUrlServices}api/ServiceProviders/ServiceItemAppointmentScheduleSlots_Get";
//Appointment APIs
static String serviceProvidersAppointmentGet = "${baseUrlServices}api/ServiceProviders/ServiceProvidersAppointment_Get";
@@ -76,6 +77,7 @@ class ApiConsts {
//Advertisement APIs
static String vehicleTypeGet = "${baseUrlServices}api/ServiceProviders/VehicleType_Get";
static String vehicleModelGet = "${baseUrlServices}api/Master/VehicleModel_Get";
+ static String vehicleBrandGet = "${baseUrlServices}api/Master/VehicleBrand_Get";
static String vehicleModelYearGet = "${baseUrlServices}api/Master/VehicleModelYear_Get";
static String vehicleColorGet = "${baseUrlServices}api/Master/VehicleColor_Get";
static String vehicleConditionGet = "${baseUrlServices}api/Master/VehicleCondition_Get";
@@ -91,6 +93,7 @@ class ApiConsts {
static String vehicleAdsSpecialServicesGet = "${baseUrlServices}api/Common/SpecialService_Get";
static String vehicleAdsSingleStepCreate = "${baseUrlServices}api/Advertisement/AdsSingleStep_Create";
static String vehicleAdsGet = "${baseUrlServices}api/Advertisement/Ads_Get";
+ static String myAdsReserveGet = "${baseUrlServices}api/Advertisement/AdsReserve_Get";
static String adsCarCheckupSPBranchScheduleSlotGet = "${baseUrlServices}api/Advertisement/AdsCarCheckupSPBranchScheduleSlot_Get";
static String adsPhotoOfficeAppointmentScheduleSlotGet = "${baseUrlServices}api/Advertisement/PhotoOfficeAppointmentScheduleSlot_Get";
@@ -124,7 +127,9 @@ class GlobalConsts {
static String attachImageError = "You must add at least 3 images";
static String attachDamagePartImage = "Please add part image";
static String adDurationDateError = "Ad Duration start date cannot be empty";
+ static String adDurationPhoneNumberError = "Phone number cannot be empty";
static String adReservablePriceErrorConst = "Ad Reservable price cannot be empty";
+ static String homeLocationEmptyError = "Home location 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.";
}
@@ -194,6 +199,11 @@ class MyAssets {
static String icPhoneNumber = "${assetPath}icons/ic_phone_number.svg";
static String icStar = "${assetPath}icons/ic_star.svg";
+ static String vehicleTypeBuggy = "${assetPath}icons/vehicle_type_buggy.svg";
+ static String vehicleTypeCar = "${assetPath}icons/vehicle_type_car.svg";
+ static String vehicleTypeGolfCart = "${assetPath}icons/vehicle_type_golf_cart.svg";
+ static String vehicleTypeMotorcycle = "${assetPath}icons/vehicle_type_motorcycle.svg";
+
//PNG
static String icWorldPng = "${assetPath}images/ic_world.png";
static String bnIntroPng = "${assetPath}images/bn_Intro.png";
diff --git a/lib/config/routes.dart b/lib/config/routes.dart
index cb9aee9..c852ecc 100644
--- a/lib/config/routes.dart
+++ b/lib/config/routes.dart
@@ -1,9 +1,5 @@
import 'package:mc_common_app/models/user/register_user.dart';
-// import 'package:mc_common_app/views/settings/create_services_page.dart';
-// import 'package:mc_common_app/views/settings/dealership_page.dart';
-// import 'package:mc_common_app/views/settings/define_branch_page.dart';
-// import 'package:mc_common_app/views/settings/define_license_page.dart';
import 'package:mc_common_app/views/user/change_email_page.dart';
import 'package:mc_common_app/views/user/change_mobile_page.dart';
import 'package:mc_common_app/views/user/change_password_page.dart';
@@ -16,10 +12,6 @@ import 'package:mc_common_app/views/user/login_method_selection_page.dart';
import 'package:mc_common_app/views/user/login_verification_page.dart';
import 'package:mc_common_app/views/user/login_verify_account_page.dart';
import 'package:mc_common_app/views/user/login_with_password_page.dart';
-
-// import 'package:mc_common_app/views/user/profile/profile_1_page.dart';
-// import 'package:mc_common_app/views/user/profile/profile_2_page.dart';
-// import 'package:mc_common_app/views/user/profile/profile_3_page.dart';
import 'package:mc_common_app/views/user/register_page.dart';
import 'package:mc_common_app/views/user/register_provider_page.dart';
import 'package:mc_common_app/views/user/register_selection_page.dart';
@@ -33,7 +25,7 @@ class AppRoutes {
static const String registerSelection = "/registerSelection";
static const String loginVerifyAccount = "/loginVerifyAccount";
static const String registerCustomer = "/registerCustomer";
- static const String registerProvider= "/registerProvider";
+ static const String registerProvider = "/registerProvider";
static const String forgetPassword = "/forgetPassword";
static const String loginVerification = "/loginVerification";
static const String loginWithPassword = "/loginWithPassword";
@@ -53,40 +45,47 @@ class AppRoutes {
static const String dashboard = "/dashboard";
static const String bookProviderAppView = "/bookProviderAppView";
static const String appointmentDetailView = "/appointmentDetailView";
+ static const String bookAppointmenServicesView = "/bookAppointmenServicesView";
+ static const String bookAppointmentsItemView = "/bookAppointmentsItemView";
+ static const String reviewAppointmentView = "/reviewAppointmentView";
+
+ //Advertisement
+ static const String selectAdTypeView = "/selectAdTypeView";
static const String adsDetailView = "/adsDetailView";
static const String createAdView = "/createAdView";
- static const String bookAppointmenServicesView = "/bookAppointmenServicesView";
+ static const String adsSearchFilterScreen = "/adsSearchFilterScreen";
+
+ // Payments
static const String paymentMethodsView = "/paymentMethodsView";
//Customer APP: Provider & Services
static const String branchDetailPage = "/branchDetailPage";
static const String providerProfilePage = "/providerProfilePage";
-
- //Subcriptions
- static final String mySubscriptionsPage = "/mySubscriptionsPage";
- static final String subscriptionsPage = "/subscriptionsPage";
+ // Subscriptions
+ static const String mySubscriptionsPage = "/mySubscriptionsPage";
+ static const String subscriptionsPage = "/subscriptionsPage";
static const String initialRoute = splash;
static final Map routes = {
//User
splash: (context) => const SplashPage(),
- registerSelection: (context) => RegisterSelectionPage(),
+ registerSelection: (context) => const RegisterSelectionPage(),
loginVerifyAccount: (context) => LoginVerifyAccountPage(),
- registerCustomer: (context) => RegisterCustomerPage(),
- registerProvider: (context) => RegisterProviderPage(),
- forgetPassword: (context) => ForgetPasswordPage(),
+ registerCustomer: (context) => const RegisterCustomerPage(),
+ registerProvider: (context) => const RegisterProviderPage(),
+ forgetPassword: (context) => const ForgetPasswordPage(),
loginVerification: (context) => const LoginVerificationPage(),
- loginWithPassword: (context) => LoginWithPassword(),
+ loginWithPassword: (context) => const LoginWithPassword(),
loginMethodSelection: (context) => LoginMethodSelectionPage(ModalRoute.of(context)!.settings.arguments as String),
completeProfile: (context) => CompleteProfilePage(ModalRoute.of(context)!.settings.arguments as RegisterUserRespModel),
verifyPassword: (context) => VerifyPasswordPage(),
confirmNewPasswordPage: (context) => ConfirmNewPasswordPage(ModalRoute.of(context)!.settings.arguments as String),
- changePassword: (context) => ChangePasswordPage(),
+ changePassword: (context) => const ChangePasswordPage(),
forgetPasswordMethodPage: (context) => ForgetPasswordMethodPage(ModalRoute.of(context)!.settings.arguments as String),
changeMobilePage: (context) => ChangeMobilePage(),
changeEmailPage: (context) => const ChangeEmailPage(),
- editAccountPage: (context) => EditAccountPage(),
+ editAccountPage: (context) => const EditAccountPage(),
};
}
diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart
index b72d532..2f07f17 100644
--- a/lib/extensions/string_extensions.dart
+++ b/lib/extensions/string_extensions.dart
@@ -3,6 +3,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.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';
extension EmailValidator on String {
Widget toText(
@@ -14,6 +15,7 @@ extension EmailValidator on String {
TextDecoration? textDecoration,
double letterSpacing = -0.4,
TextAlign? textAlign,
+ FontWeight? fontWeight,
double? height,
int? maxLines}) =>
AutoSizeText(
@@ -25,7 +27,7 @@ extension EmailValidator on String {
height: height,
decoration: isUnderLine ? TextDecoration.underline : textDecoration ?? TextDecoration.none,
fontSize: fontSize ?? 10,
- fontWeight: isBold ? FontWeight.bold : FontWeight.w600,
+ fontWeight: isBold ? FontWeight.bold : fontWeight ?? FontWeight.w600,
color: color ?? MyColors.darkTextColor,
letterSpacing: letterSpacing,
),
@@ -180,6 +182,94 @@ extension AdPostEnum on int {
}
}
+extension AdPostStatusToInt on AdPostStatus {
+ int getIdFromAdPostStatusEnum() {
+ switch (this) {
+ case AdPostStatus.pendingForReview:
+ return 1;
+ case AdPostStatus.pendingForPayment:
+ return 2;
+
+ case AdPostStatus.rejected:
+ return 3;
+
+ case AdPostStatus.cancelled:
+ return 4;
+
+ case AdPostStatus.pendingForPost:
+ return 5;
+
+ case AdPostStatus.active:
+ return 6;
+
+ case AdPostStatus.expired:
+ return 7;
+
+ case AdPostStatus.sold:
+ return 8;
+
+ case AdPostStatus.reserved:
+ return 9;
+
+ case AdPostStatus.buyingService:
+ return 10;
+
+ case AdPostStatus.reserveCancel:
+ return 11;
+ default:
+ return -1;
+ }
+ }
+}
+
+extension CreatedByRoleEnumToInt on CreatedByRoleEnum {
+ int getIdFromCreatedByRoleEnum() {
+ switch (this) {
+ case CreatedByRoleEnum.admin:
+ return 1;
+ case CreatedByRoleEnum.customer:
+ return 2;
+ case CreatedByRoleEnum.provider:
+ return 3;
+ case CreatedByRoleEnum.allAds:
+ return -1;
+ default:
+ return 1;
+ }
+ }
+}
+
+extension AdReserveStatusEnum on int {
+ AdReserveStatus toAdRserveStatusEnum() {
+ if (this == 0) {
+ return AdReserveStatus.defaultStatus;
+ } else if (this == 1) {
+ return AdReserveStatus.reserved;
+ } else if (this == 2) {
+ return AdReserveStatus.cancelledByOwner;
+ } else if (this == 3) {
+ return AdReserveStatus.cancelledByAdmin;
+ } else {
+ return AdReserveStatus.defaultStatus;
+ }
+ }
+}
+
+extension AdOwnerEnum on int {
+ CreatedByRoleEnum toCreatedByRoleEnum() {
+ if (this == -1) {
+ return CreatedByRoleEnum.allAds;
+ } else if (this == 1) {
+ return CreatedByRoleEnum.admin;
+ } else if (this == 2) {
+ return CreatedByRoleEnum.customer;
+ } else if (this == 3) {
+ return CreatedByRoleEnum.provider;
+ }
+ return CreatedByRoleEnum.customer;
+ }
+}
+
extension BranchsEnum on int {
BranchStatusEnum toBranchStatusEnum() {
if (this == 1) {
@@ -246,3 +336,19 @@ extension DateTimeConversions on DateTime {
}
}
}
+
+extension VehicleAdTypeEnum on int {
+ VehicleTypeEnum getVehicleTypeEnum() {
+ if (this == 1) {
+ return VehicleTypeEnum.car;
+ } else if (this == 2) {
+ return VehicleTypeEnum.motorCycle;
+ } else if (this == 3) {
+ return VehicleTypeEnum.golfCart;
+ } else if (this == 4) {
+ return VehicleTypeEnum.buggy;
+ } else {
+ return VehicleTypeEnum.car;
+ }
+ }
+}
diff --git a/lib/main.dart b/lib/main.dart
index f2d9ecf..7ea71be 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -9,6 +9,8 @@ import 'package:provider/provider.dart';
import 'package:provider/single_child_widget.dart';
import 'package:sizer/sizer.dart';
+
+//testing push
final navigatorKey = GlobalKey();
Logger logger = Logger(
diff --git a/lib/models/advertisment_models/ad_details_model.dart b/lib/models/advertisment_models/ad_details_model.dart
index d27b578..4c7f85f 100644
--- a/lib/models/advertisment_models/ad_details_model.dart
+++ b/lib/models/advertisment_models/ad_details_model.dart
@@ -1,3 +1,5 @@
+import 'dart:math';
+
import 'package:mc_common_app/extensions/string_extensions.dart';
import 'package:mc_common_app/models/advertisment_models/special_service_model.dart';
import 'package:mc_common_app/utils/enums.dart';
@@ -36,6 +38,11 @@ class AdDetailsModel {
bool? isMCHandled;
String? modifiedOn;
AdPostStatus? adPostStatus;
+ AdReserveStatus? adReserveStatus;
+ bool? isMyAd;
+ String? phoneNo;
+ String? whatsAppNo;
+ CreatedByRoleEnum? createdByRoleEnum;
AdDetailsModel(
{this.id,
@@ -69,9 +76,20 @@ class AdDetailsModel {
this.reservePrice,
this.isMCHandled,
this.adPostStatus,
+ this.adReserveStatus,
+ this.isMyAd,
+ this.phoneNo,
+ this.whatsAppNo,
+ this.createdByRoleEnum,
this.modifiedOn});
- AdDetailsModel.fromJson(Map json) {
+ int getRandomValue({required int min, required int max}) {
+ Random random = Random();
+ int randomNumber = random.nextInt(max - min);
+ return randomNumber;
+ }
+
+ AdDetailsModel.fromJson(Map json, bool isMyAds) {
id = json['id'];
startdate = json['startdate'];
enddate = json['enddate'];
@@ -82,12 +100,6 @@ class AdDetailsModel {
specialservice!.add(SpecialServiceModel.fromJson(v));
});
}
- // if (json['reserved'] != null) {
- // reserved = [];
- // json['reserved'].forEach((v) {
- // reserved!.add(Null.fromJson(v));
- // });
- // }
statusID = json['statusID'];
statuslabel = json['statuslabel'];
adsDurationPrice = json['adsDurationPrice'];
@@ -113,7 +125,14 @@ class AdDetailsModel {
reservePrice = json['reservePrice'];
isMCHandled = json['isMCHandled'];
modifiedOn = json['modifiedOn'];
+ whatsAppNo = json['phoneNo'];
+ modifiedOn = json['whatsAppNo'];
adPostStatus = (json['statusID'] as int).toAdPostEnum();
+ //TODO: THIS ID SHOULD BE UPDATED!
+ adReserveStatus = AdReserveStatus.defaultStatus;
+ createdByRoleEnum = CreatedByRoleEnum.admin;
+ // createdByRoleEnum = (json['createdByRole'] as int).toCreatedByRoleEnum();
+ isMyAd = isMyAds;
}
Map toJson() {
diff --git a/lib/models/advertisment_models/reserved_ads_models.dart b/lib/models/advertisment_models/reserved_ads_models.dart
new file mode 100644
index 0000000..83c793f
--- /dev/null
+++ b/lib/models/advertisment_models/reserved_ads_models.dart
@@ -0,0 +1,36 @@
+class MyReservedAdsRespModel {
+ int? id;
+ int? adsID;
+ int? customerID;
+ int? paymentStatus;
+ int? reservationTimeID;
+ double? reservationBasePrice;
+ double? refundAmount;
+ String? refundDate;
+
+ MyReservedAdsRespModel({this.id, this.adsID, this.customerID, this.paymentStatus, this.reservationTimeID, this.reservationBasePrice, this.refundAmount, this.refundDate});
+
+ MyReservedAdsRespModel.fromJson(Map json) {
+ id = json['id'];
+ adsID = json['adsID'];
+ customerID = json['customerID'];
+ paymentStatus = json['paymentStatus'];
+ reservationTimeID = json['reservationTimeID'];
+ reservationBasePrice = json['reservationBasePrice'];
+ refundAmount = json['refundAmount'];
+ refundDate = json['refundDate'];
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['id'] = id;
+ data['adsID'] = adsID;
+ data['customerID'] = customerID;
+ data['paymentStatus'] = paymentStatus;
+ data['reservationTimeID'] = reservationTimeID;
+ data['reservationBasePrice'] = reservationBasePrice;
+ data['refundAmount'] = refundAmount;
+ data['refundDate'] = refundDate;
+ return data;
+ }
+}
diff --git a/lib/models/advertisment_models/vehicle_details_models.dart b/lib/models/advertisment_models/vehicle_details_models.dart
index 60ff707..905e43b 100644
--- a/lib/models/advertisment_models/vehicle_details_models.dart
+++ b/lib/models/advertisment_models/vehicle_details_models.dart
@@ -1,5 +1,8 @@
import 'dart:developer';
+import 'package:mc_common_app/extensions/string_extensions.dart';
+import 'package:mc_common_app/utils/enums.dart';
+
class VehicleDetailsModel {
List? vehicleBrands;
List? vehicleCategories;
@@ -56,14 +59,22 @@ class VehicleTypeModel {
String? vehicleTypeName;
String? vehicleTypeNameN;
bool? isActive;
-
- VehicleTypeModel({this.id, this.vehicleTypeName, this.vehicleTypeNameN, this.isActive});
+ VehicleTypeEnum? vehicleTypeEnum;
+
+ VehicleTypeModel({
+ this.id,
+ this.vehicleTypeName,
+ this.vehicleTypeNameN,
+ this.isActive,
+ this.vehicleTypeEnum = VehicleTypeEnum.car,
+ });
VehicleTypeModel.fromJson(Map json) {
id = json['id'];
vehicleTypeName = json['vehicleTypeName'];
vehicleTypeNameN = json['vehicleTypeNameN'];
isActive = json['isActive'];
+ vehicleTypeEnum = (json['id'] as int).getVehicleTypeEnum();
}
Map toJson() {
diff --git a/lib/models/generic_resp_model.dart b/lib/models/generic_resp_model.dart
index 7b476d7..89d935d 100644
--- a/lib/models/generic_resp_model.dart
+++ b/lib/models/generic_resp_model.dart
@@ -23,16 +23,7 @@ class GenericRespModel {
}
var json = {
- "ads": {
- "id": 0,
- "adsDurationID": 1,
- "startDate": "2023-04-12T10:10:20.905Z",
- "countryId": 1,
- "specialServiceIDs": [
-
- ],
- "isMCHandled": false
- },
+ "ads": {"id": 0, "adsDurationID": 1, "startDate": "2023-04-12T10:10:20.905Z", "countryId": 1, "specialServiceIDs": [], "isMCHandled": false},
"vehiclePosting": {
"id": 0,
"userID": "1A1597B3-D5A0-433A-098B-08DB189E51EC",
@@ -56,24 +47,10 @@ var json = {
"demandAmount": 34,
"adStatus": 1,
"vehiclePostingImages": [
- {
- "id": 0,
- "imageName": "onon",
- "imageUrl": "string",
- "imageStr": null,
- "vehiclePostingID": 0,
- "vehiclePosting": null
- }
+ {"id": 0, "imageName": "onon", "imageUrl": "string", "imageStr": null, "vehiclePostingID": 0, "vehiclePosting": null}
],
"vehiclePostingDamageParts": [
- {
- "id": 0,
- "comment": "hhsa",
- "vehicleImageBase64": null,
- "vehicleDamagePartID": 1,
- "vehiclePostingID": 0,
- "isActive": true
- }
+ {"id": 0, "comment": "hhsa", "vehicleImageBase64": null, "vehicleDamagePartID": 1, "vehiclePostingID": 0, "isActive": true}
]
}
};
@@ -86,9 +63,7 @@ class AdsCreationPayloadModel {
AdsCreationPayloadModel.fromJson(Map json) {
ads = json['ads'] != null ? Ads.fromJson(json['ads']) : null;
- vehiclePosting = json['vehiclePosting'] != null
- ? VehiclePosting.fromJson(json['vehiclePosting'])
- : null;
+ vehiclePosting = json['vehiclePosting'] != null ? VehiclePosting.fromJson(json['vehiclePosting']) : null;
}
Map toJson() {
@@ -111,13 +86,7 @@ class Ads {
List? specialServiceIDs;
bool? isMCHandled;
- Ads(
- {this.id,
- this.adsDurationID,
- this.startDate,
- this.countryId,
- this.specialServiceIDs,
- this.isMCHandled});
+ Ads({this.id, this.adsDurationID, this.startDate, this.countryId, this.specialServiceIDs, this.isMCHandled});
Ads.fromJson(Map json) {
id = json['id'];
@@ -164,31 +133,35 @@ class VehiclePosting {
int? adStatus;
List? vehiclePostingImages;
List? vehiclePostingDamageParts;
+ String? phoneNo;
+ String? whatsAppNo;
VehiclePosting(
{this.id,
- this.userID,
- this.vehicleType,
- this.vehicleModelID,
- this.vehicleModelYearID,
- this.vehicleColorID,
- this.vehicleCategoryID,
- this.vehicleConditionID,
- this.vehicleMileageID,
- this.vehicleTransmissionID,
- this.vehicleSellerTypeID,
- this.cityID,
- this.price,
- this.vehicleVIN,
- this.vehicleDescription,
- this.vehicleTitle,
- this.vehicleDescriptionN,
- this.isFinanceAvailable,
- this.warantyYears,
- this.demandAmount,
- this.adStatus,
- this.vehiclePostingImages,
- this.vehiclePostingDamageParts});
+ this.userID,
+ this.vehicleType,
+ this.vehicleModelID,
+ this.vehicleModelYearID,
+ this.vehicleColorID,
+ this.vehicleCategoryID,
+ this.vehicleConditionID,
+ this.vehicleMileageID,
+ this.vehicleTransmissionID,
+ this.vehicleSellerTypeID,
+ this.cityID,
+ this.price,
+ this.vehicleVIN,
+ this.vehicleDescription,
+ this.vehicleTitle,
+ this.vehicleDescriptionN,
+ this.isFinanceAvailable,
+ this.warantyYears,
+ this.demandAmount,
+ this.adStatus,
+ this.phoneNo,
+ this.whatsAppNo,
+ this.vehiclePostingImages,
+ this.vehiclePostingDamageParts});
VehiclePosting.fromJson(Map json) {
id = json['id'];
@@ -212,6 +185,8 @@ class VehiclePosting {
warantyYears = json['warantyYears'];
demandAmount = json['demandAmount'];
adStatus = json['adStatus'];
+ phoneNo = json['phoneNo'];
+ whatsAppNo = json['whatsAppNo'];
if (json['vehiclePostingImages'] != null) {
vehiclePostingImages = [];
json['vehiclePostingImages'].forEach((v) {
@@ -221,8 +196,7 @@ class VehiclePosting {
if (json['vehiclePostingDamageParts'] != null) {
vehiclePostingDamageParts = [];
json['vehiclePostingDamageParts'].forEach((v) {
- vehiclePostingDamageParts!
- .add(VehiclePostingDamageParts.fromJson(v));
+ vehiclePostingDamageParts!.add(VehiclePostingDamageParts.fromJson(v));
});
}
}
@@ -250,16 +224,21 @@ class VehiclePosting {
data['warantyYears'] = warantyYears;
data['demandAmount'] = demandAmount;
data['adStatus'] = adStatus;
+ data['phoneNo'] = phoneNo;
+ data['whatsAppNo'] = whatsAppNo;
if (vehiclePostingImages != null) {
- data['vehiclePostingImages'] =
- vehiclePostingImages!.map((v) => v.toJson()).toList();
+ data['vehiclePostingImages'] = vehiclePostingImages!.map((v) => v.toJson()).toList();
}
if (vehiclePostingDamageParts != null) {
- data['vehiclePostingDamageParts'] =
- vehiclePostingDamageParts!.map((v) => v.toJson()).toList();
+ data['vehiclePostingDamageParts'] = vehiclePostingDamageParts!.map((v) => v.toJson()).toList();
}
return data;
}
+
+ @override
+ String toString() {
+ return 'VehiclePosting{id: $id, userID: $userID, vehicleType: $vehicleType, vehicleModelID: $vehicleModelID, vehicleModelYearID: $vehicleModelYearID, vehicleColorID: $vehicleColorID, vehicleCategoryID: $vehicleCategoryID, vehicleConditionID: $vehicleConditionID, vehicleMileageID: $vehicleMileageID, vehicleTransmissionID: $vehicleTransmissionID, vehicleSellerTypeID: $vehicleSellerTypeID, cityID: $cityID, price: $price, vehicleVIN: $vehicleVIN, vehicleDescription: $vehicleDescription, vehicleTitle: $vehicleTitle, vehicleDescriptionN: $vehicleDescriptionN, isFinanceAvailable: $isFinanceAvailable, warantyYears: $warantyYears, demandAmount: $demandAmount, adStatus: $adStatus, vehiclePostingImages: $vehiclePostingImages, vehiclePostingDamageParts: $vehiclePostingDamageParts, phoneNo: $phoneNo, whatsAppNo: $whatsAppNo}';
+ }
}
class VehiclePostingImages {
@@ -270,13 +249,7 @@ class VehiclePostingImages {
int? vehiclePostingID;
String? vehiclePosting;
- VehiclePostingImages(
- {this.id,
- this.imageName,
- this.imageUrl,
- this.imageStr,
- this.vehiclePostingID,
- this.vehiclePosting});
+ VehiclePostingImages({this.id, this.imageName, this.imageUrl, this.imageStr, this.vehiclePostingID, this.vehiclePosting});
VehiclePostingImages.fromJson(Map json) {
id = json['id'];
@@ -307,13 +280,7 @@ class VehiclePostingDamageParts {
int? vehiclePostingID;
bool? isActive;
- VehiclePostingDamageParts(
- {this.id,
- this.comment,
- this.vehicleImageBase64,
- this.vehicleDamagePartID,
- this.vehiclePostingID,
- this.isActive});
+ VehiclePostingDamageParts({this.id, this.comment, this.vehicleImageBase64, this.vehicleDamagePartID, this.vehiclePostingID, this.isActive});
VehiclePostingDamageParts.fromJson(Map json) {
id = json['id'];
diff --git a/lib/models/model/provider_model.dart b/lib/models/model/provider_model.dart
index 97ce37e..256b281 100644
--- a/lib/models/model/provider_model.dart
+++ b/lib/models/model/provider_model.dart
@@ -4,8 +4,7 @@
import 'dart:convert';
-import 'package:mc_common_app/models/profile/categroy.dart';
-import 'package:mc_common_app/models/services/branch_model.dart';
+import 'package:mc_common_app/models/provider_branches_models/branch_detail_model.dart';
ProviderModel branch2FromJson(String str) => ProviderModel.fromJson(json.decode(str));
@@ -26,18 +25,18 @@ class ProviderModel {
factory ProviderModel.fromJson(Map json) =>
ProviderModel(
- messageStatus: json["messageStatus"] == null ? null : json["messageStatus"],
- totalItemsCount: json["totalItemsCount"] == null ? null : json["totalItemsCount"],
+ messageStatus: json["messageStatus"],
+ totalItemsCount: json["totalItemsCount"],
data: json["data"] == null ? null : ProviderModelData.fromJson(json["data"]),
- message: json["message"] == null ? null : json["message"],
+ message: json["message"],
);
Map toJson() =>
{
- "messageStatus": messageStatus == null ? null : messageStatus,
- "totalItemsCount": totalItemsCount == null ? null : totalItemsCount,
+ "messageStatus": messageStatus,
+ "totalItemsCount": totalItemsCount,
"data": data == null ? null : data!.toJson(),
- "message": message == null ? null : message,
+ "message": message,
};
}
@@ -62,29 +61,29 @@ class ProviderModelData {
final int? allDocStatus;
final bool? isValidSubscription;
final String? userId;
- final List? serviceProviderBranch;
+ final List? serviceProviderBranch;
factory ProviderModelData.fromJson(Map json) =>
ProviderModelData(
- id: json["id"] == null ? null : json["id"],
- companyName: json["companyName"] == null ? null : json["companyName"],
- countryName: json["countryName"] == null ? null : json["countryName"],
- countryID: json["countryID"] == null ? null : json["countryID"],
- companyDescription: json["companyDescription"] == null ? null : json["companyDescription"],
- allDocStatus: json["allDocStatus"] == null ? null : json["allDocStatus"],
- isValidSubscription: json["isValidSubscription"] == null ? null : json["isValidSubscription"],
- userId: json["userID"] == null ? null : json["userID"],
- serviceProviderBranch: json["serviceProviderBranch"] == null ? null : List.from(json["serviceProviderBranch"].map((x) => BranchModel.fromJson(x))),
+ id: json["id"],
+ companyName: json["companyName"],
+ countryName: json["countryName"],
+ countryID: json["countryID"],
+ companyDescription: json["companyDescription"],
+ allDocStatus: json["allDocStatus"],
+ isValidSubscription: json["isValidSubscription"],
+ userId: json["userID"],
+ serviceProviderBranch: json["serviceProviderBranch"] == null ? null : List.from(json["serviceProviderBranch"].map((x) => BranchDetailModel.fromJson(x))),
);
Map toJson() =>
{
- "id": id == null ? null : id,
- "companyName": companyName == null ? null : companyName,
- "companyDescription": companyDescription == null ? null : companyDescription,
- "allDocStatus": allDocStatus == null ? null : allDocStatus,
- "isValidSubscription": isValidSubscription == null ? null : isValidSubscription,
- "userID": userId == null ? null : userId,
+ "id": id,
+ "companyName": companyName,
+ "companyDescription": companyDescription,
+ "allDocStatus": allDocStatus,
+ "isValidSubscription": isValidSubscription,
+ "userID": userId,
"serviceProviderBranch": serviceProviderBranch == null ? null : List.from(serviceProviderBranch!.map((x) => x.toJson())),
};
}
diff --git a/lib/models/payment_models/pay_order_detail_resp_model.dart b/lib/models/payment_models/pay_order_detail_resp_model.dart
index ca54aeb..7ed268c 100644
--- a/lib/models/payment_models/pay_order_detail_resp_model.dart
+++ b/lib/models/payment_models/pay_order_detail_resp_model.dart
@@ -30,6 +30,11 @@ class PayOrderDetailRespModel {
this.serviceAppointmentID,
this.providerSubscriptionID});
+ @override
+ String toString() {
+ return 'PayOrderDetailRespModel{id: $id, userFullName: $userFullName, userMobile: $userMobile, userEmail: $userEmail, userID: $userID, amount: $amount, currency: $currency, payFortProjectID: $payFortProjectID, payFortServiceID: $payFortServiceID, description: $description, isPaid: $isPaid, language: $language, serviceAppointmentID: $serviceAppointmentID, providerSubscriptionID: $providerSubscriptionID}';
+ }
+
PayOrderDetailRespModel.fromJson(Map json) {
id = json['id'];
userFullName = json['userFullName'];
diff --git a/lib/models/services/branch_model.dart b/lib/models/provider_branches_models/branch_detail_model.dart
similarity index 92%
rename from lib/models/services/branch_model.dart
rename to lib/models/provider_branches_models/branch_detail_model.dart
index dfc56ca..70768c3 100644
--- a/lib/models/services/branch_model.dart
+++ b/lib/models/provider_branches_models/branch_detail_model.dart
@@ -1,9 +1,9 @@
import 'package:mc_common_app/extensions/string_extensions.dart';
-import 'package:mc_common_app/models/profile/categroy.dart';
+import 'package:mc_common_app/models/provider_branches_models/profile/categroy.dart';
import 'package:mc_common_app/models/services/service_model.dart';
import 'package:mc_common_app/utils/enums.dart';
-class BranchModel {
+class BranchDetailModel {
final int? id;
final int? serviceProviderId;
final String? serviceProviderName;
@@ -25,7 +25,7 @@ class BranchModel {
String? countryName;
bool isExpanded;
- BranchModel({
+ BranchDetailModel({
this.id,
this.serviceProviderId,
this.serviceProviderName,
@@ -48,7 +48,7 @@ class BranchModel {
required this.isExpanded,
});
- factory BranchModel.fromJson(Map json) => BranchModel(
+ factory BranchDetailModel.fromJson(Map json) => BranchDetailModel(
id: json["id"],
serviceProviderId: json["serviceProviderID"],
serviceProviderName: json["serviceProviderName"],
diff --git a/lib/models/profile/branch.dart b/lib/models/provider_branches_models/profile/branch.dart
similarity index 100%
rename from lib/models/profile/branch.dart
rename to lib/models/provider_branches_models/profile/branch.dart
diff --git a/lib/models/profile/categroy.dart b/lib/models/provider_branches_models/profile/categroy.dart
similarity index 96%
rename from lib/models/profile/categroy.dart
rename to lib/models/provider_branches_models/profile/categroy.dart
index 0c7bf26..33feaae 100644
--- a/lib/models/profile/categroy.dart
+++ b/lib/models/provider_branches_models/profile/categroy.dart
@@ -5,7 +5,7 @@
import 'dart:convert';
import 'package:equatable/equatable.dart';
-import 'package:mc_common_app/models/model/provider_model.dart';
+import 'package:mc_common_app/models/provider_branches_models/provider_profile_model.dart';
import 'package:mc_common_app/models/services/service_model.dart';
Category categoryFromJson(String str) => Category.fromJson(json.decode(str));
diff --git a/lib/models/profile/document.dart b/lib/models/provider_branches_models/profile/document.dart
similarity index 100%
rename from lib/models/profile/document.dart
rename to lib/models/provider_branches_models/profile/document.dart
diff --git a/lib/models/profile/services.dart b/lib/models/provider_branches_models/profile/services.dart
similarity index 52%
rename from lib/models/profile/services.dart
rename to lib/models/provider_branches_models/profile/services.dart
index 1d3d7ec..d457b4d 100644
--- a/lib/models/profile/services.dart
+++ b/lib/models/provider_branches_models/profile/services.dart
@@ -23,18 +23,18 @@ class Services {
factory Services.fromJson(Map json) =>
Services(
- totalItemsCount: json["totalItemsCount"] == null ? null : json["totalItemsCount"],
+ totalItemsCount: json["totalItemsCount"],
data: json["data"] == null ? null : List.from(json["data"].map((x) => ServicesData.fromJson(x))),
- messageStatus: json["messageStatus"] == null ? null : json["messageStatus"],
- message: json["message"] == null ? null : json["message"],
+ messageStatus: json["messageStatus"],
+ message: json["message"],
);
Map toJson() =>
{
- "totalItemsCount": totalItemsCount == null ? null : totalItemsCount,
+ "totalItemsCount": totalItemsCount,
"data": data == null ? null : List.from(data!.map((x) => x.toJson())),
- "messageStatus": messageStatus == null ? null : messageStatus,
- "message": message == null ? null : message,
+ "messageStatus": messageStatus,
+ "message": message,
};
}
@@ -61,24 +61,24 @@ class ServicesData {
factory ServicesData.fromJson(Map json) =>
ServicesData(
- id: json["id"] == null ? null : json["id"],
- description: json["description"] == null ? (json["serviceDescription"] == null ? null : json["serviceDescription"]) : json["description"],
- descriptionN: json["descriptionN"] == null ? (json["serviceDescriptionN"] == null ? null : json["serviceDescriptionN"]) : json["descriptionN"],
- serviceIconUrl: json["serviceIconUrl"] == null ? null : json["serviceIconUrl"],
- serviceImageUrl: json["serviceImageUrl"] == null ? null : json["serviceImageUrl"],
- serviceCategoryId: json["serviceCategoryID"] == null ? null : json["serviceCategoryID"],
- categoryName: json["categoryName"] == null ? null : json["categoryName"],
+ id: json["id"],
+ description: json["description"] ?? (json["serviceDescription"]),
+ descriptionN: json["descriptionN"] ?? (json["serviceDescriptionN"]),
+ serviceIconUrl: json["serviceIconUrl"],
+ serviceImageUrl: json["serviceImageUrl"],
+ serviceCategoryId: json["serviceCategoryID"],
+ categoryName: json["categoryName"],
isSelected: false,
);
Map toJson() =>
{
- "id": id == null ? null : id,
- "description": description == null ? null : description,
- "descriptionN": descriptionN == null ? null : descriptionN,
+ "id": id,
+ "description": description,
+ "descriptionN": descriptionN,
"serviceIconUrl": serviceIconUrl,
"serviceImageUrl": serviceImageUrl,
- "serviceCategoryID": serviceCategoryId == null ? null : serviceCategoryId,
+ "serviceCategoryID": serviceCategoryId,
"categoryName": categoryName,
};
}
diff --git a/lib/models/provider_branches_models/provider_profile_model.dart b/lib/models/provider_branches_models/provider_profile_model.dart
new file mode 100644
index 0000000..10a845f
--- /dev/null
+++ b/lib/models/provider_branches_models/provider_profile_model.dart
@@ -0,0 +1,53 @@
+// To parse this JSON data, do
+//
+// final branch2 = branch2FromJson(jsonString);
+
+import 'package:mc_common_app/models/provider_branches_models/branch_detail_model.dart';
+
+
+class ProviderProfileModel {
+ ProviderProfileModel({
+ this.id,
+ this.companyName,
+ this.countryName,
+ this.companyDescription,
+ this.allDocStatus,
+ this.isValidSubscription,
+ this.userId,
+ this.serviceProviderBranch,
+ this.countryID,
+ });
+
+ final int? id;
+ final String? companyName;
+ final String? countryName;
+ int? countryID;
+ final String? companyDescription;
+ final int? allDocStatus;
+ final bool? isValidSubscription;
+ final String? userId;
+ final List? serviceProviderBranch;
+
+ factory ProviderProfileModel.fromJson(Map json) => ProviderProfileModel(
+ id: json["id"],
+ companyName: json["companyName"],
+ countryName: json["countryName"],
+ countryID: json["countryID"],
+ companyDescription: json["companyDescription"],
+ allDocStatus: json["allDocStatus"],
+ isValidSubscription: json["isValidSubscription"],
+ userId: json["userID"],
+ serviceProviderBranch: json["serviceProviderBranch"] == null ? null : List.from(json["serviceProviderBranch"].map((x) => BranchDetailModel.fromJson(x))),
+ );
+
+ Map toJson() => {
+ "id": id,
+ "companyName": companyName,
+ "companyDescription": companyDescription,
+ "allDocStatus": allDocStatus,
+ "isValidSubscription": isValidSubscription,
+ "userID": userId,
+ "serviceProviderBranch": serviceProviderBranch == null ? null : List.from(serviceProviderBranch!.map((x) => x.toJson())),
+ };
+}
+
diff --git a/lib/models/provider_category_model.dart b/lib/models/provider_category_model.dart
index 2c6ae13..18c8dda 100644
--- a/lib/models/provider_category_model.dart
+++ b/lib/models/provider_category_model.dart
@@ -1,32 +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 json) {
- id = json['id'];
- categoryName = json['categoryName'];
- categoryNameN = json['categoryNameN'];
- serviceCategoryIconUrl = json['serviceCategoryIconUrl'];
- serviceCategoryImageUrl = json['serviceCategoryImageUrl'];
- isActive = json['isActive'];
- isSelected = false;
- }
-
- Map toJson() {
- final Map data = {};
- data['id'] = id;
- data['categoryName'] = categoryName;
- data['categoryNameN'] = categoryNameN;
- data['serviceCategoryIconUrl'] = serviceCategoryIconUrl;
- data['serviceCategoryImageUrl'] = serviceCategoryImageUrl;
- data['isActive'] = isActive;
- return data;
- }
-}
+// 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 json) {
+// id = json['id'];
+// categoryName = json['categoryName'];
+// categoryNameN = json['categoryNameN'];
+// serviceCategoryIconUrl = json['serviceCategoryIconUrl'];
+// serviceCategoryImageUrl = json['serviceCategoryImageUrl'];
+// isActive = json['isActive'];
+// isSelected = false;
+// }
+//
+// Map toJson() {
+// final Map data = {};
+// data['id'] = id;
+// data['categoryName'] = categoryName;
+// data['categoryNameN'] = categoryNameN;
+// data['serviceCategoryIconUrl'] = serviceCategoryIconUrl;
+// data['serviceCategoryImageUrl'] = serviceCategoryImageUrl;
+// data['isActive'] = isActive;
+// return data;
+// }
+// }
diff --git a/lib/models/provider_service_model.dart b/lib/models/provider_service_model.dart
index 4875675..914ce65 100644
--- a/lib/models/provider_service_model.dart
+++ b/lib/models/provider_service_model.dart
@@ -1,65 +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 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 toJson() {
- final Map data = {};
- 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}';
- }
-}
+// 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 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 toJson() {
+// final Map data = {};
+// 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}';
+// }
+// }
diff --git a/lib/models/schedule_model.dart b/lib/models/schedule_model.dart
index 6676083..47c13e6 100644
--- a/lib/models/schedule_model.dart
+++ b/lib/models/schedule_model.dart
@@ -4,6 +4,8 @@
import 'dart:convert';
+import 'package:mc_common_app/models/services/service_model.dart';
+
Schedule scheduleFromJson(String str) => Schedule.fromJson(json.decode(str));
String scheduleToJson(Schedule data) => json.encode(data.toJson());
@@ -53,7 +55,8 @@ class ScheduleData {
final String? latitude;
final String? longitude;
final List? weeklyOffDays;
- final List? scheduleServices;
+ final List? scheduleServices;
+ final List? selectedServices;
String branchId;
ScheduleData({
@@ -72,6 +75,7 @@ class ScheduleData {
this.longitude,
this.weeklyOffDays,
this.scheduleServices,
+ this.selectedServices,
this.branchId = "",
});
@@ -91,7 +95,8 @@ class ScheduleData {
latitude: json["latitude"],
longitude: json["longitude"],
weeklyOffDays: json["weeklyOffDays"] == null ? [] : List.from(json["weeklyOffDays"]!.map((x) => WeeklyOffDay.fromJson(x))),
- scheduleServices: json["scheduleServices"] == null ? [] : List.from(json["scheduleServices"]!.map((x) => ScheduleService.fromJson(x))),
+ scheduleServices: json["scheduleServices"] == null ? [] : List.from(json["scheduleServices"]!.map((x) => ServiceModel.fromJson(x))),
+ selectedServices: [],
);
Map toJson() =>
@@ -111,33 +116,14 @@ class ScheduleData {
"longitude": longitude,
"scheduleServices": scheduleServices == null ? [] : List.from(scheduleServices!.map((x) => x.toJson())),
};
-}
-
-class ScheduleService {
- final int? providerServiceId;
- // final int? branchScheduleGroupServiceID;
- final String? providerServiceName;
- ScheduleService({
- this.providerServiceId,
- // this.branchScheduleGroupServiceID,
- this.providerServiceName,
- });
-
- factory ScheduleService.fromJson(Map json) =>
- ScheduleService(
- providerServiceId: json["providerServiceID"],
- // branchScheduleGroupServiceID: json["branchScheduleGroupServiceID"],
- providerServiceName: json["providerServiceName"],
- );
-
- Map toJson() =>
- {
- "providerServiceID": providerServiceId,
- "providerServiceName": providerServiceName,
- };
+ @override
+ String toString() {
+ return 'ScheduleData{id: $id, scheduleName: $scheduleName, serviceProviderBranchId: $serviceProviderBranchId, fromDate: $fromDate, toDate: $toDate, startTime: $startTime, endTime: $endTime, slotDurationMinute: $slotDurationMinute, perSlotAppointment: $perSlotAppointment, branchName: $branchName, address: $address, latitude: $latitude, longitude: $longitude, weeklyOffDays: $weeklyOffDays, scheduleServices: $scheduleServices, branchId: $branchId}';
+ }
}
+
class WeeklyOffDay {
final int? id;
final int? dayNumber;
diff --git a/lib/models/service_schedule_model.dart b/lib/models/service_schedule_model.dart
new file mode 100644
index 0000000..b8081f5
--- /dev/null
+++ b/lib/models/service_schedule_model.dart
@@ -0,0 +1,180 @@
+import 'package:mc_common_app/extensions/string_extensions.dart';
+import 'package:mc_common_app/models/services/item_model.dart';
+import 'package:mc_common_app/models/widgets_models.dart';
+
+class ServiceAppointmentScheduleModel {
+ List? serviceSlotList;
+ List? serviceItemList;
+ String? selectedDate;
+ String? selectedTimeSlot;
+ List? availableDates;
+ List? availableTimeSlots;
+ double? amountToPay;
+ double? amountTotal;
+ double? amountRem;
+
+ ServiceAppointmentScheduleModel({
+ this.serviceSlotList,
+ this.serviceItemList,
+ this.selectedDate,
+ this.selectedTimeSlot,
+ this.availableDates,
+ this.availableTimeSlots,
+ this.amountToPay,
+ this.amountTotal,
+ this.amountRem,
+ });
+
+ List getFormattedSlotTimes() {
+ var seenSlots = {};
+
+ var slotTimeData = serviceSlotList!
+ .where((slot) => seenSlots.add(TimeSlotModel(
+ slot: slot.startTime!,
+ slotId: slot.id!,
+ isSelected: false,
+ )))
+ .toList();
+ List slotTime = [];
+ for (var element in slotTimeData) {
+ slotTime.add(TimeSlotModel(isSelected: false, slotId: element.id!, slot: element.slotDate ?? ""));
+ }
+
+ return slotTime;
+ }
+
+ List getFormattedSlotDates() {
+ var seenDates = {};
+
+ var slotDatesData = serviceSlotList!
+ .where((slot) => seenDates.add(TimeSlotModel(
+ slot: slot.slotDate!,
+ slotId: slot.id!,
+ isSelected: false,
+ )))
+ .toList();
+ List slotDates = [];
+ for (var element in slotDatesData) {
+ slotDates.add(TimeSlotModel(isSelected: false, slotId: element.id!, slot: element.slotDate!.toFormattedDateWithoutTime() ?? ""));
+ }
+
+ return slotDates;
+ }
+
+ //TODO: I WILL START FROM HERE; I NEED TO ONLY PICK THE DISTINCT DATES FROM THE RESPONSE AND THEN BASED ON THE DATE SELECTION I WILL PICK THEIR SLOTS.
+ //TODO: AFTER THAT, I WILL
+
+ ServiceAppointmentScheduleModel.fromJson(Map json) {
+ if (json['serviceSlotList'] != null) {
+ serviceSlotList = [];
+ json['serviceSlotList'].forEach((v) {
+ serviceSlotList!.add(ServiceSlotList.fromJson(v));
+ });
+ }
+ if (json['serviceItemList'] != null) {
+ serviceItemList = [];
+ json['serviceItemList'].forEach((v) {
+ serviceItemList!.add(ItemData.fromJson(v));
+ });
+ }
+
+ amountToPay = json['amountToPay'];
+ selectedDate = '';
+ selectedTimeSlot = '';
+ availableDates = getFormattedSlotDates();
+ availableTimeSlots = getFormattedSlotTimes();
+ amountTotal = json['amountTotal'];
+ amountRem = json['amountRem'];
+ }
+
+ Map toJson() {
+ final Map data = {};
+ if (serviceSlotList != null) {
+ data['serviceSlotList'] = serviceSlotList!.map((v) => v.toJson()).toList();
+ }
+ if (serviceItemList != null) {
+ data['serviceItemList'] = serviceItemList!.map((v) => v.toJson()).toList();
+ }
+ data['amountToPay'] = amountToPay;
+ data['amountTotal'] = amountTotal;
+ data['amountRem'] = amountRem;
+ return data;
+ }
+}
+
+class ServiceSlotList {
+ int? id;
+ int? branchAppointmentScheduleID;
+ String? branchAppointmentSchedule;
+ int? serviceProviderID;
+ String? slotDate;
+ String? startTime;
+ String? endTime;
+ int? bookAppointment;
+ int? allowAppointment;
+ int? slotDurationMinute;
+ int? appointmentType;
+ bool? isActive;
+ int? createdBy;
+ String? createdOn;
+ int? modifiedBy;
+ String? modifiedOn;
+
+ ServiceSlotList(
+ {this.id,
+ this.branchAppointmentScheduleID,
+ this.branchAppointmentSchedule,
+ this.serviceProviderID,
+ this.slotDate,
+ this.startTime,
+ this.endTime,
+ this.bookAppointment,
+ this.allowAppointment,
+ this.slotDurationMinute,
+ this.appointmentType,
+ this.isActive,
+ this.createdBy,
+ this.createdOn,
+ this.modifiedBy,
+ this.modifiedOn});
+
+ ServiceSlotList.fromJson(Map json) {
+ id = json['id'];
+ branchAppointmentScheduleID = json['branchAppointmentScheduleID'];
+ branchAppointmentSchedule = json['branchAppointmentSchedule'];
+ serviceProviderID = json['serviceProviderID'];
+ slotDate = json['slotDate'];
+ startTime = json['startTime'];
+ endTime = json['endTime'];
+ bookAppointment = json['bookAppointment'];
+ allowAppointment = json['allowAppointment'];
+ slotDurationMinute = json['slotDurationMinute'];
+ appointmentType = json['appointmentType'];
+ isActive = json['isActive'];
+ createdBy = json['createdBy'];
+ createdOn = json['createdOn'];
+ modifiedBy = json['modifiedBy'];
+ modifiedOn = json['modifiedOn'];
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['id'] = id;
+ data['branchAppointmentScheduleID'] = branchAppointmentScheduleID;
+ data['branchAppointmentSchedule'] = branchAppointmentSchedule;
+ data['serviceProviderID'] = serviceProviderID;
+ data['slotDate'] = slotDate;
+ data['startTime'] = startTime;
+ data['endTime'] = endTime;
+ data['bookAppointment'] = bookAppointment;
+ data['allowAppointment'] = allowAppointment;
+ data['slotDurationMinute'] = slotDurationMinute;
+ data['appointmentType'] = appointmentType;
+ data['isActive'] = isActive;
+ data['createdBy'] = createdBy;
+ data['createdOn'] = createdOn;
+ data['modifiedBy'] = modifiedBy;
+ data['modifiedOn'] = modifiedOn;
+ return data;
+ }
+}
diff --git a/lib/models/services/item_model.dart b/lib/models/services/item_model.dart
index 9925e29..2ea572c 100644
--- a/lib/models/services/item_model.dart
+++ b/lib/models/services/item_model.dart
@@ -22,18 +22,18 @@ class ItemModel {
});
factory ItemModel.fromJson(Map json) => ItemModel(
- messageStatus: json["messageStatus"],
- totalItemsCount: json["totalItemsCount"],
- data: json["data"] == null ? [] : List.from(json["data"]!.map((x) => ItemData.fromJson(x))),
- message: json["message"],
- );
+ messageStatus: json["messageStatus"],
+ totalItemsCount: json["totalItemsCount"],
+ data: json["data"] == null ? [] : List.from(json["data"]!.map((x) => ItemData.fromJson(x))),
+ message: json["message"],
+ );
Map toJson() => {
- "messageStatus": messageStatus,
- "totalItemsCount": totalItemsCount,
- "data": data == null ? [] : List.from(data!.map((x) => x.toJson())),
- "message": message,
- };
+ "messageStatus": messageStatus,
+ "totalItemsCount": totalItemsCount,
+ "data": data == null ? [] : List.from(data!.map((x) => x.toJson())),
+ "message": message,
+ };
}
class ItemData {
@@ -49,6 +49,7 @@ class ItemData {
final bool? isAllowAppointment;
final bool? isAppointmentCompanyLoc;
final bool? isAppointmentCustomerLoc;
+ final double? appointmentPricePercentage;
bool? isUpdateOrSelected;
ItemData({
@@ -64,37 +65,38 @@ class ItemData {
this.isAllowAppointment,
this.isAppointmentCompanyLoc,
this.isAppointmentCustomerLoc,
+ this.appointmentPricePercentage,
this.isUpdateOrSelected,
});
factory ItemData.fromJson(Map json) => ItemData(
- id: json["id"],
- name: json["name"],
- price: json["price"].toString(),
- manufactureDate: json["manufactureDate"],
- description: json["description"],
- pictureUrl: json["pictureUrl"],
- companyId: json["companyID"],
- serviceProviderServiceId: json["serviceProviderServiceID"],
- isActive: json["isActive"],
- isAllowAppointment: json["isAllowAppointment"],
- isAppointmentCompanyLoc: json["isAppointmentCompanyLoc"],
- isAppointmentCustomerLoc: json["isAppointmentCustomerLoc"],
+ id: json["id"],
+ name: json["name"],
+ price: json["price"].toString(),
+ manufactureDate: json["manufactureDate"],
+ description: json["description"],
+ pictureUrl: json["pictureUrl"],
+ companyId: json["companyID"],
+ serviceProviderServiceId: json["serviceProviderServiceID"],
+ isActive: json["isActive"],
+ isAllowAppointment: json["isAllowAppointment"],
+ isAppointmentCompanyLoc: json["isAppointmentCompanyLoc"],
+ isAppointmentCustomerLoc: json["isAppointmentCustomerLoc"],
isUpdateOrSelected: false,
- );
+ );
Map toJson() => {
- "id": id,
- "name": name,
- "price": price,
- "manufactureDate": manufactureDate,
- "description": description,
- "pictureUrl": pictureUrl,
- "companyID": companyId,
- "serviceProviderServiceID": serviceProviderServiceId,
- "isActive": isActive,
- "isAllowAppointment": isAllowAppointment,
- "isAppointmentCompanyLoc": isAppointmentCompanyLoc,
- "isAppointmentCustomerLoc": isAppointmentCustomerLoc,
- };
-}
+ "id": id,
+ "name": name,
+ "price": price,
+ "manufactureDate": manufactureDate,
+ "description": description,
+ "pictureUrl": pictureUrl,
+ "companyID": companyId,
+ "serviceProviderServiceID": serviceProviderServiceId,
+ "isActive": isActive,
+ "isAllowAppointment": isAllowAppointment,
+ "isAppointmentCompanyLoc": isAppointmentCompanyLoc,
+ "isAppointmentCustomerLoc": isAppointmentCustomerLoc,
+ };
+}
\ No newline at end of file
diff --git a/lib/models/services/near_branch_model.dart b/lib/models/services/near_branch_model.dart
deleted file mode 100644
index 93d9cd6..0000000
--- a/lib/models/services/near_branch_model.dart
+++ /dev/null
@@ -1,39 +0,0 @@
-// To parse this JSON data, do
-//
-// final nearBrancheModel = nearBrancheModelFromJson(jsonString);
-
-import 'dart:convert';
-
-import 'branch_model.dart';
-
-NearBrancheModel nearBrancheModelFromJson(String str) => NearBrancheModel.fromJson(json.decode(str));
-
-String nearBrancheModelToJson(NearBrancheModel data) => json.encode(data.toJson());
-
-class NearBrancheModel {
- final int? messageStatus;
- final int? totalItemsCount;
- final List? data;
- final String? message;
-
- NearBrancheModel({
- this.messageStatus,
- this.totalItemsCount,
- this.data,
- this.message,
- });
-
- factory NearBrancheModel.fromJson(Map json) => NearBrancheModel(
- messageStatus: json["messageStatus"],
- totalItemsCount: json["totalItemsCount"],
- data: json["data"] == null ? [] : List.from(json["data"]!.map((x) => BranchModel.fromJson(x))),
- message: json["message"],
- );
-
- Map toJson() => {
- "messageStatus": messageStatus,
- "totalItemsCount": totalItemsCount,
- "data": data == null ? [] : List.from(data!.map((x) => x.toJson())),
- "message": message,
- };
-}
diff --git a/lib/models/services/service_model.dart b/lib/models/services/service_model.dart
index 3d04657..5306dd5 100644
--- a/lib/models/services/service_model.dart
+++ b/lib/models/services/service_model.dart
@@ -1,3 +1,4 @@
+
import 'package:mc_common_app/models/services/item_model.dart';
class ServiceModel {
@@ -75,4 +76,9 @@ class ServiceModel {
"itemsCount": itemsCount,
"branchServiceItems": serviceItems == null ? [] : List.from(serviceItems!.map((x) => x.toJson())),
};
+
+ @override
+ String toString() {
+ return 'ServiceModel{serviceProviderServiceId: $serviceProviderServiceId, providerServiceDescription: $providerServiceDescription, categoryId: $categoryId, categoryName: $categoryName, serviceId: $serviceId, serviceDescription: $serviceDescription, serviceDescriptionN: $serviceDescriptionN, serviceStatus: $serviceStatus, statusText: $statusText, isAllowAppointment: $isAllowAppointment, isAllowAppointmentHome: $isAllowAppointmentHome, customerLocationRange: $customerLocationRange, rangePricePerKm: $rangePricePerKm, itemsCount: $itemsCount, serviceItems: $serviceItems, isExpandedOrSelected: $isExpandedOrSelected}';
+ }
}
diff --git a/lib/packages/cutom_country_code_picker.dart b/lib/packages/cutom_country_code_picker.dart
new file mode 100644
index 0000000..3e1aa11
--- /dev/null
+++ b/lib/packages/cutom_country_code_picker.dart
@@ -0,0 +1,302 @@
+import 'package:collection/collection.dart' show IterableExtension;
+import 'package:country_code_picker/country_code_picker.dart';
+import 'package:flutter/material.dart';
+
+class CustomCountryCodePicker extends StatefulWidget {
+ final bool isTextNeeded;
+ final ValueChanged? onChanged;
+ final ValueChanged? onInit;
+ final String? initialSelection;
+ final List favorite;
+ final TextStyle? textStyle;
+ final EdgeInsetsGeometry padding;
+ final bool showCountryOnly;
+ final InputDecoration searchDecoration;
+ final TextStyle? searchStyle;
+ final TextStyle? dialogTextStyle;
+ final WidgetBuilder? emptySearchBuilder;
+ final Function(CountryCode?)? builder;
+ final bool enabled;
+ final TextOverflow textOverflow;
+ final Icon closeIcon;
+
+ /// Barrier color of ModalBottomSheet
+ final Color? barrierColor;
+
+ /// Background color of ModalBottomSheet
+ final Color? backgroundColor;
+
+ /// BoxDecoration for dialog
+ final BoxDecoration? boxDecoration;
+
+ /// the size of the selection dialog
+ final Size? dialogSize;
+
+ /// Background color of selection dialog
+ final Color? dialogBackgroundColor;
+
+ /// used to customize the country list
+ final List? countryFilter;
+
+ /// shows the name of the country instead of the dialcode
+ final bool showOnlyCountryWhenClosed;
+
+ /// aligns the flag and the Text left
+ ///
+ /// additionally this option also fills the available space of the widget.
+ /// this is especially useful in combination with [showOnlyCountryWhenClosed],
+ /// because longer country names are displayed in one line
+ final bool alignLeft;
+
+ /// shows the flag
+ final bool showFlag;
+
+ final bool hideMainText;
+
+ final bool? showFlagMain;
+
+ final bool? showFlagDialog;
+
+ /// Width of the flag images
+ final double flagWidth;
+
+ /// Use this property to change the order of the options
+ final Comparator? comparator;
+
+ /// Set to true if you want to hide the search part
+ final bool hideSearch;
+
+ /// Set to true if you want to show drop down button
+ final bool showDropDownButton;
+
+ /// [BoxDecoration] for the flag image
+ final Decoration? flagDecoration;
+
+ /// An optional argument for injecting a list of countries
+ /// with customized codes.
+ final List