export let coops = [
{
logo: "chiron_logo",
name: "Chiron Health",
location: [["Estonia","KohtlaJarve"],[59.41038769769602, 27.287802936242034]],
market: "wellnessAndHealth",
workers: 2,
status: "inDevelopment",
website: "chrn.health",
contact: ["https://discord.gg/Qk8KUk787z","DiscordInviteLink"],
description: "descriptionChironHealth"
},
{
logo: "kuusk_logo",
name: "Kuusk",
location: [["Estonia","KohtlaJarve"],[59.399947051803004, 27.277159931677055]],
market: "herbalTeas",
workers: 1,
status: "inDevelopment",
website: "-",
contact: ["https://discord.gg/Qk8KUk787z","DiscordInviteLink"],
description: "kuuskDescription"
}
]
export let coopsByCountry = {}
for (let g of coops) {
let country = g.location[0][0]
if (country in coopsByCountry) {
coopsByCountry[country].push(g)
}
else {
coopsByCountry[country] = [g]
}
}
export let coopsMarkersLayer = L.layerGroup()
export function addMarkersCoops(map,content) {
for (let g of coops) {
let coordinates
let text = ""+content["Cooperative"]+"
"
for (let field in g) {
let fieldText
if (field!="logo") {
fieldText = content[field] + ": "
}
if (field=="logo") {
text += "" + "
"
}
else if (field=="contact") {
text += fieldText + "" + content[g.contact[1]] + "" + "
"
}
else if (field=="website") {
text += fieldText + "" + g.website + "" + "
"
}
else if (field=="location") {
let location = g[field][0]
let locationString = location.map(x => content[x]).join(", ")
text += fieldText + locationString + "
"
coordinates = g[field][1]
}
else if (field=="market" || field=="status" || field=="description") {
text += fieldText + content[g[field]] + "
"
}
else {
text += fieldText + g[field] + "
"
}
}
L.marker(coordinates).addTo(coopsMarkersLayer).bindPopup(text)
}
coopsMarkersLayer.addTo(map)
}