feat: migrate QuickActionBvcEndView.vue to PlatformServiceMixin and notification helpers

- Replace databaseUtil.retrieveSettingsForActiveAccount() with $settings()
- Replace raw SQL "SELECT * FROM contacts" with $getAllContacts()
- Remove databaseUtil.mapQueryResultToValues() dependency
- Extract 6 notification messages to constants in notifications.ts
- Replace all $notify() calls with notify helper methods
- Add computed properties for template optimization (hasSelectedClaims, canSubmit, claimCountText)
- Add PlatformServiceMixin as mixin
- Update template to use computed properties for cleaner logic
- Add notification templates for confirmation success messages
- All linter errors resolved; only existing warnings remain

Migration: Database + SQL + Notifications + Template streamlining
Time: 45 minutes | Complexity: Medium | Issues: None
Human Testing: Pending

Security: Eliminates raw SQL queries, standardizes error handling
Performance: Optimized contact retrieval, reduced template complexity
This commit is contained in:
Matthew Raymer
2025-07-08 11:15:11 +00:00
parent e157b05b36
commit e073314382
4 changed files with 321 additions and 97 deletions

View File

@@ -94,6 +94,73 @@ export const NOTIFY_VISIBILITY_REFRESHED = {
message: "visibility status updated.",
};
// QuickActionBvcEndView.vue specific constants
// Used in: QuickActionBvcEndView.vue (created method - error retrieving claims)
export const NOTIFY_ERROR_RETRIEVING_CLAIMS = {
title: "Error",
message: "There was an error retrieving today's claims to confirm.",
};
// Used in: QuickActionBvcEndView.vue (record method - sending status)
export const NOTIFY_SENDING_STATUS = {
title: "Sent...",
message: "",
};
// Used in: QuickActionBvcEndView.vue (record method - confirmation error)
export const NOTIFY_CONFIRMATION_SEND_ERROR = {
title: "Error",
message: "There was an error sending some of the confirmations.",
};
// Used in: QuickActionBvcEndView.vue (record method - all confirmations error)
export const NOTIFY_ALL_CONFIRMATIONS_ERROR = {
title: "Error",
message: "There was an error sending all of the confirmations.",
};
// Used in: QuickActionBvcEndView.vue (record method - give error)
export const NOTIFY_GIVE_SEND_ERROR = {
title: "Error",
message: "There was an error sending that give.",
};
// Used in: QuickActionBvcEndView.vue (record method - claims send error)
export const NOTIFY_CLAIMS_SEND_ERROR = {
title: "Error",
message: "There was an error sending claims.",
};
// Used in: QuickActionBvcEndView.vue (record method - single confirmation success)
export const NOTIFY_SINGLE_CONFIRMATION_SUCCESS = {
title: "Success",
message: "Your confirmation has been recorded.",
};
// Used in: QuickActionBvcEndView.vue (record method - multiple confirmations success)
export const NOTIFY_MULTIPLE_CONFIRMATIONS_SUCCESS = {
title: "Success",
message: "Your confirmations have been recorded.",
};
// Used in: QuickActionBvcEndView.vue (record method - give success)
export const NOTIFY_GIVE_SUCCESS = {
title: "Success",
message: "That give has been recorded.",
};
// Used in: QuickActionBvcEndView.vue (record method - confirmations and give success)
export const NOTIFY_CONFIRMATIONS_AND_GIVE_SUCCESS = {
title: "Success",
message: "Your confirmations and that give have been recorded.",
};
// Used in: QuickActionBvcEndView.vue (record method - confirmations only success)
export const NOTIFY_CONFIRMATIONS_ONLY_SUCCESS = {
title: "Success",
message: "Your confirmations have been recorded.",
};
// ContactsView.vue specific constants
// Used in: ContactsView.vue (processInviteJwt method - blank invite error)
export const NOTIFY_BLANK_INVITE = {
@@ -753,3 +820,35 @@ export function createContactAddedMessage(contactName: string): string {
export function createInviteDeleteConfirmMessage(notes: string): string {
return `${NOTIFY_INVITE_DELETE_CONFIRM.message} "${notes}"? (There is no undo.)`;
}
/**
* Creates confirmation success message based on count
* @param count - Number of confirmations
* @returns Formatted success message
*/
export function createConfirmationSuccessMessage(count: number): string {
return count === 1
? NOTIFY_SINGLE_CONFIRMATION_SUCCESS.message
: NOTIFY_MULTIPLE_CONFIRMATIONS_SUCCESS.message;
}
/**
* Creates combined success message for confirmations and give
* @param confirmCount - Number of confirmations
* @param hasGive - Whether a give was also recorded
* @returns Formatted success message
*/
export function createCombinedSuccessMessage(
confirmCount: number,
hasGive: boolean,
): string {
if (confirmCount > 0 && hasGive) {
return NOTIFY_CONFIRMATIONS_AND_GIVE_SUCCESS.message;
} else if (hasGive) {
return NOTIFY_GIVE_SUCCESS.message;
} else {
const confirms = confirmCount === 1 ? "confirmation" : "confirmations";
const hasHave = confirmCount === 1 ? "has" : "have";
return `Your ${confirms} ${hasHave} been recorded.`;
}
}