@hmcts/ccd-case-ui-toolkit 7.0.52-task-event-completion-info → 7.0.52-task-event-completion-info-2
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/esm2022/lib/shared/components/case-editor/case-edit/case-edit.component.mjs +5 -8
- package/esm2022/lib/shared/components/event-start/event-guard/event-start.guard.mjs +18 -3
- package/esm2022/lib/shared/components/event-start/services/event-start-state-machine.service.mjs +15 -1
- package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs +35 -9
- package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
- package/lib/shared/components/case-editor/case-edit/case-edit.component.d.ts.map +1 -1
- package/lib/shared/components/event-start/event-guard/event-start.guard.d.ts.map +1 -1
- package/lib/shared/components/event-start/services/event-start-state-machine.service.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -9351,7 +9351,8 @@ class CaseEditComponent {
|
|
|
9351
9351
|
eventId,
|
|
9352
9352
|
task: taskInSessionStorage
|
|
9353
9353
|
});
|
|
9354
|
-
// add
|
|
9354
|
+
// add taskEventCompletionInfo again to ensure link current event with task id
|
|
9355
|
+
// note: previous usage was created here so this is to ensure correct functionality continues
|
|
9355
9356
|
const taskEventCompletionInfo = {
|
|
9356
9357
|
caseId,
|
|
9357
9358
|
eventId,
|
|
@@ -9524,9 +9525,9 @@ class CaseEditComponent {
|
|
|
9524
9525
|
return this.postCompleteTaskIfRequired();
|
|
9525
9526
|
}), finalize(() => {
|
|
9526
9527
|
this.loadingService.unregister(loadingSpinnerToken);
|
|
9527
|
-
// on event completion ensure the previous event taskToComplete/
|
|
9528
|
+
// on event completion ensure the previous event taskToComplete/taskEventCompletionInfo removed
|
|
9528
9529
|
this.sessionStorageService.removeItem('taskToComplete');
|
|
9529
|
-
this.sessionStorageService.removeItem('
|
|
9530
|
+
this.sessionStorageService.removeItem('taskEventCompletionInfo');
|
|
9530
9531
|
this.isSubmitting = false;
|
|
9531
9532
|
}))
|
|
9532
9533
|
.subscribe(() => {
|
|
@@ -9601,7 +9602,6 @@ class CaseEditComponent {
|
|
|
9601
9602
|
else if ((taskEventCompletionInfo.taskId === taskInSessionStorage.id &&
|
|
9602
9603
|
this.eventDetailsDoNotMatch(taskEventCompletionInfo, eventDetails))
|
|
9603
9604
|
|| this.eventMoreThanDayAgo(taskEventCompletionInfo.createdTimestamp)) {
|
|
9604
|
-
console.log('howdy there');
|
|
9605
9605
|
// if the session storage not related to event, ignore it and remove
|
|
9606
9606
|
this.sessionStorageService.removeItem('taskToComplete');
|
|
9607
9607
|
this.sessionStorageService.removeItem('taskEventCompletionInfo');
|
|
@@ -9629,9 +9629,7 @@ class CaseEditComponent {
|
|
|
9629
9629
|
}
|
|
9630
9630
|
eventMoreThanDayAgo(timestamp) {
|
|
9631
9631
|
let dayAgoDate = new Date().getTime() - (24 * 60 * 60 * 1000);
|
|
9632
|
-
console.log(dayAgoDate, 'decent', timestamp);
|
|
9633
9632
|
if (dayAgoDate > timestamp) {
|
|
9634
|
-
console.log('jeffrey');
|
|
9635
9633
|
return true;
|
|
9636
9634
|
}
|
|
9637
9635
|
return false;
|
|
@@ -9640,7 +9638,6 @@ class CaseEditComponent {
|
|
|
9640
9638
|
if (taskEventCompletionInfo.eventId !== eventDetails.eventId
|
|
9641
9639
|
|| taskEventCompletionInfo.caseId !== eventDetails.caseId
|
|
9642
9640
|
|| taskEventCompletionInfo.userId !== eventDetails.userId) {
|
|
9643
|
-
console.log(taskEventCompletionInfo, 'yee-haw 2', eventDetails);
|
|
9644
9641
|
return true;
|
|
9645
9642
|
}
|
|
9646
9643
|
return false;
|
|
@@ -33591,12 +33588,18 @@ class EventStartGuard {
|
|
|
33591
33588
|
const caseId = route.params['cid'];
|
|
33592
33589
|
const eventId = route.params['eid'];
|
|
33593
33590
|
const taskId = route.queryParams['tid'];
|
|
33591
|
+
let userId;
|
|
33592
|
+
const userInfoStr = this.sessionStorageService.getItem('userDetails');
|
|
33593
|
+
if (userInfoStr) {
|
|
33594
|
+
const userInfo = JSON.parse(userInfoStr);
|
|
33595
|
+
userId = userInfo?.uid ? userInfo.uid : null;
|
|
33596
|
+
}
|
|
33594
33597
|
const caseInfoStr = this.sessionStorageService.getItem('caseInfo');
|
|
33595
33598
|
if (caseInfoStr) {
|
|
33596
33599
|
const caseInfo = JSON.parse(caseInfoStr);
|
|
33597
33600
|
if (caseInfo && caseInfo.cid === caseId) {
|
|
33598
33601
|
return this.workAllocationService.getTasksByCaseIdAndEventId(eventId, caseId, caseInfo.caseType, caseInfo.jurisdiction)
|
|
33599
|
-
.pipe(switchMap((payload) => this.checkForTasks(payload, caseId, eventId, taskId)));
|
|
33602
|
+
.pipe(switchMap((payload) => this.checkForTasks(payload, caseId, eventId, taskId, userId)));
|
|
33600
33603
|
}
|
|
33601
33604
|
}
|
|
33602
33605
|
return of(false);
|
|
@@ -33639,10 +33642,19 @@ class EventStartGuard {
|
|
|
33639
33642
|
removeTaskFromSessionStorage() {
|
|
33640
33643
|
this.sessionStorageService.removeItem(EventStartGuard.TASK_TO_COMPLETE);
|
|
33641
33644
|
}
|
|
33642
|
-
checkForTasks(payload, caseId, eventId, taskId) {
|
|
33645
|
+
checkForTasks(payload, caseId, eventId, taskId, userId) {
|
|
33643
33646
|
if (taskId && payload?.tasks?.length > 0) {
|
|
33644
33647
|
const task = payload.tasks.find((t) => t.id == taskId);
|
|
33645
33648
|
if (task) {
|
|
33649
|
+
// Store task to session
|
|
33650
|
+
const taskEventCompletionInfo = {
|
|
33651
|
+
caseId: caseId,
|
|
33652
|
+
eventId: eventId,
|
|
33653
|
+
userId: userId,
|
|
33654
|
+
taskId: task.id,
|
|
33655
|
+
createdTimestamp: Date.now()
|
|
33656
|
+
};
|
|
33657
|
+
this.sessionStorageService.setItem('taskEventCompletionInfo', JSON.stringify(taskEventCompletionInfo));
|
|
33646
33658
|
this.sessionStorageService.setItem(EventStartGuard.TASK_TO_COMPLETE, JSON.stringify(task));
|
|
33647
33659
|
}
|
|
33648
33660
|
else {
|
|
@@ -33811,8 +33823,22 @@ class EventStartStateMachineService {
|
|
|
33811
33823
|
task = context.tasks[0];
|
|
33812
33824
|
}
|
|
33813
33825
|
const taskStr = JSON.stringify(task);
|
|
33826
|
+
let userInfo;
|
|
33827
|
+
const userInfoStr = context.sessionStorageService.getItem('userDetails');
|
|
33828
|
+
if (userInfoStr) {
|
|
33829
|
+
userInfo = JSON.parse(userInfoStr);
|
|
33830
|
+
}
|
|
33814
33831
|
console.log('entryActionForStateOneTaskAssignedToUser: setting taskToComplete to ' + taskStr);
|
|
33815
33832
|
// Store task to session
|
|
33833
|
+
const taskEventCompletionInfo = {
|
|
33834
|
+
caseId: context.caseId,
|
|
33835
|
+
eventId: context.eventId,
|
|
33836
|
+
userId: userInfo.uid,
|
|
33837
|
+
taskId: task.id,
|
|
33838
|
+
createdTimestamp: Date.now()
|
|
33839
|
+
};
|
|
33840
|
+
context.sessionStorageService.setItem('taskEventCompletionInfo', JSON.stringify(taskEventCompletionInfo));
|
|
33841
|
+
console.log('have added', taskEventCompletionInfo);
|
|
33816
33842
|
context.sessionStorageService.setItem('taskToComplete', taskStr);
|
|
33817
33843
|
// Allow user to perform the event
|
|
33818
33844
|
context.router.navigate([`/cases/case-details/${context.caseId}/trigger/${context.eventId}`], { relativeTo: context.route });
|