mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-05 02:14:05 +00:00
* feat(vacay): support half vacation days (#552) Log a vacation day as a half day (0.5) as well as a full day and count it as such against the entitlement. A "Half day" mode joins the calendar toolbar on desktop and mobile; half days render as a diagonal half-fill in the day cell, and the used/remaining totals carry the fraction. Closes #552 * refactor(vacay): half-day as a per-person toggle with a corner badge The diagonal half-fill collided with the two-person split — one person's half day looked like two people off. Drop the diagonal: the cell fill keeps showing who is off, a half day gets a small corner ½ badge, and a hover tooltip lists who is off on that date and how much (only when a half day is present). Logging moves from a third mode to a Half-day toggle that applies to the selected person, on desktop and mobile. * feat(vacay): mark half days with an orange corner dot Swap the ½ badge for a small orange dot in the bottom-right corner, mirroring the blue trip dot — quieter in the grid, and the hover tooltip still spells out who is on a half day. * fix(vacay): make the fraction migration idempotent The crosswalk test replays the migration tail (rewind + re-run), which expects every later migration to be idempotent. Guard the vacay_entries ADD COLUMN behind a pragma_table_info check so the second run is a no-op. Also only set dayVisual's `half` flag when true, so full days keep their exact { background, numColor } shape for the mobile day-model unit test. * style(vacay): nudge the mobile day dots slightly inward The blue trip dot and orange half-day dot sat right in the cell corner on mobile; move both a touch toward the centre so they read cleaner.
This commit is contained in:
@@ -695,7 +695,7 @@ export function createRealRpcHost(id: string, granted: ReadonlySet<string>, rout
|
||||
},
|
||||
// --- Vacay write: the plan is the ACTING USER's active plan (resolved host-side);
|
||||
// the service broadcasts to plan users itself. ---
|
||||
vacayToggleEntry: (userId, date) => { requireAddon(ADDON_IDS.VACAY, 'vacay'); return vacayToggleEntrySvc(userId, getActivePlanId(userId), date, undefined); },
|
||||
vacayToggleEntry: (userId, date) => { requireAddon(ADDON_IDS.VACAY, 'vacay'); return vacayToggleEntrySvc(userId, getActivePlanId(userId), date, 1, undefined); },
|
||||
vacayToggleCompanyHoliday: (userId, date, note) => {
|
||||
requireAddon(ADDON_IDS.VACAY, 'vacay');
|
||||
return vacayToggleCompanyHolidaySvc(getActivePlanId(userId), date, note, undefined);
|
||||
|
||||
@@ -182,7 +182,7 @@ export class VacayController {
|
||||
@HttpCode(200)
|
||||
toggleEntry(
|
||||
@CurrentUser() user: User,
|
||||
@Body() body: { date?: string; target_user_id?: number | string },
|
||||
@Body() body: { date?: string; target_user_id?: number | string; fraction?: number },
|
||||
@Headers('x-socket-id') socketId?: string,
|
||||
) {
|
||||
if (!body.date) {
|
||||
@@ -197,7 +197,7 @@ export class VacayController {
|
||||
}
|
||||
userId = tid;
|
||||
}
|
||||
return this.vacay.toggleEntry(userId, planId, body.date, socketId);
|
||||
return this.vacay.toggleEntry(userId, planId, body.date, body.fraction, socketId);
|
||||
}
|
||||
|
||||
@Post('entries/company-holiday')
|
||||
|
||||
@@ -86,8 +86,8 @@ export class VacayService {
|
||||
return svc.getEntries(planId, year);
|
||||
}
|
||||
|
||||
toggleEntry(userId: number, planId: number, date: string, socketId: string | undefined) {
|
||||
return svc.toggleEntry(userId, planId, date, socketId);
|
||||
toggleEntry(userId: number, planId: number, date: string, fraction: unknown, socketId: string | undefined) {
|
||||
return svc.toggleEntry(userId, planId, date, fraction, socketId);
|
||||
}
|
||||
|
||||
toggleCompanyHoliday(planId: number, date: string, note: string | undefined, socketId: string | undefined) {
|
||||
|
||||
Reference in New Issue
Block a user