fix: only allow zones with the same currency to be selected
This commit is contained in:
parent
5972c44ad1
commit
16a6104b25
3 changed files with 24 additions and 7 deletions
|
|
@ -47,8 +47,8 @@
|
||||||
v-model="zoneDialog.data.countries"
|
v-model="zoneDialog.data.countries"
|
||||||
></q-select>
|
></q-select>
|
||||||
<q-select
|
<q-select
|
||||||
v-if="!zoneDialog.data.id"
|
:disabled="!!zoneDialog.data.id"
|
||||||
style="width: 100px"
|
:readonly="!!zoneDialog.data.id"
|
||||||
filled
|
filled
|
||||||
dense
|
dense
|
||||||
v-model="zoneDialog.data.currency"
|
v-model="zoneDialog.data.currency"
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,14 @@
|
||||||
v-model.trim="stallDialog.data.name"
|
v-model.trim="stallDialog.data.name"
|
||||||
label="Name"
|
label="Name"
|
||||||
></q-input>
|
></q-input>
|
||||||
|
<q-input
|
||||||
|
filled
|
||||||
|
dense
|
||||||
|
v-model.trim="stallDialog.data.description"
|
||||||
|
type="textarea"
|
||||||
|
rows="3"
|
||||||
|
label="Description"
|
||||||
|
></q-input>
|
||||||
<q-select
|
<q-select
|
||||||
filled
|
filled
|
||||||
dense
|
dense
|
||||||
|
|
@ -130,7 +138,7 @@
|
||||||
:options="currencies"
|
:options="currencies"
|
||||||
></q-select>
|
></q-select>
|
||||||
<q-select
|
<q-select
|
||||||
:options="zoneOptions"
|
:options="filteredZoneOptions"
|
||||||
filled
|
filled
|
||||||
dense
|
dense
|
||||||
multiple
|
multiple
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ async function stallList(path) {
|
||||||
show: false,
|
show: false,
|
||||||
data: {
|
data: {
|
||||||
name: '',
|
name: '',
|
||||||
|
description: '',
|
||||||
wallet: null,
|
wallet: null,
|
||||||
currency: 'sat',
|
currency: 'sat',
|
||||||
shippingZones: []
|
shippingZones: []
|
||||||
|
|
@ -22,16 +23,23 @@ async function stallList(path) {
|
||||||
zoneOptions: []
|
zoneOptions: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
filteredZoneOptions: function () {
|
||||||
|
return this.zoneOptions.filter(
|
||||||
|
z => z.currency === this.stallDialog.data.currency
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
sendStallFormData: async function () {
|
sendStallFormData: async function () {
|
||||||
console.log('### sendStallFormData', this.stallDialog.data)
|
|
||||||
|
|
||||||
await this.createStall({
|
await this.createStall({
|
||||||
name: this.stallDialog.data.name,
|
name: this.stallDialog.data.name,
|
||||||
wallet: this.stallDialog.data.wallet,
|
wallet: this.stallDialog.data.wallet,
|
||||||
currency: this.stallDialog.data.currency,
|
currency: this.stallDialog.data.currency,
|
||||||
shipping_zones: this.stallDialog.data.shippingZones,
|
shipping_zones: this.stallDialog.data.shippingZones,
|
||||||
config: {}
|
config: {
|
||||||
|
description: this.stallDialog.data.description
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
createStall: async function (stall) {
|
createStall: async function (stall) {
|
||||||
|
|
@ -75,7 +83,7 @@ async function stallList(path) {
|
||||||
this.zoneOptions = data.map(z => ({
|
this.zoneOptions = data.map(z => ({
|
||||||
...z,
|
...z,
|
||||||
label: z.name
|
label: z.name
|
||||||
? `${z.name} (${z.countries.join(', ')}})`
|
? `${z.name} (${z.countries.join(', ')})`
|
||||||
: z.countries.join(', ')
|
: z.countries.join(', ')
|
||||||
}))
|
}))
|
||||||
console.log('### this.zoneOptions', this.zoneOptions)
|
console.log('### this.zoneOptions', this.zoneOptions)
|
||||||
|
|
@ -88,6 +96,7 @@ async function stallList(path) {
|
||||||
await this.getZones()
|
await this.getZones()
|
||||||
this.stallDialog.data = {
|
this.stallDialog.data = {
|
||||||
name: '',
|
name: '',
|
||||||
|
description: '',
|
||||||
wallet: null,
|
wallet: null,
|
||||||
currency: 'sat',
|
currency: 'sat',
|
||||||
shippingZones: []
|
shippingZones: []
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue