displays statues in timelogs
This commit is contained in:
Родитель
e22158550d
Коммит
2f3806e38f
20
app.js
20
app.js
|
@ -85,14 +85,26 @@
|
|||
|
||||
onFetchAuditsDone: function(data) {
|
||||
var timelogs = _.reduce(data.audits, function(memo, audit) {
|
||||
var event = _.find(audit.events, function(event) {
|
||||
var newStatus = _.find(audit.events, function(event) {
|
||||
return event.field_name == 'status';
|
||||
}, this),
|
||||
event = _.find(audit.events, function(event) {
|
||||
return event.field_name == this.setting('time_field_id');
|
||||
}, this);
|
||||
}, this),
|
||||
status;
|
||||
|
||||
if (event) {
|
||||
if (newStatus){
|
||||
status = newStatus.value;
|
||||
} else {
|
||||
status = _.last(memo).status;
|
||||
}
|
||||
|
||||
memo.push({
|
||||
time: this.TimeHelper.secondsToTimeString(parseInt(event.value, 0)),
|
||||
date: new Date(audit.created_at).toLocaleString(),
|
||||
status: status,
|
||||
localized_status: this.I18n.t(helpers.fmt('statuses.%@', status)),
|
||||
user: _.find(data.users, function(user) {
|
||||
return user.id === audit.author_id;
|
||||
})
|
||||
|
@ -217,6 +229,8 @@
|
|||
|
||||
}));
|
||||
|
||||
this.$('tr').tooltip({ placement: 'left', html: true });
|
||||
|
||||
this.$('.timelogs-opener')
|
||||
.removeAttr('disabled')
|
||||
.removeClass('disabled');
|
||||
|
@ -310,7 +324,7 @@
|
|||
TimeHelper: {
|
||||
secondsToTimeString: function(seconds) {
|
||||
var hours = Math.floor(seconds / 3600),
|
||||
minutes = Math.floor((seconds - (hours * 3600)) / 60);
|
||||
minutes = Math.floor((seconds - (hours * 3600)) / 60),
|
||||
secs = seconds - (hours * 3600) - (minutes * 60);
|
||||
|
||||
return helpers.fmt('%@:%@:%@',
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
{{#if timelogs}}
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th>{{t "views.main.timelogs_table.date"}}</th>
|
||||
<th>{{t "views.main.timelogs_table.status"}}</th>
|
||||
<th>{{t "views.main.timelogs_table.agent"}}</th>
|
||||
<th>{{t "views.main.timelogs_table.time"}}</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each timelogs}}
|
||||
<tr>
|
||||
<td>{{date}}</td>
|
||||
<tr data-toggle="tooltip" title="{{date}}">
|
||||
<td>
|
||||
<span class="ticket_status_label {{status}}">
|
||||
<strong>{{localized_status}}</strong>
|
||||
</span>
|
||||
</td>
|
||||
<td>{{user.name}}</td>
|
||||
<td>{{time}}</td>
|
||||
</tr>
|
||||
|
@ -18,4 +22,4 @@
|
|||
<div class="text-center">
|
||||
<a download="{{csv_filename}}" href="data:text/csv;charset=utf-8,{{csv_string}}" class="btn"><i class="icon-file"></i> CSV Timelogs</a>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
|
|
@ -37,6 +37,13 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"statuses": {
|
||||
"new": "n",
|
||||
"open": "o",
|
||||
"pending": "p",
|
||||
"hold": "h",
|
||||
"solved": "s"
|
||||
},
|
||||
"views": {
|
||||
"main": {
|
||||
"pause": "Pause",
|
||||
|
@ -48,7 +55,7 @@
|
|||
"timelogs_table": {
|
||||
"agent": "Agent",
|
||||
"time": "Time",
|
||||
"date": "Date"
|
||||
"status": "Status"
|
||||
}
|
||||
},
|
||||
"modal": {
|
||||
|
|
Загрузка…
Ссылка в новой задаче