@esvndev/es-data-sharing 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +189 -14
- package/dist/component/common/dynamic-field-input.d.ts +11 -0
- package/dist/component/common/grid-column-builder.d.ts +10 -0
- package/dist/component/master-info/master-card.d.ts +1 -0
- package/dist/component/modal/batch-master-card.d.ts +10 -0
- package/dist/component/modal/data-sharing-content.d.ts +18 -0
- package/dist/component/modal/index.d.ts +24 -4
- package/dist/component/modal/modal-sharing.d.ts +7 -2
- package/dist/component/modal/sharing-helpers.d.ts +12 -0
- package/dist/component/org-detail/detail-tab-table.d.ts +10 -0
- package/dist/component/org-override/override-table.d.ts +2 -0
- package/dist/component/org-scope/org-table.d.ts +1 -0
- package/dist/index.d.ts +137 -16
- package/dist/index.js +694 -69
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +688 -72
- package/dist/index.mjs.map +1 -1
- package/dist/styles/index.css +209 -6
- package/dist/styles/index.css.map +1 -1
- package/dist/styles/modal.css +29 -5
- package/dist/styles/modal.css.map +1 -1
- package/dist/types/index.d.ts +61 -12
- package/package.json +5 -3
package/dist/index.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
3
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
6
|
var react = require('react');
|
|
7
|
+
var reactI18next = require('react-i18next');
|
|
5
8
|
var reactstrap = require('reactstrap');
|
|
9
|
+
var esGridTemplate = require('es-grid-template');
|
|
10
|
+
var becoxyIcons = require('becoxy-icons');
|
|
6
11
|
|
|
7
12
|
var classnames$1 = {exports: {}};
|
|
8
13
|
|
|
@@ -83,19 +88,62 @@ var classnames$1 = {exports: {}};
|
|
|
83
88
|
|
|
84
89
|
var classnames = classnames$1.exports;
|
|
85
90
|
|
|
86
|
-
const MasterCard = ({ title, fields, data, isGlobalShared, onToggleGlobalShared }) => {
|
|
87
|
-
|
|
91
|
+
const MasterCard = ({ title, fields, data, isGlobalShared, onToggleGlobalShared, showGlobalSharedSwitch = true }) => {
|
|
92
|
+
const { t } = reactI18next.useTranslation();
|
|
93
|
+
return (jsxRuntime.jsx(reactstrap.Card, { className: "border h-100 shadow-none mb-0 es-data-sharing-master-card", children: jsxRuntime.jsxs(reactstrap.CardBody, { className: "d-flex flex-column", children: [jsxRuntime.jsxs("div", { className: "d-flex align-items-center es-master-header", children: [jsxRuntime.jsx("div", { className: "avatar bg-light-primary me-2 es-master-avatar", children: jsxRuntime.jsx("span", { className: "avatar-content fs-5", children: "\uD83C\uDFE2" }) }), jsxRuntime.jsx("h5", { className: "mb-0 fw-bolder", children: t(title) })] }), jsxRuntime.jsx("div", { className: "master-fields-list flex-grow-1", children: fields.map(f => (jsxRuntime.jsxs("div", { className: "row mx-0 align-items-center es-master-field-row", children: [jsxRuntime.jsxs("label", { className: "col-5 ps-0 text-muted small mb-0", children: [t(f.label), ":"] }), jsxRuntime.jsx("div", { className: "col-7 pe-0 fw-bold text-truncate text-dark", title: data[f.key] ? String(data[f.key]) : '', children: data[f.key] !== undefined && data[f.key] !== null && data[f.key] !== '' ? String(data[f.key]) : '-' })] }, f.key))) }), showGlobalSharedSwitch && (jsxRuntime.jsx("div", { className: "mt-auto pt-3", children: jsxRuntime.jsxs("div", { className: `d-flex align-items-center justify-content-between es-global-shared-box ${isGlobalShared ? 'is-active' : ''}`, children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("div", { className: "fw-bold small text-primary", children: t('DataSharing_GlobalShared', 'Danh mục dùng chung toàn tập đoàn') }), jsxRuntime.jsx("div", { className: "text-muted", style: { fontSize: '11px' }, children: t('DataSharing_GlobalSharedDesc', 'Tự động cấp quyền sử dụng cho tất cả đơn vị thành viên') })] }), jsxRuntime.jsx("div", { className: "form-check form-switch mb-0", children: jsxRuntime.jsx(reactstrap.Input, { type: "switch", checked: isGlobalShared, onChange: e => onToggleGlobalShared(e.target.checked) }) })] }) }))] }) }));
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const BatchMasterCard = ({ title, items, isGlobalShared, onToggleGlobalShared, showGlobalSharedSwitch = true }) => {
|
|
97
|
+
const { t } = reactI18next.useTranslation();
|
|
98
|
+
return (jsxRuntime.jsx(reactstrap.Card, { className: "border h-100 shadow-none mb-0 es-data-sharing-master-card", children: jsxRuntime.jsxs(reactstrap.CardBody, { className: "d-flex flex-column", children: [jsxRuntime.jsxs("div", { className: "d-flex align-items-center justify-content-between es-master-header", children: [jsxRuntime.jsxs("div", { className: "d-flex align-items-center", children: [jsxRuntime.jsx("div", { className: "avatar bg-light-primary me-2 es-master-avatar", children: jsxRuntime.jsx("span", { className: "avatar-content fs-5", children: "\uD83D\uDCE6" }) }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("h5", { className: "mb-0 fw-bolder", children: t(title) }), jsxRuntime.jsx("small", { className: "text-muted", children: t('DataSharing_BatchModeSubtitle', 'Chế độ chia sẻ hàng loạt') })] })] }), jsxRuntime.jsxs(reactstrap.Badge, { color: "primary", pill: true, children: [items.length, " ", t('DataSharing_SelectedItems', 'đối tượng')] })] }), jsxRuntime.jsx("div", { className: "p-2 flex-grow-1 es-batch-items-list", children: items.map((item, idx) => (jsxRuntime.jsxs("div", { className: "d-flex align-items-center justify-content-between py-1 border-bottom last-no-border", children: [jsxRuntime.jsxs("div", { className: "text-truncate me-2", children: [jsxRuntime.jsx("span", { className: "fw-bold text-primary me-1", children: item.code || item.Code || '-' }), jsxRuntime.jsx("span", { className: "small text-dark", children: item.name || item.Name || '' })] }), item.taxCode && jsxRuntime.jsx("small", { className: "text-muted text-nowrap", children: item.taxCode })] }, item.id || item.Id || idx))) }), showGlobalSharedSwitch && (jsxRuntime.jsx("div", { className: "mt-auto pt-3", children: jsxRuntime.jsxs("div", { className: `d-flex align-items-center justify-content-between es-global-shared-box ${isGlobalShared ? 'is-active' : ''}`, children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("div", { className: "fw-bold small text-primary", children: t('DataSharing_GlobalShared', 'Danh mục dùng chung toàn tập đoàn') }), jsxRuntime.jsx("div", { className: "text-muted", style: { fontSize: '11px' }, children: t('DataSharing_GlobalSharedDesc', 'Tự động cấp quyền sử dụng cho tất cả đơn vị thành viên') })] }), jsxRuntime.jsx("div", { className: "form-check form-switch mb-0", children: jsxRuntime.jsx(reactstrap.Input, { type: "switch", checked: isGlobalShared, onChange: e => onToggleGlobalShared(e.target.checked) }) })] }) }))] }) }));
|
|
88
99
|
};
|
|
89
100
|
|
|
90
|
-
const OrgTable = ({ orgList, onChangeOrg }) => {
|
|
101
|
+
const OrgTable = ({ orgList, onChangeOrg, parentOrgName }) => {
|
|
102
|
+
const { t, i18n } = reactI18next.useTranslation();
|
|
91
103
|
const [search, setSearch] = react.useState('');
|
|
92
104
|
const [filterType, setFilterType] = react.useState('ALL');
|
|
93
|
-
const filtered = orgList.filter(o => {
|
|
105
|
+
const filtered = react.useMemo(() => orgList.filter(o => {
|
|
94
106
|
const matchSearch = o.orgName.toLowerCase().includes(search.toLowerCase()) ||
|
|
95
107
|
o.orgCode.toLowerCase().includes(search.toLowerCase());
|
|
96
108
|
const matchType = filterType === 'ALL' || o.orgType === filterType;
|
|
97
109
|
return matchSearch && matchType;
|
|
98
|
-
});
|
|
110
|
+
}), [orgList, search, filterType]);
|
|
111
|
+
const gridDataSource = react.useMemo(() => filtered.map(o => ({
|
|
112
|
+
...o,
|
|
113
|
+
rowId: o.targetOrgId,
|
|
114
|
+
statusText: o.isSelected
|
|
115
|
+
? t('DataSharing_Sharing', 'Đang chia sẻ')
|
|
116
|
+
: t('DataSharing_NotShared', 'Chưa chia sẻ')
|
|
117
|
+
})), [filtered, t]);
|
|
118
|
+
const selectedCount = orgList.filter(o => o.isSelected).length;
|
|
119
|
+
const overrideCount = orgList.filter(o => o.isSelected && o.canOverrideConfig).length;
|
|
120
|
+
const allFilteredSelected = filtered.length > 0 && filtered.every(o => o.isSelected);
|
|
121
|
+
const resolvedParentOrg = react.useMemo(() => {
|
|
122
|
+
if (parentOrgName)
|
|
123
|
+
return parentOrgName;
|
|
124
|
+
const rootOrg = orgList.find(o => !o.parentId);
|
|
125
|
+
if (!rootOrg)
|
|
126
|
+
return '';
|
|
127
|
+
return rootOrg.orgCode ? `${rootOrg.orgName} (${rootOrg.orgCode})` : rootOrg.orgName;
|
|
128
|
+
}, [parentOrgName, orgList]);
|
|
129
|
+
const handleToggleSelectAll = (checked) => {
|
|
130
|
+
const filteredIds = new Set(filtered.map(f => f.targetOrgId));
|
|
131
|
+
const next = orgList.map(item => {
|
|
132
|
+
if (!filteredIds.has(item.targetOrgId))
|
|
133
|
+
return item;
|
|
134
|
+
return {
|
|
135
|
+
...item,
|
|
136
|
+
isSelected: checked,
|
|
137
|
+
status: checked ? 1 : 0,
|
|
138
|
+
statusText: checked ? t('DataSharing_Sharing', 'Đang chia sẻ') : t('DataSharing_NotShared', 'Chưa chia sẻ')
|
|
139
|
+
};
|
|
140
|
+
});
|
|
141
|
+
onChangeOrg(next);
|
|
142
|
+
};
|
|
143
|
+
const handleToggleAllOverride = (enable) => {
|
|
144
|
+
const next = orgList.map(item => item.isSelected ? { ...item, canOverrideConfig: enable } : item);
|
|
145
|
+
onChangeOrg(next);
|
|
146
|
+
};
|
|
99
147
|
const handleSelectRow = (targetOrgId, checked) => {
|
|
100
148
|
const next = orgList.map(item => {
|
|
101
149
|
if (item.targetOrgId === targetOrgId) {
|
|
@@ -103,84 +151,591 @@ const OrgTable = ({ orgList, onChangeOrg }) => {
|
|
|
103
151
|
...item,
|
|
104
152
|
isSelected: checked,
|
|
105
153
|
status: checked ? 1 : 0,
|
|
106
|
-
statusText: checked ? 'Đang chia sẻ' : 'Chưa chia sẻ'
|
|
154
|
+
statusText: checked ? t('DataSharing_Sharing', 'Đang chia sẻ') : t('DataSharing_NotShared', 'Chưa chia sẻ')
|
|
107
155
|
};
|
|
108
156
|
}
|
|
109
157
|
return item;
|
|
110
158
|
});
|
|
111
159
|
onChangeOrg(next);
|
|
112
160
|
};
|
|
113
|
-
const
|
|
114
|
-
const next = orgList.map(item => item.targetOrgId === targetOrgId ? { ...item,
|
|
161
|
+
const handleFieldChange = (targetOrgId, field, value) => {
|
|
162
|
+
const next = orgList.map(item => item.targetOrgId === targetOrgId ? { ...item, [field]: value } : item);
|
|
115
163
|
onChangeOrg(next);
|
|
116
164
|
};
|
|
117
|
-
const
|
|
118
|
-
const
|
|
119
|
-
|
|
165
|
+
const handleCellChange = (args, handleCallback) => {
|
|
166
|
+
const item = args.rowData;
|
|
167
|
+
const field = args.field;
|
|
168
|
+
if (field === 'effectiveFrom' || field === 'effectiveTo') {
|
|
169
|
+
const rawVal = item?.[field];
|
|
170
|
+
const normalized = rawVal ? String(rawVal).substring(0, 10) : null;
|
|
171
|
+
handleFieldChange(item.targetOrgId, field, normalized);
|
|
172
|
+
}
|
|
173
|
+
handleCallback(item, args.indexRow);
|
|
120
174
|
};
|
|
121
|
-
|
|
175
|
+
const headerColumns = react.useMemo(() => [
|
|
176
|
+
{
|
|
177
|
+
field: 'isSelected',
|
|
178
|
+
headerText: '',
|
|
179
|
+
width: 50,
|
|
180
|
+
minWidth: 50,
|
|
181
|
+
maxWidth: 50,
|
|
182
|
+
textAlign: 'center',
|
|
183
|
+
fixedType: 'left',
|
|
184
|
+
allowFiltering: false,
|
|
185
|
+
allowSortering: false,
|
|
186
|
+
allowResizing: false,
|
|
187
|
+
editEnable: false,
|
|
188
|
+
headerTemplate: () => (jsxRuntime.jsx("div", { className: "d-flex justify-content-center", onClick: e => e.stopPropagation(), children: jsxRuntime.jsx(reactstrap.Input, { type: "checkbox", title: String(t('DataSharing_SelectAll', 'Chọn tất cả')), checked: allFilteredSelected, onChange: e => handleToggleSelectAll(e.target.checked) }) })),
|
|
189
|
+
template: (props) => (jsxRuntime.jsx("div", { className: "d-flex justify-content-center", onClick: e => e.stopPropagation(), children: jsxRuntime.jsx(reactstrap.Input, { type: "checkbox", checked: Boolean(props.rowData?.isSelected), onChange: e => handleSelectRow(props.rowData?.targetOrgId, e.target.checked) }) }))
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
field: 'orgName',
|
|
193
|
+
headerText: String(t('DataSharing_Organization', 'Đơn vị')),
|
|
194
|
+
headerTooltip: String(t('DataSharing_Organization', 'Đơn vị')),
|
|
195
|
+
width: 260,
|
|
196
|
+
minWidth: 160,
|
|
197
|
+
fixedType: 'left',
|
|
198
|
+
editEnable: false,
|
|
199
|
+
template: (props) => (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("div", { className: "fw-bold", children: props.rowData?.orgName }), jsxRuntime.jsxs("span", { className: "text-muted small", children: ["(", props.rowData?.orgCode, ")"] })] }))
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
field: 'orgType',
|
|
203
|
+
headerText: String(t('DataSharing_OrgType', 'Loại')),
|
|
204
|
+
headerTooltip: String(t('DataSharing_OrgType', 'Loại')),
|
|
205
|
+
width: 110,
|
|
206
|
+
minWidth: 95,
|
|
207
|
+
textAlign: 'center',
|
|
208
|
+
visible: false,
|
|
209
|
+
editEnable: false,
|
|
210
|
+
template: (props) => (jsxRuntime.jsx(reactstrap.Badge, { color: props.rowData?.orgType === 'Công ty' ? 'light-primary' : 'light-info', children: props.rowData?.orgType === 'Công ty'
|
|
211
|
+
? t('DataSharing_Company', 'Công ty')
|
|
212
|
+
: t('DataSharing_Branch', 'Chi nhánh') }))
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
field: 'isInheritMaster',
|
|
216
|
+
headerText: String(t('DataSharing_InheritMaster', 'Kế thừa gốc')),
|
|
217
|
+
headerTooltip: String(t('DataSharing_InheritMaster', 'Kế thừa gốc')),
|
|
218
|
+
width: 115,
|
|
219
|
+
minWidth: 100,
|
|
220
|
+
textAlign: 'center',
|
|
221
|
+
visible: false,
|
|
222
|
+
allowFiltering: false,
|
|
223
|
+
editEnable: false,
|
|
224
|
+
template: (props) => (jsxRuntime.jsx("div", { className: "form-check form-switch d-flex justify-content-center mb-0", onClick: e => e.stopPropagation(), children: jsxRuntime.jsx(reactstrap.Input, { type: "switch", checked: Boolean(props.rowData?.isInheritMaster), onChange: e => handleFieldChange(props.rowData?.targetOrgId, 'isInheritMaster', e.target.checked) }) }))
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
field: 'canOverrideConfig',
|
|
228
|
+
headerText: String(t('DataSharing_CanOverride', 'Cấu hình riêng')),
|
|
229
|
+
headerTooltip: String(t('DataSharing_CanOverride', 'Cấu hình riêng')),
|
|
230
|
+
width: 125,
|
|
231
|
+
minWidth: 110,
|
|
232
|
+
textAlign: 'center',
|
|
233
|
+
allowFiltering: false,
|
|
234
|
+
editEnable: false,
|
|
235
|
+
template: (props) => (jsxRuntime.jsx("div", { className: "form-check form-switch d-flex justify-content-center mb-0", onClick: e => e.stopPropagation(), children: jsxRuntime.jsx(reactstrap.Input, { type: "switch", disabled: !props.rowData?.isSelected, checked: Boolean(props.rowData?.canOverrideConfig), onChange: e => handleFieldChange(props.rowData?.targetOrgId, 'canOverrideConfig', e.target.checked) }) }))
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
field: 'effectiveFrom',
|
|
239
|
+
headerText: String(t('DataSharing_EffectiveFrom', 'Hiệu lực từ')),
|
|
240
|
+
headerTooltip: String(t('DataSharing_EffectiveFrom', 'Hiệu lực từ')),
|
|
241
|
+
type: 'date',
|
|
242
|
+
editType: 'date',
|
|
243
|
+
textAlign: 'center',
|
|
244
|
+
visible: false,
|
|
245
|
+
width: 145,
|
|
246
|
+
minWidth: 120,
|
|
247
|
+
editEnable: (rowData) => Boolean(rowData?.isSelected)
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
field: 'effectiveTo',
|
|
251
|
+
headerText: String(t('DataSharing_EffectiveTo', 'Hiệu lực đến')),
|
|
252
|
+
headerTooltip: String(t('DataSharing_EffectiveTo', 'Hiệu lực đến')),
|
|
253
|
+
type: 'date',
|
|
254
|
+
editType: 'date',
|
|
255
|
+
textAlign: 'center',
|
|
256
|
+
visible: false,
|
|
257
|
+
width: 145,
|
|
258
|
+
minWidth: 120,
|
|
259
|
+
editEnable: (rowData) => Boolean(rowData?.isSelected)
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
field: 'statusText',
|
|
263
|
+
headerText: String(t('DataSharing_Status', 'Trạng thái')),
|
|
264
|
+
headerTooltip: String(t('DataSharing_Status', 'Trạng thái')),
|
|
265
|
+
width: 125,
|
|
266
|
+
minWidth: 105,
|
|
267
|
+
textAlign: 'center',
|
|
268
|
+
visible: false,
|
|
269
|
+
editEnable: false,
|
|
270
|
+
template: (props) => props.rowData?.isSelected ? (jsxRuntime.jsx("span", { className: "badge bg-light-success text-success", children: t('DataSharing_Sharing', 'Đang chia sẻ') })) : (jsxRuntime.jsx("span", { className: "badge bg-light-secondary text-secondary", children: t('DataSharing_NotShared', 'Chưa chia sẻ') }))
|
|
271
|
+
}
|
|
272
|
+
], [allFilteredSelected, orgList, filtered, t]);
|
|
273
|
+
return (jsxRuntime.jsx(reactstrap.Card, { className: "border h-100 shadow-none mb-0 es-data-sharing-org-scope", children: jsxRuntime.jsxs(reactstrap.CardBody, { className: "d-flex flex-column", children: [jsxRuntime.jsxs("div", { className: "d-flex flex-wrap justify-content-between align-items-center mb-2 gap-2", children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("h5", { className: "mb-0 fw-bolder", children: t('DataSharing_OrgScope', 'Phạm vi chia sẻ xuống đơn vị') }), jsxRuntime.jsxs("div", { className: "d-flex align-items-center gap-2 mt-1", children: [jsxRuntime.jsxs(reactstrap.Badge, { color: "light-primary", className: "text-primary", children: [t('DataSharing_Sharing', 'Đang chia sẻ'), ": ", selectedCount, "/", orgList.length] }), jsxRuntime.jsxs(reactstrap.Badge, { color: "light-info", className: "text-info", children: [t('DataSharing_CanOverride', 'Cấu hình riêng'), ": ", overrideCount] })] })] }), jsxRuntime.jsxs("div", { className: "d-flex align-items-center gap-1", style: { minWidth: '280px' }, children: [jsxRuntime.jsx(reactstrap.Input, { type: "search", bsSize: "sm", placeholder: t('DataSharing_SearchOrg', 'Tìm kiếm đơn vị...'), value: search, onChange: e => setSearch(e.target.value) }), jsxRuntime.jsxs(reactstrap.Input, { type: "select", bsSize: "sm", style: { width: '125px' }, value: filterType, onChange: e => setFilterType(e.target.value), children: [jsxRuntime.jsx("option", { value: "ALL", children: t('DataSharing_All', 'Tất cả') }), jsxRuntime.jsx("option", { value: "C\u00F4ng ty", children: t('DataSharing_Company', 'Công ty') }), jsxRuntime.jsx("option", { value: "Chi nh\u00E1nh", children: t('DataSharing_Branch', 'Chi nhánh') })] })] })] }), (resolvedParentOrg || selectedCount > 0) && (jsxRuntime.jsxs("div", { className: "d-flex flex-wrap justify-content-between align-items-center gap-2 mb-2", children: [jsxRuntime.jsx("div", { children: resolvedParentOrg && (jsxRuntime.jsxs("div", { className: "es-parent-org-pill", children: [jsxRuntime.jsxs("span", { className: "text-muted", children: [t('DataSharing_ParentOrg', 'Công ty mẹ'), ":"] }), jsxRuntime.jsxs("span", { className: "fw-bold text-primary", children: ["\uD83C\uDFE2 ", resolvedParentOrg] })] })) }), selectedCount > 0 && (jsxRuntime.jsxs("div", { className: "d-flex gap-2 ms-auto", children: [jsxRuntime.jsx(reactstrap.Button, { size: "sm", color: "primary", outline: true, className: "py-0 px-2", style: { fontSize: '12px' }, onClick: () => handleToggleAllOverride(true), children: t('DataSharing_EnableAllOverride', 'Cho phép tất cả cấu hình riêng') }), jsxRuntime.jsx(reactstrap.Button, { size: "sm", color: "secondary", outline: true, className: "py-0 px-2", style: { fontSize: '12px' }, onClick: () => handleToggleAllOverride(false), children: t('DataSharing_DisableAllOverride', 'Chỉ kế thừa gốc') })] }))] })), jsxRuntime.jsx("div", { className: "flex-grow-1 es-data-sharing-grid-wrap", style: { minHeight: 0 }, children: jsxRuntime.jsx(esGridTemplate.GridComponent, { dataSource: gridDataSource, editAble: false, rowEditable: (rowData) => Boolean(rowData?.isSelected), lang: i18n.language || 'vi', showToolbar: false, toolbarItems: [], columns: headerColumns, onCellChange: handleCellChange, onRowStyles: (rowData) => rowData?.isSelected ? { backgroundColor: 'rgba(115, 103, 240, 0.06)' } : {}, height: 360, allowResizing: true, t: t, showEmptyText: false }, "DataSharingOrgScopeGrid") })] }) }));
|
|
122
274
|
};
|
|
123
275
|
|
|
124
|
-
|
|
276
|
+
function resolveFieldDisplayValue(field, rowData, rawVal) {
|
|
277
|
+
const fieldKey = field.fieldKey ?? 'value';
|
|
278
|
+
const fieldLabel = field.fieldLabel ?? 'label';
|
|
279
|
+
if (field.type === 'select' || field.type === 'selectTable') {
|
|
280
|
+
const found = (field.options ?? []).find(opt => opt?.[fieldKey] === rawVal ||
|
|
281
|
+
opt?.value === rawVal ||
|
|
282
|
+
(opt?.key !== undefined && rowData?.bankCode && opt.key === rowData.bankCode));
|
|
283
|
+
if (found) {
|
|
284
|
+
return found.name || found[fieldLabel] || rawVal;
|
|
285
|
+
}
|
|
286
|
+
return rowData?.name || rawVal || '';
|
|
287
|
+
}
|
|
288
|
+
return rawVal ?? '';
|
|
289
|
+
}
|
|
290
|
+
function buildGridColumns(fields, options) {
|
|
291
|
+
const { t, isFieldEditable, formatDisplayValue } = options;
|
|
292
|
+
return fields.map(field => {
|
|
293
|
+
const fieldKey = field.fieldKey ?? 'value';
|
|
294
|
+
const fieldLabel = field.fieldLabel ?? 'label';
|
|
295
|
+
const numericWidth = typeof field.width === 'number' ? field.width : 170;
|
|
296
|
+
let editType = 'text';
|
|
297
|
+
let type = undefined;
|
|
298
|
+
if (field.type === 'select') {
|
|
299
|
+
editType = 'select';
|
|
300
|
+
}
|
|
301
|
+
else if (field.type === 'selectTable') {
|
|
302
|
+
editType = 'selectTable';
|
|
303
|
+
}
|
|
304
|
+
else if (field.type === 'number' || field.type === 'numeric') {
|
|
305
|
+
editType = 'numeric';
|
|
306
|
+
type = 'number';
|
|
307
|
+
}
|
|
308
|
+
else if (field.type === 'currency') {
|
|
309
|
+
editType = 'currency';
|
|
310
|
+
type = 'number';
|
|
311
|
+
}
|
|
312
|
+
else if (field.type === 'date') {
|
|
313
|
+
editType = 'date';
|
|
314
|
+
type = 'date';
|
|
315
|
+
}
|
|
316
|
+
else if (field.type === 'checkbox' || field.type === 'switch') {
|
|
317
|
+
editType = 'checkbox';
|
|
318
|
+
type = 'checkbox';
|
|
319
|
+
}
|
|
320
|
+
const col = {
|
|
321
|
+
field: field.key,
|
|
322
|
+
headerText: field.label,
|
|
323
|
+
headerTooltip: String(t(field.label, field.label)),
|
|
324
|
+
width: numericWidth,
|
|
325
|
+
minWidth: Math.min(numericWidth, 120),
|
|
326
|
+
type,
|
|
327
|
+
editType,
|
|
328
|
+
textAlign: field.textAlign,
|
|
329
|
+
fixedType: field.fixedType,
|
|
330
|
+
editEnable: (rowData) => {
|
|
331
|
+
if (field.readonly)
|
|
332
|
+
return false;
|
|
333
|
+
return isFieldEditable ? isFieldEditable(field, rowData) : true;
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
if (field.type === 'select') {
|
|
337
|
+
col.editSelectSettings = {
|
|
338
|
+
options: field.options ?? [],
|
|
339
|
+
fieldLabel: fieldLabel
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
else if (field.type === 'selectTable') {
|
|
343
|
+
col.editSelectSettings = {
|
|
344
|
+
options: field.options ?? [],
|
|
345
|
+
fieldLabel: fieldLabel,
|
|
346
|
+
fieldKey: fieldKey,
|
|
347
|
+
columns: field.selectTableColumns ?? [],
|
|
348
|
+
menuWidth: field.menuWidth ?? 580
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
if (field.type === 'checkbox' || field.type === 'switch') {
|
|
352
|
+
col.textAlign = field.textAlign ?? 'center';
|
|
353
|
+
col.template = (props) => (jsxRuntime.jsx(reactstrap.Input, { className: "form-check-input", type: "checkbox", disabled: true, checked: Boolean(props.rowData?.[field.key]), value: props.rowData?.[field.key] }));
|
|
354
|
+
}
|
|
355
|
+
else if (field.type === 'select' || field.type === 'selectTable' || formatDisplayValue) {
|
|
356
|
+
col.template = (props) => {
|
|
357
|
+
const rawVal = props.rowData?.[field.key];
|
|
358
|
+
const resolved = resolveFieldDisplayValue(field, props.rowData, rawVal);
|
|
359
|
+
if (formatDisplayValue) {
|
|
360
|
+
return formatDisplayValue(field, props.rowData, resolved);
|
|
361
|
+
}
|
|
362
|
+
return resolved ?? '';
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
return col;
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
const OverrideTable = ({ orgList, overrideColumns, masterData, onChangeOverride, onApplyFirstToAll }) => {
|
|
370
|
+
const { t, i18n } = reactI18next.useTranslation();
|
|
125
371
|
const selectedOrgs = orgList.filter(o => o.isSelected);
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
372
|
+
const editableOrgs = selectedOrgs.filter(o => o.canOverrideConfig);
|
|
373
|
+
const gridDataSource = react.useMemo(() => selectedOrgs.map(org => {
|
|
374
|
+
const row = {
|
|
375
|
+
rowId: org.targetOrgId,
|
|
376
|
+
targetOrgId: org.targetOrgId,
|
|
377
|
+
orgName: org.orgName,
|
|
378
|
+
orgCode: org.orgCode,
|
|
379
|
+
_canOverrideConfig: Boolean(org.canOverrideConfig)
|
|
380
|
+
};
|
|
381
|
+
overrideColumns.forEach(col => {
|
|
382
|
+
if (org.canOverrideConfig) {
|
|
383
|
+
row[col.key] = org.overrideData?.[col.key] ?? col.defaultValue ?? '';
|
|
384
|
+
}
|
|
385
|
+
else {
|
|
386
|
+
row[col.key] = masterData?.[col.key] ?? '';
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
return row;
|
|
390
|
+
}), [selectedOrgs, overrideColumns, masterData]);
|
|
391
|
+
const headerColumns = react.useMemo(() => {
|
|
392
|
+
const baseCols = [
|
|
393
|
+
{
|
|
394
|
+
field: '#',
|
|
395
|
+
headerText: 'STT',
|
|
396
|
+
textAlign: 'center',
|
|
397
|
+
width: 50,
|
|
398
|
+
minWidth: 50,
|
|
399
|
+
maxWidth: 70,
|
|
400
|
+
fixedType: 'left'
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
field: 'orgName',
|
|
404
|
+
headerText: t('DataSharing_Organization', 'Đơn vị'),
|
|
405
|
+
headerTooltip: t('DataSharing_Organization', 'Đơn vị'),
|
|
406
|
+
width: 220,
|
|
407
|
+
minWidth: 180,
|
|
408
|
+
fixedType: 'left',
|
|
409
|
+
editEnable: false,
|
|
410
|
+
template: (props) => (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("div", { className: "fw-bold", children: props.rowData?.orgName }), jsxRuntime.jsxs("small", { className: "text-muted", children: ["(", props.rowData?.orgCode, ")"] })] }))
|
|
411
|
+
}
|
|
412
|
+
];
|
|
413
|
+
const dynamicCols = buildGridColumns(overrideColumns, {
|
|
414
|
+
t,
|
|
415
|
+
isFieldEditable: (_field, rowData) => Boolean(rowData?._canOverrideConfig),
|
|
416
|
+
formatDisplayValue: (_field, rowData, resolved) => {
|
|
417
|
+
if (!rowData?._canOverrideConfig) {
|
|
418
|
+
const hasMasterVal = resolved !== undefined && resolved !== null && resolved !== '';
|
|
419
|
+
return (jsxRuntime.jsx("span", { className: "text-muted fst-italic", children: hasMasterVal
|
|
420
|
+
? `${t('DataSharing_InheritFromMaster', 'Kế thừa')}: ${String(resolved)}`
|
|
421
|
+
: t('DataSharing_InheritFromMaster', 'Kế thừa từ gốc') }));
|
|
422
|
+
}
|
|
423
|
+
return resolved ?? '';
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
return [...baseCols, ...dynamicCols];
|
|
427
|
+
}, [overrideColumns, t]);
|
|
428
|
+
const handleCellChange = (args, handleCallback) => {
|
|
429
|
+
const item = args.rowData;
|
|
430
|
+
const field = args.field;
|
|
431
|
+
if (field && item?._canOverrideConfig) {
|
|
432
|
+
onChangeOverride(item.targetOrgId, field, item[field]);
|
|
433
|
+
}
|
|
434
|
+
handleCallback(item, args.indexRow);
|
|
435
|
+
};
|
|
436
|
+
return (jsxRuntime.jsxs("div", { className: "es-data-sharing-override-table", children: [editableOrgs.length > 1 && onApplyFirstToAll && (jsxRuntime.jsx("div", { className: "d-flex justify-content-end mb-2", children: jsxRuntime.jsxs(reactstrap.Button, { size: "sm", color: "primary", outline: true, className: "py-0 px-2", style: { fontSize: '12px' }, onClick: onApplyFirstToAll, children: ["\uD83D\uDCCB ", t('DataSharing_ApplyFirstToAll', 'Áp dụng cấu hình dòng đầu cho các đơn vị khác')] }) })), selectedOrgs.length === 0 ? (jsxRuntime.jsx("div", { className: "border rounded text-center text-muted py-4 bg-light small", children: t('DataSharing_NoOrgSelected', 'Chưa có đơn vị nào được chọn chia sẻ ở bảng trên.') })) : (jsxRuntime.jsx("div", { className: "es-data-sharing-grid-wrap", children: jsxRuntime.jsx(esGridTemplate.GridComponent, { dataSource: gridDataSource, editAble: editableOrgs.length > 0, rowEditable: (rowData) => Boolean(rowData?._canOverrideConfig), lang: i18n.language || 'vi', showToolbar: false, toolbarItems: [], columns: headerColumns, onCellChange: handleCellChange, height: 280, allowResizing: true, t: t, format: {
|
|
437
|
+
decimalSeparator: '.',
|
|
438
|
+
thousandSeparator: ',',
|
|
439
|
+
decimalScale: 0
|
|
440
|
+
}, showEmptyText: false }, "DataSharingOverrideGrid") })), jsxRuntime.jsxs("div", { className: "d-flex align-items-center mt-2 es-override-note", children: [jsxRuntime.jsx("span", { className: "me-1", children: "\u2139\uFE0F" }), jsxRuntime.jsx("span", { children: t('DataSharing_OverrideNote', 'Thông tin gốc do công ty mẹ quản lý. Các đơn vị được bật "Cấu hình riêng" sẽ có thể nhập thông số riêng tại đây.') })] })] }));
|
|
133
441
|
};
|
|
134
442
|
|
|
135
|
-
const
|
|
136
|
-
const
|
|
443
|
+
const DetailTabTable = ({ tabConfig, orgList, rows, onChangeRows }) => {
|
|
444
|
+
const { t, i18n } = reactI18next.useTranslation();
|
|
445
|
+
const selectedOrgs = orgList.filter(o => o.isSelected);
|
|
446
|
+
const availableOrgs = selectedOrgs.length > 0 ? selectedOrgs : orgList;
|
|
447
|
+
const orgOptions = react.useMemo(() => [
|
|
448
|
+
{ label: t('DataSharing_SharedForAllOrgs', 'Dùng chung toàn tập đoàn'), value: '' },
|
|
449
|
+
...availableOrgs.map(org => ({
|
|
450
|
+
label: `${org.orgName} (${org.orgCode})`,
|
|
451
|
+
value: org.targetOrgId
|
|
452
|
+
}))
|
|
453
|
+
], [availableOrgs, t]);
|
|
454
|
+
const defaultValue = react.useMemo(() => {
|
|
455
|
+
const base = {
|
|
456
|
+
organizationId: '',
|
|
457
|
+
...(tabConfig.defaultRow ?? {})
|
|
458
|
+
};
|
|
459
|
+
tabConfig.columns.forEach(col => {
|
|
460
|
+
if (base[col.key] === undefined && col.defaultValue !== undefined) {
|
|
461
|
+
base[col.key] = col.defaultValue;
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
return base;
|
|
465
|
+
}, [tabConfig]);
|
|
466
|
+
const activeGridRows = react.useMemo(() => (rows ?? [])
|
|
467
|
+
.filter(r => !r._deleted)
|
|
468
|
+
.map(r => ({
|
|
469
|
+
...r,
|
|
470
|
+
organizationId: r.organizationId ?? ''
|
|
471
|
+
})), [rows]);
|
|
472
|
+
const emitUpdatedRows = (nextActiveRows) => {
|
|
473
|
+
const normalizedActive = (nextActiveRows ?? []).map((row, idx) => ({
|
|
474
|
+
...row,
|
|
475
|
+
organizationId: row.organizationId ? String(row.organizationId) : null,
|
|
476
|
+
sortOrder: idx + 1
|
|
477
|
+
}));
|
|
478
|
+
// Enforce uniqueScopeKey checkboxes across updated rows
|
|
479
|
+
tabConfig.columns.forEach(col => {
|
|
480
|
+
if ((col.type === 'checkbox' || col.type === 'switch') && col.uniqueScopeKey !== undefined) {
|
|
481
|
+
const seen = new Set();
|
|
482
|
+
normalizedActive.forEach(r => {
|
|
483
|
+
const scopeVal = r[col.uniqueScopeKey] ? String(r[col.uniqueScopeKey]) : '';
|
|
484
|
+
if (r[col.key]) {
|
|
485
|
+
if (seen.has(scopeVal)) {
|
|
486
|
+
r[col.key] = false;
|
|
487
|
+
}
|
|
488
|
+
else {
|
|
489
|
+
seen.add(scopeVal);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
const activeIds = new Set(normalizedActive.map(r => r.id).filter(Boolean));
|
|
496
|
+
const softDeletedPersisted = (rows ?? [])
|
|
497
|
+
.filter(r => r.id && !activeIds.has(r.id))
|
|
498
|
+
.map(r => ({ ...r, _deleted: true }));
|
|
499
|
+
onChangeRows([...normalizedActive, ...softDeletedPersisted]);
|
|
500
|
+
};
|
|
501
|
+
const headerColumns = react.useMemo(() => {
|
|
502
|
+
const baseCols = [
|
|
503
|
+
{
|
|
504
|
+
field: '#',
|
|
505
|
+
headerText: 'STT',
|
|
506
|
+
textAlign: 'center',
|
|
507
|
+
width: 50,
|
|
508
|
+
minWidth: 50,
|
|
509
|
+
maxWidth: 70,
|
|
510
|
+
fixedType: 'left'
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
field: 'organizationId',
|
|
514
|
+
headerText: t('DataSharing_Organization', 'Đơn vị áp dụng'),
|
|
515
|
+
headerTooltip: t('DataSharing_Organization', 'Đơn vị áp dụng'),
|
|
516
|
+
editType: 'select',
|
|
517
|
+
editEnable: true,
|
|
518
|
+
editSelectSettings: {
|
|
519
|
+
options: orgOptions,
|
|
520
|
+
fieldLabel: 'label'
|
|
521
|
+
},
|
|
522
|
+
template: (props) => {
|
|
523
|
+
const orgId = props.rowData?.organizationId ?? '';
|
|
524
|
+
if (!orgId) {
|
|
525
|
+
return t('DataSharing_SharedForAllOrgs', 'Dùng chung toàn tập đoàn');
|
|
526
|
+
}
|
|
527
|
+
const found = orgList.find(o => String(o.targetOrgId).toLowerCase() === String(orgId).toLowerCase());
|
|
528
|
+
return found ? `${found.orgName} (${found.orgCode})` : orgId;
|
|
529
|
+
},
|
|
530
|
+
width: 230,
|
|
531
|
+
minWidth: 180
|
|
532
|
+
}
|
|
533
|
+
];
|
|
534
|
+
const dynamicCols = buildGridColumns(tabConfig.columns, { t });
|
|
535
|
+
const commandCols = tabConfig.allowDelete === false
|
|
536
|
+
? []
|
|
537
|
+
: [
|
|
538
|
+
{
|
|
539
|
+
field: 'command',
|
|
540
|
+
visible: true,
|
|
541
|
+
textAlign: 'center',
|
|
542
|
+
fixedType: 'right',
|
|
543
|
+
width: 50,
|
|
544
|
+
minWidth: 50,
|
|
545
|
+
maxWidth: 50,
|
|
546
|
+
commandItems: [
|
|
547
|
+
{
|
|
548
|
+
id: 'DELETE',
|
|
549
|
+
title: '',
|
|
550
|
+
icon: jsxRuntime.jsx(becoxyIcons.Trash2, { fontSize: 16 }),
|
|
551
|
+
tooltip: String(t('Delete', 'Xóa'))
|
|
552
|
+
}
|
|
553
|
+
]
|
|
554
|
+
}
|
|
555
|
+
];
|
|
556
|
+
return [...baseCols, ...dynamicCols, ...commandCols];
|
|
557
|
+
}, [tabConfig.columns, tabConfig.allowDelete, orgOptions, orgList, t]);
|
|
558
|
+
const handleCellChange = (args, handleCallback) => {
|
|
559
|
+
const item = args.rowData;
|
|
560
|
+
const val = args.option;
|
|
561
|
+
const field = args.field;
|
|
562
|
+
const colDef = tabConfig.columns.find(c => c.key === field);
|
|
563
|
+
if (colDef?.autoFillMap && val && typeof val === 'object') {
|
|
564
|
+
Object.entries(colDef.autoFillMap).forEach(([targetKey, sourceKey]) => {
|
|
565
|
+
const sourceVal = val[sourceKey];
|
|
566
|
+
if (sourceVal !== undefined && sourceVal !== null) {
|
|
567
|
+
item[targetKey] = sourceVal;
|
|
568
|
+
}
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
if (colDef && (colDef.type === 'checkbox' || colDef.type === 'switch') && colDef.uniqueScopeKey !== undefined && item[colDef.key]) {
|
|
572
|
+
const currentScope = item[colDef.uniqueScopeKey] ?? '';
|
|
573
|
+
args.rowsData?.forEach((row) => {
|
|
574
|
+
if (row.rowId !== item.rowId && (row[colDef.uniqueScopeKey] ?? '') === currentScope) {
|
|
575
|
+
row[colDef.key] = false;
|
|
576
|
+
}
|
|
577
|
+
});
|
|
578
|
+
emitUpdatedRows(args.rowsData ?? []);
|
|
579
|
+
}
|
|
580
|
+
handleCallback(item, args.indexRow);
|
|
581
|
+
};
|
|
582
|
+
const toolbarBottomItems = tabConfig.allowAdd === false
|
|
583
|
+
? []
|
|
584
|
+
: [
|
|
585
|
+
{ key: 'ADD', label: 'Add item', position: 'Bottom', align: 'left' },
|
|
586
|
+
{ key: 'INSERT_AFTER', label: 'Insert item after', position: 'Bottom', align: 'left' },
|
|
587
|
+
{ key: 'INSERT_BEFORE', label: 'Insert item before', position: 'Bottom', align: 'left' },
|
|
588
|
+
{ key: 'DUPLICATE', label: 'Duplicate', position: 'Bottom', align: 'left' },
|
|
589
|
+
{ key: 'DELETE', label: 'Delete all item', position: 'Bottom', align: 'left' }
|
|
590
|
+
];
|
|
591
|
+
const handleCommandClick = (item) => {
|
|
592
|
+
if (item.id === 'DELETE') {
|
|
593
|
+
emitUpdatedRows(item?.rows ?? []);
|
|
594
|
+
}
|
|
595
|
+
};
|
|
596
|
+
return (jsxRuntime.jsx("div", { className: "es-data-sharing-detail-tab es-data-sharing-grid-wrap", children: jsxRuntime.jsx(esGridTemplate.GridComponent, { dataSource: activeGridRows, editAble: true, lang: i18n.language || 'vi', showToolbar: false, onDataChange: emitUpdatedRows, defaultValue: defaultValue, columns: headerColumns, onCellChange: handleCellChange, toolbarItems: toolbarBottomItems, commandClick: handleCommandClick, height: 280, allowResizing: true, t: t, format: {
|
|
597
|
+
decimalSeparator: '.',
|
|
598
|
+
thousandSeparator: ',',
|
|
599
|
+
decimalScale: 2
|
|
600
|
+
}, showEmptyText: false }, `DataSharingDetailGrid_${tabConfig.key}`) }));
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
const DataSharingContent = ({ config, masterData = {}, masterDataList = [], parentOrgName, isBatchMode = false, orgList, setOrgList, detailData, setDetailData, isGlobalShared, onToggleGlobalShared, onChangeOverride, onApplyFirstToAll, showMasterCard: propShowMasterCard, showOrgScope: propShowOrgScope, showConfigTabs: propShowConfigTabs, showOverrideTab: propShowOverrideTab, showSummaryTab: propShowSummaryTab, showGlobalSharedSwitch: propShowGlobalSharedSwitch }) => {
|
|
604
|
+
const { t } = reactI18next.useTranslation();
|
|
605
|
+
const showMasterCard = propShowMasterCard ?? config.showMasterCard ?? true;
|
|
606
|
+
const showOrgScope = propShowOrgScope ?? config.showOrgScope ?? true;
|
|
607
|
+
const showConfigTabs = propShowConfigTabs ?? config.showConfigTabs ?? true;
|
|
608
|
+
const showOverrideTab = propShowOverrideTab ?? config.showOverrideTab ?? true;
|
|
609
|
+
const showSummaryTab = propShowSummaryTab ?? config.showSummaryTab ?? true;
|
|
610
|
+
const showGlobalSharedSwitch = propShowGlobalSharedSwitch ?? config.showGlobalSharedSwitch ?? true;
|
|
611
|
+
const detailTabs = config.detailTabs ?? [];
|
|
612
|
+
const hasVisibleTabs = showConfigTabs && (showOverrideTab || detailTabs.length > 0 || showSummaryTab);
|
|
613
|
+
const getFirstVisibleTab = () => {
|
|
614
|
+
if (showOverrideTab)
|
|
615
|
+
return 'override';
|
|
616
|
+
if (detailTabs.length > 0)
|
|
617
|
+
return `detail:${detailTabs[0].key}`;
|
|
618
|
+
return 'summary';
|
|
619
|
+
};
|
|
620
|
+
const [activeTab, setActiveTab] = react.useState(getFirstVisibleTab);
|
|
621
|
+
react.useEffect(() => {
|
|
622
|
+
const validTabs = [];
|
|
623
|
+
if (showOverrideTab)
|
|
624
|
+
validTabs.push('override');
|
|
625
|
+
detailTabs.forEach(tab => validTabs.push(`detail:${tab.key}`));
|
|
626
|
+
if (showSummaryTab)
|
|
627
|
+
validTabs.push('summary');
|
|
628
|
+
if (validTabs.length > 0 && !validTabs.includes(activeTab)) {
|
|
629
|
+
setActiveTab(validTabs[0]);
|
|
630
|
+
}
|
|
631
|
+
}, [showOverrideTab, showSummaryTab, detailTabs, activeTab]);
|
|
632
|
+
const selectedOrgs = orgList.filter(o => o.isSelected);
|
|
633
|
+
const showTopRow = showMasterCard || showOrgScope;
|
|
634
|
+
const masterColMd = showOrgScope ? 5 : 12;
|
|
635
|
+
const orgColMd = showMasterCard ? 7 : 12;
|
|
636
|
+
return (jsxRuntime.jsxs("div", { className: "es-data-sharing-content", children: [showTopRow && (jsxRuntime.jsxs(reactstrap.Row, { className: hasVisibleTabs ? 'mb-3' : 'mb-0', children: [showMasterCard && (jsxRuntime.jsx(reactstrap.Col, { md: masterColMd, className: showOrgScope ? 'mb-2 mb-md-0' : '', children: isBatchMode ? (jsxRuntime.jsx(BatchMasterCard, { title: config.masterCardTitle ?? config.title, items: masterDataList, isGlobalShared: isGlobalShared, onToggleGlobalShared: onToggleGlobalShared, showGlobalSharedSwitch: showGlobalSharedSwitch })) : (jsxRuntime.jsx(MasterCard, { title: config.masterCardTitle ?? config.title, fields: config.masterFields ?? [], data: masterData, isGlobalShared: isGlobalShared, onToggleGlobalShared: onToggleGlobalShared, showGlobalSharedSwitch: showGlobalSharedSwitch })) })), showOrgScope && (jsxRuntime.jsx(reactstrap.Col, { md: orgColMd, children: jsxRuntime.jsx(OrgTable, { orgList: orgList, onChangeOrg: setOrgList, parentOrgName: parentOrgName ?? config.parentOrgName }) }))] })), hasVisibleTabs && (jsxRuntime.jsxs("div", { className: "es-data-sharing-tabs-section", children: [jsxRuntime.jsxs(reactstrap.Nav, { tabs: true, className: "mb-2", children: [showOverrideTab && (jsxRuntime.jsx(reactstrap.NavItem, { children: jsxRuntime.jsxs(reactstrap.NavLink, { className: classnames({ active: activeTab === 'override' }), onClick: () => setActiveTab('override'), style: { cursor: 'pointer' }, children: ["\u2699\uFE0F ", t('DataSharing_OrgConfigTab', 'Cấu hình theo đơn vị'), selectedOrgs.length > 0 && (jsxRuntime.jsx(reactstrap.Badge, { color: "light-primary", className: "ms-1 text-primary", children: selectedOrgs.length }))] }) })), detailTabs.map(tab => {
|
|
637
|
+
const activeCount = (detailData[tab.key] ?? []).filter(r => !r._deleted).length;
|
|
638
|
+
return (jsxRuntime.jsx(reactstrap.NavItem, { children: jsxRuntime.jsxs(reactstrap.NavLink, { className: classnames({ active: activeTab === `detail:${tab.key}` }), onClick: () => setActiveTab(`detail:${tab.key}`), style: { cursor: 'pointer' }, children: [tab.icon ? `${tab.icon} ` : '📄 ', t(tab.title), jsxRuntime.jsx(reactstrap.Badge, { color: "light-info", className: "ms-1 text-info", children: activeCount })] }) }, tab.key));
|
|
639
|
+
}), showSummaryTab && (jsxRuntime.jsx(reactstrap.NavItem, { children: jsxRuntime.jsxs(reactstrap.NavLink, { className: classnames({ active: activeTab === 'summary' }), onClick: () => setActiveTab('summary'), style: { cursor: 'pointer' }, children: ["\uD83D\uDD52 ", t('DataSharing_SummaryTab', 'Tổng hợp phân quyền')] }) }))] }), jsxRuntime.jsxs(reactstrap.TabContent, { activeTab: activeTab, children: [showOverrideTab && (jsxRuntime.jsx(reactstrap.TabPane, { tabId: "override", children: jsxRuntime.jsx(OverrideTable, { orgList: orgList, overrideColumns: config.overrideColumns ?? [], masterData: isBatchMode ? undefined : masterData, onChangeOverride: onChangeOverride, onApplyFirstToAll: onApplyFirstToAll }) })), detailTabs.map(tab => (jsxRuntime.jsx(reactstrap.TabPane, { tabId: `detail:${tab.key}`, children: jsxRuntime.jsx(DetailTabTable, { tabConfig: tab, orgList: orgList, rows: detailData[tab.key] ?? [], onChangeRows: updatedRows => setDetailData(prev => ({
|
|
640
|
+
...prev,
|
|
641
|
+
[tab.key]: updatedRows
|
|
642
|
+
})) }) }, tab.key))), showSummaryTab && (jsxRuntime.jsx(reactstrap.TabPane, { tabId: "summary", children: jsxRuntime.jsxs("div", { className: "es-data-sharing-summary-box", children: [jsxRuntime.jsx("div", { className: "fw-bold mb-2 small text-dark", children: t('DataSharing_SummaryTitle', 'Tóm tắt cấu hình chuẩn bị áp dụng') }), jsxRuntime.jsxs("div", { className: "es-summary-grid", children: [jsxRuntime.jsxs("div", { className: "es-summary-item", children: [jsxRuntime.jsx("div", { className: "es-summary-label", children: t('DataSharing_SummaryScope', 'Phạm vi') }), jsxRuntime.jsx("div", { className: "es-summary-value", children: isGlobalShared
|
|
643
|
+
? t('DataSharing_GlobalShared', 'Danh mục dùng chung toàn tập đoàn')
|
|
644
|
+
: `${selectedOrgs.length} ${t('DataSharing_Organization', 'Đơn vị')}` })] }), jsxRuntime.jsxs("div", { className: "es-summary-item", children: [jsxRuntime.jsx("div", { className: "es-summary-label", children: t('DataSharing_SummaryOverride', 'Đơn vị cho phép cấu hình riêng') }), jsxRuntime.jsx("div", { className: "es-summary-value", children: selectedOrgs.filter(o => o.canOverrideConfig).length })] }), detailTabs.map(tab => (jsxRuntime.jsxs("div", { className: "es-summary-item", children: [jsxRuntime.jsx("div", { className: "es-summary-label", children: t(tab.title) }), jsxRuntime.jsx("div", { className: "es-summary-value", children: (detailData[tab.key] ?? []).filter(r => !r._deleted).length })] }, tab.key)))] })] }) }))] })] }))] }));
|
|
645
|
+
};
|
|
646
|
+
|
|
647
|
+
function applyGlobalSharedToOrgList(orgList, checked, sharingLabel) {
|
|
648
|
+
if (!checked)
|
|
649
|
+
return orgList;
|
|
650
|
+
return orgList.map(o => ({
|
|
651
|
+
...o,
|
|
652
|
+
isSelected: true,
|
|
653
|
+
status: 1,
|
|
654
|
+
statusText: sharingLabel
|
|
655
|
+
}));
|
|
656
|
+
}
|
|
657
|
+
function updateOrgOverrideValue(orgList, targetOrgId, fieldKey, value) {
|
|
658
|
+
return orgList.map(item => {
|
|
659
|
+
if (item.targetOrgId !== targetOrgId)
|
|
660
|
+
return item;
|
|
661
|
+
return {
|
|
662
|
+
...item,
|
|
663
|
+
overrideData: {
|
|
664
|
+
...item.overrideData,
|
|
665
|
+
[fieldKey]: value
|
|
666
|
+
}
|
|
667
|
+
};
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
function applyFirstOverrideToAll(orgList) {
|
|
671
|
+
const editableOrgs = orgList.filter(o => o.isSelected && o.canOverrideConfig);
|
|
672
|
+
if (editableOrgs.length < 2)
|
|
673
|
+
return orgList;
|
|
674
|
+
const firstData = editableOrgs[0].overrideData ?? {};
|
|
675
|
+
return orgList.map(item => {
|
|
676
|
+
if (!item.isSelected || !item.canOverrideConfig)
|
|
677
|
+
return item;
|
|
678
|
+
return {
|
|
679
|
+
...item,
|
|
680
|
+
overrideData: {
|
|
681
|
+
...firstData
|
|
682
|
+
}
|
|
683
|
+
};
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
function buildDataSharingPayload(params) {
|
|
687
|
+
const { config, entityId, entityIds, isGlobalShared, orgList, detailData } = params;
|
|
688
|
+
const isBatchMode = (entityIds?.length ?? 0) > 1;
|
|
689
|
+
const detailTabs = config.detailTabs ?? [];
|
|
690
|
+
return {
|
|
691
|
+
entityType: config.entityType,
|
|
692
|
+
entityId,
|
|
693
|
+
...(isBatchMode ? { entityIds } : {}),
|
|
694
|
+
isGlobalShared,
|
|
695
|
+
sharingList: orgList.map(o => ({
|
|
696
|
+
TargetOrgId: o.targetOrgId,
|
|
697
|
+
IsInheritMaster: o.isInheritMaster,
|
|
698
|
+
CanOverrideConfig: o.canOverrideConfig,
|
|
699
|
+
EffectiveFrom: o.effectiveFrom || null,
|
|
700
|
+
EffectiveTo: o.effectiveTo || null,
|
|
701
|
+
Status: o.isSelected ? 1 : 0
|
|
702
|
+
})),
|
|
703
|
+
orgConfigList: orgList
|
|
704
|
+
.filter(o => o.isSelected && o.canOverrideConfig)
|
|
705
|
+
.map(o => ({
|
|
706
|
+
OrganizationId: o.targetOrgId,
|
|
707
|
+
...o.overrideData
|
|
708
|
+
})),
|
|
709
|
+
...(detailTabs.length > 0 ? { detailData } : {})
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
const ModalSharingView = ({ isOpen, toggle, config, masterData, masterDataList = [], parentOrgName, entityId, entityIds, orgList, setOrgList, detailData, setDetailData, isGlobalShared, setIsGlobalShared, onSave, loading = false, showMasterCard, showOrgScope, showConfigTabs, showOverrideTab, showSummaryTab, showGlobalSharedSwitch }) => {
|
|
714
|
+
const { t } = reactI18next.useTranslation();
|
|
137
715
|
const [saving, setSaving] = react.useState(false);
|
|
716
|
+
const isBatchMode = (entityIds?.length ?? 0) > 1;
|
|
138
717
|
const handleToggleGlobalShared = (checked) => {
|
|
139
718
|
setIsGlobalShared(checked);
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
...o,
|
|
143
|
-
isSelected: true,
|
|
144
|
-
status: 1,
|
|
145
|
-
statusText: 'Đang chia sẻ'
|
|
146
|
-
})));
|
|
147
|
-
}
|
|
719
|
+
const sharingLabel = t('DataSharing_Sharing', 'Đang chia sẻ');
|
|
720
|
+
setOrgList(prev => applyGlobalSharedToOrgList(prev, checked, sharingLabel));
|
|
148
721
|
};
|
|
149
722
|
const handleChangeOverride = (targetOrgId, fieldKey, value) => {
|
|
150
|
-
setOrgList(prev => prev
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
...item,
|
|
155
|
-
overrideData: {
|
|
156
|
-
...item.overrideData,
|
|
157
|
-
[fieldKey]: value
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
}));
|
|
723
|
+
setOrgList(prev => updateOrgOverrideValue(prev, targetOrgId, fieldKey, value));
|
|
724
|
+
};
|
|
725
|
+
const handleApplyFirstToAll = () => {
|
|
726
|
+
setOrgList(prev => applyFirstOverrideToAll(prev));
|
|
161
727
|
};
|
|
162
728
|
const handleSubmit = async () => {
|
|
163
729
|
setSaving(true);
|
|
164
730
|
try {
|
|
165
|
-
const payload = {
|
|
166
|
-
|
|
731
|
+
const payload = buildDataSharingPayload({
|
|
732
|
+
config,
|
|
167
733
|
entityId,
|
|
734
|
+
entityIds,
|
|
168
735
|
isGlobalShared,
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
CanOverrideConfig: o.canOverrideConfig,
|
|
173
|
-
EffectiveFrom: o.effectiveFrom || null,
|
|
174
|
-
EffectiveTo: o.effectiveTo || null,
|
|
175
|
-
Status: o.isSelected ? 1 : 0
|
|
176
|
-
})),
|
|
177
|
-
orgConfigList: orgList
|
|
178
|
-
.filter(o => o.isSelected)
|
|
179
|
-
.map(o => ({
|
|
180
|
-
OrganizationId: o.targetOrgId,
|
|
181
|
-
...o.overrideData
|
|
182
|
-
}))
|
|
183
|
-
};
|
|
736
|
+
orgList,
|
|
737
|
+
detailData
|
|
738
|
+
});
|
|
184
739
|
await onSave(payload);
|
|
185
740
|
toggle();
|
|
186
741
|
}
|
|
@@ -188,30 +743,90 @@ const ModalSharingView = ({ isOpen, toggle, config, masterData, entityId, orgLis
|
|
|
188
743
|
setSaving(false);
|
|
189
744
|
}
|
|
190
745
|
};
|
|
191
|
-
return (jsxRuntime.jsxs(reactstrap.Modal, { isOpen: isOpen, toggle: toggle, className: "modal-dialog-centered modal-xl es-data-sharing-modal", children: [jsxRuntime.jsx(reactstrap.ModalHeader, { toggle: toggle,
|
|
746
|
+
return (jsxRuntime.jsxs(reactstrap.Modal, { isOpen: isOpen, toggle: toggle, className: "modal-dialog-centered modal-xl es-data-sharing-modal", children: [jsxRuntime.jsx(reactstrap.ModalHeader, { toggle: toggle, children: jsxRuntime.jsxs("div", { className: "d-flex align-items-center", children: [jsxRuntime.jsx("span", { className: "me-2 es-data-sharing-header-icon", children: "\uD83D\uDD17" }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", { className: "d-flex align-items-center gap-2", children: [jsxRuntime.jsx("h4", { className: "mb-0 fw-bolder", children: t(config.title) }), isBatchMode && (jsxRuntime.jsxs(reactstrap.Badge, { color: "primary", children: [t('DataSharing_BatchSharing', 'Chia sẻ hàng loạt'), " (", entityIds?.length, ")"] }))] }), jsxRuntime.jsx("small", { className: "text-muted", children: t('DataSharing_Subtitle', 'Quản lý chia sẻ dữ liệu và phân quyền theo đơn vị thành viên') })] })] }) }), jsxRuntime.jsx(reactstrap.ModalBody, { children: loading ? (jsxRuntime.jsxs("div", { className: "text-center py-5", children: [jsxRuntime.jsx("div", { className: "spinner-border text-primary", role: "status", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }), jsxRuntime.jsx("div", { className: "mt-2 text-muted", children: t('DataSharing_Loading', 'Đang tải dữ liệu chia sẻ...') })] })) : (jsxRuntime.jsx(DataSharingContent, { config: config, masterData: masterData, masterDataList: masterDataList, parentOrgName: parentOrgName, isBatchMode: isBatchMode, orgList: orgList, setOrgList: setOrgList, detailData: detailData, setDetailData: setDetailData, isGlobalShared: isGlobalShared, onToggleGlobalShared: handleToggleGlobalShared, onChangeOverride: handleChangeOverride, onApplyFirstToAll: handleApplyFirstToAll, showMasterCard: showMasterCard, showOrgScope: showOrgScope, showConfigTabs: showConfigTabs, showOverrideTab: showOverrideTab, showSummaryTab: showSummaryTab, showGlobalSharedSwitch: showGlobalSharedSwitch })) }), jsxRuntime.jsxs(reactstrap.ModalFooter, { children: [jsxRuntime.jsx(reactstrap.Button, { color: "primary", onClick: handleSubmit, disabled: saving || loading, children: saving ? t('DataSharing_Saving', 'Đang lưu...') : t('DataSharing_Save', 'Cập nhật chia sẻ') }), jsxRuntime.jsx(reactstrap.Button, { color: "secondary", outline: true, onClick: toggle, disabled: saving || loading, children: t('DataSharing_Cancel', 'Hủy') })] })] }));
|
|
192
747
|
};
|
|
193
748
|
|
|
194
|
-
const
|
|
749
|
+
const DataSharingPanel = ({ config, masterData = {}, masterDataList = [], parentOrgName, isBatchMode = false, orgList, onChangeOrgList, detailData: controlledDetailData, onChangeDetailData, isGlobalShared: controlledGlobalShared = false, onChangeGlobalShared, showMasterCard, showOrgScope, showConfigTabs, showOverrideTab, showSummaryTab, showGlobalSharedSwitch }) => {
|
|
750
|
+
const { t } = reactI18next.useTranslation();
|
|
751
|
+
const [internalDetailData, setInternalDetailData] = react.useState({});
|
|
752
|
+
const detailData = controlledDetailData ?? internalDetailData;
|
|
753
|
+
const setDetailData = onChangeDetailData ?? setInternalDetailData;
|
|
754
|
+
const handleToggleGlobalShared = (checked) => {
|
|
755
|
+
onChangeGlobalShared?.(checked);
|
|
756
|
+
const sharingLabel = t('DataSharing_Sharing', 'Đang chia sẻ');
|
|
757
|
+
onChangeOrgList(prev => applyGlobalSharedToOrgList(prev, checked, sharingLabel));
|
|
758
|
+
};
|
|
759
|
+
const handleChangeOverride = (targetOrgId, fieldKey, value) => {
|
|
760
|
+
onChangeOrgList(prev => updateOrgOverrideValue(prev, targetOrgId, fieldKey, value));
|
|
761
|
+
};
|
|
762
|
+
const handleApplyFirstToAll = () => {
|
|
763
|
+
onChangeOrgList(prev => applyFirstOverrideToAll(prev));
|
|
764
|
+
};
|
|
765
|
+
return (jsxRuntime.jsx(DataSharingContent, { config: config, masterData: masterData, masterDataList: masterDataList, parentOrgName: parentOrgName, isBatchMode: isBatchMode, orgList: orgList, setOrgList: onChangeOrgList, detailData: detailData, setDetailData: setDetailData, isGlobalShared: controlledGlobalShared, onToggleGlobalShared: handleToggleGlobalShared, onChangeOverride: handleChangeOverride, onApplyFirstToAll: handleApplyFirstToAll, showMasterCard: showMasterCard, showOrgScope: showOrgScope, showConfigTabs: showConfigTabs, showOverrideTab: showOverrideTab, showSummaryTab: showSummaryTab, showGlobalSharedSwitch: showGlobalSharedSwitch }));
|
|
766
|
+
};
|
|
767
|
+
const DataSharingComponent = react.forwardRef(({ database, parentOrgName, fetchSharingData, onSave, onSuccess, showMasterCard, showOrgScope, showConfigTabs, showOverrideTab, showSummaryTab, showGlobalSharedSwitch }, ref) => {
|
|
195
768
|
const [isOpen, setIsOpen] = react.useState(false);
|
|
196
769
|
const [loading, setLoading] = react.useState(false);
|
|
197
770
|
const [config, setConfig] = react.useState(null);
|
|
198
771
|
const [masterData, setMasterData] = react.useState({});
|
|
772
|
+
const [masterDataList, setMasterDataList] = react.useState([]);
|
|
773
|
+
const [activeParentOrgName, setActiveParentOrgName] = react.useState(parentOrgName);
|
|
199
774
|
const [entityId, setEntityId] = react.useState('');
|
|
775
|
+
const [entityIds, setEntityIds] = react.useState(undefined);
|
|
776
|
+
const [activeDatabase, setActiveDatabase] = react.useState(database);
|
|
200
777
|
const [isGlobalShared, setIsGlobalShared] = react.useState(false);
|
|
201
778
|
const [orgList, setOrgList] = react.useState([]);
|
|
779
|
+
const [detailData, setDetailData] = react.useState({});
|
|
780
|
+
const [openVisibility, setOpenVisibility] = react.useState({});
|
|
202
781
|
react.useImperativeHandle(ref, () => ({
|
|
203
782
|
open: async (params) => {
|
|
783
|
+
const targetDb = params.database ?? database;
|
|
784
|
+
const ids = params.entityIds?.filter(Boolean) ?? [];
|
|
785
|
+
const isBatch = ids.length > 1;
|
|
786
|
+
const primaryEntityId = params.entityId || ids[0] || '';
|
|
204
787
|
setIsOpen(true);
|
|
205
788
|
setConfig(params.config);
|
|
206
|
-
setMasterData(params.masterData);
|
|
207
|
-
|
|
789
|
+
setMasterData(params.masterData ?? params.masterDataList?.[0] ?? {});
|
|
790
|
+
setMasterDataList(params.masterDataList ?? (params.masterData ? [params.masterData] : []));
|
|
791
|
+
setActiveParentOrgName(params.parentOrgName ?? parentOrgName);
|
|
792
|
+
setEntityId(primaryEntityId);
|
|
793
|
+
setEntityIds(isBatch ? ids : undefined);
|
|
794
|
+
setActiveDatabase(targetDb);
|
|
208
795
|
setIsGlobalShared(params.initialGlobalShared || false);
|
|
209
|
-
|
|
796
|
+
setDetailData(params.initialDetailData ?? {});
|
|
797
|
+
setOpenVisibility({
|
|
798
|
+
showMasterCard: params.showMasterCard,
|
|
799
|
+
showOrgScope: params.showOrgScope,
|
|
800
|
+
showConfigTabs: params.showConfigTabs,
|
|
801
|
+
showOverrideTab: params.showOverrideTab,
|
|
802
|
+
showSummaryTab: params.showSummaryTab,
|
|
803
|
+
showGlobalSharedSwitch: params.showGlobalSharedSwitch
|
|
804
|
+
});
|
|
805
|
+
if (fetchSharingData && primaryEntityId) {
|
|
210
806
|
setLoading(true);
|
|
211
807
|
try {
|
|
212
|
-
const res = await fetchSharingData(params.entityType,
|
|
213
|
-
|
|
214
|
-
|
|
808
|
+
const res = await fetchSharingData(params.entityType, primaryEntityId, targetDb);
|
|
809
|
+
if (res.parentOrgName) {
|
|
810
|
+
setActiveParentOrgName(res.parentOrgName);
|
|
811
|
+
}
|
|
812
|
+
if (isBatch) {
|
|
813
|
+
// In batch mode, load org tree cleanly without inheriting single-item selections
|
|
814
|
+
setIsGlobalShared(false);
|
|
815
|
+
setOrgList((res.orgList ?? []).map(o => ({
|
|
816
|
+
...o,
|
|
817
|
+
isSelected: false,
|
|
818
|
+
isInheritMaster: true,
|
|
819
|
+
canOverrideConfig: false,
|
|
820
|
+
status: 0,
|
|
821
|
+
overrideData: {}
|
|
822
|
+
})));
|
|
823
|
+
setDetailData({});
|
|
824
|
+
}
|
|
825
|
+
else {
|
|
826
|
+
setIsGlobalShared(res.isGlobalShared);
|
|
827
|
+
setOrgList(res.orgList ?? []);
|
|
828
|
+
setDetailData(res.detailData ?? params.initialDetailData ?? {});
|
|
829
|
+
}
|
|
215
830
|
}
|
|
216
831
|
finally {
|
|
217
832
|
setLoading(false);
|
|
@@ -225,15 +840,25 @@ const DataSharingComponent = react.forwardRef(({ fetchSharingData, onSave, onSuc
|
|
|
225
840
|
if (!isOpen || !config)
|
|
226
841
|
return null;
|
|
227
842
|
const handleSave = async (payload) => {
|
|
843
|
+
const finalPayload = activeDatabase
|
|
844
|
+
? { ...payload, database: activeDatabase }
|
|
845
|
+
: payload;
|
|
228
846
|
if (onSave) {
|
|
229
|
-
await onSave(
|
|
847
|
+
await onSave(finalPayload);
|
|
230
848
|
}
|
|
231
849
|
if (onSuccess) {
|
|
232
850
|
onSuccess();
|
|
233
851
|
}
|
|
234
852
|
};
|
|
235
|
-
return (jsxRuntime.jsx(ModalSharingView, { isOpen: isOpen, toggle: () => setIsOpen(false), config: config, masterData: masterData, entityId: entityId, orgList: orgList, setOrgList: setOrgList, isGlobalShared: isGlobalShared, setIsGlobalShared: setIsGlobalShared, onSave: handleSave, loading: loading }));
|
|
853
|
+
return (jsxRuntime.jsx(ModalSharingView, { isOpen: isOpen, toggle: () => setIsOpen(false), config: config, masterData: masterData, masterDataList: masterDataList, parentOrgName: activeParentOrgName ?? parentOrgName, entityId: entityId, entityIds: entityIds, orgList: orgList, setOrgList: setOrgList, detailData: detailData, setDetailData: setDetailData, isGlobalShared: isGlobalShared, setIsGlobalShared: setIsGlobalShared, onSave: handleSave, loading: loading, showMasterCard: openVisibility.showMasterCard ?? showMasterCard, showOrgScope: openVisibility.showOrgScope ?? showOrgScope, showConfigTabs: openVisibility.showConfigTabs ?? showConfigTabs, showOverrideTab: openVisibility.showOverrideTab ?? showOverrideTab, showSummaryTab: openVisibility.showSummaryTab ?? showSummaryTab, showGlobalSharedSwitch: openVisibility.showGlobalSharedSwitch ?? showGlobalSharedSwitch }));
|
|
236
854
|
});
|
|
237
855
|
|
|
238
|
-
|
|
856
|
+
exports.BatchMasterCard = BatchMasterCard;
|
|
857
|
+
exports.DataSharingPanel = DataSharingPanel;
|
|
858
|
+
exports.DetailTabTable = DetailTabTable;
|
|
859
|
+
exports.MasterCard = MasterCard;
|
|
860
|
+
exports.OrgTable = OrgTable;
|
|
861
|
+
exports.OverrideTable = OverrideTable;
|
|
862
|
+
exports.buildDataSharingPayload = buildDataSharingPayload;
|
|
863
|
+
exports["default"] = DataSharingComponent;
|
|
239
864
|
//# sourceMappingURL=index.js.map
|