@hmcts/ccd-case-ui-toolkit 6.10.7-rollback-case-link → 6.13.0-rc1
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 +381 -234
- 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/shared/components/case-viewer/case-full-access-view/case-full-access-view.component.js +15 -1
- package/esm2015/lib/shared/components/palette/case-file-view/components/case-file-view-folder-selector/case-file-view-folder-selector.component.js +1 -1
- package/esm2015/lib/shared/components/palette/case-flag/components/select-flag-type/select-flag-type.component.js +13 -15
- package/esm2015/lib/shared/components/palette/case-flag/write-case-flag-field.component.js +11 -8
- package/esm2015/lib/shared/components/palette/datetime-picker/datetime-picker.component.js +10 -3
- package/esm2015/lib/shared/components/search-result/search-result.component.js +10 -14
- package/esm2015/lib/shared/directives/conditional-show/domain/conditional-show.model.js +103 -200
- package/esm2015/lib/shared/directives/conditional-show/services/condition-parser.service.js +201 -0
- package/esm2015/lib/shared/directives/conditional-show/services/condition.peg.js +90 -0
- package/esm2015/lib/shared/domain/case-flag/hmcts-service-detail.model.js +1 -1
- package/esm2015/lib/shared/services/case-flag/case-flag-refdata.service.js +25 -4
- package/fesm2015/hmcts-ccd-case-ui-toolkit.js +443 -215
- package/fesm2015/hmcts-ccd-case-ui-toolkit.js.map +1 -1
- package/lib/shared/components/case-viewer/case-full-access-view/case-full-access-view.component.d.ts +1 -0
- package/lib/shared/components/case-viewer/case-full-access-view/case-full-access-view.component.d.ts.map +1 -1
- package/lib/shared/components/palette/case-flag/components/select-flag-type/select-flag-type.component.d.ts +2 -1
- package/lib/shared/components/palette/case-flag/components/select-flag-type/select-flag-type.component.d.ts.map +1 -1
- package/lib/shared/components/palette/case-flag/write-case-flag-field.component.d.ts +1 -0
- package/lib/shared/components/palette/case-flag/write-case-flag-field.component.d.ts.map +1 -1
- package/lib/shared/components/palette/datetime-picker/datetime-picker.component.d.ts.map +1 -1
- package/lib/shared/directives/conditional-show/domain/conditional-show.model.d.ts +13 -30
- package/lib/shared/directives/conditional-show/domain/conditional-show.model.d.ts.map +1 -1
- package/lib/shared/directives/conditional-show/services/condition-parser.service.d.ts +30 -0
- package/lib/shared/directives/conditional-show/services/condition-parser.service.d.ts.map +1 -0
- package/lib/shared/directives/conditional-show/services/condition.peg.d.ts +3 -0
- package/lib/shared/directives/conditional-show/services/condition.peg.d.ts.map +1 -0
- package/lib/shared/domain/case-flag/hmcts-service-detail.model.d.ts.map +1 -1
- package/lib/shared/services/case-flag/case-flag-refdata.service.d.ts +14 -3
- package/lib/shared/services/case-flag/case-flag-refdata.service.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -12,9 +12,10 @@ import * as i1$2 from '@angular/common/http';
|
|
|
12
12
|
import { HttpErrorResponse, HttpHeaders, HttpParams } from '@angular/common/http';
|
|
13
13
|
import { catchError, map, publish, refCount, debounceTime, delay, distinctUntilChanged, finalize, publishReplay, take, tap, first, switchMap, takeUntil, filter } from 'rxjs/operators';
|
|
14
14
|
import { Type, Expose, plainToClassFromExist, plainToClass } from 'class-transformer';
|
|
15
|
-
import * as _ from 'underscore';
|
|
16
15
|
import * as moment from 'moment';
|
|
17
16
|
import { __decorate, __metadata } from 'tslib';
|
|
17
|
+
import * as _ from 'underscore';
|
|
18
|
+
import { generate } from 'pegjs';
|
|
18
19
|
import { isUndefined } from 'util';
|
|
19
20
|
import { StateMachine } from '@edium/fsm';
|
|
20
21
|
import * as i1$3 from '@angular/material/dialog';
|
|
@@ -3799,168 +3800,152 @@ FieldsUtils.ɵprov = i0.ɵɵdefineInjectable({ token: FieldsUtils, factory: Fiel
|
|
|
3799
3800
|
type: Injectable
|
|
3800
3801
|
}], null, null); })();
|
|
3801
3802
|
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
}
|
|
3816
|
-
}
|
|
3817
|
-
static addPathPrefixToCondition(showCondition, pathPrefix) {
|
|
3818
|
-
if (!pathPrefix || pathPrefix === '') {
|
|
3819
|
-
return showCondition;
|
|
3820
|
-
}
|
|
3821
|
-
if (showCondition.search(ShowCondition.OR_CONDITION_REGEXP) !== -1) {
|
|
3822
|
-
let orConditions = showCondition.split(ShowCondition.OR_CONDITION_REGEXP);
|
|
3823
|
-
orConditions = this.extractConditions(orConditions, pathPrefix);
|
|
3824
|
-
return orConditions.join(' OR ');
|
|
3825
|
-
}
|
|
3826
|
-
else {
|
|
3827
|
-
let andConditions = showCondition.split(ShowCondition.AND_CONDITION_REGEXP);
|
|
3828
|
-
andConditions = this.extractConditions(andConditions, pathPrefix);
|
|
3829
|
-
return andConditions.join(' AND ');
|
|
3830
|
-
}
|
|
3803
|
+
const conditionSource = `{
|
|
3804
|
+
function flat(arr, depth = 1) {
|
|
3805
|
+
var flatten = function (arr, depth = 1) {
|
|
3806
|
+
if (depth) return arr;
|
|
3807
|
+
|
|
3808
|
+
// Otherwise, concatenate into the parent array
|
|
3809
|
+
return arr.reduce(function (acc, val) {
|
|
3810
|
+
return acc.concat(Array.isArray(val) ? flatten(val, depth - 1) : val);
|
|
3811
|
+
}, []);
|
|
3812
|
+
|
|
3813
|
+
};
|
|
3814
|
+
|
|
3815
|
+
return flatten(arr, depth - 1);
|
|
3831
3816
|
}
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3817
|
+
}
|
|
3818
|
+
|
|
3819
|
+
Start
|
|
3820
|
+
= Formula
|
|
3821
|
+
|
|
3822
|
+
Formula
|
|
3823
|
+
= EnclosedFormula
|
|
3824
|
+
/ OpenFormula
|
|
3825
|
+
|
|
3826
|
+
EnclosedFormula
|
|
3827
|
+
= bracket formula:OpenFormula bracket join:(JoinComparator)*
|
|
3828
|
+
{ return flat([ [formula], join[0] ], 1) }
|
|
3829
|
+
|
|
3830
|
+
OpenFormula
|
|
3831
|
+
= eq:OpenEqualityCheck joins:(JoinComparator)*
|
|
3832
|
+
{ return flat([ eq, flat(joins) ]) }
|
|
3833
|
+
|
|
3834
|
+
JoinComparator
|
|
3835
|
+
= comp:Comparator eq:OpenEqualityCheck
|
|
3836
|
+
{ return [comp, eq]; }
|
|
3837
|
+
/ CompoundJoinComparator
|
|
3838
|
+
|
|
3839
|
+
CompoundJoinComparator
|
|
3840
|
+
= comp:Comparator bracket f:OpenFormula bracket
|
|
3841
|
+
{ return [comp, f ] }
|
|
3842
|
+
|
|
3843
|
+
OpenEqualityCheck
|
|
3844
|
+
= fr:FieldReference _? op:operator _? val:Value
|
|
3845
|
+
{ return { fieldReference: fr, comparator: op, value: val } }
|
|
3846
|
+
|
|
3847
|
+
Comparator
|
|
3848
|
+
= _? c:'AND' _?
|
|
3849
|
+
{ return c; }
|
|
3850
|
+
/ _? c:'OR' _?
|
|
3851
|
+
{ return c; }
|
|
3852
|
+
|
|
3853
|
+
Word
|
|
3854
|
+
= l:Letter+
|
|
3855
|
+
{ return l.join(""); }
|
|
3856
|
+
|
|
3857
|
+
Letter
|
|
3858
|
+
= [a-zA-Z]
|
|
3859
|
+
|
|
3860
|
+
Value
|
|
3861
|
+
= v:quotedValue / v:Word
|
|
3862
|
+
{ return v.join("") }
|
|
3863
|
+
/ v:number
|
|
3864
|
+
{ return parseInt(v.join("")) }
|
|
3865
|
+
|
|
3866
|
+
FieldReference
|
|
3867
|
+
= characters:[A-Za-z0-9._]+ { return characters.join(""); }
|
|
3868
|
+
|
|
3869
|
+
number
|
|
3870
|
+
= [0-9]+
|
|
3871
|
+
|
|
3872
|
+
quotedValue
|
|
3873
|
+
= '"'val:[A-Za-z0-9.,* _-]*'"'
|
|
3874
|
+
{ return val.join(""); }
|
|
3875
|
+
|
|
3876
|
+
bracket
|
|
3877
|
+
= (_? "("+ _? / _? ")"+ _? )
|
|
3878
|
+
|
|
3879
|
+
operator
|
|
3880
|
+
= "=" / "!=" / "CONTAINS"
|
|
3881
|
+
|
|
3882
|
+
ws "Whitespace"
|
|
3883
|
+
= [ \t]
|
|
3884
|
+
|
|
3885
|
+
_ "One or more whitespaces"
|
|
3886
|
+
= ws+
|
|
3887
|
+
|
|
3888
|
+
nl "New line"
|
|
3889
|
+
= "\\n"`;
|
|
3890
|
+
var peg = generate(conditionSource);
|
|
3891
|
+
|
|
3892
|
+
class ConditionParser {
|
|
3893
|
+
/**
|
|
3894
|
+
* Parse the raw formula and output structured condition data
|
|
3895
|
+
* that can be used in evaluating show/hide logic
|
|
3896
|
+
* @param condition raw formula e.g. TextField = "Hello"
|
|
3897
|
+
*/
|
|
3898
|
+
static parse(condition) {
|
|
3899
|
+
if (!condition) {
|
|
3900
|
+
return null;
|
|
3838
3901
|
}
|
|
3839
|
-
|
|
3902
|
+
;
|
|
3903
|
+
condition = condition.replace(/CONTAINS/g, ' CONTAINS');
|
|
3904
|
+
return peg.parse(condition.trim(), {});
|
|
3840
3905
|
}
|
|
3841
3906
|
/**
|
|
3842
|
-
*
|
|
3843
|
-
*
|
|
3844
|
-
*
|
|
3845
|
-
*
|
|
3846
|
-
* @param showCondition The ShowCondition model to evaluate.
|
|
3847
|
-
* @param caseFields Inspected to see appropriate display_contexts.
|
|
3907
|
+
* Evaluate the current fields against the conditions
|
|
3908
|
+
* @param fields the current page fields and their value
|
|
3909
|
+
* @param conditions The PegJS formula output
|
|
3848
3910
|
*/
|
|
3849
|
-
static
|
|
3850
|
-
if (
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
}
|
|
3867
|
-
// Consider what type of field this is.
|
|
3868
|
-
const ft = caseField.field_type;
|
|
3869
|
-
switch (ft.type) {
|
|
3870
|
-
case 'Collection':
|
|
3871
|
-
if (ft.collection_field_type.type === 'Complex' && ft.collection_field_type.complex_fields) {
|
|
3872
|
-
caseField = ft.collection_field_type.complex_fields.find(cf => cf.id === head);
|
|
3873
|
-
}
|
|
3874
|
-
break;
|
|
3875
|
-
case 'Complex':
|
|
3876
|
-
if (ft.complex_fields) {
|
|
3877
|
-
caseField = ft.complex_fields.find(cf => cf.id === head);
|
|
3878
|
-
}
|
|
3879
|
-
break;
|
|
3880
|
-
}
|
|
3881
|
-
}
|
|
3882
|
-
}
|
|
3883
|
-
if (caseField) {
|
|
3884
|
-
allUnchangeable = allUnchangeable && ['HIDDEN', 'READONLY'].indexOf(caseField.display_context) > -1;
|
|
3885
|
-
}
|
|
3911
|
+
static evaluate(fields, conditions, path) {
|
|
3912
|
+
if (!conditions) {
|
|
3913
|
+
return true;
|
|
3914
|
+
}
|
|
3915
|
+
;
|
|
3916
|
+
const validJoinComparators = ['AND', 'OR'];
|
|
3917
|
+
const result = conditions.reduce((accumulator, condition, index) => {
|
|
3918
|
+
const isJoinComparator = (comparator) => (typeof comparator === 'string' && validJoinComparators.indexOf(comparator) !== -1);
|
|
3919
|
+
if (isJoinComparator(condition)) {
|
|
3920
|
+
return accumulator;
|
|
3921
|
+
}
|
|
3922
|
+
;
|
|
3923
|
+
let currentConditionResult = true;
|
|
3924
|
+
if (Array.isArray(condition)) {
|
|
3925
|
+
currentConditionResult = this.evaluate(fields, condition);
|
|
3926
|
+
if (isJoinComparator(conditions[index - 1])) {
|
|
3927
|
+
return this.evaluateJoin(accumulator, conditions[index - 1], currentConditionResult);
|
|
3886
3928
|
}
|
|
3887
|
-
return allUnchangeable;
|
|
3888
3929
|
}
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
static extractConditions(conditionsArray, pathPrefix) {
|
|
3893
|
-
const extracted = conditionsArray.map(condition => {
|
|
3894
|
-
if (condition.startsWith(pathPrefix)) {
|
|
3895
|
-
return condition;
|
|
3930
|
+
if (condition.comparator) {
|
|
3931
|
+
const formula = condition.fieldReference + condition.comparator + condition.value;
|
|
3932
|
+
currentConditionResult = this.matchEqualityCondition(fields, formula, path);
|
|
3896
3933
|
}
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
return extracted;
|
|
3900
|
-
}
|
|
3901
|
-
static getField(condition) {
|
|
3902
|
-
let separator = ShowCondition.CONTAINS;
|
|
3903
|
-
if (condition.indexOf(ShowCondition.CONTAINS) < 0) {
|
|
3904
|
-
separator = ShowCondition.CONDITION_EQUALS;
|
|
3905
|
-
if (condition.indexOf(ShowCondition.CONDITION_NOT_EQUALS) > -1) {
|
|
3906
|
-
separator = ShowCondition.CONDITION_NOT_EQUALS;
|
|
3934
|
+
if (isJoinComparator(conditions[index - 1])) {
|
|
3935
|
+
return this.evaluateJoin(accumulator, conditions[index - 1], currentConditionResult);
|
|
3907
3936
|
}
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
match(fields, path) {
|
|
3912
|
-
if (!this.condition) {
|
|
3913
|
-
return true;
|
|
3914
|
-
}
|
|
3915
|
-
return this.matchAndConditions(fields, this.updatePathName(path));
|
|
3916
|
-
}
|
|
3917
|
-
matchByContextFields(contextFields) {
|
|
3918
|
-
return this.match(FieldsUtils.toValuesMap(contextFields));
|
|
3919
|
-
}
|
|
3920
|
-
/**
|
|
3921
|
-
* Determine whether this is affected by fields that have a display_context
|
|
3922
|
-
* of HIDDEN or READONLY, which means they aren't able to be changed by the
|
|
3923
|
-
* user's actions.
|
|
3924
|
-
*
|
|
3925
|
-
* @param caseFields Inspected to see appropriate display_contexts.
|
|
3926
|
-
*/
|
|
3927
|
-
hiddenCannotChange(caseFields) {
|
|
3928
|
-
return ShowCondition.hiddenCannotChange(this, caseFields);
|
|
3929
|
-
}
|
|
3930
|
-
/**
|
|
3931
|
-
* Path Name gets updated for complex sub fields
|
|
3932
|
-
* @param path Path name.
|
|
3933
|
-
*/
|
|
3934
|
-
updatePathName(path) {
|
|
3935
|
-
if (path && path.split(/[_]+/g).length > 0) {
|
|
3936
|
-
const [pathName, ...pathTail] = path.split(/[_]+/g);
|
|
3937
|
-
const pathFinalIndex = pathTail.pop();
|
|
3938
|
-
const pathTailString = pathTail.toString();
|
|
3939
|
-
let mappedPathTail;
|
|
3940
|
-
mappedPathTail = pathTail.map((value) => {
|
|
3941
|
-
return Number(pathFinalIndex) === Number(value) ? pathName : value;
|
|
3942
|
-
});
|
|
3943
|
-
return pathTailString !== mappedPathTail.toString()
|
|
3944
|
-
? `${pathName}_${mappedPathTail.join('_')}_${pathFinalIndex}`
|
|
3945
|
-
: path;
|
|
3946
|
-
}
|
|
3947
|
-
else {
|
|
3948
|
-
return path;
|
|
3949
|
-
}
|
|
3937
|
+
return currentConditionResult;
|
|
3938
|
+
}, true);
|
|
3939
|
+
return result;
|
|
3950
3940
|
}
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
else if (!!this.andConditions) {
|
|
3956
|
-
return this.andConditions.every(andCondition => this.matchEqualityCondition(fields, andCondition, path));
|
|
3957
|
-
}
|
|
3958
|
-
else {
|
|
3959
|
-
return false;
|
|
3941
|
+
static evaluateJoin(leftResult, comparator, rightResult) {
|
|
3942
|
+
switch (comparator) {
|
|
3943
|
+
case 'OR': return leftResult || rightResult;
|
|
3944
|
+
case 'AND': return leftResult && rightResult;
|
|
3960
3945
|
}
|
|
3961
3946
|
}
|
|
3962
|
-
matchEqualityCondition(fields, condition, path) {
|
|
3963
|
-
const [field, conditionSeparator] =
|
|
3947
|
+
static matchEqualityCondition(fields, condition, path) {
|
|
3948
|
+
const [field, conditionSeparator] = this.getField(condition);
|
|
3964
3949
|
const [head, ...tail] = field.split('.');
|
|
3965
3950
|
const currentValue = this.findValueForComplexCondition(fields, head, tail, path);
|
|
3966
3951
|
const expectedValue = this.unquoted(condition.split(conditionSeparator)[1]);
|
|
@@ -3971,7 +3956,29 @@ class ShowCondition {
|
|
|
3971
3956
|
return this.checkValueEquals(expectedValue, currentValue, conditionSeparator);
|
|
3972
3957
|
}
|
|
3973
3958
|
}
|
|
3974
|
-
|
|
3959
|
+
static getValue(fields, head) {
|
|
3960
|
+
if (this.isDynamicList(fields[head])) {
|
|
3961
|
+
return fields[head].value.code;
|
|
3962
|
+
}
|
|
3963
|
+
else {
|
|
3964
|
+
return fields[head];
|
|
3965
|
+
}
|
|
3966
|
+
}
|
|
3967
|
+
static isDynamicList(dynamiclist) {
|
|
3968
|
+
return !_.isEmpty(dynamiclist) &&
|
|
3969
|
+
(_.has(dynamiclist, 'value') && _.has(dynamiclist, 'list_items'));
|
|
3970
|
+
}
|
|
3971
|
+
static getField(condition) {
|
|
3972
|
+
let separator = ShowCondition.CONTAINS;
|
|
3973
|
+
if (condition.indexOf(ShowCondition.CONTAINS) < 0) {
|
|
3974
|
+
separator = ShowCondition.CONDITION_EQUALS;
|
|
3975
|
+
if (condition.indexOf(ShowCondition.CONDITION_NOT_EQUALS) > -1) {
|
|
3976
|
+
separator = ShowCondition.CONDITION_NOT_EQUALS;
|
|
3977
|
+
}
|
|
3978
|
+
}
|
|
3979
|
+
return [condition.split(separator)[0], separator];
|
|
3980
|
+
}
|
|
3981
|
+
static checkValueEquals(expectedValue, currentValue, conditionSeparaor) {
|
|
3975
3982
|
if (expectedValue.search('[,]') > -1) { // for multi-select list
|
|
3976
3983
|
return this.checkMultiSelectListEquals(expectedValue, currentValue, conditionSeparaor);
|
|
3977
3984
|
}
|
|
@@ -3991,7 +3998,7 @@ class ShowCondition {
|
|
|
3991
3998
|
}
|
|
3992
3999
|
}
|
|
3993
4000
|
}
|
|
3994
|
-
checkValueNotEquals(expectedValue, currentValue) {
|
|
4001
|
+
static checkValueNotEquals(expectedValue, currentValue) {
|
|
3995
4002
|
const formatCurrentValue = currentValue ? currentValue.toString().trim() : '';
|
|
3996
4003
|
if ('*' === expectedValue && formatCurrentValue !== '') {
|
|
3997
4004
|
return false;
|
|
@@ -3999,7 +4006,7 @@ class ShowCondition {
|
|
|
3999
4006
|
const formatExpectedValue = expectedValue ? expectedValue.toString().trim() : '';
|
|
4000
4007
|
return formatCurrentValue != formatExpectedValue; // tslint:disable-line
|
|
4001
4008
|
}
|
|
4002
|
-
checkMultiSelectListEquals(expectedValue, currentValue, conditionSeparator) {
|
|
4009
|
+
static checkMultiSelectListEquals(expectedValue, currentValue, conditionSeparator) {
|
|
4003
4010
|
const expectedValues = expectedValue.split(',').sort().toString();
|
|
4004
4011
|
const values = currentValue ? currentValue.sort().toString() : '';
|
|
4005
4012
|
if (conditionSeparator === ShowCondition.CONDITION_NOT_EQUALS) {
|
|
@@ -4009,7 +4016,7 @@ class ShowCondition {
|
|
|
4009
4016
|
return expectedValues === values;
|
|
4010
4017
|
}
|
|
4011
4018
|
}
|
|
4012
|
-
checkValueContains(expectedValue, currentValue) {
|
|
4019
|
+
static checkValueContains(expectedValue, currentValue) {
|
|
4013
4020
|
if (expectedValue.search(',') > -1) {
|
|
4014
4021
|
const expectedValues = expectedValue.split(',').sort();
|
|
4015
4022
|
const values = currentValue ? currentValue.sort().toString() : '';
|
|
@@ -4020,7 +4027,11 @@ class ShowCondition {
|
|
|
4020
4027
|
return values.search(expectedValue) >= 0;
|
|
4021
4028
|
}
|
|
4022
4029
|
}
|
|
4023
|
-
|
|
4030
|
+
static unquoted(str) {
|
|
4031
|
+
const res = str.replace(/^"|"$/g, '');
|
|
4032
|
+
return res;
|
|
4033
|
+
}
|
|
4034
|
+
static findValueForComplexCondition(fields, head, tail, path) {
|
|
4024
4035
|
if (!fields) {
|
|
4025
4036
|
return undefined;
|
|
4026
4037
|
}
|
|
@@ -4036,7 +4047,7 @@ class ShowCondition {
|
|
|
4036
4047
|
}
|
|
4037
4048
|
}
|
|
4038
4049
|
}
|
|
4039
|
-
findValueForComplexConditionForPathIfAny(fields, head, tail, path) {
|
|
4050
|
+
static findValueForComplexConditionForPathIfAny(fields, head, tail, path) {
|
|
4040
4051
|
if (path) {
|
|
4041
4052
|
const [_, ...pathTail] = path.split(/[_]+/g);
|
|
4042
4053
|
return this.findValueForComplexCondition(fields[head], tail[0], tail.slice(1), pathTail.join('_'));
|
|
@@ -4045,9 +4056,9 @@ class ShowCondition {
|
|
|
4045
4056
|
return this.findValueForComplexCondition(fields[head], tail[0], tail.slice(1), path);
|
|
4046
4057
|
}
|
|
4047
4058
|
}
|
|
4048
|
-
findValueForComplexConditionInArray(fields, head, tail, path) {
|
|
4059
|
+
static findValueForComplexConditionInArray(fields, head, tail, path) {
|
|
4049
4060
|
// use the path to resolve which array element we refer to
|
|
4050
|
-
if (path
|
|
4061
|
+
if (path.startsWith(head)) {
|
|
4051
4062
|
const [_, ...pathTail] = path.split(/[_]+/g);
|
|
4052
4063
|
if (pathTail.length > 0) {
|
|
4053
4064
|
try {
|
|
@@ -4056,42 +4067,221 @@ class ShowCondition {
|
|
|
4056
4067
|
return (fields[head][arrayIndex] !== undefined) ? this.findValueForComplexCondition(fields[head][arrayIndex]['value'], tail[0], tail.slice(1), dropNumberPath.join('_')) : null;
|
|
4057
4068
|
}
|
|
4058
4069
|
catch (e) {
|
|
4059
|
-
console.
|
|
4070
|
+
console.error('Error while parsing number', pathTail[0], e);
|
|
4060
4071
|
}
|
|
4061
4072
|
}
|
|
4062
4073
|
}
|
|
4063
4074
|
else {
|
|
4064
|
-
console.
|
|
4075
|
+
console.error('Path in formArray should start with ', head, ', full path: ', path);
|
|
4065
4076
|
}
|
|
4066
4077
|
}
|
|
4067
|
-
|
|
4068
|
-
if (
|
|
4069
|
-
return
|
|
4078
|
+
static removeStarChar(str) {
|
|
4079
|
+
if (str && str.indexOf('*') > -1) {
|
|
4080
|
+
return str.substring(0, str.indexOf('*'));
|
|
4081
|
+
}
|
|
4082
|
+
return str;
|
|
4083
|
+
}
|
|
4084
|
+
static okIfBothEmpty(right, value) {
|
|
4085
|
+
return value === null && (right === '');
|
|
4086
|
+
}
|
|
4087
|
+
}
|
|
4088
|
+
|
|
4089
|
+
class ShowCondition {
|
|
4090
|
+
// Expects a show condition of the form: <fieldName>="string"
|
|
4091
|
+
constructor(condition) {
|
|
4092
|
+
this.condition = condition;
|
|
4093
|
+
this.conditions = [];
|
|
4094
|
+
if (!!condition) {
|
|
4095
|
+
this.conditions = ConditionParser.parse(condition);
|
|
4096
|
+
}
|
|
4097
|
+
}
|
|
4098
|
+
static addPathPrefixToCondition(showCondition, pathPrefix) {
|
|
4099
|
+
if (!pathPrefix || pathPrefix === '') {
|
|
4100
|
+
return showCondition;
|
|
4101
|
+
}
|
|
4102
|
+
if (!showCondition) {
|
|
4103
|
+
return '';
|
|
4104
|
+
}
|
|
4105
|
+
const formula = ConditionParser.parse(showCondition);
|
|
4106
|
+
if (!formula) {
|
|
4107
|
+
return showCondition;
|
|
4108
|
+
}
|
|
4109
|
+
this.processedList = [];
|
|
4110
|
+
showCondition = showCondition.replace(/CONTAINS/g, ' CONTAINS');
|
|
4111
|
+
const processedCondition = this.processAddPathPrefixToCondition(formula, pathPrefix, showCondition);
|
|
4112
|
+
return processedCondition.replace(/ CONTAINS/g, 'CONTAINS');
|
|
4113
|
+
}
|
|
4114
|
+
static processAddPathPrefixToCondition(formula, pathPrefix, originalCondition) {
|
|
4115
|
+
let finalCondition = originalCondition;
|
|
4116
|
+
if (Array.isArray(formula)) {
|
|
4117
|
+
formula.forEach(condition => {
|
|
4118
|
+
if (typeof condition === 'string' && this.validJoinComparators.indexOf(condition) !== -1) {
|
|
4119
|
+
// do nothing
|
|
4120
|
+
}
|
|
4121
|
+
else {
|
|
4122
|
+
if (Array.isArray(condition)) {
|
|
4123
|
+
finalCondition = this.processAddPathPrefixToCondition(condition, pathPrefix, finalCondition);
|
|
4124
|
+
}
|
|
4125
|
+
else {
|
|
4126
|
+
finalCondition = this.extractConditions(condition, pathPrefix, finalCondition);
|
|
4127
|
+
}
|
|
4128
|
+
}
|
|
4129
|
+
});
|
|
4070
4130
|
}
|
|
4071
4131
|
else {
|
|
4072
|
-
|
|
4132
|
+
finalCondition = this.extractConditions(formula, pathPrefix, finalCondition);
|
|
4073
4133
|
}
|
|
4134
|
+
return finalCondition;
|
|
4074
4135
|
}
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4136
|
+
static extractConditions(condition, pathPrefix, originalCondition) {
|
|
4137
|
+
if (condition.fieldReference.startsWith(pathPrefix)) {
|
|
4138
|
+
return originalCondition;
|
|
4139
|
+
}
|
|
4140
|
+
else {
|
|
4141
|
+
if (originalCondition.indexOf(condition.fieldReference) > -1) {
|
|
4142
|
+
if (this.processedList && this.processedList.indexOf(condition.fieldReference) === -1) {
|
|
4143
|
+
this.processedList.push(condition.fieldReference);
|
|
4144
|
+
const regularExp = new RegExp('(\\b)' + condition.fieldReference + '(?=[^"]*(?:"[^"]*"[^"]*)*$)(\\b)', 'g');
|
|
4145
|
+
return originalCondition.replace(regularExp, pathPrefix + '.' + condition.fieldReference);
|
|
4146
|
+
}
|
|
4147
|
+
else {
|
|
4148
|
+
return originalCondition;
|
|
4149
|
+
}
|
|
4150
|
+
}
|
|
4151
|
+
}
|
|
4078
4152
|
}
|
|
4079
|
-
|
|
4080
|
-
|
|
4153
|
+
// Cache instances so that we can cache results more effectively
|
|
4154
|
+
static getInstance(condition) {
|
|
4155
|
+
let instance = this.instanceCache.get(condition);
|
|
4156
|
+
if (!instance) {
|
|
4157
|
+
instance = new ShowCondition(condition);
|
|
4158
|
+
this.instanceCache.set(condition, instance);
|
|
4159
|
+
}
|
|
4160
|
+
return instance;
|
|
4081
4161
|
}
|
|
4082
|
-
|
|
4083
|
-
|
|
4162
|
+
static getField(condition) {
|
|
4163
|
+
let separator = ShowCondition.CONTAINS;
|
|
4164
|
+
if (condition.indexOf(ShowCondition.CONTAINS) < 0) {
|
|
4165
|
+
separator = ShowCondition.CONDITION_EQUALS;
|
|
4166
|
+
if (condition.indexOf(ShowCondition.CONDITION_NOT_EQUALS) > -1) {
|
|
4167
|
+
separator = ShowCondition.CONDITION_NOT_EQUALS;
|
|
4168
|
+
}
|
|
4169
|
+
}
|
|
4170
|
+
return [condition.split(separator)[0], separator];
|
|
4084
4171
|
}
|
|
4085
|
-
|
|
4086
|
-
|
|
4172
|
+
static getConditions(formula) {
|
|
4173
|
+
const conditionList = [];
|
|
4174
|
+
if (!!formula) {
|
|
4175
|
+
const newFormula = typeof formula === 'string' ? JSON.parse(formula) : formula;
|
|
4176
|
+
if (Array.isArray(newFormula)) {
|
|
4177
|
+
newFormula.forEach(condition => {
|
|
4178
|
+
if (!(typeof condition === 'string' && this.validJoinComparators.indexOf(condition) !== -1)) {
|
|
4179
|
+
if (Array.isArray(condition)) {
|
|
4180
|
+
conditionList.push(ShowCondition.getConditions(condition).toString());
|
|
4181
|
+
}
|
|
4182
|
+
else {
|
|
4183
|
+
conditionList.push(condition.fieldReference + condition.comparator + condition.value);
|
|
4184
|
+
}
|
|
4185
|
+
}
|
|
4186
|
+
});
|
|
4187
|
+
}
|
|
4188
|
+
else {
|
|
4189
|
+
conditionList.push(newFormula.fieldReference + newFormula.comparator + newFormula.value);
|
|
4190
|
+
}
|
|
4191
|
+
}
|
|
4192
|
+
return conditionList.toString();
|
|
4193
|
+
}
|
|
4194
|
+
/**
|
|
4195
|
+
* Determine whether a ShowCondition model is affected by fields that have
|
|
4196
|
+
* a display_context of HIDDEN or READONLY, which means they aren't able to
|
|
4197
|
+
* be changed by the user's actions.
|
|
4198
|
+
*
|
|
4199
|
+
* @param showCondition The ShowCondition model to evaluate.
|
|
4200
|
+
* @param caseFields Inspected to see appropriate display_contexts.
|
|
4201
|
+
*/
|
|
4202
|
+
static hiddenCannotChange(showCondition, caseFields) {
|
|
4203
|
+
if (showCondition && showCondition.conditions.length && caseFields) {
|
|
4204
|
+
const conditions = this.getConditions(showCondition.conditions).split(',');
|
|
4205
|
+
if (conditions && conditions.length > 0) {
|
|
4206
|
+
let allUnchangeable = true;
|
|
4207
|
+
for (const condition of conditions) {
|
|
4208
|
+
const [field] = ShowCondition.getField(condition);
|
|
4209
|
+
const path = field.split('.');
|
|
4210
|
+
let head = path.shift();
|
|
4211
|
+
let caseField = caseFields.find(cf => cf.id === head);
|
|
4212
|
+
while (path.length > 0) {
|
|
4213
|
+
head = path.shift();
|
|
4214
|
+
if (caseField) {
|
|
4215
|
+
// Jump out if this is HIDDEN or READONLY, regardless of whether or not it's
|
|
4216
|
+
// complex or a collection - nested fields will "inherit" the display_context.
|
|
4217
|
+
if (['HIDDEN', 'READONLY'].indexOf(caseField.display_context) > -1) {
|
|
4218
|
+
break;
|
|
4219
|
+
}
|
|
4220
|
+
// Consider what type of field this is.
|
|
4221
|
+
const ft = caseField.field_type;
|
|
4222
|
+
switch (ft.type) {
|
|
4223
|
+
case 'Collection':
|
|
4224
|
+
if (ft.collection_field_type.type === 'Complex' && ft.collection_field_type.complex_fields) {
|
|
4225
|
+
caseField = ft.collection_field_type.complex_fields.find(cf => cf.id === head);
|
|
4226
|
+
}
|
|
4227
|
+
break;
|
|
4228
|
+
case 'Complex':
|
|
4229
|
+
if (ft.complex_fields) {
|
|
4230
|
+
caseField = ft.complex_fields.find(cf => cf.id === head);
|
|
4231
|
+
}
|
|
4232
|
+
break;
|
|
4233
|
+
}
|
|
4234
|
+
}
|
|
4235
|
+
}
|
|
4236
|
+
if (caseField) {
|
|
4237
|
+
allUnchangeable = allUnchangeable && ['HIDDEN', 'READONLY'].indexOf(caseField.display_context) > -1;
|
|
4238
|
+
}
|
|
4239
|
+
}
|
|
4240
|
+
return allUnchangeable;
|
|
4241
|
+
}
|
|
4242
|
+
}
|
|
4243
|
+
return false;
|
|
4244
|
+
}
|
|
4245
|
+
match(fields, path) {
|
|
4246
|
+
return ConditionParser.evaluate(fields, this.conditions, this.updatePathName(path));
|
|
4247
|
+
}
|
|
4248
|
+
updatePathName(path) {
|
|
4249
|
+
if (path && path.split(/[_]+/g).length > 0) {
|
|
4250
|
+
/* tslint:disable-next-line */
|
|
4251
|
+
let [pathName, ...pathTail] = path.split(/[_]+/g);
|
|
4252
|
+
const pathFinalIndex = pathTail.pop();
|
|
4253
|
+
const pathTailString = pathTail.toString();
|
|
4254
|
+
pathTail = pathTail.map((value) => {
|
|
4255
|
+
return Number(pathFinalIndex) === Number(value) ? pathName : value;
|
|
4256
|
+
});
|
|
4257
|
+
return pathTailString !== pathTail.toString()
|
|
4258
|
+
? `${pathName}_${pathTail.join('_')}_${pathFinalIndex}`
|
|
4259
|
+
: path;
|
|
4260
|
+
}
|
|
4261
|
+
else {
|
|
4262
|
+
return path;
|
|
4263
|
+
}
|
|
4264
|
+
}
|
|
4265
|
+
matchByContextFields(contextFields) {
|
|
4266
|
+
return this.match(FieldsUtils.toValuesMap(contextFields));
|
|
4267
|
+
}
|
|
4268
|
+
/**
|
|
4269
|
+
* Determine whether this is affected by fields that have a display_context
|
|
4270
|
+
* of HIDDEN or READONLY, which means they aren't able to be changed by the
|
|
4271
|
+
* user's actions.
|
|
4272
|
+
*
|
|
4273
|
+
* @param caseFields Inspected to see appropriate display_contexts.
|
|
4274
|
+
*/
|
|
4275
|
+
hiddenCannotChange(caseFields) {
|
|
4276
|
+
return ShowCondition.hiddenCannotChange(this, caseFields);
|
|
4087
4277
|
}
|
|
4088
4278
|
}
|
|
4089
|
-
ShowCondition.AND_CONDITION_REGEXP = new RegExp('\\sAND\\s(?![^"]*"(?:(?:[^"]*"){2})*[^"]*$)', 'g');
|
|
4090
|
-
ShowCondition.OR_CONDITION_REGEXP = new RegExp('\\sOR\\s(?![^"]*"(?:(?:[^"]*"){2})*[^"]*$)', 'g');
|
|
4091
4279
|
ShowCondition.CONDITION_NOT_EQUALS = '!=';
|
|
4092
4280
|
ShowCondition.CONDITION_EQUALS = '=';
|
|
4093
4281
|
ShowCondition.CONTAINS = 'CONTAINS';
|
|
4094
4282
|
ShowCondition.instanceCache = new Map();
|
|
4283
|
+
ShowCondition.validJoinComparators = ['AND', 'OR'];
|
|
4284
|
+
ShowCondition.processedList = [];
|
|
4095
4285
|
|
|
4096
4286
|
class Constants {
|
|
4097
4287
|
}
|
|
@@ -5886,13 +6076,14 @@ class CaseFlagRefdataService {
|
|
|
5886
6076
|
return of(null);
|
|
5887
6077
|
}
|
|
5888
6078
|
/**
|
|
5889
|
-
* Retrieves the HMCTS service details for a jurisdiction or service, including service
|
|
5890
|
-
* service has
|
|
6079
|
+
* Retrieves the HMCTS service details for a jurisdiction or service, including service codes. More than one
|
|
6080
|
+
* service code may be present. For example, the Divorce jurisdiction/service has corresponding service codes of
|
|
6081
|
+
* "ABA1" and "ABA2".
|
|
5891
6082
|
*
|
|
5892
6083
|
* @param serviceNames The service name(s) to look up, comma-separated if more than one
|
|
5893
6084
|
* @returns An `Observable` of an array of service details
|
|
5894
6085
|
*/
|
|
5895
|
-
|
|
6086
|
+
getHmctsServiceDetailsByServiceName(serviceNames) {
|
|
5896
6087
|
let url = this.appConfig.getLocationRefApiUrl();
|
|
5897
6088
|
if (url) {
|
|
5898
6089
|
url += '/orgServices';
|
|
@@ -5903,6 +6094,26 @@ class CaseFlagRefdataService {
|
|
|
5903
6094
|
}
|
|
5904
6095
|
return of(null);
|
|
5905
6096
|
}
|
|
6097
|
+
/**
|
|
6098
|
+
* Retrieves the HMCTS service details for a case type, including service code. For example, the
|
|
6099
|
+
* "FinancialRemedyContested" case type is associated with the Divorce jurisdiction/service and service code "ABA2".
|
|
6100
|
+
*
|
|
6101
|
+
* Note that a case type might not be associated with any service codes of a jurisdiction or service.
|
|
6102
|
+
*
|
|
6103
|
+
* @param caseTypeId The case type ID to look up
|
|
6104
|
+
* @returns An `Observable` of an array of service details
|
|
6105
|
+
*/
|
|
6106
|
+
getHmctsServiceDetailsByCaseType(caseTypeId) {
|
|
6107
|
+
let url = this.appConfig.getLocationRefApiUrl();
|
|
6108
|
+
if (url) {
|
|
6109
|
+
url += '/orgServices';
|
|
6110
|
+
if (caseTypeId) {
|
|
6111
|
+
url += `?ccdCaseType=${caseTypeId}`;
|
|
6112
|
+
}
|
|
6113
|
+
return this.http.get(url, { observe: 'body' });
|
|
6114
|
+
}
|
|
6115
|
+
return of(null);
|
|
6116
|
+
}
|
|
5906
6117
|
}
|
|
5907
6118
|
CaseFlagRefdataService.ɵfac = function CaseFlagRefdataService_Factory(t) { return new (t || CaseFlagRefdataService)(i0.ɵɵinject(HttpService), i0.ɵɵinject(AbstractAppConfig)); };
|
|
5908
6119
|
CaseFlagRefdataService.ɵprov = i0.ɵɵdefineInjectable({ token: CaseFlagRefdataService, factory: CaseFlagRefdataService.ɵfac });
|
|
@@ -10784,7 +10995,7 @@ function WriteCaseFlagFieldComponent_div_1_ng_container_5_Template(rf, ctx) { if
|
|
|
10784
10995
|
} if (rf & 2) {
|
|
10785
10996
|
const ctx_r8 = i0.ɵɵnextContext(2);
|
|
10786
10997
|
i0.ɵɵadvance(1);
|
|
10787
|
-
i0.ɵɵproperty("formGroup", ctx_r8.caseFlagParentFormGroup)("jurisdiction", ctx_r8.jurisdiction);
|
|
10998
|
+
i0.ɵɵproperty("formGroup", ctx_r8.caseFlagParentFormGroup)("jurisdiction", ctx_r8.jurisdiction)("caseTypeId", ctx_r8.caseTypeId);
|
|
10788
10999
|
} }
|
|
10789
11000
|
function WriteCaseFlagFieldComponent_div_1_ng_container_6_Template(rf, ctx) { if (rf & 1) {
|
|
10790
11001
|
const _r17 = i0.ɵɵgetCurrentView();
|
|
@@ -10818,7 +11029,7 @@ function WriteCaseFlagFieldComponent_div_1_Template(rf, ctx) { if (rf & 1) {
|
|
|
10818
11029
|
i0.ɵɵtext(3);
|
|
10819
11030
|
i0.ɵɵelementEnd();
|
|
10820
11031
|
i0.ɵɵtemplate(4, WriteCaseFlagFieldComponent_div_1_ng_container_4_Template, 2, 2, "ng-container", 11);
|
|
10821
|
-
i0.ɵɵtemplate(5, WriteCaseFlagFieldComponent_div_1_ng_container_5_Template, 2,
|
|
11032
|
+
i0.ɵɵtemplate(5, WriteCaseFlagFieldComponent_div_1_ng_container_5_Template, 2, 3, "ng-container", 11);
|
|
10822
11033
|
i0.ɵɵtemplate(6, WriteCaseFlagFieldComponent_div_1_ng_container_6_Template, 2, 3, "ng-container", 11);
|
|
10823
11034
|
i0.ɵɵtemplate(7, WriteCaseFlagFieldComponent_div_1_ng_container_7_Template, 2, 2, "ng-container", 11);
|
|
10824
11035
|
i0.ɵɵelementEnd();
|
|
@@ -10917,11 +11128,14 @@ class WriteCaseFlagFieldComponent extends AbstractFieldWriteComponent {
|
|
|
10917
11128
|
}
|
|
10918
11129
|
}), true);
|
|
10919
11130
|
this.createFlagCaption = CaseFlagText.CAPTION;
|
|
10920
|
-
// Get the
|
|
11131
|
+
// Get the case type ID from the CaseView object in the snapshot data (required for retrieving the available flag
|
|
10921
11132
|
// types for a case)
|
|
10922
|
-
if (this.route.snapshot.data.case && this.route.snapshot.data.case.case_type
|
|
10923
|
-
this.route.snapshot.data.case.case_type.
|
|
10924
|
-
|
|
11133
|
+
if (this.route.snapshot.data.case && this.route.snapshot.data.case.case_type) {
|
|
11134
|
+
this.caseTypeId = this.route.snapshot.data.case.case_type.id;
|
|
11135
|
+
// Get the jurisdiction (required for retrieving the available flag types if unable to determine using case type ID)
|
|
11136
|
+
if (this.route.snapshot.data.case.case_type.jurisdiction) {
|
|
11137
|
+
this.jurisdiction = this.route.snapshot.data.case.case_type.jurisdiction.id;
|
|
11138
|
+
}
|
|
10925
11139
|
}
|
|
10926
11140
|
// Extract all flags-related data from the CaseEventTrigger object in the snapshot data
|
|
10927
11141
|
if (this.route.snapshot.data.eventTrigger && this.route.snapshot.data.eventTrigger.case_fields) {
|
|
@@ -11172,7 +11386,7 @@ class WriteCaseFlagFieldComponent extends AbstractFieldWriteComponent {
|
|
|
11172
11386
|
}
|
|
11173
11387
|
}
|
|
11174
11388
|
WriteCaseFlagFieldComponent.ɵfac = function WriteCaseFlagFieldComponent_Factory(t) { return new (t || WriteCaseFlagFieldComponent)(i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(CaseEditDataService)); };
|
|
11175
|
-
WriteCaseFlagFieldComponent.ɵcmp = i0.ɵɵdefineComponent({ type: WriteCaseFlagFieldComponent, selectors: [["ccd-write-case-flag-field"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 3, vars: 3, consts: [["class", "govuk-error-summary", "aria-labelledby", "error-summary-title", "role", "alert", "tabindex", "-1", "data-module", "govuk-error-summary", 4, "ngIf"], ["class", "form-group", 3, "formGroup", 4, "ngIf"], ["aria-labelledby", "error-summary-title", "role", "alert", "tabindex", "-1", "data-module", "govuk-error-summary", 1, "govuk-error-summary"], ["id", "error-summary-title", 1, "govuk-error-summary__title"], ["class", "govuk-error-summary__body", 4, "ngFor", "ngForOf"], [1, "govuk-error-summary__body"], [1, "govuk-list", "govuk-error-summary__list"], [1, "validation-error", 3, "click"], [1, "form-group", 3, "formGroup"], [1, "govuk-form-group", 3, "ngSwitch"], ["id", "create-flag-caption", 1, "govuk-caption-l", 3, "ngClass"], [4, "ngSwitchCase"], [3, "formGroup", "flagsData", "caseFlagStateEmitter"], [3, "formGroup", "jurisdiction", "caseFlagStateEmitter", "flagCommentsOptionalEmitter"], [3, "formGroup", "languages", "flagCode", "caseFlagStateEmitter"], [3, "formGroup", "optional", "caseFlagStateEmitter"], [3, "formGroup", "flagsData", "caseTitle", "caseFlagStateEmitter"], [3, "formGroup", "selectedFlag", "caseFlagStateEmitter"]], template: function WriteCaseFlagFieldComponent_Template(rf, ctx) { if (rf & 1) {
|
|
11389
|
+
WriteCaseFlagFieldComponent.ɵcmp = i0.ɵɵdefineComponent({ type: WriteCaseFlagFieldComponent, selectors: [["ccd-write-case-flag-field"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 3, vars: 3, consts: [["class", "govuk-error-summary", "aria-labelledby", "error-summary-title", "role", "alert", "tabindex", "-1", "data-module", "govuk-error-summary", 4, "ngIf"], ["class", "form-group", 3, "formGroup", 4, "ngIf"], ["aria-labelledby", "error-summary-title", "role", "alert", "tabindex", "-1", "data-module", "govuk-error-summary", 1, "govuk-error-summary"], ["id", "error-summary-title", 1, "govuk-error-summary__title"], ["class", "govuk-error-summary__body", 4, "ngFor", "ngForOf"], [1, "govuk-error-summary__body"], [1, "govuk-list", "govuk-error-summary__list"], [1, "validation-error", 3, "click"], [1, "form-group", 3, "formGroup"], [1, "govuk-form-group", 3, "ngSwitch"], ["id", "create-flag-caption", 1, "govuk-caption-l", 3, "ngClass"], [4, "ngSwitchCase"], [3, "formGroup", "flagsData", "caseFlagStateEmitter"], [3, "formGroup", "jurisdiction", "caseTypeId", "caseFlagStateEmitter", "flagCommentsOptionalEmitter"], [3, "formGroup", "languages", "flagCode", "caseFlagStateEmitter"], [3, "formGroup", "optional", "caseFlagStateEmitter"], [3, "formGroup", "flagsData", "caseTitle", "caseFlagStateEmitter"], [3, "formGroup", "selectedFlag", "caseFlagStateEmitter"]], template: function WriteCaseFlagFieldComponent_Template(rf, ctx) { if (rf & 1) {
|
|
11176
11390
|
i0.ɵɵtemplate(0, WriteCaseFlagFieldComponent_div_0_Template, 4, 1, "div", 0);
|
|
11177
11391
|
i0.ɵɵtemplate(1, WriteCaseFlagFieldComponent_div_1_Template, 8, 10, "div", 1);
|
|
11178
11392
|
i0.ɵɵtemplate(2, WriteCaseFlagFieldComponent_div_2_Template, 4, 4, "div", 1);
|
|
@@ -15486,7 +15700,7 @@ CaseFileViewFolderSelectorComponent.ɵcmp = i0.ɵɵdefineComponent({ type: CaseF
|
|
|
15486
15700
|
i0.ɵɵtextInterpolate1("Where do you want to move \"", ctx.data.document.document_filename, "\" file?");
|
|
15487
15701
|
i0.ɵɵadvance(2);
|
|
15488
15702
|
i0.ɵɵproperty("ngForOf", ctx.currentCategories);
|
|
15489
|
-
} }, directives: [i1.NgForOf, i1.NgTemplateOutlet], styles: [":host{position:relative;display:block}.folders{margin-bottom:20px}.folder{display:none;border-top:1px solid #ccc;margin:0 0 -1px}.folder:last-child{border-bottom:1px solid #ccc}.folders>.folder,input:checked~.folder{display:block}.iconImg{position:relative;display:inline-block;height:28px}.folder>.folder{margin-left:20px}.folder label:before{top:3px}.folder label:after{top:13px}p{font-weight:700}button{margin-right:20px}.close{float:right;width:30px;height:30px;background:url(/assets/img/x.PNG) no-repeat 50%}.cancel,.close{cursor:pointer}.cdk-overlay-pane{overflow:auto}.cdk-overlay-pane::-webkit-scrollbar{width:7px}.cdk-overlay-pane::-webkit-scrollbar-thumb{border:4px solid transparent;background-clip:padding-box;border-radius:9999px;background-color:#aaa}.cdk-overlay-pane::-webkit-scrollbar-button{display:none}.cdk-overlay-pane::-webkit-scrollbar-track-piece{background:#eee}.cdk-overlay-pane::-webkit-scrollbar-thumb{background:#ccc}"], encapsulation: 2 });
|
|
15703
|
+
} }, directives: [i1.NgForOf, i1.NgTemplateOutlet], styles: [":host{position:relative;display:block}.folders{margin-bottom:20px}.folder{display:none;border-top:1px solid #ccc;margin:0 0 -1px}.folder,.folder:last-child{border-bottom:1px solid #ccc}.folders>.folder,input:checked~.folder{display:block}.iconImg{position:relative;display:inline-block;height:28px}.folder>.folder{margin-left:20px}.folder label:before{top:3px}.folder label:after{top:13px}p{font-weight:700}button{margin-right:20px}.close{float:right;width:30px;height:30px;background:url(/assets/img/x.PNG) no-repeat 50%}.cancel,.close{cursor:pointer}.cdk-overlay-pane{overflow:auto}.cdk-overlay-pane::-webkit-scrollbar{width:7px}.cdk-overlay-pane::-webkit-scrollbar-thumb{border:4px solid transparent;background-clip:padding-box;border-radius:9999px;background-color:#aaa}.cdk-overlay-pane::-webkit-scrollbar-button{display:none}.cdk-overlay-pane::-webkit-scrollbar-track-piece{background:#eee}.cdk-overlay-pane::-webkit-scrollbar-thumb{background:#ccc}"], encapsulation: 2 });
|
|
15490
15704
|
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CaseFileViewFolderSelectorComponent, [{
|
|
15491
15705
|
type: Component,
|
|
15492
15706
|
args: [{
|
|
@@ -16370,22 +16584,18 @@ class SelectFlagTypeComponent {
|
|
|
16370
16584
|
&& this.formGroup['caseField'].id === this.caseLevelCaseFlagsFieldId
|
|
16371
16585
|
? RefdataCaseFlagType.CASE
|
|
16372
16586
|
: RefdataCaseFlagType.PARTY;
|
|
16373
|
-
// HMCTS service code
|
|
16374
|
-
this.flagRefdata$ = this.caseFlagRefdataService.
|
|
16587
|
+
// HMCTS service code is required to retrieve the relevant list of flag types; attempt to obtain it by case type ID first
|
|
16588
|
+
this.flagRefdata$ = this.caseFlagRefdataService.getHmctsServiceDetailsByCaseType(this.caseTypeId)
|
|
16375
16589
|
.pipe(
|
|
16590
|
+
// If an error occurs retrieving HMCTS service details by case type ID, try by service name instead
|
|
16591
|
+
catchError(_ => this.caseFlagRefdataService.getHmctsServiceDetailsByServiceName(this.jurisdiction)),
|
|
16376
16592
|
// Use switchMap to return an inner Observable of the flag types data, having received the service details
|
|
16377
16593
|
// including service_code. This avoids having nested `subscribe`s, which is an anti-pattern!
|
|
16378
|
-
switchMap(serviceDetails =>
|
|
16379
|
-
return this.caseFlagRefdataService.getCaseFlagsRefdata(serviceDetails[0].service_code, flagType);
|
|
16380
|
-
}))
|
|
16594
|
+
switchMap(serviceDetails => this.caseFlagRefdataService.getCaseFlagsRefdata(serviceDetails[0].service_code, flagType)))
|
|
16381
16595
|
.subscribe({
|
|
16382
|
-
|
|
16383
|
-
|
|
16384
|
-
|
|
16385
|
-
},
|
|
16386
|
-
error: error => {
|
|
16387
|
-
this.onRefdataError(error);
|
|
16388
|
-
}
|
|
16596
|
+
// First (and only) object in the returned array should be the top-level "Party" flag type
|
|
16597
|
+
next: flagTypes => this.flagTypes = flagTypes[0].childFlags,
|
|
16598
|
+
error: error => this.onRefdataError(error)
|
|
16389
16599
|
});
|
|
16390
16600
|
}
|
|
16391
16601
|
ngOnDestroy() {
|
|
@@ -16457,7 +16667,7 @@ class SelectFlagTypeComponent {
|
|
|
16457
16667
|
}
|
|
16458
16668
|
}
|
|
16459
16669
|
SelectFlagTypeComponent.ɵfac = function SelectFlagTypeComponent_Factory(t) { return new (t || SelectFlagTypeComponent)(i0.ɵɵdirectiveInject(CaseFlagRefdataService)); };
|
|
16460
|
-
SelectFlagTypeComponent.ɵcmp = i0.ɵɵdefineComponent({ type: SelectFlagTypeComponent, selectors: [["ccd-select-flag-type"]], inputs: { formGroup: "formGroup", jurisdiction: "jurisdiction" }, outputs: { caseFlagStateEmitter: "caseFlagStateEmitter", flagCommentsOptionalEmitter: "flagCommentsOptionalEmitter" }, decls: 11, vars: 9, consts: [[1, "form-group", 3, "formGroup"], [1, "govuk-form-group", 3, "ngClass"], ["aria-describedby", "flag-type-heading", 1, "govuk-fieldset"], [1, "govuk-fieldset__legend", "govuk-fieldset__legend--l"], ["id", "flag-type-heading", 1, "govuk-fieldset__heading"], ["id", "flag-type-not-selected-error-message", "class", "govuk-error-message", 4, "ngIf"], ["data-module", "govuk-radios", "id", "conditional-radios-list", 1, "govuk-radios", "govuk-radios--conditional"], ["class", "govuk-radios__item", 4, "ngFor", "ngForOf"], ["class", "govuk-radios__conditional", "id", "conditional-flagType", 4, "ngIf"], ["class", "govuk-button-group", 4, "ngIf"], ["id", "flag-type-not-selected-error-message", 1, "govuk-error-message"], [1, "govuk-visually-hidden"], [1, "govuk-radios__item"], ["type", "radio", 1, "govuk-radios__input", 3, "id", "name", "value", "formControlName", "change"], [1, "govuk-label", "govuk-radios__label", 3, "for"], ["id", "conditional-flagType", 1, "govuk-radios__conditional"], ["for", "other-flag-type-description", 1, "govuk-label"], ["id", "flag-type-error-message", "class", "govuk-error-message", 4, "ngIf"], ["id", "other-flag-type-description", "type", "text", 1, "govuk-input", "govuk-!-width-one-half", 3, "ngClass", "name", "formControlName"], ["id", "flag-type-error-message", 1, "govuk-error-message"], [1, "govuk-button-group"], ["type", "button", 1, "button", "button-primary", 3, "click"]], template: function SelectFlagTypeComponent_Template(rf, ctx) { if (rf & 1) {
|
|
16670
|
+
SelectFlagTypeComponent.ɵcmp = i0.ɵɵdefineComponent({ type: SelectFlagTypeComponent, selectors: [["ccd-select-flag-type"]], inputs: { formGroup: "formGroup", jurisdiction: "jurisdiction", caseTypeId: "caseTypeId" }, outputs: { caseFlagStateEmitter: "caseFlagStateEmitter", flagCommentsOptionalEmitter: "flagCommentsOptionalEmitter" }, decls: 11, vars: 9, consts: [[1, "form-group", 3, "formGroup"], [1, "govuk-form-group", 3, "ngClass"], ["aria-describedby", "flag-type-heading", 1, "govuk-fieldset"], [1, "govuk-fieldset__legend", "govuk-fieldset__legend--l"], ["id", "flag-type-heading", 1, "govuk-fieldset__heading"], ["id", "flag-type-not-selected-error-message", "class", "govuk-error-message", 4, "ngIf"], ["data-module", "govuk-radios", "id", "conditional-radios-list", 1, "govuk-radios", "govuk-radios--conditional"], ["class", "govuk-radios__item", 4, "ngFor", "ngForOf"], ["class", "govuk-radios__conditional", "id", "conditional-flagType", 4, "ngIf"], ["class", "govuk-button-group", 4, "ngIf"], ["id", "flag-type-not-selected-error-message", 1, "govuk-error-message"], [1, "govuk-visually-hidden"], [1, "govuk-radios__item"], ["type", "radio", 1, "govuk-radios__input", 3, "id", "name", "value", "formControlName", "change"], [1, "govuk-label", "govuk-radios__label", 3, "for"], ["id", "conditional-flagType", 1, "govuk-radios__conditional"], ["for", "other-flag-type-description", 1, "govuk-label"], ["id", "flag-type-error-message", "class", "govuk-error-message", 4, "ngIf"], ["id", "other-flag-type-description", "type", "text", 1, "govuk-input", "govuk-!-width-one-half", 3, "ngClass", "name", "formControlName"], ["id", "flag-type-error-message", 1, "govuk-error-message"], [1, "govuk-button-group"], ["type", "button", 1, "button", "button-primary", 3, "click"]], template: function SelectFlagTypeComponent_Template(rf, ctx) { if (rf & 1) {
|
|
16461
16671
|
i0.ɵɵelementStart(0, "div", 0);
|
|
16462
16672
|
i0.ɵɵelementStart(1, "div", 1);
|
|
16463
16673
|
i0.ɵɵelementStart(2, "fieldset", 2);
|
|
@@ -16501,6 +16711,8 @@ SelectFlagTypeComponent.ɵcmp = i0.ɵɵdefineComponent({ type: SelectFlagTypeCom
|
|
|
16501
16711
|
type: Input
|
|
16502
16712
|
}], jurisdiction: [{
|
|
16503
16713
|
type: Input
|
|
16714
|
+
}], caseTypeId: [{
|
|
16715
|
+
type: Input
|
|
16504
16716
|
}], caseFlagStateEmitter: [{
|
|
16505
16717
|
type: Output
|
|
16506
16718
|
}], flagCommentsOptionalEmitter: [{
|
|
@@ -18512,7 +18724,10 @@ DatetimePickerComponent.ɵcmp = i0.ɵɵdefineComponent({ type: DatetimePickerCom
|
|
|
18512
18724
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.inputElement = _t.first);
|
|
18513
18725
|
} }, inputs: { dateControl: "dateControl" }, features: [i0.ɵɵProvidersFeature([
|
|
18514
18726
|
{ provide: NGX_MAT_DATE_FORMATS, useValue: CUSTOM_MOMENT_FORMATS },
|
|
18515
|
-
{ provide: NgxMatDateAdapter,
|
|
18727
|
+
{ provide: NgxMatDateAdapter,
|
|
18728
|
+
useClass: NgxMatMomentAdapter,
|
|
18729
|
+
deps: [MAT_DATE_LOCALE, NGX_MAT_MOMENT_DATE_ADAPTER_OPTIONS]
|
|
18730
|
+
},
|
|
18516
18731
|
{ provide: NGX_MAT_MOMENT_DATE_ADAPTER_OPTIONS, useValue: { useUtc: true } }
|
|
18517
18732
|
]), i0.ɵɵInheritDefinitionFeature], decls: 14, vars: 26, consts: [[1, "govuk-form-group", "bottom-30", 3, "id", "ngClass"], ["class", "form-label", 4, "ngIf"], ["class", "form-hint", 4, "ngIf"], ["class", "error-message", 4, "ngIf"], [1, "datepicker-container"], ["ng-model-options", "{timezone:'utc'}", 1, "govuk-input", 3, "min", "max", "formControl", "ngxMatDatetimePicker", "focusin", "focusout", "dateChange"], ["input", ""], ["matSuffix", "", "id", "pickerOpener", 3, "for"], [3, "color", "touchUi", "hideTime", "startView", "stepHour", "stepSecond", "stepMinute", "showSeconds", "showSpinners", "disableMinute", "enableMeridian", "yearSelected", "monthSelected", "opened"], ["picker", ""], [1, "form-label"], [1, "form-hint"], [1, "error-message"]], template: function DatetimePickerComponent_Template(rf, ctx) { if (rf & 1) {
|
|
18518
18733
|
i0.ɵɵelementStart(0, "div", 0);
|
|
@@ -18565,7 +18780,10 @@ DatetimePickerComponent.ɵcmp = i0.ɵɵdefineComponent({ type: DatetimePickerCom
|
|
|
18565
18780
|
encapsulation: ViewEncapsulation.None,
|
|
18566
18781
|
providers: [
|
|
18567
18782
|
{ provide: NGX_MAT_DATE_FORMATS, useValue: CUSTOM_MOMENT_FORMATS },
|
|
18568
|
-
{ provide: NgxMatDateAdapter,
|
|
18783
|
+
{ provide: NgxMatDateAdapter,
|
|
18784
|
+
useClass: NgxMatMomentAdapter,
|
|
18785
|
+
deps: [MAT_DATE_LOCALE, NGX_MAT_MOMENT_DATE_ADAPTER_OPTIONS]
|
|
18786
|
+
},
|
|
18569
18787
|
{ provide: NGX_MAT_MOMENT_DATE_ADAPTER_OPTIONS, useValue: { useUtc: true } }
|
|
18570
18788
|
]
|
|
18571
18789
|
}]
|
|
@@ -23938,6 +24156,7 @@ class CaseFullAccessViewComponent {
|
|
|
23938
24156
|
this.activitySubscription = this.postViewActivity().subscribe();
|
|
23939
24157
|
});
|
|
23940
24158
|
}
|
|
24159
|
+
this.checkRouteAndSetCaseViewTab();
|
|
23941
24160
|
// Check for active Case Flags
|
|
23942
24161
|
this.activeCaseFlags = this.hasActiveCaseFlags();
|
|
23943
24162
|
}
|
|
@@ -23967,6 +24186,19 @@ class CaseFullAccessViewComponent {
|
|
|
23967
24186
|
subscription.unsubscribe();
|
|
23968
24187
|
}
|
|
23969
24188
|
}
|
|
24189
|
+
checkRouteAndSetCaseViewTab() {
|
|
24190
|
+
this.router.events.subscribe((val) => {
|
|
24191
|
+
const url = val && val.url;
|
|
24192
|
+
if (url) {
|
|
24193
|
+
const tabUrl = url ? url.split('#') : null;
|
|
24194
|
+
const tab = tabUrl && tabUrl.length > 1 ? tabUrl[tabUrl.length - 1].replaceAll('%20', ' ') : '';
|
|
24195
|
+
const matTab = this.tabGroup._tabs.find((x) => x.textLabel.toLowerCase() === tab.toLowerCase());
|
|
24196
|
+
if (matTab && matTab.position) {
|
|
24197
|
+
this.tabGroup.selectedIndex = matTab.position;
|
|
24198
|
+
}
|
|
24199
|
+
}
|
|
24200
|
+
});
|
|
24201
|
+
}
|
|
23970
24202
|
postViewActivity() {
|
|
23971
24203
|
return this.activityPollingService.postViewActivity(this.caseDetails.case_id);
|
|
23972
24204
|
}
|
|
@@ -27423,11 +27655,11 @@ function SearchResultComponent_table_0_th_9_Template(rf, ctx) { if (rf & 1) {
|
|
|
27423
27655
|
i0.ɵɵadvance(2);
|
|
27424
27656
|
i0.ɵɵproperty("checked", ctx_r6.allOnPageSelected())("disabled", !ctx_r6.canAnyBeShared());
|
|
27425
27657
|
} }
|
|
27426
|
-
function
|
|
27658
|
+
function SearchResultComponent_table_0_th_10_div_4_Template(rf, ctx) { if (rf & 1) {
|
|
27427
27659
|
const _r19 = i0.ɵɵgetCurrentView();
|
|
27428
27660
|
i0.ɵɵelementStart(0, "div", 27);
|
|
27429
27661
|
i0.ɵɵelementStart(1, "a", 28);
|
|
27430
|
-
i0.ɵɵlistener("click", function
|
|
27662
|
+
i0.ɵɵlistener("click", function SearchResultComponent_table_0_th_10_div_4_Template_a_click_1_listener() { i0.ɵɵrestoreView(_r19); const col_r15 = i0.ɵɵnextContext().$implicit; const ctx_r17 = i0.ɵɵnextContext(2); return ctx_r17.sort(col_r15); });
|
|
27431
27663
|
i0.ɵɵelementEnd();
|
|
27432
27664
|
i0.ɵɵelementEnd();
|
|
27433
27665
|
} if (rf & 2) {
|
|
@@ -27439,16 +27671,12 @@ function SearchResultComponent_table_0_th_10_div_6_Template(rf, ctx) { if (rf &
|
|
|
27439
27671
|
function SearchResultComponent_table_0_th_10_Template(rf, ctx) { if (rf & 1) {
|
|
27440
27672
|
const _r22 = i0.ɵɵgetCurrentView();
|
|
27441
27673
|
i0.ɵɵelementStart(0, "th");
|
|
27442
|
-
i0.ɵɵelementStart(1, "
|
|
27443
|
-
i0.ɵɵelementStart(2, "
|
|
27444
|
-
i0.ɵɵ
|
|
27445
|
-
i0.ɵɵ
|
|
27446
|
-
i0.ɵɵlistener("click", function SearchResultComponent_table_0_th_10_Template_div_click_4_listener() { i0.ɵɵrestoreView(_r22); const col_r15 = ctx.$implicit; const ctx_r21 = i0.ɵɵnextContext(2); return ctx_r21.sort(col_r15); });
|
|
27447
|
-
i0.ɵɵtext(5);
|
|
27448
|
-
i0.ɵɵelementEnd();
|
|
27449
|
-
i0.ɵɵtemplate(6, SearchResultComponent_table_0_th_10_div_6_Template, 2, 1, "div", 26);
|
|
27450
|
-
i0.ɵɵelementEnd();
|
|
27674
|
+
i0.ɵɵelementStart(1, "div", 24);
|
|
27675
|
+
i0.ɵɵelementStart(2, "div", 25);
|
|
27676
|
+
i0.ɵɵlistener("click", function SearchResultComponent_table_0_th_10_Template_div_click_2_listener() { i0.ɵɵrestoreView(_r22); const col_r15 = ctx.$implicit; const ctx_r21 = i0.ɵɵnextContext(2); return ctx_r21.sort(col_r15); });
|
|
27677
|
+
i0.ɵɵtext(3);
|
|
27451
27678
|
i0.ɵɵelementEnd();
|
|
27679
|
+
i0.ɵɵtemplate(4, SearchResultComponent_table_0_th_10_div_4_Template, 2, 1, "div", 26);
|
|
27452
27680
|
i0.ɵɵelementEnd();
|
|
27453
27681
|
i0.ɵɵelementEnd();
|
|
27454
27682
|
} if (rf & 2) {
|
|
@@ -27456,7 +27684,7 @@ function SearchResultComponent_table_0_th_10_Template(rf, ctx) { if (rf & 1) {
|
|
|
27456
27684
|
const ctx_r7 = i0.ɵɵnextContext(2);
|
|
27457
27685
|
i0.ɵɵadvance(1);
|
|
27458
27686
|
i0.ɵɵattribute("aria-label", "Sort by " + col_r15.label + " " + ctx_r7.isSortAscending(col_r15) ? "ascending" : "descending");
|
|
27459
|
-
i0.ɵɵadvance(
|
|
27687
|
+
i0.ɵɵadvance(2);
|
|
27460
27688
|
i0.ɵɵtextInterpolate(col_r15.label);
|
|
27461
27689
|
i0.ɵɵadvance(1);
|
|
27462
27690
|
i0.ɵɵproperty("ngIf", ctx_r7.comparator(col_r15));
|
|
@@ -27728,7 +27956,7 @@ function SearchResultComponent_table_0_Template(rf, ctx) { if (rf & 1) {
|
|
|
27728
27956
|
i0.ɵɵelementStart(7, "thead");
|
|
27729
27957
|
i0.ɵɵelementStart(8, "tr", 7);
|
|
27730
27958
|
i0.ɵɵtemplate(9, SearchResultComponent_table_0_th_9_Template, 4, 2, "th", 8);
|
|
27731
|
-
i0.ɵɵtemplate(10, SearchResultComponent_table_0_th_10_Template,
|
|
27959
|
+
i0.ɵɵtemplate(10, SearchResultComponent_table_0_th_10_Template, 5, 3, "th", 9);
|
|
27732
27960
|
i0.ɵɵtemplate(11, SearchResultComponent_table_0_th_11_Template, 1, 0, "th", 10);
|
|
27733
27961
|
i0.ɵɵelementEnd();
|
|
27734
27962
|
i0.ɵɵelementEnd();
|