@enyxs/wikex-components 0.11.14 → 0.11.15
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/README.md +15 -0
- package/dist/consultation-model.d.mts +37 -0
- package/dist/consultation-model.d.ts +37 -0
- package/dist/consultation-model.js +42 -0
- package/dist/consultation-model.js.map +1 -0
- package/dist/consultation-model.mjs +15 -0
- package/dist/consultation-model.mjs.map +1 -0
- package/dist/consultations.d.mts +27 -0
- package/dist/consultations.d.ts +27 -0
- package/dist/consultations.js +226 -0
- package/dist/consultations.js.map +1 -0
- package/dist/consultations.mjs +200 -0
- package/dist/consultations.mjs.map +1 -0
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +67 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +67 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -1
package/README.md
CHANGED
|
@@ -129,3 +129,18 @@ filtering, pagination and ordering helpers from
|
|
|
129
129
|
`@enyxs/wikex-components/fees/model`. This entry has no React or CMS dependency
|
|
130
130
|
and can run on a backend. Strict validation throws for invalid table data;
|
|
131
131
|
`parseFeesTable` retains public rendering's legacy fallback behavior.
|
|
132
|
+
|
|
133
|
+
## Consultation forms and management
|
|
134
|
+
|
|
135
|
+
The original landing registration renderer accepts `onConsultationSubmit`, an
|
|
136
|
+
async callback receiving `ConsultationSubmission` exported from the root entry.
|
|
137
|
+
It preserves the existing form style, uses MUI selects and shows accessible
|
|
138
|
+
success/error notices. While sending, fields are disabled; failures retain the
|
|
139
|
+
values and submission ID for idempotent retries. Success clears all fields.
|
|
140
|
+
Editable CMS previews do not submit live requests. The host owns the endpoint,
|
|
141
|
+
validation, authentication and storage. The separate partnership form is unchanged.
|
|
142
|
+
|
|
143
|
+
Use `ConsultationManager` from `@enyxs/wikex-components/consultations` for the
|
|
144
|
+
controlled admin table, filters, pagination, detail/status/notes dialog and delete
|
|
145
|
+
confirmation. Supply data, permissions and API callbacks. Pure models and labels
|
|
146
|
+
are exported from `@enyxs/wikex-components/consultations/model`.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
type ConsultationSubmission = {
|
|
2
|
+
submissionId: string;
|
|
3
|
+
name: string;
|
|
4
|
+
phone: string;
|
|
5
|
+
email: string;
|
|
6
|
+
city: string;
|
|
7
|
+
markets: string[];
|
|
8
|
+
otherMarket: string;
|
|
9
|
+
capital: string;
|
|
10
|
+
language: 'vi' | 'en';
|
|
11
|
+
sourcePath: string;
|
|
12
|
+
website: string;
|
|
13
|
+
};
|
|
14
|
+
declare const consultationStatuses: {
|
|
15
|
+
readonly new: "Mới";
|
|
16
|
+
readonly contacted: "Đã liên hệ";
|
|
17
|
+
readonly completed: "Hoàn tất";
|
|
18
|
+
readonly cancelled: "Không tiếp tục";
|
|
19
|
+
};
|
|
20
|
+
type ConsultationStatus = keyof typeof consultationStatuses;
|
|
21
|
+
declare const consultationCities: Record<string, string>;
|
|
22
|
+
declare const consultationCapitals: Record<string, string>;
|
|
23
|
+
type Consultation = Omit<ConsultationSubmission, 'website' | 'submissionId'> & {
|
|
24
|
+
id: string;
|
|
25
|
+
status: ConsultationStatus;
|
|
26
|
+
notes: string;
|
|
27
|
+
createdAt: string;
|
|
28
|
+
updatedAt: string;
|
|
29
|
+
};
|
|
30
|
+
type ConsultationList = {
|
|
31
|
+
items: Consultation[];
|
|
32
|
+
total: number;
|
|
33
|
+
page: number;
|
|
34
|
+
pageSize: number;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export { type Consultation, type ConsultationList, type ConsultationStatus, type ConsultationSubmission, consultationCapitals, consultationCities, consultationStatuses };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
type ConsultationSubmission = {
|
|
2
|
+
submissionId: string;
|
|
3
|
+
name: string;
|
|
4
|
+
phone: string;
|
|
5
|
+
email: string;
|
|
6
|
+
city: string;
|
|
7
|
+
markets: string[];
|
|
8
|
+
otherMarket: string;
|
|
9
|
+
capital: string;
|
|
10
|
+
language: 'vi' | 'en';
|
|
11
|
+
sourcePath: string;
|
|
12
|
+
website: string;
|
|
13
|
+
};
|
|
14
|
+
declare const consultationStatuses: {
|
|
15
|
+
readonly new: "Mới";
|
|
16
|
+
readonly contacted: "Đã liên hệ";
|
|
17
|
+
readonly completed: "Hoàn tất";
|
|
18
|
+
readonly cancelled: "Không tiếp tục";
|
|
19
|
+
};
|
|
20
|
+
type ConsultationStatus = keyof typeof consultationStatuses;
|
|
21
|
+
declare const consultationCities: Record<string, string>;
|
|
22
|
+
declare const consultationCapitals: Record<string, string>;
|
|
23
|
+
type Consultation = Omit<ConsultationSubmission, 'website' | 'submissionId'> & {
|
|
24
|
+
id: string;
|
|
25
|
+
status: ConsultationStatus;
|
|
26
|
+
notes: string;
|
|
27
|
+
createdAt: string;
|
|
28
|
+
updatedAt: string;
|
|
29
|
+
};
|
|
30
|
+
type ConsultationList = {
|
|
31
|
+
items: Consultation[];
|
|
32
|
+
total: number;
|
|
33
|
+
page: number;
|
|
34
|
+
pageSize: number;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export { type Consultation, type ConsultationList, type ConsultationStatus, type ConsultationSubmission, consultationCapitals, consultationCities, consultationStatuses };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/consultation-model.ts
|
|
21
|
+
var consultation_model_exports = {};
|
|
22
|
+
__export(consultation_model_exports, {
|
|
23
|
+
consultationCapitals: () => consultationCapitals,
|
|
24
|
+
consultationCities: () => consultationCities,
|
|
25
|
+
consultationStatuses: () => consultationStatuses
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(consultation_model_exports);
|
|
28
|
+
var consultationStatuses = {
|
|
29
|
+
new: "M\u1EDBi",
|
|
30
|
+
contacted: "\u0110\xE3 li\xEAn h\u1EC7",
|
|
31
|
+
completed: "Ho\xE0n t\u1EA5t",
|
|
32
|
+
cancelled: "Kh\xF4ng ti\u1EBFp t\u1EE5c"
|
|
33
|
+
};
|
|
34
|
+
var consultationCities = { "ho-chi-minh-city": "TP. H\u1ED3 Ch\xED Minh", hanoi: "H\xE0 N\u1ED9i", other: "Kh\xE1c" };
|
|
35
|
+
var consultationCapitals = { "under-10m": "D\u01B0\u1EDBi 10 tri\u1EC7u", "10m-30m": "10\u201330 tri\u1EC7u", "30m-100m": "30\u2013100 tri\u1EC7u", "over-100m": "Tr\xEAn 100 tri\u1EC7u" };
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
consultationCapitals,
|
|
39
|
+
consultationCities,
|
|
40
|
+
consultationStatuses
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=consultation-model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/consultation-model.ts"],"sourcesContent":["export type ConsultationSubmission = {\n submissionId: string;\n name: string;\n phone: string;\n email: string;\n city: string;\n markets: string[];\n otherMarket: string;\n capital: string;\n language: 'vi' | 'en';\n sourcePath: string;\n website: string;\n};\n\nexport const consultationStatuses = {\n new: 'Mới', contacted: 'Đã liên hệ', completed: 'Hoàn tất', cancelled: 'Không tiếp tục',\n} as const;\nexport type ConsultationStatus = keyof typeof consultationStatuses;\nexport const consultationCities: Record<string, string> = { 'ho-chi-minh-city': 'TP. Hồ Chí Minh', hanoi: 'Hà Nội', other: 'Khác' };\nexport const consultationCapitals: Record<string, string> = { 'under-10m': 'Dưới 10 triệu', '10m-30m': '10–30 triệu', '30m-100m': '30–100 triệu', 'over-100m': 'Trên 100 triệu' };\nexport type Consultation = Omit<ConsultationSubmission, 'website' | 'submissionId'> & {\n id: string; status: ConsultationStatus; notes: string; createdAt: string; updatedAt: string;\n};\nexport type ConsultationList = { items: Consultation[]; total: number; page: number; pageSize: number };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcO,IAAM,uBAAuB;AAAA,EAClC,KAAK;AAAA,EAAO,WAAW;AAAA,EAAc,WAAW;AAAA,EAAY,WAAW;AACzE;AAEO,IAAM,qBAA6C,EAAE,oBAAoB,2BAAmB,OAAO,kBAAU,OAAO,UAAO;AAC3H,IAAM,uBAA+C,EAAE,aAAa,gCAAiB,WAAW,yBAAe,YAAY,0BAAgB,aAAa,yBAAiB;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/consultation-model.ts
|
|
2
|
+
var consultationStatuses = {
|
|
3
|
+
new: "M\u1EDBi",
|
|
4
|
+
contacted: "\u0110\xE3 li\xEAn h\u1EC7",
|
|
5
|
+
completed: "Ho\xE0n t\u1EA5t",
|
|
6
|
+
cancelled: "Kh\xF4ng ti\u1EBFp t\u1EE5c"
|
|
7
|
+
};
|
|
8
|
+
var consultationCities = { "ho-chi-minh-city": "TP. H\u1ED3 Ch\xED Minh", hanoi: "H\xE0 N\u1ED9i", other: "Kh\xE1c" };
|
|
9
|
+
var consultationCapitals = { "under-10m": "D\u01B0\u1EDBi 10 tri\u1EC7u", "10m-30m": "10\u201330 tri\u1EC7u", "30m-100m": "30\u2013100 tri\u1EC7u", "over-100m": "Tr\xEAn 100 tri\u1EC7u" };
|
|
10
|
+
export {
|
|
11
|
+
consultationCapitals,
|
|
12
|
+
consultationCities,
|
|
13
|
+
consultationStatuses
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=consultation-model.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/consultation-model.ts"],"sourcesContent":["export type ConsultationSubmission = {\n submissionId: string;\n name: string;\n phone: string;\n email: string;\n city: string;\n markets: string[];\n otherMarket: string;\n capital: string;\n language: 'vi' | 'en';\n sourcePath: string;\n website: string;\n};\n\nexport const consultationStatuses = {\n new: 'Mới', contacted: 'Đã liên hệ', completed: 'Hoàn tất', cancelled: 'Không tiếp tục',\n} as const;\nexport type ConsultationStatus = keyof typeof consultationStatuses;\nexport const consultationCities: Record<string, string> = { 'ho-chi-minh-city': 'TP. Hồ Chí Minh', hanoi: 'Hà Nội', other: 'Khác' };\nexport const consultationCapitals: Record<string, string> = { 'under-10m': 'Dưới 10 triệu', '10m-30m': '10–30 triệu', '30m-100m': '30–100 triệu', 'over-100m': 'Trên 100 triệu' };\nexport type Consultation = Omit<ConsultationSubmission, 'website' | 'submissionId'> & {\n id: string; status: ConsultationStatus; notes: string; createdAt: string; updatedAt: string;\n};\nexport type ConsultationList = { items: Consultation[]; total: number; page: number; pageSize: number };\n"],"mappings":";AAcO,IAAM,uBAAuB;AAAA,EAClC,KAAK;AAAA,EAAO,WAAW;AAAA,EAAc,WAAW;AAAA,EAAY,WAAW;AACzE;AAEO,IAAM,qBAA6C,EAAE,oBAAoB,2BAAmB,OAAO,kBAAU,OAAO,UAAO;AAC3H,IAAM,uBAA+C,EAAE,aAAa,gCAAiB,WAAW,yBAAe,YAAY,0BAAgB,aAAa,yBAAiB;","names":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ConsultationList, ConsultationStatus, Consultation } from './consultation-model.mjs';
|
|
3
|
+
export { ConsultationSubmission } from './consultation-model.mjs';
|
|
4
|
+
|
|
5
|
+
type ConsultationManagerProps = {
|
|
6
|
+
data: ConsultationList;
|
|
7
|
+
search: string;
|
|
8
|
+
status: ConsultationStatus | '';
|
|
9
|
+
loading: boolean;
|
|
10
|
+
busy: boolean;
|
|
11
|
+
canWrite: boolean;
|
|
12
|
+
notice: {
|
|
13
|
+
severity: 'success' | 'error';
|
|
14
|
+
message: string;
|
|
15
|
+
} | null;
|
|
16
|
+
onSearch: (value: string) => void;
|
|
17
|
+
onStatus: (value: ConsultationStatus | '') => void;
|
|
18
|
+
onPage: (page: number) => void;
|
|
19
|
+
onPageSize: (size: number) => void;
|
|
20
|
+
onReload: () => void;
|
|
21
|
+
onSave: (item: Consultation, status: ConsultationStatus, notes: string) => Promise<void>;
|
|
22
|
+
onDelete: (item: Consultation) => Promise<void>;
|
|
23
|
+
onDismissNotice: () => void;
|
|
24
|
+
};
|
|
25
|
+
declare function ConsultationManager({ data, search, status, loading, busy, canWrite, notice, onSearch, onStatus, onPage, onPageSize, onReload, onSave, onDelete, onDismissNotice }: ConsultationManagerProps): react.JSX.Element;
|
|
26
|
+
|
|
27
|
+
export { Consultation, ConsultationList, ConsultationManager, type ConsultationManagerProps, ConsultationStatus };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ConsultationList, ConsultationStatus, Consultation } from './consultation-model.js';
|
|
3
|
+
export { ConsultationSubmission } from './consultation-model.js';
|
|
4
|
+
|
|
5
|
+
type ConsultationManagerProps = {
|
|
6
|
+
data: ConsultationList;
|
|
7
|
+
search: string;
|
|
8
|
+
status: ConsultationStatus | '';
|
|
9
|
+
loading: boolean;
|
|
10
|
+
busy: boolean;
|
|
11
|
+
canWrite: boolean;
|
|
12
|
+
notice: {
|
|
13
|
+
severity: 'success' | 'error';
|
|
14
|
+
message: string;
|
|
15
|
+
} | null;
|
|
16
|
+
onSearch: (value: string) => void;
|
|
17
|
+
onStatus: (value: ConsultationStatus | '') => void;
|
|
18
|
+
onPage: (page: number) => void;
|
|
19
|
+
onPageSize: (size: number) => void;
|
|
20
|
+
onReload: () => void;
|
|
21
|
+
onSave: (item: Consultation, status: ConsultationStatus, notes: string) => Promise<void>;
|
|
22
|
+
onDelete: (item: Consultation) => Promise<void>;
|
|
23
|
+
onDismissNotice: () => void;
|
|
24
|
+
};
|
|
25
|
+
declare function ConsultationManager({ data, search, status, loading, busy, canWrite, notice, onSearch, onStatus, onPage, onPageSize, onReload, onSave, onDelete, onDismissNotice }: ConsultationManagerProps): react.JSX.Element;
|
|
26
|
+
|
|
27
|
+
export { Consultation, ConsultationList, ConsultationManager, type ConsultationManagerProps, ConsultationStatus };
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/consultations.ts
|
|
22
|
+
var consultations_exports = {};
|
|
23
|
+
__export(consultations_exports, {
|
|
24
|
+
ConsultationManager: () => ConsultationManager
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(consultations_exports);
|
|
27
|
+
|
|
28
|
+
// src/wikex/consultation-manager.tsx
|
|
29
|
+
var import_react = require("react");
|
|
30
|
+
var import_material = require("@mui/material");
|
|
31
|
+
|
|
32
|
+
// src/consultation-model.ts
|
|
33
|
+
var consultationStatuses = {
|
|
34
|
+
new: "M\u1EDBi",
|
|
35
|
+
contacted: "\u0110\xE3 li\xEAn h\u1EC7",
|
|
36
|
+
completed: "Ho\xE0n t\u1EA5t",
|
|
37
|
+
cancelled: "Kh\xF4ng ti\u1EBFp t\u1EE5c"
|
|
38
|
+
};
|
|
39
|
+
var consultationCities = { "ho-chi-minh-city": "TP. H\u1ED3 Ch\xED Minh", hanoi: "H\xE0 N\u1ED9i", other: "Kh\xE1c" };
|
|
40
|
+
var consultationCapitals = { "under-10m": "D\u01B0\u1EDBi 10 tri\u1EC7u", "10m-30m": "10\u201330 tri\u1EC7u", "30m-100m": "30\u2013100 tri\u1EC7u", "over-100m": "Tr\xEAn 100 tri\u1EC7u" };
|
|
41
|
+
|
|
42
|
+
// src/wikex/consultation-manager.tsx
|
|
43
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
44
|
+
var date = (value) => new Intl.DateTimeFormat("vi-VN", { timeZone: "Asia/Ho_Chi_Minh", dateStyle: "short", timeStyle: "short" }).format(new Date(value));
|
|
45
|
+
var city = (value) => consultationCities[value] || value || "Ch\u01B0a cung c\u1EA5p";
|
|
46
|
+
var capital = (value) => consultationCapitals[value] || value || "Ch\u01B0a cung c\u1EA5p";
|
|
47
|
+
function ConsultationManager({
|
|
48
|
+
data,
|
|
49
|
+
search,
|
|
50
|
+
status,
|
|
51
|
+
loading,
|
|
52
|
+
busy,
|
|
53
|
+
canWrite,
|
|
54
|
+
notice,
|
|
55
|
+
onSearch,
|
|
56
|
+
onStatus,
|
|
57
|
+
onPage,
|
|
58
|
+
onPageSize,
|
|
59
|
+
onReload,
|
|
60
|
+
onSave,
|
|
61
|
+
onDelete,
|
|
62
|
+
onDismissNotice
|
|
63
|
+
}) {
|
|
64
|
+
const [editing, setEditing] = (0, import_react.useState)(null);
|
|
65
|
+
const [deleting, setDeleting] = (0, import_react.useState)(null);
|
|
66
|
+
const [draftStatus, setDraftStatus] = (0, import_react.useState)("new");
|
|
67
|
+
const [notes, setNotes] = (0, import_react.useState)("");
|
|
68
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Stack, { spacing: 3, sx: { minWidth: 0 }, children: [
|
|
69
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Stack, { direction: { xs: "column", sm: "row" }, gap: 2, justifyContent: "space-between", alignItems: { sm: "center" }, children: [
|
|
70
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Stack, { spacing: 1, children: [
|
|
71
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "h4", children: "\u0110\u0103ng k\xFD t\u01B0 v\u1EA5n" }),
|
|
72
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "body2", color: "text.secondary", children: "Th\xF4ng tin t\u1EEB form \u0111\u0103ng k\xFD tr\xEAn website. Theo d\xF5i li\xEAn h\u1EC7 v\xE0 ghi ch\xFA x\u1EED l\xFD." })
|
|
73
|
+
] }),
|
|
74
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Button, { variant: "outlined", disabled: loading || busy, onClick: onReload, children: "T\u1EA3i l\u1EA1i danh s\xE1ch" })
|
|
75
|
+
] }),
|
|
76
|
+
!canWrite && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Alert, { severity: "info", children: "B\u1EA1n c\xF3 quy\u1EC1n xem \u0111\u0103ng k\xFD. C\u1EA7n quy\u1EC1n ch\u1EC9nh s\u1EEDa \u0111\u0103ng k\xFD t\u01B0 v\u1EA5n \u0111\u1EC3 c\u1EADp nh\u1EADt ho\u1EB7c x\xF3a." }),
|
|
77
|
+
notice && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Alert, { severity: notice.severity, onClose: onDismissNotice, children: notice.message }),
|
|
78
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Card, { sx: { p: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Stack, { direction: { xs: "column", sm: "row" }, spacing: 2, children: [
|
|
79
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.TextField, { size: "small", fullWidth: true, label: "T\xECm theo t\xEAn, \u0111i\u1EC7n tho\u1EA1i ho\u1EB7c email", value: search, disabled: busy, onChange: (event) => onSearch(event.target.value) }),
|
|
80
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.TextField, { select: true, size: "small", label: "Tr\u1EA1ng th\xE1i", value: status, disabled: busy, sx: { minWidth: 200 }, onChange: (event) => onStatus(event.target.value), children: [
|
|
81
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.MenuItem, { value: "", children: "T\u1EA5t c\u1EA3" }),
|
|
82
|
+
Object.entries(consultationStatuses).map(([key, label]) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.MenuItem, { value: key, children: label }, key))
|
|
83
|
+
] })
|
|
84
|
+
] }) }),
|
|
85
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Card, { "aria-busy": loading, sx: { opacity: loading ? 0.65 : 1 }, children: [
|
|
86
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Box, { sx: { overflowX: "auto" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Table, { "aria-label": "Danh s\xE1ch \u0111\u0103ng k\xFD t\u01B0 v\u1EA5n", sx: { minWidth: 1050 }, children: [
|
|
87
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.TableRow, { children: ["Kh\xE1ch h\xE0ng", "\u0110i\u1EC7n tho\u1EA1i / Email", "Khu v\u1EF1c", "Th\u1ECB tr\u01B0\u1EDDng / V\u1ED1n", "Tr\u1EA1ng th\xE1i", "Ng\xE0y g\u1EEDi", "Thao t\xE1c"].map((title) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.TableCell, { children: title }, title)) }) }),
|
|
88
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.TableBody, { children: [
|
|
89
|
+
data.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.TableRow, { children: [
|
|
90
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.TableCell, { sx: { maxWidth: 220, overflowWrap: "anywhere" }, children: [
|
|
91
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "subtitle2", children: item.name }),
|
|
92
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "caption", color: "text.secondary", children: item.language.toUpperCase() })
|
|
93
|
+
] }),
|
|
94
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.TableCell, { sx: { maxWidth: 260, overflowWrap: "anywhere" }, children: [
|
|
95
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "body2", children: item.phone }),
|
|
96
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "body2", color: "text.secondary", children: item.email })
|
|
97
|
+
] }),
|
|
98
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.TableCell, { children: city(item.city) }),
|
|
99
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.TableCell, { sx: { maxWidth: 220, overflowWrap: "anywhere" }, children: [
|
|
100
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "body2", children: item.markets.join(", ") || "Ch\u01B0a cung c\u1EA5p" }),
|
|
101
|
+
item.otherMarket && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Typography, { variant: "body2", children: [
|
|
102
|
+
"Kh\xE1c: ",
|
|
103
|
+
item.otherMarket
|
|
104
|
+
] }),
|
|
105
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "caption", color: "text.secondary", children: capital(item.capital) })
|
|
106
|
+
] }),
|
|
107
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Chip, { size: "small", label: consultationStatuses[item.status], color: item.status === "new" ? "warning" : item.status === "completed" ? "success" : "default" }) }),
|
|
108
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.TableCell, { sx: { whiteSpace: "nowrap" }, children: date(item.createdAt) }),
|
|
109
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Stack, { direction: "row", spacing: 1, children: [
|
|
110
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Button, { size: "small", disabled: busy, onClick: () => {
|
|
111
|
+
setEditing(item);
|
|
112
|
+
setDraftStatus(item.status);
|
|
113
|
+
setNotes(item.notes);
|
|
114
|
+
}, children: "Xem / x\u1EED l\xFD" }),
|
|
115
|
+
canWrite && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Button, { size: "small", color: "error", disabled: busy, onClick: () => setDeleting(item), children: "X\xF3a" })
|
|
116
|
+
] }) })
|
|
117
|
+
] }, item.id)),
|
|
118
|
+
!data.items.length && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.TableCell, { colSpan: 7, align: "center", sx: { py: 6 }, children: loading ? "\u0110ang t\u1EA3i \u0111\u0103ng k\xFD\u2026" : "Ch\u01B0a c\xF3 \u0111\u0103ng k\xFD ph\xF9 h\u1EE3p." }) })
|
|
119
|
+
] })
|
|
120
|
+
] }) }),
|
|
121
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
122
|
+
import_material.TablePagination,
|
|
123
|
+
{
|
|
124
|
+
component: "div",
|
|
125
|
+
count: data.total,
|
|
126
|
+
page: data.page - 1,
|
|
127
|
+
rowsPerPage: data.pageSize,
|
|
128
|
+
rowsPerPageOptions: [10, 25, 50, 100],
|
|
129
|
+
labelRowsPerPage: "S\u1ED1 d\xF2ng m\u1ED7i trang",
|
|
130
|
+
labelDisplayedRows: ({ from, to, count }) => `${from}\u2013${to} / ${count}`,
|
|
131
|
+
onPageChange: (_, next) => onPage(next + 1),
|
|
132
|
+
onRowsPerPageChange: (event) => onPageSize(Number(event.target.value)),
|
|
133
|
+
disabled: loading || busy,
|
|
134
|
+
slotProps: { select: { native: false }, actions: { previousButton: { "aria-label": "Trang tr\u01B0\u1EDBc" }, nextButton: { "aria-label": "Trang sau" } } }
|
|
135
|
+
}
|
|
136
|
+
)
|
|
137
|
+
] }),
|
|
138
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Dialog, { open: Boolean(editing), onClose: () => !busy && setEditing(null), fullWidth: true, maxWidth: "sm", children: [
|
|
139
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.DialogTitle, { children: "Chi ti\u1EBFt \u0111\u0103ng k\xFD t\u01B0 v\u1EA5n" }),
|
|
140
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.DialogContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Stack, { spacing: 2, sx: { pt: 1 }, children: [
|
|
141
|
+
notice?.severity === "error" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Alert, { severity: "error", children: notice.message }),
|
|
142
|
+
editing && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Stack, { spacing: 0.75, sx: { overflowWrap: "anywhere" }, children: [
|
|
143
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Typography, { children: [
|
|
144
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "H\u1ECD v\xE0 t\xEAn:" }),
|
|
145
|
+
" ",
|
|
146
|
+
editing.name
|
|
147
|
+
] }),
|
|
148
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Typography, { children: [
|
|
149
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "\u0110i\u1EC7n tho\u1EA1i:" }),
|
|
150
|
+
" ",
|
|
151
|
+
editing.phone
|
|
152
|
+
] }),
|
|
153
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Typography, { children: [
|
|
154
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "Email:" }),
|
|
155
|
+
" ",
|
|
156
|
+
editing.email
|
|
157
|
+
] }),
|
|
158
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Typography, { children: [
|
|
159
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "Khu v\u1EF1c:" }),
|
|
160
|
+
" ",
|
|
161
|
+
city(editing.city)
|
|
162
|
+
] }),
|
|
163
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Typography, { children: [
|
|
164
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "Th\u1ECB tr\u01B0\u1EDDng:" }),
|
|
165
|
+
" ",
|
|
166
|
+
editing.markets.join(", ") || "Ch\u01B0a cung c\u1EA5p",
|
|
167
|
+
editing.otherMarket ? ` \xB7 Kh\xE1c: ${editing.otherMarket}` : ""
|
|
168
|
+
] }),
|
|
169
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Typography, { children: [
|
|
170
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "S\u1ED1 v\u1ED1n:" }),
|
|
171
|
+
" ",
|
|
172
|
+
capital(editing.capital)
|
|
173
|
+
] }),
|
|
174
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Typography, { children: [
|
|
175
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "Trang g\u1EEDi:" }),
|
|
176
|
+
" ",
|
|
177
|
+
editing.sourcePath
|
|
178
|
+
] }),
|
|
179
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Typography, { children: [
|
|
180
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "Ng\xE0y g\u1EEDi:" }),
|
|
181
|
+
" ",
|
|
182
|
+
date(editing.createdAt)
|
|
183
|
+
] })
|
|
184
|
+
] }),
|
|
185
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.TextField, { select: true, label: "Tr\u1EA1ng th\xE1i x\u1EED l\xFD", value: draftStatus, disabled: busy || !canWrite, onChange: (event) => setDraftStatus(event.target.value), children: Object.entries(consultationStatuses).map(([key, label]) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.MenuItem, { value: key, children: label }, key)) }),
|
|
186
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.TextField, { label: "Ghi ch\xFA n\u1ED9i b\u1ED9", value: notes, disabled: busy || !canWrite, multiline: true, minRows: 4, inputProps: { maxLength: 5e3 }, onChange: (event) => setNotes(event.target.value) })
|
|
187
|
+
] }) }),
|
|
188
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.DialogActions, { children: [
|
|
189
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Button, { disabled: busy, onClick: () => setEditing(null), children: "\u0110\xF3ng" }),
|
|
190
|
+
canWrite && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Button, { variant: "contained", loading: busy, disabled: busy, onClick: async () => {
|
|
191
|
+
if (!editing) return;
|
|
192
|
+
try {
|
|
193
|
+
await onSave(editing, draftStatus, notes);
|
|
194
|
+
setEditing(null);
|
|
195
|
+
} catch {
|
|
196
|
+
}
|
|
197
|
+
}, children: "L\u01B0u x\u1EED l\xFD" })
|
|
198
|
+
] })
|
|
199
|
+
] }),
|
|
200
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Dialog, { open: Boolean(deleting), onClose: () => !busy && setDeleting(null), children: [
|
|
201
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.DialogTitle, { children: "X\xF3a \u0111\u0103ng k\xFD t\u01B0 v\u1EA5n?" }),
|
|
202
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.DialogContent, { children: [
|
|
203
|
+
notice?.severity === "error" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Alert, { severity: "error", sx: { mb: 2 }, children: notice.message }),
|
|
204
|
+
"Th\xF4ng tin \u0111\u0103ng k\xFD c\u1EE7a ",
|
|
205
|
+
deleting?.name,
|
|
206
|
+
" s\u1EBD b\u1ECB x\xF3a v\u0129nh vi\u1EC5n."
|
|
207
|
+
] }),
|
|
208
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.DialogActions, { children: [
|
|
209
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Button, { disabled: busy, onClick: () => setDeleting(null), children: "H\u1EE7y" }),
|
|
210
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Button, { color: "error", disabled: busy, onClick: async () => {
|
|
211
|
+
if (!deleting) return;
|
|
212
|
+
try {
|
|
213
|
+
await onDelete(deleting);
|
|
214
|
+
setDeleting(null);
|
|
215
|
+
} catch {
|
|
216
|
+
}
|
|
217
|
+
}, children: "X\xF3a \u0111\u0103ng k\xFD" })
|
|
218
|
+
] })
|
|
219
|
+
] })
|
|
220
|
+
] });
|
|
221
|
+
}
|
|
222
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
223
|
+
0 && (module.exports = {
|
|
224
|
+
ConsultationManager
|
|
225
|
+
});
|
|
226
|
+
//# sourceMappingURL=consultations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/consultations.ts","../src/wikex/consultation-manager.tsx","../src/consultation-model.ts"],"sourcesContent":["\"use client\";\nexport { ConsultationManager } from './wikex/consultation-manager';\nexport type { ConsultationManagerProps } from './wikex/consultation-manager';\nexport type { Consultation, ConsultationList, ConsultationStatus, ConsultationSubmission } from './consultation-model';\n","'use client';\n\nimport { useState } from 'react';\nimport { Alert, Box, Button, Card, Chip, Dialog, DialogActions, DialogContent, DialogTitle, MenuItem, Stack, Table, TableBody, TableCell, TableHead, TablePagination, TableRow, TextField, Typography } from '@mui/material';\nimport { consultationStatuses, consultationCities, consultationCapitals } from '../consultation-model';\nimport type { Consultation, ConsultationList, ConsultationStatus } from '../consultation-model';\n\nexport type ConsultationManagerProps = {\n data: ConsultationList;\n search: string;\n status: ConsultationStatus | '';\n loading: boolean;\n busy: boolean;\n canWrite: boolean;\n notice: { severity: 'success' | 'error'; message: string } | null;\n onSearch: (value: string) => void;\n onStatus: (value: ConsultationStatus | '') => void;\n onPage: (page: number) => void;\n onPageSize: (size: number) => void;\n onReload: () => void;\n onSave: (item: Consultation, status: ConsultationStatus, notes: string) => Promise<void>;\n onDelete: (item: Consultation) => Promise<void>;\n onDismissNotice: () => void;\n};\nconst date = (value: string) => new Intl.DateTimeFormat('vi-VN', { timeZone: 'Asia/Ho_Chi_Minh', dateStyle: 'short', timeStyle: 'short' }).format(new Date(value));\nconst city = (value: string) => consultationCities[value] || value || 'Chưa cung cấp';\nconst capital = (value: string) => consultationCapitals[value] || value || 'Chưa cung cấp';\n\nexport function ConsultationManager({ data, search, status, loading, busy, canWrite, notice, onSearch, onStatus,\n onPage, onPageSize, onReload, onSave, onDelete, onDismissNotice }: ConsultationManagerProps) {\n const [editing, setEditing] = useState<Consultation | null>(null);\n const [deleting, setDeleting] = useState<Consultation | null>(null);\n const [draftStatus, setDraftStatus] = useState<ConsultationStatus>('new');\n const [notes, setNotes] = useState('');\n return <Stack spacing={3} sx={{ minWidth: 0 }}>\n <Stack direction={{ xs: 'column', sm: 'row' }} gap={2} justifyContent=\"space-between\" alignItems={{ sm: 'center' }}>\n <Stack spacing={1}><Typography variant=\"h4\">Đăng ký tư vấn</Typography>\n <Typography variant=\"body2\" color=\"text.secondary\">Thông tin từ form đăng ký trên website. Theo dõi liên hệ và ghi chú xử lý.</Typography></Stack>\n <Button variant=\"outlined\" disabled={loading || busy} onClick={onReload}>Tải lại danh sách</Button>\n </Stack>\n {!canWrite && <Alert severity=\"info\">Bạn có quyền xem đăng ký. Cần quyền chỉnh sửa đăng ký tư vấn để cập nhật hoặc xóa.</Alert>}\n {notice && <Alert severity={notice.severity} onClose={onDismissNotice}>{notice.message}</Alert>}\n <Card sx={{ p: 3 }}><Stack direction={{ xs: 'column', sm: 'row' }} spacing={2}>\n <TextField size=\"small\" fullWidth label=\"Tìm theo tên, điện thoại hoặc email\" value={search} disabled={busy} onChange={event => onSearch(event.target.value)} />\n <TextField select size=\"small\" label=\"Trạng thái\" value={status} disabled={busy} sx={{ minWidth: 200 }} onChange={event => onStatus(event.target.value as ConsultationStatus | '')}>\n <MenuItem value=\"\">Tất cả</MenuItem>{Object.entries(consultationStatuses).map(([key, label]) => <MenuItem key={key} value={key}>{label}</MenuItem>)}\n </TextField>\n </Stack></Card>\n <Card aria-busy={loading} sx={{ opacity: loading ? 0.65 : 1 }}>\n <Box sx={{ overflowX: 'auto' }}><Table aria-label=\"Danh sách đăng ký tư vấn\" sx={{ minWidth: 1050 }}>\n <TableHead><TableRow>{['Khách hàng', 'Điện thoại / Email', 'Khu vực', 'Thị trường / Vốn', 'Trạng thái', 'Ngày gửi', 'Thao tác'].map(title => <TableCell key={title}>{title}</TableCell>)}</TableRow></TableHead>\n <TableBody>{data.items.map(item => <TableRow key={item.id}>\n <TableCell sx={{ maxWidth: 220, overflowWrap: 'anywhere' }}><Typography variant=\"subtitle2\">{item.name}</Typography><Typography variant=\"caption\" color=\"text.secondary\">{item.language.toUpperCase()}</Typography></TableCell>\n <TableCell sx={{ maxWidth: 260, overflowWrap: 'anywhere' }}><Typography variant=\"body2\">{item.phone}</Typography><Typography variant=\"body2\" color=\"text.secondary\">{item.email}</Typography></TableCell>\n <TableCell>{city(item.city)}</TableCell>\n <TableCell sx={{ maxWidth: 220, overflowWrap: 'anywhere' }}><Typography variant=\"body2\">{item.markets.join(', ') || 'Chưa cung cấp'}</Typography>{item.otherMarket && <Typography variant=\"body2\">Khác: {item.otherMarket}</Typography>}<Typography variant=\"caption\" color=\"text.secondary\">{capital(item.capital)}</Typography></TableCell>\n <TableCell><Chip size=\"small\" label={consultationStatuses[item.status]} color={item.status === 'new' ? 'warning' : item.status === 'completed' ? 'success' : 'default'} /></TableCell>\n <TableCell sx={{ whiteSpace: 'nowrap' }}>{date(item.createdAt)}</TableCell>\n <TableCell><Stack direction=\"row\" spacing={1}><Button size=\"small\" disabled={busy} onClick={() => { setEditing(item); setDraftStatus(item.status); setNotes(item.notes); }}>Xem / xử lý</Button>{canWrite && <Button size=\"small\" color=\"error\" disabled={busy} onClick={() => setDeleting(item)}>Xóa</Button>}</Stack></TableCell>\n </TableRow>)}{!data.items.length && <TableRow><TableCell colSpan={7} align=\"center\" sx={{ py: 6 }}>{loading ? 'Đang tải đăng ký…' : 'Chưa có đăng ký phù hợp.'}</TableCell></TableRow>}</TableBody>\n </Table></Box>\n <TablePagination component=\"div\" count={data.total} page={data.page - 1} rowsPerPage={data.pageSize}\n rowsPerPageOptions={[10, 25, 50, 100]} labelRowsPerPage=\"Số dòng mỗi trang\" labelDisplayedRows={({ from, to, count }) => `${from}–${to} / ${count}`}\n onPageChange={(_, next) => onPage(next + 1)} onRowsPerPageChange={event => onPageSize(Number(event.target.value))}\n disabled={loading || busy} slotProps={{ select: { native: false }, actions: { previousButton: { 'aria-label': 'Trang trước' }, nextButton: { 'aria-label': 'Trang sau' } } }} />\n </Card>\n <Dialog open={Boolean(editing)} onClose={() => !busy && setEditing(null)} fullWidth maxWidth=\"sm\">\n <DialogTitle>Chi tiết đăng ký tư vấn</DialogTitle><DialogContent><Stack spacing={2} sx={{ pt: 1 }}>\n {notice?.severity === 'error' && <Alert severity=\"error\">{notice.message}</Alert>}\n {editing && <Stack spacing={0.75} sx={{ overflowWrap: 'anywhere' }}>\n <Typography><strong>Họ và tên:</strong> {editing.name}</Typography><Typography><strong>Điện thoại:</strong> {editing.phone}</Typography><Typography><strong>Email:</strong> {editing.email}</Typography>\n <Typography><strong>Khu vực:</strong> {city(editing.city)}</Typography><Typography><strong>Thị trường:</strong> {editing.markets.join(', ') || 'Chưa cung cấp'}{editing.otherMarket ? ` · Khác: ${editing.otherMarket}` : ''}</Typography>\n <Typography><strong>Số vốn:</strong> {capital(editing.capital)}</Typography><Typography><strong>Trang gửi:</strong> {editing.sourcePath}</Typography><Typography><strong>Ngày gửi:</strong> {date(editing.createdAt)}</Typography>\n </Stack>}\n <TextField select label=\"Trạng thái xử lý\" value={draftStatus} disabled={busy || !canWrite} onChange={event => setDraftStatus(event.target.value as ConsultationStatus)}>\n {Object.entries(consultationStatuses).map(([key, label]) => <MenuItem key={key} value={key}>{label}</MenuItem>)}\n </TextField>\n <TextField label=\"Ghi chú nội bộ\" value={notes} disabled={busy || !canWrite} multiline minRows={4} inputProps={{ maxLength: 5000 }} onChange={event => setNotes(event.target.value)} />\n </Stack></DialogContent><DialogActions><Button disabled={busy} onClick={() => setEditing(null)}>Đóng</Button>{canWrite && <Button variant=\"contained\" loading={busy} disabled={busy} onClick={async () => {\n if (!editing) return;\n try { await onSave(editing, draftStatus, notes); setEditing(null); } catch { /* Host reports the error and retains the draft. */ }\n }}>Lưu xử lý</Button>}</DialogActions>\n </Dialog>\n <Dialog open={Boolean(deleting)} onClose={() => !busy && setDeleting(null)}><DialogTitle>Xóa đăng ký tư vấn?</DialogTitle><DialogContent>\n {notice?.severity === 'error' && <Alert severity=\"error\" sx={{ mb: 2 }}>{notice.message}</Alert>}\n Thông tin đăng ký của {deleting?.name} sẽ bị xóa vĩnh viễn.\n </DialogContent><DialogActions><Button disabled={busy} onClick={() => setDeleting(null)}>Hủy</Button><Button color=\"error\" disabled={busy} onClick={async () => {\n if (!deleting) return;\n try { await onDelete(deleting); setDeleting(null); } catch { /* Host reports the error. */ }\n }}>Xóa đăng ký</Button></DialogActions></Dialog>\n </Stack>;\n}\n","export type ConsultationSubmission = {\n submissionId: string;\n name: string;\n phone: string;\n email: string;\n city: string;\n markets: string[];\n otherMarket: string;\n capital: string;\n language: 'vi' | 'en';\n sourcePath: string;\n website: string;\n};\n\nexport const consultationStatuses = {\n new: 'Mới', contacted: 'Đã liên hệ', completed: 'Hoàn tất', cancelled: 'Không tiếp tục',\n} as const;\nexport type ConsultationStatus = keyof typeof consultationStatuses;\nexport const consultationCities: Record<string, string> = { 'ho-chi-minh-city': 'TP. Hồ Chí Minh', hanoi: 'Hà Nội', other: 'Khác' };\nexport const consultationCapitals: Record<string, string> = { 'under-10m': 'Dưới 10 triệu', '10m-30m': '10–30 triệu', '30m-100m': '30–100 triệu', 'over-100m': 'Trên 100 triệu' };\nexport type Consultation = Omit<ConsultationSubmission, 'website' | 'submissionId'> & {\n id: string; status: ConsultationStatus; notes: string; createdAt: string; updatedAt: string;\n};\nexport type ConsultationList = { items: Consultation[]; total: number; page: number; pageSize: number };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,mBAAyB;AACzB,sBAA6M;;;ACWtM,IAAM,uBAAuB;AAAA,EAClC,KAAK;AAAA,EAAO,WAAW;AAAA,EAAc,WAAW;AAAA,EAAY,WAAW;AACzE;AAEO,IAAM,qBAA6C,EAAE,oBAAoB,2BAAmB,OAAO,kBAAU,OAAO,UAAO;AAC3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