56 lines
1.2 KiB
Vue
56 lines
1.2 KiB
Vue
<script setup>
|
|
import { useI18n } from 'vue-i18n';
|
|
import { useRoute } from 'vue-router';
|
|
|
|
import axios from 'axios';
|
|
import { useQuasar } from 'quasar';
|
|
|
|
import useNotify from 'src/composables/useNotify';
|
|
|
|
import VnSmsDialog from 'src/components/common/VnSmsDialog.vue';
|
|
|
|
const $props = defineProps({
|
|
customer: {
|
|
type: Object,
|
|
required: true,
|
|
},
|
|
});
|
|
|
|
const { notify } = useNotify();
|
|
const { t } = useI18n();
|
|
const quasar = useQuasar();
|
|
const route = useRoute();
|
|
|
|
const showSmsDialog = () => {
|
|
quasar.dialog({
|
|
component: VnSmsDialog,
|
|
componentProps: {
|
|
phone: $props.customer.mobile || $props.customer.phone,
|
|
promise: sendSms,
|
|
},
|
|
});
|
|
};
|
|
|
|
const sendSms = async (payload) => {
|
|
payload.destinationFk = route.params.id;
|
|
try {
|
|
await axios.post(`Clients/${route.params.id}/sendSms`, payload);
|
|
notify('globals.notificationSent', 'positive');
|
|
} catch (error) {
|
|
notify(error.message, 'positive');
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<template>
|
|
<QItem v-ripple clickable>
|
|
<QItemSection @click="showSmsDialog()">{{ t('Send SMS') }}</QItemSection>
|
|
</QItem>
|
|
</template>
|
|
|
|
<i18n>
|
|
es:
|
|
Simple ticket: Ticket simple
|
|
Send SMS: Enviar SMS
|
|
</i18n>
|