From c34a5ed3e49114f5e0b90e3dfee09e4d7145d76d Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 17 Feb 2021 06:37:33 +0100 Subject: [PATCH] Location is submitted and added to the array through events. --- .../store/modules/transactions/create.js | 4 + .../src/components/transactions/Create.vue | 15 ++- .../src/components/transactions/SplitForm.vue | 1 + .../transactions/TransactionLocation.vue | 91 ++++++++++++++++++- 4 files changed, 107 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/store/modules/transactions/create.js b/frontend/src/components/store/modules/transactions/create.js index 013aedf284..a04abca641 100644 --- a/frontend/src/components/store/modules/transactions/create.js +++ b/frontend/src/components/store/modules/transactions/create.js @@ -113,6 +113,10 @@ const state = () => ({ // transaction links: links: [], attachments: [], + // location: + zoom_level: null, + longitude: null, + latitude: null, // error handling errors: {}, diff --git a/frontend/src/components/transactions/Create.vue b/frontend/src/components/transactions/Create.vue index 828a717466..79ad3e6173 100644 --- a/frontend/src/components/transactions/Create.vue +++ b/frontend/src/components/transactions/Create.vue @@ -33,6 +33,7 @@ :custom-fields="customFields" :submitted-transaction="submittedTransaction" v-on:uploaded-attachments="uploadedAttachment($event)" + v-on:set-marker-location="storeLocation(index, $event)" /> @@ -346,7 +347,14 @@ export default { this.submittedAttachments = true; } }, - + storeLocation: function(index, event) { + let zoomLevel = event.hasMarker ? event.zoomLevel : null; + let lat = event.hasMarker ? event.lat : null; + let lng = event.hasMarker ? event.lng : null; + this.updateField({index: index, field: 'zoom_level', value: zoomLevel}); + this.updateField({index: index, field: 'latitude', value: lat}); + this.updateField({index: index, field: 'longitude', value: lng}); + }, submitTransactionLinks(data, response) { console.log('submitTransactionLinks()'); let promises = []; @@ -590,6 +598,11 @@ export default { notes: array.notes, external_id: array.external_id, + // location: + zoom_level: array.zoom_level, + longitude: array.longitude, + latitude: array.latitude, + // from thing: order: 0, reconciled: false, diff --git a/frontend/src/components/transactions/SplitForm.vue b/frontend/src/components/transactions/SplitForm.vue index ca99a9ca17..2fc304d79e 100644 --- a/frontend/src/components/transactions/SplitForm.vue +++ b/frontend/src/components/transactions/SplitForm.vue @@ -211,6 +211,7 @@ :custom-fields.sync="customFields" /> {{ $t('firefly.location') }} -
- (TODO) +
+ + + + + + +