import { translate } from "/js/libraries/mapTools.js" export function addGroupPinContent(g,content,locale) { let coordinates let text = ""+content["Group"]+"
" for (let field of ["location","members","contact"]) { let fieldText = content[field] + ": " if (field=="contact") { text += fieldText + "" + g.contact + "" } else if (field=="location") { let location = [g.country,g.state,g.town].filter(x => x!=null && x!=undefined) let locationString if (locale=="en") { locationString = location.map(x => x).join(", ") } else { locationString = location.map(x => translate(content, x)).join(", ") } text += fieldText + locationString + "
" coordinates = [g.latitude,g.longitude] } else { text += fieldText + g[field] + "
" } } return {text,coordinates} } export function addCommunePinContent(g,content,locale) { let coordinates let text = ""+content["Commune"]+"
" for (let field of ["location","status","members","contact"]) { let fieldText = content[field] + ": " if (field=="contact") { text += fieldText + "" + g.contact + "" } else if (field=="location") { let location = [g.country,g.state,g.town].filter(x => x!=null && x!=undefined) let locationString if (locale=="en") { locationString = location.map(x => x).join(", ") } else { locationString = location.map(x => translate(content, x)).join(", ") } text += fieldText + locationString + "
" coordinates = [g.latitude,g.longitude] } else if (field=="status") { text += fieldText + content[g[field]] + "
" } else { text += fieldText + g[field] + "
" } } return {text,coordinates} } export function addCoopPinContent(g,content,locale) { let coordinates let text = ""+content["Cooperative"]+"
" for (let field of ["logo","name","location","workers","status","website","contact","description"]) { let fieldText if (field!="logo") { fieldText = content[field] + ": " } if (field=="logo") { text += "logo" + "
" } else if (field=="contact") { text += fieldText + "" + g.contact + "" + "
" } else if (field=="website") { text += fieldText + "" + g.website + "" + "
" } else if (field=="location") { let location = [g.country,g.state,g.town].filter(x => x!=null && x!=undefined) let locationString if (locale=="en") { locationString = location.map(x => x).join(", ") } else { locationString = location.map(x => translate(content, x)).join(", ") } text += fieldText + locationString + "
" coordinates = [g.latitude,g.longitude] } else if (field=="market" || field=="status" || field=="description") { text += fieldText + g[field] + "
" } else { text += fieldText + g[field] + "
" } } return {text,coordinates} } export function addPartyPinContent(g,content,locale) { let coordinates let text = ""+content["Cooperative"]+"
" for (let field of ["logo","name","location","website","contact","description"]) { let fieldText if (field!="logo") { fieldText = content[field] + ": " } if (field=="logo") { text += "logo" + "
" } else if (field=="link") { text += fieldText + "" + g.link + "" + "
" } else if (field=="website") { text += fieldText + "" + g.website + "" + "
" } else if (field=="location") { let location = [g.country,g.state,g.town].filter(x => x!=null && x!=undefined) let locationString if (locale=="en") { locationString = location.map(x => x).join(", ") } else { locationString = location.map(x => translate(content, x)).join(", ") } text += fieldText + locationString + "
" coordinates = [g.latitude,g.longitude] } else if (field=="description") { text += fieldText + content[g[field]] + "
" } else if (field=="contact") { text += fieldText + "" + g.contact + "" + "
" } else { text += fieldText + g[field] + "
" } } return {text,coordinates} } export function addPartnersPinContent(g,content,locale) { let coordinates let text = ""+content["Partner"]+"
" for (let field of ["logo","name","location","website","contact","description"]) { let fieldText if (field!="logo") { fieldText = content[field] + ": " } if (field=="logo") { text += "logo" + "
" } else if (field=="contact") { text += fieldText + "" + g.contact + "" + "
" } else if (field=="website") { text += fieldText + "" + g.website + "" + "
" } else if (field=="location") { let location = [g.country,g.state,g.town].filter(x => x!=null && x!=undefined) let locationString if (locale=="en") { locationString = location.map(x => x).join(", ") } else { locationString = location.map(x => translate(content, x)).join(", ") } text += fieldText + locationString + "
" coordinates = [g.latitude,g.longitude] } else if (field=="description") { text += fieldText + g[field] + "
" } else { text += fieldText + g[field] + "
" } } return {text,coordinates} }