This commit is contained in:
gsinghpal
2026-03-16 08:14:56 -04:00
parent fdca9518ab
commit e56974d46f
196 changed files with 19739 additions and 3471 deletions

View File

@@ -294,13 +294,10 @@ body:has(.fclk-app) .o_footer {
.fclk-btn-icon {
position: relative;
z-index: 1;
display: flex;
align-items: center;
justify-content: center;
}
.fclk-btn-icon svg[id="fclk-btn-icon-play"] {
transform: translateX(3px);
#fclk-btn-icon-play {
transform: translateX(4px);
}
.fclk-btn-ripple {
@@ -605,22 +602,22 @@ body:has(.fclk-app) .o_footer {
/* Standalone fallbacks for wizard modals rendered outside .fclk-app */
.fclk-wizard-overlay {
--fclk-card: var(--fclk-card, #ffffff);
--fclk-card-border: var(--fclk-card-border, #e5e7eb);
--fclk-bg: var(--fclk-bg, #f3f4f6);
--fclk-text: var(--fclk-text, #1f2937);
--fclk-text-muted: var(--fclk-text-muted, #6b7280);
--fclk-text-dim: var(--fclk-text-dim, #9ca3af);
--fclk-green: var(--fclk-green, #10B981);
--fclk-green-glow: var(--fclk-green-glow, rgba(16, 185, 129, 0.25));
--fclk-hover-bg: var(--fclk-hover-bg, #f9fafb);
--fclk-wiz-card: #ffffff;
--fclk-wiz-card-border: #e5e7eb;
--fclk-wiz-bg: #f3f4f6;
--fclk-wiz-text: #1f2937;
--fclk-wiz-text-muted: #6b7280;
--fclk-wiz-text-dim: #9ca3af;
--fclk-wiz-green: #10B981;
--fclk-wiz-green-glow: rgba(16, 185, 129, 0.25);
--fclk-wiz-hover-bg: #f9fafb;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 300;
z-index: 1055;
display: flex;
align-items: center;
justify-content: center;
@@ -629,26 +626,26 @@ body:has(.fclk-app) .o_footer {
@media (prefers-color-scheme: dark) {
.fclk-wizard-overlay {
--fclk-card: #1a1d23;
--fclk-card-border: #2a2d35;
--fclk-bg: #0f1117;
--fclk-text: #ffffff;
--fclk-text-muted: #9ca3af;
--fclk-text-dim: #6b7280;
--fclk-green-glow: rgba(16, 185, 129, 0.3);
--fclk-hover-bg: #1e2128;
--fclk-wiz-card: #1a1d23;
--fclk-wiz-card-border: #2a2d35;
--fclk-wiz-bg: #0f1117;
--fclk-wiz-text: #ffffff;
--fclk-wiz-text-muted: #9ca3af;
--fclk-wiz-text-dim: #6b7280;
--fclk-wiz-green-glow: rgba(16, 185, 129, 0.3);
--fclk-wiz-hover-bg: #1e2128;
}
}
html.o_dark .fclk-wizard-overlay {
--fclk-card: #1a1d23;
--fclk-card-border: #2a2d35;
--fclk-bg: #0f1117;
--fclk-text: #ffffff;
--fclk-text-muted: #9ca3af;
--fclk-text-dim: #6b7280;
--fclk-green-glow: rgba(16, 185, 129, 0.3);
--fclk-hover-bg: #1e2128;
--fclk-wiz-card: #1a1d23;
--fclk-wiz-card-border: #2a2d35;
--fclk-wiz-bg: #0f1117;
--fclk-wiz-text: #ffffff;
--fclk-wiz-text-muted: #9ca3af;
--fclk-wiz-text-dim: #6b7280;
--fclk-wiz-green-glow: rgba(16, 185, 129, 0.3);
--fclk-wiz-hover-bg: #1e2128;
}
.fclk-wizard-backdrop {
@@ -664,8 +661,8 @@ html.o_dark .fclk-wizard-overlay {
.fclk-wizard-dialog {
position: relative;
background: var(--fclk-card);
border: 1px solid var(--fclk-card-border);
background: var(--fclk-wiz-card, #ffffff);
border: 1px solid var(--fclk-wiz-card-border, #e5e7eb);
border-radius: 20px;
width: 100%;
max-width: 440px;
@@ -693,7 +690,7 @@ html.o_dark .fclk-wizard-overlay {
.fclk-wizard-header {
padding: 28px 24px 20px;
text-align: center;
border-bottom: 1px solid var(--fclk-card-border);
border-bottom: 1px solid var(--fclk-wiz-card-border, #e5e7eb);
}
.fclk-wizard-header-icon {
@@ -722,7 +719,7 @@ html.o_dark .fclk-wizard-overlay {
}
.fclk-wizard-title {
color: var(--fclk-text);
color: var(--fclk-wiz-text, #1f2937);
font-size: 20px;
font-weight: 700;
margin: 0 0 6px;
@@ -730,7 +727,7 @@ html.o_dark .fclk-wizard-overlay {
}
.fclk-wizard-subtitle {
color: var(--fclk-text-muted);
color: var(--fclk-wiz-text-muted, #6b7280);
font-size: 13px;
line-height: 1.5;
margin: 0;
@@ -752,14 +749,14 @@ html.o_dark .fclk-wizard-overlay {
display: flex;
align-items: center;
gap: 6px;
color: var(--fclk-text);
color: var(--fclk-wiz-text, #1f2937);
font-size: 13px;
font-weight: 600;
margin-bottom: 8px;
}
.fclk-wizard-label svg {
color: var(--fclk-text-muted);
color: var(--fclk-wiz-text-muted, #6b7280);
flex-shrink: 0;
}
@@ -770,24 +767,24 @@ html.o_dark .fclk-wizard-overlay {
.fclk-wizard-input {
width: 100%;
background: var(--fclk-bg);
border: 1.5px solid var(--fclk-card-border);
background: var(--fclk-wiz-bg, #f3f4f6);
border: 1.5px solid var(--fclk-wiz-card-border, #e5e7eb);
border-radius: 12px;
padding: 12px 14px;
font-size: 14px;
color: var(--fclk-text);
color: var(--fclk-wiz-text, #1f2937);
transition: border-color 0.2s, box-shadow 0.2s;
outline: none;
font-family: inherit;
}
.fclk-wizard-input:focus {
border-color: var(--fclk-green);
box-shadow: 0 0 0 3px var(--fclk-green-glow);
border-color: var(--fclk-wiz-green, #10B981);
box-shadow: 0 0 0 3px var(--fclk-wiz-green-glow, rgba(16, 185, 129, 0.25));
}
.fclk-wizard-input::placeholder {
color: var(--fclk-text-dim);
color: var(--fclk-wiz-text-dim, #9ca3af);
}
.fclk-wizard-textarea {
@@ -797,7 +794,7 @@ html.o_dark .fclk-wizard-overlay {
.fclk-wizard-hint {
display: block;
color: var(--fclk-text-dim);
color: var(--fclk-wiz-text-dim, #9ca3af);
font-size: 11px;
margin-top: 6px;
}
@@ -807,7 +804,7 @@ html.o_dark .fclk-wizard-overlay {
display: flex;
gap: 10px;
justify-content: flex-end;
border-top: 1px solid var(--fclk-card-border);
border-top: 1px solid var(--fclk-wiz-card-border, #e5e7eb);
}
.fclk-wizard-btn {
@@ -852,20 +849,20 @@ html.o_dark .fclk-wizard-overlay {
}
.fclk-wizard-btn--secondary {
background: var(--fclk-bg);
color: var(--fclk-text-muted);
border: 1px solid var(--fclk-card-border);
background: var(--fclk-wiz-bg, #f3f4f6);
color: var(--fclk-wiz-text-muted, #6b7280);
border: 1px solid var(--fclk-wiz-card-border, #e5e7eb);
}
.fclk-wizard-btn--secondary:hover:not(:disabled) {
background: var(--fclk-hover-bg);
color: var(--fclk-text);
background: var(--fclk-wiz-hover-bg, #f9fafb);
color: var(--fclk-wiz-text, #1f2937);
}
/* Clock-out confirmation summary card */
.fclk-clockout-summary {
background: var(--fclk-bg);
border: 1px solid var(--fclk-card-border);
background: var(--fclk-wiz-bg, #f3f4f6);
border: 1px solid var(--fclk-wiz-card-border, #e5e7eb);
border-radius: 12px;
padding: 16px;
}
@@ -878,16 +875,16 @@ html.o_dark .fclk-wizard-overlay {
}
.fclk-clockout-summary-row + .fclk-clockout-summary-row {
border-top: 1px solid var(--fclk-card-border);
border-top: 1px solid var(--fclk-wiz-card-border, #e5e7eb);
}
.fclk-clockout-summary-label {
color: var(--fclk-text-muted);
color: var(--fclk-wiz-text-muted, #6b7280);
font-size: 13px;
}
.fclk-clockout-summary-value {
color: var(--fclk-text);
color: var(--fclk-wiz-text, #1f2937);
font-size: 14px;
font-weight: 600;
}
@@ -917,13 +914,13 @@ html.o_dark .fclk-wizard-overlay {
}
.fclk-modal-item-name {
color: var(--fclk-text);
color: var(--fclk-wiz-text, #1f2937);
font-size: 14px;
font-weight: 500;
}
.fclk-modal-item-addr {
color: var(--fclk-text-muted);
color: var(--fclk-wiz-text-muted, #6b7280);
font-size: 12px;
}

View File

@@ -535,10 +535,12 @@ export class FusionClockPortal extends Interaction {
const reasonEl = document.getElementById("fclk-reason-text");
const timeEl = document.getElementById("fclk-reason-time");
const reason = reasonEl ? reasonEl.value.trim() : "";
const depTime = timeEl ? timeEl.value.trim() : "";
const rawTime = timeEl ? timeEl.value.trim() : "";
const depTime = rawTime ? new Date(rawTime).toISOString() : "";
if (!reason) {
this._showToast("Please provide a reason.", "error");
return;
}

View File

@@ -356,9 +356,10 @@ export class FusionClockPortalFAB extends Interaction {
const submitBtn = document.getElementById("fclk-pfab-reason-submit-btn");
if (submitBtn) submitBtn.disabled = true;
try {
const rawTime = timeEl ? timeEl.value.trim() : "";
await rpc("/fusion_clock/submit_reason", {
reason: reason,
departure_time: timeEl ? timeEl.value : "",
departure_time: rawTime ? new Date(rawTime).toISOString() : "",
});
modal.style.display = "none";
if (reasonEl) reasonEl.value = "";

View File

@@ -1,21 +1,25 @@
/** @odoo-module **/
import { Component, useState, onWillStart, onMounted, onWillUnmount } from "@odoo/owl";
import { Dropdown } from "@web/core/dropdown/dropdown";
import { DropdownItem } from "@web/core/dropdown/dropdown_item";
import { useDropdownState } from "@web/core/dropdown/dropdown_hooks";
import { rpc } from "@web/core/network/rpc";
import { registry } from "@web/core/registry";
import { useService } from "@web/core/utils/hooks";
export class FusionClockFAB extends Component {
static props = {};
static template = "fusion_clock.ClockFAB";
static template = "fusion_clock.ClockSystray";
static components = { Dropdown, DropdownItem };
setup() {
this.notification = useService("notification");
this.dropdown = useDropdownState();
this.state = useState({
isCheckedIn: false,
isDisplayed: false,
expanded: false,
checkInTime: null,
locationName: "",
timerDisplay: "00:00:00",
@@ -40,38 +44,22 @@ export class FusionClockFAB extends Component {
if (this.state.isCheckedIn) {
this._startTimer();
}
// Poll every 15s to stay in sync with portal clock-outs
this._pollInterval = setInterval(() => this._fetchStatus(), 15000);
// Re-sync immediately when browser tab regains focus
this._onFocus = () => this._fetchStatus();
window.addEventListener("focus", this._onFocus);
// Close panel when clicking outside
this._onDocClick = (ev) => {
if (!this.state.expanded) return;
const el = ev.target.closest(".fclk-fab-wrapper");
if (!el) this.state.expanded = false;
};
document.addEventListener("click", this._onDocClick, true);
});
onWillUnmount(() => {
this._stopTimer();
if (this._pollInterval) clearInterval(this._pollInterval);
if (this._onDocClick) document.removeEventListener("click", this._onDocClick, true);
if (this._onFocus) window.removeEventListener("focus", this._onFocus);
});
}
togglePanel() {
this.state.expanded = !this.state.expanded;
this.state.error = "";
// Always re-fetch when opening the panel
if (this.state.expanded) {
this._fetchStatus();
}
}
// =================================================================
// Server sync
// =================================================================
async _fetchStatus() {
try {
@@ -83,6 +71,10 @@ export class FusionClockFAB extends Component {
this.state.todayHours = (result.today_hours || 0).toFixed(1);
this.state.weekHours = (result.week_hours || 0).toFixed(1);
if (result.pending_reason) {
this.state.showReasonDialog = true;
}
if (result.is_checked_in && result.check_in) {
const serverTime = new Date(result.check_in + "Z");
const wasRunning = this.state.isCheckedIn;
@@ -117,8 +109,13 @@ export class FusionClockFAB extends Component {
}
}
// =================================================================
// Clock actions
// =================================================================
async onClockAction() {
if (this.state.isCheckedIn) {
this.dropdown.close();
this.state.showClockoutConfirm = true;
return;
}
@@ -181,6 +178,7 @@ export class FusionClockFAB extends Component {
if (result.requires_reason) {
this.state.loading = false;
this.dropdown.close();
this.state.showReasonDialog = true;
this.state.reasonText = "";
this.state.reasonTime = "";
@@ -214,6 +212,10 @@ export class FusionClockFAB extends Component {
this.state.loading = false;
}
// =================================================================
// Reason dialog
// =================================================================
onReasonTextInput(ev) {
this.state.reasonText = ev.target.value;
}
@@ -243,13 +245,17 @@ export class FusionClockFAB extends Component {
this.state.reasonText = "";
this.state.reasonTime = "";
this.state.reasonSubmitting = false;
await this._executeClockAction();
this.notification.add("Reason submitted. You can now clock in.", { type: "success" });
} catch (e) {
this.state.error = "Failed to submit reason.";
this.state.reasonSubmitting = false;
}
}
// =================================================================
// Timer
// =================================================================
get confirmCheckinDisplay() {
if (!this.state.checkInTime) return "--";
const d = this.state.checkInTime;
@@ -293,6 +299,11 @@ export class FusionClockFAB extends Component {
}
}
registry.category("main_components").add("FusionClockFAB", {
const systrayRegistry = registry.category("systray");
if (systrayRegistry.contains("hr_attendance.attendance_menu")) {
systrayRegistry.remove("hr_attendance.attendance_menu");
}
registry.category("systray").add("fusion_clock.ClockSystray", {
Component: FusionClockFAB,
});
}, { sequence: 101 });

View File

@@ -1,6 +1,6 @@
/* ============================================================
Fusion Clock - Floating Action Button (FAB)
Bottom-left corner clock widget with ripple animation
Fusion Clock - Systray Icon & Dropdown Panel
Top-right navbar clock widget with pulse animation
Theme-aware: adapts to Odoo light / dark mode
============================================================ */
@@ -14,7 +14,6 @@
--fclk-fab-divider: #e5e7eb;
--fclk-fab-location-bg: rgba(16, 185, 129, 0.08);
--fclk-fab-error-bg: rgba(239, 68, 68, 0.06);
--fclk-fab-arrow-bg: #ffffff;
}
// ---- Dark-mode tokens ----
@@ -27,7 +26,6 @@ html.o_dark {
--fclk-fab-divider: #3a3d48;
--fclk-fab-location-bg: rgba(16, 185, 129, 0.1);
--fclk-fab-error-bg: rgba(239, 68, 68, 0.1);
--fclk-fab-arrow-bg: #1e2028;
}
// Static color palette
@@ -36,349 +34,214 @@ $fclk-blue: #3b82f6;
$fclk-green: #10B981;
$fclk-red: #ef4444;
// Gradient used on the FAB (teal-to-blue like the portal header)
$fclk-gradient: linear-gradient(135deg, $fclk-teal 0%, #2563eb 100%);
$fclk-gradient-active: linear-gradient(135deg, $fclk-green 0%, $fclk-teal 100%);
// ===========================================================
// Wrapper - anchored bottom-LEFT
// Systray Icon & Dropdown
// ===========================================================
.fclk-fab-wrapper {
position: fixed;
bottom: 24px;
left: 24px;
z-index: 1050;
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 12px;
pointer-events: none;
> * { pointer-events: auto; }
}
// ===========================================================
// FAB Button
// ===========================================================
.fclk-fab-btn {
.fclk-systray-btn {
position: relative;
width: 54px;
height: 54px;
border-radius: 50%;
background: none;
border: none;
background: $fclk-gradient;
color: #fff;
font-size: 21px;
padding: 0;
cursor: pointer;
box-shadow: 0 4px 20px rgba($fclk-teal, 0.35);
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
display: flex;
align-items: center;
justify-content: center;
outline: none;
overflow: visible;
width: 20px;
height: 20px;
}
&:hover {
transform: scale(1.1);
box-shadow: 0 6px 28px rgba($fclk-teal, 0.45);
.fclk-systray-icon {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
width: 20px;
height: 20px;
.fa-clock-o {
font-size: 16px;
position: relative;
z-index: 1;
transition: color 0.3s;
}
&:active {
transform: scale(0.93);
}
&--in {
.fa-clock-o {
color: var(--bs-success, var(--o-success, #198754));
}
// Clocked-in: green-teal gradient
&.fclk-fab-btn--active {
background: $fclk-gradient-active;
box-shadow: 0 4px 20px rgba($fclk-green, 0.4);
&::before,
&::after {
content: '';
position: absolute;
top: 50%;
left: 50%;
width: 14px;
height: 14px;
border-radius: 50%;
border: 1.5px solid var(--bs-success, var(--o-success, #198754));
transform: translate(-50%, -50%) scale(1);
animation: fclk-wave 2.4s infinite ease-out;
}
&:hover {
box-shadow: 0 6px 28px rgba($fclk-green, 0.5);
&::after {
animation-delay: 1.2s;
}
}
// Panel-open: muted
&.fclk-fab-btn--open {
background: #374151;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
color: #d1d5db;
}
.fclk-fab-icon {
position: relative;
z-index: 2;
transition: transform 0.3s ease;
line-height: 1;
}
&.fclk-fab-btn--open .fclk-fab-icon {
transform: rotate(90deg);
&--out {
.fa-clock-o {
color: var(--bs-danger, var(--o-danger, #dc3545));
}
}
}
// ---- Ripple rings radiating outward from the FAB ----
.fclk-fab-ripple-ring {
position: absolute;
top: 50%;
left: 50%;
width: 54px;
height: 54px;
border-radius: 50%;
border: 2px solid rgba($fclk-green, 0.5);
transform: translate(-50%, -50%) scale(1);
pointer-events: none;
z-index: 1;
&.fclk-fab-ripple-ring--1 {
animation: fclk-ripple-out 2.4s ease-out infinite;
}
&.fclk-fab-ripple-ring--2 {
animation: fclk-ripple-out 2.4s ease-out 0.8s infinite;
}
&.fclk-fab-ripple-ring--3 {
animation: fclk-ripple-out 2.4s ease-out 1.6s infinite;
}
}
@keyframes fclk-ripple-out {
@keyframes fclk-wave {
0% {
transform: translate(-50%, -50%) scale(1);
opacity: 0.55;
opacity: 0.7;
}
100% {
transform: translate(-50%, -50%) scale(2.6);
transform: translate(-50%, -50%) scale(2.8);
opacity: 0;
}
}
// ---- Mini timer badge ----
.fclk-fab-badge {
position: absolute;
top: -8px;
left: 50%;
transform: translateX(-50%);
background: #111827;
color: $fclk-green;
font-size: 9px;
font-weight: 700;
font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
padding: 2px 7px;
border-radius: 10px;
white-space: nowrap;
letter-spacing: 0.5px;
border: 1px solid rgba($fclk-green, 0.35);
pointer-events: none;
z-index: 3;
animation: fclk-badge-in 0.3s ease;
}
@keyframes fclk-badge-in {
from { opacity: 0; transform: translateX(-50%) translateY(4px); }
to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
// ===========================================================
// Expanded Panel
// ===========================================================
.fclk-fab-panel {
.fclk-systray-dropdown {
width: 280px;
background: var(--fclk-fab-panel-bg);
border: 1px solid var(--fclk-fab-panel-border);
border-radius: 16px;
padding: 18px;
box-shadow: var(--fclk-fab-panel-shadow);
animation: fclk-panel-slide-up 0.25s cubic-bezier(0.4, 0, 0.2, 1);
position: relative;
border-radius: 12px !important;
overflow: hidden;
box-shadow: var(--fclk-fab-panel-shadow) !important;
}
@keyframes fclk-panel-slide-up {
from { opacity: 0; transform: translateY(12px) scale(0.96); }
to { opacity: 1; transform: translateY(0) scale(1); }
}
// Arrow pointing down toward the FAB
.fclk-fab-panel-arrow {
position: absolute;
bottom: -6px;
left: 22px;
width: 12px;
height: 12px;
background: var(--fclk-fab-arrow-bg);
border-right: 1px solid var(--fclk-fab-panel-border);
border-bottom: 1px solid var(--fclk-fab-panel-border);
transform: rotate(45deg);
}
// ---- Header row ----
.fclk-fab-panel-header {
.fclk-systray-panel {
padding: 16px;
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 14px;
flex-direction: column;
gap: 12px;
background: var(--fclk-fab-panel-bg);
}
.fclk-fab-panel-title {
.fclk-systray-header {
display: flex;
align-items: center;
gap: 8px;
color: var(--fclk-fab-text);
font-size: 13px;
font-weight: 600;
letter-spacing: 0.3px;
}
.fclk-fab-status-dot {
width: 8px;
height: 8px;
border-radius: 50%;
background: #9ca3af;
.fclk-systray-header-dot {
font-size: 8px;
flex-shrink: 0;
&.active {
background: $fclk-green;
box-shadow: 0 0 6px rgba($fclk-green, 0.5);
}
}
.fclk-fab-open-link {
color: var(--fclk-fab-muted);
.fclk-systray-header-text {
font-weight: 600;
font-size: 13px;
text-decoration: none;
transition: color 0.2s;
&:hover { color: $fclk-blue; }
}
// ---- Location chip ----
.fclk-fab-location {
display: flex;
align-items: center;
gap: 6px;
font-size: 11px;
color: $fclk-green;
background: var(--fclk-fab-location-bg);
border-radius: 8px;
padding: 6px 10px;
margin-bottom: 12px;
.fa { font-size: 12px; }
}
// ---- Timer ----
.fclk-fab-timer {
text-align: center;
color: var(--fclk-fab-text);
font-size: 28px;
font-weight: 300;
font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
letter-spacing: 2px;
font-variant-numeric: tabular-nums;
margin-bottom: 14px;
line-height: 1;
}
// ---- Stats row ----
.fclk-fab-stats {
.fclk-systray-link {
margin-left: auto;
color: var(--fclk-fab-muted);
font-size: 12px;
&:hover { color: var(--fclk-fab-text); }
}
.fclk-systray-location {
font-size: 12px;
color: var(--fclk-fab-muted);
.fa { margin-right: 4px; }
}
.fclk-systray-timer {
font-size: 28px;
font-weight: 700;
text-align: center;
letter-spacing: 2px;
color: var(--fclk-fab-text);
font-variant-numeric: tabular-nums;
padding: 4px 0;
}
.fclk-systray-stats {
display: flex;
align-items: center;
justify-content: center;
gap: 16px;
margin-bottom: 14px;
padding: 8px;
background: var(--fclk-fab-location-bg);
border-radius: 8px;
}
.fclk-fab-stat {
text-align: center;
.fclk-fab-stat-val {
display: block;
color: var(--fclk-fab-text);
font-size: 16px;
font-weight: 700;
}
.fclk-fab-stat-lbl {
display: block;
color: var(--fclk-fab-muted);
font-size: 9px;
text-transform: uppercase;
letter-spacing: 0.6px;
margin-top: 2px;
}
.fclk-systray-stat {
display: flex;
flex-direction: column;
align-items: center;
gap: 2px;
}
.fclk-fab-stat-divider {
.fclk-systray-stat-val {
font-size: 16px;
font-weight: 700;
color: var(--fclk-fab-text);
}
.fclk-systray-stat-lbl {
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.5px;
color: var(--fclk-fab-muted);
}
.fclk-systray-stat-sep {
width: 1px;
height: 28px;
height: 24px;
background: var(--fclk-fab-divider);
}
// ---- Action button ----
.fclk-fab-action {
.fclk-systray-action {
width: 100%;
padding: 10px 16px;
border: none;
border-radius: 8px;
font-size: 14px;
font-weight: 600;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
width: 100%;
border: none;
border-radius: 12px;
padding: 11px 0;
font-size: 13px;
font-weight: 600;
cursor: pointer;
transition: all 0.2s ease;
letter-spacing: 0.3px;
transition: opacity 0.15s, transform 0.1s;
color: #fff;
.fa { font-size: 15px; }
&.fclk-fab-action--in {
background: $fclk-gradient;
color: #fff;
&:hover:not(:disabled) {
box-shadow: 0 4px 16px rgba($fclk-teal, 0.4);
}
&--in {
background: var(--bs-success, var(--o-success, #198754));
&:hover { opacity: 0.9; }
}
&.fclk-fab-action--out {
background: $fclk-red;
color: #fff;
&:hover:not(:disabled) {
box-shadow: 0 4px 16px rgba($fclk-red, 0.35);
}
&--out {
background: var(--bs-danger, var(--o-danger, #dc3545));
&:hover { opacity: 0.9; }
}
&:disabled {
opacity: 0.55;
cursor: not-allowed;
}
&:active { transform: scale(0.98); }
&:disabled { opacity: 0.6; cursor: not-allowed; }
}
// ---- Error ----
.fclk-fab-error {
display: flex;
align-items: flex-start;
gap: 6px;
color: $fclk-red;
font-size: 11px;
.fclk-systray-error {
padding: 8px 12px;
background: var(--fclk-fab-error-bg);
border-radius: 8px;
padding: 8px 10px;
margin-top: 10px;
animation: fclk-shake 0.35s ease;
line-height: 1.4;
.fa { font-size: 12px; margin-top: 1px; flex-shrink: 0; }
}
@keyframes fclk-shake {
0%, 100% { transform: translateX(0); }
25% { transform: translateX(-4px); }
75% { transform: translateX(4px); }
border-radius: 6px;
font-size: 12px;
color: var(--bs-warning, var(--o-warning, #856404));
.fa { margin-right: 4px; }
}
// ===========================================================
// FAB Dialog Overlays (reason, clock-out confirmation)
// Dialog Overlays (reason, clock-out confirmation)
// ===========================================================
.fclk-fab-dialog-overlay {
position: fixed;
@@ -593,7 +456,6 @@ $fclk-gradient-active: linear-gradient(135deg, $fclk-green 0%, $fclk-teal 100%);
}
}
// Summary card (used in clock-out confirmation)
.fclk-fab-dialog-summary {
background: var(--fclk-fab-location-bg, rgba(0, 0, 0, 0.04));
border: 1px solid var(--fclk-fab-panel-border);
@@ -678,7 +540,6 @@ html.o_dark {
.fa { margin-right: 4px; }
}
// Google Places dropdown z-index fix
.pac-container {
z-index: 2100 !important;
border-radius: 8px;
@@ -732,7 +593,6 @@ html.o_dark {
letter-spacing: 0.2px;
}
// -- Total (blue/slate) --
.fclk-dash-card--total {
background: linear-gradient(135deg, #eff6ff 0%, #e0e7ff 100%);
border: 1px solid #bfdbfe;
@@ -742,7 +602,6 @@ html.o_dark {
.fclk-dash-card-label { color: #3b82f6; }
}
// -- Present (green) --
.fclk-dash-card--present {
background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
border: 1px solid #a7f3d0;
@@ -752,7 +611,6 @@ html.o_dark {
.fclk-dash-card-label { color: #10b981; }
}
// -- Absent (red) --
.fclk-dash-card--absent {
background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
border: 1px solid #fecaca;
@@ -762,7 +620,6 @@ html.o_dark {
.fclk-dash-card-label { color: #ef4444; }
}
// -- Late (amber) --
.fclk-dash-card--late {
background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
border: 1px solid #fde68a;
@@ -772,7 +629,6 @@ html.o_dark {
.fclk-dash-card-label { color: #f59e0b; }
}
// -- Dark mode overrides --
html.o_dark {
.fclk-dash-card--total {
background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(99, 102, 241, 0.1) 100%);

View File

@@ -1,120 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<templates xml:space="preserve">
<t t-name="fusion_clock.ClockFAB">
<div t-if="state.isDisplayed" class="fclk-fab-wrapper">
<!-- Expanded Panel (above the button) -->
<div t-if="state.expanded" class="fclk-fab-panel">
<!-- Header -->
<div class="fclk-fab-panel-header">
<div class="fclk-fab-panel-title">
<span t-attf-class="fclk-fab-status-dot {{ state.isCheckedIn ? 'active' : '' }}"/>
<span t-if="state.isCheckedIn">Clocked In</span>
<span t-else="">Ready</span>
</div>
<a href="/my/clock" class="fclk-fab-open-link" target="_blank" title="Open Full Clock">
<i class="fa fa-external-link"/>
</a>
</div>
<!-- Location -->
<div t-if="state.isCheckedIn and state.locationName" class="fclk-fab-location">
<i class="fa fa-map-marker"/>
<span t-esc="state.locationName"/>
</div>
<!-- Timer -->
<div class="fclk-fab-timer" t-esc="state.timerDisplay"/>
<!-- Stats Row -->
<div class="fclk-fab-stats">
<div class="fclk-fab-stat">
<span class="fclk-fab-stat-val"><t t-esc="state.todayHours"/>h</span>
<span class="fclk-fab-stat-lbl">Today</span>
</div>
<div class="fclk-fab-stat-divider"/>
<div class="fclk-fab-stat">
<span class="fclk-fab-stat-val"><t t-esc="state.weekHours"/>h</span>
<span class="fclk-fab-stat-lbl">Week</span>
</div>
</div>
<!-- Clock Action Button -->
<button t-attf-class="fclk-fab-action {{ state.isCheckedIn ? 'fclk-fab-action--out' : 'fclk-fab-action--in' }}"
t-on-click="onClockAction"
t-att-disabled="state.loading">
<t t-if="state.loading">
<i class="fa fa-circle-o-notch fa-spin"/> Working...
</t>
<t t-elif="state.isCheckedIn">
<i class="fa fa-stop-circle-o"/> Clock Out
</t>
<t t-else="">
<i class="fa fa-play-circle-o"/> Clock In
</t>
<t t-name="fusion_clock.ClockSystray">
<t t-if="state.isDisplayed">
<!-- Systray Dropdown -->
<Dropdown position="'bottom-end'" state="dropdown"
beforeOpen.bind="_fetchStatus"
menuClass="'fclk-systray-dropdown p-0'">
<button class="fclk-systray-btn">
<span t-attf-class="fclk-systray-icon {{ state.isCheckedIn ? 'fclk-systray-icon--in' : 'fclk-systray-icon--out' }}">
<i class="fa fa-clock-o"/>
</span>
</button>
<t t-set-slot="content">
<div class="fclk-systray-panel">
<!-- Header -->
<div class="fclk-systray-header">
<i t-attf-class="fa fa-circle fclk-systray-header-dot {{ state.isCheckedIn ? 'text-success' : 'text-danger' }}"/>
<span t-if="state.isCheckedIn" class="fclk-systray-header-text">Clocked In</span>
<span t-else="" class="fclk-systray-header-text">Ready to Clock In</span>
<a href="/my/clock" class="fclk-systray-link" target="_blank" title="Open Full Clock">
<i class="fa fa-external-link"/>
</a>
</div>
<!-- Error -->
<div t-if="state.error" class="fclk-fab-error">
<i class="fa fa-exclamation-triangle"/>
<t t-esc="state.error"/>
</div>
<!-- Location -->
<div t-if="state.isCheckedIn and state.locationName" class="fclk-systray-location">
<i class="fa fa-map-marker"/> <t t-esc="state.locationName"/>
</div>
<!-- Arrow pointing to button -->
<div class="fclk-fab-panel-arrow"/>
</div>
<!-- Timer -->
<div class="fclk-systray-timer" t-esc="state.timerDisplay"/>
<!-- Floating Action Button -->
<button t-attf-class="fclk-fab-btn {{ state.isCheckedIn ? 'fclk-fab-btn--active' : '' }} {{ state.expanded ? 'fclk-fab-btn--open' : '' }}"
t-on-click="togglePanel">
<span t-if="state.isCheckedIn" class="fclk-fab-ripple-ring fclk-fab-ripple-ring--1"/>
<span t-if="state.isCheckedIn" class="fclk-fab-ripple-ring fclk-fab-ripple-ring--2"/>
<span t-if="state.isCheckedIn" class="fclk-fab-ripple-ring fclk-fab-ripple-ring--3"/>
<span class="fclk-fab-icon">
<i t-if="!state.expanded" class="fa fa-clock-o"/>
<i t-else="" class="fa fa-times"/>
</span>
<span t-if="state.isCheckedIn and !state.expanded" class="fclk-fab-badge">
<t t-esc="state.timerDisplay"/>
</span>
</button>
<!-- Stats -->
<div class="fclk-systray-stats">
<div class="fclk-systray-stat">
<span class="fclk-systray-stat-val"><t t-esc="state.todayHours"/>h</span>
<span class="fclk-systray-stat-lbl">Today</span>
</div>
<div class="fclk-systray-stat-sep"/>
<div class="fclk-systray-stat">
<span class="fclk-systray-stat-val"><t t-esc="state.weekHours"/>h</span>
<span class="fclk-systray-stat-lbl">This Week</span>
</div>
</div>
<!-- Missed Clock-Out Reason Dialog -->
<!-- Clock Action -->
<button t-attf-class="fclk-systray-action {{ state.isCheckedIn ? 'fclk-systray-action--out' : 'fclk-systray-action--in' }}"
t-on-click="onClockAction"
t-att-disabled="state.loading">
<t t-if="state.loading">
<i class="fa fa-circle-o-notch fa-spin"/> Working...
</t>
<t t-elif="state.isCheckedIn">
<i class="fa fa-stop-circle-o"/> Clock Out
</t>
<t t-else="">
<i class="fa fa-play-circle-o"/> Clock In
</t>
</button>
<!-- Error -->
<div t-if="state.error" class="fclk-systray-error">
<i class="fa fa-exclamation-triangle"/> <t t-esc="state.error"/>
</div>
</div>
</t>
</Dropdown>
<!-- Missed Clock-Out Reason Dialog (outside dropdown) -->
<div t-if="state.showReasonDialog" class="fclk-fab-dialog-overlay">
<div class="fclk-fab-dialog-backdrop" t-on-click="cancelReason"/>
<div class="fclk-fab-dialog">
<div class="fclk-fab-dialog-header fclk-fab-dialog-header--warning">
<div class="fclk-fab-dialog-icon">
<i class="fa fa-exclamation-triangle"/>
</div>
<div class="fclk-fab-dialog-icon"><i class="fa fa-exclamation-triangle"/></div>
<h4 class="fclk-fab-dialog-title">Missed Clock-Out</h4>
<p class="fclk-fab-dialog-subtitle">You didn't clock out on your last shift. Please provide details before continuing.</p>
</div>
<div class="fclk-fab-dialog-body">
<div class="fclk-fab-dialog-field">
<label class="fclk-fab-dialog-label">
<i class="fa fa-comment-o"/> Reason <span class="fclk-fab-dialog-required">*</span>
</label>
<textarea class="fclk-fab-dialog-input" rows="3"
placeholder="Please explain why you didn't clock out..."
t-on-input="onReasonTextInput"
t-att-value="state.reasonText"/>
<label class="fclk-fab-dialog-label"><i class="fa fa-comment-o"/> Reason <span class="fclk-fab-dialog-required">*</span></label>
<textarea class="fclk-fab-dialog-input" rows="3" placeholder="Please explain why you didn't clock out..." t-on-input="onReasonTextInput" t-att-value="state.reasonText"/>
</div>
<div class="fclk-fab-dialog-field">
<label class="fclk-fab-dialog-label">
<i class="fa fa-clock-o"/> Departure Time
</label>
<input type="datetime-local" class="fclk-fab-dialog-input"
t-on-input="onReasonTimeInput"
t-att-value="state.reasonTime"/>
<label class="fclk-fab-dialog-label"><i class="fa fa-clock-o"/> Departure Time</label>
<input type="datetime-local" class="fclk-fab-dialog-input" t-on-input="onReasonTimeInput" t-att-value="state.reasonTime"/>
<span class="fclk-fab-dialog-hint">When did you actually leave? (optional)</span>
</div>
</div>
<div class="fclk-fab-dialog-footer">
<button class="fclk-fab-dialog-btn fclk-fab-dialog-btn--cancel" t-on-click="cancelReason">Cancel</button>
<button class="fclk-fab-dialog-btn fclk-fab-dialog-btn--submit" t-on-click="submitReason"
t-att-disabled="state.reasonSubmitting">
<button class="fclk-fab-dialog-btn fclk-fab-dialog-btn--submit" t-on-click="submitReason" t-att-disabled="state.reasonSubmitting">
<t t-if="state.reasonSubmitting"><i class="fa fa-circle-o-notch fa-spin"/> Submitting...</t>
<t t-else=""><i class="fa fa-check"/> Submit Reason</t>
</button>
@@ -122,14 +98,12 @@
</div>
</div>
<!-- Clock-Out Confirmation Dialog -->
<!-- Clock-Out Confirmation Dialog (outside dropdown) -->
<div t-if="state.showClockoutConfirm" class="fclk-fab-dialog-overlay">
<div class="fclk-fab-dialog-backdrop" t-on-click="cancelClockOut"/>
<div class="fclk-fab-dialog fclk-fab-dialog--compact">
<div class="fclk-fab-dialog-header fclk-fab-dialog-header--danger">
<div class="fclk-fab-dialog-icon">
<i class="fa fa-stop-circle"/>
</div>
<div class="fclk-fab-dialog-icon"><i class="fa fa-stop-circle"/></div>
<h4 class="fclk-fab-dialog-title">Clock Out?</h4>
<p class="fclk-fab-dialog-subtitle">Are you sure you want to end your current shift?</p>
</div>
@@ -153,7 +127,7 @@
</div>
</div>
</div>
</div>
</t>
</t>
</templates>