This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
||||||
import { Fragment, useState } from 'react';
|
import { Fragment, useState } from 'react';
|
||||||
import { commandsApi, plannedTabsApi, remindersApi, tabsApi, type Tab, type TabLine } from '@/lib/api/client';
|
import { commandsApi, plannedTabsApi, tabsApi, type Tab, type TabLine } from '@/lib/api/client';
|
||||||
import { PageHeader } from '@/components/page-header';
|
import { PageHeader } from '@/components/page-header';
|
||||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||||
import { Input } from '@/components/ui/input';
|
import { Input } from '@/components/ui/input';
|
||||||
@@ -18,7 +18,7 @@ import { LoadingState } from '@/components/loading-state';
|
|||||||
import { ErrorState } from '@/components/error-state';
|
import { ErrorState } from '@/components/error-state';
|
||||||
import { toast } from '@/components/ui/toast';
|
import { toast } from '@/components/ui/toast';
|
||||||
import { formatCents } from '@/lib/utils';
|
import { formatCents } from '@/lib/utils';
|
||||||
import { RefreshCw, Plus, X, Users, Mail, Send, Upload, ChevronRight, ChevronDown, Search, Trash2 } from 'lucide-react';
|
import { RefreshCw, Plus, X, Users, Mail, Upload, ChevronRight, ChevronDown, Search, Trash2 } from 'lucide-react';
|
||||||
import { ConfirmDialog } from '@/components/confirm-dialog';
|
import { ConfirmDialog } from '@/components/confirm-dialog';
|
||||||
import { ImportCustomersDialog } from '@/components/import-customers-dialog';
|
import { ImportCustomersDialog } from '@/components/import-customers-dialog';
|
||||||
import { useLang } from '@/lib/i18n';
|
import { useLang } from '@/lib/i18n';
|
||||||
@@ -137,16 +137,6 @@ export default function TabsPage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const sendTestMutation = useMutation({
|
|
||||||
mutationFn: (plannedTabId: string) => remindersApi.sendTest(venueId, plannedTabId),
|
|
||||||
onSuccess: (result) => {
|
|
||||||
toast({ title: t('tabs.test_sent'), description: t('tabs.test_sent_desc', { email: result.email }), variant: 'success' });
|
|
||||||
},
|
|
||||||
onError: (err) => {
|
|
||||||
toast({ title: t('tabs.test_failed'), description: te(err), variant: 'destructive' });
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
if (isLoading) return <LoadingState />;
|
if (isLoading) return <LoadingState />;
|
||||||
if (error) return <ErrorState message={te(error, 'tabs.load_failed')} />;
|
if (error) return <ErrorState message={te(error, 'tabs.load_failed')} />;
|
||||||
|
|
||||||
@@ -208,17 +198,6 @@ export default function TabsPage() {
|
|||||||
<div key={pt.id} className="flex items-center gap-1 px-3 py-1.5 bg-secondary rounded-full text-sm">
|
<div key={pt.id} className="flex items-center gap-1 px-3 py-1.5 bg-secondary rounded-full text-sm">
|
||||||
{pt.customerName}
|
{pt.customerName}
|
||||||
{pt.email && <Mail className="h-3 w-3 text-muted-foreground" />}
|
{pt.email && <Mail className="h-3 w-3 text-muted-foreground" />}
|
||||||
{canManage && pt.email && (
|
|
||||||
<button
|
|
||||||
onClick={() => sendTestMutation.mutate(pt.id)}
|
|
||||||
disabled={sendTestMutation.isPending}
|
|
||||||
className="text-muted-foreground hover:text-primary ml-0.5"
|
|
||||||
title={t('tabs.send_test')}
|
|
||||||
aria-label={t('tabs.send_test')}
|
|
||||||
>
|
|
||||||
<Send className="h-3 w-3" />
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
{canManage && (
|
{canManage && (
|
||||||
<button onClick={() => removePlannedName(pt.id)} className="text-muted-foreground hover:text-destructive ml-0.5" aria-label={t('planned.remove', { name: pt.customerName })}>
|
<button onClick={() => removePlannedName(pt.id)} className="text-muted-foreground hover:text-destructive ml-0.5" aria-label={t('planned.remove', { name: pt.customerName })}>
|
||||||
<X className="h-3 w-3" />
|
<X className="h-3 w-3" />
|
||||||
@@ -296,17 +275,6 @@ export default function TabsPage() {
|
|||||||
<div className="flex items-center gap-1.5 text-sm text-muted-foreground">
|
<div className="flex items-center gap-1.5 text-sm text-muted-foreground">
|
||||||
<Mail className="h-3 w-3" />
|
<Mail className="h-3 w-3" />
|
||||||
<span className="truncate max-w-[200px]">{tab.email}</span>
|
<span className="truncate max-w-[200px]">{tab.email}</span>
|
||||||
{canManage && tab.plannedTabId && (
|
|
||||||
<button
|
|
||||||
onClick={() => sendTestMutation.mutate(tab.plannedTabId!)}
|
|
||||||
disabled={sendTestMutation.isPending}
|
|
||||||
className="hover:text-primary"
|
|
||||||
title={t('tabs.send_test')}
|
|
||||||
aria-label={t('tabs.send_test')}
|
|
||||||
>
|
|
||||||
<Send className="h-3 w-3" />
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<span className="text-muted-foreground">—</span>
|
<span className="text-muted-foreground">—</span>
|
||||||
|
|||||||
@@ -110,10 +110,6 @@ const translations: Record<Lang, Record<string, string>> = {
|
|||||||
'tabs.deleted': "{name}'s tab is deleted",
|
'tabs.deleted': "{name}'s tab is deleted",
|
||||||
'tabs.settled': 'Tab settled',
|
'tabs.settled': 'Tab settled',
|
||||||
'tabs.settled_desc': '{name}: {amount}',
|
'tabs.settled_desc': '{name}: {amount}',
|
||||||
'tabs.send_test': 'Send test email',
|
|
||||||
'tabs.test_sent': 'Test email sent',
|
|
||||||
'tabs.test_sent_desc': 'Sent to {email}',
|
|
||||||
'tabs.test_failed': 'Test email failed',
|
|
||||||
'planned.title': 'Planned Customers',
|
'planned.title': 'Planned Customers',
|
||||||
'planned.name_placeholder': 'Add customer name...',
|
'planned.name_placeholder': 'Add customer name...',
|
||||||
'planned.email_placeholder': 'Email (optional)',
|
'planned.email_placeholder': 'Email (optional)',
|
||||||
@@ -668,10 +664,6 @@ const translations: Record<Lang, Record<string, string>> = {
|
|||||||
'tabs.deleted': 'Poef van {name} is verwijderd',
|
'tabs.deleted': 'Poef van {name} is verwijderd',
|
||||||
'tabs.settled': 'Poef afgerekend',
|
'tabs.settled': 'Poef afgerekend',
|
||||||
'tabs.settled_desc': '{name}: {amount}',
|
'tabs.settled_desc': '{name}: {amount}',
|
||||||
'tabs.send_test': 'Testmail versturen',
|
|
||||||
'tabs.test_sent': 'Testmail verstuurd',
|
|
||||||
'tabs.test_sent_desc': 'Verstuurd naar {email}',
|
|
||||||
'tabs.test_failed': 'Testmail mislukt',
|
|
||||||
'planned.title': 'Geplande klanten',
|
'planned.title': 'Geplande klanten',
|
||||||
'planned.name_placeholder': 'Naam van de klant...',
|
'planned.name_placeholder': 'Naam van de klant...',
|
||||||
'planned.email_placeholder': 'E-mail (optioneel)',
|
'planned.email_placeholder': 'E-mail (optioneel)',
|
||||||
|
|||||||
Reference in New Issue
Block a user