@senior-gestao-pessoas/hcm-entity-lookups 5.6.0-develop-858caee6 → 5.6.1-develop-8344af66
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/senior-gestao-pessoas-hcm-entity-lookups.umd.js +169 -64
- package/bundles/senior-gestao-pessoas-hcm-entity-lookups.umd.js.map +1 -1
- package/bundles/senior-gestao-pessoas-hcm-entity-lookups.umd.min.js +1 -1
- package/bundles/senior-gestao-pessoas-hcm-entity-lookups.umd.min.js.map +1 -1
- package/core/dto/lookup-service-config.d.ts +3 -0
- package/esm2015/core/dto/lookup-service-config.js +1 -1
- package/esm2015/lookups/characteristics-lookup/characteristics-lookup.service.js +1 -2
- package/esm2015/lookups/employee-lookup/employee-lookup.component.js +3 -3
- package/esm2015/lookups/employee-lookup/employee-lookup.service.js +170 -63
- package/esm2015/shared/utils/utils.js +1 -1
- package/esm5/core/dto/lookup-service-config.js +1 -1
- package/esm5/lookups/characteristics-lookup/characteristics-lookup.service.js +1 -2
- package/esm5/lookups/employee-lookup/employee-lookup.component.js +3 -3
- package/esm5/lookups/employee-lookup/employee-lookup.service.js +169 -63
- package/esm5/shared/utils/utils.js +1 -1
- package/fesm2015/senior-gestao-pessoas-hcm-entity-lookups.js +170 -64
- package/fesm2015/senior-gestao-pessoas-hcm-entity-lookups.js.map +1 -1
- package/fesm5/senior-gestao-pessoas-hcm-entity-lookups.js +169 -64
- package/fesm5/senior-gestao-pessoas-hcm-entity-lookups.js.map +1 -1
- package/lookups/employee-lookup/employee-lookup.service.d.ts +27 -9
- package/package.json +1 -1
- package/senior-gestao-pessoas-hcm-entity-lookups.metadata.json +1 -1
|
@@ -2954,23 +2954,60 @@
|
|
|
2954
2954
|
this.translate = translate;
|
|
2955
2955
|
this.configService = configService;
|
|
2956
2956
|
this.employeeService = employeeService;
|
|
2957
|
-
this.
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2957
|
+
this.lookupServiceConfig = {
|
|
2958
|
+
lookupDisplayFields: ["employer.codEmp", "employer.nomEmp", "code", "person.nomPes", "person.cnpCpf", "employmentRelationship.contractType"],
|
|
2959
|
+
lookupSuggestionFields: ["employer.codEmp", "employer.nomEmp", "code", "person.nomPes", "employmentRelationship.contractType"],
|
|
2960
|
+
lookupSeparator: " - ",
|
|
2961
|
+
searchSubject: new rxjs.Subject(),
|
|
2962
|
+
lookupSubject: new rxjs.Subject(),
|
|
2963
|
+
entityName: "employee",
|
|
2964
|
+
dynamicFormOptions: {
|
|
2965
|
+
cancelLabel: this.translate.instant(this.configService.getTranslationPrefix() + ".cancel"),
|
|
2966
|
+
clearLabel: this.translate.instant(this.configService.getTranslationPrefix() + ".clear"),
|
|
2967
|
+
dataKey: "id",
|
|
2968
|
+
emptyFieldLabel: this.translate.instant(this.configService.getTranslationPrefix() + ".list_grid_empty_field"),
|
|
2969
|
+
emptyMessage: this.translate.instant(this.configService.getTranslationPrefix() + ".empty_message_field"),
|
|
2970
|
+
filterLabel: this.translate.instant(this.configService.getTranslationPrefix() + ".filter"),
|
|
2971
|
+
filterTitle: this.translate.instant(this.configService.getTranslationPrefix() + ".filters"),
|
|
2972
|
+
label: this.translate.instant(this.configService.getTranslationPrefix() + ".employee"),
|
|
2973
|
+
lookupDisplayField: "label",
|
|
2974
|
+
multiple: false,
|
|
2975
|
+
name: "employee",
|
|
2976
|
+
recordLabel: this.translate.instant(this.configService.getTranslationPrefix() + ".records_found"),
|
|
2977
|
+
recordsLabel: this.translate.instant(this.configService.getTranslationPrefix() + ".records_found"),
|
|
2978
|
+
required: false,
|
|
2979
|
+
searchEmptyTitle: this.translate.instant(this.configService.getTranslationPrefix() + ".nothing_found"),
|
|
2980
|
+
searchFields: this.getEmployeeSearchFields(),
|
|
2981
|
+
searchGridFields: this.getEmployeeSearchGridFields(),
|
|
2982
|
+
searchTitle: this.translate.instant(this.configService.getTranslationPrefix() + ".employee_search_title"),
|
|
2983
|
+
selectLabel: this.translate.instant(this.configService.getTranslationPrefix() + ".select"),
|
|
2984
|
+
visible: true,
|
|
2985
|
+
isCollective: false,
|
|
2986
|
+
},
|
|
2987
|
+
filters: {
|
|
2988
|
+
additionalFilter: undefined,
|
|
2989
|
+
initialFilter: undefined,
|
|
2990
|
+
companyIds: [],
|
|
2991
|
+
situation: undefined,
|
|
2992
|
+
},
|
|
2993
|
+
fieldsForValidation: ["hireDate", "dismissalDate", "modelGroup.id"],
|
|
2994
|
+
};
|
|
2962
2995
|
this.ngUnsubscribe = new rxjs.Subject();
|
|
2963
2996
|
}
|
|
2964
2997
|
EmployeeLookupService.prototype.updateSuggestions = function (value) {
|
|
2965
2998
|
var _a, _b;
|
|
2966
|
-
if (value === null || value === void 0 ? void 0 : value.
|
|
2967
|
-
if ((_b = (_a = value.
|
|
2968
|
-
value.
|
|
2969
|
-
.loadLabelFromEnum(value.
|
|
2999
|
+
if (value === null || value === void 0 ? void 0 : value[this.lookupServiceConfig.entityName]) {
|
|
3000
|
+
if ((_b = (_a = value[this.lookupServiceConfig.entityName]) === null || _a === void 0 ? void 0 : _a.employmentRelationship) === null || _b === void 0 ? void 0 : _b.contractType) {
|
|
3001
|
+
value[this.lookupServiceConfig.entityName].employmentRelationship.contractTypeLabel = this.employeeService
|
|
3002
|
+
.loadLabelFromEnum(value[this.lookupServiceConfig.entityName].employmentRelationship.contractType);
|
|
2970
3003
|
}
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
3004
|
+
var suggestionFields = this.lookupServiceConfig.lookupSuggestionFields
|
|
3005
|
+
.map(function (field) { return field === "employmentRelationship.contractType"
|
|
3006
|
+
? "employmentRelationship.contractTypeLabel"
|
|
3007
|
+
: field; });
|
|
3008
|
+
value[this.lookupServiceConfig.entityName].label = this.getSuggestionValue(suggestionFields, this.lookupServiceConfig.entityName, value, this.lookupServiceConfig.lookupSeparator);
|
|
3009
|
+
if (value[this.lookupServiceConfig.entityName].label.trim() === this.lookupServiceConfig.lookupSeparator.trim()) {
|
|
3010
|
+
delete value[this.lookupServiceConfig.entityName].label;
|
|
2974
3011
|
}
|
|
2975
3012
|
}
|
|
2976
3013
|
};
|
|
@@ -2979,8 +3016,29 @@
|
|
|
2979
3016
|
.map(function (field) { return getProp(value, ownerEntity + "." + field); })
|
|
2980
3017
|
.reduce(function (acc, val) { return "" + acc + separator + val; });
|
|
2981
3018
|
};
|
|
3019
|
+
/**
|
|
3020
|
+
* @deprecated Use lookupServiceConfig.filters e lookupServiceConfig.dynamicFormOptions
|
|
3021
|
+
* para configurar o lookup antes de chamar _getFormField().
|
|
3022
|
+
*
|
|
3023
|
+
* Exemplo de migração:
|
|
3024
|
+
* ```
|
|
3025
|
+
* // Antes:
|
|
3026
|
+
* this.employeeLookupService.getFormField(false, ['idempresa'], 'filtro')
|
|
3027
|
+
*
|
|
3028
|
+
* Este método será removido em versões futuras.
|
|
3029
|
+
*
|
|
3030
|
+
* // Depois:
|
|
3031
|
+
* this.employeeLookupService.lookupServiceConfig.dynamicFormOptions.isCollective = false;
|
|
3032
|
+
* this.employeeLookupService.lookupServiceConfig.filters.companyIds = ['id-empresa'];
|
|
3033
|
+
* this.employeeLookupService.lookupServiceConfig.filters.additionalFilter = 'filtro';
|
|
3034
|
+
* this.employeeLookupService._getFormField()
|
|
3035
|
+
* ```
|
|
3036
|
+
*/
|
|
2982
3037
|
EmployeeLookupService.prototype.getFormField = function (isCollective, companyIds, additionalFilter) {
|
|
2983
3038
|
var _this = this;
|
|
3039
|
+
var _a, _b;
|
|
3040
|
+
this.lookupServiceConfig.filters.companyIds = companyIds;
|
|
3041
|
+
this.lookupServiceConfig.filters.additionalFilter = additionalFilter;
|
|
2984
3042
|
return new angularComponents.FormField({
|
|
2985
3043
|
cancelLabel: this.translate.instant(this.configService.getTranslationPrefix() + ".cancel"),
|
|
2986
3044
|
clearLabel: this.translate.instant(this.configService.getTranslationPrefix() + ".clear"),
|
|
@@ -2993,23 +3051,54 @@
|
|
|
2993
3051
|
lookupDisplayField: "label",
|
|
2994
3052
|
multiple: false,
|
|
2995
3053
|
name: "employee",
|
|
2996
|
-
onLookupRequest: function (value) { return _this.onEmployeeLookupRequest(value
|
|
2997
|
-
onSearchRequest: function (event) { return _this.onEmployeeSearchRequest(event
|
|
3054
|
+
onLookupRequest: function (value) { return _this.onEmployeeLookupRequest(value); },
|
|
3055
|
+
onSearchRequest: function (event) { return _this.onEmployeeSearchRequest(event); },
|
|
2998
3056
|
recordLabel: this.translate.instant(this.configService.getTranslationPrefix() + ".records_found"),
|
|
2999
3057
|
recordsLabel: this.translate.instant(this.configService.getTranslationPrefix() + ".records_found"),
|
|
3000
3058
|
required: function () { return true; },
|
|
3001
3059
|
searchEmptyTitle: this.translate.instant(this.configService.getTranslationPrefix() + ".nothing_found"),
|
|
3002
|
-
searchFields: this.
|
|
3003
|
-
searchGridFields: this.
|
|
3004
|
-
searchObservable: this.
|
|
3060
|
+
searchFields: (_a = this.lookupServiceConfig.dynamicFormOptions) === null || _a === void 0 ? void 0 : _a.searchFields,
|
|
3061
|
+
searchGridFields: (_b = this.lookupServiceConfig.dynamicFormOptions) === null || _b === void 0 ? void 0 : _b.searchGridFields,
|
|
3062
|
+
searchObservable: this.lookupServiceConfig.searchSubject,
|
|
3005
3063
|
searchTitle: this.translate.instant(this.configService.getTranslationPrefix() + ".employee_search_title"),
|
|
3006
3064
|
selectLabel: this.translate.instant(this.configService.getTranslationPrefix() + ".select"),
|
|
3007
|
-
suggestionsObservable: this.
|
|
3065
|
+
suggestionsObservable: this.lookupServiceConfig.lookupSubject,
|
|
3008
3066
|
type: angularComponents.FieldType.Lookup,
|
|
3009
3067
|
visible: function () { return !isCollective; },
|
|
3010
3068
|
});
|
|
3011
3069
|
};
|
|
3012
|
-
EmployeeLookupService.prototype.
|
|
3070
|
+
EmployeeLookupService.prototype._getFormField = function () {
|
|
3071
|
+
var _this = this;
|
|
3072
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
3073
|
+
return new angularComponents.FormField({
|
|
3074
|
+
cancelLabel: (_a = this.lookupServiceConfig.dynamicFormOptions) === null || _a === void 0 ? void 0 : _a.cancelLabel,
|
|
3075
|
+
clearLabel: (_b = this.lookupServiceConfig.dynamicFormOptions) === null || _b === void 0 ? void 0 : _b.clearLabel,
|
|
3076
|
+
recordLabel: (_c = this.lookupServiceConfig.dynamicFormOptions) === null || _c === void 0 ? void 0 : _c.recordLabel,
|
|
3077
|
+
recordsLabel: (_d = this.lookupServiceConfig.dynamicFormOptions) === null || _d === void 0 ? void 0 : _d.recordsLabel,
|
|
3078
|
+
searchEmptyTitle: (_e = this.lookupServiceConfig.dynamicFormOptions) === null || _e === void 0 ? void 0 : _e.searchEmptyTitle,
|
|
3079
|
+
searchFields: (_f = this.lookupServiceConfig.dynamicFormOptions) === null || _f === void 0 ? void 0 : _f.searchFields,
|
|
3080
|
+
searchTitle: (_g = this.lookupServiceConfig.dynamicFormOptions) === null || _g === void 0 ? void 0 : _g.searchTitle,
|
|
3081
|
+
selectLabel: (_h = this.lookupServiceConfig.dynamicFormOptions) === null || _h === void 0 ? void 0 : _h.selectLabel,
|
|
3082
|
+
dataKey: (_j = this.lookupServiceConfig.dynamicFormOptions) === null || _j === void 0 ? void 0 : _j.dataKey,
|
|
3083
|
+
emptyFieldLabel: (_k = this.lookupServiceConfig.dynamicFormOptions) === null || _k === void 0 ? void 0 : _k.emptyFieldLabel,
|
|
3084
|
+
emptyMessage: (_l = this.lookupServiceConfig.dynamicFormOptions) === null || _l === void 0 ? void 0 : _l.emptyMessage,
|
|
3085
|
+
filterLabel: (_m = this.lookupServiceConfig.dynamicFormOptions) === null || _m === void 0 ? void 0 : _m.filterLabel,
|
|
3086
|
+
filterTitle: (_o = this.lookupServiceConfig.dynamicFormOptions) === null || _o === void 0 ? void 0 : _o.filterTitle,
|
|
3087
|
+
label: (_p = this.lookupServiceConfig.dynamicFormOptions) === null || _p === void 0 ? void 0 : _p.label,
|
|
3088
|
+
lookupDisplayField: (_q = this.lookupServiceConfig.dynamicFormOptions) === null || _q === void 0 ? void 0 : _q.lookupDisplayField,
|
|
3089
|
+
multiple: (_r = this.lookupServiceConfig.dynamicFormOptions) === null || _r === void 0 ? void 0 : _r.multiple,
|
|
3090
|
+
name: (_s = this.lookupServiceConfig.dynamicFormOptions) === null || _s === void 0 ? void 0 : _s.name,
|
|
3091
|
+
onLookupRequest: function (value) { return _this.onEmployeeLookupRequest(value); },
|
|
3092
|
+
onSearchRequest: function (event) { return _this.onEmployeeSearchRequest(event); },
|
|
3093
|
+
required: function () { var _a; return (_a = _this.lookupServiceConfig.dynamicFormOptions) === null || _a === void 0 ? void 0 : _a.required; },
|
|
3094
|
+
searchObservable: this.lookupServiceConfig.searchSubject,
|
|
3095
|
+
suggestionsObservable: this.lookupServiceConfig.lookupSubject,
|
|
3096
|
+
type: angularComponents.FieldType.Lookup,
|
|
3097
|
+
visible: function () { var _a; return !((_a = _this.lookupServiceConfig.dynamicFormOptions) === null || _a === void 0 ? void 0 : _a.isCollective); },
|
|
3098
|
+
searchGridFields: (_t = this.lookupServiceConfig.dynamicFormOptions) === null || _t === void 0 ? void 0 : _t.searchGridFields,
|
|
3099
|
+
});
|
|
3100
|
+
};
|
|
3101
|
+
EmployeeLookupService.prototype.getEmployeeSearchGridFields = function () {
|
|
3013
3102
|
return __spread(this.getEmployeeLookupFields(), [
|
|
3014
3103
|
new angularComponents.FormField({
|
|
3015
3104
|
label: this.translate
|
|
@@ -3021,6 +3110,18 @@
|
|
|
3021
3110
|
}),
|
|
3022
3111
|
]);
|
|
3023
3112
|
};
|
|
3113
|
+
EmployeeLookupService.prototype.getEmployeeSearchFields = function () {
|
|
3114
|
+
return __spread(this.getFieldInSearchRequestFilter(), [
|
|
3115
|
+
new angularComponents.FormField({
|
|
3116
|
+
label: this.translate
|
|
3117
|
+
.instant(this.configService.getTranslationPrefix() + ".employee_situation"),
|
|
3118
|
+
options: this.employeeService.situationOptions,
|
|
3119
|
+
defaultValue: exports.SituationEmployee.WORKING,
|
|
3120
|
+
name: "situation",
|
|
3121
|
+
type: angularComponents.FieldType.Enum,
|
|
3122
|
+
}),
|
|
3123
|
+
]);
|
|
3124
|
+
};
|
|
3024
3125
|
EmployeeLookupService.prototype.getEmployeeLookupFields = function () {
|
|
3025
3126
|
return [
|
|
3026
3127
|
new angularComponents.FormField({
|
|
@@ -3033,11 +3134,6 @@
|
|
|
3033
3134
|
name: "code",
|
|
3034
3135
|
type: angularComponents.FieldType.Integer,
|
|
3035
3136
|
}),
|
|
3036
|
-
new angularComponents.FormField({
|
|
3037
|
-
label: this.translate.instant(this.configService.getTranslationPrefix() + ".employee_person_nom_pes"),
|
|
3038
|
-
name: "person.nomPes",
|
|
3039
|
-
type: angularComponents.FieldType.String,
|
|
3040
|
-
}),
|
|
3041
3137
|
new angularComponents.FormField({
|
|
3042
3138
|
label: this.translate
|
|
3043
3139
|
.instant(this.configService.getTranslationPrefix() + ".employee_employment_relationship_contract_type"),
|
|
@@ -3045,26 +3141,43 @@
|
|
|
3045
3141
|
options: this.employeeService.contractTypeOptions,
|
|
3046
3142
|
type: angularComponents.FieldType.Enum,
|
|
3047
3143
|
}),
|
|
3144
|
+
new angularComponents.FormField({
|
|
3145
|
+
label: this.translate.instant(this.configService.getTranslationPrefix() + ".employee_person_nom_pes"),
|
|
3146
|
+
name: "person.nomPes",
|
|
3147
|
+
type: angularComponents.FieldType.String,
|
|
3148
|
+
}),
|
|
3048
3149
|
];
|
|
3049
3150
|
};
|
|
3151
|
+
EmployeeLookupService.prototype.getFieldInSearchRequestFilter = function () {
|
|
3152
|
+
return __spread(this.getEmployeeLookupFields(), [
|
|
3153
|
+
new angularComponents.FormField({
|
|
3154
|
+
label: this.translate.instant(this.configService.getTranslationPrefix() + ".employee_cpf"),
|
|
3155
|
+
name: "person.cnpCpf",
|
|
3156
|
+
type: angularComponents.FieldType.Number,
|
|
3157
|
+
mask: "999.999.999-99"
|
|
3158
|
+
})
|
|
3159
|
+
]);
|
|
3160
|
+
};
|
|
3050
3161
|
EmployeeLookupService.prototype.getFieldInLoookupRequestFilter = function () {
|
|
3051
3162
|
return [
|
|
3052
3163
|
new angularComponents.FormField({
|
|
3053
|
-
label: this.translate.instant(this.configService.getTranslationPrefix() + ".employee_code"),
|
|
3054
3164
|
name: "code",
|
|
3055
3165
|
type: angularComponents.FieldType.Integer,
|
|
3056
3166
|
}),
|
|
3057
3167
|
new angularComponents.FormField({
|
|
3058
|
-
|
|
3168
|
+
name: "person.cnpCpf",
|
|
3169
|
+
type: angularComponents.FieldType.Number,
|
|
3170
|
+
}),
|
|
3171
|
+
new angularComponents.FormField({
|
|
3059
3172
|
name: "person.nomPes",
|
|
3060
3173
|
type: angularComponents.FieldType.String,
|
|
3061
3174
|
}),
|
|
3062
3175
|
];
|
|
3063
3176
|
};
|
|
3064
|
-
EmployeeLookupService.prototype.onEmployeeSearchRequest = function (event
|
|
3177
|
+
EmployeeLookupService.prototype.onEmployeeSearchRequest = function (event) {
|
|
3065
3178
|
var _this = this;
|
|
3066
|
-
|
|
3067
|
-
|
|
3179
|
+
var _a, _b, _c, _d;
|
|
3180
|
+
this.onEmployeeSearchRequestObservable(event, (_b = (_a = this.lookupServiceConfig) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.companyIds, true, (_d = (_c = this.lookupServiceConfig) === null || _c === void 0 ? void 0 : _c.filters) === null || _d === void 0 ? void 0 : _d.additionalFilter).subscribe(function (data) { return _this.lookupServiceConfig.searchSubject.next(data); });
|
|
3068
3181
|
};
|
|
3069
3182
|
EmployeeLookupService.prototype.onEmployeeSearchRequestObservable = function (event, companyIds, isDynamicForm, additionalFilter) {
|
|
3070
3183
|
var _this = this;
|
|
@@ -3072,9 +3185,12 @@
|
|
|
3072
3185
|
var first = event.first, rows = event.rows, multiSortMeta = event.multiSortMeta, filterData = event.filterData;
|
|
3073
3186
|
var page = first / rows;
|
|
3074
3187
|
var sort = multiSortMeta;
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3188
|
+
if (filterData === null || filterData === void 0 ? void 0 : filterData['person.cnpCpf']) {
|
|
3189
|
+
filterData['person.cnpCpf'] = filterData['person.cnpCpf'].replace(/\D/g, '');
|
|
3190
|
+
}
|
|
3191
|
+
var employeeFilterQuery = createSearchRequestFilter(filterData, this.getFieldInSearchRequestFilter());
|
|
3192
|
+
employeeFilterQuery = this.getFiltersDefaultEmployee(companyIds, employeeFilterQuery, additionalFilter, filterData === null || filterData === void 0 ? void 0 : filterData.situation);
|
|
3193
|
+
var displayFields = mergeUnique(this.lookupServiceConfig.lookupDisplayFields, this.lookupServiceConfig.fieldsForValidation);
|
|
3078
3194
|
return this.employeeService
|
|
3079
3195
|
.list({ page: page, sort: sort, filterQuery: employeeFilterQuery, displayFields: displayFields })
|
|
3080
3196
|
.pipe(operators.takeUntil(this.ngUnsubscribe), operators.map(function (list) { return _this.mapToComponent(list, isDynamicForm); }));
|
|
@@ -3101,7 +3217,7 @@
|
|
|
3101
3217
|
};
|
|
3102
3218
|
EmployeeLookupService.prototype.getLabelForMaping = function (item) {
|
|
3103
3219
|
var _this = this;
|
|
3104
|
-
return this.
|
|
3220
|
+
return this.lookupServiceConfig.lookupSuggestionFields
|
|
3105
3221
|
.map(function (field) {
|
|
3106
3222
|
if (field.indexOf(".") > 0) {
|
|
3107
3223
|
item[field] = getProp(item, field);
|
|
@@ -3111,50 +3227,40 @@
|
|
|
3111
3227
|
}
|
|
3112
3228
|
return item[field];
|
|
3113
3229
|
})
|
|
3114
|
-
.join(this.
|
|
3230
|
+
.join(this.lookupServiceConfig.lookupSeparator);
|
|
3115
3231
|
};
|
|
3116
|
-
EmployeeLookupService.prototype.onEmployeeLookupRequest = function (value
|
|
3232
|
+
EmployeeLookupService.prototype.onEmployeeLookupRequest = function (value) {
|
|
3117
3233
|
var _this = this;
|
|
3118
|
-
|
|
3119
|
-
|
|
3234
|
+
var _a, _b, _c, _d;
|
|
3235
|
+
this.onEmployeeLookupRequestObservable(value, (_b = (_a = this.lookupServiceConfig) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.companyIds, (_d = (_c = this.lookupServiceConfig) === null || _c === void 0 ? void 0 : _c.filters) === null || _d === void 0 ? void 0 : _d.additionalFilter).subscribe(function (data) { return _this.lookupServiceConfig.lookupSubject.next(data.contents); });
|
|
3120
3236
|
};
|
|
3121
3237
|
EmployeeLookupService.prototype.onEmployeeLookupRequestObservable = function (value, companyIds, additionalFilter) {
|
|
3122
3238
|
var _this = this;
|
|
3123
|
-
var sort = this.
|
|
3239
|
+
var sort = this.lookupServiceConfig.lookupDisplayFields.map(function (field) { return ({
|
|
3124
3240
|
field: field,
|
|
3125
3241
|
order: 1,
|
|
3126
3242
|
}); });
|
|
3127
3243
|
var filterQuery = createLookupRequestFilter(value, this.getFieldInLoookupRequestFilter());
|
|
3128
|
-
filterQuery = this.
|
|
3129
|
-
var displayFields = mergeUnique(this.
|
|
3244
|
+
filterQuery = this.getFiltersDefaultEmployee(companyIds, filterQuery, additionalFilter, null);
|
|
3245
|
+
var displayFields = mergeUnique(this.lookupServiceConfig.lookupDisplayFields, this.lookupServiceConfig.fieldsForValidation);
|
|
3130
3246
|
return this.employeeService
|
|
3131
3247
|
.list({ sort: sort, filterQuery: filterQuery, displayFields: displayFields })
|
|
3132
3248
|
.pipe(operators.takeUntil(this.ngUnsubscribe))
|
|
3133
|
-
.pipe(operators.map(function (list) { return (__assign(__assign({}, list), { contents: list.contents.map(function (item) { return (__assign(__assign({}, item), { label: _this.
|
|
3134
|
-
.map(function (field) {
|
|
3135
|
-
if (field.indexOf(".") > 0) {
|
|
3136
|
-
item[field] = getProp(item, field);
|
|
3137
|
-
}
|
|
3138
|
-
if (field === "employmentRelationship.contractType") {
|
|
3139
|
-
item[field] = _this.employeeService.loadLabelFromEnum(item[field]);
|
|
3140
|
-
}
|
|
3141
|
-
return item[field];
|
|
3142
|
-
})
|
|
3143
|
-
.join(_this.employeeLookupSeparator) })); }) })); }));
|
|
3249
|
+
.pipe(operators.map(function (list) { return (__assign(__assign({}, list), { contents: list.contents.map(function (item) { return (__assign(__assign({}, item), { label: _this.getLabelForMaping(item) })); }) })); }));
|
|
3144
3250
|
};
|
|
3145
|
-
EmployeeLookupService.prototype.
|
|
3146
|
-
var
|
|
3251
|
+
EmployeeLookupService.prototype.getFiltersDefaultEmployee = function (companyIds, filterData, additionalFilter, situationEmployee) {
|
|
3252
|
+
var filters = [];
|
|
3147
3253
|
var nowDate = moment$l().format('YYYY-MM-DD');
|
|
3148
|
-
if (situationEmployee
|
|
3149
|
-
|
|
3254
|
+
if (situationEmployee === exports.SituationEmployee.WORKING) {
|
|
3255
|
+
filters.push("(dismissalDate is null or dismissalDate gt '" + nowDate + "')");
|
|
3150
3256
|
}
|
|
3151
|
-
else if (situationEmployee
|
|
3152
|
-
|
|
3257
|
+
else if (situationEmployee === exports.SituationEmployee.DISMISSED) {
|
|
3258
|
+
filters.push("(dismissalDate is not null and dismissalDate le '" + nowDate + "')");
|
|
3153
3259
|
}
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
(
|
|
3157
|
-
return
|
|
3260
|
+
additionalFilter && filters.push("(" + additionalFilter + ")");
|
|
3261
|
+
filterData && filters.push("(" + filterData + ")");
|
|
3262
|
+
(companyIds === null || companyIds === void 0 ? void 0 : companyIds.length) && filters.push("(employer.id in (" + companyIds.map(function (id) { return "'" + id + "'"; }) + "))");
|
|
3263
|
+
return filters.join(' and ');
|
|
3158
3264
|
};
|
|
3159
3265
|
EmployeeLookupService.ctorParameters = function () { return [
|
|
3160
3266
|
{ type: core$1.TranslateService },
|
|
@@ -3180,8 +3286,8 @@
|
|
|
3180
3286
|
return _this;
|
|
3181
3287
|
}
|
|
3182
3288
|
EmployeeLookupComponent.prototype.ngOnInit = function () {
|
|
3183
|
-
this.employeeSearchFields = this.employeeLookupService.
|
|
3184
|
-
this.employeeSearchGridFields = this.employeeLookupService.
|
|
3289
|
+
this.employeeSearchFields = this.employeeLookupService.lookupServiceConfig.dynamicFormOptions.searchFields;
|
|
3290
|
+
this.employeeSearchGridFields = this.employeeLookupService.lookupServiceConfig.dynamicFormOptions.searchGridFields;
|
|
3185
3291
|
};
|
|
3186
3292
|
EmployeeLookupComponent.prototype.onEmployeeLookupRequest = function (value) {
|
|
3187
3293
|
var _this = this;
|
|
@@ -9877,7 +9983,6 @@
|
|
|
9877
9983
|
}); });
|
|
9878
9984
|
var filterQuery = createLookupRequestFilter(value, this.getCharacteristicsFields());
|
|
9879
9985
|
var displayFields = this.characteristicsLookupDisplayFields;
|
|
9880
|
-
debugger;
|
|
9881
9986
|
return this.characteristicsService
|
|
9882
9987
|
.list({ sort: sort, filterQuery: filterQuery, displayFields: displayFields })
|
|
9883
9988
|
.pipe(operators.takeUntil(this.ngUnsubscribe))
|