@fayz-ai/plugin-crm 0.31.17 → 0.32.0
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/components/AssigneeRota.d.ts.map +1 -1
- package/dist/components/AutomationBolt.d.ts.map +1 -1
- package/dist/components/CompanyGroupBadge.d.ts.map +1 -1
- package/dist/components/LeadQualification.d.ts.map +1 -1
- package/dist/components/LinkCompanyPrompt.d.ts.map +1 -1
- package/dist/components/LinkContactDialog.d.ts.map +1 -1
- package/dist/components/LostReasonDialog.d.ts.map +1 -1
- package/dist/components/PersonPhones.d.ts.map +1 -1
- package/dist/components/QuoteStatusDropdown.d.ts.map +1 -1
- package/dist/components/SurveyEditorDialog.d.ts.map +1 -1
- package/dist/components/SurveyScale.d.ts.map +1 -1
- package/dist/components/UnitPicker.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1070 -895
- package/dist/index.js.map +1 -1
- package/dist/lib/message-events.d.ts.map +1 -1
- package/dist/locales/en.d.ts.map +1 -1
- package/dist/locales/pt-BR.d.ts.map +1 -1
- package/dist/settings/v1-settings.d.ts +2 -0
- package/dist/settings/v1-settings.d.ts.map +1 -0
- package/dist/views/ActivityListView.d.ts.map +1 -1
- package/dist/views/CompanyDetailView.d.ts +3 -4
- package/dist/views/CompanyDetailView.d.ts.map +1 -1
- package/dist/views/CompanyFormView.d.ts +2 -1
- package/dist/views/CompanyFormView.d.ts.map +1 -1
- package/dist/views/CompanyGroupsView.d.ts.map +1 -1
- package/dist/views/CrmPage.d.ts.map +1 -1
- package/dist/views/DealCardModal.d.ts.map +1 -1
- package/dist/views/DealFunnelView.d.ts.map +1 -1
- package/dist/views/DealListView.d.ts.map +1 -1
- package/dist/views/DealsView.d.ts.map +1 -1
- package/dist/views/DistributionView.d.ts.map +1 -1
- package/dist/views/LeadDetailView.d.ts.map +1 -1
- package/dist/views/LeadListView.d.ts.map +1 -1
- package/dist/views/LeadSidebar.d.ts.map +1 -1
- package/dist/views/NetworkView.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/QuoteFormView.d.ts.map +1 -1
- package/dist/views/QuoteListView.d.ts.map +1 -1
- package/dist/views/SurveysView.d.ts.map +1 -1
- package/dist/views/companyEntity.d.ts +21 -0
- package/dist/views/companyEntity.d.ts.map +1 -0
- package/package.json +5 -5
- package/dist/data/index.d.ts +0 -3
- package/dist/data/index.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default, { useState, useEffect, useCallback, useMemo, useRef } from 'react';
|
|
3
3
|
import { tl, useTranslation, getSupabaseClientOptional, getActiveUnitId, RECORD_GROUP, recordRailFields, activeFacet, registerTranslations, registerMessageDefaults, createSafeDataProvider, getActiveTenantId, countByTenant, usePluginRuntimeOptional, useActiveTenantId, exportCSV, getCurrentLocale, loadMessageOverrides, resolveMessages, useActiveUnitId } from '@fayz-ai/core';
|
|
4
|
-
import { createPluginContext, useUnitBootstrap, useUnitStore, createCrudPage, PluginSettingsPanel, registerTimelineSource, dedup, useModuleNavigation, usePluginOnboardingGate, PluginOnboardingGateSkeleton, createViewRouter, ModuleActionBar, usePermissionOptional, PageActions, useTenantPluginSettings, SettingsGroup, ToggleRow, adminNavigateTo, usePersistedState, useScrollMemory, useLimitGuard, useCatalogedItemTypes, OrderFormSkeleton, OrderFormBlock, OrderFormView, OrderFormItemsCard, OrderFormItemRow, OrderFormAddItemStep, createArchetypeLookup, formatCurrency, useRecordVisit, OrderDetailSkeleton, OrderDetailBlock, OrderDetailView, PersonLink,
|
|
5
|
-
import { Archive, FileX2, FileCheck2, Send, FilePlus2, XCircle, Trophy, PhoneCall, MoveRight, Target, ArrowRightLeft, UserPlus, MapPin, MessageCircle, CheckSquare, FileText, Users, Mail, Phone, ArrowUp, ArrowDown, X, Plus, Filter, Lock, Pencil, Trash2, Globe, Check, ChevronRight, Settings, Tag, Briefcase, CircleDot, User, Download, CircleDashed, Search, Inbox, Play, Clock, Sparkles, Calendar, ArrowRight, MoreHorizontal, ChevronDown, Printer, CircleCheckBig, Ban, Receipt, Package, CalendarClock, Loader2, Network, Building2,
|
|
6
|
-
import { Badge, Checkbox, toast, defineKpiWidget, defineChartWidget, defineCustomWidget, defineTableWidget, PageTransition, ModulePage, SubpageHeader,
|
|
4
|
+
import { createPluginContext, defineSettingsTab, registrySettingsParent, useUnitBootstrap, useUnitStore, createCrudPage, PluginSettingsPanel, registerTimelineSource, dedup, useModuleNavigation, usePluginOnboardingGate, PluginOnboardingGateSkeleton, createViewRouter, ModuleActionBar, usePermissionOptional, PageActions, useTenantPluginSettings, SettingsGroup, ToggleRow, adminNavigateTo, usePersistedState, useScrollMemory, useLimitGuard, useCatalogedItemTypes, OrderFormSkeleton, OrderFormBlock, OrderFormView, OrderFormItemsCard, OrderFormItemRow, OrderFormAddItemStep, createArchetypeLookup, formatCurrency, useRecordVisit, OrderDetailSkeleton, OrderDetailBlock, OrderDetailView, PersonLink, CrudFormSkeleton, CrudFormPage, CrudDetailSkeleton, CrudDetailPage, AskAIButton, KanbanBoard, InlineField, useUnitFilter, invalidateLimit, useAccessOptional, useOrganizationStore, getRailPage, RightRailPage, ContactPicker, useAgentSurface } from '@fayz-ai/admin';
|
|
5
|
+
import { Archive, FileX2, FileCheck2, Send, FilePlus2, XCircle, Trophy, PhoneCall, MoveRight, Target, ArrowRightLeft, UserPlus, MapPin, MessageCircle, CheckSquare, FileText, Users, Mail, Phone, ArrowUp, ArrowDown, X, Plus, Filter, Lock, Pencil, Trash2, Globe, Check, ChevronRight, Settings, Tag, Briefcase, CircleDot, User, Download, CircleDashed, Search, Inbox, Play, Clock, Sparkles, Calendar, ArrowRight, MoreHorizontal, ChevronDown, Printer, CircleCheckBig, Ban, Receipt, Package, CalendarClock, Loader2, Network, Building2, Star, MessageSquareQuote, UserRound, CalendarDays, ThumbsDown, SignalHigh, CalendarRange, ChevronLeft, TrendingDown, UserCheck, AlertTriangle, Settings2, Repeat, Zap, Snowflake, Sun, Flame, Merge, Fingerprint, Paperclip, ImageOff, CircleAlert, Link2, CheckCircle2, SlidersHorizontal, ExternalLink, Clipboard, DollarSign, ThumbsUp, UserRoundPlus } from 'lucide-react';
|
|
6
|
+
import { Button, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Badge, Checkbox, toast, defineKpiWidget, defineChartWidget, defineCustomWidget, defineTableWidget, PageTransition, ModulePage, SubpageHeader, TooltipProvider, Tooltip, TooltipTrigger, TooltipContent, Switch, ConfirmDialog, useIsWide, PageHeaderActions, FilterChip, MultiSelect, FilterMenu, FilterMenuRow, PersonAvatar, ListView, Modal, ModalContent, ModalHeader, ModalTitle, ModalBody, Input, Textarea, ModalFooter, useSaveBar, SearchSelect, DatePicker, FilterPanel, FilterPanelField, RequiredFilter, Card, DataTable, Dropdown, DropdownTrigger, DropdownContent, DropdownItem, PhoneLink, ComingSoon, DashboardCanvas, ModalDescription, PageViewBar, PersonPicker, cn, HeaderTabs, SheetBody, SheetFooter, Popover, PopoverTrigger, PopoverContent, getLucideIcon, DictateButton, DropdownLabel, DropdownSeparator, normalizePhone, KpiCard, ChartWidget, CardHeader, CardTitle, CardContent, TableWidget } from '@fayz-ai/ui';
|
|
7
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
8
|
import { createPortal } from 'react-dom';
|
|
9
9
|
import { createStore as createStore$1 } from 'zustand/vanilla';
|
|
@@ -77,6 +77,26 @@ function buildCrmDomainEvents() {
|
|
|
77
77
|
description: "O neg\xF3cio ficou sem movimento",
|
|
78
78
|
trigger: "Quando o neg\xF3cio passa dias sem avan\xE7ar",
|
|
79
79
|
fields: DEAL_FIELDS
|
|
80
|
+
},
|
|
81
|
+
// V1 "Pesquisas de avaliação": the invite and the thank-you are templates of
|
|
82
|
+
// the catalog. Nothing emits these events yet.
|
|
83
|
+
{
|
|
84
|
+
name: "crm.survey_requested",
|
|
85
|
+
title: "Pesquisa de satisfa\xE7\xE3o enviada",
|
|
86
|
+
icon: "Star",
|
|
87
|
+
audit: false,
|
|
88
|
+
description: "O cliente foi convidado a avaliar o atendimento",
|
|
89
|
+
trigger: "Quando a conta \xE9 fechada e a pesquisa est\xE1 ligada",
|
|
90
|
+
fields: CONTACT_FIELDS
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: "crm.survey_answered",
|
|
94
|
+
title: "Pesquisa respondida",
|
|
95
|
+
icon: "MessageSquareHeart",
|
|
96
|
+
audit: false,
|
|
97
|
+
description: "O cliente respondeu a pesquisa",
|
|
98
|
+
trigger: "Quando a avalia\xE7\xE3o \xE9 registrada",
|
|
99
|
+
fields: CONTACT_FIELDS
|
|
80
100
|
}
|
|
81
101
|
];
|
|
82
102
|
}
|
|
@@ -166,6 +186,22 @@ function buildCrmMessageDefaults() {
|
|
|
166
186
|
body: "Oi {{contact_name}}, tudo bem?\n\nPassando para saber se {{deal_name}} ainda faz sentido para voc\xEA. Se preferir, retomo mais para frente \u2014 \xE9 s\xF3 me dizer. \u2014 {{owner_name}}"
|
|
167
187
|
}
|
|
168
188
|
}
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
eventKey: "crm.survey_requested",
|
|
192
|
+
kind: "transactional",
|
|
193
|
+
channels: ["whatsapp"],
|
|
194
|
+
defaults: {
|
|
195
|
+
whatsapp: { body: "Oi {{contact_name}}! Como foi sua experi\xEAncia com a {{company_name}}? Responda de 1 a 5 \u2014 sua opini\xE3o ajuda a gente a melhorar." }
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
eventKey: "crm.survey_answered",
|
|
200
|
+
kind: "transactional",
|
|
201
|
+
channels: ["whatsapp"],
|
|
202
|
+
defaults: {
|
|
203
|
+
whatsapp: { body: "Obrigado pela avalia\xE7\xE3o, {{contact_name}}! \u{1F49B} Equipe {{company_name}}" }
|
|
204
|
+
}
|
|
169
205
|
}
|
|
170
206
|
];
|
|
171
207
|
}
|
|
@@ -209,10 +245,12 @@ function GroupRow({ g, onOpen, open, members, roll, onEdit, onAdd, onRemove, onD
|
|
|
209
245
|
}, [term, search]);
|
|
210
246
|
return /* @__PURE__ */ jsxs("div", { className: "border-b last:border-b-0", children: [
|
|
211
247
|
/* @__PURE__ */ jsxs(
|
|
212
|
-
|
|
248
|
+
Button,
|
|
213
249
|
{
|
|
250
|
+
variant: "bare",
|
|
251
|
+
size: "bare",
|
|
214
252
|
onClick: onOpen,
|
|
215
|
-
className: "flex w-full
|
|
253
|
+
className: "flex w-full justify-start gap-3 whitespace-normal rounded-none px-4 py-3 text-left font-normal hover:bg-muted/20",
|
|
216
254
|
children: [
|
|
217
255
|
open ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4 shrink-0 text-muted-foreground" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
218
256
|
/* @__PURE__ */ jsx(Network, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
@@ -257,8 +295,10 @@ function GroupRow({ g, onOpen, open, members, roll, onEdit, onAdd, onRemove, onD
|
|
|
257
295
|
m.companyDocument && /* @__PURE__ */ jsx("span", { className: "tabular-nums text-muted-foreground", children: m.companyDocument }),
|
|
258
296
|
m.source && /* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground/70", children: m.source === "document_root" ? "pela raiz do CNPJ" : "declarado" }),
|
|
259
297
|
editing && /* @__PURE__ */ jsx(
|
|
260
|
-
|
|
298
|
+
Button,
|
|
261
299
|
{
|
|
300
|
+
variant: "bare",
|
|
301
|
+
size: "bare",
|
|
262
302
|
onClick: () => void onRemove(m.id),
|
|
263
303
|
className: "ml-auto text-muted-foreground hover:text-destructive",
|
|
264
304
|
"aria-label": `Tirar ${m.companyName} do grupo`,
|
|
@@ -282,19 +322,14 @@ function GroupRow({ g, onOpen, open, members, roll, onEdit, onAdd, onRemove, onD
|
|
|
282
322
|
] }),
|
|
283
323
|
/* @__PURE__ */ jsxs("label", { className: "block", children: [
|
|
284
324
|
/* @__PURE__ */ jsx("span", { className: "text-[11px] text-muted-foreground", children: "Tipo de la\xE7o" }),
|
|
285
|
-
/* @__PURE__ */
|
|
286
|
-
"
|
|
287
|
-
{
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
" \u2014 ",
|
|
294
|
-
k.hint
|
|
295
|
-
] }, k.value))
|
|
296
|
-
}
|
|
297
|
-
)
|
|
325
|
+
/* @__PURE__ */ jsxs(Select, { value: draftKind, onValueChange: setDraftKind, children: [
|
|
326
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "mt-0.5 h-8 rounded-md border-border bg-background px-2 py-0 shadow-none", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
327
|
+
/* @__PURE__ */ jsx(SelectContent, { children: KINDS.map((k) => /* @__PURE__ */ jsxs(SelectItem, { value: k.value, children: [
|
|
328
|
+
k.label,
|
|
329
|
+
" \u2014 ",
|
|
330
|
+
k.hint
|
|
331
|
+
] }, k.value)) })
|
|
332
|
+
] })
|
|
298
333
|
] })
|
|
299
334
|
] }),
|
|
300
335
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
@@ -312,8 +347,10 @@ function GroupRow({ g, onOpen, open, members, roll, onEdit, onAdd, onRemove, onD
|
|
|
312
347
|
)
|
|
313
348
|
] }),
|
|
314
349
|
hits.length > 0 && /* @__PURE__ */ jsx("div", { className: "mt-1 max-h-40 overflow-auto rounded-md border bg-card", children: hits.map((h) => /* @__PURE__ */ jsxs(
|
|
315
|
-
|
|
350
|
+
Button,
|
|
316
351
|
{
|
|
352
|
+
variant: "bare",
|
|
353
|
+
size: "bare",
|
|
317
354
|
disabled: busy,
|
|
318
355
|
onClick: async () => {
|
|
319
356
|
setBusy(true);
|
|
@@ -325,7 +362,7 @@ function GroupRow({ g, onOpen, open, members, roll, onEdit, onAdd, onRemove, onD
|
|
|
325
362
|
setBusy(false);
|
|
326
363
|
}
|
|
327
364
|
},
|
|
328
|
-
className: "flex w-full items-baseline gap-2 px-2 py-1.5 text-left text-xs hover:bg-muted/40",
|
|
365
|
+
className: "flex w-full items-baseline justify-start gap-2 whitespace-normal rounded-none px-2 py-1.5 text-left text-xs font-normal hover:bg-muted/40",
|
|
329
366
|
children: [
|
|
330
367
|
/* @__PURE__ */ jsx(Plus, { className: "h-3 w-3 shrink-0" }),
|
|
331
368
|
/* @__PURE__ */ jsx("span", { className: "font-medium", children: h.name }),
|
|
@@ -373,10 +410,12 @@ function GroupRow({ g, onOpen, open, members, roll, onEdit, onAdd, onRemove, onD
|
|
|
373
410
|
)
|
|
374
411
|
] })
|
|
375
412
|
] }) : /* @__PURE__ */ jsxs(
|
|
376
|
-
|
|
413
|
+
Button,
|
|
377
414
|
{
|
|
415
|
+
variant: "bare",
|
|
416
|
+
size: "bare",
|
|
378
417
|
onClick: () => setEditing(true),
|
|
379
|
-
className: "mt-1
|
|
418
|
+
className: "mt-1 gap-1 text-[11px] font-normal text-primary hover:underline",
|
|
380
419
|
children: [
|
|
381
420
|
/* @__PURE__ */ jsx(Pencil, { className: "h-3 w-3" }),
|
|
382
421
|
" Editar grupo"
|
|
@@ -735,28 +774,28 @@ function CrmGeneralSettings() {
|
|
|
735
774
|
const s = useTenantPluginSettings("crm", CRM_DEFAULTS);
|
|
736
775
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
737
776
|
/* @__PURE__ */ jsxs(SettingsGroup, { title: t2("crm.settings.leadManagement"), description: t2("crm.settings.leadManagementDesc"), children: [
|
|
738
|
-
/* @__PURE__ */ jsx(ToggleRow, { label: t2("crm.settings.autoAssign"), description: t2("crm.settings.autoAssignDesc"), checked: s.get("autoAssign"), onChange: (v) => s.set("autoAssign", v) }),
|
|
739
|
-
/* @__PURE__ */ jsx(ToggleRow, { label: t2("crm.settings.requireSource"), description: t2("crm.settings.requireSourceDesc"), checked: s.get("requireSource"), onChange: (v) => s.set("requireSource", v) }),
|
|
740
|
-
/* @__PURE__ */ jsx(ToggleRow, { label: t2("crm.settings.leadScoring"), description: t2("crm.settings.leadScoringDesc"), checked: s.get("leadScoring"), onChange: (v) => s.set("leadScoring", v) }),
|
|
741
|
-
/* @__PURE__ */ jsx(ToggleRow, { label: t2("crm.settings.duplicateDetection"), description: t2("crm.settings.duplicateDetectionDesc"), checked: s.get("duplicateDetection"), onChange: (v) => s.set("duplicateDetection", v) })
|
|
777
|
+
/* @__PURE__ */ jsx(ToggleRow, { pending: true, label: t2("crm.settings.autoAssign"), description: t2("crm.settings.autoAssignDesc"), checked: s.get("autoAssign"), onChange: (v) => s.set("autoAssign", v) }),
|
|
778
|
+
/* @__PURE__ */ jsx(ToggleRow, { pending: true, label: t2("crm.settings.requireSource"), description: t2("crm.settings.requireSourceDesc"), checked: s.get("requireSource"), onChange: (v) => s.set("requireSource", v) }),
|
|
779
|
+
/* @__PURE__ */ jsx(ToggleRow, { pending: true, label: t2("crm.settings.leadScoring"), description: t2("crm.settings.leadScoringDesc"), checked: s.get("leadScoring"), onChange: (v) => s.set("leadScoring", v) }),
|
|
780
|
+
/* @__PURE__ */ jsx(ToggleRow, { pending: true, label: t2("crm.settings.duplicateDetection"), description: t2("crm.settings.duplicateDetectionDesc"), checked: s.get("duplicateDetection"), onChange: (v) => s.set("duplicateDetection", v) })
|
|
742
781
|
] }),
|
|
743
782
|
/* @__PURE__ */ jsxs(SettingsGroup, { title: t2("crm.settings.deals"), description: t2("crm.settings.dealsDesc"), children: [
|
|
744
|
-
/* @__PURE__ */ jsx(ToggleRow, { label: t2("crm.settings.autoCreateDeal"), description: t2("crm.settings.autoCreateDealDesc"), checked: s.get("autoCreateDeal"), onChange: (v) => s.set("autoCreateDeal", v) }),
|
|
745
|
-
/* @__PURE__ */ jsx(ToggleRow, { label: t2("crm.settings.requireCloseDate"), description: t2("crm.settings.requireCloseDateDesc"), checked: s.get("requireCloseDate"), onChange: (v) => s.set("requireCloseDate", v) }),
|
|
746
|
-
/* @__PURE__ */ jsx(ToggleRow, { label: t2("crm.settings.rottingDeals"), description: t2("crm.settings.rottingDealsDesc"), checked: s.get("rottingDeals"), onChange: (v) => s.set("rottingDeals", v) }),
|
|
747
|
-
/* @__PURE__ */ jsx(ToggleRow, { label: t2("crm.settings.weightedPipeline"), description: t2("crm.settings.weightedPipelineDesc"), checked: s.get("weightedPipeline"), onChange: (v) => s.set("weightedPipeline", v) })
|
|
783
|
+
/* @__PURE__ */ jsx(ToggleRow, { pending: true, label: t2("crm.settings.autoCreateDeal"), description: t2("crm.settings.autoCreateDealDesc"), checked: s.get("autoCreateDeal"), onChange: (v) => s.set("autoCreateDeal", v) }),
|
|
784
|
+
/* @__PURE__ */ jsx(ToggleRow, { pending: true, label: t2("crm.settings.requireCloseDate"), description: t2("crm.settings.requireCloseDateDesc"), checked: s.get("requireCloseDate"), onChange: (v) => s.set("requireCloseDate", v) }),
|
|
785
|
+
/* @__PURE__ */ jsx(ToggleRow, { pending: true, label: t2("crm.settings.rottingDeals"), description: t2("crm.settings.rottingDealsDesc"), checked: s.get("rottingDeals"), onChange: (v) => s.set("rottingDeals", v) }),
|
|
786
|
+
/* @__PURE__ */ jsx(ToggleRow, { pending: true, label: t2("crm.settings.weightedPipeline"), description: t2("crm.settings.weightedPipelineDesc"), checked: s.get("weightedPipeline"), onChange: (v) => s.set("weightedPipeline", v) })
|
|
748
787
|
] }),
|
|
749
788
|
/* @__PURE__ */ jsxs(SettingsGroup, { title: t2("crm.settings.quotes"), description: t2("crm.settings.quotesDesc"), children: [
|
|
750
|
-
/* @__PURE__ */ jsx(ToggleRow, { label: t2("crm.settings.autoNumberQuotes"), description: t2("crm.settings.autoNumberQuotesDesc"), checked: s.get("autoNumberQuotes"), onChange: (v) => s.set("autoNumberQuotes", v) }),
|
|
751
|
-
/* @__PURE__ */ jsx(ToggleRow, { label: t2("crm.settings.defaultValidity"), description: t2("crm.settings.defaultValidityDesc"), checked: s.get("defaultValidity"), onChange: (v) => s.set("defaultValidity", v) }),
|
|
752
|
-
/* @__PURE__ */ jsx(ToggleRow, { label: t2("crm.settings.requireApproval"), description: t2("crm.settings.requireApprovalDesc"), checked: s.get("requireApproval"), onChange: (v) => s.set("requireApproval", v) })
|
|
789
|
+
/* @__PURE__ */ jsx(ToggleRow, { pending: true, label: t2("crm.settings.autoNumberQuotes"), description: t2("crm.settings.autoNumberQuotesDesc"), checked: s.get("autoNumberQuotes"), onChange: (v) => s.set("autoNumberQuotes", v) }),
|
|
790
|
+
/* @__PURE__ */ jsx(ToggleRow, { pending: true, label: t2("crm.settings.defaultValidity"), description: t2("crm.settings.defaultValidityDesc"), checked: s.get("defaultValidity"), onChange: (v) => s.set("defaultValidity", v) }),
|
|
791
|
+
/* @__PURE__ */ jsx(ToggleRow, { pending: true, label: t2("crm.settings.requireApproval"), description: t2("crm.settings.requireApprovalDesc"), checked: s.get("requireApproval"), onChange: (v) => s.set("requireApproval", v) })
|
|
753
792
|
] }),
|
|
754
793
|
/* @__PURE__ */ jsx(LeadScoreWeights, {}),
|
|
755
794
|
/* @__PURE__ */ jsx(EngagementLadderSettings, {}),
|
|
756
795
|
/* @__PURE__ */ jsxs(SettingsGroup, { title: t2("crm.settings.notifications"), description: t2("crm.settings.notificationsDesc"), children: [
|
|
757
|
-
/* @__PURE__ */ jsx(ToggleRow, { label: t2("crm.settings.overdueAlerts"), description: t2("crm.settings.overdueAlertsDesc"), checked: s.get("overdueAlerts"), onChange: (v) => s.set("overdueAlerts", v) }),
|
|
758
|
-
/* @__PURE__ */ jsx(ToggleRow, { label: t2("crm.settings.stageChangeAlerts"), description: t2("crm.settings.stageChangeAlertsDesc"), checked: s.get("stageChangeAlerts"), onChange: (v) => s.set("stageChangeAlerts", v) }),
|
|
759
|
-
/* @__PURE__ */ jsx(ToggleRow, { label: t2("crm.settings.newLeadNotif"), description: t2("crm.settings.newLeadNotifDesc"), checked: s.get("newLeadNotif"), onChange: (v) => s.set("newLeadNotif", v) })
|
|
796
|
+
/* @__PURE__ */ jsx(ToggleRow, { pending: true, label: t2("crm.settings.overdueAlerts"), description: t2("crm.settings.overdueAlertsDesc"), checked: s.get("overdueAlerts"), onChange: (v) => s.set("overdueAlerts", v) }),
|
|
797
|
+
/* @__PURE__ */ jsx(ToggleRow, { pending: true, label: t2("crm.settings.stageChangeAlerts"), description: t2("crm.settings.stageChangeAlertsDesc"), checked: s.get("stageChangeAlerts"), onChange: (v) => s.set("stageChangeAlerts", v) }),
|
|
798
|
+
/* @__PURE__ */ jsx(ToggleRow, { pending: true, label: t2("crm.settings.newLeadNotif"), description: t2("crm.settings.newLeadNotifDesc"), checked: s.get("newLeadNotif"), onChange: (v) => s.set("newLeadNotif", v) })
|
|
760
799
|
] })
|
|
761
800
|
] });
|
|
762
801
|
}
|
|
@@ -791,7 +830,7 @@ function CrmOnboarding({ onComplete }) {
|
|
|
791
830
|
/* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
|
|
792
831
|
] })
|
|
793
832
|
] }),
|
|
794
|
-
step === 0 && /* @__PURE__ */ jsx("
|
|
833
|
+
step === 0 && /* @__PURE__ */ jsx(Button, { variant: "bare", size: "bare", onClick: onComplete, className: "text-xs font-normal text-muted-foreground hover:text-foreground", children: t2("crm.onboarding.skip") })
|
|
795
834
|
] })
|
|
796
835
|
] }) });
|
|
797
836
|
}
|
|
@@ -890,15 +929,17 @@ function LostReasonDialog({
|
|
|
890
929
|
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1.5", children: LOST_REASONS.map((key) => {
|
|
891
930
|
const active = picked === key;
|
|
892
931
|
return /* @__PURE__ */ jsx(
|
|
893
|
-
|
|
932
|
+
Button,
|
|
894
933
|
{
|
|
895
934
|
type: "button",
|
|
935
|
+
variant: "bare",
|
|
936
|
+
size: "bare",
|
|
896
937
|
"aria-pressed": active,
|
|
897
938
|
onClick: () => {
|
|
898
939
|
setPicked(active ? void 0 : key);
|
|
899
940
|
if (!active) setOther("");
|
|
900
941
|
},
|
|
901
|
-
className: "rounded-full border px-3 py-1.5 text-xs font-medium
|
|
942
|
+
className: "rounded-full border px-3 py-1.5 text-xs font-medium " + (active ? "border-primary bg-primary/10 text-primary" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"),
|
|
902
943
|
children: t2(`crm.lostReason.${key}`)
|
|
903
944
|
},
|
|
904
945
|
key
|
|
@@ -933,7 +974,7 @@ function LostReasonDialog({
|
|
|
933
974
|
function useCrmUnitFilter() {
|
|
934
975
|
return useUnitFilter({ scope: "global" });
|
|
935
976
|
}
|
|
936
|
-
var ROW = "
|
|
977
|
+
var ROW = "gap-2 text-xs hover:bg-muted";
|
|
937
978
|
function UnitPicker({ filter: f }) {
|
|
938
979
|
const [open, setOpen] = React.useState(false);
|
|
939
980
|
if (!f.visible) return null;
|
|
@@ -944,11 +985,12 @@ function UnitPicker({ filter: f }) {
|
|
|
944
985
|
};
|
|
945
986
|
return /* @__PURE__ */ jsxs(Dropdown, { open, onOpenChange: setOpen, children: [
|
|
946
987
|
/* @__PURE__ */ jsx(DropdownTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
947
|
-
|
|
988
|
+
Button,
|
|
948
989
|
{
|
|
949
990
|
type: "button",
|
|
991
|
+
variant: "outline",
|
|
950
992
|
title: f.label,
|
|
951
|
-
className: "
|
|
993
|
+
className: "h-8 shrink-0 gap-1.5 rounded-full px-3 text-xs font-medium",
|
|
952
994
|
children: [
|
|
953
995
|
/* @__PURE__ */ jsx(Building2, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
954
996
|
/* @__PURE__ */ jsx("span", { className: "max-w-[10rem] truncate", children: current }),
|
|
@@ -957,12 +999,12 @@ function UnitPicker({ filter: f }) {
|
|
|
957
999
|
}
|
|
958
1000
|
) }),
|
|
959
1001
|
/* @__PURE__ */ jsxs(DropdownContent, { align: "end", className: "w-56 p-1", children: [
|
|
960
|
-
/* @__PURE__ */ jsxs(
|
|
1002
|
+
/* @__PURE__ */ jsxs(DropdownItem, { className: ROW, onSelect: () => pick(void 0), children: [
|
|
961
1003
|
/* @__PURE__ */ jsx("span", { className: "truncate", children: f.allLabel }),
|
|
962
1004
|
!f.value && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 shrink-0" })
|
|
963
1005
|
] }),
|
|
964
1006
|
/* @__PURE__ */ jsx("div", { className: "my-1 border-t" }),
|
|
965
|
-
/* @__PURE__ */ jsx("div", { className: "max-h-64 overflow-y-auto", children: f.options.map((u) => /* @__PURE__ */ jsxs(
|
|
1007
|
+
/* @__PURE__ */ jsx("div", { className: "max-h-64 overflow-y-auto", children: f.options.map((u) => /* @__PURE__ */ jsxs(DropdownItem, { className: ROW, onSelect: () => pick(u.id), children: [
|
|
966
1008
|
/* @__PURE__ */ jsx("span", { className: "truncate", children: u.name }),
|
|
967
1009
|
f.value === u.id && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 shrink-0" })
|
|
968
1010
|
] }, u.id)) })
|
|
@@ -1450,13 +1492,15 @@ function usePipelineAgentSurface(deps) {
|
|
|
1450
1492
|
}, [deps.provider, deps.pipelines, deps.activePipelineId, deps.stages, deps.dealCountByStage, deps.refresh]);
|
|
1451
1493
|
useAgentSurface(contribution);
|
|
1452
1494
|
}
|
|
1453
|
-
var CHIP_ROW = "flex w-full
|
|
1495
|
+
var CHIP_ROW = "flex w-full justify-start whitespace-normal font-normal gap-2 rounded-md px-2 py-1.5 text-left text-xs hover:bg-muted";
|
|
1454
1496
|
function BoardFilterChip({ trigger, onClear, clearLabel, closeOnSelect, children }) {
|
|
1455
1497
|
const [open, setOpen] = React__default.useState(false);
|
|
1456
1498
|
return /* @__PURE__ */ jsxs(Dropdown, { open, onOpenChange: setOpen, children: [
|
|
1457
1499
|
/* @__PURE__ */ jsx(DropdownTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
1458
|
-
|
|
1500
|
+
Button,
|
|
1459
1501
|
{
|
|
1502
|
+
variant: "bare",
|
|
1503
|
+
size: "bare",
|
|
1460
1504
|
type: "button",
|
|
1461
1505
|
className: "inline-flex h-7 shrink-0 items-center gap-1.5 rounded-full border border-primary/30 bg-primary/10 px-2 text-xs font-medium text-primary transition-colors hover:bg-primary/15",
|
|
1462
1506
|
children: [
|
|
@@ -1474,7 +1518,7 @@ function BoardFilterChip({ trigger, onClear, clearLabel, closeOnSelect, children
|
|
|
1474
1518
|
children
|
|
1475
1519
|
}
|
|
1476
1520
|
),
|
|
1477
|
-
/* @__PURE__ */ jsx("div", { className: "mt-1 border-t pt-1", children: /* @__PURE__ */ jsxs("
|
|
1521
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1 border-t pt-1", children: /* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: CHIP_ROW + " text-muted-foreground", onClick: () => {
|
|
1478
1522
|
onClear();
|
|
1479
1523
|
setOpen(false);
|
|
1480
1524
|
}, children: [
|
|
@@ -1510,11 +1554,13 @@ function PipelineSkeleton() {
|
|
|
1510
1554
|
function OwnerControl({ ownerId, team, onAssign }) {
|
|
1511
1555
|
const t2 = useTranslation();
|
|
1512
1556
|
const current = ownerId ? team?.find((m) => m.userId === ownerId) : void 0;
|
|
1513
|
-
const item = "flex w-full
|
|
1557
|
+
const item = "flex w-full justify-start whitespace-normal font-normal gap-2 rounded-md px-2 py-1.5 text-left text-xs hover:bg-muted";
|
|
1514
1558
|
return /* @__PURE__ */ jsxs(Dropdown, { children: [
|
|
1515
1559
|
/* @__PURE__ */ jsx(DropdownTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
1516
|
-
|
|
1560
|
+
Button,
|
|
1517
1561
|
{
|
|
1562
|
+
variant: "bare",
|
|
1563
|
+
size: "bare",
|
|
1518
1564
|
onClick: (e) => e.stopPropagation(),
|
|
1519
1565
|
draggable: false,
|
|
1520
1566
|
title: current?.name ?? t2("crm.pipeline.assignOwner"),
|
|
@@ -1526,12 +1572,12 @@ function OwnerControl({ ownerId, team, onAssign }) {
|
|
|
1526
1572
|
/* @__PURE__ */ jsx("p", { className: "px-2 py-1 text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: t2("crm.pipeline.assignOwner") }),
|
|
1527
1573
|
team === null && /* @__PURE__ */ jsx("p", { className: "px-2 py-1.5 text-xs text-muted-foreground", children: t2("crm.pipeline.teamUnavailable") }),
|
|
1528
1574
|
team !== null && /* @__PURE__ */ jsxs("div", { className: "max-h-56 overflow-y-auto", children: [
|
|
1529
|
-
/* @__PURE__ */ jsxs("
|
|
1575
|
+
/* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: item, onClick: () => onAssign(void 0), children: [
|
|
1530
1576
|
/* @__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" }) }),
|
|
1531
1577
|
t2("crm.pipeline.unassigned"),
|
|
1532
1578
|
!ownerId && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 text-muted-foreground" })
|
|
1533
1579
|
] }),
|
|
1534
|
-
team.map((m) => /* @__PURE__ */ jsxs("
|
|
1580
|
+
team.map((m) => /* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: item, onClick: () => onAssign(m.userId), children: [
|
|
1535
1581
|
/* @__PURE__ */ jsx(PersonAvatar, { name: m.name, size: "xs" }),
|
|
1536
1582
|
/* @__PURE__ */ jsx("span", { className: "truncate", children: m.name }),
|
|
1537
1583
|
ownerId === m.userId && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 shrink-0 text-muted-foreground" })
|
|
@@ -1553,8 +1599,10 @@ function DisplayPopover({ display, onChange }) {
|
|
|
1553
1599
|
if (!open) setPage("root");
|
|
1554
1600
|
}, children: [
|
|
1555
1601
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
1556
|
-
|
|
1602
|
+
Button,
|
|
1557
1603
|
{
|
|
1604
|
+
variant: "bare",
|
|
1605
|
+
size: "bare",
|
|
1558
1606
|
type: "button",
|
|
1559
1607
|
title: t2("crm.board.display"),
|
|
1560
1608
|
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",
|
|
@@ -1565,11 +1613,13 @@ function DisplayPopover({ display, onChange }) {
|
|
|
1565
1613
|
page === "root" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1566
1614
|
/* @__PURE__ */ jsx("p", { className: "px-2 py-1 text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: t2("crm.board.display") }),
|
|
1567
1615
|
/* @__PURE__ */ jsxs(
|
|
1568
|
-
|
|
1616
|
+
Button,
|
|
1569
1617
|
{
|
|
1618
|
+
variant: "bare",
|
|
1619
|
+
size: "bare",
|
|
1570
1620
|
type: "button",
|
|
1571
1621
|
onClick: () => setPage("props"),
|
|
1572
|
-
className: "flex w-full
|
|
1622
|
+
className: "flex w-full justify-start whitespace-normal font-normal gap-2 px-2 py-1.5 text-left text-xs hover:bg-muted",
|
|
1573
1623
|
children: [
|
|
1574
1624
|
/* @__PURE__ */ jsx(SlidersHorizontal, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
1575
1625
|
t2("crm.board.cardProps"),
|
|
@@ -1580,11 +1630,13 @@ function DisplayPopover({ display, onChange }) {
|
|
|
1580
1630
|
] }),
|
|
1581
1631
|
page === "props" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1582
1632
|
/* @__PURE__ */ jsxs(
|
|
1583
|
-
|
|
1633
|
+
Button,
|
|
1584
1634
|
{
|
|
1635
|
+
variant: "bare",
|
|
1636
|
+
size: "bare",
|
|
1585
1637
|
type: "button",
|
|
1586
1638
|
onClick: () => setPage("root"),
|
|
1587
|
-
className: "flex w-full
|
|
1639
|
+
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",
|
|
1588
1640
|
children: [
|
|
1589
1641
|
/* @__PURE__ */ jsx(ChevronLeft, { className: "h-3.5 w-3.5" }),
|
|
1590
1642
|
" ",
|
|
@@ -1597,12 +1649,14 @@ function DisplayPopover({ display, onChange }) {
|
|
|
1597
1649
|
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1.5 p-1", children: Object.keys(DISPLAY_DEFAULTS).map((k) => {
|
|
1598
1650
|
const on = display[k];
|
|
1599
1651
|
return /* @__PURE__ */ jsx(
|
|
1600
|
-
|
|
1652
|
+
Button,
|
|
1601
1653
|
{
|
|
1654
|
+
variant: "bare",
|
|
1655
|
+
size: "bare",
|
|
1602
1656
|
type: "button",
|
|
1603
1657
|
"aria-pressed": on,
|
|
1604
1658
|
onClick: () => onChange({ ...display, [k]: !on }),
|
|
1605
|
-
className: `rounded-full px-2.5 py-1 text-xs
|
|
1659
|
+
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"}`,
|
|
1606
1660
|
children: t2(`crm.board.prop.${k}`)
|
|
1607
1661
|
},
|
|
1608
1662
|
k
|
|
@@ -1711,11 +1765,13 @@ function BoardMenu({ menu, team, stages, canArchive, onClose, onOpenDeal, onAssi
|
|
|
1711
1765
|
left: Math.min(menu.x, (typeof window !== "undefined" ? window.innerWidth : 1200) - 240),
|
|
1712
1766
|
top: Math.min(menu.y, (typeof window !== "undefined" ? window.innerHeight : 800) - 340)
|
|
1713
1767
|
};
|
|
1714
|
-
const item = "flex w-full
|
|
1768
|
+
const item = "flex w-full justify-start whitespace-normal font-normal gap-2 px-2 py-1.5 text-left text-xs hover:bg-muted";
|
|
1715
1769
|
const backRow = (label2) => /* @__PURE__ */ jsxs(
|
|
1716
|
-
|
|
1770
|
+
Button,
|
|
1717
1771
|
{
|
|
1718
|
-
|
|
1772
|
+
variant: "bare",
|
|
1773
|
+
size: "bare",
|
|
1774
|
+
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",
|
|
1719
1775
|
onClick: () => setMode("actions"),
|
|
1720
1776
|
children: [
|
|
1721
1777
|
/* @__PURE__ */ jsx(ChevronLeft, { className: "h-3.5 w-3.5" }),
|
|
@@ -1740,7 +1796,7 @@ function BoardMenu({ menu, team, stages, canArchive, onClose, onOpenDeal, onAssi
|
|
|
1740
1796
|
),
|
|
1741
1797
|
/* @__PURE__ */ jsxs("div", { className: "fixed z-50 w-56 rounded-card border bg-popover p-1 shadow-lg", style, children: [
|
|
1742
1798
|
menu.mode === "actions" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1743
|
-
/* @__PURE__ */ jsxs("
|
|
1799
|
+
/* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: item, onClick: () => {
|
|
1744
1800
|
onClose();
|
|
1745
1801
|
onOpenDeal(deal);
|
|
1746
1802
|
}, children: [
|
|
@@ -1748,18 +1804,18 @@ function BoardMenu({ menu, team, stages, canArchive, onClose, onOpenDeal, onAssi
|
|
|
1748
1804
|
" ",
|
|
1749
1805
|
t2("crm.pipeline.openDeal")
|
|
1750
1806
|
] }),
|
|
1751
|
-
/* @__PURE__ */ jsxs("
|
|
1807
|
+
/* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: item, onClick: () => setMode("assign"), children: [
|
|
1752
1808
|
/* @__PURE__ */ jsx(UserRound, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
1753
1809
|
" ",
|
|
1754
1810
|
t2("crm.pipeline.assignOwner")
|
|
1755
1811
|
] }),
|
|
1756
|
-
/* @__PURE__ */ jsxs("
|
|
1812
|
+
/* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: item, onClick: () => setMode("move"), children: [
|
|
1757
1813
|
/* @__PURE__ */ jsx(ArrowRightLeft, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
1758
1814
|
" ",
|
|
1759
1815
|
t2("crm.pipeline.moveTo")
|
|
1760
1816
|
] }),
|
|
1761
1817
|
(wonStage && deal.stageId !== wonStage.id || lostStage && deal.stageId !== lostStage.id) && /* @__PURE__ */ jsx("div", { className: "my-1 border-t border-border" }),
|
|
1762
|
-
wonStage && deal.stageId !== wonStage.id && /* @__PURE__ */ jsxs("
|
|
1818
|
+
wonStage && deal.stageId !== wonStage.id && /* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: item, onClick: () => {
|
|
1763
1819
|
onClose();
|
|
1764
1820
|
onMove(deal, wonStage.id);
|
|
1765
1821
|
}, children: [
|
|
@@ -1767,7 +1823,7 @@ function BoardMenu({ menu, team, stages, canArchive, onClose, onOpenDeal, onAssi
|
|
|
1767
1823
|
" ",
|
|
1768
1824
|
t2("crm.pipeline.markWon")
|
|
1769
1825
|
] }),
|
|
1770
|
-
lostStage && deal.stageId !== lostStage.id && /* @__PURE__ */ jsxs("
|
|
1826
|
+
lostStage && deal.stageId !== lostStage.id && /* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: item, onClick: () => {
|
|
1771
1827
|
onClose();
|
|
1772
1828
|
onMove(deal, lostStage.id);
|
|
1773
1829
|
}, children: [
|
|
@@ -1777,7 +1833,7 @@ function BoardMenu({ menu, team, stages, canArchive, onClose, onOpenDeal, onAssi
|
|
|
1777
1833
|
] }),
|
|
1778
1834
|
canArchive && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1779
1835
|
/* @__PURE__ */ jsx("div", { className: "my-1 border-t border-border" }),
|
|
1780
|
-
/* @__PURE__ */ jsxs("
|
|
1836
|
+
/* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: `${item} text-destructive hover:bg-destructive/10`, onClick: () => {
|
|
1781
1837
|
onClose();
|
|
1782
1838
|
onArchive(deal);
|
|
1783
1839
|
}, children: [
|
|
@@ -1792,7 +1848,7 @@ function BoardMenu({ menu, team, stages, canArchive, onClose, onOpenDeal, onAssi
|
|
|
1792
1848
|
/* @__PURE__ */ jsx("div", { className: "my-1 border-t border-border" }),
|
|
1793
1849
|
team === null && /* @__PURE__ */ jsx("p", { className: "px-2 py-1.5 text-xs text-muted-foreground", children: t2("crm.pipeline.teamUnavailable") }),
|
|
1794
1850
|
team !== null && /* @__PURE__ */ jsxs("div", { className: "max-h-56 overflow-y-auto", children: [
|
|
1795
|
-
/* @__PURE__ */ jsxs("
|
|
1851
|
+
/* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: item, onClick: () => {
|
|
1796
1852
|
onClose();
|
|
1797
1853
|
onAssign(deal, void 0);
|
|
1798
1854
|
}, children: [
|
|
@@ -1800,7 +1856,7 @@ function BoardMenu({ menu, team, stages, canArchive, onClose, onOpenDeal, onAssi
|
|
|
1800
1856
|
t2("crm.pipeline.unassigned"),
|
|
1801
1857
|
!deal.assignedToId && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 text-muted-foreground" })
|
|
1802
1858
|
] }),
|
|
1803
|
-
team.map((m) => /* @__PURE__ */ jsxs("
|
|
1859
|
+
team.map((m) => /* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: item, onClick: () => {
|
|
1804
1860
|
onClose();
|
|
1805
1861
|
onAssign(deal, m.userId);
|
|
1806
1862
|
}, children: [
|
|
@@ -1813,7 +1869,7 @@ function BoardMenu({ menu, team, stages, canArchive, onClose, onOpenDeal, onAssi
|
|
|
1813
1869
|
menu.mode === "move" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1814
1870
|
backRow(t2("crm.pipeline.moveTo")),
|
|
1815
1871
|
/* @__PURE__ */ jsx("div", { className: "my-1 border-t border-border" }),
|
|
1816
|
-
/* @__PURE__ */ jsx("div", { className: "max-h-56 overflow-y-auto", children: stages.filter((s) => s.id !== deal.stageId).map((s) => /* @__PURE__ */ jsxs("
|
|
1872
|
+
/* @__PURE__ */ jsx("div", { className: "max-h-56 overflow-y-auto", children: stages.filter((s) => s.id !== deal.stageId).map((s) => /* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: item, onClick: () => {
|
|
1817
1873
|
onClose();
|
|
1818
1874
|
onMove(deal, s.id);
|
|
1819
1875
|
}, children: [
|
|
@@ -1854,8 +1910,10 @@ function StageCards({ stageId, deals, total, onLoadMore, loadMoreLabel, savingDe
|
|
|
1854
1910
|
deal.id
|
|
1855
1911
|
)),
|
|
1856
1912
|
onLoadMore && total !== void 0 && total > deals.length && /* @__PURE__ */ jsx(
|
|
1857
|
-
|
|
1913
|
+
Button,
|
|
1858
1914
|
{
|
|
1915
|
+
variant: "bare",
|
|
1916
|
+
size: "bare",
|
|
1859
1917
|
type: "button",
|
|
1860
1918
|
onClick: onLoadMore,
|
|
1861
1919
|
className: "w-full rounded-card border border-dashed border-border py-2 text-xs font-medium text-muted-foreground transition-colors hover:border-primary/40 hover:bg-muted hover:text-foreground",
|
|
@@ -2172,19 +2230,19 @@ function PipelineView({ onDealClick, onAddLead, onOpenSettings, onStageIntent })
|
|
|
2172
2230
|
/* @__PURE__ */ jsx("span", { className: "max-w-[8rem] truncate", children: effectiveOwner === "none" ? t2("crm.leads.filters.unassigned") : effectiveOwner === myUserId ? t2("crm.leads.filters.mine") : (team ?? []).find((m) => m.userId === effectiveOwner)?.name ?? t2("crm.leads.filters.owner") })
|
|
2173
2231
|
] }),
|
|
2174
2232
|
children: [
|
|
2175
|
-
myUserId && /* @__PURE__ */ jsxs("
|
|
2233
|
+
myUserId && /* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: CHIP_ROW, onClick: () => setOwnerFilter("__me__"), children: [
|
|
2176
2234
|
/* @__PURE__ */ jsx(PersonAvatar, { name: (team ?? []).find((m) => m.userId === myUserId)?.name ?? "Eu", size: "xs" }),
|
|
2177
2235
|
" ",
|
|
2178
2236
|
t2("crm.leads.filters.mine"),
|
|
2179
2237
|
effectiveOwner === myUserId && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 shrink-0" })
|
|
2180
2238
|
] }),
|
|
2181
|
-
/* @__PURE__ */ jsxs("
|
|
2239
|
+
/* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: CHIP_ROW, onClick: () => setOwnerFilter("none"), children: [
|
|
2182
2240
|
/* @__PURE__ */ jsx(UserRound, { className: "h-3 w-3 text-muted-foreground" }),
|
|
2183
2241
|
" ",
|
|
2184
2242
|
t2("crm.leads.filters.unassigned"),
|
|
2185
2243
|
effectiveOwner === "none" && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 shrink-0" })
|
|
2186
2244
|
] }),
|
|
2187
|
-
(team ?? []).filter((m) => m.userId !== myUserId).map((m) => /* @__PURE__ */ jsxs("
|
|
2245
|
+
(team ?? []).filter((m) => m.userId !== myUserId).map((m) => /* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: CHIP_ROW, onClick: () => setOwnerFilter(m.userId), children: [
|
|
2188
2246
|
/* @__PURE__ */ jsx(PersonAvatar, { name: m.name, size: "xs" }),
|
|
2189
2247
|
" ",
|
|
2190
2248
|
/* @__PURE__ */ jsx("span", { className: "truncate", children: m.name }),
|
|
@@ -2203,7 +2261,7 @@ function PipelineView({ onDealClick, onAddLead, onOpenSettings, onStageIntent })
|
|
|
2203
2261
|
/* @__PURE__ */ jsx(CalendarDays, { className: "h-3 w-3" }),
|
|
2204
2262
|
t2(`crm.filters.period${period === "custom" ? "Custom" : period}`)
|
|
2205
2263
|
] }),
|
|
2206
|
-
children: ["24h", "7d", "custom"].map((p) => /* @__PURE__ */ jsxs("
|
|
2264
|
+
children: ["24h", "7d", "custom"].map((p) => /* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: CHIP_ROW, onClick: () => setPeriod(p), children: [
|
|
2207
2265
|
t2(`crm.filters.period${p === "custom" ? "Custom" : p}`),
|
|
2208
2266
|
period === p && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 shrink-0" })
|
|
2209
2267
|
] }, p))
|
|
@@ -2224,8 +2282,10 @@ function PipelineView({ onDealClick, onAddLead, onOpenSettings, onStageIntent })
|
|
|
2224
2282
|
children: [.../* @__PURE__ */ new Set([...availableTags, ...selectedTags])].sort((a, b) => (tagDefs.get(a)?.name ?? humanizeTag(a)).localeCompare(tagDefs.get(b)?.name ?? humanizeTag(b))).map((slug) => {
|
|
2225
2283
|
const on = selectedTags.includes(slug);
|
|
2226
2284
|
return /* @__PURE__ */ jsxs(
|
|
2227
|
-
|
|
2285
|
+
Button,
|
|
2228
2286
|
{
|
|
2287
|
+
variant: "bare",
|
|
2288
|
+
size: "bare",
|
|
2229
2289
|
className: CHIP_ROW,
|
|
2230
2290
|
onClick: () => setSelectedTags(on ? selectedTags.filter((s) => s !== slug) : [...selectedTags, slug]),
|
|
2231
2291
|
children: [
|
|
@@ -2255,13 +2315,13 @@ function PipelineView({ onDealClick, onAddLead, onOpenSettings, onStageIntent })
|
|
|
2255
2315
|
header: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
2256
2316
|
/* @__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" }),
|
|
2257
2317
|
/* @__PURE__ */ jsx(
|
|
2258
|
-
|
|
2318
|
+
Input,
|
|
2259
2319
|
{
|
|
2260
2320
|
type: "text",
|
|
2261
2321
|
value: search,
|
|
2262
2322
|
onChange: (e) => setSearch(e.target.value),
|
|
2263
2323
|
placeholder: t2("crm.deals.searchPlaceholder"),
|
|
2264
|
-
className: "h-8
|
|
2324
|
+
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"
|
|
2265
2325
|
}
|
|
2266
2326
|
)
|
|
2267
2327
|
] }),
|
|
@@ -2376,8 +2436,10 @@ function PipelineView({ onDealClick, onAddLead, onOpenSettings, onStageIntent })
|
|
|
2376
2436
|
count: (col) => query ? (displayBoard.get(col.id) ?? []).length : dealStageTotals.get(col.id) ?? (displayBoard.get(col.id) ?? []).length,
|
|
2377
2437
|
isOver: (col) => dragOverStageId === col.id,
|
|
2378
2438
|
columnAction: onAddLead ? (col) => /* @__PURE__ */ jsx(
|
|
2379
|
-
|
|
2439
|
+
Button,
|
|
2380
2440
|
{
|
|
2441
|
+
variant: "bare",
|
|
2442
|
+
size: "bare",
|
|
2381
2443
|
onClick: (e) => {
|
|
2382
2444
|
e.stopPropagation();
|
|
2383
2445
|
onAddLead(col.id);
|
|
@@ -2926,13 +2988,13 @@ function DealListView({ onOpenDeal }) {
|
|
|
2926
2988
|
/* @__PURE__ */ jsxs("div", { className: "relative min-w-[12rem] flex-1", children: [
|
|
2927
2989
|
/* @__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" }),
|
|
2928
2990
|
/* @__PURE__ */ jsx(
|
|
2929
|
-
|
|
2991
|
+
Input,
|
|
2930
2992
|
{
|
|
2931
2993
|
type: "text",
|
|
2932
2994
|
value: search,
|
|
2933
2995
|
onChange: (e) => setSearch(e.target.value),
|
|
2934
2996
|
placeholder: t2("crm.deals.searchPlaceholder"),
|
|
2935
|
-
className: "
|
|
2997
|
+
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"
|
|
2936
2998
|
}
|
|
2937
2999
|
)
|
|
2938
3000
|
] }),
|
|
@@ -3030,11 +3092,12 @@ function DealListView({ onOpenDeal }) {
|
|
|
3030
3092
|
),
|
|
3031
3093
|
filtersMenu,
|
|
3032
3094
|
filtrosAtivos > 0 && /* @__PURE__ */ jsxs(
|
|
3033
|
-
|
|
3095
|
+
Button,
|
|
3034
3096
|
{
|
|
3035
3097
|
type: "button",
|
|
3098
|
+
variant: "ghost",
|
|
3036
3099
|
onClick: limparFiltros,
|
|
3037
|
-
className: "
|
|
3100
|
+
className: "h-auto shrink-0 gap-1 rounded-full px-2 py-1 text-xs font-medium text-muted-foreground",
|
|
3038
3101
|
children: [
|
|
3039
3102
|
/* @__PURE__ */ jsx(X, { className: "h-3 w-3 shrink-0" }),
|
|
3040
3103
|
t2("crm.leads.filters.clear")
|
|
@@ -3083,25 +3146,29 @@ function DealListView({ onOpenDeal }) {
|
|
|
3083
3146
|
}) }),
|
|
3084
3147
|
totalPages > 1 && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
3085
3148
|
/* @__PURE__ */ jsx(
|
|
3086
|
-
|
|
3149
|
+
Button,
|
|
3087
3150
|
{
|
|
3088
3151
|
type: "button",
|
|
3089
3152
|
"aria-label": t2("crud.list.prevPage"),
|
|
3090
3153
|
disabled: page <= 1,
|
|
3091
3154
|
onClick: () => setPage((p) => p - 1),
|
|
3092
|
-
|
|
3155
|
+
variant: "ghost",
|
|
3156
|
+
size: "icon",
|
|
3157
|
+
className: "h-7 w-7 rounded-md text-muted-foreground disabled:opacity-40",
|
|
3093
3158
|
children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" })
|
|
3094
3159
|
}
|
|
3095
3160
|
),
|
|
3096
3161
|
/* @__PURE__ */ jsx("span", { className: "px-1 text-xs tabular-nums text-muted-foreground", children: t2("crud.list.pageOf", { page: String(page), pages: String(totalPages) }) }),
|
|
3097
3162
|
/* @__PURE__ */ jsx(
|
|
3098
|
-
|
|
3163
|
+
Button,
|
|
3099
3164
|
{
|
|
3100
3165
|
type: "button",
|
|
3101
3166
|
"aria-label": t2("crud.list.nextPage"),
|
|
3102
3167
|
disabled: page >= totalPages,
|
|
3103
3168
|
onClick: () => setPage((p) => p + 1),
|
|
3104
|
-
|
|
3169
|
+
variant: "ghost",
|
|
3170
|
+
size: "icon",
|
|
3171
|
+
className: "h-7 w-7 rounded-md text-muted-foreground disabled:opacity-40",
|
|
3105
3172
|
children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
|
|
3106
3173
|
}
|
|
3107
3174
|
)
|
|
@@ -3208,12 +3275,14 @@ function DealFunnelView({ onStageClick }) {
|
|
|
3208
3275
|
const topW = widthOf(stage.dealCount);
|
|
3209
3276
|
const botW = next ? widthOf(next.dealCount) : Math.max(topW - 14, 8);
|
|
3210
3277
|
return /* @__PURE__ */ jsxs(
|
|
3211
|
-
|
|
3278
|
+
Button,
|
|
3212
3279
|
{
|
|
3213
3280
|
type: "button",
|
|
3281
|
+
variant: "bare",
|
|
3282
|
+
size: "bare",
|
|
3214
3283
|
onClick: onStageClick ? () => onStageClick(stage.stageId) : void 0,
|
|
3215
3284
|
title: onStageClick ? `${stage.stageName} \u2014 ${t2("crm.deals.viewList")}` : stage.stageName,
|
|
3216
|
-
className: "group relative block h-12 w-full cursor-pointer",
|
|
3285
|
+
className: "group relative block h-12 w-full cursor-pointer rounded-none",
|
|
3217
3286
|
children: [
|
|
3218
3287
|
/* @__PURE__ */ jsx(
|
|
3219
3288
|
"div",
|
|
@@ -3274,38 +3343,29 @@ var TRANSITIONS = {
|
|
|
3274
3343
|
};
|
|
3275
3344
|
function RejectModal({ onConfirm, onCancel }) {
|
|
3276
3345
|
const [reason, setReason] = useState("");
|
|
3277
|
-
return
|
|
3278
|
-
|
|
3279
|
-
|
|
3346
|
+
return /* @__PURE__ */ jsx(Modal, { open: true, onOpenChange: (open) => {
|
|
3347
|
+
if (!open) onCancel();
|
|
3348
|
+
}, children: /* @__PURE__ */ jsxs(ModalContent, { className: "max-w-sm", children: [
|
|
3349
|
+
/* @__PURE__ */ jsxs(ModalHeader, { children: [
|
|
3350
|
+
/* @__PURE__ */ jsx(ModalTitle, { children: "Reject Quote" }),
|
|
3351
|
+
/* @__PURE__ */ jsx(ModalDescription, { children: "Provide a reason for the rejection." })
|
|
3352
|
+
] }),
|
|
3353
|
+
/* @__PURE__ */ jsx(ModalBody, { children: /* @__PURE__ */ jsx(
|
|
3354
|
+
Textarea,
|
|
3280
3355
|
{
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-0.5", children: "Provide a reason for the rejection." })
|
|
3288
|
-
] }),
|
|
3289
|
-
/* @__PURE__ */ jsx(
|
|
3290
|
-
"textarea",
|
|
3291
|
-
{
|
|
3292
|
-
value: reason,
|
|
3293
|
-
onChange: (e) => setReason(e.target.value),
|
|
3294
|
-
rows: 3,
|
|
3295
|
-
placeholder: "Reason for rejection...",
|
|
3296
|
-
autoFocus: true,
|
|
3297
|
-
className: "w-full rounded-input border border-input bg-card px-3 py-2 text-sm shadow-[inset_0_1px_0_rgb(0_0_0_/0.06)] focus:outline-none focus:ring-2 focus:ring-ring resize-none"
|
|
3298
|
-
}
|
|
3299
|
-
),
|
|
3300
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2 mt-3", children: [
|
|
3301
|
-
/* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", onClick: onCancel, children: "Cancel" }),
|
|
3302
|
-
/* @__PURE__ */ jsx(Button, { variant: "destructive", size: "sm", onClick: () => onConfirm(reason), disabled: !reason.trim(), children: "Reject Quote" })
|
|
3303
|
-
] })
|
|
3304
|
-
]
|
|
3356
|
+
value: reason,
|
|
3357
|
+
onChange: (e) => setReason(e.target.value),
|
|
3358
|
+
rows: 3,
|
|
3359
|
+
placeholder: "Reason for rejection...",
|
|
3360
|
+
autoFocus: true,
|
|
3361
|
+
className: "resize-none"
|
|
3305
3362
|
}
|
|
3306
3363
|
) }),
|
|
3307
|
-
|
|
3308
|
-
|
|
3364
|
+
/* @__PURE__ */ jsxs(ModalFooter, { children: [
|
|
3365
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", onClick: onCancel, children: "Cancel" }),
|
|
3366
|
+
/* @__PURE__ */ jsx(Button, { variant: "destructive", size: "sm", onClick: () => onConfirm(reason), disabled: !reason.trim(), children: "Reject Quote" })
|
|
3367
|
+
] })
|
|
3368
|
+
] }) });
|
|
3309
3369
|
}
|
|
3310
3370
|
function QuoteStatusDropdown({ quote, onStatusChange, size = "default" }) {
|
|
3311
3371
|
const sendQuote = useCrmStore((s) => s.sendQuote);
|
|
@@ -3365,11 +3425,13 @@ function QuoteStatusDropdown({ quote, onStatusChange, size = "default" }) {
|
|
|
3365
3425
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3366
3426
|
/* @__PURE__ */ jsxs(Dropdown, { children: [
|
|
3367
3427
|
/* @__PURE__ */ jsx(DropdownTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
3368
|
-
|
|
3428
|
+
Button,
|
|
3369
3429
|
{
|
|
3430
|
+
variant: "bare",
|
|
3431
|
+
size: "bare",
|
|
3370
3432
|
onClick: (e) => e.stopPropagation(),
|
|
3371
3433
|
disabled: loading,
|
|
3372
|
-
className: `
|
|
3434
|
+
className: `gap-1 rounded-full font-medium capitalize transition-all ${config.bg} ${isSmall ? "px-1.5 py-0.5 text-[9px]" : "px-2.5 py-1 text-[11px]"} hover:ring-2 hover:ring-primary/20 focus:outline-none focus:ring-2 focus:ring-ring`,
|
|
3373
3435
|
children: [
|
|
3374
3436
|
!isSmall && /* @__PURE__ */ jsx(StatusIcon, { className: "h-3 w-3" }),
|
|
3375
3437
|
config.label,
|
|
@@ -3594,9 +3656,11 @@ function AutomationBolt({ activityType, messages, className = "" }) {
|
|
|
3594
3656
|
const active = hits.some((m) => m.enabled);
|
|
3595
3657
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3596
3658
|
/* @__PURE__ */ jsx(
|
|
3597
|
-
|
|
3659
|
+
Button,
|
|
3598
3660
|
{
|
|
3599
3661
|
type: "button",
|
|
3662
|
+
variant: "bare",
|
|
3663
|
+
size: "bare",
|
|
3600
3664
|
onClick: (e) => {
|
|
3601
3665
|
e.stopPropagation();
|
|
3602
3666
|
if (Detail) setOpen(true);
|
|
@@ -3604,7 +3668,11 @@ function AutomationBolt({ activityType, messages, className = "" }) {
|
|
|
3604
3668
|
},
|
|
3605
3669
|
title: describe(hits),
|
|
3606
3670
|
"aria-label": describe(hits),
|
|
3607
|
-
className:
|
|
3671
|
+
className: cn(
|
|
3672
|
+
"shrink-0 rounded",
|
|
3673
|
+
active ? "text-primary hover:text-primary/70" : "text-muted-foreground/40 hover:text-muted-foreground",
|
|
3674
|
+
className
|
|
3675
|
+
),
|
|
3608
3676
|
children: /* @__PURE__ */ jsx(Zap, { className: `h-3.5 w-3.5 ${active ? "fill-current" : ""}` })
|
|
3609
3677
|
}
|
|
3610
3678
|
),
|
|
@@ -3861,6 +3929,7 @@ function PartnerOnlineBookingCell({ value }) {
|
|
|
3861
3929
|
const t2 = useTranslation();
|
|
3862
3930
|
return value ? /* @__PURE__ */ jsx(Badge, { children: t2("common.yes") }) : /* @__PURE__ */ jsx(Badge, { variant: "secondary", children: t2("common.no") });
|
|
3863
3931
|
}
|
|
3932
|
+
var ROW_ACTION = "rounded p-1 text-muted-foreground hover:bg-muted disabled:opacity-30";
|
|
3864
3933
|
var loadMembers = loadTeam;
|
|
3865
3934
|
function AssigneeRotaInput({ value, onChange }) {
|
|
3866
3935
|
const t2 = useTranslation();
|
|
@@ -3893,52 +3962,48 @@ function AssigneeRotaInput({ value, onChange }) {
|
|
|
3893
3962
|
/* @__PURE__ */ jsx("span", { className: "w-5 text-xs tabular-nums text-muted-foreground", children: i + 1 }),
|
|
3894
3963
|
/* @__PURE__ */ jsx("span", { className: "flex-1 text-sm", children: nameOf(id) }),
|
|
3895
3964
|
/* @__PURE__ */ jsx(
|
|
3896
|
-
|
|
3965
|
+
Button,
|
|
3897
3966
|
{
|
|
3898
3967
|
type: "button",
|
|
3968
|
+
variant: "bare",
|
|
3969
|
+
size: "bare",
|
|
3899
3970
|
onClick: () => move(i, -1),
|
|
3900
3971
|
disabled: i === 0,
|
|
3901
|
-
className:
|
|
3972
|
+
className: ROW_ACTION,
|
|
3902
3973
|
title: t2("crm.rota.up"),
|
|
3903
3974
|
children: /* @__PURE__ */ jsx(ArrowUp, { className: "h-3.5 w-3.5" })
|
|
3904
3975
|
}
|
|
3905
3976
|
),
|
|
3906
3977
|
/* @__PURE__ */ jsx(
|
|
3907
|
-
|
|
3978
|
+
Button,
|
|
3908
3979
|
{
|
|
3909
3980
|
type: "button",
|
|
3981
|
+
variant: "bare",
|
|
3982
|
+
size: "bare",
|
|
3910
3983
|
onClick: () => move(i, 1),
|
|
3911
3984
|
disabled: i === rota.length - 1,
|
|
3912
|
-
className:
|
|
3985
|
+
className: ROW_ACTION,
|
|
3913
3986
|
title: t2("crm.rota.down"),
|
|
3914
3987
|
children: /* @__PURE__ */ jsx(ArrowDown, { className: "h-3.5 w-3.5" })
|
|
3915
3988
|
}
|
|
3916
3989
|
),
|
|
3917
3990
|
/* @__PURE__ */ jsx(
|
|
3918
|
-
|
|
3991
|
+
Button,
|
|
3919
3992
|
{
|
|
3920
3993
|
type: "button",
|
|
3994
|
+
variant: "bare",
|
|
3995
|
+
size: "bare",
|
|
3921
3996
|
onClick: () => onChange(rota.filter((x) => x !== id)),
|
|
3922
|
-
className:
|
|
3997
|
+
className: `${ROW_ACTION} hover:text-destructive`,
|
|
3923
3998
|
title: t2("crm.rota.remove"),
|
|
3924
3999
|
children: /* @__PURE__ */ jsx(X, { className: "h-3.5 w-3.5" })
|
|
3925
4000
|
}
|
|
3926
4001
|
)
|
|
3927
4002
|
] }, id)) }),
|
|
3928
|
-
available.length > 0 && /* @__PURE__ */ jsxs(
|
|
3929
|
-
"
|
|
3930
|
-
{
|
|
3931
|
-
|
|
3932
|
-
onChange: (e) => {
|
|
3933
|
-
if (e.target.value) onChange([...rota, e.target.value]);
|
|
3934
|
-
},
|
|
3935
|
-
className: "w-full rounded-input border border-input bg-background px-2 py-1.5 text-sm",
|
|
3936
|
-
children: [
|
|
3937
|
-
/* @__PURE__ */ jsx("option", { value: "", children: t2("crm.rota.add") }),
|
|
3938
|
-
available.map((m) => /* @__PURE__ */ jsx("option", { value: m.userId, children: m.name }, m.userId))
|
|
3939
|
-
]
|
|
3940
|
-
}
|
|
3941
|
-
)
|
|
4003
|
+
available.length > 0 && /* @__PURE__ */ jsxs(Select, { value: "", onValueChange: (v) => onChange([...rota, v]), children: [
|
|
4004
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-auto bg-background px-2 py-1.5 shadow-none", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: t2("crm.rota.add") }) }),
|
|
4005
|
+
/* @__PURE__ */ jsx(SelectContent, { children: available.map((m) => /* @__PURE__ */ jsx(SelectItem, { value: m.userId, children: m.name }, m.userId)) })
|
|
4006
|
+
] })
|
|
3942
4007
|
] });
|
|
3943
4008
|
}
|
|
3944
4009
|
function AssigneeRotaCell({ value }) {
|
|
@@ -4455,14 +4520,15 @@ function LinkCompanyPrompt({ personId, companyText, onLinked }) {
|
|
|
4455
4520
|
/* @__PURE__ */ jsx("span", { className: "block text-[11px] text-muted-foreground", children: t2(existente ? "crm.linkCompany.hintExisting" : "crm.linkCompany.hintNew") })
|
|
4456
4521
|
] }),
|
|
4457
4522
|
/* @__PURE__ */ jsxs(
|
|
4458
|
-
|
|
4523
|
+
Button,
|
|
4459
4524
|
{
|
|
4460
4525
|
type: "button",
|
|
4526
|
+
size: "sm",
|
|
4461
4527
|
onClick: () => {
|
|
4462
4528
|
void vincular();
|
|
4463
4529
|
},
|
|
4464
4530
|
disabled: ligando,
|
|
4465
|
-
className: "
|
|
4531
|
+
className: "h-7 shrink-0 px-3 font-medium disabled:opacity-60",
|
|
4466
4532
|
children: [
|
|
4467
4533
|
ligando ? /* @__PURE__ */ jsx(Loader2, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ jsx(Plus, { className: "h-3 w-3" }),
|
|
4468
4534
|
t2(existente ? "crm.linkCompany.link" : "crm.linkCompany.create")
|
|
@@ -4554,18 +4620,6 @@ function Section({ title, action, children }) {
|
|
|
4554
4620
|
children
|
|
4555
4621
|
] });
|
|
4556
4622
|
}
|
|
4557
|
-
function Field({ label: label2, children }) {
|
|
4558
|
-
return /* @__PURE__ */ jsxs("label", { className: "block space-y-1", children: [
|
|
4559
|
-
/* @__PURE__ */ jsx("span", { className: "text-[11px] font-medium text-muted-foreground", children: label2 }),
|
|
4560
|
-
children
|
|
4561
|
-
] });
|
|
4562
|
-
}
|
|
4563
|
-
function InfoRow({ label: label2, value }) {
|
|
4564
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
|
|
4565
|
-
/* @__PURE__ */ jsx("p", { className: "text-[11px] font-medium text-muted-foreground", children: label2 }),
|
|
4566
|
-
/* @__PURE__ */ jsx("div", { className: "text-sm", children: value || /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "\u2014" }) })
|
|
4567
|
-
] });
|
|
4568
|
-
}
|
|
4569
4623
|
function QuickAction({ icon: Icon, label: label2, onClick, href: href2 }) {
|
|
4570
4624
|
const disabled = !onClick && !href2;
|
|
4571
4625
|
const circle = /* @__PURE__ */ jsx("span", { className: "flex h-9 w-9 items-center justify-center rounded-full border bg-card shadow-sm transition-colors " + (disabled ? "opacity-40" : "hover:bg-muted"), children: /* @__PURE__ */ jsx(Icon, { className: "h-4 w-4 text-muted-foreground" }) });
|
|
@@ -4576,11 +4630,12 @@ function QuickAction({ icon: Icon, label: label2, onClick, href: href2 }) {
|
|
|
4576
4630
|
caption
|
|
4577
4631
|
] });
|
|
4578
4632
|
}
|
|
4579
|
-
return /* @__PURE__ */ jsxs(
|
|
4633
|
+
return /* @__PURE__ */ jsxs(Button, { type: "button", variant: "bare", size: "bare", onClick, disabled, className: "flex flex-col gap-1 font-normal disabled:opacity-100", children: [
|
|
4580
4634
|
circle,
|
|
4581
4635
|
caption
|
|
4582
4636
|
] });
|
|
4583
4637
|
}
|
|
4638
|
+
var COMPOSER_FIELD = "min-h-0 resize-none rounded-lg border-border bg-background shadow-none focus-visible:ring-offset-0";
|
|
4584
4639
|
function formatDocument(doc) {
|
|
4585
4640
|
const d = doc.replace(/\D/g, "");
|
|
4586
4641
|
if (d.length === 14) return d.replace(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/, "$1.$2.$3/$4-$5");
|
|
@@ -4590,9 +4645,11 @@ function formatDocument(doc) {
|
|
|
4590
4645
|
function CopyDocument({ document: doc, label: label2 }) {
|
|
4591
4646
|
const [copied, setCopied] = React__default.useState(false);
|
|
4592
4647
|
return /* @__PURE__ */ jsx(
|
|
4593
|
-
|
|
4648
|
+
Button,
|
|
4594
4649
|
{
|
|
4595
4650
|
type: "button",
|
|
4651
|
+
variant: "ghost",
|
|
4652
|
+
size: "icon",
|
|
4596
4653
|
onClick: (e) => {
|
|
4597
4654
|
e.stopPropagation();
|
|
4598
4655
|
void navigator.clipboard?.writeText(doc.replace(/\D/g, "")).then(() => {
|
|
@@ -4603,7 +4660,7 @@ function CopyDocument({ document: doc, label: label2 }) {
|
|
|
4603
4660
|
},
|
|
4604
4661
|
title: label2,
|
|
4605
4662
|
"aria-label": label2,
|
|
4606
|
-
className: "
|
|
4663
|
+
className: "h-6 w-6 shrink-0 rounded-md text-muted-foreground",
|
|
4607
4664
|
children: copied ? /* @__PURE__ */ jsx(Check, { className: "h-3.5 w-3.5 text-success" }) : /* @__PURE__ */ jsx(Clipboard, { className: "h-3.5 w-3.5" })
|
|
4608
4665
|
}
|
|
4609
4666
|
);
|
|
@@ -4626,11 +4683,12 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
4626
4683
|
const [contato, setContato] = useState(null);
|
|
4627
4684
|
const [stages, setStages] = useState([]);
|
|
4628
4685
|
const [activities, setActivities] = useState([]);
|
|
4629
|
-
const [quotes2, setQuotes] = useState(
|
|
4686
|
+
const [quotes2, setQuotes] = useState(null);
|
|
4687
|
+
const [companyPending, setCompanyPending] = useState(true);
|
|
4688
|
+
const [personPending, setPersonPending] = useState(true);
|
|
4630
4689
|
const [loading, setLoading] = useState(true);
|
|
4631
4690
|
const [activitiesLoading, setActivitiesLoading] = useState(true);
|
|
4632
4691
|
const [movingStage, setMovingStage] = useState(false);
|
|
4633
|
-
const [saving, setSaving] = useState(false);
|
|
4634
4692
|
const [closing, setClosing] = useState(false);
|
|
4635
4693
|
const [askingLost, setAskingLost] = useState(false);
|
|
4636
4694
|
const [draft, setDraft] = useState(null);
|
|
@@ -4646,7 +4704,6 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
4646
4704
|
const [myUserId, setMyUserId] = useState(null);
|
|
4647
4705
|
const [savingOwner, setSavingOwner] = useState(false);
|
|
4648
4706
|
const [score, setScore] = useState(void 0);
|
|
4649
|
-
const [editing, setEditing] = useState(false);
|
|
4650
4707
|
const wide = useIsWide();
|
|
4651
4708
|
const createActivity = useCrmStore((s) => s.createActivity);
|
|
4652
4709
|
const [ctypes, setCtypes] = useState(() => DEFAULT_ACTIVITY_TYPES);
|
|
@@ -4721,12 +4778,13 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
4721
4778
|
setSyncedDealId(dealId);
|
|
4722
4779
|
setLead(null);
|
|
4723
4780
|
setActivities([]);
|
|
4724
|
-
setQuotes(
|
|
4781
|
+
setQuotes(null);
|
|
4725
4782
|
setCompany(null);
|
|
4783
|
+
setCompanyPending(true);
|
|
4784
|
+
setPersonPending(true);
|
|
4726
4785
|
setPessoasDaCasa([]);
|
|
4727
4786
|
setStages([]);
|
|
4728
4787
|
setScore(void 0);
|
|
4729
|
-
setEditing(false);
|
|
4730
4788
|
setComposerOpen(false);
|
|
4731
4789
|
if (seed && seed.id === dealId) {
|
|
4732
4790
|
setDeal(seed);
|
|
@@ -4817,6 +4875,8 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
4817
4875
|
setDeal(d);
|
|
4818
4876
|
if (!d) {
|
|
4819
4877
|
setLoading(false);
|
|
4878
|
+
setCompanyPending(false);
|
|
4879
|
+
setPersonPending(false);
|
|
4820
4880
|
return;
|
|
4821
4881
|
}
|
|
4822
4882
|
void loadTeamOrNull({ unitId: d.unitId }).then((team2) => {
|
|
@@ -4829,8 +4889,12 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
4829
4889
|
}
|
|
4830
4890
|
const leadP = d.leadId ? provider.getLeadById(d.leadId) : Promise.resolve(null);
|
|
4831
4891
|
const contatoP = d.contactId && d.contactId !== d.leadId ? provider.getLeadById(d.contactId).catch(() => null) : Promise.resolve(null);
|
|
4832
|
-
void Promise.all([leadP, contatoP]).
|
|
4892
|
+
void Promise.all([leadP, contatoP]).catch(() => {
|
|
4893
|
+
if (!cancelled) setCompanyPending(false);
|
|
4894
|
+
return [null, null];
|
|
4895
|
+
}).then(([l, c]) => {
|
|
4833
4896
|
if (cancelled) return;
|
|
4897
|
+
setPersonPending(false);
|
|
4834
4898
|
setLead(l);
|
|
4835
4899
|
setContato(c);
|
|
4836
4900
|
const p = c ?? l;
|
|
@@ -4854,9 +4918,13 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
4854
4918
|
setScore(null);
|
|
4855
4919
|
}
|
|
4856
4920
|
const companyId = d.companyId ?? p?.companyId;
|
|
4921
|
+
if (!companyId) setCompanyPending(false);
|
|
4857
4922
|
if (companyId) {
|
|
4858
4923
|
void provider.getCompanyById(companyId).then((c2) => {
|
|
4859
4924
|
if (!cancelled) setCompany(c2);
|
|
4925
|
+
}).catch(() => {
|
|
4926
|
+
}).finally(() => {
|
|
4927
|
+
if (!cancelled) setCompanyPending(false);
|
|
4860
4928
|
});
|
|
4861
4929
|
void provider.getCompanyGroupPeople(companyId).catch(() => []).then((gente) => {
|
|
4862
4930
|
if (!cancelled) setPessoasDaCasa(gente);
|
|
@@ -4871,6 +4939,8 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
4871
4939
|
});
|
|
4872
4940
|
void provider.getQuotesByDealId(dealId).then((q) => {
|
|
4873
4941
|
if (!cancelled) setQuotes(q);
|
|
4942
|
+
}, () => {
|
|
4943
|
+
if (!cancelled) setQuotes([]);
|
|
4874
4944
|
});
|
|
4875
4945
|
void loadMyUserId().then((u) => {
|
|
4876
4946
|
if (!cancelled) setMyUserId(u);
|
|
@@ -4965,41 +5035,59 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
4965
5035
|
setSavingOwner(false);
|
|
4966
5036
|
}
|
|
4967
5037
|
}
|
|
4968
|
-
async function
|
|
4969
|
-
if (!deal || !draft
|
|
4970
|
-
|
|
5038
|
+
async function saveField(key, raw) {
|
|
5039
|
+
if (!deal || !draft) return;
|
|
5040
|
+
const text = typeof raw === "string" ? raw.trim() : "";
|
|
5041
|
+
if (key === "name" && !text) return;
|
|
4971
5042
|
try {
|
|
4972
|
-
if (
|
|
4973
|
-
await
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
});
|
|
5043
|
+
if (key === "value" || key === "expectedCloseDate" || key === "notes") {
|
|
5044
|
+
const patched = await provider.updateDeal(deal.id, key === "value" ? { value: Number(raw) || 0 } : { [key]: text || void 0 });
|
|
5045
|
+
setDeal(patched);
|
|
5046
|
+
setDraft((d) => d ? { ...d, [key]: key === "value" ? Number(raw) || 0 : text } : d);
|
|
5047
|
+
} else if (pessoaDoCard) {
|
|
5048
|
+
await updateLead(pessoaDoCard.id, { [key]: text || void 0 });
|
|
5049
|
+
const repintada = (x) => ({ ...x, [key]: text || (key === "name" ? x.name : "") });
|
|
5050
|
+
if (contato) setContato(repintada(contato));
|
|
5051
|
+
else if (lead) setLead(repintada(lead));
|
|
5052
|
+
setDraft((d) => d ? { ...d, [key]: text } : d);
|
|
5053
|
+
if (key === "name") setDeal((d) => d && d.contactId === pessoaDoCard.id ? { ...d, contactName: text } : d);
|
|
4979
5054
|
}
|
|
4980
|
-
const patched = await provider.updateDeal(deal.id, {
|
|
4981
|
-
value: draft.value,
|
|
4982
|
-
expectedCloseDate: draft.expectedCloseDate || void 0,
|
|
4983
|
-
notes: draft.notes.trim() || void 0
|
|
4984
|
-
});
|
|
4985
|
-
setDeal(patched);
|
|
4986
|
-
const repintada = (x) => ({ ...x, name: draft.name.trim() || x.name, email: draft.email, phone: draft.phone, company: draft.company });
|
|
4987
|
-
if (contato) setContato(repintada(contato));
|
|
4988
|
-
else if (lead) setLead(repintada(lead));
|
|
4989
5055
|
toast.success(t2("crm.card.saved"));
|
|
4990
5056
|
} catch (err) {
|
|
4991
5057
|
toast.error(t2("crm.card.saveFailed"), { description: err?.message });
|
|
4992
|
-
} finally {
|
|
4993
|
-
setSaving(false);
|
|
4994
5058
|
}
|
|
4995
5059
|
}
|
|
5060
|
+
async function saveCompanyName(raw) {
|
|
5061
|
+
const name = typeof raw === "string" ? raw.trim() : "";
|
|
5062
|
+
if (!name) return;
|
|
5063
|
+
if (!company) return saveField("company", name);
|
|
5064
|
+
try {
|
|
5065
|
+
setCompany(await provider.saveCompany({ id: company.id, name }));
|
|
5066
|
+
setDeal((d) => d && d.companyName === company.name ? { ...d, companyName: name } : d);
|
|
5067
|
+
toast.success(t2("crm.card.saved"));
|
|
5068
|
+
} catch (err) {
|
|
5069
|
+
toast.error(t2("crm.card.saveFailed"), { description: err?.message });
|
|
5070
|
+
}
|
|
5071
|
+
}
|
|
5072
|
+
const headline = deal ? dealHeadline(deal) : "";
|
|
5073
|
+
const headlineSave = !deal || deal.groupName ? void 0 : deal.companyName ? company ? saveCompanyName : void 0 : deal.contactName && pessoaDoCard ? (v) => saveField("name", v) : void 0;
|
|
4996
5074
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4997
5075
|
/* @__PURE__ */ jsx(Modal, { open, onOpenChange: (o) => {
|
|
4998
5076
|
if (!o) onClose();
|
|
4999
5077
|
}, children: /* @__PURE__ */ jsxs(ModalContent, { size: "5xl", noPadding: true, children: [
|
|
5000
5078
|
/* @__PURE__ */ jsxs(ModalHeader, { className: "flex-col items-stretch gap-2 border-b px-5 py-3", children: [
|
|
5001
5079
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
5002
|
-
/* @__PURE__ */ jsx(ModalTitle, { className: "min-w-0 flex-1 truncate text-base", children: loading && !deal ? /* @__PURE__ */ jsx("span", { className: "inline-block h-5 w-40 animate-pulse rounded bg-muted/40 align-middle" }) :
|
|
5080
|
+
/* @__PURE__ */ jsx(ModalTitle, { className: "min-w-0 flex-1 truncate text-base", children: loading && !deal ? /* @__PURE__ */ jsx("span", { className: "inline-block h-5 w-40 animate-pulse rounded bg-muted/40 align-middle" }) : /* @__PURE__ */ jsx(
|
|
5081
|
+
InlineField,
|
|
5082
|
+
{
|
|
5083
|
+
layout: "bare",
|
|
5084
|
+
t: t2,
|
|
5085
|
+
field: { key: "headline", label: deal?.companyName ? t2("crm.leadDetail.company") : t2("crm.leadDetail.name"), type: "text" },
|
|
5086
|
+
value: headline,
|
|
5087
|
+
display: /* @__PURE__ */ jsx("span", { className: "block truncate", children: headline || t2("crm.dealSidebar.deal") }),
|
|
5088
|
+
onSave: headlineSave
|
|
5089
|
+
}
|
|
5090
|
+
) }),
|
|
5003
5091
|
/* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-2 pr-8", children: [
|
|
5004
5092
|
deal?.status === "open" ? /* @__PURE__ */ jsxs(Button, { size: "sm", variant: "ghost", disabled: closing, onClick: () => setAskingLost(true), children: [
|
|
5005
5093
|
/* @__PURE__ */ jsx(ThumbsDown, { className: "h-3 w-3" }),
|
|
@@ -5048,15 +5136,17 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
5048
5136
|
journeyStages.map((s) => {
|
|
5049
5137
|
const active = s.id === deal?.stageId;
|
|
5050
5138
|
return /* @__PURE__ */ jsxs(
|
|
5051
|
-
|
|
5139
|
+
Button,
|
|
5052
5140
|
{
|
|
5053
5141
|
type: "button",
|
|
5142
|
+
variant: "bare",
|
|
5143
|
+
size: "bare",
|
|
5054
5144
|
disabled: movingStage,
|
|
5055
5145
|
onClick: () => {
|
|
5056
5146
|
void changeStage(s);
|
|
5057
5147
|
},
|
|
5058
5148
|
"aria-pressed": active,
|
|
5059
|
-
className: "
|
|
5149
|
+
className: "rounded-full border px-2.5 py-1 text-xs font-medium disabled:opacity-60 " + (active ? "border-primary bg-primary/10 text-primary" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"),
|
|
5060
5150
|
children: [
|
|
5061
5151
|
/* @__PURE__ */ jsx("span", { className: "h-2 w-2 rounded-full", style: { backgroundColor: s.color } }),
|
|
5062
5152
|
s.name
|
|
@@ -5098,8 +5188,30 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
5098
5188
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2 text-center", children: [
|
|
5099
5189
|
/* @__PURE__ */ jsx(PersonAvatar, { name: draft.name || deal?.contactName || "?", size: "md", className: "h-14 w-14 text-lg" }),
|
|
5100
5190
|
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
5101
|
-
/* @__PURE__ */ jsx(
|
|
5102
|
-
|
|
5191
|
+
/* @__PURE__ */ jsx(
|
|
5192
|
+
InlineField,
|
|
5193
|
+
{
|
|
5194
|
+
layout: "bare",
|
|
5195
|
+
className: "justify-center",
|
|
5196
|
+
t: t2,
|
|
5197
|
+
field: { key: "name", label: t2("crm.leadDetail.name"), type: "text" },
|
|
5198
|
+
value: draft.name,
|
|
5199
|
+
display: /* @__PURE__ */ jsx("span", { className: "block truncate text-sm font-semibold", children: draft.name || deal?.contactName || "\u2014" }),
|
|
5200
|
+
onSave: pessoaDoCard ? (v) => saveField("name", v) : void 0
|
|
5201
|
+
}
|
|
5202
|
+
),
|
|
5203
|
+
(company?.name || draft.company || pessoaDoCard) && /* @__PURE__ */ jsx(
|
|
5204
|
+
InlineField,
|
|
5205
|
+
{
|
|
5206
|
+
layout: "bare",
|
|
5207
|
+
className: "justify-center",
|
|
5208
|
+
t: t2,
|
|
5209
|
+
field: { key: "company", label: t2("crm.leadDetail.company"), type: "text" },
|
|
5210
|
+
value: company?.name ?? draft.company,
|
|
5211
|
+
display: /* @__PURE__ */ jsx("span", { className: "block truncate text-xs text-muted-foreground", children: company?.name ?? draft.company ?? "\u2014" }),
|
|
5212
|
+
onSave: company || pessoaDoCard ? saveCompanyName : void 0
|
|
5213
|
+
}
|
|
5214
|
+
),
|
|
5103
5215
|
pessoaDoCard?.companyRole && /* @__PURE__ */ jsx("p", { className: "truncate text-[11px] text-muted-foreground/80", children: pessoaDoCard.companyRole })
|
|
5104
5216
|
] }),
|
|
5105
5217
|
score === void 0 ? /* @__PURE__ */ jsx("span", { className: "h-5 w-20 animate-pulse rounded-full bg-muted/40", "aria-hidden": true }) : score ? /* @__PURE__ */ jsx(TemperatureBadge, { score }) : null,
|
|
@@ -5122,7 +5234,7 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
5122
5234
|
/* @__PURE__ */ jsx(QuickAction, { icon: Pencil, label: t2("crm.card.quickNote"), onClick: () => prepActivity("note") })
|
|
5123
5235
|
] })
|
|
5124
5236
|
] }),
|
|
5125
|
-
/* @__PURE__ */ jsx(Section, { title: t2("crm.card.pointOfContact"), children: /* @__PURE__ */ jsx(
|
|
5237
|
+
/* @__PURE__ */ jsx(Section, { title: t2("crm.card.pointOfContact"), children: personPending || companyPending ? /* @__PURE__ */ jsx("div", { className: "h-9 animate-pulse rounded-lg bg-muted/30", "aria-hidden": true }) : /* @__PURE__ */ jsx(
|
|
5126
5238
|
PersonPicker,
|
|
5127
5239
|
{
|
|
5128
5240
|
options: pessoasDaCasa.map((x) => ({
|
|
@@ -5141,54 +5253,62 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
5141
5253
|
disabled: trocandoContato || pessoasDaCasa.length === 0
|
|
5142
5254
|
}
|
|
5143
5255
|
) }),
|
|
5144
|
-
/* @__PURE__ */ jsx(
|
|
5145
|
-
|
|
5146
|
-
{
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5256
|
+
/* @__PURE__ */ jsx(Section, { title: t2("crm.card.about"), children: personPending ? /* @__PURE__ */ jsx("div", { className: "space-y-3", "aria-hidden": true, children: [1, 2, 3, 4].map((i) => /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
5257
|
+
/* @__PURE__ */ jsx("div", { className: "h-3 w-16 animate-pulse rounded bg-muted/30" }),
|
|
5258
|
+
/* @__PURE__ */ jsx("div", { className: "h-5 w-36 animate-pulse rounded bg-muted/40" })
|
|
5259
|
+
] }, i)) }) : /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
5260
|
+
/* @__PURE__ */ jsx(
|
|
5261
|
+
InlineField,
|
|
5262
|
+
{
|
|
5263
|
+
layout: "stacked",
|
|
5264
|
+
t: t2,
|
|
5265
|
+
field: { key: "phone", label: t2("crm.leadDetail.phone"), type: "phone" },
|
|
5266
|
+
value: draft.phone,
|
|
5267
|
+
onSave: pessoaDoCard ? (v) => saveField("phone", v) : void 0
|
|
5268
|
+
}
|
|
5269
|
+
),
|
|
5270
|
+
/* @__PURE__ */ jsx(
|
|
5271
|
+
InlineField,
|
|
5272
|
+
{
|
|
5273
|
+
layout: "stacked",
|
|
5274
|
+
t: t2,
|
|
5275
|
+
field: { key: "email", label: t2("crm.leadDetail.email"), type: "email" },
|
|
5276
|
+
value: draft.email,
|
|
5277
|
+
onSave: pessoaDoCard ? (v) => saveField("email", v) : void 0
|
|
5278
|
+
}
|
|
5279
|
+
),
|
|
5280
|
+
/* @__PURE__ */ jsx(
|
|
5281
|
+
InlineField,
|
|
5282
|
+
{
|
|
5283
|
+
layout: "stacked",
|
|
5284
|
+
t: t2,
|
|
5285
|
+
field: { key: "value", label: t2("crm.dealSidebar.value"), type: "currency" },
|
|
5286
|
+
value: draft.value || void 0,
|
|
5287
|
+
display: draft.value ? formatCurrency(draft.value, currency) : void 0,
|
|
5288
|
+
onSave: (v) => saveField("value", v)
|
|
5289
|
+
}
|
|
5290
|
+
),
|
|
5291
|
+
/* @__PURE__ */ jsx(
|
|
5292
|
+
InlineField,
|
|
5293
|
+
{
|
|
5294
|
+
layout: "stacked",
|
|
5295
|
+
t: t2,
|
|
5296
|
+
field: { key: "expectedCloseDate", label: t2("crm.dealSidebar.expectedClose"), type: "date" },
|
|
5297
|
+
value: draft.expectedCloseDate,
|
|
5298
|
+
onSave: (v) => saveField("expectedCloseDate", v)
|
|
5299
|
+
}
|
|
5300
|
+
),
|
|
5301
|
+
/* @__PURE__ */ jsx(
|
|
5302
|
+
InlineField,
|
|
5303
|
+
{
|
|
5304
|
+
layout: "stacked",
|
|
5305
|
+
t: t2,
|
|
5306
|
+
field: { key: "notes", label: t2("crm.leadDetail.notes"), type: "textarea" },
|
|
5307
|
+
value: draft.notes,
|
|
5308
|
+
onSave: (v) => saveField("notes", v)
|
|
5309
|
+
}
|
|
5310
|
+
)
|
|
5311
|
+
] }) }),
|
|
5192
5312
|
/* @__PURE__ */ jsx(Section, { title: t2("crm.card.owner"), children: team === null ? /* @__PURE__ */ jsx("div", { className: "h-9 animate-pulse rounded-lg bg-muted/40", "aria-hidden": true }) : team.length === 0 ? (
|
|
5193
5313
|
// Lista vazia aqui quase sempre é falta de `members.read`, e
|
|
5194
5314
|
// não uma casa sem equipe. Dizer "ninguém" seria mentir.
|
|
@@ -5218,13 +5338,15 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
5218
5338
|
}
|
|
5219
5339
|
),
|
|
5220
5340
|
myUserId && deal?.assignedToId !== myUserId && /* @__PURE__ */ jsxs(
|
|
5221
|
-
|
|
5341
|
+
Button,
|
|
5222
5342
|
{
|
|
5343
|
+
variant: "bare",
|
|
5344
|
+
size: "lg",
|
|
5223
5345
|
onClick: () => {
|
|
5224
5346
|
void changeOwner(myUserId);
|
|
5225
5347
|
},
|
|
5226
5348
|
disabled: savingOwner,
|
|
5227
|
-
className: "
|
|
5349
|
+
className: "shrink-0 border border-primary/30 bg-primary/5 px-3 text-xs font-medium text-primary hover:bg-primary/10 disabled:opacity-60",
|
|
5228
5350
|
children: [
|
|
5229
5351
|
/* @__PURE__ */ jsx(UserCheck, { className: "h-3.5 w-3.5" }),
|
|
5230
5352
|
deal?.assignedToId ? t2("crm.card.takeOverFrom") : t2("crm.card.takeOver")
|
|
@@ -5255,11 +5377,13 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
5255
5377
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
|
|
5256
5378
|
/* @__PURE__ */ jsx("h3", { className: "text-[11px] font-semibold uppercase tracking-wider text-muted-foreground", children: t2("crm.card.timeline") }),
|
|
5257
5379
|
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-1", children: [["all", t2("crm.card.tabAll")], ["contact", t2("crm.card.tabContacts")], ["note", t2("crm.card.tabNotes")], ["task", t2("crm.card.tabTasks")]].map(([v, label2]) => /* @__PURE__ */ jsx(
|
|
5258
|
-
|
|
5380
|
+
Button,
|
|
5259
5381
|
{
|
|
5260
5382
|
type: "button",
|
|
5383
|
+
variant: "bare",
|
|
5384
|
+
size: "bare",
|
|
5261
5385
|
onClick: () => setTimelineTab(v),
|
|
5262
|
-
className: "
|
|
5386
|
+
className: "px-2 py-0.5 text-xs " + (timelineTab === v ? "bg-primary/10 font-medium text-primary" : "font-normal text-muted-foreground hover:bg-muted hover:text-foreground"),
|
|
5263
5387
|
children: label2
|
|
5264
5388
|
},
|
|
5265
5389
|
v
|
|
@@ -5269,36 +5393,42 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
5269
5393
|
/* @__PURE__ */ jsx(ArrowRight, { className: "h-3.5 w-3.5 shrink-0 text-primary" }),
|
|
5270
5394
|
/* @__PURE__ */ jsx("span", { className: "text-foreground", children: t2("crm.card.stageIntent").replace("{from}", deal.stageName ?? "\u2014").replace("{to}", pendingStage.name) }),
|
|
5271
5395
|
/* @__PURE__ */ jsx(
|
|
5272
|
-
|
|
5396
|
+
Button,
|
|
5273
5397
|
{
|
|
5274
5398
|
type: "button",
|
|
5275
|
-
|
|
5399
|
+
variant: "bare",
|
|
5400
|
+
size: "bare",
|
|
5401
|
+
className: "ml-auto text-xs font-normal text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",
|
|
5276
5402
|
onClick: () => onPendingResolved?.(false),
|
|
5277
5403
|
children: t2("crm.card.stageIntentCancel")
|
|
5278
5404
|
}
|
|
5279
5405
|
)
|
|
5280
5406
|
] }),
|
|
5281
5407
|
!composerOpen ? /* @__PURE__ */ jsx(
|
|
5282
|
-
|
|
5408
|
+
Button,
|
|
5283
5409
|
{
|
|
5284
5410
|
type: "button",
|
|
5411
|
+
variant: "bare",
|
|
5412
|
+
size: "bare",
|
|
5285
5413
|
onClick: () => prepActivity(ctype),
|
|
5286
|
-
className: "w-full rounded-card border bg-card px-3 py-2.5 text-left
|
|
5414
|
+
className: "flex w-full justify-start whitespace-normal rounded-card border bg-card px-3 py-2.5 text-left font-normal text-muted-foreground shadow-sm hover:bg-muted/30",
|
|
5287
5415
|
children: t2("crm.followUp.placeholder")
|
|
5288
5416
|
}
|
|
5289
5417
|
) : /* @__PURE__ */ jsxs("div", { className: "space-y-2 rounded-card border bg-card p-3 shadow-sm", children: [
|
|
5290
5418
|
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: orderedTypes.map((tp) => /* @__PURE__ */ jsx(
|
|
5291
|
-
|
|
5419
|
+
Button,
|
|
5292
5420
|
{
|
|
5293
5421
|
type: "button",
|
|
5422
|
+
variant: "bare",
|
|
5423
|
+
size: "bare",
|
|
5294
5424
|
onClick: () => setCtype(tp.value),
|
|
5295
|
-
className: "rounded-full border px-2.5 py-0.5 text-[11px] font-medium
|
|
5425
|
+
className: "rounded-full border px-2.5 py-0.5 text-[11px] font-medium " + (ctype === tp.value ? "border-primary bg-primary/10 text-primary" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"),
|
|
5296
5426
|
children: tp.label
|
|
5297
5427
|
},
|
|
5298
5428
|
tp.value
|
|
5299
5429
|
)) }),
|
|
5300
5430
|
/* @__PURE__ */ jsx(
|
|
5301
|
-
|
|
5431
|
+
Textarea,
|
|
5302
5432
|
{
|
|
5303
5433
|
ref: composerRef,
|
|
5304
5434
|
rows: 2,
|
|
@@ -5311,7 +5441,7 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
5311
5441
|
}
|
|
5312
5442
|
},
|
|
5313
5443
|
placeholder: t2("crm.followUp.placeholder"),
|
|
5314
|
-
className:
|
|
5444
|
+
className: COMPOSER_FIELD
|
|
5315
5445
|
}
|
|
5316
5446
|
),
|
|
5317
5447
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
@@ -5324,12 +5454,13 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
5324
5454
|
/* @__PURE__ */ jsx(SelectContent, { children: ["connected", "no_answer", "left_message", "replied", "scheduled", "not_now"].map((o) => /* @__PURE__ */ jsx(SelectItem, { value: o, children: t2(`crm.outcome.${o}`) }, o)) })
|
|
5325
5455
|
] }),
|
|
5326
5456
|
ctype === "task" && /* @__PURE__ */ jsx(
|
|
5327
|
-
|
|
5457
|
+
DatePicker,
|
|
5328
5458
|
{
|
|
5329
|
-
|
|
5459
|
+
variant: "toolbar",
|
|
5460
|
+
format: "numeric",
|
|
5330
5461
|
value: cdue,
|
|
5331
|
-
onChange:
|
|
5332
|
-
|
|
5462
|
+
onChange: setCdue,
|
|
5463
|
+
triggerClassName: "h-8 rounded-lg bg-background px-2 font-normal shadow-none"
|
|
5333
5464
|
}
|
|
5334
5465
|
),
|
|
5335
5466
|
CONTACT_TYPES2.has(ctype) && coutcome === "not_now" && /* @__PURE__ */ jsx(FutureContactPicker, { value: cfutureDate, onChange: setCfutureDate, required: true }),
|
|
@@ -5365,7 +5496,8 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
5365
5496
|
deal.groupCompanies ? /* @__PURE__ */ jsx("span", { className: "block truncate text-[11px] text-muted-foreground", children: t2("crm.card.groupCompanies", { count: String(deal.groupCompanies) }) }) : null
|
|
5366
5497
|
] })
|
|
5367
5498
|
] }) }),
|
|
5368
|
-
|
|
5499
|
+
companyPending && /* @__PURE__ */ jsx(Section, { title: t2("crm.card.companyTitle"), children: /* @__PURE__ */ jsx("div", { className: "h-[58px] animate-pulse rounded-card bg-muted/30", "aria-hidden": true }) }),
|
|
5500
|
+
!companyPending && !company && pessoaDoCard?.id && /* @__PURE__ */ jsx(Section, { title: t2("crm.card.companyTitle"), children: /* @__PURE__ */ jsx(
|
|
5369
5501
|
LinkCompanyPrompt,
|
|
5370
5502
|
{
|
|
5371
5503
|
personId: pessoaDoCard.id,
|
|
@@ -5380,12 +5512,14 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
5380
5512
|
}
|
|
5381
5513
|
) }),
|
|
5382
5514
|
company && /* @__PURE__ */ jsx(Section, { title: t2("crm.card.companyTitle"), children: /* @__PURE__ */ jsxs(
|
|
5383
|
-
|
|
5515
|
+
Button,
|
|
5384
5516
|
{
|
|
5385
5517
|
type: "button",
|
|
5518
|
+
variant: "bare",
|
|
5519
|
+
size: "bare",
|
|
5386
5520
|
onClick: () => onViewCompany?.(company.id),
|
|
5387
5521
|
disabled: !onViewCompany,
|
|
5388
|
-
className: "flex w-full
|
|
5522
|
+
className: "flex w-full justify-start gap-3 whitespace-normal rounded-card border bg-card px-3 py-3 text-left font-normal shadow-sm enabled:hover:bg-muted/20 disabled:pointer-events-auto disabled:opacity-100",
|
|
5389
5523
|
children: [
|
|
5390
5524
|
/* @__PURE__ */ jsx(Building2, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
5391
5525
|
/* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1", children: [
|
|
@@ -5405,15 +5539,17 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
5405
5539
|
{
|
|
5406
5540
|
title: t2("crm.dealSidebar.quotes"),
|
|
5407
5541
|
action: onCreateQuote && lead ? /* @__PURE__ */ jsx(
|
|
5408
|
-
|
|
5542
|
+
Button,
|
|
5409
5543
|
{
|
|
5410
5544
|
type: "button",
|
|
5545
|
+
variant: "bare",
|
|
5546
|
+
size: "bare",
|
|
5411
5547
|
onClick: () => onCreateQuote(lead.id),
|
|
5412
5548
|
className: "text-[11px] font-medium text-primary hover:underline",
|
|
5413
5549
|
children: t2("crm.leadDetail.createQuote")
|
|
5414
5550
|
}
|
|
5415
5551
|
) : void 0,
|
|
5416
|
-
children: quotes2.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "\u2014" }) : /* @__PURE__ */ jsx("div", { className: "divide-y rounded-card border", children: quotes2.map((q) => /* @__PURE__ */ jsxs(
|
|
5552
|
+
children: quotes2 === null ? /* @__PURE__ */ jsx("div", { className: "h-4 w-24 animate-pulse rounded bg-muted/30", "aria-hidden": true }) : quotes2.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "\u2014" }) : /* @__PURE__ */ jsx("div", { className: "divide-y rounded-card border", children: quotes2.map((q) => /* @__PURE__ */ jsxs(
|
|
5417
5553
|
"div",
|
|
5418
5554
|
{
|
|
5419
5555
|
onClick: () => onViewQuote?.(q.id),
|
|
@@ -5425,7 +5561,7 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
5425
5561
|
] }),
|
|
5426
5562
|
/* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-2", onClick: (e) => e.stopPropagation(), children: [
|
|
5427
5563
|
/* @__PURE__ */ jsx("span", { className: "text-sm font-semibold", children: formatCurrency(q.totalAmount, currency) }),
|
|
5428
|
-
/* @__PURE__ */ jsx(QuoteStatusDropdown, { quote: q, size: "sm", onStatusChange: (u) => setQuotes(
|
|
5564
|
+
/* @__PURE__ */ jsx(QuoteStatusDropdown, { quote: q, size: "sm", onStatusChange: (u) => setQuotes((qs) => qs?.map((x) => x.id === u.id ? u : x) ?? qs) })
|
|
5429
5565
|
] })
|
|
5430
5566
|
]
|
|
5431
5567
|
},
|
|
@@ -5595,7 +5731,7 @@ function LeadFormView({ onSaved, initialStageId, initialPipelineId }) {
|
|
|
5595
5731
|
] }),
|
|
5596
5732
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
5597
5733
|
/* @__PURE__ */ jsx("label", { className: "text-xs font-medium text-muted-foreground", children: t2("crm.leadForm.notes") }),
|
|
5598
|
-
/* @__PURE__ */ jsx(
|
|
5734
|
+
/* @__PURE__ */ jsx(Textarea, { value: notes, onChange: (e) => setNotes(e.target.value), rows: 2, placeholder: t2("crm.leadForm.notesPlaceholder"), className: "mt-1 min-h-0 resize-none" })
|
|
5599
5735
|
] })
|
|
5600
5736
|
]
|
|
5601
5737
|
}
|
|
@@ -5692,15 +5828,17 @@ function DealsView({ mode, onChangeMode, openDealId, onOpenDeal, onCloseDeal, on
|
|
|
5692
5828
|
pipelines.length > 1 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center gap-1", role: "tablist", "aria-label": t2("crm.pipeline.pickFunnel"), children: pipelines.map((p) => {
|
|
5693
5829
|
const active = p.id === activePipelineId;
|
|
5694
5830
|
return /* @__PURE__ */ jsx(
|
|
5695
|
-
|
|
5831
|
+
Button,
|
|
5696
5832
|
{
|
|
5697
5833
|
type: "button",
|
|
5834
|
+
variant: "bare",
|
|
5835
|
+
size: "bare",
|
|
5698
5836
|
role: "tab",
|
|
5699
5837
|
"aria-selected": active,
|
|
5700
5838
|
onClick: () => {
|
|
5701
5839
|
void selectPipeline(p.id);
|
|
5702
5840
|
},
|
|
5703
|
-
className: "rounded-md px-3 py-1.5
|
|
5841
|
+
className: "rounded-md px-3 py-1.5 " + (active ? "bg-primary/10 font-medium text-primary" : "font-normal text-muted-foreground hover:bg-muted hover:text-foreground"),
|
|
5704
5842
|
children: p.name
|
|
5705
5843
|
},
|
|
5706
5844
|
p.id
|
|
@@ -6020,17 +6158,19 @@ function OwnerFilterChip({ t: t2, people, myUserId, value, effective, onChange }
|
|
|
6020
6158
|
const isMe = Boolean(effective && myUserId && effective === myUserId);
|
|
6021
6159
|
const label2 = !effective ? t2("crm.leads.filters.allOwners") : isMe ? t2("crm.leads.filters.mine") : effective === "none" ? t2("crm.leads.filters.unassigned") : people.get(effective) ?? effective.slice(0, 8);
|
|
6022
6160
|
const showAvatar = effective && effective !== "none";
|
|
6023
|
-
const row = "flex w-full
|
|
6161
|
+
const row = "flex w-full justify-start gap-2 px-2 py-1.5 text-left text-xs font-normal hover:bg-muted";
|
|
6024
6162
|
const pick = (v) => {
|
|
6025
6163
|
onChange(v);
|
|
6026
6164
|
setOpen(false);
|
|
6027
6165
|
};
|
|
6028
6166
|
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
|
|
6029
6167
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
6030
|
-
|
|
6168
|
+
Button,
|
|
6031
6169
|
{
|
|
6032
6170
|
type: "button",
|
|
6033
|
-
|
|
6171
|
+
variant: "bare",
|
|
6172
|
+
size: "bare",
|
|
6173
|
+
className: `shrink-0 gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium ${effective ? "border-primary/30 bg-primary/10 text-primary hover:bg-primary/15" : "border-transparent bg-muted/70 text-muted-foreground hover:bg-muted hover:text-foreground"}`,
|
|
6034
6174
|
children: [
|
|
6035
6175
|
showAvatar ? /* @__PURE__ */ jsx(PersonAvatar, { name: people.get(effective) ?? label2, size: "xs" }) : /* @__PURE__ */ jsx(User, { className: "h-3 w-3 shrink-0 opacity-70" }),
|
|
6036
6176
|
label2
|
|
@@ -6038,25 +6178,25 @@ function OwnerFilterChip({ t: t2, people, myUserId, value, effective, onChange }
|
|
|
6038
6178
|
}
|
|
6039
6179
|
) }),
|
|
6040
6180
|
/* @__PURE__ */ jsxs(PopoverContent, { align: "start", className: "w-60 p-1.5", children: [
|
|
6041
|
-
/* @__PURE__ */ jsxs("
|
|
6181
|
+
/* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: row, onClick: () => pick(""), children: [
|
|
6042
6182
|
/* @__PURE__ */ jsx(User, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
6043
6183
|
" ",
|
|
6044
6184
|
t2("crm.leads.filters.allOwners"),
|
|
6045
6185
|
!effective && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 text-muted-foreground" })
|
|
6046
6186
|
] }),
|
|
6047
|
-
myUserId && /* @__PURE__ */ jsxs("
|
|
6187
|
+
myUserId && /* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: row, onClick: () => pick("__me__"), children: [
|
|
6048
6188
|
/* @__PURE__ */ jsx(PersonAvatar, { name: people.get(myUserId) ?? "Eu", size: "xs" }),
|
|
6049
6189
|
" ",
|
|
6050
6190
|
t2("crm.leads.filters.mine"),
|
|
6051
6191
|
isMe && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 text-muted-foreground" })
|
|
6052
6192
|
] }),
|
|
6053
|
-
/* @__PURE__ */ jsxs("
|
|
6193
|
+
/* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: row, onClick: () => pick("none"), children: [
|
|
6054
6194
|
/* @__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(User, { className: "h-2.5 w-2.5 text-muted-foreground" }) }),
|
|
6055
6195
|
t2("crm.leads.filters.unassigned"),
|
|
6056
6196
|
effective === "none" && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 text-muted-foreground" })
|
|
6057
6197
|
] }),
|
|
6058
6198
|
/* @__PURE__ */ jsx("div", { className: "my-1 border-t border-border" }),
|
|
6059
|
-
/* @__PURE__ */ jsx("div", { className: "max-h-56 overflow-y-auto", children: [...people].filter(([id]) => id !== myUserId).map(([id, nome]) => /* @__PURE__ */ jsxs("
|
|
6199
|
+
/* @__PURE__ */ jsx("div", { className: "max-h-56 overflow-y-auto", children: [...people].filter(([id]) => id !== myUserId).map(([id, nome]) => /* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: row, onClick: () => pick(id), children: [
|
|
6060
6200
|
/* @__PURE__ */ jsx(PersonAvatar, { name: nome, size: "xs" }),
|
|
6061
6201
|
/* @__PURE__ */ jsx("span", { className: "truncate", children: nome }),
|
|
6062
6202
|
effective === id && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 shrink-0 text-muted-foreground" })
|
|
@@ -6644,12 +6784,14 @@ function LeadListView({ onNew, onEdit }) {
|
|
|
6644
6784
|
statusFilter.map((s) => {
|
|
6645
6785
|
const opt = LEAD_STATUS_OPTIONS.find((o) => o.value === s);
|
|
6646
6786
|
return /* @__PURE__ */ jsx(
|
|
6647
|
-
|
|
6787
|
+
Button,
|
|
6648
6788
|
{
|
|
6649
6789
|
type: "button",
|
|
6790
|
+
variant: "bare",
|
|
6791
|
+
size: "bare",
|
|
6650
6792
|
title: t2("crm.leads.filters.clear"),
|
|
6651
6793
|
onClick: () => setStatusFilter(statusFilter.filter((x) => x !== s)),
|
|
6652
|
-
className: "shrink-0",
|
|
6794
|
+
className: "shrink-0 rounded-full",
|
|
6653
6795
|
children: /* @__PURE__ */ jsx(DotChip, { color: opt?.dot ?? "#94A3B8", label: opt ? t2(opt.labelKey) : s, className: "h-[26px] px-2.5 text-xs" })
|
|
6654
6796
|
},
|
|
6655
6797
|
s
|
|
@@ -6767,24 +6909,28 @@ function useQuoteColumns(currency, onEditQuote, onArchive) {
|
|
|
6767
6909
|
header: "",
|
|
6768
6910
|
cell: ({ row }) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-0.5", children: [
|
|
6769
6911
|
onEditQuote && /* @__PURE__ */ jsx(
|
|
6770
|
-
|
|
6912
|
+
Button,
|
|
6771
6913
|
{
|
|
6914
|
+
variant: "ghost",
|
|
6915
|
+
size: "icon",
|
|
6772
6916
|
onClick: (e) => {
|
|
6773
6917
|
e.stopPropagation();
|
|
6774
6918
|
onEditQuote(row.original.id);
|
|
6775
6919
|
},
|
|
6776
|
-
className: "
|
|
6920
|
+
className: "h-7 w-7 rounded-md text-muted-foreground",
|
|
6777
6921
|
title: "Edit quote",
|
|
6778
6922
|
children: /* @__PURE__ */ jsx(Pencil, { className: "h-3.5 w-3.5" })
|
|
6779
6923
|
}
|
|
6780
6924
|
),
|
|
6781
6925
|
onArchive && /* @__PURE__ */ jsxs(Dropdown, { children: [
|
|
6782
6926
|
/* @__PURE__ */ jsx(DropdownTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
6783
|
-
|
|
6927
|
+
Button,
|
|
6784
6928
|
{
|
|
6929
|
+
variant: "ghost",
|
|
6930
|
+
size: "icon",
|
|
6785
6931
|
onClick: (e) => e.stopPropagation(),
|
|
6786
6932
|
"aria-label": t2("crm.quotes.moreActions"),
|
|
6787
|
-
className: "
|
|
6933
|
+
className: "h-7 w-7 rounded-md text-muted-foreground",
|
|
6788
6934
|
children: /* @__PURE__ */ jsx(MoreHorizontal, { className: "h-3.5 w-3.5" })
|
|
6789
6935
|
}
|
|
6790
6936
|
) }),
|
|
@@ -6956,7 +7102,7 @@ function QuoteListView({ onNew, onEdit, onEditQuote }) {
|
|
|
6956
7102
|
/* @__PURE__ */ jsxs(Card, { className: "relative px-3 py-1.5", children: [
|
|
6957
7103
|
/* @__PURE__ */ jsx(Search, { className: "pointer-events-none absolute left-5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
|
|
6958
7104
|
/* @__PURE__ */ jsx(
|
|
6959
|
-
|
|
7105
|
+
Input,
|
|
6960
7106
|
{
|
|
6961
7107
|
type: "text",
|
|
6962
7108
|
value: search,
|
|
@@ -6966,7 +7112,7 @@ function QuoteListView({ onNew, onEdit, onEditQuote }) {
|
|
|
6966
7112
|
},
|
|
6967
7113
|
placeholder: t2("crm.quotes.searchPlaceholder"),
|
|
6968
7114
|
"aria-label": t2("crm.quotes.searchPlaceholder"),
|
|
6969
|
-
className: "
|
|
7115
|
+
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"
|
|
6970
7116
|
}
|
|
6971
7117
|
)
|
|
6972
7118
|
] }),
|
|
@@ -6980,14 +7126,7 @@ function QuoteListView({ onNew, onEdit, onEditQuote }) {
|
|
|
6980
7126
|
emptyMessage: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1 py-6", children: [
|
|
6981
7127
|
/* @__PURE__ */ jsx(FileText, { className: "mb-2 h-9 w-9 text-muted-foreground/40", strokeWidth: 1.5 }),
|
|
6982
7128
|
/* @__PURE__ */ jsx("p", { className: "text-base font-semibold text-foreground", children: t2("crm.quotes.noQuotes") }),
|
|
6983
|
-
onNew && /* @__PURE__ */ jsx(
|
|
6984
|
-
"button",
|
|
6985
|
-
{
|
|
6986
|
-
onClick: onNew,
|
|
6987
|
-
className: "mt-3 inline-flex items-center gap-1.5 rounded-button border border-primary bg-primary px-3 py-2 text-sm font-medium text-primary-foreground shadow-button-primary transition-colors hover:bg-primary/90 active:shadow-button-inset",
|
|
6988
|
-
children: t2("crm.quotes.createFirst")
|
|
6989
|
-
}
|
|
6990
|
-
)
|
|
7129
|
+
onNew && /* @__PURE__ */ jsx(Button, { size: "lg", onClick: onNew, className: "mt-3 px-3 font-medium", children: t2("crm.quotes.createFirst") })
|
|
6991
7130
|
] })
|
|
6992
7131
|
}
|
|
6993
7132
|
),
|
|
@@ -7204,7 +7343,7 @@ function QuoteFormView({ quoteId, leadId, onSaved }) {
|
|
|
7204
7343
|
saveLabel: isEdit ? t2("crm.quoteForm.saveChanges") : t2("crm.quoteForm.saveQuote")
|
|
7205
7344
|
});
|
|
7206
7345
|
if (loadingExisting) return /* @__PURE__ */ jsx(OrderFormSkeleton, { parentLabel: t2("crm.quotes.title"), onBack: () => onSaved?.() });
|
|
7207
|
-
const
|
|
7346
|
+
const money = (v) => formatCurrency(v, currency);
|
|
7208
7347
|
const validUntilLabel = (/* @__PURE__ */ new Date(`${validUntil}T12:00:00`)).toLocaleDateString(getCurrentLocale());
|
|
7209
7348
|
const contactSection = /* @__PURE__ */ jsx(OrderFormBlock, { title: t2("crm.quoteForm.client"), children: /* @__PURE__ */ jsx(
|
|
7210
7349
|
SearchSelect,
|
|
@@ -7253,21 +7392,25 @@ function QuoteFormView({ quoteId, leadId, onSaved }) {
|
|
|
7253
7392
|
] }),
|
|
7254
7393
|
/* @__PURE__ */ jsxs("div", { className: "mt-1 flex flex-wrap gap-1.5", children: [
|
|
7255
7394
|
VALIDITY_PRESETS.map((preset) => /* @__PURE__ */ jsx(
|
|
7256
|
-
|
|
7395
|
+
Button,
|
|
7257
7396
|
{
|
|
7258
7397
|
type: "button",
|
|
7398
|
+
variant: "bare",
|
|
7399
|
+
size: "bare",
|
|
7259
7400
|
onClick: () => pickValidity(preset.days),
|
|
7260
|
-
className: `rounded-full border px-2.5 py-1 text-xs
|
|
7401
|
+
className: `rounded-full border px-2.5 py-1 text-xs font-normal ${validityDays === preset.days ? "border-primary bg-primary text-primary-foreground" : "border-input bg-card text-muted-foreground hover:bg-muted/50"}`,
|
|
7261
7402
|
children: t2(preset.labelKey)
|
|
7262
7403
|
},
|
|
7263
7404
|
preset.days
|
|
7264
7405
|
)),
|
|
7265
7406
|
/* @__PURE__ */ jsx(
|
|
7266
|
-
|
|
7407
|
+
Button,
|
|
7267
7408
|
{
|
|
7268
7409
|
type: "button",
|
|
7410
|
+
variant: "bare",
|
|
7411
|
+
size: "bare",
|
|
7269
7412
|
onClick: () => pickValidity(null),
|
|
7270
|
-
className: `rounded-full border px-2.5 py-1 text-xs
|
|
7413
|
+
className: `rounded-full border px-2.5 py-1 text-xs font-normal ${validityDays === null ? "border-primary bg-primary text-primary-foreground" : "border-input bg-card text-muted-foreground hover:bg-muted/50"}`,
|
|
7271
7414
|
children: t2("crm.quoteForm.validCustom")
|
|
7272
7415
|
}
|
|
7273
7416
|
)
|
|
@@ -7275,23 +7418,23 @@ function QuoteFormView({ quoteId, leadId, onSaved }) {
|
|
|
7275
7418
|
] })
|
|
7276
7419
|
] }) }),
|
|
7277
7420
|
/* @__PURE__ */ jsx(OrderFormBlock, { title: t2("crm.quoteForm.paymentConditions"), children: /* @__PURE__ */ jsx(
|
|
7278
|
-
|
|
7421
|
+
Textarea,
|
|
7279
7422
|
{
|
|
7280
7423
|
value: paymentConditions,
|
|
7281
7424
|
onChange: (e) => setPaymentConditions(e.target.value),
|
|
7282
7425
|
rows: 2,
|
|
7283
7426
|
placeholder: t2("crm.quoteForm.paymentConditionsPlaceholder"),
|
|
7284
|
-
className: "
|
|
7427
|
+
className: "min-h-0 resize-none"
|
|
7285
7428
|
}
|
|
7286
7429
|
) }),
|
|
7287
7430
|
/* @__PURE__ */ jsx(OrderFormBlock, { title: t2("crm.quoteForm.notes"), children: /* @__PURE__ */ jsx(
|
|
7288
|
-
|
|
7431
|
+
Textarea,
|
|
7289
7432
|
{
|
|
7290
7433
|
value: observations,
|
|
7291
7434
|
onChange: (e) => setObservations(e.target.value),
|
|
7292
7435
|
rows: 2,
|
|
7293
7436
|
placeholder: t2("crm.quoteForm.notesPlaceholder"),
|
|
7294
|
-
className: "
|
|
7437
|
+
className: "min-h-0 resize-none"
|
|
7295
7438
|
}
|
|
7296
7439
|
) })
|
|
7297
7440
|
] });
|
|
@@ -7323,7 +7466,7 @@ function QuoteFormView({ quoteId, leadId, onSaved }) {
|
|
|
7323
7466
|
count: items.length,
|
|
7324
7467
|
countLabel: t2("crm.quoteForm.itemCount", { count: String(items.length) }),
|
|
7325
7468
|
totalLabel: t2("crm.quoteForm.total"),
|
|
7326
|
-
total:
|
|
7469
|
+
total: money(totalAmount),
|
|
7327
7470
|
emptyLabel: contactId ? t2("crm.quoteForm.noItems") : t2("crm.quoteForm.selectClientFirst"),
|
|
7328
7471
|
emptyActionLabel: t2("crm.quoteForm.addFirstItem"),
|
|
7329
7472
|
header: addingItem && /* @__PURE__ */ jsx(
|
|
@@ -7347,7 +7490,7 @@ function QuoteFormView({ quoteId, leadId, onSaved }) {
|
|
|
7347
7490
|
discount: item.discount,
|
|
7348
7491
|
itemTypes,
|
|
7349
7492
|
currency,
|
|
7350
|
-
formatMoney:
|
|
7493
|
+
formatMoney: money,
|
|
7351
7494
|
expanded: expandedItemId === item._id,
|
|
7352
7495
|
onToggle: () => setExpandedItemId(expandedItemId === item._id ? null : item._id),
|
|
7353
7496
|
onChange: (patch) => updateItem(item._id, patch),
|
|
@@ -7372,6 +7515,7 @@ function QuoteFormView({ quoteId, leadId, onSaved }) {
|
|
|
7372
7515
|
}
|
|
7373
7516
|
);
|
|
7374
7517
|
}
|
|
7518
|
+
var SEND_ITEM = "gap-2 px-3 py-2 text-xs";
|
|
7375
7519
|
function QuoteDetailView({ quoteId, onBack, onEdit, onInvoiceCreated }) {
|
|
7376
7520
|
const t2 = useTranslation();
|
|
7377
7521
|
const { currency } = useCrmConfig();
|
|
@@ -7381,13 +7525,11 @@ function QuoteDetailView({ quoteId, onBack, onEdit, onInvoiceCreated }) {
|
|
|
7381
7525
|
const rejectQuote = useCrmStore((s) => s.rejectQuote);
|
|
7382
7526
|
const [quote, setQuote] = useState(null);
|
|
7383
7527
|
const [loading, setLoading] = useState(true);
|
|
7384
|
-
const [sendMenuOpen, setSendMenuOpen] = useState(false);
|
|
7385
7528
|
const [sending, setSending] = useState(false);
|
|
7386
7529
|
const [approving, setApproving] = useState(false);
|
|
7387
7530
|
const [rejectOpen, setRejectOpen] = useState(false);
|
|
7388
7531
|
const [rejectReason, setRejectReason] = useState("");
|
|
7389
7532
|
const [rejecting, setRejecting] = useState(false);
|
|
7390
|
-
const sendMenuRef = useRef(null);
|
|
7391
7533
|
useEffect(() => {
|
|
7392
7534
|
setLoading(true);
|
|
7393
7535
|
provider.getQuoteById(quoteId).then((q) => {
|
|
@@ -7395,17 +7537,8 @@ function QuoteDetailView({ quoteId, onBack, onEdit, onInvoiceCreated }) {
|
|
|
7395
7537
|
setLoading(false);
|
|
7396
7538
|
});
|
|
7397
7539
|
}, [quoteId]);
|
|
7398
|
-
useEffect(() => {
|
|
7399
|
-
if (!sendMenuOpen) return;
|
|
7400
|
-
const h = (e) => {
|
|
7401
|
-
if (sendMenuRef.current && !sendMenuRef.current.contains(e.target)) setSendMenuOpen(false);
|
|
7402
|
-
};
|
|
7403
|
-
document.addEventListener("mousedown", h);
|
|
7404
|
-
return () => document.removeEventListener("mousedown", h);
|
|
7405
|
-
}, [sendMenuOpen]);
|
|
7406
7540
|
async function handleSend(_channel) {
|
|
7407
7541
|
setSending(true);
|
|
7408
|
-
setSendMenuOpen(false);
|
|
7409
7542
|
try {
|
|
7410
7543
|
const updated = await sendQuote(quoteId);
|
|
7411
7544
|
setQuote(updated);
|
|
@@ -7442,7 +7575,7 @@ function QuoteDetailView({ quoteId, onBack, onEdit, onInvoiceCreated }) {
|
|
|
7442
7575
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center rounded-lg border-2 border-dashed border-muted py-12 text-center", children: [
|
|
7443
7576
|
/* @__PURE__ */ jsx(FileText, { className: "mb-2 h-8 w-8 text-muted-foreground/30" }),
|
|
7444
7577
|
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t2("crm.quoteDetail.notFound") }),
|
|
7445
|
-
/* @__PURE__ */ jsx("
|
|
7578
|
+
/* @__PURE__ */ jsx(Button, { variant: "bare", size: "bare", onClick: onBack, className: "mt-1 text-xs font-normal text-primary hover:underline", children: t2("crm.quoteDetail.backToList") })
|
|
7446
7579
|
] })
|
|
7447
7580
|
] });
|
|
7448
7581
|
}
|
|
@@ -7465,33 +7598,24 @@ function QuoteDetailView({ quoteId, onBack, onEdit, onInvoiceCreated }) {
|
|
|
7465
7598
|
];
|
|
7466
7599
|
const editable = quote.status !== "approved" && quote.status !== "rejected" && quote.status !== "expired";
|
|
7467
7600
|
const actions = /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
7468
|
-
quote.status === "draft" && /* @__PURE__ */ jsxs(
|
|
7469
|
-
/* @__PURE__ */ jsxs(
|
|
7470
|
-
"
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
children: [
|
|
7477
|
-
/* @__PURE__ */ jsx(Send, { className: "h-3 w-3" }),
|
|
7478
|
-
sending ? t2("crm.quoteDetail.sending") : t2("crm.quoteDetail.send"),
|
|
7479
|
-
/* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3 opacity-60" })
|
|
7480
|
-
]
|
|
7481
|
-
}
|
|
7482
|
-
),
|
|
7483
|
-
sendMenuOpen && /* @__PURE__ */ jsxs("div", { className: "animate-in fade-in zoom-in-95 absolute right-0 top-full z-20 mt-1 w-48 rounded-lg border bg-card py-1 shadow-lg duration-100", children: [
|
|
7484
|
-
/* @__PURE__ */ jsxs("button", { type: "button", onClick: () => handleSend(), className: "flex w-full items-center gap-2 px-3 py-2 text-xs transition-colors hover:bg-muted/50", children: [
|
|
7601
|
+
quote.status === "draft" && /* @__PURE__ */ jsxs(Dropdown, { children: [
|
|
7602
|
+
/* @__PURE__ */ jsx(DropdownTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { type: "button", size: "sm", disabled: sending, className: "h-auto px-3 py-1.5 font-medium", children: [
|
|
7603
|
+
/* @__PURE__ */ jsx(Send, { className: "h-3 w-3" }),
|
|
7604
|
+
sending ? t2("crm.quoteDetail.sending") : t2("crm.quoteDetail.send"),
|
|
7605
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3 opacity-60" })
|
|
7606
|
+
] }) }),
|
|
7607
|
+
/* @__PURE__ */ jsxs(DropdownContent, { align: "end", className: "w-48", children: [
|
|
7608
|
+
/* @__PURE__ */ jsxs(DropdownItem, { onSelect: () => void handleSend(), className: SEND_ITEM, children: [
|
|
7485
7609
|
/* @__PURE__ */ jsx(Printer, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
7486
7610
|
" ",
|
|
7487
7611
|
t2("crm.quoteDetail.sendPrint")
|
|
7488
7612
|
] }),
|
|
7489
|
-
/* @__PURE__ */ jsxs(
|
|
7613
|
+
/* @__PURE__ */ jsxs(DropdownItem, { onSelect: () => void handleSend(), className: SEND_ITEM, children: [
|
|
7490
7614
|
/* @__PURE__ */ jsx(Mail, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
7491
7615
|
" ",
|
|
7492
7616
|
t2("crm.quoteDetail.sendEmail")
|
|
7493
7617
|
] }),
|
|
7494
|
-
/* @__PURE__ */ jsxs(
|
|
7618
|
+
/* @__PURE__ */ jsxs(DropdownItem, { onSelect: () => void handleSend(), className: SEND_ITEM, children: [
|
|
7495
7619
|
/* @__PURE__ */ jsx(MessageCircle, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
7496
7620
|
" ",
|
|
7497
7621
|
t2("crm.quoteDetail.sendWhatsApp")
|
|
@@ -7587,25 +7711,27 @@ function QuoteDetailView({ quoteId, onBack, onEdit, onInvoiceCreated }) {
|
|
|
7587
7711
|
extraSections: sideBlocks
|
|
7588
7712
|
}
|
|
7589
7713
|
),
|
|
7590
|
-
|
|
7591
|
-
/* @__PURE__ */ jsxs(
|
|
7592
|
-
/* @__PURE__ */
|
|
7593
|
-
|
|
7594
|
-
/* @__PURE__ */
|
|
7595
|
-
|
|
7596
|
-
|
|
7714
|
+
/* @__PURE__ */ jsx(Modal, { open: rejectOpen, onOpenChange: setRejectOpen, children: /* @__PURE__ */ jsxs(ModalContent, { className: "max-w-sm", children: [
|
|
7715
|
+
/* @__PURE__ */ jsxs(ModalBody, { children: [
|
|
7716
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-3 flex items-center gap-3", children: [
|
|
7717
|
+
/* @__PURE__ */ jsx("div", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-destructive/10", children: /* @__PURE__ */ jsx(X, { className: "h-5 w-5 text-destructive" }) }),
|
|
7718
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
7719
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold", children: t2("crm.quoteDetail.reject") }),
|
|
7720
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t2("crm.quoteDetail.rejectDescription") })
|
|
7721
|
+
] })
|
|
7722
|
+
] }),
|
|
7723
|
+
/* @__PURE__ */ jsx(
|
|
7724
|
+
Textarea,
|
|
7725
|
+
{
|
|
7726
|
+
value: rejectReason,
|
|
7727
|
+
onChange: (e) => setRejectReason(e.target.value),
|
|
7728
|
+
placeholder: t2("crm.quoteDetail.rejectReasonPlaceholder"),
|
|
7729
|
+
className: "h-20 resize-none",
|
|
7730
|
+
autoFocus: true
|
|
7731
|
+
}
|
|
7732
|
+
)
|
|
7597
7733
|
] }),
|
|
7598
|
-
/* @__PURE__ */
|
|
7599
|
-
"textarea",
|
|
7600
|
-
{
|
|
7601
|
-
value: rejectReason,
|
|
7602
|
-
onChange: (e) => setRejectReason(e.target.value),
|
|
7603
|
-
placeholder: t2("crm.quoteDetail.rejectReasonPlaceholder"),
|
|
7604
|
-
className: "h-20 w-full resize-none rounded-input border border-input bg-card px-3 py-2 text-sm shadow-[inset_0_1px_0_rgb(0_0_0_/0.06)] focus:outline-none focus:ring-2 focus:ring-ring",
|
|
7605
|
-
autoFocus: true
|
|
7606
|
-
}
|
|
7607
|
-
),
|
|
7608
|
-
/* @__PURE__ */ jsxs("div", { className: "mt-3 flex justify-end gap-2", children: [
|
|
7734
|
+
/* @__PURE__ */ jsxs(ModalFooter, { children: [
|
|
7609
7735
|
/* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => setRejectOpen(false), children: t2("common.cancel") }),
|
|
7610
7736
|
/* @__PURE__ */ jsx(
|
|
7611
7737
|
Button,
|
|
@@ -7708,10 +7834,12 @@ function PersonPhones({ personId, onOpenPerson }) {
|
|
|
7708
7834
|
t2("crm.phones.title")
|
|
7709
7835
|
] }),
|
|
7710
7836
|
!adding && /* @__PURE__ */ jsxs(
|
|
7711
|
-
|
|
7837
|
+
Button,
|
|
7712
7838
|
{
|
|
7839
|
+
variant: "outline",
|
|
7840
|
+
size: "sm",
|
|
7713
7841
|
onClick: () => setAdding(true),
|
|
7714
|
-
className: "
|
|
7842
|
+
className: "h-auto gap-0 py-1 text-[11px] font-medium",
|
|
7715
7843
|
children: [
|
|
7716
7844
|
/* @__PURE__ */ jsx(Plus, { className: "inline h-3 w-3 mr-0.5" }),
|
|
7717
7845
|
t2("crm.phones.add")
|
|
@@ -7734,10 +7862,12 @@ function PersonPhones({ personId, onOpenPerson }) {
|
|
|
7734
7862
|
t2("crm.phones.sharedWith", { count: String(shared[p.id].length) }),
|
|
7735
7863
|
" ",
|
|
7736
7864
|
shared[p.id].map((o, i) => /* @__PURE__ */ jsxs(
|
|
7737
|
-
|
|
7865
|
+
Button,
|
|
7738
7866
|
{
|
|
7867
|
+
variant: "bare",
|
|
7868
|
+
size: "bare",
|
|
7739
7869
|
onClick: () => onOpenPerson?.(o.personId),
|
|
7740
|
-
className: "underline hover:no-underline",
|
|
7870
|
+
className: "inline text-[11px] font-normal underline hover:no-underline",
|
|
7741
7871
|
children: [
|
|
7742
7872
|
i > 0 && ", ",
|
|
7743
7873
|
o.label || o.phone
|
|
@@ -7748,8 +7878,10 @@ function PersonPhones({ personId, onOpenPerson }) {
|
|
|
7748
7878
|
] })
|
|
7749
7879
|
] }),
|
|
7750
7880
|
/* @__PURE__ */ jsx(
|
|
7751
|
-
|
|
7881
|
+
Button,
|
|
7752
7882
|
{
|
|
7883
|
+
variant: "bare",
|
|
7884
|
+
size: "bare",
|
|
7753
7885
|
onClick: () => setRemoveTarget(p),
|
|
7754
7886
|
className: "text-muted-foreground hover:text-destructive",
|
|
7755
7887
|
"aria-label": t2("common.delete"),
|
|
@@ -7856,10 +7988,6 @@ function touchDate(at, locale) {
|
|
|
7856
7988
|
if (m) return new Date(+m[1], +m[2] - 1, +m[3]).toLocaleDateString(locale);
|
|
7857
7989
|
return formatDateTime(at, locale);
|
|
7858
7990
|
}
|
|
7859
|
-
function money(v, locale) {
|
|
7860
|
-
if (v == null) return null;
|
|
7861
|
-
return v.toLocaleString(locale, { style: "currency", currency: "BRL", maximumFractionDigits: 0 });
|
|
7862
|
-
}
|
|
7863
7991
|
function LeadQualification({ lead }) {
|
|
7864
7992
|
const provider = useCrmProvider();
|
|
7865
7993
|
const { currency } = useCrmConfig();
|
|
@@ -7999,7 +8127,7 @@ function LeadQualification({ lead }) {
|
|
|
7999
8127
|
receita.capitalSocial != null && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
|
|
8000
8128
|
t2("crm.qualification.capital"),
|
|
8001
8129
|
": ",
|
|
8002
|
-
/* @__PURE__ */ jsx("span", { className: "text-foreground", children:
|
|
8130
|
+
/* @__PURE__ */ jsx("span", { className: "text-foreground", children: formatCurrency(receita.capitalSocial, currency) })
|
|
8003
8131
|
] }),
|
|
8004
8132
|
receita.socios != null && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
|
|
8005
8133
|
t2("crm.qualification.socios"),
|
|
@@ -8130,7 +8258,7 @@ function LogActivityButton({ target, onLogged }) {
|
|
|
8130
8258
|
] }),
|
|
8131
8259
|
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
8132
8260
|
/* @__PURE__ */ jsx(
|
|
8133
|
-
|
|
8261
|
+
Textarea,
|
|
8134
8262
|
{
|
|
8135
8263
|
autoFocus: true,
|
|
8136
8264
|
rows: 3,
|
|
@@ -8146,7 +8274,7 @@ function LogActivityButton({ target, onLogged }) {
|
|
|
8146
8274
|
}
|
|
8147
8275
|
},
|
|
8148
8276
|
placeholder: t2("crm.followUp.placeholder"),
|
|
8149
|
-
className: "
|
|
8277
|
+
className: "min-h-0 resize-none rounded-lg border-border bg-background pr-10 shadow-none placeholder:text-muted-foreground/70 focus-visible:ring-offset-0"
|
|
8150
8278
|
}
|
|
8151
8279
|
),
|
|
8152
8280
|
/* @__PURE__ */ jsx(
|
|
@@ -8274,7 +8402,7 @@ function LeadDetailView({ leadId, onBack, onCreateQuote, onViewQuote, onOpenComp
|
|
|
8274
8402
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center py-12 text-center rounded-lg border-2 border-dashed border-muted", children: [
|
|
8275
8403
|
/* @__PURE__ */ jsx(UserPlus, { className: "h-8 w-8 text-muted-foreground/30 mb-2" }),
|
|
8276
8404
|
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t2("crm.leadDetail.leadNotFound") }),
|
|
8277
|
-
/* @__PURE__ */ jsx("
|
|
8405
|
+
/* @__PURE__ */ jsx(Button, { variant: "bare", size: "bare", onClick: onBack, className: "mt-1 text-xs font-normal text-primary hover:underline", children: t2("crm.leadDetail.backToList") })
|
|
8278
8406
|
] })
|
|
8279
8407
|
] });
|
|
8280
8408
|
}
|
|
@@ -8293,10 +8421,11 @@ function LeadDetailView({ leadId, onBack, onCreateQuote, onViewQuote, onOpenComp
|
|
|
8293
8421
|
] }),
|
|
8294
8422
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 shrink-0", children: [
|
|
8295
8423
|
deal && onOpenDeal && /* @__PURE__ */ jsxs(
|
|
8296
|
-
|
|
8424
|
+
Button,
|
|
8297
8425
|
{
|
|
8426
|
+
variant: "outline",
|
|
8298
8427
|
onClick: () => onOpenDeal(deal.id),
|
|
8299
|
-
className: "
|
|
8428
|
+
className: "h-auto px-3 py-1.5 text-xs font-medium",
|
|
8300
8429
|
children: [
|
|
8301
8430
|
/* @__PURE__ */ jsx(Filter, { className: "h-3 w-3" }),
|
|
8302
8431
|
" ",
|
|
@@ -8307,11 +8436,13 @@ function LeadDetailView({ leadId, onBack, onCreateQuote, onViewQuote, onOpenComp
|
|
|
8307
8436
|
/* @__PURE__ */ jsx(TalkToPerson, { personId: leadId, name: lead.name, phone: lead.phone }),
|
|
8308
8437
|
canArchive && /* @__PURE__ */ jsxs(Dropdown, { children: [
|
|
8309
8438
|
/* @__PURE__ */ jsx(DropdownTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
8310
|
-
|
|
8439
|
+
Button,
|
|
8311
8440
|
{
|
|
8441
|
+
variant: "outline",
|
|
8442
|
+
size: "icon",
|
|
8312
8443
|
"aria-label": t2("crm.leadDetail.moreActions"),
|
|
8313
8444
|
disabled: archiving,
|
|
8314
|
-
className: "
|
|
8445
|
+
className: "rounded-lg text-muted-foreground hover:text-foreground disabled:opacity-60",
|
|
8315
8446
|
children: /* @__PURE__ */ jsx(MoreHorizontal, { className: "h-4 w-4" })
|
|
8316
8447
|
}
|
|
8317
8448
|
) }),
|
|
@@ -8322,10 +8453,10 @@ function LeadDetailView({ leadId, onBack, onCreateQuote, onViewQuote, onOpenComp
|
|
|
8322
8453
|
] }) })
|
|
8323
8454
|
] }),
|
|
8324
8455
|
onCreateQuote && lead.status !== "converted" && lead.status !== "lost" && /* @__PURE__ */ jsxs(
|
|
8325
|
-
|
|
8456
|
+
Button,
|
|
8326
8457
|
{
|
|
8327
8458
|
onClick: () => onCreateQuote(leadId),
|
|
8328
|
-
className: "
|
|
8459
|
+
className: "h-auto px-3 py-1.5 text-xs font-medium",
|
|
8329
8460
|
children: [
|
|
8330
8461
|
/* @__PURE__ */ jsx(FileText, { className: "h-3 w-3" }),
|
|
8331
8462
|
" ",
|
|
@@ -8355,10 +8486,12 @@ function LeadDetailView({ leadId, onBack, onCreateQuote, onViewQuote, onOpenComp
|
|
|
8355
8486
|
{
|
|
8356
8487
|
label: t2("crm.leadDetail.company"),
|
|
8357
8488
|
value: lead.companyName ? /* @__PURE__ */ jsxs(
|
|
8358
|
-
|
|
8489
|
+
Button,
|
|
8359
8490
|
{
|
|
8491
|
+
variant: "bare",
|
|
8492
|
+
size: "bare",
|
|
8360
8493
|
onClick: () => lead.companyId && onOpenCompany?.(lead.companyId),
|
|
8361
|
-
className: "text-left text-primary hover:underline",
|
|
8494
|
+
className: "inline whitespace-normal text-left font-normal text-primary hover:underline",
|
|
8362
8495
|
children: [
|
|
8363
8496
|
lead.companyName,
|
|
8364
8497
|
lead.companyRole && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
|
|
@@ -8452,10 +8585,11 @@ function LeadDetailView({ leadId, onBack, onCreateQuote, onViewQuote, onOpenComp
|
|
|
8452
8585
|
/* @__PURE__ */ jsxs("div", { className: "mb-1 flex items-center justify-between gap-2", children: [
|
|
8453
8586
|
/* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold text-foreground", children: t2("crm.leadDetail.pipeline") }),
|
|
8454
8587
|
onOpenDeal && /* @__PURE__ */ jsxs(
|
|
8455
|
-
|
|
8588
|
+
Button,
|
|
8456
8589
|
{
|
|
8590
|
+
variant: "outline",
|
|
8457
8591
|
onClick: () => onOpenDeal(deal.id),
|
|
8458
|
-
className: "
|
|
8592
|
+
className: "h-auto gap-1 px-2 py-1 text-[11px] font-medium shadow-none active:shadow-none",
|
|
8459
8593
|
children: [
|
|
8460
8594
|
t2("crm.leadDetail.openDeal"),
|
|
8461
8595
|
" ",
|
|
@@ -8825,204 +8959,155 @@ function CompanyListView({ onNew, onEdit }) {
|
|
|
8825
8959
|
)
|
|
8826
8960
|
] });
|
|
8827
8961
|
}
|
|
8828
|
-
|
|
8829
|
-
function CompanyFormView({ companyId, onSaved }) {
|
|
8830
|
-
const t2 = useTranslation();
|
|
8962
|
+
function DocumentInput({ value, onChange, companyId, t: t2 }) {
|
|
8831
8963
|
const provider = useCrmProvider();
|
|
8832
|
-
const
|
|
8833
|
-
const [name, setName] = useState("");
|
|
8834
|
-
const [legalName, setLegalName] = useState("");
|
|
8835
|
-
const [documentNumber, setDocumentNumber] = useState("");
|
|
8836
|
-
const [email, setEmail] = useState("");
|
|
8837
|
-
const [phone, setPhone] = useState("");
|
|
8838
|
-
const [website, setWebsite] = useState("");
|
|
8839
|
-
const [instagram, setInstagram] = useState("");
|
|
8840
|
-
const [city, setCity] = useState("");
|
|
8841
|
-
const [state, setState] = useState("");
|
|
8842
|
-
const [notes, setNotes] = useState("");
|
|
8843
|
-
const [saving, setSaving] = useState(false);
|
|
8964
|
+
const text = String(value ?? "");
|
|
8844
8965
|
const [duplicate, setDuplicate] = useState(null);
|
|
8845
8966
|
useEffect(() => {
|
|
8846
|
-
|
|
8967
|
+
const digits2 = normalizeDocument(text);
|
|
8968
|
+
if (digits2.length !== 11 && digits2.length !== 14) {
|
|
8969
|
+
setDuplicate(null);
|
|
8970
|
+
return;
|
|
8971
|
+
}
|
|
8847
8972
|
let cancelled = false;
|
|
8848
|
-
void provider.
|
|
8849
|
-
if (cancelled
|
|
8850
|
-
setName(c.name);
|
|
8851
|
-
setLegalName(c.legalName ?? "");
|
|
8852
|
-
setDocumentNumber(c.documentNumber ? formatDocument2(c.documentNumber) : "");
|
|
8853
|
-
setEmail(c.email ?? "");
|
|
8854
|
-
setPhone(c.phone ?? "");
|
|
8855
|
-
setWebsite(c.website ?? "");
|
|
8856
|
-
setInstagram(c.instagram ?? "");
|
|
8857
|
-
setCity(c.city ?? "");
|
|
8858
|
-
setState(c.state ?? "");
|
|
8859
|
-
setNotes(c.notes ?? "");
|
|
8973
|
+
void provider.findCompanyByDocument(digits2).then((found) => {
|
|
8974
|
+
if (!cancelled) setDuplicate(found && found.id !== companyId ? found.name : null);
|
|
8860
8975
|
});
|
|
8861
8976
|
return () => {
|
|
8862
8977
|
cancelled = true;
|
|
8863
8978
|
};
|
|
8864
|
-
}, [companyId]);
|
|
8979
|
+
}, [text, companyId]);
|
|
8980
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
8981
|
+
/* @__PURE__ */ jsx(Input, { value: text, onChange: (e) => onChange(e.target.value), placeholder: t2("crm.companyForm.documentPlaceholder") }),
|
|
8982
|
+
isValidDocument(text) === false && /* @__PURE__ */ jsx("p", { className: "mt-1 text-[11px] text-warning-foreground", children: t2("crm.companyForm.documentInvalidHint") }),
|
|
8983
|
+
duplicate && /* @__PURE__ */ jsxs("p", { className: "mt-1 text-[11px] text-destructive", children: [
|
|
8984
|
+
t2("crm.companyForm.documentTakenHint"),
|
|
8985
|
+
" ",
|
|
8986
|
+
/* @__PURE__ */ jsx("strong", { children: duplicate })
|
|
8987
|
+
] })
|
|
8988
|
+
] });
|
|
8989
|
+
}
|
|
8990
|
+
function buildCompanyEntity(t2, companyId) {
|
|
8991
|
+
return {
|
|
8992
|
+
name: t2("crm.companies.one"),
|
|
8993
|
+
namePlural: t2("crm.companies.title"),
|
|
8994
|
+
icon: "Building2",
|
|
8995
|
+
displayField: "name",
|
|
8996
|
+
subtitleField: "legalName",
|
|
8997
|
+
formColumns: 2,
|
|
8998
|
+
fieldGroups: [
|
|
8999
|
+
{ id: "identity", label: t2("crm.companyDetail.identity"), columns: 2 },
|
|
9000
|
+
{ id: "contact", label: t2("crm.companyDetail.contact"), columns: 2 }
|
|
9001
|
+
],
|
|
9002
|
+
fields: [
|
|
9003
|
+
{ key: "name", label: t2("crm.companyForm.name"), type: "text", required: true, placeholder: t2("crm.companyForm.namePlaceholder"), group: "identity" },
|
|
9004
|
+
{ key: "legalName", label: t2("crm.companyForm.legalName"), type: "text", placeholder: t2("crm.companyForm.legalNamePlaceholder"), group: "identity" },
|
|
9005
|
+
{
|
|
9006
|
+
key: "documentNumber",
|
|
9007
|
+
label: t2("crm.companyForm.document"),
|
|
9008
|
+
type: "custom",
|
|
9009
|
+
group: "identity",
|
|
9010
|
+
renderInput: ({ value, onChange }) => /* @__PURE__ */ jsx(DocumentInput, { value, onChange, companyId, t: t2 }),
|
|
9011
|
+
renderCell: (value, row) => value ? /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
9012
|
+
/* @__PURE__ */ jsx("span", { className: "tabular-nums", children: formatDocument2(String(value)) }),
|
|
9013
|
+
row.documentValid === false && /* @__PURE__ */ jsx("span", { className: "rounded-full bg-warning-soft px-1.5 py-0.5 text-[10px] text-warning-foreground", children: t2("crm.companies.documentInvalid") })
|
|
9014
|
+
] }) : null
|
|
9015
|
+
},
|
|
9016
|
+
{ key: "email", label: t2("crm.companyForm.email"), type: "email", group: "contact" },
|
|
9017
|
+
{ key: "phone", label: t2("crm.companyForm.phone"), type: "phone", group: "contact" },
|
|
9018
|
+
{ key: "website", label: t2("crm.companyForm.website"), type: "url", group: "contact" },
|
|
9019
|
+
{
|
|
9020
|
+
key: "instagram",
|
|
9021
|
+
label: t2("crm.companyForm.instagram"),
|
|
9022
|
+
type: "text",
|
|
9023
|
+
placeholder: "@casa",
|
|
9024
|
+
group: "contact",
|
|
9025
|
+
// A link, not text: sellers open the profile before calling to see if the place is alive.
|
|
9026
|
+
renderCell: (value) => {
|
|
9027
|
+
if (!value) return null;
|
|
9028
|
+
const url = instagramUrl(String(value));
|
|
9029
|
+
return url ? /* @__PURE__ */ jsxs("a", { href: url, target: "_blank", rel: "noreferrer", className: "text-primary hover:underline", children: [
|
|
9030
|
+
"@",
|
|
9031
|
+
normalizeInstagram(String(value))
|
|
9032
|
+
] }) : /* @__PURE__ */ jsx("span", { children: String(value) });
|
|
9033
|
+
}
|
|
9034
|
+
},
|
|
9035
|
+
{ key: "city", label: t2("crm.companyForm.city"), type: "text", group: "contact" },
|
|
9036
|
+
{ key: "state", label: t2("crm.companyForm.state"), type: "text", group: "contact" },
|
|
9037
|
+
{ key: "notes", label: t2("crm.companyForm.notes"), type: "textarea", group: "contact", span: 2 }
|
|
9038
|
+
]
|
|
9039
|
+
};
|
|
9040
|
+
}
|
|
9041
|
+
function toCompanyInput(values, id) {
|
|
9042
|
+
const s = (k) => typeof values[k] === "string" ? values[k].trim() : values[k] ?? "";
|
|
9043
|
+
return {
|
|
9044
|
+
id,
|
|
9045
|
+
name: s("name") || s("legalName"),
|
|
9046
|
+
legalName: s("legalName"),
|
|
9047
|
+
documentNumber: s("documentNumber"),
|
|
9048
|
+
email: s("email"),
|
|
9049
|
+
phone: s("phone"),
|
|
9050
|
+
website: s("website"),
|
|
9051
|
+
instagram: normalizeInstagram(s("instagram")) ?? "",
|
|
9052
|
+
city: s("city"),
|
|
9053
|
+
state: s("state"),
|
|
9054
|
+
notes: s("notes")
|
|
9055
|
+
};
|
|
9056
|
+
}
|
|
9057
|
+
function CompanyFormView({ companyId, onSaved, onCancel }) {
|
|
9058
|
+
const t2 = useTranslation();
|
|
9059
|
+
const provider = useCrmProvider();
|
|
9060
|
+
const saveCompany = useCrmStore((s) => s.saveCompany);
|
|
9061
|
+
const entity = useMemo(() => buildCompanyEntity(t2, companyId), [t2, companyId]);
|
|
9062
|
+
const [initialData, setInitialData] = useState(companyId ? null : {});
|
|
8865
9063
|
useEffect(() => {
|
|
8866
|
-
|
|
8867
|
-
if (digits2.length !== 11 && digits2.length !== 14) {
|
|
8868
|
-
setDuplicate(null);
|
|
8869
|
-
return;
|
|
8870
|
-
}
|
|
9064
|
+
if (!companyId) return;
|
|
8871
9065
|
let cancelled = false;
|
|
8872
|
-
void provider.
|
|
9066
|
+
void provider.getCompanyById(companyId).then((c) => {
|
|
8873
9067
|
if (cancelled) return;
|
|
8874
|
-
|
|
9068
|
+
setInitialData(c ? { ...c, documentNumber: c.documentNumber ? formatDocument2(c.documentNumber) : "" } : {});
|
|
8875
9069
|
});
|
|
8876
9070
|
return () => {
|
|
8877
9071
|
cancelled = true;
|
|
8878
9072
|
};
|
|
8879
|
-
}, [
|
|
8880
|
-
|
|
8881
|
-
|
|
8882
|
-
if (!name
|
|
8883
|
-
|
|
8884
|
-
|
|
8885
|
-
const saved = await saveCompany({
|
|
8886
|
-
id: companyId,
|
|
8887
|
-
name: name.trim() || legalName.trim(),
|
|
8888
|
-
legalName: legalName.trim() || void 0,
|
|
8889
|
-
documentNumber: documentNumber.trim() || void 0,
|
|
8890
|
-
email: email.trim() || void 0,
|
|
8891
|
-
phone: phone.trim() || void 0,
|
|
8892
|
-
website: website.trim() || void 0,
|
|
8893
|
-
// Normaliza na escrita — ver lib/instagram.
|
|
8894
|
-
instagram: normalizeInstagram(instagram),
|
|
8895
|
-
city: city.trim() || void 0,
|
|
8896
|
-
state: state.trim() || void 0,
|
|
8897
|
-
notes: notes.trim() || void 0
|
|
8898
|
-
});
|
|
8899
|
-
onSaved?.(saved.id);
|
|
8900
|
-
} finally {
|
|
8901
|
-
setSaving(false);
|
|
9073
|
+
}, [companyId]);
|
|
9074
|
+
async function submit(values) {
|
|
9075
|
+
const input = toCompanyInput(values, companyId);
|
|
9076
|
+
if (!input.name) {
|
|
9077
|
+
toast.error(t2("common.formIncomplete"));
|
|
9078
|
+
throw new Error("name required");
|
|
8902
9079
|
}
|
|
8903
|
-
|
|
8904
|
-
|
|
8905
|
-
|
|
8906
|
-
|
|
8907
|
-
|
|
8908
|
-
|
|
8909
|
-
|
|
8910
|
-
width: "max-w-md",
|
|
8911
|
-
children: [
|
|
8912
|
-
/* @__PURE__ */ jsxs(SheetBody, { className: "space-y-4", children: [
|
|
8913
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
8914
|
-
/* @__PURE__ */ jsx("label", { className: "text-xs font-medium text-muted-foreground", children: t2("crm.companyForm.name") }),
|
|
8915
|
-
/* @__PURE__ */ jsx(
|
|
8916
|
-
"input",
|
|
8917
|
-
{
|
|
8918
|
-
type: "text",
|
|
8919
|
-
value: name,
|
|
8920
|
-
onChange: (e) => setName(e.target.value),
|
|
8921
|
-
placeholder: t2("crm.companyForm.namePlaceholder"),
|
|
8922
|
-
autoFocus: true,
|
|
8923
|
-
className: inputClass
|
|
8924
|
-
}
|
|
8925
|
-
)
|
|
8926
|
-
] }),
|
|
8927
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
8928
|
-
/* @__PURE__ */ jsx("label", { className: "text-xs font-medium text-muted-foreground", children: t2("crm.companyForm.legalName") }),
|
|
8929
|
-
/* @__PURE__ */ jsx(
|
|
8930
|
-
"input",
|
|
8931
|
-
{
|
|
8932
|
-
type: "text",
|
|
8933
|
-
value: legalName,
|
|
8934
|
-
onChange: (e) => setLegalName(e.target.value),
|
|
8935
|
-
placeholder: t2("crm.companyForm.legalNamePlaceholder"),
|
|
8936
|
-
className: inputClass
|
|
8937
|
-
}
|
|
8938
|
-
)
|
|
8939
|
-
] }),
|
|
8940
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
8941
|
-
/* @__PURE__ */ jsx("label", { className: "text-xs font-medium text-muted-foreground", children: t2("crm.companyForm.document") }),
|
|
8942
|
-
/* @__PURE__ */ jsx(
|
|
8943
|
-
"input",
|
|
8944
|
-
{
|
|
8945
|
-
type: "text",
|
|
8946
|
-
value: documentNumber,
|
|
8947
|
-
onChange: (e) => setDocumentNumber(e.target.value),
|
|
8948
|
-
placeholder: t2("crm.companyForm.documentPlaceholder"),
|
|
8949
|
-
className: inputClass
|
|
8950
|
-
}
|
|
8951
|
-
),
|
|
8952
|
-
docValid === false && /* @__PURE__ */ jsx("p", { className: "mt-1 text-[11px] text-warning-foreground", children: t2("crm.companyForm.documentInvalidHint") }),
|
|
8953
|
-
duplicate && /* @__PURE__ */ jsxs("p", { className: "mt-1 text-[11px] text-destructive", children: [
|
|
8954
|
-
t2("crm.companyForm.documentTakenHint"),
|
|
8955
|
-
" ",
|
|
8956
|
-
/* @__PURE__ */ jsx("strong", { children: duplicate.name })
|
|
8957
|
-
] })
|
|
8958
|
-
] }),
|
|
8959
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
8960
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
8961
|
-
/* @__PURE__ */ jsx("label", { className: "text-xs font-medium text-muted-foreground", children: t2("crm.companyForm.email") }),
|
|
8962
|
-
/* @__PURE__ */ jsx("input", { type: "email", value: email, onChange: (e) => setEmail(e.target.value), className: inputClass })
|
|
8963
|
-
] }),
|
|
8964
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
8965
|
-
/* @__PURE__ */ jsx("label", { className: "text-xs font-medium text-muted-foreground", children: t2("crm.companyForm.phone") }),
|
|
8966
|
-
/* @__PURE__ */ jsx("input", { type: "tel", value: phone, onChange: (e) => setPhone(e.target.value), className: inputClass })
|
|
8967
|
-
] })
|
|
8968
|
-
] }),
|
|
8969
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
8970
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
8971
|
-
/* @__PURE__ */ jsx("label", { className: "text-xs font-medium text-muted-foreground", children: t2("crm.companyForm.website") }),
|
|
8972
|
-
/* @__PURE__ */ jsx("input", { type: "text", value: website, onChange: (e) => setWebsite(e.target.value), className: inputClass })
|
|
8973
|
-
] }),
|
|
8974
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
8975
|
-
/* @__PURE__ */ jsx("label", { className: "text-xs font-medium text-muted-foreground", children: t2("crm.companyForm.instagram") }),
|
|
8976
|
-
/* @__PURE__ */ jsx(
|
|
8977
|
-
"input",
|
|
8978
|
-
{
|
|
8979
|
-
type: "text",
|
|
8980
|
-
value: instagram,
|
|
8981
|
-
onChange: (e) => setInstagram(e.target.value),
|
|
8982
|
-
placeholder: "@casa",
|
|
8983
|
-
className: inputClass
|
|
8984
|
-
}
|
|
8985
|
-
)
|
|
8986
|
-
] })
|
|
8987
|
-
] }),
|
|
8988
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-3 gap-3", children: [
|
|
8989
|
-
/* @__PURE__ */ jsxs("div", { className: "col-span-2", children: [
|
|
8990
|
-
/* @__PURE__ */ jsx("label", { className: "text-xs font-medium text-muted-foreground", children: t2("crm.companyForm.city") }),
|
|
8991
|
-
/* @__PURE__ */ jsx("input", { type: "text", value: city, onChange: (e) => setCity(e.target.value), className: inputClass })
|
|
8992
|
-
] }),
|
|
8993
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
8994
|
-
/* @__PURE__ */ jsx("label", { className: "text-xs font-medium text-muted-foreground", children: t2("crm.companyForm.state") }),
|
|
8995
|
-
/* @__PURE__ */ jsx("input", { type: "text", value: state, onChange: (e) => setState(e.target.value), className: inputClass })
|
|
8996
|
-
] })
|
|
8997
|
-
] }),
|
|
8998
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
8999
|
-
/* @__PURE__ */ jsx("label", { className: "text-xs font-medium text-muted-foreground", children: t2("crm.companyForm.notes") }),
|
|
9000
|
-
/* @__PURE__ */ jsx(
|
|
9001
|
-
"textarea",
|
|
9002
|
-
{
|
|
9003
|
-
value: notes,
|
|
9004
|
-
onChange: (e) => setNotes(e.target.value),
|
|
9005
|
-
rows: 2,
|
|
9006
|
-
className: `${inputClass} resize-none`
|
|
9007
|
-
}
|
|
9008
|
-
)
|
|
9009
|
-
] })
|
|
9010
|
-
] }),
|
|
9011
|
-
/* @__PURE__ */ jsxs(SheetFooter, { children: [
|
|
9012
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: () => onSaved?.(), children: t2("common.cancel") }),
|
|
9013
|
-
/* @__PURE__ */ jsx(
|
|
9014
|
-
Button,
|
|
9015
|
-
{
|
|
9016
|
-
onClick: submit,
|
|
9017
|
-
disabled: saving || duplicate !== null || !name.trim() && !legalName.trim(),
|
|
9018
|
-
children: t2("common.save")
|
|
9019
|
-
}
|
|
9020
|
-
)
|
|
9021
|
-
] })
|
|
9022
|
-
]
|
|
9080
|
+
const digits2 = normalizeDocument(input.documentNumber);
|
|
9081
|
+
if (digits2.length === 11 || digits2.length === 14) {
|
|
9082
|
+
const found = await provider.findCompanyByDocument(digits2);
|
|
9083
|
+
if (found && found.id !== companyId) {
|
|
9084
|
+
toast.error(`${t2("crm.companyForm.documentTakenHint")} ${found.name}`);
|
|
9085
|
+
throw new Error("document taken");
|
|
9086
|
+
}
|
|
9023
9087
|
}
|
|
9024
|
-
|
|
9088
|
+
const saved = await saveCompany(input);
|
|
9089
|
+
return { id: saved.id };
|
|
9090
|
+
}
|
|
9091
|
+
const cancel = onCancel ?? (() => onSaved?.());
|
|
9092
|
+
const title = companyId ? t2("crm.companyForm.editTitle") : t2("crm.companyForm.title");
|
|
9093
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-5", children: [
|
|
9094
|
+
(!companyId || !initialData) && /* @__PURE__ */ jsx(SubpageHeader, { title, onBack: cancel, parentLabel: t2("crm.companies.title") }),
|
|
9095
|
+
!initialData ? /* @__PURE__ */ jsx(CrudFormSkeleton, {}) : /* @__PURE__ */ jsx(
|
|
9096
|
+
CrudFormPage,
|
|
9097
|
+
{
|
|
9098
|
+
entityDef: entity,
|
|
9099
|
+
mode: companyId ? "edit" : "create",
|
|
9100
|
+
initialData,
|
|
9101
|
+
onSubmit: submit,
|
|
9102
|
+
onSaved: (created) => onSaved?.(created?.id ?? companyId),
|
|
9103
|
+
onCancel: cancel,
|
|
9104
|
+
namePlural: t2("crm.companies.title"),
|
|
9105
|
+
hideBreadcrumb: !companyId
|
|
9106
|
+
}
|
|
9107
|
+
)
|
|
9108
|
+
] });
|
|
9025
9109
|
}
|
|
9110
|
+
var INLINE_LINK = "text-xs font-normal text-primary hover:underline";
|
|
9026
9111
|
function CompanyGroupBadge({ companyId, onOpenCompany }) {
|
|
9027
9112
|
const provider = useCrmProvider();
|
|
9028
9113
|
const { currency } = useCrmConfig();
|
|
@@ -9053,10 +9138,12 @@ function CompanyGroupBadge({ companyId, onOpenCompany }) {
|
|
|
9053
9138
|
group.wonValue > 0 && /* @__PURE__ */ jsx("span", { className: "ml-auto text-sm font-semibold tabular-nums", children: formatCurrency(group.wonValue, currency) })
|
|
9054
9139
|
] }),
|
|
9055
9140
|
siblings.length > 0 && /* @__PURE__ */ jsx("div", { className: "mt-1.5 flex flex-wrap gap-x-3 gap-y-1 pl-6", children: siblings.map((m) => /* @__PURE__ */ jsx(
|
|
9056
|
-
|
|
9141
|
+
Button,
|
|
9057
9142
|
{
|
|
9143
|
+
variant: "bare",
|
|
9144
|
+
size: "bare",
|
|
9058
9145
|
onClick: () => onOpenCompany?.(m.companyId),
|
|
9059
|
-
className:
|
|
9146
|
+
className: INLINE_LINK,
|
|
9060
9147
|
children: m.companyName
|
|
9061
9148
|
},
|
|
9062
9149
|
m.id
|
|
@@ -9115,10 +9202,11 @@ function LinkContactDialog({
|
|
|
9115
9202
|
/* @__PURE__ */ jsxs("div", { className: "max-h-56 overflow-y-auto rounded-card border divide-y", children: [
|
|
9116
9203
|
results.length === 0 && /* @__PURE__ */ jsx("p", { className: "px-4 py-3 text-sm text-muted-foreground", children: t2("crm.companyDetail.linkNoResults") }),
|
|
9117
9204
|
results.map((lead) => /* @__PURE__ */ jsxs(
|
|
9118
|
-
|
|
9205
|
+
Button,
|
|
9119
9206
|
{
|
|
9207
|
+
variant: "ghost",
|
|
9120
9208
|
onClick: () => setSelected(lead),
|
|
9121
|
-
className: `flex w-full flex-col items-start px-4 py-2 text-left
|
|
9209
|
+
className: `flex h-auto w-full flex-col items-start gap-0 whitespace-normal rounded-none px-4 py-2 text-left font-normal ${selected?.id === lead.id ? "bg-muted" : ""}`,
|
|
9122
9210
|
children: [
|
|
9123
9211
|
/* @__PURE__ */ jsx("span", { className: "text-sm", children: lead.name }),
|
|
9124
9212
|
/* @__PURE__ */ jsxs("span", { className: "text-[11px] text-muted-foreground", children: [
|
|
@@ -9176,28 +9264,120 @@ function FieldRow2({ label: label2, value }) {
|
|
|
9176
9264
|
/* @__PURE__ */ jsx("dd", { className: "col-span-2 text-sm text-foreground", children: value ?? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground/50", children: "\u2014" }) })
|
|
9177
9265
|
] });
|
|
9178
9266
|
}
|
|
9267
|
+
function ReceitaTab({ receita }) {
|
|
9268
|
+
const t2 = useTranslation();
|
|
9269
|
+
const { currency } = useCrmConfig();
|
|
9270
|
+
if (!receita) return /* @__PURE__ */ jsx("p", { className: "px-1 py-4 text-sm text-muted-foreground", children: t2("crm.companyDetail.receitaNone") });
|
|
9271
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
9272
|
+
receita.consultadoEm && /* @__PURE__ */ jsxs("p", { className: "mb-2 flex items-center gap-1.5 text-xs text-muted-foreground", children: [
|
|
9273
|
+
/* @__PURE__ */ jsx(Fingerprint, { className: "h-3.5 w-3.5" }),
|
|
9274
|
+
t2("crm.companyDetail.receitaCheckedOn"),
|
|
9275
|
+
" ",
|
|
9276
|
+
receita.consultadoEm
|
|
9277
|
+
] }),
|
|
9278
|
+
/* @__PURE__ */ jsx("div", { className: "rounded-card border bg-card shadow-sm", children: /* @__PURE__ */ jsxs("dl", { className: "grid divide-y md:grid-cols-2 md:divide-y-0", children: [
|
|
9279
|
+
/* @__PURE__ */ jsx("div", { className: "px-5 md:border-b", children: /* @__PURE__ */ jsx(FieldRow2, { label: t2("crm.companyDetail.receitaSituacao"), value: receita.situacao ? (
|
|
9280
|
+
// "BAIXADA" é a empresa não existir mais; em cinza passa despercebido.
|
|
9281
|
+
/* @__PURE__ */ jsx("span", { className: receita.situacao === "ATIVA" ? void 0 : "font-medium text-destructive", children: receita.situacao })
|
|
9282
|
+
) : null }) }),
|
|
9283
|
+
/* @__PURE__ */ jsx("div", { className: "px-5 md:border-b", children: /* @__PURE__ */ jsx(FieldRow2, { label: t2("crm.companyDetail.receitaLegalName"), value: receita.razaoSocial ?? null }) }),
|
|
9284
|
+
/* @__PURE__ */ jsx("div", { className: "px-5 md:border-b", children: /* @__PURE__ */ jsx(FieldRow2, { label: t2("crm.companyDetail.receitaPorte"), value: receita.porte ?? null }) }),
|
|
9285
|
+
/* @__PURE__ */ jsx("div", { className: "px-5 md:border-b", children: /* @__PURE__ */ jsx(
|
|
9286
|
+
FieldRow2,
|
|
9287
|
+
{
|
|
9288
|
+
label: t2("crm.companyDetail.receitaCapital"),
|
|
9289
|
+
value: receita.capitalSocial != null ? formatCurrency(receita.capitalSocial, currency) : null
|
|
9290
|
+
}
|
|
9291
|
+
) }),
|
|
9292
|
+
/* @__PURE__ */ jsx("div", { className: "px-5 md:border-b", children: /* @__PURE__ */ jsx(FieldRow2, { label: t2("crm.companyDetail.receitaOpened"), value: receita.abertura ?? null }) }),
|
|
9293
|
+
/* @__PURE__ */ jsx("div", { className: "px-5 md:border-b", children: /* @__PURE__ */ jsx(
|
|
9294
|
+
FieldRow2,
|
|
9295
|
+
{
|
|
9296
|
+
label: t2("crm.companyDetail.receitaPartners"),
|
|
9297
|
+
value: receita.socios != null ? String(receita.socios) : null
|
|
9298
|
+
}
|
|
9299
|
+
) }),
|
|
9300
|
+
/* @__PURE__ */ jsx("div", { className: "px-5 md:col-span-2 md:border-t", children: /* @__PURE__ */ jsx(
|
|
9301
|
+
FieldRow2,
|
|
9302
|
+
{
|
|
9303
|
+
label: t2("crm.companyDetail.receitaCnae"),
|
|
9304
|
+
value: receita.cnaeDescricao ? /* @__PURE__ */ jsxs("span", { children: [
|
|
9305
|
+
receita.cnaeDescricao,
|
|
9306
|
+
receita.cnae && /* @__PURE__ */ jsx("span", { className: "ml-1.5 tabular-nums text-muted-foreground", children: receita.cnae })
|
|
9307
|
+
] }) : receita.cnae ?? null
|
|
9308
|
+
}
|
|
9309
|
+
) })
|
|
9310
|
+
] }) })
|
|
9311
|
+
] });
|
|
9312
|
+
}
|
|
9313
|
+
function PeopleTab({ people, groupSiblings, onLink, onUnlink, onOpenLead }) {
|
|
9314
|
+
const t2 = useTranslation();
|
|
9315
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
9316
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3", children: [
|
|
9317
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: (groupSiblings ?? 0) > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9318
|
+
/* @__PURE__ */ jsx(Link2, { className: "mr-1 inline h-3 w-3" }),
|
|
9319
|
+
t2("crm.companyDetail.groupHint", { count: String(groupSiblings) })
|
|
9320
|
+
] }) }),
|
|
9321
|
+
/* @__PURE__ */ jsx(Button, { size: "sm", variant: "outline", onClick: onLink, children: t2("crm.companyDetail.link") })
|
|
9322
|
+
] }),
|
|
9323
|
+
/* @__PURE__ */ jsxs("div", { className: "divide-y rounded-card border bg-card shadow-sm", children: [
|
|
9324
|
+
people.length === 0 && /* @__PURE__ */ jsx("p", { className: "px-5 py-4 text-sm text-muted-foreground", children: t2("crm.companyDetail.noPeople") }),
|
|
9325
|
+
people.map((cp) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 px-5 py-3", children: [
|
|
9326
|
+
/* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: "font-normal whitespace-normal justify-start flex flex-col items-start text-left", onClick: () => onOpenLead?.(cp.personId), children: [
|
|
9327
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-primary hover:underline", children: cp.personName }),
|
|
9328
|
+
/* @__PURE__ */ jsxs("span", { className: "text-[11px] text-muted-foreground", children: [
|
|
9329
|
+
cp.role || t2("crm.companyDetail.noRole"),
|
|
9330
|
+
cp.isPrimary && ` \xB7 ${t2("crm.companyDetail.primary")}`
|
|
9331
|
+
] })
|
|
9332
|
+
] }),
|
|
9333
|
+
/* @__PURE__ */ jsx(Button, { variant: "bare", size: "bare", onClick: () => onUnlink(cp), className: "font-normal whitespace-normal text-[11px] text-muted-foreground hover:text-destructive", children: t2("crm.companyDetail.unlink") })
|
|
9334
|
+
] }, cp.id))
|
|
9335
|
+
] })
|
|
9336
|
+
] });
|
|
9337
|
+
}
|
|
9338
|
+
function DealsTab({ deals, onOpenDeal }) {
|
|
9339
|
+
const t2 = useTranslation();
|
|
9340
|
+
const { currency } = useCrmConfig();
|
|
9341
|
+
return /* @__PURE__ */ jsxs("div", { className: "divide-y rounded-card border bg-card shadow-sm", children: [
|
|
9342
|
+
deals.length === 0 && /* @__PURE__ */ jsx("p", { className: "px-5 py-4 text-sm text-muted-foreground", children: t2("crm.companyDetail.noDeals") }),
|
|
9343
|
+
deals.map((d) => {
|
|
9344
|
+
const conteudo = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9345
|
+
/* @__PURE__ */ jsxs("span", { className: "flex flex-col text-left", children: [
|
|
9346
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm", children: d.title }),
|
|
9347
|
+
/* @__PURE__ */ jsxs("span", { className: "text-[11px] text-muted-foreground", children: [
|
|
9348
|
+
d.stageName,
|
|
9349
|
+
" \xB7 ",
|
|
9350
|
+
formatRelativeTime(d.createdAt)
|
|
9351
|
+
] })
|
|
9352
|
+
] }),
|
|
9353
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm tabular-nums", children: formatCurrency(d.value, currency) })
|
|
9354
|
+
] });
|
|
9355
|
+
const classe = "flex w-full items-center justify-between gap-3 px-5 py-3";
|
|
9356
|
+
return onOpenDeal ? /* @__PURE__ */ jsx(Button, { variant: "bare", size: "bare", type: "button", onClick: () => onOpenDeal(d.id), className: `font-normal whitespace-normal justify-start ${classe} text-left transition-colors hover:bg-muted/40`, children: conteudo }, d.id) : /* @__PURE__ */ jsx("div", { className: classe, children: conteudo }, d.id);
|
|
9357
|
+
})
|
|
9358
|
+
] });
|
|
9359
|
+
}
|
|
9179
9360
|
function CompanyDetailView({
|
|
9180
9361
|
companyId,
|
|
9181
9362
|
onBack,
|
|
9182
9363
|
onEdit,
|
|
9183
9364
|
onOpenLead,
|
|
9184
9365
|
onOpenCompany,
|
|
9185
|
-
onOpenDeal
|
|
9366
|
+
onOpenDeal,
|
|
9367
|
+
initialTab
|
|
9186
9368
|
}) {
|
|
9187
9369
|
const t2 = useTranslation();
|
|
9188
|
-
const { currency } = useCrmConfig();
|
|
9189
9370
|
const provider = useCrmProvider();
|
|
9190
9371
|
const canArchive = useCanArchive();
|
|
9191
9372
|
const archiveCompany = useCrmStore((s) => s.archiveCompany);
|
|
9192
9373
|
const unlinkCompanyPerson = useCrmStore((s) => s.unlinkCompanyPerson);
|
|
9374
|
+
const saveCompany = useCrmStore((s) => s.saveCompany);
|
|
9193
9375
|
const [company, setCompany] = useState(null);
|
|
9194
9376
|
useRecordVisit(company ? {
|
|
9195
9377
|
id: company.id,
|
|
9196
9378
|
kind: "company",
|
|
9197
9379
|
kindLabel: t2("crm.companies.title"),
|
|
9198
9380
|
label: company.name || company.legalName || "",
|
|
9199
|
-
// Só quando DIZ outra coisa. A razão social costuma ser igual ao nome
|
|
9200
|
-
// fantasia, e um subtítulo que repete o título é ruído.
|
|
9201
9381
|
subtitle: company.legalName && company.legalName !== company.name ? company.legalName : void 0,
|
|
9202
9382
|
archetype: "company"
|
|
9203
9383
|
} : null);
|
|
@@ -9214,13 +9394,11 @@ function CompanyDetailView({
|
|
|
9214
9394
|
return abertos.reduce((a, b) => (b.updatedAt ?? b.createdAt ?? "") > (a.updatedAt ?? a.createdAt ?? "") ? b : a);
|
|
9215
9395
|
}, [deals]);
|
|
9216
9396
|
const load = useCallback(async () => {
|
|
9217
|
-
setLoading(true);
|
|
9218
9397
|
try {
|
|
9219
9398
|
const [c, p, d] = await Promise.all([
|
|
9220
9399
|
provider.getCompanyById(companyId),
|
|
9221
9400
|
provider.getCompanyPeople(companyId),
|
|
9222
|
-
//
|
|
9223
|
-
// que faz uma ficha de empresa valer alguma coisa.
|
|
9401
|
+
// Filtered by the database, all statuses: the history is half of what a company record is for.
|
|
9224
9402
|
provider.getDeals({ companyId, pageSize: 200 })
|
|
9225
9403
|
]);
|
|
9226
9404
|
setCompany(c);
|
|
@@ -9231,6 +9409,7 @@ function CompanyDetailView({
|
|
|
9231
9409
|
}
|
|
9232
9410
|
}, [companyId]);
|
|
9233
9411
|
useEffect(() => {
|
|
9412
|
+
setLoading(true);
|
|
9234
9413
|
void load();
|
|
9235
9414
|
}, [load]);
|
|
9236
9415
|
useEffect(() => {
|
|
@@ -9244,243 +9423,77 @@ function CompanyDetailView({
|
|
|
9244
9423
|
vivo = false;
|
|
9245
9424
|
};
|
|
9246
9425
|
}, [provider, companyId]);
|
|
9247
|
-
|
|
9426
|
+
const entity = useMemo(() => {
|
|
9427
|
+
const base = buildCompanyEntity(t2, companyId);
|
|
9428
|
+
const tab = (id, label2, icon, component, props) => ({ id, label: label2, icon, component, props });
|
|
9429
|
+
const tabs = [
|
|
9430
|
+
tab("people", t2("crm.companyDetail.people"), "Users", PeopleTab, {
|
|
9431
|
+
people,
|
|
9432
|
+
groupSiblings: company?.groupSiblings,
|
|
9433
|
+
onLink: () => setLinking(true),
|
|
9434
|
+
onUnlink: setUnlinkTarget,
|
|
9435
|
+
onOpenLead
|
|
9436
|
+
}),
|
|
9437
|
+
tab("deals", t2("crm.companyDetail.deals"), "Handshake", DealsTab, { deals, onOpenDeal }),
|
|
9438
|
+
tab("receita", t2("crm.companyDetail.receita"), "Fingerprint", ReceitaTab, { receita })
|
|
9439
|
+
];
|
|
9440
|
+
return { ...base, detailTabs: tabs };
|
|
9441
|
+
}, [t2, companyId, people, deals, receita, company?.groupSiblings, onOpenLead, onOpenDeal]);
|
|
9442
|
+
const extraActions = [
|
|
9443
|
+
...negocioDoFunil && onOpenDeal ? [{
|
|
9444
|
+
id: "open-in-pipeline",
|
|
9445
|
+
label: t2("crm.companyDetail.openInPipeline"),
|
|
9446
|
+
icon: Filter,
|
|
9447
|
+
intent: "primary",
|
|
9448
|
+
onSelect: () => onOpenDeal(negocioDoFunil.id)
|
|
9449
|
+
}] : [],
|
|
9450
|
+
...canArchive ? [{
|
|
9451
|
+
id: "archive",
|
|
9452
|
+
label: t2("crm.companies.archive"),
|
|
9453
|
+
icon: Archive,
|
|
9454
|
+
intent: "danger",
|
|
9455
|
+
onSelect: () => setArchiving(true)
|
|
9456
|
+
}] : []
|
|
9457
|
+
];
|
|
9458
|
+
async function saveFields(values) {
|
|
9459
|
+
if (!company) return;
|
|
9460
|
+
const s = (k) => typeof values[k] === "string" ? values[k].trim() : void 0;
|
|
9461
|
+
const instagram = s("instagram");
|
|
9462
|
+
await saveCompany({
|
|
9463
|
+
id: company.id,
|
|
9464
|
+
name: s("name") || company.name,
|
|
9465
|
+
legalName: s("legalName"),
|
|
9466
|
+
email: s("email"),
|
|
9467
|
+
phone: s("phone"),
|
|
9468
|
+
website: s("website"),
|
|
9469
|
+
instagram: instagram === void 0 ? void 0 : normalizeInstagram(instagram) ?? "",
|
|
9470
|
+
city: s("city"),
|
|
9471
|
+
state: s("state"),
|
|
9472
|
+
notes: s("notes")
|
|
9473
|
+
});
|
|
9474
|
+
await load();
|
|
9475
|
+
}
|
|
9476
|
+
if (loading) return /* @__PURE__ */ jsx(CrudDetailSkeleton, {});
|
|
9248
9477
|
if (!company) return /* @__PURE__ */ jsx("div", { className: "p-6 text-sm text-muted-foreground", children: t2("crm.companyDetail.notFound") });
|
|
9249
|
-
return /* @__PURE__ */ jsxs(
|
|
9250
|
-
/* @__PURE__ */ jsx(SubpageHeader, { title: company.name, parentLabel: t2("crm.companies.title"), onBack }),
|
|
9251
|
-
/* @__PURE__ */ jsx(CompanyGroupBadge, { companyId: company.id, onOpenCompany: (id) => onOpenCompany?.(id) }),
|
|
9252
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-4", children: [
|
|
9253
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
9254
|
-
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-foreground", children: company.name }),
|
|
9255
|
-
company.legalName && company.legalName !== company.name && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: company.legalName })
|
|
9256
|
-
] }),
|
|
9257
|
-
/* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-2", children: [
|
|
9258
|
-
negocioDoFunil && onOpenDeal && /* @__PURE__ */ jsxs(
|
|
9259
|
-
"button",
|
|
9260
|
-
{
|
|
9261
|
-
onClick: () => onOpenDeal(negocioDoFunil.id),
|
|
9262
|
-
className: "inline-flex items-center gap-1.5 rounded-button bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground shadow-button transition-opacity hover:opacity-90",
|
|
9263
|
-
children: [
|
|
9264
|
-
/* @__PURE__ */ jsx(Filter, { className: "h-3 w-3" }),
|
|
9265
|
-
" ",
|
|
9266
|
-
t2("crm.companyDetail.openInPipeline")
|
|
9267
|
-
]
|
|
9268
|
-
}
|
|
9269
|
-
),
|
|
9270
|
-
/* @__PURE__ */ jsx(
|
|
9271
|
-
"button",
|
|
9272
|
-
{
|
|
9273
|
-
onClick: () => onEdit?.(company.id),
|
|
9274
|
-
className: "rounded-button border bg-card px-3 py-1.5 text-xs font-medium shadow-button hover:bg-muted",
|
|
9275
|
-
children: t2("common.edit")
|
|
9276
|
-
}
|
|
9277
|
-
),
|
|
9278
|
-
canArchive && /* @__PURE__ */ jsxs(Dropdown, { children: [
|
|
9279
|
-
/* @__PURE__ */ jsx(DropdownTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
9280
|
-
"button",
|
|
9281
|
-
{
|
|
9282
|
-
"aria-label": t2("crm.companyDetail.moreActions"),
|
|
9283
|
-
className: "inline-flex h-[30px] w-[30px] items-center justify-center rounded-button border bg-card text-muted-foreground shadow-button transition-colors hover:bg-muted hover:text-foreground",
|
|
9284
|
-
children: /* @__PURE__ */ jsx(MoreHorizontal, { className: "h-4 w-4" })
|
|
9285
|
-
}
|
|
9286
|
-
) }),
|
|
9287
|
-
/* @__PURE__ */ jsx(DropdownContent, { align: "end", children: /* @__PURE__ */ jsxs(DropdownItem, { onSelect: () => setArchiving(true), children: [
|
|
9288
|
-
/* @__PURE__ */ jsx(Archive, { className: "h-3.5 w-3.5" }),
|
|
9289
|
-
" ",
|
|
9290
|
-
t2("crm.companies.archive")
|
|
9291
|
-
] }) })
|
|
9292
|
-
] })
|
|
9293
|
-
] })
|
|
9294
|
-
] }),
|
|
9295
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
9296
|
-
/* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold text-foreground mb-1", children: t2("crm.companyDetail.identity") }),
|
|
9297
|
-
/* @__PURE__ */ jsx("div", { className: "rounded-card border bg-card shadow-sm", children: /* @__PURE__ */ jsxs("dl", { className: "grid divide-y md:grid-cols-2 md:divide-y-0", children: [
|
|
9298
|
-
/* @__PURE__ */ jsx("div", { className: "px-5 md:border-b", children: /* @__PURE__ */ jsx(
|
|
9299
|
-
FieldRow2,
|
|
9300
|
-
{
|
|
9301
|
-
label: t2("crm.companies.documentCol"),
|
|
9302
|
-
value: company.documentNumber ? /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
9303
|
-
/* @__PURE__ */ jsx("span", { className: "tabular-nums", children: formatDocument2(company.documentNumber) }),
|
|
9304
|
-
company.documentValid === false && /* @__PURE__ */ jsx("span", { className: "rounded-full bg-warning-soft px-1.5 py-0.5 text-[10px] text-warning-foreground", children: t2("crm.companies.documentInvalid") })
|
|
9305
|
-
] }) : null
|
|
9306
|
-
}
|
|
9307
|
-
) }),
|
|
9308
|
-
/* @__PURE__ */ jsx("div", { className: "px-5 md:border-b", children: /* @__PURE__ */ jsx(
|
|
9309
|
-
FieldRow2,
|
|
9310
|
-
{
|
|
9311
|
-
label: t2("crm.companyDetail.email"),
|
|
9312
|
-
value: company.email ? /* @__PURE__ */ jsx("a", { href: `mailto:${company.email}`, className: "text-primary hover:underline", children: company.email }) : null
|
|
9313
|
-
}
|
|
9314
|
-
) }),
|
|
9315
|
-
/* @__PURE__ */ jsx("div", { className: "px-5 md:border-b md:last:border-b-0", children: /* @__PURE__ */ jsx(
|
|
9316
|
-
FieldRow2,
|
|
9317
|
-
{
|
|
9318
|
-
label: t2("crm.companyDetail.phone"),
|
|
9319
|
-
value: company.phone ? /* @__PURE__ */ jsx(PhoneLink, { phone: company.phone, className: "text-primary" }) : null
|
|
9320
|
-
}
|
|
9321
|
-
) }),
|
|
9322
|
-
/* @__PURE__ */ jsx("div", { className: "px-5 md:border-b md:last:border-b-0", children: /* @__PURE__ */ jsx(
|
|
9323
|
-
FieldRow2,
|
|
9324
|
-
{
|
|
9325
|
-
label: t2("crm.companyDetail.location"),
|
|
9326
|
-
value: [company.city, company.state].filter(Boolean).join(" / ") || null
|
|
9327
|
-
}
|
|
9328
|
-
) }),
|
|
9329
|
-
/* @__PURE__ */ jsx("div", { className: "px-5 md:border-b md:last:border-b-0", children: /* @__PURE__ */ jsx(
|
|
9330
|
-
FieldRow2,
|
|
9331
|
-
{
|
|
9332
|
-
label: t2("crm.companyDetail.instagram"),
|
|
9333
|
-
value: company.instagram ? instagramUrl(company.instagram) ? /* @__PURE__ */ jsxs(
|
|
9334
|
-
"a",
|
|
9335
|
-
{
|
|
9336
|
-
href: instagramUrl(company.instagram),
|
|
9337
|
-
target: "_blank",
|
|
9338
|
-
rel: "noreferrer",
|
|
9339
|
-
className: "text-primary hover:underline",
|
|
9340
|
-
children: [
|
|
9341
|
-
"@",
|
|
9342
|
-
normalizeInstagram(company.instagram)
|
|
9343
|
-
]
|
|
9344
|
-
}
|
|
9345
|
-
) : /* @__PURE__ */ jsx("span", { children: company.instagram }) : null
|
|
9346
|
-
}
|
|
9347
|
-
) })
|
|
9348
|
-
] }) })
|
|
9349
|
-
] }),
|
|
9350
|
-
receita && /* @__PURE__ */ jsxs("div", { children: [
|
|
9351
|
-
/* @__PURE__ */ jsxs("h3", { className: "mb-1 flex items-center gap-1.5 text-sm font-semibold text-foreground", children: [
|
|
9352
|
-
/* @__PURE__ */ jsx(Fingerprint, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
9353
|
-
t2("crm.companyDetail.receita"),
|
|
9354
|
-
receita.consultadoEm && /* @__PURE__ */ jsxs("span", { className: "text-xs font-normal text-muted-foreground", children: [
|
|
9355
|
-
"\xB7 ",
|
|
9356
|
-
t2("crm.companyDetail.receitaCheckedOn"),
|
|
9357
|
-
" ",
|
|
9358
|
-
receita.consultadoEm
|
|
9359
|
-
] })
|
|
9360
|
-
] }),
|
|
9361
|
-
/* @__PURE__ */ jsx("div", { className: "rounded-card border bg-card shadow-sm", children: /* @__PURE__ */ jsxs("dl", { className: "grid divide-y md:grid-cols-2 md:divide-y-0", children: [
|
|
9362
|
-
/* @__PURE__ */ jsx("div", { className: "px-5 md:border-b", children: /* @__PURE__ */ jsx(FieldRow2, { label: t2("crm.companyDetail.receitaSituacao"), value: receita.situacao ? (
|
|
9363
|
-
// "BAIXADA" não é um detalhe: é a empresa não existir mais.
|
|
9364
|
-
// Em cinzento ao lado de porte e capital, passa despercebida.
|
|
9365
|
-
/* @__PURE__ */ jsx("span", { className: receita.situacao === "ATIVA" ? void 0 : "font-medium text-destructive", children: receita.situacao })
|
|
9366
|
-
) : null }) }),
|
|
9367
|
-
/* @__PURE__ */ jsx("div", { className: "px-5 md:border-b", children: /* @__PURE__ */ jsx(FieldRow2, { label: t2("crm.companyDetail.receitaLegalName"), value: receita.razaoSocial ?? null }) }),
|
|
9368
|
-
/* @__PURE__ */ jsx("div", { className: "px-5 md:border-b", children: /* @__PURE__ */ jsx(FieldRow2, { label: t2("crm.companyDetail.receitaPorte"), value: receita.porte ?? null }) }),
|
|
9369
|
-
/* @__PURE__ */ jsx("div", { className: "px-5 md:border-b", children: /* @__PURE__ */ jsx(
|
|
9370
|
-
FieldRow2,
|
|
9371
|
-
{
|
|
9372
|
-
label: t2("crm.companyDetail.receitaCapital"),
|
|
9373
|
-
value: receita.capitalSocial != null ? formatCurrency(receita.capitalSocial, currency) : null
|
|
9374
|
-
}
|
|
9375
|
-
) }),
|
|
9376
|
-
/* @__PURE__ */ jsx("div", { className: "px-5 md:border-b", children: /* @__PURE__ */ jsx(FieldRow2, { label: t2("crm.companyDetail.receitaOpened"), value: receita.abertura ?? null }) }),
|
|
9377
|
-
/* @__PURE__ */ jsx("div", { className: "px-5 md:border-b", children: /* @__PURE__ */ jsx(
|
|
9378
|
-
FieldRow2,
|
|
9379
|
-
{
|
|
9380
|
-
label: t2("crm.companyDetail.receitaPartners"),
|
|
9381
|
-
value: receita.socios != null ? String(receita.socios) : null
|
|
9382
|
-
}
|
|
9383
|
-
) }),
|
|
9384
|
-
/* @__PURE__ */ jsx("div", { className: "px-5 md:col-span-2 md:border-t", children: /* @__PURE__ */ jsx(
|
|
9385
|
-
FieldRow2,
|
|
9386
|
-
{
|
|
9387
|
-
label: t2("crm.companyDetail.receitaCnae"),
|
|
9388
|
-
value: receita.cnaeDescricao ? /* @__PURE__ */ jsxs("span", { children: [
|
|
9389
|
-
receita.cnaeDescricao,
|
|
9390
|
-
receita.cnae && /* @__PURE__ */ jsx("span", { className: "ml-1.5 tabular-nums text-muted-foreground", children: receita.cnae })
|
|
9391
|
-
] }) : receita.cnae ?? null
|
|
9392
|
-
}
|
|
9393
|
-
) })
|
|
9394
|
-
] }) })
|
|
9395
|
-
] }),
|
|
9396
|
-
(company.groupSiblings ?? 0) > 0 && /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
|
|
9397
|
-
/* @__PURE__ */ jsx(Link2, { className: "inline h-3 w-3 mr-1" }),
|
|
9398
|
-
t2("crm.companyDetail.groupHint", { count: String(company.groupSiblings) })
|
|
9399
|
-
] }),
|
|
9400
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
9401
|
-
/* @__PURE__ */ jsxs("div", { className: "mb-1 flex items-center justify-between", children: [
|
|
9402
|
-
/* @__PURE__ */ jsxs("h3", { className: "text-sm font-semibold text-foreground", children: [
|
|
9403
|
-
/* @__PURE__ */ jsx(Users, { className: "inline h-3.5 w-3.5 mr-1" }),
|
|
9404
|
-
t2("crm.companyDetail.people")
|
|
9405
|
-
] }),
|
|
9406
|
-
/* @__PURE__ */ jsx(
|
|
9407
|
-
"button",
|
|
9408
|
-
{
|
|
9409
|
-
onClick: () => setLinking(true),
|
|
9410
|
-
className: "rounded-button border bg-card px-2.5 py-1 text-[11px] font-medium shadow-button hover:bg-muted",
|
|
9411
|
-
children: t2("crm.companyDetail.link")
|
|
9412
|
-
}
|
|
9413
|
-
)
|
|
9414
|
-
] }),
|
|
9415
|
-
/* @__PURE__ */ jsxs("div", { className: "rounded-card border bg-card shadow-sm divide-y", children: [
|
|
9416
|
-
people.length === 0 && /* @__PURE__ */ jsx("p", { className: "px-5 py-4 text-sm text-muted-foreground", children: t2("crm.companyDetail.noPeople") }),
|
|
9417
|
-
people.map((cp) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 px-5 py-3", children: [
|
|
9418
|
-
/* @__PURE__ */ jsxs(
|
|
9419
|
-
"button",
|
|
9420
|
-
{
|
|
9421
|
-
className: "flex flex-col items-start text-left",
|
|
9422
|
-
onClick: () => onOpenLead?.(cp.personId),
|
|
9423
|
-
children: [
|
|
9424
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-primary hover:underline", children: cp.personName }),
|
|
9425
|
-
/* @__PURE__ */ jsxs("span", { className: "text-[11px] text-muted-foreground", children: [
|
|
9426
|
-
cp.role || t2("crm.companyDetail.noRole"),
|
|
9427
|
-
cp.isPrimary && ` \xB7 ${t2("crm.companyDetail.primary")}`
|
|
9428
|
-
] })
|
|
9429
|
-
]
|
|
9430
|
-
}
|
|
9431
|
-
),
|
|
9432
|
-
/* @__PURE__ */ jsx(
|
|
9433
|
-
"button",
|
|
9434
|
-
{
|
|
9435
|
-
onClick: () => setUnlinkTarget(cp),
|
|
9436
|
-
className: "text-[11px] text-muted-foreground hover:text-destructive",
|
|
9437
|
-
children: t2("crm.companyDetail.unlink")
|
|
9438
|
-
}
|
|
9439
|
-
)
|
|
9440
|
-
] }, cp.id))
|
|
9441
|
-
] })
|
|
9442
|
-
] }),
|
|
9443
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
9444
|
-
/* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold text-foreground mb-1", children: t2("crm.companyDetail.deals") }),
|
|
9445
|
-
/* @__PURE__ */ jsxs("div", { className: "rounded-card border bg-card shadow-sm divide-y", children: [
|
|
9446
|
-
deals.length === 0 && /* @__PURE__ */ jsx("p", { className: "px-5 py-4 text-sm text-muted-foreground", children: t2("crm.companyDetail.noDeals") }),
|
|
9447
|
-
deals.map((d) => {
|
|
9448
|
-
const conteudo = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9449
|
-
/* @__PURE__ */ jsxs("span", { className: "flex flex-col text-left", children: [
|
|
9450
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm", children: d.title }),
|
|
9451
|
-
/* @__PURE__ */ jsxs("span", { className: "text-[11px] text-muted-foreground", children: [
|
|
9452
|
-
d.stageName,
|
|
9453
|
-
" \xB7 ",
|
|
9454
|
-
formatRelativeTime(d.createdAt)
|
|
9455
|
-
] })
|
|
9456
|
-
] }),
|
|
9457
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm tabular-nums", children: formatCurrency(d.value, currency) })
|
|
9458
|
-
] });
|
|
9459
|
-
const classe = "flex w-full items-center justify-between gap-3 px-5 py-3";
|
|
9460
|
-
return onOpenDeal ? /* @__PURE__ */ jsx(
|
|
9461
|
-
"button",
|
|
9462
|
-
{
|
|
9463
|
-
type: "button",
|
|
9464
|
-
onClick: () => onOpenDeal(d.id),
|
|
9465
|
-
className: `${classe} text-left transition-colors hover:bg-muted/40`,
|
|
9466
|
-
children: conteudo
|
|
9467
|
-
},
|
|
9468
|
-
d.id
|
|
9469
|
-
) : /* @__PURE__ */ jsx("div", { className: classe, children: conteudo }, d.id);
|
|
9470
|
-
})
|
|
9471
|
-
] })
|
|
9472
|
-
] }),
|
|
9478
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9473
9479
|
/* @__PURE__ */ jsx(
|
|
9474
|
-
|
|
9480
|
+
CrudDetailPage,
|
|
9475
9481
|
{
|
|
9476
|
-
|
|
9477
|
-
|
|
9478
|
-
|
|
9479
|
-
|
|
9480
|
-
|
|
9481
|
-
|
|
9482
|
+
entityDef: entity,
|
|
9483
|
+
item: company,
|
|
9484
|
+
namePlural: t2("crm.companies.title"),
|
|
9485
|
+
basePath: "/sales/companies",
|
|
9486
|
+
initialTab,
|
|
9487
|
+
onBack: () => onBack?.(),
|
|
9488
|
+
onEdit: onEdit ? () => onEdit(company.id) : void 0,
|
|
9489
|
+
onFieldsSave: saveFields,
|
|
9490
|
+
badges: /* @__PURE__ */ jsx(CompanyGroupBadge, { companyId: company.id, onOpenCompany: (id) => onOpenCompany?.(id) }),
|
|
9491
|
+
extraActions
|
|
9482
9492
|
}
|
|
9483
9493
|
),
|
|
9494
|
+
/* @__PURE__ */ jsx(LinkContactDialog, { companyId: company.id, open: linking, onClose: () => setLinking(false), onLinked: () => {
|
|
9495
|
+
void load();
|
|
9496
|
+
} }),
|
|
9484
9497
|
/* @__PURE__ */ jsx(
|
|
9485
9498
|
ConfirmDialog,
|
|
9486
9499
|
{
|
|
@@ -9675,10 +9688,11 @@ function LeadSidebar({ leadId, open, onClose, onViewDeal, onOpenLead }) {
|
|
|
9675
9688
|
] }),
|
|
9676
9689
|
lead && (deal || onOpenLead) && /* @__PURE__ */ jsxs(SheetFooter, { children: [
|
|
9677
9690
|
deal && onViewDeal && /* @__PURE__ */ jsxs(
|
|
9678
|
-
|
|
9691
|
+
Button,
|
|
9679
9692
|
{
|
|
9680
9693
|
onClick: () => onViewDeal(deal.id),
|
|
9681
|
-
|
|
9694
|
+
variant: "outline",
|
|
9695
|
+
className: "h-auto flex-1 gap-2 rounded-lg px-3 py-2.5 text-xs font-medium",
|
|
9682
9696
|
children: [
|
|
9683
9697
|
t2("crm.leadSidebar.viewDeal"),
|
|
9684
9698
|
" ",
|
|
@@ -9687,13 +9701,14 @@ function LeadSidebar({ leadId, open, onClose, onViewDeal, onOpenLead }) {
|
|
|
9687
9701
|
}
|
|
9688
9702
|
),
|
|
9689
9703
|
onOpenLead && /* @__PURE__ */ jsxs(
|
|
9690
|
-
|
|
9704
|
+
Button,
|
|
9691
9705
|
{
|
|
9692
9706
|
onClick: () => {
|
|
9693
9707
|
onOpenLead(lead.id);
|
|
9694
9708
|
onClose();
|
|
9695
9709
|
},
|
|
9696
|
-
|
|
9710
|
+
variant: "outline",
|
|
9711
|
+
className: "h-auto flex-1 gap-2 rounded-lg px-3 py-2.5 text-xs font-medium",
|
|
9697
9712
|
children: [
|
|
9698
9713
|
t2("crm.leadSidebar.openFullProfile"),
|
|
9699
9714
|
" ",
|
|
@@ -9825,10 +9840,12 @@ function ActivityListView({ onOpenLead, onOpenQuote, onOpenDeal } = {}) {
|
|
|
9825
9840
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col sm:flex-row gap-3 sm:items-center", children: [
|
|
9826
9841
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-1.5 flex-wrap", children: [
|
|
9827
9842
|
/* @__PURE__ */ jsx(
|
|
9828
|
-
|
|
9843
|
+
Button,
|
|
9829
9844
|
{
|
|
9845
|
+
variant: "bare",
|
|
9846
|
+
size: "bare",
|
|
9830
9847
|
onClick: () => setTypeFilter(null),
|
|
9831
|
-
className: `rounded-full px-2.5 py-1 text-xs font-medium
|
|
9848
|
+
className: `rounded-full px-2.5 py-1 text-xs font-medium ${typeFilter === null ? "bg-primary text-primary-foreground" : "bg-muted/50 text-muted-foreground hover:bg-muted"}`,
|
|
9832
9849
|
children: t2("crm.activities.all")
|
|
9833
9850
|
}
|
|
9834
9851
|
),
|
|
@@ -9836,10 +9853,12 @@ function ActivityListView({ onOpenLead, onOpenQuote, onOpenDeal } = {}) {
|
|
|
9836
9853
|
const cfg = TYPE_CONFIG[type];
|
|
9837
9854
|
const Icon = cfg.icon;
|
|
9838
9855
|
return /* @__PURE__ */ jsxs(
|
|
9839
|
-
|
|
9856
|
+
Button,
|
|
9840
9857
|
{
|
|
9858
|
+
variant: "bare",
|
|
9859
|
+
size: "bare",
|
|
9841
9860
|
onClick: () => setTypeFilter(typeFilter === type ? null : type),
|
|
9842
|
-
className: `
|
|
9861
|
+
className: `gap-1 rounded-full px-2.5 py-1 text-xs font-medium ${typeFilter === type ? cfg.color : "bg-muted/50 text-muted-foreground hover:bg-muted"}`,
|
|
9843
9862
|
children: [
|
|
9844
9863
|
/* @__PURE__ */ jsx(Icon, { className: "h-3 w-3" }),
|
|
9845
9864
|
cfg.label
|
|
@@ -9849,10 +9868,12 @@ function ActivityListView({ onOpenLead, onOpenQuote, onOpenDeal } = {}) {
|
|
|
9849
9868
|
);
|
|
9850
9869
|
}),
|
|
9851
9870
|
/* @__PURE__ */ jsxs(
|
|
9852
|
-
|
|
9871
|
+
Button,
|
|
9853
9872
|
{
|
|
9873
|
+
variant: "bare",
|
|
9874
|
+
size: "bare",
|
|
9854
9875
|
onClick: () => setTypeFilter(eventsFilter ? null : "events"),
|
|
9855
|
-
className: `
|
|
9876
|
+
className: `gap-1 rounded-full px-2.5 py-1 text-xs font-medium ${eventsFilter ? "bg-primary/15 text-primary" : "bg-muted/50 text-muted-foreground hover:bg-muted"}`,
|
|
9856
9877
|
children: [
|
|
9857
9878
|
/* @__PURE__ */ jsx(Sparkles, { className: "h-3 w-3" }),
|
|
9858
9879
|
t2("crm.activities.systemEvents")
|
|
@@ -9863,10 +9884,12 @@ function ActivityListView({ onOpenLead, onOpenQuote, onOpenDeal } = {}) {
|
|
|
9863
9884
|
/* @__PURE__ */ jsx("div", { className: "flex-1" }),
|
|
9864
9885
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-1.5", children: [
|
|
9865
9886
|
/* @__PURE__ */ jsxs(
|
|
9866
|
-
|
|
9887
|
+
Button,
|
|
9867
9888
|
{
|
|
9889
|
+
variant: "bare",
|
|
9890
|
+
size: "bare",
|
|
9868
9891
|
onClick: () => setShowCompleted(showCompleted === false ? null : false),
|
|
9869
|
-
className: `
|
|
9892
|
+
className: `gap-1 rounded-full px-2.5 py-1 text-xs font-medium ${showCompleted === false ? "bg-warning-soft text-warning-soft-foreground" : "bg-muted/50 text-muted-foreground hover:bg-muted"}`,
|
|
9870
9893
|
children: [
|
|
9871
9894
|
/* @__PURE__ */ jsx(Clock, { className: "h-3 w-3" }),
|
|
9872
9895
|
" ",
|
|
@@ -9875,10 +9898,12 @@ function ActivityListView({ onOpenLead, onOpenQuote, onOpenDeal } = {}) {
|
|
|
9875
9898
|
}
|
|
9876
9899
|
),
|
|
9877
9900
|
/* @__PURE__ */ jsxs(
|
|
9878
|
-
|
|
9901
|
+
Button,
|
|
9879
9902
|
{
|
|
9903
|
+
variant: "bare",
|
|
9904
|
+
size: "bare",
|
|
9880
9905
|
onClick: () => setShowCompleted(showCompleted === true ? null : true),
|
|
9881
|
-
className: `
|
|
9906
|
+
className: `gap-1 rounded-full px-2.5 py-1 text-xs font-medium ${showCompleted === true ? "bg-success-soft text-success-soft-foreground" : "bg-muted/50 text-muted-foreground hover:bg-muted"}`,
|
|
9882
9907
|
children: [
|
|
9883
9908
|
/* @__PURE__ */ jsx(Check, { className: "h-3 w-3" }),
|
|
9884
9909
|
" ",
|
|
@@ -10084,6 +10109,35 @@ function NetworkView() {
|
|
|
10084
10109
|
const scored = React__default.useMemo(() => scoreUnits(rows ?? [], weights), [rows, weights]);
|
|
10085
10110
|
const avg = networkScore(scored);
|
|
10086
10111
|
const ranked = React__default.useMemo(() => [...scored].sort((a, b) => b.revenue - a.revenue), [scored]);
|
|
10112
|
+
const columns = React__default.useMemo(() => {
|
|
10113
|
+
const NUM = { className: "text-right" };
|
|
10114
|
+
return [
|
|
10115
|
+
{
|
|
10116
|
+
id: "rank",
|
|
10117
|
+
header: "#",
|
|
10118
|
+
cell: ({ row }) => /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: row.index === 0 && row.original.revenue > 0 ? /* @__PURE__ */ jsx(Trophy, { className: "h-3 w-3 text-warning" }) : row.index + 1 })
|
|
10119
|
+
},
|
|
10120
|
+
{ id: "unit", header: t2("crm.network.unit"), cell: ({ row }) => /* @__PURE__ */ jsx("span", { className: "font-medium", children: row.original.unitName }) },
|
|
10121
|
+
{ id: "orders", header: t2("crm.network.orders"), meta: NUM, cell: ({ row }) => /* @__PURE__ */ jsx("span", { className: "tabular-nums", children: row.original.ordersCount }) },
|
|
10122
|
+
{ id: "revenue", header: t2("crm.network.revenue"), meta: NUM, cell: ({ row }) => /* @__PURE__ */ jsx("span", { className: "tabular-nums", children: formatCurrency(row.original.revenue, currency) }) },
|
|
10123
|
+
{ id: "conversion", header: t2("crm.network.dim.conversion"), meta: NUM, cell: ({ row }) => /* @__PURE__ */ jsx(Cell, { value: row.original.conversion }) },
|
|
10124
|
+
{ id: "retention", header: t2("crm.network.dim.retention"), meta: NUM, cell: ({ row }) => /* @__PURE__ */ jsx(Cell, { value: row.original.retention }) },
|
|
10125
|
+
{ id: "reactivation", header: t2("crm.network.dim.reactivation"), meta: NUM, cell: ({ row }) => /* @__PURE__ */ jsx(Cell, { value: row.original.reactivation }) },
|
|
10126
|
+
{ id: "satisfaction", header: t2("crm.network.dim.satisfaction"), meta: NUM, cell: ({ row }) => /* @__PURE__ */ jsx(Cell, { value: row.original.satisfaction }) },
|
|
10127
|
+
{ id: "score", header: t2("crm.network.score"), meta: NUM, cell: ({ row }) => /* @__PURE__ */ jsx("span", { className: "text-sm font-semibold", children: /* @__PURE__ */ jsx(Cell, { value: row.original.score, suffix: "" }) }) },
|
|
10128
|
+
// How many dimensions went in: a score from one dimension is not comparable with one from five.
|
|
10129
|
+
{
|
|
10130
|
+
id: "measured",
|
|
10131
|
+
header: t2("crm.network.measured"),
|
|
10132
|
+
meta: NUM,
|
|
10133
|
+
cell: ({ row }) => /* @__PURE__ */ jsxs("span", { className: "text-[10px] text-muted-foreground", children: [
|
|
10134
|
+
row.original.measured,
|
|
10135
|
+
"/",
|
|
10136
|
+
MEASURED_DIMENSIONS.length
|
|
10137
|
+
] })
|
|
10138
|
+
}
|
|
10139
|
+
];
|
|
10140
|
+
}, [t2, currency]);
|
|
10087
10141
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
10088
10142
|
/* @__PURE__ */ jsx(
|
|
10089
10143
|
SubpageHeader,
|
|
@@ -10124,36 +10178,17 @@ function NetworkView() {
|
|
|
10124
10178
|
] }),
|
|
10125
10179
|
/* @__PURE__ */ jsx("p", { className: "mt-3 text-[10px] text-muted-foreground", children: t2("crm.network.weightsNote") })
|
|
10126
10180
|
] }),
|
|
10127
|
-
/* @__PURE__ */ jsx("div", {
|
|
10128
|
-
|
|
10129
|
-
|
|
10130
|
-
|
|
10131
|
-
|
|
10132
|
-
|
|
10133
|
-
|
|
10134
|
-
|
|
10135
|
-
/* @__PURE__ */ jsx("
|
|
10136
|
-
|
|
10137
|
-
|
|
10138
|
-
/* @__PURE__ */ jsx("th", { className: "px-3 py-2 text-right font-medium", children: t2("crm.network.measured") })
|
|
10139
|
-
] }) }),
|
|
10140
|
-
/* @__PURE__ */ jsx("tbody", { "data-testid": "network-rows", children: rows === null ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: 10, className: "px-3 py-8 text-center text-xs text-muted-foreground", children: t2("common.loading") }) }) : ranked.length === 0 ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: 10, className: "px-3 py-8 text-center text-xs text-muted-foreground", children: t2("crm.network.empty") }) }) : ranked.map((u, i) => /* @__PURE__ */ jsxs("tr", { className: "border-b last:border-b-0", "data-testid": "network-row", children: [
|
|
10141
|
-
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-xs text-muted-foreground", children: i === 0 && u.revenue > 0 ? /* @__PURE__ */ jsx(Trophy, { className: "h-3 w-3 text-warning" }) : i + 1 }),
|
|
10142
|
-
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-xs font-medium", children: u.unitName }),
|
|
10143
|
-
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-right text-xs tabular-nums", children: u.ordersCount }),
|
|
10144
|
-
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-right text-xs tabular-nums", children: formatCurrency(u.revenue, currency) }),
|
|
10145
|
-
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-right text-xs", children: /* @__PURE__ */ jsx(Cell, { value: u.conversion }) }),
|
|
10146
|
-
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-right text-xs", children: /* @__PURE__ */ jsx(Cell, { value: u.retention }) }),
|
|
10147
|
-
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-right text-xs", children: /* @__PURE__ */ jsx(Cell, { value: u.reactivation }) }),
|
|
10148
|
-
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-right text-xs", children: /* @__PURE__ */ jsx(Cell, { value: u.satisfaction }) }),
|
|
10149
|
-
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-right text-sm font-semibold", children: /* @__PURE__ */ jsx(Cell, { value: u.score, suffix: "" }) }),
|
|
10150
|
-
/* @__PURE__ */ jsxs("td", { className: "px-3 py-2 text-right text-[10px] text-muted-foreground", children: [
|
|
10151
|
-
u.measured,
|
|
10152
|
-
"/",
|
|
10153
|
-
MEASURED_DIMENSIONS.length
|
|
10154
|
-
] })
|
|
10155
|
-
] }, u.unitId)) })
|
|
10156
|
-
] }) }),
|
|
10181
|
+
/* @__PURE__ */ jsx("div", { "data-testid": "network-rows", children: /* @__PURE__ */ jsx(
|
|
10182
|
+
DataTable,
|
|
10183
|
+
{
|
|
10184
|
+
compact: true,
|
|
10185
|
+
columns,
|
|
10186
|
+
data: ranked,
|
|
10187
|
+
loading: rows === null,
|
|
10188
|
+
getRowId: (u) => u.unitId,
|
|
10189
|
+
emptyMessage: /* @__PURE__ */ jsx("span", { className: "text-xs", children: t2("crm.network.empty") })
|
|
10190
|
+
}
|
|
10191
|
+
) }),
|
|
10157
10192
|
ranked.some((u) => u.measured === 0) && /* @__PURE__ */ jsxs("p", { className: "rounded-lg bg-muted/30 px-3 py-2 text-xs text-muted-foreground", "data-testid": "network-note", children: [
|
|
10158
10193
|
/* @__PURE__ */ jsx(Network, { className: "mr-1 inline h-3 w-3" }),
|
|
10159
10194
|
t2("crm.network.unmeasuredNote")
|
|
@@ -10208,13 +10243,15 @@ function SurveyScale({ type, value, onChange, readOnly, compact }) {
|
|
|
10208
10243
|
};
|
|
10209
10244
|
if (type === "stars") {
|
|
10210
10245
|
return /* @__PURE__ */ jsx("div", { className: "flex gap-1", children: [1, 2, 3, 4, 5].map((n) => /* @__PURE__ */ jsx(
|
|
10211
|
-
|
|
10246
|
+
Button,
|
|
10212
10247
|
{
|
|
10213
10248
|
type: "button",
|
|
10249
|
+
variant: "bare",
|
|
10250
|
+
size: "bare",
|
|
10214
10251
|
disabled: readOnly,
|
|
10215
10252
|
onClick: () => pick(n),
|
|
10216
10253
|
"aria-label": `${n} ${n === 1 ? "estrela" : "estrelas"}`,
|
|
10217
|
-
className: "
|
|
10254
|
+
className: "p-0.5 disabled:cursor-default disabled:opacity-100",
|
|
10218
10255
|
children: /* @__PURE__ */ jsx(Star, { className: `${compact ? "h-4 w-4" : "h-7 w-7"} ${(value ?? 0) >= n ? "fill-warning text-warning" : "text-muted-foreground/40"}` })
|
|
10219
10256
|
},
|
|
10220
10257
|
n
|
|
@@ -10222,13 +10259,15 @@ function SurveyScale({ type, value, onChange, readOnly, compact }) {
|
|
|
10222
10259
|
}
|
|
10223
10260
|
if (type === "nps") {
|
|
10224
10261
|
return /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: Array.from({ length: 11 }, (_, n) => /* @__PURE__ */ jsx(
|
|
10225
|
-
|
|
10262
|
+
Button,
|
|
10226
10263
|
{
|
|
10227
10264
|
type: "button",
|
|
10265
|
+
variant: "bare",
|
|
10266
|
+
size: "bare",
|
|
10228
10267
|
disabled: readOnly,
|
|
10229
10268
|
onClick: () => pick(n),
|
|
10230
10269
|
"aria-label": `Nota ${n}`,
|
|
10231
|
-
className: `h-8 w-8
|
|
10270
|
+
className: `h-8 w-8 border text-xs font-medium disabled:cursor-default disabled:opacity-100 ${value === n ? "border-primary bg-primary text-primary-foreground" : "border-input bg-card text-foreground hover:bg-muted"}`,
|
|
10232
10271
|
children: n
|
|
10233
10272
|
},
|
|
10234
10273
|
n
|
|
@@ -10236,12 +10275,14 @@ function SurveyScale({ type, value, onChange, readOnly, compact }) {
|
|
|
10236
10275
|
}
|
|
10237
10276
|
return /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
10238
10277
|
/* @__PURE__ */ jsxs(
|
|
10239
|
-
|
|
10278
|
+
Button,
|
|
10240
10279
|
{
|
|
10241
10280
|
type: "button",
|
|
10281
|
+
variant: "bare",
|
|
10282
|
+
size: "bare",
|
|
10242
10283
|
disabled: readOnly,
|
|
10243
10284
|
onClick: () => pick(1),
|
|
10244
|
-
className: `flex
|
|
10285
|
+
className: `flex gap-1.5 border px-3 py-1.5 text-xs font-medium disabled:cursor-default disabled:opacity-100 ${value === 1 ? "border-success bg-success/15 text-success" : "border-input bg-card hover:bg-muted"}`,
|
|
10245
10286
|
children: [
|
|
10246
10287
|
/* @__PURE__ */ jsx(ThumbsUp, { className: "h-3.5 w-3.5" }),
|
|
10247
10288
|
" Sim"
|
|
@@ -10249,12 +10290,14 @@ function SurveyScale({ type, value, onChange, readOnly, compact }) {
|
|
|
10249
10290
|
}
|
|
10250
10291
|
),
|
|
10251
10292
|
/* @__PURE__ */ jsxs(
|
|
10252
|
-
|
|
10293
|
+
Button,
|
|
10253
10294
|
{
|
|
10254
10295
|
type: "button",
|
|
10296
|
+
variant: "bare",
|
|
10297
|
+
size: "bare",
|
|
10255
10298
|
disabled: readOnly,
|
|
10256
10299
|
onClick: () => pick(0),
|
|
10257
|
-
className: `flex
|
|
10300
|
+
className: `flex gap-1.5 border px-3 py-1.5 text-xs font-medium disabled:cursor-default disabled:opacity-100 ${value === 0 ? "border-destructive bg-destructive/15 text-destructive" : "border-input bg-card hover:bg-muted"}`,
|
|
10258
10301
|
children: [
|
|
10259
10302
|
/* @__PURE__ */ jsx(ThumbsDown, { className: "h-3.5 w-3.5" }),
|
|
10260
10303
|
" N\xE3o"
|
|
@@ -10358,13 +10401,13 @@ function SurveyEditorDialog({ survey, provider, answeredQuestionIds, onClose, on
|
|
|
10358
10401
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
10359
10402
|
/* @__PURE__ */ jsx("label", { className: "text-[10px] font-medium uppercase text-muted-foreground", children: "Mensagem de agradecimento" }),
|
|
10360
10403
|
/* @__PURE__ */ jsx(
|
|
10361
|
-
|
|
10404
|
+
Textarea,
|
|
10362
10405
|
{
|
|
10363
10406
|
value: thanks,
|
|
10364
10407
|
onChange: (e) => setThanks(e.target.value),
|
|
10365
10408
|
rows: 2,
|
|
10366
10409
|
placeholder: "Obrigado pela sua avalia\xE7\xE3o!",
|
|
10367
|
-
className: "mt-0.5
|
|
10410
|
+
className: "mt-0.5 min-h-0 resize-none px-2 py-1.5 text-xs"
|
|
10368
10411
|
}
|
|
10369
10412
|
),
|
|
10370
10413
|
/* @__PURE__ */ jsx("p", { className: "mt-1 text-[11px] text-muted-foreground", children: "O que o cliente l\xEA depois de responder." })
|
|
@@ -10407,13 +10450,15 @@ function SurveyEditorDialog({ survey, provider, answeredQuestionIds, onClose, on
|
|
|
10407
10450
|
),
|
|
10408
10451
|
/* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
10409
10452
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
10410
|
-
|
|
10453
|
+
Button,
|
|
10411
10454
|
{
|
|
10412
10455
|
type: "button",
|
|
10456
|
+
variant: "bare",
|
|
10457
|
+
size: "bare",
|
|
10413
10458
|
"aria-label": q.answered ? "Pergunta j\xE1 respondida \u2014 n\xE3o pode ser removida" : "Remover pergunta",
|
|
10414
10459
|
disabled: q.answered,
|
|
10415
10460
|
onClick: () => setQuestions(questions.filter((_, j) => j !== i)),
|
|
10416
|
-
className: "
|
|
10461
|
+
className: "p-1.5 text-destructive hover:bg-destructive/10 disabled:pointer-events-auto disabled:cursor-not-allowed disabled:opacity-40",
|
|
10417
10462
|
children: /* @__PURE__ */ jsx(Trash2, { className: "h-3.5 w-3.5" })
|
|
10418
10463
|
}
|
|
10419
10464
|
) }),
|
|
@@ -10423,27 +10468,17 @@ function SurveyEditorDialog({ survey, provider, answeredQuestionIds, onClose, on
|
|
|
10423
10468
|
/* @__PURE__ */ jsxs("div", { className: "fz-fields fz-fields-2 mt-3", children: [
|
|
10424
10469
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
10425
10470
|
/* @__PURE__ */ jsx("label", { className: "text-[10px] font-medium uppercase text-muted-foreground", children: "Como responde" }),
|
|
10426
|
-
/* @__PURE__ */
|
|
10427
|
-
"
|
|
10428
|
-
{
|
|
10429
|
-
|
|
10430
|
-
onChange: (e) => patch(i, { questionType: e.target.value }),
|
|
10431
|
-
className: "mt-0.5 h-9 w-full rounded-input border border-input bg-card px-2 text-xs shadow-[inset_0_1px_0_rgb(0_0_0_/0.06)]",
|
|
10432
|
-
children: QUESTION_TYPES.map((o) => /* @__PURE__ */ jsx("option", { value: o.value, children: o.label }, o.value))
|
|
10433
|
-
}
|
|
10434
|
-
)
|
|
10471
|
+
/* @__PURE__ */ jsxs(Select, { value: q.questionType, onValueChange: (v) => patch(i, { questionType: v }), children: [
|
|
10472
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "mt-0.5 bg-card px-2 text-xs shadow-[inset_0_1px_0_rgb(0_0_0_/0.06)]", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
10473
|
+
/* @__PURE__ */ jsx(SelectContent, { children: QUESTION_TYPES.map((o) => /* @__PURE__ */ jsx(SelectItem, { value: o.value, children: o.label }, o.value)) })
|
|
10474
|
+
] })
|
|
10435
10475
|
] }),
|
|
10436
10476
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
10437
10477
|
/* @__PURE__ */ jsx("label", { className: "text-[10px] font-medium uppercase text-muted-foreground", children: "Coment\xE1rio" }),
|
|
10438
|
-
/* @__PURE__ */
|
|
10439
|
-
"
|
|
10440
|
-
{
|
|
10441
|
-
|
|
10442
|
-
onChange: (e) => patch(i, { allowComment: e.target.value }),
|
|
10443
|
-
className: "mt-0.5 h-9 w-full rounded-input border border-input bg-card px-2 text-xs shadow-[inset_0_1px_0_rgb(0_0_0_/0.06)]",
|
|
10444
|
-
children: COMMENT_POLICIES.map((o) => /* @__PURE__ */ jsx("option", { value: o.value, children: o.label }, o.value))
|
|
10445
|
-
}
|
|
10446
|
-
)
|
|
10478
|
+
/* @__PURE__ */ jsxs(Select, { value: q.allowComment, onValueChange: (v) => patch(i, { allowComment: v }), children: [
|
|
10479
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "mt-0.5 bg-card px-2 text-xs shadow-[inset_0_1px_0_rgb(0_0_0_/0.06)]", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
10480
|
+
/* @__PURE__ */ jsx(SelectContent, { children: COMMENT_POLICIES.map((o) => /* @__PURE__ */ jsx(SelectItem, { value: o.value, children: o.label }, o.value)) })
|
|
10481
|
+
] })
|
|
10447
10482
|
] })
|
|
10448
10483
|
] }),
|
|
10449
10484
|
/* @__PURE__ */ jsxs("div", { className: "mt-3 flex items-center justify-between", children: [
|
|
@@ -10547,13 +10582,13 @@ function SurveyCollectDialog({ survey, provider, contactLookup, onClose, onSaved
|
|
|
10547
10582
|
}
|
|
10548
10583
|
),
|
|
10549
10584
|
q.allowComment !== "no" && /* @__PURE__ */ jsx(
|
|
10550
|
-
|
|
10585
|
+
Textarea,
|
|
10551
10586
|
{
|
|
10552
10587
|
rows: 2,
|
|
10553
10588
|
value: answers[q.id]?.comment ?? "",
|
|
10554
10589
|
onChange: (e) => patch(q.id, { comment: e.target.value }),
|
|
10555
10590
|
placeholder: q.allowComment === "required" ? "Coment\xE1rio (obrigat\xF3rio)" : "Coment\xE1rio (opcional)",
|
|
10556
|
-
className: "
|
|
10591
|
+
className: "min-h-0 resize-none px-2 py-1.5 text-xs"
|
|
10557
10592
|
}
|
|
10558
10593
|
)
|
|
10559
10594
|
] }, q.id)),
|
|
@@ -10759,12 +10794,14 @@ function SurveysView() {
|
|
|
10759
10794
|
/* @__PURE__ */ jsxs(TooltipProvider, { delayDuration: 200, children: [
|
|
10760
10795
|
canEdit && /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
10761
10796
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
10762
|
-
|
|
10797
|
+
Button,
|
|
10763
10798
|
{
|
|
10764
10799
|
type: "button",
|
|
10800
|
+
variant: "ghost",
|
|
10801
|
+
size: "icon",
|
|
10765
10802
|
"aria-label": "Editar pesquisa",
|
|
10766
10803
|
onClick: () => void openEditor(survey),
|
|
10767
|
-
className: "
|
|
10804
|
+
className: "h-[26px] w-[26px] text-muted-foreground",
|
|
10768
10805
|
children: /* @__PURE__ */ jsx(Pencil, { className: "h-3.5 w-3.5" })
|
|
10769
10806
|
}
|
|
10770
10807
|
) }),
|
|
@@ -10772,12 +10809,14 @@ function SurveysView() {
|
|
|
10772
10809
|
] }),
|
|
10773
10810
|
canDelete && /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
10774
10811
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
10775
|
-
|
|
10812
|
+
Button,
|
|
10776
10813
|
{
|
|
10777
10814
|
type: "button",
|
|
10815
|
+
variant: "bare",
|
|
10816
|
+
size: "bare",
|
|
10778
10817
|
"aria-label": "Excluir pesquisa",
|
|
10779
10818
|
onClick: () => setRemoving(survey),
|
|
10780
|
-
className: "
|
|
10819
|
+
className: "p-1.5 text-destructive hover:bg-destructive/10",
|
|
10781
10820
|
children: /* @__PURE__ */ jsx(Trash2, { className: "h-3.5 w-3.5" })
|
|
10782
10821
|
}
|
|
10783
10822
|
) }),
|
|
@@ -10979,6 +11018,26 @@ function DistributionView() {
|
|
|
10979
11018
|
setBusy(false);
|
|
10980
11019
|
}
|
|
10981
11020
|
}
|
|
11021
|
+
const backlogColumns = React__default.useMemo(() => [
|
|
11022
|
+
{
|
|
11023
|
+
id: "lead",
|
|
11024
|
+
header: () => /* @__PURE__ */ jsx("span", { className: "text-xs uppercase", children: t2("crm.distribution.lead") }),
|
|
11025
|
+
cell: ({ row: { original: b } }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11026
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: b.leadName }),
|
|
11027
|
+
b.offersSoFar > 0 && /* @__PURE__ */ jsx("span", { className: "ml-2 rounded-full bg-amber-500/10 px-2 py-0.5 text-xs text-amber-700", children: t2("crm.distribution.wentRound") })
|
|
11028
|
+
] })
|
|
11029
|
+
},
|
|
11030
|
+
{
|
|
11031
|
+
id: "company",
|
|
11032
|
+
header: () => /* @__PURE__ */ jsx("span", { className: "text-xs uppercase", children: t2("crm.distribution.company") }),
|
|
11033
|
+
cell: ({ row }) => /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: row.original.companyName ?? "\u2014" })
|
|
11034
|
+
},
|
|
11035
|
+
{
|
|
11036
|
+
id: "waitingFor",
|
|
11037
|
+
header: () => /* @__PURE__ */ jsx("span", { className: "text-xs uppercase", children: t2("crm.distribution.waitingFor") }),
|
|
11038
|
+
cell: ({ row }) => /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: horas(row.original.hoursWaiting, t2) })
|
|
11039
|
+
}
|
|
11040
|
+
], [t2]);
|
|
10982
11041
|
const waiting = backlog?.length ?? 0;
|
|
10983
11042
|
const stale = (backlog ?? []).filter((b) => b.offersSoFar > 0).length;
|
|
10984
11043
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
@@ -11006,21 +11065,7 @@ function DistributionView() {
|
|
|
11006
11065
|
] })
|
|
11007
11066
|
] }),
|
|
11008
11067
|
backlog === null ? /* @__PURE__ */ jsx(Skeleton, {}) : waiting === 0 ? /* @__PURE__ */ jsx("div", { className: "rounded-card border bg-card p-6 text-center text-sm text-muted-foreground", children: t2("crm.distribution.noneWaiting") }) : /* @__PURE__ */ jsxs("div", { className: "overflow-hidden rounded-card border bg-card shadow-sm", children: [
|
|
11009
|
-
/* @__PURE__ */
|
|
11010
|
-
/* @__PURE__ */ jsx("thead", { className: "border-b bg-muted/30 text-left text-xs uppercase text-muted-foreground", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
11011
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-2 font-medium", children: t2("crm.distribution.lead") }),
|
|
11012
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-2 font-medium", children: t2("crm.distribution.company") }),
|
|
11013
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-2 font-medium", children: t2("crm.distribution.waitingFor") })
|
|
11014
|
-
] }) }),
|
|
11015
|
-
/* @__PURE__ */ jsx("tbody", { children: backlog.slice(0, 50).map((b) => /* @__PURE__ */ jsxs("tr", { className: "border-b last:border-0", children: [
|
|
11016
|
-
/* @__PURE__ */ jsxs("td", { className: "px-4 py-2", children: [
|
|
11017
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium", children: b.leadName }),
|
|
11018
|
-
b.offersSoFar > 0 && /* @__PURE__ */ jsx("span", { className: "ml-2 rounded-full bg-amber-500/10 px-2 py-0.5 text-xs text-amber-700", children: t2("crm.distribution.wentRound") })
|
|
11019
|
-
] }),
|
|
11020
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-2 text-muted-foreground", children: b.companyName ?? "\u2014" }),
|
|
11021
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-2 text-muted-foreground", children: horas(b.hoursWaiting, t2) })
|
|
11022
|
-
] }, b.leadId)) })
|
|
11023
|
-
] }),
|
|
11068
|
+
/* @__PURE__ */ jsx(DataTable, { variant: "bare", columns: backlogColumns, data: backlog.slice(0, 50), getRowId: (b) => b.leadId }),
|
|
11024
11069
|
waiting > 50 && /* @__PURE__ */ jsx("div", { className: "border-t px-4 py-2 text-xs text-muted-foreground", children: t2("crm.distribution.andMore", { count: waiting - 50 }) })
|
|
11025
11070
|
] })
|
|
11026
11071
|
] }),
|
|
@@ -11389,10 +11434,7 @@ function CrmPage({ config, provider, store, registries }) {
|
|
|
11389
11434
|
{ id: "quotes-edit", render: ({ id }) => /* @__PURE__ */ jsx(QuoteFormView, { quoteId: id, onSaved: () => navigate(`quotes-detail:${id}`) }) },
|
|
11390
11435
|
{ id: "company-groups", render: () => /* @__PURE__ */ jsx(CompanyGroupsView, {}) },
|
|
11391
11436
|
{ id: "companies-list", render: () => /* @__PURE__ */ jsx(CompanyListView, { onNew: () => navigate("companies-new"), onEdit: (id) => navigate(`companies-detail:${id}`) }) },
|
|
11392
|
-
{ id: "companies-new", render: () => /* @__PURE__ */
|
|
11393
|
-
/* @__PURE__ */ jsx(CompanyListView, { onNew: () => navigate("companies-new"), onEdit: (id) => navigate(`companies-detail:${id}`) }),
|
|
11394
|
-
/* @__PURE__ */ jsx(CompanyFormView, { onSaved: (id) => navigate(id ? `companies-detail:${id}` : "companies-list") })
|
|
11395
|
-
] }) },
|
|
11437
|
+
{ id: "companies-new", render: () => /* @__PURE__ */ jsx(CompanyFormView, { onSaved: (id) => navigate(id ? `companies-detail:${id}` : "companies-list"), onCancel: () => navigate("companies-list") }) },
|
|
11396
11438
|
{ id: "companies-edit", render: ({ id }) => /* @__PURE__ */ jsx(CompanyFormView, { companyId: id, onSaved: () => navigate(`companies-detail:${id}`) }) },
|
|
11397
11439
|
{ id: "companies-detail", render: ({ id }) => /* @__PURE__ */ jsx(
|
|
11398
11440
|
CompanyDetailView,
|
|
@@ -31336,6 +31378,8 @@ var en = {
|
|
|
31336
31378
|
"crm.companies.noCompanies": "No companies yet",
|
|
31337
31379
|
"crm.companies.createFirst": "Add the first one",
|
|
31338
31380
|
"crm.companies.archive": "Archive",
|
|
31381
|
+
"crm.companies.one": "Company",
|
|
31382
|
+
"crm.companyDetail.contact": "Contact",
|
|
31339
31383
|
"crm.companyDetail.openInPipeline": "View in pipeline",
|
|
31340
31384
|
"crm.companyDetail.moreActions": "More actions",
|
|
31341
31385
|
"crm.companies.archiveTitle": "Archive company?",
|
|
@@ -31349,6 +31393,7 @@ var en = {
|
|
|
31349
31393
|
"crm.companyDetail.linkRole": "Role here",
|
|
31350
31394
|
"crm.companyDetail.linkRolePlaceholder": "Owner / partner, manager\u2026",
|
|
31351
31395
|
"crm.companyDetail.receita": "Federal tax registry",
|
|
31396
|
+
"crm.companyDetail.receitaNone": "The federal registry has not been checked for this company yet.",
|
|
31352
31397
|
"crm.companyDetail.receitaCheckedOn": "checked on",
|
|
31353
31398
|
"crm.companyDetail.receitaSituacao": "Registration status",
|
|
31354
31399
|
"crm.companyDetail.receitaLegalName": "Legal name",
|
|
@@ -32277,6 +32322,8 @@ var ptBR = {
|
|
|
32277
32322
|
"crm.companies.noCompanies": "Nenhuma empresa ainda",
|
|
32278
32323
|
"crm.companies.createFirst": "Cadastrar a primeira",
|
|
32279
32324
|
"crm.companies.archive": "Arquivar",
|
|
32325
|
+
"crm.companies.one": "Empresa",
|
|
32326
|
+
"crm.companyDetail.contact": "Contato",
|
|
32280
32327
|
"crm.companyDetail.openInPipeline": "Ver no funil",
|
|
32281
32328
|
"crm.companyDetail.moreActions": "Mais a\xE7\xF5es",
|
|
32282
32329
|
"crm.companies.archiveTitle": "Arquivar empresa?",
|
|
@@ -32290,6 +32337,7 @@ var ptBR = {
|
|
|
32290
32337
|
"crm.companyDetail.linkRole": "Cargo aqui",
|
|
32291
32338
|
"crm.companyDetail.linkRolePlaceholder": "Propriet\xE1rio / s\xF3cio, ger\xEAncia\u2026",
|
|
32292
32339
|
"crm.companyDetail.receita": "Receita Federal",
|
|
32340
|
+
"crm.companyDetail.receitaNone": "O cadastro da Receita ainda n\xE3o foi consultado para esta empresa.",
|
|
32293
32341
|
"crm.companyDetail.receitaCheckedOn": "consultado em",
|
|
32294
32342
|
"crm.companyDetail.receitaSituacao": "Situa\xE7\xE3o cadastral",
|
|
32295
32343
|
"crm.companyDetail.receitaLegalName": "Raz\xE3o social",
|
|
@@ -33178,6 +33226,131 @@ var VOCABULARY = {
|
|
|
33178
33226
|
function customerVocabulary(verticalId) {
|
|
33179
33227
|
return verticalId && VOCABULARY[verticalId] || { one: "Cliente", many: "Clientes" };
|
|
33180
33228
|
}
|
|
33229
|
+
var CLIENT_TABS = [
|
|
33230
|
+
["evaluations", "Evaluations", "Avalia\xE7\xF5es", true],
|
|
33231
|
+
["services", "Services", "Servi\xE7os", true],
|
|
33232
|
+
["revision", "Revision", "Revis\xE3o", true],
|
|
33233
|
+
["appointments", "Appointments", "Agendamentos", true],
|
|
33234
|
+
["account", "Account", "Conta", true],
|
|
33235
|
+
["quotes", "Quotes", "Or\xE7amentos", true],
|
|
33236
|
+
["images", "Images", "Imagens", true],
|
|
33237
|
+
["files", "Files", "Arquivos", true],
|
|
33238
|
+
["cancelled", "Cancelled", "Cancelados", false]
|
|
33239
|
+
];
|
|
33240
|
+
var crmV1SettingsTabs = [
|
|
33241
|
+
defineSettingsTab({
|
|
33242
|
+
id: "crm-loyalty",
|
|
33243
|
+
label: tl("Club & cashback", "Clube e Cashback"),
|
|
33244
|
+
icon: "Gift",
|
|
33245
|
+
section: "financial",
|
|
33246
|
+
requiresFacet: "loyalty",
|
|
33247
|
+
pending: true,
|
|
33248
|
+
defaults: {
|
|
33249
|
+
"loyalty.default_percent": 5,
|
|
33250
|
+
"loyalty.validity_days": 30,
|
|
33251
|
+
"loyalty.release_delay_hours": 0,
|
|
33252
|
+
"loyalty.max_redeem_pct_of_bill": 100,
|
|
33253
|
+
"loyalty.earn_on_service_charge": false,
|
|
33254
|
+
"loyalty.earn_on_cover_charge": false,
|
|
33255
|
+
"loyalty.earn_requires_membership": false,
|
|
33256
|
+
"loyalty.redeem_requires_membership": true
|
|
33257
|
+
},
|
|
33258
|
+
sections: [
|
|
33259
|
+
{ title: tl("Program", "Programa"), fields: [
|
|
33260
|
+
{ key: "loyalty.default_percent", type: "number", min: 0, max: 100, label: tl("Cashback (% of the purchase)", "Cashback (% da compra)") },
|
|
33261
|
+
{ key: "loyalty.validity_days", type: "number", min: 1, max: 3650, label: tl("Credit valid for (days)", "Validade do cr\xE9dito (dias)") },
|
|
33262
|
+
{ key: "loyalty.release_delay_hours", type: "number", min: 0, max: 720, label: tl("Credit released after (hours)", "Cr\xE9dito liberado ap\xF3s (horas)") }
|
|
33263
|
+
] },
|
|
33264
|
+
{ title: tl("Earning", "Ganho"), fields: [
|
|
33265
|
+
{ key: "loyalty.max_earn_per_purchase", type: "number", min: 0, label: tl("Max cashback per purchase", "Cashback m\xE1ximo por compra") },
|
|
33266
|
+
{ key: "loyalty.monthly_earn_cap", type: "number", min: 0, label: tl("Max cashback per month", "Cashback m\xE1ximo por m\xEAs") },
|
|
33267
|
+
{ key: "loyalty.earn_on_service_charge", type: "boolean", label: tl("Earn on the service charge", "Ganha sobre a taxa de servi\xE7o") },
|
|
33268
|
+
{ key: "loyalty.earn_on_cover_charge", type: "boolean", label: tl("Earn on the cover charge", "Ganha sobre a taxa de ingresso") },
|
|
33269
|
+
{ key: "loyalty.earn_requires_membership", type: "boolean", label: tl("Only members earn", "S\xF3 membro do clube ganha") }
|
|
33270
|
+
] },
|
|
33271
|
+
{ title: tl("Redeeming", "Resgate"), fields: [
|
|
33272
|
+
{ key: "loyalty.min_redeem_amount", type: "number", min: 0, label: tl("Minimum balance to redeem", "Saldo m\xEDnimo para resgatar") },
|
|
33273
|
+
{ key: "loyalty.max_redeem_pct_of_bill", type: "number", min: 0, max: 100, label: tl("Max share of the bill (%)", "M\xE1ximo da conta pago com cashback (%)") },
|
|
33274
|
+
{ key: "loyalty.redeem_requires_membership", type: "boolean", label: tl("Only members redeem", "S\xF3 membro do clube resgata") }
|
|
33275
|
+
] }
|
|
33276
|
+
]
|
|
33277
|
+
}),
|
|
33278
|
+
defineSettingsTab({
|
|
33279
|
+
id: "crm-client-type",
|
|
33280
|
+
label: tl("Type", "Tipo"),
|
|
33281
|
+
icon: "UserCog",
|
|
33282
|
+
section: "registry",
|
|
33283
|
+
parent: registrySettingsParent("person:customer", tl("Clients", "Clientes")),
|
|
33284
|
+
order: 4,
|
|
33285
|
+
keywords: [tl("Client type", "Tipo de cliente"), "CPF", "CNPJ"],
|
|
33286
|
+
pending: true,
|
|
33287
|
+
defaults: { "clients.person_type_mode": "pf" },
|
|
33288
|
+
sections: [{
|
|
33289
|
+
description: tl("Companies relabel the form: CPF becomes CNPJ, RG becomes IE.", "Em pessoa jur\xEDdica o cadastro troca os r\xF3tulos: CPF vira CNPJ, RG vira IE."),
|
|
33290
|
+
fields: [
|
|
33291
|
+
{ key: "clients.person_type_mode", type: "select", label: tl("Your clients are", "Seus clientes s\xE3o"), options: [
|
|
33292
|
+
{ value: "pf", label: tl("People", "Pessoa f\xEDsica") },
|
|
33293
|
+
{ value: "pj", label: tl("Companies", "Pessoa jur\xEDdica") },
|
|
33294
|
+
{ value: "both", label: tl("Both", "Ambos") }
|
|
33295
|
+
] }
|
|
33296
|
+
]
|
|
33297
|
+
}]
|
|
33298
|
+
}),
|
|
33299
|
+
defineSettingsTab({
|
|
33300
|
+
id: "crm-client-menu",
|
|
33301
|
+
label: tl("Menus", "Menus"),
|
|
33302
|
+
icon: "ListOrdered",
|
|
33303
|
+
section: "registry",
|
|
33304
|
+
parent: registrySettingsParent("person:customer", tl("Clients", "Clientes")),
|
|
33305
|
+
order: 3,
|
|
33306
|
+
keywords: [tl("Client record tabs", "Menu de clientes"), tl("Record", "Ficha")],
|
|
33307
|
+
pending: true,
|
|
33308
|
+
defaults: Object.fromEntries(CLIENT_TABS.map(([id, , , on]) => [`clients.menu.${id}`, on])),
|
|
33309
|
+
sections: [{
|
|
33310
|
+
description: tl("Which tabs the client record shows.", "Quais abas a ficha do cliente mostra."),
|
|
33311
|
+
fields: CLIENT_TABS.map(([id, en2, pt]) => ({ key: `clients.menu.${id}`, type: "boolean", label: tl(en2, pt) }))
|
|
33312
|
+
}]
|
|
33313
|
+
}),
|
|
33314
|
+
defineSettingsTab({
|
|
33315
|
+
id: "crm-qr-registration",
|
|
33316
|
+
label: tl("Pre-registration QR", "QR de pr\xE9-cadastro"),
|
|
33317
|
+
keywords: [tl("Pre-registration QR code", "QR Code de pr\xE9-cadastro")],
|
|
33318
|
+
icon: "ScanLine",
|
|
33319
|
+
section: "registry",
|
|
33320
|
+
parent: registrySettingsParent("person:customer", tl("Clients", "Clientes")),
|
|
33321
|
+
order: 5,
|
|
33322
|
+
pending: true,
|
|
33323
|
+
defaults: { "qr_registration.cpf_exists_message": "J\xE1 temos seu cadastro. Procure a recep\xE7\xE3o." },
|
|
33324
|
+
sections: [{
|
|
33325
|
+
fields: [
|
|
33326
|
+
{ key: "qr_registration.title", type: "string", scope: "unit", label: tl("Title", "T\xEDtulo") },
|
|
33327
|
+
{ key: "qr_registration.subtitle", type: "string", scope: "unit", label: tl("Subtitle", "Subt\xEDtulo") },
|
|
33328
|
+
{ key: "qr_registration.intro", type: "string", scope: "unit", label: tl("Text before the forms", "Texto antes dos formul\xE1rios") },
|
|
33329
|
+
{ key: "qr_registration.cpf_exists_message", type: "string", scope: "unit", label: tl("Message when the CPF already exists", "Mensagem quando o CPF j\xE1 existe") }
|
|
33330
|
+
]
|
|
33331
|
+
}]
|
|
33332
|
+
}),
|
|
33333
|
+
defineSettingsTab({
|
|
33334
|
+
id: "crm-review-surveys",
|
|
33335
|
+
label: tl("Review surveys", "Pesquisas de avalia\xE7\xE3o"),
|
|
33336
|
+
icon: "Star",
|
|
33337
|
+
section: "operations",
|
|
33338
|
+
pending: true,
|
|
33339
|
+
defaults: { "reviews.ask_on_checkout": true },
|
|
33340
|
+
sections: [{
|
|
33341
|
+
enabledBy: "reviews.ask_on_checkout",
|
|
33342
|
+
fields: [
|
|
33343
|
+
{ key: "reviews.ask_on_checkout", type: "boolean", label: tl("Ask for a review when the bill closes", "Solicitar avalia\xE7\xE3o ao fechar a conta") },
|
|
33344
|
+
// The texts are templates of the shared message catalog (Automações ›
|
|
33345
|
+
// Mensagens), not strings of this screen.
|
|
33346
|
+
{ key: "reviews.invite_message", type: "message", message: { eventKey: "crm.survey_requested" }, label: tl("Survey message", "Mensagem da pesquisa") },
|
|
33347
|
+
{ key: "reviews.thanks_message", type: "message", message: { eventKey: "crm.survey_answered" }, label: tl("Thank-you message", "Mensagem de agradecimento") }
|
|
33348
|
+
]
|
|
33349
|
+
}]
|
|
33350
|
+
})
|
|
33351
|
+
];
|
|
33352
|
+
|
|
33353
|
+
// src/index.ts
|
|
33181
33354
|
var DEFAULT_LABELS = {
|
|
33182
33355
|
pageTitle: "Sales",
|
|
33183
33356
|
pageSubtitle: "CRM, leads, deals, and pipeline management"
|
|
@@ -33303,7 +33476,8 @@ function createCrmPlugin(options) {
|
|
|
33303
33476
|
facets: [
|
|
33304
33477
|
{ id: "contacts", label: "Contatos e leads", description: "Cadastro, tags e hist\xF3rico.", includedWithPlugin: true },
|
|
33305
33478
|
{ id: "pipeline", label: "Funil de vendas", description: "Board de neg\xF3cios, etapas e previs\xE3o." },
|
|
33306
|
-
{ id: "automation", label: "Automa\xE7\xF5es de funil", description: "Regras que movem o card e disparam a pr\xF3xima a\xE7\xE3o." }
|
|
33479
|
+
{ id: "automation", label: "Automa\xE7\xF5es de funil", description: "Regras que movem o card e disparam a pr\xF3xima a\xE7\xE3o." },
|
|
33480
|
+
{ id: "loyalty", label: "Clube e Cashback", description: "Cr\xE9dito de volta em cada compra, resgatado na pr\xF3xima." }
|
|
33307
33481
|
],
|
|
33308
33482
|
dependencies: [],
|
|
33309
33483
|
// Os FATOS do funil. Vão no manifesto (e não num registro à parte) para que
|
|
@@ -33750,6 +33924,7 @@ function createCrmPlugin(options) {
|
|
|
33750
33924
|
],
|
|
33751
33925
|
registries: crmRegistries2,
|
|
33752
33926
|
settings: [
|
|
33927
|
+
...crmV1SettingsTabs,
|
|
33753
33928
|
{
|
|
33754
33929
|
id: "crm",
|
|
33755
33930
|
label: "Sales & CRM",
|