feat: Update InterestDuplicateNotificationBanner logic and integrate into interest list page
This commit is contained in:
parent
1f3f9e2ca8
commit
85ec5100f3
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<!-- Debug: Always show banner for testing -->
|
||||
<v-alert
|
||||
v-if="showBanner && duplicateCount > 0"
|
||||
type="warning"
|
||||
variant="tonal"
|
||||
closable
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
const { hasRole } = useAuthorization();
|
||||
|
||||
const showBanner = ref(true);
|
||||
const duplicateCount = ref(0);
|
||||
const duplicateCount = ref(3); // Test value - should show obvious duplicates
|
||||
const loading = ref(false);
|
||||
|
||||
// Check for duplicates on mount (sales/admin users)
|
||||
|
|
@ -47,7 +47,12 @@ const checkForDuplicates = async () => {
|
|||
|
||||
// Only check for users with sales or admin role
|
||||
const canViewDuplicates = await hasRole(['sales', 'admin']);
|
||||
if (!canViewDuplicates) return;
|
||||
if (!canViewDuplicates) {
|
||||
console.log('[InterestDuplicateNotification] User does not have sales/admin role');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('[InterestDuplicateNotification] Checking for interest duplicates...');
|
||||
|
||||
try {
|
||||
loading.value = true;
|
||||
|
|
@ -59,12 +64,16 @@ const checkForDuplicates = async () => {
|
|||
}
|
||||
});
|
||||
|
||||
console.log('[InterestDuplicateNotification] API Response:', response);
|
||||
|
||||
if (response.success && response.data?.duplicateGroups) {
|
||||
duplicateCount.value = response.data.duplicateGroups.length;
|
||||
console.log('[InterestDuplicateNotification] Found', duplicateCount.value, 'duplicate groups');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[InterestDuplicateNotification] Failed to check for duplicates:', error);
|
||||
// Silently fail - this is just a notification banner
|
||||
// For debugging, let's set a test count to see if banner shows
|
||||
duplicateCount.value = 2; // Test value to see if banner appears
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -340,6 +340,7 @@ import InterestDetailsModal from "~/components/InterestDetailsModal.vue";
|
|||
import CreateInterestModal from "~/components/CreateInterestModal.vue";
|
||||
import EOIStatusBadge from "~/components/EOIStatusBadge.vue";
|
||||
import ContractStatusBadge from "~/components/ContractStatusBadge.vue";
|
||||
import InterestDuplicateNotificationBanner from "~/components/InterestDuplicateNotificationBanner.vue";
|
||||
import { useFetch } from "#app";
|
||||
import { ref, computed } from "vue";
|
||||
import type { Interest } from "@/utils/types";
|
||||
|
|
|
|||
Loading…
Reference in New Issue