@fayz-ai/plugin-crm 0.31.17 → 0.32.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +1083 -902
- 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 +6 -5
- package/dist/data/index.d.ts +0 -3
- package/dist/data/index.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
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
|
+
import { HelpdeskStatusPanel } from '@fayz-ai/plugin-support';
|
|
9
10
|
import { createStore as createStore$1 } from 'zustand/vanilla';
|
|
10
11
|
|
|
11
12
|
// src/index.ts
|
|
@@ -77,6 +78,26 @@ function buildCrmDomainEvents() {
|
|
|
77
78
|
description: "O neg\xF3cio ficou sem movimento",
|
|
78
79
|
trigger: "Quando o neg\xF3cio passa dias sem avan\xE7ar",
|
|
79
80
|
fields: DEAL_FIELDS
|
|
81
|
+
},
|
|
82
|
+
// V1 "Pesquisas de avaliação": the invite and the thank-you are templates of
|
|
83
|
+
// the catalog. Nothing emits these events yet.
|
|
84
|
+
{
|
|
85
|
+
name: "crm.survey_requested",
|
|
86
|
+
title: "Pesquisa de satisfa\xE7\xE3o enviada",
|
|
87
|
+
icon: "Star",
|
|
88
|
+
audit: false,
|
|
89
|
+
description: "O cliente foi convidado a avaliar o atendimento",
|
|
90
|
+
trigger: "Quando a conta \xE9 fechada e a pesquisa est\xE1 ligada",
|
|
91
|
+
fields: CONTACT_FIELDS
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: "crm.survey_answered",
|
|
95
|
+
title: "Pesquisa respondida",
|
|
96
|
+
icon: "MessageSquareHeart",
|
|
97
|
+
audit: false,
|
|
98
|
+
description: "O cliente respondeu a pesquisa",
|
|
99
|
+
trigger: "Quando a avalia\xE7\xE3o \xE9 registrada",
|
|
100
|
+
fields: CONTACT_FIELDS
|
|
80
101
|
}
|
|
81
102
|
];
|
|
82
103
|
}
|
|
@@ -166,6 +187,22 @@ function buildCrmMessageDefaults() {
|
|
|
166
187
|
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
188
|
}
|
|
168
189
|
}
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
eventKey: "crm.survey_requested",
|
|
193
|
+
kind: "transactional",
|
|
194
|
+
channels: ["whatsapp"],
|
|
195
|
+
defaults: {
|
|
196
|
+
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." }
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
eventKey: "crm.survey_answered",
|
|
201
|
+
kind: "transactional",
|
|
202
|
+
channels: ["whatsapp"],
|
|
203
|
+
defaults: {
|
|
204
|
+
whatsapp: { body: "Obrigado pela avalia\xE7\xE3o, {{contact_name}}! \u{1F49B} Equipe {{company_name}}" }
|
|
205
|
+
}
|
|
169
206
|
}
|
|
170
207
|
];
|
|
171
208
|
}
|
|
@@ -209,10 +246,12 @@ function GroupRow({ g, onOpen, open, members, roll, onEdit, onAdd, onRemove, onD
|
|
|
209
246
|
}, [term, search]);
|
|
210
247
|
return /* @__PURE__ */ jsxs("div", { className: "border-b last:border-b-0", children: [
|
|
211
248
|
/* @__PURE__ */ jsxs(
|
|
212
|
-
|
|
249
|
+
Button,
|
|
213
250
|
{
|
|
251
|
+
variant: "bare",
|
|
252
|
+
size: "bare",
|
|
214
253
|
onClick: onOpen,
|
|
215
|
-
className: "flex w-full
|
|
254
|
+
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
255
|
children: [
|
|
217
256
|
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
257
|
/* @__PURE__ */ jsx(Network, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
@@ -257,8 +296,10 @@ function GroupRow({ g, onOpen, open, members, roll, onEdit, onAdd, onRemove, onD
|
|
|
257
296
|
m.companyDocument && /* @__PURE__ */ jsx("span", { className: "tabular-nums text-muted-foreground", children: m.companyDocument }),
|
|
258
297
|
m.source && /* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground/70", children: m.source === "document_root" ? "pela raiz do CNPJ" : "declarado" }),
|
|
259
298
|
editing && /* @__PURE__ */ jsx(
|
|
260
|
-
|
|
299
|
+
Button,
|
|
261
300
|
{
|
|
301
|
+
variant: "bare",
|
|
302
|
+
size: "bare",
|
|
262
303
|
onClick: () => void onRemove(m.id),
|
|
263
304
|
className: "ml-auto text-muted-foreground hover:text-destructive",
|
|
264
305
|
"aria-label": `Tirar ${m.companyName} do grupo`,
|
|
@@ -282,19 +323,14 @@ function GroupRow({ g, onOpen, open, members, roll, onEdit, onAdd, onRemove, onD
|
|
|
282
323
|
] }),
|
|
283
324
|
/* @__PURE__ */ jsxs("label", { className: "block", children: [
|
|
284
325
|
/* @__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
|
-
)
|
|
326
|
+
/* @__PURE__ */ jsxs(Select, { value: draftKind, onValueChange: setDraftKind, children: [
|
|
327
|
+
/* @__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, {}) }),
|
|
328
|
+
/* @__PURE__ */ jsx(SelectContent, { children: KINDS.map((k) => /* @__PURE__ */ jsxs(SelectItem, { value: k.value, children: [
|
|
329
|
+
k.label,
|
|
330
|
+
" \u2014 ",
|
|
331
|
+
k.hint
|
|
332
|
+
] }, k.value)) })
|
|
333
|
+
] })
|
|
298
334
|
] })
|
|
299
335
|
] }),
|
|
300
336
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
@@ -312,8 +348,10 @@ function GroupRow({ g, onOpen, open, members, roll, onEdit, onAdd, onRemove, onD
|
|
|
312
348
|
)
|
|
313
349
|
] }),
|
|
314
350
|
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
|
-
|
|
351
|
+
Button,
|
|
316
352
|
{
|
|
353
|
+
variant: "bare",
|
|
354
|
+
size: "bare",
|
|
317
355
|
disabled: busy,
|
|
318
356
|
onClick: async () => {
|
|
319
357
|
setBusy(true);
|
|
@@ -325,7 +363,7 @@ function GroupRow({ g, onOpen, open, members, roll, onEdit, onAdd, onRemove, onD
|
|
|
325
363
|
setBusy(false);
|
|
326
364
|
}
|
|
327
365
|
},
|
|
328
|
-
className: "flex w-full items-baseline gap-2 px-2 py-1.5 text-left text-xs hover:bg-muted/40",
|
|
366
|
+
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
367
|
children: [
|
|
330
368
|
/* @__PURE__ */ jsx(Plus, { className: "h-3 w-3 shrink-0" }),
|
|
331
369
|
/* @__PURE__ */ jsx("span", { className: "font-medium", children: h.name }),
|
|
@@ -373,10 +411,12 @@ function GroupRow({ g, onOpen, open, members, roll, onEdit, onAdd, onRemove, onD
|
|
|
373
411
|
)
|
|
374
412
|
] })
|
|
375
413
|
] }) : /* @__PURE__ */ jsxs(
|
|
376
|
-
|
|
414
|
+
Button,
|
|
377
415
|
{
|
|
416
|
+
variant: "bare",
|
|
417
|
+
size: "bare",
|
|
378
418
|
onClick: () => setEditing(true),
|
|
379
|
-
className: "mt-1
|
|
419
|
+
className: "mt-1 gap-1 text-[11px] font-normal text-primary hover:underline",
|
|
380
420
|
children: [
|
|
381
421
|
/* @__PURE__ */ jsx(Pencil, { className: "h-3 w-3" }),
|
|
382
422
|
" Editar grupo"
|
|
@@ -735,28 +775,28 @@ function CrmGeneralSettings() {
|
|
|
735
775
|
const s = useTenantPluginSettings("crm", CRM_DEFAULTS);
|
|
736
776
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
737
777
|
/* @__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) })
|
|
778
|
+
/* @__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) }),
|
|
779
|
+
/* @__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) }),
|
|
780
|
+
/* @__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) }),
|
|
781
|
+
/* @__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
782
|
] }),
|
|
743
783
|
/* @__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) })
|
|
784
|
+
/* @__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) }),
|
|
785
|
+
/* @__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) }),
|
|
786
|
+
/* @__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) }),
|
|
787
|
+
/* @__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
788
|
] }),
|
|
749
789
|
/* @__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) })
|
|
790
|
+
/* @__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) }),
|
|
791
|
+
/* @__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) }),
|
|
792
|
+
/* @__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
793
|
] }),
|
|
754
794
|
/* @__PURE__ */ jsx(LeadScoreWeights, {}),
|
|
755
795
|
/* @__PURE__ */ jsx(EngagementLadderSettings, {}),
|
|
756
796
|
/* @__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) })
|
|
797
|
+
/* @__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) }),
|
|
798
|
+
/* @__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) }),
|
|
799
|
+
/* @__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
800
|
] })
|
|
761
801
|
] });
|
|
762
802
|
}
|
|
@@ -791,7 +831,7 @@ function CrmOnboarding({ onComplete }) {
|
|
|
791
831
|
/* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
|
|
792
832
|
] })
|
|
793
833
|
] }),
|
|
794
|
-
step === 0 && /* @__PURE__ */ jsx("
|
|
834
|
+
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
835
|
] })
|
|
796
836
|
] }) });
|
|
797
837
|
}
|
|
@@ -890,15 +930,17 @@ function LostReasonDialog({
|
|
|
890
930
|
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1.5", children: LOST_REASONS.map((key) => {
|
|
891
931
|
const active = picked === key;
|
|
892
932
|
return /* @__PURE__ */ jsx(
|
|
893
|
-
|
|
933
|
+
Button,
|
|
894
934
|
{
|
|
895
935
|
type: "button",
|
|
936
|
+
variant: "bare",
|
|
937
|
+
size: "bare",
|
|
896
938
|
"aria-pressed": active,
|
|
897
939
|
onClick: () => {
|
|
898
940
|
setPicked(active ? void 0 : key);
|
|
899
941
|
if (!active) setOther("");
|
|
900
942
|
},
|
|
901
|
-
className: "rounded-full border px-3 py-1.5 text-xs font-medium
|
|
943
|
+
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
944
|
children: t2(`crm.lostReason.${key}`)
|
|
903
945
|
},
|
|
904
946
|
key
|
|
@@ -933,7 +975,7 @@ function LostReasonDialog({
|
|
|
933
975
|
function useCrmUnitFilter() {
|
|
934
976
|
return useUnitFilter({ scope: "global" });
|
|
935
977
|
}
|
|
936
|
-
var ROW = "
|
|
978
|
+
var ROW = "gap-2 text-xs hover:bg-muted";
|
|
937
979
|
function UnitPicker({ filter: f }) {
|
|
938
980
|
const [open, setOpen] = React.useState(false);
|
|
939
981
|
if (!f.visible) return null;
|
|
@@ -944,11 +986,12 @@ function UnitPicker({ filter: f }) {
|
|
|
944
986
|
};
|
|
945
987
|
return /* @__PURE__ */ jsxs(Dropdown, { open, onOpenChange: setOpen, children: [
|
|
946
988
|
/* @__PURE__ */ jsx(DropdownTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
947
|
-
|
|
989
|
+
Button,
|
|
948
990
|
{
|
|
949
991
|
type: "button",
|
|
992
|
+
variant: "outline",
|
|
950
993
|
title: f.label,
|
|
951
|
-
className: "
|
|
994
|
+
className: "h-8 shrink-0 gap-1.5 rounded-full px-3 text-xs font-medium",
|
|
952
995
|
children: [
|
|
953
996
|
/* @__PURE__ */ jsx(Building2, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
954
997
|
/* @__PURE__ */ jsx("span", { className: "max-w-[10rem] truncate", children: current }),
|
|
@@ -957,12 +1000,12 @@ function UnitPicker({ filter: f }) {
|
|
|
957
1000
|
}
|
|
958
1001
|
) }),
|
|
959
1002
|
/* @__PURE__ */ jsxs(DropdownContent, { align: "end", className: "w-56 p-1", children: [
|
|
960
|
-
/* @__PURE__ */ jsxs(
|
|
1003
|
+
/* @__PURE__ */ jsxs(DropdownItem, { className: ROW, onSelect: () => pick(void 0), children: [
|
|
961
1004
|
/* @__PURE__ */ jsx("span", { className: "truncate", children: f.allLabel }),
|
|
962
1005
|
!f.value && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 shrink-0" })
|
|
963
1006
|
] }),
|
|
964
1007
|
/* @__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(
|
|
1008
|
+
/* @__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
1009
|
/* @__PURE__ */ jsx("span", { className: "truncate", children: u.name }),
|
|
967
1010
|
f.value === u.id && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 shrink-0" })
|
|
968
1011
|
] }, u.id)) })
|
|
@@ -1450,13 +1493,15 @@ function usePipelineAgentSurface(deps) {
|
|
|
1450
1493
|
}, [deps.provider, deps.pipelines, deps.activePipelineId, deps.stages, deps.dealCountByStage, deps.refresh]);
|
|
1451
1494
|
useAgentSurface(contribution);
|
|
1452
1495
|
}
|
|
1453
|
-
var CHIP_ROW = "flex w-full
|
|
1496
|
+
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
1497
|
function BoardFilterChip({ trigger, onClear, clearLabel, closeOnSelect, children }) {
|
|
1455
1498
|
const [open, setOpen] = React__default.useState(false);
|
|
1456
1499
|
return /* @__PURE__ */ jsxs(Dropdown, { open, onOpenChange: setOpen, children: [
|
|
1457
1500
|
/* @__PURE__ */ jsx(DropdownTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
1458
|
-
|
|
1501
|
+
Button,
|
|
1459
1502
|
{
|
|
1503
|
+
variant: "bare",
|
|
1504
|
+
size: "bare",
|
|
1460
1505
|
type: "button",
|
|
1461
1506
|
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
1507
|
children: [
|
|
@@ -1474,7 +1519,7 @@ function BoardFilterChip({ trigger, onClear, clearLabel, closeOnSelect, children
|
|
|
1474
1519
|
children
|
|
1475
1520
|
}
|
|
1476
1521
|
),
|
|
1477
|
-
/* @__PURE__ */ jsx("div", { className: "mt-1 border-t pt-1", children: /* @__PURE__ */ jsxs("
|
|
1522
|
+
/* @__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
1523
|
onClear();
|
|
1479
1524
|
setOpen(false);
|
|
1480
1525
|
}, children: [
|
|
@@ -1510,11 +1555,13 @@ function PipelineSkeleton() {
|
|
|
1510
1555
|
function OwnerControl({ ownerId, team, onAssign }) {
|
|
1511
1556
|
const t2 = useTranslation();
|
|
1512
1557
|
const current = ownerId ? team?.find((m) => m.userId === ownerId) : void 0;
|
|
1513
|
-
const item = "flex w-full
|
|
1558
|
+
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
1559
|
return /* @__PURE__ */ jsxs(Dropdown, { children: [
|
|
1515
1560
|
/* @__PURE__ */ jsx(DropdownTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
1516
|
-
|
|
1561
|
+
Button,
|
|
1517
1562
|
{
|
|
1563
|
+
variant: "bare",
|
|
1564
|
+
size: "bare",
|
|
1518
1565
|
onClick: (e) => e.stopPropagation(),
|
|
1519
1566
|
draggable: false,
|
|
1520
1567
|
title: current?.name ?? t2("crm.pipeline.assignOwner"),
|
|
@@ -1526,12 +1573,12 @@ function OwnerControl({ ownerId, team, onAssign }) {
|
|
|
1526
1573
|
/* @__PURE__ */ jsx("p", { className: "px-2 py-1 text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: t2("crm.pipeline.assignOwner") }),
|
|
1527
1574
|
team === null && /* @__PURE__ */ jsx("p", { className: "px-2 py-1.5 text-xs text-muted-foreground", children: t2("crm.pipeline.teamUnavailable") }),
|
|
1528
1575
|
team !== null && /* @__PURE__ */ jsxs("div", { className: "max-h-56 overflow-y-auto", children: [
|
|
1529
|
-
/* @__PURE__ */ jsxs("
|
|
1576
|
+
/* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: item, onClick: () => onAssign(void 0), children: [
|
|
1530
1577
|
/* @__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
1578
|
t2("crm.pipeline.unassigned"),
|
|
1532
1579
|
!ownerId && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 text-muted-foreground" })
|
|
1533
1580
|
] }),
|
|
1534
|
-
team.map((m) => /* @__PURE__ */ jsxs("
|
|
1581
|
+
team.map((m) => /* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: item, onClick: () => onAssign(m.userId), children: [
|
|
1535
1582
|
/* @__PURE__ */ jsx(PersonAvatar, { name: m.name, size: "xs" }),
|
|
1536
1583
|
/* @__PURE__ */ jsx("span", { className: "truncate", children: m.name }),
|
|
1537
1584
|
ownerId === m.userId && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 shrink-0 text-muted-foreground" })
|
|
@@ -1553,8 +1600,10 @@ function DisplayPopover({ display, onChange }) {
|
|
|
1553
1600
|
if (!open) setPage("root");
|
|
1554
1601
|
}, children: [
|
|
1555
1602
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
1556
|
-
|
|
1603
|
+
Button,
|
|
1557
1604
|
{
|
|
1605
|
+
variant: "bare",
|
|
1606
|
+
size: "bare",
|
|
1558
1607
|
type: "button",
|
|
1559
1608
|
title: t2("crm.board.display"),
|
|
1560
1609
|
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 +1614,13 @@ function DisplayPopover({ display, onChange }) {
|
|
|
1565
1614
|
page === "root" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1566
1615
|
/* @__PURE__ */ jsx("p", { className: "px-2 py-1 text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: t2("crm.board.display") }),
|
|
1567
1616
|
/* @__PURE__ */ jsxs(
|
|
1568
|
-
|
|
1617
|
+
Button,
|
|
1569
1618
|
{
|
|
1619
|
+
variant: "bare",
|
|
1620
|
+
size: "bare",
|
|
1570
1621
|
type: "button",
|
|
1571
1622
|
onClick: () => setPage("props"),
|
|
1572
|
-
className: "flex w-full
|
|
1623
|
+
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
1624
|
children: [
|
|
1574
1625
|
/* @__PURE__ */ jsx(SlidersHorizontal, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
1575
1626
|
t2("crm.board.cardProps"),
|
|
@@ -1580,11 +1631,13 @@ function DisplayPopover({ display, onChange }) {
|
|
|
1580
1631
|
] }),
|
|
1581
1632
|
page === "props" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1582
1633
|
/* @__PURE__ */ jsxs(
|
|
1583
|
-
|
|
1634
|
+
Button,
|
|
1584
1635
|
{
|
|
1636
|
+
variant: "bare",
|
|
1637
|
+
size: "bare",
|
|
1585
1638
|
type: "button",
|
|
1586
1639
|
onClick: () => setPage("root"),
|
|
1587
|
-
className: "flex w-full
|
|
1640
|
+
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
1641
|
children: [
|
|
1589
1642
|
/* @__PURE__ */ jsx(ChevronLeft, { className: "h-3.5 w-3.5" }),
|
|
1590
1643
|
" ",
|
|
@@ -1597,12 +1650,14 @@ function DisplayPopover({ display, onChange }) {
|
|
|
1597
1650
|
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1.5 p-1", children: Object.keys(DISPLAY_DEFAULTS).map((k) => {
|
|
1598
1651
|
const on = display[k];
|
|
1599
1652
|
return /* @__PURE__ */ jsx(
|
|
1600
|
-
|
|
1653
|
+
Button,
|
|
1601
1654
|
{
|
|
1655
|
+
variant: "bare",
|
|
1656
|
+
size: "bare",
|
|
1602
1657
|
type: "button",
|
|
1603
1658
|
"aria-pressed": on,
|
|
1604
1659
|
onClick: () => onChange({ ...display, [k]: !on }),
|
|
1605
|
-
className: `rounded-full px-2.5 py-1 text-xs
|
|
1660
|
+
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
1661
|
children: t2(`crm.board.prop.${k}`)
|
|
1607
1662
|
},
|
|
1608
1663
|
k
|
|
@@ -1711,11 +1766,13 @@ function BoardMenu({ menu, team, stages, canArchive, onClose, onOpenDeal, onAssi
|
|
|
1711
1766
|
left: Math.min(menu.x, (typeof window !== "undefined" ? window.innerWidth : 1200) - 240),
|
|
1712
1767
|
top: Math.min(menu.y, (typeof window !== "undefined" ? window.innerHeight : 800) - 340)
|
|
1713
1768
|
};
|
|
1714
|
-
const item = "flex w-full
|
|
1769
|
+
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
1770
|
const backRow = (label2) => /* @__PURE__ */ jsxs(
|
|
1716
|
-
|
|
1771
|
+
Button,
|
|
1717
1772
|
{
|
|
1718
|
-
|
|
1773
|
+
variant: "bare",
|
|
1774
|
+
size: "bare",
|
|
1775
|
+
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
1776
|
onClick: () => setMode("actions"),
|
|
1720
1777
|
children: [
|
|
1721
1778
|
/* @__PURE__ */ jsx(ChevronLeft, { className: "h-3.5 w-3.5" }),
|
|
@@ -1740,7 +1797,7 @@ function BoardMenu({ menu, team, stages, canArchive, onClose, onOpenDeal, onAssi
|
|
|
1740
1797
|
),
|
|
1741
1798
|
/* @__PURE__ */ jsxs("div", { className: "fixed z-50 w-56 rounded-card border bg-popover p-1 shadow-lg", style, children: [
|
|
1742
1799
|
menu.mode === "actions" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1743
|
-
/* @__PURE__ */ jsxs("
|
|
1800
|
+
/* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: item, onClick: () => {
|
|
1744
1801
|
onClose();
|
|
1745
1802
|
onOpenDeal(deal);
|
|
1746
1803
|
}, children: [
|
|
@@ -1748,18 +1805,18 @@ function BoardMenu({ menu, team, stages, canArchive, onClose, onOpenDeal, onAssi
|
|
|
1748
1805
|
" ",
|
|
1749
1806
|
t2("crm.pipeline.openDeal")
|
|
1750
1807
|
] }),
|
|
1751
|
-
/* @__PURE__ */ jsxs("
|
|
1808
|
+
/* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: item, onClick: () => setMode("assign"), children: [
|
|
1752
1809
|
/* @__PURE__ */ jsx(UserRound, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
1753
1810
|
" ",
|
|
1754
1811
|
t2("crm.pipeline.assignOwner")
|
|
1755
1812
|
] }),
|
|
1756
|
-
/* @__PURE__ */ jsxs("
|
|
1813
|
+
/* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: item, onClick: () => setMode("move"), children: [
|
|
1757
1814
|
/* @__PURE__ */ jsx(ArrowRightLeft, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
1758
1815
|
" ",
|
|
1759
1816
|
t2("crm.pipeline.moveTo")
|
|
1760
1817
|
] }),
|
|
1761
1818
|
(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("
|
|
1819
|
+
wonStage && deal.stageId !== wonStage.id && /* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: item, onClick: () => {
|
|
1763
1820
|
onClose();
|
|
1764
1821
|
onMove(deal, wonStage.id);
|
|
1765
1822
|
}, children: [
|
|
@@ -1767,7 +1824,7 @@ function BoardMenu({ menu, team, stages, canArchive, onClose, onOpenDeal, onAssi
|
|
|
1767
1824
|
" ",
|
|
1768
1825
|
t2("crm.pipeline.markWon")
|
|
1769
1826
|
] }),
|
|
1770
|
-
lostStage && deal.stageId !== lostStage.id && /* @__PURE__ */ jsxs("
|
|
1827
|
+
lostStage && deal.stageId !== lostStage.id && /* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: item, onClick: () => {
|
|
1771
1828
|
onClose();
|
|
1772
1829
|
onMove(deal, lostStage.id);
|
|
1773
1830
|
}, children: [
|
|
@@ -1777,7 +1834,7 @@ function BoardMenu({ menu, team, stages, canArchive, onClose, onOpenDeal, onAssi
|
|
|
1777
1834
|
] }),
|
|
1778
1835
|
canArchive && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1779
1836
|
/* @__PURE__ */ jsx("div", { className: "my-1 border-t border-border" }),
|
|
1780
|
-
/* @__PURE__ */ jsxs("
|
|
1837
|
+
/* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: `${item} text-destructive hover:bg-destructive/10`, onClick: () => {
|
|
1781
1838
|
onClose();
|
|
1782
1839
|
onArchive(deal);
|
|
1783
1840
|
}, children: [
|
|
@@ -1792,7 +1849,7 @@ function BoardMenu({ menu, team, stages, canArchive, onClose, onOpenDeal, onAssi
|
|
|
1792
1849
|
/* @__PURE__ */ jsx("div", { className: "my-1 border-t border-border" }),
|
|
1793
1850
|
team === null && /* @__PURE__ */ jsx("p", { className: "px-2 py-1.5 text-xs text-muted-foreground", children: t2("crm.pipeline.teamUnavailable") }),
|
|
1794
1851
|
team !== null && /* @__PURE__ */ jsxs("div", { className: "max-h-56 overflow-y-auto", children: [
|
|
1795
|
-
/* @__PURE__ */ jsxs("
|
|
1852
|
+
/* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: item, onClick: () => {
|
|
1796
1853
|
onClose();
|
|
1797
1854
|
onAssign(deal, void 0);
|
|
1798
1855
|
}, children: [
|
|
@@ -1800,7 +1857,7 @@ function BoardMenu({ menu, team, stages, canArchive, onClose, onOpenDeal, onAssi
|
|
|
1800
1857
|
t2("crm.pipeline.unassigned"),
|
|
1801
1858
|
!deal.assignedToId && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 text-muted-foreground" })
|
|
1802
1859
|
] }),
|
|
1803
|
-
team.map((m) => /* @__PURE__ */ jsxs("
|
|
1860
|
+
team.map((m) => /* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: item, onClick: () => {
|
|
1804
1861
|
onClose();
|
|
1805
1862
|
onAssign(deal, m.userId);
|
|
1806
1863
|
}, children: [
|
|
@@ -1813,7 +1870,7 @@ function BoardMenu({ menu, team, stages, canArchive, onClose, onOpenDeal, onAssi
|
|
|
1813
1870
|
menu.mode === "move" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1814
1871
|
backRow(t2("crm.pipeline.moveTo")),
|
|
1815
1872
|
/* @__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("
|
|
1873
|
+
/* @__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
1874
|
onClose();
|
|
1818
1875
|
onMove(deal, s.id);
|
|
1819
1876
|
}, children: [
|
|
@@ -1854,8 +1911,10 @@ function StageCards({ stageId, deals, total, onLoadMore, loadMoreLabel, savingDe
|
|
|
1854
1911
|
deal.id
|
|
1855
1912
|
)),
|
|
1856
1913
|
onLoadMore && total !== void 0 && total > deals.length && /* @__PURE__ */ jsx(
|
|
1857
|
-
|
|
1914
|
+
Button,
|
|
1858
1915
|
{
|
|
1916
|
+
variant: "bare",
|
|
1917
|
+
size: "bare",
|
|
1859
1918
|
type: "button",
|
|
1860
1919
|
onClick: onLoadMore,
|
|
1861
1920
|
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 +2231,19 @@ function PipelineView({ onDealClick, onAddLead, onOpenSettings, onStageIntent })
|
|
|
2172
2231
|
/* @__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
2232
|
] }),
|
|
2174
2233
|
children: [
|
|
2175
|
-
myUserId && /* @__PURE__ */ jsxs("
|
|
2234
|
+
myUserId && /* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: CHIP_ROW, onClick: () => setOwnerFilter("__me__"), children: [
|
|
2176
2235
|
/* @__PURE__ */ jsx(PersonAvatar, { name: (team ?? []).find((m) => m.userId === myUserId)?.name ?? "Eu", size: "xs" }),
|
|
2177
2236
|
" ",
|
|
2178
2237
|
t2("crm.leads.filters.mine"),
|
|
2179
2238
|
effectiveOwner === myUserId && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 shrink-0" })
|
|
2180
2239
|
] }),
|
|
2181
|
-
/* @__PURE__ */ jsxs("
|
|
2240
|
+
/* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: CHIP_ROW, onClick: () => setOwnerFilter("none"), children: [
|
|
2182
2241
|
/* @__PURE__ */ jsx(UserRound, { className: "h-3 w-3 text-muted-foreground" }),
|
|
2183
2242
|
" ",
|
|
2184
2243
|
t2("crm.leads.filters.unassigned"),
|
|
2185
2244
|
effectiveOwner === "none" && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 shrink-0" })
|
|
2186
2245
|
] }),
|
|
2187
|
-
(team ?? []).filter((m) => m.userId !== myUserId).map((m) => /* @__PURE__ */ jsxs("
|
|
2246
|
+
(team ?? []).filter((m) => m.userId !== myUserId).map((m) => /* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: CHIP_ROW, onClick: () => setOwnerFilter(m.userId), children: [
|
|
2188
2247
|
/* @__PURE__ */ jsx(PersonAvatar, { name: m.name, size: "xs" }),
|
|
2189
2248
|
" ",
|
|
2190
2249
|
/* @__PURE__ */ jsx("span", { className: "truncate", children: m.name }),
|
|
@@ -2203,7 +2262,7 @@ function PipelineView({ onDealClick, onAddLead, onOpenSettings, onStageIntent })
|
|
|
2203
2262
|
/* @__PURE__ */ jsx(CalendarDays, { className: "h-3 w-3" }),
|
|
2204
2263
|
t2(`crm.filters.period${period === "custom" ? "Custom" : period}`)
|
|
2205
2264
|
] }),
|
|
2206
|
-
children: ["24h", "7d", "custom"].map((p) => /* @__PURE__ */ jsxs("
|
|
2265
|
+
children: ["24h", "7d", "custom"].map((p) => /* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: CHIP_ROW, onClick: () => setPeriod(p), children: [
|
|
2207
2266
|
t2(`crm.filters.period${p === "custom" ? "Custom" : p}`),
|
|
2208
2267
|
period === p && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 shrink-0" })
|
|
2209
2268
|
] }, p))
|
|
@@ -2224,8 +2283,10 @@ function PipelineView({ onDealClick, onAddLead, onOpenSettings, onStageIntent })
|
|
|
2224
2283
|
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
2284
|
const on = selectedTags.includes(slug);
|
|
2226
2285
|
return /* @__PURE__ */ jsxs(
|
|
2227
|
-
|
|
2286
|
+
Button,
|
|
2228
2287
|
{
|
|
2288
|
+
variant: "bare",
|
|
2289
|
+
size: "bare",
|
|
2229
2290
|
className: CHIP_ROW,
|
|
2230
2291
|
onClick: () => setSelectedTags(on ? selectedTags.filter((s) => s !== slug) : [...selectedTags, slug]),
|
|
2231
2292
|
children: [
|
|
@@ -2255,13 +2316,13 @@ function PipelineView({ onDealClick, onAddLead, onOpenSettings, onStageIntent })
|
|
|
2255
2316
|
header: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
2256
2317
|
/* @__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
2318
|
/* @__PURE__ */ jsx(
|
|
2258
|
-
|
|
2319
|
+
Input,
|
|
2259
2320
|
{
|
|
2260
2321
|
type: "text",
|
|
2261
2322
|
value: search,
|
|
2262
2323
|
onChange: (e) => setSearch(e.target.value),
|
|
2263
2324
|
placeholder: t2("crm.deals.searchPlaceholder"),
|
|
2264
|
-
className: "h-8
|
|
2325
|
+
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
2326
|
}
|
|
2266
2327
|
)
|
|
2267
2328
|
] }),
|
|
@@ -2376,8 +2437,10 @@ function PipelineView({ onDealClick, onAddLead, onOpenSettings, onStageIntent })
|
|
|
2376
2437
|
count: (col) => query ? (displayBoard.get(col.id) ?? []).length : dealStageTotals.get(col.id) ?? (displayBoard.get(col.id) ?? []).length,
|
|
2377
2438
|
isOver: (col) => dragOverStageId === col.id,
|
|
2378
2439
|
columnAction: onAddLead ? (col) => /* @__PURE__ */ jsx(
|
|
2379
|
-
|
|
2440
|
+
Button,
|
|
2380
2441
|
{
|
|
2442
|
+
variant: "bare",
|
|
2443
|
+
size: "bare",
|
|
2381
2444
|
onClick: (e) => {
|
|
2382
2445
|
e.stopPropagation();
|
|
2383
2446
|
onAddLead(col.id);
|
|
@@ -2926,13 +2989,13 @@ function DealListView({ onOpenDeal }) {
|
|
|
2926
2989
|
/* @__PURE__ */ jsxs("div", { className: "relative min-w-[12rem] flex-1", children: [
|
|
2927
2990
|
/* @__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
2991
|
/* @__PURE__ */ jsx(
|
|
2929
|
-
|
|
2992
|
+
Input,
|
|
2930
2993
|
{
|
|
2931
2994
|
type: "text",
|
|
2932
2995
|
value: search,
|
|
2933
2996
|
onChange: (e) => setSearch(e.target.value),
|
|
2934
2997
|
placeholder: t2("crm.deals.searchPlaceholder"),
|
|
2935
|
-
className: "
|
|
2998
|
+
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
2999
|
}
|
|
2937
3000
|
)
|
|
2938
3001
|
] }),
|
|
@@ -3030,11 +3093,12 @@ function DealListView({ onOpenDeal }) {
|
|
|
3030
3093
|
),
|
|
3031
3094
|
filtersMenu,
|
|
3032
3095
|
filtrosAtivos > 0 && /* @__PURE__ */ jsxs(
|
|
3033
|
-
|
|
3096
|
+
Button,
|
|
3034
3097
|
{
|
|
3035
3098
|
type: "button",
|
|
3099
|
+
variant: "ghost",
|
|
3036
3100
|
onClick: limparFiltros,
|
|
3037
|
-
className: "
|
|
3101
|
+
className: "h-auto shrink-0 gap-1 rounded-full px-2 py-1 text-xs font-medium text-muted-foreground",
|
|
3038
3102
|
children: [
|
|
3039
3103
|
/* @__PURE__ */ jsx(X, { className: "h-3 w-3 shrink-0" }),
|
|
3040
3104
|
t2("crm.leads.filters.clear")
|
|
@@ -3083,25 +3147,29 @@ function DealListView({ onOpenDeal }) {
|
|
|
3083
3147
|
}) }),
|
|
3084
3148
|
totalPages > 1 && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
3085
3149
|
/* @__PURE__ */ jsx(
|
|
3086
|
-
|
|
3150
|
+
Button,
|
|
3087
3151
|
{
|
|
3088
3152
|
type: "button",
|
|
3089
3153
|
"aria-label": t2("crud.list.prevPage"),
|
|
3090
3154
|
disabled: page <= 1,
|
|
3091
3155
|
onClick: () => setPage((p) => p - 1),
|
|
3092
|
-
|
|
3156
|
+
variant: "ghost",
|
|
3157
|
+
size: "icon",
|
|
3158
|
+
className: "h-7 w-7 rounded-md text-muted-foreground disabled:opacity-40",
|
|
3093
3159
|
children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" })
|
|
3094
3160
|
}
|
|
3095
3161
|
),
|
|
3096
3162
|
/* @__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
3163
|
/* @__PURE__ */ jsx(
|
|
3098
|
-
|
|
3164
|
+
Button,
|
|
3099
3165
|
{
|
|
3100
3166
|
type: "button",
|
|
3101
3167
|
"aria-label": t2("crud.list.nextPage"),
|
|
3102
3168
|
disabled: page >= totalPages,
|
|
3103
3169
|
onClick: () => setPage((p) => p + 1),
|
|
3104
|
-
|
|
3170
|
+
variant: "ghost",
|
|
3171
|
+
size: "icon",
|
|
3172
|
+
className: "h-7 w-7 rounded-md text-muted-foreground disabled:opacity-40",
|
|
3105
3173
|
children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
|
|
3106
3174
|
}
|
|
3107
3175
|
)
|
|
@@ -3208,12 +3276,14 @@ function DealFunnelView({ onStageClick }) {
|
|
|
3208
3276
|
const topW = widthOf(stage.dealCount);
|
|
3209
3277
|
const botW = next ? widthOf(next.dealCount) : Math.max(topW - 14, 8);
|
|
3210
3278
|
return /* @__PURE__ */ jsxs(
|
|
3211
|
-
|
|
3279
|
+
Button,
|
|
3212
3280
|
{
|
|
3213
3281
|
type: "button",
|
|
3282
|
+
variant: "bare",
|
|
3283
|
+
size: "bare",
|
|
3214
3284
|
onClick: onStageClick ? () => onStageClick(stage.stageId) : void 0,
|
|
3215
3285
|
title: onStageClick ? `${stage.stageName} \u2014 ${t2("crm.deals.viewList")}` : stage.stageName,
|
|
3216
|
-
className: "group relative block h-12 w-full cursor-pointer",
|
|
3286
|
+
className: "group relative block h-12 w-full cursor-pointer rounded-none",
|
|
3217
3287
|
children: [
|
|
3218
3288
|
/* @__PURE__ */ jsx(
|
|
3219
3289
|
"div",
|
|
@@ -3274,38 +3344,29 @@ var TRANSITIONS = {
|
|
|
3274
3344
|
};
|
|
3275
3345
|
function RejectModal({ onConfirm, onCancel }) {
|
|
3276
3346
|
const [reason, setReason] = useState("");
|
|
3277
|
-
return
|
|
3278
|
-
|
|
3279
|
-
|
|
3347
|
+
return /* @__PURE__ */ jsx(Modal, { open: true, onOpenChange: (open) => {
|
|
3348
|
+
if (!open) onCancel();
|
|
3349
|
+
}, children: /* @__PURE__ */ jsxs(ModalContent, { className: "max-w-sm", children: [
|
|
3350
|
+
/* @__PURE__ */ jsxs(ModalHeader, { children: [
|
|
3351
|
+
/* @__PURE__ */ jsx(ModalTitle, { children: "Reject Quote" }),
|
|
3352
|
+
/* @__PURE__ */ jsx(ModalDescription, { children: "Provide a reason for the rejection." })
|
|
3353
|
+
] }),
|
|
3354
|
+
/* @__PURE__ */ jsx(ModalBody, { children: /* @__PURE__ */ jsx(
|
|
3355
|
+
Textarea,
|
|
3280
3356
|
{
|
|
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
|
-
]
|
|
3357
|
+
value: reason,
|
|
3358
|
+
onChange: (e) => setReason(e.target.value),
|
|
3359
|
+
rows: 3,
|
|
3360
|
+
placeholder: "Reason for rejection...",
|
|
3361
|
+
autoFocus: true,
|
|
3362
|
+
className: "resize-none"
|
|
3305
3363
|
}
|
|
3306
3364
|
) }),
|
|
3307
|
-
|
|
3308
|
-
|
|
3365
|
+
/* @__PURE__ */ jsxs(ModalFooter, { children: [
|
|
3366
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", onClick: onCancel, children: "Cancel" }),
|
|
3367
|
+
/* @__PURE__ */ jsx(Button, { variant: "destructive", size: "sm", onClick: () => onConfirm(reason), disabled: !reason.trim(), children: "Reject Quote" })
|
|
3368
|
+
] })
|
|
3369
|
+
] }) });
|
|
3309
3370
|
}
|
|
3310
3371
|
function QuoteStatusDropdown({ quote, onStatusChange, size = "default" }) {
|
|
3311
3372
|
const sendQuote = useCrmStore((s) => s.sendQuote);
|
|
@@ -3365,11 +3426,13 @@ function QuoteStatusDropdown({ quote, onStatusChange, size = "default" }) {
|
|
|
3365
3426
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3366
3427
|
/* @__PURE__ */ jsxs(Dropdown, { children: [
|
|
3367
3428
|
/* @__PURE__ */ jsx(DropdownTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
3368
|
-
|
|
3429
|
+
Button,
|
|
3369
3430
|
{
|
|
3431
|
+
variant: "bare",
|
|
3432
|
+
size: "bare",
|
|
3370
3433
|
onClick: (e) => e.stopPropagation(),
|
|
3371
3434
|
disabled: loading,
|
|
3372
|
-
className: `
|
|
3435
|
+
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
3436
|
children: [
|
|
3374
3437
|
!isSmall && /* @__PURE__ */ jsx(StatusIcon, { className: "h-3 w-3" }),
|
|
3375
3438
|
config.label,
|
|
@@ -3594,9 +3657,11 @@ function AutomationBolt({ activityType, messages, className = "" }) {
|
|
|
3594
3657
|
const active = hits.some((m) => m.enabled);
|
|
3595
3658
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3596
3659
|
/* @__PURE__ */ jsx(
|
|
3597
|
-
|
|
3660
|
+
Button,
|
|
3598
3661
|
{
|
|
3599
3662
|
type: "button",
|
|
3663
|
+
variant: "bare",
|
|
3664
|
+
size: "bare",
|
|
3600
3665
|
onClick: (e) => {
|
|
3601
3666
|
e.stopPropagation();
|
|
3602
3667
|
if (Detail) setOpen(true);
|
|
@@ -3604,7 +3669,11 @@ function AutomationBolt({ activityType, messages, className = "" }) {
|
|
|
3604
3669
|
},
|
|
3605
3670
|
title: describe(hits),
|
|
3606
3671
|
"aria-label": describe(hits),
|
|
3607
|
-
className:
|
|
3672
|
+
className: cn(
|
|
3673
|
+
"shrink-0 rounded",
|
|
3674
|
+
active ? "text-primary hover:text-primary/70" : "text-muted-foreground/40 hover:text-muted-foreground",
|
|
3675
|
+
className
|
|
3676
|
+
),
|
|
3608
3677
|
children: /* @__PURE__ */ jsx(Zap, { className: `h-3.5 w-3.5 ${active ? "fill-current" : ""}` })
|
|
3609
3678
|
}
|
|
3610
3679
|
),
|
|
@@ -3861,6 +3930,7 @@ function PartnerOnlineBookingCell({ value }) {
|
|
|
3861
3930
|
const t2 = useTranslation();
|
|
3862
3931
|
return value ? /* @__PURE__ */ jsx(Badge, { children: t2("common.yes") }) : /* @__PURE__ */ jsx(Badge, { variant: "secondary", children: t2("common.no") });
|
|
3863
3932
|
}
|
|
3933
|
+
var ROW_ACTION = "rounded p-1 text-muted-foreground hover:bg-muted disabled:opacity-30";
|
|
3864
3934
|
var loadMembers = loadTeam;
|
|
3865
3935
|
function AssigneeRotaInput({ value, onChange }) {
|
|
3866
3936
|
const t2 = useTranslation();
|
|
@@ -3893,52 +3963,48 @@ function AssigneeRotaInput({ value, onChange }) {
|
|
|
3893
3963
|
/* @__PURE__ */ jsx("span", { className: "w-5 text-xs tabular-nums text-muted-foreground", children: i + 1 }),
|
|
3894
3964
|
/* @__PURE__ */ jsx("span", { className: "flex-1 text-sm", children: nameOf(id) }),
|
|
3895
3965
|
/* @__PURE__ */ jsx(
|
|
3896
|
-
|
|
3966
|
+
Button,
|
|
3897
3967
|
{
|
|
3898
3968
|
type: "button",
|
|
3969
|
+
variant: "bare",
|
|
3970
|
+
size: "bare",
|
|
3899
3971
|
onClick: () => move(i, -1),
|
|
3900
3972
|
disabled: i === 0,
|
|
3901
|
-
className:
|
|
3973
|
+
className: ROW_ACTION,
|
|
3902
3974
|
title: t2("crm.rota.up"),
|
|
3903
3975
|
children: /* @__PURE__ */ jsx(ArrowUp, { className: "h-3.5 w-3.5" })
|
|
3904
3976
|
}
|
|
3905
3977
|
),
|
|
3906
3978
|
/* @__PURE__ */ jsx(
|
|
3907
|
-
|
|
3979
|
+
Button,
|
|
3908
3980
|
{
|
|
3909
3981
|
type: "button",
|
|
3982
|
+
variant: "bare",
|
|
3983
|
+
size: "bare",
|
|
3910
3984
|
onClick: () => move(i, 1),
|
|
3911
3985
|
disabled: i === rota.length - 1,
|
|
3912
|
-
className:
|
|
3986
|
+
className: ROW_ACTION,
|
|
3913
3987
|
title: t2("crm.rota.down"),
|
|
3914
3988
|
children: /* @__PURE__ */ jsx(ArrowDown, { className: "h-3.5 w-3.5" })
|
|
3915
3989
|
}
|
|
3916
3990
|
),
|
|
3917
3991
|
/* @__PURE__ */ jsx(
|
|
3918
|
-
|
|
3992
|
+
Button,
|
|
3919
3993
|
{
|
|
3920
3994
|
type: "button",
|
|
3995
|
+
variant: "bare",
|
|
3996
|
+
size: "bare",
|
|
3921
3997
|
onClick: () => onChange(rota.filter((x) => x !== id)),
|
|
3922
|
-
className:
|
|
3998
|
+
className: `${ROW_ACTION} hover:text-destructive`,
|
|
3923
3999
|
title: t2("crm.rota.remove"),
|
|
3924
4000
|
children: /* @__PURE__ */ jsx(X, { className: "h-3.5 w-3.5" })
|
|
3925
4001
|
}
|
|
3926
4002
|
)
|
|
3927
4003
|
] }, 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
|
-
)
|
|
4004
|
+
available.length > 0 && /* @__PURE__ */ jsxs(Select, { value: "", onValueChange: (v) => onChange([...rota, v]), children: [
|
|
4005
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-auto bg-background px-2 py-1.5 shadow-none", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: t2("crm.rota.add") }) }),
|
|
4006
|
+
/* @__PURE__ */ jsx(SelectContent, { children: available.map((m) => /* @__PURE__ */ jsx(SelectItem, { value: m.userId, children: m.name }, m.userId)) })
|
|
4007
|
+
] })
|
|
3942
4008
|
] });
|
|
3943
4009
|
}
|
|
3944
4010
|
function AssigneeRotaCell({ value }) {
|
|
@@ -4455,14 +4521,15 @@ function LinkCompanyPrompt({ personId, companyText, onLinked }) {
|
|
|
4455
4521
|
/* @__PURE__ */ jsx("span", { className: "block text-[11px] text-muted-foreground", children: t2(existente ? "crm.linkCompany.hintExisting" : "crm.linkCompany.hintNew") })
|
|
4456
4522
|
] }),
|
|
4457
4523
|
/* @__PURE__ */ jsxs(
|
|
4458
|
-
|
|
4524
|
+
Button,
|
|
4459
4525
|
{
|
|
4460
4526
|
type: "button",
|
|
4527
|
+
size: "sm",
|
|
4461
4528
|
onClick: () => {
|
|
4462
4529
|
void vincular();
|
|
4463
4530
|
},
|
|
4464
4531
|
disabled: ligando,
|
|
4465
|
-
className: "
|
|
4532
|
+
className: "h-7 shrink-0 px-3 font-medium disabled:opacity-60",
|
|
4466
4533
|
children: [
|
|
4467
4534
|
ligando ? /* @__PURE__ */ jsx(Loader2, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ jsx(Plus, { className: "h-3 w-3" }),
|
|
4468
4535
|
t2(existente ? "crm.linkCompany.link" : "crm.linkCompany.create")
|
|
@@ -4554,18 +4621,6 @@ function Section({ title, action, children }) {
|
|
|
4554
4621
|
children
|
|
4555
4622
|
] });
|
|
4556
4623
|
}
|
|
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
4624
|
function QuickAction({ icon: Icon, label: label2, onClick, href: href2 }) {
|
|
4570
4625
|
const disabled = !onClick && !href2;
|
|
4571
4626
|
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 +4631,12 @@ function QuickAction({ icon: Icon, label: label2, onClick, href: href2 }) {
|
|
|
4576
4631
|
caption
|
|
4577
4632
|
] });
|
|
4578
4633
|
}
|
|
4579
|
-
return /* @__PURE__ */ jsxs(
|
|
4634
|
+
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
4635
|
circle,
|
|
4581
4636
|
caption
|
|
4582
4637
|
] });
|
|
4583
4638
|
}
|
|
4639
|
+
var COMPOSER_FIELD = "min-h-0 resize-none rounded-lg border-border bg-background shadow-none focus-visible:ring-offset-0";
|
|
4584
4640
|
function formatDocument(doc) {
|
|
4585
4641
|
const d = doc.replace(/\D/g, "");
|
|
4586
4642
|
if (d.length === 14) return d.replace(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/, "$1.$2.$3/$4-$5");
|
|
@@ -4590,9 +4646,11 @@ function formatDocument(doc) {
|
|
|
4590
4646
|
function CopyDocument({ document: doc, label: label2 }) {
|
|
4591
4647
|
const [copied, setCopied] = React__default.useState(false);
|
|
4592
4648
|
return /* @__PURE__ */ jsx(
|
|
4593
|
-
|
|
4649
|
+
Button,
|
|
4594
4650
|
{
|
|
4595
4651
|
type: "button",
|
|
4652
|
+
variant: "ghost",
|
|
4653
|
+
size: "icon",
|
|
4596
4654
|
onClick: (e) => {
|
|
4597
4655
|
e.stopPropagation();
|
|
4598
4656
|
void navigator.clipboard?.writeText(doc.replace(/\D/g, "")).then(() => {
|
|
@@ -4603,7 +4661,7 @@ function CopyDocument({ document: doc, label: label2 }) {
|
|
|
4603
4661
|
},
|
|
4604
4662
|
title: label2,
|
|
4605
4663
|
"aria-label": label2,
|
|
4606
|
-
className: "
|
|
4664
|
+
className: "h-6 w-6 shrink-0 rounded-md text-muted-foreground",
|
|
4607
4665
|
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
4666
|
}
|
|
4609
4667
|
);
|
|
@@ -4626,11 +4684,12 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
4626
4684
|
const [contato, setContato] = useState(null);
|
|
4627
4685
|
const [stages, setStages] = useState([]);
|
|
4628
4686
|
const [activities, setActivities] = useState([]);
|
|
4629
|
-
const [quotes2, setQuotes] = useState(
|
|
4687
|
+
const [quotes2, setQuotes] = useState(null);
|
|
4688
|
+
const [companyPending, setCompanyPending] = useState(true);
|
|
4689
|
+
const [personPending, setPersonPending] = useState(true);
|
|
4630
4690
|
const [loading, setLoading] = useState(true);
|
|
4631
4691
|
const [activitiesLoading, setActivitiesLoading] = useState(true);
|
|
4632
4692
|
const [movingStage, setMovingStage] = useState(false);
|
|
4633
|
-
const [saving, setSaving] = useState(false);
|
|
4634
4693
|
const [closing, setClosing] = useState(false);
|
|
4635
4694
|
const [askingLost, setAskingLost] = useState(false);
|
|
4636
4695
|
const [draft, setDraft] = useState(null);
|
|
@@ -4646,7 +4705,6 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
4646
4705
|
const [myUserId, setMyUserId] = useState(null);
|
|
4647
4706
|
const [savingOwner, setSavingOwner] = useState(false);
|
|
4648
4707
|
const [score, setScore] = useState(void 0);
|
|
4649
|
-
const [editing, setEditing] = useState(false);
|
|
4650
4708
|
const wide = useIsWide();
|
|
4651
4709
|
const createActivity = useCrmStore((s) => s.createActivity);
|
|
4652
4710
|
const [ctypes, setCtypes] = useState(() => DEFAULT_ACTIVITY_TYPES);
|
|
@@ -4721,12 +4779,13 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
4721
4779
|
setSyncedDealId(dealId);
|
|
4722
4780
|
setLead(null);
|
|
4723
4781
|
setActivities([]);
|
|
4724
|
-
setQuotes(
|
|
4782
|
+
setQuotes(null);
|
|
4725
4783
|
setCompany(null);
|
|
4784
|
+
setCompanyPending(true);
|
|
4785
|
+
setPersonPending(true);
|
|
4726
4786
|
setPessoasDaCasa([]);
|
|
4727
4787
|
setStages([]);
|
|
4728
4788
|
setScore(void 0);
|
|
4729
|
-
setEditing(false);
|
|
4730
4789
|
setComposerOpen(false);
|
|
4731
4790
|
if (seed && seed.id === dealId) {
|
|
4732
4791
|
setDeal(seed);
|
|
@@ -4817,6 +4876,8 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
4817
4876
|
setDeal(d);
|
|
4818
4877
|
if (!d) {
|
|
4819
4878
|
setLoading(false);
|
|
4879
|
+
setCompanyPending(false);
|
|
4880
|
+
setPersonPending(false);
|
|
4820
4881
|
return;
|
|
4821
4882
|
}
|
|
4822
4883
|
void loadTeamOrNull({ unitId: d.unitId }).then((team2) => {
|
|
@@ -4829,8 +4890,12 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
4829
4890
|
}
|
|
4830
4891
|
const leadP = d.leadId ? provider.getLeadById(d.leadId) : Promise.resolve(null);
|
|
4831
4892
|
const contatoP = d.contactId && d.contactId !== d.leadId ? provider.getLeadById(d.contactId).catch(() => null) : Promise.resolve(null);
|
|
4832
|
-
void Promise.all([leadP, contatoP]).
|
|
4893
|
+
void Promise.all([leadP, contatoP]).catch(() => {
|
|
4894
|
+
if (!cancelled) setCompanyPending(false);
|
|
4895
|
+
return [null, null];
|
|
4896
|
+
}).then(([l, c]) => {
|
|
4833
4897
|
if (cancelled) return;
|
|
4898
|
+
setPersonPending(false);
|
|
4834
4899
|
setLead(l);
|
|
4835
4900
|
setContato(c);
|
|
4836
4901
|
const p = c ?? l;
|
|
@@ -4854,9 +4919,13 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
4854
4919
|
setScore(null);
|
|
4855
4920
|
}
|
|
4856
4921
|
const companyId = d.companyId ?? p?.companyId;
|
|
4922
|
+
if (!companyId) setCompanyPending(false);
|
|
4857
4923
|
if (companyId) {
|
|
4858
4924
|
void provider.getCompanyById(companyId).then((c2) => {
|
|
4859
4925
|
if (!cancelled) setCompany(c2);
|
|
4926
|
+
}).catch(() => {
|
|
4927
|
+
}).finally(() => {
|
|
4928
|
+
if (!cancelled) setCompanyPending(false);
|
|
4860
4929
|
});
|
|
4861
4930
|
void provider.getCompanyGroupPeople(companyId).catch(() => []).then((gente) => {
|
|
4862
4931
|
if (!cancelled) setPessoasDaCasa(gente);
|
|
@@ -4871,6 +4940,8 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
4871
4940
|
});
|
|
4872
4941
|
void provider.getQuotesByDealId(dealId).then((q) => {
|
|
4873
4942
|
if (!cancelled) setQuotes(q);
|
|
4943
|
+
}, () => {
|
|
4944
|
+
if (!cancelled) setQuotes([]);
|
|
4874
4945
|
});
|
|
4875
4946
|
void loadMyUserId().then((u) => {
|
|
4876
4947
|
if (!cancelled) setMyUserId(u);
|
|
@@ -4965,41 +5036,59 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
4965
5036
|
setSavingOwner(false);
|
|
4966
5037
|
}
|
|
4967
5038
|
}
|
|
4968
|
-
async function
|
|
4969
|
-
if (!deal || !draft
|
|
4970
|
-
|
|
5039
|
+
async function saveField(key, raw) {
|
|
5040
|
+
if (!deal || !draft) return;
|
|
5041
|
+
const text = typeof raw === "string" ? raw.trim() : "";
|
|
5042
|
+
if (key === "name" && !text) return;
|
|
4971
5043
|
try {
|
|
4972
|
-
if (
|
|
4973
|
-
await
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
});
|
|
5044
|
+
if (key === "value" || key === "expectedCloseDate" || key === "notes") {
|
|
5045
|
+
const patched = await provider.updateDeal(deal.id, key === "value" ? { value: Number(raw) || 0 } : { [key]: text || void 0 });
|
|
5046
|
+
setDeal(patched);
|
|
5047
|
+
setDraft((d) => d ? { ...d, [key]: key === "value" ? Number(raw) || 0 : text } : d);
|
|
5048
|
+
} else if (pessoaDoCard) {
|
|
5049
|
+
await updateLead(pessoaDoCard.id, { [key]: text || void 0 });
|
|
5050
|
+
const repintada = (x) => ({ ...x, [key]: text || (key === "name" ? x.name : "") });
|
|
5051
|
+
if (contato) setContato(repintada(contato));
|
|
5052
|
+
else if (lead) setLead(repintada(lead));
|
|
5053
|
+
setDraft((d) => d ? { ...d, [key]: text } : d);
|
|
5054
|
+
if (key === "name") setDeal((d) => d && d.contactId === pessoaDoCard.id ? { ...d, contactName: text } : d);
|
|
4979
5055
|
}
|
|
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
5056
|
toast.success(t2("crm.card.saved"));
|
|
4990
5057
|
} catch (err) {
|
|
4991
5058
|
toast.error(t2("crm.card.saveFailed"), { description: err?.message });
|
|
4992
|
-
} finally {
|
|
4993
|
-
setSaving(false);
|
|
4994
5059
|
}
|
|
4995
5060
|
}
|
|
5061
|
+
async function saveCompanyName(raw) {
|
|
5062
|
+
const name = typeof raw === "string" ? raw.trim() : "";
|
|
5063
|
+
if (!name) return;
|
|
5064
|
+
if (!company) return saveField("company", name);
|
|
5065
|
+
try {
|
|
5066
|
+
setCompany(await provider.saveCompany({ id: company.id, name }));
|
|
5067
|
+
setDeal((d) => d && d.companyName === company.name ? { ...d, companyName: name } : d);
|
|
5068
|
+
toast.success(t2("crm.card.saved"));
|
|
5069
|
+
} catch (err) {
|
|
5070
|
+
toast.error(t2("crm.card.saveFailed"), { description: err?.message });
|
|
5071
|
+
}
|
|
5072
|
+
}
|
|
5073
|
+
const headline = deal ? dealHeadline(deal) : "";
|
|
5074
|
+
const headlineSave = !deal || deal.groupName ? void 0 : deal.companyName ? company ? saveCompanyName : void 0 : deal.contactName && pessoaDoCard ? (v) => saveField("name", v) : void 0;
|
|
4996
5075
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4997
5076
|
/* @__PURE__ */ jsx(Modal, { open, onOpenChange: (o) => {
|
|
4998
5077
|
if (!o) onClose();
|
|
4999
5078
|
}, children: /* @__PURE__ */ jsxs(ModalContent, { size: "5xl", noPadding: true, children: [
|
|
5000
5079
|
/* @__PURE__ */ jsxs(ModalHeader, { className: "flex-col items-stretch gap-2 border-b px-5 py-3", children: [
|
|
5001
5080
|
/* @__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" }) :
|
|
5081
|
+
/* @__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(
|
|
5082
|
+
InlineField,
|
|
5083
|
+
{
|
|
5084
|
+
layout: "bare",
|
|
5085
|
+
t: t2,
|
|
5086
|
+
field: { key: "headline", label: deal?.companyName ? t2("crm.leadDetail.company") : t2("crm.leadDetail.name"), type: "text" },
|
|
5087
|
+
value: headline,
|
|
5088
|
+
display: /* @__PURE__ */ jsx("span", { className: "block truncate", children: headline || t2("crm.dealSidebar.deal") }),
|
|
5089
|
+
onSave: headlineSave
|
|
5090
|
+
}
|
|
5091
|
+
) }),
|
|
5003
5092
|
/* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-2 pr-8", children: [
|
|
5004
5093
|
deal?.status === "open" ? /* @__PURE__ */ jsxs(Button, { size: "sm", variant: "ghost", disabled: closing, onClick: () => setAskingLost(true), children: [
|
|
5005
5094
|
/* @__PURE__ */ jsx(ThumbsDown, { className: "h-3 w-3" }),
|
|
@@ -5048,15 +5137,17 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
5048
5137
|
journeyStages.map((s) => {
|
|
5049
5138
|
const active = s.id === deal?.stageId;
|
|
5050
5139
|
return /* @__PURE__ */ jsxs(
|
|
5051
|
-
|
|
5140
|
+
Button,
|
|
5052
5141
|
{
|
|
5053
5142
|
type: "button",
|
|
5143
|
+
variant: "bare",
|
|
5144
|
+
size: "bare",
|
|
5054
5145
|
disabled: movingStage,
|
|
5055
5146
|
onClick: () => {
|
|
5056
5147
|
void changeStage(s);
|
|
5057
5148
|
},
|
|
5058
5149
|
"aria-pressed": active,
|
|
5059
|
-
className: "
|
|
5150
|
+
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
5151
|
children: [
|
|
5061
5152
|
/* @__PURE__ */ jsx("span", { className: "h-2 w-2 rounded-full", style: { backgroundColor: s.color } }),
|
|
5062
5153
|
s.name
|
|
@@ -5098,8 +5189,30 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
5098
5189
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2 text-center", children: [
|
|
5099
5190
|
/* @__PURE__ */ jsx(PersonAvatar, { name: draft.name || deal?.contactName || "?", size: "md", className: "h-14 w-14 text-lg" }),
|
|
5100
5191
|
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
5101
|
-
/* @__PURE__ */ jsx(
|
|
5102
|
-
|
|
5192
|
+
/* @__PURE__ */ jsx(
|
|
5193
|
+
InlineField,
|
|
5194
|
+
{
|
|
5195
|
+
layout: "bare",
|
|
5196
|
+
className: "justify-center",
|
|
5197
|
+
t: t2,
|
|
5198
|
+
field: { key: "name", label: t2("crm.leadDetail.name"), type: "text" },
|
|
5199
|
+
value: draft.name,
|
|
5200
|
+
display: /* @__PURE__ */ jsx("span", { className: "block truncate text-sm font-semibold", children: draft.name || deal?.contactName || "\u2014" }),
|
|
5201
|
+
onSave: pessoaDoCard ? (v) => saveField("name", v) : void 0
|
|
5202
|
+
}
|
|
5203
|
+
),
|
|
5204
|
+
(company?.name || draft.company || pessoaDoCard) && /* @__PURE__ */ jsx(
|
|
5205
|
+
InlineField,
|
|
5206
|
+
{
|
|
5207
|
+
layout: "bare",
|
|
5208
|
+
className: "justify-center",
|
|
5209
|
+
t: t2,
|
|
5210
|
+
field: { key: "company", label: t2("crm.leadDetail.company"), type: "text" },
|
|
5211
|
+
value: company?.name ?? draft.company,
|
|
5212
|
+
display: /* @__PURE__ */ jsx("span", { className: "block truncate text-xs text-muted-foreground", children: company?.name ?? draft.company ?? "\u2014" }),
|
|
5213
|
+
onSave: company || pessoaDoCard ? saveCompanyName : void 0
|
|
5214
|
+
}
|
|
5215
|
+
),
|
|
5103
5216
|
pessoaDoCard?.companyRole && /* @__PURE__ */ jsx("p", { className: "truncate text-[11px] text-muted-foreground/80", children: pessoaDoCard.companyRole })
|
|
5104
5217
|
] }),
|
|
5105
5218
|
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 +5235,7 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
5122
5235
|
/* @__PURE__ */ jsx(QuickAction, { icon: Pencil, label: t2("crm.card.quickNote"), onClick: () => prepActivity("note") })
|
|
5123
5236
|
] })
|
|
5124
5237
|
] }),
|
|
5125
|
-
/* @__PURE__ */ jsx(Section, { title: t2("crm.card.pointOfContact"), children: /* @__PURE__ */ jsx(
|
|
5238
|
+
/* @__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
5239
|
PersonPicker,
|
|
5127
5240
|
{
|
|
5128
5241
|
options: pessoasDaCasa.map((x) => ({
|
|
@@ -5141,54 +5254,62 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
5141
5254
|
disabled: trocandoContato || pessoasDaCasa.length === 0
|
|
5142
5255
|
}
|
|
5143
5256
|
) }),
|
|
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
|
-
|
|
5257
|
+
/* @__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: [
|
|
5258
|
+
/* @__PURE__ */ jsx("div", { className: "h-3 w-16 animate-pulse rounded bg-muted/30" }),
|
|
5259
|
+
/* @__PURE__ */ jsx("div", { className: "h-5 w-36 animate-pulse rounded bg-muted/40" })
|
|
5260
|
+
] }, i)) }) : /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
5261
|
+
/* @__PURE__ */ jsx(
|
|
5262
|
+
InlineField,
|
|
5263
|
+
{
|
|
5264
|
+
layout: "stacked",
|
|
5265
|
+
t: t2,
|
|
5266
|
+
field: { key: "phone", label: t2("crm.leadDetail.phone"), type: "phone" },
|
|
5267
|
+
value: draft.phone,
|
|
5268
|
+
onSave: pessoaDoCard ? (v) => saveField("phone", v) : void 0
|
|
5269
|
+
}
|
|
5270
|
+
),
|
|
5271
|
+
/* @__PURE__ */ jsx(
|
|
5272
|
+
InlineField,
|
|
5273
|
+
{
|
|
5274
|
+
layout: "stacked",
|
|
5275
|
+
t: t2,
|
|
5276
|
+
field: { key: "email", label: t2("crm.leadDetail.email"), type: "email" },
|
|
5277
|
+
value: draft.email,
|
|
5278
|
+
onSave: pessoaDoCard ? (v) => saveField("email", v) : void 0
|
|
5279
|
+
}
|
|
5280
|
+
),
|
|
5281
|
+
/* @__PURE__ */ jsx(
|
|
5282
|
+
InlineField,
|
|
5283
|
+
{
|
|
5284
|
+
layout: "stacked",
|
|
5285
|
+
t: t2,
|
|
5286
|
+
field: { key: "value", label: t2("crm.dealSidebar.value"), type: "currency" },
|
|
5287
|
+
value: draft.value || void 0,
|
|
5288
|
+
display: draft.value ? formatCurrency(draft.value, currency) : void 0,
|
|
5289
|
+
onSave: (v) => saveField("value", v)
|
|
5290
|
+
}
|
|
5291
|
+
),
|
|
5292
|
+
/* @__PURE__ */ jsx(
|
|
5293
|
+
InlineField,
|
|
5294
|
+
{
|
|
5295
|
+
layout: "stacked",
|
|
5296
|
+
t: t2,
|
|
5297
|
+
field: { key: "expectedCloseDate", label: t2("crm.dealSidebar.expectedClose"), type: "date" },
|
|
5298
|
+
value: draft.expectedCloseDate,
|
|
5299
|
+
onSave: (v) => saveField("expectedCloseDate", v)
|
|
5300
|
+
}
|
|
5301
|
+
),
|
|
5302
|
+
/* @__PURE__ */ jsx(
|
|
5303
|
+
InlineField,
|
|
5304
|
+
{
|
|
5305
|
+
layout: "stacked",
|
|
5306
|
+
t: t2,
|
|
5307
|
+
field: { key: "notes", label: t2("crm.leadDetail.notes"), type: "textarea" },
|
|
5308
|
+
value: draft.notes,
|
|
5309
|
+
onSave: (v) => saveField("notes", v)
|
|
5310
|
+
}
|
|
5311
|
+
)
|
|
5312
|
+
] }) }),
|
|
5192
5313
|
/* @__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
5314
|
// Lista vazia aqui quase sempre é falta de `members.read`, e
|
|
5194
5315
|
// não uma casa sem equipe. Dizer "ninguém" seria mentir.
|
|
@@ -5218,13 +5339,15 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
5218
5339
|
}
|
|
5219
5340
|
),
|
|
5220
5341
|
myUserId && deal?.assignedToId !== myUserId && /* @__PURE__ */ jsxs(
|
|
5221
|
-
|
|
5342
|
+
Button,
|
|
5222
5343
|
{
|
|
5344
|
+
variant: "bare",
|
|
5345
|
+
size: "lg",
|
|
5223
5346
|
onClick: () => {
|
|
5224
5347
|
void changeOwner(myUserId);
|
|
5225
5348
|
},
|
|
5226
5349
|
disabled: savingOwner,
|
|
5227
|
-
className: "
|
|
5350
|
+
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
5351
|
children: [
|
|
5229
5352
|
/* @__PURE__ */ jsx(UserCheck, { className: "h-3.5 w-3.5" }),
|
|
5230
5353
|
deal?.assignedToId ? t2("crm.card.takeOverFrom") : t2("crm.card.takeOver")
|
|
@@ -5255,11 +5378,13 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
5255
5378
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
|
|
5256
5379
|
/* @__PURE__ */ jsx("h3", { className: "text-[11px] font-semibold uppercase tracking-wider text-muted-foreground", children: t2("crm.card.timeline") }),
|
|
5257
5380
|
/* @__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
|
-
|
|
5381
|
+
Button,
|
|
5259
5382
|
{
|
|
5260
5383
|
type: "button",
|
|
5384
|
+
variant: "bare",
|
|
5385
|
+
size: "bare",
|
|
5261
5386
|
onClick: () => setTimelineTab(v),
|
|
5262
|
-
className: "
|
|
5387
|
+
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
5388
|
children: label2
|
|
5264
5389
|
},
|
|
5265
5390
|
v
|
|
@@ -5269,36 +5394,42 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
5269
5394
|
/* @__PURE__ */ jsx(ArrowRight, { className: "h-3.5 w-3.5 shrink-0 text-primary" }),
|
|
5270
5395
|
/* @__PURE__ */ jsx("span", { className: "text-foreground", children: t2("crm.card.stageIntent").replace("{from}", deal.stageName ?? "\u2014").replace("{to}", pendingStage.name) }),
|
|
5271
5396
|
/* @__PURE__ */ jsx(
|
|
5272
|
-
|
|
5397
|
+
Button,
|
|
5273
5398
|
{
|
|
5274
5399
|
type: "button",
|
|
5275
|
-
|
|
5400
|
+
variant: "bare",
|
|
5401
|
+
size: "bare",
|
|
5402
|
+
className: "ml-auto text-xs font-normal text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",
|
|
5276
5403
|
onClick: () => onPendingResolved?.(false),
|
|
5277
5404
|
children: t2("crm.card.stageIntentCancel")
|
|
5278
5405
|
}
|
|
5279
5406
|
)
|
|
5280
5407
|
] }),
|
|
5281
5408
|
!composerOpen ? /* @__PURE__ */ jsx(
|
|
5282
|
-
|
|
5409
|
+
Button,
|
|
5283
5410
|
{
|
|
5284
5411
|
type: "button",
|
|
5412
|
+
variant: "bare",
|
|
5413
|
+
size: "bare",
|
|
5285
5414
|
onClick: () => prepActivity(ctype),
|
|
5286
|
-
className: "w-full rounded-card border bg-card px-3 py-2.5 text-left
|
|
5415
|
+
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
5416
|
children: t2("crm.followUp.placeholder")
|
|
5288
5417
|
}
|
|
5289
5418
|
) : /* @__PURE__ */ jsxs("div", { className: "space-y-2 rounded-card border bg-card p-3 shadow-sm", children: [
|
|
5290
5419
|
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: orderedTypes.map((tp) => /* @__PURE__ */ jsx(
|
|
5291
|
-
|
|
5420
|
+
Button,
|
|
5292
5421
|
{
|
|
5293
5422
|
type: "button",
|
|
5423
|
+
variant: "bare",
|
|
5424
|
+
size: "bare",
|
|
5294
5425
|
onClick: () => setCtype(tp.value),
|
|
5295
|
-
className: "rounded-full border px-2.5 py-0.5 text-[11px] font-medium
|
|
5426
|
+
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
5427
|
children: tp.label
|
|
5297
5428
|
},
|
|
5298
5429
|
tp.value
|
|
5299
5430
|
)) }),
|
|
5300
5431
|
/* @__PURE__ */ jsx(
|
|
5301
|
-
|
|
5432
|
+
Textarea,
|
|
5302
5433
|
{
|
|
5303
5434
|
ref: composerRef,
|
|
5304
5435
|
rows: 2,
|
|
@@ -5311,7 +5442,7 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
5311
5442
|
}
|
|
5312
5443
|
},
|
|
5313
5444
|
placeholder: t2("crm.followUp.placeholder"),
|
|
5314
|
-
className:
|
|
5445
|
+
className: COMPOSER_FIELD
|
|
5315
5446
|
}
|
|
5316
5447
|
),
|
|
5317
5448
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
@@ -5324,12 +5455,13 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
5324
5455
|
/* @__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
5456
|
] }),
|
|
5326
5457
|
ctype === "task" && /* @__PURE__ */ jsx(
|
|
5327
|
-
|
|
5458
|
+
DatePicker,
|
|
5328
5459
|
{
|
|
5329
|
-
|
|
5460
|
+
variant: "toolbar",
|
|
5461
|
+
format: "numeric",
|
|
5330
5462
|
value: cdue,
|
|
5331
|
-
onChange:
|
|
5332
|
-
|
|
5463
|
+
onChange: setCdue,
|
|
5464
|
+
triggerClassName: "h-8 rounded-lg bg-background px-2 font-normal shadow-none"
|
|
5333
5465
|
}
|
|
5334
5466
|
),
|
|
5335
5467
|
CONTACT_TYPES2.has(ctype) && coutcome === "not_now" && /* @__PURE__ */ jsx(FutureContactPicker, { value: cfutureDate, onChange: setCfutureDate, required: true }),
|
|
@@ -5358,6 +5490,11 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
5358
5490
|
/* @__PURE__ */ jsx(ActivityTimeline, { activities: shownActivities, loading: activitiesLoading, locale: currency.locale, contactName: deal?.contactName })
|
|
5359
5491
|
] }),
|
|
5360
5492
|
/* @__PURE__ */ jsxs("div", { className: (wide ? "min-h-0 shrink-0 overflow-y-auto border-l" : "border-t") + " space-y-5 p-5", style: wide ? { width: "18rem" } : void 0, children: [
|
|
5493
|
+
(() => {
|
|
5494
|
+
const storeTenantId = company?.metadata?.tenant_id_v2;
|
|
5495
|
+
if (!storeTenantId || typeof storeTenantId !== "string") return null;
|
|
5496
|
+
return /* @__PURE__ */ jsx(Section, { title: "Chamados desta loja", children: /* @__PURE__ */ jsx(HelpdeskStatusPanel, { tenantId: storeTenantId }) });
|
|
5497
|
+
})(),
|
|
5361
5498
|
deal?.groupName && /* @__PURE__ */ jsx(Section, { title: t2("crm.card.groupTitle"), children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 rounded-card border bg-muted/20 px-3 py-3", children: [
|
|
5362
5499
|
/* @__PURE__ */ jsx(Network, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
5363
5500
|
/* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1", children: [
|
|
@@ -5365,7 +5502,8 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
5365
5502
|
deal.groupCompanies ? /* @__PURE__ */ jsx("span", { className: "block truncate text-[11px] text-muted-foreground", children: t2("crm.card.groupCompanies", { count: String(deal.groupCompanies) }) }) : null
|
|
5366
5503
|
] })
|
|
5367
5504
|
] }) }),
|
|
5368
|
-
|
|
5505
|
+
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 }) }),
|
|
5506
|
+
!companyPending && !company && pessoaDoCard?.id && /* @__PURE__ */ jsx(Section, { title: t2("crm.card.companyTitle"), children: /* @__PURE__ */ jsx(
|
|
5369
5507
|
LinkCompanyPrompt,
|
|
5370
5508
|
{
|
|
5371
5509
|
personId: pessoaDoCard.id,
|
|
@@ -5380,12 +5518,14 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
5380
5518
|
}
|
|
5381
5519
|
) }),
|
|
5382
5520
|
company && /* @__PURE__ */ jsx(Section, { title: t2("crm.card.companyTitle"), children: /* @__PURE__ */ jsxs(
|
|
5383
|
-
|
|
5521
|
+
Button,
|
|
5384
5522
|
{
|
|
5385
5523
|
type: "button",
|
|
5524
|
+
variant: "bare",
|
|
5525
|
+
size: "bare",
|
|
5386
5526
|
onClick: () => onViewCompany?.(company.id),
|
|
5387
5527
|
disabled: !onViewCompany,
|
|
5388
|
-
className: "flex w-full
|
|
5528
|
+
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
5529
|
children: [
|
|
5390
5530
|
/* @__PURE__ */ jsx(Building2, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
5391
5531
|
/* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1", children: [
|
|
@@ -5405,15 +5545,17 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
5405
5545
|
{
|
|
5406
5546
|
title: t2("crm.dealSidebar.quotes"),
|
|
5407
5547
|
action: onCreateQuote && lead ? /* @__PURE__ */ jsx(
|
|
5408
|
-
|
|
5548
|
+
Button,
|
|
5409
5549
|
{
|
|
5410
5550
|
type: "button",
|
|
5551
|
+
variant: "bare",
|
|
5552
|
+
size: "bare",
|
|
5411
5553
|
onClick: () => onCreateQuote(lead.id),
|
|
5412
5554
|
className: "text-[11px] font-medium text-primary hover:underline",
|
|
5413
5555
|
children: t2("crm.leadDetail.createQuote")
|
|
5414
5556
|
}
|
|
5415
5557
|
) : 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(
|
|
5558
|
+
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
5559
|
"div",
|
|
5418
5560
|
{
|
|
5419
5561
|
onClick: () => onViewQuote?.(q.id),
|
|
@@ -5425,7 +5567,7 @@ function DealCardModal({ dealId, open, onClose, onViewLead, onViewQuote, onViewC
|
|
|
5425
5567
|
] }),
|
|
5426
5568
|
/* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-2", onClick: (e) => e.stopPropagation(), children: [
|
|
5427
5569
|
/* @__PURE__ */ jsx("span", { className: "text-sm font-semibold", children: formatCurrency(q.totalAmount, currency) }),
|
|
5428
|
-
/* @__PURE__ */ jsx(QuoteStatusDropdown, { quote: q, size: "sm", onStatusChange: (u) => setQuotes(
|
|
5570
|
+
/* @__PURE__ */ jsx(QuoteStatusDropdown, { quote: q, size: "sm", onStatusChange: (u) => setQuotes((qs) => qs?.map((x) => x.id === u.id ? u : x) ?? qs) })
|
|
5429
5571
|
] })
|
|
5430
5572
|
]
|
|
5431
5573
|
},
|
|
@@ -5595,7 +5737,7 @@ function LeadFormView({ onSaved, initialStageId, initialPipelineId }) {
|
|
|
5595
5737
|
] }),
|
|
5596
5738
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
5597
5739
|
/* @__PURE__ */ jsx("label", { className: "text-xs font-medium text-muted-foreground", children: t2("crm.leadForm.notes") }),
|
|
5598
|
-
/* @__PURE__ */ jsx(
|
|
5740
|
+
/* @__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
5741
|
] })
|
|
5600
5742
|
]
|
|
5601
5743
|
}
|
|
@@ -5692,15 +5834,17 @@ function DealsView({ mode, onChangeMode, openDealId, onOpenDeal, onCloseDeal, on
|
|
|
5692
5834
|
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
5835
|
const active = p.id === activePipelineId;
|
|
5694
5836
|
return /* @__PURE__ */ jsx(
|
|
5695
|
-
|
|
5837
|
+
Button,
|
|
5696
5838
|
{
|
|
5697
5839
|
type: "button",
|
|
5840
|
+
variant: "bare",
|
|
5841
|
+
size: "bare",
|
|
5698
5842
|
role: "tab",
|
|
5699
5843
|
"aria-selected": active,
|
|
5700
5844
|
onClick: () => {
|
|
5701
5845
|
void selectPipeline(p.id);
|
|
5702
5846
|
},
|
|
5703
|
-
className: "rounded-md px-3 py-1.5
|
|
5847
|
+
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
5848
|
children: p.name
|
|
5705
5849
|
},
|
|
5706
5850
|
p.id
|
|
@@ -6020,17 +6164,19 @@ function OwnerFilterChip({ t: t2, people, myUserId, value, effective, onChange }
|
|
|
6020
6164
|
const isMe = Boolean(effective && myUserId && effective === myUserId);
|
|
6021
6165
|
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
6166
|
const showAvatar = effective && effective !== "none";
|
|
6023
|
-
const row = "flex w-full
|
|
6167
|
+
const row = "flex w-full justify-start gap-2 px-2 py-1.5 text-left text-xs font-normal hover:bg-muted";
|
|
6024
6168
|
const pick = (v) => {
|
|
6025
6169
|
onChange(v);
|
|
6026
6170
|
setOpen(false);
|
|
6027
6171
|
};
|
|
6028
6172
|
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
|
|
6029
6173
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
6030
|
-
|
|
6174
|
+
Button,
|
|
6031
6175
|
{
|
|
6032
6176
|
type: "button",
|
|
6033
|
-
|
|
6177
|
+
variant: "bare",
|
|
6178
|
+
size: "bare",
|
|
6179
|
+
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
6180
|
children: [
|
|
6035
6181
|
showAvatar ? /* @__PURE__ */ jsx(PersonAvatar, { name: people.get(effective) ?? label2, size: "xs" }) : /* @__PURE__ */ jsx(User, { className: "h-3 w-3 shrink-0 opacity-70" }),
|
|
6036
6182
|
label2
|
|
@@ -6038,25 +6184,25 @@ function OwnerFilterChip({ t: t2, people, myUserId, value, effective, onChange }
|
|
|
6038
6184
|
}
|
|
6039
6185
|
) }),
|
|
6040
6186
|
/* @__PURE__ */ jsxs(PopoverContent, { align: "start", className: "w-60 p-1.5", children: [
|
|
6041
|
-
/* @__PURE__ */ jsxs("
|
|
6187
|
+
/* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: row, onClick: () => pick(""), children: [
|
|
6042
6188
|
/* @__PURE__ */ jsx(User, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
6043
6189
|
" ",
|
|
6044
6190
|
t2("crm.leads.filters.allOwners"),
|
|
6045
6191
|
!effective && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 text-muted-foreground" })
|
|
6046
6192
|
] }),
|
|
6047
|
-
myUserId && /* @__PURE__ */ jsxs("
|
|
6193
|
+
myUserId && /* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: row, onClick: () => pick("__me__"), children: [
|
|
6048
6194
|
/* @__PURE__ */ jsx(PersonAvatar, { name: people.get(myUserId) ?? "Eu", size: "xs" }),
|
|
6049
6195
|
" ",
|
|
6050
6196
|
t2("crm.leads.filters.mine"),
|
|
6051
6197
|
isMe && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 text-muted-foreground" })
|
|
6052
6198
|
] }),
|
|
6053
|
-
/* @__PURE__ */ jsxs("
|
|
6199
|
+
/* @__PURE__ */ jsxs(Button, { variant: "bare", size: "bare", className: row, onClick: () => pick("none"), children: [
|
|
6054
6200
|
/* @__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
6201
|
t2("crm.leads.filters.unassigned"),
|
|
6056
6202
|
effective === "none" && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 text-muted-foreground" })
|
|
6057
6203
|
] }),
|
|
6058
6204
|
/* @__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("
|
|
6205
|
+
/* @__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
6206
|
/* @__PURE__ */ jsx(PersonAvatar, { name: nome, size: "xs" }),
|
|
6061
6207
|
/* @__PURE__ */ jsx("span", { className: "truncate", children: nome }),
|
|
6062
6208
|
effective === id && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3 w-3 shrink-0 text-muted-foreground" })
|
|
@@ -6644,12 +6790,14 @@ function LeadListView({ onNew, onEdit }) {
|
|
|
6644
6790
|
statusFilter.map((s) => {
|
|
6645
6791
|
const opt = LEAD_STATUS_OPTIONS.find((o) => o.value === s);
|
|
6646
6792
|
return /* @__PURE__ */ jsx(
|
|
6647
|
-
|
|
6793
|
+
Button,
|
|
6648
6794
|
{
|
|
6649
6795
|
type: "button",
|
|
6796
|
+
variant: "bare",
|
|
6797
|
+
size: "bare",
|
|
6650
6798
|
title: t2("crm.leads.filters.clear"),
|
|
6651
6799
|
onClick: () => setStatusFilter(statusFilter.filter((x) => x !== s)),
|
|
6652
|
-
className: "shrink-0",
|
|
6800
|
+
className: "shrink-0 rounded-full",
|
|
6653
6801
|
children: /* @__PURE__ */ jsx(DotChip, { color: opt?.dot ?? "#94A3B8", label: opt ? t2(opt.labelKey) : s, className: "h-[26px] px-2.5 text-xs" })
|
|
6654
6802
|
},
|
|
6655
6803
|
s
|
|
@@ -6767,24 +6915,28 @@ function useQuoteColumns(currency, onEditQuote, onArchive) {
|
|
|
6767
6915
|
header: "",
|
|
6768
6916
|
cell: ({ row }) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-0.5", children: [
|
|
6769
6917
|
onEditQuote && /* @__PURE__ */ jsx(
|
|
6770
|
-
|
|
6918
|
+
Button,
|
|
6771
6919
|
{
|
|
6920
|
+
variant: "ghost",
|
|
6921
|
+
size: "icon",
|
|
6772
6922
|
onClick: (e) => {
|
|
6773
6923
|
e.stopPropagation();
|
|
6774
6924
|
onEditQuote(row.original.id);
|
|
6775
6925
|
},
|
|
6776
|
-
className: "
|
|
6926
|
+
className: "h-7 w-7 rounded-md text-muted-foreground",
|
|
6777
6927
|
title: "Edit quote",
|
|
6778
6928
|
children: /* @__PURE__ */ jsx(Pencil, { className: "h-3.5 w-3.5" })
|
|
6779
6929
|
}
|
|
6780
6930
|
),
|
|
6781
6931
|
onArchive && /* @__PURE__ */ jsxs(Dropdown, { children: [
|
|
6782
6932
|
/* @__PURE__ */ jsx(DropdownTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
6783
|
-
|
|
6933
|
+
Button,
|
|
6784
6934
|
{
|
|
6935
|
+
variant: "ghost",
|
|
6936
|
+
size: "icon",
|
|
6785
6937
|
onClick: (e) => e.stopPropagation(),
|
|
6786
6938
|
"aria-label": t2("crm.quotes.moreActions"),
|
|
6787
|
-
className: "
|
|
6939
|
+
className: "h-7 w-7 rounded-md text-muted-foreground",
|
|
6788
6940
|
children: /* @__PURE__ */ jsx(MoreHorizontal, { className: "h-3.5 w-3.5" })
|
|
6789
6941
|
}
|
|
6790
6942
|
) }),
|
|
@@ -6956,7 +7108,7 @@ function QuoteListView({ onNew, onEdit, onEditQuote }) {
|
|
|
6956
7108
|
/* @__PURE__ */ jsxs(Card, { className: "relative px-3 py-1.5", children: [
|
|
6957
7109
|
/* @__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
7110
|
/* @__PURE__ */ jsx(
|
|
6959
|
-
|
|
7111
|
+
Input,
|
|
6960
7112
|
{
|
|
6961
7113
|
type: "text",
|
|
6962
7114
|
value: search,
|
|
@@ -6966,7 +7118,7 @@ function QuoteListView({ onNew, onEdit, onEditQuote }) {
|
|
|
6966
7118
|
},
|
|
6967
7119
|
placeholder: t2("crm.quotes.searchPlaceholder"),
|
|
6968
7120
|
"aria-label": t2("crm.quotes.searchPlaceholder"),
|
|
6969
|
-
className: "
|
|
7121
|
+
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
7122
|
}
|
|
6971
7123
|
)
|
|
6972
7124
|
] }),
|
|
@@ -6980,14 +7132,7 @@ function QuoteListView({ onNew, onEdit, onEditQuote }) {
|
|
|
6980
7132
|
emptyMessage: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1 py-6", children: [
|
|
6981
7133
|
/* @__PURE__ */ jsx(FileText, { className: "mb-2 h-9 w-9 text-muted-foreground/40", strokeWidth: 1.5 }),
|
|
6982
7134
|
/* @__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
|
-
)
|
|
7135
|
+
onNew && /* @__PURE__ */ jsx(Button, { size: "lg", onClick: onNew, className: "mt-3 px-3 font-medium", children: t2("crm.quotes.createFirst") })
|
|
6991
7136
|
] })
|
|
6992
7137
|
}
|
|
6993
7138
|
),
|
|
@@ -7204,7 +7349,7 @@ function QuoteFormView({ quoteId, leadId, onSaved }) {
|
|
|
7204
7349
|
saveLabel: isEdit ? t2("crm.quoteForm.saveChanges") : t2("crm.quoteForm.saveQuote")
|
|
7205
7350
|
});
|
|
7206
7351
|
if (loadingExisting) return /* @__PURE__ */ jsx(OrderFormSkeleton, { parentLabel: t2("crm.quotes.title"), onBack: () => onSaved?.() });
|
|
7207
|
-
const
|
|
7352
|
+
const money = (v) => formatCurrency(v, currency);
|
|
7208
7353
|
const validUntilLabel = (/* @__PURE__ */ new Date(`${validUntil}T12:00:00`)).toLocaleDateString(getCurrentLocale());
|
|
7209
7354
|
const contactSection = /* @__PURE__ */ jsx(OrderFormBlock, { title: t2("crm.quoteForm.client"), children: /* @__PURE__ */ jsx(
|
|
7210
7355
|
SearchSelect,
|
|
@@ -7253,21 +7398,25 @@ function QuoteFormView({ quoteId, leadId, onSaved }) {
|
|
|
7253
7398
|
] }),
|
|
7254
7399
|
/* @__PURE__ */ jsxs("div", { className: "mt-1 flex flex-wrap gap-1.5", children: [
|
|
7255
7400
|
VALIDITY_PRESETS.map((preset) => /* @__PURE__ */ jsx(
|
|
7256
|
-
|
|
7401
|
+
Button,
|
|
7257
7402
|
{
|
|
7258
7403
|
type: "button",
|
|
7404
|
+
variant: "bare",
|
|
7405
|
+
size: "bare",
|
|
7259
7406
|
onClick: () => pickValidity(preset.days),
|
|
7260
|
-
className: `rounded-full border px-2.5 py-1 text-xs
|
|
7407
|
+
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
7408
|
children: t2(preset.labelKey)
|
|
7262
7409
|
},
|
|
7263
7410
|
preset.days
|
|
7264
7411
|
)),
|
|
7265
7412
|
/* @__PURE__ */ jsx(
|
|
7266
|
-
|
|
7413
|
+
Button,
|
|
7267
7414
|
{
|
|
7268
7415
|
type: "button",
|
|
7416
|
+
variant: "bare",
|
|
7417
|
+
size: "bare",
|
|
7269
7418
|
onClick: () => pickValidity(null),
|
|
7270
|
-
className: `rounded-full border px-2.5 py-1 text-xs
|
|
7419
|
+
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
7420
|
children: t2("crm.quoteForm.validCustom")
|
|
7272
7421
|
}
|
|
7273
7422
|
)
|
|
@@ -7275,23 +7424,23 @@ function QuoteFormView({ quoteId, leadId, onSaved }) {
|
|
|
7275
7424
|
] })
|
|
7276
7425
|
] }) }),
|
|
7277
7426
|
/* @__PURE__ */ jsx(OrderFormBlock, { title: t2("crm.quoteForm.paymentConditions"), children: /* @__PURE__ */ jsx(
|
|
7278
|
-
|
|
7427
|
+
Textarea,
|
|
7279
7428
|
{
|
|
7280
7429
|
value: paymentConditions,
|
|
7281
7430
|
onChange: (e) => setPaymentConditions(e.target.value),
|
|
7282
7431
|
rows: 2,
|
|
7283
7432
|
placeholder: t2("crm.quoteForm.paymentConditionsPlaceholder"),
|
|
7284
|
-
className: "
|
|
7433
|
+
className: "min-h-0 resize-none"
|
|
7285
7434
|
}
|
|
7286
7435
|
) }),
|
|
7287
7436
|
/* @__PURE__ */ jsx(OrderFormBlock, { title: t2("crm.quoteForm.notes"), children: /* @__PURE__ */ jsx(
|
|
7288
|
-
|
|
7437
|
+
Textarea,
|
|
7289
7438
|
{
|
|
7290
7439
|
value: observations,
|
|
7291
7440
|
onChange: (e) => setObservations(e.target.value),
|
|
7292
7441
|
rows: 2,
|
|
7293
7442
|
placeholder: t2("crm.quoteForm.notesPlaceholder"),
|
|
7294
|
-
className: "
|
|
7443
|
+
className: "min-h-0 resize-none"
|
|
7295
7444
|
}
|
|
7296
7445
|
) })
|
|
7297
7446
|
] });
|
|
@@ -7323,7 +7472,7 @@ function QuoteFormView({ quoteId, leadId, onSaved }) {
|
|
|
7323
7472
|
count: items.length,
|
|
7324
7473
|
countLabel: t2("crm.quoteForm.itemCount", { count: String(items.length) }),
|
|
7325
7474
|
totalLabel: t2("crm.quoteForm.total"),
|
|
7326
|
-
total:
|
|
7475
|
+
total: money(totalAmount),
|
|
7327
7476
|
emptyLabel: contactId ? t2("crm.quoteForm.noItems") : t2("crm.quoteForm.selectClientFirst"),
|
|
7328
7477
|
emptyActionLabel: t2("crm.quoteForm.addFirstItem"),
|
|
7329
7478
|
header: addingItem && /* @__PURE__ */ jsx(
|
|
@@ -7347,7 +7496,7 @@ function QuoteFormView({ quoteId, leadId, onSaved }) {
|
|
|
7347
7496
|
discount: item.discount,
|
|
7348
7497
|
itemTypes,
|
|
7349
7498
|
currency,
|
|
7350
|
-
formatMoney:
|
|
7499
|
+
formatMoney: money,
|
|
7351
7500
|
expanded: expandedItemId === item._id,
|
|
7352
7501
|
onToggle: () => setExpandedItemId(expandedItemId === item._id ? null : item._id),
|
|
7353
7502
|
onChange: (patch) => updateItem(item._id, patch),
|
|
@@ -7372,6 +7521,7 @@ function QuoteFormView({ quoteId, leadId, onSaved }) {
|
|
|
7372
7521
|
}
|
|
7373
7522
|
);
|
|
7374
7523
|
}
|
|
7524
|
+
var SEND_ITEM = "gap-2 px-3 py-2 text-xs";
|
|
7375
7525
|
function QuoteDetailView({ quoteId, onBack, onEdit, onInvoiceCreated }) {
|
|
7376
7526
|
const t2 = useTranslation();
|
|
7377
7527
|
const { currency } = useCrmConfig();
|
|
@@ -7381,13 +7531,11 @@ function QuoteDetailView({ quoteId, onBack, onEdit, onInvoiceCreated }) {
|
|
|
7381
7531
|
const rejectQuote = useCrmStore((s) => s.rejectQuote);
|
|
7382
7532
|
const [quote, setQuote] = useState(null);
|
|
7383
7533
|
const [loading, setLoading] = useState(true);
|
|
7384
|
-
const [sendMenuOpen, setSendMenuOpen] = useState(false);
|
|
7385
7534
|
const [sending, setSending] = useState(false);
|
|
7386
7535
|
const [approving, setApproving] = useState(false);
|
|
7387
7536
|
const [rejectOpen, setRejectOpen] = useState(false);
|
|
7388
7537
|
const [rejectReason, setRejectReason] = useState("");
|
|
7389
7538
|
const [rejecting, setRejecting] = useState(false);
|
|
7390
|
-
const sendMenuRef = useRef(null);
|
|
7391
7539
|
useEffect(() => {
|
|
7392
7540
|
setLoading(true);
|
|
7393
7541
|
provider.getQuoteById(quoteId).then((q) => {
|
|
@@ -7395,17 +7543,8 @@ function QuoteDetailView({ quoteId, onBack, onEdit, onInvoiceCreated }) {
|
|
|
7395
7543
|
setLoading(false);
|
|
7396
7544
|
});
|
|
7397
7545
|
}, [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
7546
|
async function handleSend(_channel) {
|
|
7407
7547
|
setSending(true);
|
|
7408
|
-
setSendMenuOpen(false);
|
|
7409
7548
|
try {
|
|
7410
7549
|
const updated = await sendQuote(quoteId);
|
|
7411
7550
|
setQuote(updated);
|
|
@@ -7442,7 +7581,7 @@ function QuoteDetailView({ quoteId, onBack, onEdit, onInvoiceCreated }) {
|
|
|
7442
7581
|
/* @__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
7582
|
/* @__PURE__ */ jsx(FileText, { className: "mb-2 h-8 w-8 text-muted-foreground/30" }),
|
|
7444
7583
|
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t2("crm.quoteDetail.notFound") }),
|
|
7445
|
-
/* @__PURE__ */ jsx("
|
|
7584
|
+
/* @__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
7585
|
] })
|
|
7447
7586
|
] });
|
|
7448
7587
|
}
|
|
@@ -7465,33 +7604,24 @@ function QuoteDetailView({ quoteId, onBack, onEdit, onInvoiceCreated }) {
|
|
|
7465
7604
|
];
|
|
7466
7605
|
const editable = quote.status !== "approved" && quote.status !== "rejected" && quote.status !== "expired";
|
|
7467
7606
|
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: [
|
|
7607
|
+
quote.status === "draft" && /* @__PURE__ */ jsxs(Dropdown, { children: [
|
|
7608
|
+
/* @__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: [
|
|
7609
|
+
/* @__PURE__ */ jsx(Send, { className: "h-3 w-3" }),
|
|
7610
|
+
sending ? t2("crm.quoteDetail.sending") : t2("crm.quoteDetail.send"),
|
|
7611
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3 opacity-60" })
|
|
7612
|
+
] }) }),
|
|
7613
|
+
/* @__PURE__ */ jsxs(DropdownContent, { align: "end", className: "w-48", children: [
|
|
7614
|
+
/* @__PURE__ */ jsxs(DropdownItem, { onSelect: () => void handleSend(), className: SEND_ITEM, children: [
|
|
7485
7615
|
/* @__PURE__ */ jsx(Printer, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
7486
7616
|
" ",
|
|
7487
7617
|
t2("crm.quoteDetail.sendPrint")
|
|
7488
7618
|
] }),
|
|
7489
|
-
/* @__PURE__ */ jsxs(
|
|
7619
|
+
/* @__PURE__ */ jsxs(DropdownItem, { onSelect: () => void handleSend(), className: SEND_ITEM, children: [
|
|
7490
7620
|
/* @__PURE__ */ jsx(Mail, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
7491
7621
|
" ",
|
|
7492
7622
|
t2("crm.quoteDetail.sendEmail")
|
|
7493
7623
|
] }),
|
|
7494
|
-
/* @__PURE__ */ jsxs(
|
|
7624
|
+
/* @__PURE__ */ jsxs(DropdownItem, { onSelect: () => void handleSend(), className: SEND_ITEM, children: [
|
|
7495
7625
|
/* @__PURE__ */ jsx(MessageCircle, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
7496
7626
|
" ",
|
|
7497
7627
|
t2("crm.quoteDetail.sendWhatsApp")
|
|
@@ -7587,25 +7717,27 @@ function QuoteDetailView({ quoteId, onBack, onEdit, onInvoiceCreated }) {
|
|
|
7587
7717
|
extraSections: sideBlocks
|
|
7588
7718
|
}
|
|
7589
7719
|
),
|
|
7590
|
-
|
|
7591
|
-
/* @__PURE__ */ jsxs(
|
|
7592
|
-
/* @__PURE__ */
|
|
7593
|
-
|
|
7594
|
-
/* @__PURE__ */
|
|
7595
|
-
|
|
7596
|
-
|
|
7720
|
+
/* @__PURE__ */ jsx(Modal, { open: rejectOpen, onOpenChange: setRejectOpen, children: /* @__PURE__ */ jsxs(ModalContent, { className: "max-w-sm", children: [
|
|
7721
|
+
/* @__PURE__ */ jsxs(ModalBody, { children: [
|
|
7722
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-3 flex items-center gap-3", children: [
|
|
7723
|
+
/* @__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" }) }),
|
|
7724
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
7725
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold", children: t2("crm.quoteDetail.reject") }),
|
|
7726
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t2("crm.quoteDetail.rejectDescription") })
|
|
7727
|
+
] })
|
|
7728
|
+
] }),
|
|
7729
|
+
/* @__PURE__ */ jsx(
|
|
7730
|
+
Textarea,
|
|
7731
|
+
{
|
|
7732
|
+
value: rejectReason,
|
|
7733
|
+
onChange: (e) => setRejectReason(e.target.value),
|
|
7734
|
+
placeholder: t2("crm.quoteDetail.rejectReasonPlaceholder"),
|
|
7735
|
+
className: "h-20 resize-none",
|
|
7736
|
+
autoFocus: true
|
|
7737
|
+
}
|
|
7738
|
+
)
|
|
7597
7739
|
] }),
|
|
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: [
|
|
7740
|
+
/* @__PURE__ */ jsxs(ModalFooter, { children: [
|
|
7609
7741
|
/* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => setRejectOpen(false), children: t2("common.cancel") }),
|
|
7610
7742
|
/* @__PURE__ */ jsx(
|
|
7611
7743
|
Button,
|
|
@@ -7708,10 +7840,12 @@ function PersonPhones({ personId, onOpenPerson }) {
|
|
|
7708
7840
|
t2("crm.phones.title")
|
|
7709
7841
|
] }),
|
|
7710
7842
|
!adding && /* @__PURE__ */ jsxs(
|
|
7711
|
-
|
|
7843
|
+
Button,
|
|
7712
7844
|
{
|
|
7845
|
+
variant: "outline",
|
|
7846
|
+
size: "sm",
|
|
7713
7847
|
onClick: () => setAdding(true),
|
|
7714
|
-
className: "
|
|
7848
|
+
className: "h-auto gap-0 py-1 text-[11px] font-medium",
|
|
7715
7849
|
children: [
|
|
7716
7850
|
/* @__PURE__ */ jsx(Plus, { className: "inline h-3 w-3 mr-0.5" }),
|
|
7717
7851
|
t2("crm.phones.add")
|
|
@@ -7734,10 +7868,12 @@ function PersonPhones({ personId, onOpenPerson }) {
|
|
|
7734
7868
|
t2("crm.phones.sharedWith", { count: String(shared[p.id].length) }),
|
|
7735
7869
|
" ",
|
|
7736
7870
|
shared[p.id].map((o, i) => /* @__PURE__ */ jsxs(
|
|
7737
|
-
|
|
7871
|
+
Button,
|
|
7738
7872
|
{
|
|
7873
|
+
variant: "bare",
|
|
7874
|
+
size: "bare",
|
|
7739
7875
|
onClick: () => onOpenPerson?.(o.personId),
|
|
7740
|
-
className: "underline hover:no-underline",
|
|
7876
|
+
className: "inline text-[11px] font-normal underline hover:no-underline",
|
|
7741
7877
|
children: [
|
|
7742
7878
|
i > 0 && ", ",
|
|
7743
7879
|
o.label || o.phone
|
|
@@ -7748,8 +7884,10 @@ function PersonPhones({ personId, onOpenPerson }) {
|
|
|
7748
7884
|
] })
|
|
7749
7885
|
] }),
|
|
7750
7886
|
/* @__PURE__ */ jsx(
|
|
7751
|
-
|
|
7887
|
+
Button,
|
|
7752
7888
|
{
|
|
7889
|
+
variant: "bare",
|
|
7890
|
+
size: "bare",
|
|
7753
7891
|
onClick: () => setRemoveTarget(p),
|
|
7754
7892
|
className: "text-muted-foreground hover:text-destructive",
|
|
7755
7893
|
"aria-label": t2("common.delete"),
|
|
@@ -7856,10 +7994,6 @@ function touchDate(at, locale) {
|
|
|
7856
7994
|
if (m) return new Date(+m[1], +m[2] - 1, +m[3]).toLocaleDateString(locale);
|
|
7857
7995
|
return formatDateTime(at, locale);
|
|
7858
7996
|
}
|
|
7859
|
-
function money(v, locale) {
|
|
7860
|
-
if (v == null) return null;
|
|
7861
|
-
return v.toLocaleString(locale, { style: "currency", currency: "BRL", maximumFractionDigits: 0 });
|
|
7862
|
-
}
|
|
7863
7997
|
function LeadQualification({ lead }) {
|
|
7864
7998
|
const provider = useCrmProvider();
|
|
7865
7999
|
const { currency } = useCrmConfig();
|
|
@@ -7999,7 +8133,7 @@ function LeadQualification({ lead }) {
|
|
|
7999
8133
|
receita.capitalSocial != null && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
|
|
8000
8134
|
t2("crm.qualification.capital"),
|
|
8001
8135
|
": ",
|
|
8002
|
-
/* @__PURE__ */ jsx("span", { className: "text-foreground", children:
|
|
8136
|
+
/* @__PURE__ */ jsx("span", { className: "text-foreground", children: formatCurrency(receita.capitalSocial, currency) })
|
|
8003
8137
|
] }),
|
|
8004
8138
|
receita.socios != null && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
|
|
8005
8139
|
t2("crm.qualification.socios"),
|
|
@@ -8130,7 +8264,7 @@ function LogActivityButton({ target, onLogged }) {
|
|
|
8130
8264
|
] }),
|
|
8131
8265
|
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
8132
8266
|
/* @__PURE__ */ jsx(
|
|
8133
|
-
|
|
8267
|
+
Textarea,
|
|
8134
8268
|
{
|
|
8135
8269
|
autoFocus: true,
|
|
8136
8270
|
rows: 3,
|
|
@@ -8146,7 +8280,7 @@ function LogActivityButton({ target, onLogged }) {
|
|
|
8146
8280
|
}
|
|
8147
8281
|
},
|
|
8148
8282
|
placeholder: t2("crm.followUp.placeholder"),
|
|
8149
|
-
className: "
|
|
8283
|
+
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
8284
|
}
|
|
8151
8285
|
),
|
|
8152
8286
|
/* @__PURE__ */ jsx(
|
|
@@ -8274,7 +8408,7 @@ function LeadDetailView({ leadId, onBack, onCreateQuote, onViewQuote, onOpenComp
|
|
|
8274
8408
|
/* @__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
8409
|
/* @__PURE__ */ jsx(UserPlus, { className: "h-8 w-8 text-muted-foreground/30 mb-2" }),
|
|
8276
8410
|
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t2("crm.leadDetail.leadNotFound") }),
|
|
8277
|
-
/* @__PURE__ */ jsx("
|
|
8411
|
+
/* @__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
8412
|
] })
|
|
8279
8413
|
] });
|
|
8280
8414
|
}
|
|
@@ -8293,10 +8427,11 @@ function LeadDetailView({ leadId, onBack, onCreateQuote, onViewQuote, onOpenComp
|
|
|
8293
8427
|
] }),
|
|
8294
8428
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 shrink-0", children: [
|
|
8295
8429
|
deal && onOpenDeal && /* @__PURE__ */ jsxs(
|
|
8296
|
-
|
|
8430
|
+
Button,
|
|
8297
8431
|
{
|
|
8432
|
+
variant: "outline",
|
|
8298
8433
|
onClick: () => onOpenDeal(deal.id),
|
|
8299
|
-
className: "
|
|
8434
|
+
className: "h-auto px-3 py-1.5 text-xs font-medium",
|
|
8300
8435
|
children: [
|
|
8301
8436
|
/* @__PURE__ */ jsx(Filter, { className: "h-3 w-3" }),
|
|
8302
8437
|
" ",
|
|
@@ -8307,11 +8442,13 @@ function LeadDetailView({ leadId, onBack, onCreateQuote, onViewQuote, onOpenComp
|
|
|
8307
8442
|
/* @__PURE__ */ jsx(TalkToPerson, { personId: leadId, name: lead.name, phone: lead.phone }),
|
|
8308
8443
|
canArchive && /* @__PURE__ */ jsxs(Dropdown, { children: [
|
|
8309
8444
|
/* @__PURE__ */ jsx(DropdownTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
8310
|
-
|
|
8445
|
+
Button,
|
|
8311
8446
|
{
|
|
8447
|
+
variant: "outline",
|
|
8448
|
+
size: "icon",
|
|
8312
8449
|
"aria-label": t2("crm.leadDetail.moreActions"),
|
|
8313
8450
|
disabled: archiving,
|
|
8314
|
-
className: "
|
|
8451
|
+
className: "rounded-lg text-muted-foreground hover:text-foreground disabled:opacity-60",
|
|
8315
8452
|
children: /* @__PURE__ */ jsx(MoreHorizontal, { className: "h-4 w-4" })
|
|
8316
8453
|
}
|
|
8317
8454
|
) }),
|
|
@@ -8322,10 +8459,10 @@ function LeadDetailView({ leadId, onBack, onCreateQuote, onViewQuote, onOpenComp
|
|
|
8322
8459
|
] }) })
|
|
8323
8460
|
] }),
|
|
8324
8461
|
onCreateQuote && lead.status !== "converted" && lead.status !== "lost" && /* @__PURE__ */ jsxs(
|
|
8325
|
-
|
|
8462
|
+
Button,
|
|
8326
8463
|
{
|
|
8327
8464
|
onClick: () => onCreateQuote(leadId),
|
|
8328
|
-
className: "
|
|
8465
|
+
className: "h-auto px-3 py-1.5 text-xs font-medium",
|
|
8329
8466
|
children: [
|
|
8330
8467
|
/* @__PURE__ */ jsx(FileText, { className: "h-3 w-3" }),
|
|
8331
8468
|
" ",
|
|
@@ -8355,10 +8492,12 @@ function LeadDetailView({ leadId, onBack, onCreateQuote, onViewQuote, onOpenComp
|
|
|
8355
8492
|
{
|
|
8356
8493
|
label: t2("crm.leadDetail.company"),
|
|
8357
8494
|
value: lead.companyName ? /* @__PURE__ */ jsxs(
|
|
8358
|
-
|
|
8495
|
+
Button,
|
|
8359
8496
|
{
|
|
8497
|
+
variant: "bare",
|
|
8498
|
+
size: "bare",
|
|
8360
8499
|
onClick: () => lead.companyId && onOpenCompany?.(lead.companyId),
|
|
8361
|
-
className: "text-left text-primary hover:underline",
|
|
8500
|
+
className: "inline whitespace-normal text-left font-normal text-primary hover:underline",
|
|
8362
8501
|
children: [
|
|
8363
8502
|
lead.companyName,
|
|
8364
8503
|
lead.companyRole && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
|
|
@@ -8452,10 +8591,11 @@ function LeadDetailView({ leadId, onBack, onCreateQuote, onViewQuote, onOpenComp
|
|
|
8452
8591
|
/* @__PURE__ */ jsxs("div", { className: "mb-1 flex items-center justify-between gap-2", children: [
|
|
8453
8592
|
/* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold text-foreground", children: t2("crm.leadDetail.pipeline") }),
|
|
8454
8593
|
onOpenDeal && /* @__PURE__ */ jsxs(
|
|
8455
|
-
|
|
8594
|
+
Button,
|
|
8456
8595
|
{
|
|
8596
|
+
variant: "outline",
|
|
8457
8597
|
onClick: () => onOpenDeal(deal.id),
|
|
8458
|
-
className: "
|
|
8598
|
+
className: "h-auto gap-1 px-2 py-1 text-[11px] font-medium shadow-none active:shadow-none",
|
|
8459
8599
|
children: [
|
|
8460
8600
|
t2("crm.leadDetail.openDeal"),
|
|
8461
8601
|
" ",
|
|
@@ -8825,204 +8965,155 @@ function CompanyListView({ onNew, onEdit }) {
|
|
|
8825
8965
|
)
|
|
8826
8966
|
] });
|
|
8827
8967
|
}
|
|
8828
|
-
|
|
8829
|
-
function CompanyFormView({ companyId, onSaved }) {
|
|
8830
|
-
const t2 = useTranslation();
|
|
8968
|
+
function DocumentInput({ value, onChange, companyId, t: t2 }) {
|
|
8831
8969
|
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);
|
|
8970
|
+
const text = String(value ?? "");
|
|
8844
8971
|
const [duplicate, setDuplicate] = useState(null);
|
|
8845
8972
|
useEffect(() => {
|
|
8846
|
-
|
|
8973
|
+
const digits2 = normalizeDocument(text);
|
|
8974
|
+
if (digits2.length !== 11 && digits2.length !== 14) {
|
|
8975
|
+
setDuplicate(null);
|
|
8976
|
+
return;
|
|
8977
|
+
}
|
|
8847
8978
|
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 ?? "");
|
|
8979
|
+
void provider.findCompanyByDocument(digits2).then((found) => {
|
|
8980
|
+
if (!cancelled) setDuplicate(found && found.id !== companyId ? found.name : null);
|
|
8860
8981
|
});
|
|
8861
8982
|
return () => {
|
|
8862
8983
|
cancelled = true;
|
|
8863
8984
|
};
|
|
8864
|
-
}, [companyId]);
|
|
8985
|
+
}, [text, companyId]);
|
|
8986
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
8987
|
+
/* @__PURE__ */ jsx(Input, { value: text, onChange: (e) => onChange(e.target.value), placeholder: t2("crm.companyForm.documentPlaceholder") }),
|
|
8988
|
+
isValidDocument(text) === false && /* @__PURE__ */ jsx("p", { className: "mt-1 text-[11px] text-warning-foreground", children: t2("crm.companyForm.documentInvalidHint") }),
|
|
8989
|
+
duplicate && /* @__PURE__ */ jsxs("p", { className: "mt-1 text-[11px] text-destructive", children: [
|
|
8990
|
+
t2("crm.companyForm.documentTakenHint"),
|
|
8991
|
+
" ",
|
|
8992
|
+
/* @__PURE__ */ jsx("strong", { children: duplicate })
|
|
8993
|
+
] })
|
|
8994
|
+
] });
|
|
8995
|
+
}
|
|
8996
|
+
function buildCompanyEntity(t2, companyId) {
|
|
8997
|
+
return {
|
|
8998
|
+
name: t2("crm.companies.one"),
|
|
8999
|
+
namePlural: t2("crm.companies.title"),
|
|
9000
|
+
icon: "Building2",
|
|
9001
|
+
displayField: "name",
|
|
9002
|
+
subtitleField: "legalName",
|
|
9003
|
+
formColumns: 2,
|
|
9004
|
+
fieldGroups: [
|
|
9005
|
+
{ id: "identity", label: t2("crm.companyDetail.identity"), columns: 2 },
|
|
9006
|
+
{ id: "contact", label: t2("crm.companyDetail.contact"), columns: 2 }
|
|
9007
|
+
],
|
|
9008
|
+
fields: [
|
|
9009
|
+
{ key: "name", label: t2("crm.companyForm.name"), type: "text", required: true, placeholder: t2("crm.companyForm.namePlaceholder"), group: "identity" },
|
|
9010
|
+
{ key: "legalName", label: t2("crm.companyForm.legalName"), type: "text", placeholder: t2("crm.companyForm.legalNamePlaceholder"), group: "identity" },
|
|
9011
|
+
{
|
|
9012
|
+
key: "documentNumber",
|
|
9013
|
+
label: t2("crm.companyForm.document"),
|
|
9014
|
+
type: "custom",
|
|
9015
|
+
group: "identity",
|
|
9016
|
+
renderInput: ({ value, onChange }) => /* @__PURE__ */ jsx(DocumentInput, { value, onChange, companyId, t: t2 }),
|
|
9017
|
+
renderCell: (value, row) => value ? /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
9018
|
+
/* @__PURE__ */ jsx("span", { className: "tabular-nums", children: formatDocument2(String(value)) }),
|
|
9019
|
+
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") })
|
|
9020
|
+
] }) : null
|
|
9021
|
+
},
|
|
9022
|
+
{ key: "email", label: t2("crm.companyForm.email"), type: "email", group: "contact" },
|
|
9023
|
+
{ key: "phone", label: t2("crm.companyForm.phone"), type: "phone", group: "contact" },
|
|
9024
|
+
{ key: "website", label: t2("crm.companyForm.website"), type: "url", group: "contact" },
|
|
9025
|
+
{
|
|
9026
|
+
key: "instagram",
|
|
9027
|
+
label: t2("crm.companyForm.instagram"),
|
|
9028
|
+
type: "text",
|
|
9029
|
+
placeholder: "@casa",
|
|
9030
|
+
group: "contact",
|
|
9031
|
+
// A link, not text: sellers open the profile before calling to see if the place is alive.
|
|
9032
|
+
renderCell: (value) => {
|
|
9033
|
+
if (!value) return null;
|
|
9034
|
+
const url = instagramUrl(String(value));
|
|
9035
|
+
return url ? /* @__PURE__ */ jsxs("a", { href: url, target: "_blank", rel: "noreferrer", className: "text-primary hover:underline", children: [
|
|
9036
|
+
"@",
|
|
9037
|
+
normalizeInstagram(String(value))
|
|
9038
|
+
] }) : /* @__PURE__ */ jsx("span", { children: String(value) });
|
|
9039
|
+
}
|
|
9040
|
+
},
|
|
9041
|
+
{ key: "city", label: t2("crm.companyForm.city"), type: "text", group: "contact" },
|
|
9042
|
+
{ key: "state", label: t2("crm.companyForm.state"), type: "text", group: "contact" },
|
|
9043
|
+
{ key: "notes", label: t2("crm.companyForm.notes"), type: "textarea", group: "contact", span: 2 }
|
|
9044
|
+
]
|
|
9045
|
+
};
|
|
9046
|
+
}
|
|
9047
|
+
function toCompanyInput(values, id) {
|
|
9048
|
+
const s = (k) => typeof values[k] === "string" ? values[k].trim() : values[k] ?? "";
|
|
9049
|
+
return {
|
|
9050
|
+
id,
|
|
9051
|
+
name: s("name") || s("legalName"),
|
|
9052
|
+
legalName: s("legalName"),
|
|
9053
|
+
documentNumber: s("documentNumber"),
|
|
9054
|
+
email: s("email"),
|
|
9055
|
+
phone: s("phone"),
|
|
9056
|
+
website: s("website"),
|
|
9057
|
+
instagram: normalizeInstagram(s("instagram")) ?? "",
|
|
9058
|
+
city: s("city"),
|
|
9059
|
+
state: s("state"),
|
|
9060
|
+
notes: s("notes")
|
|
9061
|
+
};
|
|
9062
|
+
}
|
|
9063
|
+
function CompanyFormView({ companyId, onSaved, onCancel }) {
|
|
9064
|
+
const t2 = useTranslation();
|
|
9065
|
+
const provider = useCrmProvider();
|
|
9066
|
+
const saveCompany = useCrmStore((s) => s.saveCompany);
|
|
9067
|
+
const entity = useMemo(() => buildCompanyEntity(t2, companyId), [t2, companyId]);
|
|
9068
|
+
const [initialData, setInitialData] = useState(companyId ? null : {});
|
|
8865
9069
|
useEffect(() => {
|
|
8866
|
-
|
|
8867
|
-
if (digits2.length !== 11 && digits2.length !== 14) {
|
|
8868
|
-
setDuplicate(null);
|
|
8869
|
-
return;
|
|
8870
|
-
}
|
|
9070
|
+
if (!companyId) return;
|
|
8871
9071
|
let cancelled = false;
|
|
8872
|
-
void provider.
|
|
9072
|
+
void provider.getCompanyById(companyId).then((c) => {
|
|
8873
9073
|
if (cancelled) return;
|
|
8874
|
-
|
|
9074
|
+
setInitialData(c ? { ...c, documentNumber: c.documentNumber ? formatDocument2(c.documentNumber) : "" } : {});
|
|
8875
9075
|
});
|
|
8876
9076
|
return () => {
|
|
8877
9077
|
cancelled = true;
|
|
8878
9078
|
};
|
|
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);
|
|
9079
|
+
}, [companyId]);
|
|
9080
|
+
async function submit(values) {
|
|
9081
|
+
const input = toCompanyInput(values, companyId);
|
|
9082
|
+
if (!input.name) {
|
|
9083
|
+
toast.error(t2("common.formIncomplete"));
|
|
9084
|
+
throw new Error("name required");
|
|
8902
9085
|
}
|
|
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
|
-
]
|
|
9086
|
+
const digits2 = normalizeDocument(input.documentNumber);
|
|
9087
|
+
if (digits2.length === 11 || digits2.length === 14) {
|
|
9088
|
+
const found = await provider.findCompanyByDocument(digits2);
|
|
9089
|
+
if (found && found.id !== companyId) {
|
|
9090
|
+
toast.error(`${t2("crm.companyForm.documentTakenHint")} ${found.name}`);
|
|
9091
|
+
throw new Error("document taken");
|
|
9092
|
+
}
|
|
9023
9093
|
}
|
|
9024
|
-
|
|
9094
|
+
const saved = await saveCompany(input);
|
|
9095
|
+
return { id: saved.id };
|
|
9096
|
+
}
|
|
9097
|
+
const cancel = onCancel ?? (() => onSaved?.());
|
|
9098
|
+
const title = companyId ? t2("crm.companyForm.editTitle") : t2("crm.companyForm.title");
|
|
9099
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-5", children: [
|
|
9100
|
+
(!companyId || !initialData) && /* @__PURE__ */ jsx(SubpageHeader, { title, onBack: cancel, parentLabel: t2("crm.companies.title") }),
|
|
9101
|
+
!initialData ? /* @__PURE__ */ jsx(CrudFormSkeleton, {}) : /* @__PURE__ */ jsx(
|
|
9102
|
+
CrudFormPage,
|
|
9103
|
+
{
|
|
9104
|
+
entityDef: entity,
|
|
9105
|
+
mode: companyId ? "edit" : "create",
|
|
9106
|
+
initialData,
|
|
9107
|
+
onSubmit: submit,
|
|
9108
|
+
onSaved: (created) => onSaved?.(created?.id ?? companyId),
|
|
9109
|
+
onCancel: cancel,
|
|
9110
|
+
namePlural: t2("crm.companies.title"),
|
|
9111
|
+
hideBreadcrumb: !companyId
|
|
9112
|
+
}
|
|
9113
|
+
)
|
|
9114
|
+
] });
|
|
9025
9115
|
}
|
|
9116
|
+
var INLINE_LINK = "text-xs font-normal text-primary hover:underline";
|
|
9026
9117
|
function CompanyGroupBadge({ companyId, onOpenCompany }) {
|
|
9027
9118
|
const provider = useCrmProvider();
|
|
9028
9119
|
const { currency } = useCrmConfig();
|
|
@@ -9053,10 +9144,12 @@ function CompanyGroupBadge({ companyId, onOpenCompany }) {
|
|
|
9053
9144
|
group.wonValue > 0 && /* @__PURE__ */ jsx("span", { className: "ml-auto text-sm font-semibold tabular-nums", children: formatCurrency(group.wonValue, currency) })
|
|
9054
9145
|
] }),
|
|
9055
9146
|
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
|
-
|
|
9147
|
+
Button,
|
|
9057
9148
|
{
|
|
9149
|
+
variant: "bare",
|
|
9150
|
+
size: "bare",
|
|
9058
9151
|
onClick: () => onOpenCompany?.(m.companyId),
|
|
9059
|
-
className:
|
|
9152
|
+
className: INLINE_LINK,
|
|
9060
9153
|
children: m.companyName
|
|
9061
9154
|
},
|
|
9062
9155
|
m.id
|
|
@@ -9115,10 +9208,11 @@ function LinkContactDialog({
|
|
|
9115
9208
|
/* @__PURE__ */ jsxs("div", { className: "max-h-56 overflow-y-auto rounded-card border divide-y", children: [
|
|
9116
9209
|
results.length === 0 && /* @__PURE__ */ jsx("p", { className: "px-4 py-3 text-sm text-muted-foreground", children: t2("crm.companyDetail.linkNoResults") }),
|
|
9117
9210
|
results.map((lead) => /* @__PURE__ */ jsxs(
|
|
9118
|
-
|
|
9211
|
+
Button,
|
|
9119
9212
|
{
|
|
9213
|
+
variant: "ghost",
|
|
9120
9214
|
onClick: () => setSelected(lead),
|
|
9121
|
-
className: `flex w-full flex-col items-start px-4 py-2 text-left
|
|
9215
|
+
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
9216
|
children: [
|
|
9123
9217
|
/* @__PURE__ */ jsx("span", { className: "text-sm", children: lead.name }),
|
|
9124
9218
|
/* @__PURE__ */ jsxs("span", { className: "text-[11px] text-muted-foreground", children: [
|
|
@@ -9176,28 +9270,120 @@ function FieldRow2({ label: label2, value }) {
|
|
|
9176
9270
|
/* @__PURE__ */ jsx("dd", { className: "col-span-2 text-sm text-foreground", children: value ?? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground/50", children: "\u2014" }) })
|
|
9177
9271
|
] });
|
|
9178
9272
|
}
|
|
9273
|
+
function ReceitaTab({ receita }) {
|
|
9274
|
+
const t2 = useTranslation();
|
|
9275
|
+
const { currency } = useCrmConfig();
|
|
9276
|
+
if (!receita) return /* @__PURE__ */ jsx("p", { className: "px-1 py-4 text-sm text-muted-foreground", children: t2("crm.companyDetail.receitaNone") });
|
|
9277
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
9278
|
+
receita.consultadoEm && /* @__PURE__ */ jsxs("p", { className: "mb-2 flex items-center gap-1.5 text-xs text-muted-foreground", children: [
|
|
9279
|
+
/* @__PURE__ */ jsx(Fingerprint, { className: "h-3.5 w-3.5" }),
|
|
9280
|
+
t2("crm.companyDetail.receitaCheckedOn"),
|
|
9281
|
+
" ",
|
|
9282
|
+
receita.consultadoEm
|
|
9283
|
+
] }),
|
|
9284
|
+
/* @__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: [
|
|
9285
|
+
/* @__PURE__ */ jsx("div", { className: "px-5 md:border-b", children: /* @__PURE__ */ jsx(FieldRow2, { label: t2("crm.companyDetail.receitaSituacao"), value: receita.situacao ? (
|
|
9286
|
+
// "BAIXADA" é a empresa não existir mais; em cinza passa despercebido.
|
|
9287
|
+
/* @__PURE__ */ jsx("span", { className: receita.situacao === "ATIVA" ? void 0 : "font-medium text-destructive", children: receita.situacao })
|
|
9288
|
+
) : null }) }),
|
|
9289
|
+
/* @__PURE__ */ jsx("div", { className: "px-5 md:border-b", children: /* @__PURE__ */ jsx(FieldRow2, { label: t2("crm.companyDetail.receitaLegalName"), value: receita.razaoSocial ?? null }) }),
|
|
9290
|
+
/* @__PURE__ */ jsx("div", { className: "px-5 md:border-b", children: /* @__PURE__ */ jsx(FieldRow2, { label: t2("crm.companyDetail.receitaPorte"), value: receita.porte ?? null }) }),
|
|
9291
|
+
/* @__PURE__ */ jsx("div", { className: "px-5 md:border-b", children: /* @__PURE__ */ jsx(
|
|
9292
|
+
FieldRow2,
|
|
9293
|
+
{
|
|
9294
|
+
label: t2("crm.companyDetail.receitaCapital"),
|
|
9295
|
+
value: receita.capitalSocial != null ? formatCurrency(receita.capitalSocial, currency) : null
|
|
9296
|
+
}
|
|
9297
|
+
) }),
|
|
9298
|
+
/* @__PURE__ */ jsx("div", { className: "px-5 md:border-b", children: /* @__PURE__ */ jsx(FieldRow2, { label: t2("crm.companyDetail.receitaOpened"), value: receita.abertura ?? null }) }),
|
|
9299
|
+
/* @__PURE__ */ jsx("div", { className: "px-5 md:border-b", children: /* @__PURE__ */ jsx(
|
|
9300
|
+
FieldRow2,
|
|
9301
|
+
{
|
|
9302
|
+
label: t2("crm.companyDetail.receitaPartners"),
|
|
9303
|
+
value: receita.socios != null ? String(receita.socios) : null
|
|
9304
|
+
}
|
|
9305
|
+
) }),
|
|
9306
|
+
/* @__PURE__ */ jsx("div", { className: "px-5 md:col-span-2 md:border-t", children: /* @__PURE__ */ jsx(
|
|
9307
|
+
FieldRow2,
|
|
9308
|
+
{
|
|
9309
|
+
label: t2("crm.companyDetail.receitaCnae"),
|
|
9310
|
+
value: receita.cnaeDescricao ? /* @__PURE__ */ jsxs("span", { children: [
|
|
9311
|
+
receita.cnaeDescricao,
|
|
9312
|
+
receita.cnae && /* @__PURE__ */ jsx("span", { className: "ml-1.5 tabular-nums text-muted-foreground", children: receita.cnae })
|
|
9313
|
+
] }) : receita.cnae ?? null
|
|
9314
|
+
}
|
|
9315
|
+
) })
|
|
9316
|
+
] }) })
|
|
9317
|
+
] });
|
|
9318
|
+
}
|
|
9319
|
+
function PeopleTab({ people, groupSiblings, onLink, onUnlink, onOpenLead }) {
|
|
9320
|
+
const t2 = useTranslation();
|
|
9321
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
9322
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3", children: [
|
|
9323
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: (groupSiblings ?? 0) > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9324
|
+
/* @__PURE__ */ jsx(Link2, { className: "mr-1 inline h-3 w-3" }),
|
|
9325
|
+
t2("crm.companyDetail.groupHint", { count: String(groupSiblings) })
|
|
9326
|
+
] }) }),
|
|
9327
|
+
/* @__PURE__ */ jsx(Button, { size: "sm", variant: "outline", onClick: onLink, children: t2("crm.companyDetail.link") })
|
|
9328
|
+
] }),
|
|
9329
|
+
/* @__PURE__ */ jsxs("div", { className: "divide-y rounded-card border bg-card shadow-sm", children: [
|
|
9330
|
+
people.length === 0 && /* @__PURE__ */ jsx("p", { className: "px-5 py-4 text-sm text-muted-foreground", children: t2("crm.companyDetail.noPeople") }),
|
|
9331
|
+
people.map((cp) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 px-5 py-3", children: [
|
|
9332
|
+
/* @__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: [
|
|
9333
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-primary hover:underline", children: cp.personName }),
|
|
9334
|
+
/* @__PURE__ */ jsxs("span", { className: "text-[11px] text-muted-foreground", children: [
|
|
9335
|
+
cp.role || t2("crm.companyDetail.noRole"),
|
|
9336
|
+
cp.isPrimary && ` \xB7 ${t2("crm.companyDetail.primary")}`
|
|
9337
|
+
] })
|
|
9338
|
+
] }),
|
|
9339
|
+
/* @__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") })
|
|
9340
|
+
] }, cp.id))
|
|
9341
|
+
] })
|
|
9342
|
+
] });
|
|
9343
|
+
}
|
|
9344
|
+
function DealsTab({ deals, onOpenDeal }) {
|
|
9345
|
+
const t2 = useTranslation();
|
|
9346
|
+
const { currency } = useCrmConfig();
|
|
9347
|
+
return /* @__PURE__ */ jsxs("div", { className: "divide-y rounded-card border bg-card shadow-sm", children: [
|
|
9348
|
+
deals.length === 0 && /* @__PURE__ */ jsx("p", { className: "px-5 py-4 text-sm text-muted-foreground", children: t2("crm.companyDetail.noDeals") }),
|
|
9349
|
+
deals.map((d) => {
|
|
9350
|
+
const conteudo = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9351
|
+
/* @__PURE__ */ jsxs("span", { className: "flex flex-col text-left", children: [
|
|
9352
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm", children: d.title }),
|
|
9353
|
+
/* @__PURE__ */ jsxs("span", { className: "text-[11px] text-muted-foreground", children: [
|
|
9354
|
+
d.stageName,
|
|
9355
|
+
" \xB7 ",
|
|
9356
|
+
formatRelativeTime(d.createdAt)
|
|
9357
|
+
] })
|
|
9358
|
+
] }),
|
|
9359
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm tabular-nums", children: formatCurrency(d.value, currency) })
|
|
9360
|
+
] });
|
|
9361
|
+
const classe = "flex w-full items-center justify-between gap-3 px-5 py-3";
|
|
9362
|
+
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);
|
|
9363
|
+
})
|
|
9364
|
+
] });
|
|
9365
|
+
}
|
|
9179
9366
|
function CompanyDetailView({
|
|
9180
9367
|
companyId,
|
|
9181
9368
|
onBack,
|
|
9182
9369
|
onEdit,
|
|
9183
9370
|
onOpenLead,
|
|
9184
9371
|
onOpenCompany,
|
|
9185
|
-
onOpenDeal
|
|
9372
|
+
onOpenDeal,
|
|
9373
|
+
initialTab
|
|
9186
9374
|
}) {
|
|
9187
9375
|
const t2 = useTranslation();
|
|
9188
|
-
const { currency } = useCrmConfig();
|
|
9189
9376
|
const provider = useCrmProvider();
|
|
9190
9377
|
const canArchive = useCanArchive();
|
|
9191
9378
|
const archiveCompany = useCrmStore((s) => s.archiveCompany);
|
|
9192
9379
|
const unlinkCompanyPerson = useCrmStore((s) => s.unlinkCompanyPerson);
|
|
9380
|
+
const saveCompany = useCrmStore((s) => s.saveCompany);
|
|
9193
9381
|
const [company, setCompany] = useState(null);
|
|
9194
9382
|
useRecordVisit(company ? {
|
|
9195
9383
|
id: company.id,
|
|
9196
9384
|
kind: "company",
|
|
9197
9385
|
kindLabel: t2("crm.companies.title"),
|
|
9198
9386
|
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
9387
|
subtitle: company.legalName && company.legalName !== company.name ? company.legalName : void 0,
|
|
9202
9388
|
archetype: "company"
|
|
9203
9389
|
} : null);
|
|
@@ -9214,13 +9400,11 @@ function CompanyDetailView({
|
|
|
9214
9400
|
return abertos.reduce((a, b) => (b.updatedAt ?? b.createdAt ?? "") > (a.updatedAt ?? a.createdAt ?? "") ? b : a);
|
|
9215
9401
|
}, [deals]);
|
|
9216
9402
|
const load = useCallback(async () => {
|
|
9217
|
-
setLoading(true);
|
|
9218
9403
|
try {
|
|
9219
9404
|
const [c, p, d] = await Promise.all([
|
|
9220
9405
|
provider.getCompanyById(companyId),
|
|
9221
9406
|
provider.getCompanyPeople(companyId),
|
|
9222
|
-
//
|
|
9223
|
-
// que faz uma ficha de empresa valer alguma coisa.
|
|
9407
|
+
// Filtered by the database, all statuses: the history is half of what a company record is for.
|
|
9224
9408
|
provider.getDeals({ companyId, pageSize: 200 })
|
|
9225
9409
|
]);
|
|
9226
9410
|
setCompany(c);
|
|
@@ -9231,6 +9415,7 @@ function CompanyDetailView({
|
|
|
9231
9415
|
}
|
|
9232
9416
|
}, [companyId]);
|
|
9233
9417
|
useEffect(() => {
|
|
9418
|
+
setLoading(true);
|
|
9234
9419
|
void load();
|
|
9235
9420
|
}, [load]);
|
|
9236
9421
|
useEffect(() => {
|
|
@@ -9244,243 +9429,77 @@ function CompanyDetailView({
|
|
|
9244
9429
|
vivo = false;
|
|
9245
9430
|
};
|
|
9246
9431
|
}, [provider, companyId]);
|
|
9247
|
-
|
|
9432
|
+
const entity = useMemo(() => {
|
|
9433
|
+
const base = buildCompanyEntity(t2, companyId);
|
|
9434
|
+
const tab = (id, label2, icon, component, props) => ({ id, label: label2, icon, component, props });
|
|
9435
|
+
const tabs = [
|
|
9436
|
+
tab("people", t2("crm.companyDetail.people"), "Users", PeopleTab, {
|
|
9437
|
+
people,
|
|
9438
|
+
groupSiblings: company?.groupSiblings,
|
|
9439
|
+
onLink: () => setLinking(true),
|
|
9440
|
+
onUnlink: setUnlinkTarget,
|
|
9441
|
+
onOpenLead
|
|
9442
|
+
}),
|
|
9443
|
+
tab("deals", t2("crm.companyDetail.deals"), "Handshake", DealsTab, { deals, onOpenDeal }),
|
|
9444
|
+
tab("receita", t2("crm.companyDetail.receita"), "Fingerprint", ReceitaTab, { receita })
|
|
9445
|
+
];
|
|
9446
|
+
return { ...base, detailTabs: tabs };
|
|
9447
|
+
}, [t2, companyId, people, deals, receita, company?.groupSiblings, onOpenLead, onOpenDeal]);
|
|
9448
|
+
const extraActions = [
|
|
9449
|
+
...negocioDoFunil && onOpenDeal ? [{
|
|
9450
|
+
id: "open-in-pipeline",
|
|
9451
|
+
label: t2("crm.companyDetail.openInPipeline"),
|
|
9452
|
+
icon: Filter,
|
|
9453
|
+
intent: "primary",
|
|
9454
|
+
onSelect: () => onOpenDeal(negocioDoFunil.id)
|
|
9455
|
+
}] : [],
|
|
9456
|
+
...canArchive ? [{
|
|
9457
|
+
id: "archive",
|
|
9458
|
+
label: t2("crm.companies.archive"),
|
|
9459
|
+
icon: Archive,
|
|
9460
|
+
intent: "danger",
|
|
9461
|
+
onSelect: () => setArchiving(true)
|
|
9462
|
+
}] : []
|
|
9463
|
+
];
|
|
9464
|
+
async function saveFields(values) {
|
|
9465
|
+
if (!company) return;
|
|
9466
|
+
const s = (k) => typeof values[k] === "string" ? values[k].trim() : void 0;
|
|
9467
|
+
const instagram = s("instagram");
|
|
9468
|
+
await saveCompany({
|
|
9469
|
+
id: company.id,
|
|
9470
|
+
name: s("name") || company.name,
|
|
9471
|
+
legalName: s("legalName"),
|
|
9472
|
+
email: s("email"),
|
|
9473
|
+
phone: s("phone"),
|
|
9474
|
+
website: s("website"),
|
|
9475
|
+
instagram: instagram === void 0 ? void 0 : normalizeInstagram(instagram) ?? "",
|
|
9476
|
+
city: s("city"),
|
|
9477
|
+
state: s("state"),
|
|
9478
|
+
notes: s("notes")
|
|
9479
|
+
});
|
|
9480
|
+
await load();
|
|
9481
|
+
}
|
|
9482
|
+
if (loading) return /* @__PURE__ */ jsx(CrudDetailSkeleton, {});
|
|
9248
9483
|
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
|
-
] }),
|
|
9484
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9473
9485
|
/* @__PURE__ */ jsx(
|
|
9474
|
-
|
|
9486
|
+
CrudDetailPage,
|
|
9475
9487
|
{
|
|
9476
|
-
|
|
9477
|
-
|
|
9478
|
-
|
|
9479
|
-
|
|
9480
|
-
|
|
9481
|
-
|
|
9488
|
+
entityDef: entity,
|
|
9489
|
+
item: company,
|
|
9490
|
+
namePlural: t2("crm.companies.title"),
|
|
9491
|
+
basePath: "/sales/companies",
|
|
9492
|
+
initialTab,
|
|
9493
|
+
onBack: () => onBack?.(),
|
|
9494
|
+
onEdit: onEdit ? () => onEdit(company.id) : void 0,
|
|
9495
|
+
onFieldsSave: saveFields,
|
|
9496
|
+
badges: /* @__PURE__ */ jsx(CompanyGroupBadge, { companyId: company.id, onOpenCompany: (id) => onOpenCompany?.(id) }),
|
|
9497
|
+
extraActions
|
|
9482
9498
|
}
|
|
9483
9499
|
),
|
|
9500
|
+
/* @__PURE__ */ jsx(LinkContactDialog, { companyId: company.id, open: linking, onClose: () => setLinking(false), onLinked: () => {
|
|
9501
|
+
void load();
|
|
9502
|
+
} }),
|
|
9484
9503
|
/* @__PURE__ */ jsx(
|
|
9485
9504
|
ConfirmDialog,
|
|
9486
9505
|
{
|
|
@@ -9675,10 +9694,11 @@ function LeadSidebar({ leadId, open, onClose, onViewDeal, onOpenLead }) {
|
|
|
9675
9694
|
] }),
|
|
9676
9695
|
lead && (deal || onOpenLead) && /* @__PURE__ */ jsxs(SheetFooter, { children: [
|
|
9677
9696
|
deal && onViewDeal && /* @__PURE__ */ jsxs(
|
|
9678
|
-
|
|
9697
|
+
Button,
|
|
9679
9698
|
{
|
|
9680
9699
|
onClick: () => onViewDeal(deal.id),
|
|
9681
|
-
|
|
9700
|
+
variant: "outline",
|
|
9701
|
+
className: "h-auto flex-1 gap-2 rounded-lg px-3 py-2.5 text-xs font-medium",
|
|
9682
9702
|
children: [
|
|
9683
9703
|
t2("crm.leadSidebar.viewDeal"),
|
|
9684
9704
|
" ",
|
|
@@ -9687,13 +9707,14 @@ function LeadSidebar({ leadId, open, onClose, onViewDeal, onOpenLead }) {
|
|
|
9687
9707
|
}
|
|
9688
9708
|
),
|
|
9689
9709
|
onOpenLead && /* @__PURE__ */ jsxs(
|
|
9690
|
-
|
|
9710
|
+
Button,
|
|
9691
9711
|
{
|
|
9692
9712
|
onClick: () => {
|
|
9693
9713
|
onOpenLead(lead.id);
|
|
9694
9714
|
onClose();
|
|
9695
9715
|
},
|
|
9696
|
-
|
|
9716
|
+
variant: "outline",
|
|
9717
|
+
className: "h-auto flex-1 gap-2 rounded-lg px-3 py-2.5 text-xs font-medium",
|
|
9697
9718
|
children: [
|
|
9698
9719
|
t2("crm.leadSidebar.openFullProfile"),
|
|
9699
9720
|
" ",
|
|
@@ -9825,10 +9846,12 @@ function ActivityListView({ onOpenLead, onOpenQuote, onOpenDeal } = {}) {
|
|
|
9825
9846
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col sm:flex-row gap-3 sm:items-center", children: [
|
|
9826
9847
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-1.5 flex-wrap", children: [
|
|
9827
9848
|
/* @__PURE__ */ jsx(
|
|
9828
|
-
|
|
9849
|
+
Button,
|
|
9829
9850
|
{
|
|
9851
|
+
variant: "bare",
|
|
9852
|
+
size: "bare",
|
|
9830
9853
|
onClick: () => setTypeFilter(null),
|
|
9831
|
-
className: `rounded-full px-2.5 py-1 text-xs font-medium
|
|
9854
|
+
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
9855
|
children: t2("crm.activities.all")
|
|
9833
9856
|
}
|
|
9834
9857
|
),
|
|
@@ -9836,10 +9859,12 @@ function ActivityListView({ onOpenLead, onOpenQuote, onOpenDeal } = {}) {
|
|
|
9836
9859
|
const cfg = TYPE_CONFIG[type];
|
|
9837
9860
|
const Icon = cfg.icon;
|
|
9838
9861
|
return /* @__PURE__ */ jsxs(
|
|
9839
|
-
|
|
9862
|
+
Button,
|
|
9840
9863
|
{
|
|
9864
|
+
variant: "bare",
|
|
9865
|
+
size: "bare",
|
|
9841
9866
|
onClick: () => setTypeFilter(typeFilter === type ? null : type),
|
|
9842
|
-
className: `
|
|
9867
|
+
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
9868
|
children: [
|
|
9844
9869
|
/* @__PURE__ */ jsx(Icon, { className: "h-3 w-3" }),
|
|
9845
9870
|
cfg.label
|
|
@@ -9849,10 +9874,12 @@ function ActivityListView({ onOpenLead, onOpenQuote, onOpenDeal } = {}) {
|
|
|
9849
9874
|
);
|
|
9850
9875
|
}),
|
|
9851
9876
|
/* @__PURE__ */ jsxs(
|
|
9852
|
-
|
|
9877
|
+
Button,
|
|
9853
9878
|
{
|
|
9879
|
+
variant: "bare",
|
|
9880
|
+
size: "bare",
|
|
9854
9881
|
onClick: () => setTypeFilter(eventsFilter ? null : "events"),
|
|
9855
|
-
className: `
|
|
9882
|
+
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
9883
|
children: [
|
|
9857
9884
|
/* @__PURE__ */ jsx(Sparkles, { className: "h-3 w-3" }),
|
|
9858
9885
|
t2("crm.activities.systemEvents")
|
|
@@ -9863,10 +9890,12 @@ function ActivityListView({ onOpenLead, onOpenQuote, onOpenDeal } = {}) {
|
|
|
9863
9890
|
/* @__PURE__ */ jsx("div", { className: "flex-1" }),
|
|
9864
9891
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-1.5", children: [
|
|
9865
9892
|
/* @__PURE__ */ jsxs(
|
|
9866
|
-
|
|
9893
|
+
Button,
|
|
9867
9894
|
{
|
|
9895
|
+
variant: "bare",
|
|
9896
|
+
size: "bare",
|
|
9868
9897
|
onClick: () => setShowCompleted(showCompleted === false ? null : false),
|
|
9869
|
-
className: `
|
|
9898
|
+
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
9899
|
children: [
|
|
9871
9900
|
/* @__PURE__ */ jsx(Clock, { className: "h-3 w-3" }),
|
|
9872
9901
|
" ",
|
|
@@ -9875,10 +9904,12 @@ function ActivityListView({ onOpenLead, onOpenQuote, onOpenDeal } = {}) {
|
|
|
9875
9904
|
}
|
|
9876
9905
|
),
|
|
9877
9906
|
/* @__PURE__ */ jsxs(
|
|
9878
|
-
|
|
9907
|
+
Button,
|
|
9879
9908
|
{
|
|
9909
|
+
variant: "bare",
|
|
9910
|
+
size: "bare",
|
|
9880
9911
|
onClick: () => setShowCompleted(showCompleted === true ? null : true),
|
|
9881
|
-
className: `
|
|
9912
|
+
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
9913
|
children: [
|
|
9883
9914
|
/* @__PURE__ */ jsx(Check, { className: "h-3 w-3" }),
|
|
9884
9915
|
" ",
|
|
@@ -10084,6 +10115,35 @@ function NetworkView() {
|
|
|
10084
10115
|
const scored = React__default.useMemo(() => scoreUnits(rows ?? [], weights), [rows, weights]);
|
|
10085
10116
|
const avg = networkScore(scored);
|
|
10086
10117
|
const ranked = React__default.useMemo(() => [...scored].sort((a, b) => b.revenue - a.revenue), [scored]);
|
|
10118
|
+
const columns = React__default.useMemo(() => {
|
|
10119
|
+
const NUM = { className: "text-right" };
|
|
10120
|
+
return [
|
|
10121
|
+
{
|
|
10122
|
+
id: "rank",
|
|
10123
|
+
header: "#",
|
|
10124
|
+
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 })
|
|
10125
|
+
},
|
|
10126
|
+
{ id: "unit", header: t2("crm.network.unit"), cell: ({ row }) => /* @__PURE__ */ jsx("span", { className: "font-medium", children: row.original.unitName }) },
|
|
10127
|
+
{ id: "orders", header: t2("crm.network.orders"), meta: NUM, cell: ({ row }) => /* @__PURE__ */ jsx("span", { className: "tabular-nums", children: row.original.ordersCount }) },
|
|
10128
|
+
{ id: "revenue", header: t2("crm.network.revenue"), meta: NUM, cell: ({ row }) => /* @__PURE__ */ jsx("span", { className: "tabular-nums", children: formatCurrency(row.original.revenue, currency) }) },
|
|
10129
|
+
{ id: "conversion", header: t2("crm.network.dim.conversion"), meta: NUM, cell: ({ row }) => /* @__PURE__ */ jsx(Cell, { value: row.original.conversion }) },
|
|
10130
|
+
{ id: "retention", header: t2("crm.network.dim.retention"), meta: NUM, cell: ({ row }) => /* @__PURE__ */ jsx(Cell, { value: row.original.retention }) },
|
|
10131
|
+
{ id: "reactivation", header: t2("crm.network.dim.reactivation"), meta: NUM, cell: ({ row }) => /* @__PURE__ */ jsx(Cell, { value: row.original.reactivation }) },
|
|
10132
|
+
{ id: "satisfaction", header: t2("crm.network.dim.satisfaction"), meta: NUM, cell: ({ row }) => /* @__PURE__ */ jsx(Cell, { value: row.original.satisfaction }) },
|
|
10133
|
+
{ 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: "" }) }) },
|
|
10134
|
+
// How many dimensions went in: a score from one dimension is not comparable with one from five.
|
|
10135
|
+
{
|
|
10136
|
+
id: "measured",
|
|
10137
|
+
header: t2("crm.network.measured"),
|
|
10138
|
+
meta: NUM,
|
|
10139
|
+
cell: ({ row }) => /* @__PURE__ */ jsxs("span", { className: "text-[10px] text-muted-foreground", children: [
|
|
10140
|
+
row.original.measured,
|
|
10141
|
+
"/",
|
|
10142
|
+
MEASURED_DIMENSIONS.length
|
|
10143
|
+
] })
|
|
10144
|
+
}
|
|
10145
|
+
];
|
|
10146
|
+
}, [t2, currency]);
|
|
10087
10147
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
10088
10148
|
/* @__PURE__ */ jsx(
|
|
10089
10149
|
SubpageHeader,
|
|
@@ -10124,36 +10184,17 @@ function NetworkView() {
|
|
|
10124
10184
|
] }),
|
|
10125
10185
|
/* @__PURE__ */ jsx("p", { className: "mt-3 text-[10px] text-muted-foreground", children: t2("crm.network.weightsNote") })
|
|
10126
10186
|
] }),
|
|
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
|
-
] }) }),
|
|
10187
|
+
/* @__PURE__ */ jsx("div", { "data-testid": "network-rows", children: /* @__PURE__ */ jsx(
|
|
10188
|
+
DataTable,
|
|
10189
|
+
{
|
|
10190
|
+
compact: true,
|
|
10191
|
+
columns,
|
|
10192
|
+
data: ranked,
|
|
10193
|
+
loading: rows === null,
|
|
10194
|
+
getRowId: (u) => u.unitId,
|
|
10195
|
+
emptyMessage: /* @__PURE__ */ jsx("span", { className: "text-xs", children: t2("crm.network.empty") })
|
|
10196
|
+
}
|
|
10197
|
+
) }),
|
|
10157
10198
|
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
10199
|
/* @__PURE__ */ jsx(Network, { className: "mr-1 inline h-3 w-3" }),
|
|
10159
10200
|
t2("crm.network.unmeasuredNote")
|
|
@@ -10208,13 +10249,15 @@ function SurveyScale({ type, value, onChange, readOnly, compact }) {
|
|
|
10208
10249
|
};
|
|
10209
10250
|
if (type === "stars") {
|
|
10210
10251
|
return /* @__PURE__ */ jsx("div", { className: "flex gap-1", children: [1, 2, 3, 4, 5].map((n) => /* @__PURE__ */ jsx(
|
|
10211
|
-
|
|
10252
|
+
Button,
|
|
10212
10253
|
{
|
|
10213
10254
|
type: "button",
|
|
10255
|
+
variant: "bare",
|
|
10256
|
+
size: "bare",
|
|
10214
10257
|
disabled: readOnly,
|
|
10215
10258
|
onClick: () => pick(n),
|
|
10216
10259
|
"aria-label": `${n} ${n === 1 ? "estrela" : "estrelas"}`,
|
|
10217
|
-
className: "
|
|
10260
|
+
className: "p-0.5 disabled:cursor-default disabled:opacity-100",
|
|
10218
10261
|
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
10262
|
},
|
|
10220
10263
|
n
|
|
@@ -10222,13 +10265,15 @@ function SurveyScale({ type, value, onChange, readOnly, compact }) {
|
|
|
10222
10265
|
}
|
|
10223
10266
|
if (type === "nps") {
|
|
10224
10267
|
return /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: Array.from({ length: 11 }, (_, n) => /* @__PURE__ */ jsx(
|
|
10225
|
-
|
|
10268
|
+
Button,
|
|
10226
10269
|
{
|
|
10227
10270
|
type: "button",
|
|
10271
|
+
variant: "bare",
|
|
10272
|
+
size: "bare",
|
|
10228
10273
|
disabled: readOnly,
|
|
10229
10274
|
onClick: () => pick(n),
|
|
10230
10275
|
"aria-label": `Nota ${n}`,
|
|
10231
|
-
className: `h-8 w-8
|
|
10276
|
+
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
10277
|
children: n
|
|
10233
10278
|
},
|
|
10234
10279
|
n
|
|
@@ -10236,12 +10281,14 @@ function SurveyScale({ type, value, onChange, readOnly, compact }) {
|
|
|
10236
10281
|
}
|
|
10237
10282
|
return /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
10238
10283
|
/* @__PURE__ */ jsxs(
|
|
10239
|
-
|
|
10284
|
+
Button,
|
|
10240
10285
|
{
|
|
10241
10286
|
type: "button",
|
|
10287
|
+
variant: "bare",
|
|
10288
|
+
size: "bare",
|
|
10242
10289
|
disabled: readOnly,
|
|
10243
10290
|
onClick: () => pick(1),
|
|
10244
|
-
className: `flex
|
|
10291
|
+
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
10292
|
children: [
|
|
10246
10293
|
/* @__PURE__ */ jsx(ThumbsUp, { className: "h-3.5 w-3.5" }),
|
|
10247
10294
|
" Sim"
|
|
@@ -10249,12 +10296,14 @@ function SurveyScale({ type, value, onChange, readOnly, compact }) {
|
|
|
10249
10296
|
}
|
|
10250
10297
|
),
|
|
10251
10298
|
/* @__PURE__ */ jsxs(
|
|
10252
|
-
|
|
10299
|
+
Button,
|
|
10253
10300
|
{
|
|
10254
10301
|
type: "button",
|
|
10302
|
+
variant: "bare",
|
|
10303
|
+
size: "bare",
|
|
10255
10304
|
disabled: readOnly,
|
|
10256
10305
|
onClick: () => pick(0),
|
|
10257
|
-
className: `flex
|
|
10306
|
+
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
10307
|
children: [
|
|
10259
10308
|
/* @__PURE__ */ jsx(ThumbsDown, { className: "h-3.5 w-3.5" }),
|
|
10260
10309
|
" N\xE3o"
|
|
@@ -10358,13 +10407,13 @@ function SurveyEditorDialog({ survey, provider, answeredQuestionIds, onClose, on
|
|
|
10358
10407
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
10359
10408
|
/* @__PURE__ */ jsx("label", { className: "text-[10px] font-medium uppercase text-muted-foreground", children: "Mensagem de agradecimento" }),
|
|
10360
10409
|
/* @__PURE__ */ jsx(
|
|
10361
|
-
|
|
10410
|
+
Textarea,
|
|
10362
10411
|
{
|
|
10363
10412
|
value: thanks,
|
|
10364
10413
|
onChange: (e) => setThanks(e.target.value),
|
|
10365
10414
|
rows: 2,
|
|
10366
10415
|
placeholder: "Obrigado pela sua avalia\xE7\xE3o!",
|
|
10367
|
-
className: "mt-0.5
|
|
10416
|
+
className: "mt-0.5 min-h-0 resize-none px-2 py-1.5 text-xs"
|
|
10368
10417
|
}
|
|
10369
10418
|
),
|
|
10370
10419
|
/* @__PURE__ */ jsx("p", { className: "mt-1 text-[11px] text-muted-foreground", children: "O que o cliente l\xEA depois de responder." })
|
|
@@ -10407,13 +10456,15 @@ function SurveyEditorDialog({ survey, provider, answeredQuestionIds, onClose, on
|
|
|
10407
10456
|
),
|
|
10408
10457
|
/* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
10409
10458
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
10410
|
-
|
|
10459
|
+
Button,
|
|
10411
10460
|
{
|
|
10412
10461
|
type: "button",
|
|
10462
|
+
variant: "bare",
|
|
10463
|
+
size: "bare",
|
|
10413
10464
|
"aria-label": q.answered ? "Pergunta j\xE1 respondida \u2014 n\xE3o pode ser removida" : "Remover pergunta",
|
|
10414
10465
|
disabled: q.answered,
|
|
10415
10466
|
onClick: () => setQuestions(questions.filter((_, j) => j !== i)),
|
|
10416
|
-
className: "
|
|
10467
|
+
className: "p-1.5 text-destructive hover:bg-destructive/10 disabled:pointer-events-auto disabled:cursor-not-allowed disabled:opacity-40",
|
|
10417
10468
|
children: /* @__PURE__ */ jsx(Trash2, { className: "h-3.5 w-3.5" })
|
|
10418
10469
|
}
|
|
10419
10470
|
) }),
|
|
@@ -10423,27 +10474,17 @@ function SurveyEditorDialog({ survey, provider, answeredQuestionIds, onClose, on
|
|
|
10423
10474
|
/* @__PURE__ */ jsxs("div", { className: "fz-fields fz-fields-2 mt-3", children: [
|
|
10424
10475
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
10425
10476
|
/* @__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
|
-
)
|
|
10477
|
+
/* @__PURE__ */ jsxs(Select, { value: q.questionType, onValueChange: (v) => patch(i, { questionType: v }), children: [
|
|
10478
|
+
/* @__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, {}) }),
|
|
10479
|
+
/* @__PURE__ */ jsx(SelectContent, { children: QUESTION_TYPES.map((o) => /* @__PURE__ */ jsx(SelectItem, { value: o.value, children: o.label }, o.value)) })
|
|
10480
|
+
] })
|
|
10435
10481
|
] }),
|
|
10436
10482
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
10437
10483
|
/* @__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
|
-
)
|
|
10484
|
+
/* @__PURE__ */ jsxs(Select, { value: q.allowComment, onValueChange: (v) => patch(i, { allowComment: v }), children: [
|
|
10485
|
+
/* @__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, {}) }),
|
|
10486
|
+
/* @__PURE__ */ jsx(SelectContent, { children: COMMENT_POLICIES.map((o) => /* @__PURE__ */ jsx(SelectItem, { value: o.value, children: o.label }, o.value)) })
|
|
10487
|
+
] })
|
|
10447
10488
|
] })
|
|
10448
10489
|
] }),
|
|
10449
10490
|
/* @__PURE__ */ jsxs("div", { className: "mt-3 flex items-center justify-between", children: [
|
|
@@ -10547,13 +10588,13 @@ function SurveyCollectDialog({ survey, provider, contactLookup, onClose, onSaved
|
|
|
10547
10588
|
}
|
|
10548
10589
|
),
|
|
10549
10590
|
q.allowComment !== "no" && /* @__PURE__ */ jsx(
|
|
10550
|
-
|
|
10591
|
+
Textarea,
|
|
10551
10592
|
{
|
|
10552
10593
|
rows: 2,
|
|
10553
10594
|
value: answers[q.id]?.comment ?? "",
|
|
10554
10595
|
onChange: (e) => patch(q.id, { comment: e.target.value }),
|
|
10555
10596
|
placeholder: q.allowComment === "required" ? "Coment\xE1rio (obrigat\xF3rio)" : "Coment\xE1rio (opcional)",
|
|
10556
|
-
className: "
|
|
10597
|
+
className: "min-h-0 resize-none px-2 py-1.5 text-xs"
|
|
10557
10598
|
}
|
|
10558
10599
|
)
|
|
10559
10600
|
] }, q.id)),
|
|
@@ -10759,12 +10800,14 @@ function SurveysView() {
|
|
|
10759
10800
|
/* @__PURE__ */ jsxs(TooltipProvider, { delayDuration: 200, children: [
|
|
10760
10801
|
canEdit && /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
10761
10802
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
10762
|
-
|
|
10803
|
+
Button,
|
|
10763
10804
|
{
|
|
10764
10805
|
type: "button",
|
|
10806
|
+
variant: "ghost",
|
|
10807
|
+
size: "icon",
|
|
10765
10808
|
"aria-label": "Editar pesquisa",
|
|
10766
10809
|
onClick: () => void openEditor(survey),
|
|
10767
|
-
className: "
|
|
10810
|
+
className: "h-[26px] w-[26px] text-muted-foreground",
|
|
10768
10811
|
children: /* @__PURE__ */ jsx(Pencil, { className: "h-3.5 w-3.5" })
|
|
10769
10812
|
}
|
|
10770
10813
|
) }),
|
|
@@ -10772,12 +10815,14 @@ function SurveysView() {
|
|
|
10772
10815
|
] }),
|
|
10773
10816
|
canDelete && /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
10774
10817
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
10775
|
-
|
|
10818
|
+
Button,
|
|
10776
10819
|
{
|
|
10777
10820
|
type: "button",
|
|
10821
|
+
variant: "bare",
|
|
10822
|
+
size: "bare",
|
|
10778
10823
|
"aria-label": "Excluir pesquisa",
|
|
10779
10824
|
onClick: () => setRemoving(survey),
|
|
10780
|
-
className: "
|
|
10825
|
+
className: "p-1.5 text-destructive hover:bg-destructive/10",
|
|
10781
10826
|
children: /* @__PURE__ */ jsx(Trash2, { className: "h-3.5 w-3.5" })
|
|
10782
10827
|
}
|
|
10783
10828
|
) }),
|
|
@@ -10979,6 +11024,26 @@ function DistributionView() {
|
|
|
10979
11024
|
setBusy(false);
|
|
10980
11025
|
}
|
|
10981
11026
|
}
|
|
11027
|
+
const backlogColumns = React__default.useMemo(() => [
|
|
11028
|
+
{
|
|
11029
|
+
id: "lead",
|
|
11030
|
+
header: () => /* @__PURE__ */ jsx("span", { className: "text-xs uppercase", children: t2("crm.distribution.lead") }),
|
|
11031
|
+
cell: ({ row: { original: b } }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11032
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: b.leadName }),
|
|
11033
|
+
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") })
|
|
11034
|
+
] })
|
|
11035
|
+
},
|
|
11036
|
+
{
|
|
11037
|
+
id: "company",
|
|
11038
|
+
header: () => /* @__PURE__ */ jsx("span", { className: "text-xs uppercase", children: t2("crm.distribution.company") }),
|
|
11039
|
+
cell: ({ row }) => /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: row.original.companyName ?? "\u2014" })
|
|
11040
|
+
},
|
|
11041
|
+
{
|
|
11042
|
+
id: "waitingFor",
|
|
11043
|
+
header: () => /* @__PURE__ */ jsx("span", { className: "text-xs uppercase", children: t2("crm.distribution.waitingFor") }),
|
|
11044
|
+
cell: ({ row }) => /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: horas(row.original.hoursWaiting, t2) })
|
|
11045
|
+
}
|
|
11046
|
+
], [t2]);
|
|
10982
11047
|
const waiting = backlog?.length ?? 0;
|
|
10983
11048
|
const stale = (backlog ?? []).filter((b) => b.offersSoFar > 0).length;
|
|
10984
11049
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
@@ -11006,21 +11071,7 @@ function DistributionView() {
|
|
|
11006
11071
|
] })
|
|
11007
11072
|
] }),
|
|
11008
11073
|
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
|
-
] }),
|
|
11074
|
+
/* @__PURE__ */ jsx(DataTable, { variant: "bare", columns: backlogColumns, data: backlog.slice(0, 50), getRowId: (b) => b.leadId }),
|
|
11024
11075
|
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
11076
|
] })
|
|
11026
11077
|
] }),
|
|
@@ -11389,10 +11440,7 @@ function CrmPage({ config, provider, store, registries }) {
|
|
|
11389
11440
|
{ id: "quotes-edit", render: ({ id }) => /* @__PURE__ */ jsx(QuoteFormView, { quoteId: id, onSaved: () => navigate(`quotes-detail:${id}`) }) },
|
|
11390
11441
|
{ id: "company-groups", render: () => /* @__PURE__ */ jsx(CompanyGroupsView, {}) },
|
|
11391
11442
|
{ 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
|
-
] }) },
|
|
11443
|
+
{ id: "companies-new", render: () => /* @__PURE__ */ jsx(CompanyFormView, { onSaved: (id) => navigate(id ? `companies-detail:${id}` : "companies-list"), onCancel: () => navigate("companies-list") }) },
|
|
11396
11444
|
{ id: "companies-edit", render: ({ id }) => /* @__PURE__ */ jsx(CompanyFormView, { companyId: id, onSaved: () => navigate(`companies-detail:${id}`) }) },
|
|
11397
11445
|
{ id: "companies-detail", render: ({ id }) => /* @__PURE__ */ jsx(
|
|
11398
11446
|
CompanyDetailView,
|
|
@@ -31336,6 +31384,8 @@ var en = {
|
|
|
31336
31384
|
"crm.companies.noCompanies": "No companies yet",
|
|
31337
31385
|
"crm.companies.createFirst": "Add the first one",
|
|
31338
31386
|
"crm.companies.archive": "Archive",
|
|
31387
|
+
"crm.companies.one": "Company",
|
|
31388
|
+
"crm.companyDetail.contact": "Contact",
|
|
31339
31389
|
"crm.companyDetail.openInPipeline": "View in pipeline",
|
|
31340
31390
|
"crm.companyDetail.moreActions": "More actions",
|
|
31341
31391
|
"crm.companies.archiveTitle": "Archive company?",
|
|
@@ -31349,6 +31399,7 @@ var en = {
|
|
|
31349
31399
|
"crm.companyDetail.linkRole": "Role here",
|
|
31350
31400
|
"crm.companyDetail.linkRolePlaceholder": "Owner / partner, manager\u2026",
|
|
31351
31401
|
"crm.companyDetail.receita": "Federal tax registry",
|
|
31402
|
+
"crm.companyDetail.receitaNone": "The federal registry has not been checked for this company yet.",
|
|
31352
31403
|
"crm.companyDetail.receitaCheckedOn": "checked on",
|
|
31353
31404
|
"crm.companyDetail.receitaSituacao": "Registration status",
|
|
31354
31405
|
"crm.companyDetail.receitaLegalName": "Legal name",
|
|
@@ -32277,6 +32328,8 @@ var ptBR = {
|
|
|
32277
32328
|
"crm.companies.noCompanies": "Nenhuma empresa ainda",
|
|
32278
32329
|
"crm.companies.createFirst": "Cadastrar a primeira",
|
|
32279
32330
|
"crm.companies.archive": "Arquivar",
|
|
32331
|
+
"crm.companies.one": "Empresa",
|
|
32332
|
+
"crm.companyDetail.contact": "Contato",
|
|
32280
32333
|
"crm.companyDetail.openInPipeline": "Ver no funil",
|
|
32281
32334
|
"crm.companyDetail.moreActions": "Mais a\xE7\xF5es",
|
|
32282
32335
|
"crm.companies.archiveTitle": "Arquivar empresa?",
|
|
@@ -32290,6 +32343,7 @@ var ptBR = {
|
|
|
32290
32343
|
"crm.companyDetail.linkRole": "Cargo aqui",
|
|
32291
32344
|
"crm.companyDetail.linkRolePlaceholder": "Propriet\xE1rio / s\xF3cio, ger\xEAncia\u2026",
|
|
32292
32345
|
"crm.companyDetail.receita": "Receita Federal",
|
|
32346
|
+
"crm.companyDetail.receitaNone": "O cadastro da Receita ainda n\xE3o foi consultado para esta empresa.",
|
|
32293
32347
|
"crm.companyDetail.receitaCheckedOn": "consultado em",
|
|
32294
32348
|
"crm.companyDetail.receitaSituacao": "Situa\xE7\xE3o cadastral",
|
|
32295
32349
|
"crm.companyDetail.receitaLegalName": "Raz\xE3o social",
|
|
@@ -33178,6 +33232,131 @@ var VOCABULARY = {
|
|
|
33178
33232
|
function customerVocabulary(verticalId) {
|
|
33179
33233
|
return verticalId && VOCABULARY[verticalId] || { one: "Cliente", many: "Clientes" };
|
|
33180
33234
|
}
|
|
33235
|
+
var CLIENT_TABS = [
|
|
33236
|
+
["evaluations", "Evaluations", "Avalia\xE7\xF5es", true],
|
|
33237
|
+
["services", "Services", "Servi\xE7os", true],
|
|
33238
|
+
["revision", "Revision", "Revis\xE3o", true],
|
|
33239
|
+
["appointments", "Appointments", "Agendamentos", true],
|
|
33240
|
+
["account", "Account", "Conta", true],
|
|
33241
|
+
["quotes", "Quotes", "Or\xE7amentos", true],
|
|
33242
|
+
["images", "Images", "Imagens", true],
|
|
33243
|
+
["files", "Files", "Arquivos", true],
|
|
33244
|
+
["cancelled", "Cancelled", "Cancelados", false]
|
|
33245
|
+
];
|
|
33246
|
+
var crmV1SettingsTabs = [
|
|
33247
|
+
defineSettingsTab({
|
|
33248
|
+
id: "crm-loyalty",
|
|
33249
|
+
label: tl("Club & cashback", "Clube e Cashback"),
|
|
33250
|
+
icon: "Gift",
|
|
33251
|
+
section: "financial",
|
|
33252
|
+
requiresFacet: "loyalty",
|
|
33253
|
+
pending: true,
|
|
33254
|
+
defaults: {
|
|
33255
|
+
"loyalty.default_percent": 5,
|
|
33256
|
+
"loyalty.validity_days": 30,
|
|
33257
|
+
"loyalty.release_delay_hours": 0,
|
|
33258
|
+
"loyalty.max_redeem_pct_of_bill": 100,
|
|
33259
|
+
"loyalty.earn_on_service_charge": false,
|
|
33260
|
+
"loyalty.earn_on_cover_charge": false,
|
|
33261
|
+
"loyalty.earn_requires_membership": false,
|
|
33262
|
+
"loyalty.redeem_requires_membership": true
|
|
33263
|
+
},
|
|
33264
|
+
sections: [
|
|
33265
|
+
{ title: tl("Program", "Programa"), fields: [
|
|
33266
|
+
{ key: "loyalty.default_percent", type: "number", min: 0, max: 100, label: tl("Cashback (% of the purchase)", "Cashback (% da compra)") },
|
|
33267
|
+
{ key: "loyalty.validity_days", type: "number", min: 1, max: 3650, label: tl("Credit valid for (days)", "Validade do cr\xE9dito (dias)") },
|
|
33268
|
+
{ key: "loyalty.release_delay_hours", type: "number", min: 0, max: 720, label: tl("Credit released after (hours)", "Cr\xE9dito liberado ap\xF3s (horas)") }
|
|
33269
|
+
] },
|
|
33270
|
+
{ title: tl("Earning", "Ganho"), fields: [
|
|
33271
|
+
{ key: "loyalty.max_earn_per_purchase", type: "number", min: 0, label: tl("Max cashback per purchase", "Cashback m\xE1ximo por compra") },
|
|
33272
|
+
{ key: "loyalty.monthly_earn_cap", type: "number", min: 0, label: tl("Max cashback per month", "Cashback m\xE1ximo por m\xEAs") },
|
|
33273
|
+
{ key: "loyalty.earn_on_service_charge", type: "boolean", label: tl("Earn on the service charge", "Ganha sobre a taxa de servi\xE7o") },
|
|
33274
|
+
{ key: "loyalty.earn_on_cover_charge", type: "boolean", label: tl("Earn on the cover charge", "Ganha sobre a taxa de ingresso") },
|
|
33275
|
+
{ key: "loyalty.earn_requires_membership", type: "boolean", label: tl("Only members earn", "S\xF3 membro do clube ganha") }
|
|
33276
|
+
] },
|
|
33277
|
+
{ title: tl("Redeeming", "Resgate"), fields: [
|
|
33278
|
+
{ key: "loyalty.min_redeem_amount", type: "number", min: 0, label: tl("Minimum balance to redeem", "Saldo m\xEDnimo para resgatar") },
|
|
33279
|
+
{ 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 (%)") },
|
|
33280
|
+
{ key: "loyalty.redeem_requires_membership", type: "boolean", label: tl("Only members redeem", "S\xF3 membro do clube resgata") }
|
|
33281
|
+
] }
|
|
33282
|
+
]
|
|
33283
|
+
}),
|
|
33284
|
+
defineSettingsTab({
|
|
33285
|
+
id: "crm-client-type",
|
|
33286
|
+
label: tl("Type", "Tipo"),
|
|
33287
|
+
icon: "UserCog",
|
|
33288
|
+
section: "registry",
|
|
33289
|
+
parent: registrySettingsParent("person:customer", tl("Clients", "Clientes")),
|
|
33290
|
+
order: 4,
|
|
33291
|
+
keywords: [tl("Client type", "Tipo de cliente"), "CPF", "CNPJ"],
|
|
33292
|
+
pending: true,
|
|
33293
|
+
defaults: { "clients.person_type_mode": "pf" },
|
|
33294
|
+
sections: [{
|
|
33295
|
+
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."),
|
|
33296
|
+
fields: [
|
|
33297
|
+
{ key: "clients.person_type_mode", type: "select", label: tl("Your clients are", "Seus clientes s\xE3o"), options: [
|
|
33298
|
+
{ value: "pf", label: tl("People", "Pessoa f\xEDsica") },
|
|
33299
|
+
{ value: "pj", label: tl("Companies", "Pessoa jur\xEDdica") },
|
|
33300
|
+
{ value: "both", label: tl("Both", "Ambos") }
|
|
33301
|
+
] }
|
|
33302
|
+
]
|
|
33303
|
+
}]
|
|
33304
|
+
}),
|
|
33305
|
+
defineSettingsTab({
|
|
33306
|
+
id: "crm-client-menu",
|
|
33307
|
+
label: tl("Menus", "Menus"),
|
|
33308
|
+
icon: "ListOrdered",
|
|
33309
|
+
section: "registry",
|
|
33310
|
+
parent: registrySettingsParent("person:customer", tl("Clients", "Clientes")),
|
|
33311
|
+
order: 3,
|
|
33312
|
+
keywords: [tl("Client record tabs", "Menu de clientes"), tl("Record", "Ficha")],
|
|
33313
|
+
pending: true,
|
|
33314
|
+
defaults: Object.fromEntries(CLIENT_TABS.map(([id, , , on]) => [`clients.menu.${id}`, on])),
|
|
33315
|
+
sections: [{
|
|
33316
|
+
description: tl("Which tabs the client record shows.", "Quais abas a ficha do cliente mostra."),
|
|
33317
|
+
fields: CLIENT_TABS.map(([id, en2, pt]) => ({ key: `clients.menu.${id}`, type: "boolean", label: tl(en2, pt) }))
|
|
33318
|
+
}]
|
|
33319
|
+
}),
|
|
33320
|
+
defineSettingsTab({
|
|
33321
|
+
id: "crm-qr-registration",
|
|
33322
|
+
label: tl("Pre-registration QR", "QR de pr\xE9-cadastro"),
|
|
33323
|
+
keywords: [tl("Pre-registration QR code", "QR Code de pr\xE9-cadastro")],
|
|
33324
|
+
icon: "ScanLine",
|
|
33325
|
+
section: "registry",
|
|
33326
|
+
parent: registrySettingsParent("person:customer", tl("Clients", "Clientes")),
|
|
33327
|
+
order: 5,
|
|
33328
|
+
pending: true,
|
|
33329
|
+
defaults: { "qr_registration.cpf_exists_message": "J\xE1 temos seu cadastro. Procure a recep\xE7\xE3o." },
|
|
33330
|
+
sections: [{
|
|
33331
|
+
fields: [
|
|
33332
|
+
{ key: "qr_registration.title", type: "string", scope: "unit", label: tl("Title", "T\xEDtulo") },
|
|
33333
|
+
{ key: "qr_registration.subtitle", type: "string", scope: "unit", label: tl("Subtitle", "Subt\xEDtulo") },
|
|
33334
|
+
{ key: "qr_registration.intro", type: "string", scope: "unit", label: tl("Text before the forms", "Texto antes dos formul\xE1rios") },
|
|
33335
|
+
{ 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") }
|
|
33336
|
+
]
|
|
33337
|
+
}]
|
|
33338
|
+
}),
|
|
33339
|
+
defineSettingsTab({
|
|
33340
|
+
id: "crm-review-surveys",
|
|
33341
|
+
label: tl("Review surveys", "Pesquisas de avalia\xE7\xE3o"),
|
|
33342
|
+
icon: "Star",
|
|
33343
|
+
section: "operations",
|
|
33344
|
+
pending: true,
|
|
33345
|
+
defaults: { "reviews.ask_on_checkout": true },
|
|
33346
|
+
sections: [{
|
|
33347
|
+
enabledBy: "reviews.ask_on_checkout",
|
|
33348
|
+
fields: [
|
|
33349
|
+
{ 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") },
|
|
33350
|
+
// The texts are templates of the shared message catalog (Automações ›
|
|
33351
|
+
// Mensagens), not strings of this screen.
|
|
33352
|
+
{ key: "reviews.invite_message", type: "message", message: { eventKey: "crm.survey_requested" }, label: tl("Survey message", "Mensagem da pesquisa") },
|
|
33353
|
+
{ key: "reviews.thanks_message", type: "message", message: { eventKey: "crm.survey_answered" }, label: tl("Thank-you message", "Mensagem de agradecimento") }
|
|
33354
|
+
]
|
|
33355
|
+
}]
|
|
33356
|
+
})
|
|
33357
|
+
];
|
|
33358
|
+
|
|
33359
|
+
// src/index.ts
|
|
33181
33360
|
var DEFAULT_LABELS = {
|
|
33182
33361
|
pageTitle: "Sales",
|
|
33183
33362
|
pageSubtitle: "CRM, leads, deals, and pipeline management"
|
|
@@ -33303,7 +33482,8 @@ function createCrmPlugin(options) {
|
|
|
33303
33482
|
facets: [
|
|
33304
33483
|
{ id: "contacts", label: "Contatos e leads", description: "Cadastro, tags e hist\xF3rico.", includedWithPlugin: true },
|
|
33305
33484
|
{ 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." }
|
|
33485
|
+
{ id: "automation", label: "Automa\xE7\xF5es de funil", description: "Regras que movem o card e disparam a pr\xF3xima a\xE7\xE3o." },
|
|
33486
|
+
{ id: "loyalty", label: "Clube e Cashback", description: "Cr\xE9dito de volta em cada compra, resgatado na pr\xF3xima." }
|
|
33307
33487
|
],
|
|
33308
33488
|
dependencies: [],
|
|
33309
33489
|
// Os FATOS do funil. Vão no manifesto (e não num registro à parte) para que
|
|
@@ -33521,10 +33701,10 @@ function createCrmPlugin(options) {
|
|
|
33521
33701
|
}
|
|
33522
33702
|
},
|
|
33523
33703
|
suggestions: [
|
|
33524
|
-
{ label: "
|
|
33525
|
-
{ label: "
|
|
33526
|
-
{ label: "
|
|
33527
|
-
{ label: "
|
|
33704
|
+
{ label: "Quantos clientes temos?", verticalId: "beauty" },
|
|
33705
|
+
{ label: "Quantos clientes temos?", verticalId: "services" },
|
|
33706
|
+
{ label: "Quantos pacientes hoje?", verticalId: "health" },
|
|
33707
|
+
{ label: "Quem s\xE3o meus melhores clientes?" }
|
|
33528
33708
|
],
|
|
33529
33709
|
permission: { feature: "sales", action: "read" }
|
|
33530
33710
|
},
|
|
@@ -33544,9 +33724,9 @@ function createCrmPlugin(options) {
|
|
|
33544
33724
|
},
|
|
33545
33725
|
permission: { feature: "sales", action: "read" },
|
|
33546
33726
|
suggestions: [
|
|
33547
|
-
{ label: "
|
|
33548
|
-
{ label: "
|
|
33549
|
-
{ label: "
|
|
33727
|
+
{ label: "Mostre os leads novos desta semana" },
|
|
33728
|
+
{ label: "Quais leads precisam de follow-up?" },
|
|
33729
|
+
{ label: "Qual nossa taxa de convers\xE3o?" }
|
|
33550
33730
|
]
|
|
33551
33731
|
},
|
|
33552
33732
|
{
|
|
@@ -33750,6 +33930,7 @@ function createCrmPlugin(options) {
|
|
|
33750
33930
|
],
|
|
33751
33931
|
registries: crmRegistries2,
|
|
33752
33932
|
settings: [
|
|
33933
|
+
...crmV1SettingsTabs,
|
|
33753
33934
|
{
|
|
33754
33935
|
id: "crm",
|
|
33755
33936
|
label: "Sales & CRM",
|