@masterteam/work-center 0.0.55 → 0.0.56

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.
@@ -1,6 +1,7 @@
1
+ import * as i1$1 from '@angular/common';
1
2
  import { CommonModule } from '@angular/common';
2
3
  import * as i0 from '@angular/core';
3
- import { inject, viewChild, input, computed, signal, Component, Injectable, DestroyRef, output, effect, untracked } from '@angular/core';
4
+ import { inject, viewChild, input, computed, signal, Component, Injectable, DestroyRef, effect, untracked, output } from '@angular/core';
4
5
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
5
6
  import { TranslocoService, TranslocoDirective } from '@jsverse/transloco';
6
7
  import { Button } from '@masterteam/components/button';
@@ -15,17 +16,17 @@ import { catchError, EMPTY, map, take } from 'rxjs';
15
16
  import { ModalRef } from '@masterteam/components/dialog';
16
17
  import { DrawerController } from '@masterteam/components/dynamic-drawer';
17
18
  import { ClientForm } from '@masterteam/forms/client-form';
18
- import { Action, Selector, State, Store, select } from '@ngxs/store';
19
19
  import { HttpClient } from '@angular/common/http';
20
+ import { Router, ActivatedRoute } from '@angular/router';
21
+ import { Drawer } from '@masterteam/components/drawer';
22
+ import { RuntimeActionContextStore, RuntimeActionRunner, resolveActionLabel } from '@masterteam/components/runtime-action';
23
+ import { Action, Selector, State, Store, select } from '@ngxs/store';
20
24
  import { handleApiRequest } from '@masterteam/components';
21
25
  import { ClientInstancePreview } from '@masterteam/client-components/client-instance-preview';
22
26
  import { EntitiesPreview } from '@masterteam/components/entities';
23
27
  import { Tabs } from '@masterteam/components/tabs';
24
28
  import { DiscussionThread } from '@masterteam/discussion';
25
29
  import { StructureBuilder } from '@masterteam/structure-builder';
26
- import { RuntimeActionContextStore, RuntimeActionRunner, resolveActionLabel } from '@masterteam/components/runtime-action';
27
- import { Router, ActivatedRoute } from '@angular/router';
28
- import { Drawer } from '@masterteam/components/drawer';
29
30
 
30
31
  class WorkCenterClientFormModal {
31
32
  modal = inject(ModalService);
@@ -452,6 +453,7 @@ function createDefaultContext(area) {
452
453
  return {
453
454
  area,
454
455
  templateId: null,
456
+ levelDataId: null,
455
457
  selectedCardKey: null,
456
458
  page: 1,
457
459
  pageSize: WORK_CENTER_LOCAL_FETCH_SIZE,
@@ -499,6 +501,7 @@ const WORK_CENTER_DEFAULT_STATE = {
499
501
  byArea: {
500
502
  MyInbox: createDefaultAreaState('MyInbox'),
501
503
  TasksCenter: createDefaultAreaState('TasksCenter'),
504
+ Workspace: createDefaultAreaState('Workspace'),
502
505
  },
503
506
  lookups: [],
504
507
  loadingActive: [],
@@ -516,6 +519,7 @@ function normalizeContext(context) {
516
519
  function buildContextFromInputs(currentContext, area, inputs = {}) {
517
520
  const parsedCardKey = toSelectedCardKey(inputs.card);
518
521
  const parsedTemplateId = toOptionalInt(inputs.templateId);
522
+ const parsedLevelDataId = toOptionalInt(inputs.levelDataId);
519
523
  const hasPageInput = hasParamValue(inputs.page);
520
524
  const parsedPage = hasPageInput ? toOptionalInt(inputs.page) : null;
521
525
  const parsedPageSize = toOptionalInt(inputs.pageSize);
@@ -526,6 +530,7 @@ function buildContextFromInputs(currentContext, area, inputs = {}) {
526
530
  page: hasPageInput ? (parsedPage ?? 1) : 1,
527
531
  pageSize: parsedPageSize ?? currentContext.pageSize,
528
532
  templateId: parsedTemplateId ?? currentContext.templateId,
533
+ levelDataId: parsedLevelDataId ?? currentContext.levelDataId,
529
534
  sort: hasParamValue(inputs.sort)
530
535
  ? parseSortInput(inputs.sort)
531
536
  : inputs.sort === null
@@ -541,6 +546,7 @@ function buildContextFromInputs(currentContext, area, inputs = {}) {
541
546
  function isSameContext(left, right) {
542
547
  return (left.area === right.area &&
543
548
  left.templateId === right.templateId &&
549
+ left.levelDataId === right.levelDataId &&
544
550
  left.selectedCardKey === right.selectedCardKey &&
545
551
  left.page === right.page &&
546
552
  left.pageSize === right.pageSize &&
@@ -1030,489 +1036,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
1030
1036
  }]
1031
1037
  }] });
1032
1038
 
1033
- const OPERATOR_LABELS = {
1034
- Eq: 'Equals',
1035
- Neq: 'Not equal',
1036
- In: 'In',
1037
- Contains: 'Contains',
1038
- StartsWith: 'Starts with',
1039
- Gt: 'Greater than',
1040
- Gte: 'Greater than or equal',
1041
- Lt: 'Less than',
1042
- Lte: 'Less than or equal',
1043
- Between: 'Between',
1044
- IsNull: 'Is empty',
1045
- IsNotNull: 'Is not empty',
1046
- };
1047
- const OPERATOR_VALUE_MODE = {
1048
- In: 'multi',
1049
- Between: 'range',
1050
- IsNull: 'none',
1051
- IsNotNull: 'none',
1052
- };
1053
- const GENERAL_TASK_CARD_KEYS = new Set([
1054
- 'mygeneraltasks',
1055
- 'generaltask',
1056
- 'generaltasks',
1057
- ]);
1058
- function toLabel(value) {
1059
- const normalized = value.split('.').pop() ?? value;
1060
- return normalized
1061
- .replace(/[_-]/g, ' ')
1062
- .replace(/([a-z])([A-Z])/g, '$1 $2')
1063
- .trim()
1064
- .replace(/\b\w/g, (char) => char.toUpperCase());
1065
- }
1066
- function columnTypeToViewType(type) {
1067
- if (type === 'date')
1068
- return 'Date';
1069
- return undefined;
1070
- }
1071
- function normalizeCardKey(value) {
1072
- if (typeof value !== 'string') {
1073
- return '';
1074
- }
1075
- return value
1076
- .trim()
1077
- .replace(/[\s_-]/g, '')
1078
- .toLowerCase();
1079
- }
1080
- /**
1081
- * Strips the user envelope used by `mt-table` user filters down to the
1082
- * scalar id that the BE rule payload accepts. Falls back to the original
1083
- * value for non-user shapes (e.g. simple string in a select filter).
1084
- */
1085
- function extractIdScalar(value) {
1086
- if (value !== null &&
1087
- typeof value === 'object' &&
1088
- 'id' in value) {
1089
- return value['id'];
1090
- }
1091
- return value;
1092
- }
1093
- function toIsoDate(value) {
1094
- if (value instanceof Date)
1095
- return value.toISOString();
1096
- return value;
1097
- }
1098
- /**
1099
- * Translates one in-table column filter value into a `WorkCenterFilterRule`.
1100
- *
1101
- * The shape of `raw` depends on the column's filter type — see
1102
- * `mt-table` `table-filter-field` outputs:
1103
- * - text → string → `Contains`
1104
- * - select → scalar | scalar[] → `Eq` | `In`
1105
- * - boolean → boolean → `Eq`
1106
- * - date → `{ from?, to?, value? }` (Date|null)→ `Between`/`Gte`/`Lte`/`Eq`
1107
- * - user → `{ id, ... }` | `{ id, ... }[]` → `Eq` (id) | `In` (ids)
1108
- *
1109
- * Returns `null` when the value is empty / nothing to send.
1110
- */
1111
- function toRuntimeFilterRule(field, raw, column) {
1112
- if (raw === null || raw === undefined || raw === '')
1039
+ function readItemContext(details) {
1040
+ const item = details.item;
1041
+ if (!item || typeof item !== 'object') {
1113
1042
  return null;
1114
- if (typeof raw === 'boolean') {
1115
- return { field, op: 'Eq', value: raw };
1116
- }
1117
- if (typeof raw === 'number') {
1118
- return { field, op: 'Eq', value: raw };
1119
- }
1120
- if (typeof raw === 'string') {
1121
- if (!raw.trim().length)
1122
- return null;
1123
- return { field, op: 'Contains', value: raw };
1124
- }
1125
- if (Array.isArray(raw)) {
1126
- const values = raw
1127
- .map(extractIdScalar)
1128
- .filter((v) => v !== null && v !== undefined && v !== '');
1129
- if (!values.length)
1130
- return null;
1131
- return { field, op: 'In', values };
1132
- }
1133
- if (typeof raw === 'object') {
1134
- const obj = raw;
1135
- // User filter envelope -> single-id Eq.
1136
- if (obj.id !== undefined && obj.id !== null && obj.id !== '') {
1137
- return { field, op: 'Eq', value: obj.id };
1138
- }
1139
- const hasFrom = obj.from !== undefined && obj.from !== null;
1140
- const hasTo = obj.to !== undefined && obj.to !== null;
1141
- if (hasFrom && hasTo) {
1142
- return {
1143
- field,
1144
- op: 'Between',
1145
- from: toIsoDate(obj.from),
1146
- to: toIsoDate(obj.to),
1147
- };
1148
- }
1149
- if (hasFrom) {
1150
- return { field, op: 'Gte', value: toIsoDate(obj.from) };
1151
- }
1152
- if (hasTo) {
1153
- return { field, op: 'Lte', value: toIsoDate(obj.to) };
1154
- }
1155
- if (obj.value !== undefined && obj.value !== null && obj.value !== '') {
1156
- const treatAsContains = column?.type === 'text' ||
1157
- (column?.filterConfig?.type === 'text' &&
1158
- typeof obj.value === 'string');
1159
- if (treatAsContains) {
1160
- return { field, op: 'Contains', value: obj.value };
1161
- }
1162
- return { field, op: 'Eq', value: extractIdScalar(obj.value) };
1163
- }
1164
1043
  }
1165
- return null;
1044
+ const context = item['context'];
1045
+ return context && typeof context === 'object'
1046
+ ? context
1047
+ : null;
1166
1048
  }
1167
- /**
1168
- * Walks `mt-table`'s filter map and produces the `WorkCenterFilterRule[]`
1169
- * sent on the BE column-filter slice. The synthetic `generalSearch` key is
1170
- * skipped because the page keeps general search local-only.
1171
- */
1172
- function buildColumnRuntimeFilters(filters, columns, allowedFields) {
1173
- if (!filters)
1174
- return [];
1175
- const allowed = allowedFields && allowedFields.length ? new Set(allowedFields) : null;
1176
- const columnByKey = new Map(columns.map((col) => [col.key, col]));
1177
- const rules = [];
1178
- for (const [key, raw] of Object.entries(filters)) {
1179
- if (key === 'generalSearch')
1180
- continue;
1181
- if (allowed && !allowed.has(key))
1182
- continue;
1183
- const rule = toRuntimeFilterRule(key, raw, columnByKey.get(key));
1184
- if (rule)
1185
- rules.push(rule);
1049
+ function readNumber(source, key) {
1050
+ const value = source?.[key];
1051
+ if (typeof value === 'number') {
1052
+ return Number.isFinite(value) ? value : undefined;
1186
1053
  }
1187
- return rules;
1188
- }
1189
- function areFilterRulesEqual(left, right) {
1190
- return JSON.stringify(left) === JSON.stringify(right);
1191
- }
1192
- function mapAllowedFields(schema) {
1193
- const properties = schema.properties ?? [];
1194
- const fromProperties = properties
1195
- .filter((property) => typeof property?.key === 'string' && property.key.length > 0)
1196
- .map((property) => ({
1197
- key: property.key,
1198
- label: property.name?.display ||
1199
- property.name?.en ||
1200
- property.name?.ar ||
1201
- toLabel(property.key),
1202
- viewType: property.viewType,
1203
- }));
1204
- if (fromProperties.length) {
1205
- return fromProperties;
1054
+ if (typeof value === 'string' && value.trim().length) {
1055
+ const parsed = Number(value);
1056
+ return Number.isFinite(parsed) ? parsed : undefined;
1206
1057
  }
1207
- return (schema.allowedFields ?? []).map((field) => ({
1208
- key: field,
1209
- label: toLabel(field),
1210
- }));
1058
+ return undefined;
1211
1059
  }
1212
- function mapAllowedOperators(schema, getLabel) {
1213
- const options = [];
1214
- for (const operator of schema.allowedOperators ?? []) {
1215
- if (typeof operator === 'string') {
1216
- options.push({
1217
- key: operator,
1218
- label: getLabel(operator),
1219
- valueMode: OPERATOR_VALUE_MODE[operator] ?? 'single',
1220
- });
1221
- continue;
1222
- }
1223
- const key = operator?.value;
1224
- if (!key) {
1225
- continue;
1226
- }
1227
- options.push({
1228
- key,
1229
- label: operator.display?.display ||
1230
- operator.display?.en ||
1231
- operator.display?.ar ||
1232
- getLabel(key),
1233
- valueMode: OPERATOR_VALUE_MODE[key] ?? 'single',
1234
- });
1235
- }
1236
- return options;
1060
+ function readString$1(source, key) {
1061
+ const value = source?.[key];
1062
+ return typeof value === 'string' && value.trim().length ? value : undefined;
1237
1063
  }
1238
- class WorkCenterPage {
1239
- facade = inject(WorkCenterFacade);
1240
- modal = inject(ModalService);
1064
+
1065
+ class WorkCenterEscalationInstanceType {
1066
+ http = inject(HttpClient);
1241
1067
  transloco = inject(TranslocoService);
1242
1068
  destroyRef = inject(DestroyRef);
1069
+ loadSub;
1070
+ details = input.required(...(ngDevMode ? [{ debugName: "details" }] : /* istanbul ignore next */ []));
1071
+ activeTab = signal('escalationDetails', ...(ngDevMode ? [{ debugName: "activeTab" }] : /* istanbul ignore next */ []));
1243
1072
  activeLang = signal(this.transloco.getActiveLang(), ...(ngDevMode ? [{ debugName: "activeLang" }] : /* istanbul ignore next */ []));
1244
- area = input('MyInbox', ...(ngDevMode ? [{ debugName: "area" }] : /* istanbul ignore next */ []));
1245
- pageTitle = input('', ...(ngDevMode ? [{ debugName: "pageTitle" }] : /* istanbul ignore next */ []));
1246
- menuIcon = input('communication.inbox-01', ...(ngDevMode ? [{ debugName: "menuIcon" }] : /* istanbul ignore next */ []));
1247
- lookups = input([], ...(ngDevMode ? [{ debugName: "lookups" }] : /* istanbul ignore next */ []));
1248
- openItemsInModal = input(true, ...(ngDevMode ? [{ debugName: "openItemsInModal" }] : /* istanbul ignore next */ []));
1249
- itemModal = input(null, ...(ngDevMode ? [{ debugName: "itemModal" }] : /* istanbul ignore next */ []));
1250
- generalTaskModal = input(null, ...(ngDevMode ? [{ debugName: "generalTaskModal" }] : /* istanbul ignore next */ []));
1251
- runtimeFiltersChanged = output();
1252
- itemClicked = output();
1253
- cardSelected = output();
1254
- context = this.facade.context;
1255
- headerFilters = this.facade.headerFilters;
1256
- tableFilters = signal({}, ...(ngDevMode ? [{ debugName: "tableFilters" }] : /* istanbul ignore next */ []));
1257
- _menuItems = this.facade.menuItems;
1258
- menuItems = computed(() => {
1259
- this.activeLang();
1260
- return this._menuItems().map((item) => ({
1261
- ...item,
1262
- subtitle: `${item.count} ${item.title}`,
1263
- }));
1264
- }, ...(ngDevMode ? [{ debugName: "menuItems" }] : /* istanbul ignore next */ []));
1265
- rows = this.facade.rows;
1266
- columns = this.facade.columns;
1267
- kpis = this.facade.kpis;
1268
- runtimeFilterSchema = this.facade.runtimeFilterSchema;
1269
- totalCount = this.facade.totalCount;
1270
- columnFilters = this.facade.columnFilters;
1271
- loading = this.facade.loading;
1272
- tableColumns = computed(() => this.columns().map((column) => ({
1273
- ...column,
1274
- sortable: true,
1275
- })), ...(ngDevMode ? [{ debugName: "tableColumns" }] : /* istanbul ignore next */ []));
1276
- /**
1277
- * Maps each status/group display label to its total count from the KPI
1278
- * summary cards so the group header shows the real backend total rather than
1279
- * the current-page row count.
1280
- */
1281
- statusGroupCountMap = computed(() => {
1282
- const map = new Map();
1283
- for (const kpi of this.kpis()) {
1284
- const label = kpi.subTitle;
1285
- const count = Number(kpi.title);
1286
- if (label && !isNaN(count)) {
1287
- map.set(label, count);
1288
- }
1289
- }
1290
- return map;
1291
- }, ...(ngDevMode ? [{ debugName: "statusGroupCountMap" }] : /* istanbul ignore next */ []));
1292
- propertyFilterSchema = computed(() => {
1293
- this.activeLang();
1294
- const schema = this.runtimeFilterSchema();
1295
- if (schema) {
1296
- const allowedFields = mapAllowedFields(schema);
1297
- const allowedOperators = mapAllowedOperators(schema, (key) => this.getOpLabel(key));
1298
- if (allowedFields.length && allowedOperators.length) {
1299
- return { allowedFields, allowedOperators };
1300
- }
1301
- }
1302
- const fallbackFields = this.columns()
1303
- .filter((column) => typeof column?.key === 'string' && column.key.length > 0)
1304
- .map((column) => ({
1305
- key: column.key,
1306
- label: column.label || toLabel(column.key),
1307
- viewType: columnTypeToViewType(column.type),
1308
- }));
1309
- if (!fallbackFields.length) {
1310
- return null;
1311
- }
1312
- const fallbackOperators = Object.keys(OPERATOR_LABELS).map((key) => ({
1313
- key,
1314
- label: this.getOpLabel(key),
1315
- valueMode: OPERATOR_VALUE_MODE[key] ?? 'single',
1316
- }));
1317
- return {
1318
- allowedFields: fallbackFields,
1319
- allowedOperators: fallbackOperators,
1320
- };
1321
- }, ...(ngDevMode ? [{ debugName: "propertyFilterSchema" }] : /* istanbul ignore next */ []));
1322
- showGeneralTaskCreateButton = computed(() => GENERAL_TASK_CARD_KEYS.has(normalizeCardKey(this.context().selectedCardKey)), ...(ngDevMode ? [{ debugName: "showGeneralTaskCreateButton" }] : /* istanbul ignore next */ []));
1323
- generalTaskButtonLabel = computed(() => {
1324
- this.activeLang();
1325
- return (this.generalTaskModal()?.buttonLabel?.trim() ||
1326
- this.transloco.translate('workCenter.page.new'));
1327
- }, ...(ngDevMode ? [{ debugName: "generalTaskButtonLabel" }] : /* istanbul ignore next */ []));
1328
- resolvedPageTitle = computed(() => {
1329
- this.activeLang();
1330
- return (this.pageTitle() ||
1331
- this.transloco.translate('workCenter.page.title'));
1332
- }, ...(ngDevMode ? [{ debugName: "resolvedPageTitle" }] : /* istanbul ignore next */ []));
1333
- generalTaskButtonIcon = computed(() => this.generalTaskModal()?.buttonIcon?.trim() || 'general.plus', ...(ngDevMode ? [{ debugName: "generalTaskButtonIcon" }] : /* istanbul ignore next */ []));
1334
- defaultModalStyleClass = '!w-[96vw] md:!w-[84vw] xl:!w-[70vw] !shadow-none';
1335
- defaultGeneralTaskModalStyleClass = '!w-[70vw] !h-[90vh]';
1336
- constructor() {
1337
- this.transloco.langChanges$
1338
- .pipe(takeUntilDestroyed(this.destroyRef))
1339
- .subscribe((lang) => this.activeLang.set(lang));
1340
- effect(() => {
1341
- this.facade.setLookups(this.lookups());
1342
- });
1343
- }
1344
- onMenuItemClick(item) {
1345
- if (item.key === this.context().selectedCardKey) {
1346
- return;
1347
- }
1348
- this.facade.selectCardAndLoad(this.area(), item.key);
1349
- this.cardSelected.emit(item.key);
1350
- }
1351
- onRuntimeFiltersApplied(filters) {
1352
- const mappedFilters = filters.map((filter) => ({
1353
- field: filter.field,
1354
- op: filter.op,
1355
- value: filter.value,
1356
- values: filter.values,
1357
- from: filter.from,
1358
- to: filter.to,
1359
- }));
1360
- this.facade.applyHeaderFiltersAndLoad(this.area(), mappedFilters);
1361
- this.runtimeFiltersChanged.emit(mappedFilters);
1362
- }
1363
- onRuntimeFiltersCleared() {
1364
- this.facade.clearAllFiltersAndLoad(this.area());
1365
- this.tableFilters.set({});
1366
- this.runtimeFiltersChanged.emit([]);
1367
- }
1368
- /**
1369
- * Single entry point for `mt-table` (`lazy=true`) — handles both column
1370
- * filters and pagination/sort. Filter changes always reset the page to 1
1371
- * (handled by `applyColumnFiltersAndLoad`); when only paging/sort changed
1372
- * we fall through to `applyTableLazyLoadAndLoad`.
1373
- */
1374
- onTableLazyLoad(event) {
1375
- const schema = this.runtimeFilterSchema();
1376
- const propertyKeys = (schema?.properties ?? [])
1377
- .map((p) => p?.key)
1378
- .filter((k) => typeof k === 'string' && k.length > 0);
1379
- const allowedKeys = schema?.allowedFields ?? [];
1380
- const allowedFields = propertyKeys.length ? propertyKeys : allowedKeys;
1381
- const nextColumnFilters = buildColumnRuntimeFilters(event?.filters, this.columns(), allowedFields.length ? allowedFields : undefined);
1382
- if (!areFilterRulesEqual(nextColumnFilters, this.columnFilters())) {
1383
- this.facade.applyColumnFiltersAndLoad(this.area(), nextColumnFilters);
1384
- return;
1385
- }
1386
- this.facade.applyTableLazyLoadAndLoad(this.area(), event);
1387
- }
1388
- onGeneralTaskCreateClick() {
1389
- const modalOptions = this.generalTaskModal();
1390
- const modalData = {
1391
- moduleKey: 'GeneralTask',
1392
- ...(modalOptions?.data ?? {}),
1393
- };
1394
- const modalHeader = modalOptions?.header ??
1395
- this.transloco.translate('workCenter.page.createGeneralTask');
1396
- const modalStyleClass = modalOptions?.styleClass ?? this.defaultGeneralTaskModalStyleClass;
1397
- const operationKey = modalOptions?.operationKey ?? 'Create';
1398
- const closeOnPendingApproval = modalOptions?.closeOnPendingApproval ?? true;
1399
- const lookups = modalOptions?.lookups ?? this.lookups();
1400
- const ref = this.modal.openModal(WorkCenterClientFormModal, 'dialog', {
1401
- header: modalHeader,
1402
- styleClass: modalStyleClass,
1403
- position: 'end',
1404
- dismissableMask: true,
1405
- inputValues: {
1406
- data: modalData,
1407
- operationKey,
1408
- closeOnPendingApproval,
1409
- lookups,
1410
- },
1411
- });
1412
- ref.onClose.pipe(take(1)).subscribe((result) => {
1413
- if (result) {
1414
- this.facade.loadRuntime(this.area(), 'refresh');
1415
- }
1416
- });
1417
- }
1418
- onRowClick(row) {
1419
- const contextKey = this.resolveRowContextKey(row);
1420
- console.log('[work-center-debug] page row click', {
1421
- contextKey,
1422
- row,
1423
- openItemsInModal: this.openItemsInModal(),
1424
- hasModalComponent: !!this.itemModal()?.component,
1425
- });
1426
- if (!contextKey) {
1427
- return;
1428
- }
1429
- this.itemClicked.emit(contextKey);
1430
- if (!this.openItemsInModal()) {
1431
- return;
1432
- }
1433
- const modalOptions = this.itemModal();
1434
- if (!modalOptions?.component) {
1435
- return;
1436
- }
1437
- const ref = this.modal.openModal(modalOptions.component, 'drawer', {
1438
- header: modalOptions?.header ??
1439
- this.transloco.translate('workCenter.page.itemDetails'),
1440
- styleClass: modalOptions?.styleClass ?? this.defaultModalStyleClass,
1441
- position: modalOptions?.position ?? 'end',
1442
- dismissible: true,
1443
- modal: true,
1444
- ...(modalOptions?.appendTo ? { appendTo: modalOptions.appendTo } : {}),
1445
- inputValues: { contextKey },
1446
- });
1447
- ref.onClose.pipe(take(1)).subscribe(() => {
1448
- this.facade.loadRuntime(this.area(), 'refresh');
1449
- });
1450
- }
1451
- rowsClickable = computed(() => this.openItemsInModal(), ...(ngDevMode ? [{ debugName: "rowsClickable" }] : /* istanbul ignore next */ []));
1452
- getOpLabel(key) {
1453
- return (this.transloco.translate('workCenter.operator.' + key) ||
1454
- OPERATOR_LABELS[key] ||
1455
- toLabel(key));
1456
- }
1457
- resolveRowContextKey(row) {
1458
- const value = row['contextKey'];
1459
- if (typeof value !== 'string') {
1460
- return null;
1461
- }
1462
- const normalized = value.trim();
1463
- return normalized.length ? normalized : null;
1464
- }
1465
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: WorkCenterPage, deps: [], target: i0.ɵɵFactoryTarget.Component });
1466
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: WorkCenterPage, isStandalone: true, selector: "mt-work-center-page", inputs: { area: { classPropertyName: "area", publicName: "area", isSignal: true, isRequired: false, transformFunction: null }, pageTitle: { classPropertyName: "pageTitle", publicName: "pageTitle", isSignal: true, isRequired: false, transformFunction: null }, menuIcon: { classPropertyName: "menuIcon", publicName: "menuIcon", isSignal: true, isRequired: false, transformFunction: null }, lookups: { classPropertyName: "lookups", publicName: "lookups", isSignal: true, isRequired: false, transformFunction: null }, openItemsInModal: { classPropertyName: "openItemsInModal", publicName: "openItemsInModal", isSignal: true, isRequired: false, transformFunction: null }, itemModal: { classPropertyName: "itemModal", publicName: "itemModal", isSignal: true, isRequired: false, transformFunction: null }, generalTaskModal: { classPropertyName: "generalTaskModal", publicName: "generalTaskModal", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { runtimeFiltersChanged: "runtimeFiltersChanged", itemClicked: "itemClicked", cardSelected: "cardSelected" }, ngImport: i0, template: "<mt-client-page\r\n [menuIcon]=\"menuIcon()\"\r\n [menuTitle]=\"resolvedPageTitle()\"\r\n [menuItems]=\"menuItems()\"\r\n [menuItemsLoading]=\"loading() && !menuItems().length\"\r\n [activeItem]=\"context().selectedCardKey ?? undefined\"\r\n storageKey=\"work-center-client-page\"\r\n (menuItemClick)=\"onMenuItemClick($event)\"\r\n>\r\n <ng-template #headerClientPageEnd>\r\n <div class=\"flex flex-wrap items-center justify-end gap-2\">\r\n <mt-property-filter-builder\r\n [schema]=\"propertyFilterSchema()\"\r\n [filters]=\"headerFilters()\"\r\n (applied)=\"onRuntimeFiltersApplied($event)\"\r\n (cleared)=\"onRuntimeFiltersCleared()\"\r\n />\r\n\r\n @if (showGeneralTaskCreateButton()) {\r\n <mt-button\r\n [label]=\"generalTaskButtonLabel()\"\r\n [icon]=\"generalTaskButtonIcon()\"\r\n size=\"small\"\r\n (onClick)=\"onGeneralTaskCreateClick()\"\r\n />\r\n }\r\n </div>\r\n </ng-template>\r\n\r\n <div class=\"flex flex-col gap-8\">\r\n @if (loading()) {\r\n <div\r\n class=\"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 xl:grid-cols-5 gap-3\"\r\n >\r\n @for (_ of [1, 2, 3, 4, 5]; track $index) {\r\n <p-skeleton height=\"6.5rem\" class=\"rounded-lg\" />\r\n }\r\n </div>\r\n } @else if (kpis().length) {\r\n <div class=\"gap-3 flex flex-wrap\">\r\n @for (kpi of kpis(); track $index) {\r\n <mt-statistic-card [data]=\"kpi\" class=\"min-w-[200px]\" />\r\n }\r\n </div>\r\n }\r\n\r\n <mt-table\r\n noCard\r\n [data]=\"rows()\"\r\n [columns]=\"tableColumns()\"\r\n tableLayout=\"auto\"\r\n [clickableRows]=\"rowsClickable()\"\r\n [loading]=\"loading()\"\r\n [showFilters]=\"true\"\r\n filterMode=\"column\"\r\n [cellClickFilter]=\"true\"\r\n [generalSearch]=\"true\"\r\n [exportable]=\"true\"\r\n [printable]=\"true\"\r\n [groupable]=\"true\"\r\n [freezeActions]=\"true\"\r\n [lazy]=\"true\"\r\n [lazyLocalSearch]=\"true\"\r\n [lazyTotalRecords]=\"totalCount()\"\r\n [pageSize]=\"context().pageSize\"\r\n [currentPage]=\"context().page - 1\"\r\n [first]=\"(context().page - 1) * context().pageSize\"\r\n [rowsPerPageOptions]=\"[10, 20, 50, 100]\"\r\n [groupCountMap]=\"statusGroupCountMap()\"\r\n storageKey=\"work-center-page-table\"\r\n [filters]=\"tableFilters()\"\r\n (filtersChange)=\"tableFilters.set($event)\"\r\n (lazyLoad)=\"onTableLazyLoad($event)\"\r\n (rowClick)=\"onRowClick($event)\"\r\n />\r\n </div>\r\n</mt-client-page>\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: ClientPage, selector: "mt-client-page", inputs: ["menuIcon", "menuTitle", "menuItems", "menuItemsLoading", "activeItem", "collapsed", "resizable", "storageKey", "storageMode", "minSidebarWidth", "maxSidebarWidth", "defaultSidebarWidth"], outputs: ["collapsedChange", "menuItemClick", "loadChildren"] }, { kind: "component", type: PropertyFilterBuilder, selector: "mt-property-filter-builder", inputs: ["schema", "filters", "title", "buttonLabel", "disabled"], outputs: ["filtersChange", "applied", "cleared"] }, { kind: "component", type: StatisticCard, selector: "mt-statistic-card", inputs: ["data", "cardClass"] }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }] });
1467
- }
1468
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: WorkCenterPage, decorators: [{
1469
- type: Component,
1470
- args: [{ selector: 'mt-work-center-page', standalone: true, imports: [
1471
- CommonModule,
1472
- Button,
1473
- ClientPage,
1474
- PropertyFilterBuilder,
1475
- StatisticCard,
1476
- Table,
1477
- SkeletonModule,
1478
- ], template: "<mt-client-page\r\n [menuIcon]=\"menuIcon()\"\r\n [menuTitle]=\"resolvedPageTitle()\"\r\n [menuItems]=\"menuItems()\"\r\n [menuItemsLoading]=\"loading() && !menuItems().length\"\r\n [activeItem]=\"context().selectedCardKey ?? undefined\"\r\n storageKey=\"work-center-client-page\"\r\n (menuItemClick)=\"onMenuItemClick($event)\"\r\n>\r\n <ng-template #headerClientPageEnd>\r\n <div class=\"flex flex-wrap items-center justify-end gap-2\">\r\n <mt-property-filter-builder\r\n [schema]=\"propertyFilterSchema()\"\r\n [filters]=\"headerFilters()\"\r\n (applied)=\"onRuntimeFiltersApplied($event)\"\r\n (cleared)=\"onRuntimeFiltersCleared()\"\r\n />\r\n\r\n @if (showGeneralTaskCreateButton()) {\r\n <mt-button\r\n [label]=\"generalTaskButtonLabel()\"\r\n [icon]=\"generalTaskButtonIcon()\"\r\n size=\"small\"\r\n (onClick)=\"onGeneralTaskCreateClick()\"\r\n />\r\n }\r\n </div>\r\n </ng-template>\r\n\r\n <div class=\"flex flex-col gap-8\">\r\n @if (loading()) {\r\n <div\r\n class=\"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 xl:grid-cols-5 gap-3\"\r\n >\r\n @for (_ of [1, 2, 3, 4, 5]; track $index) {\r\n <p-skeleton height=\"6.5rem\" class=\"rounded-lg\" />\r\n }\r\n </div>\r\n } @else if (kpis().length) {\r\n <div class=\"gap-3 flex flex-wrap\">\r\n @for (kpi of kpis(); track $index) {\r\n <mt-statistic-card [data]=\"kpi\" class=\"min-w-[200px]\" />\r\n }\r\n </div>\r\n }\r\n\r\n <mt-table\r\n noCard\r\n [data]=\"rows()\"\r\n [columns]=\"tableColumns()\"\r\n tableLayout=\"auto\"\r\n [clickableRows]=\"rowsClickable()\"\r\n [loading]=\"loading()\"\r\n [showFilters]=\"true\"\r\n filterMode=\"column\"\r\n [cellClickFilter]=\"true\"\r\n [generalSearch]=\"true\"\r\n [exportable]=\"true\"\r\n [printable]=\"true\"\r\n [groupable]=\"true\"\r\n [freezeActions]=\"true\"\r\n [lazy]=\"true\"\r\n [lazyLocalSearch]=\"true\"\r\n [lazyTotalRecords]=\"totalCount()\"\r\n [pageSize]=\"context().pageSize\"\r\n [currentPage]=\"context().page - 1\"\r\n [first]=\"(context().page - 1) * context().pageSize\"\r\n [rowsPerPageOptions]=\"[10, 20, 50, 100]\"\r\n [groupCountMap]=\"statusGroupCountMap()\"\r\n storageKey=\"work-center-page-table\"\r\n [filters]=\"tableFilters()\"\r\n (filtersChange)=\"tableFilters.set($event)\"\r\n (lazyLoad)=\"onTableLazyLoad($event)\"\r\n (rowClick)=\"onRowClick($event)\"\r\n />\r\n </div>\r\n</mt-client-page>\r\n" }]
1479
- }], ctorParameters: () => [], propDecorators: { area: [{ type: i0.Input, args: [{ isSignal: true, alias: "area", required: false }] }], pageTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageTitle", required: false }] }], menuIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "menuIcon", required: false }] }], lookups: [{ type: i0.Input, args: [{ isSignal: true, alias: "lookups", required: false }] }], openItemsInModal: [{ type: i0.Input, args: [{ isSignal: true, alias: "openItemsInModal", required: false }] }], itemModal: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemModal", required: false }] }], generalTaskModal: [{ type: i0.Input, args: [{ isSignal: true, alias: "generalTaskModal", required: false }] }], runtimeFiltersChanged: [{ type: i0.Output, args: ["runtimeFiltersChanged"] }], itemClicked: [{ type: i0.Output, args: ["itemClicked"] }], cardSelected: [{ type: i0.Output, args: ["cardSelected"] }] } });
1480
-
1481
- function readItemContext(details) {
1482
- const item = details.item;
1483
- if (!item || typeof item !== 'object') {
1484
- return null;
1485
- }
1486
- const context = item['context'];
1487
- return context && typeof context === 'object'
1488
- ? context
1489
- : null;
1490
- }
1491
- function readNumber(source, key) {
1492
- const value = source?.[key];
1493
- if (typeof value === 'number') {
1494
- return Number.isFinite(value) ? value : undefined;
1495
- }
1496
- if (typeof value === 'string' && value.trim().length) {
1497
- const parsed = Number(value);
1498
- return Number.isFinite(parsed) ? parsed : undefined;
1499
- }
1500
- return undefined;
1501
- }
1502
- function readString$1(source, key) {
1503
- const value = source?.[key];
1504
- return typeof value === 'string' && value.trim().length ? value : undefined;
1505
- }
1506
-
1507
- class WorkCenterEscalationInstanceType {
1508
- http = inject(HttpClient);
1509
- transloco = inject(TranslocoService);
1510
- destroyRef = inject(DestroyRef);
1511
- loadSub;
1512
- details = input.required(...(ngDevMode ? [{ debugName: "details" }] : /* istanbul ignore next */ []));
1513
- activeTab = signal('escalationDetails', ...(ngDevMode ? [{ debugName: "activeTab" }] : /* istanbul ignore next */ []));
1514
- activeLang = signal(this.transloco.getActiveLang(), ...(ngDevMode ? [{ debugName: "activeLang" }] : /* istanbul ignore next */ []));
1515
- tabOptions = computed(() => {
1073
+ tabOptions = computed(() => {
1516
1074
  this.activeLang();
1517
1075
  return [
1518
1076
  {
@@ -1721,7 +1279,7 @@ class WorkCenterEscalationInstanceType {
1721
1279
  });
1722
1280
  }
1723
1281
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: WorkCenterEscalationInstanceType, deps: [], target: i0.ɵɵFactoryTarget.Component });
1724
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: WorkCenterEscalationInstanceType, isStandalone: true, selector: "mt-work-center-escalation-instance-type", inputs: { details: { classPropertyName: "details", publicName: "details", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<div\r\n class=\"mt-modal-content flex h-full min-h-0 flex-col gap-4 p-4 lg:overflow-hidden\"\r\n *transloco=\"let t; prefix: 'workCenter'\"\r\n>\r\n <div\r\n class=\"flex flex-1 min-h-0 flex-col gap-4 lg:grid lg:grid-cols-[13rem_minmax(0,1fr)] lg:gap-6\"\r\n >\r\n @if (tabOptions().length > 1) {\r\n <mt-tabs\r\n [(active)]=\"activeTab\"\r\n [options]=\"tabOptions()\"\r\n mode=\"vertical\"\r\n size=\"small\"\r\n />\r\n }\r\n\r\n <div class=\"min-w-0 flex-1 min-h-0 lg:overflow-hidden\">\r\n <div\r\n class=\"h-full min-h-0 lg:overflow-hidden\"\r\n [hidden]=\"activeTab() !== 'escalationDetails'\"\r\n >\r\n <div\r\n class=\"min-w-0 h-full min-h-0 lg:overflow-y-auto lg:overscroll-contain lg:pr-2\"\r\n >\r\n @if (canRenderDetails()) {\r\n @if (loading()) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"loading.escalationDetails\") }}\r\n </p>\r\n </div>\r\n } @else if (error(); as error) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-red-300 bg-red-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-red-600\">\r\n {{ error }}\r\n </p>\r\n </div>\r\n } @else if (preview()) {\r\n <mt-entities-preview [entities]=\"detailEntities()\" />\r\n }\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"context.escalationDetailsUnavailable\") }}\r\n </p>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n\r\n <div\r\n class=\"h-full min-h-0 lg:overflow-hidden\"\r\n [hidden]=\"activeTab() !== 'moduleDetails'\"\r\n >\r\n @if (moduleDetailsConfig(); as moduleDetailsConfig) {\r\n <div\r\n class=\"min-w-0 h-full min-h-0 lg:overflow-y-auto lg:overscroll-contain lg:pr-2\"\r\n >\r\n <mt-client-instance-preview [config]=\"moduleDetailsConfig\" />\r\n </div>\r\n }\r\n </div>\r\n\r\n <div\r\n class=\"flex-1 min-h-0 overflow-auto\"\r\n [hidden]=\"activeTab() !== 'schema'\"\r\n >\r\n @if (canRenderDetails()) {\r\n @if (loading()) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"loading.escalationSchema\") }}\r\n </p>\r\n </div>\r\n } @else if (error(); as error) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-red-300 bg-red-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-red-600\">\r\n {{ error }}\r\n </p>\r\n </div>\r\n } @else if (hasSchema()) {\r\n <!--\r\n Only mount the flow once the schema tab is actually active. The\r\n structure-builder fits the diagram to the host size on load\r\n (fLoaded -> fitToScreen) and never re-fits, so mounting it inside\r\n the [hidden] (display:none, zero-size) container produces a blank\r\n canvas that doesn't recover when the tab is shown.\r\n -->\r\n @if (activeTab() === \"schema\") {\r\n <!--\r\n Use a concrete height (not lg:h-full). The diagram has no\r\n intrinsic height, and the tab's ancestor chain is block (not\r\n flex) on lg, so `h-full` collapses to 0 and the canvas renders\r\n blank. Mirrors the process preview's `h-[70vh]`.\r\n -->\r\n <div class=\"h-[70vh] min-h-[22rem] overflow-hidden rounded-lg\">\r\n <mt-structure-builder\r\n class=\"h-full\"\r\n [layoutDirection]=\"'LR'\"\r\n [readonly]=\"true\"\r\n [structureMode]=\"'workflow'\"\r\n [nodeFields]=\"previewNodeFields\"\r\n [nodes]=\"schemaNodes()\"\r\n [connections]=\"schemaConnections()\"\r\n />\r\n </div>\r\n }\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"context.escalationSchemaUnavailable\") }}\r\n </p>\r\n </div>\r\n }\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"context.escalationSchemaContextUnavailable\") }}\r\n </p>\r\n </div>\r\n }\r\n </div>\r\n\r\n <div\r\n class=\"h-full min-h-0 overflow-hidden\"\r\n [hidden]=\"activeTab() !== 'discussion'\"\r\n >\r\n @if (canRenderDiscussion()) {\r\n <div\r\n class=\"h-[32rem] min-h-[22rem] overflow-hidden rounded-lg border border-surface-200 bg-surface-50 lg:h-full lg:min-h-0\"\r\n >\r\n <mt-discussion-thread\r\n [moduleType]=\"'EscalationInstance'\"\r\n [recordId]=\"resolvedInstanceId()\"\r\n [mentionSearchEndpoint]=\"'Identity/users'\"\r\n [mentionSearchParam]=\"'query'\"\r\n [mentionSearchDataPath]=\"'data'\"\r\n [uploadEndpoint]=\"'uploader'\"\r\n [attachmentDownloadEndpoint]=\"'uploader'\"\r\n [showParticipants]=\"true\"\r\n [autoMarkRead]=\"true\"\r\n [refreshIntervalMs]=\"0\"\r\n [styleClass]=\"'h-full'\"\r\n />\r\n </div>\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"context.escalationDiscussionUnavailable\") }}\r\n </p>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: Tabs, selector: "mt-tabs", inputs: ["options", "optionLabel", "optionValue", "active", "mode", "moreLabel", "defaultIcon", "size", "fluid", "disabled", "searchThreshold"], outputs: ["activeChange", "onChange"] }, { kind: "component", type: DiscussionThread, selector: "mt-discussion-thread", inputs: ["moduleType", "recordId", "title", "subtitle", "placeholder", "pageSize", "currentUserId", "requestContext", "mentionableUsers", "mentionSearchEndpoint", "mentionSearchParam", "mentionSearchDataPath", "allowAttachments", "uploadEndpoint", "attachmentDownloadEndpoint", "showParticipants", "autoMarkRead", "refreshIntervalMs", "styleClass", "disabled"], outputs: ["loaded", "errored", "commentCreated", "commentUpdated", "commentDeleted", "readStateChanged"] }, { kind: "component", type: EntitiesPreview, selector: "mt-entities-preview", inputs: ["entities", "attachmentShape", "stackOnNarrow", "clickableKeys", "activeKeys", "clickableTooltip", "activeTooltip"], outputs: ["entityClick"] }, { kind: "component", type: ClientInstancePreview, selector: "mt-client-instance-preview", inputs: ["config", "hideEmptyState", "stackOnNarrow"] }, { kind: "component", type: StructureBuilder, selector: "mt-structure-builder", inputs: ["availableNodes", "availableNodesLabel", "nodeForm", "nodeDialogFooterConfig", "connectionForm", "connectionFormulaSchemaId", "connectionFormulaConfig", "connectionGuard", "nodeActions", "nodeFields", "isAutoLayout", "readonly", "structureMode", "nodeStyle", "addModalType", "updateModalType", "addModalStyleClass", "updateModalStyleClass", "addModalHeader", "updateModalHeader", "appendTo", "availableTabsClass", "layoutDirection", "nodes", "connections", "nodeTemplate"], outputs: ["nodeActionsEvent", "action", "nodesChange", "connectionsChange"] }] });
1282
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: WorkCenterEscalationInstanceType, isStandalone: true, selector: "mt-work-center-escalation-instance-type", inputs: { details: { classPropertyName: "details", publicName: "details", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<div\r\n class=\"mt-modal-content flex h-full min-h-0 flex-col gap-4 p-4 lg:overflow-hidden\"\r\n *transloco=\"let t; prefix: 'workCenter'\"\r\n>\r\n <div\r\n class=\"flex flex-1 min-h-0 flex-col gap-4 lg:grid lg:grid-cols-[13rem_minmax(0,1fr)] lg:gap-6\"\r\n >\r\n @if (tabOptions().length > 1) {\r\n <mt-tabs\r\n [(active)]=\"activeTab\"\r\n [options]=\"tabOptions()\"\r\n mode=\"vertical\"\r\n size=\"small\"\r\n />\r\n }\r\n\r\n <div class=\"min-w-0 flex-1 min-h-0 lg:overflow-hidden\">\r\n <div\r\n class=\"h-full min-h-0 lg:overflow-hidden\"\r\n [hidden]=\"activeTab() !== 'escalationDetails'\"\r\n >\r\n <div\r\n class=\"min-w-0 h-full min-h-0 lg:overflow-y-auto lg:overscroll-contain lg:pr-2\"\r\n >\r\n @if (canRenderDetails()) {\r\n @if (loading()) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"loading.escalationDetails\") }}\r\n </p>\r\n </div>\r\n } @else if (error(); as error) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-red-300 bg-red-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-red-600\">\r\n {{ error }}\r\n </p>\r\n </div>\r\n } @else if (preview()) {\r\n <mt-entities-preview [entities]=\"detailEntities()\" />\r\n }\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"context.escalationDetailsUnavailable\") }}\r\n </p>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n\r\n <div\r\n class=\"h-full min-h-0 lg:overflow-hidden\"\r\n [hidden]=\"activeTab() !== 'moduleDetails'\"\r\n >\r\n @if (moduleDetailsConfig(); as moduleDetailsConfig) {\r\n <div\r\n class=\"min-w-0 h-full min-h-0 lg:overflow-y-auto lg:overscroll-contain lg:pr-2\"\r\n >\r\n <mt-client-instance-preview [config]=\"moduleDetailsConfig\" />\r\n </div>\r\n }\r\n </div>\r\n\r\n <div\r\n class=\"flex-1 min-h-0 overflow-auto\"\r\n [hidden]=\"activeTab() !== 'schema'\"\r\n >\r\n @if (canRenderDetails()) {\r\n @if (loading()) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"loading.escalationSchema\") }}\r\n </p>\r\n </div>\r\n } @else if (error(); as error) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-red-300 bg-red-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-red-600\">\r\n {{ error }}\r\n </p>\r\n </div>\r\n } @else if (hasSchema()) {\r\n <!--\r\n Only mount the flow once the schema tab is actually active. The\r\n structure-builder fits the diagram to the host size on load\r\n (fLoaded -> fitToScreen) and never re-fits, so mounting it inside\r\n the [hidden] (display:none, zero-size) container produces a blank\r\n canvas that doesn't recover when the tab is shown.\r\n -->\r\n @if (activeTab() === \"schema\") {\r\n <!--\r\n Use a concrete height (not lg:h-full). The diagram has no\r\n intrinsic height, and the tab's ancestor chain is block (not\r\n flex) on lg, so `h-full` collapses to 0 and the canvas renders\r\n blank. Mirrors the process preview's `h-[70vh]`.\r\n -->\r\n <div class=\"h-[70vh] min-h-[22rem] overflow-hidden rounded-lg\">\r\n <mt-structure-builder\r\n class=\"h-full\"\r\n [layoutDirection]=\"'LR'\"\r\n [readonly]=\"true\"\r\n [structureMode]=\"'workflow'\"\r\n [nodeFields]=\"previewNodeFields\"\r\n [nodes]=\"schemaNodes()\"\r\n [connections]=\"schemaConnections()\"\r\n />\r\n </div>\r\n }\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"context.escalationSchemaUnavailable\") }}\r\n </p>\r\n </div>\r\n }\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"context.escalationSchemaContextUnavailable\") }}\r\n </p>\r\n </div>\r\n }\r\n </div>\r\n\r\n <div\r\n class=\"h-full min-h-0 overflow-hidden\"\r\n [hidden]=\"activeTab() !== 'discussion'\"\r\n >\r\n @if (canRenderDiscussion()) {\r\n <div\r\n class=\"h-[32rem] min-h-[22rem] overflow-hidden rounded-lg border border-surface-200 bg-surface-50 lg:h-full lg:min-h-0\"\r\n >\r\n <mt-discussion-thread\r\n [moduleType]=\"'EscalationInstance'\"\r\n [recordId]=\"resolvedInstanceId()\"\r\n [mentionSearchEndpoint]=\"'Identity/users'\"\r\n [mentionSearchParam]=\"'query'\"\r\n [mentionSearchDataPath]=\"'data'\"\r\n [uploadEndpoint]=\"'uploader'\"\r\n [attachmentDownloadEndpoint]=\"'uploader'\"\r\n [showParticipants]=\"true\"\r\n [autoMarkRead]=\"true\"\r\n [refreshIntervalMs]=\"0\"\r\n [styleClass]=\"'h-full'\"\r\n />\r\n </div>\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"context.escalationDiscussionUnavailable\") }}\r\n </p>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: Tabs, selector: "mt-tabs", inputs: ["options", "optionLabel", "optionValue", "active", "mode", "moreLabel", "defaultIcon", "size", "fluid", "disabled", "searchThreshold"], outputs: ["activeChange", "onChange"] }, { kind: "component", type: DiscussionThread, selector: "mt-discussion-thread", inputs: ["moduleType", "recordId", "title", "subtitle", "placeholder", "pageSize", "currentUserId", "requestContext", "mentionableUsers", "mentionSearchEndpoint", "mentionSearchParam", "mentionSearchDataPath", "allowAttachments", "uploadEndpoint", "attachmentDownloadEndpoint", "showParticipants", "autoMarkRead", "refreshIntervalMs", "styleClass", "disabled"], outputs: ["loaded", "errored", "commentCreated", "commentUpdated", "commentDeleted", "readStateChanged"] }, { kind: "component", type: EntitiesPreview, selector: "mt-entities-preview", inputs: ["entities", "attachmentShape", "stackOnNarrow", "clickableKeys", "activeKeys", "clickableTooltip", "activeTooltip"], outputs: ["entityClick"] }, { kind: "component", type: ClientInstancePreview, selector: "mt-client-instance-preview", inputs: ["config", "hideEmptyState", "stackOnNarrow"] }, { kind: "component", type: StructureBuilder, selector: "mt-structure-builder", inputs: ["availableNodes", "availableNodesLabel", "nodeForm", "nodeDialogFooterConfig", "connectionForm", "connectionFormulaSchemaId", "connectionFormulaConfig", "nodeActions", "nodeFields", "isAutoLayout", "readonly", "structureMode", "nodeStyle", "addModalType", "updateModalType", "addModalStyleClass", "updateModalStyleClass", "addModalHeader", "updateModalHeader", "appendTo", "availableTabsClass", "layoutDirection", "nodes", "connections", "nodeTemplate"], outputs: ["nodeActionsEvent", "action", "nodesChange", "connectionsChange"] }] });
1725
1283
  }
1726
1284
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: WorkCenterEscalationInstanceType, decorators: [{
1727
1285
  type: Component,
@@ -2110,7 +1668,7 @@ class WorkCenterProcessPreview {
2110
1668
  });
2111
1669
  }
2112
1670
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: WorkCenterProcessPreview, deps: [], target: i0.ɵɵFactoryTarget.Component });
2113
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: WorkCenterProcessPreview, isStandalone: true, selector: "mt-work-center-process-preview", inputs: { requestId: { classPropertyName: "requestId", publicName: "requestId", isSignal: true, isRequired: false, transformFunction: null }, view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if (!canRenderPreview()) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n Process preview is not available for this item yet.\r\n </p>\r\n </div>\r\n} @else if (loading()) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"text-sm text-surface-500\">Loading process preview...</p>\r\n </div>\r\n} @else if (error()) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-red-300 bg-red-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-red-600\">{{ error() }}</p>\r\n </div>\r\n} @else {\r\n @if (view() === \"schema\") {\r\n @if (hasSchema()) {\r\n <div class=\"wc-process-preview-schema h-[70vh] overflow-hidden\">\r\n <mt-structure-builder\r\n class=\"h-full\"\r\n [layoutDirection]=\"'LR'\"\r\n [readonly]=\"true\"\r\n [structureMode]=\"'workflow'\"\r\n [nodeFields]=\"previewNodeFields\"\r\n [nodes]=\"schemaNodes()\"\r\n [connections]=\"schemaConnections()\"\r\n />\r\n </div>\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n Process steps are not available for this item yet.\r\n </p>\r\n </div>\r\n }\r\n } @else if (hasApprovals()) {\r\n <div class=\"max-h-[70vh] overflow-y-auto\">\r\n <mt-table\r\n noCard\r\n [data]=\"approvalRows()\"\r\n [columns]=\"approvalColumns()\"\r\n storageKey=\"work-center-process-preview-table\"\r\n [showFilters]=\"false\"\r\n [generalSearch]=\"false\"\r\n [clickableRows]=\"false\"\r\n />\r\n </div>\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n Process approvals data is not available for this item yet.\r\n </p>\r\n </div>\r\n }\r\n}\r\n", styles: [":host ::ng-deep .wc-process-preview-schema .wf-detail-row{align-items:center}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange"] }, { kind: "component", type: StructureBuilder, selector: "mt-structure-builder", inputs: ["availableNodes", "availableNodesLabel", "nodeForm", "nodeDialogFooterConfig", "connectionForm", "connectionFormulaSchemaId", "connectionFormulaConfig", "connectionGuard", "nodeActions", "nodeFields", "isAutoLayout", "readonly", "structureMode", "nodeStyle", "addModalType", "updateModalType", "addModalStyleClass", "updateModalStyleClass", "addModalHeader", "updateModalHeader", "appendTo", "availableTabsClass", "layoutDirection", "nodes", "connections", "nodeTemplate"], outputs: ["nodeActionsEvent", "action", "nodesChange", "connectionsChange"] }] });
1671
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: WorkCenterProcessPreview, isStandalone: true, selector: "mt-work-center-process-preview", inputs: { requestId: { classPropertyName: "requestId", publicName: "requestId", isSignal: true, isRequired: false, transformFunction: null }, view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if (!canRenderPreview()) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n Process preview is not available for this item yet.\r\n </p>\r\n </div>\r\n} @else if (loading()) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"text-sm text-surface-500\">Loading process preview...</p>\r\n </div>\r\n} @else if (error()) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-red-300 bg-red-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-red-600\">{{ error() }}</p>\r\n </div>\r\n} @else {\r\n @if (view() === \"schema\") {\r\n @if (hasSchema()) {\r\n <div class=\"wc-process-preview-schema h-[70vh] overflow-hidden\">\r\n <mt-structure-builder\r\n class=\"h-full\"\r\n [layoutDirection]=\"'LR'\"\r\n [readonly]=\"true\"\r\n [structureMode]=\"'workflow'\"\r\n [nodeFields]=\"previewNodeFields\"\r\n [nodes]=\"schemaNodes()\"\r\n [connections]=\"schemaConnections()\"\r\n />\r\n </div>\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n Process steps are not available for this item yet.\r\n </p>\r\n </div>\r\n }\r\n } @else if (hasApprovals()) {\r\n <div class=\"max-h-[70vh] overflow-y-auto\">\r\n <mt-table\r\n noCard\r\n [data]=\"approvalRows()\"\r\n [columns]=\"approvalColumns()\"\r\n storageKey=\"work-center-process-preview-table\"\r\n [showFilters]=\"false\"\r\n [generalSearch]=\"false\"\r\n [clickableRows]=\"false\"\r\n />\r\n </div>\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n Process approvals data is not available for this item yet.\r\n </p>\r\n </div>\r\n }\r\n}\r\n", styles: [":host ::ng-deep .wc-process-preview-schema .wf-detail-row{align-items:center}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange"] }, { kind: "component", type: StructureBuilder, selector: "mt-structure-builder", inputs: ["availableNodes", "availableNodesLabel", "nodeForm", "nodeDialogFooterConfig", "connectionForm", "connectionFormulaSchemaId", "connectionFormulaConfig", "nodeActions", "nodeFields", "isAutoLayout", "readonly", "structureMode", "nodeStyle", "addModalType", "updateModalType", "addModalStyleClass", "updateModalStyleClass", "addModalHeader", "updateModalHeader", "appendTo", "availableTabsClass", "layoutDirection", "nodes", "connections", "nodeTemplate"], outputs: ["nodeActionsEvent", "action", "nodesChange", "connectionsChange"] }] });
2114
1672
  }
2115
1673
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: WorkCenterProcessPreview, decorators: [{
2116
1674
  type: Component,
@@ -2693,7 +2251,10 @@ class WorkCenterItemModalRoute {
2693
2251
  modal = inject(ModalService);
2694
2252
  lookups = this.facade.lookups;
2695
2253
  contextKey = input(null, ...(ngDevMode ? [{ debugName: "contextKey" }] : /* istanbul ignore next */ []));
2254
+ manageRouteOutlet = input(true, ...(ngDevMode ? [{ debugName: "manageRouteOutlet" }] : /* istanbul ignore next */ []));
2255
+ showPreviewLevelAction = input(true, ...(ngDevMode ? [{ debugName: "showPreviewLevelAction" }] : /* istanbul ignore next */ []));
2696
2256
  previewLevel = output();
2257
+ closed = output();
2697
2258
  drawerVisible = signal(true, ...(ngDevMode ? [{ debugName: "drawerVisible" }] : /* istanbul ignore next */ []));
2698
2259
  loading = signal(false, ...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
2699
2260
  error = signal(null, ...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
@@ -2705,6 +2266,7 @@ class WorkCenterItemModalRoute {
2705
2266
  this.transloco.translate('workCenter.page.itemDetails'), ...(ngDevMode ? [{ debugName: "drawerTitle" }] : /* istanbul ignore next */ []));
2706
2267
  drawerSubtitle = computed(() => this.readDisplayField(this.details()?.item, 'subtitle') ?? '', ...(ngDevMode ? [{ debugName: "drawerSubtitle" }] : /* istanbul ignore next */ []));
2707
2268
  previewLevelTarget = computed(() => this.resolvePreviewLevelTarget(this.details()), ...(ngDevMode ? [{ debugName: "previewLevelTarget" }] : /* istanbul ignore next */ []));
2269
+ displayedPreviewLevelTarget = computed(() => this.showPreviewLevelAction() ? this.previewLevelTarget() : null, ...(ngDevMode ? [{ debugName: "displayedPreviewLevelTarget" }] : /* istanbul ignore next */ []));
2708
2270
  constructor() {
2709
2271
  effect(() => {
2710
2272
  this.footerActionsMounted.set(!!this.resolvedContextKey());
@@ -2766,7 +2328,7 @@ class WorkCenterItemModalRoute {
2766
2328
  // menu/KPI counters are stale regardless of whether the dialog closes.
2767
2329
  this.facade.loadRuntime(this.facade.activeArea(), 'refresh');
2768
2330
  if (result.afterSuccess === 'close') {
2769
- void this.closeRouteOutlet();
2331
+ void this.close();
2770
2332
  return;
2771
2333
  }
2772
2334
  this.detailsReloadTick.update((value) => value + 1);
@@ -2783,7 +2345,14 @@ class WorkCenterItemModalRoute {
2783
2345
  if (visible) {
2784
2346
  return;
2785
2347
  }
2786
- await this.closeRouteOutlet();
2348
+ await this.close();
2349
+ }
2350
+ close() {
2351
+ if (!this.manageRouteOutlet()) {
2352
+ this.closed.emit();
2353
+ return Promise.resolve(true);
2354
+ }
2355
+ return this.closeRouteOutlet();
2787
2356
  }
2788
2357
  closeRouteOutlet() {
2789
2358
  console.log('[work-center-debug] modal route closing', {
@@ -2845,7 +2414,7 @@ class WorkCenterItemModalRoute {
2845
2414
  };
2846
2415
  }
2847
2416
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: WorkCenterItemModalRoute, deps: [], target: i0.ɵɵFactoryTarget.Component });
2848
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: WorkCenterItemModalRoute, isStandalone: true, selector: "mt-work-center-item-modal-route", inputs: { contextKey: { classPropertyName: "contextKey", publicName: "contextKey", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { previewLevel: "previewLevel" }, providers: [RuntimeActionContextStore], ngImport: i0, template: "<mt-drawer\r\n [visible]=\"drawerVisible()\"\r\n [loadingHeader]=\"loading()\"\r\n [title]=\"drawerTitle()\"\r\n styleClass=\"mt-work-center-item-drawer !absolute !w-[96vw] md:!w-[84vw] xl:!w-[70vw]\"\r\n position=\"right\"\r\n [modal]=\"true\"\r\n (visibleChange)=\"onVisibleChange($event)\"\r\n *transloco=\"let t; prefix: 'workCenter'\"\r\n>\r\n <ng-container content>\r\n @if (loading()) {\r\n <div class=\"p-4\" [class]=\"modal.contentClass\">\r\n <div class=\"flex min-h-[22rem] flex-col gap-5\">\r\n <div class=\"flex items-center gap-3\">\r\n <p-skeleton shape=\"circle\" size=\"3rem\" />\r\n <div class=\"flex flex-1 flex-col gap-2\">\r\n <p-skeleton width=\"12rem\" height=\"1rem\" />\r\n <p-skeleton width=\"8rem\" height=\"0.875rem\" />\r\n </div>\r\n </div>\r\n\r\n <div class=\"grid gap-3 md:grid-cols-2\">\r\n @for (_ of [1, 2, 3, 4]; track $index) {\r\n <p-skeleton height=\"5rem\" class=\"rounded-lg\" />\r\n }\r\n </div>\r\n\r\n <p-skeleton height=\"16rem\" class=\"rounded-lg\" />\r\n </div>\r\n </div>\r\n } @else if (error(); as errorMessage) {\r\n <div class=\"p-4\" [class]=\"modal.contentClass\">\r\n <div class=\"flex min-h-[22rem] items-center justify-center\">\r\n <p class=\"max-w-xl text-sm font-medium text-red-600\">\r\n {{ errorMessage }}\r\n </p>\r\n </div>\r\n </div>\r\n } @else if (details(); as details) {\r\n <div [class]=\"modal.contentClass + ' h-full min-h-0'\">\r\n <mt-work-center-item-modal [details]=\"details\" [lookups]=\"lookups()\" />\r\n </div>\r\n } @else {\r\n <div class=\"p-4\" [class]=\"modal.contentClass\">\r\n <div class=\"flex min-h-[22rem] items-center justify-center\">\r\n <p class=\"text-sm font-medium text-surface-500\">\r\n {{ t(\"modal.noItemSelected\") }}\r\n </p>\r\n </div>\r\n </div>\r\n }\r\n </ng-container>\r\n\r\n @if (footerActionsMounted()) {\r\n <div footer [class]=\"modal.footerClass\">\r\n <mt-work-center-item-modal-footer-actions\r\n [contextKey]=\"resolvedContextKey()\"\r\n [previewLevelTarget]=\"previewLevelTarget()\"\r\n (actionExecuted)=\"onActionExecuted($event)\"\r\n (previewLevelSelected)=\"onPreviewLevelSelected($event)\"\r\n (visibilityChange)=\"onFooterVisibilityChange($event)\"\r\n />\r\n </div>\r\n }\r\n</mt-drawer>\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: Drawer, selector: "mt-drawer", inputs: ["visible", "position", "fullScreen", "closeOnEscape", "blockScroll", "dismissible", "title", "subtitle", "loadingHeader", "styleClass", "transitionOptions", "appendTo", "modal", "showMaximizeToggle", "maximizeTooltip", "restoreTooltip", "maximized"], outputs: ["visibleChange", "onShow", "onHide", "maximizedChange"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: WorkCenterItemModal, selector: "mt-work-center-item-modal", inputs: ["details", "lookups"] }, { kind: "component", type: WorkCenterItemModalFooterActions, selector: "mt-work-center-item-modal-footer-actions", inputs: ["contextKey", "previewLevelTarget"], outputs: ["actionExecuted", "previewLevelSelected", "visibilityChange"] }] });
2417
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: WorkCenterItemModalRoute, isStandalone: true, selector: "mt-work-center-item-modal-route", inputs: { contextKey: { classPropertyName: "contextKey", publicName: "contextKey", isSignal: true, isRequired: false, transformFunction: null }, manageRouteOutlet: { classPropertyName: "manageRouteOutlet", publicName: "manageRouteOutlet", isSignal: true, isRequired: false, transformFunction: null }, showPreviewLevelAction: { classPropertyName: "showPreviewLevelAction", publicName: "showPreviewLevelAction", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { previewLevel: "previewLevel", closed: "closed" }, providers: [RuntimeActionContextStore], ngImport: i0, template: "<mt-drawer\n [visible]=\"drawerVisible()\"\n [loadingHeader]=\"loading()\"\n [title]=\"drawerTitle()\"\n styleClass=\"mt-work-center-item-drawer !absolute !w-[96vw] md:!w-[84vw] xl:!w-[70vw]\"\n position=\"right\"\n [modal]=\"true\"\n (visibleChange)=\"onVisibleChange($event)\"\n *transloco=\"let t; prefix: 'workCenter'\"\n>\n <ng-container content>\n @if (loading()) {\n <div class=\"p-4\" [class]=\"modal.contentClass\">\n <div class=\"flex min-h-[22rem] flex-col gap-5\">\n <div class=\"flex items-center gap-3\">\n <p-skeleton shape=\"circle\" size=\"3rem\" />\n <div class=\"flex flex-1 flex-col gap-2\">\n <p-skeleton width=\"12rem\" height=\"1rem\" />\n <p-skeleton width=\"8rem\" height=\"0.875rem\" />\n </div>\n </div>\n\n <div class=\"grid gap-3 md:grid-cols-2\">\n @for (_ of [1, 2, 3, 4]; track $index) {\n <p-skeleton height=\"5rem\" class=\"rounded-lg\" />\n }\n </div>\n\n <p-skeleton height=\"16rem\" class=\"rounded-lg\" />\n </div>\n </div>\n } @else if (error(); as errorMessage) {\n <div class=\"p-4\" [class]=\"modal.contentClass\">\n <div class=\"flex min-h-[22rem] items-center justify-center\">\n <p class=\"max-w-xl text-sm font-medium text-red-600\">\n {{ errorMessage }}\n </p>\n </div>\n </div>\n } @else if (details(); as details) {\n <div [class]=\"modal.contentClass + ' h-full min-h-0'\">\n <mt-work-center-item-modal [details]=\"details\" [lookups]=\"lookups()\" />\n </div>\n } @else {\n <div class=\"p-4\" [class]=\"modal.contentClass\">\n <div class=\"flex min-h-[22rem] items-center justify-center\">\n <p class=\"text-sm font-medium text-surface-500\">\n {{ t(\"modal.noItemSelected\") }}\n </p>\n </div>\n </div>\n }\n </ng-container>\n\n @if (footerActionsMounted()) {\n <div footer [class]=\"modal.footerClass\">\n <mt-work-center-item-modal-footer-actions\n [contextKey]=\"resolvedContextKey()\"\n [previewLevelTarget]=\"displayedPreviewLevelTarget()\"\n (actionExecuted)=\"onActionExecuted($event)\"\n (previewLevelSelected)=\"onPreviewLevelSelected($event)\"\n (visibilityChange)=\"onFooterVisibilityChange($event)\"\n />\n </div>\n }\n</mt-drawer>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: Drawer, selector: "mt-drawer", inputs: ["visible", "position", "fullScreen", "closeOnEscape", "blockScroll", "dismissible", "title", "subtitle", "loadingHeader", "styleClass", "transitionOptions", "appendTo", "modal", "showMaximizeToggle", "maximizeTooltip", "restoreTooltip", "maximized"], outputs: ["visibleChange", "onShow", "onHide", "maximizedChange"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: WorkCenterItemModal, selector: "mt-work-center-item-modal", inputs: ["details", "lookups"] }, { kind: "component", type: WorkCenterItemModalFooterActions, selector: "mt-work-center-item-modal-footer-actions", inputs: ["contextKey", "previewLevelTarget"], outputs: ["actionExecuted", "previewLevelSelected", "visibilityChange"] }] });
2849
2418
  }
2850
2419
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: WorkCenterItemModalRoute, decorators: [{
2851
2420
  type: Component,
@@ -2856,8 +2425,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
2856
2425
  SkeletonModule,
2857
2426
  WorkCenterItemModal,
2858
2427
  WorkCenterItemModalFooterActions,
2859
- ], providers: [RuntimeActionContextStore], template: "<mt-drawer\r\n [visible]=\"drawerVisible()\"\r\n [loadingHeader]=\"loading()\"\r\n [title]=\"drawerTitle()\"\r\n styleClass=\"mt-work-center-item-drawer !absolute !w-[96vw] md:!w-[84vw] xl:!w-[70vw]\"\r\n position=\"right\"\r\n [modal]=\"true\"\r\n (visibleChange)=\"onVisibleChange($event)\"\r\n *transloco=\"let t; prefix: 'workCenter'\"\r\n>\r\n <ng-container content>\r\n @if (loading()) {\r\n <div class=\"p-4\" [class]=\"modal.contentClass\">\r\n <div class=\"flex min-h-[22rem] flex-col gap-5\">\r\n <div class=\"flex items-center gap-3\">\r\n <p-skeleton shape=\"circle\" size=\"3rem\" />\r\n <div class=\"flex flex-1 flex-col gap-2\">\r\n <p-skeleton width=\"12rem\" height=\"1rem\" />\r\n <p-skeleton width=\"8rem\" height=\"0.875rem\" />\r\n </div>\r\n </div>\r\n\r\n <div class=\"grid gap-3 md:grid-cols-2\">\r\n @for (_ of [1, 2, 3, 4]; track $index) {\r\n <p-skeleton height=\"5rem\" class=\"rounded-lg\" />\r\n }\r\n </div>\r\n\r\n <p-skeleton height=\"16rem\" class=\"rounded-lg\" />\r\n </div>\r\n </div>\r\n } @else if (error(); as errorMessage) {\r\n <div class=\"p-4\" [class]=\"modal.contentClass\">\r\n <div class=\"flex min-h-[22rem] items-center justify-center\">\r\n <p class=\"max-w-xl text-sm font-medium text-red-600\">\r\n {{ errorMessage }}\r\n </p>\r\n </div>\r\n </div>\r\n } @else if (details(); as details) {\r\n <div [class]=\"modal.contentClass + ' h-full min-h-0'\">\r\n <mt-work-center-item-modal [details]=\"details\" [lookups]=\"lookups()\" />\r\n </div>\r\n } @else {\r\n <div class=\"p-4\" [class]=\"modal.contentClass\">\r\n <div class=\"flex min-h-[22rem] items-center justify-center\">\r\n <p class=\"text-sm font-medium text-surface-500\">\r\n {{ t(\"modal.noItemSelected\") }}\r\n </p>\r\n </div>\r\n </div>\r\n }\r\n </ng-container>\r\n\r\n @if (footerActionsMounted()) {\r\n <div footer [class]=\"modal.footerClass\">\r\n <mt-work-center-item-modal-footer-actions\r\n [contextKey]=\"resolvedContextKey()\"\r\n [previewLevelTarget]=\"previewLevelTarget()\"\r\n (actionExecuted)=\"onActionExecuted($event)\"\r\n (previewLevelSelected)=\"onPreviewLevelSelected($event)\"\r\n (visibilityChange)=\"onFooterVisibilityChange($event)\"\r\n />\r\n </div>\r\n }\r\n</mt-drawer>\r\n" }]
2860
- }], ctorParameters: () => [], propDecorators: { contextKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "contextKey", required: false }] }], previewLevel: [{ type: i0.Output, args: ["previewLevel"] }] } });
2428
+ ], providers: [RuntimeActionContextStore], template: "<mt-drawer\n [visible]=\"drawerVisible()\"\n [loadingHeader]=\"loading()\"\n [title]=\"drawerTitle()\"\n styleClass=\"mt-work-center-item-drawer !absolute !w-[96vw] md:!w-[84vw] xl:!w-[70vw]\"\n position=\"right\"\n [modal]=\"true\"\n (visibleChange)=\"onVisibleChange($event)\"\n *transloco=\"let t; prefix: 'workCenter'\"\n>\n <ng-container content>\n @if (loading()) {\n <div class=\"p-4\" [class]=\"modal.contentClass\">\n <div class=\"flex min-h-[22rem] flex-col gap-5\">\n <div class=\"flex items-center gap-3\">\n <p-skeleton shape=\"circle\" size=\"3rem\" />\n <div class=\"flex flex-1 flex-col gap-2\">\n <p-skeleton width=\"12rem\" height=\"1rem\" />\n <p-skeleton width=\"8rem\" height=\"0.875rem\" />\n </div>\n </div>\n\n <div class=\"grid gap-3 md:grid-cols-2\">\n @for (_ of [1, 2, 3, 4]; track $index) {\n <p-skeleton height=\"5rem\" class=\"rounded-lg\" />\n }\n </div>\n\n <p-skeleton height=\"16rem\" class=\"rounded-lg\" />\n </div>\n </div>\n } @else if (error(); as errorMessage) {\n <div class=\"p-4\" [class]=\"modal.contentClass\">\n <div class=\"flex min-h-[22rem] items-center justify-center\">\n <p class=\"max-w-xl text-sm font-medium text-red-600\">\n {{ errorMessage }}\n </p>\n </div>\n </div>\n } @else if (details(); as details) {\n <div [class]=\"modal.contentClass + ' h-full min-h-0'\">\n <mt-work-center-item-modal [details]=\"details\" [lookups]=\"lookups()\" />\n </div>\n } @else {\n <div class=\"p-4\" [class]=\"modal.contentClass\">\n <div class=\"flex min-h-[22rem] items-center justify-center\">\n <p class=\"text-sm font-medium text-surface-500\">\n {{ t(\"modal.noItemSelected\") }}\n </p>\n </div>\n </div>\n }\n </ng-container>\n\n @if (footerActionsMounted()) {\n <div footer [class]=\"modal.footerClass\">\n <mt-work-center-item-modal-footer-actions\n [contextKey]=\"resolvedContextKey()\"\n [previewLevelTarget]=\"displayedPreviewLevelTarget()\"\n (actionExecuted)=\"onActionExecuted($event)\"\n (previewLevelSelected)=\"onPreviewLevelSelected($event)\"\n (visibilityChange)=\"onFooterVisibilityChange($event)\"\n />\n </div>\n }\n</mt-drawer>\n" }]
2429
+ }], ctorParameters: () => [], propDecorators: { contextKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "contextKey", required: false }] }], manageRouteOutlet: [{ type: i0.Input, args: [{ isSignal: true, alias: "manageRouteOutlet", required: false }] }], showPreviewLevelAction: [{ type: i0.Input, args: [{ isSignal: true, alias: "showPreviewLevelAction", required: false }] }], previewLevel: [{ type: i0.Output, args: ["previewLevel"] }], closed: [{ type: i0.Output, args: ["closed"] }] } });
2861
2430
  // Accepts either a plain string (e.g. `moduleKey`) or a localized
2862
2431
  // `{ display, en, ar }` translatable, returning the display string.
2863
2432
  function normalizeDisplayName(value) {
@@ -2885,6 +2454,469 @@ function normalizeRouteId(value) {
2885
2454
  return null;
2886
2455
  }
2887
2456
 
2457
+ const OPERATOR_LABELS = {
2458
+ Eq: 'Equals',
2459
+ Neq: 'Not equal',
2460
+ In: 'In',
2461
+ Contains: 'Contains',
2462
+ StartsWith: 'Starts with',
2463
+ Gt: 'Greater than',
2464
+ Gte: 'Greater than or equal',
2465
+ Lt: 'Less than',
2466
+ Lte: 'Less than or equal',
2467
+ Between: 'Between',
2468
+ IsNull: 'Is empty',
2469
+ IsNotNull: 'Is not empty',
2470
+ };
2471
+ const OPERATOR_VALUE_MODE = {
2472
+ In: 'multi',
2473
+ Between: 'range',
2474
+ IsNull: 'none',
2475
+ IsNotNull: 'none',
2476
+ };
2477
+ const GENERAL_TASK_CARD_KEYS = new Set([
2478
+ 'mygeneraltasks',
2479
+ 'generaltask',
2480
+ 'generaltasks',
2481
+ ]);
2482
+ function toLabel(value) {
2483
+ const normalized = value.split('.').pop() ?? value;
2484
+ return normalized
2485
+ .replace(/[_-]/g, ' ')
2486
+ .replace(/([a-z])([A-Z])/g, '$1 $2')
2487
+ .trim()
2488
+ .replace(/\b\w/g, (char) => char.toUpperCase());
2489
+ }
2490
+ function columnTypeToViewType(type) {
2491
+ if (type === 'date')
2492
+ return 'Date';
2493
+ return undefined;
2494
+ }
2495
+ function normalizeCardKey(value) {
2496
+ if (typeof value !== 'string') {
2497
+ return '';
2498
+ }
2499
+ return value
2500
+ .trim()
2501
+ .replace(/[\s_-]/g, '')
2502
+ .toLowerCase();
2503
+ }
2504
+ /**
2505
+ * Strips the user envelope used by `mt-table` user filters down to the
2506
+ * scalar id that the BE rule payload accepts. Falls back to the original
2507
+ * value for non-user shapes (e.g. simple string in a select filter).
2508
+ */
2509
+ function extractIdScalar(value) {
2510
+ if (value !== null &&
2511
+ typeof value === 'object' &&
2512
+ 'id' in value) {
2513
+ return value['id'];
2514
+ }
2515
+ return value;
2516
+ }
2517
+ function toIsoDate(value) {
2518
+ if (value instanceof Date)
2519
+ return value.toISOString();
2520
+ return value;
2521
+ }
2522
+ /**
2523
+ * Translates one in-table column filter value into a `WorkCenterFilterRule`.
2524
+ *
2525
+ * The shape of `raw` depends on the column's filter type — see
2526
+ * `mt-table` `table-filter-field` outputs:
2527
+ * - text → string → `Contains`
2528
+ * - select → scalar | scalar[] → `Eq` | `In`
2529
+ * - boolean → boolean → `Eq`
2530
+ * - date → `{ from?, to?, value? }` (Date|null)→ `Between`/`Gte`/`Lte`/`Eq`
2531
+ * - user → `{ id, ... }` | `{ id, ... }[]` → `Eq` (id) | `In` (ids)
2532
+ *
2533
+ * Returns `null` when the value is empty / nothing to send.
2534
+ */
2535
+ function toRuntimeFilterRule(field, raw, column) {
2536
+ if (raw === null || raw === undefined || raw === '')
2537
+ return null;
2538
+ if (typeof raw === 'boolean') {
2539
+ return { field, op: 'Eq', value: raw };
2540
+ }
2541
+ if (typeof raw === 'number') {
2542
+ return { field, op: 'Eq', value: raw };
2543
+ }
2544
+ if (typeof raw === 'string') {
2545
+ if (!raw.trim().length)
2546
+ return null;
2547
+ return { field, op: 'Contains', value: raw };
2548
+ }
2549
+ if (Array.isArray(raw)) {
2550
+ const values = raw
2551
+ .map(extractIdScalar)
2552
+ .filter((v) => v !== null && v !== undefined && v !== '');
2553
+ if (!values.length)
2554
+ return null;
2555
+ return { field, op: 'In', values };
2556
+ }
2557
+ if (typeof raw === 'object') {
2558
+ const obj = raw;
2559
+ // User filter envelope -> single-id Eq.
2560
+ if (obj.id !== undefined && obj.id !== null && obj.id !== '') {
2561
+ return { field, op: 'Eq', value: obj.id };
2562
+ }
2563
+ const hasFrom = obj.from !== undefined && obj.from !== null;
2564
+ const hasTo = obj.to !== undefined && obj.to !== null;
2565
+ if (hasFrom && hasTo) {
2566
+ return {
2567
+ field,
2568
+ op: 'Between',
2569
+ from: toIsoDate(obj.from),
2570
+ to: toIsoDate(obj.to),
2571
+ };
2572
+ }
2573
+ if (hasFrom) {
2574
+ return { field, op: 'Gte', value: toIsoDate(obj.from) };
2575
+ }
2576
+ if (hasTo) {
2577
+ return { field, op: 'Lte', value: toIsoDate(obj.to) };
2578
+ }
2579
+ if (obj.value !== undefined && obj.value !== null && obj.value !== '') {
2580
+ const treatAsContains = column?.type === 'text' ||
2581
+ (column?.filterConfig?.type === 'text' &&
2582
+ typeof obj.value === 'string');
2583
+ if (treatAsContains) {
2584
+ return { field, op: 'Contains', value: obj.value };
2585
+ }
2586
+ return { field, op: 'Eq', value: extractIdScalar(obj.value) };
2587
+ }
2588
+ }
2589
+ return null;
2590
+ }
2591
+ /**
2592
+ * Walks `mt-table`'s filter map and produces the `WorkCenterFilterRule[]`
2593
+ * sent on the BE column-filter slice. The synthetic `generalSearch` key is
2594
+ * skipped because the page keeps general search local-only.
2595
+ */
2596
+ function buildColumnRuntimeFilters(filters, columns, allowedFields) {
2597
+ if (!filters)
2598
+ return [];
2599
+ const allowed = allowedFields && allowedFields.length ? new Set(allowedFields) : null;
2600
+ const columnByKey = new Map(columns.map((col) => [col.key, col]));
2601
+ const rules = [];
2602
+ for (const [key, raw] of Object.entries(filters)) {
2603
+ if (key === 'generalSearch')
2604
+ continue;
2605
+ if (allowed && !allowed.has(key))
2606
+ continue;
2607
+ const rule = toRuntimeFilterRule(key, raw, columnByKey.get(key));
2608
+ if (rule)
2609
+ rules.push(rule);
2610
+ }
2611
+ return rules;
2612
+ }
2613
+ function areFilterRulesEqual(left, right) {
2614
+ return JSON.stringify(left) === JSON.stringify(right);
2615
+ }
2616
+ function mapAllowedFields(schema) {
2617
+ const properties = schema.properties ?? [];
2618
+ const fromProperties = properties
2619
+ .filter((property) => typeof property?.key === 'string' && property.key.length > 0)
2620
+ .map((property) => ({
2621
+ key: property.key,
2622
+ label: property.name?.display ||
2623
+ property.name?.en ||
2624
+ property.name?.ar ||
2625
+ toLabel(property.key),
2626
+ viewType: property.viewType,
2627
+ }));
2628
+ if (fromProperties.length) {
2629
+ return fromProperties;
2630
+ }
2631
+ return (schema.allowedFields ?? []).map((field) => ({
2632
+ key: field,
2633
+ label: toLabel(field),
2634
+ }));
2635
+ }
2636
+ function mapAllowedOperators(schema, getLabel) {
2637
+ const options = [];
2638
+ for (const operator of schema.allowedOperators ?? []) {
2639
+ if (typeof operator === 'string') {
2640
+ options.push({
2641
+ key: operator,
2642
+ label: getLabel(operator),
2643
+ valueMode: OPERATOR_VALUE_MODE[operator] ?? 'single',
2644
+ });
2645
+ continue;
2646
+ }
2647
+ const key = operator?.value;
2648
+ if (!key) {
2649
+ continue;
2650
+ }
2651
+ options.push({
2652
+ key,
2653
+ label: operator.display?.display ||
2654
+ operator.display?.en ||
2655
+ operator.display?.ar ||
2656
+ getLabel(key),
2657
+ valueMode: OPERATOR_VALUE_MODE[key] ?? 'single',
2658
+ });
2659
+ }
2660
+ return options;
2661
+ }
2662
+ class WorkCenterPage {
2663
+ facade = inject(WorkCenterFacade);
2664
+ modal = inject(ModalService);
2665
+ transloco = inject(TranslocoService);
2666
+ destroyRef = inject(DestroyRef);
2667
+ activeLang = signal(this.transloco.getActiveLang(), ...(ngDevMode ? [{ debugName: "activeLang" }] : /* istanbul ignore next */ []));
2668
+ area = input('MyInbox', ...(ngDevMode ? [{ debugName: "area" }] : /* istanbul ignore next */ []));
2669
+ pageTitle = input('', ...(ngDevMode ? [{ debugName: "pageTitle" }] : /* istanbul ignore next */ []));
2670
+ menuIcon = input('communication.inbox-01', ...(ngDevMode ? [{ debugName: "menuIcon" }] : /* istanbul ignore next */ []));
2671
+ lookups = input([], ...(ngDevMode ? [{ debugName: "lookups" }] : /* istanbul ignore next */ []));
2672
+ showSidebar = input(true, ...(ngDevMode ? [{ debugName: "showSidebar" }] : /* istanbul ignore next */ []));
2673
+ bootstrapInputs = input(null, ...(ngDevMode ? [{ debugName: "bootstrapInputs" }] : /* istanbul ignore next */ []));
2674
+ openItemDrawer = input(false, ...(ngDevMode ? [{ debugName: "openItemDrawer" }] : /* istanbul ignore next */ []));
2675
+ openItemsInModal = input(true, ...(ngDevMode ? [{ debugName: "openItemsInModal" }] : /* istanbul ignore next */ []));
2676
+ itemModal = input(null, ...(ngDevMode ? [{ debugName: "itemModal" }] : /* istanbul ignore next */ []));
2677
+ generalTaskModal = input(null, ...(ngDevMode ? [{ debugName: "generalTaskModal" }] : /* istanbul ignore next */ []));
2678
+ runtimeFiltersChanged = output();
2679
+ itemClicked = output();
2680
+ cardSelected = output();
2681
+ context = this.facade.context;
2682
+ headerFilters = this.facade.headerFilters;
2683
+ tableFilters = signal({}, ...(ngDevMode ? [{ debugName: "tableFilters" }] : /* istanbul ignore next */ []));
2684
+ selectedItemContextKey = signal(null, ...(ngDevMode ? [{ debugName: "selectedItemContextKey" }] : /* istanbul ignore next */ []));
2685
+ _menuItems = this.facade.menuItems;
2686
+ menuItems = computed(() => {
2687
+ this.activeLang();
2688
+ return this._menuItems().map((item) => ({
2689
+ ...item,
2690
+ subtitle: `${item.count} ${item.title}`,
2691
+ }));
2692
+ }, ...(ngDevMode ? [{ debugName: "menuItems" }] : /* istanbul ignore next */ []));
2693
+ rows = this.facade.rows;
2694
+ columns = this.facade.columns;
2695
+ kpis = this.facade.kpis;
2696
+ runtimeFilterSchema = this.facade.runtimeFilterSchema;
2697
+ totalCount = this.facade.totalCount;
2698
+ columnFilters = this.facade.columnFilters;
2699
+ loading = this.facade.loading;
2700
+ tableColumns = computed(() => this.columns().map((column) => ({
2701
+ ...column,
2702
+ sortable: true,
2703
+ })), ...(ngDevMode ? [{ debugName: "tableColumns" }] : /* istanbul ignore next */ []));
2704
+ /**
2705
+ * Maps each status/group display label to its total count from the KPI
2706
+ * summary cards so the group header shows the real backend total rather than
2707
+ * the current-page row count.
2708
+ */
2709
+ statusGroupCountMap = computed(() => {
2710
+ const map = new Map();
2711
+ for (const kpi of this.kpis()) {
2712
+ const label = kpi.subTitle;
2713
+ const count = Number(kpi.title);
2714
+ if (label && !isNaN(count)) {
2715
+ map.set(label, count);
2716
+ }
2717
+ }
2718
+ return map;
2719
+ }, ...(ngDevMode ? [{ debugName: "statusGroupCountMap" }] : /* istanbul ignore next */ []));
2720
+ propertyFilterSchema = computed(() => {
2721
+ this.activeLang();
2722
+ const schema = this.runtimeFilterSchema();
2723
+ if (schema) {
2724
+ const allowedFields = mapAllowedFields(schema);
2725
+ const allowedOperators = mapAllowedOperators(schema, (key) => this.getOpLabel(key));
2726
+ if (allowedFields.length && allowedOperators.length) {
2727
+ return { allowedFields, allowedOperators };
2728
+ }
2729
+ }
2730
+ const fallbackFields = this.columns()
2731
+ .filter((column) => typeof column?.key === 'string' && column.key.length > 0)
2732
+ .map((column) => ({
2733
+ key: column.key,
2734
+ label: column.label || toLabel(column.key),
2735
+ viewType: columnTypeToViewType(column.type),
2736
+ }));
2737
+ if (!fallbackFields.length) {
2738
+ return null;
2739
+ }
2740
+ const fallbackOperators = Object.keys(OPERATOR_LABELS).map((key) => ({
2741
+ key,
2742
+ label: this.getOpLabel(key),
2743
+ valueMode: OPERATOR_VALUE_MODE[key] ?? 'single',
2744
+ }));
2745
+ return {
2746
+ allowedFields: fallbackFields,
2747
+ allowedOperators: fallbackOperators,
2748
+ };
2749
+ }, ...(ngDevMode ? [{ debugName: "propertyFilterSchema" }] : /* istanbul ignore next */ []));
2750
+ showGeneralTaskCreateButton = computed(() => GENERAL_TASK_CARD_KEYS.has(normalizeCardKey(this.context().selectedCardKey)), ...(ngDevMode ? [{ debugName: "showGeneralTaskCreateButton" }] : /* istanbul ignore next */ []));
2751
+ generalTaskButtonLabel = computed(() => {
2752
+ this.activeLang();
2753
+ return (this.generalTaskModal()?.buttonLabel?.trim() ||
2754
+ this.transloco.translate('workCenter.page.new'));
2755
+ }, ...(ngDevMode ? [{ debugName: "generalTaskButtonLabel" }] : /* istanbul ignore next */ []));
2756
+ resolvedPageTitle = computed(() => {
2757
+ this.activeLang();
2758
+ return (this.pageTitle() ||
2759
+ this.transloco.translate('workCenter.page.title'));
2760
+ }, ...(ngDevMode ? [{ debugName: "resolvedPageTitle" }] : /* istanbul ignore next */ []));
2761
+ generalTaskButtonIcon = computed(() => this.generalTaskModal()?.buttonIcon?.trim() || 'general.plus', ...(ngDevMode ? [{ debugName: "generalTaskButtonIcon" }] : /* istanbul ignore next */ []));
2762
+ defaultModalStyleClass = '!w-[96vw] md:!w-[84vw] xl:!w-[70vw] !shadow-none';
2763
+ defaultGeneralTaskModalStyleClass = '!w-[70vw] !h-[90vh]';
2764
+ constructor() {
2765
+ this.transloco.langChanges$
2766
+ .pipe(takeUntilDestroyed(this.destroyRef))
2767
+ .subscribe((lang) => this.activeLang.set(lang));
2768
+ effect(() => {
2769
+ this.facade.setLookups(this.lookups());
2770
+ });
2771
+ effect(() => {
2772
+ const inputs = this.bootstrapInputs();
2773
+ if (inputs) {
2774
+ this.facade.setParams(this.area(), inputs);
2775
+ }
2776
+ });
2777
+ }
2778
+ onMenuItemClick(item) {
2779
+ if (item.key === this.context().selectedCardKey) {
2780
+ return;
2781
+ }
2782
+ this.facade.selectCardAndLoad(this.area(), item.key);
2783
+ this.cardSelected.emit(item.key);
2784
+ }
2785
+ onRuntimeFiltersApplied(filters) {
2786
+ const mappedFilters = filters.map((filter) => ({
2787
+ field: filter.field,
2788
+ op: filter.op,
2789
+ value: filter.value,
2790
+ values: filter.values,
2791
+ from: filter.from,
2792
+ to: filter.to,
2793
+ }));
2794
+ this.facade.applyHeaderFiltersAndLoad(this.area(), mappedFilters);
2795
+ this.runtimeFiltersChanged.emit(mappedFilters);
2796
+ }
2797
+ onRuntimeFiltersCleared() {
2798
+ this.facade.clearAllFiltersAndLoad(this.area());
2799
+ this.tableFilters.set({});
2800
+ this.runtimeFiltersChanged.emit([]);
2801
+ }
2802
+ /**
2803
+ * Single entry point for `mt-table` (`lazy=true`) — handles both column
2804
+ * filters and pagination/sort. Filter changes always reset the page to 1
2805
+ * (handled by `applyColumnFiltersAndLoad`); when only paging/sort changed
2806
+ * we fall through to `applyTableLazyLoadAndLoad`.
2807
+ */
2808
+ onTableLazyLoad(event) {
2809
+ const schema = this.runtimeFilterSchema();
2810
+ const propertyKeys = (schema?.properties ?? [])
2811
+ .map((p) => p?.key)
2812
+ .filter((k) => typeof k === 'string' && k.length > 0);
2813
+ const allowedKeys = schema?.allowedFields ?? [];
2814
+ const allowedFields = propertyKeys.length ? propertyKeys : allowedKeys;
2815
+ const nextColumnFilters = buildColumnRuntimeFilters(event?.filters, this.columns(), allowedFields.length ? allowedFields : undefined);
2816
+ if (!areFilterRulesEqual(nextColumnFilters, this.columnFilters())) {
2817
+ this.facade.applyColumnFiltersAndLoad(this.area(), nextColumnFilters);
2818
+ return;
2819
+ }
2820
+ this.facade.applyTableLazyLoadAndLoad(this.area(), event);
2821
+ }
2822
+ onGeneralTaskCreateClick() {
2823
+ const modalOptions = this.generalTaskModal();
2824
+ const modalData = {
2825
+ moduleKey: 'GeneralTask',
2826
+ ...(modalOptions?.data ?? {}),
2827
+ };
2828
+ const modalHeader = modalOptions?.header ??
2829
+ this.transloco.translate('workCenter.page.createGeneralTask');
2830
+ const modalStyleClass = modalOptions?.styleClass ?? this.defaultGeneralTaskModalStyleClass;
2831
+ const operationKey = modalOptions?.operationKey ?? 'Create';
2832
+ const closeOnPendingApproval = modalOptions?.closeOnPendingApproval ?? true;
2833
+ const lookups = modalOptions?.lookups ?? this.lookups();
2834
+ const ref = this.modal.openModal(WorkCenterClientFormModal, 'dialog', {
2835
+ header: modalHeader,
2836
+ styleClass: modalStyleClass,
2837
+ position: 'end',
2838
+ dismissableMask: true,
2839
+ inputValues: {
2840
+ data: modalData,
2841
+ operationKey,
2842
+ closeOnPendingApproval,
2843
+ lookups,
2844
+ },
2845
+ });
2846
+ ref.onClose.pipe(take(1)).subscribe((result) => {
2847
+ if (result) {
2848
+ this.facade.loadRuntime(this.area(), 'refresh');
2849
+ }
2850
+ });
2851
+ }
2852
+ onRowClick(row) {
2853
+ const contextKey = this.resolveRowContextKey(row);
2854
+ console.log('[work-center-debug] page row click', {
2855
+ contextKey,
2856
+ row,
2857
+ openItemsInModal: this.openItemsInModal(),
2858
+ hasModalComponent: !!this.itemModal()?.component,
2859
+ });
2860
+ if (!contextKey) {
2861
+ return;
2862
+ }
2863
+ this.itemClicked.emit(contextKey);
2864
+ if (this.openItemDrawer()) {
2865
+ this.selectedItemContextKey.set(contextKey);
2866
+ return;
2867
+ }
2868
+ if (!this.openItemsInModal()) {
2869
+ return;
2870
+ }
2871
+ const modalOptions = this.itemModal();
2872
+ if (!modalOptions?.component) {
2873
+ return;
2874
+ }
2875
+ const ref = this.modal.openModal(modalOptions.component, 'drawer', {
2876
+ header: modalOptions?.header ??
2877
+ this.transloco.translate('workCenter.page.itemDetails'),
2878
+ styleClass: modalOptions?.styleClass ?? this.defaultModalStyleClass,
2879
+ position: modalOptions?.position ?? 'end',
2880
+ dismissible: true,
2881
+ modal: true,
2882
+ ...(modalOptions?.appendTo ? { appendTo: modalOptions.appendTo } : {}),
2883
+ inputValues: { contextKey },
2884
+ });
2885
+ ref.onClose.pipe(take(1)).subscribe(() => {
2886
+ this.facade.loadRuntime(this.area(), 'refresh');
2887
+ });
2888
+ }
2889
+ rowsClickable = computed(() => this.openItemDrawer() || this.openItemsInModal(), ...(ngDevMode ? [{ debugName: "rowsClickable" }] : /* istanbul ignore next */ []));
2890
+ getOpLabel(key) {
2891
+ return (this.transloco.translate('workCenter.operator.' + key) ||
2892
+ OPERATOR_LABELS[key] ||
2893
+ toLabel(key));
2894
+ }
2895
+ resolveRowContextKey(row) {
2896
+ const value = row['contextKey'];
2897
+ if (typeof value !== 'string') {
2898
+ return null;
2899
+ }
2900
+ const normalized = value.trim();
2901
+ return normalized.length ? normalized : null;
2902
+ }
2903
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: WorkCenterPage, deps: [], target: i0.ɵɵFactoryTarget.Component });
2904
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: WorkCenterPage, isStandalone: true, selector: "mt-work-center-page", inputs: { area: { classPropertyName: "area", publicName: "area", isSignal: true, isRequired: false, transformFunction: null }, pageTitle: { classPropertyName: "pageTitle", publicName: "pageTitle", isSignal: true, isRequired: false, transformFunction: null }, menuIcon: { classPropertyName: "menuIcon", publicName: "menuIcon", isSignal: true, isRequired: false, transformFunction: null }, lookups: { classPropertyName: "lookups", publicName: "lookups", isSignal: true, isRequired: false, transformFunction: null }, showSidebar: { classPropertyName: "showSidebar", publicName: "showSidebar", isSignal: true, isRequired: false, transformFunction: null }, bootstrapInputs: { classPropertyName: "bootstrapInputs", publicName: "bootstrapInputs", isSignal: true, isRequired: false, transformFunction: null }, openItemDrawer: { classPropertyName: "openItemDrawer", publicName: "openItemDrawer", isSignal: true, isRequired: false, transformFunction: null }, openItemsInModal: { classPropertyName: "openItemsInModal", publicName: "openItemsInModal", isSignal: true, isRequired: false, transformFunction: null }, itemModal: { classPropertyName: "itemModal", publicName: "itemModal", isSignal: true, isRequired: false, transformFunction: null }, generalTaskModal: { classPropertyName: "generalTaskModal", publicName: "generalTaskModal", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { runtimeFiltersChanged: "runtimeFiltersChanged", itemClicked: "itemClicked", cardSelected: "cardSelected" }, ngImport: i0, template: "<ng-template #headerActions>\n <div class=\"flex flex-wrap items-center justify-end gap-2\">\n <mt-property-filter-builder\n [schema]=\"propertyFilterSchema()\"\n [filters]=\"headerFilters()\"\n (applied)=\"onRuntimeFiltersApplied($event)\"\n (cleared)=\"onRuntimeFiltersCleared()\"\n />\n\n @if (showGeneralTaskCreateButton()) {\n <mt-button\n [label]=\"generalTaskButtonLabel()\"\n [icon]=\"generalTaskButtonIcon()\"\n size=\"small\"\n (onClick)=\"onGeneralTaskCreateClick()\"\n />\n }\n </div>\n</ng-template>\n\n<ng-template #pageContent>\n <div class=\"flex flex-col gap-8\">\n @if (loading()) {\n <div\n class=\"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 xl:grid-cols-5 gap-3\"\n >\n @for (_ of [1, 2, 3, 4, 5]; track $index) {\n <p-skeleton height=\"6.5rem\" class=\"rounded-lg\" />\n }\n </div>\n } @else if (kpis().length) {\n <div class=\"gap-3 flex flex-wrap\">\n @for (kpi of kpis(); track $index) {\n <mt-statistic-card [data]=\"kpi\" class=\"min-w-[200px]\" />\n }\n </div>\n }\n\n <mt-table\n noCard\n [data]=\"rows()\"\n [columns]=\"tableColumns()\"\n tableLayout=\"auto\"\n [clickableRows]=\"rowsClickable()\"\n [loading]=\"loading()\"\n [showFilters]=\"true\"\n filterMode=\"column\"\n [cellClickFilter]=\"true\"\n [generalSearch]=\"true\"\n [exportable]=\"true\"\n [printable]=\"true\"\n [groupable]=\"true\"\n [freezeActions]=\"true\"\n [lazy]=\"true\"\n [lazyLocalSearch]=\"true\"\n [lazyTotalRecords]=\"totalCount()\"\n [pageSize]=\"context().pageSize\"\n [currentPage]=\"context().page - 1\"\n [first]=\"(context().page - 1) * context().pageSize\"\n [rowsPerPageOptions]=\"[10, 20, 50, 100]\"\n [groupCountMap]=\"statusGroupCountMap()\"\n storageKey=\"work-center-page-table\"\n [filters]=\"tableFilters()\"\n (filtersChange)=\"tableFilters.set($event)\"\n (lazyLoad)=\"onTableLazyLoad($event)\"\n (rowClick)=\"onRowClick($event)\"\n />\n </div>\n</ng-template>\n\n@if (showSidebar()) {\n <mt-client-page\n [menuIcon]=\"menuIcon()\"\n [menuTitle]=\"resolvedPageTitle()\"\n [menuItems]=\"menuItems()\"\n [menuItemsLoading]=\"loading() && !menuItems().length\"\n [activeItem]=\"context().selectedCardKey ?? undefined\"\n storageKey=\"work-center-client-page\"\n (menuItemClick)=\"onMenuItemClick($event)\"\n >\n <ng-template #headerClientPageEnd>\n <ng-container [ngTemplateOutlet]=\"headerActions\" />\n </ng-template>\n\n <ng-container [ngTemplateOutlet]=\"pageContent\" />\n </mt-client-page>\n} @else {\n <div class=\"flex h-full min-h-0 flex-col bg-surface-0\">\n <div\n class=\"flex shrink-0 items-center justify-end border-b border-surface px-7 py-4\"\n >\n <ng-container [ngTemplateOutlet]=\"headerActions\" />\n </div>\n <div class=\"min-h-0 flex-1 overflow-y-auto px-7 py-5\">\n <ng-container [ngTemplateOutlet]=\"pageContent\" />\n </div>\n </div>\n}\n\n@if (selectedItemContextKey(); as contextKey) {\n <mt-work-center-item-modal-route\n [contextKey]=\"contextKey\"\n [manageRouteOutlet]=\"false\"\n [showPreviewLevelAction]=\"false\"\n (closed)=\"selectedItemContextKey.set(null)\"\n />\n}\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: ClientPage, selector: "mt-client-page", inputs: ["menuIcon", "menuTitle", "menuItems", "menuItemsLoading", "activeItem", "collapsed", "resizable", "storageKey", "storageMode", "minSidebarWidth", "maxSidebarWidth", "defaultSidebarWidth"], outputs: ["collapsedChange", "menuItemClick", "loadChildren"] }, { kind: "component", type: PropertyFilterBuilder, selector: "mt-property-filter-builder", inputs: ["schema", "filters", "title", "buttonLabel", "disabled"], outputs: ["filtersChange", "applied", "cleared"] }, { kind: "component", type: StatisticCard, selector: "mt-statistic-card", inputs: ["data", "cardClass"] }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange"] }, { kind: "component", type: WorkCenterItemModalRoute, selector: "mt-work-center-item-modal-route", inputs: ["contextKey", "manageRouteOutlet", "showPreviewLevelAction"], outputs: ["previewLevel", "closed"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }] });
2905
+ }
2906
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: WorkCenterPage, decorators: [{
2907
+ type: Component,
2908
+ args: [{ selector: 'mt-work-center-page', standalone: true, imports: [
2909
+ CommonModule,
2910
+ Button,
2911
+ ClientPage,
2912
+ PropertyFilterBuilder,
2913
+ StatisticCard,
2914
+ Table,
2915
+ WorkCenterItemModalRoute,
2916
+ SkeletonModule,
2917
+ ], template: "<ng-template #headerActions>\n <div class=\"flex flex-wrap items-center justify-end gap-2\">\n <mt-property-filter-builder\n [schema]=\"propertyFilterSchema()\"\n [filters]=\"headerFilters()\"\n (applied)=\"onRuntimeFiltersApplied($event)\"\n (cleared)=\"onRuntimeFiltersCleared()\"\n />\n\n @if (showGeneralTaskCreateButton()) {\n <mt-button\n [label]=\"generalTaskButtonLabel()\"\n [icon]=\"generalTaskButtonIcon()\"\n size=\"small\"\n (onClick)=\"onGeneralTaskCreateClick()\"\n />\n }\n </div>\n</ng-template>\n\n<ng-template #pageContent>\n <div class=\"flex flex-col gap-8\">\n @if (loading()) {\n <div\n class=\"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 xl:grid-cols-5 gap-3\"\n >\n @for (_ of [1, 2, 3, 4, 5]; track $index) {\n <p-skeleton height=\"6.5rem\" class=\"rounded-lg\" />\n }\n </div>\n } @else if (kpis().length) {\n <div class=\"gap-3 flex flex-wrap\">\n @for (kpi of kpis(); track $index) {\n <mt-statistic-card [data]=\"kpi\" class=\"min-w-[200px]\" />\n }\n </div>\n }\n\n <mt-table\n noCard\n [data]=\"rows()\"\n [columns]=\"tableColumns()\"\n tableLayout=\"auto\"\n [clickableRows]=\"rowsClickable()\"\n [loading]=\"loading()\"\n [showFilters]=\"true\"\n filterMode=\"column\"\n [cellClickFilter]=\"true\"\n [generalSearch]=\"true\"\n [exportable]=\"true\"\n [printable]=\"true\"\n [groupable]=\"true\"\n [freezeActions]=\"true\"\n [lazy]=\"true\"\n [lazyLocalSearch]=\"true\"\n [lazyTotalRecords]=\"totalCount()\"\n [pageSize]=\"context().pageSize\"\n [currentPage]=\"context().page - 1\"\n [first]=\"(context().page - 1) * context().pageSize\"\n [rowsPerPageOptions]=\"[10, 20, 50, 100]\"\n [groupCountMap]=\"statusGroupCountMap()\"\n storageKey=\"work-center-page-table\"\n [filters]=\"tableFilters()\"\n (filtersChange)=\"tableFilters.set($event)\"\n (lazyLoad)=\"onTableLazyLoad($event)\"\n (rowClick)=\"onRowClick($event)\"\n />\n </div>\n</ng-template>\n\n@if (showSidebar()) {\n <mt-client-page\n [menuIcon]=\"menuIcon()\"\n [menuTitle]=\"resolvedPageTitle()\"\n [menuItems]=\"menuItems()\"\n [menuItemsLoading]=\"loading() && !menuItems().length\"\n [activeItem]=\"context().selectedCardKey ?? undefined\"\n storageKey=\"work-center-client-page\"\n (menuItemClick)=\"onMenuItemClick($event)\"\n >\n <ng-template #headerClientPageEnd>\n <ng-container [ngTemplateOutlet]=\"headerActions\" />\n </ng-template>\n\n <ng-container [ngTemplateOutlet]=\"pageContent\" />\n </mt-client-page>\n} @else {\n <div class=\"flex h-full min-h-0 flex-col bg-surface-0\">\n <div\n class=\"flex shrink-0 items-center justify-end border-b border-surface px-7 py-4\"\n >\n <ng-container [ngTemplateOutlet]=\"headerActions\" />\n </div>\n <div class=\"min-h-0 flex-1 overflow-y-auto px-7 py-5\">\n <ng-container [ngTemplateOutlet]=\"pageContent\" />\n </div>\n </div>\n}\n\n@if (selectedItemContextKey(); as contextKey) {\n <mt-work-center-item-modal-route\n [contextKey]=\"contextKey\"\n [manageRouteOutlet]=\"false\"\n [showPreviewLevelAction]=\"false\"\n (closed)=\"selectedItemContextKey.set(null)\"\n />\n}\n" }]
2918
+ }], ctorParameters: () => [], propDecorators: { area: [{ type: i0.Input, args: [{ isSignal: true, alias: "area", required: false }] }], pageTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageTitle", required: false }] }], menuIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "menuIcon", required: false }] }], lookups: [{ type: i0.Input, args: [{ isSignal: true, alias: "lookups", required: false }] }], showSidebar: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSidebar", required: false }] }], bootstrapInputs: [{ type: i0.Input, args: [{ isSignal: true, alias: "bootstrapInputs", required: false }] }], openItemDrawer: [{ type: i0.Input, args: [{ isSignal: true, alias: "openItemDrawer", required: false }] }], openItemsInModal: [{ type: i0.Input, args: [{ isSignal: true, alias: "openItemsInModal", required: false }] }], itemModal: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemModal", required: false }] }], generalTaskModal: [{ type: i0.Input, args: [{ isSignal: true, alias: "generalTaskModal", required: false }] }], runtimeFiltersChanged: [{ type: i0.Output, args: ["runtimeFiltersChanged"] }], itemClicked: [{ type: i0.Output, args: ["itemClicked"] }], cardSelected: [{ type: i0.Output, args: ["cardSelected"] }] } });
2919
+
2888
2920
  const APP_STATES = [WorkCenterState];
2889
2921
 
2890
2922
  /**