feat: Add date-range filter on CSAT Reports (#2622)
This commit is contained in:
parent
a5bc81b304
commit
3d18ec9e40
10 changed files with 175 additions and 120 deletions
|
@ -1,4 +1,5 @@
|
||||||
class Api::V1::Accounts::CsatSurveyResponsesController < Api::V1::Accounts::BaseController
|
class Api::V1::Accounts::CsatSurveyResponsesController < Api::V1::Accounts::BaseController
|
||||||
|
include Sift
|
||||||
include DateRangeHelper
|
include DateRangeHelper
|
||||||
|
|
||||||
RESULTS_PER_PAGE = 25
|
RESULTS_PER_PAGE = 25
|
||||||
|
@ -9,6 +10,8 @@ class Api::V1::Accounts::CsatSurveyResponsesController < Api::V1::Accounts::Base
|
||||||
before_action :set_current_page_surveys, only: [:index]
|
before_action :set_current_page_surveys, only: [:index]
|
||||||
before_action :set_total_sent_messages_count, only: [:metrics]
|
before_action :set_total_sent_messages_count, only: [:metrics]
|
||||||
|
|
||||||
|
sort_on :created_at, type: :datetime
|
||||||
|
|
||||||
def index; end
|
def index; end
|
||||||
|
|
||||||
def metrics
|
def metrics
|
||||||
|
@ -25,7 +28,9 @@ class Api::V1::Accounts::CsatSurveyResponsesController < Api::V1::Accounts::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_csat_survey_responses
|
def set_csat_survey_responses
|
||||||
@csat_survey_responses = Current.account.csat_survey_responses.includes([:conversation, :assigned_agent, :contact])
|
@csat_survey_responses = filtrate(
|
||||||
|
Current.account.csat_survey_responses.includes([:conversation, :assigned_agent, :contact])
|
||||||
|
)
|
||||||
@csat_survey_responses = @csat_survey_responses.where(created_at: range) if range.present?
|
@csat_survey_responses = @csat_survey_responses.where(created_at: range) if range.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,16 @@ class CSATReportsAPI extends ApiClient {
|
||||||
super('csat_survey_responses', { accountScoped: true });
|
super('csat_survey_responses', { accountScoped: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
get({ page } = {}) {
|
get({ page, from, to } = {}) {
|
||||||
return axios.get(this.url, { params: { page } });
|
return axios.get(this.url, {
|
||||||
|
params: { page, since: from, until: to, sort: '-created_at' },
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getMetrics() {
|
getMetrics({ from, to } = {}) {
|
||||||
return axios.get(`${this.url}/metrics`);
|
return axios.get(`${this.url}/metrics`, {
|
||||||
|
params: { since: from, until: to },
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,18 +11,26 @@ describe('#Reports API', () => {
|
||||||
});
|
});
|
||||||
describeWithAPIMock('API calls', context => {
|
describeWithAPIMock('API calls', context => {
|
||||||
it('#get', () => {
|
it('#get', () => {
|
||||||
csatReportsAPI.get({ page: 1 });
|
csatReportsAPI.get({ page: 1, from: 1622485800, to: 1623695400 });
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
||||||
'/api/v1/csat_survey_responses',
|
'/api/v1/csat_survey_responses',
|
||||||
{
|
{
|
||||||
params: { page: 1 },
|
params: {
|
||||||
|
page: 1,
|
||||||
|
since: 1622485800,
|
||||||
|
until: 1623695400,
|
||||||
|
sort: '-created_at',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('#getMetrics', () => {
|
it('#getMetrics', () => {
|
||||||
csatReportsAPI.getMetrics();
|
csatReportsAPI.getMetrics({ from: 1622485800, to: 1623695400 });
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
||||||
'/api/v1/csat_survey_responses/metrics'
|
'/api/v1/csat_survey_responses/metrics',
|
||||||
|
{
|
||||||
|
params: { since: 1622485800, until: 1623695400 },
|
||||||
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="column content-box">
|
<div class="column content-box">
|
||||||
|
<report-date-range-selector @date-range-change="onDateRangeChange" />
|
||||||
<csat-metrics />
|
<csat-metrics />
|
||||||
<csat-table :page-index="pageIndex" @page-change="onPageNumberChange" />
|
<csat-table :page-index="pageIndex" @page-change="onPageNumberChange" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -7,26 +8,38 @@
|
||||||
<script>
|
<script>
|
||||||
import CsatMetrics from './components/CsatMetrics';
|
import CsatMetrics from './components/CsatMetrics';
|
||||||
import CsatTable from './components/CsatTable';
|
import CsatTable from './components/CsatTable';
|
||||||
|
import ReportDateRangeSelector from './components/DateRangeSelector';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'CsatResponses',
|
name: 'CsatResponses',
|
||||||
components: {
|
components: {
|
||||||
CsatMetrics,
|
CsatMetrics,
|
||||||
CsatTable,
|
CsatTable,
|
||||||
|
ReportDateRangeSelector,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return { pageIndex: 1 };
|
return { pageIndex: 1, from: 0, to: 0 };
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.$store.dispatch('csat/getMetrics');
|
|
||||||
this.getData();
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getData() {
|
getAllData() {
|
||||||
this.$store.dispatch('csat/get', { page: this.pageIndex });
|
this.$store.dispatch('csat/getMetrics', { from: this.from, to: this.to });
|
||||||
|
this.getResponses();
|
||||||
|
},
|
||||||
|
getResponses() {
|
||||||
|
this.$store.dispatch('csat/get', {
|
||||||
|
page: this.pageIndex,
|
||||||
|
from: this.from,
|
||||||
|
to: this.to,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
onPageNumberChange(pageIndex) {
|
onPageNumberChange(pageIndex) {
|
||||||
this.pageIndex = pageIndex;
|
this.pageIndex = pageIndex;
|
||||||
this.getData();
|
this.getResponses();
|
||||||
|
},
|
||||||
|
onDateRangeChange({ from, to }) {
|
||||||
|
this.from = from;
|
||||||
|
this.to = to;
|
||||||
|
this.getAllData();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,30 +8,7 @@
|
||||||
>
|
>
|
||||||
{{ $t('REPORT.DOWNLOAD_AGENT_REPORTS') }}
|
{{ $t('REPORT.DOWNLOAD_AGENT_REPORTS') }}
|
||||||
</woot-button>
|
</woot-button>
|
||||||
<div class="range-selector">
|
<report-date-range-selector @date-range-change="onDateRangeChange" />
|
||||||
<div class="small-3 pull-right">
|
|
||||||
<multiselect
|
|
||||||
v-model="currentDateRangeSelection"
|
|
||||||
track-by="name"
|
|
||||||
label="name"
|
|
||||||
:placeholder="$t('FORMS.MULTISELECT.SELECT_ONE')"
|
|
||||||
selected-label
|
|
||||||
:select-label="$t('FORMS.MULTISELECT.ENTER_TO_SELECT')"
|
|
||||||
deselect-label=""
|
|
||||||
:options="dateRange"
|
|
||||||
:searchable="false"
|
|
||||||
:allow-empty="false"
|
|
||||||
@select="changeDateSelection"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<woot-date-range-picker
|
|
||||||
v-if="isDateRangeSelected"
|
|
||||||
:value="customDateRange"
|
|
||||||
:confirm-text="$t('REPORT.CUSTOM_DATE_RANGE.CONFIRM')"
|
|
||||||
:placeholder="$t('REPORT.CUSTOM_DATE_RANGE.PLACEHOLDER')"
|
|
||||||
@change="onChange"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<woot-report-stats-card
|
<woot-report-stats-card
|
||||||
v-for="(metric, index) in metrics"
|
v-for="(metric, index) in metrics"
|
||||||
|
@ -61,12 +38,9 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import startOfDay from 'date-fns/startOfDay';
|
|
||||||
import subDays from 'date-fns/subDays';
|
|
||||||
import getUnixTime from 'date-fns/getUnixTime';
|
|
||||||
import fromUnixTime from 'date-fns/fromUnixTime';
|
import fromUnixTime from 'date-fns/fromUnixTime';
|
||||||
import format from 'date-fns/format';
|
import format from 'date-fns/format';
|
||||||
import WootDateRangePicker from 'dashboard/components/ui/DateRangePicker.vue';
|
import ReportDateRangeSelector from './components/DateRangeSelector';
|
||||||
|
|
||||||
const REPORTS_KEYS = {
|
const REPORTS_KEYS = {
|
||||||
CONVERSATIONS: 'conversations_count',
|
CONVERSATIONS: 'conversations_count',
|
||||||
|
@ -77,46 +51,18 @@ const REPORTS_KEYS = {
|
||||||
RESOLUTION_COUNT: 'resolutions_count',
|
RESOLUTION_COUNT: 'resolutions_count',
|
||||||
};
|
};
|
||||||
|
|
||||||
const CUSTOM_DATE_RANGE_ID = 5;
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
WootDateRangePicker,
|
ReportDateRangeSelector,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return { from: 0, to: 0, currentSelection: 0 };
|
||||||
currentSelection: 0,
|
|
||||||
currentDateRangeSelection: this.$t('REPORT.DATE_RANGE')[0],
|
|
||||||
dateRange: this.$t('REPORT.DATE_RANGE'),
|
|
||||||
customDateRange: [new Date(), new Date()],
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
...mapGetters({
|
||||||
accountSummary: 'getAccountSummary',
|
accountSummary: 'getAccountSummary',
|
||||||
accountReport: 'getAccountReports',
|
accountReport: 'getAccountReports',
|
||||||
}),
|
}),
|
||||||
to() {
|
|
||||||
if (this.isDateRangeSelected) {
|
|
||||||
return this.fromCustomDate(this.customDateRange[1]);
|
|
||||||
}
|
|
||||||
return this.fromCustomDate(new Date());
|
|
||||||
},
|
|
||||||
from() {
|
|
||||||
if (this.isDateRangeSelected) {
|
|
||||||
return this.fromCustomDate(this.customDateRange[0]);
|
|
||||||
}
|
|
||||||
const dateRange = {
|
|
||||||
0: 6,
|
|
||||||
1: 29,
|
|
||||||
2: 89,
|
|
||||||
3: 179,
|
|
||||||
4: 364,
|
|
||||||
};
|
|
||||||
const diff = dateRange[this.currentDateRangeSelection.id];
|
|
||||||
const fromDate = subDays(new Date(), diff);
|
|
||||||
return this.fromCustomDate(fromDate);
|
|
||||||
},
|
|
||||||
collection() {
|
collection() {
|
||||||
if (this.accountReport.isFetching) {
|
if (this.accountReport.isFetching) {
|
||||||
return {};
|
return {};
|
||||||
|
@ -152,32 +98,11 @@ export default {
|
||||||
DESC: this.$t(`REPORT.METRICS.${key}.DESC`),
|
DESC: this.$t(`REPORT.METRICS.${key}.DESC`),
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
isDateRangeSelected() {
|
|
||||||
return this.currentDateRangeSelection.id === CUSTOM_DATE_RANGE_ID;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.fetchAllData();
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
fetchAllData() {
|
fetchAllData() {
|
||||||
const { from, to } = this;
|
const { from, to } = this;
|
||||||
this.$store.dispatch('fetchAccountSummary', {
|
this.$store.dispatch('fetchAccountSummary', { from, to });
|
||||||
from,
|
|
||||||
to,
|
|
||||||
});
|
|
||||||
this.$store.dispatch('fetchAccountReport', {
|
|
||||||
metric: this.metrics[this.currentSelection].KEY,
|
|
||||||
from,
|
|
||||||
to,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
changeDateSelection(selectedRange) {
|
|
||||||
this.currentDateRangeSelection = selectedRange;
|
|
||||||
this.fetchAllData();
|
|
||||||
},
|
|
||||||
changeSelection(index) {
|
|
||||||
this.currentSelection = index;
|
|
||||||
this.fetchChartData();
|
this.fetchChartData();
|
||||||
},
|
},
|
||||||
fetchChartData() {
|
fetchChartData() {
|
||||||
|
@ -190,23 +115,17 @@ export default {
|
||||||
},
|
},
|
||||||
downloadAgentReports() {
|
downloadAgentReports() {
|
||||||
const { from, to } = this;
|
const { from, to } = this;
|
||||||
this.$store.dispatch('downloadAgentReports', {
|
this.$store.dispatch('downloadAgentReports', { from, to });
|
||||||
from,
|
|
||||||
to,
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
fromCustomDate(date) {
|
changeSelection(index) {
|
||||||
return getUnixTime(startOfDay(date));
|
this.currentSelection = index;
|
||||||
|
this.fetchChartData();
|
||||||
},
|
},
|
||||||
onChange(value) {
|
onDateRangeChange({ from, to }) {
|
||||||
this.customDateRange = value;
|
this.from = from;
|
||||||
|
this.to = to;
|
||||||
this.fetchAllData();
|
this.fetchAllData();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
|
||||||
.range-selector {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="csat--table-container">
|
<div class="csat--table-container">
|
||||||
<ve-table
|
<ve-table
|
||||||
max-height="calc(100vh - 30rem)"
|
max-height="calc(100vh - 35rem)"
|
||||||
:fixed-header="true"
|
:fixed-header="true"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:table-data="tableData"
|
:table-data="tableData"
|
||||||
|
@ -25,12 +25,14 @@ import { VeTable, VePagination } from 'vue-easytable';
|
||||||
import UserAvatarWithName from 'dashboard/components/widgets/UserAvatarWithName';
|
import UserAvatarWithName from 'dashboard/components/widgets/UserAvatarWithName';
|
||||||
import { CSAT_RATINGS } from 'shared/constants/messages';
|
import { CSAT_RATINGS } from 'shared/constants/messages';
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
|
import timeMixin from 'dashboard/mixins/time';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
VeTable,
|
VeTable,
|
||||||
VePagination,
|
VePagination,
|
||||||
},
|
},
|
||||||
|
mixins: [timeMixin],
|
||||||
props: {
|
props: {
|
||||||
pageIndex: {
|
pageIndex: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
@ -93,6 +95,7 @@ export default {
|
||||||
key: 'feedbackText',
|
key: 'feedbackText',
|
||||||
title: this.$t('CSAT_REPORTS.TABLE.HEADER.FEEDBACK_TEXT'),
|
title: this.$t('CSAT_REPORTS.TABLE.HEADER.FEEDBACK_TEXT'),
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
width: 400,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'converstionId',
|
field: 'converstionId',
|
||||||
|
@ -106,9 +109,14 @@ export default {
|
||||||
params: { conversation_id: row.conversationId },
|
params: { conversation_id: row.conversationId },
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<router-link to={routerParams}>
|
<div class="text-right">
|
||||||
{`#${row.conversationId}`}
|
<router-link to={routerParams}>
|
||||||
</router-link>
|
{`#${row.conversationId}`}
|
||||||
|
</router-link>
|
||||||
|
<div class="csat--timestamp" v-tooltip={row.createdAt}>
|
||||||
|
{row.createdAgo}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -121,6 +129,8 @@ export default {
|
||||||
rating: response.rating,
|
rating: response.rating,
|
||||||
feedbackText: response.feedback_message || '---',
|
feedbackText: response.feedback_message || '---',
|
||||||
conversationId: response.conversation_id,
|
conversationId: response.conversation_id,
|
||||||
|
createdAgo: this.dynamicTime(response.created_at),
|
||||||
|
createdAt: this.messageStamp(response.created_at, 'LLL d yyyy, h:mm a'),
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -188,4 +198,9 @@ export default {
|
||||||
margin-top: -1px;
|
margin-top: -1px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.csat--timestamp {
|
||||||
|
color: var(--b-400);
|
||||||
|
font-size: var(--font-size-small);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -0,0 +1,91 @@
|
||||||
|
<template>
|
||||||
|
<div class="flex-container flex-dir-column medium-flex-dir-row">
|
||||||
|
<div class="small-12 medium-3 pull-right">
|
||||||
|
<multiselect
|
||||||
|
v-model="currentDateRangeSelection"
|
||||||
|
track-by="name"
|
||||||
|
label="name"
|
||||||
|
:placeholder="$t('FORMS.MULTISELECT.SELECT_ONE')"
|
||||||
|
selected-label
|
||||||
|
:select-label="$t('FORMS.MULTISELECT.ENTER_TO_SELECT')"
|
||||||
|
deselect-label=""
|
||||||
|
:options="dateRange"
|
||||||
|
:searchable="false"
|
||||||
|
:allow-empty="false"
|
||||||
|
@select="changeDateSelection"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<woot-date-range-picker
|
||||||
|
v-if="isDateRangeSelected"
|
||||||
|
:value="customDateRange"
|
||||||
|
:confirm-text="$t('REPORT.CUSTOM_DATE_RANGE.CONFIRM')"
|
||||||
|
:placeholder="$t('REPORT.CUSTOM_DATE_RANGE.PLACEHOLDER')"
|
||||||
|
@change="onChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import WootDateRangePicker from 'dashboard/components/ui/DateRangePicker.vue';
|
||||||
|
const CUSTOM_DATE_RANGE_ID = 5;
|
||||||
|
import subDays from 'date-fns/subDays';
|
||||||
|
import startOfDay from 'date-fns/startOfDay';
|
||||||
|
import getUnixTime from 'date-fns/getUnixTime';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
WootDateRangePicker,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
currentDateRangeSelection: this.$t('REPORT.DATE_RANGE')[0],
|
||||||
|
dateRange: this.$t('REPORT.DATE_RANGE'),
|
||||||
|
customDateRange: [new Date(), new Date()],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
isDateRangeSelected() {
|
||||||
|
return this.currentDateRangeSelection.id === CUSTOM_DATE_RANGE_ID;
|
||||||
|
},
|
||||||
|
to() {
|
||||||
|
if (this.isDateRangeSelected) {
|
||||||
|
return this.fromCustomDate(this.customDateRange[1]);
|
||||||
|
}
|
||||||
|
return this.fromCustomDate(new Date());
|
||||||
|
},
|
||||||
|
from() {
|
||||||
|
if (this.isDateRangeSelected) {
|
||||||
|
return this.fromCustomDate(this.customDateRange[0]);
|
||||||
|
}
|
||||||
|
const dateRange = {
|
||||||
|
0: 6,
|
||||||
|
1: 29,
|
||||||
|
2: 89,
|
||||||
|
3: 179,
|
||||||
|
4: 364,
|
||||||
|
};
|
||||||
|
const diff = dateRange[this.currentDateRangeSelection.id];
|
||||||
|
const fromDate = subDays(new Date(), diff);
|
||||||
|
return this.fromCustomDate(fromDate);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.onDateRangeChange();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onDateRangeChange() {
|
||||||
|
this.$emit('date-range-change', { from: this.from, to: this.to });
|
||||||
|
},
|
||||||
|
fromCustomDate(date) {
|
||||||
|
return getUnixTime(startOfDay(date));
|
||||||
|
},
|
||||||
|
changeDateSelection(selectedRange) {
|
||||||
|
this.currentDateRangeSelection = selectedRange;
|
||||||
|
this.onDateRangeChange();
|
||||||
|
},
|
||||||
|
onChange(value) {
|
||||||
|
this.customDateRange = value;
|
||||||
|
this.onDateRangeChange();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
|
@ -82,10 +82,10 @@ export const getters = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const actions = {
|
export const actions = {
|
||||||
get: async function getResponses({ commit }, { page = 1 } = {}) {
|
get: async function getResponses({ commit }, { page = 1, from, to } = {}) {
|
||||||
commit(types.SET_CSAT_RESPONSE_UI_FLAG, { isFetching: true });
|
commit(types.SET_CSAT_RESPONSE_UI_FLAG, { isFetching: true });
|
||||||
try {
|
try {
|
||||||
const response = await CSATReports.get({ page });
|
const response = await CSATReports.get({ page, from, to });
|
||||||
commit(types.SET_CSAT_RESPONSE, response.data);
|
commit(types.SET_CSAT_RESPONSE, response.data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Ignore error
|
// Ignore error
|
||||||
|
@ -93,10 +93,10 @@ export const actions = {
|
||||||
commit(types.SET_CSAT_RESPONSE_UI_FLAG, { isFetching: false });
|
commit(types.SET_CSAT_RESPONSE_UI_FLAG, { isFetching: false });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getMetrics: async function getMetrics({ commit }) {
|
getMetrics: async function getMetrics({ commit }, { from, to }) {
|
||||||
commit(types.SET_CSAT_RESPONSE_UI_FLAG, { isFetchingMetrics: true });
|
commit(types.SET_CSAT_RESPONSE_UI_FLAG, { isFetchingMetrics: true });
|
||||||
try {
|
try {
|
||||||
const response = await CSATReports.getMetrics();
|
const response = await CSATReports.getMetrics({ from, to });
|
||||||
commit(types.SET_CSAT_RESPONSE_METRICS, response.data);
|
commit(types.SET_CSAT_RESPONSE_METRICS, response.data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Ignore error
|
// Ignore error
|
||||||
|
|
|
@ -101,7 +101,7 @@ export default {
|
||||||
},
|
},
|
||||||
readableTime() {
|
readableTime() {
|
||||||
const { created_at: createdAt = '' } = this.message;
|
const { created_at: createdAt = '' } = this.message;
|
||||||
return this.messageStamp(createdAt);
|
return this.messageStamp(createdAt, 'LLL d yyyy, h:mm a');
|
||||||
},
|
},
|
||||||
messageType() {
|
messageType() {
|
||||||
const { message_type: type = 1 } = this.message;
|
const { message_type: type = 1 } = this.message;
|
||||||
|
|
|
@ -14,4 +14,4 @@ if resource.assigned_agent
|
||||||
json.partial! 'api/v1/models/agent.json.jbuilder', resource: resource.assigned_agent
|
json.partial! 'api/v1/models/agent.json.jbuilder', resource: resource.assigned_agent
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
json.created_at resource.created_at
|
json.created_at resource.created_at.to_i
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue