This commit is contained in:
2020-11-12 22:14:09 +00:00
parent 3ee75abd1a
commit da91700fa1
4 changed files with 44 additions and 25 deletions

View File

@@ -11,20 +11,13 @@ todo: Uifielddatatype Phone and TimeSpan support at client, translation keys etc
todo: input type email url phone number etc supported on device to activate? todo: input type email url phone number etc supported on device to activate?
if not, it must be supported somehow so figure it out if not, it must be supported somehow so figure it out
todo: latitude longitude todo: map url template should be set in user options with click to set various but defaults to google
windows ayanova uses a special control to enter in degrees m seconds not decimal input?! google maps
needs replacement decimal control or something else, can't use precision more than two decimal places open street map
NOTE: check docs, maybe it's a setting on the existing control? bing maps?
Ideally a coordinate specific input, check around apple maps?
at least replicate windows ayanova if nothing else, check web interfaces to see what was done there mapquest?
https://tutorialzine.com/2016/06/quick-tip-detecting-your-location-with-javascript
TODO: Make composite control for display and input
Use decimal degrees
lat above with title and long below with title
icon to grab current coordinates "map-marker-alt"
icon to view on a map with "map-marked-alt"
if a mapping url is defined
todo: After customer form is made todo: After customer form is made

View File

@@ -490,16 +490,10 @@ export default {
/////////////////////////////////////////////// ///////////////////////////////////////////////
// Use geolocation api to attempt to get current location // Use geolocation api to attempt to get current location
// try high accuracy first and downgrade if unavailable // try high accuracy first and downgrade if unavailable
// //https://www.openstreetmap.org/?mlat=48.3911&mlon=-124.7353#map=12/48.3910/-124.7353
//https://www.openstreetmap.org/#map=18/49.68155/-125.00435
// function getCurrentLocation(options) { //https://www.openstreetmap.org/?mlat=49.71236&mlon=-124.96961#map=17/49.71236/-124.96961
// return new Promise((resolve, reject) => { //https://www.google.com/maps/search/?api=1&query=47.5951518,-122.3316393
// navigator.geolocation.getCurrentPosition(resolve, ({code, message}) =>
// reject(Object.assign(new Error(message), {name: "PositionError", code})),
// options);
// });
// };
getGeoLocation: async function() { getGeoLocation: async function() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
navigator.geolocation.getCurrentPosition( navigator.geolocation.getCurrentPosition(

View File

@@ -892,6 +892,7 @@ async function clickHandler(menuItem) {
break; break;
case "geocapture": case "geocapture":
try { try {
window.$gz.form.deleteAllErrorBoxErrors(m.vm);
let loc = await window.$gz.util.getGeoLocation(); let loc = await window.$gz.util.getGeoLocation();
m.vm.obj.latitude = loc.latitude; m.vm.obj.latitude = loc.latitude;
m.vm.fieldValueChanged("latitude"); m.vm.fieldValueChanged("latitude");

View File

@@ -31,6 +31,23 @@
></v-text-field> ></v-text-field>
</v-col> </v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<v-text-field
v-model="obj.mapUrlTemplate"
:readonly="formState.readOnly"
:label="$ay.t('MapUrlTemplate')"
:error-messages="form().serverErrors(this, 'mapUrlTemplate')"
ref="mapUrlTemplate"
@input="fieldValueChanged('mapUrlTemplate')"
data-cy="mapUrlTemplate"
></v-text-field>
<v-select
:items="selectLists.mapUrls"
item-text="name"
item-value="value"
></v-select>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3"> <v-col cols="12" sm="6" lg="4" xl="3">
<v-text-field <v-text-field
v-model="obj.currencyName" v-model="obj.currencyName"
@@ -150,7 +167,19 @@ export default {
return { return {
formCustomTemplateKey: FORM_CUSTOM_TEMPLATE_KEY, formCustomTemplateKey: FORM_CUSTOM_TEMPLATE_KEY,
selectLists: { selectLists: {
translations: [] translations: [],
mapUrls: [
{
name: "Google",
value:
"https://www.google.com/maps/search/?api=1&query={aylatitude},{aylongitude}"
},
{
name: "Open Street Map",
value:
"https://www.openstreetmap.org/?mlat={aylatitude}&mlon={aylongitude}#map=17/{aylatitude}/{aylongitude}"
}
]
}, },
activeTranslationId: null, activeTranslationId: null,
darkMode: this.$store.state.darkMode, darkMode: this.$store.state.darkMode,
@@ -167,6 +196,7 @@ export default {
id: 0, id: 0,
concurrency: 0, concurrency: 0,
emailAddress: null, emailAddress: null,
mapUrlTemplate: null,
uiColor: null, uiColor: null,
languageOverride: null, languageOverride: null,
timeZoneOverride: null, timeZoneOverride: null,
@@ -440,7 +470,8 @@ async function fetchTranslatedText(vm) {
//"Hour12", //"Hour12",
"UserColor", "UserColor",
"Translation", "Translation",
"DarkMode" "DarkMode",
"MapUrlTemplate"
]); ]);
} }