194 lines
5.4 KiB
Dart
194 lines
5.4 KiB
Dart
class DashBoardModel {
|
|
final String status;
|
|
final bool isKycCompleted;
|
|
final List<ServiceList> serviceLists;
|
|
final String userName;
|
|
final String companyName;
|
|
final int generalChatId;
|
|
final List<Review> reviews;
|
|
final ServiceRequestList serviceRequestLists;
|
|
final List<ImageSlider> imageSlider;
|
|
|
|
DashBoardModel({
|
|
required this.status,
|
|
required this.isKycCompleted,
|
|
required this.serviceLists,
|
|
required this.userName,
|
|
required this.companyName,
|
|
required this.generalChatId,
|
|
required this.imageSlider,
|
|
required this.reviews,
|
|
required this.serviceRequestLists,
|
|
});
|
|
|
|
factory DashBoardModel.fromJson(Map<String, dynamic> json) {
|
|
return DashBoardModel(
|
|
status: json['status'] ?? '',
|
|
isKycCompleted: json['is_kyc_completed'] ?? false,
|
|
serviceLists:
|
|
(json['service_lists'] as List<dynamic>?)
|
|
?.map((e) => ServiceList.fromJson(e))
|
|
.toList() ??
|
|
[],
|
|
imageSlider: (json['imageSlider'] as List)
|
|
.map((e) => ImageSlider.fromJson(e))
|
|
.toList(),
|
|
userName: json['user_name'] ?? '',
|
|
companyName: json['company_name'] ?? '',
|
|
generalChatId: json['general_chat_id'] ?? 0,
|
|
reviews:
|
|
(json['reviews'] as List<dynamic>?)
|
|
?.map((e) => Review.fromJson(e))
|
|
.toList() ??
|
|
[],
|
|
serviceRequestLists: ServiceRequestList.fromJson(
|
|
json['service_request_lists'] ?? {},
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
// ---------------------------------------------------------------
|
|
// SERVICE LIST MODEL
|
|
// ---------------------------------------------------------------
|
|
class ServiceList {
|
|
final int id;
|
|
final String service;
|
|
final String icon;
|
|
|
|
ServiceList({required this.id, required this.service, required this.icon});
|
|
|
|
factory ServiceList.fromJson(Map<String, dynamic> json) {
|
|
return ServiceList(
|
|
id: json['id'] ?? 0,
|
|
service: json['service'] ?? '',
|
|
icon: json['icon'] ?? '',
|
|
);
|
|
}
|
|
}
|
|
|
|
class ImageSlider {
|
|
final String image;
|
|
|
|
ImageSlider({required this.image});
|
|
|
|
factory ImageSlider.fromJson(Map<String, dynamic> json) {
|
|
return ImageSlider(image: json['image'] ?? '');
|
|
}
|
|
}
|
|
|
|
// ---------------------------------------------------------------
|
|
// REVIEW MODEL
|
|
// ---------------------------------------------------------------
|
|
class Review {
|
|
final int id;
|
|
final String name;
|
|
final String about;
|
|
final String content;
|
|
final int rating;
|
|
|
|
Review({
|
|
required this.id,
|
|
required this.name,
|
|
required this.about,
|
|
required this.content,
|
|
required this.rating,
|
|
});
|
|
|
|
factory Review.fromJson(Map<String, dynamic> json) {
|
|
return Review(
|
|
id: json['id'] ?? 0,
|
|
name: json['name'] ?? '',
|
|
about: json['about'] ?? '',
|
|
content: json['content'] ?? '',
|
|
rating: json['rating'] ?? 0,
|
|
);
|
|
}
|
|
}
|
|
|
|
// ---------------------------------------------------------------
|
|
// SERVICE REQUEST LIST WRAPPER
|
|
// ---------------------------------------------------------------
|
|
class ServiceRequestList {
|
|
final String status;
|
|
final int recordsTotal;
|
|
final int recordsFiltered;
|
|
final List<ServiceRequestItem> data;
|
|
|
|
ServiceRequestList({
|
|
required this.status,
|
|
required this.recordsTotal,
|
|
required this.recordsFiltered,
|
|
required this.data,
|
|
});
|
|
|
|
factory ServiceRequestList.fromJson(Map<String, dynamic> json) {
|
|
return ServiceRequestList(
|
|
status: json['status'] ?? '',
|
|
recordsTotal: json['recordsTotal'] ?? 0,
|
|
recordsFiltered: json['recordsFiltered'] ?? 0,
|
|
data:
|
|
(json['data'] as List<dynamic>?)
|
|
?.map((e) => ServiceRequestItem.fromJson(e))
|
|
.toList() ??
|
|
[],
|
|
);
|
|
}
|
|
}
|
|
|
|
// ---------------------------------------------------------------
|
|
// SERVICE REQUEST ITEM
|
|
// ---------------------------------------------------------------
|
|
class ServiceRequestItem {
|
|
final int id;
|
|
final String name;
|
|
final String logo;
|
|
final String email;
|
|
final String mobile;
|
|
final String paymentStatus;
|
|
final num paymentAmount;
|
|
final String status;
|
|
final String service;
|
|
final String message;
|
|
final String createdDate;
|
|
final String createdTime;
|
|
final int actions;
|
|
final int? chatId;
|
|
|
|
ServiceRequestItem({
|
|
required this.id,
|
|
required this.name,
|
|
required this.logo,
|
|
required this.email,
|
|
required this.mobile,
|
|
required this.paymentStatus,
|
|
required this.paymentAmount,
|
|
required this.status,
|
|
required this.service,
|
|
required this.message,
|
|
required this.createdDate,
|
|
required this.createdTime,
|
|
required this.actions,
|
|
required this.chatId,
|
|
});
|
|
|
|
factory ServiceRequestItem.fromJson(Map<String, dynamic> json) {
|
|
return ServiceRequestItem(
|
|
id: json['id'] ?? 0,
|
|
name: json['name'] ?? '',
|
|
logo: json['logo'] ?? '',
|
|
email: json['email'] ?? '',
|
|
mobile: json['mobile'] ?? '',
|
|
paymentStatus: json['payment_status'] ?? '',
|
|
paymentAmount: json['payment_amount'] ?? 0,
|
|
status: json['status'] ?? '',
|
|
service: json['service'] ?? '',
|
|
message: json['message'] ?? '',
|
|
createdDate: json['created_date'] ?? '',
|
|
createdTime: json['created_time'] ?? '',
|
|
actions: json['actions'] ?? 0,
|
|
chatId: json['chat_id'],
|
|
);
|
|
}
|
|
}
|