Merge branch 'quantity-fix' into 'master'

fix: exchange rate

See merge request mohit.panjvani/crater-web!1302
This commit is contained in:
Mohit Panjwani
2021-12-01 12:57:12 +00:00

View File

@ -45,7 +45,7 @@
</template> </template>
<script setup> <script setup>
import { watch, computed, ref, onMounted } from 'vue' import { watch, computed, ref, onBeforeUnmount } from 'vue'
import { useGlobalStore } from '@/scripts/stores/global' import { useGlobalStore } from '@/scripts/stores/global'
import { useCompanyStore } from '@/scripts/stores/company' import { useCompanyStore } from '@/scripts/stores/company'
import { useExchangeRateStore } from '@/scripts/stores/exchange-rate' import { useExchangeRateStore } from '@/scripts/stores/exchange-rate'
@ -110,7 +110,8 @@ watch(
() => props.store[props.storeProp].currency_id, () => props.store[props.storeProp].currency_id,
(v) => { (v) => {
onChangeCurrency(v) onChangeCurrency(v)
} },
{ immediate: true }
) )
watch( watch(
() => props.customerCurrency, () => props.customerCurrency,
@ -144,7 +145,7 @@ function setCustomerCurrency(v) {
async function onChangeCurrency(v) { async function onChangeCurrency(v) {
if (v !== companyCurrency.value.id) { if (v !== companyCurrency.value.id) {
if (!props.isEdit) { if (!props.isEdit && v) {
await getCurrenctExchangeRate(v) await getCurrenctExchangeRate(v)
} }
@ -170,4 +171,8 @@ function getCurrenctExchangeRate(v) {
isFetching.value = false isFetching.value = false
}) })
} }
onBeforeUnmount(() => {
props.store.showExchangeRate = false
})
</script> </script>