@fayz-ai/plugin-crm 0.34.0 → 0.35.1
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/{CrmPage-Z2HRXNCW.js → CrmPage-Z5OYCBKA.js} +421 -388
- package/dist/CrmPage-Z5OYCBKA.js.map +1 -0
- package/dist/components/DealsToolbar.d.ts +37 -0
- package/dist/components/DealsToolbar.d.ts.map +1 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/locales/en.d.ts.map +1 -1
- package/dist/locales/pt-BR.d.ts.map +1 -1
- package/dist/views/DealListView.d.ts.map +1 -1
- package/dist/views/PipelineView.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/CrmPage-Z2HRXNCW.js.map +0 -1
|
@@ -4,8 +4,8 @@ import { resolveSourceView } from './chunk-QJOLAGGN.js';
|
|
|
4
4
|
import { CrmContextProvider, useCrmProvider, useCrmStore, useCrmConfig, formatCurrency } from './chunk-7V46TYYX.js';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import React__default, { useCallback, useMemo, useState, useEffect, useRef } from 'react';
|
|
7
|
-
import { Archive, FileX2, FileCheck2, Send, FilePlus2, XCircle, Trophy, PhoneCall, MoveRight, Target, ArrowRightLeft, UserPlus, MapPin, MessageCircle, CheckSquare, FileText, Users, Mail, Phone, Filter, Globe, Check, ChevronRight, Plus, Settings, Tag, Briefcase, CircleDot, User, Download, CircleDashed, Search, Inbox, X, Play, Clock, Sparkles, Calendar, ArrowRight, MoreHorizontal, ChevronDown, Printer, Pencil, CircleCheckBig, Ban, Receipt, Package, CalendarClock, Loader2, Network, Building2, Star, Trash2, MessageSquareQuote, UserRound, CalendarDays, ThumbsDown, SignalHigh, CalendarRange, TrendingDown, UserCheck, AlertTriangle, Settings2, Repeat, Zap, Snowflake, Sun, Flame, Merge, Fingerprint, Paperclip, ImageOff, CircleAlert, Link2, CheckCircle2,
|
|
8
|
-
import { PageTransition, ModulePage, Button, useIsWide, PageHeaderActions, usePageSize, toast, FilterChip, MultiSelect, FilterMenu, FilterMenuRow, PersonAvatar, SubpageHeader, ListView, ConfirmDialog, Modal, ModalContent, ModalHeader, ModalTitle, ModalBody, Input, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Textarea, ModalFooter, useSaveBar, SearchSelect, DatePicker, useFilterDraft, FilterPanel, FilterPanelField, RequiredFilter, Card, DataTable, Dropdown, DropdownTrigger, DropdownContent, DropdownItem, PhoneLink, ComingSoon, Switch, TooltipProvider, Tooltip, TooltipTrigger, TooltipContent, DashboardCanvas,
|
|
7
|
+
import { Archive, FileX2, FileCheck2, Send, FilePlus2, XCircle, Trophy, PhoneCall, MoveRight, Target, ArrowRightLeft, UserPlus, MapPin, MessageCircle, CheckSquare, FileText, Users, Mail, Phone, Filter, Globe, Check, ChevronRight, Plus, Settings, Tag, Briefcase, CircleDot, User, Download, CircleDashed, Search, Inbox, X, Play, Clock, Sparkles, Calendar, ArrowRight, MoreHorizontal, ChevronDown, Printer, Pencil, CircleCheckBig, Ban, Receipt, Package, CalendarClock, Loader2, Network, Building2, Star, Trash2, MessageSquareQuote, UserRound, CalendarDays, ThumbsDown, SignalHigh, CalendarRange, TrendingDown, UserCheck, AlertTriangle, Settings2, Repeat, Zap, Snowflake, Sun, Flame, Merge, Fingerprint, Paperclip, ImageOff, CircleAlert, Link2, CheckCircle2, ExternalLink, Clipboard, DollarSign, ThumbsUp, SlidersHorizontal, ChevronLeft, UserRoundPlus } from 'lucide-react';
|
|
8
|
+
import { PageTransition, ModulePage, Button, useIsWide, PageHeaderActions, usePageSize, toast, FilterChip, MultiSelect, FilterMenu, FilterMenuRow, PersonAvatar, SubpageHeader, ListView, ConfirmDialog, Modal, ModalContent, ModalHeader, ModalTitle, ModalBody, Input, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Textarea, ModalFooter, useSaveBar, SearchSelect, DatePicker, useFilterDraft, FilterPanel, FilterPanelField, RequiredFilter, Card, DataTable, Dropdown, DropdownTrigger, DropdownContent, DropdownItem, PhoneLink, ComingSoon, Switch, TooltipProvider, Tooltip, TooltipTrigger, TooltipContent, DashboardCanvas, Pagination, PersonPicker, cn, HeaderTabs, SheetBody, SheetFooter, Popover, PopoverTrigger, PopoverContent, getLucideIcon, DictateButton, DropdownLabel, DropdownSeparator, ModalDescription, normalizePhone } from '@fayz-ai/ui';
|
|
9
9
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
10
10
|
import { usePluginRuntimeOptional, useTranslation, currentAppPath, navigateApp, useActiveTenantId, exportCSV, getCurrentLocale, appHref, getSupabaseClientOptional, loadMessageOverrides, resolveMessages, useActiveUnitId } from '@fayz-ai/core';
|
|
11
11
|
import { useModuleNavigation, usePluginOnboardingGate, useUnitStore, PluginOnboardingGateSkeleton, createViewRouter, ModuleActionBar, adminNavigateTo, PageActions, usePermissionOptional, usePersistedState, useScrollMemory, useLimitGuard, useCatalogedItemTypes, OrderFormSkeleton, OrderFormBlock, OrderFormView, OrderFormItemsCard, OrderFormItemRow, OrderFormAddItemStep, createArchetypeLookup, useRecordVisit, AddressesTab, OrderDetailSkeleton, OrderDetailBlock, OrderDetailView, PersonLink, CrudFormSkeleton, CrudFormPage, CrudDetailSkeleton, CrudDetailPage, AskAIButton, KanbanBoard, InlineField, useUnitFilter, invalidateLimit, useAccessOptional, useOrganizationStore, getRailPage, RightRailPage, ContactPicker, useAgentSurface } from '@fayz-ai/admin';
|
|
@@ -597,6 +597,103 @@ function UnitPicker({ filter: f }) {
|
|
|
597
597
|
] })
|
|
598
598
|
] });
|
|
599
599
|
}
|
|
600
|
+
function DisplayPopover({ config }) {
|
|
601
|
+
const t = useTranslation();
|
|
602
|
+
const [page, setPage] = useState("root");
|
|
603
|
+
return /* @__PURE__ */ jsxs(Popover, { onOpenChange: (open) => {
|
|
604
|
+
if (!open) setPage("root");
|
|
605
|
+
}, children: [
|
|
606
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
607
|
+
Button,
|
|
608
|
+
{
|
|
609
|
+
variant: "bare",
|
|
610
|
+
size: "bare",
|
|
611
|
+
type: "button",
|
|
612
|
+
title: t("crm.board.display"),
|
|
613
|
+
className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full border bg-card text-muted-foreground shadow-button transition-colors hover:bg-muted hover:text-foreground",
|
|
614
|
+
children: /* @__PURE__ */ jsx(SlidersHorizontal, { className: "h-4 w-4" })
|
|
615
|
+
}
|
|
616
|
+
) }),
|
|
617
|
+
/* @__PURE__ */ jsxs(PopoverContent, { align: "end", className: "w-72 p-1.5", children: [
|
|
618
|
+
page === "root" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
619
|
+
/* @__PURE__ */ jsx("p", { className: "px-2 py-1 text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: t("crm.board.display") }),
|
|
620
|
+
/* @__PURE__ */ jsxs(
|
|
621
|
+
Button,
|
|
622
|
+
{
|
|
623
|
+
variant: "bare",
|
|
624
|
+
size: "bare",
|
|
625
|
+
type: "button",
|
|
626
|
+
onClick: () => setPage("props"),
|
|
627
|
+
className: "flex w-full justify-start whitespace-normal font-normal gap-2 px-2 py-1.5 text-left text-xs hover:bg-muted",
|
|
628
|
+
children: [
|
|
629
|
+
/* @__PURE__ */ jsx(SlidersHorizontal, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
630
|
+
config.title,
|
|
631
|
+
/* @__PURE__ */ jsx("span", { className: "ml-auto text-muted-foreground", children: "\u203A" })
|
|
632
|
+
]
|
|
633
|
+
}
|
|
634
|
+
)
|
|
635
|
+
] }),
|
|
636
|
+
page === "props" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
637
|
+
/* @__PURE__ */ jsxs(
|
|
638
|
+
Button,
|
|
639
|
+
{
|
|
640
|
+
variant: "bare",
|
|
641
|
+
size: "bare",
|
|
642
|
+
type: "button",
|
|
643
|
+
onClick: () => setPage("root"),
|
|
644
|
+
className: "flex w-full justify-start gap-1 px-1.5 py-1 text-left text-[11px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
645
|
+
children: [
|
|
646
|
+
/* @__PURE__ */ jsx(ChevronLeft, { className: "h-3.5 w-3.5" }),
|
|
647
|
+
" ",
|
|
648
|
+
t("common.back"),
|
|
649
|
+
/* @__PURE__ */ jsx("span", { className: "ml-auto pr-1 text-[10px] font-medium uppercase tracking-wide", children: config.title })
|
|
650
|
+
]
|
|
651
|
+
}
|
|
652
|
+
),
|
|
653
|
+
/* @__PURE__ */ jsx("div", { className: "my-1 border-t border-border" }),
|
|
654
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1.5 p-1", children: config.options.map(({ key, label: label2 }) => {
|
|
655
|
+
const on = config.visible[key] !== false;
|
|
656
|
+
return /* @__PURE__ */ jsx(
|
|
657
|
+
Button,
|
|
658
|
+
{
|
|
659
|
+
variant: "bare",
|
|
660
|
+
size: "bare",
|
|
661
|
+
type: "button",
|
|
662
|
+
"aria-pressed": on,
|
|
663
|
+
onClick: () => config.onChange({ ...config.visible, [key]: !on }),
|
|
664
|
+
className: `rounded-full px-2.5 py-1 text-xs ${on ? "border border-primary/30 bg-primary/10 font-medium text-primary" : "border border-border font-normal text-muted-foreground hover:text-foreground"}`,
|
|
665
|
+
children: label2
|
|
666
|
+
},
|
|
667
|
+
key
|
|
668
|
+
);
|
|
669
|
+
}) })
|
|
670
|
+
] })
|
|
671
|
+
] })
|
|
672
|
+
] });
|
|
673
|
+
}
|
|
674
|
+
function DealsToolbar({ search, onSearchChange, children, display, variant = "header" }) {
|
|
675
|
+
const t = useTranslation();
|
|
676
|
+
const row = /* @__PURE__ */ jsxs("div", { className: `flex flex-wrap items-center gap-2 px-3 py-2 ${variant === "header" ? "border-b border-border" : ""}`, children: [
|
|
677
|
+
/* @__PURE__ */ jsxs("div", { className: "relative min-w-[12rem] flex-1", children: [
|
|
678
|
+
/* @__PURE__ */ jsx(Search, { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
|
|
679
|
+
/* @__PURE__ */ jsx(
|
|
680
|
+
Input,
|
|
681
|
+
{
|
|
682
|
+
type: "text",
|
|
683
|
+
value: search,
|
|
684
|
+
onChange: (e) => onSearchChange(e.target.value),
|
|
685
|
+
placeholder: t("crm.deals.searchPlaceholder"),
|
|
686
|
+
className: "h-auto rounded-none border-0 bg-transparent py-1.5 pl-8 pr-3 shadow-none focus-visible:ring-0 focus-visible:ring-offset-0"
|
|
687
|
+
}
|
|
688
|
+
)
|
|
689
|
+
] }),
|
|
690
|
+
/* @__PURE__ */ jsxs("div", { className: "ml-auto flex shrink-0 flex-nowrap items-center justify-end gap-1.5 md:flex-wrap", children: [
|
|
691
|
+
children,
|
|
692
|
+
display && /* @__PURE__ */ jsx(DisplayPopover, { config: display })
|
|
693
|
+
] })
|
|
694
|
+
] });
|
|
695
|
+
return variant === "card" ? /* @__PURE__ */ jsx(Card, { className: "overflow-visible", children: row }) : row;
|
|
696
|
+
}
|
|
600
697
|
|
|
601
698
|
// src/lib/relative-time.ts
|
|
602
699
|
var MINUTE = 60;
|
|
@@ -1137,80 +1234,6 @@ var TEMP_CHIP = {
|
|
|
1137
1234
|
cold: { icon: Snowflake, cls: "bg-info-soft text-info-soft-foreground" }
|
|
1138
1235
|
};
|
|
1139
1236
|
var DISPLAY_DEFAULTS = { temperature: true, due: true, contact: true, tags: true, value: true, age: true };
|
|
1140
|
-
function DisplayPopover({ display, onChange }) {
|
|
1141
|
-
const t = useTranslation();
|
|
1142
|
-
const [page, setPage] = useState("root");
|
|
1143
|
-
return /* @__PURE__ */ jsxs(Popover, { onOpenChange: (open) => {
|
|
1144
|
-
if (!open) setPage("root");
|
|
1145
|
-
}, children: [
|
|
1146
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
1147
|
-
Button,
|
|
1148
|
-
{
|
|
1149
|
-
variant: "bare",
|
|
1150
|
-
size: "bare",
|
|
1151
|
-
type: "button",
|
|
1152
|
-
title: t("crm.board.display"),
|
|
1153
|
-
className: "flex h-8 w-8 items-center justify-center rounded-full border bg-card text-muted-foreground shadow-button transition-colors hover:bg-muted hover:text-foreground",
|
|
1154
|
-
children: /* @__PURE__ */ jsx(SlidersHorizontal, { className: "h-4 w-4" })
|
|
1155
|
-
}
|
|
1156
|
-
) }),
|
|
1157
|
-
/* @__PURE__ */ jsxs(PopoverContent, { align: "end", className: "w-72 p-1.5", children: [
|
|
1158
|
-
page === "root" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1159
|
-
/* @__PURE__ */ jsx("p", { className: "px-2 py-1 text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: t("crm.board.display") }),
|
|
1160
|
-
/* @__PURE__ */ jsxs(
|
|
1161
|
-
Button,
|
|
1162
|
-
{
|
|
1163
|
-
variant: "bare",
|
|
1164
|
-
size: "bare",
|
|
1165
|
-
type: "button",
|
|
1166
|
-
onClick: () => setPage("props"),
|
|
1167
|
-
className: "flex w-full justify-start whitespace-normal font-normal gap-2 px-2 py-1.5 text-left text-xs hover:bg-muted",
|
|
1168
|
-
children: [
|
|
1169
|
-
/* @__PURE__ */ jsx(SlidersHorizontal, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
1170
|
-
t("crm.board.cardProps"),
|
|
1171
|
-
/* @__PURE__ */ jsx("span", { className: "ml-auto text-muted-foreground", children: "\u203A" })
|
|
1172
|
-
]
|
|
1173
|
-
}
|
|
1174
|
-
)
|
|
1175
|
-
] }),
|
|
1176
|
-
page === "props" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1177
|
-
/* @__PURE__ */ jsxs(
|
|
1178
|
-
Button,
|
|
1179
|
-
{
|
|
1180
|
-
variant: "bare",
|
|
1181
|
-
size: "bare",
|
|
1182
|
-
type: "button",
|
|
1183
|
-
onClick: () => setPage("root"),
|
|
1184
|
-
className: "flex w-full justify-start gap-1 px-1.5 py-1 text-left text-[11px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
1185
|
-
children: [
|
|
1186
|
-
/* @__PURE__ */ jsx(ChevronLeft, { className: "h-3.5 w-3.5" }),
|
|
1187
|
-
" ",
|
|
1188
|
-
t("common.back"),
|
|
1189
|
-
/* @__PURE__ */ jsx("span", { className: "ml-auto pr-1 text-[10px] font-medium uppercase tracking-wide", children: t("crm.board.cardProps") })
|
|
1190
|
-
]
|
|
1191
|
-
}
|
|
1192
|
-
),
|
|
1193
|
-
/* @__PURE__ */ jsx("div", { className: "my-1 border-t border-border" }),
|
|
1194
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1.5 p-1", children: Object.keys(DISPLAY_DEFAULTS).map((k) => {
|
|
1195
|
-
const on = display[k];
|
|
1196
|
-
return /* @__PURE__ */ jsx(
|
|
1197
|
-
Button,
|
|
1198
|
-
{
|
|
1199
|
-
variant: "bare",
|
|
1200
|
-
size: "bare",
|
|
1201
|
-
type: "button",
|
|
1202
|
-
"aria-pressed": on,
|
|
1203
|
-
onClick: () => onChange({ ...display, [k]: !on }),
|
|
1204
|
-
className: `rounded-full px-2.5 py-1 text-xs ${on ? "border border-primary/30 bg-primary/10 font-medium text-primary" : "border border-border font-normal text-muted-foreground hover:text-foreground"}`,
|
|
1205
|
-
children: t(`crm.board.prop.${k}`)
|
|
1206
|
-
},
|
|
1207
|
-
k
|
|
1208
|
-
);
|
|
1209
|
-
}) })
|
|
1210
|
-
] })
|
|
1211
|
-
] })
|
|
1212
|
-
] });
|
|
1213
|
-
}
|
|
1214
1237
|
function shortDate(iso, locale) {
|
|
1215
1238
|
try {
|
|
1216
1239
|
return (/* @__PURE__ */ new Date(iso + (iso.length === 10 ? "T00:00:00" : ""))).toLocaleDateString(locale, { day: "numeric", month: "short" });
|
|
@@ -1763,196 +1786,195 @@ function PipelineView({ onDealClick, onAddLead, onOpenSettings, onStageIntent })
|
|
|
1763
1786
|
setMenu({ x: e.clientX, y: e.clientY, deal, mode });
|
|
1764
1787
|
}
|
|
1765
1788
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
1766
|
-
/* @__PURE__ */
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
t("crm.leads.filters.mine"),
|
|
1782
|
-
effectiveOwner === myUserId && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 shrink-0" })
|
|
1783
|
-
] }),
|
|
1784
|
-
/* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: CHIP_ROW, onClick: () => setOwnerFilter("none"), children: [
|
|
1785
|
-
/* @__PURE__ */ jsx(UserRound, { className: "h-3 w-3 text-muted-foreground" }),
|
|
1786
|
-
" ",
|
|
1787
|
-
t("crm.leads.filters.unassigned"),
|
|
1788
|
-
effectiveOwner === "none" && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 shrink-0" })
|
|
1789
|
-
] }),
|
|
1790
|
-
(team ?? []).filter((m) => m.userId !== myUserId).map((m) => /* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: CHIP_ROW, onClick: () => setOwnerFilter(m.userId), children: [
|
|
1791
|
-
/* @__PURE__ */ jsx(PersonAvatar, { name: m.name, size: "xs" }),
|
|
1792
|
-
" ",
|
|
1793
|
-
/* @__PURE__ */ jsx("span", { className: "truncate", children: m.name }),
|
|
1794
|
-
effectiveOwner === m.userId && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 shrink-0" })
|
|
1795
|
-
] }, m.userId))
|
|
1796
|
-
]
|
|
1797
|
-
}
|
|
1798
|
-
),
|
|
1799
|
-
period !== "all" && /* @__PURE__ */ jsx(
|
|
1800
|
-
BoardFilterChip,
|
|
1801
|
-
{
|
|
1802
|
-
closeOnSelect: true,
|
|
1803
|
-
clearLabel: t("crm.board.clearFilters"),
|
|
1804
|
-
onClear: () => setPeriod("all"),
|
|
1805
|
-
trigger: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1806
|
-
/* @__PURE__ */ jsx(CalendarDays, { className: "h-3 w-3" }),
|
|
1807
|
-
t(`crm.filters.period${period === "custom" ? "Custom" : period}`)
|
|
1808
|
-
] }),
|
|
1809
|
-
children: ["24h", "7d", "custom"].map((p) => /* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: CHIP_ROW, onClick: () => setPeriod(p), children: [
|
|
1810
|
-
t(`crm.filters.period${p === "custom" ? "Custom" : p}`),
|
|
1811
|
-
period === p && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 shrink-0" })
|
|
1812
|
-
] }, p))
|
|
1813
|
-
}
|
|
1814
|
-
),
|
|
1815
|
-
selectedTags.length > 0 && /* @__PURE__ */ jsx(
|
|
1816
|
-
BoardFilterChip,
|
|
1817
|
-
{
|
|
1818
|
-
clearLabel: t("crm.board.clearFilters"),
|
|
1819
|
-
onClear: () => setSelectedTags([]),
|
|
1820
|
-
trigger: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1821
|
-
/* @__PURE__ */ jsx("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full", style: { backgroundColor: tagDefs.get(selectedTags[0])?.color ?? "#94A3B8" } }),
|
|
1822
|
-
/* @__PURE__ */ jsxs("span", { className: "max-w-[8rem] truncate", children: [
|
|
1823
|
-
tagDefs.get(selectedTags[0])?.name ?? humanizeTag(selectedTags[0]),
|
|
1824
|
-
selectedTags.length > 1 ? ` +${selectedTags.length - 1}` : ""
|
|
1825
|
-
] })
|
|
1826
|
-
] }),
|
|
1827
|
-
children: [.../* @__PURE__ */ new Set([...availableTags, ...selectedTags])].sort((a, b) => (tagDefs.get(a)?.name ?? humanizeTag(a)).localeCompare(tagDefs.get(b)?.name ?? humanizeTag(b))).map((slug) => {
|
|
1828
|
-
const on = selectedTags.includes(slug);
|
|
1829
|
-
return /* @__PURE__ */ jsxs(
|
|
1830
|
-
Button,
|
|
1831
|
-
{
|
|
1832
|
-
variant: "bare",
|
|
1833
|
-
size: "bare",
|
|
1834
|
-
className: CHIP_ROW,
|
|
1835
|
-
onClick: () => setSelectedTags(on ? selectedTags.filter((s) => s !== slug) : [...selectedTags, slug]),
|
|
1836
|
-
children: [
|
|
1837
|
-
/* @__PURE__ */ jsx("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full", style: { backgroundColor: tagDefs.get(slug)?.color ?? "#94A3B8" } }),
|
|
1838
|
-
/* @__PURE__ */ jsx("span", { className: "truncate", children: tagDefs.get(slug)?.name ?? humanizeTag(slug) }),
|
|
1839
|
-
on && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 shrink-0" })
|
|
1840
|
-
]
|
|
1841
|
-
},
|
|
1842
|
-
slug
|
|
1843
|
-
);
|
|
1844
|
-
})
|
|
1845
|
-
}
|
|
1846
|
-
),
|
|
1847
|
-
/* @__PURE__ */ jsx(UnitPicker, { filter: unitFilter }),
|
|
1848
|
-
/* @__PURE__ */ jsx(
|
|
1849
|
-
FilterMenu,
|
|
1850
|
-
{
|
|
1851
|
-
label: t("crm.board.filters"),
|
|
1852
|
-
activeCount: (period !== "all" ? 1 : 0) + (selectedTags.length ? 1 : 0) + (search.trim() ? 1 : 0) + (effectiveOwner ? 1 : 0),
|
|
1853
|
-
onClear: () => {
|
|
1854
|
-
setSearch("");
|
|
1855
|
-
setPeriod("all");
|
|
1856
|
-
setSelectedTags([]);
|
|
1857
|
-
setOwnerFilter(void 0);
|
|
1858
|
-
},
|
|
1859
|
-
clearLabel: t("crm.board.clearFilters"),
|
|
1860
|
-
header: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
1861
|
-
/* @__PURE__ */ jsx(Search, { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
|
|
1862
|
-
/* @__PURE__ */ jsx(
|
|
1863
|
-
Input,
|
|
1864
|
-
{
|
|
1865
|
-
type: "text",
|
|
1866
|
-
value: search,
|
|
1867
|
-
onChange: (e) => setSearch(e.target.value),
|
|
1868
|
-
placeholder: t("crm.deals.searchPlaceholder"),
|
|
1869
|
-
className: "h-8 border-border bg-background pl-8 pr-3 text-xs shadow-none placeholder:text-muted-foreground/70 focus-visible:ring-offset-0"
|
|
1870
|
-
}
|
|
1871
|
-
)
|
|
1872
|
-
] }),
|
|
1873
|
-
fields: [
|
|
1789
|
+
/* @__PURE__ */ jsxs(
|
|
1790
|
+
DealsToolbar,
|
|
1791
|
+
{
|
|
1792
|
+
variant: "card",
|
|
1793
|
+
search,
|
|
1794
|
+
onSearchChange: setSearch,
|
|
1795
|
+
display: {
|
|
1796
|
+
title: t("crm.board.cardProps"),
|
|
1797
|
+
options: Object.keys(DISPLAY_DEFAULTS).map((k) => ({ key: k, label: t(`crm.board.prop.${k}`) })),
|
|
1798
|
+
visible: display,
|
|
1799
|
+
onChange: (next) => setDisplay({ ...DISPLAY_DEFAULTS, ...next })
|
|
1800
|
+
},
|
|
1801
|
+
children: [
|
|
1802
|
+
effectiveOwner && /* @__PURE__ */ jsxs(
|
|
1803
|
+
BoardFilterChip,
|
|
1874
1804
|
{
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
}, children: [
|
|
1885
|
-
/* @__PURE__ */ jsx(UserRound, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
1886
|
-
" ",
|
|
1887
|
-
t("crm.leads.filters.allOwners")
|
|
1888
|
-
] }),
|
|
1889
|
-
myUserId && /* @__PURE__ */ jsxs(FilterMenuRow, { active: effectiveOwner === myUserId, onClick: () => {
|
|
1890
|
-
setOwnerFilter("__me__");
|
|
1891
|
-
close();
|
|
1892
|
-
}, children: [
|
|
1805
|
+
closeOnSelect: true,
|
|
1806
|
+
clearLabel: t("crm.board.clearFilters"),
|
|
1807
|
+
onClear: () => setOwnerFilter(void 0),
|
|
1808
|
+
trigger: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1809
|
+
effectiveOwner === "none" ? /* @__PURE__ */ jsx(UserRound, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(PersonAvatar, { name: (team ?? []).find((m) => m.userId === effectiveOwner)?.name ?? "Eu", size: "xs" }),
|
|
1810
|
+
/* @__PURE__ */ jsx("span", { className: "max-w-[8rem] truncate", children: effectiveOwner === "none" ? t("crm.leads.filters.unassigned") : effectiveOwner === myUserId ? t("crm.leads.filters.mine") : (team ?? []).find((m) => m.userId === effectiveOwner)?.name ?? t("crm.leads.filters.owner") })
|
|
1811
|
+
] }),
|
|
1812
|
+
children: [
|
|
1813
|
+
myUserId && /* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: CHIP_ROW, onClick: () => setOwnerFilter("__me__"), children: [
|
|
1893
1814
|
/* @__PURE__ */ jsx(PersonAvatar, { name: (team ?? []).find((m) => m.userId === myUserId)?.name ?? "Eu", size: "xs" }),
|
|
1894
1815
|
" ",
|
|
1895
|
-
t("crm.leads.filters.mine")
|
|
1816
|
+
t("crm.leads.filters.mine"),
|
|
1817
|
+
effectiveOwner === myUserId && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 shrink-0" })
|
|
1896
1818
|
] }),
|
|
1897
|
-
/* @__PURE__ */ jsxs(
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
t("crm.leads.filters.unassigned")
|
|
1819
|
+
/* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: CHIP_ROW, onClick: () => setOwnerFilter("none"), children: [
|
|
1820
|
+
/* @__PURE__ */ jsx(UserRound, { className: "h-3 w-3 text-muted-foreground" }),
|
|
1821
|
+
" ",
|
|
1822
|
+
t("crm.leads.filters.unassigned"),
|
|
1823
|
+
effectiveOwner === "none" && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 shrink-0" })
|
|
1903
1824
|
] }),
|
|
1904
|
-
(team ?? []).filter((m) => m.userId !== myUserId
|
|
1905
|
-
setOwnerFilter(m.userId);
|
|
1906
|
-
close();
|
|
1907
|
-
}, children: [
|
|
1825
|
+
(team ?? []).filter((m) => m.userId !== myUserId).map((m) => /* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: CHIP_ROW, onClick: () => setOwnerFilter(m.userId), children: [
|
|
1908
1826
|
/* @__PURE__ */ jsx(PersonAvatar, { name: m.name, size: "xs" }),
|
|
1909
|
-
|
|
1827
|
+
" ",
|
|
1828
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: m.name }),
|
|
1829
|
+
effectiveOwner === m.userId && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 shrink-0" })
|
|
1910
1830
|
] }, m.userId))
|
|
1911
|
-
]
|
|
1912
|
-
}
|
|
1831
|
+
]
|
|
1832
|
+
}
|
|
1833
|
+
),
|
|
1834
|
+
period !== "all" && /* @__PURE__ */ jsx(
|
|
1835
|
+
BoardFilterChip,
|
|
1913
1836
|
{
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
period ===
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
},
|
|
1837
|
+
closeOnSelect: true,
|
|
1838
|
+
clearLabel: t("crm.board.clearFilters"),
|
|
1839
|
+
onClear: () => setPeriod("all"),
|
|
1840
|
+
trigger: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1841
|
+
/* @__PURE__ */ jsx(CalendarDays, { className: "h-3 w-3" }),
|
|
1842
|
+
t(`crm.filters.period${period === "custom" ? "Custom" : period}`)
|
|
1843
|
+
] }),
|
|
1844
|
+
children: ["24h", "7d", "custom"].map((p) => /* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: CHIP_ROW, onClick: () => setPeriod(p), children: [
|
|
1845
|
+
t(`crm.filters.period${p === "custom" ? "Custom" : p}`),
|
|
1846
|
+
period === p && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 shrink-0" })
|
|
1847
|
+
] }, p))
|
|
1848
|
+
}
|
|
1849
|
+
),
|
|
1850
|
+
selectedTags.length > 0 && /* @__PURE__ */ jsx(
|
|
1851
|
+
BoardFilterChip,
|
|
1930
1852
|
{
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1853
|
+
clearLabel: t("crm.board.clearFilters"),
|
|
1854
|
+
onClear: () => setSelectedTags([]),
|
|
1855
|
+
trigger: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1856
|
+
/* @__PURE__ */ jsx("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full", style: { backgroundColor: tagDefs.get(selectedTags[0])?.color ?? "#94A3B8" } }),
|
|
1857
|
+
/* @__PURE__ */ jsxs("span", { className: "max-w-[8rem] truncate", children: [
|
|
1858
|
+
tagDefs.get(selectedTags[0])?.name ?? humanizeTag(selectedTags[0]),
|
|
1859
|
+
selectedTags.length > 1 ? ` +${selectedTags.length - 1}` : ""
|
|
1860
|
+
] })
|
|
1861
|
+
] }),
|
|
1862
|
+
children: [.../* @__PURE__ */ new Set([...availableTags, ...selectedTags])].sort((a, b) => (tagDefs.get(a)?.name ?? humanizeTag(a)).localeCompare(tagDefs.get(b)?.name ?? humanizeTag(b))).map((slug) => {
|
|
1936
1863
|
const on = selectedTags.includes(slug);
|
|
1937
1864
|
return /* @__PURE__ */ jsxs(
|
|
1938
|
-
|
|
1865
|
+
Button,
|
|
1939
1866
|
{
|
|
1940
|
-
|
|
1867
|
+
variant: "bare",
|
|
1868
|
+
size: "bare",
|
|
1869
|
+
className: CHIP_ROW,
|
|
1941
1870
|
onClick: () => setSelectedTags(on ? selectedTags.filter((s) => s !== slug) : [...selectedTags, slug]),
|
|
1942
1871
|
children: [
|
|
1943
1872
|
/* @__PURE__ */ jsx("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full", style: { backgroundColor: tagDefs.get(slug)?.color ?? "#94A3B8" } }),
|
|
1944
|
-
/* @__PURE__ */ jsx("span", { className: "truncate", children: tagDefs.get(slug)?.name ?? humanizeTag(slug) })
|
|
1873
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: tagDefs.get(slug)?.name ?? humanizeTag(slug) }),
|
|
1874
|
+
on && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 shrink-0" })
|
|
1945
1875
|
]
|
|
1946
1876
|
},
|
|
1947
1877
|
slug
|
|
1948
1878
|
);
|
|
1949
|
-
})
|
|
1879
|
+
})
|
|
1950
1880
|
}
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1881
|
+
),
|
|
1882
|
+
/* @__PURE__ */ jsx(UnitPicker, { filter: unitFilter }),
|
|
1883
|
+
/* @__PURE__ */ jsx(
|
|
1884
|
+
FilterMenu,
|
|
1885
|
+
{
|
|
1886
|
+
label: t("crm.board.filters"),
|
|
1887
|
+
activeCount: (period !== "all" ? 1 : 0) + (selectedTags.length ? 1 : 0) + (effectiveOwner ? 1 : 0),
|
|
1888
|
+
onClear: () => {
|
|
1889
|
+
setPeriod("all");
|
|
1890
|
+
setSelectedTags([]);
|
|
1891
|
+
setOwnerFilter(void 0);
|
|
1892
|
+
},
|
|
1893
|
+
clearLabel: t("crm.board.clearFilters"),
|
|
1894
|
+
fields: [
|
|
1895
|
+
{
|
|
1896
|
+
id: "owner",
|
|
1897
|
+
label: t("crm.leads.filters.owner"),
|
|
1898
|
+
icon: UserRound,
|
|
1899
|
+
activeCount: effectiveOwner ? 1 : 0,
|
|
1900
|
+
searchable: true,
|
|
1901
|
+
render: (close, q) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1902
|
+
/* @__PURE__ */ jsxs(FilterMenuRow, { active: !effectiveOwner, onClick: () => {
|
|
1903
|
+
setOwnerFilter(void 0);
|
|
1904
|
+
close();
|
|
1905
|
+
}, children: [
|
|
1906
|
+
/* @__PURE__ */ jsx(UserRound, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
1907
|
+
" ",
|
|
1908
|
+
t("crm.leads.filters.allOwners")
|
|
1909
|
+
] }),
|
|
1910
|
+
myUserId && /* @__PURE__ */ jsxs(FilterMenuRow, { active: effectiveOwner === myUserId, onClick: () => {
|
|
1911
|
+
setOwnerFilter("__me__");
|
|
1912
|
+
close();
|
|
1913
|
+
}, children: [
|
|
1914
|
+
/* @__PURE__ */ jsx(PersonAvatar, { name: (team ?? []).find((m) => m.userId === myUserId)?.name ?? "Eu", size: "xs" }),
|
|
1915
|
+
" ",
|
|
1916
|
+
t("crm.leads.filters.mine")
|
|
1917
|
+
] }),
|
|
1918
|
+
/* @__PURE__ */ jsxs(FilterMenuRow, { active: effectiveOwner === "none", onClick: () => {
|
|
1919
|
+
setOwnerFilter("none");
|
|
1920
|
+
close();
|
|
1921
|
+
}, children: [
|
|
1922
|
+
/* @__PURE__ */ jsx("span", { className: "flex h-5 w-5 items-center justify-center rounded-full border border-dashed border-muted-foreground/50", children: /* @__PURE__ */ jsx(UserRound, { className: "h-2.5 w-2.5 text-muted-foreground" }) }),
|
|
1923
|
+
t("crm.leads.filters.unassigned")
|
|
1924
|
+
] }),
|
|
1925
|
+
(team ?? []).filter((m) => m.userId !== myUserId && m.name.toLowerCase().includes(q.toLowerCase())).map((m) => /* @__PURE__ */ jsxs(FilterMenuRow, { active: effectiveOwner === m.userId, onClick: () => {
|
|
1926
|
+
setOwnerFilter(m.userId);
|
|
1927
|
+
close();
|
|
1928
|
+
}, children: [
|
|
1929
|
+
/* @__PURE__ */ jsx(PersonAvatar, { name: m.name, size: "xs" }),
|
|
1930
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: m.name })
|
|
1931
|
+
] }, m.userId))
|
|
1932
|
+
] })
|
|
1933
|
+
},
|
|
1934
|
+
{
|
|
1935
|
+
id: "period",
|
|
1936
|
+
label: t("crm.filters.period"),
|
|
1937
|
+
icon: CalendarDays,
|
|
1938
|
+
activeCount: period !== "all" ? 1 : 0,
|
|
1939
|
+
render: (close) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1940
|
+
["all", "24h", "7d", "custom"].map((p) => /* @__PURE__ */ jsx(FilterMenuRow, { active: period === p, onClick: () => {
|
|
1941
|
+
setPeriod(p);
|
|
1942
|
+
if (p !== "custom") close();
|
|
1943
|
+
}, children: t(`crm.filters.period${p === "all" ? "All" : p === "custom" ? "Custom" : p}`) }, p)),
|
|
1944
|
+
period === "custom" && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 p-1.5", children: [
|
|
1945
|
+
/* @__PURE__ */ jsx(DatePicker, { variant: "chip", format: "numeric", className: "w-full", value: customFrom, onChange: setCustomFrom }),
|
|
1946
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "\u2013" }),
|
|
1947
|
+
/* @__PURE__ */ jsx(DatePicker, { variant: "chip", format: "numeric", className: "w-full", value: customTo, onChange: setCustomTo })
|
|
1948
|
+
] })
|
|
1949
|
+
] })
|
|
1950
|
+
},
|
|
1951
|
+
{
|
|
1952
|
+
id: "tags",
|
|
1953
|
+
label: t("crm.leads.filters.tag"),
|
|
1954
|
+
icon: Tag,
|
|
1955
|
+
activeCount: selectedTags.length,
|
|
1956
|
+
render: () => /* @__PURE__ */ jsx(Fragment, { children: [.../* @__PURE__ */ new Set([...availableTags, ...selectedTags])].sort((a, b) => (tagDefs.get(a)?.name ?? humanizeTag(a)).localeCompare(tagDefs.get(b)?.name ?? humanizeTag(b))).map((slug) => {
|
|
1957
|
+
const on = selectedTags.includes(slug);
|
|
1958
|
+
return /* @__PURE__ */ jsxs(
|
|
1959
|
+
FilterMenuRow,
|
|
1960
|
+
{
|
|
1961
|
+
active: on,
|
|
1962
|
+
onClick: () => setSelectedTags(on ? selectedTags.filter((s) => s !== slug) : [...selectedTags, slug]),
|
|
1963
|
+
children: [
|
|
1964
|
+
/* @__PURE__ */ jsx("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full", style: { backgroundColor: tagDefs.get(slug)?.color ?? "#94A3B8" } }),
|
|
1965
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: tagDefs.get(slug)?.name ?? humanizeTag(slug) })
|
|
1966
|
+
]
|
|
1967
|
+
},
|
|
1968
|
+
slug
|
|
1969
|
+
);
|
|
1970
|
+
}) })
|
|
1971
|
+
}
|
|
1972
|
+
]
|
|
1973
|
+
}
|
|
1974
|
+
)
|
|
1975
|
+
]
|
|
1976
|
+
}
|
|
1977
|
+
),
|
|
1956
1978
|
boardPending ? /* @__PURE__ */ jsx(PipelineSkeleton, {}) : visibleStages.length === 0 ? (
|
|
1957
1979
|
/* Sem etapas não existe quadro: o `flex` abaixo renderizava uma faixa
|
|
1958
1980
|
em branco, que parece uma tela que não carregou. O funil é a única
|
|
@@ -1972,6 +1994,7 @@ function PipelineView({ onDealClick, onAddLead, onOpenSettings, onStageIntent })
|
|
|
1972
1994
|
{
|
|
1973
1995
|
layout: "scroll",
|
|
1974
1996
|
fitViewport: true,
|
|
1997
|
+
fitViewportOffset: "12.75rem",
|
|
1975
1998
|
columns: visibleStages.map((stage) => ({
|
|
1976
1999
|
id: stage.id,
|
|
1977
2000
|
label: stage.name,
|
|
@@ -2197,6 +2220,7 @@ function DealListView({ onOpenDeal }) {
|
|
|
2197
2220
|
}, [deals, query, stage, status, city, tags, cohort, companyName, owner, tagDefs, currency.locale]);
|
|
2198
2221
|
const columns = useMemo(() => [
|
|
2199
2222
|
{
|
|
2223
|
+
id: "title",
|
|
2200
2224
|
accessorKey: "title",
|
|
2201
2225
|
header: t("crm.deals.colDeal"),
|
|
2202
2226
|
cell: ({ row }) => /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
@@ -2207,6 +2231,7 @@ function DealListView({ onOpenDeal }) {
|
|
|
2207
2231
|
{
|
|
2208
2232
|
// A empresa (024). Três pessoas da mesma casa viram três linhas, e sem
|
|
2209
2233
|
// esta coluna nada na lista diz que são a mesma casa.
|
|
2234
|
+
id: "companyName",
|
|
2210
2235
|
accessorKey: "companyName",
|
|
2211
2236
|
header: t("crm.card.companyTitle"),
|
|
2212
2237
|
cell: ({ row }) => row.original.companyName ? /* @__PURE__ */ jsxs("div", { className: "min-w-0 max-w-[14rem]", children: [
|
|
@@ -2221,6 +2246,7 @@ function DealListView({ onOpenDeal }) {
|
|
|
2221
2246
|
] }) : /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: "\u2014" })
|
|
2222
2247
|
},
|
|
2223
2248
|
{
|
|
2249
|
+
id: "stageName",
|
|
2224
2250
|
accessorKey: "stageName",
|
|
2225
2251
|
header: t("crm.dealSidebar.stage"),
|
|
2226
2252
|
cell: ({ row }) => /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5 whitespace-nowrap text-xs", children: [
|
|
@@ -2230,6 +2256,7 @@ function DealListView({ onOpenDeal }) {
|
|
|
2230
2256
|
},
|
|
2231
2257
|
{
|
|
2232
2258
|
// Derivado (020) — a coluna que ordena por "quem ainda não foi contatado".
|
|
2259
|
+
id: "contactStatusName",
|
|
2233
2260
|
accessorKey: "contactStatusName",
|
|
2234
2261
|
header: t("crm.deals.colStatus"),
|
|
2235
2262
|
cell: ({ row }) => row.original.contactStatusName ? /* @__PURE__ */ jsx(
|
|
@@ -2245,6 +2272,7 @@ function DealListView({ onOpenDeal }) {
|
|
|
2245
2272
|
) : /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: "\u2014" })
|
|
2246
2273
|
},
|
|
2247
2274
|
{
|
|
2275
|
+
id: "contactCity",
|
|
2248
2276
|
accessorKey: "contactCity",
|
|
2249
2277
|
header: t("crm.deals.colCity"),
|
|
2250
2278
|
cell: ({ row }) => row.original.contactCity ? /* @__PURE__ */ jsxs("span", { className: "whitespace-nowrap text-xs", children: [
|
|
@@ -2256,11 +2284,13 @@ function DealListView({ onOpenDeal }) {
|
|
|
2256
2284
|
] }) : /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: "\u2014" })
|
|
2257
2285
|
},
|
|
2258
2286
|
{
|
|
2287
|
+
id: "value",
|
|
2259
2288
|
accessorKey: "value",
|
|
2260
2289
|
header: t("crm.dealSidebar.value"),
|
|
2261
2290
|
cell: ({ getValue }) => /* @__PURE__ */ jsx("span", { className: "whitespace-nowrap text-sm font-semibold tabular-nums", children: formatCurrency(getValue(), currency) })
|
|
2262
2291
|
},
|
|
2263
2292
|
{
|
|
2293
|
+
id: "assignedToName",
|
|
2264
2294
|
accessorKey: "assignedToName",
|
|
2265
2295
|
header: t("crm.dealSidebar.assignedTo"),
|
|
2266
2296
|
cell: ({ getValue }) => /* @__PURE__ */ jsx("span", { className: "whitespace-nowrap text-xs text-muted-foreground", children: getValue() || "\u2014" })
|
|
@@ -2278,6 +2308,11 @@ function DealListView({ onOpenDeal }) {
|
|
|
2278
2308
|
}
|
|
2279
2309
|
}
|
|
2280
2310
|
], [currency, t]);
|
|
2311
|
+
const [visibleColumns, setVisibleColumns] = usePersistedState("crm.deals.columns", {});
|
|
2312
|
+
const shownColumns = useMemo(
|
|
2313
|
+
() => columns.filter((c) => c.id === "title" || visibleColumns[c.id] !== false),
|
|
2314
|
+
[columns, visibleColumns]
|
|
2315
|
+
);
|
|
2281
2316
|
const pageRows = useMemo(
|
|
2282
2317
|
() => rows.slice((page - 1) * pageSize, page * pageSize),
|
|
2283
2318
|
[rows, page]
|
|
@@ -2401,150 +2436,148 @@ function DealListView({ onOpenDeal }) {
|
|
|
2401
2436
|
);
|
|
2402
2437
|
return /* @__PURE__ */ jsxs("div", { ref: ancoraRolagem, className: "space-y-3", children: [
|
|
2403
2438
|
/* @__PURE__ */ jsxs(Card, { className: "overflow-hidden", children: [
|
|
2404
|
-
/* @__PURE__ */ jsxs(
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
/* @__PURE__ */ jsx(
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
] })
|
|
2542
|
-
] }),
|
|
2439
|
+
/* @__PURE__ */ jsxs(
|
|
2440
|
+
DealsToolbar,
|
|
2441
|
+
{
|
|
2442
|
+
search,
|
|
2443
|
+
onSearchChange: setSearch,
|
|
2444
|
+
display: {
|
|
2445
|
+
title: t("crm.deals.columns"),
|
|
2446
|
+
options: columns.filter((c) => c.id !== "title").map((c) => ({ key: c.id, label: String(c.header) })),
|
|
2447
|
+
visible: visibleColumns,
|
|
2448
|
+
onChange: setVisibleColumns
|
|
2449
|
+
},
|
|
2450
|
+
children: [
|
|
2451
|
+
/* @__PURE__ */ jsx(UnitPicker, { filter: unitFilter }),
|
|
2452
|
+
stage && /* @__PURE__ */ jsx(
|
|
2453
|
+
FilterChip,
|
|
2454
|
+
{
|
|
2455
|
+
label: t("crm.dealSidebar.stage"),
|
|
2456
|
+
icon: Filter,
|
|
2457
|
+
allLabel: t("crm.deals.allStages"),
|
|
2458
|
+
options: stageOptions,
|
|
2459
|
+
value: stage,
|
|
2460
|
+
onChange: setStage
|
|
2461
|
+
}
|
|
2462
|
+
),
|
|
2463
|
+
outcome !== "open" && /* @__PURE__ */ jsx(
|
|
2464
|
+
FilterChip,
|
|
2465
|
+
{
|
|
2466
|
+
label: t("crm.deals.outcome"),
|
|
2467
|
+
icon: ThumbsDown,
|
|
2468
|
+
allLabel: t("crm.deals.outcomeOpen"),
|
|
2469
|
+
options: outcomeOptions,
|
|
2470
|
+
value: outcome,
|
|
2471
|
+
onChange: (v) => setOutcome(v ?? "open")
|
|
2472
|
+
}
|
|
2473
|
+
),
|
|
2474
|
+
status && /* @__PURE__ */ jsx(
|
|
2475
|
+
FilterChip,
|
|
2476
|
+
{
|
|
2477
|
+
label: t("crm.deals.colStatus"),
|
|
2478
|
+
icon: SignalHigh,
|
|
2479
|
+
allLabel: t("crm.deals.allStatuses"),
|
|
2480
|
+
options: statusOptions,
|
|
2481
|
+
value: status,
|
|
2482
|
+
onChange: setStatus
|
|
2483
|
+
}
|
|
2484
|
+
),
|
|
2485
|
+
cohort && /* @__PURE__ */ jsx(
|
|
2486
|
+
FilterChip,
|
|
2487
|
+
{
|
|
2488
|
+
label: t("crm.deals.cohort"),
|
|
2489
|
+
icon: CalendarRange,
|
|
2490
|
+
allLabel: t("crm.deals.allCohorts"),
|
|
2491
|
+
options: cohortOptions,
|
|
2492
|
+
value: cohort,
|
|
2493
|
+
onChange: setCohort
|
|
2494
|
+
}
|
|
2495
|
+
),
|
|
2496
|
+
tags.length > 0 && /* @__PURE__ */ jsx(
|
|
2497
|
+
MultiSelect,
|
|
2498
|
+
{
|
|
2499
|
+
variant: "chip",
|
|
2500
|
+
icon: Tag,
|
|
2501
|
+
options: tagOptions,
|
|
2502
|
+
value: tags,
|
|
2503
|
+
onChange: setTags,
|
|
2504
|
+
allLabel: t("crm.leads.filters.allTags"),
|
|
2505
|
+
searchPlaceholder: t("crm.leads.filters.searchTag"),
|
|
2506
|
+
emptyLabel: t("crm.leads.filters.noTag")
|
|
2507
|
+
}
|
|
2508
|
+
),
|
|
2509
|
+
owner && /* @__PURE__ */ jsx(
|
|
2510
|
+
FilterChip,
|
|
2511
|
+
{
|
|
2512
|
+
label: t("crm.leads.filters.owner"),
|
|
2513
|
+
icon: User,
|
|
2514
|
+
allLabel: t("crm.leads.filters.allOwners"),
|
|
2515
|
+
options: ownerOptions,
|
|
2516
|
+
value: owner,
|
|
2517
|
+
onChange: setOwner
|
|
2518
|
+
}
|
|
2519
|
+
),
|
|
2520
|
+
companyName && /* @__PURE__ */ jsx(
|
|
2521
|
+
FilterChip,
|
|
2522
|
+
{
|
|
2523
|
+
label: t("crm.card.companyTitle"),
|
|
2524
|
+
icon: Building2,
|
|
2525
|
+
allLabel: t("crm.deals.allCompanies"),
|
|
2526
|
+
options: companyOptions,
|
|
2527
|
+
value: companyName,
|
|
2528
|
+
onChange: setCompanyName
|
|
2529
|
+
}
|
|
2530
|
+
),
|
|
2531
|
+
city && /* @__PURE__ */ jsx(
|
|
2532
|
+
FilterChip,
|
|
2533
|
+
{
|
|
2534
|
+
label: t("crm.deals.colCity"),
|
|
2535
|
+
icon: MapPin,
|
|
2536
|
+
allLabel: t("crm.deals.allCities"),
|
|
2537
|
+
options: cityOptions,
|
|
2538
|
+
value: city,
|
|
2539
|
+
onChange: setCity
|
|
2540
|
+
}
|
|
2541
|
+
),
|
|
2542
|
+
filtersMenu,
|
|
2543
|
+
filtrosAtivos > 0 && /* @__PURE__ */ jsxs(
|
|
2544
|
+
Button,
|
|
2545
|
+
{
|
|
2546
|
+
type: "button",
|
|
2547
|
+
variant: "ghost",
|
|
2548
|
+
onClick: limparFiltros,
|
|
2549
|
+
className: "h-auto shrink-0 gap-1 rounded-full px-2 py-1 text-xs font-medium text-muted-foreground",
|
|
2550
|
+
children: [
|
|
2551
|
+
/* @__PURE__ */ jsx(X, { className: "h-3 w-3 shrink-0" }),
|
|
2552
|
+
t("crm.leads.filters.clear")
|
|
2553
|
+
]
|
|
2554
|
+
}
|
|
2555
|
+
),
|
|
2556
|
+
segmentRules.length > 0 && /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: () => setSegmentOpen(true), className: "h-8 gap-1 px-2 text-xs", children: [
|
|
2557
|
+
/* @__PURE__ */ jsx(Filter, { className: "h-3.5 w-3.5" }),
|
|
2558
|
+
t("crm.deals.saveSegment")
|
|
2559
|
+
] }),
|
|
2560
|
+
/* @__PURE__ */ jsx(
|
|
2561
|
+
Button,
|
|
2562
|
+
{
|
|
2563
|
+
type: "button",
|
|
2564
|
+
variant: "ghost",
|
|
2565
|
+
size: "icon",
|
|
2566
|
+
"aria-label": t("crud.export.action"),
|
|
2567
|
+
title: t("crud.export.action"),
|
|
2568
|
+
onClick: exportRows,
|
|
2569
|
+
className: "h-8 w-8 shrink-0",
|
|
2570
|
+
children: /* @__PURE__ */ jsx(Download, { className: "h-4 w-4" })
|
|
2571
|
+
}
|
|
2572
|
+
)
|
|
2573
|
+
]
|
|
2574
|
+
}
|
|
2575
|
+
),
|
|
2543
2576
|
/* @__PURE__ */ jsx(
|
|
2544
2577
|
DataTable,
|
|
2545
2578
|
{
|
|
2546
2579
|
variant: "bare",
|
|
2547
|
-
columns,
|
|
2580
|
+
columns: shownColumns,
|
|
2548
2581
|
data: pageRows,
|
|
2549
2582
|
loading: dealsLoading,
|
|
2550
2583
|
onRowClick: onOpenDeal ? (row) => onOpenDeal(row.id) : void 0,
|
|
@@ -10430,5 +10463,5 @@ function CrmPage({ config, provider, store, registries }) {
|
|
|
10430
10463
|
}
|
|
10431
10464
|
|
|
10432
10465
|
export { CrmPage };
|
|
10433
|
-
//# sourceMappingURL=CrmPage-
|
|
10434
|
-
//# sourceMappingURL=CrmPage-
|
|
10466
|
+
//# sourceMappingURL=CrmPage-Z5OYCBKA.js.map
|
|
10467
|
+
//# sourceMappingURL=CrmPage-Z5OYCBKA.js.map
|