add link to related points

This commit is contained in:
Zhora Shalyapin 2025-03-24 08:12:53 +00:00
parent ce50b1cecd
commit 07d01839d1

16
main.js
View File

@ -15,6 +15,8 @@
(function () { (function () {
'use strict' 'use strict'
const adminSite = "runcity.geo.rictum.ru"
const links = { const links = {
"Волонтеры": "suv_comp", "Волонтеры": "suv_comp",
"Контрольные пункты": "cp_mgmt", "Контрольные пункты": "cp_mgmt",
@ -25,7 +27,7 @@
"Склеить": "suv_comp?action=test_merge", "Склеить": "suv_comp?action=test_merge",
"Прохождение": "callcenter?action=online_log", "Прохождение": "callcenter?action=online_log",
"КП в трассах": "route_mgmt?action=cp_list", "КП в трассах": "route_mgmt?action=cp_list",
// "Связанные КП": "#", "Связанные КП": relatedPointsHref(),
} }
const catLinks = { const catLinks = {
@ -288,24 +290,28 @@
} }
async function updatePoint(formData) { async function updatePoint(formData) {
return await fetch(`https://runcity.geo.rictum.ru/api/competitions/${getCompetition()}/update`, { return await fetch(`https://${adminSite}/api/competitions/${getCompetition()}/update`, {
method: 'POST', method: 'POST',
body: formData body: formData
}) })
} }
async function deletePoint() { async function deletePoint() {
return await fetch(`https://runcity.geo.rictum.ru/api/points/${urlParams().get("cp_id")}`, { return await fetch(`https://${adminSite}/api/points/${urlParams().get("cp_id")}`, {
method: 'DELETE' method: 'DELETE'
}) })
} }
async function getPointIdByNumber(number) { async function getPointIdByNumber(number) {
return await fetch(`https://runcity.geo.rictum.ru/api/competitions/${getCompetition()}/${number}`, { return await fetch(`https://${adminSite}/api/competitions/${getCompetition()}/${number}`, {
method: 'GET' method: 'GET'
}) })
} }
function relatedPointsHref() {
return `https://${adminSite}/competitions/${getCompetition()}/relations`
}
function copyCoordinates() { function copyCoordinates() {
let copyButton = Tag.button({ let copyButton = Tag.button({
classes: "copy-button", classes: "copy-button",
@ -1097,7 +1103,7 @@
let mainLinksFormatted = {} let mainLinksFormatted = {}
for (const [label, href] of Object.entries(links)) { for (const [label, href] of Object.entries(links)) {
mainLinksFormatted[label] = `/${competition}/${href}` mainLinksFormatted[label] = href.startsWith("http") ? href : `/${competition}/${href}`
} }
menuContainer.append(createMenuFromLinks(mainLinksFormatted, ["Легенда"])) menuContainer.append(createMenuFromLinks(mainLinksFormatted, ["Легенда"]))