principal-dashboard-lib-v2 0.0.35 → 0.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/principal-dashboard-lib-v2.umd.js +4560 -0
- package/bundles/principal-dashboard-lib-v2.umd.js.map +1 -0
- package/bundles/principal-dashboard-lib-v2.umd.min.js +2 -0
- package/bundles/principal-dashboard-lib-v2.umd.min.js.map +1 -0
- package/esm2015/lib/chartheader/chartheader.component.js +63 -0
- package/esm2015/lib/chartview/chartview.component.js +508 -0
- package/esm2015/lib/detailedview/detailedview.component.js +180 -0
- package/esm2015/lib/exceldata.service.js +651 -0
- package/esm2015/lib/full-table-view/full-table-view.component.js +312 -0
- package/esm2015/lib/header/header.component.js +187 -0
- package/esm2015/lib/insights/insights.component.js +519 -0
- package/esm2015/lib/principal-dashboard-lib-v2.component.js +42 -0
- package/esm2015/lib/principal-dashboard-lib-v2.module.js +41 -0
- package/esm2015/lib/principal-dashboard-lib-v2.service.js +843 -0
- package/esm2015/lib/small-table-view/small-table-view.component.js +362 -0
- package/esm2015/lib/tableview/tableview.component.js +220 -0
- package/esm2015/lib/timeline/timeline.component.js +195 -0
- package/esm2015/principal-dashboard-lib-v2.js +15 -0
- package/esm2015/public-api.js +7 -0
- package/fesm2015/principal-dashboard-lib-v2.js +4097 -0
- package/fesm2015/principal-dashboard-lib-v2.js.map +1 -0
- package/lib/chartheader/chartheader.component.d.ts +20 -0
- package/lib/chartview/chartview.component.d.ts +82 -0
- package/lib/detailedview/detailedview.component.d.ts +20 -0
- package/lib/exceldata.service.d.ts +18 -0
- package/lib/full-table-view/full-table-view.component.d.ts +31 -0
- package/lib/header/header.component.d.ts +41 -0
- package/lib/insights/insights.component.d.ts +100 -0
- package/lib/principal-dashboard-lib-v2.component.d.ts +14 -0
- package/lib/principal-dashboard-lib-v2.module.d.ts +2 -0
- package/lib/principal-dashboard-lib-v2.service.d.ts +66 -0
- package/lib/small-table-view/small-table-view.component.d.ts +48 -0
- package/lib/tableview/tableview.component.d.ts +30 -0
- package/lib/timeline/timeline.component.d.ts +76 -0
- package/package.json +10 -2
- package/principal-dashboard-lib-v2.d.ts +14 -0
- package/principal-dashboard-lib-v2.metadata.json +1 -0
- package/{src/public-api.ts → public-api.d.ts} +0 -4
- package/karma.conf.js +0 -44
- package/ng-package.json +0 -7
- package/src/lib/chartheader/chartheader.component.html +0 -13
- package/src/lib/chartheader/chartheader.component.scss +0 -66
- package/src/lib/chartheader/chartheader.component.spec.ts +0 -25
- package/src/lib/chartheader/chartheader.component.ts +0 -51
- package/src/lib/chartview/chartview.component -Backup.ts +0 -1096
- package/src/lib/chartview/chartview.component.html +0 -60
- package/src/lib/chartview/chartview.component.scss +0 -136
- package/src/lib/chartview/chartview.component.spec.ts +0 -25
- package/src/lib/chartview/chartview.component.ts +0 -470
- package/src/lib/detailedview/detailedview.component.html +0 -7
- package/src/lib/detailedview/detailedview.component.scss +0 -55
- package/src/lib/detailedview/detailedview.component.spec.ts +0 -25
- package/src/lib/detailedview/detailedview.component.ts +0 -199
- package/src/lib/exceldata.service.spec.ts +0 -16
- package/src/lib/exceldata.service.ts +0 -672
- package/src/lib/full-table-view/full-table-view.component.html +0 -49
- package/src/lib/full-table-view/full-table-view.component.scss +0 -51
- package/src/lib/full-table-view/full-table-view.component.spec.ts +0 -25
- package/src/lib/full-table-view/full-table-view.component.ts +0 -219
- package/src/lib/header/header.component -backup.ts +0 -120
- package/src/lib/header/header.component.html +0 -20
- package/src/lib/header/header.component.scss +0 -133
- package/src/lib/header/header.component.spec.ts +0 -25
- package/src/lib/header/header.component.ts +0 -205
- package/src/lib/principal-dashboard-lib-v2.component.html +0 -18
- package/src/lib/principal-dashboard-lib-v2.component.scss +0 -17
- package/src/lib/principal-dashboard-lib-v2.component.spec.ts +0 -25
- package/src/lib/principal-dashboard-lib-v2.component.ts +0 -32
- package/src/lib/principal-dashboard-lib-v2.module.ts +0 -37
- package/src/lib/principal-dashboard-lib-v2.service - Copy.ts +0 -585
- package/src/lib/principal-dashboard-lib-v2.service.spec.ts +0 -16
- package/src/lib/principal-dashboard-lib-v2.service.ts +0 -913
- package/src/lib/small-table-view/small-table-view.component.html +0 -53
- package/src/lib/small-table-view/small-table-view.component.scss +0 -65
- package/src/lib/small-table-view/small-table-view.component.spec.ts +0 -25
- package/src/lib/small-table-view/small-table-view.component.ts +0 -292
- package/src/lib/tableview/tableview.component.html +0 -27
- package/src/lib/tableview/tableview.component.scss +0 -31
- package/src/lib/tableview/tableview.component.spec.ts +0 -25
- package/src/lib/tableview/tableview.component.ts +0 -267
- package/src/test.ts +0 -26
- package/tsconfig.lib.json +0 -25
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -17
- package/tslint.json +0 -17
|
@@ -0,0 +1,4560 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('angular-google-charts'), require('file-saver'), require('xlsx'), require('@angular/common'), require('ng2-datepicker'), require('html2canvas'), require('jspdf')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('principal-dashboard-lib-v2', ['exports', '@angular/core', 'rxjs', 'angular-google-charts', 'file-saver', 'xlsx', '@angular/common', 'ng2-datepicker', 'html2canvas', 'jspdf'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['principal-dashboard-lib-v2'] = {}, global.ng.core, global.rxjs, global.angularGoogleCharts, global.FileSaver, global.XLSX, global.ng.common, global.ng2Datepicker, global.html2canvas, global.jspdf));
|
|
5
|
+
}(this, (function (exports, i0, rxjs, angularGoogleCharts, FileSaver, XLSX, common, ng2Datepicker, html2canvas, jspdf) { 'use strict';
|
|
6
|
+
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var html2canvas__default = /*#__PURE__*/_interopDefaultLegacy(html2canvas);
|
|
10
|
+
|
|
11
|
+
var PrincipalDashboardLibV2Service = /** @class */ (function () {
|
|
12
|
+
function PrincipalDashboardLibV2Service() {
|
|
13
|
+
this.isResoureMetaDataReady = new rxjs.ReplaySubject();
|
|
14
|
+
this.isResoureMetaDataReady$ = this.isResoureMetaDataReady.asObservable();
|
|
15
|
+
this.isUserReqiuredDataReady = new rxjs.ReplaySubject();
|
|
16
|
+
this.isUserReqiuredDataReady$ = this.isUserReqiuredDataReady.asObservable();
|
|
17
|
+
this.mychartType = '';
|
|
18
|
+
this.dataType = '';
|
|
19
|
+
this.userAllData = '';
|
|
20
|
+
this.userMetadata = { userDetails: [], resourceDetails: [] };
|
|
21
|
+
this.resoureMetadata = new Array();
|
|
22
|
+
this.userDetailObject = {};
|
|
23
|
+
this.userlist = false;
|
|
24
|
+
//for change chart Type
|
|
25
|
+
this.chartType = new rxjs.BehaviorSubject(this.mychartType);
|
|
26
|
+
this.chartType$ = this.chartType.asObservable();
|
|
27
|
+
//for change userWise To classRoom wise or vice versa
|
|
28
|
+
this.isUserWise_data = new rxjs.BehaviorSubject(true);
|
|
29
|
+
this.isUserWise_data$ = this.isUserWise_data.asObservable();
|
|
30
|
+
// for all user and current user information
|
|
31
|
+
this.isAllUsers = new rxjs.BehaviorSubject(this.userlist);
|
|
32
|
+
this.isAllUsers$ = this.isAllUsers.asObservable();
|
|
33
|
+
//for get details of selected user
|
|
34
|
+
this.detailedviewData = new rxjs.BehaviorSubject(this.userMetadata);
|
|
35
|
+
this.detailedviewData$ = this.detailedviewData.asObservable();
|
|
36
|
+
// true while the Insights tab is selected instead of the user / classroom views
|
|
37
|
+
this.isInsightsView = new rxjs.BehaviorSubject(false);
|
|
38
|
+
this.isInsightsView$ = this.isInsightsView.asObservable();
|
|
39
|
+
this.openSmallTable = new rxjs.BehaviorSubject(false);
|
|
40
|
+
// colour of the timeline bar that opened the details popup
|
|
41
|
+
this.detailAccentColor = '';
|
|
42
|
+
// set when the popup should list every session of a timeline row instead of one session
|
|
43
|
+
this.detailRowRequest = null;
|
|
44
|
+
this.openSmallTable$ = this.openSmallTable.asObservable();
|
|
45
|
+
}
|
|
46
|
+
PrincipalDashboardLibV2Service.prototype.genarateResourseReqiuredData = function (data) {
|
|
47
|
+
this.isResoureMetaDataReady.next(false);
|
|
48
|
+
var resourceMetadataMatrix = new Array();
|
|
49
|
+
if (data && data !== null) {
|
|
50
|
+
var resouseID = void 0;
|
|
51
|
+
var title = void 0;
|
|
52
|
+
var subject = void 0;
|
|
53
|
+
var grade = void 0;
|
|
54
|
+
var chapter = void 0;
|
|
55
|
+
var teachingPoint = void 0;
|
|
56
|
+
var type = void 0;
|
|
57
|
+
var resourceMetadata = data.resourcesMetadata.resourceMetadata;
|
|
58
|
+
if (resourceMetadata != undefined && resourceMetadata.length > 0) {
|
|
59
|
+
for (var i = 0; i < resourceMetadata.length; i++) {
|
|
60
|
+
//----------//resouseID
|
|
61
|
+
resouseID = resourceMetadata[i].resourceId;
|
|
62
|
+
//----------//subject
|
|
63
|
+
if (resourceMetadata[i].subject != undefined) {
|
|
64
|
+
if (resourceMetadata[i].subject.title != undefined) {
|
|
65
|
+
subject = resourceMetadata[i].subject.title;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
subject = '';
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
subject = '';
|
|
73
|
+
}
|
|
74
|
+
//----------//grade
|
|
75
|
+
if (resourceMetadata[i].grade != undefined) {
|
|
76
|
+
if (resourceMetadata[i].grade.title != undefined) {
|
|
77
|
+
grade = resourceMetadata[i].grade.title;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
grade = '';
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
grade = '';
|
|
85
|
+
}
|
|
86
|
+
//----------//chapter
|
|
87
|
+
//console.log('LOOKCHP',resourceMetadata[i].chapter)
|
|
88
|
+
if (resourceMetadata[i].chapter != undefined) {
|
|
89
|
+
if (resourceMetadata[i].chapter.title != undefined) {
|
|
90
|
+
chapter = resourceMetadata[i].chapter.title;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
chapter = '';
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
chapter = '';
|
|
98
|
+
}
|
|
99
|
+
//----------//teachingPoint
|
|
100
|
+
//console.log('LOOKTP',resourceMetadata[i].teachingPoint)
|
|
101
|
+
if (resourceMetadata[i].teachingPoint != undefined) {
|
|
102
|
+
if (resourceMetadata[i].teachingPoint.title != undefined) {
|
|
103
|
+
teachingPoint = resourceMetadata[i].teachingPoint.title;
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
//teachingPoint = '<span style="color:lightgray;">--</span>';
|
|
107
|
+
teachingPoint = '';
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
//teachingPoint = '<span style="color:lightgray;">--</span>';
|
|
112
|
+
teachingPoint = '';
|
|
113
|
+
}
|
|
114
|
+
//----------//type
|
|
115
|
+
if (resourceMetadata[i].type != undefined) {
|
|
116
|
+
type = this.getDisplaytypeValue(resourceMetadata[i].type);
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
type = '';
|
|
120
|
+
}
|
|
121
|
+
//----------//title
|
|
122
|
+
if (resourceMetadata[i].title != undefined) {
|
|
123
|
+
title = resourceMetadata[i].title;
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
title = '';
|
|
127
|
+
}
|
|
128
|
+
var resourceMetauserConsoleData = {
|
|
129
|
+
resouseID: resouseID,
|
|
130
|
+
subject: subject,
|
|
131
|
+
grade: grade,
|
|
132
|
+
chapter: chapter,
|
|
133
|
+
teachingPoint: teachingPoint,
|
|
134
|
+
type: type,
|
|
135
|
+
title: title
|
|
136
|
+
};
|
|
137
|
+
resourceMetadataMatrix.push(resourceMetauserConsoleData);
|
|
138
|
+
this.resoureMetaData = resourceMetadataMatrix;
|
|
139
|
+
this.isResoureMetaDataReady.next(true);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
// this.resoureMetaData = resourceMetadataMatrix;
|
|
144
|
+
return resourceMetadataMatrix;
|
|
145
|
+
};
|
|
146
|
+
PrincipalDashboardLibV2Service.prototype.getName = function (user) {
|
|
147
|
+
if (/School Admin/gm.exec(user.role)) {
|
|
148
|
+
return "Support Admin";
|
|
149
|
+
}
|
|
150
|
+
return user.fullName;
|
|
151
|
+
};
|
|
152
|
+
PrincipalDashboardLibV2Service.prototype.genarateUserReqiuredData = function (data) {
|
|
153
|
+
this.isUserReqiuredDataReady.next(false);
|
|
154
|
+
var usersMetadataMatrix = new Array();
|
|
155
|
+
var usermetadataMatrixUpdated = new Array();
|
|
156
|
+
var schoolTerminalMatrix = new Array();
|
|
157
|
+
var userConsoleMatrix = new Array();
|
|
158
|
+
if (data && data !== null) {
|
|
159
|
+
var userConsole = data.usersConsole.userConsole;
|
|
160
|
+
var usersMetadata = data.usersMetadata.userMetadata;
|
|
161
|
+
var schoolTerminal = data.schoolTerminals.schoolTerminal;
|
|
162
|
+
if (usersMetadata != null && usersMetadata.length > 0) {
|
|
163
|
+
for (var i_1 = 0; i_1 < usersMetadata.length; i_1++) {
|
|
164
|
+
var userId = void 0;
|
|
165
|
+
var userName = void 0;
|
|
166
|
+
var userSubjects = void 0;
|
|
167
|
+
var listOfUser = {};
|
|
168
|
+
if (usersMetadata[i_1].userId != "") {
|
|
169
|
+
userId = usersMetadata[i_1].userId;
|
|
170
|
+
//console.log("--chartDataUserWise-->>",usersMetadata[i].terminalIP)
|
|
171
|
+
if (usersMetadata[i_1].fullName !== undefined) {
|
|
172
|
+
userName = this.getName(usersMetadata[i_1]); // get name of user w.r.t. ID
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
userName = '';
|
|
176
|
+
}
|
|
177
|
+
if (usersMetadata[i_1].userSubjects !== undefined) {
|
|
178
|
+
userSubjects = usersMetadata[i_1].userSubjects; // get name of user w.r.t. ID
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
userSubjects = '';
|
|
182
|
+
}
|
|
183
|
+
listOfUser = {
|
|
184
|
+
userId: userId,
|
|
185
|
+
userName: userName,
|
|
186
|
+
userSubjects: userSubjects
|
|
187
|
+
};
|
|
188
|
+
usersMetadataMatrix.push(listOfUser); // array of all users
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
for (var i = 0; i < usersMetadataMatrix.length; i++) {
|
|
193
|
+
//console.log('usersMetadataMatrix-->', usersMetadataMatrix[i].userName)
|
|
194
|
+
usersMetadataMatrix.forEach(function (element) {
|
|
195
|
+
//console.log('element.userName-->>', element.userName)
|
|
196
|
+
if (usersMetadataMatrix[i].userName === element.userName) {
|
|
197
|
+
usermetadataMatrixUpdated.push(usersMetadataMatrix[i]); //array of same name users
|
|
198
|
+
usersMetadataMatrix.splice(i, 1); //delete the same name users from usermetadataMatrix
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
for (var i = 0; i < usermetadataMatrixUpdated.length; i++) {
|
|
203
|
+
// const randomNumber = document.createElement('span');
|
|
204
|
+
// randomNumber.innerHTML = i.toString();
|
|
205
|
+
//usermetadataMatrixUpdated[i].userName = usermetadataMatrixUpdated[i].userName + " --- " + i;
|
|
206
|
+
usermetadataMatrixUpdated[i].userName = usermetadataMatrixUpdated[i].userName;
|
|
207
|
+
usersMetadataMatrix.push(usermetadataMatrixUpdated[i]); //adding same name users in usermetadataMatrix with some random charators
|
|
208
|
+
this.usersMetaData = usersMetadataMatrix;
|
|
209
|
+
}
|
|
210
|
+
if (schoolTerminal != null && schoolTerminal.length > 0) {
|
|
211
|
+
for (var i = 0; i < schoolTerminal.length; i++) {
|
|
212
|
+
var schoolId = void 0;
|
|
213
|
+
var terminalKey = void 0;
|
|
214
|
+
var terminalType = void 0;
|
|
215
|
+
var location = void 0;
|
|
216
|
+
var schoolTerminalData = {};
|
|
217
|
+
//----------//schoolId
|
|
218
|
+
if (schoolTerminal[i].schoolId !== undefined) {
|
|
219
|
+
schoolId = schoolTerminal[i].schoolId; // get name of user w.r.t. ID
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
schoolId = '';
|
|
223
|
+
}
|
|
224
|
+
//----------//terminalKey
|
|
225
|
+
if (schoolTerminal[i].terminalKey !== undefined) {
|
|
226
|
+
terminalKey = schoolTerminal[i].terminalKey; // get name of user w.r.t. ID
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
terminalKey = '';
|
|
230
|
+
}
|
|
231
|
+
//----------//terminalType
|
|
232
|
+
if (schoolTerminal[i].terminalType !== undefined) {
|
|
233
|
+
terminalType = schoolTerminal[i].terminalType; // get name of user w.r.t. ID
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
terminalType = '';
|
|
237
|
+
}
|
|
238
|
+
//----------//location
|
|
239
|
+
if (schoolTerminal[i].metadata !== undefined) {
|
|
240
|
+
var metadataJSON = JSON.parse(schoolTerminal[i].metadata);
|
|
241
|
+
location = metadataJSON.location; // get name of user w.r.t. ID
|
|
242
|
+
//console.log("metadataJSON",location);
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
location = '';
|
|
246
|
+
}
|
|
247
|
+
schoolTerminalData = {
|
|
248
|
+
schoolId: schoolId,
|
|
249
|
+
terminalKey: terminalKey,
|
|
250
|
+
terminalType: terminalType,
|
|
251
|
+
location: location
|
|
252
|
+
};
|
|
253
|
+
//console.log('ccc--',schoolTerminalData)
|
|
254
|
+
schoolTerminalMatrix.push(schoolTerminalData);
|
|
255
|
+
this.schoolTerminalData = schoolTerminalMatrix;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
if (userConsole != null && userConsole.length > 0) {
|
|
259
|
+
var _loop_1 = function (index) {
|
|
260
|
+
var userId = void 0;
|
|
261
|
+
var startTime = void 0;
|
|
262
|
+
var endTime = void 0;
|
|
263
|
+
var duration = void 0;
|
|
264
|
+
var selectedDate = void 0;
|
|
265
|
+
var terminalIP = void 0;
|
|
266
|
+
var userConsoleResources = void 0;
|
|
267
|
+
var resourceMetadataIDS = void 0;
|
|
268
|
+
var resourceMetauserConsoleData = [];
|
|
269
|
+
var resourceDurationFromConsole = [];
|
|
270
|
+
var userName = void 0;
|
|
271
|
+
var userSubjects = void 0;
|
|
272
|
+
var terminalLocation = void 0;
|
|
273
|
+
var launchedFrom = [];
|
|
274
|
+
//console.log('myuserConsole', userConsole[index])
|
|
275
|
+
//----------//user iD
|
|
276
|
+
if (userConsole[index].userId !== undefined) {
|
|
277
|
+
userId = userConsole[index].userId; // get name of user w.r.t. ID
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
userId = '';
|
|
281
|
+
}
|
|
282
|
+
//----------// startTime
|
|
283
|
+
if (userConsole[index].startTime !== undefined) {
|
|
284
|
+
startTime = userConsole[index].startTime; // get name of user w.r.t. ID
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
startTime = '';
|
|
288
|
+
}
|
|
289
|
+
//----------// endTime
|
|
290
|
+
if (userConsole[index].endTime !== undefined) {
|
|
291
|
+
endTime = userConsole[index].endTime; // get name of user w.r.t. ID
|
|
292
|
+
this_1.myEndTime = endTime;
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
endTime = '';
|
|
296
|
+
}
|
|
297
|
+
//----------// Date
|
|
298
|
+
if (userConsole[index].selectedDate !== undefined) {
|
|
299
|
+
selectedDate = userConsole[index].selectedDate; // get name of user w.r.t. ID
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
selectedDate = '';
|
|
303
|
+
}
|
|
304
|
+
//----------// Duration
|
|
305
|
+
if (userConsole[index].duration !== undefined) {
|
|
306
|
+
duration = userConsole[index].duration; // get name of user w.r.t. ID
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
duration = '';
|
|
310
|
+
}
|
|
311
|
+
//----------// terminalIP
|
|
312
|
+
if (userConsole[index].terminalIP !== undefined) {
|
|
313
|
+
terminalIP = userConsole[index].terminalIP; // get name of user w.r.t. ID
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
terminalIP = '';
|
|
317
|
+
}
|
|
318
|
+
//----------// userConsoleResources
|
|
319
|
+
if (userConsole[index].userConsoleResources !== undefined) {
|
|
320
|
+
userConsoleResources = userConsole[index].userConsoleResources; // get name of user w.r.t. ID
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
userConsoleResources = null;
|
|
324
|
+
}
|
|
325
|
+
if (userConsoleResources != null) {
|
|
326
|
+
if (userConsoleResources.userConsoleResource !== undefined) {
|
|
327
|
+
userConsoleResources.userConsoleResource.forEach(function (item) {
|
|
328
|
+
//console.log("lookingFor: ",item)
|
|
329
|
+
resourceMetauserConsoleData.push(item.resourceId); // get name of user w.r.t. ID
|
|
330
|
+
resourceDurationFromConsole.push(item.duration);
|
|
331
|
+
if (item.launchedFrom) {
|
|
332
|
+
launchedFrom.push(item.launchedFrom);
|
|
333
|
+
}
|
|
334
|
+
//
|
|
335
|
+
});
|
|
336
|
+
// resourceMetauserConsoleData = userConsoleResources.userConsoleResource[index]resourceId; // get name of user w.r.t. ID
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
//console.log("lookingFor: ELSE ")
|
|
340
|
+
resourceMetauserConsoleData = [];
|
|
341
|
+
resourceDurationFromConsole = [];
|
|
342
|
+
launchedFrom = [];
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
//----------// userName and userSubjects
|
|
346
|
+
for (var i_2 = 0; i_2 < usersMetadataMatrix.length; i_2++) {
|
|
347
|
+
if (userId === usersMetadataMatrix[i_2].userId) {
|
|
348
|
+
userName = usersMetadataMatrix[i_2].userName;
|
|
349
|
+
userSubjects = usersMetadataMatrix[i_2].userSubjects;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
//----------// terminalIP and terminalLocation
|
|
353
|
+
for (var i_3 = 0; i_3 < schoolTerminalMatrix.length; i_3++) {
|
|
354
|
+
//console.log("schoolTerminalMatrix[i]",schoolTerminalMatrix[i]);
|
|
355
|
+
//console.log("schoolTerminalMatrix[i].terminalKey",terminalIP,schoolTerminalMatrix[i].terminalKey);
|
|
356
|
+
if (terminalIP === schoolTerminalMatrix[i_3].terminalKey) {
|
|
357
|
+
terminalLocation = schoolTerminalMatrix[i_3].location;
|
|
358
|
+
break;
|
|
359
|
+
}
|
|
360
|
+
else {
|
|
361
|
+
terminalLocation = '';
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
if (terminalLocation === undefined || terminalLocation === 'undefined') {
|
|
365
|
+
terminalLocation = '';
|
|
366
|
+
}
|
|
367
|
+
// console.log('userName--',userName)
|
|
368
|
+
var userData = {
|
|
369
|
+
userId: userId,
|
|
370
|
+
userName: userName,
|
|
371
|
+
startTime: new Date(startTime),
|
|
372
|
+
endTime: new Date(endTime),
|
|
373
|
+
terminalIP: terminalIP,
|
|
374
|
+
resourceMetauserConsoleData: resourceMetauserConsoleData,
|
|
375
|
+
resourceDurationFromConsole: resourceDurationFromConsole,
|
|
376
|
+
launchedFrom: launchedFrom,
|
|
377
|
+
duration: duration,
|
|
378
|
+
terminalLocation: terminalLocation,
|
|
379
|
+
userSubjects: userSubjects
|
|
380
|
+
};
|
|
381
|
+
userConsoleMatrix.push(userData);
|
|
382
|
+
this_1.userConsoleData = userConsoleMatrix;
|
|
383
|
+
this_1.isUserReqiuredDataReady.next(true);
|
|
384
|
+
};
|
|
385
|
+
var this_1 = this;
|
|
386
|
+
for (var index = 0; index < userConsole.length; index++) {
|
|
387
|
+
_loop_1(index);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
// console.log(usersMetadataMatrix,schoolTerminalMatrix,userConsoleMatrix);
|
|
392
|
+
return {
|
|
393
|
+
usersMetadata: usersMetadataMatrix,
|
|
394
|
+
schoolTerminalData: schoolTerminalMatrix,
|
|
395
|
+
userConsoleData: userConsoleMatrix
|
|
396
|
+
};
|
|
397
|
+
};
|
|
398
|
+
PrincipalDashboardLibV2Service.prototype.userWiseChartData = function () {
|
|
399
|
+
var dataTableforChart = new Array();
|
|
400
|
+
dataTableforChart = [];
|
|
401
|
+
if (this.userConsoleData) {
|
|
402
|
+
if (this.userConsoleData.length > 0) {
|
|
403
|
+
for (var i = 0; i < this.userConsoleData.length; i++) {
|
|
404
|
+
//console.log("chartDataUserWiseNew-->>",this.userConsoleData)
|
|
405
|
+
//console.log("chartDataUserWiseNew-->>",this.userConsoleData.userName)
|
|
406
|
+
if (typeof this.userConsoleData[i].userName === undefined) {
|
|
407
|
+
this.userConsoleData[i].userName = (Math.floor(Math.random() * 100)).toString();
|
|
408
|
+
}
|
|
409
|
+
if (this.userConsoleData[i].userName === undefined) {
|
|
410
|
+
this.userConsoleData[i].userName = "-";
|
|
411
|
+
//console.log('pakad',this.userConsoleData[i].userName = "-", this.userConsoleData[i].userId)
|
|
412
|
+
//this.userConsoleData.splice(i, 1);
|
|
413
|
+
}
|
|
414
|
+
/*
|
|
415
|
+
if(this.userConsoleData[i].userName === "-"){
|
|
416
|
+
this.userConsoleData.splice(i, 1); // 2nd parameter means remove one item only
|
|
417
|
+
}*/
|
|
418
|
+
//if(this.userConsoleData[i].userName !== undefined || this.userConsoleData[i].userName !== '-' || this.userConsoleData[i].userName !== '--')
|
|
419
|
+
{
|
|
420
|
+
var userData = [this.userConsoleData[i].userName, this.userConsoleData[i].startTime, this.userConsoleData[i].endTime];
|
|
421
|
+
dataTableforChart.push(userData);
|
|
422
|
+
}
|
|
423
|
+
//console.log("chartDataUserWiseNewNew-->>",userData)
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
return dataTableforChart;
|
|
428
|
+
};
|
|
429
|
+
PrincipalDashboardLibV2Service.prototype.classRoomWiseChartData = function () {
|
|
430
|
+
var dataTableforChart = new Array();
|
|
431
|
+
dataTableforChart = [];
|
|
432
|
+
if (this.userConsoleData) {
|
|
433
|
+
for (var i = 0; i < this.userConsoleData.length; i++) {
|
|
434
|
+
//console.log('bbb-->',this.userConsoleData[i].terminalLocation)
|
|
435
|
+
var roomName = this.userConsoleData[i].terminalLocation;
|
|
436
|
+
var location = this.getRoomLabel(roomName, this.userConsoleData[i].terminalIP);
|
|
437
|
+
//console.log('bbblocation-->',location)
|
|
438
|
+
var userData = [location, this.userConsoleData[i].startTime, this.userConsoleData[i].endTime];
|
|
439
|
+
dataTableforChart.push(userData);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
//console.log("this.classRoomWiseChartData",dataTableforChart);
|
|
443
|
+
return dataTableforChart;
|
|
444
|
+
};
|
|
445
|
+
PrincipalDashboardLibV2Service.prototype.newGetCurrentClassroomData = function () {
|
|
446
|
+
var dataTableforChart = new Array();
|
|
447
|
+
dataTableforChart = [];
|
|
448
|
+
if (this.userConsoleData) {
|
|
449
|
+
for (var i = 0; i < this.userConsoleData.length; i++) {
|
|
450
|
+
//console.log('bbb-->',this.userConsoleData[i].terminalLocation)
|
|
451
|
+
var roomName = this.userConsoleData[i].terminalLocation;
|
|
452
|
+
var location = roomName + " - " + this.userConsoleData[i].terminalIP;
|
|
453
|
+
//console.log('bbblocation-->',location)
|
|
454
|
+
//let userData = [location];
|
|
455
|
+
dataTableforChart.push(location);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
//console.log("this.classRoomWiseChartData",dataTableforChart);
|
|
459
|
+
dataTableforChart = this.uniq(dataTableforChart);
|
|
460
|
+
return dataTableforChart;
|
|
461
|
+
};
|
|
462
|
+
// Row label for classroom wise chart: room name, or IP as fallback when name is missing
|
|
463
|
+
PrincipalDashboardLibV2Service.prototype.getRoomLabel = function (roomName, roomIP) {
|
|
464
|
+
var name = (roomName === undefined || roomName === null || roomName === 'undefined') ? '' : String(roomName).trim();
|
|
465
|
+
return name !== '' ? name : (roomIP || '');
|
|
466
|
+
};
|
|
467
|
+
PrincipalDashboardLibV2Service.prototype.uniq = function (a) {
|
|
468
|
+
return Array.from(new Set(a));
|
|
469
|
+
};
|
|
470
|
+
PrincipalDashboardLibV2Service.prototype.allUserChartData = function () {
|
|
471
|
+
var dataTableforChart = new Array();
|
|
472
|
+
dataTableforChart = [];
|
|
473
|
+
var AlluserDetailsForTableChart = new Array();
|
|
474
|
+
AlluserDetailsForTableChart = [];
|
|
475
|
+
if (this.userConsoleData && this.usersMetaData) {
|
|
476
|
+
var inActiveuserName = void 0;
|
|
477
|
+
var userSubjects = void 0;
|
|
478
|
+
var myID = void 0;
|
|
479
|
+
var AlluserDetails_1 = new Array();
|
|
480
|
+
for (var index = 0; index < this.userConsoleData.length; index++) {
|
|
481
|
+
AlluserDetails_1.push(this.userConsoleData[index]);
|
|
482
|
+
AlluserDetailsForTableChart.push(this.userConsoleData[index]);
|
|
483
|
+
}
|
|
484
|
+
for (var i = 0; i < this.usersMetaData.length; i++) {
|
|
485
|
+
myID = this.usersMetaData[i].userId;
|
|
486
|
+
inActiveuserName = this.usersMetaData[i].userName;
|
|
487
|
+
//if(inActiveuserName === undefined)
|
|
488
|
+
{
|
|
489
|
+
//console.log("alluser-1->>",inActiveuserName);
|
|
490
|
+
}
|
|
491
|
+
userSubjects = this.usersMetaData[i].userSubjects;
|
|
492
|
+
var myChartRowuserConsoleData = {
|
|
493
|
+
userId: myID,
|
|
494
|
+
userName: inActiveuserName,
|
|
495
|
+
startTime: new Date(this.myEndTime),
|
|
496
|
+
endTime: new Date(this.myEndTime),
|
|
497
|
+
terminalIP: "",
|
|
498
|
+
resourceMetauserConsoleData: [],
|
|
499
|
+
duration: "0",
|
|
500
|
+
terminalLocation: "",
|
|
501
|
+
userSubjects: userSubjects
|
|
502
|
+
};
|
|
503
|
+
//AlluserDetails.push(myChartRowuserConsoleData);
|
|
504
|
+
var myTableRowuserConsoleData = {
|
|
505
|
+
userId: myID,
|
|
506
|
+
userName: inActiveuserName,
|
|
507
|
+
startTime: "",
|
|
508
|
+
endTime: "",
|
|
509
|
+
terminalIP: "",
|
|
510
|
+
resourceMetauserConsoleData: [],
|
|
511
|
+
duration: 0,
|
|
512
|
+
terminalLocation: "",
|
|
513
|
+
userSubjects: userSubjects
|
|
514
|
+
};
|
|
515
|
+
//console.log("alluser-2->>",inActiveuserName);
|
|
516
|
+
AlluserDetailsForTableChart.push(myTableRowuserConsoleData);
|
|
517
|
+
AlluserDetails_1.push(myChartRowuserConsoleData);
|
|
518
|
+
}
|
|
519
|
+
setTimeout(function () {
|
|
520
|
+
var _loop_2 = function (i) {
|
|
521
|
+
//console.log("alluser-3->>",AlluserDetails[i]);
|
|
522
|
+
if (AlluserDetails_1[i].userName == undefined) {
|
|
523
|
+
//AlluserDetails[i].userName = "--"
|
|
524
|
+
AlluserDetails_1.splice(i, 1); // 2nd parameter means remove one item only
|
|
525
|
+
}
|
|
526
|
+
//if(AlluserDetails[i].userName !== undefined || AlluserDetails[i].userName !== '-' || AlluserDetails[i].userName !== '--')
|
|
527
|
+
{
|
|
528
|
+
if (AlluserDetails_1[i].userName === "--") {
|
|
529
|
+
AlluserDetails_1.splice(i, 1); // 2nd parameter means remove one item only
|
|
530
|
+
}
|
|
531
|
+
setTimeout(function () {
|
|
532
|
+
var userData = [AlluserDetails_1[i].userName, AlluserDetails_1[i].startTime, AlluserDetails_1[i].endTime];
|
|
533
|
+
dataTableforChart.push(userData);
|
|
534
|
+
}, 300);
|
|
535
|
+
}
|
|
536
|
+
};
|
|
537
|
+
for (var i = 0; i < AlluserDetails_1.length; i++) {
|
|
538
|
+
_loop_2(i);
|
|
539
|
+
}
|
|
540
|
+
}, 50);
|
|
541
|
+
/*
|
|
542
|
+
for(let i = 0; i < AlluserDetails.length; i++){
|
|
543
|
+
console.log("alluser-3->>",AlluserDetails[i].userName);
|
|
544
|
+
if(AlluserDetails[i].userName === undefined){
|
|
545
|
+
AlluserDetails[i].userName = "(-)"
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
let userData = [AlluserDetails[i].userName,AlluserDetails[i].startTime,AlluserDetails[i].endTime];
|
|
549
|
+
dataTableforChart.push(userData);
|
|
550
|
+
}*/
|
|
551
|
+
}
|
|
552
|
+
return { forChartData: dataTableforChart, fordurationTable: AlluserDetailsForTableChart };
|
|
553
|
+
};
|
|
554
|
+
PrincipalDashboardLibV2Service.prototype.allRoomsData = function () {
|
|
555
|
+
var dataTableforChart = new Array();
|
|
556
|
+
dataTableforChart = [];
|
|
557
|
+
var allRoomsDetails = new Array();
|
|
558
|
+
allRoomsDetails = [];
|
|
559
|
+
if (this.userConsoleData && this.schoolTerminalData) {
|
|
560
|
+
var myChartRowData = {};
|
|
561
|
+
var inActiveClassRoom = void 0;
|
|
562
|
+
for (var i = 0; i < this.userConsoleData.length; i++) {
|
|
563
|
+
allRoomsDetails.push(this.userConsoleData[i]);
|
|
564
|
+
//console.log("bbb allRoom-->",this.userConsoleData[i])
|
|
565
|
+
var roomName = this.userConsoleData[i].terminalLocation;
|
|
566
|
+
var roomIP = this.userConsoleData[i].terminalIP;
|
|
567
|
+
var location = this.getRoomLabel(roomName, roomIP);
|
|
568
|
+
//console.log('bbbbRoom',location)
|
|
569
|
+
// let userData = [this.userConsoleData[i].terminalIP,this.userConsoleData[i].startTime,this.userConsoleData[i].endTime];
|
|
570
|
+
var userData = [location, this.userConsoleData[i].startTime, this.userConsoleData[i].endTime];
|
|
571
|
+
dataTableforChart.push(userData);
|
|
572
|
+
}
|
|
573
|
+
var inactiveRoonName = void 0;
|
|
574
|
+
// rooms already used today are in the chart above, add only the idle ones
|
|
575
|
+
var activeRoomIPs = this.userConsoleData.map(function (room) { return room.terminalIP; });
|
|
576
|
+
for (var i = 0; i < this.schoolTerminalData.length; i++) {
|
|
577
|
+
//console.log("schoolTerminalData",this.schoolTerminalData);
|
|
578
|
+
if (activeRoomIPs.includes(this.schoolTerminalData[i].terminalKey)) {
|
|
579
|
+
continue;
|
|
580
|
+
}
|
|
581
|
+
inActiveClassRoom = this.getRoomLabel(this.schoolTerminalData[i].location, this.schoolTerminalData[i].terminalKey);
|
|
582
|
+
//inactiveRoonName = this.schoolTerminalData[i].location;
|
|
583
|
+
myChartRowData = {
|
|
584
|
+
userId: "",
|
|
585
|
+
userName: "",
|
|
586
|
+
startTime: new Date(this.myEndTime),
|
|
587
|
+
endTime: new Date(this.myEndTime),
|
|
588
|
+
terminalIP: this.schoolTerminalData[i].terminalKey,
|
|
589
|
+
resourceMetauserConsoleData: [],
|
|
590
|
+
duration: 0,
|
|
591
|
+
terminalLocation: this.schoolTerminalData[i].location,
|
|
592
|
+
userSubjects: ""
|
|
593
|
+
};
|
|
594
|
+
allRoomsDetails.push(myChartRowData);
|
|
595
|
+
var myChartRowuserConsoleData = [inActiveClassRoom, new Date(this.myEndTime), new Date(this.myEndTime)];
|
|
596
|
+
dataTableforChart.push(myChartRowuserConsoleData);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
return { forChartData: dataTableforChart, fordurationTable: allRoomsDetails };
|
|
600
|
+
};
|
|
601
|
+
PrincipalDashboardLibV2Service.prototype.dataForTableView = function (userConsoleMatrix, resourceMetadataMatrix) {
|
|
602
|
+
var currentDate;
|
|
603
|
+
var resourceMatrixForTableChart = new Array();
|
|
604
|
+
var resourceMatrixForExcel = new Array();
|
|
605
|
+
resourceMatrixForTableChart = [];
|
|
606
|
+
resourceMatrixForExcel = [];
|
|
607
|
+
for (var i = 0; i < userConsoleMatrix.length; i++) {
|
|
608
|
+
var startTime = void 0;
|
|
609
|
+
var endTime = void 0;
|
|
610
|
+
var duration = void 0;
|
|
611
|
+
var terminalIP = void 0;
|
|
612
|
+
var subject = void 0;
|
|
613
|
+
var grade = void 0;
|
|
614
|
+
var chapter = void 0;
|
|
615
|
+
var topicName = void 0;
|
|
616
|
+
var AssestDetail = void 0;
|
|
617
|
+
var resourceType = void 0;
|
|
618
|
+
var resourceTitle = void 0;
|
|
619
|
+
var teachingPoint = void 0;
|
|
620
|
+
var location = void 0;
|
|
621
|
+
var teacherName = void 0;
|
|
622
|
+
var teacherSubject = void 0;
|
|
623
|
+
var resourceMetadataIDs = void 0;
|
|
624
|
+
var resourceMetadataIDsDuration = void 0;
|
|
625
|
+
var resourceArrayForExcel = new Array();
|
|
626
|
+
var resourceArrayForTableChart = new Array();
|
|
627
|
+
var userConsoleDataMatrix = new Array();
|
|
628
|
+
var launchedFrom = void 0;
|
|
629
|
+
resourceArrayForTableChart = [];
|
|
630
|
+
userConsoleDataMatrix = [];
|
|
631
|
+
//----------------- for subject and Name
|
|
632
|
+
teacherSubject = userConsoleMatrix[i].userSubjects;
|
|
633
|
+
teacherName = userConsoleMatrix[i].userName;
|
|
634
|
+
//----------------- for start Time and EndTime
|
|
635
|
+
if ((userConsoleMatrix[i].startTime != undefined && userConsoleMatrix[i].startTime != "") && (userConsoleMatrix[i].endTime != undefined && userConsoleMatrix[i].endTime != "")) {
|
|
636
|
+
startTime = userConsoleMatrix[i].startTime.toLocaleTimeString('en-US', { hour12: true });
|
|
637
|
+
endTime = userConsoleMatrix[i].endTime.toLocaleTimeString('en-US', { hour12: true });
|
|
638
|
+
currentDate = userConsoleMatrix[i].startTime.getDate() + '/' + (userConsoleMatrix[i].startTime.getMonth() + 1) + '/' + userConsoleMatrix[i].startTime.getFullYear();
|
|
639
|
+
}
|
|
640
|
+
//----------------- for duration
|
|
641
|
+
duration = Math.floor(userConsoleMatrix[i].duration);
|
|
642
|
+
//----------------- for Terminal loaction and terminal IP
|
|
643
|
+
location = userConsoleMatrix[i].terminalLocation;
|
|
644
|
+
terminalIP = userConsoleMatrix[i].terminalIP;
|
|
645
|
+
var roomDetail = location + ' ' + terminalIP;
|
|
646
|
+
resourceMetadataIDs = userConsoleMatrix[i].resourceMetauserConsoleData;
|
|
647
|
+
resourceMetadataIDsDuration = userConsoleMatrix[i].resourceDurationFromConsole;
|
|
648
|
+
//console.log('mlaunchedFrom-->> ',(typeof userConsoleMatrix[i].launchedFrom));
|
|
649
|
+
//console.log('mlaunchedFrom-->> ',( userConsoleMatrix[i].launchedFrom));
|
|
650
|
+
var launchDataArr = Array(userConsoleMatrix[i].launchedFrom);
|
|
651
|
+
//console.log('mlaunchedFrom len-->> ', launchDataArr);
|
|
652
|
+
launchedFrom = launchDataArr;
|
|
653
|
+
if (resourceMetadataIDs.length === 0) {
|
|
654
|
+
subject = undefined;
|
|
655
|
+
grade = undefined;
|
|
656
|
+
chapter = undefined;
|
|
657
|
+
topicName = undefined;
|
|
658
|
+
teachingPoint = undefined;
|
|
659
|
+
AssestDetail = undefined;
|
|
660
|
+
resourceTitle = undefined;
|
|
661
|
+
resourceType = undefined;
|
|
662
|
+
resourceArrayForTableChart = [teacherName, teacherSubject, currentDate, startTime, endTime, duration, roomDetail, subject, grade, chapter, teachingPoint, AssestDetail, launchedFrom];
|
|
663
|
+
resourceMatrixForTableChart.push(resourceArrayForTableChart);
|
|
664
|
+
}
|
|
665
|
+
else {
|
|
666
|
+
//resourceMetadataMatrix = [resouseID,subject,grade,chapter,teachingPoint,type,title]
|
|
667
|
+
for (var k = 0; k < resourceMetadataIDs.length; k++) {
|
|
668
|
+
for (var i_4 = 0; i_4 < resourceMetadataMatrix.length; i_4++) {
|
|
669
|
+
if (resourceMetadataIDs[k] === resourceMetadataMatrix[i_4].resouseID) {
|
|
670
|
+
subject = resourceMetadataMatrix[i_4].subject;
|
|
671
|
+
grade = resourceMetadataMatrix[i_4].grade;
|
|
672
|
+
chapter = resourceMetadataMatrix[i_4].chapter;
|
|
673
|
+
topicName = resourceMetadataMatrix[i_4].topicName;
|
|
674
|
+
teachingPoint = resourceMetadataMatrix[i_4].teachingPoint;
|
|
675
|
+
if (resourceMetadataMatrix[i_4].title.toLowerCase() === 'whiteboard' || resourceMetadataMatrix[i_4].title.toLowerCase() === 'question') {
|
|
676
|
+
AssestDetail = this.getDisplaytypeValue(resourceMetadataMatrix[i_4].type) + ' : ' + this.convertSeconds(resourceMetadataIDsDuration[k]);
|
|
677
|
+
}
|
|
678
|
+
else {
|
|
679
|
+
AssestDetail = this.getDisplaytypeValue(resourceMetadataMatrix[i_4].type) + " : " + resourceMetadataMatrix[i_4].title + ' : ' + this.convertSeconds(resourceMetadataIDsDuration[k]);
|
|
680
|
+
}
|
|
681
|
+
//AssestDetail = this.getDisplaytypeValue(resourceMetadataMatrix[i].type) + " : " + resourceMetadataMatrix[i].title + ' : ' + resourceMetadataIDsDuration[k];
|
|
682
|
+
resourceArrayForTableChart = [teacherName, teacherSubject, currentDate, startTime, endTime, duration, roomDetail, subject, grade, chapter, teachingPoint, AssestDetail, launchedFrom];
|
|
683
|
+
resourceMatrixForTableChart.push(resourceArrayForTableChart);
|
|
684
|
+
teacherName = undefined;
|
|
685
|
+
teacherSubject = undefined;
|
|
686
|
+
currentDate = undefined;
|
|
687
|
+
startTime = undefined;
|
|
688
|
+
endTime = undefined;
|
|
689
|
+
duration = undefined;
|
|
690
|
+
roomDetail = undefined;
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
return resourceMatrixForTableChart;
|
|
697
|
+
};
|
|
698
|
+
PrincipalDashboardLibV2Service.prototype.dataForDetailedView = function (userConsoleMatrix, resourceMetadataMatrix, rowLabel) {
|
|
699
|
+
var detailedView_UserDataMatrix = new Array();
|
|
700
|
+
detailedView_UserDataMatrix = [];
|
|
701
|
+
var detailedView_ResourceDataMatrix = new Array();
|
|
702
|
+
detailedView_ResourceDataMatrix = [];
|
|
703
|
+
var startTime;
|
|
704
|
+
var endTime;
|
|
705
|
+
var duration;
|
|
706
|
+
var terminalIP;
|
|
707
|
+
var subject;
|
|
708
|
+
var grade;
|
|
709
|
+
var chapter;
|
|
710
|
+
var AssestDetail;
|
|
711
|
+
var teachingPoint;
|
|
712
|
+
var location;
|
|
713
|
+
var teacherName;
|
|
714
|
+
var teacherSubject;
|
|
715
|
+
var currentDate;
|
|
716
|
+
var resourceMetadataIDs;
|
|
717
|
+
var resourceMetadataIDsduration;
|
|
718
|
+
var resourceArrayForTableChart = new Array();
|
|
719
|
+
resourceArrayForTableChart = [];
|
|
720
|
+
//----------------- for subject and Name
|
|
721
|
+
teacherSubject = userConsoleMatrix[rowLabel].userSubjects;
|
|
722
|
+
teacherName = userConsoleMatrix[rowLabel].userName;
|
|
723
|
+
//----------------- for start Time and EndTime
|
|
724
|
+
if ((userConsoleMatrix[rowLabel].startTime != undefined && userConsoleMatrix[rowLabel].startTime != "") && (userConsoleMatrix[rowLabel].endTime != undefined && userConsoleMatrix[rowLabel].endTime != "")) {
|
|
725
|
+
startTime = userConsoleMatrix[rowLabel].startTime.toLocaleTimeString('en-US', { hour12: true });
|
|
726
|
+
endTime = userConsoleMatrix[rowLabel].endTime.toLocaleTimeString('en-US', { hour12: true });
|
|
727
|
+
currentDate = userConsoleMatrix[rowLabel].startTime.getDate() + '/' + userConsoleMatrix[rowLabel].startTime.getMonth() + '/' + userConsoleMatrix[rowLabel].startTime.getFullYear();
|
|
728
|
+
}
|
|
729
|
+
//----------------- for duration
|
|
730
|
+
duration = Math.floor(userConsoleMatrix[rowLabel].duration);
|
|
731
|
+
//----------------- for Terminal loaction and terminal IP
|
|
732
|
+
location = userConsoleMatrix[rowLabel].terminalLocation;
|
|
733
|
+
terminalIP = userConsoleMatrix[rowLabel].terminalIP;
|
|
734
|
+
var roomDetail = location + ' ' + terminalIP;
|
|
735
|
+
resourceMetadataIDs = userConsoleMatrix[rowLabel].resourceMetauserConsoleData;
|
|
736
|
+
resourceMetadataIDsduration = userConsoleMatrix[rowLabel].resourceDurationFromConsole;
|
|
737
|
+
detailedView_UserDataMatrix = [teacherName, startTime, teacherSubject, endTime, roomDetail];
|
|
738
|
+
if (resourceMetadataIDs.length == 0) {
|
|
739
|
+
subject = undefined;
|
|
740
|
+
grade = undefined;
|
|
741
|
+
chapter = undefined;
|
|
742
|
+
teachingPoint = undefined;
|
|
743
|
+
AssestDetail = undefined;
|
|
744
|
+
}
|
|
745
|
+
else {
|
|
746
|
+
for (var k = 0; k < resourceMetadataIDs.length; k++) {
|
|
747
|
+
for (var i = 0; i < resourceMetadataMatrix.length; i++) {
|
|
748
|
+
if (resourceMetadataIDs[k] === resourceMetadataMatrix[i].resouseID) {
|
|
749
|
+
subject = resourceMetadataMatrix[i].subject;
|
|
750
|
+
grade = resourceMetadataMatrix[i].grade;
|
|
751
|
+
chapter = resourceMetadataMatrix[i].chapter;
|
|
752
|
+
teachingPoint = resourceMetadataMatrix[i].teachingPoint;
|
|
753
|
+
if (resourceMetadataMatrix[i].title.toLowerCase() === 'whiteboard' || resourceMetadataMatrix[i].title.toLowerCase() === 'question') {
|
|
754
|
+
AssestDetail = this.getDisplaytypeValue(resourceMetadataMatrix[i].type) + ": " + this.convertSeconds(resourceMetadataIDsduration[k]);
|
|
755
|
+
}
|
|
756
|
+
else {
|
|
757
|
+
AssestDetail = this.getDisplaytypeValue(resourceMetadataMatrix[i].type) + ": " + resourceMetadataMatrix[i].title + ": " + this.convertSeconds(resourceMetadataIDsduration[k]);
|
|
758
|
+
}
|
|
759
|
+
//AssestDetail = this.getDisplaytypeValue(resourceMetadataMatrix[i].type) + ": " + resourceMetadataMatrix[i].title + ": " + this.convertSeconds(resourceMetadataIDsduration[k]);
|
|
760
|
+
resourceArrayForTableChart = [subject, grade, chapter, teachingPoint, AssestDetail];
|
|
761
|
+
detailedView_ResourceDataMatrix.push(resourceArrayForTableChart);
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
return { userDetails: detailedView_UserDataMatrix, resourceDetails: detailedView_ResourceDataMatrix };
|
|
767
|
+
};
|
|
768
|
+
// To GET DISPLAY TYPE
|
|
769
|
+
PrincipalDashboardLibV2Service.prototype.getDisplaytypeValue = function (key) {
|
|
770
|
+
var assetTypeConfig = [
|
|
771
|
+
{
|
|
772
|
+
type: "asset_media",
|
|
773
|
+
display: "Media"
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
type: "asset_print",
|
|
777
|
+
display: "Print"
|
|
778
|
+
},
|
|
779
|
+
{
|
|
780
|
+
type: "quiz",
|
|
781
|
+
display: "Quiz"
|
|
782
|
+
},
|
|
783
|
+
{
|
|
784
|
+
type: "question",
|
|
785
|
+
display: "Question"
|
|
786
|
+
},
|
|
787
|
+
{
|
|
788
|
+
type: "chapter",
|
|
789
|
+
display: "Chapter"
|
|
790
|
+
},
|
|
791
|
+
{
|
|
792
|
+
type: "tp",
|
|
793
|
+
display: "Topic"
|
|
794
|
+
},
|
|
795
|
+
{
|
|
796
|
+
type: "whiteboard",
|
|
797
|
+
display: "Whiteboard"
|
|
798
|
+
},
|
|
799
|
+
{
|
|
800
|
+
type: "widget",
|
|
801
|
+
display: "Widget"
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
type: "casset_media",
|
|
805
|
+
display: "cMedia"
|
|
806
|
+
},
|
|
807
|
+
{
|
|
808
|
+
type: "casset_print",
|
|
809
|
+
display: "cPrint"
|
|
810
|
+
},
|
|
811
|
+
{
|
|
812
|
+
type: "cquiz",
|
|
813
|
+
display: "cQuiz"
|
|
814
|
+
},
|
|
815
|
+
{
|
|
816
|
+
type: "cquestion",
|
|
817
|
+
display: "cQuestion"
|
|
818
|
+
},
|
|
819
|
+
{
|
|
820
|
+
type: "image",
|
|
821
|
+
display: "Image"
|
|
822
|
+
},
|
|
823
|
+
{
|
|
824
|
+
type: "video",
|
|
825
|
+
display: "Video"
|
|
826
|
+
},
|
|
827
|
+
{
|
|
828
|
+
type: "tools",
|
|
829
|
+
display: "Tools"
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
type: "feature",
|
|
833
|
+
display: "Feature"
|
|
834
|
+
},
|
|
835
|
+
];
|
|
836
|
+
var displayValue = key;
|
|
837
|
+
assetTypeConfig.forEach(function (value) {
|
|
838
|
+
if (value.type === key) {
|
|
839
|
+
displayValue = value.display;
|
|
840
|
+
}
|
|
841
|
+
});
|
|
842
|
+
return displayValue;
|
|
843
|
+
};
|
|
844
|
+
PrincipalDashboardLibV2Service.prototype.convertSeconds = function (seconds) {
|
|
845
|
+
var minutes = Math.floor(seconds / 60);
|
|
846
|
+
var remainingSeconds = seconds % 60;
|
|
847
|
+
return minutes + "m " + remainingSeconds + "s";
|
|
848
|
+
};
|
|
849
|
+
return PrincipalDashboardLibV2Service;
|
|
850
|
+
}());
|
|
851
|
+
PrincipalDashboardLibV2Service.ɵprov = i0.ɵɵdefineInjectable({ factory: function PrincipalDashboardLibV2Service_Factory() { return new PrincipalDashboardLibV2Service(); }, token: PrincipalDashboardLibV2Service, providedIn: "root" });
|
|
852
|
+
PrincipalDashboardLibV2Service.decorators = [
|
|
853
|
+
{ type: i0.Injectable, args: [{
|
|
854
|
+
providedIn: 'root'
|
|
855
|
+
},] }
|
|
856
|
+
];
|
|
857
|
+
PrincipalDashboardLibV2Service.ctorParameters = function () { return []; };
|
|
858
|
+
|
|
859
|
+
var PrincipalDashboardLibV2Component = /** @class */ (function () {
|
|
860
|
+
function PrincipalDashboardLibV2Component(pdService) {
|
|
861
|
+
this.pdService = pdService;
|
|
862
|
+
this.userSelectedDate = new i0.EventEmitter();
|
|
863
|
+
this.messageForUser = "Loding...";
|
|
864
|
+
this.isInsights = false;
|
|
865
|
+
}
|
|
866
|
+
Object.defineProperty(PrincipalDashboardLibV2Component.prototype, "responseStatus", {
|
|
867
|
+
set: function (res) {
|
|
868
|
+
this.setMessageForUser(res);
|
|
869
|
+
// console.log(" @Input() set responseStatus(res: any) >>>>>>>>>>>>.",res);
|
|
870
|
+
},
|
|
871
|
+
enumerable: false,
|
|
872
|
+
configurable: true
|
|
873
|
+
});
|
|
874
|
+
PrincipalDashboardLibV2Component.prototype.ngOnInit = function () {
|
|
875
|
+
var _this = this;
|
|
876
|
+
this.pdService.isInsightsView.subscribe(function (value) { return _this.isInsights = value; });
|
|
877
|
+
// console.log(" IN --> 7 data",this.data);
|
|
878
|
+
};
|
|
879
|
+
PrincipalDashboardLibV2Component.prototype.setMessageForUser = function (res) {
|
|
880
|
+
this.messageForUser = res;
|
|
881
|
+
};
|
|
882
|
+
PrincipalDashboardLibV2Component.prototype.onUserSelectDate = function (e) {
|
|
883
|
+
// console.log(" IN --> 1");
|
|
884
|
+
this.data = null;
|
|
885
|
+
this.userSelectedDate.emit(e);
|
|
886
|
+
};
|
|
887
|
+
return PrincipalDashboardLibV2Component;
|
|
888
|
+
}());
|
|
889
|
+
PrincipalDashboardLibV2Component.decorators = [
|
|
890
|
+
{ type: i0.Component, args: [{
|
|
891
|
+
selector: 'lib-principal-dashboard-lib-v2',
|
|
892
|
+
template: "<div id=\"reprtModule\">\n <div id=\"pd-mainDiv\" class=\"pd-mainContainer\">\n <lib-header [data]=\"data\" (userSelectedDate)=\"onUserSelectDate($event)\">\n </lib-header>\n <lib-chartheader></lib-chartheader>\n \n <div id=\"pd-preloader\" class=\"pd-preloaderDiv\" *ngIf=\"responseStatus !== 'true' && !data\">\n {{messageForUser}} \n </div>\n <!-- kept alive (only hidden) while on Insights so the timeline keeps its state -->\n <div [style.display]=\"isInsights ? 'none' : 'block'\">\n <lib-chartview *ngIf=\"data\" [data]=\"data\"></lib-chartview>\n <!-- <lib-tableview *ngIf=\"data\" [data]=\"data\"></lib-tableview> -->\n <lib-full-table-view *ngIf=\"data\" [data]=\"data\"></lib-full-table-view>\n </div>\n <lib-insights *ngIf=\"data && isInsights\" [data]=\"data\"></lib-insights>\n <!-- <lib-detailedview *ngIf=\"data\" [data]=\"data\"></lib-detailedview> -->\n <lib-small-table-view *ngIf=\"data\" [data]=\"data\"></lib-small-table-view>\n \n </div>\n</div>\n ",
|
|
893
|
+
styles: [".pd-mainContainer{width:100%;height:100%}.pd-mainContainer .pd-preloaderDiv{text-align:center;line-height:27;position:absolute;width:100%;height:87%;z-index:2}.bs-datepicker-head{background-color:#000!important}"]
|
|
894
|
+
},] }
|
|
895
|
+
];
|
|
896
|
+
PrincipalDashboardLibV2Component.ctorParameters = function () { return [
|
|
897
|
+
{ type: PrincipalDashboardLibV2Service }
|
|
898
|
+
]; };
|
|
899
|
+
PrincipalDashboardLibV2Component.propDecorators = {
|
|
900
|
+
data: [{ type: i0.Input }],
|
|
901
|
+
responseStatus: [{ type: i0.Input }],
|
|
902
|
+
userSelectedDate: [{ type: i0.Output }]
|
|
903
|
+
};
|
|
904
|
+
|
|
905
|
+
var ChartheaderComponent = /** @class */ (function () {
|
|
906
|
+
function ChartheaderComponent(pdService) {
|
|
907
|
+
this.pdService = pdService;
|
|
908
|
+
//variables
|
|
909
|
+
this.mytype = angularGoogleCharts.ChartType.Timeline;
|
|
910
|
+
this.datadisplaytype = 'UserWise';
|
|
911
|
+
this.isUserWise = true;
|
|
912
|
+
this.isChartView = true;
|
|
913
|
+
this.isInsights = false;
|
|
914
|
+
}
|
|
915
|
+
ChartheaderComponent.prototype.ngOnInit = function () {
|
|
916
|
+
this.libVersion = "0.0.37";
|
|
917
|
+
// this.myIcon = document.getElementById('myIconImg');
|
|
918
|
+
// this.changeChatType()
|
|
919
|
+
};
|
|
920
|
+
ChartheaderComponent.prototype.changeChatType = function () {
|
|
921
|
+
if (this.mytype == angularGoogleCharts.ChartType.Timeline) {
|
|
922
|
+
this.isChartView = false;
|
|
923
|
+
this.mytype = angularGoogleCharts.ChartType.Table;
|
|
924
|
+
this.pdService.chartType.next(this.mytype);
|
|
925
|
+
}
|
|
926
|
+
else {
|
|
927
|
+
this.isChartView = true;
|
|
928
|
+
this.mytype = angularGoogleCharts.ChartType.Timeline;
|
|
929
|
+
this.pdService.chartType.next(this.mytype);
|
|
930
|
+
}
|
|
931
|
+
};
|
|
932
|
+
ChartheaderComponent.prototype.showInsights = function () {
|
|
933
|
+
this.isInsights = true;
|
|
934
|
+
this.pdService.openSmallTable.next(false);
|
|
935
|
+
this.pdService.isInsightsView.next(true);
|
|
936
|
+
};
|
|
937
|
+
ChartheaderComponent.prototype.changeDataTypeClassRoom = function () {
|
|
938
|
+
this.leaveInsights();
|
|
939
|
+
this.isUserWise = false;
|
|
940
|
+
this.pdService.isUserWise_data.next(false);
|
|
941
|
+
};
|
|
942
|
+
ChartheaderComponent.prototype.changeDataTypeUser = function () {
|
|
943
|
+
this.leaveInsights();
|
|
944
|
+
this.isUserWise = true;
|
|
945
|
+
this.pdService.isUserWise_data.next(true);
|
|
946
|
+
};
|
|
947
|
+
ChartheaderComponent.prototype.leaveInsights = function () {
|
|
948
|
+
if (this.isInsights) {
|
|
949
|
+
this.isInsights = false;
|
|
950
|
+
this.pdService.isInsightsView.next(false);
|
|
951
|
+
}
|
|
952
|
+
};
|
|
953
|
+
return ChartheaderComponent;
|
|
954
|
+
}());
|
|
955
|
+
ChartheaderComponent.decorators = [
|
|
956
|
+
{ type: i0.Component, args: [{
|
|
957
|
+
selector: 'lib-chartheader',
|
|
958
|
+
template: "\n<div id=\"pd-chartheader\">\n <div id=\"pd-chatTypeBtnDiv\" *ngIf=\"!isInsights\" class=\"pd-tabIconBtn\" [ngClass]=\" isChartView ? 'tableIconImg' : 'chartIconImg'\" (click)=\"changeChatType()\">\n </div>\n \n <div id=\"pd-userWisechatTypeBtn\" class=\"userWiseBtn\" [ngStyle]=\"{ color: isUserWise && !isInsights ? '#ffffff' : '#000000' , backgroundColor: isUserWise && !isInsights ? '#000000' : '#c4c4c4'}\"\n (click)=\"changeDataTypeUser()\">User wise</div>\n <div id=\"pd-classRoomWiseBtn\" class=\"classWiseBtn\" [ngStyle]=\"{ color: !isUserWise && !isInsights ? '#ffffff' : '#000000' , backgroundColor: !isUserWise && !isInsights ? '#000000' : '#c4c4c4'}\"\n (click)=\"changeDataTypeClassRoom()\">Classroom wise</div><div id=\"pd-insightsBtn\" class=\"insightsBtn\" [ngStyle]=\"{ color: isInsights ? '#ffffff' : '#000000' , backgroundColor: isInsights ? '#000000' : '#c4c4c4'}\"\n (click)=\"showInsights()\">Insights</div>\n\n \n <div class=\"libVersionDiv\">v{{libVersion}}</div>\n</div>",
|
|
959
|
+
styles: ["#pd-chartheader{font-size:12pt;font-weight:400;color:#5c5c5c;z-index:1;width:100%;height:40px;position:relative;margin:10 auto;text-align:center;background-color:#e0e0e0}#pd-chartheader #pd-classRoomWiseBtn,#pd-chartheader #pd-insightsBtn,#pd-chartheader #pd-userWisechatTypeBtn{background:-moz-linear-gradient(center top,#45a1da 5%,#1172ae 100%);display:inline-block;padding:0 20px;cursor:pointer;margin:5px 0 0;width:160px;height:30px;line-height:30px}#pd-chartheader .libVersionDiv{position:absolute;font-size:12px;color:#343a40;margin-top:-21px;font-weight:700;margin-left:71px}.userWiseBtn{border-radius:6px 0 0 6px}.insightsBtn{border-radius:0 6px 6px 0;border-left:1px solid #e0e0e0}.pd-tabIconBtn{cursor:pointer;position:absolute;left:10px;top:-17px;width:62px;height:52px;background-repeat:no-repeat}.tableIconImg{background-image:url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD4AAAAzCAYAAADPX7uaAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MkZDQzc3REFDMkQ2MTFFMkIzNDhCNTE1RDg3OUE1QTciIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MkZDQzc3REJDMkQ2MTFFMkIzNDhCNTE1RDg3OUE1QTciPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDoyRkNDNzdEOEMyRDYxMUUyQjM0OEI1MTVEODc5QTVBNyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDoyRkNDNzdEOUMyRDYxMUUyQjM0OEI1MTVEODc5QTVBNyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PnXBGHQAAAblSURBVHja3FrLbxtFGP9mdh0/m0DSPFvnEKAHkBCNShEHWlB5nEigqgRcokogLlwR/AHcEDf4BxBXToEDV0JfqlAgQiJIVVtKuaQmzcOO7fgxw3yzO/Z4vC/DurU70mhm19/Ofr/v981vZndNIFohMFyFhxnYEYGSgACQAQLHo9oGASEefTKAWcCNPtfOmX1fxr2AUuOYhGTAwwDNPSoz7IgO3otBaoDWq35+kFKdGYD1agaC+zGuA7aMlnpkwMNm3Atw02iZybjtkdpEA2u5NrYRhEEEroNtuNVM9daxF+M624mJ/BNHnj679HEimV4ilOYHeg1j7G79sLL6+4+rX2zfvVn0mf9d4maCto/OPzX6zCvLn1944+yFN8+cgumJxwZ68d7a3s1/t/bzR99a1szm2vef3Lv9x66P8HkqdivNT7z42rv2SOr8+2+dG3jQWNBH9FX4/PaTL5x7R5uuXThpkLAls2MXv/z0A2nDOR+KigV9TmZGLxqi3KFJts/6LYGLOT01PpprDTgs5XHhs/B90oNthZHbHozrrHOmRRJLLpcbSLClUqktcm1/fZdfv3W8tUnhBvDkGIXTH87B0QWMKgFKCHDqXkScikfUHYFoozo22qqCfXds7tzMbZ0qG6ZMuGyVK3ieMQa7t+uw8XWhw0cDuOfSa4dsV+XgWPUVMZM8AodQlgpBETxWywGFLbXEpfK808cAoS22FnUAtwLiApSZxWSKOaCaXPYZHjdBtky1eE5c2xA/ZFMTAmihw0et77vFtkPXRoNxda64XwZqg2QcwUngCqxNOgJCXeDSjjoBIkQDzh1ADott4IwpwLx9rPWbzSaM8nGT5UiaFAocPIDLHKIaCOoAaQEkzhRQ51utBOyy7x7LsblLBYdWQIiaPu45OS5XyqNcI95g4wDeleoqZyynUhcwsk9UyrvpbVmKZYNxqqc6cfaTmObUbd2NJ2G8LR7INgag4USIEBUsbqa3p789A+9KdXG3cr0Ehb/uyXnWEjXaFrfOPoFUMgm1eq2lZ0ro9DnOuWKcQMJOQKV66GZbW+DMPsYlnxpzhS/mVDeBN2scXp1/D54/eRpS6ZT36w3NvlYXqvvrBjx38iTYmAIhpVwuw+bmJiwuLors0PJaWw1Ur9Gowy/rG7DBvoofOOOdqW5DEhZyz8Lri+elk0EPaFxcOzZ+BNLFo/Dy6TOwt10U/tPA+2WzWRir/QRnT70Eu//sC/CW74PZ6HgO9m4yMSVIZ6rzWFK9M4JUOM7EBCxW9qB0UArNFjtFoVI/gEqlArul+y6LAddYDag2ylCtVmHvYMfXHsdOZhNQa1Zl7DsZhz6Km0i9dDodegPlOLaZTKZzA+MxpiqWmBa92Mcubl7AMbqpVAqSQrRC30u7zqHtxMREKJBazRHBRCIRyZ4/KFXHmyEb169fB9uOsg3gcHBwAFeuXIm05240GnLfffXq1UgipWziV3UPxvF4ampKpmJYqQtVLxQKMDs7KwMWVlALdnZ2pH2YHmCQbt261cUy7wfjqn/s2DHJTFAqou3MzAzcuHED8vm8DECQPRZM7zt37kj7ra2tQHE7fvy4zIy+MG4uZ3q0sQYBweuQcXQEW6xBLKIdjqnsse9nr8b2FDfej52bNtfDUh2v60XV9RKm6ji2/lv8jMvHwG5Vx6UMlTrsJrqqj4yMhNqaqh5m763qfXhIUaqOKo2qHiW6qOpra2uRmMZHTdSOS5cuhS5LD3Q5UwPPz89L1sNSF+chqvTCwkKoquN9UNWLxaK0DxsbNQCF8L+kOo3KuKpq0MnJydA3nmg/PT0t0xxbZDPsDamyx+UyyB7HnpubawXH9LNvLyJ0p6KoNLZRHMJxFZtB9mrMvr2ICFL1fu7VUT96se+Dqvvv1bEG3UR3rFdVR+BBqq7G7p+4GW83kDkUqWvXrvW0V0eV7kXVL1++HHmvrqu78jn2VEenVlZWBu6DQhyp3vFV0dzArK+vD+SXFJ8NTNfnYS/g5h9lWJC4DXLR/GXg/UcgX8bZIwScRWWcLS0tFeR8BtgZZuACx9/Yrq6ujvoxztvX8P3l5eWK6KfVZqDeaMKQIe94t4GYhPKnday2R4rrpfrZNz8c/l8/xkdzctGt1WvypiMWdY4bTfe9EZPHI0nHt/v7pThSrGrqn8m4zvaOvofP3fttNg4CDreMYz87t83Gw/usjgWxCdZbKW8yrgo+8uC2KRXlQSZCUVu4VESW4mCcueNti3rCHLfjm7iICn4aScKjWQ4F4xmTcRWJP2NmWpVMj/blOPc2GvMtZff6L6vfP5YH5Y+7/o8V3S33Oe/7v3QYErBRgwB+czxMlIa1+IrkvwIMANKaPx47pbRTAAAAAElFTkSuQmCC\")}.chartIconImg{background-image:url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD4AAAAzCAYAAADPX7uaAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RDk0MUYxOEJDQzFFMTFFMkIxOUNERTUyRTI5MjFDNEYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RDk0MUYxOENDQzFFMTFFMkIxOUNERTUyRTI5MjFDNEYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpEOTQxRjE4OUNDMUUxMUUyQjE5Q0RFNTJFMjkyMUM0RiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpEOTQxRjE4QUNDMUUxMUUyQjE5Q0RFNTJFMjkyMUM0RiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PpdyrHsAAAZISURBVHja3FpLbBtFGP5nd/1I/CCOm0AqUqRCKwQHJB6qgIioVBUnEkCV4MAhUgsHuCU8Du0hCXAAoRwAwYEeQJW4AAcCiuBSiebI4wDiIR4qEKQooYkdx3b83OGftXczO96x1/HGWXeiiXd2Znf/b77/NbNLwF0h0FuFthqguQRKmkwA8RE46nZsMyDE4Zj4UAuocEy5c+KxlHEnoIrQJi004CBAU4eqC+MID96JQUUAzVf+vJ9UXRcA81WcCCpjnAesCr+KgwYcNONOgKvCry4yrjmoNuHAqvUxmjAJfgTOg63Uq6jqVtuJcZ7tQHL01tgd4xMvBEJ9E0RRRn0dw3R9pVzcWfz568U3N1b+3JbYf4NzE0Frh44ci995cvKNM4+Mn3n0oXvhxuSAr4P32kZ69PMr3z7/iare9MuVL15av/prWuL4HD22pebH7z/9lBYMP3H2sVO+B80Kk5HJijI/ftuJU09y5tqAU2nm2EKRG6befvmcMYZS2hOVFSZzqD8+JThlm0/SJPHbAI42PTwYj1o37JWSQJlR9iEHtk2MVHNgnGed6txMshKLxXw5EdlsdtfJ7conDb+yOG4lKVQAHo1GYXZ21leg5+fnbTIKwB1Dr9YiXQVd141qlmq1avxOT0/7AvTCwgJUKhWbjNyxNMXWWsZGgXF+AlZXV10J9/HYFFS38xBAAnAa4cH3zsPhB+7qGPTIyEgNDSEyxttelvLIO7bp0rU0DOd0OEbisAFlqJRK3icvvIxeABdVXSyKorTexVBVI5sk9T92jZvrWsklazeTt2NVZ0VFQEzN3BcEjeOJQjoGLj7Xc1UXgfPHTHhXwAnnYikTunPGRZk8B65Tuaq7ZdxyqZQw1AZo1VB/74DbVJ16our2h/BAeeDr2Txm/7vjIsEgRIMB+64BqU2Cug/A7W3w3rnxKsoLf987lyDDHhgI4V1VePGe2+HC+Am7I6TMxhVPbFy0d8+dmyyBEYEHNLxV/BAukQ4DGRjAmJ3i+ond1hW1Y8ZF9rvu1W2GjA8kODFErwDRGtVZoYrh1U1V38ptwoeX37Jtkpw9PQORcKxj1e8cuN7cuYkOjBoJYi1sWf2kBoyP46wvW8zAp99chEACIDmYgNQ/OXj65HMQV9tf+/My0v1m3NlOCesw7M7st7y64dzY+VqfpgWMHQGtHxc/yTBsrxVwQrQ92X9Xw5ldQM6OERgP3BYhMJCbcVypRwRaZSzVtN3M6kr5ImTW07ZnDR4ZcpWteRTO5IxLY7jJNLFv29P6HztvVuC0gdY1gp3/6avv4KNn34UgihgO90GOFOD1lQ+6yLhOXXlJGwLirKo6YWszKs9yuHkiGBKjpA+SJAY3D90CPxR+d23jTOZ9X6Q4AlBA/kqPSE6Txi6mHVVU2yqtQLMXoPsSx+lelqWkUU4j2uFJJ8YJNMWF86gcgHMTGG+ZeFTxocUyQLCRWubYKDizQZtgJ9YOUhcTmPY3ImgNfJvgZJ2mGXR9I6KtJR+mogTjMGHpqzAOe4ytJ1VEwWxbZZcq0NiFSRBeE1b78T85WFU3c3VR5a9lcwY8SstA0+uQPTps9e2ktzFz1+A3yEBer8JRZgqGVeC98bCUwtVddQuK+RJeX3tWpVCGAi3BJl7zR/oqpLdS0sxxL6rObyWbb0WDWHGJBeGHz53//tVnJhORcMi6YGxszHfby3Nzc7C8vGy1c4UiXHj/s9Tli6/djc0C1iLb+oPdt6h626oeiURgZmbGV8ATiYQnqm57qygmMEtLS+DHIklgqMxtahK/an06QT3YXu524eTVwflDICnj+nUEXHfLuD4xMfEfO5EFSPUycMTxL/tdXFyMyxinu9fQzOTk5A4e95nJQLlShR5Dzrd2GCbM5/t4rJqDivOl8MqlL4udyjEYjxrZR6lcMh4aVJVau1JP8ahutIOhmmybmawXKlYQ/Z/IOM92yloXYImu/zjiBQHFNaEtG2eGTG94H+GxMGzIuqXyIuNm+RtrkiUxAODFPrCZb4ZdsuQF43r9fhtYj4v3tb0Tx1nJ17O267EUkfF+kXFzJv7ymGmz9Lc5Pu9lbsMxb3l2p29ZZV8s++XD3WYLWwDnD3sb+mXfpUOPgHU7CSCz8VZOqVeL1En+L8AAjJTPo0iRABoAAAAASUVORK5CYII=\")}"]
|
|
960
|
+
},] }
|
|
961
|
+
];
|
|
962
|
+
ChartheaderComponent.ctorParameters = function () { return [
|
|
963
|
+
{ type: PrincipalDashboardLibV2Service }
|
|
964
|
+
]; };
|
|
965
|
+
|
|
966
|
+
/*! *****************************************************************************
|
|
967
|
+
Copyright (c) Microsoft Corporation.
|
|
968
|
+
|
|
969
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
970
|
+
purpose with or without fee is hereby granted.
|
|
971
|
+
|
|
972
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
973
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
974
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
975
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
976
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
977
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
978
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
979
|
+
***************************************************************************** */
|
|
980
|
+
/* global Reflect, Promise */
|
|
981
|
+
var extendStatics = function (d, b) {
|
|
982
|
+
extendStatics = Object.setPrototypeOf ||
|
|
983
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
984
|
+
function (d, b) { for (var p in b)
|
|
985
|
+
if (Object.prototype.hasOwnProperty.call(b, p))
|
|
986
|
+
d[p] = b[p]; };
|
|
987
|
+
return extendStatics(d, b);
|
|
988
|
+
};
|
|
989
|
+
function __extends(d, b) {
|
|
990
|
+
if (typeof b !== "function" && b !== null)
|
|
991
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
992
|
+
extendStatics(d, b);
|
|
993
|
+
function __() { this.constructor = d; }
|
|
994
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
995
|
+
}
|
|
996
|
+
var __assign = function () {
|
|
997
|
+
__assign = Object.assign || function __assign(t) {
|
|
998
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
999
|
+
s = arguments[i];
|
|
1000
|
+
for (var p in s)
|
|
1001
|
+
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
1002
|
+
t[p] = s[p];
|
|
1003
|
+
}
|
|
1004
|
+
return t;
|
|
1005
|
+
};
|
|
1006
|
+
return __assign.apply(this, arguments);
|
|
1007
|
+
};
|
|
1008
|
+
function __rest(s, e) {
|
|
1009
|
+
var t = {};
|
|
1010
|
+
for (var p in s)
|
|
1011
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
1012
|
+
t[p] = s[p];
|
|
1013
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
1014
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1015
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
1016
|
+
t[p[i]] = s[p[i]];
|
|
1017
|
+
}
|
|
1018
|
+
return t;
|
|
1019
|
+
}
|
|
1020
|
+
function __decorate(decorators, target, key, desc) {
|
|
1021
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1022
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1023
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1024
|
+
else
|
|
1025
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
1026
|
+
if (d = decorators[i])
|
|
1027
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1028
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1029
|
+
}
|
|
1030
|
+
function __param(paramIndex, decorator) {
|
|
1031
|
+
return function (target, key) { decorator(target, key, paramIndex); };
|
|
1032
|
+
}
|
|
1033
|
+
function __metadata(metadataKey, metadataValue) {
|
|
1034
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
1035
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
1036
|
+
}
|
|
1037
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
1038
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
1039
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1040
|
+
function fulfilled(value) { try {
|
|
1041
|
+
step(generator.next(value));
|
|
1042
|
+
}
|
|
1043
|
+
catch (e) {
|
|
1044
|
+
reject(e);
|
|
1045
|
+
} }
|
|
1046
|
+
function rejected(value) { try {
|
|
1047
|
+
step(generator["throw"](value));
|
|
1048
|
+
}
|
|
1049
|
+
catch (e) {
|
|
1050
|
+
reject(e);
|
|
1051
|
+
} }
|
|
1052
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
1053
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
1056
|
+
function __generator(thisArg, body) {
|
|
1057
|
+
var _ = { label: 0, sent: function () { if (t[0] & 1)
|
|
1058
|
+
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
1059
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
|
1060
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
1061
|
+
function step(op) {
|
|
1062
|
+
if (f)
|
|
1063
|
+
throw new TypeError("Generator is already executing.");
|
|
1064
|
+
while (_)
|
|
1065
|
+
try {
|
|
1066
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
|
1067
|
+
return t;
|
|
1068
|
+
if (y = 0, t)
|
|
1069
|
+
op = [op[0] & 2, t.value];
|
|
1070
|
+
switch (op[0]) {
|
|
1071
|
+
case 0:
|
|
1072
|
+
case 1:
|
|
1073
|
+
t = op;
|
|
1074
|
+
break;
|
|
1075
|
+
case 4:
|
|
1076
|
+
_.label++;
|
|
1077
|
+
return { value: op[1], done: false };
|
|
1078
|
+
case 5:
|
|
1079
|
+
_.label++;
|
|
1080
|
+
y = op[1];
|
|
1081
|
+
op = [0];
|
|
1082
|
+
continue;
|
|
1083
|
+
case 7:
|
|
1084
|
+
op = _.ops.pop();
|
|
1085
|
+
_.trys.pop();
|
|
1086
|
+
continue;
|
|
1087
|
+
default:
|
|
1088
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
1089
|
+
_ = 0;
|
|
1090
|
+
continue;
|
|
1091
|
+
}
|
|
1092
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
1093
|
+
_.label = op[1];
|
|
1094
|
+
break;
|
|
1095
|
+
}
|
|
1096
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
1097
|
+
_.label = t[1];
|
|
1098
|
+
t = op;
|
|
1099
|
+
break;
|
|
1100
|
+
}
|
|
1101
|
+
if (t && _.label < t[2]) {
|
|
1102
|
+
_.label = t[2];
|
|
1103
|
+
_.ops.push(op);
|
|
1104
|
+
break;
|
|
1105
|
+
}
|
|
1106
|
+
if (t[2])
|
|
1107
|
+
_.ops.pop();
|
|
1108
|
+
_.trys.pop();
|
|
1109
|
+
continue;
|
|
1110
|
+
}
|
|
1111
|
+
op = body.call(thisArg, _);
|
|
1112
|
+
}
|
|
1113
|
+
catch (e) {
|
|
1114
|
+
op = [6, e];
|
|
1115
|
+
y = 0;
|
|
1116
|
+
}
|
|
1117
|
+
finally {
|
|
1118
|
+
f = t = 0;
|
|
1119
|
+
}
|
|
1120
|
+
if (op[0] & 5)
|
|
1121
|
+
throw op[1];
|
|
1122
|
+
return { value: op[0] ? op[1] : void 0, done: true };
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
|
1126
|
+
if (k2 === undefined)
|
|
1127
|
+
k2 = k;
|
|
1128
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
|
1129
|
+
}) : (function (o, m, k, k2) {
|
|
1130
|
+
if (k2 === undefined)
|
|
1131
|
+
k2 = k;
|
|
1132
|
+
o[k2] = m[k];
|
|
1133
|
+
});
|
|
1134
|
+
function __exportStar(m, o) {
|
|
1135
|
+
for (var p in m)
|
|
1136
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
|
1137
|
+
__createBinding(o, m, p);
|
|
1138
|
+
}
|
|
1139
|
+
function __values(o) {
|
|
1140
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
1141
|
+
if (m)
|
|
1142
|
+
return m.call(o);
|
|
1143
|
+
if (o && typeof o.length === "number")
|
|
1144
|
+
return {
|
|
1145
|
+
next: function () {
|
|
1146
|
+
if (o && i >= o.length)
|
|
1147
|
+
o = void 0;
|
|
1148
|
+
return { value: o && o[i++], done: !o };
|
|
1149
|
+
}
|
|
1150
|
+
};
|
|
1151
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
1152
|
+
}
|
|
1153
|
+
function __read(o, n) {
|
|
1154
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
1155
|
+
if (!m)
|
|
1156
|
+
return o;
|
|
1157
|
+
var i = m.call(o), r, ar = [], e;
|
|
1158
|
+
try {
|
|
1159
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
1160
|
+
ar.push(r.value);
|
|
1161
|
+
}
|
|
1162
|
+
catch (error) {
|
|
1163
|
+
e = { error: error };
|
|
1164
|
+
}
|
|
1165
|
+
finally {
|
|
1166
|
+
try {
|
|
1167
|
+
if (r && !r.done && (m = i["return"]))
|
|
1168
|
+
m.call(i);
|
|
1169
|
+
}
|
|
1170
|
+
finally {
|
|
1171
|
+
if (e)
|
|
1172
|
+
throw e.error;
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
return ar;
|
|
1176
|
+
}
|
|
1177
|
+
/** @deprecated */
|
|
1178
|
+
function __spread() {
|
|
1179
|
+
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
1180
|
+
ar = ar.concat(__read(arguments[i]));
|
|
1181
|
+
return ar;
|
|
1182
|
+
}
|
|
1183
|
+
/** @deprecated */
|
|
1184
|
+
function __spreadArrays() {
|
|
1185
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
1186
|
+
s += arguments[i].length;
|
|
1187
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
1188
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
1189
|
+
r[k] = a[j];
|
|
1190
|
+
return r;
|
|
1191
|
+
}
|
|
1192
|
+
function __spreadArray(to, from, pack) {
|
|
1193
|
+
if (pack || arguments.length === 2)
|
|
1194
|
+
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
1195
|
+
if (ar || !(i in from)) {
|
|
1196
|
+
if (!ar)
|
|
1197
|
+
ar = Array.prototype.slice.call(from, 0, i);
|
|
1198
|
+
ar[i] = from[i];
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
return to.concat(ar || from);
|
|
1202
|
+
}
|
|
1203
|
+
function __await(v) {
|
|
1204
|
+
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
1205
|
+
}
|
|
1206
|
+
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
1207
|
+
if (!Symbol.asyncIterator)
|
|
1208
|
+
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
1209
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
1210
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
1211
|
+
function verb(n) { if (g[n])
|
|
1212
|
+
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
1213
|
+
function resume(n, v) { try {
|
|
1214
|
+
step(g[n](v));
|
|
1215
|
+
}
|
|
1216
|
+
catch (e) {
|
|
1217
|
+
settle(q[0][3], e);
|
|
1218
|
+
} }
|
|
1219
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
1220
|
+
function fulfill(value) { resume("next", value); }
|
|
1221
|
+
function reject(value) { resume("throw", value); }
|
|
1222
|
+
function settle(f, v) { if (f(v), q.shift(), q.length)
|
|
1223
|
+
resume(q[0][0], q[0][1]); }
|
|
1224
|
+
}
|
|
1225
|
+
function __asyncDelegator(o) {
|
|
1226
|
+
var i, p;
|
|
1227
|
+
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
1228
|
+
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
|
1229
|
+
}
|
|
1230
|
+
function __asyncValues(o) {
|
|
1231
|
+
if (!Symbol.asyncIterator)
|
|
1232
|
+
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
1233
|
+
var m = o[Symbol.asyncIterator], i;
|
|
1234
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
1235
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
1236
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
1237
|
+
}
|
|
1238
|
+
function __makeTemplateObject(cooked, raw) {
|
|
1239
|
+
if (Object.defineProperty) {
|
|
1240
|
+
Object.defineProperty(cooked, "raw", { value: raw });
|
|
1241
|
+
}
|
|
1242
|
+
else {
|
|
1243
|
+
cooked.raw = raw;
|
|
1244
|
+
}
|
|
1245
|
+
return cooked;
|
|
1246
|
+
}
|
|
1247
|
+
;
|
|
1248
|
+
var __setModuleDefault = Object.create ? (function (o, v) {
|
|
1249
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
1250
|
+
}) : function (o, v) {
|
|
1251
|
+
o["default"] = v;
|
|
1252
|
+
};
|
|
1253
|
+
function __importStar(mod) {
|
|
1254
|
+
if (mod && mod.__esModule)
|
|
1255
|
+
return mod;
|
|
1256
|
+
var result = {};
|
|
1257
|
+
if (mod != null)
|
|
1258
|
+
for (var k in mod)
|
|
1259
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
1260
|
+
__createBinding(result, mod, k);
|
|
1261
|
+
__setModuleDefault(result, mod);
|
|
1262
|
+
return result;
|
|
1263
|
+
}
|
|
1264
|
+
function __importDefault(mod) {
|
|
1265
|
+
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
1266
|
+
}
|
|
1267
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
1268
|
+
if (kind === "a" && !f)
|
|
1269
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
1270
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
1271
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
1272
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
1273
|
+
}
|
|
1274
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
1275
|
+
if (kind === "m")
|
|
1276
|
+
throw new TypeError("Private method is not writable");
|
|
1277
|
+
if (kind === "a" && !f)
|
|
1278
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
1279
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
1280
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
1281
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
var ChartviewComponent = /** @class */ (function () {
|
|
1285
|
+
function ChartviewComponent(pdService) {
|
|
1286
|
+
this.pdService = pdService;
|
|
1287
|
+
this.totalUsers = 0;
|
|
1288
|
+
this.eligibleUsers = 0;
|
|
1289
|
+
this.currentUsers = 0;
|
|
1290
|
+
this.myChartType = angularGoogleCharts.ChartType.Timeline;
|
|
1291
|
+
this.myChartwidth = window.innerWidth * 0.88;
|
|
1292
|
+
this.myChartHeight = window.innerHeight;
|
|
1293
|
+
this.currentList = "Current Users";
|
|
1294
|
+
this.allList = "All Users";
|
|
1295
|
+
this.isAllUsers = false;
|
|
1296
|
+
this.isUserWise = false;
|
|
1297
|
+
this.isSubscribed = false;
|
|
1298
|
+
// set to false to go back to the Google timeline chart
|
|
1299
|
+
this.useCustomTimeline = true;
|
|
1300
|
+
this.isTableView = false;
|
|
1301
|
+
this.timelineRows = [];
|
|
1302
|
+
this.timelineList = [];
|
|
1303
|
+
this.myChartDataMatrix = new Array();
|
|
1304
|
+
this.totalChartDataMatrix = new Array();
|
|
1305
|
+
}
|
|
1306
|
+
Object.defineProperty(ChartviewComponent.prototype, "data", {
|
|
1307
|
+
set: function (res) {
|
|
1308
|
+
if (res !== null) {
|
|
1309
|
+
this.loadChart(res);
|
|
1310
|
+
}
|
|
1311
|
+
},
|
|
1312
|
+
enumerable: false,
|
|
1313
|
+
configurable: true
|
|
1314
|
+
});
|
|
1315
|
+
ChartviewComponent.prototype.ngOnInit = function () { };
|
|
1316
|
+
ChartviewComponent.prototype.loadChart = function (response) {
|
|
1317
|
+
var _this = this;
|
|
1318
|
+
//console.log(' INloadChart -->', response);
|
|
1319
|
+
this.totalUsers = 0;
|
|
1320
|
+
this.eligibleUsers = 0;
|
|
1321
|
+
this.currentUsers = 0;
|
|
1322
|
+
this.myChartType = angularGoogleCharts.ChartType.Timeline;
|
|
1323
|
+
this.myChartwidth = window.innerWidth * 0.88;
|
|
1324
|
+
this.myChartHeight = window.innerHeight;
|
|
1325
|
+
this.currentList = "Current Users";
|
|
1326
|
+
this.allList = "All Users";
|
|
1327
|
+
this.isAllUsers = false;
|
|
1328
|
+
this.pdService.isAllUsers.next(false);
|
|
1329
|
+
this.isUserWise = false;
|
|
1330
|
+
this.myChartDataMatrix = [];
|
|
1331
|
+
this.totalChartDataMatrix = [];
|
|
1332
|
+
this.chartview = document.getElementById('pd-chartview');
|
|
1333
|
+
this.myDataList = document.getElementById('pd-xmlData');
|
|
1334
|
+
// let parse = new DOMParser();
|
|
1335
|
+
if (response) {
|
|
1336
|
+
this.myXmlData = JSON.parse(response);
|
|
1337
|
+
}
|
|
1338
|
+
if (this.myXmlData) {
|
|
1339
|
+
this.currentdataList = this.pdService.genarateUserReqiuredData(this.myXmlData);
|
|
1340
|
+
this.alluserList = this.pdService.allUserChartData();
|
|
1341
|
+
this.allRoomsList = this.pdService.allRoomsData();
|
|
1342
|
+
this.resourceDataList = this.pdService.genarateResourseReqiuredData(this.myXmlData);
|
|
1343
|
+
this.totalUsers = this.currentdataList.usersMetadata.length;
|
|
1344
|
+
this.eligibleUsers = this.findEligibleUserCount();
|
|
1345
|
+
this.installedClassrooms = this.findInstalledClassrooms();
|
|
1346
|
+
this.currentRooms = this.findCurrentClassrooms();
|
|
1347
|
+
this.findCurrentUserCount();
|
|
1348
|
+
}
|
|
1349
|
+
// subscribe once; on later reloads just redraw the currently selected view
|
|
1350
|
+
if (this.isSubscribed) {
|
|
1351
|
+
this.updateDataType(this.pdService.isUserWise_data.value);
|
|
1352
|
+
return;
|
|
1353
|
+
}
|
|
1354
|
+
this.isSubscribed = true;
|
|
1355
|
+
this.pdService.chartType.subscribe(function (data) {
|
|
1356
|
+
if (data) {
|
|
1357
|
+
_this.updateChartType(data);
|
|
1358
|
+
}
|
|
1359
|
+
});
|
|
1360
|
+
this.pdService.isUserWise_data.subscribe(function (data) {
|
|
1361
|
+
_this.updateDataType(data);
|
|
1362
|
+
});
|
|
1363
|
+
this.pdService.isInsightsView.subscribe(function (insights) {
|
|
1364
|
+
if (!insights) {
|
|
1365
|
+
setTimeout(function () { return _this.fitChartHeight(); });
|
|
1366
|
+
}
|
|
1367
|
+
});
|
|
1368
|
+
window.addEventListener('resize', this.onResizeWindow.bind(this));
|
|
1369
|
+
};
|
|
1370
|
+
ChartviewComponent.prototype.onResizeWindow = function (event) {
|
|
1371
|
+
this.myChartwidth = window.innerWidth * 0.88; //set an appropriate factor
|
|
1372
|
+
this.fitChartHeight();
|
|
1373
|
+
};
|
|
1374
|
+
// stretch the chart area from where it starts down to the bottom of the window
|
|
1375
|
+
ChartviewComponent.prototype.fitChartHeight = function () {
|
|
1376
|
+
var chartview = document.getElementById('pd-chartview');
|
|
1377
|
+
if (!chartview || chartview.style.display === 'none')
|
|
1378
|
+
return;
|
|
1379
|
+
var top = chartview.getBoundingClientRect().top + window.scrollY;
|
|
1380
|
+
var height = Math.max(window.innerHeight - top - 8, 240);
|
|
1381
|
+
chartview.style.height = height + 'px';
|
|
1382
|
+
};
|
|
1383
|
+
ChartviewComponent.prototype.myChartReady = function () {
|
|
1384
|
+
this.createDivforTotalDurartion();
|
|
1385
|
+
this.setHeightofDivforTotalDurartion();
|
|
1386
|
+
// this.removeBlankEntryBar();
|
|
1387
|
+
};
|
|
1388
|
+
ChartviewComponent.prototype.updateChartType = function (dataType) {
|
|
1389
|
+
var _this = this;
|
|
1390
|
+
this.isTableView = dataType == angularGoogleCharts.ChartType.Table;
|
|
1391
|
+
if (this.chartview != null && this.chartview != undefined) {
|
|
1392
|
+
if (dataType == angularGoogleCharts.ChartType.Table) {
|
|
1393
|
+
this.chartview.style.display = 'none';
|
|
1394
|
+
}
|
|
1395
|
+
else {
|
|
1396
|
+
this.chartview.style.display = 'block';
|
|
1397
|
+
setTimeout(function () { return _this.fitChartHeight(); });
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
};
|
|
1401
|
+
ChartviewComponent.prototype.updateDataType = function (dataType) {
|
|
1402
|
+
var _this = this;
|
|
1403
|
+
setTimeout(function () { return _this.fitChartHeight(); });
|
|
1404
|
+
this.isUserWise = dataType;
|
|
1405
|
+
if (this.myXmlData) {
|
|
1406
|
+
if (this.isUserWise) {
|
|
1407
|
+
this.currentList = "Current Users";
|
|
1408
|
+
this.allList = "All Users";
|
|
1409
|
+
if (this.isAllUsers) {
|
|
1410
|
+
this.userWiseAllData();
|
|
1411
|
+
}
|
|
1412
|
+
else {
|
|
1413
|
+
this.userWiseCurrentData();
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
else {
|
|
1417
|
+
this.allList = "All Rooms";
|
|
1418
|
+
this.currentList = "Current Rooms";
|
|
1419
|
+
if (this.isAllUsers) {
|
|
1420
|
+
this.classRoomWiseAllData();
|
|
1421
|
+
}
|
|
1422
|
+
else {
|
|
1423
|
+
this.classRoomWiseCurrentData();
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
};
|
|
1428
|
+
ChartviewComponent.prototype.updateChart = function () {
|
|
1429
|
+
var _this = this;
|
|
1430
|
+
var labels = document.getElementById('labels');
|
|
1431
|
+
while (labels && labels.firstChild) {
|
|
1432
|
+
labels.removeChild(labels.lastChild);
|
|
1433
|
+
}
|
|
1434
|
+
this.chartDataTable = this.myChartDataMatrix;
|
|
1435
|
+
//const filteredData = this.myChartDataMatrix.filter(node => node[0] !== "-");
|
|
1436
|
+
/*
|
|
1437
|
+
if(filteredData.length>0){
|
|
1438
|
+
this.chartDataTable = filteredData;
|
|
1439
|
+
}else{
|
|
1440
|
+
this.chartDataTable = this.myChartDataMatrix;
|
|
1441
|
+
}*/
|
|
1442
|
+
//console.log("this.myChartDataMatrix",this.myChartDataMatrix);
|
|
1443
|
+
(this.myChartOptions = {
|
|
1444
|
+
tooltip: {
|
|
1445
|
+
trigger: 'none',
|
|
1446
|
+
},
|
|
1447
|
+
colors: ['#ff7f0e', '#2ca02c', '#8c564b', '#d62728', '#bcbd22', '#17becf'],
|
|
1448
|
+
timeline: {
|
|
1449
|
+
colorByRowLabel: true,
|
|
1450
|
+
barLabelStyle: {
|
|
1451
|
+
fontSize: 7,
|
|
1452
|
+
},
|
|
1453
|
+
},
|
|
1454
|
+
hAxis: {
|
|
1455
|
+
format: 'HH:mm a',
|
|
1456
|
+
},
|
|
1457
|
+
});
|
|
1458
|
+
setTimeout(function () {
|
|
1459
|
+
_this.myChartHeight = _this.AllrowHeight + 100; //to set perfect height of chart
|
|
1460
|
+
}, 1000);
|
|
1461
|
+
};
|
|
1462
|
+
ChartviewComponent.prototype.filterUserHasDash = function (callee) {
|
|
1463
|
+
var leftData = this.myChartDataMatrix;
|
|
1464
|
+
var rightData = this.currentdataList.userConsoleData;
|
|
1465
|
+
var updatedChartData = leftData.filter(function (row) { return row[0] !== "-"; });
|
|
1466
|
+
// Filter out objects in rightData where the userName is "-"
|
|
1467
|
+
var updatedRightData = rightData.filter(function (item) { return item.userName !== "-"; });
|
|
1468
|
+
return {
|
|
1469
|
+
updatedChartData: updatedChartData,
|
|
1470
|
+
updatedRightData: updatedRightData
|
|
1471
|
+
};
|
|
1472
|
+
};
|
|
1473
|
+
ChartviewComponent.prototype.calulateTotalDuration = function (detailViewMatrix) {
|
|
1474
|
+
//
|
|
1475
|
+
//const filteredData = detailViewMatrix.filter(item => item.userName !== "-" && item.userName !== "--");
|
|
1476
|
+
//detailViewMatrix = filteredData;
|
|
1477
|
+
var id_durationArray;
|
|
1478
|
+
var id_durationMatrix = new Array();
|
|
1479
|
+
id_durationMatrix = [];
|
|
1480
|
+
this.totalChartDataMatrix = [];
|
|
1481
|
+
if (this.isUserWise) {
|
|
1482
|
+
for (var i = 0; i < detailViewMatrix.length; i++) {
|
|
1483
|
+
id_durationArray = {
|
|
1484
|
+
name: detailViewMatrix[i].userName,
|
|
1485
|
+
value: parseInt(detailViewMatrix[i].duration),
|
|
1486
|
+
};
|
|
1487
|
+
id_durationMatrix.push(id_durationArray);
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
else {
|
|
1491
|
+
for (var i = 0; i < detailViewMatrix.length; i++) {
|
|
1492
|
+
// console.log("detailViewMatrix[i]",detailViewMatrix[i]);
|
|
1493
|
+
id_durationArray = {
|
|
1494
|
+
name: this.pdService.getRoomLabel(detailViewMatrix[i].terminalLocation, detailViewMatrix[i].terminalIP),
|
|
1495
|
+
value: parseInt(detailViewMatrix[i].duration),
|
|
1496
|
+
};
|
|
1497
|
+
id_durationMatrix.push(id_durationArray);
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
var obj = {};
|
|
1501
|
+
id_durationMatrix = __spread(new Set(id_durationMatrix));
|
|
1502
|
+
id_durationMatrix.forEach(function (item) {
|
|
1503
|
+
if (obj[item.name]) {
|
|
1504
|
+
obj[item.name].value = obj[item.name].value + item.value;
|
|
1505
|
+
}
|
|
1506
|
+
else {
|
|
1507
|
+
obj[item.name] = item;
|
|
1508
|
+
}
|
|
1509
|
+
});
|
|
1510
|
+
var valuesArr = Object.values(obj);
|
|
1511
|
+
var myArray = new Array();
|
|
1512
|
+
myArray = [];
|
|
1513
|
+
valuesArr.forEach(function (item) {
|
|
1514
|
+
myArray.push(item.value);
|
|
1515
|
+
});
|
|
1516
|
+
for (var i = 0; i < myArray.length; i++) {
|
|
1517
|
+
var totaldurationPerRow = [this.timeConvert(myArray[i]).toString() + ' hrs'];
|
|
1518
|
+
// let totalChartRowDataArray = [totaldurationPerRow];
|
|
1519
|
+
this.totalChartDataMatrix.push(totaldurationPerRow);
|
|
1520
|
+
}
|
|
1521
|
+
};
|
|
1522
|
+
ChartviewComponent.prototype.timeConvert = function (n) {
|
|
1523
|
+
var num = Math.floor(n);
|
|
1524
|
+
var hours = num / 60;
|
|
1525
|
+
var rhours = Math.floor(hours);
|
|
1526
|
+
var minutes = (hours - rhours) * 60;
|
|
1527
|
+
var rminutes = Math.round(minutes);
|
|
1528
|
+
return rhours + ':' + rminutes;
|
|
1529
|
+
};
|
|
1530
|
+
ChartviewComponent.prototype.removeBlankEntryBar = function () {
|
|
1531
|
+
var chartDiv = document.getElementById('myTimeLine');
|
|
1532
|
+
var el = chartDiv.getElementsByTagName("rect"); //get all the descendant rect element inside the container
|
|
1533
|
+
var width = 100000000; //set a large initial value to width
|
|
1534
|
+
var elToRem = []; //element would be added to this array for removal
|
|
1535
|
+
for (var i = 0; i < el.length; i++) { //looping over all the rect element of container
|
|
1536
|
+
var cwidth = parseInt(el[i].getAttribute("width")); //getting the width of ith element
|
|
1537
|
+
if (cwidth < width) { //if current element width is less than previous width then this is min. width and ith element should be removed
|
|
1538
|
+
elToRem = [el[i]];
|
|
1539
|
+
width = cwidth; //setting the width with min width
|
|
1540
|
+
}
|
|
1541
|
+
else if (cwidth == width) { //if current element width is equal to previous width then more that one element would be removed
|
|
1542
|
+
elToRem.push(el[i]);
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
for (var i = 0; i < elToRem.length; i++) {
|
|
1546
|
+
// now iterate JUST the elements to remove
|
|
1547
|
+
elToRem[i].setAttribute("fill", "none");
|
|
1548
|
+
}
|
|
1549
|
+
};
|
|
1550
|
+
ChartviewComponent.prototype.createDivforTotalDurartion = function () {
|
|
1551
|
+
var rowLabels = [];
|
|
1552
|
+
this.rowElements = [];
|
|
1553
|
+
var labels = document.getElementById('labels');
|
|
1554
|
+
if (!labels)
|
|
1555
|
+
return;
|
|
1556
|
+
while (labels.firstChild) {
|
|
1557
|
+
labels.removeChild(labels.lastChild);
|
|
1558
|
+
}
|
|
1559
|
+
for (var i = 0; i < this.totalChartDataMatrix.length; i++) {
|
|
1560
|
+
var team = this.totalChartDataMatrix[i][0];
|
|
1561
|
+
rowLabels.push(team);
|
|
1562
|
+
var label = labels.appendChild(document.createElement('div'));
|
|
1563
|
+
label.style['border-bottom'] = '1px solid #b7b7b7';
|
|
1564
|
+
label.style['font-family'] = 'Arial';
|
|
1565
|
+
label.style['font-size'] = '13px';
|
|
1566
|
+
label.style['text-align'] = 'left';
|
|
1567
|
+
label.style['padding-left'] = '8px';
|
|
1568
|
+
label.style['padding-right'] = '8px';
|
|
1569
|
+
label.style.position = 'inherit';
|
|
1570
|
+
if (i % 2) {
|
|
1571
|
+
label.style['background-color'] = '#e6e6e6';
|
|
1572
|
+
}
|
|
1573
|
+
else {
|
|
1574
|
+
label.style['background-color'] = '#ffffff';
|
|
1575
|
+
}
|
|
1576
|
+
label.innerHTML = team;
|
|
1577
|
+
this.rowElements.push(label);
|
|
1578
|
+
}
|
|
1579
|
+
};
|
|
1580
|
+
ChartviewComponent.prototype.setHeightofDivforTotalDurartion = function () {
|
|
1581
|
+
this.AllrowHeight = 0;
|
|
1582
|
+
var chartDiv = document.getElementById('myTimeLine');
|
|
1583
|
+
var rows = chartDiv.getElementsByTagName('rect');
|
|
1584
|
+
var rowIndex = -1;
|
|
1585
|
+
for (var i = 0; i < rows.length; i++) {
|
|
1586
|
+
rowIndex++;
|
|
1587
|
+
if (rowIndex < this.rowElements.length) {
|
|
1588
|
+
var rowHeight = parseFloat(rows[i].getAttribute('height')) + 'px';
|
|
1589
|
+
this.AllrowHeight += parseFloat(rows[i].getAttribute('height'));
|
|
1590
|
+
var currentCell = this.rowElements[rowIndex];
|
|
1591
|
+
if (currentCell) {
|
|
1592
|
+
currentCell.style.height = rowHeight;
|
|
1593
|
+
currentCell.style.lineHeight = rowHeight;
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
};
|
|
1598
|
+
// rows for lib-timeline, one per teacher or room, bars point back into `list` by index
|
|
1599
|
+
ChartviewComponent.prototype.buildTimeline = function (list) {
|
|
1600
|
+
var _this = this;
|
|
1601
|
+
this.timelineList = list || [];
|
|
1602
|
+
var rows = [];
|
|
1603
|
+
var rowByLabel = {};
|
|
1604
|
+
this.timelineList.forEach(function (session, index) {
|
|
1605
|
+
var label = _this.isUserWise
|
|
1606
|
+
? session.userName
|
|
1607
|
+
: _this.pdService.getRoomLabel(session.terminalLocation, session.terminalIP);
|
|
1608
|
+
if (label === undefined || label === null || label === '' || label === '--')
|
|
1609
|
+
return;
|
|
1610
|
+
if (label === '-')
|
|
1611
|
+
label = 'Unknown user';
|
|
1612
|
+
var row = rowByLabel[label];
|
|
1613
|
+
if (!row) {
|
|
1614
|
+
row = rowByLabel[label] = { label: label, bars: [] };
|
|
1615
|
+
rows.push(row);
|
|
1616
|
+
}
|
|
1617
|
+
if (_this.isSession(session)) {
|
|
1618
|
+
var other = _this.isUserWise
|
|
1619
|
+
? _this.pdService.getRoomLabel(session.terminalLocation, session.terminalIP)
|
|
1620
|
+
: session.userName;
|
|
1621
|
+
var time = session.startTime.toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit' }) +
|
|
1622
|
+
' – ' + session.endTime.toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit' });
|
|
1623
|
+
row.bars.push({
|
|
1624
|
+
start: session.startTime,
|
|
1625
|
+
end: session.endTime,
|
|
1626
|
+
index: index,
|
|
1627
|
+
tooltip: ((other || '') + "\n" + time).trim(),
|
|
1628
|
+
});
|
|
1629
|
+
}
|
|
1630
|
+
});
|
|
1631
|
+
this.timelineRows = rows;
|
|
1632
|
+
};
|
|
1633
|
+
// idle user / room placeholders have no user or no real start time
|
|
1634
|
+
ChartviewComponent.prototype.isSession = function (session) {
|
|
1635
|
+
return !!session && !!session.userId &&
|
|
1636
|
+
session.startTime instanceof Date && !isNaN(session.startTime.getTime()) &&
|
|
1637
|
+
session.endTime instanceof Date && !isNaN(session.endTime.getTime());
|
|
1638
|
+
};
|
|
1639
|
+
// every session of one row: a teacher's day (user wise) or a room's day (classroom wise)
|
|
1640
|
+
ChartviewComponent.prototype.openRow = function (event) {
|
|
1641
|
+
var _this = this;
|
|
1642
|
+
var sessions = event.indexes
|
|
1643
|
+
.map(function (i) { return _this.timelineList[i]; })
|
|
1644
|
+
.filter(function (s) { return _this.isSession(s); })
|
|
1645
|
+
.map(function (s) { return ({ userId: s.userId, ip: s.terminalIP, start: s.startTime.getTime() }); });
|
|
1646
|
+
if (!sessions.length)
|
|
1647
|
+
return;
|
|
1648
|
+
this.pdService.detailAccentColor = event.color;
|
|
1649
|
+
this.pdService.detailRowRequest = { label: event.label, isUserWise: this.isUserWise, total: event.total, sessions: sessions };
|
|
1650
|
+
this.pdService.openSmallTable.next({ allSessions: true });
|
|
1651
|
+
};
|
|
1652
|
+
ChartviewComponent.prototype.openSession = function (event) {
|
|
1653
|
+
var index = event.index;
|
|
1654
|
+
var session = this.timelineList[index];
|
|
1655
|
+
if (!this.isSession(session))
|
|
1656
|
+
return;
|
|
1657
|
+
this.pdService.detailAccentColor = event.color;
|
|
1658
|
+
this.pdService.detailRowRequest = null;
|
|
1659
|
+
this.selectedUserData = this.pdService.dataForDetailedView(this.timelineList, this.resourceDataList, index);
|
|
1660
|
+
this.pdService.detailedviewData.next(this.selectedUserData);
|
|
1661
|
+
this.pdService.openSmallTable.next(this.selectedUserData);
|
|
1662
|
+
};
|
|
1663
|
+
ChartviewComponent.prototype.onSelectRowData = function (event) {
|
|
1664
|
+
var _a = event.selection[0], row = _a.row, column = _a.column;
|
|
1665
|
+
// pick the same list the chart rows were built from
|
|
1666
|
+
var selectedList = this.currentdataList.userConsoleData;
|
|
1667
|
+
if (this.isAllUsers) {
|
|
1668
|
+
selectedList = this.isUserWise ? this.alluserList.fordurationTable : this.allRoomsList.fordurationTable;
|
|
1669
|
+
}
|
|
1670
|
+
// idle room / user rows have no session to show
|
|
1671
|
+
if (!selectedList[row] || !selectedList[row].userId || !selectedList[row].startTime) {
|
|
1672
|
+
return;
|
|
1673
|
+
}
|
|
1674
|
+
this.selectedUserData = this.pdService.dataForDetailedView(selectedList, this.resourceDataList, row);
|
|
1675
|
+
var smallData = [{ 'a': this.currentdataList, 'b': row }];
|
|
1676
|
+
// console.log("this.selectedUserData",this.selectedUserData);
|
|
1677
|
+
this.pdService.detailedviewData.next(this.selectedUserData);
|
|
1678
|
+
this.updateChart();
|
|
1679
|
+
this.pdService.openSmallTable.next(this.selectedUserData);
|
|
1680
|
+
// alluserList
|
|
1681
|
+
};
|
|
1682
|
+
ChartviewComponent.prototype.showAllUser = function () {
|
|
1683
|
+
this.pdService.isAllUsers.next(true);
|
|
1684
|
+
this.isAllUsers = true;
|
|
1685
|
+
if (this.isUserWise) {
|
|
1686
|
+
this.userWiseAllData();
|
|
1687
|
+
}
|
|
1688
|
+
else {
|
|
1689
|
+
this.classRoomWiseAllData();
|
|
1690
|
+
}
|
|
1691
|
+
};
|
|
1692
|
+
ChartviewComponent.prototype.showCurrentUser = function () {
|
|
1693
|
+
this.isAllUsers = false;
|
|
1694
|
+
this.pdService.isAllUsers.next(false);
|
|
1695
|
+
if (this.isUserWise) {
|
|
1696
|
+
this.userWiseCurrentData();
|
|
1697
|
+
}
|
|
1698
|
+
else {
|
|
1699
|
+
this.classRoomWiseCurrentData();
|
|
1700
|
+
}
|
|
1701
|
+
};
|
|
1702
|
+
ChartviewComponent.prototype.userWiseCurrentData = function () {
|
|
1703
|
+
var chartDataUserWise = this.pdService.userWiseChartData();
|
|
1704
|
+
this.buildTimeline(this.currentdataList.userConsoleData);
|
|
1705
|
+
// console.log("chartDataUserWise",chartDataUserWise);
|
|
1706
|
+
if (chartDataUserWise.length > 0) {
|
|
1707
|
+
this.myChartDataMatrix = chartDataUserWise;
|
|
1708
|
+
this.updateChart();
|
|
1709
|
+
if (this.currentdataList.userConsoleData.length > 0) {
|
|
1710
|
+
this.calulateTotalDuration(this.currentdataList.userConsoleData);
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
};
|
|
1714
|
+
ChartviewComponent.prototype.userWiseAllData = function () {
|
|
1715
|
+
this.buildTimeline(this.alluserList.fordurationTable);
|
|
1716
|
+
var chartDataUserWise = this.alluserList.forChartData;
|
|
1717
|
+
if (chartDataUserWise.length > 0) {
|
|
1718
|
+
this.myChartDataMatrix = chartDataUserWise;
|
|
1719
|
+
this.updateChart();
|
|
1720
|
+
this.calulateTotalDuration(this.alluserList.fordurationTable);
|
|
1721
|
+
}
|
|
1722
|
+
};
|
|
1723
|
+
ChartviewComponent.prototype.classRoomWiseCurrentData = function () {
|
|
1724
|
+
var classRoomdata = this.pdService.classRoomWiseChartData();
|
|
1725
|
+
this.buildTimeline(this.currentdataList.userConsoleData);
|
|
1726
|
+
console.log("classRoomdata", classRoomdata);
|
|
1727
|
+
if (classRoomdata && classRoomdata.length > 0) {
|
|
1728
|
+
this.myChartDataMatrix = classRoomdata;
|
|
1729
|
+
console.log("myChartDataMatrix", this.myChartDataMatrix);
|
|
1730
|
+
this.updateChart();
|
|
1731
|
+
if (this.currentdataList.userConsoleData.length > 0) {
|
|
1732
|
+
this.calulateTotalDuration(this.currentdataList.userConsoleData);
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
};
|
|
1736
|
+
ChartviewComponent.prototype.classRoomWiseAllData = function () {
|
|
1737
|
+
var allclassRoomList = this.allRoomsList || this.pdService.allRoomsData();
|
|
1738
|
+
this.buildTimeline(allclassRoomList.fordurationTable);
|
|
1739
|
+
if (allclassRoomList.forChartData && allclassRoomList.forChartData.length > 0) {
|
|
1740
|
+
this.myChartDataMatrix = allclassRoomList.forChartData;
|
|
1741
|
+
this.updateChart();
|
|
1742
|
+
}
|
|
1743
|
+
if (allclassRoomList.fordurationTable && allclassRoomList.fordurationTable.length > 0) {
|
|
1744
|
+
this.calulateTotalDuration(allclassRoomList.fordurationTable);
|
|
1745
|
+
}
|
|
1746
|
+
};
|
|
1747
|
+
ChartviewComponent.prototype.findCurrentUserCount = function () {
|
|
1748
|
+
var userConsoleData = this.currentdataList.userConsoleData;
|
|
1749
|
+
var userNameArray = new Array();
|
|
1750
|
+
for (var index = 0; index < userConsoleData.length; index++) {
|
|
1751
|
+
var element = userConsoleData[index].userName;
|
|
1752
|
+
userNameArray.push(element);
|
|
1753
|
+
}
|
|
1754
|
+
var uniqueUserName = __spread(new Set(userNameArray));
|
|
1755
|
+
this.currentUsers = uniqueUserName.length;
|
|
1756
|
+
};
|
|
1757
|
+
ChartviewComponent.prototype.findCurrentClassrooms = function () {
|
|
1758
|
+
//console.log("findCurrentClassrooms", this.currentdataList.schoolTerminalData)
|
|
1759
|
+
var classRoomdata = this.pdService.newGetCurrentClassroomData();
|
|
1760
|
+
// console.log("findCurrentClassrooms",classRoomdata);
|
|
1761
|
+
return classRoomdata.length;
|
|
1762
|
+
};
|
|
1763
|
+
ChartviewComponent.prototype.findInstalledClassrooms = function () {
|
|
1764
|
+
var count = 0;
|
|
1765
|
+
// console.log("findInstalledClassrooms", this.currentdataList.schoolTerminalData)
|
|
1766
|
+
return this.currentdataList.schoolTerminalData.length;
|
|
1767
|
+
};
|
|
1768
|
+
ChartviewComponent.prototype.findEligibleUserCount = function () {
|
|
1769
|
+
// console.log("findEligibleUserCount", this.currentdataList)
|
|
1770
|
+
var count = 0;
|
|
1771
|
+
var userMetaData = this.currentdataList.usersMetadata;
|
|
1772
|
+
for (var index = 0; index < userMetaData.length; index++) {
|
|
1773
|
+
var element = userMetaData[index].userSubjects;
|
|
1774
|
+
if (element !== "") {
|
|
1775
|
+
// console.log("findEligibleUserCount", element)
|
|
1776
|
+
count = count + 1;
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
return count;
|
|
1780
|
+
};
|
|
1781
|
+
ChartviewComponent.prototype.ngOnDestroy = function () {
|
|
1782
|
+
// console.log('ngOnDestroy >>');
|
|
1783
|
+
};
|
|
1784
|
+
return ChartviewComponent;
|
|
1785
|
+
}());
|
|
1786
|
+
ChartviewComponent.decorators = [
|
|
1787
|
+
{ type: i0.Component, args: [{
|
|
1788
|
+
selector: 'lib-chartview',
|
|
1789
|
+
template: "<div id=\"pd-chartview-main-container\" class=\"pd-chartview-main-container\">\n <div id=\"userSummary\">\n <table class=\"summaryTable\">\n <tbody>\n <tr>\n <td id=\"totalUsers\" class=\"chartview-navigationbar\">\n Total users: {{totalUsers}}\n </td>\n <td id=\"eligibleUsers\" class=\"chartview-navigationbar\">\n Eligible users: {{eligibleUsers}}\n </td>\n <td id=\"currentUsers\" class=\"chartview-navigationbar\">\n Current users: {{currentUsers}}\n </td>\n <td id=\"totalRooms\" class=\"chartview-navigationbar\">\n Installed Classrooms: {{installedClassrooms}}\n </td>\n <td id=\"currentRooms\" class=\"chartview-navigationbar\">\n Current Classrooms: {{currentRooms}}\n </td>\n <!-- <td\n id=\"currentRooms\"\n \n >\n <span id=\"totalUsers_list\" class=\"activeAll\">User List</span>\n </td> -->\n </tr>\n </tbody>\n </table>\n </div>\n <div id=\"pd-messageDivContainer\" class='pd-messageDivContainer'>\n <div id=\"pd-messageDiv\" class='pd-messageDiv' *ngIf=\"!isTableView\">Click the bars to view details of content accessed by a teacher.</div>\n <div id=\"pd-toggleContainer\" class=\"pd-toggleContainer\">\n \n <div id=\"pd-currentUserBtn\" class=\"pd-currentUserBtn-div pd-commonStyleBtn\" (click)=\"showCurrentUser()\" [ngStyle]=\"{ color: isAllUsers ? '#000000' : '#ffffff' , backgroundColor: isAllUsers ? '#c4c4c4' : '#000000'}\">\n {{currentList}}</div>\n <div id=\"pd-allUserBtn\" class=\"pd-allUserBtn-div pd-commonStyleBtn\" (click)=\"showAllUser()\" [ngStyle]=\"{ color: isAllUsers ? '#ffffff' : '#000000' , backgroundColor: isAllUsers ? '#000000' : '#c4c4c4'}\">\n {{allList}}</div>\n </div>\n </div>\n <div id=\"pd-chartview\" class=\"pd-chartview\">\n <lib-timeline\n *ngIf=\"useCustomTimeline\"\n [rows]=\"timelineRows\"\n [labelTitle]=\"isUserWise ? 'Teacher' : 'Room'\"\n (barClick)=\"openSession($event)\"\n (totalClick)=\"openRow($event)\"\n ></lib-timeline>\n <div id=\"myChartDiv\" *ngIf=\"!useCustomTimeline\">\n <div id=\"myTimeLine\">\n <google-chart\n [type]=\"myChartType\"\n [data]=\"chartDataTable\"\n [options]=\"myChartOptions\"\n [width]=\"myChartwidth\"\n [height]=\"myChartHeight\"\n (select)=\"onSelectRowData($event)\"\n (ready)=\"myChartReady()\"\n > \n </google-chart>\n \n </div>\n <div class=\"inline babloo\" id=\"labels\"></div> \n \n \n </div>\n</div>\n",
|
|
1790
|
+
styles: [".pd-chartview-main-container .pd-chartview{display:block;overflow:scroll;width:100%;height:484px;font-family:Tahoma;font-size:12pt;font-weight:400;color:#666;margin:10 auto;text-align:center;padding-top:1px}.pd-chartview-main-container #userSummary{background:#e0e0e0;margin-top:1px}.pd-chartview-main-container #roomSummary,.pd-chartview-main-container #userSummary{position:relative;width:100%;text-align:center;padding-top:6px;padding-bottom:6px;font-size:13px}.pd-chartview-main-container .pd-messageDivContainer{margin-top:1px;position:relative;display:flex;align-items:center;justify-content:center;min-height:40px;padding:0 200px;box-sizing:border-box}.pd-chartview-main-container .pd-messageDivContainer .pd-messageDiv{font-size:13px;text-align:center}.pd-chartview-main-container .pd-messageDivContainer .pd-toggleContainer{line-height:30px;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;position:absolute;right:0;top:50%;transform:translateY(-50%)}.pd-chartview-main-container .pd-messageDivContainer .pd-allUserBtn-div{border-radius:0 5px 5px 0}.pd-chartview-main-container .pd-messageDivContainer .pd-currentUserBtn-div{border-radius:5px 0 0 5px}.pd-chartview-main-container .pd-messageDivContainer .pd-commonStyleBtn{display:inline-block;cursor:pointer;font-size:12px;width:92px;text-align:center}.pd-chartview-main-container .summaryTable{width:100%;border-collapse:collapse;border-spacing:2px;border-color:grey}.pd-chartview-main-container .activeAll{cursor:pointer;background:none!important;border-radius:13px;border:none;width:64px;height:18px!important;line-height:18px!important;color:#45a1da;margin-right:0!important;padding:1px 5px;vertical-align:sub}.pd-chartview-main-container #myTimeLine{width:89%;height:60%;margin-left:5px;overflow-x:scroll;overflow-y:hidden;float:left}.pd-chartview-main-container #myTimeLine2{width:71px;position:relative;overflow-x:hidden;overflow-y:hidden}.pd-chartview-main-container #myChartDiv{width:100%}.pd-chartview-main-container .chartview-navigationbar{border-collapse:collapse;border-right:1px solid #999;text-align:center}.pd-chartview-main-container #labels{border-right:1px solid #b7b7b7;border-top:1px solid #b7b7b7;width:10%;float:left;font-size:1.2vw;overflow-x:hidden;overflow-y:hidden}.inline{vertical-align:top;position:relative}"]
|
|
1791
|
+
},] }
|
|
1792
|
+
];
|
|
1793
|
+
ChartviewComponent.ctorParameters = function () { return [
|
|
1794
|
+
{ type: PrincipalDashboardLibV2Service }
|
|
1795
|
+
]; };
|
|
1796
|
+
ChartviewComponent.propDecorators = {
|
|
1797
|
+
data: [{ type: i0.Input }]
|
|
1798
|
+
};
|
|
1799
|
+
|
|
1800
|
+
var DetailedviewComponent = /** @class */ (function () {
|
|
1801
|
+
function DetailedviewComponent(pdService) {
|
|
1802
|
+
this.pdService = pdService;
|
|
1803
|
+
this.userMetadataHeadingArray = [
|
|
1804
|
+
'Name:',
|
|
1805
|
+
'Start Time:',
|
|
1806
|
+
'Subject:',
|
|
1807
|
+
'End Time:',
|
|
1808
|
+
'Room Details:',
|
|
1809
|
+
];
|
|
1810
|
+
this.resourseMetadataHeadingArray = [
|
|
1811
|
+
'Subject',
|
|
1812
|
+
'Class',
|
|
1813
|
+
'Chapter Name',
|
|
1814
|
+
'Topic Name',
|
|
1815
|
+
'Assets Details',
|
|
1816
|
+
];
|
|
1817
|
+
}
|
|
1818
|
+
DetailedviewComponent.prototype.ngOnInit = function () {
|
|
1819
|
+
var _this = this;
|
|
1820
|
+
this.deatilViewContainer = document.getElementById('pd-deatilViewContainer');
|
|
1821
|
+
this.deatilViewTable = document.getElementById('pd-deatilViewTable');
|
|
1822
|
+
this.closeButton = document.getElementById('pd-closeButton');
|
|
1823
|
+
this.pdService.detailedviewData.subscribe(function (data) {
|
|
1824
|
+
if (data) {
|
|
1825
|
+
if (data.userDetails.length > 0) {
|
|
1826
|
+
_this.createTable(data.userDetails);
|
|
1827
|
+
}
|
|
1828
|
+
if (data.resourceDetails.length > 0) {
|
|
1829
|
+
data.resourceDetails = _this.replaceLabelChapterAndTopic(data.resourceDetails);
|
|
1830
|
+
_this.createResourcesTable(data.resourceDetails);
|
|
1831
|
+
//console.log("11dec resourceDetails",data.resourceDetails);
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
});
|
|
1835
|
+
this.deatilViewContainer.style.display = 'none';
|
|
1836
|
+
};
|
|
1837
|
+
DetailedviewComponent.prototype.replaceLabelChapterAndTopic = function (data) {
|
|
1838
|
+
var htmlStr = "<span style='font-style: italic;color: #3F51B5;'>(seen)</span>";
|
|
1839
|
+
return data.map(function (row) {
|
|
1840
|
+
return row.map(function (cell) {
|
|
1841
|
+
if (cell.includes("Topic:")) {
|
|
1842
|
+
return cell.replace(/Topic: .*/, "Topic " + htmlStr);
|
|
1843
|
+
}
|
|
1844
|
+
if (cell.includes("Chapter:")) {
|
|
1845
|
+
return cell.replace(/Chapter: .*/, "Chapter " + htmlStr);
|
|
1846
|
+
}
|
|
1847
|
+
return cell;
|
|
1848
|
+
});
|
|
1849
|
+
});
|
|
1850
|
+
};
|
|
1851
|
+
DetailedviewComponent.prototype.replaceLabelChapterAndTopic1 = function (data) {
|
|
1852
|
+
var htmlStr = "<span style='font-style: italic;color: #3F51B5;'>(selected)</span>";
|
|
1853
|
+
return data.map(function (row) {
|
|
1854
|
+
return row.map(function (cell) {
|
|
1855
|
+
if (cell.includes("Topic: :")) {
|
|
1856
|
+
return cell.replace(/Topic: :.*$/, "Topic " + htmlStr);
|
|
1857
|
+
}
|
|
1858
|
+
if (cell.includes("Chapter:")) {
|
|
1859
|
+
return cell.replace(/Chapter: .*$/, "Chapter " + htmlStr);
|
|
1860
|
+
}
|
|
1861
|
+
return cell;
|
|
1862
|
+
});
|
|
1863
|
+
});
|
|
1864
|
+
};
|
|
1865
|
+
DetailedviewComponent.prototype.createTable = function (userMetadata) {
|
|
1866
|
+
this.deatilViewContainer.style.display = 'block';
|
|
1867
|
+
while (this.deatilViewTable.firstChild) {
|
|
1868
|
+
this.deatilViewTable.removeChild(this.deatilViewTable.lastChild);
|
|
1869
|
+
}
|
|
1870
|
+
var labelArray = new Array();
|
|
1871
|
+
var cnt = 0;
|
|
1872
|
+
for (var i = 0; i < userMetadata.length; i++) {
|
|
1873
|
+
var label = document.createElement('label');
|
|
1874
|
+
label.appendChild(document.createTextNode(this.userMetadataHeadingArray[i]));
|
|
1875
|
+
if (label.textContent === 'undefined' || label.textContent === undefined) {
|
|
1876
|
+
label.textContent = '';
|
|
1877
|
+
}
|
|
1878
|
+
labelArray.push(label);
|
|
1879
|
+
var data = document.createElement('label');
|
|
1880
|
+
data.appendChild(document.createTextNode(userMetadata[i]));
|
|
1881
|
+
if (data.textContent === 'undefined' || data.textContent === undefined) {
|
|
1882
|
+
data.textContent = '';
|
|
1883
|
+
}
|
|
1884
|
+
labelArray.push(data);
|
|
1885
|
+
}
|
|
1886
|
+
var tbl = document.createElement('table');
|
|
1887
|
+
tbl.id = "userDataTable";
|
|
1888
|
+
tbl.className = "table table-bordered";
|
|
1889
|
+
var tblBody = document.createElement('tbody');
|
|
1890
|
+
for (var j = 0; j < userMetadata.length / 2; j++) {
|
|
1891
|
+
var row = document.createElement('tr');
|
|
1892
|
+
var cell = void 0;
|
|
1893
|
+
for (var i = 0; i < 4; i++) {
|
|
1894
|
+
if (i % 2 == 0) {
|
|
1895
|
+
cell = document.createElement('th');
|
|
1896
|
+
cell.style['font-weight'] = "bold";
|
|
1897
|
+
// cell.style.background ="#e0e0e0";
|
|
1898
|
+
}
|
|
1899
|
+
else {
|
|
1900
|
+
cell = document.createElement('td');
|
|
1901
|
+
}
|
|
1902
|
+
if (cnt < labelArray.length) {
|
|
1903
|
+
cell.appendChild(labelArray[cnt]);
|
|
1904
|
+
row.appendChild(cell);
|
|
1905
|
+
//console.log('11dec', cell);
|
|
1906
|
+
}
|
|
1907
|
+
cnt++;
|
|
1908
|
+
}
|
|
1909
|
+
tblBody.appendChild(row);
|
|
1910
|
+
tbl.appendChild(tblBody);
|
|
1911
|
+
this.deatilViewTable.appendChild(tbl);
|
|
1912
|
+
}
|
|
1913
|
+
};
|
|
1914
|
+
DetailedviewComponent.prototype.createResourcesTable = function (resoureMetadata) {
|
|
1915
|
+
var labelArray = new Array();
|
|
1916
|
+
var cnt = 0;
|
|
1917
|
+
for (var i = 0; i < this.resourseMetadataHeadingArray.length; i++) {
|
|
1918
|
+
var label = document.createElement('label');
|
|
1919
|
+
label.appendChild(document.createTextNode(this.resourseMetadataHeadingArray[i]));
|
|
1920
|
+
if (label.textContent === 'undefined' || label.textContent === undefined) {
|
|
1921
|
+
label.textContent = '';
|
|
1922
|
+
}
|
|
1923
|
+
labelArray.push(label);
|
|
1924
|
+
}
|
|
1925
|
+
for (var i = 0; i < resoureMetadata.length; i++) {
|
|
1926
|
+
for (var j = 0; j < 5; j++) {
|
|
1927
|
+
var label = document.createElement('label');
|
|
1928
|
+
//label.appendChild(document.createTextNode(resoureMetadata[i][j]));
|
|
1929
|
+
label.innerHTML = resoureMetadata[i][j];
|
|
1930
|
+
if (label.textContent === 'undefined' || label.textContent === undefined) {
|
|
1931
|
+
label.textContent = '';
|
|
1932
|
+
}
|
|
1933
|
+
labelArray.push(label);
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
var tbl = document.createElement('table');
|
|
1937
|
+
tbl.className = "table table-bordered";
|
|
1938
|
+
tbl.id = "resoureMetadataTable";
|
|
1939
|
+
var tblBody = document.createElement('tbody');
|
|
1940
|
+
for (var j = 0; j <= resoureMetadata.length; j++) {
|
|
1941
|
+
var row = document.createElement('tr');
|
|
1942
|
+
var cell = void 0;
|
|
1943
|
+
for (var i = 0; i < 5; i++) {
|
|
1944
|
+
if (j == 0) {
|
|
1945
|
+
cell = document.createElement('th');
|
|
1946
|
+
cell.style['font-weight'] = 'bold';
|
|
1947
|
+
// cell.style.background ="#e0e0e0";
|
|
1948
|
+
}
|
|
1949
|
+
else {
|
|
1950
|
+
cell = document.createElement('td');
|
|
1951
|
+
}
|
|
1952
|
+
if (cnt < labelArray.length) {
|
|
1953
|
+
cell.appendChild(labelArray[cnt]);
|
|
1954
|
+
row.appendChild(cell);
|
|
1955
|
+
//console.log('11dec', cell);
|
|
1956
|
+
}
|
|
1957
|
+
cnt++;
|
|
1958
|
+
}
|
|
1959
|
+
tblBody.appendChild(row);
|
|
1960
|
+
tbl.appendChild(tblBody);
|
|
1961
|
+
this.deatilViewTable.appendChild(tbl);
|
|
1962
|
+
}
|
|
1963
|
+
};
|
|
1964
|
+
DetailedviewComponent.prototype.onCloseBtnClick = function () {
|
|
1965
|
+
this.deatilViewContainer.style.display = 'none';
|
|
1966
|
+
};
|
|
1967
|
+
return DetailedviewComponent;
|
|
1968
|
+
}());
|
|
1969
|
+
DetailedviewComponent.decorators = [
|
|
1970
|
+
{ type: i0.Component, args: [{
|
|
1971
|
+
selector: 'lib-detailedview',
|
|
1972
|
+
template: "<div id=\"pd-deatilViewContainer\">\n <div class=\"pd-detailview-header\">\n <div class=\"pd-detailview-title\">Details</div>\n <div id=\"pd-closeButton\" (click)=\"onCloseBtnClick()\">+</div>\n </div>\n <div id=\"pd-deatilViewTable\"></div>\n</div>\n",
|
|
1973
|
+
styles: ["#pd-deatilViewContainer{position:absolute;background:#fff;box-shadow:0 0 17px #818181;font-size:12px;width:50%;max-height:350px;top:140px;left:230px}#pd-deatilViewContainer .pd-detailview-header{position:relative;width:100%;height:35px;background-color:#e6e6e6}#pd-deatilViewContainer .pd-detailview-title{position:absolute;margin-left:5px;font-size:20px;line-height:35px}#pd-deatilViewContainer #pd-closeButton{width:24px;position:absolute;float:right;right:0;cursor:pointer;height:24px;background:#000;border-radius:12px;color:#fff;line-height:22px;text-align:center;font-size:26px;transform:rotate(45deg);margin:5px}#pd-deatilViewContainer #pd-deatilViewTable{overflow:scroll;scroll-behavior:smooth;height:auto;margin:5px;max-height:300px}"]
|
|
1974
|
+
},] }
|
|
1975
|
+
];
|
|
1976
|
+
DetailedviewComponent.ctorParameters = function () { return [
|
|
1977
|
+
{ type: PrincipalDashboardLibV2Service }
|
|
1978
|
+
]; };
|
|
1979
|
+
|
|
1980
|
+
var EXCEL_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8';
|
|
1981
|
+
var EXCEL_EXTENSION = '.xlsx';
|
|
1982
|
+
var ExceldataService = /** @class */ (function () {
|
|
1983
|
+
function ExceldataService() {
|
|
1984
|
+
this.resourceTypes = new Array();
|
|
1985
|
+
this.tabName = [{ "name": "School" }, { "name": "User Summary" }, { "name": "Terminal Summary" }, { "name": "Usage Details" }];
|
|
1986
|
+
}
|
|
1987
|
+
ExceldataService.prototype.exportAsExcelFile = function (json, excelFileName) {
|
|
1988
|
+
var excelBuffer;
|
|
1989
|
+
var myobj = { Sheets: {}, SheetNames: [] };
|
|
1990
|
+
for (var i = 0; i < json.length; i++) {
|
|
1991
|
+
var worksheet = XLSX.utils.json_to_sheet(json[i]);
|
|
1992
|
+
myobj.Sheets[this.tabName[i].name] = worksheet;
|
|
1993
|
+
myobj.SheetNames.push(this.tabName[i].name);
|
|
1994
|
+
}
|
|
1995
|
+
var workbook = myobj;
|
|
1996
|
+
excelBuffer = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' });
|
|
1997
|
+
this.saveAsExcelFile(excelBuffer, excelFileName);
|
|
1998
|
+
};
|
|
1999
|
+
ExceldataService.prototype.saveAsExcelFile = function (buffer, fileName) {
|
|
2000
|
+
var data = new Blob([buffer], {
|
|
2001
|
+
type: EXCEL_TYPE
|
|
2002
|
+
});
|
|
2003
|
+
FileSaver.saveAs(data, fileName + EXCEL_EXTENSION);
|
|
2004
|
+
};
|
|
2005
|
+
//_____FOR EXCEL CONVERTOR END
|
|
2006
|
+
ExceldataService.prototype.genarateResourseReqiuredData_Excel = function (data) {
|
|
2007
|
+
var resouseID;
|
|
2008
|
+
var title;
|
|
2009
|
+
var subject;
|
|
2010
|
+
var grade;
|
|
2011
|
+
var chapter;
|
|
2012
|
+
var teachingpoint;
|
|
2013
|
+
var type;
|
|
2014
|
+
var resourceMetadataMatrix = new Array();
|
|
2015
|
+
var resourceMetadata = data.resourcesMetadata.resourceMetadata;
|
|
2016
|
+
if (resourceMetadata != undefined && resourceMetadata.length > 0) {
|
|
2017
|
+
for (var i = 0; i < resourceMetadata.length; i++) {
|
|
2018
|
+
//----------//resouseID
|
|
2019
|
+
resouseID = resourceMetadata[i].resourceId;
|
|
2020
|
+
//----------//subject
|
|
2021
|
+
if (resourceMetadata[i].subject != undefined) {
|
|
2022
|
+
if (resourceMetadata[i].subject.title != undefined) {
|
|
2023
|
+
subject = resourceMetadata[i].subject.title;
|
|
2024
|
+
}
|
|
2025
|
+
else {
|
|
2026
|
+
subject = '';
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
else {
|
|
2030
|
+
subject = '';
|
|
2031
|
+
}
|
|
2032
|
+
//----------//grade
|
|
2033
|
+
if (resourceMetadata[i].grade != undefined) {
|
|
2034
|
+
if (resourceMetadata[i].grade.title != undefined) {
|
|
2035
|
+
grade = resourceMetadata[i].grade.title;
|
|
2036
|
+
}
|
|
2037
|
+
else {
|
|
2038
|
+
grade = '';
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
else {
|
|
2042
|
+
grade = '';
|
|
2043
|
+
}
|
|
2044
|
+
//----------//chapter
|
|
2045
|
+
if (resourceMetadata[i].chapter != undefined) {
|
|
2046
|
+
if (resourceMetadata[i].chapter.title != undefined) {
|
|
2047
|
+
chapter = resourceMetadata[i].chapter.title;
|
|
2048
|
+
}
|
|
2049
|
+
else {
|
|
2050
|
+
chapter = '';
|
|
2051
|
+
}
|
|
2052
|
+
}
|
|
2053
|
+
else {
|
|
2054
|
+
chapter = '';
|
|
2055
|
+
}
|
|
2056
|
+
//----------//teachingpoint
|
|
2057
|
+
if (resourceMetadata[i].teachingpoint != undefined) {
|
|
2058
|
+
if (resourceMetadata[i].teachingpoint.title != undefined) {
|
|
2059
|
+
teachingpoint = resourceMetadata[i].teachingpoint.title;
|
|
2060
|
+
}
|
|
2061
|
+
else {
|
|
2062
|
+
teachingpoint = '';
|
|
2063
|
+
}
|
|
2064
|
+
}
|
|
2065
|
+
else {
|
|
2066
|
+
teachingpoint = '';
|
|
2067
|
+
}
|
|
2068
|
+
//----------//type
|
|
2069
|
+
if (resourceMetadata[i].type != undefined) {
|
|
2070
|
+
type = this.getDisplaytypeValue(resourceMetadata[i].type);
|
|
2071
|
+
}
|
|
2072
|
+
else {
|
|
2073
|
+
type = '';
|
|
2074
|
+
}
|
|
2075
|
+
//----------//title
|
|
2076
|
+
if (resourceMetadata[i].title != undefined) {
|
|
2077
|
+
title = resourceMetadata[i].title;
|
|
2078
|
+
}
|
|
2079
|
+
else {
|
|
2080
|
+
title = '';
|
|
2081
|
+
}
|
|
2082
|
+
var resourceMetauserConsoleData = {
|
|
2083
|
+
resouseID: resouseID,
|
|
2084
|
+
subject: subject,
|
|
2085
|
+
grade: grade,
|
|
2086
|
+
chapter: chapter,
|
|
2087
|
+
teachingpoint: teachingpoint,
|
|
2088
|
+
type: type,
|
|
2089
|
+
title: title
|
|
2090
|
+
};
|
|
2091
|
+
resourceMetadataMatrix.push(resourceMetauserConsoleData);
|
|
2092
|
+
this.resourceTypes.push(type);
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
this.resourceTypes = __spread(new Set(this.resourceTypes));
|
|
2096
|
+
return resourceMetadataMatrix;
|
|
2097
|
+
};
|
|
2098
|
+
ExceldataService.prototype.getName = function (user) {
|
|
2099
|
+
if (/School Admin/gm.exec(user.role)) {
|
|
2100
|
+
return "Support Admin";
|
|
2101
|
+
}
|
|
2102
|
+
return user.fullName;
|
|
2103
|
+
};
|
|
2104
|
+
ExceldataService.prototype.genarateUserReqiuredData_Excel = function (data) {
|
|
2105
|
+
var userConsole = data.usersConsole.userConsole;
|
|
2106
|
+
var usersMetadata = data.usersMetadata.userMetadata;
|
|
2107
|
+
var schoolTerminal = data.schoolTerminals.schoolTerminal;
|
|
2108
|
+
var usersMetadataMatrix = new Array();
|
|
2109
|
+
var usermetadataMatrixUpdated = new Array();
|
|
2110
|
+
var schoolTerminalMatrix = new Array();
|
|
2111
|
+
var userConsoleMatrix = new Array();
|
|
2112
|
+
if (usersMetadata != null && usersMetadata.length > 0) {
|
|
2113
|
+
for (var i_1 = 0; i_1 < usersMetadata.length; i_1++) {
|
|
2114
|
+
var userId = void 0;
|
|
2115
|
+
var userName = void 0;
|
|
2116
|
+
var userSubjects = void 0;
|
|
2117
|
+
var listOfUser = {};
|
|
2118
|
+
if (usersMetadata[i_1].userId != "") {
|
|
2119
|
+
userId = usersMetadata[i_1].userId;
|
|
2120
|
+
if (usersMetadata[i_1].fullName !== undefined) {
|
|
2121
|
+
userName = this.getName(usersMetadata[i_1]); // get name of user w.r.t. ID
|
|
2122
|
+
}
|
|
2123
|
+
else {
|
|
2124
|
+
userName = '';
|
|
2125
|
+
}
|
|
2126
|
+
if (usersMetadata[i_1].userSubjects !== undefined) {
|
|
2127
|
+
userSubjects = usersMetadata[i_1].userSubjects; // get name of user w.r.t. ID
|
|
2128
|
+
}
|
|
2129
|
+
else {
|
|
2130
|
+
userSubjects = '';
|
|
2131
|
+
}
|
|
2132
|
+
listOfUser = {
|
|
2133
|
+
userId: userId,
|
|
2134
|
+
userName: userName,
|
|
2135
|
+
userSubjects: userSubjects
|
|
2136
|
+
};
|
|
2137
|
+
usersMetadataMatrix.push(listOfUser); // array of all users
|
|
2138
|
+
}
|
|
2139
|
+
}
|
|
2140
|
+
}
|
|
2141
|
+
for (var i = 0; i < usersMetadataMatrix.length; i++) {
|
|
2142
|
+
usersMetadataMatrix.forEach(function (element) {
|
|
2143
|
+
if (usersMetadataMatrix[i].userName === element.userName) {
|
|
2144
|
+
usermetadataMatrixUpdated.push(usersMetadataMatrix[i]); //array of same name users
|
|
2145
|
+
usersMetadataMatrix.splice(i, 1); //delete the same name users from usermetadataMatrix
|
|
2146
|
+
}
|
|
2147
|
+
});
|
|
2148
|
+
}
|
|
2149
|
+
for (var i = 0; i < usermetadataMatrixUpdated.length; i++) {
|
|
2150
|
+
usermetadataMatrixUpdated[i].userName = usermetadataMatrixUpdated[i].userName + " " + i;
|
|
2151
|
+
usersMetadataMatrix.push(usermetadataMatrixUpdated[i]); //adding same name users in usermetadataMatrix with some random charators
|
|
2152
|
+
}
|
|
2153
|
+
if (schoolTerminal != null && schoolTerminal.length > 0) {
|
|
2154
|
+
for (var i = 0; i < schoolTerminal.length; i++) {
|
|
2155
|
+
var schoolId = void 0;
|
|
2156
|
+
var terminalKey = void 0;
|
|
2157
|
+
var terminalType = void 0;
|
|
2158
|
+
var location = void 0;
|
|
2159
|
+
var schoolTerminalData = {};
|
|
2160
|
+
//----------//schoolId
|
|
2161
|
+
if (schoolTerminal[i].schoolId !== undefined) {
|
|
2162
|
+
schoolId = schoolTerminal[i].schoolId; // get name of user w.r.t. ID
|
|
2163
|
+
}
|
|
2164
|
+
else {
|
|
2165
|
+
schoolId = '';
|
|
2166
|
+
}
|
|
2167
|
+
//----------//terminalKey
|
|
2168
|
+
if (schoolTerminal[i].terminalKey !== undefined) {
|
|
2169
|
+
terminalKey = schoolTerminal[i].terminalKey; // get name of user w.r.t. ID
|
|
2170
|
+
}
|
|
2171
|
+
else {
|
|
2172
|
+
terminalKey = '';
|
|
2173
|
+
}
|
|
2174
|
+
//----------//terminalType
|
|
2175
|
+
if (schoolTerminal[i].terminalType !== undefined) {
|
|
2176
|
+
terminalType = schoolTerminal[i].terminalType; // get name of user w.r.t. ID
|
|
2177
|
+
}
|
|
2178
|
+
else {
|
|
2179
|
+
terminalType = '';
|
|
2180
|
+
}
|
|
2181
|
+
//----------//location
|
|
2182
|
+
if (schoolTerminal[i].metadata !== undefined) {
|
|
2183
|
+
location = schoolTerminal[i].metadata; // get name of user w.r.t. ID
|
|
2184
|
+
}
|
|
2185
|
+
else {
|
|
2186
|
+
location = '';
|
|
2187
|
+
}
|
|
2188
|
+
schoolTerminalData = {
|
|
2189
|
+
schoolId: schoolId,
|
|
2190
|
+
terminalKey: terminalKey,
|
|
2191
|
+
terminalType: terminalType,
|
|
2192
|
+
location: location
|
|
2193
|
+
};
|
|
2194
|
+
schoolTerminalMatrix.push(schoolTerminalData);
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
if (userConsole != null && userConsole.length > 0) {
|
|
2198
|
+
var _loop_1 = function (index) {
|
|
2199
|
+
var userId = void 0;
|
|
2200
|
+
var startTime = void 0;
|
|
2201
|
+
var endTime = void 0;
|
|
2202
|
+
var duration = void 0;
|
|
2203
|
+
var selectedDate = void 0;
|
|
2204
|
+
var terminalIP = void 0;
|
|
2205
|
+
var userConsoleResources = void 0;
|
|
2206
|
+
var resourceMetadataIDS = void 0;
|
|
2207
|
+
var resourceMetauserConsoleData = [];
|
|
2208
|
+
var resourceDurationFromConsole = [];
|
|
2209
|
+
var userName = void 0;
|
|
2210
|
+
var userSubjects = void 0;
|
|
2211
|
+
var terminalLocation = void 0;
|
|
2212
|
+
//----------//user iD
|
|
2213
|
+
if (userConsole[index].userId !== undefined) {
|
|
2214
|
+
userId = userConsole[index].userId; // get name of user w.r.t. ID
|
|
2215
|
+
}
|
|
2216
|
+
else {
|
|
2217
|
+
userId = '';
|
|
2218
|
+
}
|
|
2219
|
+
//----------// startTime
|
|
2220
|
+
if (userConsole[index].startTime !== undefined) {
|
|
2221
|
+
startTime = userConsole[index].startTime; // get name of user w.r.t. ID
|
|
2222
|
+
}
|
|
2223
|
+
else {
|
|
2224
|
+
startTime = '';
|
|
2225
|
+
}
|
|
2226
|
+
//----------// endTime
|
|
2227
|
+
if (userConsole[index].endTime !== undefined) {
|
|
2228
|
+
endTime = userConsole[index].endTime; // get name of user w.r.t. ID
|
|
2229
|
+
this_1.myEndTime = endTime;
|
|
2230
|
+
}
|
|
2231
|
+
else {
|
|
2232
|
+
endTime = '';
|
|
2233
|
+
}
|
|
2234
|
+
//----------// Date
|
|
2235
|
+
if (userConsole[index].selectedDate !== undefined) {
|
|
2236
|
+
selectedDate = userConsole[index].selectedDate; // get name of user w.r.t. ID
|
|
2237
|
+
}
|
|
2238
|
+
else {
|
|
2239
|
+
selectedDate = '';
|
|
2240
|
+
}
|
|
2241
|
+
//----------// Duration
|
|
2242
|
+
if (userConsole[index].duration !== undefined) {
|
|
2243
|
+
duration = userConsole[index].duration; // get name of user w.r.t. ID
|
|
2244
|
+
}
|
|
2245
|
+
else {
|
|
2246
|
+
duration = '';
|
|
2247
|
+
}
|
|
2248
|
+
//----------// terminalIP
|
|
2249
|
+
if (userConsole[index].terminalIP !== undefined) {
|
|
2250
|
+
terminalIP = userConsole[index].terminalIP; // get name of user w.r.t. ID
|
|
2251
|
+
}
|
|
2252
|
+
else {
|
|
2253
|
+
terminalIP = '';
|
|
2254
|
+
}
|
|
2255
|
+
//----------// userConsoleResources
|
|
2256
|
+
if (userConsole[index].userConsoleResources !== undefined) {
|
|
2257
|
+
userConsoleResources = userConsole[index].userConsoleResources; // get name of user w.r.t. ID
|
|
2258
|
+
}
|
|
2259
|
+
else {
|
|
2260
|
+
userConsoleResources = null;
|
|
2261
|
+
}
|
|
2262
|
+
if (userConsoleResources != null) {
|
|
2263
|
+
if (userConsoleResources.userConsoleResource !== undefined) {
|
|
2264
|
+
// satyajit resource wise duration added
|
|
2265
|
+
userConsoleResources.userConsoleResource.forEach(function (item) {
|
|
2266
|
+
resourceMetauserConsoleData.push(item.resourceId); // get name of user w.r.t. ID
|
|
2267
|
+
resourceDurationFromConsole.push(item.duration);
|
|
2268
|
+
});
|
|
2269
|
+
// resourceMetauserConsoleData = userConsoleResources.userConsoleResource; // get name of user w.r.t. ID
|
|
2270
|
+
}
|
|
2271
|
+
else {
|
|
2272
|
+
resourceMetauserConsoleData = [];
|
|
2273
|
+
resourceDurationFromConsole = [];
|
|
2274
|
+
}
|
|
2275
|
+
}
|
|
2276
|
+
//----------// userName and userSubjects
|
|
2277
|
+
for (var i_2 = 0; i_2 < usersMetadataMatrix.length; i_2++) {
|
|
2278
|
+
if (userId === usersMetadataMatrix[i_2].userId) {
|
|
2279
|
+
userName = usersMetadataMatrix[i_2].userName;
|
|
2280
|
+
userSubjects = usersMetadataMatrix[i_2].userSubjects;
|
|
2281
|
+
}
|
|
2282
|
+
}
|
|
2283
|
+
//----------// terminalIP and terminalLocation
|
|
2284
|
+
for (var i_3 = 0; i_3 < schoolTerminalMatrix.length; i_3++) {
|
|
2285
|
+
if (terminalIP === schoolTerminalMatrix[i_3].terminalKey) {
|
|
2286
|
+
terminalLocation = schoolTerminalMatrix[i_3].location;
|
|
2287
|
+
}
|
|
2288
|
+
}
|
|
2289
|
+
var userData = {
|
|
2290
|
+
userId: userId,
|
|
2291
|
+
userName: userName,
|
|
2292
|
+
startTime: new Date(startTime),
|
|
2293
|
+
endTime: new Date(endTime),
|
|
2294
|
+
terminalIP: terminalIP,
|
|
2295
|
+
resourceMetauserConsoleData: resourceMetauserConsoleData,
|
|
2296
|
+
duration: duration,
|
|
2297
|
+
terminalLocation: terminalLocation,
|
|
2298
|
+
userSubjects: userSubjects,
|
|
2299
|
+
resourceDurationFromConsole: resourceDurationFromConsole
|
|
2300
|
+
};
|
|
2301
|
+
userConsoleMatrix.push(userData);
|
|
2302
|
+
};
|
|
2303
|
+
var this_1 = this;
|
|
2304
|
+
for (var index = 0; index < userConsole.length; index++) {
|
|
2305
|
+
_loop_1(index);
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
return { usersMetadata: usersMetadataMatrix, schoolTerminalData: schoolTerminalMatrix, userConsoleData: userConsoleMatrix };
|
|
2309
|
+
};
|
|
2310
|
+
ExceldataService.prototype.deatilData_Excel = function (userConsoleMatrix, resourceMetadataMatrix) {
|
|
2311
|
+
// console.log("resourceMetadataMatrix",resourceMetadataMatrix);
|
|
2312
|
+
var currentDate;
|
|
2313
|
+
var resourceMatrixForExcel = new Array();
|
|
2314
|
+
resourceMatrixForExcel = [];
|
|
2315
|
+
for (var i = 0; i < userConsoleMatrix.length; i++) {
|
|
2316
|
+
var userID = void 0;
|
|
2317
|
+
var startTime = void 0;
|
|
2318
|
+
var endTime = void 0;
|
|
2319
|
+
var duration = void 0;
|
|
2320
|
+
var terminalIP = void 0;
|
|
2321
|
+
var subject = void 0;
|
|
2322
|
+
var grade = void 0;
|
|
2323
|
+
var chapter = void 0;
|
|
2324
|
+
var resourceType = void 0;
|
|
2325
|
+
var resourceTitle = void 0;
|
|
2326
|
+
var teachingpoint = void 0;
|
|
2327
|
+
var location = void 0;
|
|
2328
|
+
var teacherName = void 0;
|
|
2329
|
+
var teacherSubject = void 0;
|
|
2330
|
+
var resourceMetadataIDs = void 0;
|
|
2331
|
+
var resourceMetadataIDsDuration = void 0;
|
|
2332
|
+
var resourceArrayForExcel = new Array();
|
|
2333
|
+
userID = userConsoleMatrix[i].userId;
|
|
2334
|
+
//----------------- for subject and Name
|
|
2335
|
+
teacherSubject = userConsoleMatrix[i].userSubjects;
|
|
2336
|
+
teacherName = userConsoleMatrix[i].userName;
|
|
2337
|
+
//----------------- for start Time and EndTime
|
|
2338
|
+
if ((userConsoleMatrix[i].startTime != undefined && userConsoleMatrix[i].startTime != "") && (userConsoleMatrix[i].endTime != undefined && userConsoleMatrix[i].endTime != "")) {
|
|
2339
|
+
startTime = userConsoleMatrix[i].startTime.toLocaleTimeString('en-US', { hour12: true });
|
|
2340
|
+
endTime = userConsoleMatrix[i].endTime.toLocaleTimeString('en-US', { hour12: true });
|
|
2341
|
+
currentDate = userConsoleMatrix[i].startTime.getDate() + '/' + (userConsoleMatrix[i].startTime.getMonth() + 1) + '/' + userConsoleMatrix[i].startTime.getFullYear();
|
|
2342
|
+
}
|
|
2343
|
+
//----------------- for duration
|
|
2344
|
+
duration = Math.floor(userConsoleMatrix[i].duration);
|
|
2345
|
+
//----------------- for Terminal loaction and terminal IP
|
|
2346
|
+
location = userConsoleMatrix[i].terminalLocation;
|
|
2347
|
+
terminalIP = userConsoleMatrix[i].terminalIP;
|
|
2348
|
+
var roomDetail = location + ' ' + terminalIP;
|
|
2349
|
+
var locationName = location;
|
|
2350
|
+
var terminalIPAddress = terminalIP;
|
|
2351
|
+
resourceMetadataIDs = userConsoleMatrix[i].resourceMetauserConsoleData;
|
|
2352
|
+
resourceMetadataIDsDuration = userConsoleMatrix[i].resourceDurationFromConsole;
|
|
2353
|
+
if (resourceMetadataIDs.length == 0) {
|
|
2354
|
+
subject = '';
|
|
2355
|
+
grade = '';
|
|
2356
|
+
chapter = '';
|
|
2357
|
+
teachingpoint = '';
|
|
2358
|
+
resourceTitle = '';
|
|
2359
|
+
resourceType = '';
|
|
2360
|
+
resourceArrayForExcel = [teacherName, teacherSubject, currentDate, startTime, endTime, duration, locationName, terminalIPAddress, subject, grade, chapter, teachingpoint, resourceTitle, resourceType, userID];
|
|
2361
|
+
resourceMatrixForExcel.push(resourceArrayForExcel);
|
|
2362
|
+
}
|
|
2363
|
+
else {
|
|
2364
|
+
for (var k = 0; k < resourceMetadataIDs.length; k++) {
|
|
2365
|
+
for (var i_4 = 0; i_4 < resourceMetadataMatrix.length; i_4++) {
|
|
2366
|
+
// resouseID:resouseID,
|
|
2367
|
+
// subject:subject,
|
|
2368
|
+
// grade:grade,
|
|
2369
|
+
// chapter:chapter,
|
|
2370
|
+
// teachingpoint:teachingpoint,
|
|
2371
|
+
// type:type,
|
|
2372
|
+
// title:title
|
|
2373
|
+
if (resourceMetadataIDs[k] === resourceMetadataMatrix[i_4].resouseID) {
|
|
2374
|
+
subject = resourceMetadataMatrix[i_4].subject;
|
|
2375
|
+
grade = resourceMetadataMatrix[i_4].grade;
|
|
2376
|
+
chapter = resourceMetadataMatrix[i_4].chapter;
|
|
2377
|
+
teachingpoint = resourceMetadataMatrix[i_4].teachingpoint;
|
|
2378
|
+
resourceTitle = resourceMetadataMatrix[i_4].title;
|
|
2379
|
+
resourceType = this.getDisplaytypeValue(resourceMetadataMatrix[i_4].type);
|
|
2380
|
+
// FOR EXCEL
|
|
2381
|
+
resourceArrayForExcel = [teacherName, teacherSubject, currentDate, startTime, endTime, duration, locationName, terminalIPAddress, subject, grade, chapter, teachingpoint, resourceTitle, resourceType, userID, resourceMetadataIDsDuration[k]];
|
|
2382
|
+
resourceMatrixForExcel.push(resourceArrayForExcel);
|
|
2383
|
+
teacherName = '';
|
|
2384
|
+
teacherSubject = '';
|
|
2385
|
+
currentDate = '';
|
|
2386
|
+
startTime = '';
|
|
2387
|
+
endTime = '';
|
|
2388
|
+
locationName = '';
|
|
2389
|
+
terminalIPAddress = '';
|
|
2390
|
+
duration = '';
|
|
2391
|
+
}
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2394
|
+
}
|
|
2395
|
+
}
|
|
2396
|
+
return resourceMatrixForExcel;
|
|
2397
|
+
};
|
|
2398
|
+
ExceldataService.prototype.deatilUsage_Excel = function (resourceMatrixForExcel) {
|
|
2399
|
+
var userList = [];
|
|
2400
|
+
// console.log("resourceMatrixForExcel>>>>>>>>>>>>>>>>>>>",resourceMatrixForExcel);
|
|
2401
|
+
if (resourceMatrixForExcel.length > 0) {
|
|
2402
|
+
for (var i = 0; i < resourceMatrixForExcel.length; i++) {
|
|
2403
|
+
var data = {
|
|
2404
|
+
// Sr_No: i+1,
|
|
2405
|
+
Name: resourceMatrixForExcel[i][0],
|
|
2406
|
+
Subjects: resourceMatrixForExcel[i][1],
|
|
2407
|
+
Date: resourceMatrixForExcel[i][2],
|
|
2408
|
+
startTime: resourceMatrixForExcel[i][3],
|
|
2409
|
+
endTime: resourceMatrixForExcel[i][4],
|
|
2410
|
+
"duration(mins)": resourceMatrixForExcel[i][5],
|
|
2411
|
+
location: resourceMatrixForExcel[i][6],
|
|
2412
|
+
IP: resourceMatrixForExcel[i][7],
|
|
2413
|
+
subjectTitle: resourceMatrixForExcel[i][8],
|
|
2414
|
+
gradeTitle: resourceMatrixForExcel[i][9],
|
|
2415
|
+
Chapter: resourceMatrixForExcel[i][10],
|
|
2416
|
+
tpTitle: resourceMatrixForExcel[i][11],
|
|
2417
|
+
resourceTitle: resourceMatrixForExcel[i][12],
|
|
2418
|
+
resourceType: resourceMatrixForExcel[i][13],
|
|
2419
|
+
'resourceDuration(sec)': resourceMatrixForExcel[i][15],
|
|
2420
|
+
};
|
|
2421
|
+
userList.push(data);
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2424
|
+
// console.log("userList",userList);
|
|
2425
|
+
return userList;
|
|
2426
|
+
};
|
|
2427
|
+
ExceldataService.prototype.userSummary_Excel = function (data, resourceMatrixForExcel) {
|
|
2428
|
+
// console.log("resourceMatrixForExcel",resourceMatrixForExcel)
|
|
2429
|
+
var userMetadataList = data.usersMetadata.userMetadata;
|
|
2430
|
+
var resourcelist = new Array();
|
|
2431
|
+
var resourceTypeList = new Array();
|
|
2432
|
+
var userObjectList = new Array();
|
|
2433
|
+
var classRooms = new Array();
|
|
2434
|
+
var datesAccess = new Array();
|
|
2435
|
+
var grades = new Array();
|
|
2436
|
+
var subjectTought = new Array();
|
|
2437
|
+
// let unique_resourceTypeList = [];
|
|
2438
|
+
var duration = 0;
|
|
2439
|
+
for (var i = 0; i < userMetadataList.length; i++) {
|
|
2440
|
+
resourcelist = [];
|
|
2441
|
+
resourceTypeList = [];
|
|
2442
|
+
classRooms = [];
|
|
2443
|
+
datesAccess = [];
|
|
2444
|
+
grades = [];
|
|
2445
|
+
subjectTought = [];
|
|
2446
|
+
duration = 0;
|
|
2447
|
+
// console.log("userMetadataList[i]",userMetadataList);
|
|
2448
|
+
// console.log("resourceMatrixForExcel[i]",[...new Set(resourceMatrixForExcel)]);
|
|
2449
|
+
for (var j = 0; j < resourceMatrixForExcel.length; j++) {
|
|
2450
|
+
if (userMetadataList[i].userId === resourceMatrixForExcel[j][14]) {
|
|
2451
|
+
if (resourceMatrixForExcel[j][12] != '') {
|
|
2452
|
+
resourcelist.push(resourceMatrixForExcel[j][12]);
|
|
2453
|
+
}
|
|
2454
|
+
if (resourceMatrixForExcel[j][13] != '') {
|
|
2455
|
+
resourceTypeList.push(resourceMatrixForExcel[j][13]);
|
|
2456
|
+
}
|
|
2457
|
+
if (resourceMatrixForExcel[j][5] != '') {
|
|
2458
|
+
duration = duration + resourceMatrixForExcel[j][5];
|
|
2459
|
+
}
|
|
2460
|
+
classRooms.push(resourceMatrixForExcel[j][6]);
|
|
2461
|
+
datesAccess.push(resourceMatrixForExcel[j][2]);
|
|
2462
|
+
grades.push(resourceMatrixForExcel[j][9]);
|
|
2463
|
+
subjectTought.push(resourceMatrixForExcel[j][8]);
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2466
|
+
var ClassRooms = void 0;
|
|
2467
|
+
var DatesAccess = void 0;
|
|
2468
|
+
var Grades = void 0;
|
|
2469
|
+
var SubjectTought = void 0;
|
|
2470
|
+
var dayAccess = void 0;
|
|
2471
|
+
if (classRooms.length > 0) {
|
|
2472
|
+
ClassRooms = __spread(new Set(classRooms))[0];
|
|
2473
|
+
}
|
|
2474
|
+
else {
|
|
2475
|
+
ClassRooms = '';
|
|
2476
|
+
}
|
|
2477
|
+
if (datesAccess.length > 0) {
|
|
2478
|
+
dayAccess = __spread(new Set(datesAccess)).length;
|
|
2479
|
+
}
|
|
2480
|
+
else {
|
|
2481
|
+
dayAccess = '';
|
|
2482
|
+
}
|
|
2483
|
+
if (datesAccess.length > 0) {
|
|
2484
|
+
DatesAccess = __spread(new Set(datesAccess))[0];
|
|
2485
|
+
}
|
|
2486
|
+
else {
|
|
2487
|
+
DatesAccess = '';
|
|
2488
|
+
}
|
|
2489
|
+
if (grades.length > 0) {
|
|
2490
|
+
Grades = __spread(new Set(grades))[0];
|
|
2491
|
+
}
|
|
2492
|
+
else {
|
|
2493
|
+
Grades = '';
|
|
2494
|
+
}
|
|
2495
|
+
if (subjectTought.length > 0) {
|
|
2496
|
+
SubjectTought = __spread(new Set(subjectTought))[0];
|
|
2497
|
+
}
|
|
2498
|
+
else {
|
|
2499
|
+
SubjectTought = '';
|
|
2500
|
+
}
|
|
2501
|
+
// if(resourceTypeList.length>0){
|
|
2502
|
+
// unique_resourceTypeList = [...new Set(resourceTypeList)];
|
|
2503
|
+
// }
|
|
2504
|
+
// console.log("this.resourceTypes",this.resourceTypes)
|
|
2505
|
+
var user = {
|
|
2506
|
+
Name: this.getName(userMetadataList[i]),
|
|
2507
|
+
Subjects: userMetadataList[i].userSubjects,
|
|
2508
|
+
duration: duration,
|
|
2509
|
+
ClassRooms: ClassRooms,
|
|
2510
|
+
DatesAccess: DatesAccess,
|
|
2511
|
+
DayAccess: dayAccess,
|
|
2512
|
+
Grades: Grades,
|
|
2513
|
+
SubjectTought: SubjectTought,
|
|
2514
|
+
AseestUsed: resourcelist,
|
|
2515
|
+
AssetType: resourceTypeList
|
|
2516
|
+
};
|
|
2517
|
+
userObjectList.push(user);
|
|
2518
|
+
}
|
|
2519
|
+
// console.log("userObjectList",userObjectList)
|
|
2520
|
+
var userSummaryList = new Array();
|
|
2521
|
+
var _loop_2 = function (i) {
|
|
2522
|
+
var Assetcounts = [];
|
|
2523
|
+
//find count of present asset type
|
|
2524
|
+
var presentAsset = userObjectList[i].AssetType;
|
|
2525
|
+
presentAsset = __spread(new Set(presentAsset));
|
|
2526
|
+
// console.log("presentAsset",presentAsset)
|
|
2527
|
+
//find count of present asset count
|
|
2528
|
+
var sampleArray = userObjectList[i].AssetType;
|
|
2529
|
+
sampleArray.forEach(function (x) { Assetcounts[x] = (Assetcounts[x] || 0) + 1; });
|
|
2530
|
+
// find missing assets
|
|
2531
|
+
var missingAssets = this_2.resourceTypes.filter(function (n) { return !presentAsset.includes(n); });
|
|
2532
|
+
// adding missing asset with count 0 in list
|
|
2533
|
+
missingAssets.forEach(function (element) {
|
|
2534
|
+
Assetcounts[element] = 0;
|
|
2535
|
+
});
|
|
2536
|
+
// console.log(Assetcounts);
|
|
2537
|
+
var asset_media = {
|
|
2538
|
+
// Sr_No: i+1,
|
|
2539
|
+
Name: userObjectList[i].Name,
|
|
2540
|
+
Subjects_taught: userObjectList[i].Subjects,
|
|
2541
|
+
" Duration(mins)": userObjectList[i].duration,
|
|
2542
|
+
ClassRooms: userObjectList[i].ClassRooms,
|
|
2543
|
+
DaysAccsessed: userObjectList[i].DayAccess,
|
|
2544
|
+
DatesAccess: userObjectList[i].DatesAccess,
|
|
2545
|
+
Grades: userObjectList[i].Grades,
|
|
2546
|
+
Subjects: userObjectList[i].SubjectTought
|
|
2547
|
+
};
|
|
2548
|
+
var returnedTarget = Object.assign(asset_media, Assetcounts);
|
|
2549
|
+
userSummaryList.push(returnedTarget);
|
|
2550
|
+
};
|
|
2551
|
+
var this_2 = this;
|
|
2552
|
+
for (var i = 0; i < userObjectList.length; i++) {
|
|
2553
|
+
_loop_2(i);
|
|
2554
|
+
}
|
|
2555
|
+
// console.log("userSummaryList",userSummaryList);
|
|
2556
|
+
return userSummaryList;
|
|
2557
|
+
};
|
|
2558
|
+
// To GET DISPLAY TYPE
|
|
2559
|
+
ExceldataService.prototype.getDisplaytypeValue = function (key) {
|
|
2560
|
+
var assetTypeConfig = [
|
|
2561
|
+
{
|
|
2562
|
+
type: "asset_media",
|
|
2563
|
+
display: "Media"
|
|
2564
|
+
},
|
|
2565
|
+
{
|
|
2566
|
+
type: "asset_print",
|
|
2567
|
+
display: "Print"
|
|
2568
|
+
},
|
|
2569
|
+
{
|
|
2570
|
+
type: "quiz",
|
|
2571
|
+
display: "Quiz"
|
|
2572
|
+
},
|
|
2573
|
+
{
|
|
2574
|
+
type: "question",
|
|
2575
|
+
display: "Question"
|
|
2576
|
+
},
|
|
2577
|
+
{
|
|
2578
|
+
type: "chapter",
|
|
2579
|
+
display: "Chapter"
|
|
2580
|
+
},
|
|
2581
|
+
{
|
|
2582
|
+
type: "tp",
|
|
2583
|
+
display: "Topic"
|
|
2584
|
+
},
|
|
2585
|
+
{
|
|
2586
|
+
type: "whiteboard",
|
|
2587
|
+
display: "Whiteboard"
|
|
2588
|
+
},
|
|
2589
|
+
{
|
|
2590
|
+
type: "widget",
|
|
2591
|
+
display: "Widget"
|
|
2592
|
+
},
|
|
2593
|
+
{
|
|
2594
|
+
type: "casset_media",
|
|
2595
|
+
display: "cMedia"
|
|
2596
|
+
},
|
|
2597
|
+
{
|
|
2598
|
+
type: "casset_print",
|
|
2599
|
+
display: "cPrint"
|
|
2600
|
+
},
|
|
2601
|
+
{
|
|
2602
|
+
type: "cquiz",
|
|
2603
|
+
display: "cQuiz"
|
|
2604
|
+
},
|
|
2605
|
+
{
|
|
2606
|
+
type: "cquestion",
|
|
2607
|
+
display: "cQuestion"
|
|
2608
|
+
},
|
|
2609
|
+
{
|
|
2610
|
+
type: "image",
|
|
2611
|
+
display: "Image"
|
|
2612
|
+
},
|
|
2613
|
+
{
|
|
2614
|
+
type: "video",
|
|
2615
|
+
display: "Video"
|
|
2616
|
+
},
|
|
2617
|
+
];
|
|
2618
|
+
var displayValue = key;
|
|
2619
|
+
assetTypeConfig.forEach(function (value) {
|
|
2620
|
+
if (value.type === key) {
|
|
2621
|
+
displayValue = value.display;
|
|
2622
|
+
}
|
|
2623
|
+
});
|
|
2624
|
+
return displayValue;
|
|
2625
|
+
};
|
|
2626
|
+
return ExceldataService;
|
|
2627
|
+
}());
|
|
2628
|
+
ExceldataService.ɵprov = i0.ɵɵdefineInjectable({ factory: function ExceldataService_Factory() { return new ExceldataService(); }, token: ExceldataService, providedIn: "root" });
|
|
2629
|
+
ExceldataService.decorators = [
|
|
2630
|
+
{ type: i0.Injectable, args: [{
|
|
2631
|
+
providedIn: 'root'
|
|
2632
|
+
},] }
|
|
2633
|
+
];
|
|
2634
|
+
ExceldataService.ctorParameters = function () { return []; };
|
|
2635
|
+
|
|
2636
|
+
var HeaderComponent = /** @class */ (function () {
|
|
2637
|
+
function HeaderComponent(excelService, pdService) {
|
|
2638
|
+
this.excelService = excelService;
|
|
2639
|
+
this.pdService = pdService;
|
|
2640
|
+
this.userSelectedDate = new i0.EventEmitter();
|
|
2641
|
+
this.refreshTimer = 0;
|
|
2642
|
+
//for datepicker
|
|
2643
|
+
this.title = 'datepicker';
|
|
2644
|
+
this.date = new Date();
|
|
2645
|
+
this.options = {
|
|
2646
|
+
inputClass: 'input',
|
|
2647
|
+
calendarClass: 'datepicker-default',
|
|
2648
|
+
scrollBarColor: '#010001',
|
|
2649
|
+
format: 'dd/LL/yyyy',
|
|
2650
|
+
maxDate: new Date()
|
|
2651
|
+
// for demo purpose
|
|
2652
|
+
};
|
|
2653
|
+
}
|
|
2654
|
+
Object.defineProperty(HeaderComponent.prototype, "data", {
|
|
2655
|
+
set: function (res) {
|
|
2656
|
+
if (res !== null) {
|
|
2657
|
+
this.loadData(res);
|
|
2658
|
+
}
|
|
2659
|
+
},
|
|
2660
|
+
enumerable: false,
|
|
2661
|
+
configurable: true
|
|
2662
|
+
});
|
|
2663
|
+
HeaderComponent.prototype.ngOnInit = function () {
|
|
2664
|
+
this.urlParams = new URLSearchParams(window.location.search);
|
|
2665
|
+
this.isDemo = this.urlParams.get('demo') === '1';
|
|
2666
|
+
this.getDefaultDate();
|
|
2667
|
+
this.startTimer();
|
|
2668
|
+
};
|
|
2669
|
+
HeaderComponent.prototype.getDefaultDate = function () {
|
|
2670
|
+
var selectedDate = this.isDemo ? new Date('2025-05-21T00:00:00') : new Date();
|
|
2671
|
+
this.getDateFormat(selectedDate);
|
|
2672
|
+
this.todayDate = this.calenderCurrentDate;
|
|
2673
|
+
console.log('this.isDemo', this.isDemo);
|
|
2674
|
+
if (this.isDemo) {
|
|
2675
|
+
this.mydata = null;
|
|
2676
|
+
this.refreshChart();
|
|
2677
|
+
this.pdService.openSmallTable.next(false);
|
|
2678
|
+
}
|
|
2679
|
+
};
|
|
2680
|
+
HeaderComponent.prototype.dateSelected = function (e) {
|
|
2681
|
+
var selectedDate = this.isDemo ? new Date('2025-05-21T00:00:00') : new Date(e);
|
|
2682
|
+
console.log("Selected Date:", selectedDate);
|
|
2683
|
+
this.getDateFormat(selectedDate);
|
|
2684
|
+
//const fixedDate = new Date('2025-05-21T00:00:00'); // Static date
|
|
2685
|
+
//console.log("Overriding selected date with fixed date:", fixedDate);
|
|
2686
|
+
//this.getDateFormat(fixedDate);
|
|
2687
|
+
this.mydata = null;
|
|
2688
|
+
this.refreshChart();
|
|
2689
|
+
this.pdService.openSmallTable.next(false);
|
|
2690
|
+
};
|
|
2691
|
+
HeaderComponent.prototype.getDateFormat = function (date) {
|
|
2692
|
+
var day = date.getDate();
|
|
2693
|
+
var month = date.getMonth() + 1;
|
|
2694
|
+
var year = date.getFullYear();
|
|
2695
|
+
var m;
|
|
2696
|
+
var d;
|
|
2697
|
+
if (month < 10) {
|
|
2698
|
+
m = "0" + month;
|
|
2699
|
+
}
|
|
2700
|
+
else {
|
|
2701
|
+
m = month;
|
|
2702
|
+
}
|
|
2703
|
+
if (day < 10) {
|
|
2704
|
+
d = "0" + day;
|
|
2705
|
+
}
|
|
2706
|
+
else {
|
|
2707
|
+
d = day;
|
|
2708
|
+
}
|
|
2709
|
+
var today = year + "-" + m + "-" + d;
|
|
2710
|
+
this.currentDate = today;
|
|
2711
|
+
this.calenderCurrentDate = today.split("-").reverse().join("-");
|
|
2712
|
+
};
|
|
2713
|
+
// selectDate(e: any) {
|
|
2714
|
+
// this.calenderEvent = e;
|
|
2715
|
+
// let today = e.target.value;
|
|
2716
|
+
// // console.log("e.target.value", e.target.value);
|
|
2717
|
+
// today = today.split("-").reverse().join("-");
|
|
2718
|
+
// this.calenderCurrentDate = today;
|
|
2719
|
+
// this.mydata = null;
|
|
2720
|
+
// this.refreshChart();
|
|
2721
|
+
// // this.userSelectedDate.emit(this.calenderCurrentDate);
|
|
2722
|
+
// ;
|
|
2723
|
+
// console.log(" IN --> 5");
|
|
2724
|
+
// }
|
|
2725
|
+
HeaderComponent.prototype.refreshChart = function () {
|
|
2726
|
+
this.stopTimer();
|
|
2727
|
+
this.refreshTimer = 0;
|
|
2728
|
+
if (this.calenderCurrentDate === this.todayDate) {
|
|
2729
|
+
this.countDown();
|
|
2730
|
+
}
|
|
2731
|
+
this.userSelectedDate.emit(this.calenderCurrentDate);
|
|
2732
|
+
};
|
|
2733
|
+
HeaderComponent.prototype.startTimer = function () {
|
|
2734
|
+
this.countDown();
|
|
2735
|
+
};
|
|
2736
|
+
HeaderComponent.prototype.stopTimer = function () {
|
|
2737
|
+
this.clearTimer();
|
|
2738
|
+
this.message = "";
|
|
2739
|
+
};
|
|
2740
|
+
HeaderComponent.prototype.clearTimer = function () {
|
|
2741
|
+
this.refreshTimer = 0;
|
|
2742
|
+
window.clearInterval(this.intervalId);
|
|
2743
|
+
};
|
|
2744
|
+
HeaderComponent.prototype.countDown = function () {
|
|
2745
|
+
var _this = this;
|
|
2746
|
+
//console.log("countDown")
|
|
2747
|
+
this.clearTimer();
|
|
2748
|
+
this.intervalId = window.setInterval(function () {
|
|
2749
|
+
_this.refreshTimer -= 1;
|
|
2750
|
+
if (_this.refreshTimer === 0) {
|
|
2751
|
+
_this.refreshChart();
|
|
2752
|
+
_this.message = '';
|
|
2753
|
+
}
|
|
2754
|
+
else {
|
|
2755
|
+
if (_this.refreshTimer < 0) {
|
|
2756
|
+
_this.refreshTimer = 300;
|
|
2757
|
+
} // reset
|
|
2758
|
+
_this.message = "" + _this.refreshTimer;
|
|
2759
|
+
}
|
|
2760
|
+
}, 1000);
|
|
2761
|
+
};
|
|
2762
|
+
HeaderComponent.prototype.timeConvert = function (n) {
|
|
2763
|
+
var num = n;
|
|
2764
|
+
var hours = num / 60;
|
|
2765
|
+
var rhours = Math.floor(hours);
|
|
2766
|
+
var minutes = (hours - rhours) * 60;
|
|
2767
|
+
var rminutes = Math.round(minutes);
|
|
2768
|
+
return rhours + ':' + rminutes;
|
|
2769
|
+
};
|
|
2770
|
+
// currentdataList: any;
|
|
2771
|
+
// currentResoursedataList:any;
|
|
2772
|
+
HeaderComponent.prototype.loadData = function (response) {
|
|
2773
|
+
if (response) {
|
|
2774
|
+
this.mydata = JSON.parse(response);
|
|
2775
|
+
if (this.mydata) {
|
|
2776
|
+
//get current data list
|
|
2777
|
+
var genarateUserReqiuredData = this.excelService.genarateUserReqiuredData_Excel(this.mydata);
|
|
2778
|
+
var currentdataList = genarateUserReqiuredData.userConsoleData;
|
|
2779
|
+
// resoureMetadata list
|
|
2780
|
+
var currentResoursedataList = this.excelService.genarateResourseReqiuredData_Excel(this.mydata);
|
|
2781
|
+
var deatilData = this.excelService.deatilData_Excel(currentdataList, currentResoursedataList);
|
|
2782
|
+
var userDetails_data = this.excelService.deatilUsage_Excel(deatilData);
|
|
2783
|
+
var UserSummary = this.excelService.userSummary_Excel(this.mydata, deatilData);
|
|
2784
|
+
var schoolDetails = this.mydata.schoolMetadata.school;
|
|
2785
|
+
var userDetails = userDetails_data;
|
|
2786
|
+
var terminalDetails = this.mydata.schoolTerminals.schoolTerminal;
|
|
2787
|
+
// console.log("schoolDetails",schoolDetails);
|
|
2788
|
+
// console.log("UserSummary",UserSummary);
|
|
2789
|
+
// console.log("terminalDetails",terminalDetails);
|
|
2790
|
+
// console.log("userDetails",userDetails);
|
|
2791
|
+
this.dataList = [
|
|
2792
|
+
[schoolDetails],
|
|
2793
|
+
UserSummary,
|
|
2794
|
+
terminalDetails,
|
|
2795
|
+
userDetails
|
|
2796
|
+
];
|
|
2797
|
+
}
|
|
2798
|
+
}
|
|
2799
|
+
};
|
|
2800
|
+
HeaderComponent.prototype.exportReport = function () {
|
|
2801
|
+
if (this.mydata) {
|
|
2802
|
+
this.excelService.exportAsExcelFile(this.dataList, 'UsageReport-' + this.calenderCurrentDate);
|
|
2803
|
+
}
|
|
2804
|
+
};
|
|
2805
|
+
HeaderComponent.prototype.ngOnDestroy = function () {
|
|
2806
|
+
this.clearTimer();
|
|
2807
|
+
};
|
|
2808
|
+
return HeaderComponent;
|
|
2809
|
+
}());
|
|
2810
|
+
HeaderComponent.decorators = [
|
|
2811
|
+
{ type: i0.Component, args: [{
|
|
2812
|
+
selector: 'lib-header',
|
|
2813
|
+
template: "<div id=\"pd_header\" class=\"pd_header\">\n \n <div *ngIf=\"message && mydata && (this.todayDate === this.calenderCurrentDate)\" id=\"pd_refeshView\" class=\"pd_refesh_bar\">\n <div class=\"timer_msg\"> This page will be refreshed in</div>\n <div class=\"timer_value\"> {{timeConvert(message)}} min</div>\n <div id=\"pd_refeshBtn\" (click)=\"refreshChart()\"> Refresh </div>\n </div>\n\n <div id=\"pd_exportBtn\" class=\"pd_exportButton\" *ngIf=\"mydata\"\n [ngClass]=\"{'pd_exportButton_shiftRight': this.todayDate != this.calenderCurrentDate}\" (click)=\"exportReport()\"> \n <span class=\"pd_exportButton_text\">Download Report</span>\n <div class=\"pd_download_icon\"></div>\n </div>\n \n <div class=\"pd_header_calendar\">\n <!-- <input type=\"Date\" [max]=\"currentDate\" [value]=\"currentDate\" id=\"myCalendar\" (input)=\"selectDate($event)\" /> -->\n <ngx-datepicker [(ngModel)]=\"date\" [options]=\"options\" (ngModelChange)=\"dateSelected($event)\"></ngx-datepicker>\n </div>\n <div class=\"pd_header_content\" >Realtime usage data</div>\n</div>\n",
|
|
2814
|
+
styles: [".pd_header{width:100%;background-color:#e0e0e0;height:50px;border-bottom:2px solid #fff}.pd_header_calendar{position:absolute;width:150px;margin:5px 5px 5px 17px}.pd_header_content{position:relative;width:350px;margin:0 auto;color:#000;text-align:center;font-size:30px;line-height:50px;pointer-events:none}.pd_exportButton{position:absolute;display:inline-block;right:144px;padding:0 16px;cursor:pointer;margin:9px 0 0;height:30px;width:160px;line-height:30px;background-color:#4285f9;font-size:10pt;font-weight:400;transition:right .5s;border-radius:5px;color:#fff;font-weight:700}.pd_exportButton_shiftRight{right:10px}.pd_download_icon{position:absolute;width:16px;height:16px;background-size:100% 100%;top:8px;background-repeat:no-repeat;display:inline-block;right:5px;background-image:url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAAY0lEQVRIiWNgGOqAkQS1/8nRy0SCBWSBUQtGLRjiFpQzQDIXDKMDZLl6ch2Abgk2TLbhxFhCseH4LKGa4dgsIdpwZhIsOMoAKUEPMjAwNJLktFGADyDXStgyE8Vm07yoGPoAAH1UItbw1O5lAAAAAElFTkSuQmCC\")}.pd_exportButton_text{position:relative;display:inline-block;width:130px}.pd_refesh_bar{position:absolute;color:#000;width:120px;height:78px;right:15px;top:4px;z-index:2;background-color:#fff;float:right;text-align:center;font-size:12px;border-radius:.25rem;border:1px solid #a09898;box-shadow:0 0 5px 0 rgba(0,0,0,.75);-webkit-box-shadow:0 0 5px 0 rgba(0,0,0,.75);-moz-box-shadow:0 0 5px 0 rgba(0,0,0,.75);-webkit-animation:refreshViewAnimate .6s;animation:refreshViewAnimate .6s}@-webkit-keyframes refreshViewAnimate{0%{opacity:.5;top:-32px}to{opacity:1;top:4px}}@keyframes refreshViewAnimate{0%{opacity:.5;top:-32px}to{opacity:1;top:4px}}.timer_msg{position:absolute;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;line-height:14px;top:2px}.timer_value{font-weight:700;font-size:15px}#pd_refeshBtn,.timer_value{position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;top:28px}#pd_refeshBtn{background-color:#2172f6;cursor:pointer;width:60px;margin:0 auto;border-radius:3px;color:#fff;height:22px;line-height:20px}#pd_refeshBtn:hover{opacity:.6}::ng-deep.bs-datepicker{margin-left:200px}.bs-datepicker-body table td span.selected,.theme-default .bs-datepicker-body table td.selected span,.theme-default .bs-datepicker-body table td[class*=select-] span:after,.theme-default .bs-datepicker-body table td span[class*=select-]:after{background-color:#000}.bs-datepicker-head{background-color:#000!important}"]
|
|
2815
|
+
},] }
|
|
2816
|
+
];
|
|
2817
|
+
HeaderComponent.ctorParameters = function () { return [
|
|
2818
|
+
{ type: ExceldataService },
|
|
2819
|
+
{ type: PrincipalDashboardLibV2Service }
|
|
2820
|
+
]; };
|
|
2821
|
+
HeaderComponent.propDecorators = {
|
|
2822
|
+
data: [{ type: i0.Input }],
|
|
2823
|
+
userSelectedDate: [{ type: i0.Output }]
|
|
2824
|
+
};
|
|
2825
|
+
|
|
2826
|
+
var TableviewComponent = /** @class */ (function () {
|
|
2827
|
+
function TableviewComponent(pdService) {
|
|
2828
|
+
this.pdService = pdService;
|
|
2829
|
+
this.myChartType = angularGoogleCharts.ChartType.Table;
|
|
2830
|
+
this.isUserWise = true;
|
|
2831
|
+
}
|
|
2832
|
+
Object.defineProperty(TableviewComponent.prototype, "data", {
|
|
2833
|
+
set: function (res) {
|
|
2834
|
+
if (res !== null) {
|
|
2835
|
+
this.loadTable(res);
|
|
2836
|
+
}
|
|
2837
|
+
},
|
|
2838
|
+
enumerable: false,
|
|
2839
|
+
configurable: true
|
|
2840
|
+
});
|
|
2841
|
+
TableviewComponent.prototype.ngOnInit = function () {
|
|
2842
|
+
};
|
|
2843
|
+
TableviewComponent.prototype.loadTable = function (response) {
|
|
2844
|
+
var _this = this;
|
|
2845
|
+
console.log('mresponse: ', response);
|
|
2846
|
+
// let parse = new DOMParser();
|
|
2847
|
+
// this.myXmlData = parse.parseFromString(response, 'application/xml');
|
|
2848
|
+
if (response) {
|
|
2849
|
+
this.myXmlData = JSON.parse(response);
|
|
2850
|
+
if (this.myXmlData) {
|
|
2851
|
+
// get current data list
|
|
2852
|
+
//console.log("AAA myXmlData-->>",this.myXmlData)
|
|
2853
|
+
var genarateUserReqiuredData = this.pdService.genarateUserReqiuredData(this.myXmlData);
|
|
2854
|
+
this.currentdataList = genarateUserReqiuredData.userConsoleData;
|
|
2855
|
+
// get all user list
|
|
2856
|
+
var fetchAlluserList = this.pdService.allUserChartData();
|
|
2857
|
+
this.alluserList = fetchAlluserList.fordurationTable;
|
|
2858
|
+
// resoureMetadata list
|
|
2859
|
+
this.currentResoursedataList = this.pdService.genarateResourseReqiuredData(this.myXmlData);
|
|
2860
|
+
//console.log("AAA genarateUserReqiuredData-->>",genarateUserReqiuredData)
|
|
2861
|
+
//console.log("AAA this.currentResoursedataList-->>",this.currentResoursedataList)
|
|
2862
|
+
}
|
|
2863
|
+
}
|
|
2864
|
+
this.tableViewDiv = document.getElementById('tableViewDiv');
|
|
2865
|
+
this.tableRow = document.getElementById('tableRow');
|
|
2866
|
+
this.tblBody = document.getElementById('tblBody');
|
|
2867
|
+
this.tableViewDiv.style.display = 'none';
|
|
2868
|
+
this.pdService.chartType.subscribe(function (data) {
|
|
2869
|
+
if (data) {
|
|
2870
|
+
_this.updateChartType(data);
|
|
2871
|
+
}
|
|
2872
|
+
});
|
|
2873
|
+
this.pdService.isUserWise_data.subscribe(function (data) {
|
|
2874
|
+
_this.updateDataType(data);
|
|
2875
|
+
});
|
|
2876
|
+
this.pdService.isAllUsers.subscribe(function (data) {
|
|
2877
|
+
if (data) {
|
|
2878
|
+
_this.showAllUser();
|
|
2879
|
+
}
|
|
2880
|
+
else {
|
|
2881
|
+
_this.showCurrentDataUser();
|
|
2882
|
+
}
|
|
2883
|
+
});
|
|
2884
|
+
};
|
|
2885
|
+
TableviewComponent.prototype.findAndSimplifyNestedArray = function (data) {
|
|
2886
|
+
//console.log('this.tableViewData',data)
|
|
2887
|
+
for (var i = 0; i < data.length; i++) {
|
|
2888
|
+
if (Array.isArray(data[i])) {
|
|
2889
|
+
var nestedArray = data[i];
|
|
2890
|
+
if (nestedArray.every(function (item) { return Array.isArray(item) && item.every(function (val) { return val === item[0]; }); })) {
|
|
2891
|
+
data[i] = [[nestedArray[0][0]]];
|
|
2892
|
+
}
|
|
2893
|
+
return data[i];
|
|
2894
|
+
}
|
|
2895
|
+
}
|
|
2896
|
+
return "No nested array found.";
|
|
2897
|
+
};
|
|
2898
|
+
TableviewComponent.prototype.showCurrentDataUser = function () {
|
|
2899
|
+
this.tableViewData = this.pdService.dataForTableView(this.currentdataList, this.currentResoursedataList);
|
|
2900
|
+
this.tableViewData = this.replaceTopicAndChapter(this.tableViewData);
|
|
2901
|
+
//this.tableViewData = this.findAndSimplifyNestedArray(this.tableViewData);
|
|
2902
|
+
var newTableViewData;
|
|
2903
|
+
for (var i = 0; i < this.tableViewData.length; i++) {
|
|
2904
|
+
newTableViewData = this.findAndSimplifyNestedArray(this.tableViewData[i]);
|
|
2905
|
+
newTableViewData[newTableViewData.length - 1] = newTableViewData[newTableViewData.length - 1][0];
|
|
2906
|
+
}
|
|
2907
|
+
var anotherTableViewData;
|
|
2908
|
+
for (var j = 0; j < this.tableViewData.length; j++) {
|
|
2909
|
+
anotherTableViewData = this.mergerSourceWithRoomData(this.tableViewData[j]);
|
|
2910
|
+
}
|
|
2911
|
+
if (this.tableViewData) {
|
|
2912
|
+
//this.ueserWiseTableView(this.tableViewData);
|
|
2913
|
+
this.ueserWiseTableView(this.tableViewData);
|
|
2914
|
+
}
|
|
2915
|
+
//console.log('AAA mlaunchedFromm tableViewData', this.tableViewData)
|
|
2916
|
+
};
|
|
2917
|
+
TableviewComponent.prototype.replaceTopicAndChapter = function (data) {
|
|
2918
|
+
var htmlStr = "<span style='font-style: italic;color: #3F51B5;'>(seen)</span>";
|
|
2919
|
+
return data.map(function (row) {
|
|
2920
|
+
if (Array.isArray(row)) {
|
|
2921
|
+
return row.map(function (item) {
|
|
2922
|
+
if (typeof item === 'string') {
|
|
2923
|
+
//item = item.replace(/Topic :\s*(.+?)\s*:\s*0m 0s/, 'Topic: $1 ' + htmlStr);
|
|
2924
|
+
//item = item.replace(/Chapter :\s*(.+?)\s*:\s*0m 0s/, 'Chapter: $1 ' + htmlStr);
|
|
2925
|
+
item = item.replace(/Topic :\s*(.+?)\s*:\s*\d+m \d+s/, 'Topic: $1 ' + htmlStr);
|
|
2926
|
+
item = item.replace(/Chapter :\s*(.+?)\s*:\s*\d+m \d+s/, 'Chapter: $1 ' + htmlStr);
|
|
2927
|
+
}
|
|
2928
|
+
return item;
|
|
2929
|
+
});
|
|
2930
|
+
}
|
|
2931
|
+
return row;
|
|
2932
|
+
});
|
|
2933
|
+
};
|
|
2934
|
+
TableviewComponent.prototype.mergerSourceWithRoomData = function (tableViewData) {
|
|
2935
|
+
var lastIndexValue = tableViewData[tableViewData.length - 1].join(' ');
|
|
2936
|
+
// Merge last index value into the 6th index
|
|
2937
|
+
//console.log('lastIndexValue',lastIndexValue)
|
|
2938
|
+
if (lastIndexValue === 'ce6') {
|
|
2939
|
+
//lastIndexValue = '<span style="color:black;"><i class="fa fa-windows" aria-hidden="true"></i></span>';
|
|
2940
|
+
lastIndexValue = '<span style="color:black;"></span>';
|
|
2941
|
+
}
|
|
2942
|
+
else if (lastIndexValue === 'ce6-a') {
|
|
2943
|
+
lastIndexValue = '<span style="color:#1b60d1;font-weight:bold;font-size:14px;"><i class="fa fa-android" aria-hidden="true"></i></span>';
|
|
2944
|
+
}
|
|
2945
|
+
else if (lastIndexValue === 'c') {
|
|
2946
|
+
lastIndexValue = '<span style="color:#1b60d1;font-weight:bold;font-size:14px; display:flex;"><i style="margin-top:-1px;" class="fa fa-android" aria-hidden="true"></i><i style="margin-left:5px;" class="fa fa-desktop" aria-hidden="true"></i></span>';
|
|
2947
|
+
}
|
|
2948
|
+
//tableViewData[6] = tableViewData[6] + '\n' + lastIndexValue;
|
|
2949
|
+
//tableViewData[6] = '<div style="display: flex;flex-direction: row;align-content: center;justify-content: flex-start;align-items: center;">'+lastIndexValue + ' ' + '<span style="font-size:11px !important;color:gray;font-weight:600;">'+tableViewData[6]+'</span></div>';
|
|
2950
|
+
tableViewData[6] = '<div style="display: flex;flex-direction: row;align-content: center;justify-content: flex-start;align-items: center;">' + '<span style="font-size:11px !important;color:gray;font-weight:600;">' + tableViewData[6] + '</span>' + '<span style="color:transparent">-</span>' + lastIndexValue + '</div>';
|
|
2951
|
+
// Optional: remove the last element (if no longer needed)
|
|
2952
|
+
tableViewData.pop();
|
|
2953
|
+
};
|
|
2954
|
+
TableviewComponent.prototype.showAllUser = function () {
|
|
2955
|
+
this.tableViewData = this.pdService.dataForTableView(this.alluserList, this.currentResoursedataList);
|
|
2956
|
+
console.log('11decc tableViewDataBBB', this.replaceTopicAndChapter(this.tableViewData));
|
|
2957
|
+
this.tableViewData = this.replaceTopicAndChapter(this.tableViewData);
|
|
2958
|
+
//console.log('AAA userConsoleMatrix tableViewData', this.tableViewData)
|
|
2959
|
+
var newTableViewData;
|
|
2960
|
+
for (var i = 0; i < this.tableViewData.length; i++) {
|
|
2961
|
+
newTableViewData = this.findAndSimplifyNestedArray(this.tableViewData[i]);
|
|
2962
|
+
if (newTableViewData[newTableViewData.length - 1]) {
|
|
2963
|
+
newTableViewData[newTableViewData.length - 1] = newTableViewData[newTableViewData.length - 1][0];
|
|
2964
|
+
}
|
|
2965
|
+
}
|
|
2966
|
+
var anotherTableViewData;
|
|
2967
|
+
for (var j = 0; j < this.tableViewData.length; j++) {
|
|
2968
|
+
anotherTableViewData = this.mergerSourceWithRoomData(this.tableViewData[j]);
|
|
2969
|
+
}
|
|
2970
|
+
if (this.tableViewData) {
|
|
2971
|
+
this.ueserWiseTableView(this.tableViewData);
|
|
2972
|
+
}
|
|
2973
|
+
};
|
|
2974
|
+
TableviewComponent.prototype.updateDataType = function (dataType) {
|
|
2975
|
+
this.isUserWise = dataType;
|
|
2976
|
+
};
|
|
2977
|
+
TableviewComponent.prototype.updateChartType = function (dataType) {
|
|
2978
|
+
this.myChartType = dataType;
|
|
2979
|
+
if (this.myChartType == angularGoogleCharts.ChartType.Timeline) {
|
|
2980
|
+
this.tableViewDiv.style.display = 'none';
|
|
2981
|
+
}
|
|
2982
|
+
else {
|
|
2983
|
+
this.tableViewDiv.style.display = 'block';
|
|
2984
|
+
}
|
|
2985
|
+
};
|
|
2986
|
+
TableviewComponent.prototype.ueserWiseTableView = function (resoureMetadata) {
|
|
2987
|
+
//console.log('AAA resoureMetadata', resoureMetadata);
|
|
2988
|
+
// this.deleterow("tableRow");
|
|
2989
|
+
document.getElementById("tblBody").innerHTML = "";
|
|
2990
|
+
var labelArray = new Array();
|
|
2991
|
+
var cnt = 0;
|
|
2992
|
+
for (var i = 0; i < resoureMetadata.length; i++) {
|
|
2993
|
+
for (var j = 0; j < 12; j++) {
|
|
2994
|
+
//let label = document.createElement('label');
|
|
2995
|
+
//label.appendChild(document.createTextNode(resoureMetadata[i][j]));
|
|
2996
|
+
var label = document.createElement('div');
|
|
2997
|
+
label.innerHTML = (resoureMetadata[i][j]);
|
|
2998
|
+
//console.log('11dec label.textContent',label.textContent)
|
|
2999
|
+
if (label.textContent === 'undefined' ||
|
|
3000
|
+
label.textContent === undefined ||
|
|
3001
|
+
label.textContent === 'undefined\nce6-a' ||
|
|
3002
|
+
label.textContent === 'undefined\nce6' ||
|
|
3003
|
+
label.textContent === 'undefined\n' ||
|
|
3004
|
+
label.textContent === 'undefined\nAndroid' ||
|
|
3005
|
+
label.textContent === 'undefined\nWeb' ||
|
|
3006
|
+
label.textContent === 'undefined\n' ||
|
|
3007
|
+
label.textContent === '\nundefined' ||
|
|
3008
|
+
label.textContent === ' undefined' ||
|
|
3009
|
+
label.textContent === 'undefined-' ||
|
|
3010
|
+
label.textContent === 'undefined-c' ||
|
|
3011
|
+
label.textContent === 'undefined- ') {
|
|
3012
|
+
label.textContent = '';
|
|
3013
|
+
}
|
|
3014
|
+
labelArray.push(label);
|
|
3015
|
+
}
|
|
3016
|
+
}
|
|
3017
|
+
//console.log("labelArray",labelArray);
|
|
3018
|
+
for (var j = 0; j <= resoureMetadata.length; j++) {
|
|
3019
|
+
var row = document.createElement('tr');
|
|
3020
|
+
var cell = void 0;
|
|
3021
|
+
for (var i = 0; i < 12; i++) {
|
|
3022
|
+
cell = document.createElement('td');
|
|
3023
|
+
if (cnt < labelArray.length) {
|
|
3024
|
+
cell.appendChild(labelArray[cnt]);
|
|
3025
|
+
row.appendChild(cell);
|
|
3026
|
+
}
|
|
3027
|
+
cnt++;
|
|
3028
|
+
}
|
|
3029
|
+
this.tblBody.appendChild(row);
|
|
3030
|
+
// this.tableRow.appendChild(this.tblBody);
|
|
3031
|
+
}
|
|
3032
|
+
};
|
|
3033
|
+
return TableviewComponent;
|
|
3034
|
+
}());
|
|
3035
|
+
TableviewComponent.decorators = [
|
|
3036
|
+
{ type: i0.Component, args: [{
|
|
3037
|
+
selector: 'lib-tableview',
|
|
3038
|
+
template: "\n <div id=\"tableViewDiv\" class=\"pd-tableViewDiv\">\n \n <table class=\"table table-bordered\" id=\"tableRow\">\n <thead class=\"table-head\">\n <tr class=\"table-headerRow\">\n <th scope=\"col\">Teacher Name</th>\n <th scope=\"col\">Subjects</th>\n <th scope=\"col\">Date</th>\n <th scope=\"col\">Start Time</th>\n <th scope=\"col\">End Time</th>\n <th scope=\"col\">Duration (mins)</th>\n <th scope=\"col\">Room</th>\n <th scope=\"col\">Subject</th>\n <th scope=\"col\">Topic of Class</th>\n <th scope=\"col\">Chapter Name</th>\n <th scope=\"col\">Topic Name</th>\n <th scope=\"col\">Assets Details</th>\n \n </tr>\n </thead>\n <tbody id=\"tblBody\">\n \n </tbody>\n </table>\n </div>\n \n",
|
|
3039
|
+
styles: [".pd-tableViewDiv{width:100%;height:744px;overflow:scroll}.pd-tableViewDiv #tableRow{font-size:small;width:100%;margin-left:24px;margin-top:10px}.pd-tableViewDiv .table-headerRow{font-weight:700}.pd-tableViewDiv .table-head{position:sticky;top:0;background:#fff}.roomCell{display:flex;flex-direction:row;align-content:center;justify-content:flex-start;align-items:center}"]
|
|
3040
|
+
},] }
|
|
3041
|
+
];
|
|
3042
|
+
TableviewComponent.ctorParameters = function () { return [
|
|
3043
|
+
{ type: PrincipalDashboardLibV2Service }
|
|
3044
|
+
]; };
|
|
3045
|
+
TableviewComponent.propDecorators = {
|
|
3046
|
+
data: [{ type: i0.Input }]
|
|
3047
|
+
};
|
|
3048
|
+
|
|
3049
|
+
var FullTableViewComponent = /** @class */ (function () {
|
|
3050
|
+
function FullTableViewComponent(pdService) {
|
|
3051
|
+
this.pdService = pdService;
|
|
3052
|
+
this.currentUserArray = [];
|
|
3053
|
+
this.remaningUsers = [];
|
|
3054
|
+
this.allUsers = [];
|
|
3055
|
+
this.usersCheckboxChecked = false;
|
|
3056
|
+
this.classroomArray = [];
|
|
3057
|
+
this.allClassrooms = [];
|
|
3058
|
+
this.isDisplay = false;
|
|
3059
|
+
this.isUserWise = true;
|
|
3060
|
+
this.isAllUsers = false;
|
|
3061
|
+
this.isInitialized = false;
|
|
3062
|
+
}
|
|
3063
|
+
Object.defineProperty(FullTableViewComponent.prototype, "data", {
|
|
3064
|
+
set: function (res) {
|
|
3065
|
+
if (res !== null) {
|
|
3066
|
+
console.log('newtable', JSON.parse(res));
|
|
3067
|
+
this.jsonResponse = JSON.parse(res);
|
|
3068
|
+
// rebuild rows when new data arrives (date change / refresh)
|
|
3069
|
+
if (this.isInitialized) {
|
|
3070
|
+
this.loadUserData();
|
|
3071
|
+
}
|
|
3072
|
+
}
|
|
3073
|
+
},
|
|
3074
|
+
enumerable: false,
|
|
3075
|
+
configurable: true
|
|
3076
|
+
});
|
|
3077
|
+
FullTableViewComponent.prototype.ngOnInit = function () {
|
|
3078
|
+
var _this = this;
|
|
3079
|
+
this.loadUserData();
|
|
3080
|
+
this.isInitialized = true;
|
|
3081
|
+
this.pdService.isUserWise_data.subscribe(function (data) {
|
|
3082
|
+
_this.isUserWise = data;
|
|
3083
|
+
});
|
|
3084
|
+
this.pdService.isAllUsers.subscribe(function (data) {
|
|
3085
|
+
_this.isAllUsers = !!data;
|
|
3086
|
+
});
|
|
3087
|
+
this.pdService.chartType.subscribe(function (data) {
|
|
3088
|
+
if (data) {
|
|
3089
|
+
console.log('newTable', data);
|
|
3090
|
+
_this.isDisplay = data === "Table";
|
|
3091
|
+
}
|
|
3092
|
+
});
|
|
3093
|
+
};
|
|
3094
|
+
Object.defineProperty(FullTableViewComponent.prototype, "userRows", {
|
|
3095
|
+
get: function () {
|
|
3096
|
+
return this.isAllUsers ? this.allUsers : this.currentUserArray;
|
|
3097
|
+
},
|
|
3098
|
+
enumerable: false,
|
|
3099
|
+
configurable: true
|
|
3100
|
+
});
|
|
3101
|
+
Object.defineProperty(FullTableViewComponent.prototype, "classroomRows", {
|
|
3102
|
+
get: function () {
|
|
3103
|
+
return this.isAllUsers ? this.allClassrooms : this.classroomArray;
|
|
3104
|
+
},
|
|
3105
|
+
enumerable: false,
|
|
3106
|
+
configurable: true
|
|
3107
|
+
});
|
|
3108
|
+
FullTableViewComponent.prototype.loadUserData = function () {
|
|
3109
|
+
var _this = this;
|
|
3110
|
+
var json = this.jsonResponse;
|
|
3111
|
+
this.currentUserArray = [];
|
|
3112
|
+
this.remaningUsers = [];
|
|
3113
|
+
this.allUsers = [];
|
|
3114
|
+
this.classroomArray = [];
|
|
3115
|
+
this.allClassrooms = [];
|
|
3116
|
+
if (!json)
|
|
3117
|
+
return;
|
|
3118
|
+
var usersConsole = json.usersConsole.userConsole;
|
|
3119
|
+
var usersMetadata = json.usersMetadata.userMetadata;
|
|
3120
|
+
var resourcesMetadata = json.resourcesMetadata.resourceMetadata;
|
|
3121
|
+
usersConsole.forEach(function (user) {
|
|
3122
|
+
var _a;
|
|
3123
|
+
var userDetails = usersMetadata.find(function (userMeta) { return userMeta.userId === user.userId; });
|
|
3124
|
+
if (user === null || user === void 0 ? void 0 : user.userConsoleResources) {
|
|
3125
|
+
var userConsoleResource = (_a = user.userConsoleResources) === null || _a === void 0 ? void 0 : _a.userConsoleResource;
|
|
3126
|
+
if (userConsoleResource && userConsoleResource.length > 0) {
|
|
3127
|
+
userConsoleResource.forEach(function (userResource, userIndex) {
|
|
3128
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3129
|
+
var resourceId = userResource.resourceId;
|
|
3130
|
+
var resourceDetails = resourcesMetadata.find(function (resource) { return resource.resourceId === resourceId &&
|
|
3131
|
+
userResource.type === resource.type; });
|
|
3132
|
+
// console.log('userResource.type',userResource.type)
|
|
3133
|
+
var prefix = _this.getDisplayTypeValue(userResource.type);
|
|
3134
|
+
var title = (resourceDetails === null || resourceDetails === void 0 ? void 0 : resourceDetails.title) || '';
|
|
3135
|
+
var tp = (_a = resourceDetails === null || resourceDetails === void 0 ? void 0 : resourceDetails.teachingPoint) === null || _a === void 0 ? void 0 : _a.title;
|
|
3136
|
+
var subject = (_b = resourceDetails === null || resourceDetails === void 0 ? void 0 : resourceDetails.subject) === null || _b === void 0 ? void 0 : _b.title;
|
|
3137
|
+
var chapter = (_c = resourceDetails === null || resourceDetails === void 0 ? void 0 : resourceDetails.chapter) === null || _c === void 0 ? void 0 : _c.title;
|
|
3138
|
+
var grade = (_d = resourceDetails === null || resourceDetails === void 0 ? void 0 : resourceDetails.grade) === null || _d === void 0 ? void 0 : _d.title;
|
|
3139
|
+
var startTime = new Date(user === null || user === void 0 ? void 0 : user.startTime);
|
|
3140
|
+
var endTime = new Date(user === null || user === void 0 ? void 0 : user.endTime);
|
|
3141
|
+
var totalDuration = _this.formatTime(Math.round((endTime.getTime() - startTime.getTime()) / 1000));
|
|
3142
|
+
var duration = parseInt((userResource === null || userResource === void 0 ? void 0 : userResource.duration) || '0');
|
|
3143
|
+
//duration = duration === 0 ? "<span style='colore:red;'>(Seen)</span>" : this.formatTime(duration);
|
|
3144
|
+
if (((_e = userResource === null || userResource === void 0 ? void 0 : userResource.type) === null || _e === void 0 ? void 0 : _e.includes('question')) || ((_f = userResource === null || userResource === void 0 ? void 0 : userResource.type) === null || _f === void 0 ? void 0 : _f.includes('cquestion'))) {
|
|
3145
|
+
duration = 0;
|
|
3146
|
+
}
|
|
3147
|
+
else {
|
|
3148
|
+
duration = duration === 0 ? "<span class='seenTag' style='color:blue;'>(Seen)</span>" : _this.formatTime(duration);
|
|
3149
|
+
}
|
|
3150
|
+
var finalAssetTitle = prefix + " : " + title + " : " + duration;
|
|
3151
|
+
if (title === '') {
|
|
3152
|
+
finalAssetTitle = prefix + " : " + duration;
|
|
3153
|
+
}
|
|
3154
|
+
// console.log('chapterTitlte', chapter)
|
|
3155
|
+
_this.currentUserArray.push({
|
|
3156
|
+
userId: user.userId,
|
|
3157
|
+
teacherName: userIndex === 0 ? userDetails === null || userDetails === void 0 ? void 0 : userDetails.fullName : '',
|
|
3158
|
+
subjects: userIndex === 0 ? userDetails === null || userDetails === void 0 ? void 0 : userDetails.userSubjects : '',
|
|
3159
|
+
date: userIndex === 0 ? user === null || user === void 0 ? void 0 : user.selectedDate : '',
|
|
3160
|
+
startTime: userIndex === 0 ? _this.formatDate(startTime) : '',
|
|
3161
|
+
endtime: userIndex === 0 ? _this.formatDate(endTime) : '',
|
|
3162
|
+
totalDuration: userIndex === 0 ? totalDuration : '',
|
|
3163
|
+
room: userIndex === 0 ? user === null || user === void 0 ? void 0 : user.terminalIP : '',
|
|
3164
|
+
tp: tp,
|
|
3165
|
+
subject: subject,
|
|
3166
|
+
chapter: chapter,
|
|
3167
|
+
grade: grade,
|
|
3168
|
+
details: finalAssetTitle,
|
|
3169
|
+
});
|
|
3170
|
+
});
|
|
3171
|
+
}
|
|
3172
|
+
}
|
|
3173
|
+
});
|
|
3174
|
+
var currentUserIds = this.currentUserArray
|
|
3175
|
+
.map(function (x) { return x.userId; })
|
|
3176
|
+
.filter(function (x, i, a) { return a.indexOf(x) === i; });
|
|
3177
|
+
this.remaningUsers = usersMetadata
|
|
3178
|
+
.filter(function (user) { return !currentUserIds.includes(user.userId); })
|
|
3179
|
+
.map(function (user) {
|
|
3180
|
+
return {
|
|
3181
|
+
userId: user.userId,
|
|
3182
|
+
teacherName: user === null || user === void 0 ? void 0 : user.fullName,
|
|
3183
|
+
subjects: user === null || user === void 0 ? void 0 : user.userSubjects,
|
|
3184
|
+
date: '',
|
|
3185
|
+
startTime: '',
|
|
3186
|
+
endtime: '',
|
|
3187
|
+
totalDuration: '0s',
|
|
3188
|
+
room: '',
|
|
3189
|
+
tp: '',
|
|
3190
|
+
subject: '',
|
|
3191
|
+
chapter: '',
|
|
3192
|
+
grade: '',
|
|
3193
|
+
details: '',
|
|
3194
|
+
};
|
|
3195
|
+
});
|
|
3196
|
+
this.allUsers = __spread(this.currentUserArray, this.remaningUsers);
|
|
3197
|
+
this.loadClassroomData(usersConsole, usersMetadata, resourcesMetadata);
|
|
3198
|
+
this.loadTable(this.currentUserArray);
|
|
3199
|
+
};
|
|
3200
|
+
// Classroom wise rows: grouped by room, then by session start time
|
|
3201
|
+
FullTableViewComponent.prototype.loadClassroomData = function (usersConsole, usersMetadata, resourcesMetadata) {
|
|
3202
|
+
var _this = this;
|
|
3203
|
+
var _a, _b;
|
|
3204
|
+
var schoolTerminals = ((_b = (_a = this.jsonResponse) === null || _a === void 0 ? void 0 : _a.schoolTerminals) === null || _b === void 0 ? void 0 : _b.schoolTerminal) || [];
|
|
3205
|
+
var roomNames = {};
|
|
3206
|
+
schoolTerminals.forEach(function (terminal) {
|
|
3207
|
+
roomNames[terminal.terminalKey] = _this.getTerminalLocation(terminal);
|
|
3208
|
+
});
|
|
3209
|
+
var sessionsByRoom = {};
|
|
3210
|
+
// every session is a bar in the classroom chart, so keep sessions without resources too
|
|
3211
|
+
usersConsole.forEach(function (user) {
|
|
3212
|
+
var ip = (user === null || user === void 0 ? void 0 : user.terminalIP) || '';
|
|
3213
|
+
(sessionsByRoom[ip] = sessionsByRoom[ip] || []).push(user);
|
|
3214
|
+
});
|
|
3215
|
+
var roomLabel = function (ip) { return _this.pdService.getRoomLabel(roomNames[ip], ip); };
|
|
3216
|
+
var activeIPs = Object.keys(sessionsByRoom).sort(function (a, b) { return roomLabel(a).localeCompare(roomLabel(b), undefined, { numeric: true }); });
|
|
3217
|
+
activeIPs.forEach(function (ip) {
|
|
3218
|
+
var sessions = sessionsByRoom[ip].sort(function (a, b) { return new Date(a.startTime).getTime() - new Date(b.startTime).getTime(); });
|
|
3219
|
+
sessions.forEach(function (user, sessionIndex) {
|
|
3220
|
+
var _a;
|
|
3221
|
+
var userDetails = usersMetadata.find(function (userMeta) { return userMeta.userId === user.userId; });
|
|
3222
|
+
var startTime = new Date(user === null || user === void 0 ? void 0 : user.startTime);
|
|
3223
|
+
var endTime = new Date(user === null || user === void 0 ? void 0 : user.endTime);
|
|
3224
|
+
var totalDuration = _this.formatTime(Math.round((endTime.getTime() - startTime.getTime()) / 1000));
|
|
3225
|
+
var resources = ((_a = user === null || user === void 0 ? void 0 : user.userConsoleResources) === null || _a === void 0 ? void 0 : _a.userConsoleResource) || [];
|
|
3226
|
+
var sessionRows = resources.length > 0 ? resources : [null];
|
|
3227
|
+
sessionRows.forEach(function (userResource, resourceIndex) {
|
|
3228
|
+
var _a, _b, _c, _d;
|
|
3229
|
+
var resourceDetails = userResource && resourcesMetadata.find(function (resource) { return resource.resourceId === userResource.resourceId &&
|
|
3230
|
+
userResource.type === resource.type; });
|
|
3231
|
+
var isFirstOfSession = resourceIndex === 0;
|
|
3232
|
+
_this.classroomArray.push({
|
|
3233
|
+
room: isFirstOfSession && sessionIndex === 0 ? roomLabel(ip) : '',
|
|
3234
|
+
teacherName: isFirstOfSession ? userDetails === null || userDetails === void 0 ? void 0 : userDetails.fullName : '',
|
|
3235
|
+
date: isFirstOfSession ? user === null || user === void 0 ? void 0 : user.selectedDate : '',
|
|
3236
|
+
startTime: isFirstOfSession ? _this.formatDate(startTime) : '',
|
|
3237
|
+
endtime: isFirstOfSession ? _this.formatDate(endTime) : '',
|
|
3238
|
+
totalDuration: isFirstOfSession ? totalDuration : '',
|
|
3239
|
+
tp: (_a = resourceDetails === null || resourceDetails === void 0 ? void 0 : resourceDetails.teachingPoint) === null || _a === void 0 ? void 0 : _a.title,
|
|
3240
|
+
subject: (_b = resourceDetails === null || resourceDetails === void 0 ? void 0 : resourceDetails.subject) === null || _b === void 0 ? void 0 : _b.title,
|
|
3241
|
+
chapter: (_c = resourceDetails === null || resourceDetails === void 0 ? void 0 : resourceDetails.chapter) === null || _c === void 0 ? void 0 : _c.title,
|
|
3242
|
+
grade: (_d = resourceDetails === null || resourceDetails === void 0 ? void 0 : resourceDetails.grade) === null || _d === void 0 ? void 0 : _d.title,
|
|
3243
|
+
details: userResource ? _this.getAssetDetails(userResource, resourceDetails) : '',
|
|
3244
|
+
});
|
|
3245
|
+
});
|
|
3246
|
+
});
|
|
3247
|
+
});
|
|
3248
|
+
var idleRooms = schoolTerminals
|
|
3249
|
+
.filter(function (terminal) { return !sessionsByRoom[terminal.terminalKey]; })
|
|
3250
|
+
.map(function (terminal) { return ({
|
|
3251
|
+
room: roomLabel(terminal.terminalKey),
|
|
3252
|
+
teacherName: '',
|
|
3253
|
+
date: '',
|
|
3254
|
+
startTime: '',
|
|
3255
|
+
endtime: '',
|
|
3256
|
+
totalDuration: '0s',
|
|
3257
|
+
tp: '',
|
|
3258
|
+
subject: '',
|
|
3259
|
+
chapter: '',
|
|
3260
|
+
grade: '',
|
|
3261
|
+
details: '',
|
|
3262
|
+
}); });
|
|
3263
|
+
this.allClassrooms = __spread(this.classroomArray, idleRooms);
|
|
3264
|
+
};
|
|
3265
|
+
FullTableViewComponent.prototype.getTerminalLocation = function (terminal) {
|
|
3266
|
+
var _a;
|
|
3267
|
+
try {
|
|
3268
|
+
return (terminal === null || terminal === void 0 ? void 0 : terminal.metadata) ? ((_a = JSON.parse(terminal.metadata)) === null || _a === void 0 ? void 0 : _a.location) || '' : '';
|
|
3269
|
+
}
|
|
3270
|
+
catch (e) {
|
|
3271
|
+
return '';
|
|
3272
|
+
}
|
|
3273
|
+
};
|
|
3274
|
+
FullTableViewComponent.prototype.getAssetDetails = function (userResource, resourceDetails) {
|
|
3275
|
+
var _a, _b;
|
|
3276
|
+
var prefix = this.getDisplayTypeValue(userResource.type);
|
|
3277
|
+
var title = (resourceDetails === null || resourceDetails === void 0 ? void 0 : resourceDetails.title) || '';
|
|
3278
|
+
var duration = parseInt((userResource === null || userResource === void 0 ? void 0 : userResource.duration) || '0');
|
|
3279
|
+
if (((_a = userResource === null || userResource === void 0 ? void 0 : userResource.type) === null || _a === void 0 ? void 0 : _a.includes('question')) || ((_b = userResource === null || userResource === void 0 ? void 0 : userResource.type) === null || _b === void 0 ? void 0 : _b.includes('cquestion'))) {
|
|
3280
|
+
duration = 0;
|
|
3281
|
+
}
|
|
3282
|
+
else {
|
|
3283
|
+
duration = duration === 0 ? "<span class='seenTag' style='color:blue;'>(Seen)</span>" : this.formatTime(duration);
|
|
3284
|
+
}
|
|
3285
|
+
return title === '' ? prefix + " : " + duration : prefix + " : " + title + " : " + duration;
|
|
3286
|
+
};
|
|
3287
|
+
FullTableViewComponent.prototype.getDisplayTypeValue = function (key) {
|
|
3288
|
+
var assetTypeConfig = [
|
|
3289
|
+
{ type: 'asset_media', display: 'Media' },
|
|
3290
|
+
{ type: 'asset_print', display: 'Print' },
|
|
3291
|
+
{ type: 'quiz', display: 'Quiz' },
|
|
3292
|
+
{ type: 'question', display: 'Question' },
|
|
3293
|
+
{ type: 'chapter', display: 'Chapter' },
|
|
3294
|
+
{ type: 'tp', display: 'Topic' },
|
|
3295
|
+
{ type: 'whiteboard', display: 'Whiteboard' },
|
|
3296
|
+
{ type: 'widget', display: 'Widget' },
|
|
3297
|
+
{ type: 'casset_media', display: 'cMedia' },
|
|
3298
|
+
{ type: 'casset_print', display: 'cPrint' },
|
|
3299
|
+
{ type: 'cquiz', display: 'cQuiz' },
|
|
3300
|
+
{ type: 'cquestion', display: 'cQuestion' },
|
|
3301
|
+
{ type: 'image', display: 'Image' },
|
|
3302
|
+
{ type: 'video', display: 'Video' },
|
|
3303
|
+
{ type: 'tools', display: 'Tools' },
|
|
3304
|
+
{ type: 'feature', display: 'Feature' },
|
|
3305
|
+
{ type: 'ebook', display: 'Ebook' }
|
|
3306
|
+
];
|
|
3307
|
+
var asset = assetTypeConfig.find(function (value) { return value.type === key; });
|
|
3308
|
+
return asset ? asset.display : key;
|
|
3309
|
+
};
|
|
3310
|
+
FullTableViewComponent.prototype.formatDate = function (now) {
|
|
3311
|
+
var hours = now.getHours();
|
|
3312
|
+
var minutes = now.getMinutes();
|
|
3313
|
+
var seconds = now.getSeconds();
|
|
3314
|
+
var ampm = hours >= 12 ? 'PM' : 'AM';
|
|
3315
|
+
hours = hours % 12 || 12;
|
|
3316
|
+
return hours.toString().padStart(2, '0') + ":" + minutes
|
|
3317
|
+
.toString()
|
|
3318
|
+
.padStart(2, '0') + ":" + seconds.toString().padStart(2, '0') + " " + ampm;
|
|
3319
|
+
};
|
|
3320
|
+
FullTableViewComponent.prototype.formatTime = function (seconds) {
|
|
3321
|
+
var days = Math.floor(seconds / 86400);
|
|
3322
|
+
var hours = Math.floor((seconds % 86400) / 3600);
|
|
3323
|
+
var minutes = Math.floor((seconds % 3600) / 60);
|
|
3324
|
+
var secs = seconds % 60;
|
|
3325
|
+
if (seconds < 60)
|
|
3326
|
+
return secs + "s";
|
|
3327
|
+
if (seconds < 3600)
|
|
3328
|
+
return minutes + "m " + secs + "s";
|
|
3329
|
+
if (seconds < 86400)
|
|
3330
|
+
return hours + "h " + minutes + "m " + secs + "s";
|
|
3331
|
+
return days + "d " + hours + "h " + minutes + "m " + secs + "s";
|
|
3332
|
+
};
|
|
3333
|
+
FullTableViewComponent.prototype.loadTable = function (data) {
|
|
3334
|
+
/*
|
|
3335
|
+
const tableBody = document.querySelector("#teacherTable tbody");
|
|
3336
|
+
|
|
3337
|
+
data.forEach((item) => {
|
|
3338
|
+
const row = document.createElement("tr");
|
|
3339
|
+
for (const key in item) {
|
|
3340
|
+
const cell = document.createElement("td");
|
|
3341
|
+
cell.textContent = item[key];
|
|
3342
|
+
if (key !== "userId") {
|
|
3343
|
+
row.appendChild(cell);
|
|
3344
|
+
}
|
|
3345
|
+
}
|
|
3346
|
+
tableBody.appendChild(row);
|
|
3347
|
+
});*/
|
|
3348
|
+
};
|
|
3349
|
+
FullTableViewComponent.prototype.toggleUsers = function () {
|
|
3350
|
+
this.usersCheckboxChecked = !this.usersCheckboxChecked;
|
|
3351
|
+
this.loadTable(this.usersCheckboxChecked
|
|
3352
|
+
? this.allUsers
|
|
3353
|
+
: this.currentUserArray);
|
|
3354
|
+
};
|
|
3355
|
+
FullTableViewComponent.prototype.getMockJson = function () {
|
|
3356
|
+
// Replace with actual data fetching logic
|
|
3357
|
+
return {};
|
|
3358
|
+
};
|
|
3359
|
+
return FullTableViewComponent;
|
|
3360
|
+
}());
|
|
3361
|
+
FullTableViewComponent.decorators = [
|
|
3362
|
+
{ type: i0.Component, args: [{
|
|
3363
|
+
selector: 'lib-full-table-view',
|
|
3364
|
+
template: "\n<div class=\"tableViewList\" *ngIf=\"isDisplay\">\n <!-- <label for=\"usersCheckbox\">All</label>\n <input\n type=\"checkbox\"\n id=\"usersCheckbox\"\n [checked]=\"usersCheckboxChecked\"\n (change)=\"toggleUsers()\"\n /> -->\n <div class=\"tableArea\">\n \n <table id=\"teacherTable\" *ngIf=\"isUserWise\">\n <thead class=\"tablehead\">\n <tr>\n <th>Teacher Name</th>\n <th>Subjects</th>\n <th>Date</th>\n <th>Start Time</th>\n <th>End Time</th>\n <th>Total Duration</th>\n <th>Room</th>\n <th>Topic</th>\n <th>Subject</th>\n <th>Chapter</th>\n <th>Grade</th>\n <th>Details</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let user of userRows\">\n <td>{{ user.teacherName }}</td>\n <td>{{ user.subjects }}</td>\n <td>{{ user.date }}</td>\n <td>{{ user.startTime }}</td>\n <td>{{ user.endtime }}</td>\n <td>{{ user.totalDuration }}</td>\n <td>{{ user.room }}</td>\n <td>{{ user.tp }}</td>\n <td>{{ user.subject }}</td>\n <td>{{ user.chapter }}</td>\n <td>{{ user.grade }}</td>\n <td><div [innerHTML]=\"user.details\"></div></td>\n </tr>\n </tbody>\n </table>\n\n <table id=\"classroomTable\" *ngIf=\"!isUserWise\">\n <thead class=\"tablehead\">\n <tr>\n <th>Room</th>\n <th>Teacher Name</th>\n <th>Date</th>\n <th>Start Time</th>\n <th>End Time</th>\n <th>Total Duration</th>\n <th>Topic</th>\n <th>Subject</th>\n <th>Chapter</th>\n <th>Grade</th>\n <th>Details</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let row of classroomRows\" [class.roomStart]=\"row.room\">\n <td class=\"roomCell\">{{ row.room }}</td>\n <td>{{ row.teacherName }}</td>\n <td>{{ row.date }}</td>\n <td>{{ row.startTime }}</td>\n <td>{{ row.endtime }}</td>\n <td>{{ row.totalDuration }}</td>\n <td>{{ row.tp }}</td>\n <td>{{ row.subject }}</td>\n <td>{{ row.chapter }}</td>\n <td>{{ row.grade }}</td>\n <td><div [innerHTML]=\"row.details\"></div></td>\n </tr>\n </tbody>\n </table>\n </div>\n \n</div>\n ",
|
|
3365
|
+
styles: ["body{font-family:Arial,sans-serif;margin:20px}.tablehead{position:sticky;top:0;background:#fff}table{width:100%;border-collapse:collapse}td,th{border:1px solid #ddd;padding:8px;text-align:left}th{background-color:#f4f4f4;font-weight:700}tr:nth-child(2n){background-color:#f9f9f9}tr:hover{background-color:#f1f1f1}.tableViewList{position:absolute;margin-top:20px}.tableArea{height:700px;overflow:scroll;font-size:12px;margin:20px 5px 5px}.seenTag{color:#00f}.roomCell{font-weight:700}.roomStart td{border-top:2px solid #b7b7b7}"]
|
|
3366
|
+
},] }
|
|
3367
|
+
];
|
|
3368
|
+
FullTableViewComponent.ctorParameters = function () { return [
|
|
3369
|
+
{ type: PrincipalDashboardLibV2Service }
|
|
3370
|
+
]; };
|
|
3371
|
+
FullTableViewComponent.propDecorators = {
|
|
3372
|
+
data: [{ type: i0.Input }]
|
|
3373
|
+
};
|
|
3374
|
+
|
|
3375
|
+
var SmallTableViewComponent = /** @class */ (function () {
|
|
3376
|
+
function SmallTableViewComponent(pdService) {
|
|
3377
|
+
this.pdService = pdService;
|
|
3378
|
+
this.currentTimeFrameUserArray = [];
|
|
3379
|
+
this.currentUserArray = [];
|
|
3380
|
+
this.remaningUsers = [];
|
|
3381
|
+
this.allUsers = [];
|
|
3382
|
+
this.usersCheckboxChecked = false;
|
|
3383
|
+
this.isDisplay = false;
|
|
3384
|
+
this.accentColor = '';
|
|
3385
|
+
// 'session' = one bar was clicked; 'all' = a row's total was clicked
|
|
3386
|
+
this.mode = 'session';
|
|
3387
|
+
this.allTitle = '';
|
|
3388
|
+
this.allSummary = [];
|
|
3389
|
+
this.otherColumn = 'Room';
|
|
3390
|
+
// who used the room (classroom wise) or which rooms were used (user wise), with time each
|
|
3391
|
+
this.people = [];
|
|
3392
|
+
this.peopleTitle = '';
|
|
3393
|
+
}
|
|
3394
|
+
Object.defineProperty(SmallTableViewComponent.prototype, "data", {
|
|
3395
|
+
set: function (res) {
|
|
3396
|
+
if (res !== null) {
|
|
3397
|
+
//console.log('smallTable',JSON.parse(res));
|
|
3398
|
+
this.jsonResponse = JSON.parse(res);
|
|
3399
|
+
}
|
|
3400
|
+
},
|
|
3401
|
+
enumerable: false,
|
|
3402
|
+
configurable: true
|
|
3403
|
+
});
|
|
3404
|
+
SmallTableViewComponent.prototype.ngOnInit = function () {
|
|
3405
|
+
var _this = this;
|
|
3406
|
+
this.pdService.openSmallTable$.subscribe(function (data) {
|
|
3407
|
+
if (data) {
|
|
3408
|
+
_this.isDisplay = true;
|
|
3409
|
+
_this.accentColor = _this.pdService.detailAccentColor;
|
|
3410
|
+
if (data['allSessions'] && _this.pdService.detailRowRequest) {
|
|
3411
|
+
_this.loadRowSessions(_this.pdService.detailRowRequest);
|
|
3412
|
+
return;
|
|
3413
|
+
}
|
|
3414
|
+
_this.mode = 'session';
|
|
3415
|
+
var userid = _this.findUserIdByName(data['userDetails'][0]);
|
|
3416
|
+
var startTime = data['userDetails'][1];
|
|
3417
|
+
var endTime = data['userDetails'][3];
|
|
3418
|
+
_this.loadUserData(userid, startTime, endTime);
|
|
3419
|
+
}
|
|
3420
|
+
else {
|
|
3421
|
+
_this.isDisplay = false;
|
|
3422
|
+
}
|
|
3423
|
+
});
|
|
3424
|
+
this.pdService.chartType.subscribe(function (data) {
|
|
3425
|
+
_this.isDisplay = false;
|
|
3426
|
+
});
|
|
3427
|
+
};
|
|
3428
|
+
SmallTableViewComponent.prototype.findUserIdByName = function (name) {
|
|
3429
|
+
var json = this.jsonResponse;
|
|
3430
|
+
var user = json.usersMetadata.userMetadata.find(function (user) { return user.fullName === name; });
|
|
3431
|
+
return user ? user.userId : null;
|
|
3432
|
+
};
|
|
3433
|
+
SmallTableViewComponent.prototype.loadUserData = function (userId, inputStartTime, inputEndTime) {
|
|
3434
|
+
var _this = this;
|
|
3435
|
+
this.currentUserArray = [];
|
|
3436
|
+
this.allUsers = [];
|
|
3437
|
+
this.currentTimeFrameUserArray = [];
|
|
3438
|
+
var json = this.jsonResponse;
|
|
3439
|
+
var usersConsole = json.usersConsole.userConsole;
|
|
3440
|
+
var usersMetadata = json.usersMetadata.userMetadata;
|
|
3441
|
+
var resourcesMetadata = json.resourcesMetadata.resourceMetadata;
|
|
3442
|
+
var filteredUsersConsole = userId
|
|
3443
|
+
? usersConsole.filter(function (user) { return user.userId === userId; })
|
|
3444
|
+
: usersConsole;
|
|
3445
|
+
filteredUsersConsole.forEach(function (user) {
|
|
3446
|
+
var _g;
|
|
3447
|
+
(_g = _this.currentUserArray).push.apply(_g, __spread(_this.rowsForConsole(user, usersMetadata, resourcesMetadata)));
|
|
3448
|
+
});
|
|
3449
|
+
var currentUserIds = this.currentUserArray
|
|
3450
|
+
.map(function (x) { return x.userId; })
|
|
3451
|
+
.filter(function (x, i, a) { return a.indexOf(x) === i; });
|
|
3452
|
+
this.remaningUsers = usersMetadata
|
|
3453
|
+
.filter(function (user) { return !currentUserIds.includes(user.userId); })
|
|
3454
|
+
.map(function (user) {
|
|
3455
|
+
return {
|
|
3456
|
+
userId: user.userId,
|
|
3457
|
+
teacherName: user === null || user === void 0 ? void 0 : user.fullName,
|
|
3458
|
+
subjects: user === null || user === void 0 ? void 0 : user.userSubjects,
|
|
3459
|
+
date: '',
|
|
3460
|
+
startTime: '',
|
|
3461
|
+
endtime: '',
|
|
3462
|
+
totalDuration: '0s',
|
|
3463
|
+
room: '',
|
|
3464
|
+
tp: '',
|
|
3465
|
+
subject: '',
|
|
3466
|
+
chapter: '',
|
|
3467
|
+
grade: '',
|
|
3468
|
+
details: '',
|
|
3469
|
+
};
|
|
3470
|
+
});
|
|
3471
|
+
this.allUsers = __spread(this.currentUserArray, this.remaningUsers);
|
|
3472
|
+
this.currentTimeFrameUserArray = this.filterDataByCriteria(this.currentUserArray, userId, inputStartTime, inputEndTime);
|
|
3473
|
+
console.log('smallData', this.currentTimeFrameUserArray);
|
|
3474
|
+
};
|
|
3475
|
+
// every session of a timeline row, oldest first; sessions with nothing opened still get a line
|
|
3476
|
+
SmallTableViewComponent.prototype.loadRowSessions = function (request) {
|
|
3477
|
+
var _this = this;
|
|
3478
|
+
this.mode = 'all';
|
|
3479
|
+
var json = this.jsonResponse;
|
|
3480
|
+
var usersConsole = json.usersConsole.userConsole;
|
|
3481
|
+
var usersMetadata = json.usersMetadata.userMetadata;
|
|
3482
|
+
var resourcesMetadata = json.resourcesMetadata.resourceMetadata;
|
|
3483
|
+
var wanted = request.sessions;
|
|
3484
|
+
var entries = usersConsole
|
|
3485
|
+
.filter(function (c) { return wanted.some(function (s) { return s.userId === c.userId && s.ip === c.terminalIP && s.start === new Date(c.startTime).getTime(); }); })
|
|
3486
|
+
.sort(function (a, b) { return new Date(a.startTime).getTime() - new Date(b.startTime).getTime(); });
|
|
3487
|
+
var teacherName = function (id) { return (usersMetadata.find(function (u) { return u.userId === id; }) || {}).fullName || ''; };
|
|
3488
|
+
var roomLabel = function (ip) { return _this.getRoomName(ip) || ip; };
|
|
3489
|
+
this.otherColumn = request.isUserWise ? 'Room' : 'Teacher';
|
|
3490
|
+
var rows = [];
|
|
3491
|
+
entries.forEach(function (c) {
|
|
3492
|
+
var start = new Date(c.startTime);
|
|
3493
|
+
var end = new Date(c.endTime);
|
|
3494
|
+
var head = {
|
|
3495
|
+
sessionHead: true,
|
|
3496
|
+
sessionTime: _this.formatClock(start) + " \u2013 " + _this.formatClock(end),
|
|
3497
|
+
sessionDuration: _this.formatTime(Math.round((end.getTime() - start.getTime()) / 1000)),
|
|
3498
|
+
sessionOther: request.isUserWise ? roomLabel(c.terminalIP) : teacherName(c.userId),
|
|
3499
|
+
};
|
|
3500
|
+
var sessionRows = _this.rowsForConsole(c, usersMetadata, resourcesMetadata);
|
|
3501
|
+
if (sessionRows.length === 0) {
|
|
3502
|
+
rows.push(Object.assign(Object.assign({}, head), { empty: true }));
|
|
3503
|
+
}
|
|
3504
|
+
else {
|
|
3505
|
+
sessionRows.forEach(function (r, i) { return rows.push(i === 0 ? Object.assign(Object.assign({}, r), head) : r); });
|
|
3506
|
+
}
|
|
3507
|
+
});
|
|
3508
|
+
this.currentTimeFrameUserArray = rows;
|
|
3509
|
+
// time per teacher (or per room), in order of first appearance
|
|
3510
|
+
var timeByOther = new Map();
|
|
3511
|
+
entries.forEach(function (c) {
|
|
3512
|
+
var key = request.isUserWise ? roomLabel(c.terminalIP) : teacherName(c.userId);
|
|
3513
|
+
if (!key)
|
|
3514
|
+
return;
|
|
3515
|
+
var ms = new Date(c.endTime).getTime() - new Date(c.startTime).getTime();
|
|
3516
|
+
timeByOther.set(key, (timeByOther.get(key) || 0) + Math.max(ms, 0));
|
|
3517
|
+
});
|
|
3518
|
+
this.people = Array.from(timeByOther.entries()).map(function (_g) {
|
|
3519
|
+
var _h = __read(_g, 2), label = _h[0], ms = _h[1];
|
|
3520
|
+
return ({ label: label, time: _this.formatTime(Math.round(ms / 1000)) });
|
|
3521
|
+
});
|
|
3522
|
+
this.peopleTitle = request.isUserWise ? 'Rooms used' : 'Teachers in this room';
|
|
3523
|
+
// a bare room number reads better as "Room 39"
|
|
3524
|
+
this.allTitle = !request.isUserWise && /^\d+$/.test(String(request.label).trim()) ? "Room " + request.label : request.label;
|
|
3525
|
+
this.allSummary = [
|
|
3526
|
+
{ label: 'Sessions', value: "" + entries.length, icon: 'sessions', tone: 'lime' },
|
|
3527
|
+
// just the count here; the names are listed under the cards
|
|
3528
|
+
{ label: request.isUserWise ? 'Rooms' : 'Teachers', value: "" + this.people.length, icon: request.isUserWise ? 'room' : 'teacher', tone: 'sand' },
|
|
3529
|
+
{ label: 'First start', value: entries.length ? this.formatDate(new Date(entries[0].startTime)) : '—', icon: 'start', tone: 'sky' },
|
|
3530
|
+
{
|
|
3531
|
+
label: 'Last end',
|
|
3532
|
+
value: entries.length ? this.formatDate(new Date(Math.max.apply(Math, __spread(entries.map(function (c) { return new Date(c.endTime).getTime(); }))))) : '—',
|
|
3533
|
+
icon: 'end',
|
|
3534
|
+
tone: 'sky',
|
|
3535
|
+
},
|
|
3536
|
+
{ label: 'Total time', value: request.total || '—', icon: 'clock', tone: 'mint' },
|
|
3537
|
+
];
|
|
3538
|
+
};
|
|
3539
|
+
Object.defineProperty(SmallTableViewComponent.prototype, "sessionSummary", {
|
|
3540
|
+
// cards for a single session, read from the first row of that session
|
|
3541
|
+
get: function () {
|
|
3542
|
+
var first = this.currentTimeFrameUserArray[0] || {};
|
|
3543
|
+
return [
|
|
3544
|
+
{ label: 'Subject', value: first.subject || '—', icon: 'subject', tone: 'lime' },
|
|
3545
|
+
{ label: 'Room', value: first.roomName || first.room || '—', sub: first.roomName ? first.room : '', icon: 'room', tone: 'sand' },
|
|
3546
|
+
{ label: 'Start', value: first.startTime || '—', icon: 'start', tone: 'sky' },
|
|
3547
|
+
{ label: 'End', value: first.endtime || '—', icon: 'end', tone: 'sky' },
|
|
3548
|
+
{ label: 'Total time', value: first.totalDuration || '—', icon: 'clock', tone: 'mint' },
|
|
3549
|
+
];
|
|
3550
|
+
},
|
|
3551
|
+
enumerable: false,
|
|
3552
|
+
configurable: true
|
|
3553
|
+
});
|
|
3554
|
+
SmallTableViewComponent.prototype.formatClock = function (date) {
|
|
3555
|
+
var hours = date.getHours();
|
|
3556
|
+
return (hours % 12 || 12) + ":" + date.getMinutes().toString().padStart(2, '0') + " " + (hours >= 12 ? 'PM' : 'AM');
|
|
3557
|
+
};
|
|
3558
|
+
// one row per resource opened in a single console session
|
|
3559
|
+
SmallTableViewComponent.prototype.rowsForConsole = function (user, usersMetadata, resourcesMetadata) {
|
|
3560
|
+
var _this = this;
|
|
3561
|
+
var _a;
|
|
3562
|
+
var rows = [];
|
|
3563
|
+
var userDetails = usersMetadata.find(function (userMeta) { return userMeta.userId === user.userId; });
|
|
3564
|
+
if (user === null || user === void 0 ? void 0 : user.userConsoleResources) {
|
|
3565
|
+
var userConsoleResource = (_a = user.userConsoleResources) === null || _a === void 0 ? void 0 : _a.userConsoleResource;
|
|
3566
|
+
if (userConsoleResource && userConsoleResource.length > 0) {
|
|
3567
|
+
userConsoleResource.forEach(function (userResource, userIndex) {
|
|
3568
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3569
|
+
var resourceId = userResource.resourceId;
|
|
3570
|
+
var resourceDetails = resourcesMetadata.find(function (resource) { return resource.resourceId === resourceId &&
|
|
3571
|
+
userResource.type === resource.type; });
|
|
3572
|
+
var prefix = _this.getDisplayTypeValue(userResource.type);
|
|
3573
|
+
var title = (resourceDetails === null || resourceDetails === void 0 ? void 0 : resourceDetails.title) || '';
|
|
3574
|
+
var tp = _this.decodeHtmlEntities((_a = resourceDetails === null || resourceDetails === void 0 ? void 0 : resourceDetails.teachingPoint) === null || _a === void 0 ? void 0 : _a.title);
|
|
3575
|
+
var subject = _this.decodeHtmlEntities((_b = resourceDetails === null || resourceDetails === void 0 ? void 0 : resourceDetails.subject) === null || _b === void 0 ? void 0 : _b.title);
|
|
3576
|
+
var chapter = _this.decodeHtmlEntities((_c = resourceDetails === null || resourceDetails === void 0 ? void 0 : resourceDetails.chapter) === null || _c === void 0 ? void 0 : _c.title);
|
|
3577
|
+
var grade = _this.decodeHtmlEntities((_d = resourceDetails === null || resourceDetails === void 0 ? void 0 : resourceDetails.grade) === null || _d === void 0 ? void 0 : _d.title);
|
|
3578
|
+
var startTime = new Date(user === null || user === void 0 ? void 0 : user.startTime);
|
|
3579
|
+
var endTime = new Date(user === null || user === void 0 ? void 0 : user.endTime);
|
|
3580
|
+
var totalDuration = _this.formatTime(Math.round((endTime.getTime() - startTime.getTime()) / 1000));
|
|
3581
|
+
var duration = parseInt((userResource === null || userResource === void 0 ? void 0 : userResource.duration) || '0');
|
|
3582
|
+
//duration = duration === 0 ? "<span class='dddd'>(Seen)</span>" : this.formatTime(duration);
|
|
3583
|
+
if (((_e = userResource === null || userResource === void 0 ? void 0 : userResource.type) === null || _e === void 0 ? void 0 : _e.includes('question')) || ((_f = userResource === null || userResource === void 0 ? void 0 : userResource.type) === null || _f === void 0 ? void 0 : _f.includes('cquestion'))) {
|
|
3584
|
+
duration = 0;
|
|
3585
|
+
}
|
|
3586
|
+
else {
|
|
3587
|
+
duration = duration === 0 ? "<span class='dddd'>(Seen)</span>" : _this.formatTime(duration);
|
|
3588
|
+
}
|
|
3589
|
+
var finalAssetTitle = prefix + " : " + title + " : " + duration;
|
|
3590
|
+
if (title === '') {
|
|
3591
|
+
finalAssetTitle = prefix + " : " + duration;
|
|
3592
|
+
}
|
|
3593
|
+
rows.push({
|
|
3594
|
+
userId: user.userId,
|
|
3595
|
+
teacherName: userIndex === 0 ? userDetails === null || userDetails === void 0 ? void 0 : userDetails.fullName : '',
|
|
3596
|
+
subjects: userIndex === 0 ? userDetails === null || userDetails === void 0 ? void 0 : userDetails.userSubjects : '',
|
|
3597
|
+
date: userIndex === 0 ? user === null || user === void 0 ? void 0 : user.selectedDate : '',
|
|
3598
|
+
startTime: userIndex === 0 ? _this.formatDate(startTime) : _this.formatDate(startTime),
|
|
3599
|
+
endtime: userIndex === 0 ? _this.formatDate(endTime) : _this.formatDate(endTime),
|
|
3600
|
+
// kept on every row: the popup reads it from whichever row comes first
|
|
3601
|
+
totalDuration: totalDuration,
|
|
3602
|
+
room: userIndex === 0 ? user === null || user === void 0 ? void 0 : user.terminalIP : '',
|
|
3603
|
+
roomName: userIndex === 0 ? _this.getRoomName(user === null || user === void 0 ? void 0 : user.terminalIP) : '',
|
|
3604
|
+
tp: tp,
|
|
3605
|
+
subject: subject,
|
|
3606
|
+
chapter: chapter,
|
|
3607
|
+
grade: grade,
|
|
3608
|
+
details: finalAssetTitle,
|
|
3609
|
+
ip: user === null || user === void 0 ? void 0 : user.terminalIP,
|
|
3610
|
+
sessionStart: startTime.getTime(),
|
|
3611
|
+
});
|
|
3612
|
+
});
|
|
3613
|
+
}
|
|
3614
|
+
}
|
|
3615
|
+
return rows;
|
|
3616
|
+
};
|
|
3617
|
+
SmallTableViewComponent.prototype.filterDataByCriteria = function (userData, inputUserId, inputStartTime, inputEndTime) {
|
|
3618
|
+
var parseTime = function (timeString) {
|
|
3619
|
+
if (!timeString)
|
|
3620
|
+
return null;
|
|
3621
|
+
var _g = __read(timeString.split(' '), 2), time = _g[0], meridian = _g[1];
|
|
3622
|
+
var _h = __read(time.split(':').map(Number), 3), hours = _h[0], minutes = _h[1], seconds = _h[2];
|
|
3623
|
+
var isPM = meridian === 'PM';
|
|
3624
|
+
return new Date(0, 0, 0, isPM && hours < 12 ? hours + 12 : hours, minutes, seconds);
|
|
3625
|
+
};
|
|
3626
|
+
var startTime = parseTime(inputStartTime);
|
|
3627
|
+
var endTime = parseTime(inputEndTime);
|
|
3628
|
+
var filteredData = userData.filter(function (entry) {
|
|
3629
|
+
if (entry.userId !== inputUserId)
|
|
3630
|
+
return false;
|
|
3631
|
+
if (!entry.startTime || !entry.endtime)
|
|
3632
|
+
return false;
|
|
3633
|
+
var entryStart = parseTime(entry.startTime);
|
|
3634
|
+
var entryEnd = parseTime(entry.endtime);
|
|
3635
|
+
return entryStart && entryEnd && entryStart >= startTime && entryEnd <= endTime;
|
|
3636
|
+
});
|
|
3637
|
+
return filteredData.map(function (entry, index) { return (Object.assign(Object.assign({}, entry), { subsequentCount: index })); });
|
|
3638
|
+
};
|
|
3639
|
+
// Converts entities like ′ or & into their characters so they render as text
|
|
3640
|
+
SmallTableViewComponent.prototype.decodeHtmlEntities = function (value) {
|
|
3641
|
+
if (!value)
|
|
3642
|
+
return value;
|
|
3643
|
+
var textarea = document.createElement('textarea');
|
|
3644
|
+
textarea.innerHTML = value;
|
|
3645
|
+
return textarea.value;
|
|
3646
|
+
};
|
|
3647
|
+
SmallTableViewComponent.prototype.getDisplayTypeValue = function (key) {
|
|
3648
|
+
var assetTypeConfig = [
|
|
3649
|
+
{ type: 'asset_media', display: 'Media' },
|
|
3650
|
+
{ type: 'asset_print', display: 'Print' },
|
|
3651
|
+
{ type: 'quiz', display: 'Quiz' },
|
|
3652
|
+
{ type: 'question', display: 'Question' },
|
|
3653
|
+
{ type: 'chapter', display: 'Chapter' },
|
|
3654
|
+
{ type: 'tp', display: 'Topic' },
|
|
3655
|
+
{ type: 'whiteboard', display: 'Whiteboard' },
|
|
3656
|
+
{ type: 'widget', display: 'Widget' },
|
|
3657
|
+
{ type: 'casset_media', display: 'cMedia' },
|
|
3658
|
+
{ type: 'casset_print', display: 'cPrint' },
|
|
3659
|
+
{ type: 'cquiz', display: 'cQuiz' },
|
|
3660
|
+
{ type: 'cquestion', display: 'cQuestion' },
|
|
3661
|
+
{ type: 'image', display: 'Image' },
|
|
3662
|
+
{ type: 'video', display: 'Video' },
|
|
3663
|
+
{ type: 'tools', display: 'Tools' },
|
|
3664
|
+
{ type: 'feature', display: 'Feature' },
|
|
3665
|
+
];
|
|
3666
|
+
var asset = assetTypeConfig.find(function (value) { return value.type === key; });
|
|
3667
|
+
return asset ? asset.display : key;
|
|
3668
|
+
};
|
|
3669
|
+
SmallTableViewComponent.prototype.formatDate = function (now) {
|
|
3670
|
+
var hours = now.getHours();
|
|
3671
|
+
var minutes = now.getMinutes();
|
|
3672
|
+
var seconds = now.getSeconds();
|
|
3673
|
+
var ampm = hours >= 12 ? 'PM' : 'AM';
|
|
3674
|
+
hours = hours % 12 || 12;
|
|
3675
|
+
return hours.toString().padStart(2, '0') + ":" + minutes
|
|
3676
|
+
.toString()
|
|
3677
|
+
.padStart(2, '0') + ":" + seconds.toString().padStart(2, '0') + " " + ampm;
|
|
3678
|
+
};
|
|
3679
|
+
SmallTableViewComponent.prototype.formatTime = function (seconds) {
|
|
3680
|
+
var days = Math.floor(seconds / 86400);
|
|
3681
|
+
var hours = Math.floor((seconds % 86400) / 3600);
|
|
3682
|
+
var minutes = Math.floor((seconds % 3600) / 60);
|
|
3683
|
+
var secs = seconds % 60;
|
|
3684
|
+
if (seconds < 60)
|
|
3685
|
+
return secs + "s";
|
|
3686
|
+
if (seconds < 3600)
|
|
3687
|
+
return minutes + "m " + secs + "s";
|
|
3688
|
+
if (seconds < 86400)
|
|
3689
|
+
return hours + "h " + minutes + "m " + secs + "s";
|
|
3690
|
+
return days + "d " + hours + "h " + minutes + "m " + secs + "s";
|
|
3691
|
+
};
|
|
3692
|
+
SmallTableViewComponent.prototype.loadTable = function (data) {
|
|
3693
|
+
/*
|
|
3694
|
+
const tableBody = document.querySelector("#teacherTable tbody");
|
|
3695
|
+
|
|
3696
|
+
data.forEach((item) => {
|
|
3697
|
+
const row = document.createElement("tr");
|
|
3698
|
+
for (const key in item) {
|
|
3699
|
+
const cell = document.createElement("td");
|
|
3700
|
+
cell.textContent = item[key];
|
|
3701
|
+
if (key !== "userId") {
|
|
3702
|
+
row.appendChild(cell);
|
|
3703
|
+
}
|
|
3704
|
+
}
|
|
3705
|
+
tableBody.appendChild(row);
|
|
3706
|
+
});*/
|
|
3707
|
+
};
|
|
3708
|
+
SmallTableViewComponent.prototype.toggleUsers = function () {
|
|
3709
|
+
this.usersCheckboxChecked = !this.usersCheckboxChecked;
|
|
3710
|
+
this.loadTable(this.usersCheckboxChecked
|
|
3711
|
+
? this.allUsers
|
|
3712
|
+
: this.currentUserArray);
|
|
3713
|
+
};
|
|
3714
|
+
// room name from schoolTerminals metadata, '' when not set
|
|
3715
|
+
SmallTableViewComponent.prototype.getRoomName = function (ip) {
|
|
3716
|
+
var _a, _b, _c;
|
|
3717
|
+
var terminals = ((_b = (_a = this.jsonResponse) === null || _a === void 0 ? void 0 : _a.schoolTerminals) === null || _b === void 0 ? void 0 : _b.schoolTerminal) || [];
|
|
3718
|
+
var terminal = terminals.find(function (t) { return t.terminalKey === ip; });
|
|
3719
|
+
try {
|
|
3720
|
+
return (terminal === null || terminal === void 0 ? void 0 : terminal.metadata) ? (((_c = JSON.parse(terminal.metadata)) === null || _c === void 0 ? void 0 : _c.location) || '').trim() : '';
|
|
3721
|
+
}
|
|
3722
|
+
catch (e) {
|
|
3723
|
+
return '';
|
|
3724
|
+
}
|
|
3725
|
+
};
|
|
3726
|
+
SmallTableViewComponent.prototype.onEscape = function () {
|
|
3727
|
+
if (this.isDisplay) {
|
|
3728
|
+
this.onCloseBtnClick();
|
|
3729
|
+
}
|
|
3730
|
+
};
|
|
3731
|
+
SmallTableViewComponent.prototype.onCloseBtnClick = function () {
|
|
3732
|
+
this.isDisplay = false;
|
|
3733
|
+
//this.pdService.openSmallTable.next(false);
|
|
3734
|
+
};
|
|
3735
|
+
return SmallTableViewComponent;
|
|
3736
|
+
}());
|
|
3737
|
+
SmallTableViewComponent.decorators = [
|
|
3738
|
+
{ type: i0.Component, args: [{
|
|
3739
|
+
selector: 'lib-small-table-view',
|
|
3740
|
+
template: "<div class=\"pd-detail-backdrop\" *ngIf=\"isDisplay\" (click)=\"onCloseBtnClick()\">\n <div id=\"pd-deatilViewContainer\" class=\"pd-detail-dialog\" role=\"dialog\" aria-modal=\"true\" aria-labelledby=\"pd-detail-title\" (click)=\"$event.stopPropagation()\">\n <div class=\"pd-detail-header\">\n <div class=\"pd-detail-heading\">\n <span class=\"pd-detail-swatch\" *ngIf=\"accentColor\" [style.background-color]=\"accentColor\"></span>\n <div>\n <div id=\"pd-detail-title\" class=\"pd-detail-title\">{{ (mode === 'all' ? allTitle : currentTimeFrameUserArray[0]?.teacherName) || 'Details' }}</div>\n <div class=\"pd-detail-subtitle\">{{ mode === 'all' ? 'All Sessions Today' : 'Session Details' }}</div>\n </div>\n </div>\n <button type=\"button\" class=\"pd-detail-close\" aria-label=\"Close\" (click)=\"onCloseBtnClick()\">×</button>\n </div>\n\n <div class=\"pd-detail-summary\">\n <div class=\"pd-detail-card\" *ngFor=\"let card of (mode === 'all' ? allSummary : sessionSummary)\" [ngClass]=\"'pd-tone-' + card.tone\">\n <div class=\"pd-detail-card-label\">\n <span class=\"pd-card-icon\" [ngSwitch]=\"card.icon\" aria-hidden=\"true\">\n <svg *ngSwitchCase=\"'sessions'\" viewBox=\"0 0 24 24\"><path d=\"M4 6h16M4 12h16M4 18h10\" /></svg>\n <svg *ngSwitchCase=\"'room'\" viewBox=\"0 0 24 24\"><rect x=\"3\" y=\"4\" width=\"18\" height=\"12\" rx=\"2\" /><path d=\"M12 16v4M8 20h8\" /></svg>\n <svg *ngSwitchCase=\"'teacher'\" viewBox=\"0 0 24 24\"><circle cx=\"12\" cy=\"8\" r=\"4\" /><path d=\"M4 20c0-4 3.6-6 8-6s8 2 8 6\" /></svg>\n <svg *ngSwitchCase=\"'subject'\" viewBox=\"0 0 24 24\"><path d=\"M4 5a2 2 0 0 1 2-2h13v16H6a2 2 0 0 0-2 2V5z\" /><path d=\"M4 19a2 2 0 0 1 2-2h13\" /></svg>\n <svg *ngSwitchCase=\"'start'\" viewBox=\"0 0 24 24\"><path d=\"M14 4h4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-4\" /><path d=\"M4 12h11M11 8l4 4-4 4\" /></svg>\n <svg *ngSwitchCase=\"'end'\" viewBox=\"0 0 24 24\"><path d=\"M10 4H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h4\" /><path d=\"M9 12h11M16 8l4 4-4 4\" /></svg>\n <svg *ngSwitchCase=\"'clock'\" viewBox=\"0 0 24 24\"><circle cx=\"12\" cy=\"12\" r=\"9\" /><path d=\"M12 7v5l3 2\" /></svg>\n </span>\n {{ card.label }}\n </div>\n <div class=\"pd-detail-card-value\">\n {{ card.value }}\n <span class=\"pd-detail-muted\" *ngIf=\"card.sub\">{{ card.sub }}</span>\n </div>\n </div>\n </div>\n\n <div class=\"pd-people\" *ngIf=\"mode === 'all' && people.length\">\n <span class=\"pd-people-title\">{{ peopleTitle }}</span>\n <span class=\"pd-person\" *ngFor=\"let p of people\">{{ p.label }} <span class=\"pd-person-time\">{{ p.time }}</span></span>\n </div>\n\n <div class=\"pd-detail-body\">\n <div class=\"pd-detail-empty\" *ngIf=\"currentTimeFrameUserArray.length === 0\">No content was opened in this session.</div>\n <table class=\"pd-detail-table\" *ngIf=\"currentTimeFrameUserArray.length > 0\">\n <thead>\n <tr>\n <ng-container *ngIf=\"mode === 'all'\">\n <th>Time</th>\n <th>{{ otherColumn }}</th>\n </ng-container>\n <th>Subject</th>\n <th>Class</th>\n <th>Chapter</th>\n <th>Topic</th>\n <th>Asset details</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let item of currentTimeFrameUserArray\" [class.pd-session-start]=\"mode === 'all' && item.sessionHead\">\n <ng-container *ngIf=\"mode === 'all'\">\n <td class=\"pd-nowrap\">\n <ng-container *ngIf=\"item.sessionHead\">\n {{ item.sessionTime }}\n <div class=\"pd-detail-muted\">{{ item.sessionDuration }}</div>\n </ng-container>\n </td>\n <td>{{ item.sessionHead ? item.sessionOther : '' }}</td>\n </ng-container>\n <ng-container *ngIf=\"!item.empty\">\n <td>{{ item.subject || '\u2014' }}</td>\n <td class=\"pd-nowrap\">{{ item.grade || '\u2014' }}</td>\n <td>{{ item.chapter || '\u2014' }}</td>\n <td [class.pd-detail-muted]=\"!item.tp\">{{ item.tp || '\u2014' }}</td>\n <td [innerHTML]=\"item.details || ''\"></td>\n </ng-container>\n <td *ngIf=\"item.empty\" colspan=\"5\" class=\"pd-detail-muted\">No content was opened in this session.</td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n</div>\n",
|
|
3741
|
+
styles: [".pd-detail-backdrop{position:fixed;inset:0;top:0;left:0;right:0;bottom:0;z-index:1000;background:rgba(17,24,39,.45);display:flex;align-items:center;justify-content:center;padding:16px;box-sizing:border-box}.pd-detail-dialog{background:#fff;border-radius:12px;box-shadow:0 20px 50px rgba(0,0,0,.25);width:900px;max-width:100%;height:600px;max-height:85vh;display:flex;flex-direction:column;overflow:hidden;font-family:Arial,sans-serif;font-size:13px;color:#1f2937}.pd-detail-header{flex:0 0 auto;display:flex;align-items:flex-start;justify-content:space-between;padding:18px 20px 12px;border-bottom:1px solid #e5e7eb}.pd-detail-title{font-size:20px;font-weight:700;line-height:1.3;color:#1f2937}.pd-detail-heading{display:flex;align-items:flex-start;gap:12px}.pd-detail-swatch{flex:0 0 auto;width:14px;height:14px;border-radius:50%;margin-top:6px}.pd-detail-subtitle{font-size:15px;font-weight:700;color:#c9952b;margin-top:4px}.pd-detail-close{border:none;background:#f3f4f6;color:#374151;width:32px;height:32px;border-radius:50%;font-size:22px;line-height:30px;cursor:pointer;flex-shrink:0}.pd-detail-close:hover{background:#e5e7eb}.pd-detail-summary{flex:0 0 auto;display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:10px;padding:14px 20px}.pd-detail-card{background:#f9fafb;border:1px solid #e5e7eb;border-radius:10px;padding:12px 14px;text-align:center}.pd-detail-card.pd-tone-lime{background:#eef6a3;border-color:#dfe98a}.pd-detail-card.pd-tone-sand{background:#f6ecd9;border-color:#ebdcc0}.pd-detail-card.pd-tone-sky{background:#e1edfb;border-color:#cbdcf3}.pd-detail-card.pd-tone-mint{background:#f3fbe6;border-color:#dfeecb}.pd-detail-card-label{display:flex;align-items:center;justify-content:center;gap:6px;font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:#6b7280;margin-bottom:6px}.pd-card-icon{display:inline-flex}.pd-card-icon svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.pd-detail-card-value{font-size:15px;font-weight:700;word-break:break-word}.pd-people{flex:0 0 auto;display:flex;flex-wrap:wrap;align-items:center;gap:6px;max-height:72px;overflow:auto;padding:0 20px 12px}.pd-people-title{font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:#6b7280;margin-right:4px}.pd-person{padding:4px 10px;border-radius:999px;background:#f6ecd9;border:1px solid #ebdcc0;font-size:12px;font-weight:700;color:#1f2937}.pd-person-time{font-weight:400;color:#6b7280;margin-left:4px}.pd-detail-muted{color:#9ca3af;font-weight:400}.pd-detail-body{overflow:auto;margin:0 20px 20px;flex:1 1 auto;min-height:0;border:1px solid #e5e7eb;border-radius:8px}.pd-detail-table{width:100%;border-collapse:separate;border-spacing:0}.pd-detail-table td,.pd-detail-table th{text-align:left;padding:9px 12px;border-bottom:1px solid #f0f0f0;vertical-align:top}.pd-detail-table th{position:sticky;top:0;z-index:1;background:#f3f4f6;font-size:12px;color:#4b5563;font-weight:700}.pd-detail-table tbody tr:nth-child(2n) td{background:#fafafa}.pd-detail-table tbody tr.pd-session-start:not(:first-child) td{border-top:2px solid #e5e7eb}.pd-detail-table tbody tr:last-child td{border-bottom:none}.pd-detail-table tbody tr:hover td{background:#eef2ff}.pd-nowrap{white-space:nowrap}.pd-detail-empty{padding:24px;text-align:center;color:#6b7280}:host ::ng-deep .dddd{color:#2563eb;font-style:italic}"]
|
|
3742
|
+
},] }
|
|
3743
|
+
];
|
|
3744
|
+
SmallTableViewComponent.ctorParameters = function () { return [
|
|
3745
|
+
{ type: PrincipalDashboardLibV2Service }
|
|
3746
|
+
]; };
|
|
3747
|
+
SmallTableViewComponent.propDecorators = {
|
|
3748
|
+
data: [{ type: i0.Input }],
|
|
3749
|
+
onEscape: [{ type: i0.HostListener, args: ['document:keydown.escape',] }]
|
|
3750
|
+
};
|
|
3751
|
+
|
|
3752
|
+
var TimelineComponent = /** @class */ (function () {
|
|
3753
|
+
function TimelineComponent() {
|
|
3754
|
+
this.rows = [];
|
|
3755
|
+
this.labelTitle = 'Name';
|
|
3756
|
+
this.barClick = new i0.EventEmitter();
|
|
3757
|
+
// clicking a row's total asks for every session in that row
|
|
3758
|
+
this.totalClick = new i0.EventEmitter();
|
|
3759
|
+
this.renderedRows = [];
|
|
3760
|
+
this.ticks = [];
|
|
3761
|
+
// :15 and :45 marks, drawn in the header only, without labels
|
|
3762
|
+
this.quarterTicks = [];
|
|
3763
|
+
// fixed width per hour so a full day scrolls horizontally instead of squeezing
|
|
3764
|
+
this.hourWidth = 160;
|
|
3765
|
+
this.minWidth = 0;
|
|
3766
|
+
this.nowLeft = null;
|
|
3767
|
+
this.sortKey = 'default';
|
|
3768
|
+
this.sortAsc = true;
|
|
3769
|
+
this.tooltip = null;
|
|
3770
|
+
this.rangeStart = 0;
|
|
3771
|
+
this.rangeEnd = 0;
|
|
3772
|
+
}
|
|
3773
|
+
TimelineComponent.prototype.ngOnChanges = function () {
|
|
3774
|
+
this.render();
|
|
3775
|
+
};
|
|
3776
|
+
TimelineComponent.prototype.render = function () {
|
|
3777
|
+
var _this = this;
|
|
3778
|
+
var rows = this.rows || [];
|
|
3779
|
+
var allBars = rows.reduce(function (acc, row) { return acc.concat(row.bars); }, []);
|
|
3780
|
+
if (allBars.length === 0) {
|
|
3781
|
+
this.ticks = [];
|
|
3782
|
+
this.quarterTicks = [];
|
|
3783
|
+
this.nowLeft = null;
|
|
3784
|
+
this.minWidth = 0;
|
|
3785
|
+
this.renderedRows = rows.map(function (row, i) { return _this.toRenderedRow(row, i); });
|
|
3786
|
+
this.applySort();
|
|
3787
|
+
return;
|
|
3788
|
+
}
|
|
3789
|
+
var minStart = Math.min.apply(Math, __spread(allBars.map(function (b) { return b.start.getTime(); })));
|
|
3790
|
+
var maxEnd = Math.max.apply(Math, __spread(allBars.map(function (b) { return b.end.getTime(); })));
|
|
3791
|
+
var hour = 3600 * 1000;
|
|
3792
|
+
var startDate = new Date(minStart);
|
|
3793
|
+
startDate.setMinutes(0, 0, 0);
|
|
3794
|
+
this.rangeStart = startDate.getTime();
|
|
3795
|
+
this.rangeEnd = Math.max(Math.ceil((maxEnd - this.rangeStart) / hour) * hour + this.rangeStart, this.rangeStart + hour);
|
|
3796
|
+
var spanHours = (this.rangeEnd - this.rangeStart) / hour;
|
|
3797
|
+
// label (170) + total (90) + track margins (48) + hours
|
|
3798
|
+
this.minWidth = 170 + 90 + 48 + spanHours * this.hourWidth;
|
|
3799
|
+
this.ticks = [];
|
|
3800
|
+
this.quarterTicks = [];
|
|
3801
|
+
for (var t = this.rangeStart; t <= this.rangeEnd; t += hour / 4) {
|
|
3802
|
+
var minutes = new Date(t).getMinutes();
|
|
3803
|
+
if (minutes === 15 || minutes === 45) {
|
|
3804
|
+
this.quarterTicks.push(this.toPercent(t));
|
|
3805
|
+
}
|
|
3806
|
+
else {
|
|
3807
|
+
this.ticks.push({ left: this.toPercent(t), label: this.formatClock(new Date(t)), major: minutes === 0 });
|
|
3808
|
+
}
|
|
3809
|
+
}
|
|
3810
|
+
var now = Date.now();
|
|
3811
|
+
this.nowLeft = now >= this.rangeStart && now <= this.rangeEnd ? this.toPercent(now) : null;
|
|
3812
|
+
this.renderedRows = rows.map(function (row, i) { return _this.toRenderedRow(row, i); });
|
|
3813
|
+
this.applySort();
|
|
3814
|
+
};
|
|
3815
|
+
TimelineComponent.prototype.toggleSort = function (key) {
|
|
3816
|
+
if (this.sortKey === key) {
|
|
3817
|
+
if (this.sortAsc) {
|
|
3818
|
+
this.sortAsc = false;
|
|
3819
|
+
}
|
|
3820
|
+
else {
|
|
3821
|
+
this.sortKey = 'default';
|
|
3822
|
+
this.sortAsc = true;
|
|
3823
|
+
}
|
|
3824
|
+
}
|
|
3825
|
+
else {
|
|
3826
|
+
this.sortKey = key;
|
|
3827
|
+
this.sortAsc = key === 'name';
|
|
3828
|
+
}
|
|
3829
|
+
this.applySort();
|
|
3830
|
+
};
|
|
3831
|
+
TimelineComponent.prototype.sortIcon = function (key) {
|
|
3832
|
+
if (this.sortKey !== key)
|
|
3833
|
+
return '';
|
|
3834
|
+
return this.sortAsc ? '▲' : '▼';
|
|
3835
|
+
};
|
|
3836
|
+
TimelineComponent.prototype.onBarClick = function (bar) {
|
|
3837
|
+
this.tooltip = null;
|
|
3838
|
+
this.barClick.emit({ index: bar.index, color: bar.color });
|
|
3839
|
+
};
|
|
3840
|
+
TimelineComponent.prototype.onTotalClick = function (row) {
|
|
3841
|
+
if (!row.bars.length)
|
|
3842
|
+
return;
|
|
3843
|
+
this.tooltip = null;
|
|
3844
|
+
this.totalClick.emit({ label: row.label, indexes: row.bars.map(function (b) { return b.index; }), color: row.color, total: row.total });
|
|
3845
|
+
};
|
|
3846
|
+
TimelineComponent.prototype.showTooltip = function (event, bar) {
|
|
3847
|
+
this.tooltip = { text: bar.tooltip, x: event.clientX + 12, y: event.clientY + 12 };
|
|
3848
|
+
};
|
|
3849
|
+
TimelineComponent.prototype.hideTooltip = function () {
|
|
3850
|
+
this.tooltip = null;
|
|
3851
|
+
};
|
|
3852
|
+
TimelineComponent.prototype.trackByLabel = function (index, row) {
|
|
3853
|
+
return row.label;
|
|
3854
|
+
};
|
|
3855
|
+
TimelineComponent.prototype.toRenderedRow = function (row, i) {
|
|
3856
|
+
var _this = this;
|
|
3857
|
+
var totalMs = this.mergedDuration(row.bars);
|
|
3858
|
+
var starts = row.bars.map(function (b) { return b.start.getTime(); });
|
|
3859
|
+
var ends = row.bars.map(function (b) { return b.end.getTime(); });
|
|
3860
|
+
var spanLeft = starts.length ? this.toPercent(Math.min.apply(Math, __spread(starts))) : 0;
|
|
3861
|
+
var spanWidth = ends.length ? this.toPercent(Math.max.apply(Math, __spread(ends))) - spanLeft : 0;
|
|
3862
|
+
return {
|
|
3863
|
+
spanLeft: spanLeft,
|
|
3864
|
+
spanWidth: spanWidth,
|
|
3865
|
+
label: row.label,
|
|
3866
|
+
color: this.rowColor(i),
|
|
3867
|
+
totalMs: totalMs,
|
|
3868
|
+
total: this.formatDuration(totalMs),
|
|
3869
|
+
order: i,
|
|
3870
|
+
bars: row.bars.map(function (bar) {
|
|
3871
|
+
var left = _this.toPercent(bar.start.getTime());
|
|
3872
|
+
return Object.assign(Object.assign({}, bar), { left: left, width: Math.max(_this.toPercent(bar.end.getTime()) - left, 0), color: _this.rowColor(i) });
|
|
3873
|
+
}),
|
|
3874
|
+
};
|
|
3875
|
+
};
|
|
3876
|
+
// unique soft colour per row: golden-angle hue steps never repeat and keep neighbouring rows apart
|
|
3877
|
+
TimelineComponent.prototype.rowColor = function (index) {
|
|
3878
|
+
var hue = Math.round((217 + index * 137.508) % 360);
|
|
3879
|
+
return "hsl(" + hue + ", 62%, 68%)";
|
|
3880
|
+
};
|
|
3881
|
+
TimelineComponent.prototype.applySort = function () {
|
|
3882
|
+
var _this = this;
|
|
3883
|
+
var dir = this.sortAsc ? 1 : -1;
|
|
3884
|
+
this.renderedRows = __spread(this.renderedRows).sort(function (a, b) {
|
|
3885
|
+
if (_this.sortKey === 'name') {
|
|
3886
|
+
return dir * a.label.localeCompare(b.label, undefined, { numeric: true });
|
|
3887
|
+
}
|
|
3888
|
+
if (_this.sortKey === 'total') {
|
|
3889
|
+
return dir * (a.totalMs - b.totalMs);
|
|
3890
|
+
}
|
|
3891
|
+
return a.order - b.order;
|
|
3892
|
+
});
|
|
3893
|
+
};
|
|
3894
|
+
// overlapping sessions in the same row are counted once
|
|
3895
|
+
TimelineComponent.prototype.mergedDuration = function (bars) {
|
|
3896
|
+
var sorted = __spread(bars).sort(function (a, b) { return a.start.getTime() - b.start.getTime(); });
|
|
3897
|
+
var total = 0;
|
|
3898
|
+
var curStart = null;
|
|
3899
|
+
var curEnd = null;
|
|
3900
|
+
sorted.forEach(function (bar) {
|
|
3901
|
+
var s = bar.start.getTime();
|
|
3902
|
+
var e = bar.end.getTime();
|
|
3903
|
+
if (curEnd === null || s > curEnd) {
|
|
3904
|
+
if (curEnd !== null)
|
|
3905
|
+
total += curEnd - curStart;
|
|
3906
|
+
curStart = s;
|
|
3907
|
+
curEnd = e;
|
|
3908
|
+
}
|
|
3909
|
+
else if (e > curEnd) {
|
|
3910
|
+
curEnd = e;
|
|
3911
|
+
}
|
|
3912
|
+
});
|
|
3913
|
+
if (curEnd !== null)
|
|
3914
|
+
total += curEnd - curStart;
|
|
3915
|
+
return total;
|
|
3916
|
+
};
|
|
3917
|
+
TimelineComponent.prototype.toPercent = function (time) {
|
|
3918
|
+
var span = this.rangeEnd - this.rangeStart;
|
|
3919
|
+
return span > 0 ? ((time - this.rangeStart) / span) * 100 : 0;
|
|
3920
|
+
};
|
|
3921
|
+
TimelineComponent.prototype.formatClock = function (date) {
|
|
3922
|
+
var hours = date.getHours();
|
|
3923
|
+
var minutes = date.getMinutes();
|
|
3924
|
+
var ampm = hours >= 12 ? 'PM' : 'AM';
|
|
3925
|
+
hours = hours % 12 || 12;
|
|
3926
|
+
return minutes === 0 ? hours + " " + ampm : hours + ":" + minutes.toString().padStart(2, '0');
|
|
3927
|
+
};
|
|
3928
|
+
TimelineComponent.prototype.formatDuration = function (ms) {
|
|
3929
|
+
var totalMinutes = Math.round(ms / 60000);
|
|
3930
|
+
var hours = Math.floor(totalMinutes / 60);
|
|
3931
|
+
var minutes = totalMinutes % 60;
|
|
3932
|
+
return hours + ":" + minutes.toString().padStart(2, '0') + " hrs";
|
|
3933
|
+
};
|
|
3934
|
+
return TimelineComponent;
|
|
3935
|
+
}());
|
|
3936
|
+
TimelineComponent.decorators = [
|
|
3937
|
+
{ type: i0.Component, args: [{
|
|
3938
|
+
selector: 'lib-timeline',
|
|
3939
|
+
template: "<div class=\"tl-container\" [style.min-width.px]=\"minWidth\">\n <div class=\"tl-row tl-header\">\n <div class=\"tl-label tl-sortable\" (click)=\"toggleSort('name')\">{{ labelTitle }} {{ sortIcon('name') }}</div>\n <div class=\"tl-track tl-axis\">\n <div class=\"tl-mark tl-mark-quarter\" *ngFor=\"let left of quarterTicks\" [style.left.%]=\"left\"></div>\n <div class=\"tl-mark\" *ngFor=\"let tick of ticks\" [class.tl-mark-hour]=\"tick.major\" [style.left.%]=\"tick.left\"></div>\n <div class=\"tl-tick\" *ngFor=\"let tick of ticks\" [class.tl-minor]=\"!tick.major\" [style.left.%]=\"tick.left\">{{ tick.label }}</div>\n </div>\n <div class=\"tl-total tl-sortable\" (click)=\"toggleSort('total')\">Total {{ sortIcon('total') }}</div>\n </div>\n\n <div class=\"tl-empty\" *ngIf=\"renderedRows.length === 0\">No usage data for this view.</div>\n\n <div class=\"tl-row\" *ngFor=\"let row of renderedRows; trackBy: trackByLabel; let odd = odd\" [class.tl-odd]=\"odd\">\n <div class=\"tl-label\" [title]=\"row.label\">{{ row.label }}</div>\n <div class=\"tl-track\">\n <div class=\"tl-gridline\" *ngFor=\"let tick of ticks\" [class.tl-minor]=\"!tick.major\" [style.left.%]=\"tick.left\"></div>\n <div class=\"tl-span\" *ngIf=\"row.bars.length\" [style.left.%]=\"row.spanLeft\" [style.width.%]=\"row.spanWidth\"></div>\n <div class=\"tl-now\" *ngIf=\"nowLeft !== null\" [style.left.%]=\"nowLeft\"></div>\n <div\n class=\"tl-bar\"\n *ngFor=\"let bar of row.bars\"\n [style.left.%]=\"bar.left\"\n [style.width.%]=\"bar.width\"\n [style.background-color]=\"bar.color\"\n (click)=\"onBarClick(bar)\"\n (mousemove)=\"showTooltip($event, bar)\"\n (mouseleave)=\"hideTooltip()\"\n ></div>\n </div>\n <div\n class=\"tl-total\"\n [class.tl-total-link]=\"row.bars.length\"\n [title]=\"row.bars.length ? 'Show all sessions' : ''\"\n (click)=\"onTotalClick(row)\"\n >{{ row.bars.length ? row.total : '\u2014' }}</div>\n </div>\n\n <div class=\"tl-tooltip\" *ngIf=\"tooltip\" [style.left.px]=\"tooltip.x\" [style.top.px]=\"tooltip.y\">{{ tooltip.text }}</div>\n</div>\n",
|
|
3940
|
+
styles: [".tl-container{font-family:Arial,sans-serif;font-size:13px;color:#1f2937;border:1px solid #e5e7eb;border-radius:8px;overflow:clip;min-width:900px;box-sizing:border-box;position:relative;isolation:isolate}.tl-row{display:flex;height:30px;border-bottom:1px solid #e2e6ec;background:#fff}.tl-row:hover:not(.tl-header){background:#eef2ff}.tl-odd{background:#f4f6f9}.tl-header{position:sticky;top:0;z-index:3;height:32px;background:#f8fafc;font-weight:700;color:#475569;border-bottom:1px solid #e5e7eb}.tl-label{flex:0 0 170px;overflow:hidden;text-overflow:ellipsis;border-right:1px solid #e5e7eb;left:0}.tl-label,.tl-total{padding:0 8px;line-height:30px;text-align:right;white-space:nowrap;position:sticky;z-index:2;background:inherit}.tl-total{flex:0 0 90px;font-variant-numeric:tabular-nums;color:#334155;border-left:1px solid #e5e7eb;right:0}.tl-total-link{cursor:pointer;color:#4338ca}.tl-total-link:hover{text-decoration:underline}.tl-sortable{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;line-height:32px}.tl-track{flex:1 1 auto;position:relative;margin:0 24px}.tl-axis .tl-tick{position:absolute;top:0;line-height:24px;transform:translateX(-50%);font-weight:400;font-size:11px;color:#64748b;white-space:nowrap}.tl-axis .tl-tick.tl-minor{font-size:10px;color:#94a3b8}.tl-axis .tl-mark{position:absolute;bottom:0;height:8px;border-left:2px solid #7c9cf5;transform:translateX(-1px)}.tl-axis .tl-mark.tl-mark-hour{height:10px;border-left:2px solid #475569;transform:translateX(-1px)}.tl-axis .tl-mark.tl-mark-quarter{height:8px;border-left:1px solid #c3cad6;transform:translateX(-.5px)}.tl-gridline{position:absolute;top:0;bottom:0;border-left:1px solid #d3d2d2;z-index:3}.tl-gridline.tl-minor{border-left:1px dashed #d3d2d2}.tl-span{position:absolute;top:5px;bottom:5px;background:#e4e8ee;border-radius:2px}.tl-now{top:0;bottom:0;border-left:2px solid #f43f5e}.tl-bar,.tl-now{position:absolute;z-index:1}.tl-bar{top:5px;bottom:5px;min-width:4px;border-radius:2px;cursor:pointer;box-shadow:inset 1px 0 0 hsla(0,0%,100%,.45);transition:filter .12s}.tl-bar:hover{filter:brightness(.82);z-index:2;box-shadow:0 2px 6px rgba(79,70,229,.35)}.tl-empty{padding:16px;text-align:center;color:#666}.tl-tooltip{position:fixed;z-index:1000;background:#1e293b;color:#fff;font-size:12px;padding:6px 10px;border-radius:6px;box-shadow:0 4px 12px rgba(0,0,0,.2);white-space:pre-line;pointer-events:none;max-width:320px}"]
|
|
3941
|
+
},] }
|
|
3942
|
+
];
|
|
3943
|
+
TimelineComponent.propDecorators = {
|
|
3944
|
+
rows: [{ type: i0.Input }],
|
|
3945
|
+
labelTitle: [{ type: i0.Input }],
|
|
3946
|
+
barClick: [{ type: i0.Output }],
|
|
3947
|
+
totalClick: [{ type: i0.Output }]
|
|
3948
|
+
};
|
|
3949
|
+
|
|
3950
|
+
var MINUTE = 60 * 1000;
|
|
3951
|
+
var HOUR = 60 * MINUTE;
|
|
3952
|
+
var SHORT_SESSION_MIN = 5;
|
|
3953
|
+
// width the page is laid out at for the PDF, so the export looks the same on any screen
|
|
3954
|
+
var PDF_RENDER_WIDTH = 1280;
|
|
3955
|
+
var InsightsComponent = /** @class */ (function () {
|
|
3956
|
+
function InsightsComponent(pdService, host) {
|
|
3957
|
+
this.pdService = pdService;
|
|
3958
|
+
this.host = host;
|
|
3959
|
+
this.schoolName = '';
|
|
3960
|
+
this.dayLabel = '';
|
|
3961
|
+
this.kpis = [];
|
|
3962
|
+
this.hourly = [];
|
|
3963
|
+
this.grades = [];
|
|
3964
|
+
this.topTeachers = [];
|
|
3965
|
+
// donut of subject share: each segment is a dash along one circle
|
|
3966
|
+
this.subjectDonut = { total: '', segments: [] };
|
|
3967
|
+
this.donutRadius = 52;
|
|
3968
|
+
// columns per class, in class order
|
|
3969
|
+
this.gradeColumns = [];
|
|
3970
|
+
// one tile per room, shaded by share of the school day in use
|
|
3971
|
+
this.roomTiles = [];
|
|
3972
|
+
this.idleRooms = [];
|
|
3973
|
+
this.inactiveTeachers = [];
|
|
3974
|
+
this.contentMix = [];
|
|
3975
|
+
this.chapters = [];
|
|
3976
|
+
this.attention = [];
|
|
3977
|
+
this.hasSessions = false;
|
|
3978
|
+
this.isExporting = false;
|
|
3979
|
+
// accordion: the full follow-up lists open below the summary tiles
|
|
3980
|
+
this.detailsOpen = false;
|
|
3981
|
+
this.eligibleCount = 0;
|
|
3982
|
+
this.classroomCount = 0;
|
|
3983
|
+
this.fileDate = '';
|
|
3984
|
+
// ---------- count-up for the headline numbers
|
|
3985
|
+
this.countFrame = 0;
|
|
3986
|
+
}
|
|
3987
|
+
Object.defineProperty(InsightsComponent.prototype, "data", {
|
|
3988
|
+
set: function (res) {
|
|
3989
|
+
if (res) {
|
|
3990
|
+
this.build(typeof res === 'string' ? JSON.parse(res) : res);
|
|
3991
|
+
}
|
|
3992
|
+
},
|
|
3993
|
+
enumerable: false,
|
|
3994
|
+
configurable: true
|
|
3995
|
+
});
|
|
3996
|
+
InsightsComponent.prototype.ngAfterViewInit = function () {
|
|
3997
|
+
var _this = this;
|
|
3998
|
+
setTimeout(function () { return _this.fitHeight(); });
|
|
3999
|
+
};
|
|
4000
|
+
// fill from where the page starts down to the bottom of the window and scroll inside it
|
|
4001
|
+
InsightsComponent.prototype.fitHeight = function () {
|
|
4002
|
+
var page = this.host.nativeElement.querySelector('.in-page');
|
|
4003
|
+
if (!page)
|
|
4004
|
+
return;
|
|
4005
|
+
var top = page.getBoundingClientRect().top;
|
|
4006
|
+
page.style.height = Math.max(window.innerHeight - top, 240) + 'px';
|
|
4007
|
+
};
|
|
4008
|
+
InsightsComponent.prototype.build = function (json) {
|
|
4009
|
+
var _this = this;
|
|
4010
|
+
var users = this.list(json, 'usersMetadata', 'userMetadata');
|
|
4011
|
+
var consoles = this.list(json, 'usersConsole', 'userConsole');
|
|
4012
|
+
var resources = this.list(json, 'resourcesMetadata', 'resourceMetadata');
|
|
4013
|
+
var terminals = this.list(json, 'schoolTerminals', 'schoolTerminal');
|
|
4014
|
+
this.schoolName = (json.schoolMetadata && json.schoolMetadata.school && json.schoolMetadata.school.schoolName) || '';
|
|
4015
|
+
var userById = new Map();
|
|
4016
|
+
users.forEach(function (u) { return userById.set(u.userId, u); });
|
|
4017
|
+
var resourceById = new Map();
|
|
4018
|
+
resources.forEach(function (r) { return resourceById.set(r.resourceId, r); });
|
|
4019
|
+
var roomByIp = new Map();
|
|
4020
|
+
terminals.forEach(function (t) { return roomByIp.set(t.terminalKey, _this.pdService.getRoomLabel(_this.location(t.metadata), t.terminalKey)); });
|
|
4021
|
+
var classrooms = terminals.filter(function (t) { return t.terminalType === 'classroom'; });
|
|
4022
|
+
var sessions = consoles
|
|
4023
|
+
.map(function (c) { return ({
|
|
4024
|
+
userId: c.userId,
|
|
4025
|
+
ip: c.terminalIP,
|
|
4026
|
+
start: _this.parseTime(c.startTime),
|
|
4027
|
+
end: _this.parseTime(c.endTime),
|
|
4028
|
+
resources: ((c.userConsoleResources && c.userConsoleResources.userConsoleResource) || []).map(function (r) { return ({
|
|
4029
|
+
resourceId: r.resourceId,
|
|
4030
|
+
type: r.type,
|
|
4031
|
+
}); }),
|
|
4032
|
+
}); })
|
|
4033
|
+
.filter(function (s) { return !isNaN(s.start) && !isNaN(s.end) && s.end >= s.start; });
|
|
4034
|
+
// zero-length entries are logins with no class time; keep them out of time-based figures
|
|
4035
|
+
var timed = sessions.filter(function (s) { return s.end > s.start; });
|
|
4036
|
+
this.hasSessions = sessions.length > 0;
|
|
4037
|
+
var first = sessions.length ? new Date(Math.min.apply(Math, __spread(sessions.map(function (s) { return s.start; })))) : null;
|
|
4038
|
+
this.fileDate = first
|
|
4039
|
+
? [first.getDate(), first.getMonth() + 1].map(function (n) { return String(n).padStart(2, '0'); }).join('-') + '-' + first.getFullYear()
|
|
4040
|
+
: '';
|
|
4041
|
+
this.dayLabel = first ? first.toLocaleDateString('en-GB', { weekday: 'long', day: 'numeric', month: 'short', year: 'numeric' }) : '';
|
|
4042
|
+
// ---- teachers
|
|
4043
|
+
var eligible = users.filter(function (u) { return (u.userSubjects || '') !== ''; });
|
|
4044
|
+
var timeByUser = this.groupTime(timed, function (s) { return s.userId; });
|
|
4045
|
+
var sessionsByUser = this.countBy(timed, function (s) { return s.userId; });
|
|
4046
|
+
var activeUserIds = new Set(sessions.map(function (s) { return s.userId; }));
|
|
4047
|
+
var totalTeachingMs = Array.from(timeByUser.values()).reduce(function (a, b) { return a + b; }, 0);
|
|
4048
|
+
var activeEligible = eligible.filter(function (u) { return activeUserIds.has(u.userId); }).length;
|
|
4049
|
+
this.eligibleCount = eligible.length;
|
|
4050
|
+
this.classroomCount = classrooms.length;
|
|
4051
|
+
this.topTeachers = this.toBars(Array.from(timeByUser.entries()).map(function (_a) {
|
|
4052
|
+
var _b = __read(_a, 2), id = _b[0], ms = _b[1];
|
|
4053
|
+
return ({
|
|
4054
|
+
label: _this.userName(userById.get(id), id),
|
|
4055
|
+
sub: (sessionsByUser.get(id) || 0) + " sessions",
|
|
4056
|
+
value: ms,
|
|
4057
|
+
});
|
|
4058
|
+
}), function (ms) { return _this.formatDuration(ms); }, 8);
|
|
4059
|
+
this.inactiveTeachers = eligible
|
|
4060
|
+
.filter(function (u) { return !activeUserIds.has(u.userId); })
|
|
4061
|
+
.map(function (u) { return _this.userName(u, u.userId); })
|
|
4062
|
+
.sort(function (a, b) { return a.localeCompare(b); });
|
|
4063
|
+
// ---- rooms
|
|
4064
|
+
var timeByRoom = this.groupTime(timed, function (s) { return s.ip; });
|
|
4065
|
+
var usedIps = new Set(sessions.map(function (s) { return s.ip; }));
|
|
4066
|
+
var usedClassrooms = classrooms.filter(function (t) { return usedIps.has(t.terminalKey); }).length;
|
|
4067
|
+
var daySpan = timed.length ? Math.max.apply(Math, __spread(timed.map(function (s) { return s.end; }))) - Math.min.apply(Math, __spread(timed.map(function (s) { return s.start; }))) : 0;
|
|
4068
|
+
// every installed classroom plus any other room that was used, in room order
|
|
4069
|
+
var tileIps = classrooms.map(function (t) { return t.terminalKey; }).concat(Array.from(timeByRoom.keys()).filter(function (ip) { return !classrooms.some(function (t) { return t.terminalKey === ip; }); }));
|
|
4070
|
+
var maxRoomMs = Math.max.apply(Math, __spread(Array.from(timeByRoom.values()), [1]));
|
|
4071
|
+
this.roomTiles = tileIps
|
|
4072
|
+
.map(function (ip) {
|
|
4073
|
+
var ms = timeByRoom.get(ip) || 0;
|
|
4074
|
+
var share = daySpan ? Math.round((ms / daySpan) * 100) : 0;
|
|
4075
|
+
return {
|
|
4076
|
+
label: roomByIp.get(ip) || ip,
|
|
4077
|
+
display: ms ? _this.formatDuration(ms) + " \u00B7 " + share + "% of the day" : 'Not used today',
|
|
4078
|
+
share: share,
|
|
4079
|
+
// pale blue for little use through to deep navy for the busiest room
|
|
4080
|
+
shade: share ? _this.navyShade(ms / maxRoomMs) : '',
|
|
4081
|
+
dark: !!share && Math.pow(ms / maxRoomMs, 1.8) > 0.5,
|
|
4082
|
+
// shown as an outlined tile: unused, or used for under 1% of the day
|
|
4083
|
+
idle: !share,
|
|
4084
|
+
// long names ("science lab", "127.0.0.1") take extra columns so they show in full
|
|
4085
|
+
span: Math.min(Math.ceil(((roomByIp.get(ip) || ip).length + 2) / 5), 4),
|
|
4086
|
+
};
|
|
4087
|
+
})
|
|
4088
|
+
.sort(function (a, b) { return a.label.localeCompare(b.label, undefined, { numeric: true }); });
|
|
4089
|
+
this.idleRooms = classrooms
|
|
4090
|
+
.filter(function (t) { return !usedIps.has(t.terminalKey); })
|
|
4091
|
+
.map(function (t) { return roomByIp.get(t.terminalKey); })
|
|
4092
|
+
.sort(function (a, b) { return a.localeCompare(b, undefined, { numeric: true }); });
|
|
4093
|
+
// ---- through the day: distinct teachers in a session during each hour
|
|
4094
|
+
this.hourly = [];
|
|
4095
|
+
if (timed.length) {
|
|
4096
|
+
var startHour = new Date(Math.min.apply(Math, __spread(timed.map(function (s) { return s.start; }))));
|
|
4097
|
+
startHour.setMinutes(0, 0, 0);
|
|
4098
|
+
var lastEnd = Math.max.apply(Math, __spread(timed.map(function (s) { return s.end; })));
|
|
4099
|
+
var counts = [];
|
|
4100
|
+
var _loop_1 = function (t) {
|
|
4101
|
+
var teachers = new Set(timed.filter(function (s) { return s.start < t + HOUR && s.end > t; }).map(function (s) { return s.userId; }));
|
|
4102
|
+
counts.push({ label: this_1.formatHour(new Date(t)), value: teachers.size });
|
|
4103
|
+
};
|
|
4104
|
+
var this_1 = this;
|
|
4105
|
+
for (var t = startHour.getTime(); t < lastEnd; t += HOUR) {
|
|
4106
|
+
_loop_1(t);
|
|
4107
|
+
}
|
|
4108
|
+
var max_1 = Math.max.apply(Math, __spread(counts.map(function (c) { return c.value; }), [1]));
|
|
4109
|
+
this.hourly = counts.map(function (c) { return (Object.assign(Object.assign({}, c), { percent: (c.value / max_1) * 100, peak: c.value === max_1, color: _this.utilisationColor(c.value / max_1) })); });
|
|
4110
|
+
}
|
|
4111
|
+
var peak = this.hourly.reduce(function (best, h) { return (!best || h.value > best.value ? h : best); }, null);
|
|
4112
|
+
// ---- what was taught: session time split evenly across the subjects / grades it touched
|
|
4113
|
+
var subjectTime = new Map();
|
|
4114
|
+
var gradeTime = new Map();
|
|
4115
|
+
timed.forEach(function (s) {
|
|
4116
|
+
var metas = s.resources.map(function (r) { return resourceById.get(r.resourceId); }).filter(function (m) { return !!m; });
|
|
4117
|
+
_this.share(subjectTime, metas.map(function (m) { return _this.title(m.subject); }), s.end - s.start);
|
|
4118
|
+
_this.share(gradeTime, metas.map(function (m) { return _this.title(m.grade); }), s.end - s.start);
|
|
4119
|
+
});
|
|
4120
|
+
this.subjectDonut = this.buildDonut(this.entries(subjectTime), 7);
|
|
4121
|
+
this.grades = this.toBars(this.entries(gradeTime).sort(function (a, b) { return a.label.localeCompare(b.label, undefined, { numeric: true }); }), function (ms) { return _this.formatDuration(ms); }, 0, false);
|
|
4122
|
+
this.gradeColumns = this.grades.map(function (g) { return (Object.assign(Object.assign({}, g), { short: _this.shortGrade(g.label) })); });
|
|
4123
|
+
// ---- content
|
|
4124
|
+
var launches = sessions.reduce(function (acc, s) { return acc.concat(s.resources); }, []);
|
|
4125
|
+
var typeCounts = this.countBy(launches, function (r) { return _this.typeLabel(r.type); });
|
|
4126
|
+
this.contentMix = this.toBars(Array.from(typeCounts.entries()).map(function (_a) {
|
|
4127
|
+
var _b = __read(_a, 2), label = _b[0], n = _b[1];
|
|
4128
|
+
return ({ label: label, value: n });
|
|
4129
|
+
}), function (n) { return "" + n; }, 0).map(function (item, i) { return (Object.assign(Object.assign({}, item), { color: _this.color(i), percent: (item.value / Math.max(launches.length, 1)) * 100 })); });
|
|
4130
|
+
var chapterCounts = new Map();
|
|
4131
|
+
launches.forEach(function (r) {
|
|
4132
|
+
var m = resourceById.get(r.resourceId);
|
|
4133
|
+
var chapter = m && _this.title(m.chapter);
|
|
4134
|
+
if (!chapter)
|
|
4135
|
+
return;
|
|
4136
|
+
var key = _this.title(m.subject) + "|" + _this.title(m.grade) + "|" + chapter;
|
|
4137
|
+
var cur = chapterCounts.get(key) || { n: 0, sub: [_this.title(m.subject), _this.title(m.grade)].filter(function (x) { return x; }).join(' · ') };
|
|
4138
|
+
cur.n++;
|
|
4139
|
+
chapterCounts.set(key, cur);
|
|
4140
|
+
});
|
|
4141
|
+
this.chapters = this.toBars(Array.from(chapterCounts.entries()).map(function (_a) {
|
|
4142
|
+
var _b = __read(_a, 2), key = _b[0], v = _b[1];
|
|
4143
|
+
return ({ label: key.split('|')[2], sub: v.sub, value: v.n });
|
|
4144
|
+
}), function (n) { return n + " uses"; }, 8);
|
|
4145
|
+
// ---- headline numbers
|
|
4146
|
+
var avgSession = timed.length ? totalTeachingMs / timed.length : 0;
|
|
4147
|
+
var topics = new Set(launches.filter(function (r) { return r.type === 'tp'; }).map(function (r) { return r.resourceId; }));
|
|
4148
|
+
this.kpis = [
|
|
4149
|
+
{
|
|
4150
|
+
label: 'Active Teachers',
|
|
4151
|
+
value: activeEligible + " / " + eligible.length,
|
|
4152
|
+
hint: this.pct(activeEligible, eligible.length) + " of eligible teachers",
|
|
4153
|
+
},
|
|
4154
|
+
{
|
|
4155
|
+
label: 'Classrooms Used',
|
|
4156
|
+
value: usedClassrooms + " / " + classrooms.length,
|
|
4157
|
+
hint: this.pct(usedClassrooms, classrooms.length) + " of classrooms",
|
|
4158
|
+
},
|
|
4159
|
+
{
|
|
4160
|
+
label: 'Teaching Time',
|
|
4161
|
+
value: this.formatDuration(totalTeachingMs),
|
|
4162
|
+
hint: this.formatDuration(activeUserIds.size ? totalTeachingMs / activeUserIds.size : 0) + " per active teacher",
|
|
4163
|
+
},
|
|
4164
|
+
{
|
|
4165
|
+
label: 'Sessions',
|
|
4166
|
+
value: "" + timed.length,
|
|
4167
|
+
hint: this.formatDuration(avgSession) + " on average",
|
|
4168
|
+
},
|
|
4169
|
+
{
|
|
4170
|
+
label: 'Content Used',
|
|
4171
|
+
value: "" + launches.length,
|
|
4172
|
+
hint: topics.size + " distinct topics",
|
|
4173
|
+
},
|
|
4174
|
+
{
|
|
4175
|
+
label: 'Peak Hour',
|
|
4176
|
+
value: peak ? peak.label : '—',
|
|
4177
|
+
hint: peak ? peak.value + " teachers in class" : 'No sessions',
|
|
4178
|
+
},
|
|
4179
|
+
];
|
|
4180
|
+
this.attention = [
|
|
4181
|
+
{
|
|
4182
|
+
label: 'Teachers Not Active',
|
|
4183
|
+
icon: 'teacher',
|
|
4184
|
+
value: this.inactiveTeachers.length,
|
|
4185
|
+
hint: 'Eligible teachers with no session today',
|
|
4186
|
+
},
|
|
4187
|
+
{
|
|
4188
|
+
label: 'Classrooms Not Used',
|
|
4189
|
+
icon: 'room',
|
|
4190
|
+
value: this.idleRooms.length,
|
|
4191
|
+
hint: 'Installed classrooms with no session today',
|
|
4192
|
+
},
|
|
4193
|
+
{
|
|
4194
|
+
label: "Sessions Under " + SHORT_SESSION_MIN + " Min",
|
|
4195
|
+
icon: 'clock',
|
|
4196
|
+
value: timed.filter(function (s) { return s.end - s.start < SHORT_SESSION_MIN * MINUTE; }).length,
|
|
4197
|
+
hint: 'May be accidental log-ins',
|
|
4198
|
+
},
|
|
4199
|
+
{
|
|
4200
|
+
label: 'Sessions Without Content',
|
|
4201
|
+
icon: 'book',
|
|
4202
|
+
value: timed.filter(function (s) { return s.resources.length === 0; }).length,
|
|
4203
|
+
hint: 'Logged in but nothing was used',
|
|
4204
|
+
},
|
|
4205
|
+
];
|
|
4206
|
+
this.countUp();
|
|
4207
|
+
};
|
|
4208
|
+
// biggest slices first; anything past `keep` is grouped as "Other"
|
|
4209
|
+
InsightsComponent.prototype.buildDonut = function (items, keep) {
|
|
4210
|
+
var _this = this;
|
|
4211
|
+
var sorted = __spread(items).sort(function (a, b) { return b.value - a.value; });
|
|
4212
|
+
var shown = sorted.slice(0, keep);
|
|
4213
|
+
var rest = sorted.slice(keep).reduce(function (sum, i) { return sum + i.value; }, 0);
|
|
4214
|
+
if (rest > 0)
|
|
4215
|
+
shown.push({ label: 'Other', value: rest });
|
|
4216
|
+
var total = shown.reduce(function (sum, i) { return sum + i.value; }, 0);
|
|
4217
|
+
var circumference = 2 * Math.PI * this.donutRadius;
|
|
4218
|
+
var used = 0;
|
|
4219
|
+
var segments = shown.map(function (item, i) {
|
|
4220
|
+
var length = total ? (item.value / total) * circumference : 0;
|
|
4221
|
+
var segment = Object.assign(Object.assign({}, item), { display: _this.formatDuration(item.value), percent: total ? Math.round((item.value / total) * 100) : 0, color: item.label === 'Other' ? '#c9d2e3' : _this.color(i),
|
|
4222
|
+
// small gap between slices
|
|
4223
|
+
dash: Math.max(length - 2, 0) + " " + circumference, offset: -used });
|
|
4224
|
+
used += length;
|
|
4225
|
+
return segment;
|
|
4226
|
+
});
|
|
4227
|
+
return { total: this.formatDuration(total), segments: segments };
|
|
4228
|
+
};
|
|
4229
|
+
// 0 = quiet (light red), 0.5 = moderate (warm yellow), 1 = busiest (green)
|
|
4230
|
+
// `soft` lightens the colour so dark text on tiles stays readable
|
|
4231
|
+
InsightsComponent.prototype.utilisationColor = function (ratio, soft) {
|
|
4232
|
+
if (soft === void 0) { soft = false; }
|
|
4233
|
+
var stops = [
|
|
4234
|
+
{ at: 0, h: 4, s: 82, l: 74 },
|
|
4235
|
+
{ at: 0.5, h: 43, s: 90, l: 62 },
|
|
4236
|
+
{ at: 1, h: 88, s: 45, l: 56 },
|
|
4237
|
+
];
|
|
4238
|
+
var r = Math.min(Math.max(ratio, 0), 1);
|
|
4239
|
+
var _a = __read(r <= 0.5 ? [stops[0], stops[1]] : [stops[1], stops[2]], 2), a = _a[0], b = _a[1];
|
|
4240
|
+
var t = (r - a.at) / (b.at - a.at);
|
|
4241
|
+
var mix = function (x, y) { return Math.round(x + (y - x) * t); };
|
|
4242
|
+
var light = mix(a.l, b.l) + (soft ? 12 : 0);
|
|
4243
|
+
return "hsl(" + mix(a.h, b.h) + ", " + mix(a.s, b.s) + "%, " + light + "%)";
|
|
4244
|
+
};
|
|
4245
|
+
// 0 = near-white blue, 1 = deep navy
|
|
4246
|
+
InsightsComponent.prototype.navyShade = function (ratio) {
|
|
4247
|
+
var from = [234, 241, 251];
|
|
4248
|
+
var to = [22, 43, 87];
|
|
4249
|
+
// eased so low and mid use stay light and only the busiest rooms turn dark
|
|
4250
|
+
var t = Math.pow(Math.min(Math.max(ratio, 0), 1), 1.8);
|
|
4251
|
+
var c = from.map(function (f, i) { return Math.round(f + (to[i] - f) * t); });
|
|
4252
|
+
return "rgb(" + c[0] + ", " + c[1] + ", " + c[2] + ")";
|
|
4253
|
+
};
|
|
4254
|
+
// "Class 7" -> "7", "Early Childhood Education" -> "ECE"
|
|
4255
|
+
InsightsComponent.prototype.shortGrade = function (label) {
|
|
4256
|
+
var match = /^class\s+(.+)$/i.exec(label);
|
|
4257
|
+
if (match)
|
|
4258
|
+
return match[1];
|
|
4259
|
+
return label.split(/\s+/).filter(function (w) { return w; }).map(function (w) { return w.charAt(0).toUpperCase(); }).join('').slice(0, 4);
|
|
4260
|
+
};
|
|
4261
|
+
// every number inside a value ("42 / 77", "48h 53m") rises from 0 together
|
|
4262
|
+
InsightsComponent.prototype.countUp = function () {
|
|
4263
|
+
var _this = this;
|
|
4264
|
+
cancelAnimationFrame(this.countFrame);
|
|
4265
|
+
var reduced = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
4266
|
+
var apply = function (progress) {
|
|
4267
|
+
_this.kpis.forEach(function (k) { return (k.shown = k.value.replace(/\d+/g, function (n) { return "" + Math.round(+n * progress); })); });
|
|
4268
|
+
_this.attention.forEach(function (a) { return (a.shown = Math.round(a.value * progress)); });
|
|
4269
|
+
};
|
|
4270
|
+
if (reduced) {
|
|
4271
|
+
apply(1);
|
|
4272
|
+
return;
|
|
4273
|
+
}
|
|
4274
|
+
var duration = 900;
|
|
4275
|
+
var start = performance.now();
|
|
4276
|
+
var step = function (now) {
|
|
4277
|
+
var t = Math.min((now - start) / duration, 1);
|
|
4278
|
+
apply(1 - Math.pow(1 - t, 3));
|
|
4279
|
+
if (t < 1)
|
|
4280
|
+
_this.countFrame = requestAnimationFrame(step);
|
|
4281
|
+
};
|
|
4282
|
+
apply(0);
|
|
4283
|
+
this.countFrame = requestAnimationFrame(step);
|
|
4284
|
+
};
|
|
4285
|
+
InsightsComponent.prototype.closeDetails = function () {
|
|
4286
|
+
this.detailsOpen = false;
|
|
4287
|
+
};
|
|
4288
|
+
// "Mrs Alisa Dsouza" -> "AD"
|
|
4289
|
+
InsightsComponent.prototype.initials = function (name) {
|
|
4290
|
+
var words = (name || '').split(/\s+/).filter(function (w) { return w && !/^(mr|mrs|miss|ms|dr)\.?$/i.test(w); });
|
|
4291
|
+
return words.length ? (words[0][0] + (words.length > 1 ? words[words.length - 1][0] : '')).toUpperCase() : '?';
|
|
4292
|
+
};
|
|
4293
|
+
// ---------- PDF export
|
|
4294
|
+
InsightsComponent.prototype.downloadPdf = function () {
|
|
4295
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4296
|
+
var page, wrapper, copy, top_1, breaks, canvas;
|
|
4297
|
+
return __generator(this, function (_a) {
|
|
4298
|
+
switch (_a.label) {
|
|
4299
|
+
case 0:
|
|
4300
|
+
page = this.host.nativeElement.querySelector('.in-page');
|
|
4301
|
+
if (!page || this.isExporting)
|
|
4302
|
+
return [2 /*return*/];
|
|
4303
|
+
this.isExporting = true;
|
|
4304
|
+
wrapper = document.createElement('div');
|
|
4305
|
+
wrapper.setAttribute('data-pdf-wrapper', '');
|
|
4306
|
+
wrapper.style.cssText = 'position:fixed;left:0;top:0;width:0;height:0;overflow:hidden;z-index:-1;';
|
|
4307
|
+
copy = page.cloneNode(true);
|
|
4308
|
+
copy.classList.add('in-exporting');
|
|
4309
|
+
copy.style.width = PDF_RENDER_WIDTH + 'px';
|
|
4310
|
+
wrapper.appendChild(copy);
|
|
4311
|
+
page.parentElement.appendChild(wrapper);
|
|
4312
|
+
_a.label = 1;
|
|
4313
|
+
case 1:
|
|
4314
|
+
_a.trys.push([1, , 3, 4]);
|
|
4315
|
+
top_1 = copy.getBoundingClientRect().top;
|
|
4316
|
+
breaks = Array.from(copy.querySelectorAll('.in-card'))
|
|
4317
|
+
.map(function (card) { return Math.round(card.getBoundingClientRect().top - top_1 - 8); })
|
|
4318
|
+
.filter(function (y, i, all) { return y > 0 && all.indexOf(y) === i; })
|
|
4319
|
+
.sort(function (a, b) { return a - b; });
|
|
4320
|
+
return [4 /*yield*/, html2canvas__default['default'](copy, {
|
|
4321
|
+
scale: 2,
|
|
4322
|
+
backgroundColor: '#ffffff',
|
|
4323
|
+
onclone: function (doc) {
|
|
4324
|
+
var clonedWrapper = doc.querySelector('[data-pdf-wrapper]');
|
|
4325
|
+
if (clonedWrapper) {
|
|
4326
|
+
clonedWrapper.style.overflow = 'visible';
|
|
4327
|
+
}
|
|
4328
|
+
},
|
|
4329
|
+
})];
|
|
4330
|
+
case 2:
|
|
4331
|
+
canvas = _a.sent();
|
|
4332
|
+
this.savePdf(canvas, breaks.map(function (y) { return y * 2; }));
|
|
4333
|
+
return [3 /*break*/, 4];
|
|
4334
|
+
case 3:
|
|
4335
|
+
wrapper.remove();
|
|
4336
|
+
this.isExporting = false;
|
|
4337
|
+
return [7 /*endfinally*/];
|
|
4338
|
+
case 4: return [2 /*return*/];
|
|
4339
|
+
}
|
|
4340
|
+
});
|
|
4341
|
+
});
|
|
4342
|
+
};
|
|
4343
|
+
// A4 portrait; each page takes whole rows of cards and long content is sliced as a last resort
|
|
4344
|
+
InsightsComponent.prototype.savePdf = function (canvas, breaks) {
|
|
4345
|
+
var _this = this;
|
|
4346
|
+
var pdf = new jspdf.jsPDF({ orientation: 'portrait', unit: 'mm', format: 'a4' });
|
|
4347
|
+
var margin = 10;
|
|
4348
|
+
var pageWidth = pdf.internal.pageSize.getWidth();
|
|
4349
|
+
var pageHeight = pdf.internal.pageSize.getHeight();
|
|
4350
|
+
var contentWidth = pageWidth - margin * 2;
|
|
4351
|
+
var mmPerPx = contentWidth / canvas.width;
|
|
4352
|
+
var maxSlice = Math.floor((pageHeight - margin * 2 - 6) / mmPerPx);
|
|
4353
|
+
var slices = [];
|
|
4354
|
+
var start = 0;
|
|
4355
|
+
var _loop_2 = function () {
|
|
4356
|
+
var end = Math.min(start + maxSlice, canvas.height);
|
|
4357
|
+
if (end < canvas.height) {
|
|
4358
|
+
var fit = breaks.filter(function (b) { return b > start && b <= end; });
|
|
4359
|
+
if (fit.length)
|
|
4360
|
+
end = fit[fit.length - 1];
|
|
4361
|
+
}
|
|
4362
|
+
slices.push([start, end]);
|
|
4363
|
+
start = end;
|
|
4364
|
+
};
|
|
4365
|
+
while (start < canvas.height) {
|
|
4366
|
+
_loop_2();
|
|
4367
|
+
}
|
|
4368
|
+
slices.forEach(function (_a, i) {
|
|
4369
|
+
var _b = __read(_a, 2), from = _b[0], to = _b[1];
|
|
4370
|
+
var part = document.createElement('canvas');
|
|
4371
|
+
part.width = canvas.width;
|
|
4372
|
+
part.height = to - from;
|
|
4373
|
+
part.getContext('2d').drawImage(canvas, 0, from, canvas.width, to - from, 0, 0, canvas.width, to - from);
|
|
4374
|
+
if (i > 0)
|
|
4375
|
+
pdf.addPage();
|
|
4376
|
+
pdf.addImage(part.toDataURL('image/jpeg', 0.92), 'JPEG', margin, margin, contentWidth, part.height * mmPerPx);
|
|
4377
|
+
pdf.setFontSize(8);
|
|
4378
|
+
pdf.setTextColor(140);
|
|
4379
|
+
pdf.text(_this.schoolName + " \u00B7 Usage insights", margin, pageHeight - 5);
|
|
4380
|
+
pdf.text("Page " + (i + 1) + " of " + slices.length, pageWidth - margin, pageHeight - 5, { align: 'right' });
|
|
4381
|
+
});
|
|
4382
|
+
pdf.save("Insights-" + (this.fileDate || 'report') + ".pdf");
|
|
4383
|
+
};
|
|
4384
|
+
// ---------- helpers
|
|
4385
|
+
InsightsComponent.prototype.list = function (json, outer, inner) {
|
|
4386
|
+
var value = json && json[outer] && json[outer][inner];
|
|
4387
|
+
return Array.isArray(value) ? value : [];
|
|
4388
|
+
};
|
|
4389
|
+
InsightsComponent.prototype.location = function (metadata) {
|
|
4390
|
+
try {
|
|
4391
|
+
return (typeof metadata === 'string' ? JSON.parse(metadata) : metadata || {}).location || '';
|
|
4392
|
+
}
|
|
4393
|
+
catch (e) {
|
|
4394
|
+
return '';
|
|
4395
|
+
}
|
|
4396
|
+
};
|
|
4397
|
+
// "2024-12-10 07:01:24.0" is not valid ISO for every browser, so add the "T"
|
|
4398
|
+
InsightsComponent.prototype.parseTime = function (value) {
|
|
4399
|
+
return value ? new Date(String(value).replace(' ', 'T')).getTime() : NaN;
|
|
4400
|
+
};
|
|
4401
|
+
InsightsComponent.prototype.title = function (item) {
|
|
4402
|
+
return (item && item.title ? String(item.title) : '').trim();
|
|
4403
|
+
};
|
|
4404
|
+
// known types use the dashboard's labels; others like "casset_weblink" become "Weblink"
|
|
4405
|
+
InsightsComponent.prototype.typeLabel = function (type) {
|
|
4406
|
+
if (!type)
|
|
4407
|
+
return 'Other';
|
|
4408
|
+
var label = this.pdService.getDisplaytypeValue(type);
|
|
4409
|
+
if (label !== type)
|
|
4410
|
+
return label;
|
|
4411
|
+
var words = type.replace(/^c?asset_/, '').replace(/_/g, ' ');
|
|
4412
|
+
return words.charAt(0).toUpperCase() + words.slice(1);
|
|
4413
|
+
};
|
|
4414
|
+
InsightsComponent.prototype.userName = function (user, fallback) {
|
|
4415
|
+
return user ? this.pdService.getName(user) : fallback;
|
|
4416
|
+
};
|
|
4417
|
+
// overlapping sessions for the same key are counted once
|
|
4418
|
+
InsightsComponent.prototype.groupTime = function (sessions, key) {
|
|
4419
|
+
var _this = this;
|
|
4420
|
+
var grouped = new Map();
|
|
4421
|
+
sessions.forEach(function (s) {
|
|
4422
|
+
var k = key(s);
|
|
4423
|
+
grouped.set(k, (grouped.get(k) || []).concat({ start: s.start, end: s.end }));
|
|
4424
|
+
});
|
|
4425
|
+
var result = new Map();
|
|
4426
|
+
grouped.forEach(function (intervals, k) { return result.set(k, _this.mergedDuration(intervals)); });
|
|
4427
|
+
return result;
|
|
4428
|
+
};
|
|
4429
|
+
InsightsComponent.prototype.mergedDuration = function (intervals) {
|
|
4430
|
+
var sorted = __spread(intervals).sort(function (a, b) { return a.start - b.start; });
|
|
4431
|
+
var total = 0;
|
|
4432
|
+
var cur = null;
|
|
4433
|
+
sorted.forEach(function (i) {
|
|
4434
|
+
if (!cur || i.start > cur.end) {
|
|
4435
|
+
if (cur)
|
|
4436
|
+
total += cur.end - cur.start;
|
|
4437
|
+
cur = Object.assign({}, i);
|
|
4438
|
+
}
|
|
4439
|
+
else if (i.end > cur.end) {
|
|
4440
|
+
cur.end = i.end;
|
|
4441
|
+
}
|
|
4442
|
+
});
|
|
4443
|
+
return cur ? total + cur.end - cur.start : total;
|
|
4444
|
+
};
|
|
4445
|
+
InsightsComponent.prototype.countBy = function (items, key) {
|
|
4446
|
+
var result = new Map();
|
|
4447
|
+
items.forEach(function (item) { return result.set(key(item), (result.get(key(item)) || 0) + 1); });
|
|
4448
|
+
return result;
|
|
4449
|
+
};
|
|
4450
|
+
InsightsComponent.prototype.share = function (target, labels, ms) {
|
|
4451
|
+
var unique = Array.from(new Set(labels.filter(function (l) { return l; })));
|
|
4452
|
+
unique.forEach(function (l) { return target.set(l, (target.get(l) || 0) + ms / unique.length); });
|
|
4453
|
+
};
|
|
4454
|
+
InsightsComponent.prototype.entries = function (map) {
|
|
4455
|
+
return Array.from(map.entries()).map(function (_a) {
|
|
4456
|
+
var _b = __read(_a, 2), label = _b[0], value = _b[1];
|
|
4457
|
+
return ({ label: label, value: value });
|
|
4458
|
+
});
|
|
4459
|
+
};
|
|
4460
|
+
// limit 0 = show all; bar length is relative to the largest value
|
|
4461
|
+
InsightsComponent.prototype.toBars = function (items, display, limit, sortByValue) {
|
|
4462
|
+
if (sortByValue === void 0) { sortByValue = true; }
|
|
4463
|
+
var sorted = sortByValue ? __spread(items).sort(function (a, b) { return b.value - a.value; }) : items;
|
|
4464
|
+
var shown = limit ? sorted.slice(0, limit) : sorted;
|
|
4465
|
+
var max = Math.max.apply(Math, __spread(shown.map(function (i) { return i.value; }), [1]));
|
|
4466
|
+
return shown.map(function (i) { return (Object.assign(Object.assign({}, i), { display: display(i.value), percent: (i.value / max) * 100 })); });
|
|
4467
|
+
};
|
|
4468
|
+
// blue and yellow first to match the page, then supporting tones
|
|
4469
|
+
InsightsComponent.prototype.color = function (index) {
|
|
4470
|
+
var palette = ['#7c9cf5', '#f6d27e', '#a9bffa', '#6fc6ba', '#f4a98a', '#c0aef7', '#f3a6c8', '#b4bfcf', '#fbe7b4'];
|
|
4471
|
+
return palette[index % palette.length];
|
|
4472
|
+
};
|
|
4473
|
+
InsightsComponent.prototype.pct = function (part, whole) {
|
|
4474
|
+
return whole ? Math.round((part / whole) * 100) + "%" : '0%';
|
|
4475
|
+
};
|
|
4476
|
+
InsightsComponent.prototype.formatHour = function (date) {
|
|
4477
|
+
var h = date.getHours();
|
|
4478
|
+
return (h % 12 || 12) + " " + (h >= 12 ? 'PM' : 'AM');
|
|
4479
|
+
};
|
|
4480
|
+
InsightsComponent.prototype.formatDuration = function (ms) {
|
|
4481
|
+
var minutes = Math.round(ms / MINUTE);
|
|
4482
|
+
var h = Math.floor(minutes / 60);
|
|
4483
|
+
var m = minutes % 60;
|
|
4484
|
+
return h ? h + "h " + m + "m" : m + "m";
|
|
4485
|
+
};
|
|
4486
|
+
return InsightsComponent;
|
|
4487
|
+
}());
|
|
4488
|
+
InsightsComponent.decorators = [
|
|
4489
|
+
{ type: i0.Component, args: [{
|
|
4490
|
+
selector: 'lib-insights',
|
|
4491
|
+
template: "<div class=\"in-page\">\n <!-- title and headline numbers stay in view while the cards below scroll -->\n <div class=\"in-sticky\">\n <div class=\"in-heading\">\n <div class=\"in-heading-text\">{{ schoolName }}<span *ngIf=\"schoolName && dayLabel\"> \u00B7 </span>{{ dayLabel }}</div>\n <button\n type=\"button\"\n class=\"in-pdf-btn\"\n *ngIf=\"hasSessions\"\n data-html2canvas-ignore=\"true\"\n [disabled]=\"isExporting\"\n (click)=\"downloadPdf()\"\n >{{ isExporting ? 'Preparing PDF\u2026' : 'Download PDF' }}</button>\n </div>\n\n <div class=\"in-kpis\" *ngIf=\"hasSessions\">\n <div class=\"in-kpi in-anim\" *ngFor=\"let kpi of kpis; let i = index; let last = last\" [class.in-kpi-accent]=\"last\" [style.animation-delay.ms]=\"i * 60\">\n <span class=\"in-kpi-icon\">\n <svg viewBox=\"0 0 10 10\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"><path d=\"M2.5 7.5l5-5M3.5 2.5h4v4\" /></svg>\n </span>\n <div class=\"in-kpi-label\">{{ kpi.label }}</div>\n <div class=\"in-kpi-value\">{{ kpi.shown || kpi.value }}</div>\n <div class=\"in-kpi-hint\">{{ kpi.hint }}</div>\n </div>\n </div>\n </div>\n\n <div class=\"in-empty\" *ngIf=\"!hasSessions\">No usage was recorded on this day.</div>\n\n <ng-container *ngIf=\"hasSessions\">\n\n <!-- primary: what to act on, and who is using the system -->\n <div class=\"in-grid\">\n <section [style.animation-delay.ms]=\"120\" class=\"in-anim in-card in-wide in-primary\">\n <div class=\"in-card-title\">Needs Attention</div>\n <div class=\"in-card-sub\">Who and what to follow up on today</div>\n <div class=\"in-attention\">\n <div class=\"in-attention-item in-anim-row\" *ngFor=\"let a of attention; let i = index\" [style.animation-delay.ms]=\"300 + i * 80\">\n <div class=\"in-attention-value\" [class.in-zero]=\"a.value === 0\">{{ a.shown != null ? a.shown : a.value }}</div>\n <div>\n <div class=\"in-attention-label\">\n <span class=\"in-inline-icon\" [ngSwitch]=\"a.icon\" aria-hidden=\"true\">\n <svg *ngSwitchCase=\"'teacher'\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"8\" r=\"4\" /><path d=\"M4 20c0-4 3.6-6 8-6s8 2 8 6\" /></svg>\n <svg *ngSwitchCase=\"'room'\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"3\" y=\"4\" width=\"18\" height=\"12\" rx=\"2\" /><path d=\"M12 16v4M8 20h8M7 9h6\" /></svg>\n <svg *ngSwitchCase=\"'clock'\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"9\" /><path d=\"M12 7v5l3 2\" /></svg>\n <svg *ngSwitchCase=\"'book'\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M4 5a2 2 0 0 1 2-2h13v16H6a2 2 0 0 0-2 2V5z\" /><path d=\"M4 19a2 2 0 0 1 2-2h13\" /></svg>\n </span>\n {{ a.label }}\n </div>\n <div class=\"in-muted\">{{ a.hint }}</div>\n </div>\n </div>\n </div>\n <!-- who to follow up: big tiles that shrink to slim bars when the lists open below (accordion) -->\n <div class=\"in-follow\" [class.in-follow-compact]=\"detailsOpen\">\n <button type=\"button\" class=\"in-follow-tile in-follow-teachers\" [attr.aria-expanded]=\"detailsOpen\" aria-controls=\"in-follow-details\" (click)=\"detailsOpen = !detailsOpen\">\n <span class=\"in-follow-icon\">\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"8\" r=\"4\" /><path d=\"M4 20c0-4 3.6-6 8-6s8 2 8 6\" /></svg>\n </span>\n <span class=\"in-follow-number\">{{ attention[0]?.shown != null ? attention[0].shown : inactiveTeachers.length }}</span>\n <span class=\"in-follow-label-big\">Teachers Not Active</span>\n <span class=\"in-muted\">of {{ eligibleCount }} eligible teachers</span>\n <span class=\"in-avatars\" *ngIf=\"inactiveTeachers.length\">\n <span class=\"in-avatar\" *ngFor=\"let name of inactiveTeachers.slice(0, 7)\" [title]=\"name\">{{ initials(name) }}</span>\n <span class=\"in-avatar in-avatar-more\" *ngIf=\"inactiveTeachers.length > 7\">+{{ inactiveTeachers.length - 7 }}</span>\n </span>\n </button>\n <button type=\"button\" class=\"in-follow-tile in-follow-rooms\" [attr.aria-expanded]=\"detailsOpen\" aria-controls=\"in-follow-details\" (click)=\"detailsOpen = !detailsOpen\">\n <span class=\"in-follow-icon\">\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"3\" y=\"4\" width=\"18\" height=\"12\" rx=\"2\" /><path d=\"M12 16v4M8 20h8M7 9h6\" /></svg>\n </span>\n <span class=\"in-follow-number\">{{ attention[1]?.shown != null ? attention[1].shown : idleRooms.length }}</span>\n <span class=\"in-follow-label-big\">Classrooms Not Used</span>\n <span class=\"in-muted\">of {{ classroomCount }} installed classrooms</span>\n <span class=\"in-room-chips\" *ngIf=\"idleRooms.length\">\n <span class=\"in-room-chip\" *ngFor=\"let room of idleRooms.slice(0, 6)\">{{ room }}</span>\n <span class=\"in-room-chip in-avatar-more\" *ngIf=\"idleRooms.length > 6\">+{{ idleRooms.length - 6 }}</span>\n </span>\n </button>\n </div>\n <div class=\"in-follow-details\" id=\"in-follow-details\" *ngIf=\"detailsOpen\">\n <ng-container *ngTemplateOutlet=\"followLists\"></ng-container>\n </div>\n <div class=\"in-follow-foot\" data-html2canvas-ignore=\"true\">\n <button type=\"button\" class=\"in-link-btn\" [attr.aria-expanded]=\"detailsOpen\" aria-controls=\"in-follow-details\" (click)=\"detailsOpen = !detailsOpen\">\n {{ detailsOpen ? 'Hide details' : 'Show details' }}\n <span class=\"in-link-chevron\" [class.in-link-chevron-up]=\"detailsOpen\" aria-hidden=\"true\"></span>\n </button>\n </div>\n <!-- the PDF can't open a modal, so it prints the full lists here instead -->\n <div class=\"in-print-only\">\n <ng-container *ngTemplateOutlet=\"followLists\"></ng-container>\n </div>\n </section>\n <section [style.animation-delay.ms]=\"180\" class=\"in-anim in-card\">\n <div class=\"in-card-title\">Most Active Teachers</div>\n <div class=\"in-card-sub\">Time in class, overlapping sessions counted once</div>\n <ng-container *ngTemplateOutlet=\"bars; context: { $implicit: topTeachers, color: '#8BC34A' }\"></ng-container>\n </section>\n </div>\n\n <!-- supporting detail -->\n <div class=\"in-grid\">\n <section [style.animation-delay.ms]=\"240\" class=\"in-anim in-card\">\n <div class=\"in-card-title\">Activity Through the Day</div>\n <div class=\"in-card-sub\">Number of teachers in a session during each hour</div>\n <div class=\"in-hours\">\n <div class=\"in-hour\" *ngFor=\"let h of hourly; let i = index\" [title]=\"h.label + ': ' + h.value + ' teachers'\">\n <div class=\"in-hour-value\">\n <svg class=\"in-hour-icon\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><circle cx=\"12\" cy=\"8\" r=\"4\" /><path d=\"M4 20c0-4 3.6-6 8-6s8 2 8 6\" /></svg>\n {{ h.value }}\n </div>\n <div class=\"in-hour-track\">\n <div class=\"in-hour-bar\" [class.in-peak]=\"h.peak\" [style.height.%]=\"h.percent\" [style.background-color]=\"h.color\" [style.animation-delay.ms]=\"250 + i * 50\"></div>\n </div>\n <div class=\"in-hour-label\">{{ h.label }}</div>\n </div>\n </div>\n <div class=\"in-util-legend\">\n <span class=\"in-muted\">Low</span>\n <span class=\"in-util-scale\"></span>\n <span class=\"in-muted\">High</span>\n </div>\n </section>\n <section [style.animation-delay.ms]=\"300\" class=\"in-anim in-card\">\n <div class=\"in-card-title\">Most Used Chapters</div>\n <div class=\"in-card-sub\">Chapters and their topics used today</div>\n <ng-container *ngTemplateOutlet=\"bars; context: { $implicit: chapters, color: '#f4a98a' }\"></ng-container>\n </section>\n <section [style.animation-delay.ms]=\"360\" class=\"in-anim in-card\">\n <div class=\"in-card-title\">Content Utilisation</div>\n <div class=\"in-card-sub\">What teachers used in class</div>\n <div class=\"in-stack\">\n <div\n class=\"in-stack-part\"\n *ngFor=\"let c of contentMix; let i = index\"\n [style.animation-delay.ms]=\"300 + i * 60\"\n [style.width.%]=\"c.percent\"\n [style.background-color]=\"c.color\"\n [title]=\"c.label + ': ' + c.display\"\n ></div>\n </div>\n <div class=\"in-legend\">\n <div class=\"in-legend-item\" *ngFor=\"let c of contentMix\">\n <span class=\"in-dot\" [style.background-color]=\"c.color\"></span>\n <span class=\"in-legend-label\">{{ c.label }}</span>\n <span class=\"in-legend-value\">{{ c.display }}</span>\n </div>\n </div>\n </section>\n </div>\n\n <!-- what was taught, and where -->\n <div class=\"in-grid\">\n <section [style.animation-delay.ms]=\"420\" class=\"in-anim in-card\">\n <div class=\"in-card-title\">Time by Subject</div>\n <div class=\"in-card-sub\">Share of session time by subject</div>\n <div class=\"in-donut-wrap\">\n <svg class=\"in-donut\" viewBox=\"0 0 140 140\" role=\"img\" aria-label=\"Time by subject\">\n <circle cx=\"70\" cy=\"70\" [attr.r]=\"donutRadius\" class=\"in-donut-track\"></circle>\n <circle\n *ngFor=\"let s of subjectDonut.segments; let i = index\"\n class=\"in-donut-seg\"\n cx=\"70\"\n cy=\"70\"\n [attr.r]=\"donutRadius\"\n [attr.stroke]=\"s.color\"\n [attr.stroke-dasharray]=\"s.dash\"\n [attr.stroke-dashoffset]=\"s.offset\"\n [style.animation-delay.ms]=\"300 + i * 90\"\n >\n <title>{{ s.label }}: {{ s.display }} ({{ s.percent }}%)</title>\n </circle>\n </svg>\n <div class=\"in-donut-center\">\n <div class=\"in-donut-total\">{{ subjectDonut.total }}</div>\n <div class=\"in-muted\" title=\"Session time where content was used\">with content</div>\n </div>\n </div>\n <div class=\"in-legend in-legend-compact\">\n <div class=\"in-legend-item\" *ngFor=\"let s of subjectDonut.segments\">\n <span class=\"in-dot\" [style.background-color]=\"s.color\"></span>\n <span class=\"in-legend-label\" [title]=\"s.label\">{{ s.label }}</span>\n <span class=\"in-legend-value\">{{ s.percent }}%</span>\n </div>\n </div>\n </section>\n <section [style.animation-delay.ms]=\"480\" class=\"in-anim in-card\">\n <div class=\"in-card-title\">Classroom Usage</div>\n <div class=\"in-card-sub\">Each classroom's utilisation by time</div>\n <div class=\"in-tiles\">\n <div\n class=\"in-tile\"\n *ngFor=\"let r of roomTiles; let i = index\"\n [class.in-tile-idle]=\"r.idle\"\n [class.in-tile-dark]=\"r.dark\"\n [style.grid-column]=\"'span ' + r.span\"\n [style.background-color]=\"r.shade\"\n [style.animation-delay.ms]=\"300 + i * 15\"\n [title]=\"r.label + ': ' + r.display\"\n >\n <span class=\"in-tile-name\">\n <svg class=\"in-tile-icon\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><rect x=\"3\" y=\"4\" width=\"18\" height=\"12\" rx=\"2\" /><path d=\"M12 16v4M8 20h8\" /></svg>{{ r.label }}\n </span>\n <span class=\"in-tile-value\">{{ r.share }}%</span>\n </div>\n </div>\n <div class=\"in-tiles-legend\">\n <span class=\"in-tile in-tile-key in-tile-idle\"></span><span class=\"in-muted\">0% / not used</span>\n <span class=\"in-scale\"></span><span class=\"in-muted\">Low \u2192 high utilisation</span>\n </div>\n </section>\n <section [style.animation-delay.ms]=\"540\" class=\"in-anim in-card\">\n <div class=\"in-card-title\">Time by Class</div>\n <div class=\"in-card-sub\">Session time per class</div>\n <div class=\"in-columns\">\n <div class=\"in-column\" *ngFor=\"let g of gradeColumns; let i = index\" [title]=\"g.label + ': ' + g.display\">\n <div class=\"in-column-track\">\n <div class=\"in-column-bar\" [style.height.%]=\"g.percent\" [style.animation-delay.ms]=\"300 + i * 50\"></div>\n </div>\n <div class=\"in-column-label\">{{ g.short }}</div>\n </div>\n </div>\n <div class=\"in-columns-caption\">Class</div>\n <div class=\"in-column-top\" *ngIf=\"gradeColumns.length\">\n <span class=\"in-muted\">Most time</span>\n <ng-container *ngFor=\"let g of gradeColumns\">\n <strong *ngIf=\"g.percent === 100\">{{ g.label }} \u00B7 {{ g.display }}</strong>\n </ng-container>\n </div>\n </section>\n </div>\n </ng-container>\n\n</div>\n\n<ng-template #followLists>\n <div class=\"in-follow-cols\">\n <div class=\"in-follow-col\">\n <div class=\"in-follow-label\">Teachers Not Active <span class=\"in-count\">{{ inactiveTeachers.length }}</span></div>\n <ul class=\"in-name-list\" *ngIf=\"inactiveTeachers.length\">\n <li *ngFor=\"let name of inactiveTeachers\">{{ name }}</li>\n </ul>\n <span class=\"in-muted\" *ngIf=\"inactiveTeachers.length === 0\">Every eligible teacher used the system today.</span>\n </div>\n <div class=\"in-follow-col\">\n <div class=\"in-follow-label\">Classrooms Not Used <span class=\"in-count\">{{ idleRooms.length }}</span></div>\n <ul class=\"in-name-list in-room-list\" *ngIf=\"idleRooms.length\">\n <li *ngFor=\"let room of idleRooms\">{{ room }}</li>\n </ul>\n <span class=\"in-muted\" *ngIf=\"idleRooms.length === 0\">Every classroom was used today.</span>\n </div>\n </div>\n</ng-template>\n\n<!-- each section passes its own bar colour so neighbouring cards are easy to tell apart -->\n<ng-template #bars let-items let-color=\"color\">\n <div class=\"in-bars\">\n <div class=\"in-muted\" *ngIf=\"items.length === 0\">No data</div>\n <div class=\"in-bar-row\" *ngFor=\"let item of items; let i = index\">\n <div class=\"in-bar-head\">\n <span class=\"in-bar-label\" [title]=\"item.label\">{{ item.label }}</span>\n <span class=\"in-bar-value\">{{ item.display }}</span>\n </div>\n <div class=\"in-bar-sub\" *ngIf=\"item.sub\">{{ item.sub }}</div>\n <div class=\"in-bar-track\"><div class=\"in-bar-fill\" [style.width.%]=\"item.percent\" [style.background-color]=\"color\" [style.animation-delay.ms]=\"300 + i * 60\"></div></div>\n </div>\n </div>\n</ng-template>\n",
|
|
4492
|
+
styles: ["@import url(\"https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap\");.in-page{font-family:Poppins,Segoe UI,Arial,sans-serif;font-size:13px;color:#1e2437;padding:0 20px 24px;box-sizing:border-box;text-align:left;overflow-y:auto;background:#eef2f9}.in-sticky{position:sticky;top:0;z-index:2;margin:0 -20px 16px;padding:16px 20px;background:#eef2f9;box-shadow:0 6px 12px -10px rgba(30,36,55,.25)}.in-heading{position:relative;margin-bottom:14px;min-height:34px;display:flex;align-items:center;justify-content:center}.in-heading-text{font-size:17px;font-weight:600;color:#1e2437;text-align:center;padding:0 150px}.in-pdf-btn{position:absolute;right:0;top:50%;transform:translateY(-50%);height:34px;padding:0 16px;border:none;border-radius:10px;background:#5b84ec;color:#fff;font:500 13px Poppins,Segoe UI,Arial,sans-serif;cursor:pointer;box-shadow:0 4px 10px rgba(91,132,236,.22)}.in-pdf-btn:hover:not([disabled]){background:#406fe9}.in-pdf-btn[disabled]{cursor:progress;background:#b3c6f5;box-shadow:none}.in-page.in-exporting{height:auto!important;overflow:visible}.in-page.in-exporting *,.in-page.in-exporting :after,.in-page.in-exporting :before{-webkit-animation:none!important;animation:none!important}.in-page.in-exporting .in-sticky{position:static;box-shadow:none}.in-page.in-exporting .in-chips{max-height:none;overflow:visible}.in-page.in-exporting .in-print-only{display:block}.in-page.in-exporting .in-follow-details{display:none}.in-card-sub,.in-muted{font-size:12px;color:#8a93a6}.in-empty{padding:40px;text-align:center;color:#8a93a6}.in-kpis{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:12px}.in-kpi{position:relative;min-width:0;padding:12px 14px;border-radius:14px;background:#fff;box-shadow:0 1px 3px rgba(30,36,55,.06);color:#1e2437;box-sizing:border-box}.in-kpi.in-kpi-accent{background:#5b84ec;color:#fff}.in-kpi.in-kpi-accent .in-kpi-hint,.in-kpi.in-kpi-accent .in-kpi-label{color:hsla(0,0%,100%,.85)}.in-kpi.in-kpi-accent .in-kpi-icon{border-color:#fff;color:#fff}.in-kpi-icon{position:absolute;top:12px;right:12px;width:20px;height:20px;border:2px solid #1e2437;border-radius:50%;box-sizing:border-box;display:flex;align-items:center;justify-content:center;color:#1e2437}.in-kpi-icon svg{width:10px;height:10px}.in-kpi-label{padding-right:24px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:12px;font-weight:500;color:rgba(30,36,55,.75)}.in-kpi-value{white-space:nowrap;font-size:22px;font-weight:700;margin:2px 0;font-variant-numeric:tabular-nums}.in-kpi-hint{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:11px;color:rgba(30,36,55,.7)}.in-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}.in-grid+.in-grid{margin-top:16px}.in-card{background:#fff;border-radius:16px;box-shadow:0 1px 3px rgba(30,36,55,.06);padding:18px 20px;min-width:0;box-sizing:border-box}.in-card,.in-wide{display:flex;flex-direction:column}.in-wide{grid-column:span 2}.in-card-title{font-size:16px;font-weight:600;color:#1e2437}.in-card-sub{margin:2px 0 16px}.in-count{display:inline-block;min-width:22px;padding:0 8px;margin-left:6px;border-radius:11px;background:#fff6de;color:#a46b00;font-size:12px;font-weight:600;text-align:center;line-height:22px;vertical-align:middle}.in-hours{flex:1 1 auto;display:flex;align-items:stretch;gap:4px;min-height:200px;max-height:320px}.in-hour{flex:1 1 0;flex-direction:column;min-width:0}.in-hour,.in-hour-value{display:flex;align-items:center}.in-hour-value{gap:3px;font-size:12px;font-weight:600;color:#1e2437;margin-bottom:6px;white-space:nowrap}.in-hour-icon{width:12px;height:12px;color:#8a93a6;flex:0 0 auto}.in-hour-track{flex:1 1 auto;max-width:44px;display:flex;align-items:flex-end;background:#f1f4f9;overflow:hidden}.in-hour-bar,.in-hour-track{width:100%;border-radius:999px}.in-hour-bar{min-height:6px;background:#fbe0a0}.in-util-legend{display:flex;align-items:center;justify-content:center;gap:8px;margin-top:12px}.in-util-scale{width:90px;height:8px;border-radius:999px;background:linear-gradient(90deg,#f38e86,#f5c447,#92c15c)}.in-hour-label{margin-top:8px;font-size:10px;color:#8a93a6;white-space:nowrap}.in-bars{display:flex;flex-direction:column;gap:12px}.in-bar-head{display:flex;justify-content:space-between;gap:12px}.in-bar-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500}.in-bar-value{flex:0 0 auto;color:#1e2437;font-weight:600;font-variant-numeric:tabular-nums}.in-bar-sub{font-size:11px;color:#8a93a6}.in-bar-track{height:8px;margin-top:6px;background:#f1f4f9;border-radius:999px;overflow:hidden}.in-bar-fill{height:100%;border-radius:999px;background:#5b84ec}.in-donut-wrap{position:relative;width:150px;height:150px;margin:0 auto 14px}.in-donut{width:100%;height:100%;transform:rotate(-90deg)}.in-donut circle{fill:none;stroke-width:18}.in-donut-track{stroke:#f1f4f9}.in-donut-seg{stroke-linecap:butt;transition:stroke-width .15s;-webkit-animation:in-draw 1s cubic-bezier(.22,1,.36,1) both;animation:in-draw 1s cubic-bezier(.22,1,.36,1) both}.in-donut-seg:hover{stroke-width:22}@-webkit-keyframes in-draw{0%{stroke-dasharray:0 400}}@keyframes in-draw{0%{stroke-dasharray:0 400}}.in-donut-center{position:absolute;inset:0;top:0;left:0;right:0;bottom:0;display:flex;flex-direction:column;align-items:center;justify-content:center;pointer-events:none}.in-donut-total{font-size:18px;font-weight:700}.in-legend-compact{gap:6px}.in-legend-compact .in-legend-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.in-columns{flex:1 1 auto;display:flex;align-items:stretch;gap:5px;min-height:180px;max-height:340px}.in-column{flex:1 1 0;min-width:0;display:flex;flex-direction:column;align-items:center}.in-column-track{flex:1 1 auto;width:100%;max-width:22px;display:flex;align-items:flex-end;background:#f1f4f9;border-radius:999px;overflow:hidden}.in-column-bar{width:100%;min-height:4px;border-radius:999px;background:#f3cb6c;-webkit-animation:in-grow-height .8s cubic-bezier(.22,1,.36,1) both;animation:in-grow-height .8s cubic-bezier(.22,1,.36,1) both}.in-column:hover .in-column-bar{background:#f0be46}.in-column-label{margin-top:6px;font-size:11px;font-weight:500;color:#8a93a6;white-space:nowrap}.in-columns-caption{text-align:center;font-size:11px;color:#8a93a6;margin-top:2px}.in-column-top{margin-top:14px;padding:10px 12px;border-radius:10px;background:#fff6de;display:flex;justify-content:space-between;gap:8px;font-size:12px}.in-tiles{display:grid;grid-auto-flow:row dense;grid-template-columns:repeat(auto-fill,minmax(58px,1fr));gap:8px}.in-tile{height:58px;border-radius:12px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;color:#162b57;cursor:default;-webkit-animation:in-pop .4s ease-out both;animation:in-pop .4s ease-out both;transition:transform .12s}.in-tile:hover{transform:scale(1.06)}.in-tile.in-tile-dark{color:#fff}.in-tile.in-tile-idle{background:#f4f7fd;border:2px solid #162b57;color:#162b57}@-webkit-keyframes in-pop{0%{opacity:0;transform:scale(.7)}}@keyframes in-pop{0%{opacity:0;transform:scale(.7)}}.in-tile-icon{width:13px;height:13px;margin-right:4px;vertical-align:-1px}.in-tile-name{max-width:100%;padding:0 4px;box-sizing:border-box;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:15px;font-weight:700}.in-tile-value{font-size:12px;font-weight:500;opacity:.85}.in-tiles-legend{display:flex;align-items:center;gap:6px;margin-top:14px;flex-wrap:wrap}.in-tiles-legend .in-tile-key{width:14px;height:14px;border-radius:4px;-webkit-animation:none;animation:none}.in-scale{width:46px;height:10px;margin-left:8px;border-radius:999px;background:linear-gradient(90deg,#eaf1fb,#162b57)}.in-primary .in-attention{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.in-primary .in-attention-item{gap:14px;padding:12px 14px}.in-primary .in-attention-value{flex:0 0 42px;height:42px;line-height:42px;border-radius:10px;background:#ef6a3a;color:#fff;font-size:16px}.in-primary .in-attention-value.in-zero{background:#8bc34a;color:#fff}.in-primary .in-attention-label{display:flex;align-items:center;gap:6px;font-size:14px}.in-primary .in-attention-item .in-muted{font-size:12px;margin-top:2px}.in-inline-icon{display:inline-flex;color:#ef6a3a}.in-inline-icon svg{width:16px;height:16px}.in-follow{flex:1 1 auto;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin-top:18px}.in-follow-tile{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;min-width:0;padding:18px 20px;border:none;border-radius:32px;font:inherit;color:inherit;text-align:center;cursor:pointer;transition:transform .15s,box-shadow .15s}.in-follow-tile:hover{transform:translateY(-2px);box-shadow:0 6px 16px rgba(30,36,55,.08)}.in-follow-teachers{background:#eaf0fd}.in-follow-teachers .in-follow-icon{color:#5b84ec}.in-follow-rooms{background:#eaf0fd}.in-follow-rooms .in-follow-icon{color:#5b84ec}.in-follow-icon{margin-bottom:6px;display:flex;align-items:center;justify-content:center}.in-follow-icon svg{width:40px;height:40px}.in-follow-number{font-size:34px;font-weight:700;line-height:1.1;font-variant-numeric:tabular-nums}.in-follow-tile>.in-muted{font-size:15px;color:#1e2437}.in-follow-label-big{font-size:18px;font-weight:600}.in-avatars{flex-wrap:wrap;margin-top:12px;padding-left:8px}.in-avatar,.in-avatars{display:flex;justify-content:center}.in-avatar{width:34px;height:34px;margin-left:-6px;border-radius:50%;border:1.5px solid #5b84ec;background:#fff;color:#3f5fae;font-size:11px;font-weight:600;align-items:center;box-sizing:border-box}.in-avatar-more{background:#5b84ec;color:#fff}.in-room-chips{flex-wrap:wrap;gap:6px;margin-top:12px}.in-room-chip,.in-room-chips{display:flex;justify-content:center}.in-room-chip{min-width:34px;height:34px;padding:0 10px;border-radius:999px;border:1.5px solid #5b84ec;background:#fff;color:#5b84ec;font-size:12px;font-weight:600;align-items:center;box-sizing:border-box}.in-room-chip.in-avatar-more{background:#5b84ec;color:#fff}.in-follow-foot{display:flex;justify-content:flex-end;margin-top:10px}.in-link-btn{border:none;background:transparent;padding:6px 4px;font:600 13px Poppins,Segoe UI,Arial,sans-serif;color:#5b84ec;cursor:pointer}.in-link-btn:hover{text-decoration:underline}.in-print-only{display:none;margin-top:16px}.in-follow-compact{flex:none}.in-follow-compact .in-follow-tile{flex-direction:row;justify-content:flex-start;gap:12px;padding:10px 16px;text-align:left}.in-follow-compact .in-follow-icon{margin:0}.in-follow-compact .in-follow-icon svg{width:24px;height:24px}.in-follow-compact .in-follow-number{font-size:22px}.in-follow-compact .in-avatars,.in-follow-compact .in-follow-tile>.in-muted,.in-follow-compact .in-room-chips{display:none}.in-follow-details{flex:none;margin-top:12px;padding:14px 16px;border:1px solid #eef1f6;border-radius:12px;-webkit-animation:in-rise .3s ease-out both;animation:in-rise .3s ease-out both}.in-link-chevron{display:inline-block;width:6px;height:6px;margin-left:6px;border-right:2px solid;border-bottom:2px solid;transform:rotate(45deg) translateY(-2px);transition:transform .2s}.in-link-chevron.in-link-chevron-up{transform:rotate(-135deg) translateY(-1px)}.in-follow-cols{display:grid;grid-template-columns:3fr 1fr;gap:24px}.in-follow-col{min-width:0}.in-follow-col+.in-follow-col{border-left:1px solid #e3e8f0;padding-left:24px}.in-follow-label{font-size:13px;font-weight:600;margin:2px 0 10px}.in-name-list{margin:0;padding:0;list-style:none;-moz-column-width:160px;column-width:160px;-moz-column-gap:20px;column-gap:20px}.in-name-list li{position:relative;padding:3px 0 3px 14px;-moz-column-break-inside:avoid;break-inside:avoid;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.in-name-list li:before{content:\"\";position:absolute;left:0;top:50%;width:6px;height:6px;margin-top:-3px;border-radius:50%;background:#a9bffa}.in-room-list li:before{background:#fbe0a0}.in-attention{display:flex;flex-direction:column;gap:10px}.in-attention-item{display:flex;align-items:center;gap:12px;padding:8px;border-radius:12px;background:#f7f9fc}.in-attention-value{flex:0 0 44px;height:40px;line-height:40px;text-align:center;border-radius:10px;background:#fbe0a0;color:#1e2437;font-size:16px;font-weight:700}.in-attention-value.in-zero{background:#eaf0fd;color:#5b84ec}.in-attention-label{font-weight:600}.in-stack{display:flex;height:14px;border-radius:999px;overflow:hidden;background:#f1f4f9;margin-bottom:16px}.in-stack-part{height:100%;box-shadow:inset -2px 0 0 #fff}.in-legend{display:flex;flex-direction:column;gap:8px}.in-legend-item{display:flex;align-items:center;gap:10px}.in-dot{flex:0 0 auto;width:10px;height:10px;border-radius:3px}.in-legend-label{flex:1 1 auto}.in-legend-value{font-weight:600;color:#1e2437;font-variant-numeric:tabular-nums}.in-chips{display:flex;flex-wrap:wrap;gap:8px;max-height:230px;overflow:auto}.in-chip{padding:5px 12px;border-radius:999px;background:#eaf0fd;color:#3f5fae;font-size:12px;font-weight:500}@-webkit-keyframes in-rise{0%{opacity:0;transform:translateY(14px)}}@keyframes in-rise{0%{opacity:0;transform:translateY(14px)}}@-webkit-keyframes in-fade-right{0%{opacity:0;transform:translateX(-10px)}}@keyframes in-fade-right{0%{opacity:0;transform:translateX(-10px)}}@-webkit-keyframes in-grow-width{0%{width:0}}@keyframes in-grow-width{0%{width:0}}@-webkit-keyframes in-grow-height{0%{height:0}}@keyframes in-grow-height{0%{height:0}}.in-anim{-webkit-animation:in-rise .5s cubic-bezier(.22,1,.36,1) both;animation:in-rise .5s cubic-bezier(.22,1,.36,1) both}.in-anim-row{-webkit-animation:in-fade-right .45s ease-out both;animation:in-fade-right .45s ease-out both}.in-bar-fill,.in-stack-part{-webkit-animation:in-grow-width .9s cubic-bezier(.22,1,.36,1) both;animation:in-grow-width .9s cubic-bezier(.22,1,.36,1) both}.in-hour-bar{-webkit-animation:in-grow-height .8s cubic-bezier(.22,1,.36,1) both;animation:in-grow-height .8s cubic-bezier(.22,1,.36,1) both}@media (prefers-reduced-motion:reduce){.in-anim,.in-anim-row,.in-bar-fill,.in-column-bar,.in-donut-seg,.in-hour-bar,.in-stack-part,.in-tile{-webkit-animation:none;animation:none}}@media (max-width:900px){.in-kpis{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (max-width:1100px){.in-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.in-grid>.in-card:last-child:nth-child(odd),.in-wide+.in-card{grid-column:span 2}}@media (max-width:760px){.in-heading-text{padding:0;text-align:left;flex:1 1 auto}.in-pdf-btn{position:static;transform:none}.in-grid>.in-card:last-child:nth-child(odd),.in-wide,.in-wide+.in-card{grid-column:auto}.in-follow,.in-follow-cols,.in-primary .in-attention{grid-template-columns:1fr}.in-follow-col+.in-follow-col{border-left:none;padding-left:0;border-top:1px solid #e3e8f0;padding-top:16px}.in-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.in-grid{grid-template-columns:1fr}}"]
|
|
4493
|
+
},] }
|
|
4494
|
+
];
|
|
4495
|
+
InsightsComponent.ctorParameters = function () { return [
|
|
4496
|
+
{ type: PrincipalDashboardLibV2Service },
|
|
4497
|
+
{ type: i0.ElementRef }
|
|
4498
|
+
]; };
|
|
4499
|
+
InsightsComponent.propDecorators = {
|
|
4500
|
+
data: [{ type: i0.Input }],
|
|
4501
|
+
fitHeight: [{ type: i0.HostListener, args: ['window:resize',] }],
|
|
4502
|
+
closeDetails: [{ type: i0.HostListener, args: ['document:keydown.escape',] }]
|
|
4503
|
+
};
|
|
4504
|
+
|
|
4505
|
+
var PrincipalDashboardLibV2Module = /** @class */ (function () {
|
|
4506
|
+
function PrincipalDashboardLibV2Module() {
|
|
4507
|
+
}
|
|
4508
|
+
return PrincipalDashboardLibV2Module;
|
|
4509
|
+
}());
|
|
4510
|
+
PrincipalDashboardLibV2Module.decorators = [
|
|
4511
|
+
{ type: i0.NgModule, args: [{
|
|
4512
|
+
declarations: [
|
|
4513
|
+
ChartheaderComponent,
|
|
4514
|
+
ChartviewComponent,
|
|
4515
|
+
DetailedviewComponent,
|
|
4516
|
+
HeaderComponent,
|
|
4517
|
+
TableviewComponent,
|
|
4518
|
+
PrincipalDashboardLibV2Component,
|
|
4519
|
+
FullTableViewComponent,
|
|
4520
|
+
SmallTableViewComponent,
|
|
4521
|
+
TimelineComponent,
|
|
4522
|
+
InsightsComponent
|
|
4523
|
+
],
|
|
4524
|
+
imports: [
|
|
4525
|
+
common.CommonModule,
|
|
4526
|
+
angularGoogleCharts.GoogleChartsModule,
|
|
4527
|
+
ng2Datepicker.DatepickerModule
|
|
4528
|
+
],
|
|
4529
|
+
exports: [
|
|
4530
|
+
PrincipalDashboardLibV2Component
|
|
4531
|
+
]
|
|
4532
|
+
},] }
|
|
4533
|
+
];
|
|
4534
|
+
|
|
4535
|
+
/*
|
|
4536
|
+
* Public API Surface of principal-dashboard-lib-v2
|
|
4537
|
+
*/
|
|
4538
|
+
|
|
4539
|
+
/**
|
|
4540
|
+
* Generated bundle index. Do not edit.
|
|
4541
|
+
*/
|
|
4542
|
+
|
|
4543
|
+
exports.PrincipalDashboardLibV2Component = PrincipalDashboardLibV2Component;
|
|
4544
|
+
exports.PrincipalDashboardLibV2Module = PrincipalDashboardLibV2Module;
|
|
4545
|
+
exports.PrincipalDashboardLibV2Service = PrincipalDashboardLibV2Service;
|
|
4546
|
+
exports.ɵa = ChartheaderComponent;
|
|
4547
|
+
exports.ɵb = ChartviewComponent;
|
|
4548
|
+
exports.ɵc = DetailedviewComponent;
|
|
4549
|
+
exports.ɵd = HeaderComponent;
|
|
4550
|
+
exports.ɵe = ExceldataService;
|
|
4551
|
+
exports.ɵf = TableviewComponent;
|
|
4552
|
+
exports.ɵg = FullTableViewComponent;
|
|
4553
|
+
exports.ɵh = SmallTableViewComponent;
|
|
4554
|
+
exports.ɵi = TimelineComponent;
|
|
4555
|
+
exports.ɵj = InsightsComponent;
|
|
4556
|
+
|
|
4557
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4558
|
+
|
|
4559
|
+
})));
|
|
4560
|
+
//# sourceMappingURL=principal-dashboard-lib-v2.umd.js.map
|