@senior-gestao-pessoas/payroll-core 9.8.0 → 9.9.0

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.
@@ -2871,62 +2871,97 @@ var InputRestAutoCompleteComponent = /** @class */ (function () {
2871
2871
  InputRestAutoCompleteComponent.prototype.filterQuery = function (event) {
2872
2872
  var _this = this;
2873
2873
  var query = event.query;
2874
- if (!(isNaN(query) && query.toString().length < this.minCharactersToSearch)) {
2874
+ if (!(Number.isNaN(query) && query.toString().length < this.minCharactersToSearch)) {
2875
2875
  try {
2876
- if (this.isTimetrackingSituation) {
2877
- return this.service
2878
- .query('autocompleteTimetrackingSituation', {
2879
- valueSearch: query,
2880
- referenceDate: this.referenceDate,
2881
- })
2882
- .subscribe(function (payload) { return _this.formaterResponce(payload.result); });
2883
- }
2884
- else if (this.isDismissalReason) {
2885
- var params = { valueSearch: query };
2886
- if (this.referenceDate) {
2887
- params['referenceDate'] = this.referenceDate;
2888
- }
2889
- return this.service
2890
- .query('autocompleteDismissalReason', params, ServiceType.GENERAL_REGISTER)
2891
- .subscribe(function (payload) { return _this.formaterResponce(payload.result); });
2892
- }
2893
- else if (this.usingType && this.usingType.length) {
2894
- return this.service
2895
- .query('autocompleteOtherCompanyFilterUsingType', {
2896
- searchText: query,
2897
- usingType: this.usingType,
2898
- })
2899
- .subscribe(function (payload) { return _this.formaterResponce(payload.result); });
2900
- }
2901
- else if (this.isDepartmentFromCompany) {
2902
- return this.service
2903
- .query('autocompleteDepartmentQuery', {
2904
- searchText: query,
2905
- companyId: this.companyId,
2906
- referenceDate: this.referenceDate,
2907
- })
2908
- .subscribe(function (payload) { return _this.formaterResponce(payload.result); });
2909
- }
2910
- else if (this.isSituationDefinition) {
2911
- var params = { searchText: query };
2912
- return this.service
2913
- .query('autocompleteSituationDefinitionQuery', params, ServiceType.ORGANIZATION_REGISTER)
2914
- .subscribe(function (payload) { return _this.formaterResponce(payload.result); });
2915
- }
2916
- else if (this.isWagetype) {
2917
- var params = { searchText: query, companyId: this.companyId };
2918
- return this.service
2919
- .query('autocompleteWagetypeQuery', params, ServiceType.ENTRY)
2920
- .subscribe(function (payload) { return _this.formaterResponce(payload.result); });
2921
- }
2922
- this.service
2923
- .query('autocomplete', this.getParamsRest(query), this.serviceType).subscribe(function (payload) { return _this.formaterResponce(payload.result); });
2876
+ var queryConfig = this.getQueryConfiguration(query);
2877
+ return this.service
2878
+ .query(queryConfig.endpoint, queryConfig.params, queryConfig.serviceType)
2879
+ .subscribe(function (payload) { return _this.formaterResponce(payload.result); });
2924
2880
  }
2925
2881
  catch (e) {
2926
2882
  console.log(e);
2927
2883
  }
2928
2884
  }
2929
2885
  };
2886
+ InputRestAutoCompleteComponent.prototype.getQueryConfiguration = function (query) {
2887
+ var _this = this;
2888
+ var queryStrategies = [
2889
+ {
2890
+ condition: function () { return _this.isTimetrackingSituation; },
2891
+ endpoint: 'autocompleteTimetrackingSituation',
2892
+ params: function () { return ({
2893
+ valueSearch: query,
2894
+ referenceDate: _this.referenceDate,
2895
+ }); },
2896
+ serviceType: this.serviceType,
2897
+ },
2898
+ {
2899
+ condition: function () { return _this.isDismissalReason; },
2900
+ endpoint: 'autocompleteDismissalReason',
2901
+ params: function () {
2902
+ var params = { valueSearch: query };
2903
+ if (_this.referenceDate) {
2904
+ params['referenceDate'] = _this.referenceDate;
2905
+ }
2906
+ return params;
2907
+ },
2908
+ serviceType: ServiceType.GENERAL_REGISTER,
2909
+ },
2910
+ {
2911
+ condition: function () { return _this.usingType && _this.usingType.length; },
2912
+ endpoint: 'autocompleteOtherCompanyFilterUsingType',
2913
+ params: function () { return ({
2914
+ searchText: query,
2915
+ usingType: _this.usingType,
2916
+ }); },
2917
+ serviceType: this.serviceType,
2918
+ },
2919
+ {
2920
+ condition: function () { return _this.isDepartmentFromCompany; },
2921
+ endpoint: 'autocompleteDepartmentQuery',
2922
+ params: function () { return ({
2923
+ searchText: query,
2924
+ companyId: _this.companyId,
2925
+ referenceDate: _this.referenceDate,
2926
+ }); },
2927
+ serviceType: this.serviceType,
2928
+ },
2929
+ {
2930
+ condition: function () { return _this.isSituationDefinition; },
2931
+ endpoint: 'autocompleteSituationDefinitionQuery',
2932
+ params: function () { return ({ searchText: query }); },
2933
+ serviceType: ServiceType.ORGANIZATION_REGISTER,
2934
+ },
2935
+ {
2936
+ condition: function () { return _this.isWagetype; },
2937
+ endpoint: 'autocompleteWagetypeQuery',
2938
+ params: function () { return ({
2939
+ searchText: query,
2940
+ companyId: _this.companyId,
2941
+ }); },
2942
+ serviceType: ServiceType.ENTRY,
2943
+ },
2944
+ {
2945
+ condition: function () { return _this.isTransportationVoucherScaleGroup; },
2946
+ endpoint: 'autocompleteTransportationVoucherScaleGroupQuery',
2947
+ params: function () { return ({ searchText: query }); },
2948
+ serviceType: ServiceType.GENERAL_REGISTER,
2949
+ },
2950
+ ];
2951
+ var strategy = queryStrategies.find(function (s) { return s.condition(); });
2952
+ if (strategy) {
2953
+ return {
2954
+ endpoint: strategy.endpoint,
2955
+ params: strategy.params(),
2956
+ serviceType: strategy.serviceType,
2957
+ };
2958
+ }
2959
+ return {
2960
+ endpoint: 'autocomplete',
2961
+ params: this.getParamsRest(query),
2962
+ serviceType: this.serviceType,
2963
+ };
2964
+ };
2930
2965
  InputRestAutoCompleteComponent.prototype.formaterResponce = function (result) {
2931
2966
  var _this = this;
2932
2967
  this.suggestions = [];
@@ -3150,6 +3185,9 @@ var InputRestAutoCompleteComponent = /** @class */ (function () {
3150
3185
  __decorate([
3151
3186
  Input()
3152
3187
  ], InputRestAutoCompleteComponent.prototype, "multiple", void 0);
3188
+ __decorate([
3189
+ Input()
3190
+ ], InputRestAutoCompleteComponent.prototype, "isTransportationVoucherScaleGroup", void 0);
3153
3191
  __decorate([
3154
3192
  Input()
3155
3193
  ], InputRestAutoCompleteComponent.prototype, "serviceType", void 0);