@fayz-ai/plugin-crm 0.8.3 → 0.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cascade.d.ts.map +1 -1
- package/dist/components/BoardFilters.d.ts +23 -0
- package/dist/components/BoardFilters.d.ts.map +1 -0
- package/dist/components/QuoteStatusDropdown.d.ts.map +1 -1
- package/dist/components/TagChips.d.ts +16 -0
- package/dist/components/TagChips.d.ts.map +1 -0
- package/dist/data/mock.d.ts +5 -0
- package/dist/data/mock.d.ts.map +1 -1
- package/dist/data/supabase.d.ts +6 -0
- package/dist/data/supabase.d.ts.map +1 -1
- package/dist/data/types.d.ts +12 -2
- package/dist/data/types.d.ts.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1136 -164
- package/dist/index.js.map +1 -1
- package/dist/lib/access.d.ts +8 -0
- package/dist/lib/access.d.ts.map +1 -0
- package/dist/locales/en.d.ts.map +1 -1
- package/dist/locales/pt-BR.d.ts.map +1 -1
- package/dist/migrations/index.d.ts +9 -1
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/public/context.d.ts +3 -3
- package/dist/public/context.d.ts.map +1 -1
- package/dist/public/createPublicFormsPlugin.d.ts +18 -2
- package/dist/public/createPublicFormsPlugin.d.ts.map +1 -1
- package/dist/public/data.supabase.d.ts.map +1 -1
- package/dist/public/index.js +31 -7
- package/dist/public/index.js.map +1 -1
- package/dist/public/types.d.ts +27 -0
- package/dist/public/types.d.ts.map +1 -1
- package/dist/registries.d.ts +11 -0
- package/dist/registries.d.ts.map +1 -1
- package/dist/store.d.ts +12 -2
- package/dist/store.d.ts.map +1 -1
- package/dist/types.d.ts +51 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/views/ActivityListView.d.ts +6 -1
- package/dist/views/ActivityListView.d.ts.map +1 -1
- package/dist/views/DealSidebar.d.ts.map +1 -1
- package/dist/views/LeadDetailView.d.ts.map +1 -1
- package/dist/views/PipelineView.d.ts.map +1 -1
- package/dist/views/QuoteDetailView.d.ts.map +1 -1
- package/dist/views/QuoteListView.d.ts.map +1 -1
- package/package.json +15 -14
- package/src/CrmPage.tsx +1 -1
- package/src/cascade.ts +2 -0
- package/src/components/BoardFilters.tsx +190 -0
- package/src/components/QuoteStatusDropdown.tsx +15 -3
- package/src/components/TagChips.tsx +80 -0
- package/src/data/mock.ts +140 -7
- package/src/data/supabase.ts +256 -11
- package/src/data/types.ts +14 -3
- package/src/index.ts +179 -3
- package/src/lib/access.ts +11 -0
- package/src/locales/en.ts +13 -0
- package/src/locales/pt-BR.ts +18 -5
- package/src/migrations/003_crm_views_rls.sql +10 -2
- package/src/migrations/007_activity_log.sql +55 -0
- package/src/migrations/008_view_field_aliases.sql +43 -0
- package/src/migrations/009_deal_archived_status.sql +30 -0
- package/src/migrations/010_quote_archived_status.sql +40 -0
- package/src/migrations/011_agent_rpc_update_lead.sql +153 -0
- package/src/migrations/012_agent_rpc_create_lead.sql +128 -0
- package/src/migrations/013_tag_slugs.sql +177 -0
- package/src/migrations/014_public_lead_tags.sql +172 -0
- package/src/migrations/index.ts +833 -3
- package/src/public/context.tsx +4 -4
- package/src/public/createPublicFormsPlugin.ts +72 -2
- package/src/public/data.supabase.ts +3 -2
- package/src/public/types.ts +28 -0
- package/src/registries.ts +44 -11
- package/src/store.ts +135 -38
- package/src/types.ts +59 -2
- package/src/views/ActivityListView.tsx +79 -11
- package/src/views/DealSidebar.tsx +48 -39
- package/src/views/LeadDetailView.tsx +29 -10
- package/src/views/PipelineView.tsx +112 -11
- package/src/views/QuoteDetailView.tsx +7 -3
- package/src/views/QuoteListView.tsx +26 -12
- package/dist/index.cjs +0 -4759
- package/dist/index.cjs.map +0 -1
- package/dist/public/index.cjs +0 -306
- package/dist/public/index.cjs.map +0 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React, { useEffect } from 'react'
|
|
2
|
-
import { FileText, Pencil } from 'lucide-react'
|
|
2
|
+
import { FileText, Pencil, Archive } from 'lucide-react'
|
|
3
3
|
import type { ColumnDef } from '@tanstack/react-table'
|
|
4
4
|
import { DataTable } from '@fayz-ai/ui'
|
|
5
5
|
import { useCrmStore, useCrmConfig, formatCurrency } from '../CrmContext'
|
|
6
6
|
import { useTranslation } from '@fayz-ai/core'
|
|
7
7
|
import { SubpageHeader } from '@fayz-ai/ui'
|
|
8
|
+
import { useCanArchive } from '../lib/access'
|
|
8
9
|
import type { Quote } from '../types'
|
|
9
10
|
|
|
10
11
|
const STATUS_COLORS: Record<string, string> = {
|
|
@@ -20,7 +21,7 @@ const STATUS_COLORS: Record<string, string> = {
|
|
|
20
21
|
cancelled: 'bg-muted text-muted-foreground',
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
function useQuoteColumns(currency: { code: string; locale: string; symbol: string }, onEditQuote?: (id: string) => void): ColumnDef<Quote, any>[] {
|
|
24
|
+
function useQuoteColumns(currency: { code: string; locale: string; symbol: string }, onEditQuote?: (id: string) => void, onArchive?: (id: string) => void): ColumnDef<Quote, any>[] {
|
|
24
25
|
const t = useTranslation()
|
|
25
26
|
const cols: ColumnDef<Quote, any>[] = [
|
|
26
27
|
{ accessorKey: 'quoteNumber', header: '#', cell: ({ getValue }) => <span className="text-xs text-muted-foreground">{getValue() as string}</span> },
|
|
@@ -39,18 +40,29 @@ function useQuoteColumns(currency: { code: string; locale: string; symbol: strin
|
|
|
39
40
|
},
|
|
40
41
|
]
|
|
41
42
|
|
|
42
|
-
if (onEditQuote) {
|
|
43
|
+
if (onEditQuote || onArchive) {
|
|
43
44
|
cols.push({
|
|
44
45
|
id: 'actions', header: '',
|
|
45
46
|
cell: ({ row }) => (
|
|
46
|
-
<div className="
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
<div className="flex items-center justify-end gap-0.5">
|
|
48
|
+
{onEditQuote && (
|
|
49
|
+
<button
|
|
50
|
+
onClick={(e) => { e.stopPropagation(); onEditQuote(row.original.id) }}
|
|
51
|
+
className="inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground transition-colors"
|
|
52
|
+
title="Edit quote"
|
|
53
|
+
>
|
|
54
|
+
<Pencil className="h-3.5 w-3.5" />
|
|
55
|
+
</button>
|
|
56
|
+
)}
|
|
57
|
+
{onArchive && (
|
|
58
|
+
<button
|
|
59
|
+
onClick={(e) => { e.stopPropagation(); onArchive(row.original.id) }}
|
|
60
|
+
className="inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground transition-colors"
|
|
61
|
+
title={t('crm.quotes.archive')}
|
|
62
|
+
>
|
|
63
|
+
<Archive className="h-3.5 w-3.5" />
|
|
64
|
+
</button>
|
|
65
|
+
)}
|
|
54
66
|
</div>
|
|
55
67
|
),
|
|
56
68
|
})
|
|
@@ -65,10 +77,12 @@ export function QuoteListView({ onNew, onEdit, onEditQuote }: { onNew?: () => vo
|
|
|
65
77
|
const quotes = useCrmStore((s) => s.quotes)
|
|
66
78
|
const quotesLoading = useCrmStore((s) => s.quotesLoading)
|
|
67
79
|
const fetchQuotes = useCrmStore((s) => s.fetchQuotes)
|
|
80
|
+
const archiveQuote = useCrmStore((s) => s.archiveQuote)
|
|
81
|
+
const canArchive = useCanArchive()
|
|
68
82
|
|
|
69
83
|
useEffect(() => { fetchQuotes({}) }, [])
|
|
70
84
|
|
|
71
|
-
const columns = useQuoteColumns(currency, onEditQuote)
|
|
85
|
+
const columns = useQuoteColumns(currency, onEditQuote, canArchive ? (id) => { void archiveQuote(id) } : undefined)
|
|
72
86
|
|
|
73
87
|
return (
|
|
74
88
|
<div className="space-y-4">
|