Skip to content

Commit e953bef

Browse files
lucksptFrancisca105
authored andcommitted
fix: warn user when no contact
1 parent 6d02879 commit e953bef

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

frontend/src/components/BulkEmailDialogTrigger.vue

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@
7171

7272
<!-- Step 1: Configuration -->
7373
<div v-if="currentStep === 1" class="mt-6 space-y-6">
74+
<div v-if="showNoMemberContactWarning" class="bg-red-50 rounded-lg p-4 max-h-40 overflow-y-auto">
75+
<h1 class="text-xl font-semibold">⚠️ Important</h1>
76+
<p class="mt-2 text-sm">
77+
You must <RouterLink :to="{ name: 'settings' }" class="font-medium text-blue-600 hover:underline" @click="handleCancel"> set your contact email and phone number</RouterLink>.
78+
Not doing so will fail later. You have been warned.
79+
</p>
80+
</div>
81+
7482
<div>
7583
<label
7684
class="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
@@ -439,6 +447,7 @@ import {
439447
useBulkSpeakerEmails,
440448
type BulkEmailResult,
441449
} from "@/composables/useBulkEmails";
450+
import { useAuthStore } from "@/stores/auth";
442451
443452
interface Props {
444453
size?: "sm" | "default" | "lg" | "icon";
@@ -459,6 +468,17 @@ const emit = defineEmits<{
459468
success: [template: EmailTemplateCategory, result: BulkEmailResult];
460469
}>();
461470
471+
const authStore = useAuthStore();
472+
const showNoMemberContactWarning = computed(() => {
473+
const { member } = authStore;
474+
475+
if (!member?.contactObject) return true;
476+
477+
const hasMail = member?.contactObject?.mails?.length > 0 && member.contactObject.mails[0].mail.trim() !== "";
478+
const hasPhone = member?.contactObject?.phones?.length > 0 && member.contactObject.phones[0].phone.trim() !== "";
479+
return !hasMail || !hasPhone;
480+
});
481+
462482
// Use the appropriate composable based on entity type
463483
const bulkEmailComposable =
464484
props.entityType === "companies"

frontend/src/views/Dashboard/SettingsView.vue

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ import Button from "@/components/ui/button/Button.vue";
290290
import Badge from "@/components/ui/badge/Badge.vue";
291291
import Label from "@/components/ui/label/Label.vue";
292292
import ContactForm from "@/components/companies/ContactForm.vue";
293+
import { useAuthStore } from "@/stores/auth";
293294
294295
const isEditMode = ref(false);
295296
const queryCache = useQueryCache();
@@ -316,6 +317,7 @@ const { mutate: updateContactMutation, isLoading: isSaving } = useMutation({
316317
},
317318
});
318319
320+
const authStore = useAuthStore();
319321
const handleUpdateContact = async (data: any) => {
320322
if (!user.value?.data.contactObject?.id) return;
321323
@@ -332,6 +334,14 @@ const handleUpdateContact = async (data: any) => {
332334
id: user.value.data.contactObject.id,
333335
data: contactData,
334336
});
337+
338+
// Assert
339+
if (!authStore.member) return;
340+
341+
authStore.member.contactObject = {
342+
...authStore.member?.contactObject,
343+
...contactData,
344+
};
335345
};
336346
337347
const handleImageError = (event: Event) => {

0 commit comments

Comments
 (0)