Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Oct 26, 2024
1 parent 1dafd62 commit 12a4cf4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
19 changes: 18 additions & 1 deletion src/components/LocationInputRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@
<h3 class="required mb-1">
{{ $t('AddPriceSingle.WhereWhen.Location') }}
</h3>

<!-- current/recent locations -->
<v-chip
v-if="currentLocation"
class="mb-2"
:style="isSelectedLocation(currentLocation) ? 'border: 1px solid #4CAF50' : 'border: 1px solid transparent'"
@click="setLocationData(currentLocation)"
>
<v-icon start :icon="isSelectedLocation(currentLocation) ? 'mdi-check-circle-outline' : 'mdi-history'" :color="isSelectedLocation(currentLocation) ? 'green' : ''" />
{{ getLocationTitle(currentLocation, true, true, true) }}
</v-chip>
<v-chip
v-for="location in recentLocations"
:key="getLocationUniqueID(location)"
Expand All @@ -14,7 +25,9 @@
<v-icon start :icon="isSelectedLocation(location) ? 'mdi-check-circle-outline' : 'mdi-history'" :color="isSelectedLocation(location) ? 'green' : ''" />
{{ getLocationTitle(location, true, true, true) }}
</v-chip>
<br v-if="recentLocations.length">

<!-- CTA -->
<br v-if="currentLocation || recentLocations.length">
<v-btn class="mb-2" size="small" prepend-icon="mdi-magnify" @click="locationSelectorDialog = true">
{{ $t('AddPriceSingle.WhereWhen.Find') }}
</v-btn>
Expand Down Expand Up @@ -50,6 +63,10 @@ export default {
location_osm_type: null
})
},
currentLocation: {
type: Object,
default: null
},
maxRecentLocations: {
type: Number,
default: 3
Expand Down
10 changes: 8 additions & 2 deletions src/components/ProofEditDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

<v-card-text>
<ProofTypeInputRow :proofTypeForm="updateProofForm" />
<LocationInputRow :locationForm="updateProofForm" :currentLocation="proof.location" maxRecentLocations="1" />
<ProofMetadataInputRow :proofType="updateProofForm.type" :proofMetadataForm="updateProofForm" />
</v-card-text>

Expand Down Expand Up @@ -44,6 +45,7 @@ export default {
components: {
ProofCard: defineAsyncComponent(() => import('../components/ProofCard.vue')),
ProofTypeInputRow: defineAsyncComponent(() => import('../components/ProofTypeInputRow.vue')),
LocationInputRow: defineAsyncComponent(() => import('../components/LocationInputRow.vue')),
ProofMetadataInputRow: defineAsyncComponent(() => import('../components/ProofMetadataInputRow.vue')),
},
props: {
Expand All @@ -57,6 +59,9 @@ export default {
return {
updateProofForm: {
type: null,
location_id: null,
location_osm_id: null,
location_osm_type: null,
date: null,
currency: null,
receipt_price_count: null,
Expand All @@ -67,8 +72,9 @@ export default {
},
computed: {
formFilled() {
let keys = ['type', 'date', 'currency']
return Object.values(this.updateProofForm).filter(k => keys.includes(k)).every(k => !!this.updateProofForm[k])
let keysOSM = Object.keys(this.updateProofForm).filter(k => !['location_id', 'receipt_price_count', 'receipt_price_total'].includes(k))
let keysONLINE = Object.keys(this.updateProofForm).filter(k => !['location_osm_id', 'location_osm_type', 'receipt_price_count', 'receipt_price_total'].includes(k))
return Object.keys(this.updateProofForm).filter(k => keysOSM.includes(k)).every(k => !!this.updateProofForm[k]) || Object.keys(this.updateProofForm).filter(k => keysONLINE.includes(k)).every(k => !!this.updateProofForm[k])
},
},
mounted() {
Expand Down

0 comments on commit 12a4cf4

Please sign in to comment.