@skysoftware-co/bayan-hr-widgets-ui 1.0.4 → 1.0.5

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/README.md CHANGED
@@ -30,6 +30,7 @@ This package contains shared HR components used in Bayan HR system, you can find
30
30
  components:
31
31
  1. My Main Details Widget
32
32
  2. My Upcoming Events Widget
33
+ 3. My Calendar Widget
33
34
 
34
35
  ## Dependencies
35
36
  This library depends on `@skysoftware-co/bayan-components-ui` package which provides:
@@ -38,6 +39,53 @@ This library depends on `@skysoftware-co/bayan-components-ui` package which prov
38
39
  ## Installation
39
40
  use npm to install this package by command: @skysoftware-co/bayan-hr-components
40
41
 
42
+ ## Setup
43
+
44
+ Before using any component, you need to configure the `HRTranslateService` and provide the `HRTranslatePipe` in your application.
45
+
46
+ ### 1. Set language and lexicon in your App Component
47
+
48
+ ```typescript
49
+ import { Component, inject, OnInit } from '@angular/core';
50
+ import { HRTranslateService } from '@skysoftware-co/bayan-hr-widgets-ui';
51
+
52
+ @Component({
53
+ selector: 'app-root',
54
+ ...
55
+ })
56
+ export class AppComponent implements OnInit {
57
+ private hrTranslateService = inject(HRTranslateService);
58
+
59
+ ngOnInit(): void {
60
+ // Set the active language (built-in: 'en', 'ar', 'fr')
61
+ this.hrTranslateService.setLanguage('en');
62
+
63
+ // Optionally set a lexicon for additional or override translations
64
+ this.hrTranslateService.setLexicon({
65
+ 'CustomKey': 'Custom Value',
66
+ ...
67
+ });
68
+ }
69
+ }
70
+ ```
71
+
72
+ ### 2. Provide the HRTranslatePipe
73
+
74
+ Add `HRTranslatePipe` to the `providers` array in your App Component:
75
+
76
+ ```typescript
77
+ import { HRTranslatePipe } from '@skysoftware-co/bayan-hr-widgets-ui';
78
+
79
+ @Component({
80
+ selector: 'app-root',
81
+ standalone: true,
82
+ imports: [...],
83
+ providers: [HRTranslatePipe],
84
+ ...
85
+ })
86
+ export class AppComponent { }
87
+ ```
88
+
41
89
  ## Constants Service
42
90
 
43
91
  ### Usage
@@ -52,6 +100,9 @@ This service provides default constant values used across HR components, you can
52
100
  |----------|------|---------------|-------------|
53
101
  | `defaultVacationBalanceColor` | string | `'#727070'` | Default color for vacation balance indicator |
54
102
  | `defaultVacationColor` | string | `'#DCDCDC'` | Default color for vacation type when no color is assigned |
103
+ | `defaultPublicHolidayColor` | string | `'#249EA0'` | Default color for public holidays in calendar |
104
+ | `defaultDayOffColor` | string | `'#FCCF5A'` | Default color for days off in calendar |
105
+ | `defaultEventsColor` | string | `'#e67e0f'` | Default color for events in calendar |
55
106
 
56
107
 
57
108
  ## My Main Details Widget Component
@@ -174,3 +225,47 @@ This component displays upcoming events (birthdays and public holidays) in a car
174
225
  ### Output Events
175
226
  - `isLoadingChanged: EventEmitter<boolean>` - Emitted when loading state changes
176
227
  - `viewAllClicked: EventEmitter<void>` - Emitted when view all is clicked (only when `externalViewAll` is true)
228
+
229
+
230
+ ## My Calendar Widget Component
231
+
232
+ ### Usage
233
+ ```html
234
+ <hr-my-calendar-widget
235
+ [baseUrl]="environment.baseUrl">
236
+ </hr-my-calendar-widget>
237
+ ```
238
+
239
+ This component displays an employee calendar showing vacations, public holidays, days off, and events. It uses DevExtreme Calendar (`DxCalendarModule`) with custom cell templates to render color-coded date ranges. The calendar loads 12 months of data starting from one month before the current date.
240
+
241
+ ### Input Properties
242
+ | Input | Type | Default Value | Description |
243
+ |-------|------|---------------|-------------|
244
+ | `baseUrl` | string | `''` | Base URL for API calls |
245
+ | `headerContainerClass` | string | `''` | Additional CSS class for the header container |
246
+ | `publicHolidayColor` | string | from `HRConstantsService`: `'#249EA0'` | Color for public holidays |
247
+ | `dayOffColor` | string | from `HRConstantsService`: `'#FCCF5A'` | Color for days off |
248
+ | `eventsColor` | string | from `HRConstantsService`: `'#e67e0f'` | Color for events |
249
+ | `legendContainerClass` | string | `'row mb-2'` | Legend container CSS class |
250
+ | `legendRowClass` | string | `'d-flex'` | Legend row CSS class |
251
+ | `legendItemClass` | string | `'d-flex align-items-center'` | Legend item CSS class |
252
+ | `legendDotClass` | string | `'me-1 circle-sm'` | Legend dot CSS class |
253
+ | `legendLabelClass` | string | `'me-1 fs-12'` | Legend label CSS class |
254
+ | `publicHolidayDotClass` | string | `'bg-accent'` | Public holiday dot CSS class |
255
+ | `dayOffDotClass` | string | `'bg-yellow'` | Day off dot CSS class |
256
+ | `eventsDotClass` | string | `'bg-primary'` | Events dot CSS class |
257
+ | `vacationsContainerClass` | string | `'d-flex mt-3'` | Vacations legend container CSS class |
258
+ | `vacationsItemClass` | string | `'d-flex align-items-center'` | Vacations legend item CSS class |
259
+ | `vacationsIconClass` | string | `'fs-8 me-1'` | Vacations icon CSS class |
260
+ | `calendarContainerClass` | string | `'row mt-2 col-12'` | Calendar container CSS class |
261
+ | `calendarClass` | string | `'button-boeder-none'` | Calendar CSS class |
262
+
263
+ ### Output Events
264
+ - `isLoadingChanged: EventEmitter<boolean>` - Emitted when loading state changes
265
+
266
+ ### API Endpoint
267
+ The component calls `GET {baseUrl}/hr/employee-portal/calendar` with query parameters:
268
+ - `Month` - Starting month
269
+ - `Year` - Starting year
270
+ - `MonthsCount` - Number of months to load (default: 12)
271
+ - Header: `api-version: 2`