feat: Format time in reports (#4072)

Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
Aswin Dev P.S 2022-02-28 16:54:43 +05:30 committed by GitHub
parent aff14b697f
commit 12c0be002e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 14 deletions

View file

@ -21,8 +21,9 @@
}
.metric {
font-size: $font-size-bigger;
font-size: $font-size-big;
font-weight: $font-weight-feather;
margin-top: $space-smaller;
}
.desc {

View file

@ -5,6 +5,7 @@ import * as types from '../mutation-types';
import Report from '../../api/reports';
import { downloadCsvFile } from '../../helper/downloadCsvFile';
import { formatTime } from '@chatwoot/utils';
const state = {
fetchingStatus: false,
@ -127,18 +128,12 @@ const mutations = {
// Average First Response Time
let avgFirstResTimeInHr = 0;
if (summaryData.avg_first_response_time) {
avgFirstResTimeInHr = (
summaryData.avg_first_response_time / 3600
).toFixed(2);
avgFirstResTimeInHr = `${avgFirstResTimeInHr} Hr`;
avgFirstResTimeInHr = formatTime(summaryData.avg_first_response_time);
}
// Average Resolution Time
let avgResolutionTimeInHr = 0;
if (summaryData.avg_resolution_time) {
avgResolutionTimeInHr = (summaryData.avg_resolution_time / 3600).toFixed(
2
);
avgResolutionTimeInHr = `${avgResolutionTimeInHr} Hr`;
avgResolutionTimeInHr = formatTime(summaryData.avg_resolution_time);
}
_state.accountSummary.avg_first_response_time = avgFirstResTimeInHr;
_state.accountSummary.avg_resolution_time = avgResolutionTimeInHr;

View file

@ -19,7 +19,7 @@
"dependencies": {
"@braid/vue-formulate": "^2.5.2",
"@chatwoot/prosemirror-schema": "https://github.com/chatwoot/prosemirror-schema.git#7e8acadd10d7b932c0dc0bd0a18f804434f83517",
"@chatwoot/utils": "^0.0.3",
"@chatwoot/utils": "^0.0.4",
"@hcaptcha/vue-hcaptcha": "^0.3.2",
"@rails/actioncable": "6.1.3",
"@rails/webpacker": "5.3.0",

View file

@ -1111,10 +1111,12 @@
prosemirror-state "^1.3.3"
prosemirror-view "^1.17.2"
"@chatwoot/utils@^0.0.3":
version "0.0.3"
resolved "https://registry.yarnpkg.com/@chatwoot/utils/-/utils-0.0.3.tgz#40fbb6c6d1aed853b3c5189d0f4979d3ca185a2f"
integrity sha512-2KbA1r34IM2U58CUvsC9dEN3gsx5Dcc6uD1iHPFNC3zTsg8Tb+K7IQXxfZt+VAvV0fbniLzCuXt6h81Ds0aj6Q==
"@chatwoot/utils@^0.0.4":
version "0.0.4"
resolved "https://registry.yarnpkg.com/@chatwoot/utils/-/utils-0.0.4.tgz#519c0e0ace4d01e821bf24e36111ea7ed82da451"
integrity sha512-giL85pBJWPmUKM+AOpeWeWvsuUJrHdSAJ4RKaQh/YNQhb8AjKxdx476s7UTaKd5DV+OnCpWtmHtNV+38CAC6lw==
dependencies:
date-fns "^2.22.1"
"@cnakazawa/watch@^1.0.3":
version "1.0.4"
@ -5462,6 +5464,11 @@ date-fns@^1.27.2:
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c"
integrity sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==
date-fns@^2.22.1:
version "2.28.0"
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.28.0.tgz#9570d656f5fc13143e50c975a3b6bbeb46cd08b2"
integrity sha512-8d35hViGYx/QH0icHYCeLmsLmMUheMmTyV9Fcm6gvNwdw31yXXH+O85sOBJ+OLnLQMKZowvpKb6FgMIQjcpvQw==
date-format-parse@^0.2.6:
version "0.2.6"
resolved "https://registry.yarnpkg.com/date-format-parse/-/date-format-parse-0.2.6.tgz#7ed42817efb6ec39532169eada9670ae3c627aa7"