|
|
|
|
@ -110,33 +110,17 @@ class _FamilyMembersState extends State<FamilyMembers> {
|
|
|
|
|
return "${parts.first[0]}${parts.last[0]}".toUpperCase();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String _getIdEnding(GetEmployeeContactsList contact) {
|
|
|
|
|
String raw = contact.pERSONID?.toString() ??
|
|
|
|
|
contact.cONTACTPERSONID?.toString() ??
|
|
|
|
|
contact.cONTACTRELATIONSHIPID?.toString() ??
|
|
|
|
|
"";
|
|
|
|
|
if (raw.length > 4) {
|
|
|
|
|
return raw.substring(raw.length - 4);
|
|
|
|
|
}
|
|
|
|
|
if (raw.isNotEmpty) {
|
|
|
|
|
return raw.padLeft(4, '0');
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<GetEmployeeContactsList> get _filteredList {
|
|
|
|
|
if (_searchQuery.trim().isEmpty) return getEmployeeContactsList;
|
|
|
|
|
String q = _searchQuery.trim().toLowerCase();
|
|
|
|
|
return getEmployeeContactsList.where((GetEmployeeContactsList item) {
|
|
|
|
|
String name = (item.cONTACTNAME ?? "").toLowerCase();
|
|
|
|
|
String rel = (item.rELATIONSHIP ?? "").toLowerCase();
|
|
|
|
|
String id = _getIdEnding(item);
|
|
|
|
|
String personId = (item.pERSONID?.toString() ?? "").toLowerCase();
|
|
|
|
|
String contactPersonId = (item.cONTACTPERSONID?.toString() ?? "").toLowerCase();
|
|
|
|
|
String contactType = (item.cONTACTTYPE ?? "").toLowerCase();
|
|
|
|
|
return name.contains(q) ||
|
|
|
|
|
rel.contains(q) ||
|
|
|
|
|
id.contains(q) ||
|
|
|
|
|
personId.contains(q) ||
|
|
|
|
|
contactPersonId.contains(q) ||
|
|
|
|
|
contactType.contains(q);
|
|
|
|
|
@ -178,12 +162,13 @@ class _FamilyMembersState extends State<FamilyMembers> {
|
|
|
|
|
List<GetEmployeeContactsList> displayList = _filteredList;
|
|
|
|
|
|
|
|
|
|
return Scaffold(
|
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
|
backgroundColor: const Color(0xFFF8FAFC),
|
|
|
|
|
appBar: PreferredSize(
|
|
|
|
|
preferredSize: const Size.fromHeight(56),
|
|
|
|
|
child: SafeArea(
|
|
|
|
|
child: Container(
|
|
|
|
|
height: 56,
|
|
|
|
|
color: const Color(0xFFF8FAFC),
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
@ -342,7 +327,7 @@ class _FamilyMembersState extends State<FamilyMembers> {
|
|
|
|
|
bool isAllowed = _isAccessAllowed(item);
|
|
|
|
|
|
|
|
|
|
return Container(
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
padding: const EdgeInsets.fromLTRB(16, 16, 16, 14),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
borderRadius: BorderRadius.circular(16),
|
|
|
|
|
@ -364,16 +349,20 @@ class _FamilyMembersState extends State<FamilyMembers> {
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
// Initials Circle
|
|
|
|
|
Container(
|
|
|
|
|
width: 44,
|
|
|
|
|
height: 44,
|
|
|
|
|
width: 48,
|
|
|
|
|
height: 48,
|
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
|
color: Color(0xFFE6F7F2),
|
|
|
|
|
color: Color(0xFFE6F5F3),
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
),
|
|
|
|
|
child: Center(
|
|
|
|
|
child: _getInitials(item.cONTACTNAME).toText16(
|
|
|
|
|
isBold: true,
|
|
|
|
|
color: const Color(0xFF168A89),
|
|
|
|
|
child: Text(
|
|
|
|
|
_getInitials(item.cONTACTNAME),
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
color: Color(0xFF168A89),
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
fontSize: 15,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -384,10 +373,15 @@ class _FamilyMembersState extends State<FamilyMembers> {
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
(item.cONTACTNAME ?? "").toText16(
|
|
|
|
|
isBold: true,
|
|
|
|
|
maxlines: 1,
|
|
|
|
|
color: const Color(0xFF1E293B),
|
|
|
|
|
Text(
|
|
|
|
|
item.cONTACTNAME ?? "",
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
color: Color(0xFF1E293B),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 3),
|
|
|
|
|
Row(
|
|
|
|
|
@ -398,7 +392,6 @@ class _FamilyMembersState extends State<FamilyMembers> {
|
|
|
|
|
color: const Color(0xFF168A89),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
@ -411,11 +404,16 @@ class _FamilyMembersState extends State<FamilyMembers> {
|
|
|
|
|
Container(
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: isAllowed ? const Color(0xFFE8F8F0) : const Color(0xFFFEECEB),
|
|
|
|
|
color: isAllowed ? const Color(0xFFE8F8F0) : const Color(0xFFFDE8E8),
|
|
|
|
|
borderRadius: BorderRadius.circular(20),
|
|
|
|
|
),
|
|
|
|
|
child: (isAllowed ? LocaleKeys.active.tr() : LocaleKeys.noAccess.tr()).toText11(
|
|
|
|
|
color: isAllowed ? const Color(0xFF2DBD72) : const Color(0xFFED1C24),
|
|
|
|
|
child: Text(
|
|
|
|
|
isAllowed ? LocaleKeys.active.tr() : LocaleKeys.noAccess.tr(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 11,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
color: isAllowed ? const Color(0xFF168A89) : const Color(0xFFDC2626),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
@ -423,32 +421,41 @@ class _FamilyMembersState extends State<FamilyMembers> {
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
const SizedBox(height: 14),
|
|
|
|
|
const Divider(height: 1, thickness: 1, color: Color(0xFFF1F5F9)),
|
|
|
|
|
const SizedBox(height: 12),
|
|
|
|
|
|
|
|
|
|
// Bottom Action Row
|
|
|
|
|
if (fromMazaya) ...<Widget>[
|
|
|
|
|
// Mazaya Access Buttons: Revoke or Allow
|
|
|
|
|
InkWell(
|
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
|
onTap: () => _toggleMazayaAccess(item),
|
|
|
|
|
child: Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: 40,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: isAllowed ? const Color(0xFFFFF1F0) : const Color(0xFFE6F7F2),
|
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: isAllowed ? const Color(0xFFFFD9D7) : const Color(0xFFCEEFE7),
|
|
|
|
|
width: 0.8,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: Center(
|
|
|
|
|
child: (isAllowed
|
|
|
|
|
? LocaleKeys.revokeMazayaAccess.tr()
|
|
|
|
|
: LocaleKeys.allowMazayaAccess.tr())
|
|
|
|
|
.toText14(
|
|
|
|
|
isBold: true,
|
|
|
|
|
isCenter: true,
|
|
|
|
|
color: isAllowed ? const Color(0xFFED1C24) : const Color(0xFF168A89),
|
|
|
|
|
Center(
|
|
|
|
|
child: InkWell(
|
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
|
onTap: () => _toggleMazayaAccess(item),
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 8),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Icon(
|
|
|
|
|
isAllowed ? Icons.close : Icons.check,
|
|
|
|
|
size: isAllowed ? 16 : 18,
|
|
|
|
|
color: isAllowed ? const Color(0xFFDC2626) : const Color(0xFF168A89),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(width: 6),
|
|
|
|
|
Text(
|
|
|
|
|
isAllowed
|
|
|
|
|
? LocaleKeys.revokeMazayaAccess.tr()
|
|
|
|
|
: LocaleKeys.allowMazayaAccess.tr(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
color: isAllowed ? const Color(0xFFDC2626) : const Color(0xFF168A89),
|
|
|
|
|
decoration: TextDecoration.underline,
|
|
|
|
|
decorationColor: isAllowed ? const Color(0xFFDC2626) : const Color(0xFF168A89),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|