@skysoftware-co/bayan-hr-widgets-ui 2.0.26 → 2.0.27

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.
Files changed (104) hide show
  1. package/ng-package.json +9 -0
  2. package/package.json +3 -15
  3. package/src/assets/i18n/ar.json +166 -0
  4. package/src/assets/i18n/en.json +166 -0
  5. package/src/assets/i18n/fr.json +166 -0
  6. package/src/lib/my-calendar-widget/my-calendar-widget.component.html +25 -0
  7. package/src/lib/my-calendar-widget/my-calendar-widget.component.ts +220 -0
  8. package/src/lib/my-main-details-widget/my-main-details-widget.component.html +157 -0
  9. package/src/lib/my-main-details-widget/my-main-details-widget.component.ts +179 -0
  10. package/src/lib/my-next-week-vacation-insights-widget/components/next-week-vacation-insights-popup/next-week-vacation-insights-popup.component.html +131 -0
  11. package/src/lib/my-next-week-vacation-insights-widget/components/next-week-vacation-insights-popup/next-week-vacation-insights-popup.component.ts +119 -0
  12. package/src/lib/my-next-week-vacation-insights-widget/my-next-week-vacation-insights-widget.component.html +35 -0
  13. package/src/lib/my-next-week-vacation-insights-widget/my-next-week-vacation-insights-widget.component.ts +110 -0
  14. package/src/lib/my-profile/address-widget/my-profile-address-widget.component.html +57 -0
  15. package/src/lib/my-profile/address-widget/my-profile-address-widget.component.ts +70 -0
  16. package/src/lib/my-profile/bank-info-widget/my-profile-bank-info-widget.component.html +101 -0
  17. package/src/lib/my-profile/bank-info-widget/my-profile-bank-info-widget.component.ts +89 -0
  18. package/src/lib/my-profile/contact-widget/my-profile-contact-widget.component.html +89 -0
  19. package/src/lib/my-profile/contact-widget/my-profile-contact-widget.component.ts +78 -0
  20. package/src/lib/my-profile/contract-widget/my-profile-contract-widget.component.html +63 -0
  21. package/src/lib/my-profile/contract-widget/my-profile-contract-widget.component.ts +73 -0
  22. package/src/lib/my-profile/degrees-widget/my-profile-degrees-widget-component.html +86 -0
  23. package/src/lib/my-profile/degrees-widget/my-profile-degrees-widget-component.ts +98 -0
  24. package/src/lib/my-profile/dependents-documents-widget/my-profile-dependents-documents-widget.html +83 -0
  25. package/src/lib/my-profile/dependents-documents-widget/my-profile-dependents-documents-widget.ts +126 -0
  26. package/src/lib/my-profile/documents-widgets/components/document-card/document-card.component.html +53 -0
  27. package/src/lib/my-profile/documents-widgets/components/document-card/document-card.component.ts +50 -0
  28. package/src/lib/my-profile/documents-widgets/components/document-row/document-row.component.html +48 -0
  29. package/src/lib/my-profile/documents-widgets/components/document-row/document-row.component.ts +44 -0
  30. package/src/lib/my-profile/documents-widgets/components/document-tablet-card/document-tablet-card.component.html +46 -0
  31. package/src/lib/my-profile/documents-widgets/components/document-tablet-card/document-tablet-card.component.ts +47 -0
  32. package/src/lib/my-profile/employee-dependents-widget/my-profile-employee-dependents-component.html +50 -0
  33. package/src/lib/my-profile/employee-dependents-widget/my-profile-employee-dependents-component.ts +63 -0
  34. package/src/lib/my-profile/entitlements-others-widget/my-profile-entitlements-others-widget.component.html +26 -0
  35. package/src/lib/my-profile/entitlements-others-widget/my-profile-entitlements-others-widget.component.ts +66 -0
  36. package/src/lib/my-profile/experiences-widget/my-profile-experiences-widget-component.html +93 -0
  37. package/src/lib/my-profile/experiences-widget/my-profile-experiences-widget-component.ts +102 -0
  38. package/src/lib/my-profile/indemnity-widget/my-profile-indemnity-widget.component.html +49 -0
  39. package/src/lib/my-profile/indemnity-widget/my-profile-indemnity-widget.component.ts +79 -0
  40. package/src/lib/my-profile/job-info-widget/my-profile-job-info-widget.component.html +71 -0
  41. package/src/lib/my-profile/job-info-widget/my-profile-job-info-widget.component.ts +73 -0
  42. package/src/lib/my-profile/languages-widget/my-profile-languages-widget.component.html +23 -0
  43. package/src/lib/my-profile/languages-widget/my-profile-languages-widget.component.ts +70 -0
  44. package/src/lib/my-profile/medical-insurance-widget/components/medical-insurance-card/medical-insurance-card.component.html +18 -0
  45. package/src/lib/my-profile/medical-insurance-widget/components/medical-insurance-card/medical-insurance-card.component.ts +29 -0
  46. package/src/lib/my-profile/medical-insurance-widget/my-profile-medical-insurance-widget.component.html +52 -0
  47. package/src/lib/my-profile/medical-insurance-widget/my-profile-medical-insurance-widget.component.ts +103 -0
  48. package/src/lib/my-profile/official-documents-widget/my-profile-official-documents-widget.html +82 -0
  49. package/src/lib/my-profile/official-documents-widget/my-profile-official-documents-widget.ts +119 -0
  50. package/src/lib/my-profile/other-nationalities-widget/my-profile-other-nationalities-widget.component.html +23 -0
  51. package/src/lib/my-profile/other-nationalities-widget/my-profile-other-nationalities-widget.component.ts +70 -0
  52. package/src/lib/my-profile/personal-info-main-widget/my-profile-personal-info-main-widget.component.html +115 -0
  53. package/src/lib/my-profile/personal-info-main-widget/my-profile-personal-info-main-widget.component.ts +75 -0
  54. package/src/lib/my-profile/salary-widget/my-profile-salary-widget.component.html +37 -0
  55. package/src/lib/my-profile/salary-widget/my-profile-salary-widget.component.ts +85 -0
  56. package/src/lib/my-profile/service-charge-widget/my-profile-service-charge-widget.component.html +16 -0
  57. package/src/lib/my-profile/service-charge-widget/my-profile-service-charge-widget.component.ts +101 -0
  58. package/src/lib/my-profile/ticket-widget/components/ticket-card/ticket-card.component.html +23 -0
  59. package/src/lib/my-profile/ticket-widget/components/ticket-card/ticket-card.component.ts +26 -0
  60. package/src/lib/my-profile/ticket-widget/my-profile-ticket-widget.component.html +68 -0
  61. package/src/lib/my-profile/ticket-widget/my-profile-ticket-widget.component.ts +93 -0
  62. package/src/lib/my-profile/vacations-widget/my-profile-vacations-widget.component.html +34 -0
  63. package/src/lib/my-profile/vacations-widget/my-profile-vacations-widget.component.ts +66 -0
  64. package/src/lib/my-team-subordinates-popup-widget/components/employee-main-info-card/employee-information-card.component.ts +65 -0
  65. package/src/lib/my-team-subordinates-popup-widget/components/employee-main-info-card/employee-main-info-card.component.html +57 -0
  66. package/src/lib/my-team-subordinates-popup-widget/components/my-team-subordinates-popup/my-team-popup.component.html +108 -0
  67. package/src/lib/my-team-subordinates-popup-widget/components/my-team-subordinates-popup/my-team-popup.component.ts +332 -0
  68. package/src/lib/my-upcoming-events-widget/components/event-item/event-item.component.html +53 -0
  69. package/src/lib/my-upcoming-events-widget/components/event-item/event-item.component.ts +42 -0
  70. package/src/lib/my-upcoming-events-widget/components/event-tab-bar/event-tab-bar.component.html +21 -0
  71. package/src/lib/my-upcoming-events-widget/components/event-tab-bar/event-tab-bar.component.ts +44 -0
  72. package/src/lib/my-upcoming-events-widget/components/events-popup/events-popup.component.html +67 -0
  73. package/src/lib/my-upcoming-events-widget/components/events-popup/events-popup.component.ts +74 -0
  74. package/src/lib/my-upcoming-events-widget/my-upcoming-events-widget.component.html +74 -0
  75. package/src/lib/my-upcoming-events-widget/my-upcoming-events-widget.component.ts +199 -0
  76. package/src/lib/services/hr-self-widgets.service.ts +624 -0
  77. package/src/lib/shared/components/card-header/card-header.component.html +4 -0
  78. package/src/lib/shared/components/card-header/card-header.component.ts +18 -0
  79. package/src/lib/shared/components/hr-employee-calendar/hr-employee-calendar.component.html +47 -0
  80. package/src/lib/shared/components/hr-employee-calendar/hr-employee-calendar.component.ts +193 -0
  81. package/src/lib/shared/components/info-field/info-field.component.html +2 -0
  82. package/src/lib/shared/components/info-field/info-field.component.ts +20 -0
  83. package/src/lib/shared/components/widget-card/widget-card-component.html +3 -0
  84. package/src/lib/shared/components/widget-card/widget-card-component.ts +17 -0
  85. package/src/lib/shared/pipes/translate.pipe.ts +34 -0
  86. package/src/lib/shared/services/bank-information-cache.service.ts +29 -0
  87. package/src/lib/shared/services/common-methods.service.ts +33 -0
  88. package/src/lib/shared/services/constants.service.ts +12 -0
  89. package/src/lib/shared/services/entitlements-cache.service.ts +94 -0
  90. package/src/lib/shared/services/job-information-cache.service.ts +72 -0
  91. package/src/lib/shared/services/my-team-popup.service.ts +34 -0
  92. package/src/lib/shared/services/personal-information-cache.service.ts +77 -0
  93. package/src/lib/shared/services/profile-documents-cache-service.ts +44 -0
  94. package/src/lib/shared/services/profile-employee-dependents-cach.ts +37 -0
  95. package/src/lib/shared/services/qualifications-cache.service.ts +45 -0
  96. package/src/lib/shared/services/translate.service.ts +35 -0
  97. package/src/lib/shared/types/common.ts +359 -0
  98. package/src/public-api.ts +35 -0
  99. package/tsconfig.lib.json +11 -0
  100. package/tsconfig.lib.prod.json +9 -0
  101. package/tsconfig.spec.json +8 -0
  102. package/fesm2022/skysoftware-co-bayan-hr-widgets-ui.mjs +0 -4812
  103. package/fesm2022/skysoftware-co-bayan-hr-widgets-ui.mjs.map +0 -1
  104. package/types/skysoftware-co-bayan-hr-widgets-ui.d.ts +0 -1308
@@ -0,0 +1,193 @@
1
+ import { ChangeDetectionStrategy, Component, ViewChild, inject, input } from '@angular/core';
2
+ import { DxCalendarComponent, DxCalendarModule } from 'devextreme-angular';
3
+ import { ScheduleCalenderVacation, ScheduleVacationTypes, DatePeriod } from '../../types/common';
4
+ import { HRCommonMethodsService } from '../../services/common-methods.service';
5
+ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
6
+ import { faCircle } from '@fortawesome/pro-regular-svg-icons';
7
+ import { HRTranslatePipe } from '../../pipes/translate.pipe';
8
+
9
+ @Component({
10
+ standalone: true,
11
+ selector: 'hr-employee-calendar',
12
+ templateUrl: './hr-employee-calendar.component.html',
13
+ imports: [DxCalendarModule, HRTranslatePipe, FontAwesomeModule],
14
+ changeDetection: ChangeDetectionStrategy.OnPush,
15
+ })
16
+ export class HREmployeeCalendarComponent {
17
+ @ViewChild('calendar') calendar!: DxCalendarComponent;
18
+ readonly showEvents = input<boolean>(false);
19
+ readonly showUpComingVacations = input<boolean>(false);
20
+ readonly scheduleCalenderVacation = input<ScheduleCalenderVacation[]>([]);
21
+ readonly minDate = input<Date>(new Date());
22
+ readonly maxDate = input<Date>(new Date());
23
+
24
+ readonly legendContainerClass = input<string>('row mb-2');
25
+ readonly legendRowClass = input<string>('d-flex');
26
+ readonly legendItemClass = input<string>('d-flex align-items-center');
27
+ readonly legendDotClass = input<string>('me-1 circle-sm');
28
+ readonly legendLabelClass = input<string>('me-1 fs-12');
29
+ readonly publicHolidayDotClass = input<string>('bg-accent');
30
+ readonly dayOffDotClass = input<string>('bg-yellow');
31
+ readonly eventsDotClass = input<string>('bg-primary');
32
+ readonly vacationsContainerClass = input<string>('d-flex mt-3');
33
+ readonly vacationsItemClass = input<string>('d-flex align-items-center');
34
+ readonly vacationsIconClass = input<string>('fs-8 me-1');
35
+ readonly calendarContainerClass = input<string>('row mt-2 col-12');
36
+ readonly calendarClass = input<string>('button-boeder-none');
37
+
38
+ squreCheckIcon = faCircle;
39
+ DaysOffVacationTypes = ScheduleVacationTypes.DaysOff;
40
+ PublicHolidaysVacationTypes = ScheduleVacationTypes.PublicHoliday;
41
+ private commonMethods = inject(HRCommonMethodsService);
42
+
43
+ customCellTemplate = (cellData: any): string | HTMLElement => {
44
+ if (cellData.view != 'month') {
45
+ return this.createDateSpan(cellData);
46
+ }
47
+
48
+ const cellDate = cellData.date;
49
+
50
+ let matchedVacation = this.scheduleCalenderVacation().find(vacation =>
51
+ this.isDateInPeriod(cellDate, vacation.VacationDays),
52
+ );
53
+
54
+ let matchedOffOrPublicHolidayBullet: ScheduleCalenderVacation | undefined = this.scheduleCalenderVacation().find(
55
+ vacation =>
56
+ this.isDateInPeriod(cellDate, vacation.VacationDays) &&
57
+ vacation.VacationType != ScheduleVacationTypes.Vacations &&
58
+ vacation.VacationType != ScheduleVacationTypes.AddedVacations,
59
+ );
60
+
61
+ if (matchedVacation) {
62
+ if (
63
+ this.commonMethods.calculateDaysDifference(
64
+ matchedVacation.VacationDays.EndDate,
65
+ matchedVacation.VacationDays.StartDate,
66
+ ) === 0
67
+ ) {
68
+ return this.createDateSpan(cellData, matchedVacation, matchedOffOrPublicHolidayBullet, false, false, false);
69
+ }
70
+
71
+ let isStartRange =
72
+ this.commonMethods.calculateDaysDifference(cellDate, matchedVacation.VacationDays.StartDate) === 0;
73
+ let isEndRange = this.commonMethods.calculateDaysDifference(matchedVacation.VacationDays.EndDate, cellDate) === 0;
74
+
75
+ return this.createDateSpan(
76
+ cellData,
77
+ matchedVacation,
78
+ matchedOffOrPublicHolidayBullet,
79
+ true,
80
+ isStartRange,
81
+ isEndRange,
82
+ );
83
+ }
84
+
85
+ return this.createDateSpan(cellData);
86
+ };
87
+
88
+ private createDateSpan = (
89
+ cellData: any,
90
+ matchedVacation: ScheduleCalenderVacation | undefined = undefined,
91
+ matchedOffOrPublicHolidayBullet: ScheduleCalenderVacation | undefined = undefined,
92
+ isInRange: boolean = false,
93
+ isStartRange: boolean = false,
94
+ isEndRange: boolean = false,
95
+ ) => {
96
+ const offDayOrPublicHolidaySpan = document.createElement('span');
97
+ const cellElement = document.createElement('span');
98
+ cellElement.textContent = cellData.text;
99
+ cellElement.style.backgroundColor = '';
100
+ cellElement.style.borderRadius = '15px';
101
+ cellElement.style.borderWidth = '0';
102
+ cellElement.style.fontSize = '10px';
103
+ cellElement.style.margin = '0';
104
+ cellElement.style.padding = '0';
105
+ cellElement.style.alignContent = 'center';
106
+ cellElement.style.position = 'relative';
107
+
108
+ if (matchedVacation) {
109
+ cellElement.title = matchedVacation.Description;
110
+
111
+ if (
112
+ matchedVacation.VacationType != ScheduleVacationTypes.DaysOff &&
113
+ matchedVacation.VacationType != ScheduleVacationTypes.PublicHoliday &&
114
+ matchedVacation.VacationType != ScheduleVacationTypes.Events
115
+ ) {
116
+ if (matchedVacation.Color) {
117
+ cellElement.style.backgroundColor = matchedVacation.Color + '99';
118
+ cellElement.style.color = '#FFFFFF';
119
+ } else {
120
+ cellElement.style.backgroundColor = '#DCDCDC';
121
+ cellElement.style.color = '#000000';
122
+ }
123
+
124
+ if (isInRange) {
125
+ cellElement.style.width = '100%';
126
+ cellElement.style.alignContent = 'start';
127
+
128
+ if (isStartRange) {
129
+ cellElement.style.borderEndEndRadius = '0px';
130
+ cellElement.style.borderStartEndRadius = '0px';
131
+ }
132
+
133
+ if (isEndRange) {
134
+ cellElement.style.borderStartStartRadius = '0px';
135
+ cellElement.style.borderEndStartRadius = '0px';
136
+ }
137
+
138
+ if (!isStartRange && !isEndRange) cellElement.style.borderRadius = '0px';
139
+ }
140
+ }
141
+ }
142
+
143
+ if (matchedOffOrPublicHolidayBullet) {
144
+ offDayOrPublicHolidaySpan.style.width = '8px';
145
+ offDayOrPublicHolidaySpan.style.height = '8px';
146
+ offDayOrPublicHolidaySpan.className = 'rounded rounded-circle';
147
+ offDayOrPublicHolidaySpan.style.position = 'absolute';
148
+ offDayOrPublicHolidaySpan.style.opacity = '1';
149
+ offDayOrPublicHolidaySpan.style.top = '-5px';
150
+ offDayOrPublicHolidaySpan.style.right = '0';
151
+ offDayOrPublicHolidaySpan.title = matchedOffOrPublicHolidayBullet.Description;
152
+
153
+ if (matchedVacation) {
154
+ if (
155
+ matchedVacation.VacationType != ScheduleVacationTypes.DaysOff &&
156
+ matchedVacation.VacationType != ScheduleVacationTypes.PublicHoliday &&
157
+ matchedVacation.VacationType != ScheduleVacationTypes.Events
158
+ ) {
159
+ if (isInRange) {
160
+ offDayOrPublicHolidaySpan.style.right = '8px';
161
+ }
162
+ }
163
+ }
164
+
165
+ offDayOrPublicHolidaySpan.style.background = matchedOffOrPublicHolidayBullet.Color || '';
166
+ offDayOrPublicHolidaySpan.style.marginTop = '2px';
167
+ cellElement.appendChild(offDayOrPublicHolidaySpan);
168
+ }
169
+
170
+ return cellElement;
171
+ };
172
+
173
+ isDateInPeriod(date: Date, period: DatePeriod) {
174
+ if (this.commonMethods.calculateDaysDifference(date, period.StartDate) == 0) return true;
175
+
176
+ if (this.commonMethods.calculateDaysDifference(date, period.EndDate) == 0) return true;
177
+
178
+ let daysDifferenceWithStartDate = this.commonMethods.calculateDaysDifference(date, period.StartDate);
179
+ let daysDifferenceWithEndDate = this.commonMethods.calculateDaysDifference(period.EndDate, date);
180
+
181
+ if (daysDifferenceWithStartDate < 0 || daysDifferenceWithEndDate < 0) return false;
182
+
183
+ return true;
184
+ }
185
+
186
+ resetCalenderCurrentDate(currentDate: Date = new Date()) {
187
+ this.calendar.instance.option('currentDate', currentDate);
188
+ }
189
+
190
+ preventInteraction(event: any): void {
191
+ event.component.option('value', null);
192
+ }
193
+ }
@@ -0,0 +1,2 @@
1
+ <div [ngClass]="labelClass()">{{ labelKey() | translate }}</div>
2
+ <div [ngClass]="valueClass()" [title]="displayValue()">{{ displayValue() }}</div>
@@ -0,0 +1,20 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
3
+ import { HRTranslatePipe } from '../../pipes/translate.pipe';
4
+
5
+ @Component({
6
+ selector: 'hr-info-field',
7
+ standalone: true,
8
+ imports: [CommonModule, HRTranslatePipe],
9
+ templateUrl: './info-field.component.html',
10
+ changeDetection: ChangeDetectionStrategy.OnPush,
11
+ })
12
+ export class HRInfoFieldComponent {
13
+ readonly labelKey = input.required<string>();
14
+ readonly value = input<string | null | undefined>(null);
15
+ readonly labelClass = input<string>('field-secondary-label-sm');
16
+ readonly valueClass = input<string>('fs-14 fw-medium');
17
+ readonly fallbackValue = input<string>('—');
18
+
19
+ readonly displayValue = computed(() => this.value() || this.fallbackValue());
20
+ }
@@ -0,0 +1,3 @@
1
+ <div [class]="cardClass()" [style.height.px]="height()" style="overflow: hidden">
2
+ <ng-container *ngTemplateOutlet="contentTemplate(); context: context()"></ng-container>
3
+ </div>
@@ -0,0 +1,17 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { ChangeDetectionStrategy, Component, TemplateRef, input } from '@angular/core';
3
+
4
+ @Component({
5
+ selector: 'hr-widget-card',
6
+ standalone: true,
7
+ imports: [CommonModule],
8
+ templateUrl: './widget-card-component.html',
9
+ changeDetection: ChangeDetectionStrategy.OnPush,
10
+ })
11
+ export class WidgetCardComponent {
12
+ readonly cardClass = input<string>('bg-white shadow-sm p-3 border-1 border');
13
+ readonly height = input<number>(110);
14
+
15
+ readonly contentTemplate = input.required<TemplateRef<any>>();
16
+ readonly context = input<any>(undefined);
17
+ }
@@ -0,0 +1,34 @@
1
+ import { Pipe, PipeTransform } from '@angular/core';
2
+ import { HRTranslateService } from '../services/translate.service';
3
+
4
+ @Pipe({
5
+ name: 'translate',
6
+ standalone: true,
7
+ })
8
+ export class HRTranslatePipe implements PipeTransform {
9
+ constructor(private readonly payrollTranslateService: HRTranslateService) {}
10
+
11
+ transform(key?: string): string {
12
+ if (!key) return '';
13
+
14
+ key = this.payrollTranslateService.translateBuiltIn(key);
15
+
16
+ const lexicon = this.payrollTranslateService.getLexicon();
17
+ let foundKey = Object.keys(lexicon).find(k => k.toLowerCase() === key!.toLowerCase());
18
+ if (foundKey) return lexicon[foundKey];
19
+
20
+ const arrKey = key.split(' ');
21
+ let keyValue = '';
22
+ for (let i = 0; i < arrKey.length; i++) {
23
+ if (i !== 0) keyValue += ' ';
24
+ foundKey = Object.keys(lexicon).find(k => k.toLowerCase() === arrKey[i].toLowerCase());
25
+ if (foundKey) {
26
+ keyValue += lexicon[foundKey];
27
+ } else {
28
+ keyValue += arrKey[i];
29
+ }
30
+ }
31
+
32
+ return keyValue;
33
+ }
34
+ }
@@ -0,0 +1,29 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { Observable } from 'rxjs';
3
+ import { MyBankInfo } from '../types/common';
4
+
5
+ @Injectable({
6
+ providedIn: 'root',
7
+ })
8
+ export class BankInformationCacheService {
9
+ private bankInformationCache$: Observable<MyBankInfo[]> | null = null;
10
+ private bankInformationCacheBaseUrl = '';
11
+
12
+ get(baseUrl: string): Observable<MyBankInfo[]> | null {
13
+ if (this.bankInformationCacheBaseUrl !== baseUrl) {
14
+ return null;
15
+ }
16
+
17
+ return this.bankInformationCache$;
18
+ }
19
+
20
+ set(baseUrl: string, value: Observable<MyBankInfo[]>): void {
21
+ this.bankInformationCacheBaseUrl = baseUrl;
22
+ this.bankInformationCache$ = value;
23
+ }
24
+
25
+ clear(): void {
26
+ this.bankInformationCache$ = null;
27
+ this.bankInformationCacheBaseUrl = '';
28
+ }
29
+ }
@@ -0,0 +1,33 @@
1
+ import { DecimalPipe } from '@angular/common';
2
+ import { Injectable } from '@angular/core';
3
+ import { HRTranslateService } from './translate.service';
4
+
5
+ @Injectable({
6
+ providedIn: 'root',
7
+ })
8
+ export class HRCommonMethodsService {
9
+ constructor(private readonly translateService: HRTranslateService) {}
10
+
11
+ calculateDaysDifference(dateOne: string | Date, dateTwo: string | Date): number {
12
+ const resetTime = (inputDate: Date): Date => {
13
+ const newDate = new Date(inputDate);
14
+ newDate.setHours(0, 0, 0, 0);
15
+ return newDate;
16
+ };
17
+ const firstDate = resetTime(new Date(dateOne));
18
+ const secondDate = resetTime(new Date(dateTwo));
19
+ return (firstDate.getTime() - secondDate.getTime()) / (1000 * 60 * 60 * 24);
20
+ }
21
+
22
+ currencyDecimalFormat(value: number, currencyDecimalsNumber: number): string | null {
23
+ const currencyDecimalsString = `1.${currencyDecimalsNumber}-${currencyDecimalsNumber}`;
24
+ const languageCode = this.translateService.getLanguage() || 'en';
25
+ const decimalPipe = new DecimalPipe(languageCode === 'fr' ? 'fr-FR' : 'en-US');
26
+
27
+ if (languageCode === 'fr') {
28
+ return decimalPipe.transform(value, currencyDecimalsString, 'fr-FR');
29
+ }
30
+
31
+ return decimalPipe.transform(value, currencyDecimalsString);
32
+ }
33
+ }
@@ -0,0 +1,12 @@
1
+ import { Injectable } from '@angular/core';
2
+
3
+ @Injectable({
4
+ providedIn: 'root',
5
+ })
6
+ export class HRConstantsService {
7
+ defaultVacationBalanceColor: string = '#727070';
8
+ defaultVacationColor: string = '#DCDCDC';
9
+ defaultPublicHolidayColor: string = '#249EA0';
10
+ defaultDayOffColor: string = '#FCCF5A';
11
+ defaultEventsColor: string = '#e67e0f';
12
+ }
@@ -0,0 +1,94 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { Observable } from 'rxjs';
3
+ import {
4
+ EntitlementsIndemnity,
5
+ EntitlementsMedicalInsurance,
6
+ EntitlementsTicket,
7
+ EntitlementsVacation,
8
+ } from '../types/common';
9
+
10
+ @Injectable({
11
+ providedIn: 'root',
12
+ })
13
+ export class EntitlementsCacheService {
14
+ private baseUrl = '';
15
+
16
+ private vacationDetails$: Observable<EntitlementsVacation[] | null> | null = null;
17
+ private indemnityDetails$: Observable<EntitlementsIndemnity | null> | null = null;
18
+ private ticketDetails$: Observable<EntitlementsTicket | null> | null = null;
19
+ private medicalInsuranceDetails$: Observable<EntitlementsMedicalInsurance | null> | null = null;
20
+ private overtimeDetails$: Observable<any> | null = null;
21
+ private socialSecurityDetails$: Observable<any> | null = null;
22
+
23
+ getVacationDetails(baseUrl: string): Observable<EntitlementsVacation[] | null> | null {
24
+ return this.baseUrl === baseUrl ? this.vacationDetails$ : null;
25
+ }
26
+
27
+ setVacationDetails(baseUrl: string, value: Observable<EntitlementsVacation[] | null>): void {
28
+ this.ensureBaseUrl(baseUrl);
29
+ this.vacationDetails$ = value;
30
+ }
31
+
32
+ getIndemnityDetails(baseUrl: string): Observable<EntitlementsIndemnity | null> | null {
33
+ return this.baseUrl === baseUrl ? this.indemnityDetails$ : null;
34
+ }
35
+
36
+ setIndemnityDetails(baseUrl: string, value: Observable<EntitlementsIndemnity | null>): void {
37
+ this.ensureBaseUrl(baseUrl);
38
+ this.indemnityDetails$ = value;
39
+ }
40
+
41
+ getTicketDetails(baseUrl: string): Observable<EntitlementsTicket | null> | null {
42
+ return this.baseUrl === baseUrl ? this.ticketDetails$ : null;
43
+ }
44
+
45
+ setTicketDetails(baseUrl: string, value: Observable<EntitlementsTicket | null>): void {
46
+ this.ensureBaseUrl(baseUrl);
47
+ this.ticketDetails$ = value;
48
+ }
49
+
50
+ getMedicalInsuranceDetails(baseUrl: string): Observable<EntitlementsMedicalInsurance | null> | null {
51
+ return this.baseUrl === baseUrl ? this.medicalInsuranceDetails$ : null;
52
+ }
53
+
54
+ setMedicalInsuranceDetails(baseUrl: string, value: Observable<EntitlementsMedicalInsurance | null>): void {
55
+ this.ensureBaseUrl(baseUrl);
56
+ this.medicalInsuranceDetails$ = value;
57
+ }
58
+
59
+ getOvertimeDetails(baseUrl: string): Observable<any> | null {
60
+ return this.baseUrl === baseUrl ? this.overtimeDetails$ : null;
61
+ }
62
+
63
+ setOvertimeDetails(baseUrl: string, value: Observable<any>): void {
64
+ this.ensureBaseUrl(baseUrl);
65
+ this.overtimeDetails$ = value;
66
+ }
67
+
68
+ getSocialSecurityDetails(baseUrl: string): Observable<any> | null {
69
+ return this.baseUrl === baseUrl ? this.socialSecurityDetails$ : null;
70
+ }
71
+
72
+ setSocialSecurityDetails(baseUrl: string, value: Observable<any>): void {
73
+ this.ensureBaseUrl(baseUrl);
74
+ this.socialSecurityDetails$ = value;
75
+ }
76
+
77
+ clear(): void {
78
+ this.baseUrl = '';
79
+ this.vacationDetails$ = null;
80
+ this.indemnityDetails$ = null;
81
+ this.ticketDetails$ = null;
82
+ this.medicalInsuranceDetails$ = null;
83
+ this.overtimeDetails$ = null;
84
+ this.socialSecurityDetails$ = null;
85
+ }
86
+
87
+ private ensureBaseUrl(baseUrl: string): void {
88
+ if (this.baseUrl && this.baseUrl !== baseUrl) {
89
+ this.clear();
90
+ }
91
+
92
+ this.baseUrl = baseUrl;
93
+ }
94
+ }
@@ -0,0 +1,72 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { Observable } from 'rxjs';
3
+ import {
4
+ JobInformationContract,
5
+ JobInformationMain,
6
+ JobInformationSalary,
7
+ JobInformationServiceCharge,
8
+ } from '../types/common';
9
+
10
+ @Injectable({
11
+ providedIn: 'root',
12
+ })
13
+ export class JobInformationCacheService {
14
+ private baseUrl = '';
15
+
16
+ private mainDetails$: Observable<JobInformationMain | null> | null = null;
17
+ private contractDetails$: Observable<JobInformationContract | null> | null = null;
18
+ private salaryDetails$: Observable<JobInformationSalary | null> | null = null;
19
+ private serviceChargeDetails$: Observable<JobInformationServiceCharge | null> | null = null;
20
+
21
+ getMainDetails(baseUrl: string): Observable<JobInformationMain | null> | null {
22
+ return this.baseUrl === baseUrl ? this.mainDetails$ : null;
23
+ }
24
+
25
+ setMainDetails(baseUrl: string, value: Observable<JobInformationMain | null>): void {
26
+ this.ensureBaseUrl(baseUrl);
27
+ this.mainDetails$ = value;
28
+ }
29
+
30
+ getContractDetails(baseUrl: string): Observable<JobInformationContract | null> | null {
31
+ return this.baseUrl === baseUrl ? this.contractDetails$ : null;
32
+ }
33
+
34
+ setContractDetails(baseUrl: string, value: Observable<JobInformationContract | null>): void {
35
+ this.ensureBaseUrl(baseUrl);
36
+ this.contractDetails$ = value;
37
+ }
38
+
39
+ getSalaryDetails(baseUrl: string): Observable<JobInformationSalary | null> | null {
40
+ return this.baseUrl === baseUrl ? this.salaryDetails$ : null;
41
+ }
42
+
43
+ setSalaryDetails(baseUrl: string, value: Observable<JobInformationSalary | null>): void {
44
+ this.ensureBaseUrl(baseUrl);
45
+ this.salaryDetails$ = value;
46
+ }
47
+
48
+ getServiceChargeDetails(baseUrl: string): Observable<JobInformationServiceCharge | null> | null {
49
+ return this.baseUrl === baseUrl ? this.serviceChargeDetails$ : null;
50
+ }
51
+
52
+ setServiceChargeDetails(baseUrl: string, value: Observable<JobInformationServiceCharge | null>): void {
53
+ this.ensureBaseUrl(baseUrl);
54
+ this.serviceChargeDetails$ = value;
55
+ }
56
+
57
+ clear(): void {
58
+ this.baseUrl = '';
59
+ this.mainDetails$ = null;
60
+ this.contractDetails$ = null;
61
+ this.salaryDetails$ = null;
62
+ this.serviceChargeDetails$ = null;
63
+ }
64
+
65
+ private ensureBaseUrl(baseUrl: string): void {
66
+ if (this.baseUrl && this.baseUrl !== baseUrl) {
67
+ this.clear();
68
+ }
69
+
70
+ this.baseUrl = baseUrl;
71
+ }
72
+ }
@@ -0,0 +1,34 @@
1
+ import { HttpClient, HttpParams } from '@angular/common/http';
2
+ import { Injectable } from '@angular/core';
3
+ import { Observable } from 'rxjs';
4
+ import { SubordinatesApiResponse } from '../types/common';
5
+
6
+ @Injectable({
7
+ providedIn: 'root',
8
+ })
9
+ export class MyTeamWidgetsService {
10
+ private readonly headers = { 'api-version': '1' };
11
+
12
+ constructor(private readonly http: HttpClient) {}
13
+
14
+ getSubordinates(
15
+ baseUrl: string,
16
+ params: {
17
+ showDirectSubordinatesOnly: boolean;
18
+ pageIndex: number;
19
+ pageSize: number;
20
+ searchValue?: string;
21
+ },
22
+ ): Observable<{ ResponseData: SubordinatesApiResponse }> {
23
+ const httpParams = new HttpParams()
24
+ .set('p.showDirectSubordinatesOnly', params.showDirectSubordinatesOnly)
25
+ .set('p.loadOptions.pageIndex', params.pageIndex + 1)
26
+ .set('p.loadOptions.pageSize', params.pageSize)
27
+ .set('p.loadOptions.searchValue', params.searchValue ?? '');
28
+
29
+ return this.http.get<{ ResponseData: SubordinatesApiResponse }>(`${baseUrl}/hr/widgets/me/team/subordinates`, {
30
+ params: httpParams,
31
+ headers: this.headers,
32
+ });
33
+ }
34
+ }
@@ -0,0 +1,77 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { Observable } from 'rxjs';
3
+ import { PersonalInfoAddressDetails, PersonalInfoContactDetails, PersonalInfoMainDetails } from '../types/common';
4
+
5
+ @Injectable({
6
+ providedIn: 'root',
7
+ })
8
+ export class PersonalInformationCacheService {
9
+ private baseUrl = '';
10
+
11
+ private mainDetails$: Observable<PersonalInfoMainDetails> | null = null;
12
+ private contactDetails$: Observable<PersonalInfoContactDetails> | null = null;
13
+ private addressDetails$: Observable<PersonalInfoAddressDetails> | null = null;
14
+ private languages$: Observable<string[]> | null = null;
15
+ private otherNationalities$: Observable<string[]> | null = null;
16
+
17
+ getMainDetails(baseUrl: string): Observable<PersonalInfoMainDetails> | null {
18
+ return this.baseUrl === baseUrl ? this.mainDetails$ : null;
19
+ }
20
+
21
+ setMainDetails(baseUrl: string, value: Observable<PersonalInfoMainDetails>): void {
22
+ this.ensureBaseUrl(baseUrl);
23
+ this.mainDetails$ = value;
24
+ }
25
+
26
+ getContactDetails(baseUrl: string): Observable<PersonalInfoContactDetails> | null {
27
+ return this.baseUrl === baseUrl ? this.contactDetails$ : null;
28
+ }
29
+
30
+ setContactDetails(baseUrl: string, value: Observable<PersonalInfoContactDetails>): void {
31
+ this.ensureBaseUrl(baseUrl);
32
+ this.contactDetails$ = value;
33
+ }
34
+
35
+ getAddressDetails(baseUrl: string): Observable<PersonalInfoAddressDetails> | null {
36
+ return this.baseUrl === baseUrl ? this.addressDetails$ : null;
37
+ }
38
+
39
+ setAddressDetails(baseUrl: string, value: Observable<PersonalInfoAddressDetails>): void {
40
+ this.ensureBaseUrl(baseUrl);
41
+ this.addressDetails$ = value;
42
+ }
43
+
44
+ getLanguages(baseUrl: string): Observable<string[]> | null {
45
+ return this.baseUrl === baseUrl ? this.languages$ : null;
46
+ }
47
+
48
+ setLanguages(baseUrl: string, value: Observable<string[]>): void {
49
+ this.ensureBaseUrl(baseUrl);
50
+ this.languages$ = value;
51
+ }
52
+
53
+ getOtherNationalities(baseUrl: string): Observable<string[]> | null {
54
+ return this.baseUrl === baseUrl ? this.otherNationalities$ : null;
55
+ }
56
+
57
+ setOtherNationalities(baseUrl: string, value: Observable<string[]>): void {
58
+ this.ensureBaseUrl(baseUrl);
59
+ this.otherNationalities$ = value;
60
+ }
61
+
62
+ clear(): void {
63
+ this.baseUrl = '';
64
+ this.mainDetails$ = null;
65
+ this.contactDetails$ = null;
66
+ this.addressDetails$ = null;
67
+ this.languages$ = null;
68
+ this.otherNationalities$ = null;
69
+ }
70
+
71
+ private ensureBaseUrl(baseUrl: string): void {
72
+ if (this.baseUrl && this.baseUrl !== baseUrl) {
73
+ this.clear();
74
+ }
75
+ this.baseUrl = baseUrl;
76
+ }
77
+ }
@@ -0,0 +1,44 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { Observable } from 'rxjs';
3
+ import { DependentDocumentGroup, PersonalDocument } from '../types/common';
4
+
5
+ @Injectable({
6
+ providedIn: 'root',
7
+ })
8
+ export class ProfileDocumentsCacheService {
9
+ private baseUrl = '';
10
+
11
+ private dependentDocuments$: Observable<DependentDocumentGroup[]> | null = null;
12
+ private personalDocuments$: Observable<PersonalDocument[]> | null = null;
13
+
14
+ getDependentDocuments(baseUrl: string): Observable<DependentDocumentGroup[]> | null {
15
+ return this.baseUrl === baseUrl ? this.dependentDocuments$ : null;
16
+ }
17
+
18
+ setDependentDocuments(baseUrl: string, value: Observable<DependentDocumentGroup[]>): void {
19
+ this.ensureBaseUrl(baseUrl);
20
+ this.dependentDocuments$ = value;
21
+ }
22
+
23
+ getPersonalDocuments(baseUrl: string): Observable<PersonalDocument[]> | null {
24
+ return this.baseUrl === baseUrl ? this.personalDocuments$ : null;
25
+ }
26
+
27
+ setPersonalDocuments(baseUrl: string, value: Observable<PersonalDocument[]>): void {
28
+ this.ensureBaseUrl(baseUrl);
29
+ this.personalDocuments$ = value;
30
+ }
31
+
32
+ clear(): void {
33
+ this.baseUrl = '';
34
+ this.dependentDocuments$ = null;
35
+ this.personalDocuments$ = null;
36
+ }
37
+
38
+ private ensureBaseUrl(baseUrl: string): void {
39
+ if (this.baseUrl && this.baseUrl !== baseUrl) {
40
+ this.clear();
41
+ }
42
+ this.baseUrl = baseUrl;
43
+ }
44
+ }