@hmcts/ccd-case-ui-toolkit 6.14.5-activity-tracker → 6.14.5-activity-tracker-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/bundles/hmcts-ccd-case-ui-toolkit.umd.js +220 -218
- package/bundles/hmcts-ccd-case-ui-toolkit.umd.js.map +1 -1
- package/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js +1 -1
- package/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js.map +1 -1
- package/esm2015/lib/app.config.js +1 -1
- package/esm2015/lib/shared/components/case-editor/services/cases.service.js +4 -7
- package/esm2015/lib/shared/components/palette/base-field/payment-field.component.js +4 -1
- package/esm2015/lib/shared/components/palette/payment/case-payment-history-viewer-field.component.js +3 -3
- package/esm2015/lib/shared/components/palette/waystopay/waystopay-field.component.js +4 -4
- package/fesm2015/hmcts-ccd-case-ui-toolkit.js +212 -210
- package/fesm2015/hmcts-ccd-case-ui-toolkit.js.map +1 -1
- package/lib/app.config.d.ts +2 -0
- package/lib/app.config.d.ts.map +1 -1
- package/lib/shared/components/case-editor/services/cases.service.d.ts +1 -3
- package/lib/shared/components/case-editor/services/cases.service.d.ts.map +1 -1
- package/lib/shared/components/palette/base-field/payment-field.component.d.ts +1 -0
- package/lib/shared/components/palette/base-field/payment-field.component.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -7569,215 +7569,13 @@ WizardPageFieldToCaseFieldMapper.ɵprov = i0.ɵɵdefineInjectable({ token: Wizar
|
|
|
7569
7569
|
}]
|
|
7570
7570
|
}], null, null); })();
|
|
7571
7571
|
|
|
7572
|
-
const MULTIPLE_TASKS_FOUND = 'More than one task found!';
|
|
7573
|
-
class WorkAllocationService {
|
|
7574
|
-
constructor(http, appConfig, errorService, alertService, sessionStorageService) {
|
|
7575
|
-
this.http = http;
|
|
7576
|
-
this.appConfig = appConfig;
|
|
7577
|
-
this.errorService = errorService;
|
|
7578
|
-
this.alertService = alertService;
|
|
7579
|
-
this.sessionStorageService = sessionStorageService;
|
|
7580
|
-
// Check to see if work allocation is enabled
|
|
7581
|
-
}
|
|
7582
|
-
/**
|
|
7583
|
-
* Call the API to get tasks matching the search criteria.
|
|
7584
|
-
* @param searchRequest The search parameters that specify which tasks to match.
|
|
7585
|
-
*/
|
|
7586
|
-
searchTasks(searchRequest) {
|
|
7587
|
-
// Do not need to check if WA enabled as parent method will do that
|
|
7588
|
-
const url = `${this.appConfig.getWorkAllocationApiUrl()}/searchForCompletable`;
|
|
7589
|
-
return this.http
|
|
7590
|
-
.post(url, { searchRequest }, null, false)
|
|
7591
|
-
.pipe(map(response => response), catchError(error => {
|
|
7592
|
-
this.errorService.setError(error);
|
|
7593
|
-
// explicitly eat away 401 error and 400 error
|
|
7594
|
-
if (error && error.status && (error.status === 401 || error.status === 400)) {
|
|
7595
|
-
// do nothing
|
|
7596
|
-
console.log('error status 401 or 400', error);
|
|
7597
|
-
}
|
|
7598
|
-
else {
|
|
7599
|
-
return throwError(error);
|
|
7600
|
-
}
|
|
7601
|
-
}));
|
|
7602
|
-
}
|
|
7603
|
-
isWAEnabled(jurisdiction, caseType) {
|
|
7604
|
-
this.features = this.appConfig.getWAServiceConfig();
|
|
7605
|
-
let enabled = false;
|
|
7606
|
-
if (!jurisdiction || !caseType) {
|
|
7607
|
-
const caseInfo = JSON.parse(this.sessionStorageService.getItem('caseInfo'));
|
|
7608
|
-
jurisdiction = caseInfo.jurisdiction;
|
|
7609
|
-
caseType = caseInfo.caseType;
|
|
7610
|
-
}
|
|
7611
|
-
if (!this.features || !this.features.configurations) {
|
|
7612
|
-
return false;
|
|
7613
|
-
}
|
|
7614
|
-
this.features.configurations.forEach(serviceConfig => {
|
|
7615
|
-
if (serviceConfig.serviceName === jurisdiction && (serviceConfig.caseTypes.indexOf(caseType) !== -1)) {
|
|
7616
|
-
enabled = true;
|
|
7617
|
-
}
|
|
7618
|
-
});
|
|
7619
|
-
return enabled;
|
|
7620
|
-
}
|
|
7621
|
-
/**
|
|
7622
|
-
* Call the API to assign a task.
|
|
7623
|
-
* @param taskId specifies which task should be assigned.
|
|
7624
|
-
* @param userId specifies the user the task should be assigned to.
|
|
7625
|
-
*/
|
|
7626
|
-
assignTask(taskId, userId) {
|
|
7627
|
-
if (!this.isWAEnabled()) {
|
|
7628
|
-
return of(null);
|
|
7629
|
-
}
|
|
7630
|
-
const url = `${this.appConfig.getWorkAllocationApiUrl()}/task/${taskId}/assign`;
|
|
7631
|
-
return this.http
|
|
7632
|
-
.post(url, { userId })
|
|
7633
|
-
.pipe(catchError(error => {
|
|
7634
|
-
this.errorService.setError(error);
|
|
7635
|
-
return throwError(error);
|
|
7636
|
-
}));
|
|
7637
|
-
}
|
|
7638
|
-
/**
|
|
7639
|
-
* Call the API to complete a task.
|
|
7640
|
-
* @param taskId specifies which task should be completed.
|
|
7641
|
-
*/
|
|
7642
|
-
completeTask(taskId) {
|
|
7643
|
-
if (!this.isWAEnabled()) {
|
|
7644
|
-
return of(null);
|
|
7645
|
-
}
|
|
7646
|
-
const url = `${this.appConfig.getWorkAllocationApiUrl()}/task/${taskId}/complete`;
|
|
7647
|
-
return this.http
|
|
7648
|
-
.post(url, {})
|
|
7649
|
-
.pipe(catchError(error => {
|
|
7650
|
-
this.errorService.setError(error);
|
|
7651
|
-
// this will subscribe to get the user details and decide whether to display an error message
|
|
7652
|
-
this.http.get(this.appConfig.getUserInfoApiUrl()).pipe(map(response => response)).subscribe((response) => {
|
|
7653
|
-
this.handleTaskCompletionError(response);
|
|
7654
|
-
});
|
|
7655
|
-
return throwError(error);
|
|
7656
|
-
}));
|
|
7657
|
-
}
|
|
7658
|
-
/**
|
|
7659
|
-
* Call the API to assign and complete a task.
|
|
7660
|
-
* @param taskId specifies which task should be completed.
|
|
7661
|
-
*/
|
|
7662
|
-
assignAndCompleteTask(taskId) {
|
|
7663
|
-
if (!this.isWAEnabled()) {
|
|
7664
|
-
return of(null);
|
|
7665
|
-
}
|
|
7666
|
-
const url = `${this.appConfig.getWorkAllocationApiUrl()}/task/${taskId}/complete`;
|
|
7667
|
-
return this.http
|
|
7668
|
-
.post(url, {
|
|
7669
|
-
completion_options: {
|
|
7670
|
-
assign_and_complete: true
|
|
7671
|
-
}
|
|
7672
|
-
})
|
|
7673
|
-
.pipe(catchError(error => {
|
|
7674
|
-
this.errorService.setError(error);
|
|
7675
|
-
// this will subscribe to get the user details and decide whether to display an error message
|
|
7676
|
-
this.http.get(this.appConfig.getUserInfoApiUrl()).pipe(map(response => response)).subscribe((response) => {
|
|
7677
|
-
this.handleTaskCompletionError(response);
|
|
7678
|
-
});
|
|
7679
|
-
return throwError(error);
|
|
7680
|
-
}));
|
|
7681
|
-
}
|
|
7682
|
-
/**
|
|
7683
|
-
* Handles the response from the observable to get the user details when task is completed.
|
|
7684
|
-
* @param response is the response given from the observable which contains the user detaild.
|
|
7685
|
-
*/
|
|
7686
|
-
handleTaskCompletionError(response) {
|
|
7687
|
-
const userDetails = response;
|
|
7688
|
-
if (this.userIsCaseworker(userDetails.userInfo.roles)) {
|
|
7689
|
-
// when submitting the completion of task if not yet rendered cases/case confirm then preserve the alert for re-rendering
|
|
7690
|
-
this.alertService.setPreserveAlerts(true, ['cases/case', 'submit']);
|
|
7691
|
-
this.alertService.warning('A task could not be completed successfully. Please complete the task associated with the case manually.');
|
|
7692
|
-
}
|
|
7693
|
-
}
|
|
7694
|
-
/**
|
|
7695
|
-
* Returns true if the user's role is equivalent to a caseworker.
|
|
7696
|
-
* @param roles is the list of roles found from the current user.
|
|
7697
|
-
*/
|
|
7698
|
-
userIsCaseworker(roles) {
|
|
7699
|
-
const lowerCaseRoles = roles.map(role => role.toLowerCase());
|
|
7700
|
-
// When/if lib & target permanently change to es2016, replace indexOf with includes
|
|
7701
|
-
return (lowerCaseRoles.indexOf(WorkAllocationService.iACCaseOfficer) !== -1)
|
|
7702
|
-
|| (lowerCaseRoles.indexOf(WorkAllocationService.iACAdmOfficer) !== -1);
|
|
7703
|
-
}
|
|
7704
|
-
/**
|
|
7705
|
-
* Look for open tasks for a case and event combination. There are 5 possible scenarios:
|
|
7706
|
-
* 1. No tasks found => Success.
|
|
7707
|
-
* 2. One task found => Mark as done => Success.
|
|
7708
|
-
* 3. One task found => Mark as done throws error => Failure.
|
|
7709
|
-
* 4. More than one task found => Failure.
|
|
7710
|
-
* 5. Search call throws an error => Failure.
|
|
7711
|
-
* @param ccdId The ID of the case to find tasks for.
|
|
7712
|
-
* @param eventId The ID of the event to find tasks for.
|
|
7713
|
-
*/
|
|
7714
|
-
completeAppropriateTask(ccdId, eventId, jurisdiction, caseTypeId) {
|
|
7715
|
-
if (!this.isWAEnabled(jurisdiction, caseTypeId)) {
|
|
7716
|
-
return of(null);
|
|
7717
|
-
}
|
|
7718
|
-
const taskSearchParameter = {
|
|
7719
|
-
ccdId,
|
|
7720
|
-
eventId,
|
|
7721
|
-
jurisdiction,
|
|
7722
|
-
caseTypeId
|
|
7723
|
-
};
|
|
7724
|
-
return this.searchTasks(taskSearchParameter)
|
|
7725
|
-
.pipe(map((response) => {
|
|
7726
|
-
const tasks = response.tasks;
|
|
7727
|
-
if (tasks && tasks.length > 0) {
|
|
7728
|
-
if (tasks.length === 1) {
|
|
7729
|
-
this.completeTask(tasks[0].id).subscribe();
|
|
7730
|
-
}
|
|
7731
|
-
else {
|
|
7732
|
-
// This is a problem. Throw an appropriate error.
|
|
7733
|
-
throw new Error(MULTIPLE_TASKS_FOUND);
|
|
7734
|
-
}
|
|
7735
|
-
}
|
|
7736
|
-
return true; // All good. Nothing to see here.
|
|
7737
|
-
}), catchError(error => {
|
|
7738
|
-
// Simply rethrow it.
|
|
7739
|
-
return throwError(error);
|
|
7740
|
-
}));
|
|
7741
|
-
}
|
|
7742
|
-
/**
|
|
7743
|
-
* Return tasks for case and event.
|
|
7744
|
-
*/
|
|
7745
|
-
getTasksByCaseIdAndEventId(eventId, caseId, caseType, jurisdiction) {
|
|
7746
|
-
const defaultPayload = {
|
|
7747
|
-
task_required_for_event: false,
|
|
7748
|
-
tasks: []
|
|
7749
|
-
};
|
|
7750
|
-
if (!this.isWAEnabled()) {
|
|
7751
|
-
return of(defaultPayload);
|
|
7752
|
-
}
|
|
7753
|
-
return this.http.get(`${this.appConfig.getWorkAllocationApiUrl()}/case/tasks/${caseId}/event/${eventId}/caseType/${caseType}/jurisdiction/${jurisdiction}`);
|
|
7754
|
-
}
|
|
7755
|
-
/**
|
|
7756
|
-
* Call the API to get a task
|
|
7757
|
-
*/
|
|
7758
|
-
getTask(taskId) {
|
|
7759
|
-
if (!this.isWAEnabled()) {
|
|
7760
|
-
return of({ task: null });
|
|
7761
|
-
}
|
|
7762
|
-
return this.http.get(`${this.appConfig.getWorkAllocationApiUrl()}/task/${taskId}`);
|
|
7763
|
-
}
|
|
7764
|
-
}
|
|
7765
|
-
WorkAllocationService.iACCaseOfficer = 'caseworker-ia-caseofficer';
|
|
7766
|
-
WorkAllocationService.iACAdmOfficer = 'caseworker-ia-admofficer';
|
|
7767
|
-
WorkAllocationService.ɵfac = function WorkAllocationService_Factory(t) { return new (t || WorkAllocationService)(i0.ɵɵinject(HttpService), i0.ɵɵinject(AbstractAppConfig), i0.ɵɵinject(HttpErrorService), i0.ɵɵinject(AlertService), i0.ɵɵinject(SessionStorageService)); };
|
|
7768
|
-
WorkAllocationService.ɵprov = i0.ɵɵdefineInjectable({ token: WorkAllocationService, factory: WorkAllocationService.ɵfac });
|
|
7769
|
-
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(WorkAllocationService, [{
|
|
7770
|
-
type: Injectable
|
|
7771
|
-
}], function () { return [{ type: HttpService }, { type: AbstractAppConfig }, { type: HttpErrorService }, { type: AlertService }, { type: SessionStorageService }]; }, null); })();
|
|
7772
|
-
|
|
7773
7572
|
class CasesService {
|
|
7774
|
-
constructor(http, appConfig, orderService, errorService, wizardPageFieldToCaseFieldMapper,
|
|
7573
|
+
constructor(http, appConfig, orderService, errorService, wizardPageFieldToCaseFieldMapper, loadingService, sessionStorageService) {
|
|
7775
7574
|
this.http = http;
|
|
7776
7575
|
this.appConfig = appConfig;
|
|
7777
7576
|
this.orderService = orderService;
|
|
7778
7577
|
this.errorService = errorService;
|
|
7779
7578
|
this.wizardPageFieldToCaseFieldMapper = wizardPageFieldToCaseFieldMapper;
|
|
7780
|
-
this.workAllocationService = workAllocationService;
|
|
7781
7579
|
this.loadingService = loadingService;
|
|
7782
7580
|
this.sessionStorageService = sessionStorageService;
|
|
7783
7581
|
this.get = this.getCaseView;
|
|
@@ -7995,11 +7793,11 @@ CasesService.V2_MEDIATYPE_CASE_DATA_VALIDATE = 'application/vnd.uk.gov.hmcts.ccd
|
|
|
7995
7793
|
CasesService.V2_MEDIATYPE_CREATE_EVENT = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.create-event.v2+json;charset=UTF-8';
|
|
7996
7794
|
CasesService.V2_MEDIATYPE_CREATE_CASE = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.create-case.v2+json;charset=UTF-8';
|
|
7997
7795
|
CasesService.PUI_CASE_MANAGER = 'pui-case-manager';
|
|
7998
|
-
CasesService.ɵfac = function CasesService_Factory(t) { return new (t || CasesService)(i0.ɵɵinject(HttpService), i0.ɵɵinject(AbstractAppConfig), i0.ɵɵinject(OrderService), i0.ɵɵinject(HttpErrorService), i0.ɵɵinject(WizardPageFieldToCaseFieldMapper), i0.ɵɵinject(
|
|
7796
|
+
CasesService.ɵfac = function CasesService_Factory(t) { return new (t || CasesService)(i0.ɵɵinject(HttpService), i0.ɵɵinject(AbstractAppConfig), i0.ɵɵinject(OrderService), i0.ɵɵinject(HttpErrorService), i0.ɵɵinject(WizardPageFieldToCaseFieldMapper), i0.ɵɵinject(LoadingService), i0.ɵɵinject(SessionStorageService)); };
|
|
7999
7797
|
CasesService.ɵprov = i0.ɵɵdefineInjectable({ token: CasesService, factory: CasesService.ɵfac });
|
|
8000
7798
|
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CasesService, [{
|
|
8001
7799
|
type: Injectable
|
|
8002
|
-
}], function () { return [{ type: HttpService }, { type: AbstractAppConfig }, { type: OrderService }, { type: HttpErrorService }, { type: WizardPageFieldToCaseFieldMapper }, { type:
|
|
7800
|
+
}], function () { return [{ type: HttpService }, { type: AbstractAppConfig }, { type: OrderService }, { type: HttpErrorService }, { type: WizardPageFieldToCaseFieldMapper }, { type: LoadingService }, { type: SessionStorageService }]; }, null); })();
|
|
8003
7801
|
|
|
8004
7802
|
class EventTriggerService {
|
|
8005
7803
|
constructor() {
|
|
@@ -8602,6 +8400,207 @@ PageValidationService.ɵprov = i0.ɵɵdefineInjectable({ token: PageValidationSe
|
|
|
8602
8400
|
type: Injectable
|
|
8603
8401
|
}], function () { return [{ type: CaseFieldService }]; }, null); })();
|
|
8604
8402
|
|
|
8403
|
+
const MULTIPLE_TASKS_FOUND = 'More than one task found!';
|
|
8404
|
+
class WorkAllocationService {
|
|
8405
|
+
constructor(http, appConfig, errorService, alertService, sessionStorageService) {
|
|
8406
|
+
this.http = http;
|
|
8407
|
+
this.appConfig = appConfig;
|
|
8408
|
+
this.errorService = errorService;
|
|
8409
|
+
this.alertService = alertService;
|
|
8410
|
+
this.sessionStorageService = sessionStorageService;
|
|
8411
|
+
// Check to see if work allocation is enabled
|
|
8412
|
+
}
|
|
8413
|
+
/**
|
|
8414
|
+
* Call the API to get tasks matching the search criteria.
|
|
8415
|
+
* @param searchRequest The search parameters that specify which tasks to match.
|
|
8416
|
+
*/
|
|
8417
|
+
searchTasks(searchRequest) {
|
|
8418
|
+
// Do not need to check if WA enabled as parent method will do that
|
|
8419
|
+
const url = `${this.appConfig.getWorkAllocationApiUrl()}/searchForCompletable`;
|
|
8420
|
+
return this.http
|
|
8421
|
+
.post(url, { searchRequest }, null, false)
|
|
8422
|
+
.pipe(map(response => response), catchError(error => {
|
|
8423
|
+
this.errorService.setError(error);
|
|
8424
|
+
// explicitly eat away 401 error and 400 error
|
|
8425
|
+
if (error && error.status && (error.status === 401 || error.status === 400)) {
|
|
8426
|
+
// do nothing
|
|
8427
|
+
console.log('error status 401 or 400', error);
|
|
8428
|
+
}
|
|
8429
|
+
else {
|
|
8430
|
+
return throwError(error);
|
|
8431
|
+
}
|
|
8432
|
+
}));
|
|
8433
|
+
}
|
|
8434
|
+
isWAEnabled(jurisdiction, caseType) {
|
|
8435
|
+
this.features = this.appConfig.getWAServiceConfig();
|
|
8436
|
+
let enabled = false;
|
|
8437
|
+
if (!jurisdiction || !caseType) {
|
|
8438
|
+
const caseInfo = JSON.parse(this.sessionStorageService.getItem('caseInfo'));
|
|
8439
|
+
jurisdiction = caseInfo.jurisdiction;
|
|
8440
|
+
caseType = caseInfo.caseType;
|
|
8441
|
+
}
|
|
8442
|
+
if (!this.features || !this.features.configurations) {
|
|
8443
|
+
return false;
|
|
8444
|
+
}
|
|
8445
|
+
this.features.configurations.forEach(serviceConfig => {
|
|
8446
|
+
if (serviceConfig.serviceName === jurisdiction && (serviceConfig.caseTypes.indexOf(caseType) !== -1)) {
|
|
8447
|
+
enabled = true;
|
|
8448
|
+
}
|
|
8449
|
+
});
|
|
8450
|
+
return enabled;
|
|
8451
|
+
}
|
|
8452
|
+
/**
|
|
8453
|
+
* Call the API to assign a task.
|
|
8454
|
+
* @param taskId specifies which task should be assigned.
|
|
8455
|
+
* @param userId specifies the user the task should be assigned to.
|
|
8456
|
+
*/
|
|
8457
|
+
assignTask(taskId, userId) {
|
|
8458
|
+
if (!this.isWAEnabled()) {
|
|
8459
|
+
return of(null);
|
|
8460
|
+
}
|
|
8461
|
+
const url = `${this.appConfig.getWorkAllocationApiUrl()}/task/${taskId}/assign`;
|
|
8462
|
+
return this.http
|
|
8463
|
+
.post(url, { userId })
|
|
8464
|
+
.pipe(catchError(error => {
|
|
8465
|
+
this.errorService.setError(error);
|
|
8466
|
+
return throwError(error);
|
|
8467
|
+
}));
|
|
8468
|
+
}
|
|
8469
|
+
/**
|
|
8470
|
+
* Call the API to complete a task.
|
|
8471
|
+
* @param taskId specifies which task should be completed.
|
|
8472
|
+
*/
|
|
8473
|
+
completeTask(taskId) {
|
|
8474
|
+
if (!this.isWAEnabled()) {
|
|
8475
|
+
return of(null);
|
|
8476
|
+
}
|
|
8477
|
+
const url = `${this.appConfig.getWorkAllocationApiUrl()}/task/${taskId}/complete`;
|
|
8478
|
+
return this.http
|
|
8479
|
+
.post(url, {})
|
|
8480
|
+
.pipe(catchError(error => {
|
|
8481
|
+
this.errorService.setError(error);
|
|
8482
|
+
// this will subscribe to get the user details and decide whether to display an error message
|
|
8483
|
+
this.http.get(this.appConfig.getUserInfoApiUrl()).pipe(map(response => response)).subscribe((response) => {
|
|
8484
|
+
this.handleTaskCompletionError(response);
|
|
8485
|
+
});
|
|
8486
|
+
return throwError(error);
|
|
8487
|
+
}));
|
|
8488
|
+
}
|
|
8489
|
+
/**
|
|
8490
|
+
* Call the API to assign and complete a task.
|
|
8491
|
+
* @param taskId specifies which task should be completed.
|
|
8492
|
+
*/
|
|
8493
|
+
assignAndCompleteTask(taskId) {
|
|
8494
|
+
if (!this.isWAEnabled()) {
|
|
8495
|
+
return of(null);
|
|
8496
|
+
}
|
|
8497
|
+
const url = `${this.appConfig.getWorkAllocationApiUrl()}/task/${taskId}/complete`;
|
|
8498
|
+
return this.http
|
|
8499
|
+
.post(url, {
|
|
8500
|
+
completion_options: {
|
|
8501
|
+
assign_and_complete: true
|
|
8502
|
+
}
|
|
8503
|
+
})
|
|
8504
|
+
.pipe(catchError(error => {
|
|
8505
|
+
this.errorService.setError(error);
|
|
8506
|
+
// this will subscribe to get the user details and decide whether to display an error message
|
|
8507
|
+
this.http.get(this.appConfig.getUserInfoApiUrl()).pipe(map(response => response)).subscribe((response) => {
|
|
8508
|
+
this.handleTaskCompletionError(response);
|
|
8509
|
+
});
|
|
8510
|
+
return throwError(error);
|
|
8511
|
+
}));
|
|
8512
|
+
}
|
|
8513
|
+
/**
|
|
8514
|
+
* Handles the response from the observable to get the user details when task is completed.
|
|
8515
|
+
* @param response is the response given from the observable which contains the user detaild.
|
|
8516
|
+
*/
|
|
8517
|
+
handleTaskCompletionError(response) {
|
|
8518
|
+
const userDetails = response;
|
|
8519
|
+
if (this.userIsCaseworker(userDetails.userInfo.roles)) {
|
|
8520
|
+
// when submitting the completion of task if not yet rendered cases/case confirm then preserve the alert for re-rendering
|
|
8521
|
+
this.alertService.setPreserveAlerts(true, ['cases/case', 'submit']);
|
|
8522
|
+
this.alertService.warning('A task could not be completed successfully. Please complete the task associated with the case manually.');
|
|
8523
|
+
}
|
|
8524
|
+
}
|
|
8525
|
+
/**
|
|
8526
|
+
* Returns true if the user's role is equivalent to a caseworker.
|
|
8527
|
+
* @param roles is the list of roles found from the current user.
|
|
8528
|
+
*/
|
|
8529
|
+
userIsCaseworker(roles) {
|
|
8530
|
+
const lowerCaseRoles = roles.map(role => role.toLowerCase());
|
|
8531
|
+
// When/if lib & target permanently change to es2016, replace indexOf with includes
|
|
8532
|
+
return (lowerCaseRoles.indexOf(WorkAllocationService.iACCaseOfficer) !== -1)
|
|
8533
|
+
|| (lowerCaseRoles.indexOf(WorkAllocationService.iACAdmOfficer) !== -1);
|
|
8534
|
+
}
|
|
8535
|
+
/**
|
|
8536
|
+
* Look for open tasks for a case and event combination. There are 5 possible scenarios:
|
|
8537
|
+
* 1. No tasks found => Success.
|
|
8538
|
+
* 2. One task found => Mark as done => Success.
|
|
8539
|
+
* 3. One task found => Mark as done throws error => Failure.
|
|
8540
|
+
* 4. More than one task found => Failure.
|
|
8541
|
+
* 5. Search call throws an error => Failure.
|
|
8542
|
+
* @param ccdId The ID of the case to find tasks for.
|
|
8543
|
+
* @param eventId The ID of the event to find tasks for.
|
|
8544
|
+
*/
|
|
8545
|
+
completeAppropriateTask(ccdId, eventId, jurisdiction, caseTypeId) {
|
|
8546
|
+
if (!this.isWAEnabled(jurisdiction, caseTypeId)) {
|
|
8547
|
+
return of(null);
|
|
8548
|
+
}
|
|
8549
|
+
const taskSearchParameter = {
|
|
8550
|
+
ccdId,
|
|
8551
|
+
eventId,
|
|
8552
|
+
jurisdiction,
|
|
8553
|
+
caseTypeId
|
|
8554
|
+
};
|
|
8555
|
+
return this.searchTasks(taskSearchParameter)
|
|
8556
|
+
.pipe(map((response) => {
|
|
8557
|
+
const tasks = response.tasks;
|
|
8558
|
+
if (tasks && tasks.length > 0) {
|
|
8559
|
+
if (tasks.length === 1) {
|
|
8560
|
+
this.completeTask(tasks[0].id).subscribe();
|
|
8561
|
+
}
|
|
8562
|
+
else {
|
|
8563
|
+
// This is a problem. Throw an appropriate error.
|
|
8564
|
+
throw new Error(MULTIPLE_TASKS_FOUND);
|
|
8565
|
+
}
|
|
8566
|
+
}
|
|
8567
|
+
return true; // All good. Nothing to see here.
|
|
8568
|
+
}), catchError(error => {
|
|
8569
|
+
// Simply rethrow it.
|
|
8570
|
+
return throwError(error);
|
|
8571
|
+
}));
|
|
8572
|
+
}
|
|
8573
|
+
/**
|
|
8574
|
+
* Return tasks for case and event.
|
|
8575
|
+
*/
|
|
8576
|
+
getTasksByCaseIdAndEventId(eventId, caseId, caseType, jurisdiction) {
|
|
8577
|
+
const defaultPayload = {
|
|
8578
|
+
task_required_for_event: false,
|
|
8579
|
+
tasks: []
|
|
8580
|
+
};
|
|
8581
|
+
if (!this.isWAEnabled()) {
|
|
8582
|
+
return of(defaultPayload);
|
|
8583
|
+
}
|
|
8584
|
+
return this.http.get(`${this.appConfig.getWorkAllocationApiUrl()}/case/tasks/${caseId}/event/${eventId}/caseType/${caseType}/jurisdiction/${jurisdiction}`);
|
|
8585
|
+
}
|
|
8586
|
+
/**
|
|
8587
|
+
* Call the API to get a task
|
|
8588
|
+
*/
|
|
8589
|
+
getTask(taskId) {
|
|
8590
|
+
if (!this.isWAEnabled()) {
|
|
8591
|
+
return of({ task: null });
|
|
8592
|
+
}
|
|
8593
|
+
return this.http.get(`${this.appConfig.getWorkAllocationApiUrl()}/task/${taskId}`);
|
|
8594
|
+
}
|
|
8595
|
+
}
|
|
8596
|
+
WorkAllocationService.iACCaseOfficer = 'caseworker-ia-caseofficer';
|
|
8597
|
+
WorkAllocationService.iACAdmOfficer = 'caseworker-ia-admofficer';
|
|
8598
|
+
WorkAllocationService.ɵfac = function WorkAllocationService_Factory(t) { return new (t || WorkAllocationService)(i0.ɵɵinject(HttpService), i0.ɵɵinject(AbstractAppConfig), i0.ɵɵinject(HttpErrorService), i0.ɵɵinject(AlertService), i0.ɵɵinject(SessionStorageService)); };
|
|
8599
|
+
WorkAllocationService.ɵprov = i0.ɵɵdefineInjectable({ token: WorkAllocationService, factory: WorkAllocationService.ɵfac });
|
|
8600
|
+
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(WorkAllocationService, [{
|
|
8601
|
+
type: Injectable
|
|
8602
|
+
}], function () { return [{ type: HttpService }, { type: AbstractAppConfig }, { type: HttpErrorService }, { type: AlertService }, { type: SessionStorageService }]; }, null); })();
|
|
8603
|
+
|
|
8605
8604
|
class CaseEditComponent {
|
|
8606
8605
|
constructor(fb, router, route, fieldsUtils, fieldsPurger, registrarService, wizardFactory, sessionStorageService, windowsService) {
|
|
8607
8606
|
this.fb = fb;
|
|
@@ -17143,6 +17142,9 @@ class PaymentField extends AbstractFieldReadComponent {
|
|
|
17143
17142
|
getRefundsUrl() {
|
|
17144
17143
|
return this.appConfig.getRefundsUrl();
|
|
17145
17144
|
}
|
|
17145
|
+
getNotificationUrl() {
|
|
17146
|
+
return this.appConfig.getNotificationUrl();
|
|
17147
|
+
}
|
|
17146
17148
|
getUserRoles() {
|
|
17147
17149
|
const userDetails = JSON.parse(this.sessionStorage.getItem('userDetails') || null);
|
|
17148
17150
|
if (!userDetails || !userDetails.hasOwnProperty('roles')) {
|
|
@@ -17165,10 +17167,10 @@ class CasePaymentHistoryViewerFieldComponent extends PaymentField {
|
|
|
17165
17167
|
}
|
|
17166
17168
|
}
|
|
17167
17169
|
CasePaymentHistoryViewerFieldComponent.ɵfac = function CasePaymentHistoryViewerFieldComponent_Factory(t) { return new (t || CasePaymentHistoryViewerFieldComponent)(i0.ɵɵdirectiveInject(AbstractAppConfig), i0.ɵɵdirectiveInject(SessionStorageService)); };
|
|
17168
|
-
CasePaymentHistoryViewerFieldComponent.ɵcmp = i0.ɵɵdefineComponent({ type: CasePaymentHistoryViewerFieldComponent, selectors: [["ccd-case-payment-history-viewer-field"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 1, vars:
|
|
17170
|
+
CasePaymentHistoryViewerFieldComponent.ɵcmp = i0.ɵɵdefineComponent({ type: CasePaymentHistoryViewerFieldComponent, selectors: [["ccd-case-payment-history-viewer-field"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 1, vars: 16, consts: [[3, "API_ROOT", "CCD_CASE_NUMBER", "BULKSCAN_API_ROOT", "SELECTED_OPTION", "ISBSENABLE", "LOGGEDINUSEREMAIL", "LOGGEDINUSERROLES", "REFUNDS_API_ROOT", "NOTIFICATION_API_ROOT", "VIEW", "TAKEPAYMENT", "SERVICEREQUEST", "PAYMENT_GROUP_REF", "EXC_REFERENCE", "DCN_NUMBER", "ISPAYMENTSTATUSENABLED"]], template: function CasePaymentHistoryViewerFieldComponent_Template(rf, ctx) { if (rf & 1) {
|
|
17169
17171
|
i0.ɵɵelement(0, "ccpay-payment-lib", 0);
|
|
17170
17172
|
} if (rf & 2) {
|
|
17171
|
-
i0.ɵɵproperty("API_ROOT", ctx.getBaseURL())("CCD_CASE_NUMBER", ctx.caseReference)("BULKSCAN_API_ROOT", ctx.getPayBulkScanBaseURL())("SELECTED_OPTION", "CCDorException")("ISBSENABLE", "true")("LOGGEDINUSEREMAIL", ctx.getUserEmail())("LOGGEDINUSERROLES", ctx.getUserRoles())("REFUNDS_API_ROOT", ctx.getRefundsUrl())("VIEW", "case-transactions")("TAKEPAYMENT", false)("SERVICEREQUEST", false)("PAYMENT_GROUP_REF", null)("EXC_REFERENCE", ctx.caseReference)("DCN_NUMBER", null)("ISPAYMENTSTATUSENABLED", "Enable");
|
|
17173
|
+
i0.ɵɵproperty("API_ROOT", ctx.getBaseURL())("CCD_CASE_NUMBER", ctx.caseReference)("BULKSCAN_API_ROOT", ctx.getPayBulkScanBaseURL())("SELECTED_OPTION", "CCDorException")("ISBSENABLE", "true")("LOGGEDINUSEREMAIL", ctx.getUserEmail())("LOGGEDINUSERROLES", ctx.getUserRoles())("REFUNDS_API_ROOT", ctx.getRefundsUrl())("NOTIFICATION_API_ROOT", ctx.getNotificationUrl())("VIEW", "case-transactions")("TAKEPAYMENT", false)("SERVICEREQUEST", false)("PAYMENT_GROUP_REF", null)("EXC_REFERENCE", ctx.caseReference)("DCN_NUMBER", null)("ISPAYMENTSTATUSENABLED", "Enable");
|
|
17172
17174
|
} }, directives: [i3.PaymentLibComponent], encapsulation: 2 });
|
|
17173
17175
|
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CasePaymentHistoryViewerFieldComponent, [{
|
|
17174
17176
|
type: Component,
|
|
@@ -17479,7 +17481,7 @@ function WaysToPayFieldComponent_ccpay_payment_lib_0_Template(rf, ctx) { if (rf
|
|
|
17479
17481
|
i0.ɵɵelement(0, "ccpay-payment-lib", 1);
|
|
17480
17482
|
} if (rf & 2) {
|
|
17481
17483
|
const ctx_r0 = i0.ɵɵnextContext();
|
|
17482
|
-
i0.ɵɵproperty("API_ROOT", ctx_r0.getBaseURL())("BULKSCAN_API_ROOT", ctx_r0.getPayBulkScanBaseURL())("REFUNDS_API_ROOT", ctx_r0.getRefundsUrl())("CCD_CASE_NUMBER", ctx_r0.caseReference)("VIEW", "case-transactions")("TAKEPAYMENT", false)("SERVICEREQUEST", true)("PAYMENT_GROUP_REF", null)("EXC_REFERENCE", ctx_r0.caseReference)("DCN_NUMBER", null)("SELECTED_OPTION", "CCDorException")("LOGGEDINUSERROLES", ctx_r0.getUserRoles())("CARDPAYMENTRETURNURL", ctx_r0.getCardPaymentReturnUrl())("ISPAYMENTSTATUSENABLED", "Enable");
|
|
17484
|
+
i0.ɵɵproperty("API_ROOT", ctx_r0.getBaseURL())("BULKSCAN_API_ROOT", ctx_r0.getPayBulkScanBaseURL())("REFUNDS_API_ROOT", ctx_r0.getRefundsUrl())("NOTIFICATION_API_ROOT", ctx_r0.getNotificationUrl())("CCD_CASE_NUMBER", ctx_r0.caseReference)("VIEW", "case-transactions")("TAKEPAYMENT", false)("SERVICEREQUEST", true)("PAYMENT_GROUP_REF", null)("EXC_REFERENCE", ctx_r0.caseReference)("DCN_NUMBER", null)("SELECTED_OPTION", "CCDorException")("LOGGEDINUSERROLES", ctx_r0.getUserRoles())("CARDPAYMENTRETURNURL", ctx_r0.getCardPaymentReturnUrl())("ISPAYMENTSTATUSENABLED", "Enable");
|
|
17483
17485
|
} }
|
|
17484
17486
|
class WaysToPayFieldComponent extends PaymentField {
|
|
17485
17487
|
constructor(appConfig, sessionStorage) {
|
|
@@ -17490,8 +17492,8 @@ class WaysToPayFieldComponent extends PaymentField {
|
|
|
17490
17492
|
}
|
|
17491
17493
|
}
|
|
17492
17494
|
WaysToPayFieldComponent.ɵfac = function WaysToPayFieldComponent_Factory(t) { return new (t || WaysToPayFieldComponent)(i0.ɵɵdirectiveInject(AbstractAppConfig), i0.ɵɵdirectiveInject(SessionStorageService)); };
|
|
17493
|
-
WaysToPayFieldComponent.ɵcmp = i0.ɵɵdefineComponent({ type: WaysToPayFieldComponent, selectors: [["ccd-ways-to-pay-field"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 1, vars: 1, consts: [[3, "API_ROOT", "BULKSCAN_API_ROOT", "REFUNDS_API_ROOT", "CCD_CASE_NUMBER", "VIEW", "TAKEPAYMENT", "SERVICEREQUEST", "PAYMENT_GROUP_REF", "EXC_REFERENCE", "DCN_NUMBER", "SELECTED_OPTION", "LOGGEDINUSERROLES", "CARDPAYMENTRETURNURL", "ISPAYMENTSTATUSENABLED", 4, "ngIf"], [3, "API_ROOT", "BULKSCAN_API_ROOT", "REFUNDS_API_ROOT", "CCD_CASE_NUMBER", "VIEW", "TAKEPAYMENT", "SERVICEREQUEST", "PAYMENT_GROUP_REF", "EXC_REFERENCE", "DCN_NUMBER", "SELECTED_OPTION", "LOGGEDINUSERROLES", "CARDPAYMENTRETURNURL", "ISPAYMENTSTATUSENABLED"]], template: function WaysToPayFieldComponent_Template(rf, ctx) { if (rf & 1) {
|
|
17494
|
-
i0.ɵɵtemplate(0, WaysToPayFieldComponent_ccpay_payment_lib_0_Template, 1,
|
|
17495
|
+
WaysToPayFieldComponent.ɵcmp = i0.ɵɵdefineComponent({ type: WaysToPayFieldComponent, selectors: [["ccd-ways-to-pay-field"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 1, vars: 1, consts: [[3, "API_ROOT", "BULKSCAN_API_ROOT", "REFUNDS_API_ROOT", "NOTIFICATION_API_ROOT", "CCD_CASE_NUMBER", "VIEW", "TAKEPAYMENT", "SERVICEREQUEST", "PAYMENT_GROUP_REF", "EXC_REFERENCE", "DCN_NUMBER", "SELECTED_OPTION", "LOGGEDINUSERROLES", "CARDPAYMENTRETURNURL", "ISPAYMENTSTATUSENABLED", 4, "ngIf"], [3, "API_ROOT", "BULKSCAN_API_ROOT", "REFUNDS_API_ROOT", "NOTIFICATION_API_ROOT", "CCD_CASE_NUMBER", "VIEW", "TAKEPAYMENT", "SERVICEREQUEST", "PAYMENT_GROUP_REF", "EXC_REFERENCE", "DCN_NUMBER", "SELECTED_OPTION", "LOGGEDINUSERROLES", "CARDPAYMENTRETURNURL", "ISPAYMENTSTATUSENABLED"]], template: function WaysToPayFieldComponent_Template(rf, ctx) { if (rf & 1) {
|
|
17496
|
+
i0.ɵɵtemplate(0, WaysToPayFieldComponent_ccpay_payment_lib_0_Template, 1, 15, "ccpay-payment-lib", 0);
|
|
17495
17497
|
} if (rf & 2) {
|
|
17496
17498
|
i0.ɵɵproperty("ngIf", ctx.getUserRoles().length > 0);
|
|
17497
17499
|
} }, directives: [i1.NgIf, i3.PaymentLibComponent], encapsulation: 2 });
|