This commit is contained in:
a-ill
2023-07-21 17:38:02 +03:00
parent fb705bab7c
commit ccd97c1095
12 changed files with 121 additions and 19 deletions

View File

@@ -5,7 +5,7 @@
import { onMount } from 'svelte'
import { writable } from 'svelte/store';
import { groupsByCountry, addMarkersGroups } from '/js/groups.js'
import { loadLocaleContent, getData, sendText } from "/js/libraries/serverTools.js"
import { loadLocaleContent, getData, sendData } from "/js/libraries/serverTools.js"
// Import components
import "/js/components/map-component.js"
@@ -105,9 +105,27 @@
function submitLocation() {
if (addressVec!=undefined) {
let data = [...addressVec,userPinLat,userPinLng,contactInput.value]
let data = {
country: addressVec[0],
state: addressVec[1],
town: addressVec[2],
latitude: userPinLat,
longitude: userPinLng,
contact: contactInput.value,
members: 1
}
if (data.state=="") {
data.state = null
}
if (data.town=="") {
data.town = null
}
if (data.contact=="") {
data.contact = null
}
let url = "/" + locale + "/groups-add-post/"
sendText(url,JSON.stringify(data),updateConfirmationMsg)
sendData(url,data,updateConfirmationMsg)
}
}

View File

@@ -4,7 +4,7 @@
// Import statements
import { onMount } from 'svelte'
import { writable } from 'svelte/store';
import { groupsByCountry, addMarkersGroups } from '/js/groups.js'
import { groupsByCountry, addMarkersGroups, translate } from '/js/groups.js'
import { loadLocaleContent, getData, sendData } from "/js/libraries/serverTools.js"
// Import components
@@ -22,14 +22,14 @@
addMarkersGroups(map,content,locale)
}
function getCountry(name) {
return locale=="en" ? name : $content[name]
function getCountry(x) {
return locale=="en" ? x : translate($content,x)
}
function getAddress(group) {
return group.location[0].map(x => locale=="en" ? x : $content[x]).join(", ")
return group.location[0].map(x => locale=="en" ? x : translate($content,x)).join(", ")
}
onMount(() => {
})