@skysoftware-co/bayan-hr-widgets-ui 2.0.19 → 2.0.20

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 +109 -0
  67. package/src/lib/my-team-subordinates-popup-widget/components/my-team-subordinates-popup/my-team-popup.component.ts +297 -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 -4788
  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 -1306
@@ -0,0 +1,199 @@
1
+ import { ChangeDetectionStrategy, Component, effect, inject, input, output, signal } from '@angular/core';
2
+ import { HRSelfWidgetsService } from '../services/hr-self-widgets.service';
3
+ import { faCalendarStar } from '@fortawesome/pro-light-svg-icons';
4
+ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
5
+ import { HRCardHeaderComponent } from '../shared/components/card-header/card-header.component';
6
+ import { HREventItemComponent } from './components/event-item/event-item.component';
7
+ import { HREventTabBarComponent } from './components/event-tab-bar/event-tab-bar.component';
8
+ import { HREventsPopupComponent } from './components/events-popup/events-popup.component';
9
+ import {
10
+ EventOption,
11
+ RelativeDay,
12
+ Birthday,
13
+ PublicHoliday,
14
+ UpcomingEventsV2,
15
+ EventTypeEnum,
16
+ FilteredUpcomingEvent,
17
+ } from '../shared/types/common';
18
+ import { HRTranslatePipe } from '../shared/pipes/translate.pipe';
19
+
20
+ @Component({
21
+ selector: 'hr-my-upcoming-events-widget',
22
+ standalone: true,
23
+ imports: [
24
+ FontAwesomeModule,
25
+ HRCardHeaderComponent,
26
+ HREventItemComponent,
27
+ HREventTabBarComponent,
28
+ HREventsPopupComponent,
29
+ HRTranslatePipe,
30
+ ],
31
+ templateUrl: './my-upcoming-events-widget.component.html',
32
+ changeDetection: ChangeDetectionStrategy.OnPush,
33
+ })
34
+ export class MyUpcomingEventsWidgetComponent {
35
+ readonly baseUrl = input<string>('');
36
+ readonly weekendWarningDescription = input<string>('WeekendDayNotDefined');
37
+ readonly selectedLanguage = input<string>('en');
38
+ readonly showProperty = input<boolean>(true);
39
+
40
+ readonly cardClass = input<string>('bg-light-gray border-0 card p-3 card-shadow rounded rounded-4 mt-3');
41
+ readonly noEventsTextClass = input<string>('text-center my-3 text-light-gray');
42
+ readonly viewAllLinkClass = input<string>('fs-14 mt-2');
43
+ readonly viewAllContainerClass = input<string>('d-flex justify-content-end cursor-pointer');
44
+ readonly warningTextClass = input<string>('text-center my-2 text-light-gray');
45
+ readonly tabSelectedClass = input<string>('selected-event-option');
46
+ readonly tabNotSelectedClass = input<string>('not-selected-event-option');
47
+ readonly tabTextSelectedClass = input<string>('text-white');
48
+ readonly tabTextNotSelectedClass = input<string>('text-primary');
49
+ readonly tabContainerClass = input<string>('d-flex gap-2 mb-3');
50
+ readonly tabItemClass = input<string>(
51
+ 'col-1 align-items-center rounded rounded-3 cursor-pointer text-center d-flex justify-content-center py-2 px-3',
52
+ );
53
+ readonly tabTextClass = input<string>('fs-16');
54
+ readonly tabIconClass = input<string>('fs-6');
55
+ readonly eventIconClass = input<string>('fs-6 text-primary pe-2');
56
+ readonly eventNameBoldClass = input<string>('fw-medium');
57
+ readonly eventDescriptionClass = input<string>('text-primary fw-medium');
58
+ readonly propertyBadgeClass = input<string>('property-badge cursor-pointer me-1');
59
+ readonly dateFormat = input<string>('dd/MM/yyyy');
60
+
61
+ readonly isLoadingChanged = output<boolean>();
62
+ readonly viewAllClicked = output<void>();
63
+
64
+ readonly externalViewAll = input<boolean>(false);
65
+
66
+ readonly selectedEventType = signal<EventTypeEnum | null>(null);
67
+ readonly selectedPopupEventType = signal<EventTypeEnum | null>(null);
68
+
69
+ readonly calendarStar = faCalendarStar;
70
+
71
+ readonly filteredEvents = signal<FilteredUpcomingEvent[]>([]);
72
+ readonly birthdays = signal<Birthday[]>([]);
73
+ readonly holidays = signal<PublicHoliday[]>([]);
74
+
75
+ readonly popupEvents = signal<FilteredUpcomingEvent[]>([]);
76
+ readonly popupVisible = signal(false);
77
+
78
+ readonly weekendWarning = signal<string | null>(null);
79
+
80
+ private readonly selfWidgetsService = inject(HRSelfWidgetsService);
81
+
82
+ private readonly loadEventsEffect = effect(() => {
83
+ this.loadEvents(EventOption.All);
84
+ });
85
+
86
+ onTabClick(eventType: EventTypeEnum | null) {
87
+ this.selectedEventType.set(eventType);
88
+ this.filteredEvents.set(this.buildEvents(this.cardData(), eventType, 2));
89
+ }
90
+
91
+ onPopupTabClick(eventType: EventTypeEnum | null) {
92
+ this.selectedPopupEventType.set(eventType);
93
+ this.popupEvents.set(this.buildEvents(this.cardData(), eventType));
94
+ }
95
+
96
+ showPopup() {
97
+ if (this.externalViewAll()) {
98
+ this.viewAllClicked.emit();
99
+ return;
100
+ }
101
+ this.popupEvents.set(this.buildEvents(this.cardData(), this.selectedPopupEventType()));
102
+ this.popupVisible.set(true);
103
+ }
104
+
105
+ onPopupClose() {
106
+ this.popupVisible.set(false);
107
+ this.selectedPopupEventType.set(null);
108
+ }
109
+
110
+ onPopupVisibleChange(visible: boolean) {
111
+ this.popupVisible.set(visible);
112
+ }
113
+
114
+ // --- Private ---
115
+
116
+ private readonly cardData = signal<UpcomingEventsV2 | null>(null);
117
+
118
+ private getUpcomingEvents(eventOption: EventOption) {
119
+ return this.selfWidgetsService.getUpcomingEvents(this.baseUrl(), eventOption);
120
+ }
121
+
122
+ private loadEvents(eventOption: EventOption) {
123
+ this.isLoadingChanged.emit(true);
124
+ this.getUpcomingEvents(eventOption).subscribe({
125
+ next: (response: any) => {
126
+ this.cardData.set(response.ResponseData);
127
+ const currentData = this.cardData();
128
+ this.birthdays.set(currentData?.Birthdays || []);
129
+ this.holidays.set(currentData?.PublicHolidays || []);
130
+ this.weekendWarning.set(currentData?.IsWeekendConfigured === false ? this.weekendWarningDescription() : null);
131
+ this.filteredEvents.set(this.buildEvents(currentData, null, 2));
132
+ this.isLoadingChanged.emit(false);
133
+ },
134
+ error: () => {
135
+ this.isLoadingChanged.emit(false);
136
+ },
137
+ });
138
+ }
139
+
140
+ private buildEvents(
141
+ source: UpcomingEventsV2 | null,
142
+ eventType: EventTypeEnum | null,
143
+ limit?: number,
144
+ ): FilteredUpcomingEvent[] {
145
+ const birthdays = source?.Birthdays || [];
146
+ const holidays = source?.PublicHolidays || [];
147
+
148
+ let filtered: FilteredUpcomingEvent[];
149
+
150
+ if (eventType === EventTypeEnum.Birthdays) {
151
+ filtered = birthdays
152
+ .map(b => this.mapBirthday(b))
153
+ .sort((a, b) => new Date(a.EventDate).getTime() - new Date(b.EventDate).getTime());
154
+ } else if (eventType === EventTypeEnum.PublicHolidays) {
155
+ filtered = holidays
156
+ .map(h => this.mapHoliday(h))
157
+ .sort((a, b) => new Date(a.EventDate).getTime() - new Date(b.EventDate).getTime());
158
+ } else {
159
+ if (limit) {
160
+ filtered = [...birthdays.map(b => this.mapBirthday(b)), ...holidays.map(h => this.mapHoliday(h))]
161
+ .sort((a, b) => new Date(a.EventDate).getTime() - new Date(b.EventDate).getTime())
162
+ .slice(0, 2);
163
+ } else {
164
+ filtered = [...birthdays.map(b => this.mapBirthday(b)), ...holidays.map(h => this.mapHoliday(h))];
165
+ }
166
+ }
167
+
168
+ if (limit) {
169
+ filtered = filtered.slice(0, limit);
170
+ }
171
+
172
+ return filtered.sort((a, b) => new Date(a.EventDate).getTime() - new Date(b.EventDate).getTime());
173
+ }
174
+
175
+ private mapBirthday(b: Birthday): FilteredUpcomingEvent {
176
+ const birthdate = new Date(b.Birthdate);
177
+ const eventDate = new Date(new Date().getFullYear(), birthdate.getMonth(), birthdate.getDate());
178
+ return {
179
+ EventDate: eventDate,
180
+ Name: b.EmployeeShortName,
181
+ EventType: EventTypeEnum.Birthdays,
182
+ Description: b.RelativeDay.toString(),
183
+ IsIn2Days: RelativeDay[b.RelativeDay as unknown as keyof typeof RelativeDay] === RelativeDay.TwoDays,
184
+ PropertyName: b.EmployeePropertyName,
185
+ PropertySymbol: b.EmployeePropertySymbol,
186
+ };
187
+ }
188
+
189
+ private mapHoliday(h: PublicHoliday): FilteredUpcomingEvent {
190
+ return {
191
+ EventDate: new Date(h.StartDate),
192
+ StartDate: new Date(h.StartDate),
193
+ EndDate: new Date(h.EndDate),
194
+ Name: h.Description,
195
+ EventType: EventTypeEnum.PublicHolidays,
196
+ Description: h.WeekContext.toString(),
197
+ };
198
+ }
199
+ }