dashboard changes
This commit is contained in:
parent
af571b914a
commit
745742010e
@ -187,9 +187,7 @@ const kDefaultEnrollmentReminderHtmlBody = r'''<!DOCTYPE html>
|
||||
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="border:1px solid #e5e7eb;border-radius:8px;background-color:#f9fafb;margin-bottom:24px;">
|
||||
<tr>
|
||||
<td style="padding:16px 18px;font-size:14px;line-height:22px;color:#374151;">
|
||||
<strong style="color:#111827;">Policy Name:</strong> {{policy_name}}<br>
|
||||
<strong style="color:#111827;">Policy Number:</strong> {{policy_no}}<br>
|
||||
<strong style="color:#111827;">Employee Code:</strong> {{emp_code}}<br>
|
||||
<strong style="color:#111827;">Enrollment Open Date:</strong> {{enrollment_open_date}}<br>
|
||||
<strong style="color:#111827;">Enrollment Close Date:</strong> {{enrollment_close_date}}
|
||||
</td>
|
||||
|
||||
@ -518,6 +518,21 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
||||
status == 'enrolled' ||
|
||||
status == 'submitted';
|
||||
|
||||
String _getRowStatus(Map<String, dynamic> row) {
|
||||
final raw = localTokenType == 'pre'
|
||||
? (row['emp_status'] ?? row['status'])
|
||||
: row['status'];
|
||||
return raw?.toString().toLowerCase().trim() ?? '';
|
||||
}
|
||||
|
||||
String? _getRowStatusRaw(Map<String, dynamic> row) {
|
||||
final raw = localTokenType == 'pre'
|
||||
? (row['emp_status'] ?? row['status'])
|
||||
: row['status'];
|
||||
final value = raw?.toString().trim();
|
||||
return value == null || value.isEmpty ? null : value;
|
||||
}
|
||||
|
||||
String _getLoggedInValue(Map<String, dynamic> row) {
|
||||
final loggedInRaw = row['logged_in'] ?? row['emp_is_active'];
|
||||
final value = loggedInRaw?.toString().toLowerCase().trim() ?? '';
|
||||
@ -544,7 +559,7 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
||||
: const Color(0xFFE8EAF6);
|
||||
|
||||
bool _matchesPreStatusFilter(Map<String, dynamic> row, String filter) {
|
||||
final status = row['status']?.toString().toLowerCase().trim() ?? '';
|
||||
final status = _getRowStatus(row);
|
||||
final relationship = row['relationship']?.toString().toLowerCase().trim() ?? '';
|
||||
|
||||
switch (filter) {
|
||||
@ -566,7 +581,7 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
||||
}
|
||||
|
||||
bool _matchesSearch(Map<String, dynamic> row, String lowerQuery) {
|
||||
final status = row['status']?.toString().toLowerCase().trim() ?? '';
|
||||
final status = _getRowStatus(row);
|
||||
|
||||
bool statusMatch;
|
||||
if (lowerQuery == 'active' || lowerQuery == 'inactive') {
|
||||
@ -662,7 +677,7 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
||||
item['gender'] ?? '',
|
||||
item['mobile'] ?? '',
|
||||
item['email_corporate'] ?? '',
|
||||
item['status'] ?? '',
|
||||
_getRowStatusRaw(item) ?? '',
|
||||
]);
|
||||
}
|
||||
|
||||
@ -1914,7 +1929,7 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
||||
int draft = 0;
|
||||
|
||||
for (final item in originalData) {
|
||||
final status = item['status']?.toString().toLowerCase().trim() ?? '';
|
||||
final status = _getRowStatus(item);
|
||||
final relationship =
|
||||
item['relationship']?.toString().toLowerCase().trim() ?? '';
|
||||
|
||||
@ -2233,11 +2248,11 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: getStatusColor(item['status'] ?? ''),
|
||||
color: getStatusColor(_getRowStatusRaw(item) ?? ''),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Text(
|
||||
_getStatusDisplayLabel(item['status']),
|
||||
_getStatusDisplayLabel(_getRowStatusRaw(item)),
|
||||
textAlign: TextAlign.center,
|
||||
style: _dataBold,
|
||||
),
|
||||
@ -3559,6 +3574,7 @@ class _ReminderMailConfigDialogState extends State<_ReminderMailConfigDialog> {
|
||||
response['message']?.toString() ??
|
||||
'Reminder mail configuration saved successfully',
|
||||
);
|
||||
Navigator.pop(context);
|
||||
} else {
|
||||
ToastHelper.showErrorToast(
|
||||
context,
|
||||
@ -3787,25 +3803,25 @@ class _ReminderMailConfigDialogState extends State<_ReminderMailConfigDialog> {
|
||||
const SizedBox(height: 14),
|
||||
_buildDaysField(),
|
||||
const SizedBox(height: 20),
|
||||
OutlinedButton.icon(
|
||||
onPressed: isBusy ? null : _openTemplateEditor,
|
||||
icon: const Icon(Icons.edit_outlined, size: 18),
|
||||
label: Text(
|
||||
'Edit Email Template',
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
style: OutlinedButton.styleFrom(
|
||||
foregroundColor: const Color(0xFF009195),
|
||||
side: const BorderSide(color: Color(0xFF009195)),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
// OutlinedButton.icon(
|
||||
// onPressed: isBusy ? null : _openTemplateEditor,
|
||||
// icon: const Icon(Icons.edit_outlined, size: 18),
|
||||
// label: Text(
|
||||
// 'Edit Email Template',
|
||||
// style: GoogleFonts.poppins(
|
||||
// fontSize: 13,
|
||||
// fontWeight: FontWeight.w600,
|
||||
// ),
|
||||
// ),
|
||||
// style: OutlinedButton.styleFrom(
|
||||
// foregroundColor: const Color(0xFF009195),
|
||||
// side: const BorderSide(color: Color(0xFF009195)),
|
||||
// padding: const EdgeInsets.symmetric(
|
||||
// horizontal: 16,
|
||||
// vertical: 12,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@ -85,10 +85,54 @@
|
||||
}
|
||||
const content = extractBodyContent(fullHtml);
|
||||
editor.setComponents(content);
|
||||
makePlaceholderTokensEditable();
|
||||
editor.refresh();
|
||||
lastExportedHtml = exportFullHtml();
|
||||
}
|
||||
|
||||
function makePlaceholderTokensEditable() {
|
||||
if (destroyed || !editor) return;
|
||||
const wrapper = editor.getWrapper();
|
||||
if (!wrapper) return;
|
||||
|
||||
const visit = function (cmp) {
|
||||
if (!cmp || typeof cmp.get !== 'function') return;
|
||||
|
||||
const content = (cmp.get('content') || '').toString();
|
||||
if (/\{\{[^{}]+\}\}/.test(content)) {
|
||||
cmp.set('editable', true);
|
||||
cmp.set('selectable', true);
|
||||
cmp.set('hoverable', true);
|
||||
cmp.set('copyable', true);
|
||||
}
|
||||
|
||||
const children = cmp.components && cmp.components();
|
||||
if (children && typeof children.each === 'function') {
|
||||
children.each(function (child) {
|
||||
visit(child);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
visit(wrapper);
|
||||
|
||||
// Ensure rendered canvas nodes containing placeholders are editable too.
|
||||
// Some newsletter/table components keep internal text nodes read-only unless
|
||||
// contenteditable is explicitly set on the live DOM element.
|
||||
const doc = editor.Canvas && editor.Canvas.getDocument
|
||||
? editor.Canvas.getDocument()
|
||||
: null;
|
||||
if (!doc) return;
|
||||
|
||||
const nodes = doc.querySelectorAll('*');
|
||||
nodes.forEach(function (el) {
|
||||
if (!el || !el.innerHTML) return;
|
||||
if (/\{\{[^{}]+\}\}/.test(el.innerHTML)) {
|
||||
el.setAttribute('contenteditable', 'true');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function insertToken(token) {
|
||||
if (destroyed || !editor) return;
|
||||
const selected = editor.getSelected();
|
||||
@ -96,10 +140,25 @@
|
||||
? selected
|
||||
: editor.getWrapper().components().at(0);
|
||||
if (cmp && cmp.append) {
|
||||
cmp.append('<span>' + token + '</span>');
|
||||
cmp.append({
|
||||
type: 'text',
|
||||
content: token,
|
||||
editable: true,
|
||||
selectable: true,
|
||||
hoverable: true,
|
||||
copyable: true,
|
||||
});
|
||||
} else {
|
||||
editor.addComponents('<span>' + token + '</span>');
|
||||
editor.addComponents({
|
||||
type: 'text',
|
||||
content: token,
|
||||
editable: true,
|
||||
selectable: true,
|
||||
hoverable: true,
|
||||
copyable: true,
|
||||
});
|
||||
}
|
||||
makePlaceholderTokensEditable();
|
||||
scheduleChange();
|
||||
}
|
||||
|
||||
@ -142,6 +201,9 @@
|
||||
});
|
||||
|
||||
editor.on('update', scheduleChange);
|
||||
editor.on('component:selected', function () {
|
||||
makePlaceholderTokensEditable();
|
||||
});
|
||||
|
||||
if (pendingHtml) {
|
||||
loadHtml(pendingHtml);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user