From 189587969bc96515488af9acee2d319c62386129 Mon Sep 17 00:00:00 2001 From: dev Date: Tue, 1 Dec 2026 15:02:16 +0300 Subject: [PATCH] =?UTF-8?q?=D0=93=D1=80=D1=83=D0=BF=D0=BF=D1=8B:=20=D1=86?= =?UTF-8?q?=D0=B2=D0=B5=D1=82=20=D1=84=D0=B8=D0=BB=D0=B8=D0=B0=D0=BB=D0=B0?= =?UTF-8?q?=20=D0=BD=D0=B0=20=D0=BA=D0=B0=D1=80=D1=82=D0=BE=D1=87=D0=BA?= =?UTF-8?q?=D0=B5=20=D0=B3=D1=80=D1=83=D0=BF=D0=BF=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/groups.js | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/public/js/groups.js b/public/js/groups.js index 45b6959..7184b9a 100644 --- a/public/js/groups.js +++ b/public/js/groups.js @@ -112,6 +112,21 @@ async function loadGroups() { renderGroups(); } +function hexToRgb(hex) { + const m = /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/.exec(hex); + return m ? [parseInt(m[1], 16), parseInt(m[2], 16), parseInt(m[3], 16)] : null; +} + +function branchColor(value) { + const raw = String(value || '').trim(); + return /^#[0-9a-fA-F]{6}$/.test(raw) ? raw.toLowerCase() : null; +} + +function branchBorderColor(value) { + const c = hexToRgb(branchColor(value)); + return c ? `rgba(${c[0]},${c[1]},${c[2]},0.35)` : null; +} + function renderGroups() { const list = document.getElementById('groupList'); const groups = allGroups.filter(groupMatchesFilters); @@ -125,8 +140,19 @@ function renderGroups() { const canDelete = admin || (currentUser && Number(g.tutor_id) === Number(currentUser.id)); const schedSet = g.day_of_week != null && g.time_start && g.time_end; const hidden = !!g.hidden; + const branch = branchesCache.find(b => b.id === g.branch_id); + const borderColor = branch ? branchBorderColor(branch.color) : null; + const topColor = branch ? branchColor(branch.color) : null; + const styleParts = []; + if (hidden) styleParts.push('opacity:.55'); + if (borderColor) styleParts.push(`border-color:${borderColor}`); + if (topColor) { + styleParts.push(`border-top-color:${topColor}`); + styleParts.push('border-top-width:2px'); + } + const styleAttr = styleParts.length ? ` style="${styleParts.join('; ')}"` : ''; return ` -
+
${g.cover_path ? `` : `
📷
`}