odant-work 1.0.75 → 1.0.76
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/#system/package-manifest.json +9 -9
- package/$server/$folder/$class/$structure/handlers/pages/form/system/$handler/tabs/agent.js +106 -145
- package/$server/$folder/$class/$structure/handlers/pages/form/system/$handler/tabs/staff.js +520 -516
- package/package.json +1 -1
- package/sources/client/folder.js +2 -0
- package/sources/modules/agent/node-rules.js +4 -1
- package/sources/server/access/gateway.js +2 -0
|
@@ -47,6 +47,18 @@ function isDroppedClass(info) {
|
|
|
47
47
|
return String(info.path || '').includes('/MODULES/');
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
function splitClassTitle(rawPath, mapEntry) {
|
|
51
|
+
if (mapEntry && typeof mapEntry === 'object')
|
|
52
|
+
return mapEntry;
|
|
53
|
+
const clean = String(rawPath || '')
|
|
54
|
+
.replace(/^\/(?:ORGANIZATIONS|PROJECTS)\/[^/]+\/MODULES\//, '')
|
|
55
|
+
.replace(/^\/MODULES\//, '');
|
|
56
|
+
const parts = clean.split('/').filter(Boolean);
|
|
57
|
+
const title = parts.length ? parts[parts.length - 1] : clean;
|
|
58
|
+
const section = parts.length > 1 ? parts.slice(0, -1).join(' / ') : '';
|
|
59
|
+
return { title, section, icon: 'odant:class' };
|
|
60
|
+
}
|
|
61
|
+
|
|
50
62
|
export default {
|
|
51
63
|
imports: 'oda//icon, oda//button',
|
|
52
64
|
template: /*html*/`
|
|
@@ -54,412 +66,428 @@ export default {
|
|
|
54
66
|
:host {
|
|
55
67
|
@apply --vertical;
|
|
56
68
|
@apply --flex;
|
|
57
|
-
padding:
|
|
58
|
-
gap:
|
|
69
|
+
padding: 14px 18px;
|
|
70
|
+
gap: 10px;
|
|
59
71
|
overflow-y: auto;
|
|
60
72
|
background: var(--content-background);
|
|
61
73
|
color: var(--content-color);
|
|
74
|
+
font-size: 13px;
|
|
62
75
|
}
|
|
63
|
-
.
|
|
76
|
+
.tree-box {
|
|
64
77
|
@apply --vertical;
|
|
65
|
-
gap: 10px;
|
|
66
|
-
padding: 14px 16px;
|
|
67
78
|
border: 1px solid var(--subtle-border);
|
|
68
79
|
border-radius: 10px;
|
|
69
|
-
background: var(--subtle-background);
|
|
70
|
-
transition: border-color .15s, box-shadow .15s;
|
|
71
|
-
}
|
|
72
|
-
.card.drop-hover, .role-card.drop-hover {
|
|
73
|
-
border-color: var(--accent-color, #2563eb);
|
|
74
|
-
box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-color, #2563eb) 22%, transparent);
|
|
75
|
-
}
|
|
76
|
-
.role-card {
|
|
77
|
-
@apply --vertical;
|
|
78
|
-
gap: 10px;
|
|
79
|
-
padding: 12px 14px;
|
|
80
|
-
border: 1px solid var(--subtle-border);
|
|
81
|
-
border-radius: 8px;
|
|
82
80
|
background: var(--content-background);
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
.role-card.active-role {
|
|
86
|
-
border-color: var(--accent-color);
|
|
87
|
-
box-shadow: 0 0 0 2px var(--accent-soft);
|
|
81
|
+
overflow: hidden;
|
|
88
82
|
}
|
|
89
|
-
.
|
|
83
|
+
.root-row {
|
|
90
84
|
@apply --horizontal;
|
|
91
85
|
align-items: center;
|
|
92
86
|
gap: 8px;
|
|
93
|
-
|
|
94
|
-
|
|
87
|
+
padding: 10px 14px;
|
|
88
|
+
background: var(--subtle-background);
|
|
89
|
+
border-bottom: 1px solid var(--subtle-border);
|
|
95
90
|
flex-wrap: wrap;
|
|
91
|
+
transition: background .15s;
|
|
92
|
+
}
|
|
93
|
+
.root-row.drop-hover, .tree-row.drop-hover {
|
|
94
|
+
background: color-mix(in srgb, var(--accent-color, #2563eb) 10%, var(--content-background));
|
|
95
|
+
outline: 1px dashed var(--accent-color, #2563eb);
|
|
96
|
+
outline-offset: -2px;
|
|
97
|
+
}
|
|
98
|
+
.root-title {
|
|
99
|
+
font-weight: 700;
|
|
100
|
+
font-size: 14px;
|
|
101
|
+
margin-right: 4px;
|
|
102
|
+
}
|
|
103
|
+
.boss-label {
|
|
104
|
+
font-size: 12px;
|
|
105
|
+
color: var(--muted-color);
|
|
96
106
|
}
|
|
97
|
-
.
|
|
107
|
+
.tree-row {
|
|
98
108
|
@apply --horizontal;
|
|
99
109
|
align-items: center;
|
|
110
|
+
gap: 6px;
|
|
111
|
+
padding: 6px 12px;
|
|
112
|
+
min-height: 34px;
|
|
113
|
+
border-bottom: 1px solid color-mix(in srgb, var(--subtle-border) 55%, transparent);
|
|
100
114
|
flex-wrap: wrap;
|
|
101
|
-
gap: 8px;
|
|
102
115
|
}
|
|
103
|
-
.
|
|
104
|
-
|
|
105
|
-
font-weight: 600;
|
|
106
|
-
color: var(--muted-color);
|
|
107
|
-
min-width: 140px;
|
|
116
|
+
.tree-row:last-child {
|
|
117
|
+
border-bottom: none;
|
|
108
118
|
}
|
|
109
|
-
.
|
|
110
|
-
|
|
119
|
+
.tree-row.role-row {
|
|
120
|
+
background: var(--content-background);
|
|
121
|
+
}
|
|
122
|
+
.tree-row.role-row:hover {
|
|
123
|
+
background: color-mix(in srgb, var(--subtle-background) 65%, transparent);
|
|
124
|
+
}
|
|
125
|
+
.tree-row.class-row {
|
|
126
|
+
min-height: 30px;
|
|
127
|
+
padding-top: 4px;
|
|
128
|
+
padding-bottom: 4px;
|
|
129
|
+
background: color-mix(in srgb, var(--subtle-background) 35%, var(--content-background));
|
|
130
|
+
}
|
|
131
|
+
.tree-row.class-row:hover {
|
|
132
|
+
background: var(--subtle-background);
|
|
133
|
+
}
|
|
134
|
+
.expander {
|
|
135
|
+
width: 18px;
|
|
136
|
+
height: 18px;
|
|
137
|
+
display: inline-flex;
|
|
138
|
+
align-items: center;
|
|
139
|
+
justify-content: center;
|
|
140
|
+
cursor: pointer;
|
|
111
141
|
color: var(--muted-color);
|
|
112
|
-
|
|
142
|
+
user-select: none;
|
|
143
|
+
border-radius: 4px;
|
|
113
144
|
}
|
|
114
|
-
.
|
|
145
|
+
.expander:hover {
|
|
146
|
+
background: var(--subtle-background);
|
|
147
|
+
color: var(--content-color);
|
|
148
|
+
}
|
|
149
|
+
.role-name {
|
|
150
|
+
font-weight: 600;
|
|
151
|
+
font-size: 13.5px;
|
|
152
|
+
}
|
|
153
|
+
.members-wrap {
|
|
115
154
|
@apply --horizontal;
|
|
116
155
|
align-items: center;
|
|
117
|
-
gap:
|
|
118
|
-
|
|
156
|
+
gap: 5px;
|
|
157
|
+
flex-wrap: wrap;
|
|
158
|
+
flex: 1;
|
|
159
|
+
min-width: 140px;
|
|
160
|
+
}
|
|
161
|
+
.chip {
|
|
162
|
+
@apply --horizontal;
|
|
163
|
+
align-items: center;
|
|
164
|
+
gap: 5px;
|
|
165
|
+
padding: 2px 8px 2px 4px;
|
|
119
166
|
border-radius: 14px;
|
|
120
167
|
background: var(--accent-soft);
|
|
121
168
|
color: var(--content-color);
|
|
122
|
-
font-size:
|
|
169
|
+
font-size: 12.5px;
|
|
170
|
+
cursor: pointer;
|
|
123
171
|
}
|
|
124
|
-
.
|
|
125
|
-
|
|
126
|
-
border: 1px solid color-mix(in srgb, #0284c7 30%, transparent);
|
|
172
|
+
.chip.inherited {
|
|
173
|
+
opacity: .75;
|
|
127
174
|
}
|
|
128
|
-
.
|
|
129
|
-
|
|
175
|
+
.chip.node-chip {
|
|
176
|
+
background: color-mix(in srgb, #0284c7 13%, var(--content-background));
|
|
177
|
+
border: 1px solid color-mix(in srgb, #0284c7 28%, transparent);
|
|
130
178
|
}
|
|
131
|
-
.
|
|
179
|
+
.chip:hover {
|
|
132
180
|
filter: brightness(0.95);
|
|
133
181
|
}
|
|
182
|
+
.chip .rm {
|
|
183
|
+
font-weight: 700;
|
|
184
|
+
opacity: .6;
|
|
185
|
+
padding: 0 2px;
|
|
186
|
+
cursor: pointer;
|
|
187
|
+
}
|
|
188
|
+
.chip .rm:hover {
|
|
189
|
+
opacity: 1;
|
|
190
|
+
color: var(--error-color, #dc2626);
|
|
191
|
+
}
|
|
134
192
|
.badge {
|
|
135
193
|
font-size: 11px;
|
|
136
194
|
font-weight: 600;
|
|
137
|
-
padding:
|
|
138
|
-
border-radius:
|
|
195
|
+
padding: 1px 6px;
|
|
196
|
+
border-radius: 8px;
|
|
139
197
|
background: var(--accent-soft);
|
|
140
198
|
color: var(--accent-color);
|
|
141
199
|
}
|
|
142
|
-
.badge.
|
|
200
|
+
.badge.ext {
|
|
143
201
|
background: light-dark(#fef3c7, #422006);
|
|
144
202
|
color: light-dark(#92400e, #fcd34d);
|
|
145
203
|
}
|
|
146
|
-
.
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
gap: 5px;
|
|
150
|
-
font-size: 12px;
|
|
204
|
+
.icon-btn {
|
|
205
|
+
border: 1px solid transparent;
|
|
206
|
+
background: transparent;
|
|
151
207
|
color: var(--muted-color);
|
|
208
|
+
border-radius: 6px;
|
|
209
|
+
padding: 3px 7px;
|
|
210
|
+
font: inherit;
|
|
211
|
+
font-size: 12px;
|
|
152
212
|
cursor: pointer;
|
|
153
|
-
|
|
213
|
+
display: inline-flex;
|
|
214
|
+
align-items: center;
|
|
215
|
+
gap: 4px;
|
|
154
216
|
}
|
|
155
|
-
.
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
min-width: 160px;
|
|
217
|
+
.icon-btn:hover {
|
|
218
|
+
background: var(--subtle-background);
|
|
219
|
+
border-color: var(--subtle-border);
|
|
220
|
+
color: var(--content-color);
|
|
160
221
|
}
|
|
161
|
-
.
|
|
222
|
+
.icon-btn.active {
|
|
223
|
+
background: var(--accent-soft);
|
|
162
224
|
color: var(--accent-color);
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
.user-chip .rm {
|
|
166
|
-
cursor: pointer;
|
|
167
|
-
font-weight: bold;
|
|
168
|
-
opacity: .65;
|
|
169
|
-
padding: 0 2px;
|
|
170
|
-
}
|
|
171
|
-
.user-chip .rm:hover {
|
|
172
|
-
opacity: 1;
|
|
173
|
-
color: var(--error-color);
|
|
174
|
-
}
|
|
175
|
-
select, input[type="text"] {
|
|
176
|
-
padding: 5px 8px;
|
|
177
|
-
border: 1px solid var(--control-border-color);
|
|
178
|
-
border-radius: 6px;
|
|
179
|
-
font: inherit;
|
|
180
|
-
font-size: 13px;
|
|
181
|
-
background: var(--control-background);
|
|
182
|
-
color: var(--control-color);
|
|
225
|
+
border-color: color-mix(in srgb, var(--accent-color) 35%, transparent);
|
|
183
226
|
}
|
|
184
|
-
.
|
|
185
|
-
|
|
186
|
-
gap: 6px;
|
|
187
|
-
padding-top: 8px;
|
|
188
|
-
border-top: 1px dashed var(--subtle-border);
|
|
227
|
+
.icon-btn.danger:hover {
|
|
228
|
+
color: var(--error-color, #dc2626);
|
|
189
229
|
}
|
|
190
|
-
.
|
|
230
|
+
.row-actions {
|
|
191
231
|
@apply --horizontal;
|
|
192
232
|
align-items: center;
|
|
193
|
-
gap:
|
|
194
|
-
|
|
195
|
-
padding: 5px 8px;
|
|
196
|
-
background: var(--subtle-background);
|
|
197
|
-
border-radius: 6px;
|
|
198
|
-
flex-wrap: wrap;
|
|
199
|
-
}
|
|
200
|
-
.pill-group {
|
|
201
|
-
@apply --horizontal;
|
|
202
|
-
border: 1px solid var(--subtle-border);
|
|
203
|
-
border-radius: 6px;
|
|
204
|
-
overflow: hidden;
|
|
205
|
-
background: var(--content-background);
|
|
233
|
+
gap: 2px;
|
|
234
|
+
margin-left: auto;
|
|
206
235
|
}
|
|
207
|
-
.
|
|
208
|
-
border: none;
|
|
209
|
-
background: transparent;
|
|
210
|
-
color: var(--muted-color);
|
|
211
|
-
padding: 3px 9px;
|
|
212
|
-
font: inherit;
|
|
213
|
-
font-size: 12px;
|
|
236
|
+
.class-title {
|
|
214
237
|
font-weight: 500;
|
|
215
238
|
cursor: pointer;
|
|
216
239
|
}
|
|
217
|
-
.
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
240
|
+
.class-title:hover {
|
|
241
|
+
color: var(--accent-color);
|
|
242
|
+
text-decoration: underline;
|
|
243
|
+
}
|
|
244
|
+
.class-section {
|
|
245
|
+
font-size: 11.5px;
|
|
246
|
+
color: var(--muted-color);
|
|
247
|
+
}
|
|
248
|
+
.write-check {
|
|
249
|
+
@apply --horizontal;
|
|
250
|
+
align-items: center;
|
|
251
|
+
gap: 5px;
|
|
252
|
+
font-size: 12.5px;
|
|
253
|
+
cursor: pointer;
|
|
254
|
+
user-select: none;
|
|
255
|
+
margin-left: auto;
|
|
256
|
+
padding-right: 6px;
|
|
221
257
|
}
|
|
222
|
-
.
|
|
258
|
+
.inline-panel {
|
|
223
259
|
@apply --vertical;
|
|
224
260
|
gap: 8px;
|
|
225
|
-
padding: 10px
|
|
226
|
-
border: 1px solid var(--accent-color, #2563eb);
|
|
227
|
-
border-radius: 8px;
|
|
261
|
+
padding: 10px 14px;
|
|
228
262
|
background: var(--subtle-background);
|
|
263
|
+
border-bottom: 1px solid var(--subtle-border);
|
|
229
264
|
}
|
|
230
|
-
.
|
|
265
|
+
.panel-list {
|
|
231
266
|
@apply --vertical;
|
|
232
267
|
gap: 2px;
|
|
233
|
-
max-height:
|
|
268
|
+
max-height: 220px;
|
|
234
269
|
overflow-y: auto;
|
|
235
|
-
padding: 4px;
|
|
236
270
|
border: 1px solid var(--subtle-border);
|
|
237
271
|
border-radius: 6px;
|
|
272
|
+
padding: 4px;
|
|
238
273
|
background: var(--content-background);
|
|
239
274
|
}
|
|
240
|
-
.
|
|
275
|
+
.panel-item {
|
|
241
276
|
@apply --horizontal;
|
|
242
277
|
align-items: center;
|
|
243
|
-
gap:
|
|
244
|
-
padding:
|
|
278
|
+
gap: 8px;
|
|
279
|
+
padding: 5px 8px;
|
|
245
280
|
border-radius: 5px;
|
|
246
|
-
font-size: 13px;
|
|
247
281
|
cursor: pointer;
|
|
282
|
+
font-size: 13px;
|
|
248
283
|
}
|
|
249
|
-
.
|
|
284
|
+
.panel-item:hover {
|
|
250
285
|
background: var(--subtle-background);
|
|
251
286
|
}
|
|
287
|
+
input[type="text"] {
|
|
288
|
+
padding: 5px 8px;
|
|
289
|
+
border: 1px solid var(--control-border-color, var(--subtle-border));
|
|
290
|
+
border-radius: 6px;
|
|
291
|
+
font: inherit;
|
|
292
|
+
font-size: 13px;
|
|
293
|
+
background: var(--content-background);
|
|
294
|
+
color: var(--control-color, inherit);
|
|
295
|
+
}
|
|
252
296
|
.muted {
|
|
253
297
|
color: var(--muted-color);
|
|
254
|
-
font-size:
|
|
298
|
+
font-size: 12px;
|
|
255
299
|
}
|
|
256
300
|
</style>
|
|
257
301
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
<oda-icon :icon="$item?.icon || 'odant:structure'" icon-size="
|
|
263
|
-
<span>{{$item?.label || $item?.id}}
|
|
264
|
-
|
|
265
|
-
<div class="hint">
|
|
266
|
-
Руководитель (BOSS) назначается один на подразделение: он видит все данные отдела, управляет ролями, агентом и настройками. Если не назначен — действует руководитель сверху. Можно перетащить человека из общего дерева прямо на эту карточку.
|
|
267
|
-
</div>
|
|
302
|
+
<div class="tree-box">
|
|
303
|
+
<!-- Корень дерева: BOSS подразделения -->
|
|
304
|
+
<div class="root-row" ~class="{ 'drop-hover': bossDropHover }"
|
|
305
|
+
@dragover="onBossDragOver" @dragleave="bossDropHover = false" @drop="onBossDrop">
|
|
306
|
+
<oda-icon :icon="$item?.icon || 'odant:structure'" icon-size="20"></oda-icon>
|
|
307
|
+
<span class="root-title">{{$item?.label || $item?.id}}</span>
|
|
308
|
+
<span class="boss-label">Руководитель (BOSS):</span>
|
|
268
309
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
<oda-icon round :icon="userIcon(currentBoss)" :icon-color="userColor(currentBoss)" icon-size="20"></oda-icon>
|
|
274
|
-
<span>{{userLabel(currentBoss)}}</span>
|
|
275
|
-
<span ~if="canEdit" class="rm" title="Снять локального руководителя (вернуть наследование сверху)" @tap.stop="clearBoss()">×</span>
|
|
310
|
+
<div ~if="visibleCurrentBoss" class="chip" title="Открыть профиль" @tap="openUser(visibleCurrentBoss)">
|
|
311
|
+
<oda-icon round :icon="userIcon(visibleCurrentBoss)" :icon-color="userColor(visibleCurrentBoss)" icon-size="18"></oda-icon>
|
|
312
|
+
<span>{{userLabel(visibleCurrentBoss)}}</span>
|
|
313
|
+
<span ~if="canEdit" class="rm" title="Снять локального руководителя" @tap.stop="clearBoss()">×</span>
|
|
276
314
|
</div>
|
|
277
315
|
|
|
278
|
-
<
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
<
|
|
282
|
-
<span>{{userLabel($for.item)}}</span>
|
|
316
|
+
<div ~if="!visibleCurrentBoss && visibleInheritedBoss" class="chip inherited" title="Наследуется сверху" @tap="openUser(visibleInheritedBoss)">
|
|
317
|
+
<oda-icon round :icon="userIcon(visibleInheritedBoss)" :icon-color="userColor(visibleInheritedBoss)" icon-size="18"></oda-icon>
|
|
318
|
+
<span>{{userLabel(visibleInheritedBoss)}}</span>
|
|
319
|
+
<span class="muted">({{inheritedBossInfo.fromLabel}})</span>
|
|
283
320
|
</div>
|
|
284
321
|
|
|
285
|
-
<
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
<
|
|
290
|
-
|
|
322
|
+
<span ~if="!visibleCurrentBoss && !visibleInheritedBoss" class="muted">не назначен</span>
|
|
323
|
+
|
|
324
|
+
<div ~if="canEdit" class="row-actions">
|
|
325
|
+
<button type="button" class="icon-btn" @tap="toggleBossPicker()">
|
|
326
|
+
<oda-icon icon="editor:mode-edit" icon-size="14"></oda-icon>
|
|
327
|
+
<span>{{visibleCurrentBoss ? 'Сменить' : 'Назначить'}}</span>
|
|
328
|
+
</button>
|
|
329
|
+
<button type="button" class="icon-btn" @tap="openAddRole('')">
|
|
330
|
+
<oda-icon icon="icons:add" icon-size="15"></oda-icon>
|
|
331
|
+
<span>Роль</span>
|
|
332
|
+
</button>
|
|
291
333
|
</div>
|
|
292
334
|
</div>
|
|
293
|
-
</div>
|
|
294
335
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
336
|
+
<!-- Выбор руководителя -->
|
|
337
|
+
<div ~if="canEdit && bossPickerOpen" class="inline-panel">
|
|
338
|
+
<div class="horizontal" style="gap:8px;align-items:center;">
|
|
339
|
+
<input type="text" placeholder="Поиск сотрудника…" ::value="bossSearch" style="flex:1;">
|
|
340
|
+
<oda-button ~if="currentBoss" @tap="clearBoss()">Наследовать сверху</oda-button>
|
|
341
|
+
<oda-button icon="icons:close" @tap="bossPickerOpen = false">Закрыть</oda-button>
|
|
342
|
+
</div>
|
|
343
|
+
<div class="panel-list">
|
|
344
|
+
<div ~if="!filteredBossUsers.length" class="muted" style="padding:6px;">Пользователи не найдены</div>
|
|
345
|
+
<div class="panel-item" ~for="filteredBossUsers" @tap="pickBoss($for.item.id)">
|
|
346
|
+
<oda-icon round :icon="userIcon($for.item.id)" :icon-color="userColor($for.item.id)" icon-size="18"></oda-icon>
|
|
347
|
+
<span>{{$for.item.label}}</span>
|
|
348
|
+
</div>
|
|
307
349
|
</div>
|
|
308
350
|
</div>
|
|
309
|
-
|
|
310
|
-
|
|
351
|
+
|
|
352
|
+
<!-- Добавление корневой роли -->
|
|
353
|
+
<div ~if="canEdit && addingRoleParent === ''" class="inline-panel">
|
|
354
|
+
<div class="horizontal" style="gap:8px;align-items:center;">
|
|
355
|
+
<input type="text" placeholder="Название новой роли…" ::value="newRoleLabel" style="flex:1;" @keydown="onNewRoleKey($event)">
|
|
356
|
+
<oda-button icon="icons:check" info-invert @tap="confirmAddRole()">Добавить</oda-button>
|
|
357
|
+
<oda-button icon="icons:close" @tap="cancelAddRole()">Отмена</oda-button>
|
|
358
|
+
</div>
|
|
311
359
|
</div>
|
|
312
360
|
|
|
313
|
-
<div ~if="!
|
|
361
|
+
<div ~if="!treeRows.length" class="muted" style="padding:16px;">Ролей пока нет</div>
|
|
314
362
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
363
|
+
<!-- Единое дерево ролей и классов -->
|
|
364
|
+
<div ~for="treeRows" style="display:contents;">
|
|
365
|
+
<!-- Строка роли -->
|
|
366
|
+
<div ~if="$for.item.kind === 'role'" class="tree-row role-row"
|
|
367
|
+
~class="{ 'drop-hover': dropHoverTrail === $for.item.trail }"
|
|
368
|
+
:style="'padding-left:' + (12 + $for.item.depth * 24) + 'px'"
|
|
369
|
+
@dragover="onRoleDragOver($event, $for.item.trail)"
|
|
370
|
+
@dragleave="onRoleDragLeave($for.item.trail)"
|
|
371
|
+
@drop="onRoleDrop($event, $for.item.trail)">
|
|
320
372
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
<
|
|
325
|
-
<span
|
|
373
|
+
<span class="expander" @tap="toggleRoleExpand($for.item.trail)">
|
|
374
|
+
{{$for.item.hasChildren ? ($for.item.expanded ? '▾' : '▸') : ''}}
|
|
375
|
+
</span>
|
|
376
|
+
<oda-icon :icon="$for.item.external ? 'icons:public' : 'fontawesome:s-user-tie'" icon-size="16"></oda-icon>
|
|
377
|
+
<span class="role-name">{{$for.item.label}}</span>
|
|
378
|
+
<span ~if="$for.item.external" class="badge ext">клиент</span>
|
|
379
|
+
<span ~if="$for.item.mine" class="badge">ваша роль</span>
|
|
326
380
|
|
|
327
|
-
<div
|
|
328
|
-
<
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
381
|
+
<div class="members-wrap">
|
|
382
|
+
<div class="chip" ~for="$for.item.memberEntries"
|
|
383
|
+
~class="{ 'node-chip': $for.$for.item.isNode }"
|
|
384
|
+
@tap="openMember($for.$for.item)">
|
|
385
|
+
<oda-icon :round="!$for.$for.item.isNode && !$for.$for.item.isGroup" :icon="$for.$for.item.icon" :icon-color="$for.$for.item.iconColor" icon-size="16"></oda-icon>
|
|
386
|
+
<span>{{$for.$for.item.label}}</span>
|
|
387
|
+
<span ~if="canEdit" class="rm" title="Убрать из роли" @tap.stop="removeRoleMember($for.item.trail, $for.$for.item.id)">×</span>
|
|
388
|
+
</div>
|
|
389
|
+
<button ~if="canEdit" type="button" class="icon-btn" title="Добавить участника (человека или подразделение)" @tap="toggleMemberPicker($for.item.trail)">
|
|
390
|
+
<oda-icon icon="icons:add" icon-size="14"></oda-icon>
|
|
391
|
+
</button>
|
|
334
392
|
</div>
|
|
335
|
-
</div>
|
|
336
393
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
<
|
|
344
|
-
<
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
<
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
</div>
|
|
353
|
-
<div ~if="inviteResult" class="role-row">
|
|
354
|
-
<input type="text" readonly :value="inviteResult.url" style="flex:1;min-width:240px;font-family:monospace;font-size:12px;">
|
|
355
|
-
<oda-button icon="icons:content-copy" @tap="copyText(inviteResult.url)">Копировать</oda-button>
|
|
356
|
-
<a ~if="inviteResult.shareUrl" :href="inviteResult.shareUrl" target="_blank" rel="noopener" style="font-size:13px;color:var(--accent-color);text-decoration:none;font-weight:600;">Открыть в Telegram ↗</a>
|
|
357
|
-
<span ~if="inviteResult.sent" style="color:#15803d;font-size:13px;font-weight:600;">✓ Отправлено ({{inviteResult.sentVia}})</span>
|
|
358
|
-
<span ~if="inviteResult.warning" class="muted" style="color:#b45309;">{{inviteResult.warning}}</span>
|
|
394
|
+
<div ~if="canEdit" class="row-actions">
|
|
395
|
+
<button type="button" class="icon-btn" title="Привязать классы" @tap="toggleClassPicker($for.item.trail)">
|
|
396
|
+
<oda-icon icon="icons:add" icon-size="14"></oda-icon>
|
|
397
|
+
<span>Класс</span>
|
|
398
|
+
</button>
|
|
399
|
+
<button type="button" class="icon-btn" title="Добавить дочернюю роль" @tap="openAddRole($for.item.trail)">
|
|
400
|
+
<oda-icon icon="icons:add" icon-size="14"></oda-icon>
|
|
401
|
+
<span>Подроль</span>
|
|
402
|
+
</button>
|
|
403
|
+
<button type="button" class="icon-btn" ~class="{ active: $for.item.external }" title="Режим внешнего клиента (CLIENT)" @tap="toggleRoleExternal($for.item.trail, !$for.item.external)">
|
|
404
|
+
<oda-icon icon="icons:public" icon-size="14"></oda-icon>
|
|
405
|
+
</button>
|
|
406
|
+
<button type="button" class="icon-btn danger" title="Удалить роль" @tap="removeRole($for.item.trail)">
|
|
407
|
+
<oda-icon icon="icons:delete" icon-size="14"></oda-icon>
|
|
408
|
+
</button>
|
|
359
409
|
</div>
|
|
360
410
|
</div>
|
|
361
411
|
|
|
362
|
-
<!--
|
|
363
|
-
<div
|
|
364
|
-
|
|
365
|
-
<div class="
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
@tap="
|
|
369
|
-
<oda-icon :round="!$for.$for.item.isNode && !$for.$for.item.isGroup" :icon="$for.$for.item.icon" :icon-color="$for.$for.item.iconColor" icon-size="18"></oda-icon>
|
|
370
|
-
<span>{{$for.$for.item.label}}</span>
|
|
371
|
-
<span ~if="canEdit" class="rm" title="Убрать из роли" @tap.stop="removeRoleMember($for.item.trail, $for.$for.item.id)">×</span>
|
|
412
|
+
<!-- Инлайн-добавление дочерней роли -->
|
|
413
|
+
<div ~if="$for.item.kind === 'role' && canEdit && addingRoleParent === $for.item.trail"
|
|
414
|
+
class="inline-panel" :style="'padding-left:' + (36 + $for.item.depth * 24) + 'px'">
|
|
415
|
+
<div class="horizontal" style="gap:8px;align-items:center;">
|
|
416
|
+
<input type="text" placeholder="Название дочерней роли…" ::value="newRoleLabel" style="flex:1;" @keydown="onNewRoleKey($event)">
|
|
417
|
+
<oda-button icon="icons:check" info-invert @tap="confirmAddRole()">Добавить</oda-button>
|
|
418
|
+
<oda-button icon="icons:close" @tap="cancelAddRole()">Отмена</oda-button>
|
|
372
419
|
</div>
|
|
373
|
-
<span ~if="!$for.item.memberEntries.length" class="muted">никто не назначен (перетащите из дерева или выберите справа)</span>
|
|
374
|
-
</div>
|
|
375
|
-
|
|
376
|
-
<div ~if="canEdit" class="role-row">
|
|
377
|
-
<span class="role-title"></span>
|
|
378
|
-
<input type="text" placeholder="Фильтр по ФИО…" ::value="userSearch" style="width:130px;">
|
|
379
|
-
<select @change="addRoleMember($for.item.trail, $event)">
|
|
380
|
-
<option value="">+ Добавить сотрудника…</option>
|
|
381
|
-
<option value="USERS">👥 Все сотрудники (USERS)</option>
|
|
382
|
-
<option value="GUESTS">🌐 Все гости (GUESTS)</option>
|
|
383
|
-
<option ~for="filteredUsers" :value="$for.$for.item.id">{{$for.$for.item.label}} ({{$for.$for.item.id}})</option>
|
|
384
|
-
</select>
|
|
385
|
-
<select ~if="availableStructures.length" @change="addRoleMember($for.item.trail, $event)">
|
|
386
|
-
<option value="">+ Добавить подразделение…</option>
|
|
387
|
-
<option ~for="availableStructures" :value="$for.$for.item.path">🏛 {{$for.$for.item.label}}</option>
|
|
388
|
-
</select>
|
|
389
420
|
</div>
|
|
390
421
|
|
|
391
|
-
<!--
|
|
392
|
-
<div
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
<
|
|
396
|
-
|
|
397
|
-
</oda-button>
|
|
398
|
-
<span class="hint" ~if="canEdit">или перетащите класс из левого дерева на эту роль</span>
|
|
422
|
+
<!-- Инлайн-выбор участника (сотрудники / подразделения) -->
|
|
423
|
+
<div ~if="$for.item.kind === 'role' && canEdit && memberPickerTrail === $for.item.trail"
|
|
424
|
+
class="inline-panel" :style="'padding-left:' + (36 + $for.item.depth * 24) + 'px'">
|
|
425
|
+
<div class="horizontal" style="gap:8px;align-items:center;">
|
|
426
|
+
<input type="text" placeholder="Поиск человека или подразделения…" ::value="memberSearch" style="flex:1;">
|
|
427
|
+
<oda-button icon="icons:close" @tap="closeMemberPicker()">Закрыть</oda-button>
|
|
399
428
|
</div>
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
<input type="text" placeholder="Поиск по названию класса или модуля…" ::value="classSearch" style="flex:1;min-width:220px;">
|
|
405
|
-
<oda-button icon="icons:check" info-invert :disabled="!selectedPickerCount" @tap="applyClassPicker($for.item.trail)">
|
|
406
|
-
Добавить выбранные ({{selectedPickerCount}})
|
|
407
|
-
</oda-button>
|
|
408
|
-
<oda-button icon="icons:close" @tap="closeClassPicker()">Закрыть</oda-button>
|
|
429
|
+
<div class="panel-list">
|
|
430
|
+
<div class="panel-item" ~for="filteredUsers" @tap="pickMember($for.item.trail, $for.$for.item.id)">
|
|
431
|
+
<oda-icon round :icon="userIcon($for.$for.item.id)" :icon-color="userColor($for.$for.item.id)" icon-size="18"></oda-icon>
|
|
432
|
+
<span>{{$for.$for.item.label}}</span>
|
|
409
433
|
</div>
|
|
410
|
-
<div class="
|
|
411
|
-
<
|
|
412
|
-
<
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
434
|
+
<div class="panel-item" ~for="filteredStructures" @tap="pickMember($for.item.trail, $for.$for.item.path)">
|
|
435
|
+
<oda-icon :icon="$for.$for.item.icon || 'odant:structure'" icon-size="18"></oda-icon>
|
|
436
|
+
<span>{{$for.$for.item.label}}</span>
|
|
437
|
+
<span class="muted">подразделение</span>
|
|
438
|
+
</div>
|
|
439
|
+
<div class="panel-item" @tap="pickMember($for.item.trail, 'USERS')">
|
|
440
|
+
<oda-icon icon="social:people" icon-size="18"></oda-icon>
|
|
441
|
+
<span>Все сотрудники</span>
|
|
442
|
+
</div>
|
|
443
|
+
<div class="panel-item" @tap="pickMember($for.item.trail, 'GUESTS')">
|
|
444
|
+
<oda-icon icon="icons:public" icon-size="18"></oda-icon>
|
|
445
|
+
<span>Все гости</span>
|
|
422
446
|
</div>
|
|
423
447
|
</div>
|
|
448
|
+
</div>
|
|
424
449
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
450
|
+
<!-- Инлайн-дерево выбора классов -->
|
|
451
|
+
<div ~if="$for.item.kind === 'role' && canEdit && pickerTrail === $for.item.trail"
|
|
452
|
+
class="inline-panel" :style="'padding-left:' + (36 + $for.item.depth * 24) + 'px'">
|
|
453
|
+
<div class="horizontal" style="gap:8px;align-items:center;">
|
|
454
|
+
<input type="text" placeholder="Поиск класса…" ::value="classSearch" style="flex:1;">
|
|
455
|
+
<oda-button icon="icons:check" info-invert :disabled="!selectedPickerCount" @tap="applyClassPicker($for.item.trail)">
|
|
456
|
+
Добавить ({{selectedPickerCount}})
|
|
457
|
+
</oda-button>
|
|
458
|
+
<oda-button icon="icons:close" @tap="closeClassPicker()">Закрыть</oda-button>
|
|
459
|
+
</div>
|
|
460
|
+
<div class="panel-list">
|
|
461
|
+
<div ~if="!visibleClassNodes.length" class="muted" style="padding:6px;">Классы не найдены</div>
|
|
462
|
+
<div class="panel-item" ~for="visibleClassNodes" :style="'padding-left:' + (6 + $for.$for.item.depth * 18) + 'px'">
|
|
463
|
+
<span ~if="$for.$for.item.hasChildren" style="width:14px;text-align:center;font-weight:700;" @tap.stop="toggleClassExpand($for.$for.item.path)">
|
|
464
|
+
{{$for.$for.item.expanded ? '▾' : '▸'}}
|
|
465
|
+
</span>
|
|
466
|
+
<span ~if="!$for.$for.item.hasChildren" style="width:14px;"></span>
|
|
467
|
+
<input ~if="$for.$for.item.selectable" type="checkbox" :checked="$for.$for.item.checked" @change="togglePickerCheck($for.$for.item.path, $event.target.checked)">
|
|
468
|
+
<oda-icon :icon="$for.$for.item.icon" icon-size="16"></oda-icon>
|
|
469
|
+
<span style="flex:1;" @tap="onPickerLabelTap($for.$for.item)">{{$for.$for.item.label}}</span>
|
|
433
470
|
</div>
|
|
434
|
-
<select :disabled="!canEdit" title="Какие записи видит роль в этом классе" @change="updateRoleLinkScope($for.item.trail, $for.$for.item.id, $event.target.value)">
|
|
435
|
-
<option value="" :selected="!$for.$for.item.scope">Все записи (по умолчанию)</option>
|
|
436
|
-
<option value="all" :selected="$for.$for.item.scope === 'all'">Все записи организации</option>
|
|
437
|
-
<option value="unit" :selected="$for.$for.item.scope === 'unit'">Только своего подразделения</option>
|
|
438
|
-
<option value="place" :selected="$for.$for.item.scope === 'place'">Только своей роли</option>
|
|
439
|
-
<option value="own" :selected="$for.$for.item.scope === 'own'">Только свои записи</option>
|
|
440
|
-
</select>
|
|
441
|
-
<span ~if="canEdit" style="cursor:pointer;color:#b91c1c;font-weight:bold;padding:0 4px;" title="Отвязать класс" @tap="removeRoleLink($for.item.trail, $for.$for.item.id)">×</span>
|
|
442
471
|
</div>
|
|
443
472
|
</div>
|
|
444
|
-
</div>
|
|
445
|
-
</div>
|
|
446
473
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
474
|
+
<!-- Строка привязанного класса внутри роли -->
|
|
475
|
+
<div ~if="$for.item.kind === 'class'" class="tree-row class-row"
|
|
476
|
+
:style="'padding-left:' + (28 + $for.item.depth * 24) + 'px'">
|
|
477
|
+
<oda-icon :icon="$for.item.icon" icon-size="15"></oda-icon>
|
|
478
|
+
<span class="class-title" :title="$for.item.id" @tap="openClass($for.item.id)">{{$for.item.title}}</span>
|
|
479
|
+
<span ~if="$for.item.section" class="class-section">{{$for.item.section}}</span>
|
|
480
|
+
<label class="write-check" title="Разрешить создание и изменение записей">
|
|
481
|
+
<input type="checkbox" :checked="$for.item.isWrite" :disabled="!canEdit"
|
|
482
|
+
@change="updateRoleLinkAccess($for.item.trail, $for.item.id, $event.target.checked ? 'write' : 'read')">
|
|
483
|
+
<span>Изменение</span>
|
|
484
|
+
</label>
|
|
485
|
+
<button ~if="canEdit" type="button" class="icon-btn danger" title="Отвязать класс" @tap="removeRoleLink($for.item.trail, $for.item.id)">×</button>
|
|
458
486
|
</div>
|
|
459
487
|
</div>
|
|
460
488
|
</div>
|
|
461
489
|
|
|
462
|
-
<div ~if="error" style="color:var(--error-color, #
|
|
490
|
+
<div ~if="error" style="color:var(--error-color, #dc2626);font-size:12.5px;">{{error}}</div>
|
|
463
491
|
`,
|
|
464
492
|
$item: {
|
|
465
493
|
$def: null,
|
|
@@ -479,23 +507,19 @@ export default {
|
|
|
479
507
|
classMap: {},
|
|
480
508
|
canEdit: false,
|
|
481
509
|
focusedTrail: '',
|
|
482
|
-
|
|
483
|
-
|
|
510
|
+
expandedRoles: {},
|
|
511
|
+
bossPickerOpen: false,
|
|
484
512
|
bossSearch: '',
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
513
|
+
addingRoleParent: null,
|
|
514
|
+
newRoleLabel: '',
|
|
515
|
+
memberPickerTrail: '',
|
|
516
|
+
memberSearch: '',
|
|
488
517
|
pickerTrail: '',
|
|
489
518
|
classSearch: '',
|
|
490
519
|
expandedClassPaths: {},
|
|
491
520
|
pickerChecked: {},
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
inviteRecipient: '',
|
|
495
|
-
inviteNote: '',
|
|
496
|
-
inviteBusy: false,
|
|
497
|
-
inviteResult: null,
|
|
498
|
-
invitesList: [],
|
|
521
|
+
bossDropHover: false,
|
|
522
|
+
dropHoverTrail: '',
|
|
499
523
|
error: '',
|
|
500
524
|
async attached() {
|
|
501
525
|
if (this.$item)
|
|
@@ -510,82 +534,131 @@ export default {
|
|
|
510
534
|
const list = Array.isArray(this.security?.BOSS) ? this.security.BOSS : [];
|
|
511
535
|
return list[0] || '';
|
|
512
536
|
},
|
|
537
|
+
get visibleCurrentBoss() {
|
|
538
|
+
const id = this.currentBoss;
|
|
539
|
+
if (!id)
|
|
540
|
+
return '';
|
|
541
|
+
return this.userMap?.[id] ? id : '';
|
|
542
|
+
},
|
|
543
|
+
get visibleInheritedBoss() {
|
|
544
|
+
const id = this.inheritedBossInfo?.users?.[0] || '';
|
|
545
|
+
if (!id)
|
|
546
|
+
return '';
|
|
547
|
+
return this.userMap?.[id] ? id : '';
|
|
548
|
+
},
|
|
513
549
|
get filteredBossUsers() {
|
|
514
550
|
const q = String(this.bossSearch || '').trim().toLowerCase();
|
|
515
|
-
const cur = this.currentBoss;
|
|
516
551
|
return (this.allUsers || []).filter(u =>
|
|
517
|
-
|
|
552
|
+
!q || u.label.toLowerCase().includes(q)
|
|
518
553
|
);
|
|
519
554
|
},
|
|
520
555
|
get filteredUsers() {
|
|
521
|
-
const q = String(this.
|
|
556
|
+
const q = String(this.memberSearch || '').trim().toLowerCase();
|
|
522
557
|
if (!q)
|
|
523
558
|
return this.allUsers || [];
|
|
524
|
-
return (this.allUsers || []).filter(u =>
|
|
525
|
-
u.label.toLowerCase().includes(q) || u.id.toLowerCase().includes(q)
|
|
526
|
-
);
|
|
559
|
+
return (this.allUsers || []).filter(u => u.label.toLowerCase().includes(q));
|
|
527
560
|
},
|
|
528
|
-
get
|
|
529
|
-
const
|
|
530
|
-
|
|
561
|
+
get filteredStructures() {
|
|
562
|
+
const q = String(this.memberSearch || '').trim().toLowerCase();
|
|
563
|
+
if (!q)
|
|
564
|
+
return this.availableStructures || [];
|
|
565
|
+
return (this.availableStructures || []).filter(s => String(s.label || '').toLowerCase().includes(q));
|
|
566
|
+
},
|
|
567
|
+
get treeRows() {
|
|
568
|
+
const rows = [];
|
|
569
|
+
const walk = (roles, prefix = '', depth = 0) => {
|
|
531
570
|
for (const r of Array.isArray(roles) ? roles : []) {
|
|
532
571
|
if (!r?.id)
|
|
533
572
|
continue;
|
|
534
573
|
const trail = prefix ? `${prefix}/${r.id}` : r.id;
|
|
535
|
-
const
|
|
536
|
-
const
|
|
574
|
+
const links = Array.isArray(r.LINKS) ? r.LINKS : [];
|
|
575
|
+
const childRoles = Array.isArray(r.ROLES) ? r.ROLES : [];
|
|
576
|
+
const hasChildren = links.length > 0 || childRoles.length > 0;
|
|
577
|
+
const expanded = this.expandedRoles?.[trail] !== false;
|
|
578
|
+
|
|
579
|
+
const memberEntries = [];
|
|
580
|
+
for (const id of Array.isArray(r.USERS) ? r.USERS : []) {
|
|
537
581
|
if (typeof id === 'string' && id.startsWith('/')) {
|
|
538
582
|
const st = this.structureMap?.[id];
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
583
|
+
if (!st && !Object.keys(this.structureMap || {}).length) {
|
|
584
|
+
memberEntries.push({
|
|
585
|
+
id,
|
|
586
|
+
isNode: true,
|
|
587
|
+
isGroup: false,
|
|
588
|
+
label: id.split('/').pop() || id,
|
|
589
|
+
icon: 'odant:structure',
|
|
590
|
+
iconColor: '',
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
else if (st) {
|
|
594
|
+
memberEntries.push({
|
|
595
|
+
id,
|
|
596
|
+
isNode: true,
|
|
597
|
+
isGroup: false,
|
|
598
|
+
label: st.label || id.split('/').pop() || id,
|
|
599
|
+
icon: st.icon || 'odant:structure',
|
|
600
|
+
iconColor: '',
|
|
601
|
+
});
|
|
602
|
+
}
|
|
547
603
|
}
|
|
548
|
-
if (id === 'USERS' || id === 'GUESTS' || id === 'GUEST') {
|
|
549
|
-
|
|
604
|
+
else if (id === 'USERS' || id === 'GUESTS' || id === 'GUEST') {
|
|
605
|
+
memberEntries.push({
|
|
550
606
|
id,
|
|
551
607
|
isNode: false,
|
|
552
608
|
isGroup: true,
|
|
553
|
-
label:
|
|
609
|
+
label: id === 'USERS' ? 'Все сотрудники' : 'Все гости',
|
|
554
610
|
icon: id === 'USERS' ? 'social:people' : 'icons:public',
|
|
555
611
|
iconColor: '',
|
|
556
|
-
};
|
|
612
|
+
});
|
|
557
613
|
}
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
scope: l.scope || '',
|
|
573
|
-
}));
|
|
574
|
-
out.push({
|
|
614
|
+
else if (this.userMap?.[id]) {
|
|
615
|
+
memberEntries.push({
|
|
616
|
+
id,
|
|
617
|
+
isNode: false,
|
|
618
|
+
isGroup: false,
|
|
619
|
+
label: this.userLabel(id),
|
|
620
|
+
icon: this.userIcon(id),
|
|
621
|
+
iconColor: this.userColor(id),
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
rows.push({
|
|
627
|
+
kind: 'role',
|
|
575
628
|
trail,
|
|
576
629
|
id: r.id,
|
|
577
630
|
label: r.label || r.id,
|
|
578
|
-
|
|
631
|
+
depth,
|
|
632
|
+
hasChildren,
|
|
633
|
+
expanded,
|
|
579
634
|
external: Boolean(r.external),
|
|
635
|
+
mine: Boolean(r.mine),
|
|
580
636
|
memberEntries,
|
|
581
|
-
linkEntries,
|
|
582
637
|
});
|
|
583
|
-
|
|
584
|
-
|
|
638
|
+
|
|
639
|
+
if (expanded) {
|
|
640
|
+
for (const l of links) {
|
|
641
|
+
if (!l?.id)
|
|
642
|
+
continue;
|
|
643
|
+
const info = splitClassTitle(l.id, this.classMap?.[l.id]);
|
|
644
|
+
rows.push({
|
|
645
|
+
kind: 'class',
|
|
646
|
+
trail,
|
|
647
|
+
id: l.id,
|
|
648
|
+
depth,
|
|
649
|
+
title: info.title,
|
|
650
|
+
section: info.section,
|
|
651
|
+
icon: info.icon || 'odant:class',
|
|
652
|
+
isWrite: l.access === 'write',
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
if (childRoles.length)
|
|
656
|
+
walk(childRoles, trail, depth + 1);
|
|
657
|
+
}
|
|
585
658
|
}
|
|
586
659
|
};
|
|
587
|
-
walk(this.security?.ROLES || []);
|
|
588
|
-
return
|
|
660
|
+
walk(this.security?.ROLES || [], '', 0);
|
|
661
|
+
return rows;
|
|
589
662
|
},
|
|
590
663
|
get selectedPickerCount() {
|
|
591
664
|
return Object.keys(this.pickerChecked || {}).filter(k => this.pickerChecked[k]).length;
|
|
@@ -594,25 +667,21 @@ export default {
|
|
|
594
667
|
const q = String(this.classSearch || '').trim().toLowerCase();
|
|
595
668
|
const out = [];
|
|
596
669
|
const matchSubtree = (node) => {
|
|
597
|
-
const selfMatch = String(node.label || '').toLowerCase().includes(q)
|
|
598
|
-
|| String(node.shortPath || '').toLowerCase().includes(q);
|
|
670
|
+
const selfMatch = String(node.label || '').toLowerCase().includes(q);
|
|
599
671
|
const kids = Array.isArray(node.children) ? node.children : [];
|
|
600
672
|
if (!q)
|
|
601
|
-
return { match: true
|
|
602
|
-
|
|
603
|
-
return { match: selfMatch || childMatched, childMatched };
|
|
673
|
+
return { match: true };
|
|
674
|
+
return { match: selfMatch || kids.some(k => matchSubtree(k).match) };
|
|
604
675
|
};
|
|
605
676
|
const walk = (nodes, depth = 0) => {
|
|
606
677
|
for (const n of Array.isArray(nodes) ? nodes : []) {
|
|
607
678
|
const kids = Array.isArray(n.children) ? n.children : [];
|
|
608
|
-
|
|
609
|
-
if (!info.match)
|
|
679
|
+
if (!matchSubtree(n).match)
|
|
610
680
|
continue;
|
|
611
681
|
const expanded = q ? true : Boolean(this.expandedClassPaths?.[n.path] ?? (depth === 0));
|
|
612
682
|
out.push({
|
|
613
683
|
path: n.path,
|
|
614
684
|
label: n.label,
|
|
615
|
-
shortPath: n.shortPath || '',
|
|
616
685
|
depth,
|
|
617
686
|
icon: n.icon || 'odant:class',
|
|
618
687
|
selectable: Boolean(n.selectable),
|
|
@@ -628,10 +697,6 @@ export default {
|
|
|
628
697
|
return out;
|
|
629
698
|
},
|
|
630
699
|
userLabel(uid) {
|
|
631
|
-
if (uid === 'USERS')
|
|
632
|
-
return 'Все сотрудники (USERS)';
|
|
633
|
-
if (uid === 'GUESTS' || uid === 'GUEST')
|
|
634
|
-
return 'Все гости (GUESTS)';
|
|
635
700
|
return this.userMap?.[uid] || uid;
|
|
636
701
|
},
|
|
637
702
|
userIcon(uid) {
|
|
@@ -649,14 +714,6 @@ export default {
|
|
|
649
714
|
return meta?.iconColor || '#3b82f6';
|
|
650
715
|
return '';
|
|
651
716
|
},
|
|
652
|
-
classTitle(path) {
|
|
653
|
-
if (this.classMap?.[path])
|
|
654
|
-
return this.classMap[path];
|
|
655
|
-
return String(path || '')
|
|
656
|
-
.replace(/^\/(?:ORGANIZATIONS|PROJECTS)\/[^/]+\/MODULES\//, '')
|
|
657
|
-
.replace(/^\/MODULES\//, 'Общие / ')
|
|
658
|
-
.replace(/\//g, ' → ');
|
|
659
|
-
},
|
|
660
717
|
async reload() {
|
|
661
718
|
this.error = '';
|
|
662
719
|
if (!this.$item)
|
|
@@ -670,7 +727,6 @@ export default {
|
|
|
670
727
|
this.loadUsers(),
|
|
671
728
|
this.loadAvailableClasses(),
|
|
672
729
|
this.loadAvailableStructures(),
|
|
673
|
-
this.loadInvites(),
|
|
674
730
|
]);
|
|
675
731
|
}
|
|
676
732
|
else {
|
|
@@ -686,7 +742,7 @@ export default {
|
|
|
686
742
|
...(p.external ? { external: true } : {}),
|
|
687
743
|
...(p.mine ? { mine: true } : {}),
|
|
688
744
|
USERS: Array.isArray(p.users) ? p.users : [],
|
|
689
|
-
LINKS: Array.isArray(p.links) ? p.links.map(l => ({ id: l.id, access: l.access || 'read', scope: l.scope
|
|
745
|
+
LINKS: Array.isArray(p.links) ? p.links.map(l => ({ id: l.id, access: l.access || 'read', ...(l.scope ? { scope: l.scope } : {}) })) : [],
|
|
690
746
|
ROLES: toRoles(p.roles),
|
|
691
747
|
}));
|
|
692
748
|
this.security = {
|
|
@@ -695,7 +751,6 @@ export default {
|
|
|
695
751
|
};
|
|
696
752
|
this.classTreeRoots = [];
|
|
697
753
|
this.availableStructures = [];
|
|
698
|
-
this.invitesList = [];
|
|
699
754
|
}
|
|
700
755
|
await this.loadInheritedBoss();
|
|
701
756
|
}
|
|
@@ -703,33 +758,6 @@ export default {
|
|
|
703
758
|
this.error = String(e?.message || e);
|
|
704
759
|
}
|
|
705
760
|
},
|
|
706
|
-
async openUser(uid) {
|
|
707
|
-
if (!uid || uid === 'USERS' || uid === 'GUESTS' || uid === 'GUEST')
|
|
708
|
-
return;
|
|
709
|
-
if (typeof window?.execute !== 'function')
|
|
710
|
-
return;
|
|
711
|
-
const target = await WORK.get_item(`/USERS/${uid}`).catch(() => null);
|
|
712
|
-
if (target)
|
|
713
|
-
window.execute(target);
|
|
714
|
-
},
|
|
715
|
-
async openMember(entry) {
|
|
716
|
-
if (!entry || entry.isGroup || typeof window?.execute !== 'function')
|
|
717
|
-
return;
|
|
718
|
-
if (entry.isNode) {
|
|
719
|
-
const target = await WORK.get_item(entry.id).catch(() => null);
|
|
720
|
-
if (target)
|
|
721
|
-
window.execute(target);
|
|
722
|
-
return;
|
|
723
|
-
}
|
|
724
|
-
await this.openUser(entry.id);
|
|
725
|
-
},
|
|
726
|
-
async openClass(clsPath) {
|
|
727
|
-
if (!clsPath || typeof window?.execute !== 'function')
|
|
728
|
-
return;
|
|
729
|
-
const target = await WORK.get_item(clsPath).catch(() => null);
|
|
730
|
-
if (target)
|
|
731
|
-
window.execute(target);
|
|
732
|
-
},
|
|
733
761
|
async loadUsers() {
|
|
734
762
|
try {
|
|
735
763
|
const uRoot = (await WORK.get_item('/USERS')) || (await WORK.get_item('/users'));
|
|
@@ -810,8 +838,14 @@ export default {
|
|
|
810
838
|
const map = {};
|
|
811
839
|
const indexNodes = (nodes) => {
|
|
812
840
|
for (const n of Array.isArray(nodes) ? nodes : []) {
|
|
813
|
-
if (n?.path && n.selectable)
|
|
814
|
-
|
|
841
|
+
if (n?.path && n.selectable) {
|
|
842
|
+
const base = splitClassTitle(n.shortPath || n.path);
|
|
843
|
+
map[n.path] = {
|
|
844
|
+
title: n.label || base.title,
|
|
845
|
+
section: base.section,
|
|
846
|
+
icon: n.icon || 'odant:class',
|
|
847
|
+
};
|
|
848
|
+
}
|
|
815
849
|
if (Array.isArray(n?.children))
|
|
816
850
|
indexNodes(n.children);
|
|
817
851
|
}
|
|
@@ -859,6 +893,39 @@ export default {
|
|
|
859
893
|
this.error = String(e?.message || e);
|
|
860
894
|
}
|
|
861
895
|
},
|
|
896
|
+
async openUser(uid) {
|
|
897
|
+
if (!uid || uid === 'USERS' || uid === 'GUESTS' || uid === 'GUEST' || typeof window?.execute !== 'function')
|
|
898
|
+
return;
|
|
899
|
+
const target = await WORK.get_item(`/USERS/${uid}`).catch(() => null);
|
|
900
|
+
if (target)
|
|
901
|
+
window.execute(target);
|
|
902
|
+
},
|
|
903
|
+
async openMember(entry) {
|
|
904
|
+
if (!entry || entry.isGroup || typeof window?.execute !== 'function')
|
|
905
|
+
return;
|
|
906
|
+
if (entry.isNode) {
|
|
907
|
+
const target = await WORK.get_item(entry.id).catch(() => null);
|
|
908
|
+
if (target)
|
|
909
|
+
window.execute(target);
|
|
910
|
+
return;
|
|
911
|
+
}
|
|
912
|
+
await this.openUser(entry.id);
|
|
913
|
+
},
|
|
914
|
+
async openClass(clsPath) {
|
|
915
|
+
if (!clsPath || typeof window?.execute !== 'function')
|
|
916
|
+
return;
|
|
917
|
+
const target = await WORK.get_item(clsPath).catch(() => null);
|
|
918
|
+
if (target)
|
|
919
|
+
window.execute(target);
|
|
920
|
+
},
|
|
921
|
+
toggleBossPicker() {
|
|
922
|
+
this.bossPickerOpen = !this.bossPickerOpen;
|
|
923
|
+
this.bossSearch = '';
|
|
924
|
+
},
|
|
925
|
+
async pickBoss(uid) {
|
|
926
|
+
this.bossPickerOpen = false;
|
|
927
|
+
await this.setBoss(uid);
|
|
928
|
+
},
|
|
862
929
|
async setBoss(uid) {
|
|
863
930
|
const sec = JSON.parse(JSON.stringify(this.security || {}));
|
|
864
931
|
const cleanUid = String(uid || '').trim();
|
|
@@ -867,6 +934,7 @@ export default {
|
|
|
867
934
|
await this.persist(sec, `Назначен руководитель: ${label}`, `В подразделении ${this.$item?.path || ''} руководитель (BOSS): ${label}.`);
|
|
868
935
|
},
|
|
869
936
|
async clearBoss() {
|
|
937
|
+
this.bossPickerOpen = false;
|
|
870
938
|
await this.setBoss('');
|
|
871
939
|
},
|
|
872
940
|
onBossDragOver(e) {
|
|
@@ -884,7 +952,7 @@ export default {
|
|
|
884
952
|
e.preventDefault();
|
|
885
953
|
const dropped = parseDroppedItem(e);
|
|
886
954
|
if (!isDroppedUser(dropped)) {
|
|
887
|
-
this.error = 'Для назначения руководителя перетащите пользователя из
|
|
955
|
+
this.error = 'Для назначения руководителя перетащите пользователя из дерева.';
|
|
888
956
|
return;
|
|
889
957
|
}
|
|
890
958
|
const uid = dropped.id || dropped.path.split('/').pop();
|
|
@@ -922,11 +990,14 @@ export default {
|
|
|
922
990
|
await this._addMemberToRole(trail, dropped.path);
|
|
923
991
|
return;
|
|
924
992
|
}
|
|
925
|
-
if (isDroppedClass(dropped)) {
|
|
926
|
-
|
|
927
|
-
await this._addLinksToRole(trail, [dropped.path]);
|
|
993
|
+
if (isDroppedClass(dropped) && dropped.path) {
|
|
994
|
+
await this._addLinksToRole(trail, [dropped.path]);
|
|
928
995
|
}
|
|
929
996
|
},
|
|
997
|
+
toggleRoleExpand(trail) {
|
|
998
|
+
const cur = this.expandedRoles?.[trail] !== false;
|
|
999
|
+
this.expandedRoles = { ...this.expandedRoles, [trail]: !cur };
|
|
1000
|
+
},
|
|
930
1001
|
_findRoleMut(sec, trail) {
|
|
931
1002
|
const steps = String(trail || '').split('/').filter(Boolean);
|
|
932
1003
|
let list = Array.isArray(sec.ROLES) ? sec.ROLES : [];
|
|
@@ -939,28 +1010,36 @@ export default {
|
|
|
939
1010
|
}
|
|
940
1011
|
return node;
|
|
941
1012
|
},
|
|
1013
|
+
openAddRole(parentTrail = '') {
|
|
1014
|
+
this.addingRoleParent = this.addingRoleParent === parentTrail ? null : parentTrail;
|
|
1015
|
+
this.newRoleLabel = '';
|
|
1016
|
+
},
|
|
1017
|
+
cancelAddRole() {
|
|
1018
|
+
this.addingRoleParent = null;
|
|
1019
|
+
this.newRoleLabel = '';
|
|
1020
|
+
},
|
|
942
1021
|
onNewRoleKey(e) {
|
|
943
1022
|
if (e?.key === 'Enter')
|
|
944
|
-
this.
|
|
1023
|
+
this.confirmAddRole();
|
|
1024
|
+
else if (e?.key === 'Escape')
|
|
1025
|
+
this.cancelAddRole();
|
|
945
1026
|
},
|
|
946
|
-
async
|
|
1027
|
+
async confirmAddRole() {
|
|
947
1028
|
const label = String(this.newRoleLabel || '').trim();
|
|
948
1029
|
if (!label)
|
|
949
1030
|
return;
|
|
1031
|
+
const parentTrail = this.addingRoleParent || '';
|
|
950
1032
|
const id = label.toLowerCase().replace(/[^a-zа-яё0-9_-]+/gi, '_').replace(/^_+|_+$/g, '') || ('role_' + Date.now());
|
|
951
1033
|
const sec = JSON.parse(JSON.stringify(this.security || {}));
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
sec.ROLES
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
...(this.newRoleExternal ? { external: true } : {}),
|
|
958
|
-
USERS: [],
|
|
959
|
-
LINKS: [],
|
|
960
|
-
});
|
|
1034
|
+
const targetList = parentTrail
|
|
1035
|
+
? ((this._findRoleMut(sec, parentTrail) || {}).ROLES ??= [])
|
|
1036
|
+
: (sec.ROLES ??= []);
|
|
1037
|
+
if (!targetList.some(r => r.id === id)) {
|
|
1038
|
+
targetList.push({ id, label, USERS: [], LINKS: [] });
|
|
961
1039
|
}
|
|
962
|
-
|
|
963
|
-
|
|
1040
|
+
if (parentTrail)
|
|
1041
|
+
this.expandedRoles = { ...this.expandedRoles, [parentTrail]: true };
|
|
1042
|
+
this.cancelAddRole();
|
|
964
1043
|
await this.persist(sec, `Создана роль «${label}»`, `В подразделении ${this.$item?.path || ''} добавлена роль «${label}».`);
|
|
965
1044
|
},
|
|
966
1045
|
async toggleRoleExternal(trail, checked) {
|
|
@@ -990,6 +1069,23 @@ export default {
|
|
|
990
1069
|
}
|
|
991
1070
|
await this.persist(sec, `Удалена роль «${targetId}»`, `Из подразделения ${this.$item?.path || ''} удалена роль «${targetId}».`);
|
|
992
1071
|
},
|
|
1072
|
+
toggleMemberPicker(trail) {
|
|
1073
|
+
this.pickerTrail = '';
|
|
1074
|
+
if (this.memberPickerTrail === trail) {
|
|
1075
|
+
this.closeMemberPicker();
|
|
1076
|
+
return;
|
|
1077
|
+
}
|
|
1078
|
+
this.memberPickerTrail = trail;
|
|
1079
|
+
this.memberSearch = '';
|
|
1080
|
+
},
|
|
1081
|
+
closeMemberPicker() {
|
|
1082
|
+
this.memberPickerTrail = '';
|
|
1083
|
+
this.memberSearch = '';
|
|
1084
|
+
},
|
|
1085
|
+
async pickMember(trail, memberId) {
|
|
1086
|
+
this.closeMemberPicker();
|
|
1087
|
+
await this._addMemberToRole(trail, memberId);
|
|
1088
|
+
},
|
|
993
1089
|
async _addMemberToRole(trail, memberId) {
|
|
994
1090
|
const sec = JSON.parse(JSON.stringify(this.security || {}));
|
|
995
1091
|
const node = this._findRoleMut(sec, trail);
|
|
@@ -1000,14 +1096,6 @@ export default {
|
|
|
1000
1096
|
node.USERS.push(memberId);
|
|
1001
1097
|
await this.persist(sec, `В роль «${node.label || node.id}» добавлен участник`, `В роль «${node.label || node.id}» добавлен ${memberId}.`);
|
|
1002
1098
|
},
|
|
1003
|
-
async addRoleMember(trail, e) {
|
|
1004
|
-
const val = e?.target?.value;
|
|
1005
|
-
if (e?.target)
|
|
1006
|
-
e.target.value = '';
|
|
1007
|
-
if (!val)
|
|
1008
|
-
return;
|
|
1009
|
-
await this._addMemberToRole(trail, val);
|
|
1010
|
-
},
|
|
1011
1099
|
async removeRoleMember(trail, memberId) {
|
|
1012
1100
|
const sec = JSON.parse(JSON.stringify(this.security || {}));
|
|
1013
1101
|
const node = this._findRoleMut(sec, trail);
|
|
@@ -1017,6 +1105,7 @@ export default {
|
|
|
1017
1105
|
await this.persist(sec, `Из роли «${node.label || node.id}» исключён участник`, `Из роли «${node.label || node.id}» удалён ${memberId}.`);
|
|
1018
1106
|
},
|
|
1019
1107
|
toggleClassPicker(trail) {
|
|
1108
|
+
this.memberPickerTrail = '';
|
|
1020
1109
|
if (this.pickerTrail === trail) {
|
|
1021
1110
|
this.closeClassPicker();
|
|
1022
1111
|
return;
|
|
@@ -1070,8 +1159,10 @@ export default {
|
|
|
1070
1159
|
added++;
|
|
1071
1160
|
}
|
|
1072
1161
|
}
|
|
1073
|
-
if (added)
|
|
1162
|
+
if (added) {
|
|
1163
|
+
this.expandedRoles = { ...this.expandedRoles, [trail]: true };
|
|
1074
1164
|
await this.persist(sec, `К роли «${node.label || node.id}» привязаны классы (${added})`, `К роли «${node.label || node.id}» привязаны классы: ${paths.join(', ')}.`);
|
|
1165
|
+
}
|
|
1075
1166
|
},
|
|
1076
1167
|
async updateRoleLinkAccess(trail, clsPath, access) {
|
|
1077
1168
|
const sec = JSON.parse(JSON.stringify(this.security || {}));
|
|
@@ -1082,18 +1173,6 @@ export default {
|
|
|
1082
1173
|
link.access = access === 'write' ? 'write' : 'read';
|
|
1083
1174
|
await this.persist(sec, `Изменён доступ роли к классу`, `Роль «${node.label || node.id}»: для ${clsPath} установлен доступ «${link.access}».`);
|
|
1084
1175
|
},
|
|
1085
|
-
async updateRoleLinkScope(trail, clsPath, scope) {
|
|
1086
|
-
const sec = JSON.parse(JSON.stringify(this.security || {}));
|
|
1087
|
-
const node = this._findRoleMut(sec, trail);
|
|
1088
|
-
const link = node?.LINKS?.find(l => l?.id === clsPath);
|
|
1089
|
-
if (!link)
|
|
1090
|
-
return;
|
|
1091
|
-
if (scope)
|
|
1092
|
-
link.scope = scope;
|
|
1093
|
-
else
|
|
1094
|
-
delete link.scope;
|
|
1095
|
-
await this.persist(sec, `Изменена область записей в роли`, `Роль «${node.label || node.id}»: для ${clsPath} установлена область «${scope || 'по умолчанию'}».`);
|
|
1096
|
-
},
|
|
1097
1176
|
async removeRoleLink(trail, clsPath) {
|
|
1098
1177
|
const sec = JSON.parse(JSON.stringify(this.security || {}));
|
|
1099
1178
|
const node = this._findRoleMut(sec, trail);
|
|
@@ -1102,79 +1181,4 @@ export default {
|
|
|
1102
1181
|
node.LINKS = node.LINKS.filter(l => l?.id !== clsPath);
|
|
1103
1182
|
await this.persist(sec, `Отвязан класс от роли`, `От роли «${node.label || node.id}» отвязан класс ${clsPath}.`);
|
|
1104
1183
|
},
|
|
1105
|
-
inviteStatusLabel(st) {
|
|
1106
|
-
return ({ active: 'активно', used: 'принято', revoked: 'отозвано', expired: 'истекло' })[st] || st;
|
|
1107
|
-
},
|
|
1108
|
-
inviteLinkOf(token) {
|
|
1109
|
-
return `${location.origin}/?invite=${encodeURIComponent(token || '')}`;
|
|
1110
|
-
},
|
|
1111
|
-
async copyText(text) {
|
|
1112
|
-
try {
|
|
1113
|
-
await navigator.clipboard?.writeText(String(text || ''));
|
|
1114
|
-
}
|
|
1115
|
-
catch {
|
|
1116
|
-
window.prompt?.('Скопируйте ссылку приглашения:', String(text || ''));
|
|
1117
|
-
}
|
|
1118
|
-
},
|
|
1119
|
-
async loadInvites() {
|
|
1120
|
-
if (!this.canEdit || !this.$item?.fetch) {
|
|
1121
|
-
this.invitesList = [];
|
|
1122
|
-
return;
|
|
1123
|
-
}
|
|
1124
|
-
try {
|
|
1125
|
-
const list = await this.$item.fetch('invite_list', {});
|
|
1126
|
-
this.invitesList = Array.isArray(list) ? list : [];
|
|
1127
|
-
}
|
|
1128
|
-
catch {
|
|
1129
|
-
this.invitesList = [];
|
|
1130
|
-
}
|
|
1131
|
-
},
|
|
1132
|
-
openInvite(trail) {
|
|
1133
|
-
if (this.inviteTrail === trail) {
|
|
1134
|
-
this.closeInvite();
|
|
1135
|
-
return;
|
|
1136
|
-
}
|
|
1137
|
-
this.inviteTrail = trail;
|
|
1138
|
-
this.inviteChannel = 'link';
|
|
1139
|
-
this.inviteRecipient = '';
|
|
1140
|
-
this.inviteNote = '';
|
|
1141
|
-
this.inviteResult = null;
|
|
1142
|
-
},
|
|
1143
|
-
closeInvite() {
|
|
1144
|
-
this.inviteTrail = '';
|
|
1145
|
-
this.inviteResult = null;
|
|
1146
|
-
},
|
|
1147
|
-
async sendInvite() {
|
|
1148
|
-
if (!this.inviteTrail || this.inviteBusy)
|
|
1149
|
-
return;
|
|
1150
|
-
this.inviteBusy = true;
|
|
1151
|
-
this.error = '';
|
|
1152
|
-
try {
|
|
1153
|
-
const res = await this.$item.fetch('invite_create', {}, {
|
|
1154
|
-
trail: this.inviteTrail,
|
|
1155
|
-
channel: this.inviteChannel,
|
|
1156
|
-
recipient: this.inviteRecipient,
|
|
1157
|
-
note: this.inviteNote,
|
|
1158
|
-
origin: location.origin,
|
|
1159
|
-
});
|
|
1160
|
-
this.inviteResult = res;
|
|
1161
|
-
await this.loadInvites();
|
|
1162
|
-
}
|
|
1163
|
-
catch (e) {
|
|
1164
|
-
this.error = String(e?.message || e);
|
|
1165
|
-
}
|
|
1166
|
-
finally {
|
|
1167
|
-
this.inviteBusy = false;
|
|
1168
|
-
}
|
|
1169
|
-
},
|
|
1170
|
-
async revokeInvite(id) {
|
|
1171
|
-
this.error = '';
|
|
1172
|
-
try {
|
|
1173
|
-
await this.$item.fetch('invite_revoke', {}, { id });
|
|
1174
|
-
await this.loadInvites();
|
|
1175
|
-
}
|
|
1176
|
-
catch (e) {
|
|
1177
|
-
this.error = String(e?.message || e);
|
|
1178
|
-
}
|
|
1179
|
-
},
|
|
1180
1184
|
}
|