feat: add one-click nudge system with popover, throttling, and email notifications (Story 3.2)
Add NudgeController with 1-hour throttling per declaration, NudgePopover component on declarations index and dashboard, shadcn-vue popover primitives, and per-declaration nudge tracking. Owners/managers can nudge assigned workers with one click. Includes 10 feature tests covering authorization, throttling, and cache invalidation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
68
resources/js/components/declarations/NudgePopover.vue
Normal file
68
resources/js/components/declarations/NudgePopover.vue
Normal file
@@ -0,0 +1,68 @@
|
||||
<script setup lang="ts">
|
||||
import { useForm } from '@inertiajs/vue3';
|
||||
import { Send } from 'lucide-vue-next';
|
||||
import { ref } from 'vue';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import {
|
||||
Popover,
|
||||
PopoverContent,
|
||||
PopoverTrigger,
|
||||
} from '@/components/ui/popover';
|
||||
|
||||
type Props = {
|
||||
assigneeName: string | null;
|
||||
nudgeUrl: string;
|
||||
};
|
||||
|
||||
const props = defineProps<Props>();
|
||||
|
||||
const open = ref(false);
|
||||
const form = useForm({});
|
||||
|
||||
function sendNudge() {
|
||||
form.post(props.nudgeUrl, {
|
||||
preserveScroll: true,
|
||||
onSuccess: () => {
|
||||
open.value = false;
|
||||
},
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Popover v-model:open="open">
|
||||
<PopoverTrigger as-child>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
class="h-8 w-8"
|
||||
@click.stop
|
||||
>
|
||||
<Send class="h-4 w-4" />
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent
|
||||
class="w-64"
|
||||
align="end"
|
||||
@click.stop
|
||||
>
|
||||
<div class="space-y-3">
|
||||
<p class="text-sm">
|
||||
Envoyer une relance à
|
||||
<span class="font-medium">{{
|
||||
assigneeName ?? 'Non assigné'
|
||||
}}</span>
|
||||
</p>
|
||||
<Button
|
||||
class="w-full"
|
||||
size="sm"
|
||||
:disabled="form.processing || !assigneeName"
|
||||
@click="sendNudge"
|
||||
>
|
||||
<Send class="mr-2 h-4 w-4" />
|
||||
Envoyer une relance
|
||||
</Button>
|
||||
</div>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
</template>
|
||||
Reference in New Issue
Block a user