55 lines
1.8 KiB
Dart
55 lines
1.8 KiB
Dart
|
|
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']);
|
||
|
|
}
|
||
|
|
}
|