Refactors employee details and UI controls
Enhances employee hours view with dynamic weekly schedule rendering Updates toggle slider and theme switch components with improved interactions Adds more flexible notification and settings configurations for employees Improves user experience by streamlining UI controls and schedule display
This commit is contained in:
parent
6746e876d7
commit
545d6606a6
18 changed files with 506 additions and 206 deletions
36
PlanTempus.Application/wwwroot/ts/modules/controls.ts
Normal file
36
PlanTempus.Application/wwwroot/ts/modules/controls.ts
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* Controls Module
|
||||
*
|
||||
* Handles generic UI controls functionality:
|
||||
* - Toggle sliders (Ja/Nej switches)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Controller for generic UI controls
|
||||
*/
|
||||
export class ControlsController {
|
||||
constructor() {
|
||||
this.initToggleSliders();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize all toggle sliders on the page
|
||||
* Toggle slider: Ja/Nej button switch with data-value attribute
|
||||
* Clicking anywhere on the slider toggles the value
|
||||
*/
|
||||
private initToggleSliders(): void {
|
||||
document.querySelectorAll('swp-toggle-slider').forEach(slider => {
|
||||
slider.addEventListener('click', () => {
|
||||
const el = slider as HTMLElement;
|
||||
const newValue = el.dataset.value === 'yes' ? 'no' : 'yes';
|
||||
el.dataset.value = newValue;
|
||||
|
||||
// Dispatch custom event for listeners
|
||||
slider.dispatchEvent(new CustomEvent('toggle', {
|
||||
bubbles: true,
|
||||
detail: { value: newValue }
|
||||
}));
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue