2024-09-22 16:49:59 +06:30
|
|
|
import 'package:fcs/constants.dart';
|
2020-10-11 02:17:23 +06:30
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
2021-09-10 14:27:38 +06:30
|
|
|
import 'package:flutter_icons_null_safety/flutter_icons_null_safety.dart';
|
2020-10-11 02:17:23 +06:30
|
|
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|
|
|
|
|
|
|
|
|
class Privilege {
|
|
|
|
|
String id;
|
2021-09-10 14:27:38 +06:30
|
|
|
String? name;
|
|
|
|
|
String? desc;
|
|
|
|
|
bool? sysAdminOnly = true;
|
|
|
|
|
bool? isChecked = false;
|
2020-10-11 02:17:23 +06:30
|
|
|
|
2021-09-10 14:27:38 +06:30
|
|
|
IconData? iconData;
|
2020-10-11 02:17:23 +06:30
|
|
|
|
|
|
|
|
Privilege(
|
2021-09-10 14:27:38 +06:30
|
|
|
{required this.id,
|
|
|
|
|
this.name,
|
|
|
|
|
this.desc,
|
|
|
|
|
this.isChecked,
|
|
|
|
|
this.sysAdminOnly}) {
|
2020-10-11 02:17:23 +06:30
|
|
|
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;
|
2021-09-13 09:53:27 +06:30
|
|
|
} else if (this.id == privilege_pickup) {
|
2021-09-13 10:17:04 +06:30
|
|
|
iconData = SimpleLineIcons.direction;
|
2021-10-11 17:09:47 +06:30
|
|
|
} else if (this.id == privilege_collect) {
|
|
|
|
|
iconData = MaterialCommunityIcons.layers;
|
|
|
|
|
} else if (this.id == privilege_report) {
|
|
|
|
|
iconData = Feather.file_text;
|
2020-10-11 02:17:23 +06:30
|
|
|
} 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']);
|
|
|
|
|
}
|
|
|
|
|
}
|