@arsedizioni/ars-utils 18.2.518 → 18.2.520
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/clipper.ui/ui/document/document.component.d.ts +1 -1
- package/esm2022/clipper.ui/ui/document/document.component.mjs +2 -2
- package/esm2022/clipper.ui/ui/document-manager/document-manager.mjs +1 -1
- package/esm2022/clipper.ui/ui/document-menu/document-menu.component.mjs +4 -4
- package/esm2022/evolution.common/common/definitions.mjs +80 -1
- package/esm2022/evolution.common/common/interceptors/auth.interceptor.mjs +21 -19
- package/esm2022/evolution.common/common/services/evolution.service.mjs +37 -30
- package/evolution.common/common/definitions.d.ts +369 -64
- package/evolution.common/common/services/evolution.service.d.ts +10 -14
- package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs +4 -4
- package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-evolution.common.mjs +137 -49
- package/fesm2022/arsedizioni-ars-utils-evolution.common.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -3,8 +3,8 @@ import { inject, signal, Injectable, NgModule } from '@angular/core';
|
|
|
3
3
|
import { HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http';
|
|
4
4
|
import { BroadcastService, SystemUtils } from '@arsedizioni/ars-utils/core';
|
|
5
5
|
import { DialogService } from '@arsedizioni/ars-utils/ui';
|
|
6
|
-
import { throwError, of, finalize, catchError as catchError$1, switchMap } from 'rxjs';
|
|
7
|
-
import {
|
|
6
|
+
import { throwError, of, finalize as finalize$1, catchError as catchError$1, switchMap } from 'rxjs';
|
|
7
|
+
import { map, finalize, catchError } from 'rxjs/operators';
|
|
8
8
|
|
|
9
9
|
const EvolutionMessages = {
|
|
10
10
|
// Login
|
|
@@ -31,6 +31,68 @@ var ERPModule;
|
|
|
31
31
|
ERPModule[ERPModule["Bollettino"] = 64] = "Bollettino";
|
|
32
32
|
ERPModule[ERPModule["Documenti"] = 128] = "Documenti";
|
|
33
33
|
})(ERPModule || (ERPModule = {}));
|
|
34
|
+
var ERPExportType;
|
|
35
|
+
(function (ERPExportType) {
|
|
36
|
+
ERPExportType[ERPExportType["Basic"] = 1] = "Basic";
|
|
37
|
+
ERPExportType[ERPExportType["Detailed"] = 8] = "Detailed";
|
|
38
|
+
ERPExportType[ERPExportType["Complete"] = 9] = "Complete";
|
|
39
|
+
ERPExportType[ERPExportType["Labels"] = 10] = "Labels";
|
|
40
|
+
ERPExportType[ERPExportType["EmployeesCoursesMatrix"] = 21] = "EmployeesCoursesMatrix";
|
|
41
|
+
ERPExportType[ERPExportType["EmployeesCoursesHoursMatrix"] = 22] = "EmployeesCoursesHoursMatrix";
|
|
42
|
+
ERPExportType[ERPExportType["EmployeesPPEsMatrix"] = 23] = "EmployeesPPEsMatrix";
|
|
43
|
+
ERPExportType[ERPExportType["EmployeesHealthChecksMatrix"] = 24] = "EmployeesHealthChecksMatrix";
|
|
44
|
+
ERPExportType[ERPExportType["TasksCoursesMatrix"] = 31] = "TasksCoursesMatrix";
|
|
45
|
+
ERPExportType[ERPExportType["Training"] = 101] = "Training";
|
|
46
|
+
ERPExportType[ERPExportType["TrainingExpired"] = 102] = "TrainingExpired";
|
|
47
|
+
ERPExportType[ERPExportType["TrainingExpiring"] = 103] = "TrainingExpiring";
|
|
48
|
+
ERPExportType[ERPExportType["TrainingAbsents"] = 104] = "TrainingAbsents";
|
|
49
|
+
ERPExportType[ERPExportType["TrainingClosed"] = 105] = "TrainingClosed";
|
|
50
|
+
ERPExportType[ERPExportType["TrainingCurrentYear"] = 108] = "TrainingCurrentYear";
|
|
51
|
+
ERPExportType[ERPExportType["TrainingNextYear"] = 109] = "TrainingNextYear";
|
|
52
|
+
ERPExportType[ERPExportType["TrainingAnnualPlannng"] = 110] = "TrainingAnnualPlannng";
|
|
53
|
+
ERPExportType[ERPExportType["EquipmentsActivitiesCompleted"] = 201] = "EquipmentsActivitiesCompleted";
|
|
54
|
+
ERPExportType[ERPExportType["EquipmentsChecksMatrix"] = 202] = "EquipmentsChecksMatrix";
|
|
55
|
+
ERPExportType[ERPExportType["RSNormsUsage"] = 301] = "RSNormsUsage";
|
|
56
|
+
ERPExportType[ERPExportType["RSNormsSitesMatrix"] = 302] = "RSNormsSitesMatrix";
|
|
57
|
+
ERPExportType[ERPExportType["RSNormsSummary"] = 303] = "RSNormsSummary";
|
|
58
|
+
ERPExportType[ERPExportType["MonitoringLaws"] = 401] = "MonitoringLaws";
|
|
59
|
+
ERPExportType[ERPExportType["MonitoringActivities"] = 402] = "MonitoringActivities";
|
|
60
|
+
ERPExportType[ERPExportType["MonitoringSummary"] = 403] = "MonitoringSummary";
|
|
61
|
+
ERPExportType[ERPExportType["PPEs"] = 501] = "PPEs";
|
|
62
|
+
ERPExportType[ERPExportType["ComplianceStatistics"] = 601] = "ComplianceStatistics";
|
|
63
|
+
ERPExportType[ERPExportType["HealthChecks"] = 701] = "HealthChecks";
|
|
64
|
+
})(ERPExportType || (ERPExportType = {}));
|
|
65
|
+
var ERPExportFormat;
|
|
66
|
+
(function (ERPExportFormat) {
|
|
67
|
+
ERPExportFormat[ERPExportFormat["Csv"] = 1] = "Csv";
|
|
68
|
+
ERPExportFormat[ERPExportFormat["Word"] = 2] = "Word";
|
|
69
|
+
ERPExportFormat[ERPExportFormat["Pdf"] = 3] = "Pdf";
|
|
70
|
+
})(ERPExportFormat || (ERPExportFormat = {}));
|
|
71
|
+
var ERPExportSource;
|
|
72
|
+
(function (ERPExportSource) {
|
|
73
|
+
ERPExportSource[ERPExportSource["All"] = 1] = "All";
|
|
74
|
+
ERPExportSource[ERPExportSource["Query"] = 2] = "Query";
|
|
75
|
+
ERPExportSource[ERPExportSource["Selection"] = 3] = "Selection";
|
|
76
|
+
})(ERPExportSource || (ERPExportSource = {}));
|
|
77
|
+
var ERPExportPart;
|
|
78
|
+
(function (ERPExportPart) {
|
|
79
|
+
ERPExportPart[ERPExportPart["IncludeRisks"] = 101] = "IncludeRisks";
|
|
80
|
+
ERPExportPart[ERPExportPart["IncludeTasks"] = 102] = "IncludeTasks";
|
|
81
|
+
ERPExportPart[ERPExportPart["IncludeTaskHistory"] = 103] = "IncludeTaskHistory";
|
|
82
|
+
ERPExportPart[ERPExportPart["IncludeTrainingRequired"] = 111] = "IncludeTrainingRequired";
|
|
83
|
+
ERPExportPart[ERPExportPart["IncludeTrainingDone"] = 112] = "IncludeTrainingDone";
|
|
84
|
+
ERPExportPart[ERPExportPart["SelectedEmployeeCourses"] = 121] = "SelectedEmployeeCourses";
|
|
85
|
+
ERPExportPart[ERPExportPart["IncludeDisabledEmployees"] = 131] = "IncludeDisabledEmployees";
|
|
86
|
+
ERPExportPart[ERPExportPart["IncludeDismissedEmployees"] = 132] = "IncludeDismissedEmployees";
|
|
87
|
+
ERPExportPart[ERPExportPart["IncludeDocumentUpdates"] = 201] = "IncludeDocumentUpdates";
|
|
88
|
+
ERPExportPart[ERPExportPart["ExcludeNonApplicableOrAcknowledged"] = 202] = "ExcludeNonApplicableOrAcknowledged";
|
|
89
|
+
ERPExportPart[ERPExportPart["ExcluteAbblicabilityTable"] = 203] = "ExcluteAbblicabilityTable";
|
|
90
|
+
ERPExportPart[ERPExportPart["IncludeActivities"] = 204] = "IncludeActivities";
|
|
91
|
+
ERPExportPart[ERPExportPart["GroupLaws"] = 205] = "GroupLaws";
|
|
92
|
+
ERPExportPart[ERPExportPart["IncludeApplicableOrAcknowledgedOnly"] = 4301] = "IncludeApplicableOrAcknowledgedOnly";
|
|
93
|
+
ERPExportPart[ERPExportPart["IncludePPEs"] = 501] = "IncludePPEs";
|
|
94
|
+
ERPExportPart[ERPExportPart["IncludeHealthChecks"] = 601] = "IncludeHealthChecks";
|
|
95
|
+
})(ERPExportPart || (ERPExportPart = {}));
|
|
34
96
|
var ERPComplianceLawsSelectionType;
|
|
35
97
|
(function (ERPComplianceLawsSelectionType) {
|
|
36
98
|
ERPComplianceLawsSelectionType[ERPComplianceLawsSelectionType["Analysis"] = 1] = "Analysis";
|
|
@@ -388,6 +450,23 @@ const EvolutionRecurrenceFrequencyTypes = [
|
|
|
388
450
|
{ name: 'Mesi', value: ERPRecurrenceFrequencyType.Month },
|
|
389
451
|
{ name: 'Giorni', value: ERPRecurrenceFrequencyType.Day },
|
|
390
452
|
];
|
|
453
|
+
var ERPPlacePermission;
|
|
454
|
+
(function (ERPPlacePermission) {
|
|
455
|
+
ERPPlacePermission[ERPPlacePermission["None"] = 0] = "None";
|
|
456
|
+
ERPPlacePermission[ERPPlacePermission["Denied"] = 1] = "Denied";
|
|
457
|
+
ERPPlacePermission[ERPPlacePermission["Read"] = 2] = "Read";
|
|
458
|
+
ERPPlacePermission[ERPPlacePermission["Write"] = 3] = "Write";
|
|
459
|
+
})(ERPPlacePermission || (ERPPlacePermission = {}));
|
|
460
|
+
var ERPPlace;
|
|
461
|
+
(function (ERPPlace) {
|
|
462
|
+
ERPPlace[ERPPlace["Subject"] = 1] = "Subject";
|
|
463
|
+
ERPPlace[ERPPlace["Site"] = 2] = "Site";
|
|
464
|
+
ERPPlace[ERPPlace["Department"] = 3] = "Department";
|
|
465
|
+
ERPPlace[ERPPlace["Area"] = 4] = "Area";
|
|
466
|
+
ERPPlace[ERPPlace["Line"] = 5] = "Line";
|
|
467
|
+
})(ERPPlace || (ERPPlace = {}));
|
|
468
|
+
class EvolutionComplianceContextInfo {
|
|
469
|
+
}
|
|
391
470
|
|
|
392
471
|
class EvolutionService {
|
|
393
472
|
constructor() {
|
|
@@ -457,7 +536,9 @@ class EvolutionService {
|
|
|
457
536
|
if (this.loggedIn()) {
|
|
458
537
|
this.logout().subscribe(r => {
|
|
459
538
|
if (!r.success) {
|
|
460
|
-
|
|
539
|
+
if (r.message) {
|
|
540
|
+
this.dialogService.error("<p>" + r.message + "</p><br><br><hr><p class='small'><i>Per eliminare la configurazione di Evolution accedere a:<br><b>menu > personalizza > collegamenti</b></i></p>", null, "Errore di Evolution");
|
|
541
|
+
}
|
|
461
542
|
}
|
|
462
543
|
else {
|
|
463
544
|
if ((this.flags & EvolutionServiceFlags.DisplayConnectionStateMessages) > 0) {
|
|
@@ -515,8 +596,20 @@ class EvolutionService {
|
|
|
515
596
|
* @param onSucces: function to execute on seccess
|
|
516
597
|
*/
|
|
517
598
|
autoLogin(email = null, password = null, remember = false, oauth = null, oauthAccessToken = null, onSucces = null) {
|
|
599
|
+
if (!oauth && !oauthAccessToken && (!email || !password)) {
|
|
600
|
+
// Try to use link if exists
|
|
601
|
+
const linkInfo = localStorage.getItem('clipper_link_evolution');
|
|
602
|
+
if (linkInfo) {
|
|
603
|
+
const link = JSON.parse(SystemUtils.cipher(linkInfo, 'evolution', true));
|
|
604
|
+
if (link) {
|
|
605
|
+
email = link.user;
|
|
606
|
+
password = link.password;
|
|
607
|
+
remember = true;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
}
|
|
518
611
|
this.login(email, password, remember, oauth, oauthAccessToken)
|
|
519
|
-
.subscribe(
|
|
612
|
+
.subscribe(r => {
|
|
520
613
|
if (!r.success) {
|
|
521
614
|
this.dialogService.error(r.message, null, "Errore in Evolution");
|
|
522
615
|
}
|
|
@@ -536,17 +629,19 @@ class EvolutionService {
|
|
|
536
629
|
autoLogout(onSucces = null) {
|
|
537
630
|
if (!this.loggedIn())
|
|
538
631
|
return;
|
|
539
|
-
this.logout()
|
|
632
|
+
this.logout()
|
|
633
|
+
.pipe(map(r => { this.clear(); return r; }))
|
|
634
|
+
.subscribe({
|
|
540
635
|
next: r => {
|
|
541
636
|
if (!r.success) {
|
|
542
637
|
this.dialogService.error(r.message, null, "Errore in Evolution");
|
|
638
|
+
this.broadcastService.sendMessage(EvolutionMessages.LOGIN_CHANGED);
|
|
543
639
|
}
|
|
544
640
|
else {
|
|
545
641
|
this.dialogService.toast('Disconnesso da Evolution', 1500, 'power_off');
|
|
546
642
|
}
|
|
547
643
|
},
|
|
548
644
|
complete: () => {
|
|
549
|
-
this.clear();
|
|
550
645
|
if (onSucces) {
|
|
551
646
|
onSucces();
|
|
552
647
|
}
|
|
@@ -576,10 +671,7 @@ class EvolutionService {
|
|
|
576
671
|
: new HttpHeaders()
|
|
577
672
|
.set("Authorization", oauthAccessToken ?? '')
|
|
578
673
|
})
|
|
579
|
-
.pipe(catchError(err => {
|
|
580
|
-
this.handleLoginError();
|
|
581
|
-
return throwError(() => err);
|
|
582
|
-
}), map((r) => {
|
|
674
|
+
.pipe(finalize(() => this.dialogService.clearBusy()), catchError(err => { this.handleLoginError(); return throwError(() => err); }), map((r) => {
|
|
583
675
|
this.loggingIn.set(false);
|
|
584
676
|
if (r.success) {
|
|
585
677
|
// Store access token
|
|
@@ -609,7 +701,7 @@ class EvolutionService {
|
|
|
609
701
|
* Perform logout
|
|
610
702
|
*/
|
|
611
703
|
logout() {
|
|
612
|
-
return this.httpClient.post(this._serviceUri + '/logout', {}).pipe(map(r => {
|
|
704
|
+
return this.httpClient.post(this._serviceUri + '/logout', {}).pipe(finalize(() => this.dialogService.clearBusy()), map(r => {
|
|
613
705
|
this.clear();
|
|
614
706
|
return r;
|
|
615
707
|
}), catchError((_e) => {
|
|
@@ -719,10 +811,18 @@ class EvolutionService {
|
|
|
719
811
|
return this.httpClient.get(this._serviceUri + '/taxonomy');
|
|
720
812
|
}
|
|
721
813
|
/**
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
814
|
+
* Retrieve groups
|
|
815
|
+
* @param group: the group number
|
|
816
|
+
* @param register: the optional register id. Default is null.
|
|
817
|
+
*/
|
|
818
|
+
getGroups(group = 1, register = null) {
|
|
819
|
+
return this.httpClient.get(this._serviceUri +
|
|
820
|
+
(register
|
|
821
|
+
? '/compliance/groups/?group=' +
|
|
822
|
+
group +
|
|
823
|
+
'®ister=' +
|
|
824
|
+
register
|
|
825
|
+
: '/compliance/groups/?group=' + group));
|
|
726
826
|
}
|
|
727
827
|
////
|
|
728
828
|
// CONTEXT
|
|
@@ -765,20 +865,6 @@ class EvolutionService {
|
|
|
765
865
|
////
|
|
766
866
|
// ACTIVITIES
|
|
767
867
|
////
|
|
768
|
-
/**
|
|
769
|
-
* Retrieve activity groups
|
|
770
|
-
* @param group the group number
|
|
771
|
-
* @param site the site id
|
|
772
|
-
*/
|
|
773
|
-
getGroups(group = 1, site = null) {
|
|
774
|
-
return this.httpClient.get(this._serviceUri +
|
|
775
|
-
(site
|
|
776
|
-
? '/compliance/groups/?group=' +
|
|
777
|
-
group +
|
|
778
|
-
'&site=' +
|
|
779
|
-
site
|
|
780
|
-
: '/compliance/groups/?group=' + group));
|
|
781
|
-
}
|
|
782
868
|
/**
|
|
783
869
|
* Add one or more activities
|
|
784
870
|
* @param params parameters
|
|
@@ -828,26 +914,28 @@ class EvolutionAuthInterceptor {
|
|
|
828
914
|
this.lastErrorTime = -1;
|
|
829
915
|
}
|
|
830
916
|
intercept(request, next) {
|
|
831
|
-
if (request.url.startsWith(this.evolutionService.serviceUri)) {
|
|
917
|
+
if (request.url.startsWith(this.evolutionService.serviceUri ?? '')) {
|
|
832
918
|
request = request.clone({ withCredentials: true });
|
|
833
919
|
return next.handle(this.addTokenToRequest(request))
|
|
834
|
-
.pipe(finalize(() => this.dialogService.clearBusy()), catchError$1(error => {
|
|
835
|
-
if (error
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
this.lastErrorTime
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
920
|
+
.pipe(finalize$1(() => this.dialogService.clearBusy()), catchError$1(error => {
|
|
921
|
+
if (error.url.startsWith(this.evolutionService.serviceUri)) {
|
|
922
|
+
if (error instanceof HttpErrorResponse &&
|
|
923
|
+
!request.url.includes("/login") &&
|
|
924
|
+
error.status === 401) {
|
|
925
|
+
return this.handle401Error(request, next);
|
|
926
|
+
}
|
|
927
|
+
const errorStatus = parseInt(error.status ?? "0");
|
|
928
|
+
if ((errorStatus > 0 && errorStatus < 500) || (this.evolutionService.flags & EvolutionServiceFlags.NotifySystemErrors) > 0) {
|
|
929
|
+
const errorTime = new Date().getTime();
|
|
930
|
+
if (errorTime - this.lastErrorTime > 5000) {
|
|
931
|
+
this.lastErrorTime = errorTime;
|
|
932
|
+
const invalidSession = errorStatus === 403;
|
|
933
|
+
this.dialogService.error("<p>" + (error.error?.message ?? error.message ?? "Impossibile eseguire l'operazione richiesta.").replaceAll("\r\n", "</p><p>") + "</p>", null, "Errore in Evolution", undefined, undefined, invalidSession ? 5000 : 15000).afterClosed().subscribe(() => {
|
|
934
|
+
if (invalidSession) {
|
|
935
|
+
this.broadcastService.sendMessage(EvolutionMessages.LOGOUT);
|
|
936
|
+
}
|
|
937
|
+
});
|
|
938
|
+
}
|
|
851
939
|
}
|
|
852
940
|
}
|
|
853
941
|
return throwError(() => error);
|
|
@@ -876,7 +964,7 @@ class EvolutionAuthInterceptor {
|
|
|
876
964
|
* @param token: the token or null to use curre3nt
|
|
877
965
|
*/
|
|
878
966
|
addTokenToRequest(request, token = null) {
|
|
879
|
-
if (request.url.startsWith(this.evolutionService.serviceUri)) {
|
|
967
|
+
if (request.url.startsWith(this.evolutionService.serviceUri ?? '')) {
|
|
880
968
|
if (!token)
|
|
881
969
|
token = this.evolutionService.getToken();
|
|
882
970
|
if (token) {
|
|
@@ -914,5 +1002,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImpor
|
|
|
914
1002
|
* Generated bundle index. Do not edit.
|
|
915
1003
|
*/
|
|
916
1004
|
|
|
917
|
-
export { ERPComplianceActivityState, ERPComplianceLawOrigin, ERPComplianceLawState, ERPComplianceLawsSelectionType, ERPComplianceNotificationLimit, ERPComplianceProfileFlags, ERPComplianceProfileRole, ERPComplianceRegisterNotificationType, ERPComplianceRegisterSiteImportOptions, ERPComplianceScope, ERPModule, ERPRecurrenceFrequencyType, EvolutionAuthInterceptor, EvolutionCommonModule, EvolutionComplianceActivityStates, EvolutionComplianceLawChangeStates, EvolutionComplianceLawOrigins, EvolutionComplianceLawStates, EvolutionComplianceNotificationLimits, EvolutionComplianceNotifications, EvolutionComplianceObligationAuthorities, EvolutionComplianceObligationTypes, EvolutionComplianceProfileFlags, EvolutionComplianceProfileRoles, EvolutionComplianceScopes, EvolutionMessages, EvolutionRecurrenceFrequencyTypes, EvolutionService, EvolutionServiceFlags };
|
|
1005
|
+
export { ERPComplianceActivityState, ERPComplianceLawOrigin, ERPComplianceLawState, ERPComplianceLawsSelectionType, ERPComplianceNotificationLimit, ERPComplianceProfileFlags, ERPComplianceProfileRole, ERPComplianceRegisterNotificationType, ERPComplianceRegisterSiteImportOptions, ERPComplianceScope, ERPExportFormat, ERPExportPart, ERPExportSource, ERPExportType, ERPModule, ERPPlace, ERPPlacePermission, ERPRecurrenceFrequencyType, EvolutionAuthInterceptor, EvolutionCommonModule, EvolutionComplianceActivityStates, EvolutionComplianceContextInfo, EvolutionComplianceLawChangeStates, EvolutionComplianceLawOrigins, EvolutionComplianceLawStates, EvolutionComplianceNotificationLimits, EvolutionComplianceNotifications, EvolutionComplianceObligationAuthorities, EvolutionComplianceObligationTypes, EvolutionComplianceProfileFlags, EvolutionComplianceProfileRoles, EvolutionComplianceScopes, EvolutionMessages, EvolutionRecurrenceFrequencyTypes, EvolutionService, EvolutionServiceFlags };
|
|
918
1006
|
//# sourceMappingURL=arsedizioni-ars-utils-evolution.common.mjs.map
|