@fayz-ai/plugin-crm 0.32.19 → 0.32.21
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-3DEBYXX6.js → CrmPage-4BPA22DO.js} +31 -52
- package/dist/CrmPage-4BPA22DO.js.map +1 -0
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/views/QuoteListView.d.ts.map +1 -1
- package/package.json +6 -6
- package/dist/CrmPage-3DEBYXX6.js.map +0 -1
|
@@ -5,7 +5,7 @@ import { CrmContextProvider, useCrmProvider, useCrmStore, useCrmConfig, formatCu
|
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import React__default, { useCallback, useMemo, useState, useEffect, useRef } from 'react';
|
|
7
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, SlidersHorizontal, ChevronLeft, ExternalLink, Clipboard, DollarSign, ThumbsUp, 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, FilterPanel, FilterPanelField, RequiredFilter, Card, DataTable, Dropdown, DropdownTrigger, DropdownContent, DropdownItem, PhoneLink, ComingSoon, Switch, TooltipProvider, Tooltip, TooltipTrigger, TooltipContent, DashboardCanvas, PageViewBar, Pagination, PersonPicker, cn, HeaderTabs, SheetBody, SheetFooter, Popover, PopoverTrigger, PopoverContent, getLucideIcon, DictateButton, DropdownLabel, DropdownSeparator, ModalDescription, normalizePhone } from '@fayz-ai/ui';
|
|
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, PageViewBar, 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, OrderDetailSkeleton, OrderDetailBlock, OrderDetailView, PersonLink, CrudFormSkeleton, CrudFormPage, CrudDetailSkeleton, CrudDetailPage, AskAIButton, KanbanBoard, InlineField, useUnitFilter, invalidateLimit, useAccessOptional, useOrganizationStore, getRailPage, RightRailPage, ContactPicker, useAgentSurface } from '@fayz-ai/admin';
|
|
@@ -5707,50 +5707,35 @@ function QuoteListView({ onNew, onEdit, onEditQuote }) {
|
|
|
5707
5707
|
const fetchQuotes = useCrmStore((s) => s.fetchQuotes);
|
|
5708
5708
|
const archiveQuote = useCrmStore((s) => s.archiveQuote);
|
|
5709
5709
|
const canArchive = useCanArchive();
|
|
5710
|
-
const hoje = () => {
|
|
5710
|
+
const hoje = useMemo(() => {
|
|
5711
5711
|
const d = /* @__PURE__ */ new Date();
|
|
5712
5712
|
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
|
5713
|
-
};
|
|
5713
|
+
}, []);
|
|
5714
5714
|
const noventaDiasAtras = useMemo(() => {
|
|
5715
5715
|
const d = /* @__PURE__ */ new Date();
|
|
5716
5716
|
d.setDate(d.getDate() - 89);
|
|
5717
5717
|
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
|
5718
5718
|
}, []);
|
|
5719
|
-
const
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
const
|
|
5724
|
-
const [search, setSearch] = useState("");
|
|
5719
|
+
const filtros = useFilterDraft(
|
|
5720
|
+
{ from: noventaDiasAtras, to: hoje, status: [], contactId: "", contactName: "", search: "" },
|
|
5721
|
+
{ persistKey: "crm.quotes" }
|
|
5722
|
+
);
|
|
5723
|
+
const { draft, applied, patch } = filtros;
|
|
5725
5724
|
const contactLookup = useMemo(
|
|
5726
5725
|
() => createArchetypeLookup({ archetype: "person", kind: ["customer", "lead"] }),
|
|
5727
5726
|
[]
|
|
5728
5727
|
);
|
|
5729
|
-
const
|
|
5730
|
-
|
|
5731
|
-
[dateFrom, dateTo, statusFilter, contactId, search]
|
|
5732
|
-
);
|
|
5733
|
-
const [emVigor, setEmVigor] = useState(rascunho);
|
|
5734
|
-
const filtrosPendentes = useMemo(
|
|
5735
|
-
() => JSON.stringify(rascunho) !== JSON.stringify(emVigor),
|
|
5736
|
-
[rascunho, emVigor]
|
|
5737
|
-
);
|
|
5738
|
-
const aplicarFiltros = useCallback(() => setEmVigor(() => rascunho), [rascunho]);
|
|
5739
|
-
const limparFiltros = () => {
|
|
5740
|
-
setStatusFilter([]);
|
|
5741
|
-
setContactId("");
|
|
5742
|
-
setContactName("");
|
|
5743
|
-
setSearch("");
|
|
5744
|
-
};
|
|
5745
|
-
const filtrosAtivos = (statusFilter.length > 0 ? 1 : 0) + (contactId ? 1 : 0) + (search.trim() ? 1 : 0);
|
|
5728
|
+
const limparFiltros = () => patch({ status: [], contactId: "", contactName: "", search: "" });
|
|
5729
|
+
const filtrosAtivos = (draft.status.length > 0 ? 1 : 0) + (draft.contactId ? 1 : 0) + (draft.search.trim() ? 1 : 0);
|
|
5746
5730
|
useEffect(() => {
|
|
5731
|
+
const search = applied.search.trim();
|
|
5747
5732
|
fetchQuotes({
|
|
5748
|
-
dateRange: { from:
|
|
5749
|
-
status:
|
|
5750
|
-
contactId:
|
|
5751
|
-
search:
|
|
5733
|
+
dateRange: { from: applied.from, to: applied.to },
|
|
5734
|
+
status: applied.status.length > 0 ? applied.status : void 0,
|
|
5735
|
+
contactId: applied.contactId || void 0,
|
|
5736
|
+
search: search || void 0
|
|
5752
5737
|
});
|
|
5753
|
-
}, [
|
|
5738
|
+
}, [applied]);
|
|
5754
5739
|
const [alvoArquivo, setAlvoArquivo] = useState(null);
|
|
5755
5740
|
const columns = useQuoteColumns(currency, onEditQuote, canArchive ? setAlvoArquivo : void 0);
|
|
5756
5741
|
const exportRows = useCallback(() => {
|
|
@@ -5791,34 +5776,31 @@ function QuoteListView({ onNew, onEdit, onEditQuote }) {
|
|
|
5791
5776
|
FilterPanel,
|
|
5792
5777
|
{
|
|
5793
5778
|
title: t("crm.quotes.filtersTitle"),
|
|
5794
|
-
|
|
5795
|
-
onApply: aplicarFiltros,
|
|
5779
|
+
onApply: filtros.apply,
|
|
5796
5780
|
applyLabel: t("crm.quotes.filterApply"),
|
|
5797
|
-
pendingTitle: t("crm.quotes.filterPending"),
|
|
5798
|
-
pendingHint: t("crm.quotes.filterPendingHint"),
|
|
5799
5781
|
onClear: filtrosAtivos > 0 ? limparFiltros : void 0,
|
|
5800
5782
|
clearLabel: t("crm.quotes.filterClear"),
|
|
5801
5783
|
busy: quotesLoading,
|
|
5802
5784
|
children: [
|
|
5803
|
-
/* @__PURE__ */ jsx(FilterPanelField, { label: t("crm.quotes.filterFrom"), children: /* @__PURE__ */ jsx(DatePicker, { variant: "input", format: "numeric", className: "w-full", value:
|
|
5804
|
-
/* @__PURE__ */ jsx(FilterPanelField, { label: t("crm.quotes.filterTo"), children: /* @__PURE__ */ jsx(DatePicker, { variant: "input", format: "numeric", className: "w-full", value:
|
|
5785
|
+
/* @__PURE__ */ jsx(FilterPanelField, { label: t("crm.quotes.filterFrom"), children: /* @__PURE__ */ jsx(DatePicker, { variant: "input", format: "numeric", className: "w-full", value: draft.from, onChange: (v) => v && patch({ from: v }) }) }),
|
|
5786
|
+
/* @__PURE__ */ jsx(FilterPanelField, { label: t("crm.quotes.filterTo"), children: /* @__PURE__ */ jsx(DatePicker, { variant: "input", format: "numeric", className: "w-full", value: draft.to, onChange: (v) => v && patch({ to: v }) }) }),
|
|
5805
5787
|
/* @__PURE__ */ jsx(FilterPanelField, { label: t("crm.quotes.status"), children: /* @__PURE__ */ jsx(
|
|
5806
5788
|
RequiredFilter,
|
|
5807
5789
|
{
|
|
5808
5790
|
label: t("crm.quotes.status"),
|
|
5809
|
-
value:
|
|
5791
|
+
value: draft.status.length === 0 ? t("crm.quotes.filterAllStatuses") : draft.status.length === 1 ? t(`crm.quotes.status.${draft.status[0]}`) : t("crud.list.selectedMany", { count: draft.status.length }),
|
|
5810
5792
|
icon: CircleDashed,
|
|
5811
5793
|
className: "h-9 w-full justify-start",
|
|
5812
5794
|
align: "start",
|
|
5813
5795
|
children: /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
|
|
5814
|
-
/* @__PURE__ */ jsx(FilterMenuRow, { active:
|
|
5796
|
+
/* @__PURE__ */ jsx(FilterMenuRow, { active: draft.status.length === 0, onClick: () => patch({ status: [] }), children: t("crm.quotes.filterAllStatuses") }),
|
|
5815
5797
|
QUOTE_STATUSES.map((st) => {
|
|
5816
|
-
const on =
|
|
5798
|
+
const on = draft.status.includes(st);
|
|
5817
5799
|
return /* @__PURE__ */ jsx(
|
|
5818
5800
|
FilterMenuRow,
|
|
5819
5801
|
{
|
|
5820
5802
|
active: on,
|
|
5821
|
-
onClick: () =>
|
|
5803
|
+
onClick: () => patch({ status: on ? draft.status.filter((v) => v !== st) : [...draft.status, st] }),
|
|
5822
5804
|
children: /* @__PURE__ */ jsx("span", { className: "truncate", children: t(`crm.quotes.status.${st}`) })
|
|
5823
5805
|
},
|
|
5824
5806
|
st
|
|
@@ -5831,8 +5813,8 @@ function QuoteListView({ onNew, onEdit, onEditQuote }) {
|
|
|
5831
5813
|
SearchSelect,
|
|
5832
5814
|
{
|
|
5833
5815
|
className: "w-full",
|
|
5834
|
-
value: contactId,
|
|
5835
|
-
displayValue: contactName,
|
|
5816
|
+
value: draft.contactId,
|
|
5817
|
+
displayValue: draft.contactName,
|
|
5836
5818
|
placeholder: t("crm.quotes.filterContactPlaceholder"),
|
|
5837
5819
|
minChars: 2,
|
|
5838
5820
|
minCharsLabel: t("crm.quotes.filterMinChars"),
|
|
@@ -5840,10 +5822,7 @@ function QuoteListView({ onNew, onEdit, onEditQuote }) {
|
|
|
5840
5822
|
searchingLabel: t("crm.quotes.filterSearching"),
|
|
5841
5823
|
loadOnOpen: false,
|
|
5842
5824
|
clearLabel: t("crm.quotes.filterAllContacts"),
|
|
5843
|
-
onChange: (id, option) => {
|
|
5844
|
-
setContactId(id);
|
|
5845
|
-
setContactName(option?.label ?? "");
|
|
5846
|
-
},
|
|
5825
|
+
onChange: (id, option) => patch({ contactId: id, contactName: option?.label ?? "" }),
|
|
5847
5826
|
onSearch: async (termo) => {
|
|
5848
5827
|
const results = await contactLookup.search(termo);
|
|
5849
5828
|
return results.map((r) => ({ id: r.id, label: r.label, subtitle: r.subtitle, group: r.group, data: r }));
|
|
@@ -5859,10 +5838,10 @@ function QuoteListView({ onNew, onEdit, onEditQuote }) {
|
|
|
5859
5838
|
Input,
|
|
5860
5839
|
{
|
|
5861
5840
|
type: "text",
|
|
5862
|
-
value: search,
|
|
5863
|
-
onChange: (e) =>
|
|
5841
|
+
value: draft.search,
|
|
5842
|
+
onChange: (e) => patch({ search: e.target.value }),
|
|
5864
5843
|
onKeyDown: (e) => {
|
|
5865
|
-
if (e.key === "Enter")
|
|
5844
|
+
if (e.key === "Enter") filtros.apply();
|
|
5866
5845
|
},
|
|
5867
5846
|
placeholder: t("crm.quotes.searchPlaceholder"),
|
|
5868
5847
|
"aria-label": t("crm.quotes.searchPlaceholder"),
|
|
@@ -10192,5 +10171,5 @@ function CrmPage({ config, provider, store, registries }) {
|
|
|
10192
10171
|
}
|
|
10193
10172
|
|
|
10194
10173
|
export { CrmPage };
|
|
10195
|
-
//# sourceMappingURL=CrmPage-
|
|
10196
|
-
//# sourceMappingURL=CrmPage-
|
|
10174
|
+
//# sourceMappingURL=CrmPage-4BPA22DO.js.map
|
|
10175
|
+
//# sourceMappingURL=CrmPage-4BPA22DO.js.map
|