@open-mercato/core 0.6.4-develop.3929.1.fcf7afece2 → 0.6.4-develop.3944.1.4100aa7fbe
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/.turbo/turbo-build.log +1 -1
- package/dist/modules/customers/backend/customers/deals/create/page.js +3 -61
- package/dist/modules/customers/backend/customers/deals/create/page.js.map +2 -2
- package/dist/modules/customers/components/detail/DealForm.js +2 -0
- package/dist/modules/customers/components/detail/DealForm.js.map +2 -2
- package/dist/modules/customers/components/detail/create/CreateDealForm.js +233 -0
- package/dist/modules/customers/components/detail/create/CreateDealForm.js.map +7 -0
- package/dist/modules/customers/components/detail/create/DealAssociationsField.js +209 -0
- package/dist/modules/customers/components/detail/create/DealAssociationsField.js.map +7 -0
- package/dist/modules/customers/components/detail/create/DealAssociationsSection.js +67 -0
- package/dist/modules/customers/components/detail/create/DealAssociationsSection.js.map +7 -0
- package/dist/modules/customers/components/detail/create/DealCreateSidebar.js +73 -0
- package/dist/modules/customers/components/detail/create/DealCreateSidebar.js.map +7 -0
- package/dist/modules/customers/components/detail/create/DealCurrencyField.js +92 -0
- package/dist/modules/customers/components/detail/create/DealCurrencyField.js.map +7 -0
- package/dist/modules/customers/components/detail/create/DealCustomAttributes.js +81 -0
- package/dist/modules/customers/components/detail/create/DealCustomAttributes.js.map +7 -0
- package/dist/modules/customers/components/detail/create/DealDetailsFields.js +171 -0
- package/dist/modules/customers/components/detail/create/DealDetailsFields.js.map +7 -0
- package/dist/modules/customers/components/detail/create/DealFormField.js +24 -0
- package/dist/modules/customers/components/detail/create/DealFormField.js.map +7 -0
- package/dist/modules/customers/components/detail/create/DealSectionCard.js +29 -0
- package/dist/modules/customers/components/detail/create/DealSectionCard.js.map +7 -0
- package/dist/modules/customers/components/detail/create/DealTipsCard.js +19 -0
- package/dist/modules/customers/components/detail/create/DealTipsCard.js.map +7 -0
- package/dist/modules/customers/components/detail/create/PipelineSelect.js +41 -0
- package/dist/modules/customers/components/detail/create/PipelineSelect.js.map +7 -0
- package/dist/modules/customers/components/detail/create/PipelineStageSelect.js +49 -0
- package/dist/modules/customers/components/detail/create/PipelineStageSelect.js.map +7 -0
- package/dist/modules/customers/components/detail/create/SuffixInput.js +21 -0
- package/dist/modules/customers/components/detail/create/SuffixInput.js.map +7 -0
- package/dist/modules/customers/components/detail/create/dealCustomFieldControl.js +270 -0
- package/dist/modules/customers/components/detail/create/dealCustomFieldControl.js.map +7 -0
- package/dist/modules/customers/components/detail/create/dealFormTypes.js +17 -0
- package/dist/modules/customers/components/detail/create/dealFormTypes.js.map +7 -0
- package/dist/modules/customers/components/detail/create/dealNumericInput.js +16 -0
- package/dist/modules/customers/components/detail/create/dealNumericInput.js.map +7 -0
- package/dist/modules/customers/components/detail/create/useDealCustomFields.js +93 -0
- package/dist/modules/customers/components/detail/create/useDealCustomFields.js.map +7 -0
- package/dist/modules/customers/components/detail/create/useDealPipelines.js +59 -0
- package/dist/modules/customers/components/detail/create/useDealPipelines.js.map +7 -0
- package/dist/modules/customers/components/formConfig.js +4 -2
- package/dist/modules/customers/components/formConfig.js.map +2 -2
- package/dist/modules/dictionaries/components/DictionaryEntrySelect.js +5 -2
- package/dist/modules/dictionaries/components/DictionaryEntrySelect.js.map +2 -2
- package/package.json +7 -7
- package/src/modules/customers/backend/customers/deals/create/page.tsx +3 -64
- package/src/modules/customers/components/detail/DealForm.tsx +2 -0
- package/src/modules/customers/components/detail/create/CreateDealForm.tsx +254 -0
- package/src/modules/customers/components/detail/create/DealAssociationsField.tsx +253 -0
- package/src/modules/customers/components/detail/create/DealAssociationsSection.tsx +72 -0
- package/src/modules/customers/components/detail/create/DealCreateSidebar.tsx +79 -0
- package/src/modules/customers/components/detail/create/DealCurrencyField.tsx +108 -0
- package/src/modules/customers/components/detail/create/DealCustomAttributes.tsx +118 -0
- package/src/modules/customers/components/detail/create/DealDetailsFields.tsx +171 -0
- package/src/modules/customers/components/detail/create/DealFormField.tsx +39 -0
- package/src/modules/customers/components/detail/create/DealSectionCard.tsx +40 -0
- package/src/modules/customers/components/detail/create/DealTipsCard.tsx +26 -0
- package/src/modules/customers/components/detail/create/PipelineSelect.tsx +55 -0
- package/src/modules/customers/components/detail/create/PipelineStageSelect.tsx +70 -0
- package/src/modules/customers/components/detail/create/SuffixInput.tsx +20 -0
- package/src/modules/customers/components/detail/create/dealCustomFieldControl.tsx +310 -0
- package/src/modules/customers/components/detail/create/dealFormTypes.ts +29 -0
- package/src/modules/customers/components/detail/create/dealNumericInput.ts +20 -0
- package/src/modules/customers/components/detail/create/useDealCustomFields.ts +118 -0
- package/src/modules/customers/components/detail/create/useDealPipelines.ts +80 -0
- package/src/modules/customers/components/formConfig.tsx +3 -0
- package/src/modules/customers/i18n/de.json +26 -0
- package/src/modules/customers/i18n/en.json +26 -0
- package/src/modules/customers/i18n/es.json +26 -0
- package/src/modules/customers/i18n/pl.json +26 -0
- package/src/modules/dictionaries/components/DictionaryEntrySelect.tsx +12 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { apiCall } from "@open-mercato/ui/backend/utils/apiCall";
|
|
4
|
+
function useDealPipelines() {
|
|
5
|
+
const [pipelines, setPipelines] = React.useState([]);
|
|
6
|
+
const [stages, setStages] = React.useState([]);
|
|
7
|
+
const mountedRef = React.useRef(true);
|
|
8
|
+
React.useEffect(() => {
|
|
9
|
+
mountedRef.current = true;
|
|
10
|
+
return () => {
|
|
11
|
+
mountedRef.current = false;
|
|
12
|
+
};
|
|
13
|
+
}, []);
|
|
14
|
+
React.useEffect(() => {
|
|
15
|
+
let cancelled = false;
|
|
16
|
+
(async () => {
|
|
17
|
+
try {
|
|
18
|
+
const call = await apiCall("/api/customers/pipelines");
|
|
19
|
+
if (cancelled || !mountedRef.current) return;
|
|
20
|
+
if (call.ok && call.result?.items) {
|
|
21
|
+
setPipelines(call.result.items);
|
|
22
|
+
}
|
|
23
|
+
} catch {
|
|
24
|
+
if (!cancelled && mountedRef.current) setPipelines([]);
|
|
25
|
+
}
|
|
26
|
+
})().catch(() => {
|
|
27
|
+
});
|
|
28
|
+
return () => {
|
|
29
|
+
cancelled = true;
|
|
30
|
+
};
|
|
31
|
+
}, []);
|
|
32
|
+
const loadStages = React.useCallback(async (pipelineId) => {
|
|
33
|
+
if (!pipelineId) {
|
|
34
|
+
if (mountedRef.current) setStages([]);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
const call = await apiCall(
|
|
39
|
+
`/api/customers/pipeline-stages?pipelineId=${encodeURIComponent(pipelineId)}`
|
|
40
|
+
);
|
|
41
|
+
if (!mountedRef.current) return;
|
|
42
|
+
if (call.ok && call.result?.items) {
|
|
43
|
+
const sorted = [...call.result.items].sort((a, b) => a.order - b.order);
|
|
44
|
+
setStages(sorted);
|
|
45
|
+
} else {
|
|
46
|
+
setStages([]);
|
|
47
|
+
}
|
|
48
|
+
} catch {
|
|
49
|
+
if (mountedRef.current) setStages([]);
|
|
50
|
+
}
|
|
51
|
+
}, []);
|
|
52
|
+
return { pipelines, stages, loadStages };
|
|
53
|
+
}
|
|
54
|
+
var useDealPipelines_default = useDealPipelines;
|
|
55
|
+
export {
|
|
56
|
+
useDealPipelines_default as default,
|
|
57
|
+
useDealPipelines
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=useDealPipelines.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/modules/customers/components/detail/create/useDealPipelines.ts"],
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\n\nexport type PipelineOption = {\n id: string\n name: string\n isDefault: boolean\n}\n\nexport type PipelineStageOption = {\n id: string\n label: string\n order: number\n}\n\nexport type UseDealPipelinesResult = {\n pipelines: PipelineOption[]\n stages: PipelineStageOption[]\n loadStages: (pipelineId: string) => Promise<void>\n}\n\nexport function useDealPipelines(): UseDealPipelinesResult {\n const [pipelines, setPipelines] = React.useState<PipelineOption[]>([])\n const [stages, setStages] = React.useState<PipelineStageOption[]>([])\n const mountedRef = React.useRef(true)\n\n React.useEffect(() => {\n mountedRef.current = true\n return () => {\n mountedRef.current = false\n }\n }, [])\n\n React.useEffect(() => {\n let cancelled = false\n ;(async () => {\n try {\n const call = await apiCall<{ items: PipelineOption[] }>('/api/customers/pipelines')\n if (cancelled || !mountedRef.current) return\n if (call.ok && call.result?.items) {\n setPipelines(call.result.items)\n }\n } catch {\n if (!cancelled && mountedRef.current) setPipelines([])\n }\n })().catch(() => {\n // The inner try/catch already resets pipelines on failure; this guards the IIFE promise only.\n })\n return () => {\n cancelled = true\n }\n }, [])\n\n const loadStages = React.useCallback(async (pipelineId: string) => {\n if (!pipelineId) {\n if (mountedRef.current) setStages([])\n return\n }\n try {\n const call = await apiCall<{ items: PipelineStageOption[] }>(\n `/api/customers/pipeline-stages?pipelineId=${encodeURIComponent(pipelineId)}`,\n )\n if (!mountedRef.current) return\n if (call.ok && call.result?.items) {\n const sorted = [...call.result.items].sort((a, b) => a.order - b.order)\n setStages(sorted)\n } else {\n setStages([])\n }\n } catch {\n if (mountedRef.current) setStages([])\n }\n }, [])\n\n return { pipelines, stages, loadStages }\n}\n\nexport default useDealPipelines\n"],
|
|
5
|
+
"mappings": ";AAEA,YAAY,WAAW;AACvB,SAAS,eAAe;AAoBjB,SAAS,mBAA2C;AACzD,QAAM,CAAC,WAAW,YAAY,IAAI,MAAM,SAA2B,CAAC,CAAC;AACrE,QAAM,CAAC,QAAQ,SAAS,IAAI,MAAM,SAAgC,CAAC,CAAC;AACpE,QAAM,aAAa,MAAM,OAAO,IAAI;AAEpC,QAAM,UAAU,MAAM;AACpB,eAAW,UAAU;AACrB,WAAO,MAAM;AACX,iBAAW,UAAU;AAAA,IACvB;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,QAAM,UAAU,MAAM;AACpB,QAAI,YAAY;AACf,KAAC,YAAY;AACZ,UAAI;AACF,cAAM,OAAO,MAAM,QAAqC,0BAA0B;AAClF,YAAI,aAAa,CAAC,WAAW,QAAS;AACtC,YAAI,KAAK,MAAM,KAAK,QAAQ,OAAO;AACjC,uBAAa,KAAK,OAAO,KAAK;AAAA,QAChC;AAAA,MACF,QAAQ;AACN,YAAI,CAAC,aAAa,WAAW,QAAS,cAAa,CAAC,CAAC;AAAA,MACvD;AAAA,IACF,GAAG,EAAE,MAAM,MAAM;AAAA,IAEjB,CAAC;AACD,WAAO,MAAM;AACX,kBAAY;AAAA,IACd;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,QAAM,aAAa,MAAM,YAAY,OAAO,eAAuB;AACjE,QAAI,CAAC,YAAY;AACf,UAAI,WAAW,QAAS,WAAU,CAAC,CAAC;AACpC;AAAA,IACF;AACA,QAAI;AACF,YAAM,OAAO,MAAM;AAAA,QACjB,6CAA6C,mBAAmB,UAAU,CAAC;AAAA,MAC7E;AACA,UAAI,CAAC,WAAW,QAAS;AACzB,UAAI,KAAK,MAAM,KAAK,QAAQ,OAAO;AACjC,cAAM,SAAS,CAAC,GAAG,KAAK,OAAO,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK;AACtE,kBAAU,MAAM;AAAA,MAClB,OAAO;AACL,kBAAU,CAAC,CAAC;AAAA,MACd;AAAA,IACF,QAAQ;AACN,UAAI,WAAW,QAAS,WAAU,CAAC,CAAC;AAAA,IACtC;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SAAO,EAAE,WAAW,QAAQ,WAAW;AACzC;AAEA,IAAO,2BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -71,7 +71,8 @@ function DictionarySelectField({
|
|
|
71
71
|
allowInlineCreate = false,
|
|
72
72
|
allowAppearance = false,
|
|
73
73
|
showManage = false,
|
|
74
|
-
showLabelInput = true
|
|
74
|
+
showLabelInput = true,
|
|
75
|
+
showActiveAppearance = true
|
|
75
76
|
}) {
|
|
76
77
|
const t = useT();
|
|
77
78
|
const queryClient = useQueryClient();
|
|
@@ -159,7 +160,8 @@ function DictionarySelectField({
|
|
|
159
160
|
allowInlineCreate,
|
|
160
161
|
allowAppearance,
|
|
161
162
|
showManage,
|
|
162
|
-
showLabelInput
|
|
163
|
+
showLabelInput,
|
|
164
|
+
showActiveAppearance
|
|
163
165
|
}
|
|
164
166
|
);
|
|
165
167
|
}
|