- Implemented ContactProfileResponse and related models for handling contact details. - Created ContactTagResponse and ContactTag models for managing contact tags. - Added DirectoryCommentResponse and DirectoryComment models for comment management. - Developed DirectoryFilterBottomSheet for filtering contacts. - Introduced OrganizationListModel for organization data handling. - Updated routes to include DirectoryMainScreen. - Enhanced DashboardScreen to navigate to the new directory page. - Created ContactDetailScreen for displaying detailed contact information. - Developed DirectoryMainScreen for managing and displaying contacts. - Added dependencies for font_awesome_flutter and flutter_html in pubspec.yaml.
246 lines
5.5 KiB
Dart
246 lines
5.5 KiB
Dart
class ContactProfileResponse {
|
|
final bool success;
|
|
final String message;
|
|
final ContactData data;
|
|
final int statusCode;
|
|
final String timestamp;
|
|
|
|
ContactProfileResponse({
|
|
required this.success,
|
|
required this.message,
|
|
required this.data,
|
|
required this.statusCode,
|
|
required this.timestamp,
|
|
});
|
|
|
|
factory ContactProfileResponse.fromJson(Map<String, dynamic> json) {
|
|
return ContactProfileResponse(
|
|
success: json['success'],
|
|
message: json['message'],
|
|
data: ContactData.fromJson(json['data']),
|
|
statusCode: json['statusCode'],
|
|
timestamp: json['timestamp'],
|
|
);
|
|
}
|
|
}
|
|
|
|
class ContactData {
|
|
final String id;
|
|
final String name;
|
|
final String? description;
|
|
final String organization;
|
|
final String address;
|
|
final String createdAt;
|
|
final String updatedAt;
|
|
final User createdBy;
|
|
final User updatedBy;
|
|
final List<ContactPhone> contactPhones;
|
|
final List<ContactEmail> contactEmails;
|
|
final ContactCategory? contactCategory;
|
|
final List<ProjectInfo> projects;
|
|
final List<Bucket> buckets;
|
|
final List<Tag> tags;
|
|
|
|
ContactData({
|
|
required this.id,
|
|
required this.name,
|
|
this.description,
|
|
required this.organization,
|
|
required this.address,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
required this.createdBy,
|
|
required this.updatedBy,
|
|
required this.contactPhones,
|
|
required this.contactEmails,
|
|
this.contactCategory,
|
|
required this.projects,
|
|
required this.buckets,
|
|
required this.tags,
|
|
});
|
|
|
|
factory ContactData.fromJson(Map<String, dynamic> json) {
|
|
return ContactData(
|
|
id: json['id'],
|
|
name: json['name'],
|
|
description: json['description'],
|
|
organization: json['organization'],
|
|
address: json['address'],
|
|
createdAt: json['createdAt'],
|
|
updatedAt: json['updatedAt'],
|
|
createdBy: User.fromJson(json['createdBy']),
|
|
updatedBy: User.fromJson(json['updatedBy']),
|
|
contactPhones: (json['contactPhones'] as List)
|
|
.map((e) => ContactPhone.fromJson(e))
|
|
.toList(),
|
|
contactEmails: (json['contactEmails'] as List)
|
|
.map((e) => ContactEmail.fromJson(e))
|
|
.toList(),
|
|
contactCategory: json['contactCategory'] != null
|
|
? ContactCategory.fromJson(json['contactCategory'])
|
|
: null,
|
|
projects: (json['projects'] as List)
|
|
.map((e) => ProjectInfo.fromJson(e))
|
|
.toList(),
|
|
buckets:
|
|
(json['buckets'] as List).map((e) => Bucket.fromJson(e)).toList(),
|
|
tags: (json['tags'] as List).map((e) => Tag.fromJson(e)).toList(),
|
|
);
|
|
}
|
|
}
|
|
|
|
class User {
|
|
final String id;
|
|
final String firstName;
|
|
final String lastName;
|
|
final String? photo;
|
|
final String jobRoleId;
|
|
final String jobRoleName;
|
|
|
|
User({
|
|
required this.id,
|
|
required this.firstName,
|
|
required this.lastName,
|
|
this.photo,
|
|
required this.jobRoleId,
|
|
required this.jobRoleName,
|
|
});
|
|
|
|
factory User.fromJson(Map<String, dynamic> json) {
|
|
return User(
|
|
id: json['id'],
|
|
firstName: json['firstName'],
|
|
lastName: json['lastName'],
|
|
photo: json['photo'],
|
|
jobRoleId: json['jobRoleId'],
|
|
jobRoleName: json['jobRoleName'],
|
|
);
|
|
}
|
|
}
|
|
|
|
class ContactPhone {
|
|
final String id;
|
|
final String label;
|
|
final String phoneNumber;
|
|
final String contactId;
|
|
|
|
ContactPhone({
|
|
required this.id,
|
|
required this.label,
|
|
required this.phoneNumber,
|
|
required this.contactId,
|
|
});
|
|
|
|
factory ContactPhone.fromJson(Map<String, dynamic> json) {
|
|
return ContactPhone(
|
|
id: json['id'],
|
|
label: json['label'],
|
|
phoneNumber: json['phoneNumber'],
|
|
contactId: json['contactId'],
|
|
);
|
|
}
|
|
}
|
|
|
|
class ContactEmail {
|
|
final String id;
|
|
final String label;
|
|
final String emailAddress;
|
|
final String contactId;
|
|
|
|
ContactEmail({
|
|
required this.id,
|
|
required this.label,
|
|
required this.emailAddress,
|
|
required this.contactId,
|
|
});
|
|
|
|
factory ContactEmail.fromJson(Map<String, dynamic> json) {
|
|
return ContactEmail(
|
|
id: json['id'],
|
|
label: json['label'],
|
|
emailAddress: json['emailAddress'],
|
|
contactId: json['contactId'],
|
|
);
|
|
}
|
|
}
|
|
|
|
class ContactCategory {
|
|
final String id;
|
|
final String name;
|
|
final String? description;
|
|
|
|
ContactCategory({
|
|
required this.id,
|
|
required this.name,
|
|
this.description,
|
|
});
|
|
|
|
factory ContactCategory.fromJson(Map<String, dynamic> json) {
|
|
return ContactCategory(
|
|
id: json['id'],
|
|
name: json['name'],
|
|
description: json['description'],
|
|
);
|
|
}
|
|
}
|
|
|
|
class ProjectInfo {
|
|
final String id;
|
|
final String name;
|
|
|
|
ProjectInfo({
|
|
required this.id,
|
|
required this.name,
|
|
});
|
|
|
|
factory ProjectInfo.fromJson(Map<String, dynamic> json) {
|
|
return ProjectInfo(
|
|
id: json['id'],
|
|
name: json['name'],
|
|
);
|
|
}
|
|
}
|
|
|
|
class Bucket {
|
|
final String id;
|
|
final String name;
|
|
final String description;
|
|
final User createdBy;
|
|
|
|
Bucket({
|
|
required this.id,
|
|
required this.name,
|
|
required this.description,
|
|
required this.createdBy,
|
|
});
|
|
|
|
factory Bucket.fromJson(Map<String, dynamic> json) {
|
|
return Bucket(
|
|
id: json['id'],
|
|
name: json['name'],
|
|
description: json['description'],
|
|
createdBy: User.fromJson(json['createdBy']),
|
|
);
|
|
}
|
|
}
|
|
|
|
class Tag {
|
|
final String id;
|
|
final String name;
|
|
final String? description;
|
|
|
|
Tag({
|
|
required this.id,
|
|
required this.name,
|
|
this.description,
|
|
});
|
|
|
|
factory Tag.fromJson(Map<String, dynamic> json) {
|
|
return Tag(
|
|
id: json['id'],
|
|
name: json['name'],
|
|
description: json['description'],
|
|
);
|
|
}
|
|
}
|