last 16-10-2025

This commit is contained in:
mageshwaran committed 2025-10-16 11:21:52 +05:30
commit 7546b7348c
269 files changed
+36404

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
class BannerModel {
final int id;
final String documentUrl; // Added to store the full URL
final String createdDate;
BannerModel({
required this.id,
required this.documentUrl,
required this.createdDate,
});
// Fixed factory method
factory BannerModel.fromJson(Map<String, dynamic> json) {
return BannerModel(
id: json['id'] as int,
documentUrl:
json['document1']
as String, // Use the document1 field which contains the full URL
createdDate: json['created_date'] as String,
);
}
Map<String, dynamic> toJson() {
return {'id': id, 'document1': documentUrl, 'created_date': createdDate};
}
// Convenience method to get the image URL if needed
String get imageUrl => documentUrl;
}
+48
View File
@@ -0,0 +1,48 @@
// ignore: file_names
class BookingModel {
final String name;
final String mobileNumber;
final String email;
final String message;
final String serviceDate;
final String serviceTime;
final String serviceId;
final String address;
BookingModel({
required this.name,
required this.mobileNumber,
required this.email,
required this.message,
required this.serviceDate,
required this.serviceTime,
required this.serviceId,
required this.address,
});
factory BookingModel.fromJson(Map<String, dynamic> json) {
return BookingModel(
name: json['name'] ?? '',
mobileNumber: json['mobile_number'] ?? '',
email: json['email'] ?? '',
message: json['message'] ?? '',
serviceDate: json['service_date'] ?? '',
serviceTime: json['service_time'] ?? '',
serviceId: json['service_id'] ?? '',
address: json['address'] ?? '',
);
}
Map<String, dynamic> toJson() {
return {
'name': name,
'mobile_number': mobileNumber,
'email': email,
'message': message,
'service_date': serviceDate,
'service_time': serviceTime,
'service_id': serviceId,
'address': address,
};
}
}
+47
View File
@@ -0,0 +1,47 @@
class CategoriesModel {
final int id;
final String name;
// Icon filename
final String iconUrl; // Full icon URL
// Image filename
final String imageUrl; // Full image URL
final String createdDate;
CategoriesModel({
required this.id,
required this.name,
required this.iconUrl,
required this.imageUrl,
required this.createdDate,
});
factory CategoriesModel.fromJson(Map<String, dynamic> json) {
return CategoriesModel(
id: json['id'],
name: json['name'],
iconUrl: json['icon1'] ?? '',
imageUrl: json['image1'] ?? '',
createdDate: json['created_date'] ?? '',
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
'icon1': iconUrl,
'image1': imageUrl,
'created_date': createdDate,
};
}
// Convenience getters to access the image URLs
String getIconUrl() => iconUrl;
String getImageUrl() => imageUrl;
}
+13
View File
@@ -0,0 +1,13 @@
class BookingModifyModel {
final String id;
final String serviceId;
final String servicedate;
final String servicetime;
BookingModifyModel({
required this.id,
required this.serviceId,
required this.servicedate,
required this.servicetime,
});
}
+11
View File
@@ -0,0 +1,11 @@
class CancelBookingRequest {
final String id;
final String serviceId;
final String type;
CancelBookingRequest({
required this.id,
required this.serviceId,
required this.type,
});
}
+150
View File
@@ -0,0 +1,150 @@
class DetailPageModel {
int id;
int vendorId;
int serviceType;
String vendorname;
String servicename;
int category;
int subcategory;
String workinghours;
String workingduration;
String amount;
String location;
String description;
String details;
String averageReview;
List<String>? videos;
String createdDate;
String vendorName;
String? profilePic;
String categoryName;
String subcategoryName;
List<String> images1;
DetailPageModel({
required this.id,
required this.vendorId,
required this.serviceType,
required this.vendorname,
required this.servicename,
required this.category,
required this.subcategory,
required this.workinghours,
required this.workingduration,
required this.amount,
required this.location,
required this.description,
required this.details,
required this.averageReview,
this.videos,
required this.createdDate,
required this.vendorName,
this.profilePic,
required this.categoryName,
required this.subcategoryName,
required this.images1,
});
factory DetailPageModel.fromJson(Map<String, dynamic> json) {
// Helper function to safely convert to string
String safeString(dynamic value) {
if (value == null) return '';
return value.toString();
}
// Helper function to safely convert to int
int safeInt(dynamic value) {
if (value == null) return 0;
if (value is int) return value;
if (value is String) return int.tryParse(value) ?? 0;
return 0;
}
// Helper function to safely handle videos
List<String>? safeVideos(dynamic value) {
if (value == null) return null;
if (value is String && value.isNotEmpty) return [value];
if (value is List) {
return value
.map((e) => e?.toString() ?? '')
.where((e) => e.isNotEmpty)
.toList();
}
return null;
}
// Helper function to safely handle images
List<String> safeImages(dynamic value) {
if (value == null) return [];
if (value is List) {
return value
.map((e) => e?.toString() ?? '')
.where((e) => e.isNotEmpty)
.toList();
}
if (value is String && value.isNotEmpty) return [value];
return [];
}
return DetailPageModel(
id: safeInt(json['id']),
vendorId: safeInt(json['vendor_id']),
serviceType: safeInt(json['service_type']),
vendorname: safeString(json['vendorname']),
servicename: safeString(json['servicename']),
category: safeInt(json['category']),
subcategory: safeInt(json['subcategory']),
workinghours: safeString(json['workinghours']),
workingduration: safeString(json['workingduration']),
amount: safeString(json['amount']),
location: safeString(json['location']),
description: safeString(json['description']),
details: safeString(json['details']),
averageReview: safeString(json['average_review']),
videos: safeVideos(json['videos']),
createdDate: safeString(json['created_date']),
vendorName: safeString(json['vendor_name']),
profilePic: json['profile_pic']?.toString(),
categoryName: safeString(json['category_name']),
subcategoryName: safeString(json['subcategory_name']),
images1: safeImages(json['images1']),
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'vendor_id': vendorId,
'service_type': serviceType,
'vendorname': vendorname,
'servicename': servicename,
'category': category,
'subcategory': subcategory,
'workinghours': workinghours,
'workingduration': workingduration,
'amount': amount,
'location': location,
'description': description,
'details': details,
'average_review': averageReview,
'videos': videos,
'created_date': createdDate,
'vendor_name': vendorName,
'profile_pic': profilePic,
'category_name': categoryName,
'subcategory_name': subcategoryName,
'images1': images1,
};
}
// Helper method to get a safe display value
String getDisplayValue(String value) {
return value.isEmpty ? 'N/A' : value;
}
// Helper method to check if images are available
bool get hasImages => images1.isNotEmpty;
// Helper method to check if videos are available
bool get hasVideos => videos != null && videos!.isNotEmpty;
}
+62
View File
@@ -0,0 +1,62 @@
class EnquiryListModel {
final int id;
final String name;
final String mobile;
final String email;
final int serviceId;
final int userId;
final String message;
final String createdDate;
final String serviceName;
final String vendorName;
final List<String> images1;
EnquiryListModel({
required this.id,
required this.name,
required this.mobile,
required this.email,
required this.serviceId,
required this.userId,
required this.message,
required this.createdDate,
required this.serviceName,
required this.vendorName,
required this.images1,
});
factory EnquiryListModel.fromJson(Map<String, dynamic> json) {
return EnquiryListModel(
id: json['id'] ?? 0,
name: json['name'] ?? '',
mobile: json['mobile'] ?? '',
email: json['email'] ?? '',
serviceId: json['service_id'] ?? 0,
userId: json['user_id'] ?? 0,
message: json['message'] ?? '',
createdDate: json['created_date'] ?? '',
serviceName: json['service_name'] ?? '',
vendorName: json['vendorname'] ?? '',
images1: List<String>.from(json['images1'] ?? []),
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
'mobile': mobile,
'email': email,
'service_id': serviceId,
'user_id': userId,
'message': message,
'created_date': createdDate,
'service_name': serviceName,
'vendorname': vendorName,
'images1': images1,
};
}
}
+37
View File
@@ -0,0 +1,37 @@
class EnquiryModel {
String? mobile;
String? name;
String? serviceId;
String? message;
String? email;
EnquiryModel({
this.mobile,
this.name,
this.serviceId,
this.message,
this.email,
});
// Factory method to create an EnquiryModel from a JSON map
factory EnquiryModel.fromJson(Map<String, dynamic> json) {
return EnquiryModel(
mobile: json['mobile'],
name: json['name'],
serviceId: json['service_id'],
message: json['message'],
email: json['email'],
);
}
// Method to convert EnquiryModel to a JSON map
Map<String, dynamic> toJson() {
return {
'mobile': mobile,
'name': name,
'service_id': serviceId,
'message': message,
'email': email,
};
}
}
+70
View File
@@ -0,0 +1,70 @@
class ExpiredPlanModel {
final int? id;
final int? userId;
final int? type;
final int? planId;
final String? endDate;
final String? createdDate;
final String? planName;
final String? price;
final int? duration;
final String? description;
ExpiredPlanModel({
this.id,
this.userId,
this.type,
this.planId,
this.endDate,
this.createdDate,
this.planName,
this.price,
this.duration,
this.description,
});
factory ExpiredPlanModel.fromJson(Map<String, dynamic> json) {
return ExpiredPlanModel(
id:
json['id'] is int
? json['id']
: int.tryParse(json['id']?.toString() ?? ''),
userId:
json['user_id'] is int
? json['user_id']
: int.tryParse(json['user_id']?.toString() ?? ''),
type:
json['type'] is int
? json['type']
: int.tryParse(json['type']?.toString() ?? ''),
planId:
json['plan_id'] is int
? json['plan_id']
: int.tryParse(json['plan_id']?.toString() ?? ''),
endDate: json['end_date']?.toString(),
createdDate: json['created_date']?.toString(),
planName: json['plan_name']?.toString(),
price: json['price']?.toString(),
duration:
json['duration'] is int
? json['duration']
: int.tryParse(json['duration']?.toString() ?? ''),
description: json['description']?.toString(),
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'user_id': userId,
'type': type,
'plan_id': planId,
'end_date': endDate,
'created_date': createdDate,
'plan_name': planName,
'price': price,
'duration': duration,
'description': description,
};
}
}
+47
View File
@@ -0,0 +1,47 @@
class GetReviewModel {
final int id;
final int userId;
final int serviceId;
final String review;
final String createdDate;
final String userName;
final String? profilePic1;
GetReviewModel({
required this.id,
required this.userId,
required this.serviceId,
required this.review,
required this.createdDate,
required this.userName,
this.profilePic1,
});
factory GetReviewModel.fromJson(Map<String, dynamic> json) {
return GetReviewModel(
id: json['id'] ?? 0,
userId: json['user_id'] ?? 0,
serviceId: json['service_id'] ?? 0,
review: json['review'] ?? '',
createdDate: json['created_date'] ?? '',
userName: json['user_name'] ?? '',
profilePic1: json['profile_pic1'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'user_id': userId,
'service_id': serviceId,
'review': review,
'created_date': createdDate,
'user_name': userName,
'profile_pic1': profilePic1,
};
}
}
+22
View File
@@ -0,0 +1,22 @@
class LoginModel {
String email;
String password;
LoginModel({required this.email, required this.password});
// For converting to JSON
Map<String, dynamic> toJson() {
return {
'email': email,
'password': password,
};
}
// For creating an instance from JSON
factory LoginModel.fromJson(Map<String, dynamic> json) {
return LoginModel(
email: json['email'] ?? '',
password: json['password'] ?? '',
);
}
}
+105
View File
@@ -0,0 +1,105 @@
class MostPopularModel {
final int id;
final int vendorId;
final int serviceType;
final String vendorName;
final String? vendorNameAlt;
final String serviceName;
final int category;
final int subcategory;
final String workingHours;
final String workingDuration;
final String amount;
final String location;
final String description;
final String details;
final List<String>? images1; // ✅ updated from String? to List<String>?
final String? videos;
final String createdDate;
final String? profilePic1; // ✅ new field
final double? averageReview;
final String phoneNumber;
MostPopularModel({
required this.id,
required this.vendorId,
required this.serviceType,
required this.vendorName,
this.vendorNameAlt,
required this.serviceName,
required this.category,
required this.subcategory,
required this.workingHours,
required this.workingDuration,
required this.amount,
required this.location,
required this.description,
required this.details,
this.images1,
this.videos,
required this.createdDate,
this.profilePic1, // ✅ new field
this.averageReview,
required this.phoneNumber,
});
factory MostPopularModel.fromJson(Map<String, dynamic> json) {
return MostPopularModel(
id: json['id'] ?? 0,
vendorId: json['vendor_id'] ?? 0,
serviceType: json['service_type'] ?? 0,
vendorName: json['vendorname'] ?? '',
vendorNameAlt: json['vendor_name'],
serviceName: json['servicename'] ?? '',
category: json['category'] ?? 0,
subcategory: json['subcategory'] ?? 0,
workingHours: json['workinghours'] ?? '',
workingDuration: json['workingduration'] ?? '',
amount: json['amount']?.toString() ?? '',
location: json['location'] ?? '',
description: json['description'] ?? '',
details: json['details'] ?? '',
images1:
(json['images1'] != null) ? List<String>.from(json['images1']) : null,
videos: json['videos'],
createdDate: json['created_date'] ?? '',
profilePic1: json['profile_pic1'], // ✅ new field
averageReview:
json['average_review'] != null
? (json['average_review'] is double)
? json['average_review']
: double.tryParse(json['average_review'].toString())
: null,
phoneNumber: json['phone_number'] ?? '',
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'vendor_id': vendorId,
'service_type': serviceType,
'vendorname': vendorName,
'vendor_name': vendorNameAlt,
'servicename': serviceName,
'category': category,
'subcategory': subcategory,
'workinghours': workingHours,
'workingduration': workingDuration,
'amount': amount,
'location': location,
'description': description,
'details': details,
'images1': images1,
'videos': videos,
'created_date': createdDate,
'profile_pic1': profilePic1, // ✅ new field
'average_review': averageReview,
'phone_number': phoneNumber,
};
}
}
+43
View File
@@ -0,0 +1,43 @@
class NotificationModel {
final int id;
final int userId;
final int type;
final int serviceId;
final String message;
final bool isRead; // Add this field
final String createdDate;
final List<String> images;
NotificationModel({
required this.id,
required this.userId,
required this.type,
required this.serviceId,
required this.isRead,
required this.message,
required this.createdDate,
required this.images,
});
factory NotificationModel.fromJson(Map<String, dynamic> json) {
// Handle both 'images' and 'images1' fields from API
List<String> imageList = [];
if (json['images1'] != null && json['images1'] is List) {
imageList = List<String>.from(json['images1']);
}
return NotificationModel(
id: json['id'] ?? 0,
userId: json['user_id'] ?? 0,
type: json['type'] ?? 0,
isRead: json['is_read'] ?? false,
serviceId: json['service_id'] ?? 0,
message: json['message'] ?? '',
createdDate: json['created_date'] ?? '',
images: imageList,
);
}
// ... rest of the class
}
+13
View File
@@ -0,0 +1,13 @@
class OtpModel {
final String userId; // Keep as String
final String otp;
OtpModel({required this.userId, required this.otp});
Map<String, dynamic> toJson() {
return {
'user_id': userId, // Send as String
'otp': otp,
};
}
}
+47
View File
@@ -0,0 +1,47 @@
class PackageModel {
final int id;
final String name;
final String price;
final int duration;
final String description;
final int type;
final int noOfService;
final String createdDate;
PackageModel({
required this.id,
required this.name,
required this.price,
required this.duration,
required this.description,
required this.type,
required this.noOfService,
required this.createdDate,
});
factory PackageModel.fromJson(Map<String, dynamic> json) {
return PackageModel(
id: json['id'],
name: json['name'],
price: json['price'],
duration: json['duration'],
description: json['description'],
type: json['type'],
noOfService: json['no_of_service'],
createdDate: json['created_date'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
'price': price,
'duration': duration,
'description': description,
'type': type,
'no_of_service': noOfService,
'created_date': createdDate,
};
}
}
+55
View File
@@ -0,0 +1,55 @@
class PaymentDetailsModel {
final int id;
final int userId;
final int type;
final int planId;
final String endDate;
final String createdDate;
final String planName;
final String price;
final int duration;
final String description;
PaymentDetailsModel({
required this.id,
required this.userId,
required this.type,
required this.planId,
required this.endDate,
required this.createdDate,
required this.planName,
required this.price,
required this.duration,
required this.description,
});
factory PaymentDetailsModel.fromJson(Map<String, dynamic> json) {
return PaymentDetailsModel(
id: json['id'] ?? 0,
userId: json['user_id'] ?? 0,
type: json['type'] ?? 0,
planId: json['plan_id'] ?? 0,
endDate: json['end_date'] ?? '',
createdDate: json['created_date'] ?? '',
planName: json['plan_name'] ?? '',
price: json['price'] ?? '',
duration: json['duration'] ?? 0,
description: json['description'] ?? '',
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'user_id': userId,
'type': type,
'plan_id': planId,
'end_date': endDate,
'created_date': createdDate,
'plan_name': planName,
'price': price,
'duration': duration,
'description': description,
};
}
}
+22
View File
@@ -0,0 +1,22 @@
class PlanSuccessModel {
final String userId;
final String planId;
final int duration;
final int type;
PlanSuccessModel({
required this.userId,
required this.planId,
required this.duration,
required this.type,
});
Map<String, dynamic> toJson() {
return {
'user_id': userId,
'plan_id': planId,
'duration': duration.toString(),
'type': type.toString(),
};
}
}
+74
View File
@@ -0,0 +1,74 @@
class ProfileGetModel {
final int id;
final String name;
final String number;
final String email;
final String password;
final int otp;
final int isVerified;
final String? address;
final String? profilePic1;
final String? updatedAt;
final String createdAt;
final String? vendorStatus;
final String? vendorId;
final String? endDate;
ProfileGetModel({
required this.id,
required this.name,
required this.number,
required this.email,
required this.password,
required this.otp,
required this.isVerified,
this.address,
this.profilePic1,
this.updatedAt,
required this.createdAt,
this.vendorStatus,
this.vendorId,
this.endDate,
});
/// Factory method to create an instance from a JSON map
factory ProfileGetModel.fromJson(Map<String, dynamic> json) {
return ProfileGetModel(
id: int.tryParse(json['id'].toString()) ?? 0,
name: json['name']?.toString() ?? '',
number: json['number']?.toString() ?? '',
email: json['email']?.toString() ?? '',
password: json['password']?.toString() ?? '',
otp: int.tryParse(json['otp'].toString()) ?? 0,
isVerified: int.tryParse(json['is_verified'].toString()) ?? 0,
address: json['address']?.toString(),
profilePic1: json['profile_pic1']?.toString(),
updatedAt: json['updated_at']?.toString(),
createdAt: json['created_at']?.toString() ?? '',
vendorStatus: json['vendor_status']?.toString(),
vendorId: json['vendor_id']?.toString(),
endDate: json['end_date']?.toString(),
);
}
/// Method to convert the object to a JSON map
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
'number': number,
'email': email,
'password': password,
'otp': otp,
'is_verified': isVerified,
'address': address,
'profile_pic1': profilePic1,
'updated_at': updatedAt,
'created_at': createdAt,
'vendor_status': vendorStatus,
'vendor_id': vendorId,
'end_date': endDate,
};
}
}
+118
View File
@@ -0,0 +1,118 @@
class ServiceModel {
final int id;
final int vendorId;
final int serviceType;
final String vendorName;
final String serviceName;
final int category;
final int subcategory;
final String workingHours;
final String workingDuration;
final String amount;
final String location;
final String description;
final String details;
final String? videos;
final String createdDate;
final String vendorDisplayName;
final String? profilePic1; // Added for JSON field "profile_pic1"
final String? averageReview;
final String phoneNumber;
final String categoryName;
final String subcategoryName;
final List<String>? images1; // Changed to List<String>?
ServiceModel({
required this.id,
required this.vendorId,
required this.serviceType,
required this.vendorName,
required this.serviceName,
required this.category,
required this.subcategory,
required this.workingHours,
required this.workingDuration,
required this.amount,
required this.location,
required this.description,
required this.details,
this.videos,
required this.createdDate,
required this.vendorDisplayName,
this.profilePic1,
this.averageReview,
required this.phoneNumber,
required this.categoryName,
required this.subcategoryName,
this.images1,
});
factory ServiceModel.fromJson(Map<String, dynamic> json) {
return ServiceModel(
id: json['id'] ?? 0,
vendorId: json['vendor_id'] ?? 0,
serviceType: json['service_type'] ?? 0,
vendorName: json['vendorname']?.toString() ?? '',
serviceName: json['servicename']?.toString() ?? '',
category: json['category'] ?? 0,
subcategory: json['subcategory'] ?? 0,
workingHours: json['workinghours']?.toString() ?? '',
workingDuration: json['workingduration']?.toString() ?? '',
amount: json['amount']?.toString() ?? '',
location: json['location']?.toString() ?? '',
description: json['description']?.toString() ?? '',
details: json['details']?.toString() ?? '',
videos:
(json['videos']?.toString().isNotEmpty ?? false)
? json['videos'].toString()
: null,
createdDate: json['created_date']?.toString() ?? '',
vendorDisplayName: json['vendor_name']?.toString() ?? '',
profilePic1: json['profile_pic1']?.toString(), // New field
averageReview:
(json['average_review']?.toString().isNotEmpty ?? false)
? json['average_review'].toString()
: null,
phoneNumber: json['phone_number']?.toString() ?? '',
categoryName: json['category_name']?.toString() ?? '',
subcategoryName: json['subcategory_name']?.toString() ?? '',
images1:
json['images1'] != null ? List<String>.from(json['images1']) : null,
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'vendor_id': vendorId,
'service_type': serviceType,
'vendorname': vendorName,
'servicename': serviceName,
'category': category,
'subcategory': subcategory,
'workinghours': workingHours,
'workingduration': workingDuration,
'amount': amount,
'location': location,
'description': description,
'details': details,
'videos': videos,
'created_date': createdDate,
'vendor_name': vendorDisplayName,
'profile_pic1': profilePic1,
'average_review': averageReview,
'phone_number': phoneNumber,
'category_name': categoryName,
'subcategory_name': subcategoryName,
'images1': images1,
};
}
}
+33
View File
@@ -0,0 +1,33 @@
class SignUpModel {
final String name;
final String number;
final String password;
final String email;
SignUpModel({
required this.name,
required this.number,
required this.password,
required this.email,
});
// Optional: toJson for API calls
Map<String, dynamic> toJson() {
return {
'name': name,
'number': number,
'password': password,
'email': email,
};
}
// Optional: fromJson for parsing API responses
factory SignUpModel.fromJson(Map<String, dynamic> json) {
return SignUpModel(
name: json['name'],
number: json['number'],
password: json['password'],
email: json['email'],
);
}
}
+39
View File
@@ -0,0 +1,39 @@
class SubcategoryModel {
final int id;
final int category;
final String name;
final String createdDate;
final String icon1; // Added the missing icon1 field
SubcategoryModel({
required this.id,
required this.category,
required this.name,
required this.createdDate,
required this.icon1, // Added to constructor
});
factory SubcategoryModel.fromJson(Map<String, dynamic> json) {
return SubcategoryModel(
id: json['id'],
category: json['category'],
name: json['name'],
createdDate: json['created_date'],
icon1: json['icon1'], // Parse icon1 from JSON
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'category': category,
'name': name,
'created_date': createdDate,
'icon1': icon1, // Include icon1 in JSON output
};
}
}
+155
View File
@@ -0,0 +1,155 @@
import 'dart:convert';
class UserBookingDetails {
final int id;
final String name;
final String mobileNumber;
final String email;
final String message;
final String serviceDate;
final String serviceTime;
final int serviceId;
final int userId;
final String address;
final int status;
final int type;
final String cancelDate;
final String createdDate;
final String serviceName;
final String vendorName;
final String workingHours;
final String amount;
final List<String> videos;
final String workingDuration;
final String description;
final String? profilePic;
final String? averageReview;
final int isRated;
final String? vendorname;
final String categoryName;
final String subcategoryName;
final List<String> images1;
UserBookingDetails({
required this.id,
required this.name,
required this.mobileNumber,
required this.email,
required this.message,
required this.serviceDate,
required this.serviceTime,
required this.serviceId,
required this.userId,
required this.address,
required this.status,
required this.type,
required this.cancelDate,
required this.createdDate,
required this.serviceName,
required this.vendorName,
required this.workingHours,
required this.amount,
required this.videos,
required this.workingDuration,
required this.description,
this.profilePic,
this.averageReview,
required this.isRated,
this.vendorname,
required this.categoryName,
required this.subcategoryName,
required this.images1,
});
factory UserBookingDetails.fromJson(Map<String, dynamic> json) {
// Helper function to safely convert dynamic data to List<String>
List<String> convertToList(dynamic value) {
if (value == null) return <String>[];
if (value is List) {
return List<String>.from(value.map((x) => x.toString()));
}
if (value is String) {
try {
// Try to parse if it's a JSON string
final parsed = jsonDecode(value);
if (parsed is List) {
return List<String>.from(parsed.map((x) => x.toString()));
}
return [value];
} catch (e) {
return [value];
}
}
return <String>[];
}
return UserBookingDetails(
id: json['id'] ?? 0,
name: json['name'] ?? '',
mobileNumber: json['mobile_number'] ?? '',
email: json['email'] ?? '',
message: json['message'] ?? '',
serviceDate: json['service_date'] ?? '',
serviceTime: json['service_time'] ?? '',
serviceId: json['service_id'] ?? 0,
userId: json['user_id'] ?? 0,
address: json['address'] ?? '',
status: json['status'] ?? 0,
type: json['type'] ?? 0,
cancelDate: json['cancel_date'] ?? '',
createdDate: json['created_date'] ?? '',
serviceName: json['service_name'] ?? '',
vendorName: json['vendorname'] ?? '',
workingHours: json['workinghours'] ?? '',
amount: json['amount'] ?? '',
videos: convertToList(json['videos']),
workingDuration: json['workingduration'] ?? '',
description: json['description'] ?? '',
profilePic: json['profile_pic'],
averageReview: json['average_review']?.toString(),
isRated: json['is_rated'] ?? 0,
vendorname: json['vendor_name'],
categoryName: json['category_name'] ?? '',
subcategoryName: json['subcategory_name'] ?? '',
images1: convertToList(json['images1']),
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
'mobile_number': mobileNumber,
'email': email,
'message': message,
'service_date': serviceDate,
'service_time': serviceTime,
'service_id': serviceId,
'user_id': userId,
'address': address,
'status': status,
'type': type,
'cancel_date': cancelDate,
'created_date': createdDate,
'service_name': serviceName,
'vendorname': vendorName,
'workinghours': workingHours,
'amount': amount,
'videos': videos,
'workingduration': workingDuration,
'description': description,
'profile_pic': profilePic,
'average_review': averageReview,
'is_rated': isRated,
'vendor_name': vendorname,
'category_name': categoryName,
'subcategory_name': subcategoryName,
'images1': images1,
};
}
@override
String toString() {
return 'UserBookingDetails{id: $id, name: $name, mobileNumber: $mobileNumber, email: $email, message: $message, serviceDate: $serviceDate, serviceTime: $serviceTime, serviceId: $serviceId, userId: $userId, address: $address, status: $status, type: $type, cancelDate: $cancelDate, createdDate: $createdDate, serviceName: $serviceName, vendorName: $vendorName, workingHours: $workingHours, amount: $amount, videos: $videos, workingDuration: $workingDuration, description: $description, profilePic: $profilePic, averageReview: $averageReview, isRated: $isRated, vendor_name: $vendorname, categoryName: $categoryName, subcategoryName: $subcategoryName, images1: $images1}';
}
}
@@ -0,0 +1,19 @@
class TermsAndConditionsModel {
final String data;
final String message;
final bool success;
TermsAndConditionsModel({
required this.data,
required this.message,
required this.success,
});
factory TermsAndConditionsModel.fromJson(Map<String, dynamic> json) {
return TermsAndConditionsModel(
data: json['data'] ?? '',
message: json['message'] ?? '',
success: json['success'] ?? false,
);
}
}
@@ -0,0 +1,120 @@
class VendorBookingModel {
int? id;
String? name;
String? mobileNumber;
String? email;
String? message;
String? serviceDate;
String? serviceTime;
int? serviceId;
int? userId;
String? address;
int? status;
String? type;
String? cancelDate;
String? createdDate;
String? serviceName;
String? username;
String? workingHours;
String? categoryName;
String? images1; // Added missing field
String? profilePic1; // Added missing field
VendorBookingModel({
this.id,
this.name,
this.mobileNumber,
this.email,
this.message,
this.serviceDate,
this.serviceTime,
this.serviceId,
this.userId,
this.address,
this.status,
this.type,
this.cancelDate,
this.createdDate,
this.serviceName,
this.username,
this.workingHours,
this.categoryName,
this.images1, // Added to constructor
this.profilePic1, // Added to constructor
});
VendorBookingModel.fromJson(Map<String, dynamic> json) {
// Helper function to safely convert values to int
int? toInt(dynamic value) {
if (value == null) return null;
if (value is int) return value;
if (value is String) {
try {
return int.parse(value);
} catch (e) {
print('Error parsing to int: $value');
return null;
}
}
return null;
}
// Helper function to safely convert values to string
String? toString(dynamic value) {
if (value == null) return null;
return value.toString();
}
id = toInt(json['id']);
name = toString(json['name']);
mobileNumber = toString(json['mobile_number']);
email = toString(json['email']);
message = toString(json['message']);
serviceDate = toString(json['service_date']);
serviceTime = toString(json['service_time']);
serviceId = toInt(json['service_id']);
userId = toInt(json['user_id']);
address = toString(json['address']);
status = toInt(json['status']);
type = toString(json['type']);
cancelDate = toString(json['cancel_date']);
createdDate = toString(json['created_date']);
serviceName = toString(json['service_name']);
username = toString(json['username']);
workingHours = toString(json['workinghours']);
categoryName = toString(json['category_name']);
images1 = toString(json['images1']); // Parse images1 from JSON
profilePic1 = toString(
json['profile_pic1'],
); // Parse profile_pic1 from JSON
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
'mobile_number': mobileNumber,
'email': email,
'message': message,
'service_date': serviceDate,
'service_time': serviceTime,
'service_id': serviceId,
'user_id': userId,
'address': address,
'status': status,
'type': type,
'cancel_date': cancelDate,
'created_date': createdDate,
'service_name': serviceName,
'username': username,
'workinghours': workingHours,
'category_name': categoryName,
'images1': images1, // Include images1 in JSON output
'profile_pic1': profilePic1, // Include profile_pic1 in JSON output
};
}
}
@@ -0,0 +1,28 @@
class VendorBookingStatus {
final String id;
final String status;
VendorBookingStatus({
required this.id,
required this.status,
});
factory VendorBookingStatus.fromJson(Map<String, dynamic> json) {
return VendorBookingStatus(
id: json['id']?.toString() ?? "0",
status: json['status']?.toString() ?? "0",
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'status': status
};
}
@override
String toString() {
return 'VendorBookingStatus{id: $id, status: $status}';
}
}
@@ -0,0 +1,43 @@
class VendorCategoriesModel {
int? id;
String? name;
String? createdDate;
int? noOfService;
String? icon1;
String? image1;
VendorCategoriesModel({
this.id,
this.name,
this.createdDate,
this.noOfService,
this.icon1,
this.image1,
});
factory VendorCategoriesModel.fromJson(Map<String, dynamic> json) {
return VendorCategoriesModel(
id: json['id'],
name: json['name'] ?? '',
createdDate: json['created_date'] ?? '',
noOfService: json['no_of_service'] ?? 0,
icon1: json['icon1'] ?? '',
image1: json['image1'] ?? '',
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
'created_date': createdDate,
'no_of_service': noOfService,
'icon1': icon1,
'image1': image1,
};
}
}
@@ -0,0 +1,75 @@
class VendorGetProfileModel {
final int id;
final String name;
final String email;
final String number;
final String location;
final String pincode;
final String aadharcard;
final String pancard;
final String drivingLicence;
final String passport;
final String? profilePic1;
final int status;
final int userId;
final String createdDate;
final String? endDate;
VendorGetProfileModel({
required this.id,
required this.name,
required this.email,
required this.number,
required this.location,
required this.pincode,
required this.aadharcard,
required this.pancard,
required this.drivingLicence,
required this.passport,
this.profilePic1,
required this.status,
required this.userId,
required this.createdDate,
this.endDate,
});
factory VendorGetProfileModel.fromJson(Map<String, dynamic> json) {
return VendorGetProfileModel(
id: json['id'],
name: json['name'],
email: json['email'],
number: json['number'],
location: json['location'],
pincode: json['pincode'],
aadharcard: json['aadharcard'],
pancard: json['pancard'],
drivingLicence: json['driving_licence'],
passport: json['passport'],
profilePic1: json['profile_pic1'],
status: json['status'],
userId: json['user_id'],
createdDate: json['created_date'],
endDate: json['end_date'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
'email': email,
'number': number,
'location': location,
'pincode': pincode,
'aadharcard': aadharcard,
'pancard': pancard,
'driving_licence': drivingLicence,
'passport': passport,
'profile_pic1': profilePic1,
'status': status,
'user_id': userId,
'created_date': createdDate,
'end_date': endDate,
};
}
}
@@ -0,0 +1,74 @@
class VendorProfileModel {
final int id;
final String name;
final String number;
final String email;
final String password;
final int otp;
final int isVerified;
final String? address;
final String? profilePic1;
final String? updatedAt;
final String createdAt;
final String? vendorStatus;
final String? vendorId;
final String? endDate;
VendorProfileModel({
required this.id,
required this.name,
required this.number,
required this.email,
required this.password,
required this.otp,
required this.isVerified,
this.address,
this.profilePic1,
this.updatedAt,
required this.createdAt,
this.vendorStatus,
this.vendorId,
this.endDate,
});
/// Factory method to create an instance from a JSON map
factory VendorProfileModel.fromJson(Map<String, dynamic> json) {
return VendorProfileModel(
id: int.tryParse(json['id'].toString()) ?? 0,
name: json['name']?.toString() ?? '',
number: json['number']?.toString() ?? '',
email: json['email']?.toString() ?? '',
password: json['password']?.toString() ?? '',
otp: int.tryParse(json['otp'].toString()) ?? 0,
isVerified: int.tryParse(json['is_verified'].toString()) ?? 0,
address: json['location']?.toString(),
profilePic1: json['profile_pic1']?.toString(),
updatedAt: json['updated_at']?.toString(),
createdAt: json['created_at']?.toString() ?? '',
vendorStatus: json['vendor_status']?.toString(),
vendorId: json['vendor_id']?.toString(),
endDate: json['end_date']?.toString(),
);
}
/// Method to convert the object to a JSON map
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
'number': number,
'email': email,
'password': password,
'otp': otp,
'is_verified': isVerified,
'location': address,
'profile_pic1': profilePic1,
'updated_at': updatedAt,
'created_at': createdAt,
'vendor_status': vendorStatus,
'vendor_id': vendorId,
'end_date': endDate,
};
}
}
@@ -0,0 +1,122 @@
import 'dart:convert';
class VendorServiceModel {
final int id;
final int vendorId;
final int serviceType;
final String vendorName;
final String serviceName;
final int category;
final int subcategory;
final String workingHours;
final String workingDuration;
final String amount;
final String location;
final String description;
final String details;
final String createdDate;
final String categoryName;
final String subcategoryName;
final List<String> video;
final List<String> images1;
VendorServiceModel({
required this.id,
required this.vendorId,
required this.serviceType,
required this.vendorName,
required this.serviceName,
required this.category,
required this.subcategory,
required this.workingHours,
required this.workingDuration,
required this.amount,
required this.location,
required this.description,
required this.details,
required this.createdDate,
required this.categoryName,
required this.subcategoryName,
required this.video,
required this.images1,
});
factory VendorServiceModel.fromJson(Map<String, dynamic> json) {
return VendorServiceModel(
id: json['id'] ?? 0,
vendorId: json['vendor_id'] ?? 0,
serviceType: json['service_type'] ?? 0,
vendorName: json['vendorname'] ?? '',
serviceName: json['servicename'] ?? '',
category: json['category'] ?? 0,
subcategory: json['subcategory'] ?? 0,
workingHours: json['workinghours'] ?? '',
workingDuration: json['workingduration'] ?? '',
amount: json['amount']?.toString() ?? '',
location: json['location'] ?? '',
description: json['description'] ?? '',
details: json['details'] ?? '',
createdDate: json['created_date'] ?? '',
categoryName: json['category_name'] ?? '',
subcategoryName: json['subcategory_name'] ?? '',
video: _parseStringList(json['videos']),
images1: _parseStringList(json['images1']),
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'vendor_id': vendorId,
'service_type': serviceType,
'vendorname': vendorName,
'servicename': serviceName,
'category': category,
'subcategory': subcategory,
'workinghours': workingHours,
'workingduration': workingDuration,
'amount': amount,
'location': location,
'description': description,
'details': details,
'created_date': createdDate,
'category_name': categoryName,
'subcategory_name': subcategoryName,
'videos': video,
'images1': images1,
};
}
static List<String> _parseStringList(dynamic input) {
if (input == null) return [];
if (input is List) {
return input.map((e) => e.toString()).toList();
}
if (input is String) {
if (input.trim().isEmpty) return [];
if (input.trim().startsWith('[')) {
try {
final parsed = jsonDecode(input);
if (parsed is List) {
return parsed.map((e) => e.toString()).toList();
}
} catch (_) {}
}
if (input.contains(',')) {
return input
.split(',')
.map((e) => e.trim())
.where((e) => e.isNotEmpty)
.toList();
}
return [input];
}
return [];
}
}
@@ -0,0 +1,74 @@
class VendorServiceUploadModel {
final String id;
final String vendorName;
final String serviceName;
final String serviceType;
final String category;
final String subcategory;
final String workingHours;
final String workingDuration;
final double amount;
final String location;
final String? description;
final String details;
final List<String> images; // This will store image URLs after upload
final List<String> videos; // YouTube video links
VendorServiceUploadModel({
required this.id,
required this.vendorName,
required this.serviceName,
required this.serviceType,
required this.category,
required this.subcategory,
required this.workingHours,
required this.workingDuration,
required this.amount,
required this.location,
this.description,
required this.details,
required this.images,
required this.videos,
});
Map<String, dynamic> toJson() {
return {
'id': id,
'vendorName': vendorName,
'serviceName': serviceName,
'serviceType': serviceType,
'category': category,
'subcategory': subcategory,
'workingHours': workingHours,
'workingDuration': workingDuration,
'amount': amount,
'location': location,
'description': description,
'details': details,
'images': images,
'videos': videos,
};
}
factory VendorServiceUploadModel.fromJson(Map<String, dynamic> json) {
return VendorServiceUploadModel(
id: json['id'] as String,
vendorName: json['vendorName'] as String,
serviceName: json['serviceName'] as String,
serviceType: json['serviceType'] as String,
category: json['category'] as String,
subcategory: json['subcategory'] as String,
workingHours: json['workingHours'] as String,
workingDuration: json['workingDuration'] as String,
amount:
json['amount'] is int
? (json['amount'] as int).toDouble()
: json['amount'] as double,
location: json['location'] as String,
description: json['description'] as String?,
details: json['details'] as String,
images: (json['images'] as List?)?.map((e) => e as String).toList() ?? [],
videos: (json['videos'] as List?)?.map((e) => e as String).toList() ?? [],
);
}
}
@@ -0,0 +1,38 @@
class VendorRegisterModel {
String name;
String number;
String email;
String? location;
String? pincode;
String? aadharCard;
String? panCard;
String? drivingLicense;
String? passport;
String userId;
VendorRegisterModel({
required this.name,
required this.number,
required this.email,
this.location,
this.pincode,
this.aadharCard,
this.panCard,
this.drivingLicense,
this.passport,
this.userId = '',
});
Map<String, dynamic> toJson() => {
'name': name,
'number': number,
'email': email,
'location': location,
'pincode': pincode,
'aadhar_card': aadharCard,
'pan_card': panCard,
'driving_license': drivingLicense,
'passport': passport,
'user_id': userId,
};
}