@bizdoc/core 3.9.2 → 3.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/bizdoc-core.mjs +166 -146
- package/fesm2022/bizdoc-core.mjs.map +1 -1
- package/index.d.ts +7 -1
- package/package.json +1 -1
package/fesm2022/bizdoc-core.mjs
CHANGED
@@ -499,6 +499,10 @@ const MATERIAL_PALETTES = {
|
|
499
499
|
};
|
500
500
|
|
501
501
|
const IMAGE_TYPE = ['image/png', 'image/jpeg', 'image/jpg', 'image/gif'];
|
502
|
+
const START_CAP = /^[A-Z][^A-Z]/;
|
503
|
+
function decapitalize(str) {
|
504
|
+
return str.replace(START_CAP, e => e.toLowerCase());
|
505
|
+
}
|
502
506
|
function anyKeys(obj) {
|
503
507
|
return obj && Object.keys(obj).find(k => obj[k] != null && obj[k] !== undefined) !== undefined;
|
504
508
|
}
|
@@ -9144,21 +9148,21 @@ class ExpandedItemComponent {
|
|
9144
9148
|
return name;
|
9145
9149
|
switch (gender) {
|
9146
9150
|
case 'adjective':
|
9147
|
-
return (action.adjective || action.past || action.title)
|
9151
|
+
return decapitalize(action.adjective || action.past || action.title);
|
9148
9152
|
case 'you':
|
9149
9153
|
const gender = this._session.gender;
|
9150
|
-
return ((gender === 'Male' ? (action.youMale || action.you) :
|
9154
|
+
return decapitalize((gender === 'Male' ? (action.youMale || action.you) :
|
9151
9155
|
gender === 'Female' ? (action.youFemale || action.you) :
|
9152
9156
|
action.you) || action.past ||
|
9153
|
-
action.title)
|
9157
|
+
action.title);
|
9154
9158
|
case 'Male':
|
9155
|
-
return (action.pastMale || action.past ||
|
9156
|
-
action.title)
|
9159
|
+
return decapitalize(action.pastMale || action.past ||
|
9160
|
+
action.title);
|
9157
9161
|
case 'Female':
|
9158
|
-
return (action.pastFemale || action.past ||
|
9159
|
-
action.title)
|
9162
|
+
return decapitalize(action.pastFemale || action.past ||
|
9163
|
+
action.title);
|
9160
9164
|
default:
|
9161
|
-
return (action.past || action.title)
|
9165
|
+
return decapitalize(action.past || action.title);
|
9162
9166
|
}
|
9163
9167
|
}
|
9164
9168
|
_fromNow(date) {
|
@@ -9731,7 +9735,7 @@ class BrowseItemsComponent {
|
|
9731
9735
|
}
|
9732
9736
|
_getActionAdjective(name, plural) {
|
9733
9737
|
const action = this._session.profile.actions.find(a => a.name === name);
|
9734
|
-
return ((plural ? (action.adjectivePlural || action.adjective) : action.adjective) || action.title)
|
9738
|
+
return decapitalize((plural ? (action.adjectivePlural || action.adjective) : action.adjective) || action.title);
|
9735
9739
|
}
|
9736
9740
|
ngOnDestroy() {
|
9737
9741
|
this._destroy.next();
|
@@ -10047,7 +10051,7 @@ class ComposeFormComponent {
|
|
10047
10051
|
}
|
10048
10052
|
_getActionAdjective(name) {
|
10049
10053
|
const action = this._session.profile.actions.find(a => a.name === name);
|
10050
|
-
return (action.adjective || action.past || action.title)
|
10054
|
+
return decapitalize(action.adjective || action.past || action.title);
|
10051
10055
|
}
|
10052
10056
|
/**
|
10053
10057
|
*
|
@@ -15744,24 +15748,24 @@ class FlowViewComponent extends TraceBase {
|
|
15744
15748
|
if (recipients.length) {
|
15745
15749
|
let r = 0;
|
15746
15750
|
do {
|
15747
|
-
|
15751
|
+
let { userId, estimate } = recipients[r];
|
15748
15752
|
let exists = false;
|
15749
15753
|
// remove duplicate user recipient on same node
|
15750
15754
|
let j = 0;
|
15751
15755
|
while (j < r && !exists) {
|
15752
|
-
if (recipients[j].userId ===
|
15756
|
+
if (recipients[j].userId === userId)
|
15753
15757
|
exists = true;
|
15754
15758
|
else
|
15755
15759
|
j++;
|
15756
15760
|
}
|
15757
15761
|
if (exists)
|
15758
|
-
recipients.splice(
|
15762
|
+
recipients.splice(estimate ? r : j, 1);
|
15759
15763
|
else
|
15760
15764
|
r++;
|
15761
15765
|
} while (r < recipients.length);
|
15762
15766
|
for (r = 0; r < recipients.length; r++) {
|
15763
|
-
let recipient = recipients[r];
|
15764
|
-
|
15767
|
+
let recipient = recipients[r], { userId, actionId, escalated, fyi, pending } = recipient;
|
15768
|
+
let { annotation, tooltip } = await this._note(node, recipient), content = this._tooltip(tooltip), id = r === 0 ? node.id : node.id + r.toString();
|
15765
15769
|
nodes.push({
|
15766
15770
|
id,
|
15767
15771
|
width: 50,
|
@@ -15770,8 +15774,8 @@ class FlowViewComponent extends TraceBase {
|
|
15770
15774
|
strokeWidth: 2,
|
15771
15775
|
//opacity: node.estimate ? .6 : 1,
|
15772
15776
|
strokeColor: node.estimate ? this.dimColor : this._accentColor,
|
15773
|
-
fill: !node.estimate &&
|
15774
|
-
this._session.getAccent(
|
15777
|
+
fill: !node.estimate && pending ?
|
15778
|
+
this._session.getAccent(userId === this._session.userId ? 500 : 400) : this.transparentColor
|
15775
15779
|
},
|
15776
15780
|
shape: this._configuration[node.type].shape,
|
15777
15781
|
zIndex: zIndex++,
|
@@ -15803,9 +15807,9 @@ class FlowViewComponent extends TraceBase {
|
|
15803
15807
|
}]
|
15804
15808
|
});
|
15805
15809
|
// add action indicator
|
15806
|
-
if (
|
15807
|
-
const action = this._session.profile.actions.find(a => a.name ===
|
15808
|
-
action.shape && !
|
15810
|
+
if (actionId) {
|
15811
|
+
const action = this._session.profile.actions.find(a => a.name === actionId);
|
15812
|
+
action.shape && !pending &&
|
15809
15813
|
indicators.push({
|
15810
15814
|
id: id + 'action',
|
15811
15815
|
width: 15,
|
@@ -15827,7 +15831,7 @@ class FlowViewComponent extends TraceBase {
|
|
15827
15831
|
});
|
15828
15832
|
}
|
15829
15833
|
// fyi indicator
|
15830
|
-
|
15834
|
+
fyi &&
|
15831
15835
|
indicators.push({
|
15832
15836
|
id: id + 'fyi',
|
15833
15837
|
width: 15,
|
@@ -15848,7 +15852,7 @@ class FlowViewComponent extends TraceBase {
|
|
15848
15852
|
}
|
15849
15853
|
});
|
15850
15854
|
// escalate indicator
|
15851
|
-
|
15855
|
+
escalated &&
|
15852
15856
|
indicators.push({
|
15853
15857
|
id: id + 'escalate',
|
15854
15858
|
width: 15,
|
@@ -16124,66 +16128,67 @@ class FlowViewComponent extends TraceBase {
|
|
16124
16128
|
async _note(node, recipient) {
|
16125
16129
|
const tooltip = {};
|
16126
16130
|
let annotation;
|
16131
|
+
const { userId, id, pending, fyi, roleId, escalated, originId, replied, repliedBy, actionId, estimate, substituteId, received } = recipient;
|
16127
16132
|
// you
|
16128
|
-
if (
|
16133
|
+
if (userId === this._session.userId) {
|
16129
16134
|
if (this._session.isImpersonating)
|
16130
16135
|
annotation = this._session.profile.name;
|
16131
16136
|
else
|
16132
16137
|
annotation = this._translate.get('You');
|
16133
|
-
if (
|
16134
|
-
const
|
16135
|
-
tooltip.role = `- ${
|
16138
|
+
if (roleId) {
|
16139
|
+
const roleName = this._roleName(roleId);
|
16140
|
+
tooltip.role = `- ${roleName}`;
|
16136
16141
|
}
|
16137
16142
|
}
|
16138
16143
|
else
|
16139
16144
|
// someone else
|
16140
16145
|
{
|
16141
|
-
const who = await firstValueFrom(this._accounts.get(
|
16146
|
+
const who = await firstValueFrom(this._accounts.get(userId));
|
16142
16147
|
annotation = who.name;
|
16143
16148
|
if (who.role)
|
16144
16149
|
tooltip.role = `- ${who.role}`;
|
16145
|
-
else if (
|
16146
|
-
const
|
16147
|
-
tooltip.role = `- ${
|
16150
|
+
else if (roleId) {
|
16151
|
+
const roleName = this._roleName(roleId);
|
16152
|
+
tooltip.role = `- ${roleName}`;
|
16148
16153
|
}
|
16149
16154
|
}
|
16150
|
-
if (
|
16151
|
-
const ago = dayjs(
|
16152
|
-
const targets = this.model.recipients.filter(r => r.originId ===
|
16155
|
+
if (replied) {
|
16156
|
+
const ago = dayjs(replied).fromNow();
|
16157
|
+
const targets = this.model.recipients.filter(r => r.originId === id), to = [];
|
16153
16158
|
if (targets.length)
|
16154
16159
|
for (let sibling of targets) {
|
16155
16160
|
const who = await firstValueFrom(this._accounts.get(sibling.userId));
|
16156
16161
|
to.push(who.name);
|
16157
16162
|
}
|
16158
|
-
if (
|
16159
|
-
if (
|
16160
|
-
const action = this._action(
|
16163
|
+
if (repliedBy) {
|
16164
|
+
if (repliedBy === this._session.profile.byId) {
|
16165
|
+
const action = this._action(actionId, this._session.profile.byGender);
|
16161
16166
|
if (to.length) {
|
16162
|
-
if (
|
16167
|
+
if (userId === this._session.profile.userId)
|
16163
16168
|
tooltip.note = this._translate.get('ActionTakenByYouTo', action, this._translate.join(to), this._session.profile.name, ago);
|
16164
16169
|
else {
|
16165
|
-
const who = await firstValueFrom(this._accounts.get(
|
16170
|
+
const who = await firstValueFrom(this._accounts.get(userId));
|
16166
16171
|
tooltip.note = this._translate.get('ActionTakenByYouTo', action, this._translate.join(to), who.name, ago);
|
16167
16172
|
}
|
16168
16173
|
}
|
16169
|
-
else if (
|
16174
|
+
else if (userId === this._session.profile.userId)
|
16170
16175
|
tooltip.note = this._translate.get('ActionTakenByYou', action, this._session.profile.name, ago);
|
16171
16176
|
else {
|
16172
|
-
const who = await firstValueFrom(this._accounts.get(
|
16177
|
+
const who = await firstValueFrom(this._accounts.get(userId));
|
16173
16178
|
tooltip.note = this._translate.get('ActionTakenByYou', action, who.name, ago);
|
16174
16179
|
}
|
16175
16180
|
}
|
16176
16181
|
else {
|
16177
|
-
const by = await firstValueFrom(this._accounts.get(
|
16178
|
-
const action = this._action(
|
16179
|
-
if (
|
16182
|
+
const by = await firstValueFrom(this._accounts.get(repliedBy));
|
16183
|
+
const action = this._action(actionId, by.gender);
|
16184
|
+
if (userId === this._session.profile.userId) {
|
16180
16185
|
if (to.length)
|
16181
16186
|
tooltip.note = this._translate.get('YouTakenActionByTo', by.name, action, this._translate.join(to), ago);
|
16182
16187
|
else
|
16183
16188
|
tooltip.note = this._translate.get('YouTakenActionBy', by.name, action, ago);
|
16184
16189
|
}
|
16185
16190
|
else {
|
16186
|
-
const who = await firstValueFrom(this._accounts.get(
|
16191
|
+
const who = await firstValueFrom(this._accounts.get(userId));
|
16187
16192
|
if (to.length)
|
16188
16193
|
tooltip.note = this._translate.get('ActionTakenByTo', by.name, action, this._translate.join(to), who.name, ago);
|
16189
16194
|
else
|
@@ -16192,80 +16197,80 @@ class FlowViewComponent extends TraceBase {
|
|
16192
16197
|
}
|
16193
16198
|
}
|
16194
16199
|
else if (to.length) {
|
16195
|
-
if (
|
16196
|
-
const action = this._action(
|
16200
|
+
if (userId === this._session.profile.userId) {
|
16201
|
+
const action = this._action(actionId, this._session.profile.gender);
|
16197
16202
|
if (this._session.isImpersonating)
|
16198
16203
|
tooltip.note = this._translate.get('ActionTakenTo', this._session.profile.name, action, this._translate.join(to), ago);
|
16199
16204
|
else
|
16200
16205
|
tooltip.note = this._translate.get('YouTakenActionTo', action, this._translate.join(to), ago);
|
16201
16206
|
}
|
16202
16207
|
else {
|
16203
|
-
const who = await firstValueFrom(this._accounts.get(
|
16204
|
-
const action = this._action(
|
16208
|
+
const who = await firstValueFrom(this._accounts.get(userId));
|
16209
|
+
const action = this._action(actionId, who.gender);
|
16205
16210
|
tooltip.note = this._translate.get('ActionTakenTo', who.name, action, this._translate.join(to), ago);
|
16206
16211
|
}
|
16207
16212
|
}
|
16208
16213
|
else if (this._session.isImpersonating) {
|
16209
|
-
const action = this._action(
|
16214
|
+
const action = this._action(actionId, this._session.profile.gender);
|
16210
16215
|
tooltip.note = this._translate.get('ActionTaken', this._session.profile.name, action, ago);
|
16211
16216
|
}
|
16212
|
-
else if (
|
16213
|
-
const action = this._action(
|
16217
|
+
else if (userId === this._session.profile.userId) {
|
16218
|
+
const action = this._action(actionId, You);
|
16214
16219
|
tooltip.note = this._translate.get('YouTakenAction', action, ago);
|
16215
16220
|
}
|
16216
16221
|
else {
|
16217
|
-
const who = await firstValueFrom(this._accounts.get(
|
16218
|
-
const action = this._action(
|
16222
|
+
const who = await firstValueFrom(this._accounts.get(userId));
|
16223
|
+
const action = this._action(actionId, who.gender);
|
16219
16224
|
tooltip.note = this._translate.get('ActionTaken', who.name, action, ago);
|
16220
16225
|
}
|
16221
16226
|
}
|
16222
|
-
else if (!
|
16223
|
-
const ago = dayjs(
|
16224
|
-
if (
|
16227
|
+
else if (!estimate) {
|
16228
|
+
const ago = dayjs(received).fromNow();
|
16229
|
+
if (userId === this._session.userId) {
|
16225
16230
|
if (this._session.isImpersonating)
|
16226
16231
|
tooltip.note = this._translate.personalize('ReceivedBy', this._session.profile.gender, this._session.profile.name, ago);
|
16227
16232
|
else
|
16228
16233
|
tooltip.note = this._translate.get('YouReceived', ago);
|
16229
16234
|
}
|
16230
16235
|
else {
|
16231
|
-
const who = await firstValueFrom(this._accounts.get(
|
16236
|
+
const who = await firstValueFrom(this._accounts.get(userId));
|
16232
16237
|
tooltip.note = this._translate.personalize('ReceivedTime', who.gender, ago);
|
16233
16238
|
}
|
16234
16239
|
}
|
16235
|
-
if (
|
16236
|
-
if (
|
16240
|
+
if (substituteId) {
|
16241
|
+
if (substituteId === this._session.userId)
|
16237
16242
|
tooltip.substituting = this._translate.personalize('SubstitutingYou', this._session.gender);
|
16238
16243
|
else {
|
16239
|
-
const substituting = await firstValueFrom(this._accounts.get(
|
16244
|
+
const substituting = await firstValueFrom(this._accounts.get(substituteId));
|
16240
16245
|
tooltip.substituting = this._translate.personalize('SubstitutingFor', substituting.gender, substituting.name);
|
16241
16246
|
}
|
16242
16247
|
}
|
16243
|
-
if (
|
16244
|
-
const origin = this.model.recipients.find(r => r.id ===
|
16248
|
+
if (originId && !replied) {
|
16249
|
+
const origin = this.model.recipients.find(r => r.id === originId), action = this._action(origin.actionId, 'adjective');
|
16245
16250
|
if ((origin.repliedBy || origin.userId) === this._session.userId)
|
16246
|
-
tooltip.substituting = this._translate.get('ActionByYou',
|
16251
|
+
tooltip.substituting = this._translate.get('ActionByYou', action);
|
16247
16252
|
else if (origin.repliedBy) {
|
16248
16253
|
const who = await firstValueFrom(this._accounts.get(origin.userId));
|
16249
16254
|
const by = await firstValueFrom(this._accounts.get(origin.repliedBy));
|
16250
|
-
tooltip.substituting = this._translate.get('ActionByBy',
|
16255
|
+
tooltip.substituting = this._translate.get('ActionByBy', action, by.name, who.name);
|
16251
16256
|
}
|
16252
16257
|
else {
|
16253
16258
|
const who = await firstValueFrom(this._accounts.get(origin.userId));
|
16254
|
-
tooltip.substituting = this._translate.get('ActionBy',
|
16259
|
+
tooltip.substituting = this._translate.get('ActionBy', action, who.name);
|
16255
16260
|
}
|
16256
16261
|
}
|
16257
|
-
if (
|
16258
|
-
const escalation = this.model.log.find(l => l.type === 'Escalation' && l.recipientId ===
|
16262
|
+
if (escalated) {
|
16263
|
+
const escalation = this.model.log.find(l => l.type === 'Escalation' && l.recipientId === originId);
|
16259
16264
|
const who = await firstValueFrom(this._accounts.get(escalation.userId));
|
16260
16265
|
const duration = this._duration.transform(dayjs.duration(escalation.duration, 's'));
|
16261
16266
|
tooltip.escalation = this._translate.get('EscalatedFrom', who.name, duration);
|
16262
16267
|
}
|
16263
|
-
if (
|
16264
|
-
const duration = dayjs(
|
16268
|
+
if (replied) {
|
16269
|
+
const duration = dayjs(replied).diff(received, 's');
|
16265
16270
|
tooltip.duration = this._translate.get('DurationTime', this._duration.transform(duration));
|
16266
16271
|
}
|
16267
|
-
else if (
|
16268
|
-
if (
|
16272
|
+
else if (pending) {
|
16273
|
+
if (estimate)
|
16269
16274
|
tooltip.estimatedTime = this._timeEstimate(node);
|
16270
16275
|
else if (node.standardTime) {
|
16271
16276
|
const diff = node.standardTime - dayjs().diff(node.time, 's');
|
@@ -16275,21 +16280,35 @@ class FlowViewComponent extends TraceBase {
|
|
16275
16280
|
}
|
16276
16281
|
else if (node.standardTime)
|
16277
16282
|
tooltip.standardTime = this._translate.get('NodeStandardTime', this._duration.transform(node.standardTime));
|
16278
|
-
if (
|
16283
|
+
if (fyi)
|
16279
16284
|
tooltip.fyi = this._translate.get('FYI');
|
16280
16285
|
return { annotation, tooltip };
|
16281
16286
|
}
|
16287
|
+
/**
|
16288
|
+
*
|
16289
|
+
* @param name
|
16290
|
+
* @param gender
|
16291
|
+
* @returns
|
16292
|
+
*/
|
16282
16293
|
_action(name, gender) {
|
16283
16294
|
const action = this._session.profile.actions.find(a => a.name === name);
|
16284
|
-
if (
|
16285
|
-
|
16286
|
-
|
16287
|
-
|
16288
|
-
|
16295
|
+
if (!action)
|
16296
|
+
return name;
|
16297
|
+
switch (gender) {
|
16298
|
+
case 'adjective':
|
16299
|
+
return decapitalize(action.adjective || action.past || action.title);
|
16300
|
+
case You:
|
16301
|
+
const gender = this._session.gender, you = gender === 'Male' ? action.youMale :
|
16302
|
+
gender === 'Female' ? action.youFemale :
|
16303
|
+
null;
|
16304
|
+
return decapitalize(you || action.you || action.past || action.title);
|
16305
|
+
case 'Male':
|
16306
|
+
return decapitalize(action.pastMale || action.past || action.title);
|
16307
|
+
case 'Female':
|
16308
|
+
return decapitalize(action.pastFemale || action.past || action.title);
|
16309
|
+
default:
|
16310
|
+
return decapitalize(action.past || action.title);
|
16289
16311
|
}
|
16290
|
-
const past = gender === 'Male' ? action?.pastMale :
|
16291
|
-
gender === 'Female' ? action?.pastFemale : null;
|
16292
|
-
return (past || action?.past || action?.title || name).toLowerCase();
|
16293
16312
|
}
|
16294
16313
|
ngOnDestroy() {
|
16295
16314
|
this.diagram?.destroy();
|
@@ -16457,90 +16476,90 @@ class TraceViewComponent extends TraceBase {
|
|
16457
16476
|
};
|
16458
16477
|
trace.push(step);
|
16459
16478
|
if (l.recipientId) {
|
16460
|
-
let recipient = recipients.find(r => r.id === l.recipientId);
|
16461
|
-
if (
|
16462
|
-
step.role = this._roleName(
|
16463
|
-
step.fyi =
|
16464
|
-
if (
|
16465
|
-
if (
|
16466
|
-
if (
|
16467
|
-
let who = await profileOf(
|
16468
|
-
if (
|
16479
|
+
let recipient = recipients.find(r => r.id === l.recipientId), { roleId, fyi, id, repliedBy, substituteId, userId } = recipient;
|
16480
|
+
if (roleId)
|
16481
|
+
step.role = this._roleName(roleId);
|
16482
|
+
step.fyi = fyi;
|
16483
|
+
if (substituteId) {
|
16484
|
+
if (repliedBy) {
|
16485
|
+
if (repliedBy === this._session.userId) {
|
16486
|
+
let who = await profileOf(userId);
|
16487
|
+
if (substituteId === this._session.userId)
|
16469
16488
|
step.name = this._translate.get('ByYou', nameOf(who));
|
16470
16489
|
else {
|
16471
|
-
let substituting = await profileOf(
|
16490
|
+
let substituting = await profileOf(substituteId);
|
16472
16491
|
step.name = this._translate.personalize('SubstitutingByYou', who.gender, nameOf(who), nameOf(substituting));
|
16473
16492
|
}
|
16474
16493
|
if (action)
|
16475
|
-
step.action = await actionBy(action, You,
|
16494
|
+
step.action = await actionBy(action, You, id);
|
16476
16495
|
}
|
16477
16496
|
else {
|
16478
|
-
let by = await profileOf(
|
16497
|
+
let by = await profileOf(repliedBy), who = await profileOf(userId), substituting = await profileOf(substituteId);
|
16479
16498
|
step.name = this._translate.get('SubstitutingBy', nameOf(who), nameOf(substituting), nameOf(by));
|
16480
16499
|
if (by.role)
|
16481
16500
|
step.role = by.role;
|
16482
16501
|
if (action)
|
16483
|
-
step.action = await actionBy(action, by.gender,
|
16502
|
+
step.action = await actionBy(action, by.gender, id);
|
16484
16503
|
}
|
16485
16504
|
}
|
16486
|
-
else if (
|
16487
|
-
let substituting = await profileOf(
|
16505
|
+
else if (userId === this._session.userId) {
|
16506
|
+
let substituting = await profileOf(substituteId);
|
16488
16507
|
step.name = this._translate.personalize('YouSubstituting', this._session.gender, nameOf(substituting));
|
16489
16508
|
if (action)
|
16490
|
-
step.action = await actionBy(action, this._session.gender,
|
16509
|
+
step.action = await actionBy(action, this._session.gender, id);
|
16491
16510
|
}
|
16492
|
-
else if (
|
16493
|
-
let who = await profileOf(
|
16511
|
+
else if (substituteId === this._session.userId) {
|
16512
|
+
let who = await profileOf(userId);
|
16494
16513
|
step.name = this._translate.personalize('SubstitutingForYou', who.gender, nameOf(who));
|
16495
16514
|
if (action)
|
16496
|
-
step.action = await actionBy(action, who.gender,
|
16515
|
+
step.action = await actionBy(action, who.gender, id);
|
16497
16516
|
}
|
16498
16517
|
else {
|
16499
|
-
let who = await profileOf(
|
16518
|
+
let who = await profileOf(userId), substituting = await profileOf(substituteId);
|
16500
16519
|
step.name = this._translate.personalize('Substituting', who.gender, nameOf(who), nameOf(substituting));
|
16501
16520
|
if (who.role)
|
16502
16521
|
step.role = who.role;
|
16503
16522
|
if (action)
|
16504
|
-
step.action = await actionBy(action, who.gender,
|
16523
|
+
step.action = await actionBy(action, who.gender, id);
|
16505
16524
|
}
|
16506
16525
|
}
|
16507
|
-
else if (
|
16508
|
-
if (
|
16509
|
-
let by = await profileOf(
|
16526
|
+
else if (repliedBy) {
|
16527
|
+
if (userId === this._session.userId) {
|
16528
|
+
let by = await profileOf(repliedBy);
|
16510
16529
|
step.name = this._translate.get('YouBy', nameOf(by));
|
16511
16530
|
if (action)
|
16512
|
-
step.action = await actionBy(action, by.gender,
|
16531
|
+
step.action = await actionBy(action, by.gender, id);
|
16513
16532
|
}
|
16514
16533
|
else {
|
16515
|
-
let who = await profileOf(
|
16516
|
-
if (
|
16534
|
+
let who = await profileOf(userId);
|
16535
|
+
if (repliedBy === this._session.userId) {
|
16517
16536
|
step.name = this._translate.get('ByYou', nameOf(who));
|
16518
16537
|
if (action)
|
16519
|
-
step.action = await actionBy(action, You,
|
16538
|
+
step.action = await actionBy(action, You, id);
|
16520
16539
|
}
|
16521
16540
|
else {
|
16522
|
-
let by = await profileOf(
|
16541
|
+
let by = await profileOf(repliedBy);
|
16523
16542
|
step.name = this._translate.get('By', nameOf(who), nameOf(by));
|
16524
16543
|
if (by.role)
|
16525
16544
|
step.role = by.role;
|
16526
16545
|
if (action)
|
16527
|
-
step.action = await actionBy(action, by.gender,
|
16546
|
+
step.action = await actionBy(action, by.gender, id);
|
16528
16547
|
}
|
16529
16548
|
}
|
16530
16549
|
}
|
16531
16550
|
else {
|
16532
|
-
if (
|
16551
|
+
if (userId === this._session.userId) {
|
16533
16552
|
step.name = this._translate.get('You');
|
16534
16553
|
if (action)
|
16535
|
-
step.action = await actionBy(action, You,
|
16554
|
+
step.action = await actionBy(action, You, id);
|
16536
16555
|
}
|
16537
16556
|
else {
|
16538
|
-
let who = await profileOf(
|
16557
|
+
let who = await profileOf(userId);
|
16539
16558
|
step.name = nameOf(who);
|
16540
16559
|
if (who.role)
|
16541
16560
|
step.role = who.role;
|
16542
16561
|
if (action)
|
16543
|
-
step.action = await actionBy(action, who.gender,
|
16562
|
+
step.action = await actionBy(action, who.gender, id);
|
16544
16563
|
}
|
16545
16564
|
}
|
16546
16565
|
}
|
@@ -16572,23 +16591,24 @@ class TraceViewComponent extends TraceBase {
|
|
16572
16591
|
}
|
16573
16592
|
}
|
16574
16593
|
for (let recipient of recipients) {
|
16575
|
-
|
16594
|
+
const { repliedBy, originId, note, escalated, pending, substituteId, actionId, userId, estimate, fyi, received, roleId, nodeId } = recipient;
|
16595
|
+
if (!pending && !estimate)
|
16576
16596
|
continue;
|
16577
16597
|
let step = {
|
16578
|
-
time:
|
16579
|
-
fyi
|
16580
|
-
estimate
|
16581
|
-
pending
|
16582
|
-
action:
|
16583
|
-
note
|
16584
|
-
type:
|
16585
|
-
duration:
|
16586
|
-
role:
|
16598
|
+
time: received,
|
16599
|
+
fyi,
|
16600
|
+
estimate,
|
16601
|
+
pending,
|
16602
|
+
action: actionId,
|
16603
|
+
note,
|
16604
|
+
type: estimate ? 'Estimate' : 'Pending',
|
16605
|
+
duration: pending ? dayjs().diff(received, 's') : null,
|
16606
|
+
role: roleId ? this._roleName(roleId) : null
|
16587
16607
|
};
|
16588
|
-
if (
|
16589
|
-
const node = this.model.workflow.nodes.find(n => n.id ===
|
16608
|
+
if (nodeId) {
|
16609
|
+
const node = this.model.workflow.nodes.find(n => n.id === nodeId);
|
16590
16610
|
if (node) {
|
16591
|
-
if (
|
16611
|
+
if (estimate) {
|
16592
16612
|
const { min, max } = super._estimateTime(node);
|
16593
16613
|
if (max)
|
16594
16614
|
step.durationMin = min,
|
@@ -16596,36 +16616,36 @@ class TraceViewComponent extends TraceBase {
|
|
16596
16616
|
}
|
16597
16617
|
}
|
16598
16618
|
}
|
16599
|
-
if (
|
16600
|
-
if (
|
16601
|
-
let who = await profileOf(
|
16619
|
+
if (substituteId) {
|
16620
|
+
if (substituteId === this._session.userId) {
|
16621
|
+
let who = await profileOf(userId);
|
16602
16622
|
step.name = this._translate.personalize('SubstitutingForYou', who.gender, nameOf(who));
|
16603
16623
|
}
|
16604
|
-
else if (
|
16605
|
-
let substituting = await profileOf(
|
16624
|
+
else if (userId === this._session.userId) {
|
16625
|
+
let substituting = await profileOf(substituteId);
|
16606
16626
|
step.name = this._translate.personalize('YouSubstituting', this._session.gender, nameOf(substituting));
|
16607
16627
|
}
|
16608
16628
|
else {
|
16609
|
-
let who = await profileOf(
|
16629
|
+
let who = await profileOf(userId), substituting = await profileOf(substituteId);
|
16610
16630
|
step.name = this._translate.personalize('Substituting', who.gender, nameOf(who), nameOf(substituting));
|
16611
16631
|
if (who.role)
|
16612
16632
|
step.role = who.role;
|
16613
16633
|
}
|
16614
16634
|
}
|
16615
|
-
else if (
|
16616
|
-
let who = await profileOf(
|
16617
|
-
if (
|
16635
|
+
else if (repliedBy) {
|
16636
|
+
let who = await profileOf(userId);
|
16637
|
+
if (repliedBy === this._session.userId)
|
16618
16638
|
step.name = this._translate.get('ByYou', nameOf(who));
|
16619
16639
|
else {
|
16620
|
-
let by = await profileOf(
|
16640
|
+
let by = await profileOf(repliedBy);
|
16621
16641
|
step.name = this._translate.get('By', nameOf(who), nameOf(by));
|
16622
16642
|
if (by.role)
|
16623
16643
|
step.role = by.role;
|
16624
16644
|
}
|
16625
16645
|
}
|
16626
|
-
else if (
|
16627
|
-
let escalation = this.model.log.find(l => l.type === 'Escalation' && l.recipientId ===
|
16628
|
-
let to = await profileOf(
|
16646
|
+
else if (escalated) {
|
16647
|
+
let escalation = this.model.log.find(l => l.type === 'Escalation' && l.recipientId === originId);
|
16648
|
+
let to = await profileOf(userId);
|
16629
16649
|
if (escalation.userId === this._session.userId)
|
16630
16650
|
step.name = this._translate.get('EscalatedByYou', nameOf(to));
|
16631
16651
|
else {
|
@@ -16634,10 +16654,10 @@ class TraceViewComponent extends TraceBase {
|
|
16634
16654
|
}
|
16635
16655
|
}
|
16636
16656
|
else {
|
16637
|
-
if (
|
16657
|
+
if (userId === this._session.userId)
|
16638
16658
|
step.name = this._translate.get('You');
|
16639
16659
|
else {
|
16640
|
-
let who = await profileOf(
|
16660
|
+
let who = await profileOf(userId);
|
16641
16661
|
step.name = nameOf(who);
|
16642
16662
|
if (who.role)
|
16643
16663
|
step.role = who.role;
|
@@ -28988,8 +29008,8 @@ let TimelineViewComponent = class TimelineViewComponent {
|
|
28988
29008
|
task.name = this._translate.get('WhoSubstituting', u[0].name, u[1].name);
|
28989
29009
|
if (u[0].role)
|
28990
29010
|
task.name += `, ${u[0].role}`;
|
28991
|
-
if (r.
|
28992
|
-
const role = this._session.profile.roles.find(o => o.name === r.
|
29011
|
+
if (r.roleId) {
|
29012
|
+
const role = this._session.profile.roles.find(o => o.name === r.roleId);
|
28993
29013
|
if (role)
|
28994
29014
|
task.name += `, ${role.name}`;
|
28995
29015
|
}
|
@@ -29001,8 +29021,8 @@ let TimelineViewComponent = class TimelineViewComponent {
|
|
29001
29021
|
task.name = u.name;
|
29002
29022
|
if (u.role)
|
29003
29023
|
task.name += `, ${u.role}`;
|
29004
|
-
else if (r.
|
29005
|
-
const role = this._session.profile.roles.find(o => o.name === r.
|
29024
|
+
else if (r.roleId) {
|
29025
|
+
const role = this._session.profile.roles.find(o => o.name === r.roleId);
|
29006
29026
|
if (role)
|
29007
29027
|
task.name += `, ${role.name}`;
|
29008
29028
|
}
|