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 () {
'use strict'
const adminSite = "runcity.geo.rictum.ru"
const links = {
"Волонтеры": "suv_comp",
"Контрольные пункты": "cp_mgmt",
@ -25,7 +27,7 @@
"Склеить": "suv_comp?action=test_merge",
"Прохождение": "callcenter?action=online_log",
"КП в трассах": "route_mgmt?action=cp_list",
// "Связанные КП": "#",
"Связанные КП": relatedPointsHref(),
}
const catLinks = {
@ -288,24 +290,28 @@
}
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',
body: formData
})
}
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'
})
}
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'
})
}
function relatedPointsHref() {
return `https://${adminSite}/competitions/${getCompetition()}/relations`
}
function copyCoordinates() {
let copyButton = Tag.button({
classes: "copy-button",
@ -1097,7 +1103,7 @@
let mainLinksFormatted = {}
for (const [label, href] of Object.entries(links)) {
mainLinksFormatted[label] = `/${competition}/${href}`
mainLinksFormatted[label] = href.startsWith("http") ? href : `/${competition}/${href}`
}
menuContainer.append(createMenuFromLinks(mainLinksFormatted, ["Легенда"]))