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

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