Better handling of phone links
Some Weboob backends were returning multiple phone numbers (comma-separated) or phone numbers in different formats (with or without spaces, with or without separating dots, etc). This commit harmonizes all of this so that all phone links will be rendered correctly and be usable to call in a single click. Related, https://git.weboob.org/weboob/devel/merge_requests/42.
This commit is contained in:
parent
f1df23dc29
commit
78b9ebf04e
@ -118,7 +118,11 @@
|
||||
<h3>{{ $t("flatsDetails.Contact") }}</h3>
|
||||
<div class="contact">
|
||||
<p>
|
||||
<a v-if="flat.phone" :href="'tel:+33' + flat.phone">{{ flat.phone }}</a>
|
||||
<template v-if="flat.phone">
|
||||
<template v-for="phoneNumber in flat.phone.split(',')">
|
||||
<a :href="'tel:+33' + normalizePhoneNumber(phoneNumber)">{{ phoneNumber }}</a><br/>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ $t("flatsDetails.no_phone_found") }}
|
||||
</template>
|
||||
@ -305,6 +309,12 @@ export default {
|
||||
this.overloadNotation = null
|
||||
},
|
||||
|
||||
normalizePhoneNumber (phoneNumber) {
|
||||
phoneNumber = phoneNumber.replace(/ /g, '')
|
||||
phoneNumber = phoneNumber.replace(/\./g, '')
|
||||
return phoneNumber
|
||||
},
|
||||
|
||||
capitalize: capitalize,
|
||||
|
||||
range: range
|
||||
|
Loading…
Reference in New Issue
Block a user