fix profile

This commit is contained in:
Sai Naw Wun
2020-10-11 02:17:23 +06:30
parent b0ce53f856
commit 32e6be2abd
42 changed files with 938 additions and 626 deletions

View File

@@ -1,67 +0,0 @@
class Role {
String roleID;
String roleName;
String privileges;
Role({this.roleName, this.roleID, this.privileges});
Role.fromJson(Map<String, dynamic> json) {
roleName = json['role_name'];
roleID = json['role_id'];
privileges = json['privileges'];
}
}
class Parser {
String status;
String message;
Role data;
Parser({this.status, this.message, this.data});
Parser.fromJson(Map<String, dynamic> json) {
status = json['status'];
message = json['message'];
if (json['status'] == 'Ok') {
data = Role.fromJson(json['data']);
}
}
}
class StatusParser {
String status;
String message;
StatusParser(this.status, this.message);
StatusParser.fromJson(Map<String, dynamic> json) {
status = json['status'];
message = json['message'];
}
}
class Privilege {
String id;
String name;
String desc;
bool sysAdminOnly = true;
bool isChecked = false;
Privilege({this.id, this.name, this.desc, this.isChecked, this.sysAdminOnly});
factory Privilege.fromMap(Map<String, dynamic> map, String docID) {
return Privilege(
id: docID,
name: map['name'],
desc: map['desc'],
sysAdminOnly: map['sys_admin_only']);
}
}
class UserLevel {
String id;
String name;
int level;
UserLevel({this.id, this.name, this.level});
factory UserLevel.fromMap(Map<String, dynamic> map, String docID) {
return UserLevel(id: docID, name: map['name'], level: map['level']);
}
}

View File

@@ -17,6 +17,7 @@ class User {
String lastMessage;
int userUnseenCount;
int fcsUnseenCount;
String preferCurrency;
String get initial => name != null && name != "" ? name.substring(0, 1) : "?";
@@ -64,7 +65,8 @@ class User {
this.lastMessage,
this.lastMessageTime,
this.userUnseenCount,
this.fcsUnseenCount});
this.fcsUnseenCount,
this.preferCurrency});
factory User.fromJson(Map<String, dynamic> json) {
return User(
@@ -106,6 +108,7 @@ class User {
lastMessage: map['last_message'],
userUnseenCount: map['user_unseen_count'],
fcsUnseenCount: map['fcs_unseen_count'],
preferCurrency: map['preferred_currency'],
lastMessageTime: _date == null ? null : _date.toDate());
}