feat(fusion_clock): redesign dashboard — layered, role-aware, gradient cards (dark+light)
- Rework /fusion_clock/dashboard_data into a personal block (everyone) plus a team block (team lead = direct reports, manager = org-wide). A regular employee's payload never contains another employee's data. - New OWL stacked layout: gradient KPI cards (Today/Week/OT/Streak), Today's Shift, Recent Activity, Upcoming Leave, Recent Penalties; team band adds Present/Absent/Late/Pending, roster, and Needs Attention. - Dark/light via compile-time $o-webclient-color-scheme branching; drop the old runtime html.o_dark dashboard block. - Open the Dashboard menu to group_fusion_clock_user (lead/manager imply). - Add HttpCase permission/no-leak tests. Bump 3.13.2 -> 3.14.0. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -13,16 +13,11 @@ export class FusionClockDashboard extends Component {
|
||||
this.action = useService("action");
|
||||
this.state = useState({
|
||||
loading: true,
|
||||
clocked_in: [],
|
||||
total_employees: 0,
|
||||
present_count: 0,
|
||||
absent_count: 0,
|
||||
late_count: 0,
|
||||
pending_reasons: 0,
|
||||
pending_corrections: 0,
|
||||
error: "",
|
||||
role: "employee",
|
||||
personal: {},
|
||||
team: null,
|
||||
});
|
||||
|
||||
onWillStart(async () => {
|
||||
await this._fetchData();
|
||||
});
|
||||
@@ -30,12 +25,15 @@ export class FusionClockDashboard extends Component {
|
||||
|
||||
async _fetchData() {
|
||||
this.state.loading = true;
|
||||
this.state.error = "";
|
||||
try {
|
||||
const data = await rpc("/fusion_clock/dashboard_data", {});
|
||||
if (data.error) {
|
||||
this.state.error = data.error;
|
||||
} else {
|
||||
Object.assign(this.state, data);
|
||||
this.state.role = data.role;
|
||||
this.state.personal = data.personal;
|
||||
this.state.team = data.team;
|
||||
}
|
||||
} catch (e) {
|
||||
this.state.error = "Failed to load dashboard data.";
|
||||
@@ -43,25 +41,47 @@ export class FusionClockDashboard extends Component {
|
||||
this.state.loading = false;
|
||||
}
|
||||
|
||||
async onRefresh() {
|
||||
await this._fetchData();
|
||||
// ---- display helpers ----
|
||||
get greeting() {
|
||||
const h = new Date().getHours();
|
||||
if (h < 12) return "Good morning";
|
||||
if (h < 17) return "Good afternoon";
|
||||
return "Good evening";
|
||||
}
|
||||
get todayLabel() {
|
||||
return new Date().toLocaleDateString(undefined, {
|
||||
weekday: "long", month: "long", day: "numeric",
|
||||
});
|
||||
}
|
||||
sourceLabel(source) {
|
||||
return { schedule: "Posted schedule", shift: "Recurring shift", none: "—" }[source] || "—";
|
||||
}
|
||||
initials(name) {
|
||||
return (name || "")
|
||||
.split(" ").filter(Boolean).slice(0, 2)
|
||||
.map((p) => p[0].toUpperCase()).join("");
|
||||
}
|
||||
fmtDate(s) {
|
||||
if (!s) return "";
|
||||
const d = new Date(s.replace(" ", "T") + "Z");
|
||||
return d.toLocaleDateString(undefined, { month: "short", day: "numeric" });
|
||||
}
|
||||
fmtTime(s) {
|
||||
if (!s) return "";
|
||||
const d = new Date(s.replace(" ", "T") + "Z");
|
||||
return d.toLocaleTimeString(undefined, { hour: "numeric", minute: "2-digit" });
|
||||
}
|
||||
|
||||
onViewAttendances() {
|
||||
this.action.doAction("hr_attendance.hr_attendance_action");
|
||||
}
|
||||
|
||||
onViewCorrections() {
|
||||
this.action.doAction("fusion_clock.action_fusion_clock_correction");
|
||||
}
|
||||
|
||||
onViewActivityLogs() {
|
||||
this.action.doAction("fusion_clock.action_fusion_clock_activity_log");
|
||||
}
|
||||
|
||||
onViewPenalties() {
|
||||
this.action.doAction("fusion_clock.action_fusion_clock_penalty");
|
||||
}
|
||||
// ---- actions ----
|
||||
onRefresh() { return this._fetchData(); }
|
||||
onOpenClock() { this.action.doAction({ type: "ir.actions.act_url", url: "/my/clock", target: "self" }); }
|
||||
onViewTimesheets() { this.action.doAction({ type: "ir.actions.act_url", url: "/my/clock/timesheets", target: "self" }); }
|
||||
onViewAttendances() { this.action.doAction("hr_attendance.hr_attendance_action"); }
|
||||
onViewCorrections() { this.action.doAction("fusion_clock.action_fusion_clock_correction"); }
|
||||
onViewActivityLogs() { this.action.doAction("fusion_clock.action_fusion_clock_activity_log"); }
|
||||
onViewPenalties() { this.action.doAction("fusion_clock.action_fusion_clock_penalty"); }
|
||||
onViewShiftPlanner() { this.action.doAction("fusion_clock.action_fusion_clock_shift_planner"); }
|
||||
onViewReports() { this.action.doAction("fusion_clock.action_fusion_clock_report"); }
|
||||
}
|
||||
|
||||
registry.category("actions").add("fusion_clock.Dashboard", FusionClockDashboard);
|
||||
|
||||
@@ -553,116 +553,148 @@ html.o_dark {
|
||||
}
|
||||
|
||||
// ===========================================================
|
||||
// Dashboard Summary Cards
|
||||
// Dashboard — layered, role-aware (gradient KPIs + stacked layout)
|
||||
// Dark/light resolved at COMPILE TIME via $o-webclient-color-scheme.
|
||||
// Gradient KPI cards are identical in both modes (white on gradient);
|
||||
// only page / section-card / text tokens swap.
|
||||
// ===========================================================
|
||||
.fclk-dash-card {
|
||||
position: relative;
|
||||
border-radius: 12px;
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
||||
$o-webclient-color-scheme: bright !default;
|
||||
|
||||
&:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
|
||||
$_fclk-dash-page-hex: #f3f4f6;
|
||||
$_fclk-dash-card-hex: #ffffff;
|
||||
$_fclk-dash-border-hex: #e5e7eb;
|
||||
$_fclk-dash-text-hex: #1f2937;
|
||||
$_fclk-dash-muted-hex: #6b7280;
|
||||
$_fclk-dash-row-hex: #f0f0f2;
|
||||
|
||||
@if $o-webclient-color-scheme == dark {
|
||||
$_fclk-dash-page-hex: #0f1117 !global;
|
||||
$_fclk-dash-card-hex: #1a1d23 !global;
|
||||
$_fclk-dash-border-hex: #2a2d35 !global;
|
||||
$_fclk-dash-text-hex: #f1f1f4 !global;
|
||||
$_fclk-dash-muted-hex: #9ca3af !global;
|
||||
$_fclk-dash-row-hex: #2a2d35 !global;
|
||||
}
|
||||
|
||||
$fclk-dash-page: var(--fclk-dash-page, #{$_fclk-dash-page-hex});
|
||||
$fclk-dash-card: var(--fclk-dash-card, #{$_fclk-dash-card-hex});
|
||||
$fclk-dash-border: var(--fclk-dash-border, #{$_fclk-dash-border-hex});
|
||||
$fclk-dash-text: var(--fclk-dash-text, #{$_fclk-dash-text-hex});
|
||||
$fclk-dash-muted: var(--fclk-dash-muted, #{$_fclk-dash-muted-hex});
|
||||
$fclk-dash-row: var(--fclk-dash-row, #{$_fclk-dash-row-hex});
|
||||
|
||||
$fclk-g-today: linear-gradient(135deg, #10b981 0%, #0ea5a4 100%);
|
||||
$fclk-g-week: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
|
||||
$fclk-g-ot: linear-gradient(135deg, #8b5cf6 0%, #d946ef 100%);
|
||||
$fclk-g-streak: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
|
||||
$fclk-g-present: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
|
||||
$fclk-g-absent: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
|
||||
$fclk-g-late: linear-gradient(135deg, #eab308 0%, #f59e0b 100%);
|
||||
$fclk-g-pending: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
|
||||
|
||||
.fclk-dash {
|
||||
background: $fclk-dash-page;
|
||||
min-height: 100%;
|
||||
|
||||
.fclk-dash-wrap { max-width: 1200px; margin: 0 auto; padding: 20px; }
|
||||
|
||||
.fclk-dash-header {
|
||||
display: flex; justify-content: space-between; align-items: flex-start;
|
||||
flex-wrap: wrap; gap: 12px; margin-bottom: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.fclk-dash-card-icon {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border-radius: 12px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 20px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.fclk-dash-card-value {
|
||||
font-size: 32px;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.fclk-dash-card-label {
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.2px;
|
||||
}
|
||||
|
||||
.fclk-dash-card--total {
|
||||
background: linear-gradient(135deg, #eff6ff 0%, #e0e7ff 100%);
|
||||
border: 1px solid #bfdbfe;
|
||||
|
||||
.fclk-dash-card-icon { background: rgba(59, 130, 246, 0.15); color: #2563eb; }
|
||||
.fclk-dash-card-value { color: #1e3a5f; }
|
||||
.fclk-dash-card-label { color: #3b82f6; }
|
||||
}
|
||||
|
||||
.fclk-dash-card--present {
|
||||
background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
|
||||
border: 1px solid #a7f3d0;
|
||||
|
||||
.fclk-dash-card-icon { background: rgba(16, 185, 129, 0.15); color: #059669; }
|
||||
.fclk-dash-card-value { color: #064e3b; }
|
||||
.fclk-dash-card-label { color: #10b981; }
|
||||
}
|
||||
|
||||
.fclk-dash-card--absent {
|
||||
background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
|
||||
border: 1px solid #fecaca;
|
||||
|
||||
.fclk-dash-card-icon { background: rgba(239, 68, 68, 0.12); color: #dc2626; }
|
||||
.fclk-dash-card-value { color: #7f1d1d; }
|
||||
.fclk-dash-card-label { color: #ef4444; }
|
||||
}
|
||||
|
||||
.fclk-dash-card--late {
|
||||
background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
|
||||
border: 1px solid #fde68a;
|
||||
|
||||
.fclk-dash-card-icon { background: rgba(245, 158, 11, 0.15); color: #d97706; }
|
||||
.fclk-dash-card-value { color: #78350f; }
|
||||
.fclk-dash-card-label { color: #f59e0b; }
|
||||
}
|
||||
|
||||
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%);
|
||||
border-color: rgba(59, 130, 246, 0.25);
|
||||
.fclk-dash-card-value { color: #93c5fd; }
|
||||
.fclk-dash-card-label { color: #60a5fa; }
|
||||
.fclk-dash-card-icon { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
|
||||
.fclk-dash-hello { font-size: 22px; font-weight: 800; color: $fclk-dash-text; }
|
||||
.fclk-dash-date { font-size: 13px; color: $fclk-dash-muted; margin-top: 2px; }
|
||||
.fclk-dash-headctl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
|
||||
.fclk-dash-statusbadge {
|
||||
border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 700;
|
||||
background: rgba(16, 185, 129, .15); color: #10b981;
|
||||
border: 1px solid rgba(16, 185, 129, .35);
|
||||
&.is-out {
|
||||
background: rgba(107, 114, 128, .15); color: $fclk-dash-muted;
|
||||
border-color: rgba(107, 114, 128, .3);
|
||||
}
|
||||
}
|
||||
.fclk-dash-btn-primary {
|
||||
background: $fclk-g-today; color: #fff; border: none; border-radius: 10px;
|
||||
padding: 8px 16px; font-weight: 700; font-size: 13px; cursor: pointer;
|
||||
}
|
||||
.fclk-dash-btn-ghost {
|
||||
background: transparent; color: $fclk-dash-muted; border: 1px solid $fclk-dash-border;
|
||||
border-radius: 10px; padding: 8px 12px; font-size: 13px; cursor: pointer;
|
||||
}
|
||||
|
||||
.fclk-dash-card--present {
|
||||
background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(52, 211, 153, 0.08) 100%);
|
||||
border-color: rgba(16, 185, 129, 0.25);
|
||||
.fclk-dash-card-value { color: #6ee7b7; }
|
||||
.fclk-dash-card-label { color: #34d399; }
|
||||
.fclk-dash-card-icon { background: rgba(16, 185, 129, 0.2); color: #34d399; }
|
||||
.fclk-kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
|
||||
.fclk-kpi {
|
||||
border-radius: 16px; padding: 16px; color: #fff;
|
||||
box-shadow: 0 6px 20px rgba(0, 0, 0, .10);
|
||||
}
|
||||
.fclk-kpi-ic {
|
||||
width: 34px; height: 34px; border-radius: 10px; background: rgba(255, 255, 255, .22);
|
||||
display: flex; align-items: center; justify-content: center; font-size: 16px; margin-bottom: 12px;
|
||||
}
|
||||
.fclk-kpi-val { font-size: 26px; font-weight: 800; line-height: 1; }
|
||||
.fclk-kpi-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; opacity: .85; margin-top: 6px; }
|
||||
|
||||
.fclk-kpi--today { background: $fclk-g-today; }
|
||||
.fclk-kpi--week { background: $fclk-g-week; }
|
||||
.fclk-kpi--ot { background: $fclk-g-ot; }
|
||||
.fclk-kpi--streak { background: $fclk-g-streak; }
|
||||
.fclk-kpi--present { background: $fclk-g-present; }
|
||||
.fclk-kpi--absent { background: $fclk-g-absent; }
|
||||
.fclk-kpi--late { background: $fclk-g-late; }
|
||||
.fclk-kpi--pending { background: $fclk-g-pending; }
|
||||
|
||||
.fclk-dash-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
|
||||
.fclk-dash-card {
|
||||
background: $fclk-dash-card; border: 1px solid $fclk-dash-border;
|
||||
border-radius: 14px; padding: 16px;
|
||||
}
|
||||
.fclk-dash-card h4 {
|
||||
margin: 0 0 12px; font-size: 14px; color: $fclk-dash-text;
|
||||
display: flex; justify-content: space-between; align-items: center;
|
||||
}
|
||||
.fclk-dash-line {
|
||||
display: flex; justify-content: space-between; align-items: center;
|
||||
font-size: 13px; padding: 7px 0; border-top: 1px solid $fclk-dash-row; color: $fclk-dash-text;
|
||||
&:first-of-type { border-top: none; }
|
||||
}
|
||||
.fclk-dash-muted { color: $fclk-dash-muted; }
|
||||
.fclk-pin { color: #10b981; font-weight: 700; }
|
||||
.fclk-pyel { color: #d97706; font-weight: 700; }
|
||||
.fclk-pred { color: #dc2626; font-weight: 700; }
|
||||
.fclk-dash-empty { text-align: center; color: $fclk-dash-muted; padding: 18px 0; font-size: 13px; }
|
||||
|
||||
.fclk-dash-divider {
|
||||
display: flex; align-items: center; gap: 12px; margin: 22px 0 14px;
|
||||
span {
|
||||
font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px;
|
||||
color: $fclk-dash-muted; font-weight: 700; white-space: nowrap;
|
||||
}
|
||||
&::before, &::after { content: ""; flex: 1; height: 1px; background: $fclk-dash-border; }
|
||||
}
|
||||
|
||||
.fclk-dash-card--absent {
|
||||
background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(248, 113, 113, 0.08) 100%);
|
||||
border-color: rgba(239, 68, 68, 0.25);
|
||||
.fclk-dash-card-value { color: #fca5a5; }
|
||||
.fclk-dash-card-label { color: #f87171; }
|
||||
.fclk-dash-card-icon { background: rgba(239, 68, 68, 0.18); color: #f87171; }
|
||||
.fclk-dash-av {
|
||||
display: inline-flex; width: 26px; height: 26px; border-radius: 50%;
|
||||
background: $fclk-dash-row; color: $fclk-dash-text; font-size: 11px; font-weight: 700;
|
||||
align-items: center; justify-content: center; margin-right: 8px;
|
||||
}
|
||||
.fclk-dash-late-badge {
|
||||
background: rgba(217, 119, 6, .15); color: #d97706; border-radius: 999px;
|
||||
padding: 2px 8px; font-size: 11px; font-weight: 700; margin-left: 6px;
|
||||
}
|
||||
|
||||
.fclk-dash-card--late {
|
||||
background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(251, 191, 36, 0.08) 100%);
|
||||
border-color: rgba(245, 158, 11, 0.25);
|
||||
.fclk-dash-card-value { color: #fcd34d; }
|
||||
.fclk-dash-card-label { color: #fbbf24; }
|
||||
.fclk-dash-card-icon { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
|
||||
.fclk-dash-actions { display: flex; flex-wrap: wrap; gap: 10px; }
|
||||
.fclk-dash-act {
|
||||
background: $fclk-dash-page; border: 1px solid $fclk-dash-border; border-radius: 10px;
|
||||
padding: 9px 14px; font-size: 13px; color: $fclk-dash-text; cursor: pointer;
|
||||
&:hover { border-color: $fclk-blue; }
|
||||
}
|
||||
|
||||
.fclk-dash-card:hover {
|
||||
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
|
||||
@media (max-width: 992px) {
|
||||
.fclk-kpi-row { grid-template-columns: repeat(2, 1fr); }
|
||||
.fclk-dash-2col { grid-template-columns: 1fr; }
|
||||
}
|
||||
@media (max-width: 576px) {
|
||||
.fclk-kpi-row { grid-template-columns: 1fr; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,148 +2,198 @@
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="fusion_clock.Dashboard">
|
||||
<div class="o_action">
|
||||
<div class="container-fluid py-3">
|
||||
|
||||
<!-- Header -->
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h2 class="mb-0">Fusion Clock Dashboard</h2>
|
||||
<button class="btn btn-outline-primary" t-on-click="onRefresh">
|
||||
<i class="fa fa-refresh"/> Refresh
|
||||
</button>
|
||||
</div>
|
||||
<div class="o_action fclk-dash">
|
||||
<div class="fclk-dash-wrap">
|
||||
|
||||
<t t-if="state.loading">
|
||||
<div class="text-center py-5">
|
||||
<div class="fclk-dash-empty">
|
||||
<i class="fa fa-spinner fa-spin fa-2x"/>
|
||||
<p class="mt-2">Loading dashboard...</p>
|
||||
<p class="mt-2">Loading dashboard…</p>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
<t t-if="state.error">
|
||||
<div class="alert alert-danger">
|
||||
<t t-esc="state.error"/>
|
||||
</div>
|
||||
<div class="fclk-dash-card"><t t-esc="state.error"/></div>
|
||||
</t>
|
||||
|
||||
<t t-if="!state.loading and !state.error">
|
||||
<!-- Summary Cards -->
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-3 mb-3">
|
||||
<div class="fclk-dash-card fclk-dash-card--total">
|
||||
<div class="fclk-dash-card-icon">
|
||||
<i class="fa fa-users"/>
|
||||
</div>
|
||||
<div class="fclk-dash-card-value"><t t-esc="state.total_employees"/></div>
|
||||
<div class="fclk-dash-card-label">Total Employees</div>
|
||||
</div>
|
||||
<!-- HEADER -->
|
||||
<div class="fclk-dash-header">
|
||||
<div>
|
||||
<div class="fclk-dash-hello"><t t-esc="greeting"/>, <t t-esc="state.personal.employee_name"/> 👋</div>
|
||||
<div class="fclk-dash-date"><t t-esc="todayLabel"/></div>
|
||||
</div>
|
||||
<div class="col-md-3 mb-3">
|
||||
<div class="fclk-dash-card fclk-dash-card--present">
|
||||
<div class="fclk-dash-card-icon">
|
||||
<i class="fa fa-check-circle"/>
|
||||
</div>
|
||||
<div class="fclk-dash-card-value"><t t-esc="state.present_count"/></div>
|
||||
<div class="fclk-dash-card-label">Present Today</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 mb-3">
|
||||
<div class="fclk-dash-card fclk-dash-card--absent">
|
||||
<div class="fclk-dash-card-icon">
|
||||
<i class="fa fa-times-circle"/>
|
||||
</div>
|
||||
<div class="fclk-dash-card-value"><t t-esc="state.absent_count"/></div>
|
||||
<div class="fclk-dash-card-label">Absent Today</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 mb-3">
|
||||
<div class="fclk-dash-card fclk-dash-card--late">
|
||||
<div class="fclk-dash-card-icon">
|
||||
<i class="fa fa-clock-o"/>
|
||||
</div>
|
||||
<div class="fclk-dash-card-value"><t t-esc="state.late_count"/></div>
|
||||
<div class="fclk-dash-card-label">Late Today</div>
|
||||
</div>
|
||||
<div class="fclk-dash-headctl">
|
||||
<span class="fclk-dash-statusbadge" t-att-class="{'is-out': !state.personal.is_checked_in}">
|
||||
<t t-if="state.personal.is_checked_in">● Clocked in</t>
|
||||
<t t-else="">○ Not clocked in</t>
|
||||
</span>
|
||||
<button class="fclk-dash-btn-primary" t-on-click="onOpenClock">Open My Clock</button>
|
||||
<button class="fclk-dash-btn-ghost" t-on-click="onRefresh"><i class="fa fa-refresh"/></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<!-- Currently Clocked In -->
|
||||
<div class="col-md-8 mb-4">
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<h5 class="mb-0">Currently Clocked In</h5>
|
||||
<span class="badge bg-success"><t t-esc="state.clocked_in.length"/> active</span>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<t t-if="state.clocked_in.length === 0">
|
||||
<div class="text-center py-4 text-muted">
|
||||
No employees currently clocked in
|
||||
</div>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<table class="table table-sm mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Employee</th>
|
||||
<th>Clock-In</th>
|
||||
<th>Location</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<t t-foreach="state.clocked_in" t-as="emp" t-key="emp_index">
|
||||
<tr>
|
||||
<td><t t-esc="emp.employee"/></td>
|
||||
<td><t t-esc="emp.check_in"/></td>
|
||||
<td><t t-esc="emp.location"/></td>
|
||||
</tr>
|
||||
</t>
|
||||
</tbody>
|
||||
</table>
|
||||
</t>
|
||||
<!-- PERSONAL KPIs -->
|
||||
<div class="fclk-kpi-row">
|
||||
<div class="fclk-kpi fclk-kpi--today">
|
||||
<div class="fclk-kpi-ic">⏱</div>
|
||||
<div class="fclk-kpi-val"><t t-esc="state.personal.today_hours"/>h</div>
|
||||
<div class="fclk-kpi-lbl">Today</div>
|
||||
</div>
|
||||
<div class="fclk-kpi fclk-kpi--week">
|
||||
<div class="fclk-kpi-ic">📅</div>
|
||||
<div class="fclk-kpi-val"><t t-esc="state.personal.week_hours"/>h</div>
|
||||
<div class="fclk-kpi-lbl">This Week</div>
|
||||
</div>
|
||||
<div class="fclk-kpi fclk-kpi--ot">
|
||||
<div class="fclk-kpi-ic">⚡</div>
|
||||
<div class="fclk-kpi-val"><t t-esc="state.personal.overtime_week"/>h</div>
|
||||
<div class="fclk-kpi-lbl">OT This Week</div>
|
||||
</div>
|
||||
<div class="fclk-kpi fclk-kpi--streak">
|
||||
<div class="fclk-kpi-ic">🔥</div>
|
||||
<div class="fclk-kpi-val"><t t-esc="state.personal.ontime_streak"/></div>
|
||||
<div class="fclk-kpi-lbl">On-time Streak</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- PERSONAL DETAIL -->
|
||||
<div class="fclk-dash-2col">
|
||||
<div class="fclk-dash-card">
|
||||
<h4>Today's Shift</h4>
|
||||
<div class="fclk-dash-line">
|
||||
<span>Scheduled</span>
|
||||
<span class="fclk-dash-muted">
|
||||
<t t-if="state.personal.shift.label"><t t-esc="state.personal.shift.label"/> (<t t-esc="state.personal.shift.hours"/>h)</t>
|
||||
<t t-else="">Not scheduled today</t>
|
||||
</span>
|
||||
</div>
|
||||
<div class="fclk-dash-line">
|
||||
<span>Status</span>
|
||||
<span t-att-class="state.personal.is_checked_in ? 'fclk-pin' : 'fclk-dash-muted'"><t t-esc="state.personal.shift.status_note"/></span>
|
||||
</div>
|
||||
<div class="fclk-dash-line">
|
||||
<span>Source</span>
|
||||
<span class="fclk-dash-muted"><t t-esc="sourceLabel(state.personal.shift.source)"/></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="fclk-dash-card">
|
||||
<h4>My Recent Activity</h4>
|
||||
<t t-if="state.personal.recent_activity.length === 0">
|
||||
<div class="fclk-dash-empty">No recent activity</div>
|
||||
</t>
|
||||
<t t-foreach="state.personal.recent_activity" t-as="a" t-key="a_index">
|
||||
<div class="fclk-dash-line">
|
||||
<span><t t-esc="fmtDate(a.check_in)"/></span>
|
||||
<span class="fclk-dash-muted">
|
||||
<t t-esc="a.worked_hours"/>h<t t-if="a.overtime_hours > 0"> · +<t t-esc="a.overtime_hours"/> OT</t>
|
||||
</span>
|
||||
</div>
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fclk-dash-2col">
|
||||
<div class="fclk-dash-card">
|
||||
<h4>Upcoming Leave</h4>
|
||||
<t t-if="state.personal.leaves.length === 0">
|
||||
<div class="fclk-dash-empty">No upcoming leave</div>
|
||||
</t>
|
||||
<t t-foreach="state.personal.leaves" t-as="lv" t-key="lv_index">
|
||||
<div class="fclk-dash-line"><span><t t-esc="lv.label"/></span><span class="fclk-dash-muted"><t t-esc="lv.state"/></span></div>
|
||||
</t>
|
||||
</div>
|
||||
<div class="fclk-dash-card">
|
||||
<h4>Recent Penalties</h4>
|
||||
<t t-if="state.personal.penalties.length === 0">
|
||||
<div class="fclk-dash-empty">None this month 🎉</div>
|
||||
</t>
|
||||
<t t-foreach="state.personal.penalties" t-as="p" t-key="p_index">
|
||||
<div class="fclk-dash-line"><span><t t-esc="p.type"/> · <t t-esc="p.date"/></span><span class="fclk-pyel">−<t t-esc="p.minutes"/> min</span></div>
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- TEAM / ORG BAND -->
|
||||
<t t-if="state.team">
|
||||
<div class="fclk-dash-divider"><span>Team / Org</span></div>
|
||||
|
||||
<div class="fclk-kpi-row">
|
||||
<div class="fclk-kpi fclk-kpi--present">
|
||||
<div class="fclk-kpi-ic">✅</div>
|
||||
<div class="fclk-kpi-val"><t t-esc="state.team.present_count"/></div>
|
||||
<div class="fclk-kpi-lbl">Present now</div>
|
||||
</div>
|
||||
<div class="fclk-kpi fclk-kpi--absent">
|
||||
<div class="fclk-kpi-ic">🚫</div>
|
||||
<div class="fclk-kpi-val"><t t-esc="state.team.absent_count"/></div>
|
||||
<div class="fclk-kpi-lbl">Absent today</div>
|
||||
</div>
|
||||
<div class="fclk-kpi fclk-kpi--late">
|
||||
<div class="fclk-kpi-ic">⏰</div>
|
||||
<div class="fclk-kpi-val"><t t-esc="state.team.late_count"/></div>
|
||||
<div class="fclk-kpi-lbl">Late today</div>
|
||||
</div>
|
||||
<div class="fclk-kpi fclk-kpi--pending">
|
||||
<div class="fclk-kpi-ic">📨</div>
|
||||
<div class="fclk-kpi-val"><t t-esc="state.team.pending_approvals"/></div>
|
||||
<div class="fclk-kpi-lbl">Pending approvals</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Alerts Panel -->
|
||||
<div class="col-md-4 mb-4">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="mb-0">Alerts</h5>
|
||||
<div class="fclk-dash-2col">
|
||||
<div class="fclk-dash-card">
|
||||
<h4>Currently Clocked In <span class="fclk-dash-muted"><t t-esc="state.team.present_count"/> of <t t-esc="state.team.total_employees"/></span></h4>
|
||||
<t t-if="state.team.clocked_in.length === 0">
|
||||
<div class="fclk-dash-empty">No one is clocked in right now</div>
|
||||
</t>
|
||||
<t t-foreach="state.team.clocked_in" t-as="emp" t-key="emp_index">
|
||||
<div class="fclk-dash-line">
|
||||
<span><span class="fclk-dash-av"><t t-esc="initials(emp.employee)"/></span><t t-esc="emp.employee"/>
|
||||
<span t-if="emp.late" class="fclk-dash-late-badge">late</span>
|
||||
</span>
|
||||
<span class="fclk-dash-muted"><t t-esc="fmtTime(emp.check_in)"/> · <t t-esc="emp.location"/></span>
|
||||
</div>
|
||||
</t>
|
||||
</div>
|
||||
<div class="fclk-dash-card">
|
||||
<h4>Needs Attention</h4>
|
||||
<div class="fclk-dash-line" t-on-click="onViewActivityLogs" style="cursor:pointer;">
|
||||
<span class="fclk-pred"><t t-esc="state.team.absent_count"/> absent (no leave)</span>
|
||||
<span class="fclk-dash-muted">review →</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3 cursor-pointer"
|
||||
t-on-click="onViewActivityLogs">
|
||||
<span><i class="fa fa-exclamation-circle text-warning me-2"/>Pending Reasons</span>
|
||||
<span class="badge bg-warning"><t t-esc="state.pending_reasons"/></span>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between align-items-center mb-3 cursor-pointer"
|
||||
t-on-click="onViewCorrections">
|
||||
<span><i class="fa fa-edit text-info me-2"/>Pending Corrections</span>
|
||||
<span class="badge bg-info"><t t-esc="state.pending_corrections"/></span>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between align-items-center cursor-pointer"
|
||||
t-on-click="onViewPenalties">
|
||||
<span><i class="fa fa-clock-o text-danger me-2"/>Late Today</span>
|
||||
<span class="badge bg-danger"><t t-esc="state.late_count"/></span>
|
||||
</div>
|
||||
<div class="fclk-dash-line">
|
||||
<span><t t-esc="state.team.on_leave_count"/> on approved leave</span>
|
||||
<span class="fclk-dash-muted">today</span>
|
||||
</div>
|
||||
<div class="fclk-dash-line" t-on-click="onViewActivityLogs" style="cursor:pointer;">
|
||||
<span class="fclk-pyel"><t t-esc="state.team.pending_reasons"/> auto clock-out — reason pending</span>
|
||||
<span class="fclk-dash-muted">view →</span>
|
||||
</div>
|
||||
<div class="fclk-dash-line" t-on-click="onViewCorrections" style="cursor:pointer;">
|
||||
<span><t t-esc="state.team.pending_approvals"/> correction requests</span>
|
||||
<span class="fclk-dash-muted">open →</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
<!-- Quick Actions -->
|
||||
<div class="card mt-3">
|
||||
<div class="card-header">
|
||||
<h5 class="mb-0">Quick Actions</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<button class="btn btn-outline-primary w-100 mb-2" t-on-click="onViewAttendances">
|
||||
<i class="fa fa-list me-1"/> View All Attendances
|
||||
</button>
|
||||
<button class="btn btn-outline-secondary w-100" t-on-click="onViewActivityLogs">
|
||||
<i class="fa fa-history me-1"/> Activity Logs
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- QUICK ACTIONS -->
|
||||
<div class="fclk-dash-card">
|
||||
<h4>Quick Actions</h4>
|
||||
<div class="fclk-dash-actions">
|
||||
<span class="fclk-dash-act" t-on-click="onOpenClock">🕒 Open My Clock</span>
|
||||
<span class="fclk-dash-act" t-on-click="onViewTimesheets">📄 My Timesheets</span>
|
||||
<t t-if="state.team">
|
||||
<span class="fclk-dash-act" t-on-click="onViewAttendances">📋 All Attendances</span>
|
||||
<span class="fclk-dash-act" t-on-click="onViewCorrections">📨 Approvals</span>
|
||||
<span class="fclk-dash-act" t-on-click="onViewPenalties">⚠ Penalties</span>
|
||||
<span class="fclk-dash-act" t-on-click="onViewActivityLogs">🗒 Activity Logs</span>
|
||||
</t>
|
||||
<t t-if="state.role === 'manager'">
|
||||
<span class="fclk-dash-act" t-on-click="onViewShiftPlanner">📅 Shift Planner</span>
|
||||
<span class="fclk-dash-act" t-on-click="onViewReports">📊 Reports</span>
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
Reference in New Issue
Block a user