style: enhance layout and functionality of duty markers and calendar
- Updated CSS for `.day` and `.access-denied` to improve layout and visual consistency. - Introduced a new function `dutyOverlapsLocalRange` in `dateUtils.js` to check duty overlaps within a specified date range. - Refactored `dutyItemHtml` in `dutyList.js` to utilize `formatTimeLocal` for time formatting, enhancing readability. - Added utility functions in `hints.js` for parsing duty marker data and building time prefixes, streamlining hint rendering logic. - Improved the `showAccessDenied` function in `ui.js` to display detailed server messages when access is denied.
This commit is contained in:
@@ -13,7 +13,6 @@ import {
|
||||
formatTimeLocal,
|
||||
formatDateKey
|
||||
} from "./dateUtils.js";
|
||||
import { dutiesByDate } from "./calendar.js";
|
||||
|
||||
/**
|
||||
* Build HTML for one timeline duty card: one-day "DD.MM, HH:MM – HH:MM" or multi-day.
|
||||
@@ -60,8 +59,6 @@ export function dutyTimelineCardHtml(d, isCurrent) {
|
||||
* @returns {string}
|
||||
*/
|
||||
export function dutyItemHtml(d, typeLabelOverride, showUntilEnd, extraClass) {
|
||||
const startDate = new Date(d.start_at);
|
||||
const endDate = new Date(d.end_at);
|
||||
const typeLabel =
|
||||
typeLabelOverride != null
|
||||
? typeLabelOverride
|
||||
@@ -70,25 +67,14 @@ export function dutyItemHtml(d, typeLabelOverride, showUntilEnd, extraClass) {
|
||||
if (extraClass) itemClass += " " + extraClass;
|
||||
let timeOrRange = "";
|
||||
if (showUntilEnd && d.event_type === "duty") {
|
||||
const end =
|
||||
String(endDate.getHours()).padStart(2, "0") +
|
||||
":" +
|
||||
String(endDate.getMinutes()).padStart(2, "0");
|
||||
timeOrRange = "до " + end;
|
||||
timeOrRange = "до " + formatTimeLocal(d.end_at);
|
||||
} else if (d.event_type === "vacation" || d.event_type === "unavailable") {
|
||||
const startStr = formatDateKey(d.start_at);
|
||||
const endStr = formatDateKey(d.end_at);
|
||||
timeOrRange = startStr === endStr ? startStr : startStr + " – " + endStr;
|
||||
} else {
|
||||
const start =
|
||||
String(startDate.getHours()).padStart(2, "0") +
|
||||
":" +
|
||||
String(startDate.getMinutes()).padStart(2, "0");
|
||||
const end =
|
||||
String(endDate.getHours()).padStart(2, "0") +
|
||||
":" +
|
||||
String(endDate.getMinutes()).padStart(2, "0");
|
||||
timeOrRange = start + " – " + end;
|
||||
timeOrRange =
|
||||
formatTimeLocal(d.start_at) + " – " + formatTimeLocal(d.end_at);
|
||||
}
|
||||
return (
|
||||
'<div class="' +
|
||||
|
||||
Reference in New Issue
Block a user