Skip to content

Commit

Permalink
refactor(proof add): forgot to commit currency field. ref #639
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Jun 20, 2024
1 parent f9086a0 commit cd2be26
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/components/ProofInputRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<span class="d-sm-none">{{ $t('AddPriceSingle.PriceDetails.Gallery') }}</span>
<span class="d-none d-sm-inline-flex">{{ $t('AddPriceSingle.PriceDetails.SelectFromGallery') }}</span>
</v-btn>
<v-btn v-if="!hideRecentProofOption" class="mb-2" size="small" prepend-icon="mdi-receipt-text-clock" @click="showUserRecentProofsDialog">
<v-btn v-if="!hideRecentProofChoice" class="mb-2" size="small" prepend-icon="mdi-receipt-text-clock" @click="showUserRecentProofsDialog">
<span class="d-sm-none">{{ $t('AddPriceSingle.PriceDetails.RecentProof') }}</span>
<span class="d-none d-sm-inline-flex">{{ $t('AddPriceSingle.PriceDetails.SelectRecentProof') }}</span>
</v-btn>
Expand Down Expand Up @@ -104,7 +104,7 @@ export default {
type: Object,
default: () => ({ proof_id: null, date: utils.currentDate() })
},
hideRecentProofOption: {
hideRecentProofChoice: {
type: Boolean,
default: false
},
Expand Down
1 change: 1 addition & 0 deletions src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
"AddPrice": "Add a price",
"AddToOFF": "Add to {name}",
"Country": "Country",
"Currency": "Currency",
"Language": "Languages",
"Locations": "Locations",
"Date": "Date",
Expand Down
2 changes: 1 addition & 1 deletion src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const routes = [
{ path: '/settings', name: 'settings', component: () => import('./views/UserSettings.vue'), meta: { title: 'Settings', requiresAuth: true } },
{ path: '/search', name: 'search', component: () => import('./views/Search.vue'), meta: { title: 'Search', icon: 'mdi-magnify', drawerMenu: true }},
{ path: '/prices', name: 'prices', component: () => import('./views/PriceList.vue'), meta: { title: 'LatestPrices', icon: 'mdi-tag-multiple-outline', drawerMenu: true }},
{ path: '/prices/add', name: 'price-add', component: () => import('./views/AddPriceHome.vue'), meta: { title: 'AddPrice', icon: 'mdi-plus', drawerMenu: true, color: 'primary', requiresAuth: true }},
{ path: '/prices/add', name: 'add-price', component: () => import('./views/AddPriceHome.vue'), meta: { title: 'AddPrice', icon: 'mdi-plus', drawerMenu: true, color: 'primary', requiresAuth: true }},
{ path: '/prices/add/single', name: 'add-price-single', component: () => import('./views/AddPriceSingle.vue'), meta: { title: 'Add a single price (price tag)', requiresAuth: true }},
{ path: '/prices/add/multiple/price-tag', name: 'add-price-multiple-price-tag', component: () => import('./views/AddPriceMultiple.vue'), meta: { title: 'Add multiple prices (price tags)', requiresAuth: true }},
{ path: '/prices/add/multiple/receipt', name: 'add-price-multiple-receipt', component: () => import('./views/AddPriceMultiple.vue'), meta: { title: 'Add multiple prices (receipt)', requiresAuth: true }},
Expand Down
27 changes: 23 additions & 4 deletions src/views/ProofAddSingle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</template>
<v-divider />
<v-card-text>
<ProofInputRow :proofType="addProofSingleForm.type" :proofForm="addProofSingleForm" :hideRecentProofOption="true" />
<ProofInputRow :proofType="addProofSingleForm.type" :proofForm="addProofSingleForm" :hideRecentProofChoice="true" />
</v-card-text>
<v-overlay v-model="disableProofImageForm" scrim="#E8F5E9" contained persistent />
</v-card>
Expand All @@ -64,14 +64,29 @@
<v-divider />
<v-card-text>
<h3 class="mb-1">
{{ $t('AddPriceSingle.WhereWhen.Date') }}
{{ $t('Common.Date') }}
</h3>
<v-row>
<v-col cols="12" sm="6">
<v-text-field
v-model="addProofSingleForm.date"
:label="$t('AddPriceSingle.WhereWhen.DateLabel')"
:label="$t('Common.Date')"
type="date"
hide-details="auto"
/>
</v-col>
</v-row>

<h3 class="mt-4 mb-1">
{{ $t('Common.Currency') }}
</h3>
<v-row>
<v-col cols="12" sm="6">
<v-select
v-model="addProofSingleForm.currency"
:label="$t('Common.Currency')"
:items="userFavoriteCurrencies"
hide-details="auto"
/>
</v-col>
</v-row>
Expand Down Expand Up @@ -117,6 +132,7 @@ export default {
type: 'PRICE_TAG',
proof_id: null,
date: utils.currentDate(),
currency: null,
},
loading: false,
}
Expand All @@ -132,7 +148,7 @@ export default {
return Object.keys(this.addProofSingleForm).filter(k => keys.includes(k)).every(k => !!this.addProofSingleForm[k])
},
proofDetailsFormFilled() {
let keys = ['date']
let keys = ['date', 'currency']
return Object.keys(this.addProofSingleForm).filter(k => keys.includes(k)).every(k => !!this.addProofSingleForm[k])
},
formFilled() {
Expand All @@ -149,6 +165,9 @@ export default {
},
disableProofDetailsForm() {
return !this.proofTypeFormFilled || !this.proofImageFormFilled
},
userFavoriteCurrencies() {
return this.appStore.getUserFavoriteCurrencies
}
},
methods: {
Expand Down

0 comments on commit cd2be26

Please sign in to comment.