diff --git a/files/client/custom/modules/smart-assistant/src/views/dashlets/smart-assistant.js b/files/client/custom/modules/smart-assistant/src/views/dashlets/smart-assistant.js
index cf32bfd..fc6628a 100644
--- a/files/client/custom/modules/smart-assistant/src/views/dashlets/smart-assistant.js
+++ b/files/client/custom/modules/smart-assistant/src/views/dashlets/smart-assistant.js
@@ -11,32 +11,48 @@ define('modules/smart-assistant/views/dashlets/smart-assistant', ['view'], funct
templateContent: '' +
'
' +
+ var active = self._activeType === c.type;
+ var border = active ? '2px solid ' + c.color : '2px solid transparent';
+ var cursor = c.value > 0 ? 'pointer' : 'default';
+ html += '
' +
'
' + c.value + '
' +
'
' + c.label + '
' +
'
';
@@ -45,10 +61,34 @@ define('modules/smart-assistant/views/dashlets/smart-assistant', ['view'], funct
this.$el.find('.sa-dashlet-cards').html(html);
},
- renderAlerts: function (alerts) {
- var $alerts = this.$el.find('.sa-dashlet-alerts');
- if (alerts.length === 0) {
- $alerts.html('
אין התראות
');
+ showDetail: function (type) {
+ var $detail = this.$el.find('.sa-dashlet-detail');
+
+ if (!type || type === this._activeType && $detail.html()) {
+ this._activeType = null;
+ $detail.html('');
+ this.renderCards(this._summary);
+ return;
+ }
+
+ this._activeType = type;
+ this.renderCards(this._summary);
+
+ var alerts = this._alerts;
+ var items = [];
+
+ if (type === 'overdue') {
+ items = alerts.filter(function (a) { return a.type === 'overdue_task'; });
+ } else if (type === 'hearings') {
+ items = alerts.filter(function (a) { return a.type === 'hearing_no_prep'; });
+ } else if (type === 'attention') {
+ items = alerts.filter(function (a) { return a.severity === 'critical' || a.severity === 'warning'; });
+ } else if (type === 'open') {
+ items = alerts.filter(function (a) { return a.type === 'inactive_case' || a.type === 'unassigned_case'; });
+ }
+
+ if (items.length === 0) {
+ $detail.html('
אין פריטים להצגה
');
return;
}
@@ -56,17 +96,19 @@ define('modules/smart-assistant/views/dashlets/smart-assistant', ['view'], funct
var severityIcons = {critical: 'fa-exclamation-circle', warning: 'fa-exclamation-triangle', info: 'fa-info-circle'};
var html = '';
- alerts.slice(0, 10).forEach(function (a) {
+ items.forEach(function (a) {
var color = severityColors[a.severity] || '#333';
var icon = severityIcons[a.severity] || 'fa-circle';
+ var link = a.caseId ? '
' : '';
+ var linkEnd = a.caseId ? '' : '';
- html += '
' +
+ html += '
' +
'' +
- '' + Espo.Utils.escapeString(a.message) + '' +
+ link + Espo.Utils.escapeString(a.message) + linkEnd +
'
';
});
- $alerts.html(html);
+ $detail.html(html);
},
actionRefresh: function () {