@@ -240,7 +248,7 @@ body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-
- | Person |
+ Sales Manager |
Action |
@@ -448,7 +456,13 @@ body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-
tbody.innerHTML = '| No targets added yet. |
';
return;
}
- records.sort((a, b) => b.id - a.id);
+ // records.sort((a, b) => b.id - a.id);
+ records.sort((a, b) => {
+ let startYearA = parseInt(a.fy_year.split('-')[0], 10);
+ let startYearB = parseInt(b.fy_year.split('-')[0], 10);
+ return startYearB - startYearA;
+ });
+
tbody.innerHTML = records.map(r => `
| ${r.fy_year} |
@@ -522,7 +536,14 @@ body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-
document.getElementById('recordId').value = '';
document.getElementById('targetAmount').value = '';
populateFY();
- renderDetailTable(userId);
+ await renderDetailTable(userId);
+ const savedId = result.data?.id || recordId;
+ const targetRow = document.getElementById(`row_${savedId}`);
+ if (targetRow) {
+ targetRow.scrollIntoView({ behavior: 'smooth', block: 'center' });
+ targetRow.classList.add('row-highlight');
+ setTimeout(() => targetRow.classList.remove('row-highlight'), 3000);
+ }
} else {
toastr.error(result.message || 'Failed to save target.');
}