forked from verdnatura/salix-front
Merge pull request 'feat: refs #6818 saysimple integration' (!904) from 6818-saySimpleIntegration into dev
Reviewed-on: verdnatura/salix-front#904 Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
commit
d474fb924f
|
@ -1,16 +1,56 @@
|
|||
<script setup>
|
||||
defineProps({ phoneNumber: { type: [String, Number], default: null } });
|
||||
import { reactive, useAttrs, onBeforeMount, capitalize } from 'vue';
|
||||
import axios from 'axios';
|
||||
const props = defineProps({
|
||||
phoneNumber: { type: [String, Number], default: null },
|
||||
channel: { type: Number, default: null },
|
||||
});
|
||||
|
||||
const config = reactive({
|
||||
sip: { icon: 'phone', href: `sip:${props.phoneNumber}` },
|
||||
'say-simple': {
|
||||
icon: 'help',
|
||||
href: null,
|
||||
channel: props.channel,
|
||||
},
|
||||
});
|
||||
const type = Object.keys(config).find((key) => key in useAttrs()) || 'sip';
|
||||
|
||||
onBeforeMount(async () => {
|
||||
let url;
|
||||
let { channel } = config[type];
|
||||
|
||||
if (type === 'say-simple') {
|
||||
url = (await axios.get('SaySimpleConfigs/findOne')).data.url;
|
||||
if (!channel)
|
||||
channel = (
|
||||
await axios.get('SaySimpleCountries/findOne', {
|
||||
params: {
|
||||
filter: { fields: ['channel'], where: { countryFk: 0 } },
|
||||
},
|
||||
})
|
||||
).data?.channel;
|
||||
|
||||
config[
|
||||
type
|
||||
].href = `${url}?customerIdentity=%2B${props.phoneNumber}&channelId=${channel}`;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<QBtn
|
||||
v-if="phoneNumber"
|
||||
flat
|
||||
round
|
||||
icon="phone"
|
||||
:icon="config[type].icon"
|
||||
size="sm"
|
||||
color="primary"
|
||||
padding="none"
|
||||
:href="`sip:${phoneNumber}`"
|
||||
:href="config[type].href"
|
||||
@click.stop
|
||||
/>
|
||||
>
|
||||
<QTooltip>
|
||||
{{ capitalize(type).replace('-', '') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</template>
|
||||
|
|
|
@ -95,6 +95,11 @@ const sumRisk = ({ clientRisks }) => {
|
|||
<template #label>
|
||||
{{ t('customer.summary.mobile') }}
|
||||
<VnLinkPhone :phone-number="entity.mobile" />
|
||||
<VnLinkPhone
|
||||
say-simple
|
||||
:phone-number="entity.mobile"
|
||||
:channel="entity.country?.saySimpleCountry?.channel"
|
||||
/>
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv :value="entity.email" copy
|
||||
|
@ -142,7 +147,7 @@ const sumRisk = ({ clientRisks }) => {
|
|||
<VnLv
|
||||
v-if="entity.country"
|
||||
:label="t('customer.summary.country')"
|
||||
:value="entity.country.country"
|
||||
:value="entity.country.name"
|
||||
/>
|
||||
<VnLv :label="t('customer.summary.street')" :value="entity.street" />
|
||||
</QCard>
|
||||
|
|
Loading…
Reference in New Issue