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

@@ -26,3 +26,24 @@ const message_type_profile = "t_profile";
const fcs_shipment_confirmed_status = "confirmed";
const fcs_shipment_shipped_status = "shipped";
const fcs_shipment_delivered_status = "delivered";
// Package status
const package_received_status = "received";
const package_processed_status = "processed";
const package_packed_status = "packed";
const package_shipped_status = "shipped";
const package_delivered_status = "delivered";
// Privileges
const privilege_admin = "admin";
const privilege_support = "sp";
const privilege_package = "pkg";
const privilege_shipment = "sh";
const privilege_fcs_shipment = "fsh";
const privilege_staff = "st";
const privilege_carton = "ca";
const privilege_customer = "cu";
const privilege_delivery = "deli";
const privilege_invoice = "inv";
const privilege_processing = "pr";
const privilege_receiving = "rc";

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());
}

View File

@@ -5,8 +5,8 @@ class DeliveryAddress {
String addressLine2;
String city;
String state;
String country;
String phoneNumber;
bool isDefault;
DeliveryAddress(
{this.id,
this.fullName,
@@ -14,8 +14,8 @@ class DeliveryAddress {
this.addressLine2,
this.city,
this.state,
this.country,
this.phoneNumber});
this.phoneNumber,
this.isDefault = false});
factory DeliveryAddress.fromMap(Map<String, dynamic> map, String docID) {
return DeliveryAddress(
@@ -25,8 +25,8 @@ class DeliveryAddress {
addressLine2: map['address_line2'],
city: map['city'],
state: map['state'],
country: map['country'],
phoneNumber: map['phone_number'],
isDefault: map['is_defalut'] ?? false,
);
}
@@ -39,7 +39,6 @@ class DeliveryAddress {
'city': city,
'state': state,
'phone_number': phoneNumber,
'country': country,
};
}
}

View File

@@ -0,0 +1,54 @@
import 'package:fcs/domain/constants.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_icons/flutter_icons.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
class Privilege {
String id;
String name;
String desc;
bool sysAdminOnly = true;
bool isChecked = false;
IconData iconData;
Privilege(
{this.id, this.name, this.desc, this.isChecked, this.sysAdminOnly}) {
if (this.id == privilege_admin) {
iconData = MaterialCommunityIcons.account_tie;
} else if (this.id == privilege_support) {
iconData = SimpleLineIcons.support;
} else if (this.id == privilege_package) {
iconData = Octicons.package;
} else if (this.id == privilege_shipment) {
iconData = SimpleLineIcons.direction;
} else if (this.id == privilege_fcs_shipment) {
iconData = Ionicons.ios_airplane;
} else if (this.id == privilege_staff) {
iconData = MaterialCommunityIcons.worker;
} else if (this.id == privilege_carton) {
iconData = MaterialCommunityIcons.package;
} else if (this.id == privilege_customer) {
iconData = Feather.users;
} else if (this.id == privilege_delivery) {
iconData = MaterialCommunityIcons.truck_fast;
} else if (this.id == privilege_invoice) {
iconData = FontAwesomeIcons.fileInvoice;
} else if (this.id == privilege_processing) {
iconData = FontAwesome.dropbox;
} else if (this.id == privilege_receiving) {
iconData = MaterialCommunityIcons.inbox_arrow_down;
} else {
iconData = MaterialCommunityIcons.account_question;
}
}
factory Privilege.fromMap(Map<String, dynamic> map, String docID) {
return Privilege(
id: docID,
name: map['name'],
desc: map['desc'],
sysAdminOnly: map['sys_admin_only']);
}
}