sf-i-events 1.0.740 → 1.0.741
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/package.json +1 -1
- package/sf-i-events.d.ts +4 -0
- package/sf-i-events.js +110 -13
- package/src/sf-i-events.ts +126 -14
- package/src/util.ts +6 -1
- package/util.d.ts +2 -0
- package/util.js +5 -1
package/package.json
CHANGED
package/sf-i-events.d.ts
CHANGED
|
@@ -186,6 +186,7 @@ export declare class SfIEvents extends LitElement {
|
|
|
186
186
|
events: any;
|
|
187
187
|
statistics: any;
|
|
188
188
|
statisticsMeta: any;
|
|
189
|
+
statisticsFiltersData: any;
|
|
189
190
|
streamIndex: any;
|
|
190
191
|
eventsInWindow: any;
|
|
191
192
|
eventHideFields: any;
|
|
@@ -452,6 +453,9 @@ export declare class SfIEvents extends LitElement {
|
|
|
452
453
|
renderCalendarContainerDivStart: (index: number) => string;
|
|
453
454
|
renderCalendarContainerDivEnd: () => string;
|
|
454
455
|
renderCalendarEventSummary: () => string;
|
|
456
|
+
renderStatisticsFiltersTableStart: () => string;
|
|
457
|
+
renderStatisticsFiltersTableRow: () => string;
|
|
458
|
+
renderStatisticsFiltersTableEnd: () => string;
|
|
455
459
|
getCalendarRowHide: (events: any, i: number, lastDay: number, month: number, firstDate?: any, currDate?: any) => boolean;
|
|
456
460
|
renderCalendarRowDivStart: (i: number, firstDate?: any, ddmm?: string) => string;
|
|
457
461
|
renderCalendarRowDivEnd: () => string;
|
package/sf-i-events.js
CHANGED
|
@@ -1110,6 +1110,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
1110
1110
|
this.events = null;
|
|
1111
1111
|
this.statistics = null;
|
|
1112
1112
|
this.statisticsMeta = null;
|
|
1113
|
+
this.statisticsFiltersData = null;
|
|
1113
1114
|
this.streamIndex = null;
|
|
1114
1115
|
this.eventsInWindow = null;
|
|
1115
1116
|
this.eventHideFields = null;
|
|
@@ -2192,6 +2193,30 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
2192
2193
|
html += '<div id="stream-event-filter" part="stream-event-total" class="d-flex flex-wrap"></div>';
|
|
2193
2194
|
return html;
|
|
2194
2195
|
};
|
|
2196
|
+
this.renderStatisticsFiltersTableStart = () => {
|
|
2197
|
+
var html = '';
|
|
2198
|
+
html += '<table id="statistics-table" part="statistics-table" class="statistics-table w-100"><tbody>';
|
|
2199
|
+
// html += '<table id="stream-filters-table" part="stream-filters-table" class="stream-filters-table"><thead><tr><td><div class="d-flex align-center justify-center"> </div></td><td><div class="d-flex align-center justify-center">Total</div></td><td><div class="d-flex align-center justify-center"><span class="material-icons color-not-started">schedule</span> Not Started</div></td><td><div class="d-flex align-center justify-center"><span class="material-symbols-outlined color-pending">pending</span> Pending Approval</div></td><td><div class="d-flex align-center justify-center"><span class="material-symbols-outlined color-rejected">block</span> Rejected</div></td><td><div class="d-flex align-center justify-center"><span class="material-symbols-outlined color-done">check_circle</span> Approved</div></td></tr></thead><tbody>';
|
|
2200
|
+
return html;
|
|
2201
|
+
};
|
|
2202
|
+
this.renderStatisticsFiltersTableRow = () => {
|
|
2203
|
+
var html = '';
|
|
2204
|
+
html += '<tr class="tablerow">';
|
|
2205
|
+
html += '<td part="td-body" class="td-body"><div class="d-flex align-center flex-wrap"><div part="td-head" class="pl-0-imp w-100 d-flex align-center">FILTER_CRITERIA_NAME</div><div>DASHBOARD_FILTER_NAME</div></div></td>';
|
|
2206
|
+
html += '<td part="td-body" class="td-body"><div class="d-flex align-center flex-wrap"><div part="td-head" class="pl-0-imp w-100 d-flex align-center"><span class="small-icon material-icons color-not-started">schedule</span> Not Started</div><div>DASHBOARD_NOT_STARTED</div></div></td>';
|
|
2207
|
+
html += '<td part="td-body" class="td-body"><div class="d-flex align-center flex-wrap"><div part="td-head" class="pl-0-imp w-100 d-flex align-center"><span class="small-icon material-symbols-outlined color-pending">pending</span> Pending Approval</div><div>DASHBOARD_PENDING_APPROVAL</div></div></td>';
|
|
2208
|
+
html += '<td part="td-body" class="td-body"><div class="d-flex align-center flex-wrap"><div part="td-head" class="pl-0-imp w-100 d-flex align-center"><span class="small-icon material-symbols-outlined color-rejected">block</span> Rejected</div><div>DASHBOARD_REJECTED</div></div></td>';
|
|
2209
|
+
html += '<td part="td-body" class="td-body"><div class="d-flex align-center flex-wrap"><div part="td-head" class="pl-0-imp w-100 d-flex align-center"><span class="small-icon material-symbols-outlined color-done">check_circle</span> Approved</div><div>DASHBOARD_APPROVED</div></div></td>';
|
|
2210
|
+
html += '<td part="td-body" class="td-body"><div class="d-flex align-center flex-wrap"><div part="td-head" class="pl-0-imp w-100 d-flex align-center">Total</div><div>DASHBOARD_TOTAL</div></div></td>';
|
|
2211
|
+
html += '</tr>';
|
|
2212
|
+
// html += '<tr class="tablerow"><td part="td-body" class="td-body"><span>DASHBOARD_FILTER_NAME</span></td><td><span>DASHBOARD_TOTAL</span></td><td><span>DASHBOARD_NOT_STARTED</span></td><td><span>DASHBOARD_PENDING_APPROVAL</span></td><td><span>DASHBOARD_REJECTED</span></td><td><span>DASHBOARD_APPROVED</span></td></tr>';
|
|
2213
|
+
return html;
|
|
2214
|
+
};
|
|
2215
|
+
this.renderStatisticsFiltersTableEnd = () => {
|
|
2216
|
+
var html = '';
|
|
2217
|
+
html += '</tbody></table>';
|
|
2218
|
+
return html;
|
|
2219
|
+
};
|
|
2195
2220
|
this.getCalendarRowHide = (events, i, lastDay, month, firstDate = null, currDate = null) => {
|
|
2196
2221
|
var hide = true;
|
|
2197
2222
|
if (events != null) {
|
|
@@ -2726,7 +2751,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
2726
2751
|
return html;
|
|
2727
2752
|
};
|
|
2728
2753
|
this.renderStatistics = (_firstDay, _endDay, iInit, iLast, showGraph, index, month, period, firstDate = null, parametersTitle) => {
|
|
2729
|
-
var _a, _b, _c, _f;
|
|
2754
|
+
var _a, _b, _c, _f, _g, _h, _j, _k;
|
|
2730
2755
|
var total = 0, notStarted = 0, approved = 0, pendingApproval = 0, rejected = 0;
|
|
2731
2756
|
var html = '';
|
|
2732
2757
|
// var lastDay = iLast;
|
|
@@ -2737,6 +2762,10 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
2737
2762
|
html += this.renderCalendarStatisticsGraphs(showGraph, parametersTitle);
|
|
2738
2763
|
html += this.renderCalendarContainerDivStart(index);
|
|
2739
2764
|
html += this.renderCalendarEventSummary();
|
|
2765
|
+
let filtersTableHtml = "";
|
|
2766
|
+
if (Object.keys(this.statisticsFiltersData).length > 0) {
|
|
2767
|
+
filtersTableHtml += this.renderStatisticsFiltersTableStart();
|
|
2768
|
+
}
|
|
2740
2769
|
for (var i = iInit; i <= iLast; i++) {
|
|
2741
2770
|
let mmdd = "";
|
|
2742
2771
|
if (firstDate == null) {
|
|
@@ -2766,6 +2795,50 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
2766
2795
|
approved += (_f = this.statistics[mmdd]["approved"]) !== null && _f !== void 0 ? _f : 0;
|
|
2767
2796
|
}
|
|
2768
2797
|
}
|
|
2798
|
+
for (let filtercriteria of Object.keys(this.statisticsFiltersData)) {
|
|
2799
|
+
for (let filterid of Object.keys(this.statisticsFiltersData[filtercriteria])) {
|
|
2800
|
+
let filtername = "";
|
|
2801
|
+
for (let filterval of this.statisticsMeta[filtercriteria]) {
|
|
2802
|
+
if (filterval.indexOf(filterid) >= 0) {
|
|
2803
|
+
filtername = filterval.split(';')[0];
|
|
2804
|
+
break;
|
|
2805
|
+
}
|
|
2806
|
+
}
|
|
2807
|
+
let filterTotal = 0, filterNotStarted = 0, filterPendingApproval = 0, filterRejected = 0, filterApproved = 0;
|
|
2808
|
+
for (var i = iInit; i <= iLast; i++) {
|
|
2809
|
+
let mmdd = "";
|
|
2810
|
+
if (firstDate == null) {
|
|
2811
|
+
mmdd = ("0" + (month + 1)).slice(-2) + "/" + ("0" + i).slice(-2);
|
|
2812
|
+
}
|
|
2813
|
+
else {
|
|
2814
|
+
const currDate = new Date(firstDate.getTime());
|
|
2815
|
+
currDate.setDate(firstDate.getDate() + (i - 1));
|
|
2816
|
+
mmdd = ("0" + (currDate.getMonth() + 1)).slice(-2) + "/" + ("0" + currDate.getDate()).slice(-2);
|
|
2817
|
+
}
|
|
2818
|
+
if (this.statisticsFiltersData[filtercriteria][filterid] != null) {
|
|
2819
|
+
if (this.statisticsFiltersData[filtercriteria][filterid][mmdd] != null) {
|
|
2820
|
+
filterTotal += this.statisticsFiltersData[filtercriteria][filterid][mmdd].count;
|
|
2821
|
+
filterNotStarted += (_g = this.statisticsFiltersData[filtercriteria][filterid][mmdd]['not-started']) !== null && _g !== void 0 ? _g : 0;
|
|
2822
|
+
filterPendingApproval += (_h = this.statisticsFiltersData[filtercriteria][filterid][mmdd]['pending-approval']) !== null && _h !== void 0 ? _h : 0;
|
|
2823
|
+
filterRejected += (_j = this.statisticsFiltersData[filtercriteria][filterid][mmdd]['rejected']) !== null && _j !== void 0 ? _j : 0;
|
|
2824
|
+
filterApproved += (_k = this.statisticsFiltersData[filtercriteria][filterid][mmdd]['approved']) !== null && _k !== void 0 ? _k : 0;
|
|
2825
|
+
}
|
|
2826
|
+
}
|
|
2827
|
+
}
|
|
2828
|
+
filtersTableHtml += this.renderStatisticsFiltersTableRow();
|
|
2829
|
+
filtersTableHtml = filtersTableHtml.replace("FILTER_CRITERIA_NAME", filtercriteria + "");
|
|
2830
|
+
filtersTableHtml = filtersTableHtml.replace("DASHBOARD_FILTER_NAME", (filtername + "").replace(/\([^)]*\)/g, ""));
|
|
2831
|
+
filtersTableHtml = filtersTableHtml.replace("DASHBOARD_TOTAL", filterTotal + "");
|
|
2832
|
+
filtersTableHtml = filtersTableHtml.replace("DASHBOARD_NOT_STARTED", filterNotStarted + " (" + Util.percentageString(filterNotStarted, filterTotal) + ")");
|
|
2833
|
+
filtersTableHtml = filtersTableHtml.replace("DASHBOARD_APPROVED", filterApproved + " (" + Util.percentageString(filterApproved, filterTotal) + ")");
|
|
2834
|
+
filtersTableHtml = filtersTableHtml.replace("DASHBOARD_PENDING_APPROVAL", filterPendingApproval + " (" + Util.percentageString(filterPendingApproval, filterTotal) + ")");
|
|
2835
|
+
filtersTableHtml = filtersTableHtml.replace("DASHBOARD_REJECTED", filterRejected + " (" + Util.percentageString(filterRejected, filterTotal) + ")");
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
if (Object.keys(this.statisticsFiltersData).length > 0) {
|
|
2839
|
+
filtersTableHtml += this.renderStatisticsFiltersTableEnd();
|
|
2840
|
+
}
|
|
2841
|
+
html += filtersTableHtml;
|
|
2769
2842
|
html += this.renderCalendarContainerDivEnd();
|
|
2770
2843
|
//console.log('final risk severities', this.riskSeverityData);
|
|
2771
2844
|
//this.period = firstDay?.getDate() + '/' + (firstDay!.getMonth()+1) + '/' + firstDay?.getFullYear() + " - " + endDay?.getDate() + '/' + (endDay!.getMonth()+1) + '/' + endDay?.getFullYear();
|
|
@@ -4099,6 +4172,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
4099
4172
|
});
|
|
4100
4173
|
};
|
|
4101
4174
|
this.renderStatisticsFilters = (eventsContainer) => {
|
|
4175
|
+
var _a;
|
|
4102
4176
|
let selectFilterCriteria = eventsContainer.querySelector('#select-filter-criteria');
|
|
4103
4177
|
let inputLabelFilter = eventsContainer.querySelector('#input-label-filter');
|
|
4104
4178
|
let selectFilterCriteriaMobile = eventsContainer.querySelector('#select-filter-criteria-mobile');
|
|
@@ -4117,10 +4191,15 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
4117
4191
|
option.value = "";
|
|
4118
4192
|
option.innerHTML = "all";
|
|
4119
4193
|
selectFilterCriteriaMobile.add(option);
|
|
4120
|
-
|
|
4194
|
+
let filterscriteria = "";
|
|
4195
|
+
if (Object.keys((_a = this.statisticsFiltersData) !== null && _a !== void 0 ? _a : {}).length > 0) {
|
|
4196
|
+
filterscriteria = Object.keys(this.statisticsFiltersData)[0];
|
|
4197
|
+
}
|
|
4121
4198
|
for (let criteria of Object.keys(this.statisticsMeta)) {
|
|
4122
4199
|
let option = new Option();
|
|
4123
4200
|
option.value = criteria;
|
|
4201
|
+
console.log('statistics filters criteria', criteria, filterscriteria, criteria == filterscriteria);
|
|
4202
|
+
option.selected = (criteria == filterscriteria);
|
|
4124
4203
|
if (criteria == "reporter" || criteria == "approver" || criteria == "functionhead") {
|
|
4125
4204
|
option.innerHTML = "user:" + criteria;
|
|
4126
4205
|
}
|
|
@@ -4130,6 +4209,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
4130
4209
|
selectFilterCriteria.add(option);
|
|
4131
4210
|
option = new Option();
|
|
4132
4211
|
option.value = criteria;
|
|
4212
|
+
option.selected = (criteria == filterscriteria);
|
|
4133
4213
|
if (criteria == "reporter" || criteria == "approver" || criteria == "functionhead") {
|
|
4134
4214
|
option.innerHTML = "user:" + criteria;
|
|
4135
4215
|
}
|
|
@@ -4143,10 +4223,10 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
4143
4223
|
let target = ev.target;
|
|
4144
4224
|
let inputLabelCriteria = eventsContainer.querySelector('#input-label-criteria');
|
|
4145
4225
|
let selectFilterValues = eventsContainer.querySelector('#select-filter-values');
|
|
4146
|
-
if
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
}
|
|
4226
|
+
// if(target.value == ""){
|
|
4227
|
+
selectFilterValues.value = "";
|
|
4228
|
+
this.processDateSelectionViewer(eventsContainer);
|
|
4229
|
+
// }
|
|
4150
4230
|
selectFilterValues.innerHTML = "";
|
|
4151
4231
|
let option = new Option();
|
|
4152
4232
|
option.value = "";
|
|
@@ -4210,14 +4290,24 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
4210
4290
|
inputLabelCriteriaMobile.style.display = 'none';
|
|
4211
4291
|
}
|
|
4212
4292
|
});
|
|
4293
|
+
selectFilterCriteriaNew.value = filterscriteria;
|
|
4294
|
+
selectFilterCriteriaMobileNew.value = filterscriteria;
|
|
4213
4295
|
let selectFilterValues = eventsContainer.querySelector('#select-filter-values');
|
|
4214
4296
|
let inputLabelCriteria = eventsContainer.querySelector('#input-label-criteria');
|
|
4215
4297
|
let selectFilterValuesMobile = eventsContainer.querySelector('#select-filter-values-mobile');
|
|
4216
4298
|
let inputLabelCriteriaMobile = eventsContainer.querySelector('#input-label-criteria-mobile');
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4299
|
+
if (filterscriteria == "") {
|
|
4300
|
+
selectFilterValues.style.display = 'none';
|
|
4301
|
+
inputLabelCriteria.style.display = 'none';
|
|
4302
|
+
selectFilterValuesMobile.style.display = 'none';
|
|
4303
|
+
inputLabelCriteriaMobile.style.display = 'none';
|
|
4304
|
+
}
|
|
4305
|
+
else {
|
|
4306
|
+
selectFilterValues.style.display = 'block';
|
|
4307
|
+
inputLabelCriteria.style.display = 'block';
|
|
4308
|
+
selectFilterValuesMobile.style.display = 'block';
|
|
4309
|
+
inputLabelCriteriaMobile.style.display = 'block';
|
|
4310
|
+
}
|
|
4221
4311
|
};
|
|
4222
4312
|
this.renderSelectAllButtons = () => {
|
|
4223
4313
|
let selectAllHtml = '<div class="d-flex justify-end w-100" style="position: fixed; bottom: 70px; left: 0px;" part="button-select-all-container">';
|
|
@@ -16421,6 +16511,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
16421
16511
|
}
|
|
16422
16512
|
};
|
|
16423
16513
|
this.fetchStatistics = async (startDate = "", endDate = "", filtercriteria, filterid) => {
|
|
16514
|
+
var _a;
|
|
16424
16515
|
let path = "";
|
|
16425
16516
|
this.sdate = startDate;
|
|
16426
16517
|
this.edate = endDate;
|
|
@@ -16438,7 +16529,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
16438
16529
|
}
|
|
16439
16530
|
let url = "https://" + this.apiId + "/" + path;
|
|
16440
16531
|
//console.log('fetch calendar url', url);
|
|
16441
|
-
let urlBody = { "projectid": this.projectId, "userid": this.userProfileId, "role": this.myRole, "sdate": sDate, "edate": eDate };
|
|
16532
|
+
let urlBody = { "projectid": this.projectId, "userid": this.userProfileId, "role": this.myRole, "sdate": sDate, "edate": eDate, "filtercriteria": filtercriteria };
|
|
16442
16533
|
if (filtercriteria == 'function') {
|
|
16443
16534
|
urlBody["functionid"] = filterid;
|
|
16444
16535
|
urlBody["locationid"] = '';
|
|
@@ -16467,6 +16558,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
16467
16558
|
this.statistics = jsonRespose.data;
|
|
16468
16559
|
this.lastupdated = new Date(jsonRespose.lastupdated).toLocaleDateString('en-IN') + " - " + new Date(jsonRespose.lastupdated).toLocaleTimeString('en-IN');
|
|
16469
16560
|
console.log('statistics date', this.lastupdated);
|
|
16561
|
+
this.statisticsFiltersData = (_a = jsonRespose.filtersdata) !== null && _a !== void 0 ? _a : {};
|
|
16470
16562
|
if (jsonRespose.meta != null)
|
|
16471
16563
|
this.statisticsMeta = jsonRespose.meta;
|
|
16472
16564
|
return jsonRespose.meta;
|
|
@@ -19311,10 +19403,12 @@ SfIEvents.styles = css `
|
|
|
19311
19403
|
display: none;
|
|
19312
19404
|
position: fixed;
|
|
19313
19405
|
bottom: 10px;
|
|
19314
|
-
|
|
19406
|
+
left: 10px
|
|
19315
19407
|
}
|
|
19316
19408
|
|
|
19317
|
-
|
|
19409
|
+
.small-icon {
|
|
19410
|
+
font-size: 98%
|
|
19411
|
+
}
|
|
19318
19412
|
`;
|
|
19319
19413
|
__decorate([
|
|
19320
19414
|
query('#decrypt-container')
|
|
@@ -19529,6 +19623,9 @@ __decorate([
|
|
|
19529
19623
|
__decorate([
|
|
19530
19624
|
property()
|
|
19531
19625
|
], SfIEvents.prototype, "statisticsMeta", void 0);
|
|
19626
|
+
__decorate([
|
|
19627
|
+
property()
|
|
19628
|
+
], SfIEvents.prototype, "statisticsFiltersData", void 0);
|
|
19532
19629
|
__decorate([
|
|
19533
19630
|
property()
|
|
19534
19631
|
], SfIEvents.prototype, "streamIndex", void 0);
|
package/src/sf-i-events.ts
CHANGED
|
@@ -1346,6 +1346,9 @@ export class SfIEvents extends LitElement {
|
|
|
1346
1346
|
@property()
|
|
1347
1347
|
statisticsMeta: any = null;
|
|
1348
1348
|
|
|
1349
|
+
@property()
|
|
1350
|
+
statisticsFiltersData: any = null;
|
|
1351
|
+
|
|
1349
1352
|
@property()
|
|
1350
1353
|
streamIndex: any = null;
|
|
1351
1354
|
|
|
@@ -2636,10 +2639,12 @@ export class SfIEvents extends LitElement {
|
|
|
2636
2639
|
display: none;
|
|
2637
2640
|
position: fixed;
|
|
2638
2641
|
bottom: 10px;
|
|
2639
|
-
|
|
2642
|
+
left: 10px
|
|
2640
2643
|
}
|
|
2641
2644
|
|
|
2642
|
-
|
|
2645
|
+
.small-icon {
|
|
2646
|
+
font-size: 98%
|
|
2647
|
+
}
|
|
2643
2648
|
`;
|
|
2644
2649
|
|
|
2645
2650
|
@query('.SfIEventsC')
|
|
@@ -4286,6 +4291,43 @@ export class SfIEvents extends LitElement {
|
|
|
4286
4291
|
|
|
4287
4292
|
}
|
|
4288
4293
|
|
|
4294
|
+
renderStatisticsFiltersTableStart = () => {
|
|
4295
|
+
|
|
4296
|
+
var html = '';
|
|
4297
|
+
|
|
4298
|
+
html += '<table id="statistics-table" part="statistics-table" class="statistics-table w-100"><tbody>';
|
|
4299
|
+
// html += '<table id="stream-filters-table" part="stream-filters-table" class="stream-filters-table"><thead><tr><td><div class="d-flex align-center justify-center"> </div></td><td><div class="d-flex align-center justify-center">Total</div></td><td><div class="d-flex align-center justify-center"><span class="material-icons color-not-started">schedule</span> Not Started</div></td><td><div class="d-flex align-center justify-center"><span class="material-symbols-outlined color-pending">pending</span> Pending Approval</div></td><td><div class="d-flex align-center justify-center"><span class="material-symbols-outlined color-rejected">block</span> Rejected</div></td><td><div class="d-flex align-center justify-center"><span class="material-symbols-outlined color-done">check_circle</span> Approved</div></td></tr></thead><tbody>';
|
|
4300
|
+
|
|
4301
|
+
return html;
|
|
4302
|
+
|
|
4303
|
+
}
|
|
4304
|
+
|
|
4305
|
+
renderStatisticsFiltersTableRow = () => {
|
|
4306
|
+
|
|
4307
|
+
var html = '';
|
|
4308
|
+
html += '<tr class="tablerow">'
|
|
4309
|
+
html +='<td part="td-body" class="td-body"><div class="d-flex align-center flex-wrap"><div part="td-head" class="pl-0-imp w-100 d-flex align-center">FILTER_CRITERIA_NAME</div><div>DASHBOARD_FILTER_NAME</div></div></td>'
|
|
4310
|
+
html +='<td part="td-body" class="td-body"><div class="d-flex align-center flex-wrap"><div part="td-head" class="pl-0-imp w-100 d-flex align-center"><span class="small-icon material-icons color-not-started">schedule</span> Not Started</div><div>DASHBOARD_NOT_STARTED</div></div></td>'
|
|
4311
|
+
html +='<td part="td-body" class="td-body"><div class="d-flex align-center flex-wrap"><div part="td-head" class="pl-0-imp w-100 d-flex align-center"><span class="small-icon material-symbols-outlined color-pending">pending</span> Pending Approval</div><div>DASHBOARD_PENDING_APPROVAL</div></div></td>'
|
|
4312
|
+
html +='<td part="td-body" class="td-body"><div class="d-flex align-center flex-wrap"><div part="td-head" class="pl-0-imp w-100 d-flex align-center"><span class="small-icon material-symbols-outlined color-rejected">block</span> Rejected</div><div>DASHBOARD_REJECTED</div></div></td>'
|
|
4313
|
+
html +='<td part="td-body" class="td-body"><div class="d-flex align-center flex-wrap"><div part="td-head" class="pl-0-imp w-100 d-flex align-center"><span class="small-icon material-symbols-outlined color-done">check_circle</span> Approved</div><div>DASHBOARD_APPROVED</div></div></td>'
|
|
4314
|
+
html +='<td part="td-body" class="td-body"><div class="d-flex align-center flex-wrap"><div part="td-head" class="pl-0-imp w-100 d-flex align-center">Total</div><div>DASHBOARD_TOTAL</div></div></td>'
|
|
4315
|
+
html += '</tr>';
|
|
4316
|
+
// html += '<tr class="tablerow"><td part="td-body" class="td-body"><span>DASHBOARD_FILTER_NAME</span></td><td><span>DASHBOARD_TOTAL</span></td><td><span>DASHBOARD_NOT_STARTED</span></td><td><span>DASHBOARD_PENDING_APPROVAL</span></td><td><span>DASHBOARD_REJECTED</span></td><td><span>DASHBOARD_APPROVED</span></td></tr>';
|
|
4317
|
+
|
|
4318
|
+
return html;
|
|
4319
|
+
|
|
4320
|
+
}
|
|
4321
|
+
|
|
4322
|
+
renderStatisticsFiltersTableEnd = () => {
|
|
4323
|
+
|
|
4324
|
+
var html = '';
|
|
4325
|
+
html += '</tbody></table>';
|
|
4326
|
+
|
|
4327
|
+
return html;
|
|
4328
|
+
|
|
4329
|
+
}
|
|
4330
|
+
|
|
4289
4331
|
getCalendarRowHide = (events: any, i: number, lastDay: number, month: number, firstDate: any = null, currDate: any = null) => {
|
|
4290
4332
|
|
|
4291
4333
|
var hide = true;
|
|
@@ -4956,8 +4998,10 @@ export class SfIEvents extends LitElement {
|
|
|
4956
4998
|
html += this.renderCalendarStatisticsGraphs(showGraph, parametersTitle);
|
|
4957
4999
|
html += this.renderCalendarContainerDivStart(index)
|
|
4958
5000
|
html += this.renderCalendarEventSummary();
|
|
4959
|
-
|
|
4960
|
-
|
|
5001
|
+
let filtersTableHtml = ""
|
|
5002
|
+
if(Object.keys(this.statisticsFiltersData).length > 0){
|
|
5003
|
+
filtersTableHtml += this.renderStatisticsFiltersTableStart()
|
|
5004
|
+
}
|
|
4961
5005
|
for(var i = iInit; i <= iLast; i++) {
|
|
4962
5006
|
|
|
4963
5007
|
let mmdd : string = "";
|
|
@@ -4993,10 +5037,60 @@ export class SfIEvents extends LitElement {
|
|
|
4993
5037
|
approved += this.statistics[mmdd]["approved"] ?? 0;
|
|
4994
5038
|
|
|
4995
5039
|
}
|
|
5040
|
+
|
|
5041
|
+
|
|
4996
5042
|
}
|
|
4997
5043
|
|
|
4998
|
-
|
|
5044
|
+
for(let filtercriteria of Object.keys(this.statisticsFiltersData)){
|
|
5045
|
+
for(let filterid of Object.keys(this.statisticsFiltersData[filtercriteria])){
|
|
5046
|
+
let filtername = ""
|
|
5047
|
+
for(let filterval of this.statisticsMeta[filtercriteria]){
|
|
5048
|
+
if(filterval.indexOf(filterid) >= 0){
|
|
5049
|
+
filtername = filterval.split(';')[0]
|
|
5050
|
+
break;
|
|
5051
|
+
}
|
|
5052
|
+
}
|
|
5053
|
+
let filterTotal = 0, filterNotStarted = 0, filterPendingApproval = 0, filterRejected = 0, filterApproved = 0;
|
|
5054
|
+
for(var i = iInit; i <= iLast; i++) {
|
|
5055
|
+
|
|
5056
|
+
let mmdd : string = "";
|
|
5057
|
+
|
|
5058
|
+
if(firstDate == null) {
|
|
5059
|
+
mmdd = ("0" + (month+1)).slice(-2) + "/" + ("0" + i).slice(-2);
|
|
5060
|
+
} else {
|
|
5061
|
+
const currDate = new Date(firstDate.getTime());
|
|
5062
|
+
currDate.setDate(firstDate.getDate() + (i - 1));
|
|
5063
|
+
mmdd = ("0" + (currDate.getMonth()+1)).slice(-2) + "/" + ("0" + currDate.getDate()).slice(-2);
|
|
5064
|
+
}
|
|
5065
|
+
if(this.statisticsFiltersData[filtercriteria][filterid] != null){
|
|
5066
|
+
if(this.statisticsFiltersData[filtercriteria][filterid][mmdd] != null){
|
|
5067
|
+
filterTotal += this.statisticsFiltersData[filtercriteria][filterid][mmdd].count
|
|
5068
|
+
filterNotStarted += this.statisticsFiltersData[filtercriteria][filterid][mmdd]['not-started'] ?? 0
|
|
5069
|
+
filterPendingApproval += this.statisticsFiltersData[filtercriteria][filterid][mmdd]['pending-approval'] ?? 0
|
|
5070
|
+
filterRejected += this.statisticsFiltersData[filtercriteria][filterid][mmdd]['rejected'] ?? 0
|
|
5071
|
+
filterApproved += this.statisticsFiltersData[filtercriteria][filterid][mmdd]['approved'] ?? 0
|
|
5072
|
+
}
|
|
5073
|
+
}
|
|
5074
|
+
}
|
|
4999
5075
|
|
|
5076
|
+
filtersTableHtml += this.renderStatisticsFiltersTableRow()
|
|
5077
|
+
filtersTableHtml = filtersTableHtml.replace("FILTER_CRITERIA_NAME", filtercriteria+"");
|
|
5078
|
+
filtersTableHtml = filtersTableHtml.replace("DASHBOARD_FILTER_NAME", (filtername+"").replace(/\([^)]*\)/g,""));
|
|
5079
|
+
filtersTableHtml = filtersTableHtml.replace("DASHBOARD_TOTAL", filterTotal+"");
|
|
5080
|
+
filtersTableHtml = filtersTableHtml.replace("DASHBOARD_NOT_STARTED", filterNotStarted+" (" + Util.percentageString(filterNotStarted, filterTotal) + ")");
|
|
5081
|
+
filtersTableHtml = filtersTableHtml.replace("DASHBOARD_APPROVED", filterApproved+" (" + Util.percentageString(filterApproved, filterTotal) + ")");
|
|
5082
|
+
filtersTableHtml = filtersTableHtml.replace("DASHBOARD_PENDING_APPROVAL", filterPendingApproval+" (" + Util.percentageString(filterPendingApproval, filterTotal) + ")");
|
|
5083
|
+
filtersTableHtml = filtersTableHtml.replace("DASHBOARD_REJECTED", filterRejected+" (" + Util.percentageString(filterRejected, filterTotal) + ")");
|
|
5084
|
+
}
|
|
5085
|
+
}
|
|
5086
|
+
|
|
5087
|
+
if(Object.keys(this.statisticsFiltersData).length > 0){
|
|
5088
|
+
filtersTableHtml += this.renderStatisticsFiltersTableEnd()
|
|
5089
|
+
}
|
|
5090
|
+
|
|
5091
|
+
|
|
5092
|
+
html += filtersTableHtml
|
|
5093
|
+
html += this.renderCalendarContainerDivEnd();
|
|
5000
5094
|
//console.log('final risk severities', this.riskSeverityData);
|
|
5001
5095
|
|
|
5002
5096
|
//this.period = firstDay?.getDate() + '/' + (firstDay!.getMonth()+1) + '/' + firstDay?.getFullYear() + " - " + endDay?.getDate() + '/' + (endDay!.getMonth()+1) + '/' + endDay?.getFullYear();
|
|
@@ -6590,10 +6684,16 @@ export class SfIEvents extends LitElement {
|
|
|
6590
6684
|
option.value = "";
|
|
6591
6685
|
option.innerHTML = "all"
|
|
6592
6686
|
selectFilterCriteriaMobile.add(option)
|
|
6593
|
-
|
|
6687
|
+
let filterscriteria = ""
|
|
6688
|
+
if(Object.keys(this.statisticsFiltersData ?? {}).length > 0){
|
|
6689
|
+
filterscriteria = Object.keys(this.statisticsFiltersData)[0]
|
|
6690
|
+
}
|
|
6691
|
+
|
|
6594
6692
|
for(let criteria of Object.keys(this.statisticsMeta)){
|
|
6595
6693
|
let option = new Option()
|
|
6596
6694
|
option.value = criteria;
|
|
6695
|
+
console.log('statistics filters criteria',criteria, filterscriteria, criteria == filterscriteria)
|
|
6696
|
+
option.selected = (criteria == filterscriteria)
|
|
6597
6697
|
if(criteria == "reporter" || criteria == "approver" || criteria == "functionhead"){
|
|
6598
6698
|
option.innerHTML = "user:" + criteria
|
|
6599
6699
|
}else{
|
|
@@ -6602,6 +6702,7 @@ export class SfIEvents extends LitElement {
|
|
|
6602
6702
|
selectFilterCriteria.add(option)
|
|
6603
6703
|
option = new Option()
|
|
6604
6704
|
option.value = criteria;
|
|
6705
|
+
option.selected = (criteria == filterscriteria)
|
|
6605
6706
|
if(criteria == "reporter" || criteria == "approver" || criteria == "functionhead"){
|
|
6606
6707
|
option.innerHTML = "user:" + criteria
|
|
6607
6708
|
}else{
|
|
@@ -6609,15 +6710,16 @@ export class SfIEvents extends LitElement {
|
|
|
6609
6710
|
}
|
|
6610
6711
|
selectFilterCriteriaMobile.add(option)
|
|
6611
6712
|
}
|
|
6713
|
+
|
|
6612
6714
|
let selectFilterCriteriaNew = Util.clearListeners(selectFilterCriteria)
|
|
6613
6715
|
selectFilterCriteriaNew.addEventListener('change',(ev: any) => {
|
|
6614
6716
|
let target = ev.target as HTMLSelectElement
|
|
6615
6717
|
let inputLabelCriteria = eventsContainer.querySelector('#input-label-criteria') as HTMLLabelElement
|
|
6616
6718
|
let selectFilterValues = eventsContainer.querySelector('#select-filter-values') as HTMLSelectElement
|
|
6617
|
-
if(target.value == ""){
|
|
6719
|
+
// if(target.value == ""){
|
|
6618
6720
|
selectFilterValues.value = ""
|
|
6619
6721
|
this.processDateSelectionViewer(eventsContainer)
|
|
6620
|
-
}
|
|
6722
|
+
// }
|
|
6621
6723
|
|
|
6622
6724
|
selectFilterValues.innerHTML = ""
|
|
6623
6725
|
let option = new Option()
|
|
@@ -6680,15 +6782,24 @@ export class SfIEvents extends LitElement {
|
|
|
6680
6782
|
selectFilterValuesMobile.style.display = 'none'
|
|
6681
6783
|
inputLabelCriteriaMobile.style.display = 'none'
|
|
6682
6784
|
}
|
|
6683
|
-
})
|
|
6785
|
+
});
|
|
6786
|
+
(selectFilterCriteriaNew as HTMLSelectElement).value = filterscriteria;
|
|
6787
|
+
(selectFilterCriteriaMobileNew as HTMLSelectElement).value = filterscriteria;
|
|
6684
6788
|
let selectFilterValues = eventsContainer.querySelector('#select-filter-values') as HTMLSelectElement
|
|
6685
6789
|
let inputLabelCriteria = eventsContainer.querySelector('#input-label-criteria') as HTMLLabelElement
|
|
6686
6790
|
let selectFilterValuesMobile = eventsContainer.querySelector('#select-filter-values-mobile') as HTMLSelectElement
|
|
6687
6791
|
let inputLabelCriteriaMobile = eventsContainer.querySelector('#input-label-criteria-mobile') as HTMLLabelElement
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6792
|
+
if(filterscriteria == ""){
|
|
6793
|
+
selectFilterValues.style.display = 'none'
|
|
6794
|
+
inputLabelCriteria.style.display = 'none'
|
|
6795
|
+
selectFilterValuesMobile.style.display = 'none'
|
|
6796
|
+
inputLabelCriteriaMobile.style.display = 'none'
|
|
6797
|
+
}else{
|
|
6798
|
+
selectFilterValues.style.display = 'block'
|
|
6799
|
+
inputLabelCriteria.style.display = 'block'
|
|
6800
|
+
selectFilterValuesMobile.style.display = 'block'
|
|
6801
|
+
inputLabelCriteriaMobile.style.display = 'block'
|
|
6802
|
+
}
|
|
6692
6803
|
}
|
|
6693
6804
|
renderSelectAllButtons = () => {
|
|
6694
6805
|
let selectAllHtml = '<div class="d-flex justify-end w-100" style="position: fixed; bottom: 70px; left: 0px;" part="button-select-all-container">';
|
|
@@ -22332,7 +22443,7 @@ export class SfIEvents extends LitElement {
|
|
|
22332
22443
|
let url = "https://"+this.apiId+"/"+ path;
|
|
22333
22444
|
|
|
22334
22445
|
//console.log('fetch calendar url', url);
|
|
22335
|
-
let urlBody :any = {"projectid": this.projectId, "userid": this.userProfileId, "role": this.myRole, "sdate": sDate, "edate": eDate};
|
|
22446
|
+
let urlBody :any = {"projectid": this.projectId, "userid": this.userProfileId, "role": this.myRole, "sdate": sDate, "edate": eDate,"filtercriteria": filtercriteria};
|
|
22336
22447
|
|
|
22337
22448
|
if(filtercriteria == 'function') {
|
|
22338
22449
|
urlBody["functionid"] = filterid;
|
|
@@ -22363,6 +22474,7 @@ export class SfIEvents extends LitElement {
|
|
|
22363
22474
|
this.statistics = jsonRespose.data
|
|
22364
22475
|
this.lastupdated = new Date(jsonRespose.lastupdated).toLocaleDateString('en-IN') + " - " + new Date(jsonRespose.lastupdated).toLocaleTimeString('en-IN')
|
|
22365
22476
|
console.log('statistics date', this.lastupdated);
|
|
22477
|
+
this.statisticsFiltersData = jsonRespose.filtersdata ?? {}
|
|
22366
22478
|
if(jsonRespose.meta != null)
|
|
22367
22479
|
this.statisticsMeta = jsonRespose.meta
|
|
22368
22480
|
return jsonRespose.meta
|
package/src/util.ts
CHANGED
|
@@ -445,8 +445,13 @@ function alphabeticalSort(arr:string[]){
|
|
|
445
445
|
return arrSorted
|
|
446
446
|
}
|
|
447
447
|
|
|
448
|
+
function percentageString(val: number, valTotal: number){
|
|
449
|
+
let num = (100 * val) / valTotal
|
|
450
|
+
return (Math.round((num + Number.EPSILON) * 100) / 100) + "%"
|
|
451
|
+
}
|
|
452
|
+
|
|
448
453
|
const exportFunctions = {
|
|
449
|
-
callApiPresignedDelete, callApiPresignedGet, callApiPresigned, jsonObjectToHtml, clearListeners, isInteger, callApi, validateName, readCookie, timeSince, createDiagonalPattern1, createDiagonalPattern2, createDiagonalPattern3, getRandomColor, convertToCSV, parseCsv, titleCase, alphabeticalSort
|
|
454
|
+
callApiPresignedDelete, callApiPresignedGet, callApiPresigned, jsonObjectToHtml, clearListeners, isInteger, callApi, validateName, readCookie, timeSince, createDiagonalPattern1, createDiagonalPattern2, createDiagonalPattern3, getRandomColor, convertToCSV, parseCsv, titleCase, alphabeticalSort, percentageString
|
|
450
455
|
};
|
|
451
456
|
|
|
452
457
|
export default exportFunctions;
|
package/util.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ declare function convertToCSV(arr: any[]): string;
|
|
|
14
14
|
declare function parseCsv(csv: string): any;
|
|
15
15
|
declare function titleCase(str: string): string;
|
|
16
16
|
declare function alphabeticalSort(arr: string[]): string[];
|
|
17
|
+
declare function percentageString(val: number, valTotal: number): string;
|
|
17
18
|
declare const exportFunctions: {
|
|
18
19
|
callApiPresignedDelete: typeof callApiPresignedDelete;
|
|
19
20
|
callApiPresignedGet: typeof callApiPresignedGet;
|
|
@@ -33,6 +34,7 @@ declare const exportFunctions: {
|
|
|
33
34
|
parseCsv: typeof parseCsv;
|
|
34
35
|
titleCase: typeof titleCase;
|
|
35
36
|
alphabeticalSort: typeof alphabeticalSort;
|
|
37
|
+
percentageString: typeof percentageString;
|
|
36
38
|
};
|
|
37
39
|
export default exportFunctions;
|
|
38
40
|
//# sourceMappingURL=util.d.ts.map
|
package/util.js
CHANGED
|
@@ -372,8 +372,12 @@ function alphabeticalSort(arr) {
|
|
|
372
372
|
});
|
|
373
373
|
return arrSorted;
|
|
374
374
|
}
|
|
375
|
+
function percentageString(val, valTotal) {
|
|
376
|
+
let num = (100 * val) / valTotal;
|
|
377
|
+
return (Math.round((num + Number.EPSILON) * 100) / 100) + "%";
|
|
378
|
+
}
|
|
375
379
|
const exportFunctions = {
|
|
376
|
-
callApiPresignedDelete, callApiPresignedGet, callApiPresigned, jsonObjectToHtml, clearListeners, isInteger, callApi, validateName, readCookie, timeSince, createDiagonalPattern1, createDiagonalPattern2, createDiagonalPattern3, getRandomColor, convertToCSV, parseCsv, titleCase, alphabeticalSort
|
|
380
|
+
callApiPresignedDelete, callApiPresignedGet, callApiPresigned, jsonObjectToHtml, clearListeners, isInteger, callApi, validateName, readCookie, timeSince, createDiagonalPattern1, createDiagonalPattern2, createDiagonalPattern3, getRandomColor, convertToCSV, parseCsv, titleCase, alphabeticalSort, percentageString
|
|
377
381
|
};
|
|
378
382
|
export default exportFunctions;
|
|
379
383
|
//# sourceMappingURL=util.js.map
|