69 lines
1.6 KiB
Vue
69 lines
1.6 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.phone || $props.customer.mobile,
|
|
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>
|
|
<RouterLink
|
|
:to="{
|
|
name: 'TicketCreate',
|
|
query: { clientFk: customer.id },
|
|
}"
|
|
class="color-vn-text"
|
|
>
|
|
{{ t('Simple ticket') }}
|
|
</RouterLink>
|
|
</QItemSection>
|
|
</QItem>
|
|
<QItem v-ripple clickable>
|
|
<QItemSection @click="showSmsDialog()">{{ t('Send SMS') }}</QItemSection>
|
|
</QItem>
|
|
</template>
|
|
|
|
<i18n>
|
|
es:
|
|
Simple ticket: Ticket simple
|
|
Send SMS: Enviar SMS
|
|
</i18n>
|