diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/settingsPage/CustomerSatisfactionPage.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/settingsPage/CustomerSatisfactionPage.vue index 309d587f8..232ad483a 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/inbox/settingsPage/CustomerSatisfactionPage.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/settingsPage/CustomerSatisfactionPage.vue @@ -39,7 +39,6 @@ const state = reactive({ language: '', }); -// WhatsApp template status const templateStatus = ref(null); const templateLoading = ref(false); @@ -74,36 +73,36 @@ const messagePreviewData = computed(() => ({ content: state.message || t('INBOX_MGMT.CSAT.MESSAGE.PLACEHOLDER'), })); -// const templateApprovalStatus = computed(() => { -// if (!templateStatus.value) return null; +const templateApprovalStatus = computed(() => { + if (!templateStatus.value) return null; -// switch (templateStatus.value.status) { -// case 'APPROVED': -// return { -// text: t('INBOX_MGMT.CSAT.TEMPLATE_STATUS.APPROVED'), -// icon: 'i-lucide-check-circle', -// color: 'text-green-600', -// }; -// case 'PENDING': -// return { -// text: t('INBOX_MGMT.CSAT.TEMPLATE_STATUS.PENDING'), -// icon: 'i-lucide-clock', -// color: 'text-yellow-600', -// }; -// case 'REJECTED': -// return { -// text: t('INBOX_MGMT.CSAT.TEMPLATE_STATUS.REJECTED'), -// icon: 'i-lucide-x-circle', -// color: 'text-red-600', -// }; -// default: -// return { -// text: t('INBOX_MGMT.CSAT.TEMPLATE_STATUS.PENDING'), -// icon: 'i-lucide-clock', -// color: 'text-yellow-600', -// }; -// } -// }); + switch (templateStatus.value.status) { + case 'APPROVED': + return { + text: t('INBOX_MGMT.CSAT.TEMPLATE_STATUS.APPROVED'), + icon: 'i-lucide-check-circle', + color: 'text-green-600', + }; + case 'PENDING': + return { + text: t('INBOX_MGMT.CSAT.TEMPLATE_STATUS.PENDING'), + icon: 'i-lucide-clock', + color: 'text-yellow-600', + }; + case 'REJECTED': + return { + text: t('INBOX_MGMT.CSAT.TEMPLATE_STATUS.REJECTED'), + icon: 'i-lucide-x-circle', + color: 'text-red-600', + }; + default: + return { + text: t('INBOX_MGMT.CSAT.TEMPLATE_STATUS.PENDING'), + icon: 'i-lucide-clock', + color: 'text-yellow-600', + }; + } +}); const initializeState = () => { if (!props.inbox) return; @@ -139,9 +138,9 @@ const checkTemplateStatus = async () => { const response = await store.dispatch('inboxes/getCSATTemplateStatus', { inboxId: props.inbox.id, }); - templateStatus.value = response.data; + templateStatus.value = response; + // eslint-disable-next-line no-empty } catch (error) { - // console.error('Error fetching template status:', error); } finally { templateLoading.value = false; } @@ -272,12 +271,11 @@ const saveSettings = async () => { /> -