sf-i-events 1.0.739 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sf-i-events",
3
3
  "private": false,
4
- "version": "1.0.739",
4
+ "version": "1.0.741",
5
5
  "description": "Superflows Navigation Component",
6
6
  "main": "sf-i-events.js",
7
7
  "module": "sf-i-events.js",
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;
@@ -268,6 +269,7 @@ export declare class SfIEvents extends LitElement {
268
269
  nextTabStatus: string;
269
270
  sdate: string;
270
271
  edate: string;
272
+ lastupdated: string;
271
273
  changedOnboardingItemIds: string[];
272
274
  selectallblock: string;
273
275
  static styles: import("lit").CSSResult;
@@ -451,6 +453,9 @@ export declare class SfIEvents extends LitElement {
451
453
  renderCalendarContainerDivStart: (index: number) => string;
452
454
  renderCalendarContainerDivEnd: () => string;
453
455
  renderCalendarEventSummary: () => string;
456
+ renderStatisticsFiltersTableStart: () => string;
457
+ renderStatisticsFiltersTableRow: () => string;
458
+ renderStatisticsFiltersTableEnd: () => string;
454
459
  getCalendarRowHide: (events: any, i: number, lastDay: number, month: number, firstDate?: any, currDate?: any) => boolean;
455
460
  renderCalendarRowDivStart: (i: number, firstDate?: any, ddmm?: string) => string;
456
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;
@@ -1209,6 +1210,7 @@ let SfIEvents = class SfIEvents extends LitElement {
1209
1210
  this.nextTabStatus = "";
1210
1211
  this.sdate = "";
1211
1212
  this.edate = "";
1213
+ this.lastupdated = "";
1212
1214
  this.changedOnboardingItemIds = [];
1213
1215
  this.selectallblock = "100";
1214
1216
  this.isSelectedLegend = (value) => {
@@ -2103,6 +2105,7 @@ let SfIEvents = class SfIEvents extends LitElement {
2103
2105
  var html = '';
2104
2106
  html += '<div class="mb-20 stream-event-list" part="stream-event-list-charts">';
2105
2107
  html += '<div class="align-center d-flex flex-wrap mb-10 w-100-m-0" part="duration-title-container"><h4 part="duration-title">' + parametersTitle + '</h4><button id="button-refresh" part="button-duration-title" class="align-center d-flex justify-center"><h4 part="duration-title">' + parametersTitle + '</h4><span part="duration-title-icon" class="material-icons ml-10">refresh</span></button></div>';
2108
+ html += '<div class="align-center d-flex flex-wrap mb-10 w-100-m-0" part="last-update-title-container"><h6 part="last-update-title">Last Updated on ' + this.lastupdated + '</h6></div>';
2106
2109
  if (showGraph) {
2107
2110
  html += '<div part="stream-event-chart-selection" class="mb-20">';
2108
2111
  html += '<div part="td-head" class="mb-5">Select Chart</div>';
@@ -2147,6 +2150,7 @@ let SfIEvents = class SfIEvents extends LitElement {
2147
2150
  var html = '';
2148
2151
  html += '<div class="mb-20 stream-event-list" part="stream-event-list-charts">';
2149
2152
  html += '<div class="align-center d-flex flex-wrap mb-10 w-100-m-0" part="duration-title-container"><h4 part="duration-title">' + parametersTitle + '</h4><button id="button-refresh" part="button-duration-title" class="align-center d-flex justify-center"><h4 part="duration-title">' + parametersTitle + '</h4><span part="duration-title-icon" class="material-icons ml-10">refresh</span></button></div>';
2153
+ html += '<div class="align-center d-flex flex-wrap mb-10 w-100-m-0" part="last-update-title-container"><h6 part="last-update-title">Last Updated on ' + this.lastupdated + '</h6></div>';
2150
2154
  if (showGraph) {
2151
2155
  html += '<div class="chart-container d-flex scroll-x align-center"><div part="chart-item" class="chart-item"><canvas id="myChart"></canvas></div><div part="chart-item" class="chart-item"><canvas id="myChart4" class="gone"></canvas></div><div part="chart-item chart-item-middle" class="chart-item"><canvas id="myChart2" class="gone"></canvas></div><div part="chart-item" class="chart-item"><canvas id="myChart3" class="gone"></canvas></div></div>';
2152
2156
  html += '<div id="chart-settings-controls" class="mt-20"></div>';
@@ -2189,6 +2193,30 @@ let SfIEvents = class SfIEvents extends LitElement {
2189
2193
  html += '<div id="stream-event-filter" part="stream-event-total" class="d-flex flex-wrap"></div>';
2190
2194
  return html;
2191
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>&nbsp;&nbsp;Not Started</div></td><td><div class="d-flex align-center justify-center"><span class="material-symbols-outlined color-pending">pending</span>&nbsp;&nbsp;Pending Approval</div></td><td><div class="d-flex align-center justify-center"><span class="material-symbols-outlined color-rejected">block</span>&nbsp;&nbsp;Rejected</div></td><td><div class="d-flex align-center justify-center"><span class="material-symbols-outlined color-done">check_circle</span>&nbsp;&nbsp;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>&nbsp;&nbsp;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>&nbsp;&nbsp;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>&nbsp;&nbsp;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>&nbsp;&nbsp;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
+ };
2192
2220
  this.getCalendarRowHide = (events, i, lastDay, month, firstDate = null, currDate = null) => {
2193
2221
  var hide = true;
2194
2222
  if (events != null) {
@@ -2723,7 +2751,7 @@ let SfIEvents = class SfIEvents extends LitElement {
2723
2751
  return html;
2724
2752
  };
2725
2753
  this.renderStatistics = (_firstDay, _endDay, iInit, iLast, showGraph, index, month, period, firstDate = null, parametersTitle) => {
2726
- var _a, _b, _c, _f;
2754
+ var _a, _b, _c, _f, _g, _h, _j, _k;
2727
2755
  var total = 0, notStarted = 0, approved = 0, pendingApproval = 0, rejected = 0;
2728
2756
  var html = '';
2729
2757
  // var lastDay = iLast;
@@ -2734,6 +2762,10 @@ let SfIEvents = class SfIEvents extends LitElement {
2734
2762
  html += this.renderCalendarStatisticsGraphs(showGraph, parametersTitle);
2735
2763
  html += this.renderCalendarContainerDivStart(index);
2736
2764
  html += this.renderCalendarEventSummary();
2765
+ let filtersTableHtml = "";
2766
+ if (Object.keys(this.statisticsFiltersData).length > 0) {
2767
+ filtersTableHtml += this.renderStatisticsFiltersTableStart();
2768
+ }
2737
2769
  for (var i = iInit; i <= iLast; i++) {
2738
2770
  let mmdd = "";
2739
2771
  if (firstDate == null) {
@@ -2763,6 +2795,50 @@ let SfIEvents = class SfIEvents extends LitElement {
2763
2795
  approved += (_f = this.statistics[mmdd]["approved"]) !== null && _f !== void 0 ? _f : 0;
2764
2796
  }
2765
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;
2766
2842
  html += this.renderCalendarContainerDivEnd();
2767
2843
  //console.log('final risk severities', this.riskSeverityData);
2768
2844
  //this.period = firstDay?.getDate() + '/' + (firstDay!.getMonth()+1) + '/' + firstDay?.getFullYear() + " - " + endDay?.getDate() + '/' + (endDay!.getMonth()+1) + '/' + endDay?.getFullYear();
@@ -4096,6 +4172,7 @@ let SfIEvents = class SfIEvents extends LitElement {
4096
4172
  });
4097
4173
  };
4098
4174
  this.renderStatisticsFilters = (eventsContainer) => {
4175
+ var _a;
4099
4176
  let selectFilterCriteria = eventsContainer.querySelector('#select-filter-criteria');
4100
4177
  let inputLabelFilter = eventsContainer.querySelector('#input-label-filter');
4101
4178
  let selectFilterCriteriaMobile = eventsContainer.querySelector('#select-filter-criteria-mobile');
@@ -4114,10 +4191,15 @@ let SfIEvents = class SfIEvents extends LitElement {
4114
4191
  option.value = "";
4115
4192
  option.innerHTML = "all";
4116
4193
  selectFilterCriteriaMobile.add(option);
4117
- console.log('adding', option, selectFilterCriteria.options);
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
+ }
4118
4198
  for (let criteria of Object.keys(this.statisticsMeta)) {
4119
4199
  let option = new Option();
4120
4200
  option.value = criteria;
4201
+ console.log('statistics filters criteria', criteria, filterscriteria, criteria == filterscriteria);
4202
+ option.selected = (criteria == filterscriteria);
4121
4203
  if (criteria == "reporter" || criteria == "approver" || criteria == "functionhead") {
4122
4204
  option.innerHTML = "user:" + criteria;
4123
4205
  }
@@ -4127,6 +4209,7 @@ let SfIEvents = class SfIEvents extends LitElement {
4127
4209
  selectFilterCriteria.add(option);
4128
4210
  option = new Option();
4129
4211
  option.value = criteria;
4212
+ option.selected = (criteria == filterscriteria);
4130
4213
  if (criteria == "reporter" || criteria == "approver" || criteria == "functionhead") {
4131
4214
  option.innerHTML = "user:" + criteria;
4132
4215
  }
@@ -4140,10 +4223,10 @@ let SfIEvents = class SfIEvents extends LitElement {
4140
4223
  let target = ev.target;
4141
4224
  let inputLabelCriteria = eventsContainer.querySelector('#input-label-criteria');
4142
4225
  let selectFilterValues = eventsContainer.querySelector('#select-filter-values');
4143
- if (target.value == "") {
4144
- selectFilterValues.value = "";
4145
- this.processDateSelectionViewer(eventsContainer);
4146
- }
4226
+ // if(target.value == ""){
4227
+ selectFilterValues.value = "";
4228
+ this.processDateSelectionViewer(eventsContainer);
4229
+ // }
4147
4230
  selectFilterValues.innerHTML = "";
4148
4231
  let option = new Option();
4149
4232
  option.value = "";
@@ -4207,14 +4290,24 @@ let SfIEvents = class SfIEvents extends LitElement {
4207
4290
  inputLabelCriteriaMobile.style.display = 'none';
4208
4291
  }
4209
4292
  });
4293
+ selectFilterCriteriaNew.value = filterscriteria;
4294
+ selectFilterCriteriaMobileNew.value = filterscriteria;
4210
4295
  let selectFilterValues = eventsContainer.querySelector('#select-filter-values');
4211
4296
  let inputLabelCriteria = eventsContainer.querySelector('#input-label-criteria');
4212
4297
  let selectFilterValuesMobile = eventsContainer.querySelector('#select-filter-values-mobile');
4213
4298
  let inputLabelCriteriaMobile = eventsContainer.querySelector('#input-label-criteria-mobile');
4214
- selectFilterValues.style.display = 'none';
4215
- inputLabelCriteria.style.display = 'none';
4216
- selectFilterValuesMobile.style.display = 'none';
4217
- inputLabelCriteriaMobile.style.display = 'none';
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
+ }
4218
4311
  };
4219
4312
  this.renderSelectAllButtons = () => {
4220
4313
  let selectAllHtml = '<div class="d-flex justify-end w-100" style="position: fixed; bottom: 70px; left: 0px;" part="button-select-all-container">';
@@ -16367,6 +16460,7 @@ let SfIEvents = class SfIEvents extends LitElement {
16367
16460
  console.log('jsonRespose', jsonRespose);
16368
16461
  this.events = (await this.fetchPresignedUrl(jsonRespose.signedUrlGet));
16369
16462
  await this.fetchPresignedUrlDelete(jsonRespose.signedUrlDelete);
16463
+ this.lastupdated = new Date().toLocaleDateString('en-IN') + " - " + new Date().toLocaleTimeString('en-IN');
16370
16464
  this.renderAppropriateStream(startDate, endDate, list == "no");
16371
16465
  this.fetchBulkReportingData();
16372
16466
  // this.events = {}
@@ -16417,6 +16511,7 @@ let SfIEvents = class SfIEvents extends LitElement {
16417
16511
  }
16418
16512
  };
16419
16513
  this.fetchStatistics = async (startDate = "", endDate = "", filtercriteria, filterid) => {
16514
+ var _a;
16420
16515
  let path = "";
16421
16516
  this.sdate = startDate;
16422
16517
  this.edate = endDate;
@@ -16434,7 +16529,7 @@ let SfIEvents = class SfIEvents extends LitElement {
16434
16529
  }
16435
16530
  let url = "https://" + this.apiId + "/" + path;
16436
16531
  //console.log('fetch calendar url', url);
16437
- 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 };
16438
16533
  if (filtercriteria == 'function') {
16439
16534
  urlBody["functionid"] = filterid;
16440
16535
  urlBody["locationid"] = '';
@@ -16461,6 +16556,9 @@ let SfIEvents = class SfIEvents extends LitElement {
16461
16556
  const jsonRespose = JSON.parse(xhr.responseText);
16462
16557
  console.log('jsonRespose Statistics', jsonRespose);
16463
16558
  this.statistics = jsonRespose.data;
16559
+ this.lastupdated = new Date(jsonRespose.lastupdated).toLocaleDateString('en-IN') + " - " + new Date(jsonRespose.lastupdated).toLocaleTimeString('en-IN');
16560
+ console.log('statistics date', this.lastupdated);
16561
+ this.statisticsFiltersData = (_a = jsonRespose.filtersdata) !== null && _a !== void 0 ? _a : {};
16464
16562
  if (jsonRespose.meta != null)
16465
16563
  this.statisticsMeta = jsonRespose.meta;
16466
16564
  return jsonRespose.meta;
@@ -19305,10 +19403,12 @@ SfIEvents.styles = css `
19305
19403
  display: none;
19306
19404
  position: fixed;
19307
19405
  bottom: 10px;
19308
- right: 10px
19406
+ left: 10px
19309
19407
  }
19310
19408
 
19311
-
19409
+ .small-icon {
19410
+ font-size: 98%
19411
+ }
19312
19412
  `;
19313
19413
  __decorate([
19314
19414
  query('#decrypt-container')
@@ -19523,6 +19623,9 @@ __decorate([
19523
19623
  __decorate([
19524
19624
  property()
19525
19625
  ], SfIEvents.prototype, "statisticsMeta", void 0);
19626
+ __decorate([
19627
+ property()
19628
+ ], SfIEvents.prototype, "statisticsFiltersData", void 0);
19526
19629
  __decorate([
19527
19630
  property()
19528
19631
  ], SfIEvents.prototype, "streamIndex", void 0);
@@ -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
 
@@ -1600,6 +1603,8 @@ export class SfIEvents extends LitElement {
1600
1603
 
1601
1604
  edate: string = "";
1602
1605
 
1606
+ lastupdated: string = "";
1607
+
1603
1608
  changedOnboardingItemIds: string[] = []
1604
1609
 
1605
1610
  @property()
@@ -2634,10 +2639,12 @@ export class SfIEvents extends LitElement {
2634
2639
  display: none;
2635
2640
  position: fixed;
2636
2641
  bottom: 10px;
2637
- right: 10px
2642
+ left: 10px
2638
2643
  }
2639
2644
 
2640
-
2645
+ .small-icon {
2646
+ font-size: 98%
2647
+ }
2641
2648
  `;
2642
2649
 
2643
2650
  @query('.SfIEventsC')
@@ -4171,6 +4178,7 @@ export class SfIEvents extends LitElement {
4171
4178
 
4172
4179
  html += '<div class="mb-20 stream-event-list" part="stream-event-list-charts">';
4173
4180
  html += '<div class="align-center d-flex flex-wrap mb-10 w-100-m-0" part="duration-title-container"><h4 part="duration-title">' + parametersTitle + '</h4><button id="button-refresh" part="button-duration-title" class="align-center d-flex justify-center"><h4 part="duration-title">' + parametersTitle + '</h4><span part="duration-title-icon" class="material-icons ml-10">refresh</span></button></div>';
4181
+ html += '<div class="align-center d-flex flex-wrap mb-10 w-100-m-0" part="last-update-title-container"><h6 part="last-update-title">Last Updated on ' + this.lastupdated + '</h6></div>';
4174
4182
  if(showGraph) {
4175
4183
  html += '<div part="stream-event-chart-selection" class="mb-20">';
4176
4184
  html += '<div part="td-head" class="mb-5">Select Chart</div>';
@@ -4222,6 +4230,7 @@ export class SfIEvents extends LitElement {
4222
4230
 
4223
4231
  html += '<div class="mb-20 stream-event-list" part="stream-event-list-charts">';
4224
4232
  html += '<div class="align-center d-flex flex-wrap mb-10 w-100-m-0" part="duration-title-container"><h4 part="duration-title">' + parametersTitle + '</h4><button id="button-refresh" part="button-duration-title" class="align-center d-flex justify-center"><h4 part="duration-title">' + parametersTitle + '</h4><span part="duration-title-icon" class="material-icons ml-10">refresh</span></button></div>';
4233
+ html += '<div class="align-center d-flex flex-wrap mb-10 w-100-m-0" part="last-update-title-container"><h6 part="last-update-title">Last Updated on ' + this.lastupdated + '</h6></div>';
4225
4234
  if(showGraph) {
4226
4235
  html += '<div class="chart-container d-flex scroll-x align-center"><div part="chart-item" class="chart-item"><canvas id="myChart"></canvas></div><div part="chart-item" class="chart-item"><canvas id="myChart4" class="gone"></canvas></div><div part="chart-item chart-item-middle" class="chart-item"><canvas id="myChart2" class="gone"></canvas></div><div part="chart-item" class="chart-item"><canvas id="myChart3" class="gone"></canvas></div></div>';
4227
4236
  html += '<div id="chart-settings-controls" class="mt-20"></div>'
@@ -4282,6 +4291,43 @@ export class SfIEvents extends LitElement {
4282
4291
 
4283
4292
  }
4284
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>&nbsp;&nbsp;Not Started</div></td><td><div class="d-flex align-center justify-center"><span class="material-symbols-outlined color-pending">pending</span>&nbsp;&nbsp;Pending Approval</div></td><td><div class="d-flex align-center justify-center"><span class="material-symbols-outlined color-rejected">block</span>&nbsp;&nbsp;Rejected</div></td><td><div class="d-flex align-center justify-center"><span class="material-symbols-outlined color-done">check_circle</span>&nbsp;&nbsp;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>&nbsp;&nbsp;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>&nbsp;&nbsp;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>&nbsp;&nbsp;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>&nbsp;&nbsp;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
+
4285
4331
  getCalendarRowHide = (events: any, i: number, lastDay: number, month: number, firstDate: any = null, currDate: any = null) => {
4286
4332
 
4287
4333
  var hide = true;
@@ -4952,8 +4998,10 @@ export class SfIEvents extends LitElement {
4952
4998
  html += this.renderCalendarStatisticsGraphs(showGraph, parametersTitle);
4953
4999
  html += this.renderCalendarContainerDivStart(index)
4954
5000
  html += this.renderCalendarEventSummary();
4955
-
4956
-
5001
+ let filtersTableHtml = ""
5002
+ if(Object.keys(this.statisticsFiltersData).length > 0){
5003
+ filtersTableHtml += this.renderStatisticsFiltersTableStart()
5004
+ }
4957
5005
  for(var i = iInit; i <= iLast; i++) {
4958
5006
 
4959
5007
  let mmdd : string = "";
@@ -4989,10 +5037,60 @@ export class SfIEvents extends LitElement {
4989
5037
  approved += this.statistics[mmdd]["approved"] ?? 0;
4990
5038
 
4991
5039
  }
5040
+
5041
+
4992
5042
  }
4993
5043
 
4994
- html += this.renderCalendarContainerDivEnd();
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
+ }
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
+
4995
5091
 
5092
+ html += filtersTableHtml
5093
+ html += this.renderCalendarContainerDivEnd();
4996
5094
  //console.log('final risk severities', this.riskSeverityData);
4997
5095
 
4998
5096
  //this.period = firstDay?.getDate() + '/' + (firstDay!.getMonth()+1) + '/' + firstDay?.getFullYear() + " - " + endDay?.getDate() + '/' + (endDay!.getMonth()+1) + '/' + endDay?.getFullYear();
@@ -6586,10 +6684,16 @@ export class SfIEvents extends LitElement {
6586
6684
  option.value = "";
6587
6685
  option.innerHTML = "all"
6588
6686
  selectFilterCriteriaMobile.add(option)
6589
- console.log('adding', option, selectFilterCriteria.options);
6687
+ let filterscriteria = ""
6688
+ if(Object.keys(this.statisticsFiltersData ?? {}).length > 0){
6689
+ filterscriteria = Object.keys(this.statisticsFiltersData)[0]
6690
+ }
6691
+
6590
6692
  for(let criteria of Object.keys(this.statisticsMeta)){
6591
6693
  let option = new Option()
6592
6694
  option.value = criteria;
6695
+ console.log('statistics filters criteria',criteria, filterscriteria, criteria == filterscriteria)
6696
+ option.selected = (criteria == filterscriteria)
6593
6697
  if(criteria == "reporter" || criteria == "approver" || criteria == "functionhead"){
6594
6698
  option.innerHTML = "user:" + criteria
6595
6699
  }else{
@@ -6598,6 +6702,7 @@ export class SfIEvents extends LitElement {
6598
6702
  selectFilterCriteria.add(option)
6599
6703
  option = new Option()
6600
6704
  option.value = criteria;
6705
+ option.selected = (criteria == filterscriteria)
6601
6706
  if(criteria == "reporter" || criteria == "approver" || criteria == "functionhead"){
6602
6707
  option.innerHTML = "user:" + criteria
6603
6708
  }else{
@@ -6605,15 +6710,16 @@ export class SfIEvents extends LitElement {
6605
6710
  }
6606
6711
  selectFilterCriteriaMobile.add(option)
6607
6712
  }
6713
+
6608
6714
  let selectFilterCriteriaNew = Util.clearListeners(selectFilterCriteria)
6609
6715
  selectFilterCriteriaNew.addEventListener('change',(ev: any) => {
6610
6716
  let target = ev.target as HTMLSelectElement
6611
6717
  let inputLabelCriteria = eventsContainer.querySelector('#input-label-criteria') as HTMLLabelElement
6612
6718
  let selectFilterValues = eventsContainer.querySelector('#select-filter-values') as HTMLSelectElement
6613
- if(target.value == ""){
6719
+ // if(target.value == ""){
6614
6720
  selectFilterValues.value = ""
6615
6721
  this.processDateSelectionViewer(eventsContainer)
6616
- }
6722
+ // }
6617
6723
 
6618
6724
  selectFilterValues.innerHTML = ""
6619
6725
  let option = new Option()
@@ -6676,15 +6782,24 @@ export class SfIEvents extends LitElement {
6676
6782
  selectFilterValuesMobile.style.display = 'none'
6677
6783
  inputLabelCriteriaMobile.style.display = 'none'
6678
6784
  }
6679
- })
6785
+ });
6786
+ (selectFilterCriteriaNew as HTMLSelectElement).value = filterscriteria;
6787
+ (selectFilterCriteriaMobileNew as HTMLSelectElement).value = filterscriteria;
6680
6788
  let selectFilterValues = eventsContainer.querySelector('#select-filter-values') as HTMLSelectElement
6681
6789
  let inputLabelCriteria = eventsContainer.querySelector('#input-label-criteria') as HTMLLabelElement
6682
6790
  let selectFilterValuesMobile = eventsContainer.querySelector('#select-filter-values-mobile') as HTMLSelectElement
6683
6791
  let inputLabelCriteriaMobile = eventsContainer.querySelector('#input-label-criteria-mobile') as HTMLLabelElement
6684
- selectFilterValues.style.display = 'none'
6685
- inputLabelCriteria.style.display = 'none'
6686
- selectFilterValuesMobile.style.display = 'none'
6687
- inputLabelCriteriaMobile.style.display = 'none'
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
+ }
6688
6803
  }
6689
6804
  renderSelectAllButtons = () => {
6690
6805
  let selectAllHtml = '<div class="d-flex justify-end w-100" style="position: fixed; bottom: 70px; left: 0px;" part="button-select-all-container">';
@@ -22224,7 +22339,7 @@ export class SfIEvents extends LitElement {
22224
22339
  console.log('jsonRespose', jsonRespose);
22225
22340
  this.events = (await this.fetchPresignedUrl(jsonRespose.signedUrlGet));
22226
22341
  await this.fetchPresignedUrlDelete(jsonRespose.signedUrlDelete)
22227
-
22342
+ this.lastupdated = new Date().toLocaleDateString('en-IN') + " - " + new Date().toLocaleTimeString('en-IN')
22228
22343
  this.renderAppropriateStream(startDate, endDate, list == "no");
22229
22344
  this.fetchBulkReportingData();
22230
22345
  // this.events = {}
@@ -22328,7 +22443,7 @@ export class SfIEvents extends LitElement {
22328
22443
  let url = "https://"+this.apiId+"/"+ path;
22329
22444
 
22330
22445
  //console.log('fetch calendar url', url);
22331
- 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};
22332
22447
 
22333
22448
  if(filtercriteria == 'function') {
22334
22449
  urlBody["functionid"] = filterid;
@@ -22357,6 +22472,9 @@ export class SfIEvents extends LitElement {
22357
22472
  const jsonRespose = JSON.parse(xhr.responseText);
22358
22473
  console.log('jsonRespose Statistics', jsonRespose);
22359
22474
  this.statistics = jsonRespose.data
22475
+ this.lastupdated = new Date(jsonRespose.lastupdated).toLocaleDateString('en-IN') + " - " + new Date(jsonRespose.lastupdated).toLocaleTimeString('en-IN')
22476
+ console.log('statistics date', this.lastupdated);
22477
+ this.statisticsFiltersData = jsonRespose.filtersdata ?? {}
22360
22478
  if(jsonRespose.meta != null)
22361
22479
  this.statisticsMeta = jsonRespose.meta
22362
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