diff --git a/client/src/components/dashboard/AuditUserBalance.vue b/client/src/components/dashboard/AuditUserBalance.vue index 2ddbe04c..9edadd70 100644 --- a/client/src/components/dashboard/AuditUserBalance.vue +++ b/client/src/components/dashboard/AuditUserBalance.vue @@ -45,7 +45,7 @@

Audit Results for {{ reportData.user_full_name - }}

+ }}
Period: {{ reportData.year }} | Reason: {{ reportData.reason }}
@@ -136,14 +136,23 @@ -
Correction Required
+
Balance Discrepancy Detected
The database balance is out of sync. This action will synchronize the records and notify the user.
+ +
Orphaned Transferred Balance Link
+ The {{ reportData.year + 1 }} balance is pointing to an outdated transferred days record + (showing {{ reportData.next_year_transferred_value }} instead of {{ + reportData.expected_remaining }}). + This will be fixed when you click the synchronize button. +
+
- + Synchronize User Balance
@@ -251,6 +260,9 @@ export default { } else { addLog('Calculations match database records.', 'success') } + if (result.transferred_days_orphaned) { + addLog(`ALERT: ${selectedYear.value + 1} transferred balance is incorrectly linked (shows ${result.next_year_transferred_value} instead of ${result.expected_remaining}).`, 'warn') + } } catch (err: any) { const errorMsg = err.response?.data?.message || err.message || 'Unknown error' addLog(`Error generating report: ${errorMsg}`, 'error') @@ -271,8 +283,16 @@ export default { reason: selectedReason.value }) - addLog(`SUCCESS: Balance updated to ${result.new_remaining}.`, 'success') - addLog(`Notification sent to user. Process complete.`, 'info') + if (result.balance_fixed) { + addLog(`Balance updated to ${result.new_remaining}.`, 'success') + } + if (result.transferred_days_fixed) { + addLog(`Fixed orphaned transferred balance link for ${selectedYear.value + 1}.`, 'success') + } + if (result.balance_fixed) { + addLog(`Notification sent to user.`, 'info') + } + addLog(`Process complete.`, 'success') // Refresh report await generateReport() diff --git a/client/src/views/UsersView.vue b/client/src/views/UsersView.vue index 3a161246..7382a4d4 100644 --- a/client/src/views/UsersView.vue +++ b/client/src/views/UsersView.vue @@ -12,14 +12,19 @@ You can change the selected office to discover the team in other offices. - + - + + + +