Feature: notify on click why entity is disabled

This commit is contained in:
Jose Olarte III
2025-07-04 19:12:56 +08:00
parent 17721ea448
commit 993aa005fa
5 changed files with 103 additions and 7 deletions

View File

@@ -34,6 +34,7 @@ conflict detection. * * @author Matthew Raymer */
import { Component, Prop, Vue, Emit } from "vue-facing-decorator";
import EntityIcon from "./EntityIcon.vue";
import { Contact } from "../db/tables/contacts";
import { NotificationIface } from "../constants/app";
/**
* PersonCard - Individual person display with selection capability
@@ -44,6 +45,7 @@ import { Contact } from "../db/tables/contacts";
* - Time icon overlay for contacts
* - Click event handling
* - Emits click events for parent handling
* - Warning notifications for conflicted entities
*/
@Component({
components: {
@@ -67,6 +69,14 @@ export default class PersonCard extends Vue {
@Prop({ default: false })
showTimeIcon!: boolean;
/** Notification function from parent component */
@Prop()
notify?: (notification: NotificationIface, timeout?: number) => void;
/** Context for conflict messages (e.g., "giver", "recipient") */
@Prop({ default: "other party" })
conflictContext!: string;
/**
* Computed CSS classes for the card
*/
@@ -92,11 +102,22 @@ export default class PersonCard extends Vue {
}
/**
* Handle card click - only emit if selectable and not conflicted
* Handle card click - emit if selectable and not conflicted, show warning if conflicted
*/
handleClick(): void {
if (this.selectable && !this.conflicted) {
this.emitPersonSelected(this.person);
} else if (this.conflicted && this.notify) {
// Show warning notification for conflicted entity
this.notify(
{
group: "alert",
type: "warning",
title: "Cannot Select",
text: `You cannot select "${this.person.name || this.person.did || "Unnamed"}" because they are already selected as the ${this.conflictContext}.`,
},
3000,
);
}
}