@hmcts/ccd-case-ui-toolkit 7.0.5 → 7.0.6
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/esm2020/lib/shared/components/case-editor/case-edit/case-edit.component.mjs +56 -26
- package/esm2020/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.mjs +4 -1
- package/esm2020/lib/shared/components/case-editor/case-event-completion/components/case-event-completion-task-reassigned/case-event-completion-task-reassigned.component.mjs +4 -14
- package/esm2020/lib/shared/components/case-editor/services/event-completion-state-machine.service.mjs +6 -25
- package/esm2020/lib/shared/components/palette/datetime-picker/datetime-picker-utils.mjs +3 -3
- package/esm2020/lib/shared/components/palette/document/write-document-field.component.mjs +14 -2
- package/esm2020/lib/shared/components/palette/linked-cases/write-linked-cases-field.component.mjs +25 -12
- package/esm2020/lib/shared/domain/case-view/service-org-response.model.mjs +2 -0
- package/esm2020/lib/shared/domain/http/http-error.model.mjs +2 -8
- package/esm2020/lib/shared/pipes/complex/ccd-read-fields-filter.pipe.mjs +4 -3
- package/esm2020/lib/shared/services/common-data-service/common-data-service.mjs +7 -1
- package/esm2020/lib/shared/services/fields/fields.purger.mjs +16 -6
- package/esm2020/lib/shared/services/form/form-value.service.mjs +10 -7
- package/esm2020/lib/shared/services/utils/retry/retry.service.mjs +1 -2
- package/fesm2015/hmcts-ccd-case-ui-toolkit.mjs +137 -94
- package/fesm2015/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
- package/fesm2020/hmcts-ccd-case-ui-toolkit.mjs +136 -94
- package/fesm2020/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
- package/lib/shared/components/case-editor/case-edit/case-edit.component.d.ts +5 -2
- package/lib/shared/components/case-editor/case-edit/case-edit.component.d.ts.map +1 -1
- package/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.d.ts.map +1 -1
- package/lib/shared/components/case-editor/case-event-completion/components/case-event-completion-task-reassigned/case-event-completion-task-reassigned.component.d.ts.map +1 -1
- package/lib/shared/components/case-editor/services/event-completion-state-machine.service.d.ts.map +1 -1
- package/lib/shared/components/palette/document/write-document-field.component.d.ts.map +1 -1
- package/lib/shared/components/palette/linked-cases/write-linked-cases-field.component.d.ts +6 -3
- package/lib/shared/components/palette/linked-cases/write-linked-cases-field.component.d.ts.map +1 -1
- package/lib/shared/domain/case-view/service-org-response.model.d.ts +14 -0
- package/lib/shared/domain/case-view/service-org-response.model.d.ts.map +1 -0
- package/lib/shared/domain/http/http-error.model.d.ts +0 -1
- package/lib/shared/domain/http/http-error.model.d.ts.map +1 -1
- package/lib/shared/pipes/complex/ccd-read-fields-filter.pipe.d.ts.map +1 -1
- package/lib/shared/services/common-data-service/common-data-service.d.ts +2 -0
- package/lib/shared/services/common-data-service/common-data-service.d.ts.map +1 -1
- package/lib/shared/services/fields/fields.purger.d.ts.map +1 -1
- package/lib/shared/services/form/form-value.service.d.ts +1 -1
- package/lib/shared/services/form/form-value.service.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ import * as i1$2 from '@angular/router';
|
|
|
8
8
|
import { RouterModule, NavigationStart, NavigationEnd } from '@angular/router';
|
|
9
9
|
import * as i3 from '@angular/forms';
|
|
10
10
|
import { NG_VALUE_ACCESSOR, NG_VALIDATORS, FormArray, FormGroup, FormControl, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
11
|
-
import { throwError, Subject, EMPTY, Observable, of, BehaviorSubject, timer, fromEvent, forkJoin } from 'rxjs';
|
|
11
|
+
import { throwError, Subject, EMPTY, Observable, of, BehaviorSubject, timer, fromEvent, forkJoin, Subscription } from 'rxjs';
|
|
12
12
|
import * as i1$3 from '@angular/common/http';
|
|
13
13
|
import { HttpErrorResponse, HttpHeaders, HttpParams } from '@angular/common/http';
|
|
14
14
|
import { catchError, map, debounceTime, publish, refCount, delay, distinctUntilChanged, finalize, timeout, mergeMap, retryWhen, tap, delayWhen, publishReplay, take, first, switchMap, takeUntil, filter } from 'rxjs/operators';
|
|
@@ -1333,14 +1333,9 @@ class HttpError {
|
|
|
1333
1333
|
}
|
|
1334
1334
|
static from(response) {
|
|
1335
1335
|
const error = new HttpError();
|
|
1336
|
-
if ((response === null || response === void 0 ? void 0 : response.status) === 429) {
|
|
1337
|
-
error.error = HttpError.MESSAGE_ERROR_429;
|
|
1338
|
-
error.status = response.status;
|
|
1339
|
-
error.message = response.message;
|
|
1340
|
-
}
|
|
1341
1336
|
// Check that the HttpErrorResponse contains an "error" object before mapping the error properties
|
|
1342
1337
|
if (!!(response && response.error)) {
|
|
1343
|
-
Object.keys(error).forEach(
|
|
1338
|
+
Object.keys(error).forEach(key => {
|
|
1344
1339
|
error[key] = response.error.hasOwnProperty(key) && response.error[key] ? response.error[key] : error[key];
|
|
1345
1340
|
});
|
|
1346
1341
|
}
|
|
@@ -1357,7 +1352,6 @@ class HttpError {
|
|
|
1357
1352
|
HttpError.DEFAULT_ERROR = 'Unknown error';
|
|
1358
1353
|
HttpError.DEFAULT_MESSAGE = 'Something unexpected happened, our technical staff have been automatically notified';
|
|
1359
1354
|
HttpError.DEFAULT_STATUS = 500;
|
|
1360
|
-
HttpError.MESSAGE_ERROR_429 = 'Your request was rate limited. Please wait a few seconds before retrying your document upload';
|
|
1361
1355
|
|
|
1362
1356
|
class AbstractAppConfig {
|
|
1363
1357
|
/**
|
|
@@ -4966,11 +4960,21 @@ class FieldsPurger {
|
|
|
4966
4960
|
* @returns A new array with the mapped values
|
|
4967
4961
|
*/
|
|
4968
4962
|
mapArrayValuesToNull(array) {
|
|
4969
|
-
|
|
4970
|
-
return
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4963
|
+
if (array && array.length > 0) {
|
|
4964
|
+
return array.map(element => {
|
|
4965
|
+
if (element !== undefined && element !== null) {
|
|
4966
|
+
return typeof element === 'object'
|
|
4967
|
+
? Object.assign({}, ...Object.keys(element).map(k => ({ [k]: null })))
|
|
4968
|
+
: null;
|
|
4969
|
+
}
|
|
4970
|
+
else {
|
|
4971
|
+
return {};
|
|
4972
|
+
}
|
|
4973
|
+
});
|
|
4974
|
+
}
|
|
4975
|
+
else {
|
|
4976
|
+
return array;
|
|
4977
|
+
}
|
|
4974
4978
|
}
|
|
4975
4979
|
}
|
|
4976
4980
|
FieldsPurger.ɵfac = function FieldsPurger_Factory(t) { return new (t || FieldsPurger)(i0.ɵɵinject(FieldsUtils)); };
|
|
@@ -5446,7 +5450,7 @@ class FormValueService {
|
|
|
5446
5450
|
* @param clearEmpty Whether or not we should clear out empty, optional, complex objects.
|
|
5447
5451
|
* @param clearNonCase Whether or not we should clear out non-case fields at the top level.
|
|
5448
5452
|
*/
|
|
5449
|
-
removeUnnecessaryFields(data, caseFields, clearEmpty = false, clearNonCase = false, fromPreviousPage = false, currentPageCaseFields = []) {
|
|
5453
|
+
removeUnnecessaryFields(data, caseFields, clearEmpty = false, clearNonCase = false, fromPreviousPage = false, currentPageCaseFields = [], isCalledFromSubmit = false) {
|
|
5450
5454
|
if (data && caseFields && caseFields.length > 0) {
|
|
5451
5455
|
// check if there is any data at the top level of the form that's not in the caseFields
|
|
5452
5456
|
if (clearNonCase) {
|
|
@@ -5457,10 +5461,13 @@ class FormValueService {
|
|
|
5457
5461
|
// Retain anything that is readonly and not a label.
|
|
5458
5462
|
continue;
|
|
5459
5463
|
}
|
|
5460
|
-
if (field.hidden === true && field.display_context !== 'HIDDEN' && field.display_context !== 'HIDDEN_TEMP' && field.id !== 'caseLinks'
|
|
5464
|
+
if (field.hidden === true && field.display_context !== 'HIDDEN' && field.display_context !== 'HIDDEN_TEMP' && field.id !== 'caseLinks') {
|
|
5461
5465
|
// Delete anything that is hidden (that is NOT readonly), and that
|
|
5462
5466
|
// hasn't had its display_context overridden to make it hidden.
|
|
5463
|
-
|
|
5467
|
+
// in event submission check for field's retain_hidden_value defore deletion
|
|
5468
|
+
if ((isCalledFromSubmit && !field.retain_hidden_value) || !isCalledFromSubmit) {
|
|
5469
|
+
delete data[field.id];
|
|
5470
|
+
}
|
|
5464
5471
|
}
|
|
5465
5472
|
else if (field.field_type) {
|
|
5466
5473
|
switch (field.field_type.type) {
|
|
@@ -5474,7 +5481,7 @@ class FormValueService {
|
|
|
5474
5481
|
}
|
|
5475
5482
|
break;
|
|
5476
5483
|
case 'Complex':
|
|
5477
|
-
this.removeUnnecessaryFields(data[field.id], field.field_type.complex_fields, clearEmpty);
|
|
5484
|
+
this.removeUnnecessaryFields(data[field.id], field.field_type.complex_fields, clearEmpty, false, false, [], isCalledFromSubmit);
|
|
5478
5485
|
// Also remove any optional complex objects that are completely empty.
|
|
5479
5486
|
// EUI-4244: Ritesh's fix, passing true instead of clearEmpty.
|
|
5480
5487
|
if (FormValueService.clearOptionalEmpty(true, data[field.id], field)) {
|
|
@@ -5497,8 +5504,8 @@ class FormValueService {
|
|
|
5497
5504
|
if (field.field_type.collection_field_type.type === 'Complex') {
|
|
5498
5505
|
// Iterate through the elements and remove any unnecessary fields within.
|
|
5499
5506
|
for (const item of collection) {
|
|
5500
|
-
this.removeUnnecessaryFields(item, field.field_type.collection_field_type.complex_fields, clearEmpty);
|
|
5501
|
-
this.removeUnnecessaryFields(item.value, field.field_type.collection_field_type.complex_fields, false);
|
|
5507
|
+
this.removeUnnecessaryFields(item, field.field_type.collection_field_type.complex_fields, clearEmpty, false, false, [], isCalledFromSubmit);
|
|
5508
|
+
this.removeUnnecessaryFields(item.value, field.field_type.collection_field_type.complex_fields, false, false, false, [], isCalledFromSubmit);
|
|
5502
5509
|
}
|
|
5503
5510
|
}
|
|
5504
5511
|
}
|
|
@@ -6998,7 +7005,6 @@ class ArtificialDelayContext {
|
|
|
6998
7005
|
this.artificialDelayOn = true;
|
|
6999
7006
|
this.selectedDelay = this.selectActualDelayTime();
|
|
7000
7007
|
}
|
|
7001
|
-
;
|
|
7002
7008
|
switchArtificialDelays(status) {
|
|
7003
7009
|
this.artificialDelayOn = status;
|
|
7004
7010
|
this.selectedDelay = this.selectActualDelayTime();
|
|
@@ -8343,18 +8349,9 @@ class EventCompletionStateMachineService {
|
|
|
8343
8349
|
state.trigger(EventCompletionStates.Final);
|
|
8344
8350
|
const taskStr = context.sessionStorageService.getItem('taskToComplete');
|
|
8345
8351
|
if (taskStr) {
|
|
8346
|
-
|
|
8347
|
-
|
|
8348
|
-
|
|
8349
|
-
context.workAllocationService.completeTask(task.id).subscribe(response => {
|
|
8350
|
-
// Emit event can be completed event
|
|
8351
|
-
context.component.eventCanBeCompleted.emit(true);
|
|
8352
|
-
}, error => {
|
|
8353
|
-
// Emit event cannot be completed event
|
|
8354
|
-
context.component.eventCanBeCompleted.emit(false);
|
|
8355
|
-
context.alertService.error(error.message);
|
|
8356
|
-
return throwError(error);
|
|
8357
|
-
});
|
|
8352
|
+
context.sessionStorageService.setItem('assignNeeded', 'false');
|
|
8353
|
+
// just set event can be completed
|
|
8354
|
+
context.component.eventCanBeCompleted.emit(true);
|
|
8358
8355
|
}
|
|
8359
8356
|
else {
|
|
8360
8357
|
// Emit event cannot be completed event
|
|
@@ -8373,18 +8370,8 @@ class EventCompletionStateMachineService {
|
|
|
8373
8370
|
// Get task details
|
|
8374
8371
|
const taskStr = context.sessionStorageService.getItem('taskToComplete');
|
|
8375
8372
|
if (taskStr) {
|
|
8376
|
-
|
|
8377
|
-
|
|
8378
|
-
// Assign and complete task
|
|
8379
|
-
context.workAllocationService.assignAndCompleteTask(task.id).subscribe(response => {
|
|
8380
|
-
// Emit event can be completed event
|
|
8381
|
-
context.component.eventCanBeCompleted.emit(true);
|
|
8382
|
-
}, error => {
|
|
8383
|
-
// Emit event cannot be completed event
|
|
8384
|
-
context.component.eventCanBeCompleted.emit(false);
|
|
8385
|
-
context.alertService.error(error.message);
|
|
8386
|
-
return throwError(error);
|
|
8387
|
-
});
|
|
8373
|
+
context.sessionStorageService.setItem('assignNeeded', 'true');
|
|
8374
|
+
context.component.eventCanBeCompleted.emit(true);
|
|
8388
8375
|
}
|
|
8389
8376
|
else {
|
|
8390
8377
|
// Emit event cannot be completed event
|
|
@@ -8740,7 +8727,7 @@ ValidPageListCaseFieldsService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({
|
|
|
8740
8727
|
})();
|
|
8741
8728
|
|
|
8742
8729
|
class CaseEditComponent {
|
|
8743
|
-
constructor(fb, caseNotifier, router, route, fieldsUtils, fieldsPurger, registrarService, wizardFactory, sessionStorageService, windowsService, formValueService, formErrorService, loadingService, validPageListCaseFieldsService) {
|
|
8730
|
+
constructor(fb, caseNotifier, router, route, fieldsUtils, fieldsPurger, registrarService, wizardFactory, sessionStorageService, windowsService, formValueService, formErrorService, loadingService, validPageListCaseFieldsService, workAllocationService) {
|
|
8744
8731
|
this.fb = fb;
|
|
8745
8732
|
this.caseNotifier = caseNotifier;
|
|
8746
8733
|
this.router = router;
|
|
@@ -8755,6 +8742,7 @@ class CaseEditComponent {
|
|
|
8755
8742
|
this.formErrorService = formErrorService;
|
|
8756
8743
|
this.loadingService = loadingService;
|
|
8757
8744
|
this.validPageListCaseFieldsService = validPageListCaseFieldsService;
|
|
8745
|
+
this.workAllocationService = workAllocationService;
|
|
8758
8746
|
this.cancelled = new EventEmitter();
|
|
8759
8747
|
this.submitted = new EventEmitter();
|
|
8760
8748
|
this.isEventCompletionChecksRequired = false;
|
|
@@ -8928,7 +8916,7 @@ class CaseEditComponent {
|
|
|
8928
8916
|
const pageListCaseFields = this.validPageListCaseFieldsService.validPageListCaseFields(this.validPageList, eventTrigger.case_fields, form.controls['data'].value);
|
|
8929
8917
|
// Remove unnecessary case fields which are hidden, only if the submission is *not* for Case Flags
|
|
8930
8918
|
if (!this.isCaseFlagSubmission) {
|
|
8931
|
-
this.formValueService.removeUnnecessaryFields(caseEventData.data, pageListCaseFields, true, true);
|
|
8919
|
+
this.formValueService.removeUnnecessaryFields(caseEventData.data, pageListCaseFields, true, true, false, [], true);
|
|
8932
8920
|
}
|
|
8933
8921
|
caseEventData.event_token = eventTrigger.event_token;
|
|
8934
8922
|
caseEventData.ignore_warning = this.ignoreWarning;
|
|
@@ -9041,31 +9029,60 @@ class CaseEditComponent {
|
|
|
9041
9029
|
}
|
|
9042
9030
|
caseSubmit({ form, caseEventData, submit }) {
|
|
9043
9031
|
const loadingSpinnerToken = this.loadingService.register();
|
|
9044
|
-
|
|
9045
|
-
|
|
9032
|
+
// keep the initial event response to finalise process after task completion
|
|
9033
|
+
let eventResponse;
|
|
9034
|
+
submit(caseEventData).pipe(switchMap((response) => {
|
|
9035
|
+
eventResponse = response;
|
|
9036
|
+
return this.postCompleteTaskIfRequired();
|
|
9037
|
+
}), finalize(() => {
|
|
9046
9038
|
this.loadingService.unregister(loadingSpinnerToken);
|
|
9047
9039
|
}))
|
|
9048
|
-
.subscribe(
|
|
9049
|
-
this.
|
|
9050
|
-
|
|
9051
|
-
|
|
9052
|
-
|
|
9053
|
-
this.
|
|
9040
|
+
.subscribe(() => {
|
|
9041
|
+
this.finishEventCompletionLogic(eventResponse);
|
|
9042
|
+
}, error => {
|
|
9043
|
+
if (!eventResponse) {
|
|
9044
|
+
// event submission error
|
|
9045
|
+
this.error = error;
|
|
9046
|
+
this.callbackErrorsSubject.next(error);
|
|
9047
|
+
/* istanbul ignore else */
|
|
9048
|
+
if (this.error.details) {
|
|
9049
|
+
this.formErrorService
|
|
9050
|
+
.mapFieldErrors(this.error.details.field_errors, form.controls['data'], 'validation');
|
|
9051
|
+
}
|
|
9052
|
+
this.isSubmitting = false;
|
|
9054
9053
|
}
|
|
9055
9054
|
else {
|
|
9056
|
-
|
|
9055
|
+
// task assignment/completion error - handled within workallocation service
|
|
9056
|
+
// could set task to be deleted (or completed later)?
|
|
9057
|
+
// note: think error messages only shown if user is caseworker - might reqauire changing
|
|
9058
|
+
this.finishEventCompletionLogic(eventResponse);
|
|
9057
9059
|
}
|
|
9058
|
-
}, error => {
|
|
9059
|
-
this.error = error;
|
|
9060
|
-
this.callbackErrorsSubject.next(error);
|
|
9061
|
-
/* istanbul ignore else */
|
|
9062
|
-
if (this.error.details) {
|
|
9063
|
-
this.formErrorService
|
|
9064
|
-
.mapFieldErrors(this.error.details.field_errors, form.controls['data'], 'validation');
|
|
9065
|
-
}
|
|
9066
|
-
this.isSubmitting = false;
|
|
9067
9060
|
});
|
|
9068
9061
|
}
|
|
9062
|
+
postCompleteTaskIfRequired() {
|
|
9063
|
+
const taskStr = this.sessionStorageService.getItem('taskToComplete');
|
|
9064
|
+
const assignNeeded = this.sessionStorageService.getItem('assignNeeded') === 'true';
|
|
9065
|
+
if (taskStr && assignNeeded) {
|
|
9066
|
+
const task = JSON.parse(taskStr);
|
|
9067
|
+
return this.workAllocationService.assignAndCompleteTask(task.id);
|
|
9068
|
+
}
|
|
9069
|
+
else if (taskStr) {
|
|
9070
|
+
const task = JSON.parse(taskStr);
|
|
9071
|
+
return this.workAllocationService.completeTask(task.id);
|
|
9072
|
+
}
|
|
9073
|
+
return of(true);
|
|
9074
|
+
}
|
|
9075
|
+
finishEventCompletionLogic(eventResponse) {
|
|
9076
|
+
this.caseNotifier.cachedCaseView = null;
|
|
9077
|
+
this.sessionStorageService.removeItem('eventUrl');
|
|
9078
|
+
const confirmation = this.buildConfirmation(eventResponse);
|
|
9079
|
+
if (confirmation && (confirmation.getHeader() || confirmation.getBody())) {
|
|
9080
|
+
this.confirm(confirmation);
|
|
9081
|
+
}
|
|
9082
|
+
else {
|
|
9083
|
+
this.emitSubmitted(eventResponse);
|
|
9084
|
+
}
|
|
9085
|
+
}
|
|
9069
9086
|
buildConfirmation(response) {
|
|
9070
9087
|
if (response['after_submit_callback_response']) {
|
|
9071
9088
|
return new Confirmation(response['id'], response['callback_response_status'], response['after_submit_callback_response']['confirmation_header'], response['after_submit_callback_response']['confirmation_body']);
|
|
@@ -9094,7 +9111,7 @@ class CaseEditComponent {
|
|
|
9094
9111
|
}
|
|
9095
9112
|
CaseEditComponent.ORIGIN_QUERY_PARAM = 'origin';
|
|
9096
9113
|
CaseEditComponent.ALERT_MESSAGE = 'Page is being refreshed so you will be redirected to the first page of this event.';
|
|
9097
|
-
CaseEditComponent.ɵfac = function CaseEditComponent_Factory(t) { return new (t || CaseEditComponent)(i0.ɵɵdirectiveInject(i3.FormBuilder), i0.ɵɵdirectiveInject(CaseNotifier), i0.ɵɵdirectiveInject(i1$2.Router), i0.ɵɵdirectiveInject(i1$2.ActivatedRoute), i0.ɵɵdirectiveInject(FieldsUtils), i0.ɵɵdirectiveInject(FieldsPurger), i0.ɵɵdirectiveInject(ConditionalShowRegistrarService), i0.ɵɵdirectiveInject(WizardFactoryService), i0.ɵɵdirectiveInject(SessionStorageService), i0.ɵɵdirectiveInject(WindowService), i0.ɵɵdirectiveInject(FormValueService), i0.ɵɵdirectiveInject(FormErrorService), i0.ɵɵdirectiveInject(LoadingService), i0.ɵɵdirectiveInject(ValidPageListCaseFieldsService)); };
|
|
9114
|
+
CaseEditComponent.ɵfac = function CaseEditComponent_Factory(t) { return new (t || CaseEditComponent)(i0.ɵɵdirectiveInject(i3.FormBuilder), i0.ɵɵdirectiveInject(CaseNotifier), i0.ɵɵdirectiveInject(i1$2.Router), i0.ɵɵdirectiveInject(i1$2.ActivatedRoute), i0.ɵɵdirectiveInject(FieldsUtils), i0.ɵɵdirectiveInject(FieldsPurger), i0.ɵɵdirectiveInject(ConditionalShowRegistrarService), i0.ɵɵdirectiveInject(WizardFactoryService), i0.ɵɵdirectiveInject(SessionStorageService), i0.ɵɵdirectiveInject(WindowService), i0.ɵɵdirectiveInject(FormValueService), i0.ɵɵdirectiveInject(FormErrorService), i0.ɵɵdirectiveInject(LoadingService), i0.ɵɵdirectiveInject(ValidPageListCaseFieldsService), i0.ɵɵdirectiveInject(WorkAllocationService)); };
|
|
9098
9115
|
CaseEditComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseEditComponent, selectors: [["ccd-case-edit"]], inputs: { eventTrigger: "eventTrigger", submit: "submit", validate: "validate", saveDraft: "saveDraft", caseDetails: "caseDetails" }, outputs: { cancelled: "cancelled", submitted: "submitted" }, features: [i0.ɵɵProvidersFeature([GreyBarService])], decls: 1, vars: 0, template: function CaseEditComponent_Template(rf, ctx) {
|
|
9099
9116
|
if (rf & 1) {
|
|
9100
9117
|
i0.ɵɵelement(0, "router-outlet");
|
|
@@ -9104,7 +9121,7 @@ CaseEditComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaseEditC
|
|
|
9104
9121
|
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseEditComponent, [{
|
|
9105
9122
|
type: Component,
|
|
9106
9123
|
args: [{ selector: 'ccd-case-edit', providers: [GreyBarService], template: "<router-outlet></router-outlet>\n", styles: ["#fieldset-case-data{margin-bottom:30px}#fieldset-case-data th{width:1%;white-space:nowrap;vertical-align:top}.compound-field td{padding:0}#confirmation-header{width:630px;background-color:#17958b;border:solid 1px #979797;color:#fff;text-align:center}#confirmation-body{width:630px;background-color:#fff}.valign-top{vertical-align:top}.summary-fields{margin-bottom:30px}.summary-fields tbody tr th,.summary-fields tbody tr td{border-bottom:0px}a.disabled{pointer-events:none;cursor:default}.case-field-label{width:45%}.case-field-content{width:50%}.case-field-change{width:5%}\n"] }]
|
|
9107
|
-
}], function () { return [{ type: i3.FormBuilder }, { type: CaseNotifier }, { type: i1$2.Router }, { type: i1$2.ActivatedRoute }, { type: FieldsUtils }, { type: FieldsPurger }, { type: ConditionalShowRegistrarService }, { type: WizardFactoryService }, { type: SessionStorageService }, { type: WindowService }, { type: FormValueService }, { type: FormErrorService }, { type: LoadingService }, { type: ValidPageListCaseFieldsService }]; }, { eventTrigger: [{
|
|
9124
|
+
}], function () { return [{ type: i3.FormBuilder }, { type: CaseNotifier }, { type: i1$2.Router }, { type: i1$2.ActivatedRoute }, { type: FieldsUtils }, { type: FieldsPurger }, { type: ConditionalShowRegistrarService }, { type: WizardFactoryService }, { type: SessionStorageService }, { type: WindowService }, { type: FormValueService }, { type: FormErrorService }, { type: LoadingService }, { type: ValidPageListCaseFieldsService }, { type: WorkAllocationService }]; }, { eventTrigger: [{
|
|
9108
9125
|
type: Input
|
|
9109
9126
|
}], submit: [{
|
|
9110
9127
|
type: Input
|
|
@@ -9962,6 +9979,7 @@ class CaseEditPageComponent {
|
|
|
9962
9979
|
}
|
|
9963
9980
|
submit() {
|
|
9964
9981
|
this.caseEditDataService.clearFormValidationErrors();
|
|
9982
|
+
console.log('Page submit event fired!');
|
|
9965
9983
|
if (this.currentPageIsNotValid()) {
|
|
9966
9984
|
// The generateErrorMessage method filters out the hidden fields.
|
|
9967
9985
|
// The error message for LinkedCases journey will never get displayed because the
|
|
@@ -9975,6 +9993,7 @@ class CaseEditPageComponent {
|
|
|
9975
9993
|
}
|
|
9976
9994
|
}
|
|
9977
9995
|
if (!this.caseEdit.isSubmitting && !this.currentPageIsNotValid()) {
|
|
9996
|
+
console.log('Case Edit Error', this.caseEdit.error);
|
|
9978
9997
|
if (this.caseEdit.validPageList.findIndex(page => page.id === this.currentPage.id) === -1) {
|
|
9979
9998
|
this.caseEdit.validPageList.push(this.currentPage);
|
|
9980
9999
|
}
|
|
@@ -10160,6 +10179,7 @@ class CaseEditPageComponent {
|
|
|
10160
10179
|
this.formErrorService
|
|
10161
10180
|
.mapFieldErrors(this.caseEdit.error.details.field_errors, (_b = (_a = this.editForm) === null || _a === void 0 ? void 0 : _a.controls) === null || _b === void 0 ? void 0 : _b['data'], 'validation');
|
|
10162
10181
|
}
|
|
10182
|
+
console.log('handleError ', error);
|
|
10163
10183
|
}
|
|
10164
10184
|
resetErrors() {
|
|
10165
10185
|
this.caseEdit.error = null;
|
|
@@ -13361,7 +13381,19 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
|
|
|
13361
13381
|
if (0 === error.status || 502 === error.status) {
|
|
13362
13382
|
return WriteDocumentFieldComponent.UPLOAD_ERROR_NOT_AVAILABLE;
|
|
13363
13383
|
}
|
|
13364
|
-
|
|
13384
|
+
let errorMsg = 'Error uploading file';
|
|
13385
|
+
if (error === null || error === void 0 ? void 0 : error.error) {
|
|
13386
|
+
const fullError = error.error;
|
|
13387
|
+
const start = fullError.indexOf('{');
|
|
13388
|
+
if (start >= 0) {
|
|
13389
|
+
const json = fullError.substring(start, fullError.length - 1).split('<EOL>').join('');
|
|
13390
|
+
const obj = JSON.parse(json);
|
|
13391
|
+
if (obj === null || obj === void 0 ? void 0 : obj.error) {
|
|
13392
|
+
errorMsg = obj.error;
|
|
13393
|
+
}
|
|
13394
|
+
}
|
|
13395
|
+
}
|
|
13396
|
+
return errorMsg;
|
|
13365
13397
|
}
|
|
13366
13398
|
buildDocumentUploadData(selectedFile) {
|
|
13367
13399
|
const documentUpload = new FormData();
|
|
@@ -16826,6 +16858,12 @@ class CommonDataService {
|
|
|
16826
16858
|
}
|
|
16827
16859
|
return of(null);
|
|
16828
16860
|
}
|
|
16861
|
+
getServiceOrgData(url) {
|
|
16862
|
+
if (url) {
|
|
16863
|
+
return this.http.get(url, { observe: 'body' });
|
|
16864
|
+
}
|
|
16865
|
+
return of(null);
|
|
16866
|
+
}
|
|
16829
16867
|
}
|
|
16830
16868
|
CommonDataService.ɵfac = function CommonDataService_Factory(t) { return new (t || CommonDataService)(i0.ɵɵinject(i1$3.HttpClient)); };
|
|
16831
16869
|
CommonDataService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: CommonDataService, factory: CommonDataService.ɵfac });
|
|
@@ -17070,6 +17108,7 @@ class WriteLinkedCasesFieldComponent extends AbstractFieldWriteComponent {
|
|
|
17070
17108
|
this.linkedCasesPages = LinkedCasesPages;
|
|
17071
17109
|
this.linkedCasesEventTriggers = LinkedCasesEventTriggers;
|
|
17072
17110
|
this.linkedCases = [];
|
|
17111
|
+
this.subscriptions = new Subscription();
|
|
17073
17112
|
}
|
|
17074
17113
|
ngOnInit() {
|
|
17075
17114
|
// This is required to enable Continue button validation
|
|
@@ -17078,17 +17117,17 @@ class WriteLinkedCasesFieldComponent extends AbstractFieldWriteComponent {
|
|
|
17078
17117
|
// Clear validation errors
|
|
17079
17118
|
this.caseEditDataService.clearFormValidationErrors();
|
|
17080
17119
|
// Get linked case reasons from ref data
|
|
17081
|
-
this.getLinkedCaseReasons();
|
|
17082
17120
|
this.linkedCasesService.editMode = false;
|
|
17083
|
-
this.caseEditDataService.caseDetails$.subscribe({
|
|
17084
|
-
next: caseDetails => this.initialiseCaseDetails(caseDetails)
|
|
17085
|
-
});
|
|
17086
|
-
this.
|
|
17121
|
+
this.subscriptions.add(this.caseEditDataService.caseDetails$.subscribe({
|
|
17122
|
+
next: caseDetails => { this.initialiseCaseDetails(caseDetails); }
|
|
17123
|
+
}));
|
|
17124
|
+
this.getOrgService();
|
|
17125
|
+
this.subscriptions.add(this.caseEditDataService.caseEventTriggerName$.subscribe({
|
|
17087
17126
|
next: name => this.linkedCasesService.isLinkedCasesEventTrigger = (name === LinkedCasesEventTriggers.LINK_CASES)
|
|
17088
|
-
});
|
|
17089
|
-
this.caseEditDataService.caseEditForm$.subscribe({
|
|
17127
|
+
}));
|
|
17128
|
+
this.subscriptions.add(this.caseEditDataService.caseEditForm$.subscribe({
|
|
17090
17129
|
next: editForm => this.caseEditForm = editForm
|
|
17091
|
-
});
|
|
17130
|
+
}));
|
|
17092
17131
|
}
|
|
17093
17132
|
initialiseCaseDetails(caseDetails) {
|
|
17094
17133
|
if (caseDetails) {
|
|
@@ -17124,18 +17163,27 @@ class WriteLinkedCasesFieldComponent extends AbstractFieldWriteComponent {
|
|
|
17124
17163
|
}
|
|
17125
17164
|
}
|
|
17126
17165
|
}
|
|
17127
|
-
getLinkedCaseReasons() {
|
|
17128
|
-
const reasonCodeAPIurl = `${this.appConfig.getRDCommonDataApiUrl()}/lov/categories/CaseLinkingReasonCode`;
|
|
17166
|
+
getLinkedCaseReasons(serviceId) {
|
|
17167
|
+
const reasonCodeAPIurl = `${this.appConfig.getRDCommonDataApiUrl()}/lov/categories/CaseLinkingReasonCode?serviceId=${serviceId}`;
|
|
17129
17168
|
this.commonDataService.getRefData(reasonCodeAPIurl).subscribe({
|
|
17130
17169
|
next: reasons => {
|
|
17131
17170
|
// Sort in ascending order
|
|
17132
17171
|
const linkCaseReasons = reasons.list_of_values.sort((a, b) => (a.value_en > b.value_en) ? 1 : -1);
|
|
17133
|
-
// Move Other option to the end of the list
|
|
17134
17172
|
this.linkedCasesService.linkCaseReasons = linkCaseReasons === null || linkCaseReasons === void 0 ? void 0 : linkCaseReasons.filter(reason => reason.value_en !== 'Other');
|
|
17173
|
+
// Move Other option to the end of the list
|
|
17135
17174
|
this.linkedCasesService.linkCaseReasons.push(linkCaseReasons === null || linkCaseReasons === void 0 ? void 0 : linkCaseReasons.find(reason => reason.value_en === 'Other'));
|
|
17136
17175
|
}
|
|
17137
17176
|
});
|
|
17138
17177
|
}
|
|
17178
|
+
getOrgService() {
|
|
17179
|
+
var _a, _b;
|
|
17180
|
+
const servicesApiUrl = `refdata/location/orgServices?ccdCaseType=${(_b = (_a = this.caseDetails) === null || _a === void 0 ? void 0 : _a.case_type) === null || _b === void 0 ? void 0 : _b.id}`;
|
|
17181
|
+
this.commonDataService.getServiceOrgData(servicesApiUrl).subscribe(result => {
|
|
17182
|
+
result.forEach(ids => {
|
|
17183
|
+
this.getLinkedCaseReasons(ids.service_id);
|
|
17184
|
+
});
|
|
17185
|
+
});
|
|
17186
|
+
}
|
|
17139
17187
|
proceedToNextPage() {
|
|
17140
17188
|
if (this.isAtFinalPage()) {
|
|
17141
17189
|
// Continue button event must be allowed in final page
|
|
@@ -17190,6 +17238,9 @@ class WriteLinkedCasesFieldComponent extends AbstractFieldWriteComponent {
|
|
|
17190
17238
|
: LinkedCasesPages.NO_LINKED_CASES;
|
|
17191
17239
|
});
|
|
17192
17240
|
}
|
|
17241
|
+
ngOnDestroy() {
|
|
17242
|
+
this.subscriptions.unsubscribe();
|
|
17243
|
+
}
|
|
17193
17244
|
}
|
|
17194
17245
|
WriteLinkedCasesFieldComponent.ɵfac = function WriteLinkedCasesFieldComponent_Factory(t) { return new (t || WriteLinkedCasesFieldComponent)(i0.ɵɵdirectiveInject(AbstractAppConfig), i0.ɵɵdirectiveInject(CommonDataService), i0.ɵɵdirectiveInject(CasesService), i0.ɵɵdirectiveInject(LinkedCasesService), i0.ɵɵdirectiveInject(CaseEditDataService)); };
|
|
17195
17246
|
WriteLinkedCasesFieldComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: WriteLinkedCasesFieldComponent, selectors: [["ccd-write-linked-cases-field"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 7, vars: 7, consts: [[1, "form-group", "govuk-!-margin-bottom-2", 3, "formGroup"], [1, "govuk-form-group", 3, "ngSwitch"], [4, "ngSwitchCase"], [3, "linkedCasesStateEmitter"]], template: function WriteLinkedCasesFieldComponent_Template(rf, ctx) {
|
|
@@ -22393,10 +22444,10 @@ WriteDateFieldComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: Wri
|
|
|
22393
22444
|
|
|
22394
22445
|
const CUSTOM_MOMENT_FORMATS = {
|
|
22395
22446
|
parse: {
|
|
22396
|
-
dateInput: 'YYYY
|
|
22447
|
+
dateInput: 'DD-MM-YYYY HH:mm:ss'
|
|
22397
22448
|
},
|
|
22398
22449
|
display: {
|
|
22399
|
-
dateInput: 'YYYY
|
|
22450
|
+
dateInput: 'DD-MM-YYYY HH:mm:ss',
|
|
22400
22451
|
monthYearLabel: 'MMMM YYYY',
|
|
22401
22452
|
dateA11yLabel: 'EEE/MMM/YYYY',
|
|
22402
22453
|
monthYearA11yLabel: 'MMMM YYYY',
|
|
@@ -23637,8 +23688,9 @@ class ReadFieldsFilterPipe {
|
|
|
23637
23688
|
return isNotEmpty;
|
|
23638
23689
|
}
|
|
23639
23690
|
static isEmpty(value) {
|
|
23640
|
-
|
|
23641
|
-
|
|
23691
|
+
const fieldValue = (value === null || value === void 0 ? void 0 : value.hasOwnProperty('list_items')) && (value === null || value === void 0 ? void 0 : value.hasOwnProperty('value')) ? value.value : value;
|
|
23692
|
+
return ReadFieldsFilterPipe.EMPTY_VALUES.indexOf(fieldValue) !== -1
|
|
23693
|
+
|| fieldValue.length === 0;
|
|
23642
23694
|
}
|
|
23643
23695
|
static isCompound(field) {
|
|
23644
23696
|
return ReadFieldsFilterPipe.NESTED_TYPES[field.field_type.type];
|
|
@@ -25595,18 +25647,9 @@ class CaseEventCompletionTaskReassignedComponent {
|
|
|
25595
25647
|
// Get task details
|
|
25596
25648
|
const taskStr = this.sessionStorageService.getItem('taskToComplete');
|
|
25597
25649
|
if (taskStr) {
|
|
25598
|
-
|
|
25599
|
-
|
|
25600
|
-
|
|
25601
|
-
this.subscription = this.workAllocationService.assignAndCompleteTask(task.id).subscribe(response => {
|
|
25602
|
-
// Emit event can be completed event
|
|
25603
|
-
this.parentComponent.eventCanBeCompleted.emit(true);
|
|
25604
|
-
}, error => {
|
|
25605
|
-
// Emit event cannot be completed event
|
|
25606
|
-
this.parentComponent.eventCanBeCompleted.emit(false);
|
|
25607
|
-
this.alertService.error(error.message);
|
|
25608
|
-
return throwError(error);
|
|
25609
|
-
});
|
|
25650
|
+
this.sessionStorageService.setItem('assignNeeded', 'true');
|
|
25651
|
+
// set event can be completed to true
|
|
25652
|
+
this.parentComponent.eventCanBeCompleted.emit(true);
|
|
25610
25653
|
}
|
|
25611
25654
|
else {
|
|
25612
25655
|
// Emit event cannot be completed event
|