diff --git a/templates/match_workspace.html b/templates/match_workspace.html index e8b35f6..f504955 100644 --- a/templates/match_workspace.html +++ b/templates/match_workspace.html @@ -999,94 +999,37 @@ data-role="{{ p.position_full or p.position or '' }}"
= 2) { return `${parts[1]} ${parts[0]}`; } - return String(rawName || "").trim(); } + function formatPlayerName(firstName, lastName, fallbackName) { + const result = `${String(firstName || "").trim()} ${String(lastName || "").trim()}`.trim(); + return result || String(fallbackName || "").trim(); + } + async function sendNeutralPersonTitle(name, role, logoUrl) { const inputName = "ИГРОК - НЕЙТРАЛЬНЫЙ"; @@ -1371,20 +1317,28 @@ data-role="{{ p.position_full or p.position or '' }}" const trigger = event.target.closest(".vmix-person-trigger"); if (!trigger) return; + const personType = String(trigger.dataset.vmixPersonType || "").trim(); const side = String(trigger.dataset.side || "").trim(); const rawName = String(trigger.dataset.name || "").trim(); + const firstName = String(trigger.dataset.firstName || "").trim(); + const lastName = String(trigger.dataset.lastName || "").trim(); const role = String(trigger.dataset.role || "").trim(); const logoUrl = side === "away" ? teamLogos.away : teamLogos.home; - if (!rawName) return; + let formattedName = ""; - const formattedName = rawName; + if (personType === "coach") { + formattedName = formatCoachName(rawName); + } else { + formattedName = formatPlayerName(firstName, lastName, rawName); + } + + if (!formattedName) return; sendNeutralPersonTitle(formattedName, role, logoUrl); }); })(); -