sf-i-events 1.0.968 → 1.0.970

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/dev/index.html CHANGED
@@ -1128,14 +1128,14 @@
1128
1128
  </div>
1129
1129
 
1130
1130
  </sf-i-events> -->
1131
- <sf-i-events projectid="41ab3c86-ccc0-4c0e-8e31-cd079a07a710" projectname="ABC Global" mode="onboarding"
1131
+ <!-- <sf-i-events projectid="41ab3c86-ccc0-4c0e-8e31-cd079a07a710" projectname="ABC Global" mode="onboarding"
1132
1132
  locations="{&quot;India&quot;:{&quot;Maharashtra&quot;:[&quot;Pune&quot;,&quot;Mumbai&quot;],&quot;Telangana&quot;:[&quot;Telangana&quot;]},&quot;Canada&quot;:{&quot;CanadaSO&quot;:[&quot;CanadaLO&quot;]},&quot;Singapore&quot;:{&quot;SingaporeSO&quot;:[&quot;Orchard&quot;,&quot;Raffles&quot;,&quot;Robinson&quot;,&quot;Tanjong&quot;,&quot;Tras&quot;]},&quot;United Kingdom&quot;:{&quot;UnitedSO&quot;:[&quot;UnitedLO&quot;]},&quot;United States of America&quot;:{&quot;AmericaSO&quot;:[&quot;AmericaLO&quot;]}}"
1133
1133
  contractstartdate="1/4/2024" apiid="dwqyez2puoxmu.cloudfront.net/event" username="ninad.t@flagggrc.tech"
1134
1134
  apiidstatutes="dnytrdlrmxgsy.cloudfront.net/statute" apiidcompliances="dnytrdlrmxgsy.cloudfront.net/compliance"
1135
1135
  apiidtags="dnytrdlrmxgsy.cloudfront.net/tagging" apiidusers="dnytrdlrmxgsy.cloudfront.net/userprofile"
1136
1136
  disablesignoff="yes" disableclientresponse="yes">
1137
1137
 
1138
- </sf-i-events>
1138
+ </sf-i-events> -->
1139
1139
  <!-- <sf-i-events projectid="a81b6ae1-98de-4b72-8cf0-9aaee5b61891" projectname="Khaitan" mode="onboarding" locations="{}"
1140
1140
  contractstartdate="01/01/2025" apiid="dwqyez2puoxmu.cloudfront.net/event" username="ninad.t@flagggrc.tech"
1141
1141
  apiidstatutes="dnytrdlrmxgsy.cloudfront.net/statute" apiidcompliances="dnytrdlrmxgsy.cloudfront.net/compliance"
@@ -1231,7 +1231,36 @@
1231
1231
  </div>
1232
1232
 
1233
1233
  </sf-i-events> -->
1234
- <!-- <sf-i-events name="Calendar" apiid="dwqyez2puoxmu.cloudfront.net/event" apiidtags="dnytrdlrmxgsy.cloudfront.net/tagging" mode="reports" fill="pattern"
1234
+ <sf-i-events name="Calendar" apiid="api2.flagggrc.tech/event-api" mode="consumer"
1235
+ apiidtags="dnytrdlrmxgsy.cloudfront.net/tagging" apiidstatutes="dnytrdlrmxgsy.cloudfront.net/statute"
1236
+ apiiddefinitions="dwqyez2puoxmu.cloudfront.net/definition"
1237
+ apiidreportformats="dwqyez2puoxmu.cloudfront.net/reportformat"
1238
+ apiidnotices="gghnbi7hku2qj5twrea6xxcaya0aqeis.lambda-url.us-east-1.on.aws"
1239
+ apiidagreements="swago3unro2te55ikvjuqwcrr40wluqh.lambda-url.us-east-1.on.aws"
1240
+ apiidlicenses="lbtsbsctcdsyah4qdszkv4rctq0tnvel.lambda-url.us-east-1.on.aws"
1241
+ apiidrcmresources="jra3sghasmaxn5aiq7rtv6pjzq0oeuaw.lambda-url.us-east-1.on.aws" fill="solid"
1242
+ username="Madhura Zende Internal" userprofileid="8d3edbb1-8318-4525-978a-ecc4c5a8e713"
1243
+ projectid="d7d4d17e-3e20-4eaa-a06a-fb1c87f26532" projectname="FlaggGRC Global"
1244
+ countryid="c48d7cc1-62df-41b3-807a-5744973db3d9" selectedcriteria="Country - India" myrole="approver"
1245
+ showregisterexport="false" features="[&quot;rcmresources&quot;]"
1246
+ eventfielddependencies="[{&quot;type&quot;: &quot;foreignkey&quot;, &quot;parent&quot;: &quot;country&quot;, &quot;child&quot;: &quot;state&quot;},{&quot;type&quot;: &quot;foreignkey&quot;, &quot;parent&quot;: &quot;category&quot;, &quot;child&quot;: &quot;subcategory&quot;},{&quot;type&quot;: &quot;foreignkey&quot;, &quot;parent&quot;: &quot;frequency&quot;, &quot;child&quot;: &quot;subfrequency&quot;}]"
1247
+ eventfields="[{&quot;type&quot;: &quot;sf-i-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/riskarea&quot;, &quot;field&quot;: &quot;riskarea&quot;},{&quot;type&quot;: &quot;sf-i-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/jurisdiction&quot;, &quot;field&quot;: &quot;jurisdiction&quot;},{&quot;type&quot;: &quot;sf-i-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/updatetype&quot;, &quot;field&quot;: &quot;updatetype&quot;},{&quot;type&quot;: &quot;sf-i-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/country&quot;, &quot;field&quot;: &quot;country&quot;},{&quot;type&quot;: &quot;sf-i-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/specificity&quot;, &quot;field&quot;: &quot;specificity&quot;},{&quot;type&quot;: &quot;sf-i-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/risk&quot;, &quot;field&quot;: &quot;risk&quot;},{&quot;type&quot;: &quot;sf-i-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/frequency&quot;, &quot;field&quot;: &quot;frequency&quot;},{&quot;type&quot;: &quot;sf-i-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/category&quot;, &quot;field&quot;: &quot;category&quot;},{&quot;type&quot;: &quot;sf-i-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/obligationtype&quot;, &quot;field&quot;: &quot;obligationtype&quot;},{&quot;type&quot;: &quot;sf-i-sub-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/state&quot;, &quot;field&quot;: &quot;state&quot;},{&quot;type&quot;: &quot;sf-i-sub-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/subfrequency&quot;, &quot;field&quot;: &quot;subfrequency&quot;},{&quot;type&quot;: &quot;sf-i-sub-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/subcategory&quot;, &quot;field&quot;: &quot;subcategory&quot;},{&quot;type&quot;: &quot;sf-i-form&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/statute&quot;, &quot;field&quot;: &quot;statute&quot;, &quot;projectField&quot;: &quot;name&quot;}]"
1248
+ eventpreviewfields="[&quot;obligation&quot;]"
1249
+ eventhidefields="[&quot;comments&quot;,&quot;documents&quot;,&quot;lastupdated&quot;,&quot;approved&quot;,&quot;tags&quot;]"
1250
+ calendarstartdd="01" calendarstartmm="04" calendarstartyyyy="2025">
1251
+
1252
+ <div slot="uploader">
1253
+ <sf-i-uploader id="uploader" max="10" apiid="1peg5170d3"
1254
+ allowedextensions="[&quot;jpg&quot;,&quot;jpeg&quot;,&quot;png&quot;,&quot;pdf&quot;,&quot;xls&quot;,&quot;xlsx&quot;,&quot;doc&quot;,&quot;docx&quot;,&quot;zip&quot;]"
1255
+ extract="yes" projectid="d7d4d17e-3e20-4eaa-a06a-fb1c87f26532" maxsize="31457280"
1256
+ allowdownload="yes"></sf-i-uploader>
1257
+ </div>
1258
+ <div slot="reporting">
1259
+ <sf-i-reporting id="reporting-format" mode="view"></sf-i-reporting>
1260
+ </div>
1261
+
1262
+ </sf-i-events>
1263
+ <!-- <sf-i-events name="Calendar" apiid="dwqyez2puoxmu.cloudfront.net/event" apiidtags="dnytrdlrmxgsy.cloudfront.net/tagging" apiIdUserProfiles="dnytrdlrmxgsy.cloudfront.net/userprofile" mode="reports" fill="pattern"
1235
1264
  username="Local Reporter 1" userprofileid="e9684b5d-ddbc-46d3-ae07-51706bf75410"
1236
1265
  projectid="41ab3c86-ccc0-4c0e-8e31-cd079a07a710" projectname="ABC Global" calendarstartyyyy="2025"
1237
1266
  myrole="reporter">
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sf-i-events",
3
3
  "private": false,
4
- "version": "1.0.968",
4
+ "version": "1.0.970",
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
@@ -150,6 +150,7 @@ export declare class SfIEvents extends LitElement {
150
150
  apiIdDetail: string;
151
151
  apiIdUsers: string;
152
152
  apiIdTags: string;
153
+ apiIdUserProfiles: string;
153
154
  apiIdNotices: string;
154
155
  apiIdAgreements: string;
155
156
  apiIdLicenses: string;
@@ -645,7 +646,7 @@ export declare class SfIEvents extends LitElement {
645
646
  fetchLicenseDetails: (listEvent: any, mmddyyyy: string) => Promise<void>;
646
647
  renewLicense: (listEvent: any, reportformatvalues: any) => Promise<void>;
647
648
  renderLicenseDetails: (listEvent: any, mmddyyyy: string) => Promise<void>;
648
- fetchRCMResourceDetails: (listEvent: any, mmddyyyy: string) => Promise<void>;
649
+ fetchRCMResourceDetails: (listEvent: any, mmddyyyy: string, flagReturn?: boolean) => Promise<any>;
649
650
  renewRCMResource: (listEvent: any, reportformatvalues: any) => Promise<void>;
650
651
  renderRCMResourceDetails: (listEvent: any, mmddyyyy: string) => Promise<void>;
651
652
  fetchEventDetails: (listEvent: any, mmddyyyy: any, currentColumnButton: HTMLButtonElement | null, eventsContainer: HTMLDivElement, previousId?: string, nextId?: string, flagUploadGuidance?: boolean, listEventContainer?: HTMLDivElement | null, reportercomments?: string | null, approvercomments?: string | null, inputReportingPercentage?: string | null, selectReportedLocation?: string | null, documents?: any | null, dateOfCompletion?: string | null, fromDrilldown?: boolean) => Promise<void>;
@@ -894,10 +895,11 @@ export declare class SfIEvents extends LitElement {
894
895
  renderNextEvents: (eventsData: any, page: number, role: string) => void;
895
896
  fetchReports: () => Promise<void>;
896
897
  renderReports: (reportsData: any) => void;
897
- renderDateSelector: (sortid: string) => void;
898
- fetchReportCompliances: (selectedDate: Date, locationid: string, sortid: string) => Promise<void>;
899
- renderReportsCompliances: (compliancesData: any, sortid: string) => void;
900
- submitUpdateReporting: (mmddyyyy: string, sortid: string) => Promise<void>;
898
+ renderComplianceSelector: (sortid: string, processed?: boolean) => void;
899
+ markReport: (mmddyyyy: string, entityid: string, locationid: string, eventid: string, year: string, processed: boolean) => Promise<void>;
900
+ fetchReportCompliances: (reporterid: string, entityid: string, locationid: string, sortid: string, processed: boolean) => Promise<void>;
901
+ renderReportsCompliances: (compliancesData: any, sortid: string, processed: boolean) => void;
902
+ submitUpdateReporting: (mmddyyyy: string, entityid: string, locationid: string, sortid: string) => Promise<void>;
901
903
  loadMode: () => Promise<void>;
902
904
  constructor();
903
905
  protected firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
package/sf-i-events.js CHANGED
@@ -2985,6 +2985,7 @@ let SfIEvents = class SfIEvents extends LitElement {
2985
2985
  };
2986
2986
  this.renderCalendarAnnotations = (event, mmdd, j, fromDrilldown) => {
2987
2987
  var html = '';
2988
+ console.log('rendering Annotations', event.module, event.completenessstatus);
2988
2989
  html += '<div class="hidden-filtername hide"><table><thead><th part="badge-filter-name" class="filtername"></th></thead></table></div>';
2989
2990
  // if(event.concise == null && event.approvers != null){
2990
2991
  let reporterStr = event.concise == null ? this.getReporterStringFromEvent(event) : "";
@@ -2993,7 +2994,7 @@ let SfIEvents = class SfIEvents extends LitElement {
2993
2994
  // console.log("graphParam", graphParam.split(';')[0]);
2994
2995
  const configHome = Util.getProjectConfigHome();
2995
2996
  const configFlag = configHome.features != null && configHome.features.indexOf("understood") >= 0;
2996
- html += '<div class="d-flex align-center event-user-labels-container"><div part="badge-filter-name" class="graphparamname graphparamname1 mb-20' + (event.concise == null ? "" : ' hide') + '">' + graphParam.split(';')[0] + '</div>' + reporterStr + approverStr + (((event.module == "compliances" || event.module == null) && event.concise == null && ((event.reportformat == null || event.reportformat.length == 0) && (event.customreporting == null) && (event.reportedlocationsflag != true)) && !fromDrilldown) ? ('<button id="button-list-reporting-' + mmdd.replace('/', '-') + '-' + j + '-" part="button-list-reporting" class="material-icons ml-10 mb-20 button-list-reporting">edit_note</button>') : '') + (((event.module == "compliances" || event.module == null) && event.concise == null && configFlag) ? (event.review ? ('<button id="input-checkbox-review-' + mmdd.replace('/', '-') + '-' + j + '" part="button-icon-reviewed" class="material-symbols-outlined d-flex align-center mb-20 ml-10 button-icon-review">flag_check</button>') : ('<button id="input-checkbox-review-' + mmdd.replace('/', '-') + '-' + j + '" part="button-icon-review" class="d-flex align-center mb-20 ml-10 button-icon-review"><span class="material-symbols-outlined" title="Mark as reviewed">flag</span>&nbsp;&nbsp;Mark Understood</button>')) : '') + '</div>';
2997
+ html += '<div class="d-flex align-center event-user-labels-container"><div part="badge-filter-name" class="graphparamname graphparamname1 mb-20' + (event.concise == null ? "" : ' hide') + '">' + graphParam.split(';')[0] + '</div>' + reporterStr + approverStr + (((event.module == "compliances" || event.module == null) && event.concise == null && ((event.reportformat == null || event.reportformat.length == 0) && (event.customreporting == null) && (event.reportedlocationsflag != true)) && !fromDrilldown) ? ('<button id="button-list-reporting-' + mmdd.replace('/', '-') + '-' + j + '-" part="button-list-reporting" class="material-icons ml-10 mb-20 button-list-reporting">edit_note</button>') : '') + (((event.module == "compliances" || event.module == null) && event.concise == null && configFlag) ? (event.review ? ('<button id="input-checkbox-review-' + mmdd.replace('/', '-') + '-' + j + '" part="button-icon-reviewed" class="material-symbols-outlined d-flex align-center mb-20 ml-10 button-icon-review">flag_check</button>') : ('<button id="input-checkbox-review-' + mmdd.replace('/', '-') + '-' + j + '" part="button-icon-review" class="d-flex align-center mb-20 ml-10 button-icon-review"><span class="material-symbols-outlined" title="Mark as reviewed">flag</span>&nbsp;&nbsp;Mark Understood</button>')) : '') + ((event.module == "rcmresource" && event.completenessstatus == "approved") ? '<button id="button-renew-' + mmdd.replace('/', '-') + '-' + j + '" part="button-icon-small" class="d-flex align-center mb-20 ml-10 button-icon button-renew"><span class="material-symbols-outlined" title="Renew">replay</span>&nbsp;&nbsp;Renew</button>' : '') + '</div>';
2997
2998
  // }
2998
2999
  return html;
2999
3000
  };
@@ -3098,6 +3099,7 @@ let SfIEvents = class SfIEvents extends LitElement {
3098
3099
  // const tempEvents1 = JSON.parse(JSON.stringify(this.events));
3099
3100
  // //console.log('eventlog1', tempEvents1['06/30'][7].comments, mmdd, j);
3100
3101
  partStatus = this.getCompletenessStatus(JSON.parse(JSON.stringify(this.events[mmdd][j])));
3102
+ this.events[mmdd][j].completenessstatus = partStatus;
3101
3103
  lateStatus = this.getTimelinessStatus(mmdd, JSON.parse(JSON.stringify(this.events[mmdd][j])), partStatus);
3102
3104
  complianceStatus = this.getComplianceStatus(partStatus, lateStatus, JSON.parse(JSON.stringify(this.events[mmdd][j])).percentage, JSON.parse(JSON.stringify(this.events[mmdd][j])));
3103
3105
  console.log("agreement partStatus", partStatus, lateStatus, complianceStatus);
@@ -5270,6 +5272,21 @@ let SfIEvents = class SfIEvents extends LitElement {
5270
5272
  }
5271
5273
  });
5272
5274
  }
5275
+ const buttonRenewArr = eventsContainer.querySelectorAll('.button-renew');
5276
+ for (var i = 0; i < buttonRenewArr.length; i++) {
5277
+ buttonRenewArr[i].addEventListener('click', async (ev) => {
5278
+ const id = ev.target.id;
5279
+ const idArr = id.split("-");
5280
+ console.log('idArr', idArr);
5281
+ const mmdd = idArr[2] + "/" + idArr[3];
5282
+ const j = idArr[4];
5283
+ const yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[3]);
5284
+ let renewEvent = this.events[mmdd][j];
5285
+ let fullEvent = await this.fetchRCMResourceDetails(renewEvent, mmdd + "/" + yyyy, true);
5286
+ console.log('renew clicked', fullEvent, fullEvent.reportformatvalues);
5287
+ this.renewRCMResource(fullEvent, fullEvent.reportformatvalues);
5288
+ });
5289
+ }
5273
5290
  const streamEventsContainer = eventsContainer.querySelectorAll('.stream-events-container');
5274
5291
  const buttonSelect = eventsContainer.querySelectorAll('.button-select');
5275
5292
  if (eventsContainer.innerHTML.indexOf('button-select-all') >= 0) {
@@ -9249,6 +9266,21 @@ let SfIEvents = class SfIEvents extends LitElement {
9249
9266
  }
9250
9267
  });
9251
9268
  }
9269
+ const buttonRenewArr = this._SfThisContainer.querySelectorAll('.button-renew');
9270
+ for (var i = 0; i < buttonRenewArr.length; i++) {
9271
+ buttonRenewArr[i].addEventListener('click', async (ev) => {
9272
+ const id = ev.target.id;
9273
+ const idArr = id.split("-");
9274
+ console.log('idArr', idArr);
9275
+ const mmdd = idArr[2] + "/" + idArr[3];
9276
+ const j = idArr[4];
9277
+ const yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[3]);
9278
+ let renewEvent = this.events[mmdd][j];
9279
+ let fullEvent = await this.fetchRCMResourceDetails(renewEvent, mmdd + "/" + yyyy, true);
9280
+ console.log('renew clicked', fullEvent, fullEvent.reportformatvalues);
9281
+ this.renewRCMResource(fullEvent, fullEvent.reportformatvalues);
9282
+ });
9283
+ }
9252
9284
  const streamEventsContainer = this._SfThisContainer.querySelectorAll('.stream-events-container');
9253
9285
  const buttonSelect = this._SfThisContainer.querySelectorAll('.button-select');
9254
9286
  let selectAllArr = this.attachSelectAllListeners(this._SfThisContainer, buttonSelect);
@@ -9879,6 +9911,21 @@ let SfIEvents = class SfIEvents extends LitElement {
9879
9911
  }
9880
9912
  });
9881
9913
  }
9914
+ const buttonRenewArr = this._SfStreamContainer.querySelectorAll('.button-renew');
9915
+ for (var i = 0; i < buttonRenewArr.length; i++) {
9916
+ buttonRenewArr[i].addEventListener('click', async (ev) => {
9917
+ const id = ev.target.id;
9918
+ const idArr = id.split("-");
9919
+ console.log('idArr', idArr);
9920
+ const mmdd = idArr[2] + "/" + idArr[3];
9921
+ const j = idArr[4];
9922
+ const yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[3]);
9923
+ let renewEvent = this.events[mmdd][j];
9924
+ let fullEvent = await this.fetchRCMResourceDetails(renewEvent, mmdd + "/" + yyyy, true);
9925
+ console.log('renew clicked', fullEvent, fullEvent.reportformatvalues);
9926
+ this.renewRCMResource(fullEvent, fullEvent.reportformatvalues);
9927
+ });
9928
+ }
9882
9929
  const streamEventsContainer = this._SfStreamContainer.querySelectorAll('.stream-events-container');
9883
9930
  const buttonSelect = this._SfStreamContainer.querySelectorAll('.button-select');
9884
9931
  let selectAllArr = this.attachSelectAllListeners(this._SfStreamContainer, buttonSelect);
@@ -10945,6 +10992,21 @@ let SfIEvents = class SfIEvents extends LitElement {
10945
10992
  }
10946
10993
  });
10947
10994
  }
10995
+ const buttonRenewArr = this._SfDetailListContainer.querySelectorAll('.button-renew');
10996
+ for (var i = 0; i < buttonRenewArr.length; i++) {
10997
+ buttonRenewArr[i].addEventListener('click', async (ev) => {
10998
+ const id = ev.target.id;
10999
+ const idArr = id.split("-");
11000
+ console.log('idArr', idArr);
11001
+ const mmdd = idArr[2] + "/" + idArr[3];
11002
+ const j = idArr[4];
11003
+ const yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[3]);
11004
+ let renewEvent = this.events[mmdd][j];
11005
+ let fullEvent = await this.fetchRCMResourceDetails(renewEvent, mmdd + "/" + yyyy, true);
11006
+ console.log('renew clicked', fullEvent, fullEvent.reportformatvalues);
11007
+ this.renewRCMResource(fullEvent, fullEvent.reportformatvalues);
11008
+ });
11009
+ }
10948
11010
  };
10949
11011
  this.renderEventDetailShort = (compliance) => {
10950
11012
  var _a, _b, _c, _f, _g;
@@ -13456,7 +13518,7 @@ let SfIEvents = class SfIEvents extends LitElement {
13456
13518
  }
13457
13519
  }
13458
13520
  };
13459
- this.fetchRCMResourceDetails = async (listEvent, mmddyyyy) => {
13521
+ this.fetchRCMResourceDetails = async (listEvent, mmddyyyy, flagReturn = false) => {
13460
13522
  let entityId = listEvent.entityid;
13461
13523
  let locationId = listEvent.locationid;
13462
13524
  let url = "https://" + this.apiIdRCMResources + "/getallobjectdetails";
@@ -13469,7 +13531,12 @@ let SfIEvents = class SfIEvents extends LitElement {
13469
13531
  if (xhr.status == 200) {
13470
13532
  const jsonRespose = JSON.parse(xhr.responseText);
13471
13533
  console.log('jsonRespose agreement details', jsonRespose);
13472
- this.renderRCMResourceDetails(jsonRespose.object, mmddyyyy);
13534
+ if (flagReturn) {
13535
+ return jsonRespose.object;
13536
+ }
13537
+ else {
13538
+ this.renderRCMResourceDetails(jsonRespose.object, mmddyyyy);
13539
+ }
13473
13540
  }
13474
13541
  else {
13475
13542
  if (xhr.status == 401) {
@@ -13704,12 +13771,12 @@ let SfIEvents = class SfIEvents extends LitElement {
13704
13771
  return;
13705
13772
  }
13706
13773
  let reportformatvalues = {};
13707
- let reportformatvaluesStr = "";
13774
+ // let reportformatvaluesStr: string = ""
13708
13775
  let reportingReporting = this._SfDetailContainer.querySelector('#reporting-reporting-0');
13709
13776
  console.log('renew reporting', reportingReporting);
13710
13777
  if (reportingReporting != null) {
13711
13778
  reportformatvalues = reportingReporting.selectedValues();
13712
- reportformatvaluesStr = JSON.stringify(reportingReporting.selectedValues());
13779
+ // reportformatvaluesStr = JSON.stringify(reportingReporting!.selectedValues())
13713
13780
  }
13714
13781
  let comparedObj = Util.compareObjects(reportformatvalues, JSON.parse(listEvent.reportformatvalues));
13715
13782
  console.log('reportformatvalues', reportformatvalues, JSON.parse(listEvent.reportformatvalues), comparedObj);
@@ -13729,7 +13796,7 @@ let SfIEvents = class SfIEvents extends LitElement {
13729
13796
  console.log('mmddyyyy', mmddyyyy);
13730
13797
  if (await this.uploadReview(entityId, locationId, mmddyyyy, listEvent["id"], comments, approved, (_a = listEvent.module) !== null && _a !== void 0 ? _a : "compliance")) {
13731
13798
  if (approved) {
13732
- await this.renewRCMResource(listEvent, reportformatvaluesStr);
13799
+ // await this.renewRCMResource(listEvent, reportformatvaluesStr);
13733
13800
  }
13734
13801
  else {
13735
13802
  console.log('renew reporting', reportformatvalues);
@@ -14028,7 +14095,7 @@ let SfIEvents = class SfIEvents extends LitElement {
14028
14095
  this.events[mmdd][p].lastupdated = new Date().toString();
14029
14096
  }
14030
14097
  }
14031
- await this.renewRCMResource(listEvent, reportformatvalues);
14098
+ // await this.renewRCMResource(listEvent, reportformatvalues);
14032
14099
  console.log('upload report auto approve single');
14033
14100
  }
14034
14101
  if (this.recentlyReported[mmdd] == null) {
@@ -25684,7 +25751,7 @@ let SfIEvents = class SfIEvents extends LitElement {
25684
25751
  }
25685
25752
  };
25686
25753
  this.renderReports = (reportsData) => {
25687
- var _a;
25754
+ var _a, _b;
25688
25755
  let html = '<div class="d-flex flex-col w-100-m-0">';
25689
25756
  html += '<div part="stream-event-list" class="d-flex flex-col align-stretch">';
25690
25757
  for (let reportKey of Object.keys(reportsData)) {
@@ -25699,7 +25766,7 @@ let SfIEvents = class SfIEvents extends LitElement {
25699
25766
  html += '<table>';
25700
25767
  html += '<tr>';
25701
25768
  html += '<th part="td-head">Select</th>';
25702
- html += '<th part="td-head">Zombie</th>';
25769
+ html += '<th part="td-head">Processed</th>';
25703
25770
  html += '<th part="td-head">Date</th>';
25704
25771
  html += '<th part="td-head">Docs</th>';
25705
25772
  html += '<th part="td-head">Comments</th>';
@@ -25710,7 +25777,7 @@ let SfIEvents = class SfIEvents extends LitElement {
25710
25777
  html += '</tr>';
25711
25778
  html += '<tr>';
25712
25779
  html += '<td part="td-body"><button id="button-select-' + reportKey.replace(/-/g, '_') + '" part="button-icon-small" class="material-icons button-expand mr-10 button-select">check</button></td>';
25713
- html += '<td part="td-body"><button id="button-check-' + reportKey.replace(/-/g, '_') + '" part="button-icon-small" class="material-symbols-outlined button-expand mr-10 button-check">search_check</button></td>';
25780
+ html += `<td part="td-body"><span class="material-symbols-outlined mr-10">${((_a = report['processed']) !== null && _a !== void 0 ? _a : false) ? "done_all" : ""}</span></td>`;
25714
25781
  html += `<td part="td-body">${reportKey.split(';')[0]}</td>`;
25715
25782
  html += `<td part="td-body">${JSON.parse(report['docs']).length}</td>`;
25716
25783
  html += `<td part="td-body">${report['comments'].length}</td>`;
@@ -25719,7 +25786,7 @@ let SfIEvents = class SfIEvents extends LitElement {
25719
25786
  let locationname = "";
25720
25787
  let eventHtml = "";
25721
25788
  if (report['event'] != null) {
25722
- locationname = (_a = JSON.parse(report['event'])['locationname']) !== null && _a !== void 0 ? _a : "";
25789
+ locationname = (_b = JSON.parse(report['event'])['locationname']) !== null && _b !== void 0 ? _b : "";
25723
25790
  for (var i = 0; i < Object.keys(JSON.parse(report['event'])).length; i++) {
25724
25791
  if (!this.EXCLUDE_COLS_FROM_REGS.includes(Object.keys(JSON.parse(report['event']))[i].toLowerCase())) {
25725
25792
  eventHtml += '<td part="td-body-register">';
@@ -25751,13 +25818,16 @@ let SfIEvents = class SfIEvents extends LitElement {
25751
25818
  const arrButtonSelect = this._SfIEventsC.querySelectorAll('.button-select');
25752
25819
  for (let buttonSelect of arrButtonSelect) {
25753
25820
  buttonSelect.addEventListener('click', (ev) => {
25821
+ var _a;
25754
25822
  const id = ev.target.id;
25755
25823
  console.log('id', id);
25756
25824
  const idArr = id.split("-");
25757
25825
  console.log('idArr', idArr);
25758
25826
  const sortid = idArr[2].replace(/_/g, '-');
25759
25827
  console.log('selected sortid', sortid);
25760
- this.renderDateSelector(sortid);
25828
+ let reportData = JSON.parse(reportsData[sortid]);
25829
+ console.log('selectedReportData', reportData);
25830
+ this.renderComplianceSelector(sortid, (_a = reportData.processed) !== null && _a !== void 0 ? _a : false);
25761
25831
  });
25762
25832
  }
25763
25833
  const arrButtonCheck = this._SfIEventsC.querySelectorAll('.button-check');
@@ -25858,110 +25928,136 @@ let SfIEvents = class SfIEvents extends LitElement {
25858
25928
  });
25859
25929
  }
25860
25930
  };
25861
- this.renderDateSelector = (sortid) => {
25931
+ this.renderComplianceSelector = (sortid, processed = false) => {
25862
25932
  let html = '';
25863
25933
  html += '<div class="w-100-m-0 d-flex flex-col justify-center">';
25864
25934
  html += '<div class="w-100-m-0 d-flex justify-start">';
25865
25935
  html += '<button id="button-reports-date-selector-back" part="button-icon" class="button-icon"><span class="material-icons">keyboard_backspace</span></button>';
25866
25936
  html += '</div>';
25867
- html += '<label part="input-label" class="mt-20">Select Date</label>';
25868
- html += `<input id="input-compliance-date" part="input-text" class="input-text mb-20" type="date" />`;
25869
- html += `<sf-i-form id="input-location-tags" name="Tags" label="Select Location" apiId="${this.apiIdTags}" mode="select" searchPhrase="${this.projectName}&Location" selectProjection="name" ignoreProjections="[&quot;updatetype&quot;,&quot;project&quot;,&quot;tagtype&quot;,&quot;shortid&quot;,&quot;shortnumid&quot;,&quot;lastmodifiedby&quot;,&quot;lastmodifiedtime&quot;]" mandatory></sf-i-form>`;
25870
- // html += '<button id="button-reports-date-selector-back" class="button-back" part="button">back</button>';
25937
+ html += `<sf-i-form id="input-user" class="m-20" name="Users" label="Select Reporter" apiId="${this.apiIdUserProfiles}" mode="select" searchPhrase="${this.projectName}" selectProjection="name" ignoreProjections="[&quot;updatetype&quot;,&quot;project&quot;,&quot;tagtype&quot;,&quot;userid&quot;,&quot;usermap&quot;,&quot;kra&quot;,&quot;role&quot;,&quot;trainingstatute&quot;,&quot;shortid&quot;,&quot;shortnumid&quot;,&quot;lastmodifiedby&quot;,&quot;lastmodifiedtime&quot;]"></sf-i-form>`;
25938
+ html += `<sf-i-form id="input-entity-tags" class="m-20" name="Tags" label="Select Entity" apiId="${this.apiIdTags}" mode="select" searchPhrase="${this.projectName}&Entity" selectProjection="name" ignoreProjections="[&quot;updatetype&quot;,&quot;project&quot;,&quot;tagtype&quot;,&quot;shortid&quot;,&quot;shortnumid&quot;,&quot;lastmodifiedby&quot;,&quot;lastmodifiedtime&quot;]"></sf-i-form>`;
25939
+ html += `<sf-i-form id="input-location-tags" class="m-20" name="Tags" label="Select Location" apiId="${this.apiIdTags}" mode="select" searchPhrase="${this.projectName}&Location" selectProjection="name" ignoreProjections="[&quot;updatetype&quot;,&quot;project&quot;,&quot;tagtype&quot;,&quot;shortid&quot;,&quot;shortnumid&quot;,&quot;lastmodifiedby&quot;,&quot;lastmodifiedtime&quot;]"></sf-i-form>`;
25940
+ html += '<div class="w-100-m-0 d-flex justify-start">';
25941
+ html += '<button id="button-reports-search" part="button-icon" class="button-icon d-flex justify-between align-center ml-10" disabled><span class="material-icons">search</span>&nbsp;&nbsp;Search</button>';
25942
+ html += `<button id="button-reports-mark" part="button-icon" class="button-icon d-flex justify-between align-center ml-10"><span class="material-icons">${processed ? "remove_done" : "done_all"}</span>&nbsp;&nbsp;${processed ? "Unmark" : "Mark"} Processed</button>`;
25943
+ html += '</div>';
25871
25944
  html += '</div>';
25872
25945
  this._SfIEventsC.querySelector('#reports-data').innerHTML = html;
25873
- let inputComplianceDate = this._SfIEventsC.querySelector('#input-compliance-date');
25946
+ let inputReporter = this._SfIEventsC.querySelector('#input-user');
25947
+ let inputEntityForm = this._SfIEventsC.querySelector('#input-entity-tags');
25874
25948
  let inputLocationForm = this._SfIEventsC.querySelector('#input-location-tags');
25875
- inputComplianceDate.addEventListener('change', (ev) => {
25876
- let selectedDate = new Date(ev.target.value);
25877
- let selectedLocation = inputLocationForm.selectedValues()[0];
25878
- if (selectedLocation == null || selectedLocation == '') {
25879
- return;
25880
- // let locationId = sortid.split(';')[2]
25881
- // selectedLocation = locationId;
25882
- }
25883
- this.fetchReportCompliances(selectedDate, selectedLocation, sortid);
25949
+ inputReporter.loadMode();
25950
+ inputReporter.addEventListener('valueChanged', (ev) => {
25951
+ let targetForm = ev.target;
25952
+ let selectedReporter = targetForm.selectedTexts()[0];
25953
+ console.log('reporter selected', selectedReporter);
25954
+ checkButtonSearch();
25955
+ });
25956
+ let entityId = sortid.split(';')[1];
25957
+ inputEntityForm.selectedSearchId = entityId;
25958
+ inputEntityForm.loadMode();
25959
+ inputEntityForm.addEventListener('valueChanged', (ev) => {
25960
+ let targetForm = ev.target;
25961
+ let selectedEntity = targetForm.selectedTexts()[0];
25962
+ console.log('entity selected', selectedEntity);
25963
+ inputLocationForm.searchPhrase = this.projectName + '&Location&' + selectedEntity.replace(/\([^)]*\)/g, "");
25964
+ inputLocationForm.loadMode();
25965
+ checkButtonSearch();
25884
25966
  });
25885
25967
  let locationId = sortid.split(';')[2];
25886
25968
  inputLocationForm.selectedSearchId = locationId;
25887
25969
  inputLocationForm.loadMode();
25888
25970
  inputLocationForm.addEventListener('valueChanged', (ev) => {
25889
- let form = ev.target;
25890
- let selectedDate = new Date(inputComplianceDate.value);
25891
- if (selectedDate.toString() == 'Invalid Date') {
25892
- return;
25893
- // let mmddyyyy = sortid.split(';')[0];
25894
- // let mm = mmddyyyy.split('/')[0];
25895
- // let dd = mmddyyyy.split('/')[1];
25896
- // let yyyy = mmddyyyy.split('/')[2];
25897
- // selectedDate = new Date(parseInt(yyyy), parseInt(mm) - 1, parseInt(dd));
25898
- }
25899
- let selectedLocation = form.selectedValues()[0];
25900
- this.fetchReportCompliances(selectedDate, selectedLocation, sortid);
25971
+ let targetForm = ev.target;
25972
+ let selectedLocation = targetForm.selectedTexts()[0];
25973
+ console.log('location selected', selectedLocation);
25974
+ checkButtonSearch();
25901
25975
  });
25902
25976
  let buttonBack = this._SfIEventsC.querySelector('#button-reports-date-selector-back');
25903
25977
  buttonBack.addEventListener('click', () => {
25904
25978
  this.fetchReports();
25905
25979
  });
25980
+ let buttonSearch = this._SfIEventsC.querySelector('#button-reports-search');
25981
+ buttonSearch.addEventListener('click', () => {
25982
+ let selectedReporterId = inputReporter.selectedValues()[0];
25983
+ let selectedEntityId = inputEntityForm.selectedValues()[0];
25984
+ let selectedLocationId = inputLocationForm.selectedValues()[0];
25985
+ this.fetchReportCompliances(selectedReporterId, selectedEntityId, selectedLocationId, sortid, processed);
25986
+ });
25987
+ let buttonMark = this._SfIEventsC.querySelector('#button-reports-mark');
25988
+ buttonMark.addEventListener('click', () => {
25989
+ let [mmddyyyy, entityid, locationid, complianceid] = sortid.split(';');
25990
+ let year = this.getFinancialYear(mmddyyyy);
25991
+ this.markReport(mmddyyyy, entityid, locationid, complianceid, year, !processed);
25992
+ });
25993
+ function checkButtonSearch() {
25994
+ let selectedReporterId = inputReporter.selectedValues()[0];
25995
+ let selectedEntityId = inputEntityForm.selectedValues()[0];
25996
+ let selectedLocationId = inputLocationForm.selectedValues()[0];
25997
+ if (selectedReporterId != null && selectedEntityId != null && selectedLocationId != null) {
25998
+ buttonSearch.disabled = false;
25999
+ }
26000
+ else {
26001
+ buttonSearch.disabled = true;
26002
+ }
26003
+ }
25906
26004
  };
25907
- this.fetchReportCompliances = async (selectedDate, locationid, sortid) => {
25908
- console.log('fetching compliances', sortid);
25909
- let complianceEntityId = sortid.split(';')[1];
25910
- // let complianceLocationId = sortid.split(';')[2]
25911
- let url = "https://" + this.apiId + "/getallcountryevents5";
25912
- let sDateObj = selectedDate;
25913
- sDateObj.setDate(selectedDate.getDate() - 60);
25914
- let day = '' + sDateObj.getDate();
25915
- let month = '' + (sDateObj.getMonth() + 1);
25916
- let year = '' + sDateObj.getFullYear();
25917
- if (month.length < 2)
25918
- month = '0' + month;
25919
- if (day.length < 2)
25920
- day = '0' + day;
25921
- let sDate = month + "/" + day + "/" + year;
25922
- let eDateObj = selectedDate;
25923
- eDateObj.setDate(selectedDate.getDate() + 120);
25924
- day = '' + eDateObj.getDate();
25925
- month = '' + (eDateObj.getMonth() + 1);
25926
- year = '' + eDateObj.getFullYear();
25927
- if (month.length < 2)
25928
- month = '0' + month;
25929
- if (day.length < 2)
25930
- day = '0' + day;
25931
- let eDate = month + "/" + day + "/" + year;
25932
- //console.log('fetch calendar url', url);
25933
- let urlBody = { "projectid": this.projectId, "userprofileid": this.userProfileId, "role": this.myRole, "entityid": complianceEntityId, "countryid": "", "functionid": "", "locationid": locationid, "tagid": this.tagId, "adhoc": "false", "exclusivestartkey": 0, "sdate": sDate, "edate": eDate, "view": "location", "year": this.calendarStartYYYY };
26005
+ this.markReport = async (mmddyyyy, entityid, locationid, eventid, year, processed) => {
26006
+ console.log('marking report', eventid, processed);
26007
+ let url = "https://" + this.apiId + "/markreportprocessed";
26008
+ let urlBody = { "projectid": this.projectId, "eventid": eventid, "mmddyyyy": mmddyyyy, "entityid": entityid, "locationid": locationid, "year": year, "processed": processed };
25934
26009
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
25935
26010
  const xhr = (await this.prepareXhr(urlBody, url, this._SfLoader, authorization, 'Preparing'));
25936
26011
  this._SfLoader.innerHTML = '';
25937
26012
  if (xhr.status == 200) {
25938
- const jsonRespose = JSON.parse(xhr.responseText);
25939
- console.log('jsonRespose', jsonRespose);
25940
- let arrCompliances = (await this.fetchPresignedUrl(jsonRespose.signedUrlGet));
25941
- await this.fetchPresignedUrlDelete(jsonRespose.signedUrlDelete);
25942
- console.log('receivedCompliacnes', arrCompliances);
25943
- this.renderReportsCompliances(arrCompliances, sortid);
26013
+ this.setSuccess("Report " + ((processed == true) ? "marked" : "unmarked") + " successfully.");
26014
+ this.fetchReports();
26015
+ setTimeout(() => {
26016
+ this.clearMessages();
26017
+ }, 5000);
25944
26018
  }
25945
26019
  else {
25946
- if (xhr.status == 401) {
25947
- let changeEvent = new CustomEvent('tokenExpired', { bubbles: true });
25948
- this.dispatchEvent(changeEvent);
25949
- }
25950
- if (xhr.status === 404) {
25951
- this.showChosenProject();
25952
- this._SfTitleChosenProject.innerHTML = this._SfProject[0].querySelector('#sf-i-project').selectedTexts()[0];
25953
- this.renderChosenProject();
25954
- }
25955
- else {
25956
- const jsonRespose = JSON.parse(xhr.responseText);
25957
- this.setError(jsonRespose.error);
26020
+ const jsonResponse = JSON.parse(xhr.responseText);
26021
+ this.setError(jsonResponse.error);
26022
+ setTimeout(() => {
26023
+ this.clearMessages();
26024
+ }, 5000);
26025
+ }
26026
+ };
26027
+ this.fetchReportCompliances = async (reporterid, entityid, locationid, sortid, processed) => {
26028
+ console.log('fetching compliances', sortid);
26029
+ let url = "https://" + this.apiId + "/geteventfromreport";
26030
+ let urlBody = { "projectid": this.projectId, "sortid": sortid, "reporterid": reporterid, "entityid": entityid, "locationid": locationid };
26031
+ const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
26032
+ const xhr = (await this.prepareXhr(urlBody, url, this._SfLoader, authorization, 'Preparing'));
26033
+ this._SfLoader.innerHTML = '';
26034
+ if (xhr.status == 200) {
26035
+ const jsonResponse = JSON.parse(xhr.responseText);
26036
+ console.log('fetch compliances jsonRespose', jsonResponse);
26037
+ if (jsonResponse.event == null) {
26038
+ this.setError("Compliance status is - " + jsonResponse.completenessstatus);
25958
26039
  setTimeout(() => {
25959
26040
  this.clearMessages();
25960
26041
  }, 5000);
25961
26042
  }
26043
+ else {
26044
+ let returnedEvent = jsonResponse.event;
26045
+ let arrCompliances = [(returnedEvent)];
26046
+ let assocEvents = {};
26047
+ let mmdd = (returnedEvent.duedate).split('/')[1] + "/" + (returnedEvent.duedate).split('/')[0];
26048
+ assocEvents[mmdd] = arrCompliances;
26049
+ this.renderReportsCompliances(assocEvents, sortid, processed);
26050
+ }
26051
+ }
26052
+ else {
26053
+ const jsonResponse = JSON.parse(xhr.responseText);
26054
+ this.setError(jsonResponse.error);
26055
+ setTimeout(() => {
26056
+ this.clearMessages();
26057
+ }, 5000);
25962
26058
  }
25963
26059
  };
25964
- this.renderReportsCompliances = (compliancesData, sortid) => {
26060
+ this.renderReportsCompliances = (compliancesData, sortid, processed) => {
25965
26061
  let eventsData = {};
25966
26062
  let complianceId = sortid.split(';')[3];
25967
26063
  console.log('renderReportsComplainces', compliancesData, complianceId);
@@ -26056,21 +26152,22 @@ let SfIEvents = class SfIEvents extends LitElement {
26056
26152
  const id = ev.target.id;
26057
26153
  const idArr = id.split("-");
26058
26154
  const mmdd = idArr[3] + "/" + idArr[4];
26059
- // const j = idArr[5];
26155
+ const j = idArr[5];
26156
+ let eventObj = eventsData[mmdd][j];
26060
26157
  console.log('move reporting', mmdd + '/' + this.calendarStartYYYY, sortid);
26061
- this.submitUpdateReporting(mmdd + '/' + this.calendarStartYYYY, sortid);
26158
+ this.submitUpdateReporting(mmdd + '/' + this.calendarStartYYYY, eventObj['entityid'], eventObj['locationid'], sortid);
26062
26159
  });
26063
26160
  }
26064
26161
  let buttonBack = this._SfIEventsC.querySelector('#button-reports-date-selector-back');
26065
26162
  buttonBack.addEventListener('click', () => {
26066
- this.renderDateSelector(sortid);
26163
+ this.renderComplianceSelector(sortid, processed);
26067
26164
  });
26068
26165
  };
26069
- this.submitUpdateReporting = async (mmddyyyy, sortid) => {
26166
+ this.submitUpdateReporting = async (mmddyyyy, entityid, locationid, sortid) => {
26070
26167
  let url = "https://" + this.apiId + "/updatereportdate";
26071
26168
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
26072
26169
  console.log('this.myroles', this.myroles);
26073
- const xhr = (await this.prepareXhr({ "projectid": this.projectId, "mmddyyyy": mmddyyyy, "sortid": sortid }, url, this._SfLoader, authorization));
26170
+ const xhr = (await this.prepareXhr({ "projectid": this.projectId, "mmddyyyy": mmddyyyy, "entityid": entityid, "locationid": locationid, "sortid": sortid }, url, this._SfLoader, authorization));
26074
26171
  this._SfLoader.innerHTML = '';
26075
26172
  if (xhr.status == 200) {
26076
26173
  this.setSuccess("update successful!");
@@ -27903,6 +28000,9 @@ __decorate([
27903
28000
  __decorate([
27904
28001
  property()
27905
28002
  ], SfIEvents.prototype, "apiIdTags", void 0);
28003
+ __decorate([
28004
+ property()
28005
+ ], SfIEvents.prototype, "apiIdUserProfiles", void 0);
27906
28006
  __decorate([
27907
28007
  property()
27908
28008
  ], SfIEvents.prototype, "apiIdNotices", void 0);
@@ -1261,6 +1261,9 @@ export class SfIEvents extends LitElement {
1261
1261
  @property()
1262
1262
  apiIdTags!: string;
1263
1263
 
1264
+ @property()
1265
+ apiIdUserProfiles!: string;
1266
+
1264
1267
  @property()
1265
1268
  apiIdNotices!: string;
1266
1269
 
@@ -5279,7 +5282,7 @@ export class SfIEvents extends LitElement {
5279
5282
  renderCalendarAnnotations = (event: any, mmdd: string, j: number, fromDrilldown: boolean) => {
5280
5283
 
5281
5284
  var html = '';
5282
-
5285
+ console.log('rendering Annotations', event.module, event.completenessstatus)
5283
5286
  html += '<div class="hidden-filtername hide"><table><thead><th part="badge-filter-name" class="filtername"></th></thead></table></div>'
5284
5287
  // if(event.concise == null && event.approvers != null){
5285
5288
  let reporterStr = event.concise == null ? this.getReporterStringFromEvent(event) : "";
@@ -5289,7 +5292,7 @@ export class SfIEvents extends LitElement {
5289
5292
  // console.log("graphParam", graphParam.split(';')[0]);
5290
5293
  const configHome = Util.getProjectConfigHome();
5291
5294
  const configFlag = configHome.features != null && configHome.features.indexOf("understood") >= 0
5292
- html += '<div class="d-flex align-center event-user-labels-container"><div part="badge-filter-name" class="graphparamname graphparamname1 mb-20' + (event.concise == null ? "" : ' hide') + '">' + graphParam.split(';')[0] + '</div>' + reporterStr + approverStr + (((event.module == "compliances" || event.module == null) && event.concise == null && ((event.reportformat == null || event.reportformat.length == 0) && (event.customreporting == null) && (event.reportedlocationsflag != true)) && !fromDrilldown) ? ('<button id="button-list-reporting-' + mmdd.replace('/', '-') + '-' + j + '-" part="button-list-reporting" class="material-icons ml-10 mb-20 button-list-reporting">edit_note</button>') : '') + (((event.module == "compliances" || event.module == null) && event.concise == null && configFlag) ? (event.review ? ('<button id="input-checkbox-review-' + mmdd.replace('/', '-') + '-' + j + '" part="button-icon-reviewed" class="material-symbols-outlined d-flex align-center mb-20 ml-10 button-icon-review">flag_check</button>') : ('<button id="input-checkbox-review-' + mmdd.replace('/', '-') + '-' + j + '" part="button-icon-review" class="d-flex align-center mb-20 ml-10 button-icon-review"><span class="material-symbols-outlined" title="Mark as reviewed">flag</span>&nbsp;&nbsp;Mark Understood</button>')) : '') + '</div>';
5295
+ html += '<div class="d-flex align-center event-user-labels-container"><div part="badge-filter-name" class="graphparamname graphparamname1 mb-20' + (event.concise == null ? "" : ' hide') + '">' + graphParam.split(';')[0] + '</div>' + reporterStr + approverStr + (((event.module == "compliances" || event.module == null) && event.concise == null && ((event.reportformat == null || event.reportformat.length == 0) && (event.customreporting == null) && (event.reportedlocationsflag != true)) && !fromDrilldown) ? ('<button id="button-list-reporting-' + mmdd.replace('/', '-') + '-' + j + '-" part="button-list-reporting" class="material-icons ml-10 mb-20 button-list-reporting">edit_note</button>') : '') + (((event.module == "compliances" || event.module == null) && event.concise == null && configFlag) ? (event.review ? ('<button id="input-checkbox-review-' + mmdd.replace('/', '-') + '-' + j + '" part="button-icon-reviewed" class="material-symbols-outlined d-flex align-center mb-20 ml-10 button-icon-review">flag_check</button>') : ('<button id="input-checkbox-review-' + mmdd.replace('/', '-') + '-' + j + '" part="button-icon-review" class="d-flex align-center mb-20 ml-10 button-icon-review"><span class="material-symbols-outlined" title="Mark as reviewed">flag</span>&nbsp;&nbsp;Mark Understood</button>')) : '') + ((event.module == "rcmresource" && event.completenessstatus == "approved") ? '<button id="button-renew-' + mmdd.replace('/', '-') + '-' + j + '" part="button-icon-small" class="d-flex align-center mb-20 ml-10 button-icon button-renew"><span class="material-symbols-outlined" title="Renew">replay</span>&nbsp;&nbsp;Renew</button>' : '') +'</div>';
5293
5296
  // }
5294
5297
 
5295
5298
  return html;
@@ -5407,6 +5410,7 @@ export class SfIEvents extends LitElement {
5407
5410
  // //console.log('eventlog1', tempEvents1['06/30'][7].comments, mmdd, j);
5408
5411
 
5409
5412
  partStatus = this.getCompletenessStatus(JSON.parse(JSON.stringify(this.events[mmdd][j])));
5413
+ this.events[mmdd][j].completenessstatus = partStatus;
5410
5414
  lateStatus = this.getTimelinessStatus(mmdd, JSON.parse(JSON.stringify(this.events[mmdd][j])), partStatus);
5411
5415
  complianceStatus = this.getComplianceStatus(partStatus, lateStatus, JSON.parse(JSON.stringify(this.events[mmdd][j])).percentage, JSON.parse(JSON.stringify(this.events[mmdd][j])));
5412
5416
  console.log("agreement partStatus", partStatus, lateStatus, complianceStatus);
@@ -7739,6 +7743,23 @@ export class SfIEvents extends LitElement {
7739
7743
 
7740
7744
  }
7741
7745
 
7746
+ const buttonRenewArr = eventsContainer.querySelectorAll('.button-renew') as NodeListOf<HTMLButtonElement>;
7747
+
7748
+ for (var i = 0; i < buttonRenewArr.length; i++) {
7749
+ buttonRenewArr[i].addEventListener('click', async (ev: any) => {
7750
+ const id = ev.target.id;
7751
+ const idArr = id.split("-")
7752
+ console.log('idArr', idArr);
7753
+ const mmdd = idArr[2] + "/" + idArr[3];
7754
+ const j = idArr[4];
7755
+ const yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[3]);
7756
+ let renewEvent = this.events[mmdd][j];
7757
+ let fullEvent = await this.fetchRCMResourceDetails(renewEvent, mmdd + "/" + yyyy, true);
7758
+ console.log('renew clicked', fullEvent, fullEvent.reportformatvalues);
7759
+ this.renewRCMResource(fullEvent, fullEvent.reportformatvalues);
7760
+ })
7761
+ }
7762
+
7742
7763
  const streamEventsContainer = eventsContainer.querySelectorAll('.stream-events-container') as NodeListOf<HTMLDivElement>;
7743
7764
  const buttonSelect = eventsContainer.querySelectorAll('.button-select') as NodeListOf<HTMLButtonElement>;
7744
7765
  if (eventsContainer.innerHTML.indexOf('button-select-all') >= 0) {
@@ -12434,6 +12455,23 @@ export class SfIEvents extends LitElement {
12434
12455
 
12435
12456
  }
12436
12457
 
12458
+ const buttonRenewArr = (this._SfThisContainer as HTMLDivElement).querySelectorAll('.button-renew') as NodeListOf<HTMLButtonElement>;
12459
+
12460
+ for (var i = 0; i < buttonRenewArr.length; i++) {
12461
+ buttonRenewArr[i].addEventListener('click', async (ev: any) => {
12462
+ const id = ev.target.id;
12463
+ const idArr = id.split("-")
12464
+ console.log('idArr', idArr);
12465
+ const mmdd = idArr[2] + "/" + idArr[3];
12466
+ const j = idArr[4];
12467
+ const yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[3]);
12468
+ let renewEvent = this.events[mmdd][j];
12469
+ let fullEvent = await this.fetchRCMResourceDetails(renewEvent, mmdd + "/" + yyyy, true);
12470
+ console.log('renew clicked', fullEvent, fullEvent.reportformatvalues);
12471
+ this.renewRCMResource(fullEvent, fullEvent.reportformatvalues);
12472
+ })
12473
+ }
12474
+
12437
12475
  const streamEventsContainer = (this._SfThisContainer as HTMLDivElement).querySelectorAll('.stream-events-container') as NodeListOf<HTMLDivElement>;
12438
12476
  const buttonSelect = (this._SfThisContainer as HTMLDivElement).querySelectorAll('.button-select') as NodeListOf<HTMLButtonElement>;
12439
12477
  let selectAllArr = this.attachSelectAllListeners((this._SfThisContainer as HTMLDivElement), buttonSelect)
@@ -13150,6 +13188,23 @@ export class SfIEvents extends LitElement {
13150
13188
 
13151
13189
  }
13152
13190
 
13191
+ const buttonRenewArr = (this._SfStreamContainer as HTMLDivElement).querySelectorAll('.button-renew') as NodeListOf<HTMLButtonElement>;
13192
+
13193
+ for (var i = 0; i < buttonRenewArr.length; i++) {
13194
+ buttonRenewArr[i].addEventListener('click', async (ev: any) => {
13195
+ const id = ev.target.id;
13196
+ const idArr = id.split("-")
13197
+ console.log('idArr', idArr);
13198
+ const mmdd = idArr[2] + "/" + idArr[3];
13199
+ const j = idArr[4];
13200
+ const yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[3]);
13201
+ let renewEvent = this.events[mmdd][j];
13202
+ let fullEvent = await this.fetchRCMResourceDetails(renewEvent, mmdd + "/" + yyyy, true);
13203
+ console.log('renew clicked', fullEvent, fullEvent.reportformatvalues);
13204
+ this.renewRCMResource(fullEvent, fullEvent.reportformatvalues);
13205
+ })
13206
+ }
13207
+
13153
13208
  const streamEventsContainer = (this._SfStreamContainer as HTMLDivElement).querySelectorAll('.stream-events-container') as NodeListOf<HTMLDivElement>;
13154
13209
  const buttonSelect = (this._SfStreamContainer as HTMLDivElement).querySelectorAll('.button-select') as NodeListOf<HTMLButtonElement>;
13155
13210
  let selectAllArr = this.attachSelectAllListeners((this._SfStreamContainer as HTMLDivElement), buttonSelect)
@@ -14427,6 +14482,23 @@ export class SfIEvents extends LitElement {
14427
14482
 
14428
14483
  }
14429
14484
 
14485
+ const buttonRenewArr = (this._SfDetailListContainer as HTMLDivElement).querySelectorAll('.button-renew') as NodeListOf<HTMLButtonElement>;
14486
+
14487
+ for (var i = 0; i < buttonRenewArr.length; i++) {
14488
+ buttonRenewArr[i].addEventListener('click', async (ev: any) => {
14489
+ const id = ev.target.id;
14490
+ const idArr = id.split("-")
14491
+ console.log('idArr', idArr);
14492
+ const mmdd = idArr[2] + "/" + idArr[3];
14493
+ const j = idArr[4];
14494
+ const yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[3]);
14495
+ let renewEvent = this.events[mmdd][j];
14496
+ let fullEvent = await this.fetchRCMResourceDetails(renewEvent, mmdd + "/" + yyyy, true);
14497
+ console.log('renew clicked', fullEvent, fullEvent.reportformatvalues);
14498
+ this.renewRCMResource(fullEvent, fullEvent.reportformatvalues);
14499
+ })
14500
+ }
14501
+
14430
14502
  }
14431
14503
  renderEventDetailShort = (compliance: any) => {
14432
14504
  var html = `
@@ -17296,7 +17368,7 @@ export class SfIEvents extends LitElement {
17296
17368
  }
17297
17369
  }
17298
17370
 
17299
- fetchRCMResourceDetails = async (listEvent: any, mmddyyyy: string) => {
17371
+ fetchRCMResourceDetails = async (listEvent: any, mmddyyyy: string, flagReturn: boolean = false) => {
17300
17372
  let entityId = listEvent.entityid;
17301
17373
  let locationId = listEvent.locationid;
17302
17374
  let url = "https://" + this.apiIdRCMResources + "/getallobjectdetails";
@@ -17313,7 +17385,11 @@ export class SfIEvents extends LitElement {
17313
17385
 
17314
17386
  const jsonRespose = JSON.parse(xhr.responseText);
17315
17387
  console.log('jsonRespose agreement details', jsonRespose);
17316
- this.renderRCMResourceDetails(jsonRespose.object, mmddyyyy)
17388
+ if (flagReturn) {
17389
+ return jsonRespose.object;
17390
+ }else{
17391
+ this.renderRCMResourceDetails(jsonRespose.object, mmddyyyy)
17392
+ }
17317
17393
  } else {
17318
17394
  if (xhr.status == 401) {
17319
17395
  let changeEvent = new CustomEvent('tokenExpired', { bubbles: true });
@@ -17571,12 +17647,12 @@ export class SfIEvents extends LitElement {
17571
17647
  return;
17572
17648
  }
17573
17649
  let reportformatvalues: any = {}
17574
- let reportformatvaluesStr: string = ""
17650
+ // let reportformatvaluesStr: string = ""
17575
17651
  let reportingReporting = (this._SfDetailContainer as HTMLDivElement).querySelector('#reporting-reporting-0') as SfIReporting
17576
17652
  console.log('renew reporting', reportingReporting)
17577
17653
  if (reportingReporting != null) {
17578
17654
  reportformatvalues = reportingReporting!.selectedValues()
17579
- reportformatvaluesStr = JSON.stringify(reportingReporting!.selectedValues())
17655
+ // reportformatvaluesStr = JSON.stringify(reportingReporting!.selectedValues())
17580
17656
  }
17581
17657
  let comparedObj = Util.compareObjects(reportformatvalues, JSON.parse(listEvent.reportformatvalues))
17582
17658
  console.log('reportformatvalues', reportformatvalues, JSON.parse(listEvent.reportformatvalues), comparedObj)
@@ -17597,7 +17673,7 @@ export class SfIEvents extends LitElement {
17597
17673
  console.log('mmddyyyy', mmddyyyy)
17598
17674
  if (await this.uploadReview(entityId, locationId, mmddyyyy, listEvent["id"], comments, approved, listEvent.module ?? "compliance")) {
17599
17675
  if (approved) {
17600
- await this.renewRCMResource(listEvent, reportformatvaluesStr);
17676
+ // await this.renewRCMResource(listEvent, reportformatvaluesStr);
17601
17677
  } else {
17602
17678
  console.log('renew reporting', reportformatvalues)
17603
17679
  }
@@ -17933,7 +18009,7 @@ export class SfIEvents extends LitElement {
17933
18009
  this.events[mmdd][p].lastupdated = new Date().toString()
17934
18010
  }
17935
18011
  }
17936
- await this.renewRCMResource(listEvent, reportformatvalues);
18012
+ // await this.renewRCMResource(listEvent, reportformatvalues);
17937
18013
  console.log('upload report auto approve single')
17938
18014
  }
17939
18015
  if (this.recentlyReported[mmdd] == null) {
@@ -22632,11 +22708,11 @@ export class SfIEvents extends LitElement {
22632
22708
  }
22633
22709
  }
22634
22710
  let pastFiscals = [parseInt(this.getCurrentYearGeneric())]
22635
- if(this.contractStartDate != null) {
22711
+ if (this.contractStartDate != null) {
22636
22712
  pastFiscals = this.getAllPastFiscals(new Date(this.contractStartDate));
22637
22713
  }
22638
22714
  html += (`<div class="left-sticky d-flex justify-between align-center mr-10"><h4 id="mapped-stats-title" part="results-title" class="d-flex align-center m-0">${status}&nbsp;&nbsp; ${tagged} in Suspense List out of ${sourceArray.data.mappings.mappings.length}</h4><h6 class="ml-20" part="onboarding-suspense-year-label">Year</h6><select id="select-year" part="input">${pastFiscals.map((fiscal) => {
22639
- return `<option value="${fiscal}"${fiscal == parseInt(year) ? " selected" : ""}>${fiscal}-${(fiscal % 100) + 1}</option>`
22715
+ return `<option value="${fiscal}"${fiscal == parseInt(year) ? " selected" : ""}>${fiscal}-${(fiscal % 100) + 1}</option>`
22640
22716
  })}</select></div>`);
22641
22717
 
22642
22718
 
@@ -32243,7 +32319,7 @@ export class SfIEvents extends LitElement {
32243
32319
 
32244
32320
  html += '<tr>';
32245
32321
  html += '<th part="td-head">Select</th>'
32246
- html += '<th part="td-head">Zombie</th>'
32322
+ html += '<th part="td-head">Processed</th>'
32247
32323
  html += '<th part="td-head">Date</th>'
32248
32324
  html += '<th part="td-head">Docs</th>'
32249
32325
  html += '<th part="td-head">Comments</th>'
@@ -32255,7 +32331,7 @@ export class SfIEvents extends LitElement {
32255
32331
 
32256
32332
  html += '<tr>';
32257
32333
  html += '<td part="td-body"><button id="button-select-' + reportKey.replace(/-/g, '_') + '" part="button-icon-small" class="material-icons button-expand mr-10 button-select">check</button></td>'
32258
- html += '<td part="td-body"><button id="button-check-' + reportKey.replace(/-/g, '_') + '" part="button-icon-small" class="material-symbols-outlined button-expand mr-10 button-check">search_check</button></td>'
32334
+ html += `<td part="td-body"><span class="material-symbols-outlined mr-10">${report['processed'] ?? false ? "done_all" : ""}</span></td>`
32259
32335
  html += `<td part="td-body">${reportKey.split(';')[0]}</td>`;
32260
32336
  html += `<td part="td-body">${JSON.parse(report['docs']).length}</td>`;
32261
32337
  html += `<td part="td-body">${report['comments'].length}</td>`;
@@ -32314,7 +32390,9 @@ export class SfIEvents extends LitElement {
32314
32390
  console.log('idArr', idArr)
32315
32391
  const sortid = idArr[2].replace(/_/g, '-')
32316
32392
  console.log('selected sortid', sortid)
32317
- this.renderDateSelector(sortid);
32393
+ let reportData = JSON.parse(reportsData[sortid]);
32394
+ console.log('selectedReportData', reportData);
32395
+ this.renderComplianceSelector(sortid, reportData.processed ?? false);
32318
32396
  })
32319
32397
  }
32320
32398
 
@@ -32423,117 +32501,143 @@ export class SfIEvents extends LitElement {
32423
32501
  }
32424
32502
 
32425
32503
  }
32426
- renderDateSelector = (sortid: string) => {
32504
+ renderComplianceSelector = (sortid: string, processed: boolean = false) => {
32427
32505
  let html = ''
32428
32506
  html += '<div class="w-100-m-0 d-flex flex-col justify-center">'
32429
32507
  html += '<div class="w-100-m-0 d-flex justify-start">'
32430
32508
  html += '<button id="button-reports-date-selector-back" part="button-icon" class="button-icon"><span class="material-icons">keyboard_backspace</span></button>'
32431
32509
  html += '</div>'
32432
- html += '<label part="input-label" class="mt-20">Select Date</label>'
32433
- html += `<input id="input-compliance-date" part="input-text" class="input-text mb-20" type="date" />`
32434
- html += `<sf-i-form id="input-location-tags" name="Tags" label="Select Location" apiId="${this.apiIdTags}" mode="select" searchPhrase="${this.projectName}&Location" selectProjection="name" ignoreProjections="[&quot;updatetype&quot;,&quot;project&quot;,&quot;tagtype&quot;,&quot;shortid&quot;,&quot;shortnumid&quot;,&quot;lastmodifiedby&quot;,&quot;lastmodifiedtime&quot;]" mandatory></sf-i-form>`
32435
- // html += '<button id="button-reports-date-selector-back" class="button-back" part="button">back</button>';
32510
+ html += `<sf-i-form id="input-user" class="m-20" name="Users" label="Select Reporter" apiId="${this.apiIdUserProfiles}" mode="select" searchPhrase="${this.projectName}" selectProjection="name" ignoreProjections="[&quot;updatetype&quot;,&quot;project&quot;,&quot;tagtype&quot;,&quot;userid&quot;,&quot;usermap&quot;,&quot;kra&quot;,&quot;role&quot;,&quot;trainingstatute&quot;,&quot;shortid&quot;,&quot;shortnumid&quot;,&quot;lastmodifiedby&quot;,&quot;lastmodifiedtime&quot;]"></sf-i-form>`
32511
+ html += `<sf-i-form id="input-entity-tags" class="m-20" name="Tags" label="Select Entity" apiId="${this.apiIdTags}" mode="select" searchPhrase="${this.projectName}&Entity" selectProjection="name" ignoreProjections="[&quot;updatetype&quot;,&quot;project&quot;,&quot;tagtype&quot;,&quot;shortid&quot;,&quot;shortnumid&quot;,&quot;lastmodifiedby&quot;,&quot;lastmodifiedtime&quot;]"></sf-i-form>`
32512
+ html += `<sf-i-form id="input-location-tags" class="m-20" name="Tags" label="Select Location" apiId="${this.apiIdTags}" mode="select" searchPhrase="${this.projectName}&Location" selectProjection="name" ignoreProjections="[&quot;updatetype&quot;,&quot;project&quot;,&quot;tagtype&quot;,&quot;shortid&quot;,&quot;shortnumid&quot;,&quot;lastmodifiedby&quot;,&quot;lastmodifiedtime&quot;]"></sf-i-form>`
32513
+ html += '<div class="w-100-m-0 d-flex justify-start">'
32514
+ html += '<button id="button-reports-search" part="button-icon" class="button-icon d-flex justify-between align-center ml-10" disabled><span class="material-icons">search</span>&nbsp;&nbsp;Search</button>'
32515
+ html += `<button id="button-reports-mark" part="button-icon" class="button-icon d-flex justify-between align-center ml-10"><span class="material-icons">${processed ? "remove_done" : "done_all"}</span>&nbsp;&nbsp;${processed ? "Unmark" : "Mark"} Processed</button>`
32516
+ html += '</div>';
32436
32517
  html += '</div>';
32437
32518
  (this._SfIEventsC.querySelector('#reports-data') as HTMLDivElement).innerHTML = html;
32438
- let inputComplianceDate = (this._SfIEventsC.querySelector('#input-compliance-date') as HTMLInputElement)
32519
+ let inputReporter = (this._SfIEventsC.querySelector('#input-user') as SfIForm)
32520
+ let inputEntityForm = (this._SfIEventsC.querySelector('#input-entity-tags') as SfIForm);
32439
32521
  let inputLocationForm = (this._SfIEventsC.querySelector('#input-location-tags') as SfIForm);
32440
32522
 
32441
- inputComplianceDate.addEventListener('change', (ev: any) => {
32442
- let selectedDate = new Date((ev.target as HTMLInputElement).value)
32443
- let selectedLocation = inputLocationForm.selectedValues()[0];
32444
- if (selectedLocation == null || selectedLocation == '') {
32445
- return;
32446
- // let locationId = sortid.split(';')[2]
32447
- // selectedLocation = locationId;
32448
- }
32449
- this.fetchReportCompliances(selectedDate, selectedLocation, sortid)
32523
+ inputReporter.loadMode();
32524
+ inputReporter.addEventListener('valueChanged', (ev: any) => {
32525
+ let targetForm = ev.target as SfIForm;
32526
+ let selectedReporter = targetForm.selectedTexts()[0]
32527
+ console.log('reporter selected', selectedReporter)
32528
+ checkButtonSearch()
32529
+ })
32530
+ let entityId = sortid.split(';')[1]
32531
+ inputEntityForm.selectedSearchId = entityId;
32532
+ inputEntityForm.loadMode();
32533
+ inputEntityForm.addEventListener('valueChanged', (ev: any) => {
32534
+ let targetForm = ev.target as SfIForm;
32535
+ let selectedEntity = targetForm.selectedTexts()[0]
32536
+ console.log('entity selected', selectedEntity)
32537
+ inputLocationForm.searchPhrase = this.projectName + '&Location&' + selectedEntity.replace(/\([^)]*\)/g, "");
32538
+ inputLocationForm.loadMode();
32539
+ checkButtonSearch()
32450
32540
  })
32451
32541
  let locationId = sortid.split(';')[2]
32452
32542
  inputLocationForm.selectedSearchId = locationId;
32453
32543
  inputLocationForm.loadMode();
32454
32544
  inputLocationForm.addEventListener('valueChanged', (ev: any) => {
32455
- let form = ev.target as SfIForm
32456
- let selectedDate = new Date((inputComplianceDate as HTMLInputElement).value)
32457
- if (selectedDate.toString() == 'Invalid Date') {
32458
- return;
32459
- // let mmddyyyy = sortid.split(';')[0];
32460
- // let mm = mmddyyyy.split('/')[0];
32461
- // let dd = mmddyyyy.split('/')[1];
32462
- // let yyyy = mmddyyyy.split('/')[2];
32463
- // selectedDate = new Date(parseInt(yyyy), parseInt(mm) - 1, parseInt(dd));
32464
- }
32465
- let selectedLocation = form.selectedValues()[0];
32466
- this.fetchReportCompliances(selectedDate, selectedLocation, sortid)
32545
+ let targetForm = ev.target as SfIForm;
32546
+ let selectedLocation = targetForm.selectedTexts()[0]
32547
+ console.log('location selected', selectedLocation)
32548
+ checkButtonSearch()
32467
32549
  })
32468
32550
 
32469
32551
  let buttonBack = (this._SfIEventsC.querySelector('#button-reports-date-selector-back') as HTMLButtonElement)
32470
32552
  buttonBack.addEventListener('click', () => {
32471
32553
  this.fetchReports()
32472
32554
  })
32555
+ let buttonSearch = (this._SfIEventsC.querySelector('#button-reports-search') as HTMLButtonElement)
32556
+ buttonSearch.addEventListener('click', () => {
32557
+ let selectedReporterId = inputReporter.selectedValues()[0];
32558
+ let selectedEntityId = inputEntityForm.selectedValues()[0];
32559
+ let selectedLocationId = inputLocationForm.selectedValues()[0];
32560
+ this.fetchReportCompliances(selectedReporterId, selectedEntityId, selectedLocationId, sortid, processed)
32561
+ })
32562
+
32563
+ let buttonMark = (this._SfIEventsC.querySelector('#button-reports-mark') as HTMLButtonElement)
32564
+ buttonMark.addEventListener('click', () => {
32565
+ let [mmddyyyy, entityid, locationid, complianceid] = sortid.split(';');
32566
+ let year = this.getFinancialYear(mmddyyyy)
32567
+ this.markReport(mmddyyyy, entityid, locationid, complianceid, year, !processed)
32568
+ })
32569
+ function checkButtonSearch() {
32570
+ let selectedReporterId = inputReporter.selectedValues()[0];
32571
+ let selectedEntityId = inputEntityForm.selectedValues()[0];
32572
+ let selectedLocationId = inputLocationForm.selectedValues()[0];
32573
+ if (selectedReporterId != null && selectedEntityId != null && selectedLocationId != null) {
32574
+ buttonSearch.disabled = false;
32575
+ } else {
32576
+ buttonSearch.disabled = true;
32577
+ }
32578
+ }
32473
32579
 
32474
32580
  }
32475
32581
 
32476
- fetchReportCompliances = async (selectedDate: Date, locationid: string, sortid: string) => {
32477
- console.log('fetching compliances', sortid)
32478
- let complianceEntityId = sortid.split(';')[1]
32479
- // let complianceLocationId = sortid.split(';')[2]
32480
- let url = "https://" + this.apiId + "/getallcountryevents5";
32481
- let sDateObj = selectedDate
32482
- sDateObj.setDate(selectedDate.getDate() - 60)
32483
- let day = '' + sDateObj.getDate();
32484
- let month = '' + (sDateObj.getMonth() + 1);
32485
- let year = '' + sDateObj.getFullYear();
32486
- if (month.length < 2)
32487
- month = '0' + month;
32488
- if (day.length < 2)
32489
- day = '0' + day;
32490
- let sDate = month + "/" + day + "/" + year
32491
- let eDateObj = selectedDate
32492
- eDateObj.setDate(selectedDate.getDate() + 120)
32493
- day = '' + eDateObj.getDate();
32494
- month = '' + (eDateObj.getMonth() + 1);
32495
- year = '' + eDateObj.getFullYear();
32496
- if (month.length < 2)
32497
- month = '0' + month;
32498
- if (day.length < 2)
32499
- day = '0' + day;
32500
- let eDate = month + "/" + day + "/" + year
32501
- //console.log('fetch calendar url', url);
32502
- let urlBody: any = { "projectid": this.projectId, "userprofileid": this.userProfileId, "role": this.myRole, "entityid": complianceEntityId, "countryid": "", "functionid": "", "locationid": locationid, "tagid": this.tagId, "adhoc": "false", "exclusivestartkey": 0, "sdate": sDate, "edate": eDate, "view": "location", "year": this.calendarStartYYYY };
32582
+ markReport = async (mmddyyyy: string, entityid: string, locationid: string, eventid: string, year: string, processed: boolean) => {
32583
+ console.log('marking report', eventid, processed)
32584
+ let url = "https://" + this.apiId + "/markreportprocessed";
32585
+
32586
+ let urlBody: any = { "projectid": this.projectId, "eventid": eventid, "mmddyyyy": mmddyyyy, "entityid": entityid, "locationid": locationid, "year": year, "processed": processed };
32503
32587
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
32504
32588
  const xhr: any = (await this.prepareXhr(urlBody, url, this._SfLoader, authorization, 'Preparing')) as any;
32505
32589
  this._SfLoader.innerHTML = '';
32506
32590
  if (xhr.status == 200) {
32507
-
32508
- const jsonRespose = JSON.parse(xhr.responseText);
32509
- console.log('jsonRespose', jsonRespose);
32510
- let arrCompliances = (await this.fetchPresignedUrl(jsonRespose.signedUrlGet));
32511
- await this.fetchPresignedUrlDelete(jsonRespose.signedUrlDelete);
32512
- console.log('receivedCompliacnes', arrCompliances)
32513
- this.renderReportsCompliances(arrCompliances, sortid);
32591
+ this.setSuccess("Report " + ((processed == true) ? "marked" : "unmarked") + " successfully.");
32592
+ this.fetchReports();
32593
+ setTimeout(() => {
32594
+ this.clearMessages();
32595
+ }, 5000);
32514
32596
  } else {
32515
- if (xhr.status == 401) {
32516
- let changeEvent = new CustomEvent('tokenExpired', { bubbles: true });
32517
- this.dispatchEvent(changeEvent);
32518
- }
32519
- if (xhr.status === 404) {
32597
+ const jsonResponse = JSON.parse(xhr.responseText);
32598
+ this.setError(jsonResponse.error);
32599
+ setTimeout(() => {
32600
+ this.clearMessages();
32601
+ }, 5000);
32602
+ }
32603
+ }
32520
32604
 
32521
- this.showChosenProject();
32522
- (this._SfTitleChosenProject as HTMLElement).innerHTML = (this._SfProject[0].querySelector('#sf-i-project') as SfIForm).selectedTexts()[0];
32523
- this.renderChosenProject();
32605
+ fetchReportCompliances = async (reporterid: string, entityid: string, locationid: string, sortid: string, processed: boolean) => {
32606
+ console.log('fetching compliances', sortid)
32607
+ let url = "https://" + this.apiId + "/geteventfromreport";
32524
32608
 
32525
- } else {
32526
- const jsonRespose = JSON.parse(xhr.responseText);
32527
- this.setError(jsonRespose.error);
32609
+ let urlBody: any = { "projectid": this.projectId, "sortid": sortid, "reporterid": reporterid, "entityid": entityid, "locationid": locationid };
32610
+ const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
32611
+ const xhr: any = (await this.prepareXhr(urlBody, url, this._SfLoader, authorization, 'Preparing')) as any;
32612
+ this._SfLoader.innerHTML = '';
32613
+ if (xhr.status == 200) {
32614
+
32615
+ const jsonResponse = JSON.parse(xhr.responseText);
32616
+ console.log('fetch compliances jsonRespose', jsonResponse);
32617
+
32618
+ if (jsonResponse.event == null) {
32619
+ this.setError("Compliance status is - " + jsonResponse.completenessstatus);
32528
32620
  setTimeout(() => {
32529
32621
  this.clearMessages();
32530
32622
  }, 5000);
32623
+ } else {
32624
+ let returnedEvent = jsonResponse.event
32625
+ let arrCompliances = [(returnedEvent)];
32626
+ let assocEvents: any = {};
32627
+ let mmdd = (returnedEvent.duedate).split('/')[1] + "/" + (returnedEvent.duedate).split('/')[0];
32628
+ assocEvents[mmdd] = arrCompliances;
32629
+ this.renderReportsCompliances(assocEvents, sortid, processed);
32531
32630
  }
32532
-
32631
+ } else {
32632
+ const jsonResponse = JSON.parse(xhr.responseText);
32633
+ this.setError(jsonResponse.error);
32634
+ setTimeout(() => {
32635
+ this.clearMessages();
32636
+ }, 5000);
32533
32637
  }
32534
32638
  }
32535
32639
 
32536
- renderReportsCompliances = (compliancesData: any, sortid: string) => {
32640
+ renderReportsCompliances = (compliancesData: any, sortid: string, processed: boolean) => {
32537
32641
  let eventsData: any = {}
32538
32642
  let complianceId = sortid.split(';')[3]
32539
32643
  console.log('renderReportsComplainces', compliancesData, complianceId);
@@ -32638,24 +32742,25 @@ export class SfIEvents extends LitElement {
32638
32742
  const id = ev.target.id;
32639
32743
  const idArr = id.split("-")
32640
32744
  const mmdd = idArr[3] + "/" + idArr[4];
32641
- // const j = idArr[5];
32745
+ const j = idArr[5];
32746
+ let eventObj = eventsData[mmdd][j];
32642
32747
  console.log('move reporting', mmdd + '/' + this.calendarStartYYYY, sortid)
32643
- this.submitUpdateReporting(mmdd + '/' + this.calendarStartYYYY, sortid);
32748
+ this.submitUpdateReporting(mmdd + '/' + this.calendarStartYYYY, eventObj['entityid'], eventObj['locationid'], sortid);
32644
32749
  })
32645
32750
  }
32646
32751
 
32647
32752
  let buttonBack = (this._SfIEventsC.querySelector('#button-reports-date-selector-back') as HTMLButtonElement)
32648
32753
  buttonBack.addEventListener('click', () => {
32649
- this.renderDateSelector(sortid)
32754
+ this.renderComplianceSelector(sortid, processed)
32650
32755
  })
32651
32756
  }
32652
32757
 
32653
- submitUpdateReporting = async (mmddyyyy: string, sortid: string) => {
32758
+ submitUpdateReporting = async (mmddyyyy: string, entityid: string, locationid: string, sortid: string) => {
32654
32759
  let url = "https://" + this.apiId + "/updatereportdate";
32655
32760
 
32656
32761
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
32657
32762
  console.log('this.myroles', this.myroles)
32658
- const xhr: any = (await this.prepareXhr({ "projectid": this.projectId, "mmddyyyy": mmddyyyy, "sortid": sortid }, url, this._SfLoader, authorization)) as any;
32763
+ const xhr: any = (await this.prepareXhr({ "projectid": this.projectId, "mmddyyyy": mmddyyyy, "entityid": entityid, "locationid": locationid, "sortid": sortid }, url, this._SfLoader, authorization)) as any;
32659
32764
  this._SfLoader.innerHTML = '';
32660
32765
  if (xhr.status == 200) {
32661
32766
  this.setSuccess("update successful!");