sf-i-events 1.0.967 → 1.0.969

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
@@ -1100,7 +1100,7 @@
1100
1100
  </div>
1101
1101
 
1102
1102
  </sf-i-events> -->
1103
- <sf-i-events name="Calendar" apiid="api2.flagggrc.tech/event" mode="consumer"
1103
+ <!-- <sf-i-events name="Calendar" apiid="api2.flagggrc.tech/event" mode="consumer"
1104
1104
  apiidtags="dnytrdlrmxgsy.cloudfront.net/tagging" apiidstatutes="dnytrdlrmxgsy.cloudfront.net/statute"
1105
1105
  apiiddefinitions="dwqyez2puoxmu.cloudfront.net/definition"
1106
1106
  apiidreportformats="dwqyez2puoxmu.cloudfront.net/reportformat"
@@ -1127,7 +1127,7 @@
1127
1127
  <sf-i-reporting id="reporting-format" mode="view"></sf-i-reporting>
1128
1128
  </div>
1129
1129
 
1130
- </sf-i-events>
1130
+ </sf-i-events> -->
1131
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"
@@ -1202,6 +1202,44 @@
1202
1202
  </div>
1203
1203
 
1204
1204
  </sf-i-events> -->
1205
+ <!-- <sf-i-events name="Calendar" apiid="api2.flagggrc.tech/event-api" mode="consumer"
1206
+ apiidtags="dnytrdlrmxgsy.cloudfront.net/tagging" apiidstatutes="dnytrdlrmxgsy.cloudfront.net/statute"
1207
+ apiiddefinitions="dwqyez2puoxmu.cloudfront.net/definition"
1208
+ apiidreportformats="dwqyez2puoxmu.cloudfront.net/reportformat"
1209
+ apiidnotices="gghnbi7hku2qj5twrea6xxcaya0aqeis.lambda-url.us-east-1.on.aws"
1210
+ apiidagreements="swago3unro2te55ikvjuqwcrr40wluqh.lambda-url.us-east-1.on.aws"
1211
+ apiidlicenses="lbtsbsctcdsyah4qdszkv4rctq0tnvel.lambda-url.us-east-1.on.aws"
1212
+ apiidrcmresources="jra3sghasmaxn5aiq7rtv6pjzq0oeuaw.lambda-url.us-east-1.on.aws" fill="solid"
1213
+ username="Ankur Singhal" userprofileid="010834e8-108e-4a87-b58d-f5b429f184be"
1214
+ projectid="f0f17ddb-546a-45f5-8a94-a5689fde8e64" projectname="Signode"
1215
+ countryid="4ab8901c-4407-4c4d-a2c7-df1a690aa0a3" selectedcriteria="Country - India" myrole="viewer"
1216
+ showregisterexport="false" features="[&quot;contracts&quot;]"
1217
+ 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;}]"
1218
+ 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;}]"
1219
+ eventpreviewfields="[&quot;obligation&quot;]"
1220
+ eventhidefields="[&quot;comments&quot;,&quot;documents&quot;,&quot;lastupdated&quot;,&quot;approved&quot;,&quot;tags&quot;]"
1221
+ calendarstartdd="01" calendarstartmm="04" calendarstartyyyy="2025">
1222
+
1223
+ <div slot="uploader">
1224
+ <sf-i-uploader id="uploader" max="10" apiid="1peg5170d3"
1225
+ 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;]"
1226
+ extract="yes" projectid="f0f17ddb-546a-45f5-8a94-a5689fde8e64" maxsize="31457280"
1227
+ allowdownload="yes"></sf-i-uploader>
1228
+ </div>
1229
+ <div slot="reporting">
1230
+ <sf-i-reporting id="reporting-format" mode="view"></sf-i-reporting>
1231
+ </div>
1232
+
1233
+ </sf-i-events> -->
1234
+ <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
+ username="Local Reporter 1" userprofileid="e9684b5d-ddbc-46d3-ae07-51706bf75410"
1236
+ projectid="41ab3c86-ccc0-4c0e-8e31-cd079a07a710" projectname="ABC Global" calendarstartyyyy="2025"
1237
+ myrole="reporter">
1238
+ </sf-i-events>
1239
+ <!-- <sf-i-events name="Calendar" apiid="dwqyez2puoxmu.cloudfront.net/event" apiidtags="dnytrdlrmxgsy.cloudfront.net/tagging" mode="reports" fill="pattern"
1240
+ username="Pushti Goenka" userprofileid="8ac7f984-a9e2-46ef-a815-c5116f3e4638"
1241
+ projectid="7f928276-a9ff-4bcd-a8db-874f618a92ea" projectname="Transvolt" calendarstartyyyy="2025" myrole="reporter">
1242
+ </sf-i-events> -->
1205
1243
  <script>
1206
1244
 
1207
1245
  function setCookie(name, value, days) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sf-i-events",
3
3
  "private": false,
4
- "version": "1.0.967",
4
+ "version": "1.0.969",
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;
@@ -582,7 +583,7 @@ export declare class SfIEvents extends LitElement {
582
583
  loadOnboardingReportedLocations: () => Promise<void>;
583
584
  loadOnboardingSignoff: () => Promise<void>;
584
585
  loadOnboardingCalendar: () => Promise<void>;
585
- loadOnboardingSuspense: () => Promise<void>;
586
+ loadOnboardingSuspense: (year?: string) => Promise<void>;
586
587
  calculateStartAndEndDateOfPast: (index?: number) => {
587
588
  startDate: string;
588
589
  endDate: string;
@@ -664,7 +665,8 @@ export declare class SfIEvents extends LitElement {
664
665
  refreshCalendar: () => Promise<void>;
665
666
  renderNewOnboarding: () => void;
666
667
  renderOnboardingSignoff: (signoff: any) => void;
667
- renderOnboardingSuspense: (sourceArray: any, suspenseList: any) => void;
668
+ getAllPastFiscals: (startDate: Date) => number[];
669
+ renderOnboardingSuspense: (sourceArray: any, suspenseList: any, year: string) => void;
668
670
  renderOnboardingSuspenseOld: (_suspenseList: any) => void;
669
671
  renderOnboardingCalendar: (_calendarJobs: any) => void;
670
672
  renderOnboardingTriggers: (mappedTriggers: any, mappedSerializedAlertSchedules: any, triggersJobs: any) => void;
@@ -763,7 +765,7 @@ export declare class SfIEvents extends LitElement {
763
765
  uploadLocationsMapping: (data: any) => Promise<void>;
764
766
  uploadEntitiesMapping: (data: any) => Promise<void>;
765
767
  uploadCountriesMapping: (data: any) => Promise<void>;
766
- uploadMappedSuspense: (data: any) => Promise<any>;
768
+ uploadMappedSuspense: (data: any, year: string) => Promise<any>;
767
769
  uploadOnboardingMapping: (data: any, onboardingstep: string) => Promise<void>;
768
770
  uploadToPresignedUrl: (data: any, url: string) => Promise<void>;
769
771
  uploadCompliancesMapping: (data: any) => Promise<void>;
@@ -852,7 +854,7 @@ export declare class SfIEvents extends LitElement {
852
854
  fetchCalendarJobs: () => Promise<any>;
853
855
  deleteFromSuspense: (suspenseKey: any, year: string) => Promise<any>;
854
856
  markReviewed: (suspenseKey: any, year: string, review: boolean) => Promise<any>;
855
- fetchSuspenseList: () => Promise<any>;
857
+ fetchSuspenseList: (year?: string) => Promise<any>;
856
858
  fetchDetail: (value: any) => Promise<void>;
857
859
  fetchGetMappedCalendar: (year: string) => Promise<any>;
858
860
  sleepFunction: (ms: number) => Promise<unknown>;
@@ -893,10 +895,11 @@ export declare class SfIEvents extends LitElement {
893
895
  renderNextEvents: (eventsData: any, page: number, role: string) => void;
894
896
  fetchReports: () => Promise<void>;
895
897
  renderReports: (reportsData: any) => void;
896
- renderDateSelector: (sortid: string) => void;
897
- fetchReportCompliances: (selectedDate: Date, sortid: string) => Promise<void>;
898
- renderReportsComplainces: (compliancesData: any, sortid: string) => void;
899
- 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>;
900
903
  loadMode: () => Promise<void>;
901
904
  constructor();
902
905
  protected firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
package/sf-i-events.js CHANGED
@@ -7631,13 +7631,13 @@ let SfIEvents = class SfIEvents extends LitElement {
7631
7631
  const calendarJobs = await this.fetchCalendarJobs();
7632
7632
  this.renderOnboardingCalendar(calendarJobs);
7633
7633
  };
7634
- this.loadOnboardingSuspense = async () => {
7634
+ this.loadOnboardingSuspense = async (year = this.getCurrentYearGeneric()) => {
7635
7635
  this.hideTabContainers();
7636
7636
  this._SfOnboardingSuspenseContainer.style.display = 'flex';
7637
7637
  const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7638
- const suspenseList = await this.fetchSuspenseList();
7638
+ const suspenseList = await this.fetchSuspenseList(year);
7639
7639
  console.log('suspenseList', suspenseList);
7640
- this.renderOnboardingSuspense(mappedSerializedLocations, suspenseList);
7640
+ this.renderOnboardingSuspense(mappedSerializedLocations, suspenseList, year);
7641
7641
  };
7642
7642
  this.calculateStartAndEndDateOfPast = (index = 0) => {
7643
7643
  //console.log('calculating start and end of past');
@@ -17844,7 +17844,21 @@ let SfIEvents = class SfIEvents extends LitElement {
17844
17844
  this.loadOnboardingSignoff();
17845
17845
  });
17846
17846
  };
17847
- this.renderOnboardingSuspense = (sourceArray, suspenseList) => {
17847
+ this.getAllPastFiscals = (startDate) => {
17848
+ let retArr = [];
17849
+ let date = new Date();
17850
+ while (date.getTime() > startDate.getTime()) {
17851
+ if (date.getMonth() < 3) {
17852
+ retArr.push(date.getFullYear() - 1);
17853
+ }
17854
+ else {
17855
+ retArr.push(date.getFullYear());
17856
+ }
17857
+ date.setFullYear(date.getFullYear() - 1);
17858
+ }
17859
+ return retArr;
17860
+ };
17861
+ this.renderOnboardingSuspense = (sourceArray, suspenseList, year) => {
17848
17862
  console.log('sourceList', sourceArray);
17849
17863
  console.log('suspenseList', suspenseList);
17850
17864
  let sourceCols = ["shortid", "obligationtitle", "obligationtype"];
@@ -17870,7 +17884,13 @@ let SfIEvents = class SfIEvents extends LitElement {
17870
17884
  changed++;
17871
17885
  }
17872
17886
  }
17873
- 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></div>');
17887
+ let pastFiscals = [parseInt(this.getCurrentYearGeneric())];
17888
+ if (this.contractStartDate != null) {
17889
+ pastFiscals = this.getAllPastFiscals(new Date(this.contractStartDate));
17890
+ }
17891
+ 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) => {
17892
+ return `<option value="${fiscal}"${fiscal == parseInt(year) ? " selected" : ""}>${fiscal}-${(fiscal % 100) + 1}</option>`;
17893
+ })}</select></div>`);
17874
17894
  if (changed > 0) {
17875
17895
  html += ('<div class="left-sticky d-flex justify-between align-center mr-10"><h4 part="results-title" class="d-flex align-center m-0"><span class="color-pending material-icons">pending</span>&nbsp;&nbsp;' + changed + ' Items changed</h4></div>');
17876
17896
  }
@@ -17993,6 +18013,11 @@ let SfIEvents = class SfIEvents extends LitElement {
17993
18013
  // html += '</div>';
17994
18014
  html += '</div>';
17995
18015
  this._SfOnboardingSuspenseContainer.innerHTML = html;
18016
+ const inputYear = this._SfOnboardingSuspenseContainer.querySelector('#select-year');
18017
+ inputYear.addEventListener('change', (e) => {
18018
+ const selectedYear = e.currentTarget.value;
18019
+ this.loadOnboardingSuspense(selectedYear);
18020
+ });
17996
18021
  const buttonApply = this._SfOnboardingSuspenseContainer.querySelector('.button-apply');
17997
18022
  buttonApply.addEventListener('click', () => {
17998
18023
  let inputSuspenseCheckboxes = this._SfOnboardingSuspenseContainer.querySelectorAll('.suspense-input');
@@ -18005,14 +18030,14 @@ let SfIEvents = class SfIEvents extends LitElement {
18005
18030
  tempSuspenseList[suspenseKey] = true;
18006
18031
  }
18007
18032
  }
18008
- this.renderOnboardingSuspense(sourceArray, tempSuspenseList);
18033
+ this.renderOnboardingSuspense(sourceArray, tempSuspenseList, year);
18009
18034
  });
18010
18035
  const buttonSave = this._SfOnboardingSuspenseContainer.querySelector('.button-save');
18011
18036
  buttonSave.addEventListener('click', async () => {
18012
18037
  console.log('saving suspense', suspenseList, Object.keys(suspenseList).length);
18013
- let response = await this.uploadMappedSuspense(suspenseList);
18038
+ let response = await this.uploadMappedSuspense(suspenseList, year);
18014
18039
  console.log('suspense save response', response);
18015
- this.loadOnboardingSuspense();
18040
+ this.loadOnboardingSuspense(year);
18016
18041
  });
18017
18042
  const buttonToggleMoreBack = this._SfOnboardingSuspenseContainer.querySelector('.button-toggle-more-back');
18018
18043
  const buttonToggleMore = this._SfOnboardingSuspenseContainer.querySelector('.button-toggle-more');
@@ -18090,7 +18115,7 @@ let SfIEvents = class SfIEvents extends LitElement {
18090
18115
  },
18091
18116
  () => {
18092
18117
  this.clearMessages();
18093
- this.renderOnboardingSuspense(sourceArray, tempSuspenseList);
18118
+ this.renderOnboardingSuspense(sourceArray, tempSuspenseList, year);
18094
18119
  }
18095
18120
  ]);
18096
18121
  // let tempObj:any = {"data":{"mappings":{"mappings":tempArr}}}
@@ -22343,12 +22368,13 @@ let SfIEvents = class SfIEvents extends LitElement {
22343
22368
  this.uploadCountriesMapping = async (data) => {
22344
22369
  await this.uploadOnboardingMapping(data, 'countries');
22345
22370
  };
22346
- this.uploadMappedSuspense = async (data) => {
22371
+ this.uploadMappedSuspense = async (data, year) => {
22347
22372
  //console.log('uploading..', data);
22348
22373
  let url = "https://" + this.apiId + "/updatemappedsuspense";
22349
22374
  const body = {
22350
22375
  "projectid": this.projectId,
22351
22376
  "data": JSON.stringify(data),
22377
+ "year": year
22352
22378
  };
22353
22379
  let authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
22354
22380
  let xhr = (await this.prepareXhr(body, url, this._SfLoader, authorization));
@@ -23972,10 +23998,12 @@ let SfIEvents = class SfIEvents extends LitElement {
23972
23998
  }
23973
23999
  }
23974
24000
  };
23975
- this.fetchSuspenseList = async () => {
24001
+ this.fetchSuspenseList = async (year = "") => {
23976
24002
  let url = "https://" + this.apiId + "/getsuspenselist1";
23977
24003
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
23978
- const year = this.getCurrentYearGeneric();
24004
+ if (year == "") {
24005
+ year = this.getCurrentYearGeneric();
24006
+ }
23979
24007
  const xhr = (await this.prepareXhr({ "projectid": this.projectId, "year": year }, url, this._SfLoader, authorization));
23980
24008
  this._SfLoader.innerHTML = '';
23981
24009
  if (xhr.status == 200) {
@@ -24582,7 +24610,7 @@ let SfIEvents = class SfIEvents extends LitElement {
24582
24610
  let path = "";
24583
24611
  this.sdate = startDate;
24584
24612
  this.edate = endDate;
24585
- path = "getstatistics";
24613
+ path = "getstatistics1";
24586
24614
  let sDate = "";
24587
24615
  let eDate = "";
24588
24616
  //console.log('currenttab', this.getCurrentTab());
@@ -25634,14 +25662,14 @@ let SfIEvents = class SfIEvents extends LitElement {
25634
25662
  let url = "https://" + this.apiId + "/getreports";
25635
25663
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
25636
25664
  console.log('this.myroles', this.myroles);
25637
- const xhr = (await this.prepareXhr({ "projectid": this.projectId, "userprofileid": this.userProfileId }, url, this._SfLoader, authorization));
25665
+ const xhr = (await this.prepareXhr({ "projectid": this.projectId, "userprofileid": this.userProfileId, "year": this.calendarStartYYYY }, url, this._SfLoader, authorization));
25638
25666
  this._SfLoader.innerHTML = '';
25639
25667
  if (xhr.status == 200) {
25640
25668
  const jsonRespose = JSON.parse(xhr.responseText);
25641
25669
  let arrReports = (await this.fetchPresignedUrl(jsonRespose.signedUrlGet));
25642
25670
  await this.fetchPresignedUrlDelete(jsonRespose.signedUrlDelete);
25643
- console.log('reports response', arrReports);
25644
- console.log('report', arrReports['3/31/*,30;c989a44e-7d3d-427e-b712-90eacf585075;38dc8c53-643f-4fee-83fe-f15239606277;0a5fb99f-c36f-46c0-85b4-7fa3d48fa134']);
25671
+ console.log('reports response', Object.keys(arrReports).length);
25672
+ console.log('report', arrReports);
25645
25673
  this.renderReports(arrReports);
25646
25674
  }
25647
25675
  else {
@@ -25656,6 +25684,7 @@ let SfIEvents = class SfIEvents extends LitElement {
25656
25684
  }
25657
25685
  };
25658
25686
  this.renderReports = (reportsData) => {
25687
+ var _a, _b;
25659
25688
  let html = '<div class="d-flex flex-col w-100-m-0">';
25660
25689
  html += '<div part="stream-event-list" class="d-flex flex-col align-stretch">';
25661
25690
  for (let reportKey of Object.keys(reportsData)) {
@@ -25670,36 +25699,44 @@ let SfIEvents = class SfIEvents extends LitElement {
25670
25699
  html += '<table>';
25671
25700
  html += '<tr>';
25672
25701
  html += '<th part="td-head">Select</th>';
25673
- html += '<th part="td-head">Zombie</th>';
25702
+ html += '<th part="td-head">Processed</th>';
25674
25703
  html += '<th part="td-head">Date</th>';
25675
25704
  html += '<th part="td-head">Docs</th>';
25676
25705
  html += '<th part="td-head">Comments</th>';
25677
25706
  html += '<th part="td-head">LastUpdated</th>';
25678
25707
  html += '<th part="td-head">CompletionDate</th>';
25708
+ html += '<th part="td-head">Location</th>';
25679
25709
  html += '<th part="td-head">Compliance</th>';
25680
25710
  html += '</tr>';
25681
25711
  html += '<tr>';
25682
25712
  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>';
25683
- 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>';
25713
+ 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>`;
25684
25714
  html += `<td part="td-body">${reportKey.split(';')[0]}</td>`;
25685
25715
  html += `<td part="td-body">${JSON.parse(report['docs']).length}</td>`;
25686
25716
  html += `<td part="td-body">${report['comments'].length}</td>`;
25687
25717
  html += `<td part="td-body">${Util.getDateTimeStrings(new Date(report['lastupdated']).getTime())}</td>`;
25688
25718
  html += `<td part="td-body">${new Date(parseInt(report['dateofcompletion'])).toLocaleDateString('en-US', { timeZone: 'Asia/Kolkata' })}</td>`;
25689
- html += '<th part="td-head">';
25690
- // const jsonReportEvent = JSON.parse(report['comments'].reportevent);
25691
- console.log('jsonReportEvent', report['event']);
25719
+ let locationname = "";
25720
+ let eventHtml = "";
25692
25721
  if (report['event'] != null) {
25693
- html += '<table>';
25694
- html += '<tr>';
25722
+ locationname = (_b = JSON.parse(report['event'])['locationname']) !== null && _b !== void 0 ? _b : "";
25695
25723
  for (var i = 0; i < Object.keys(JSON.parse(report['event'])).length; i++) {
25696
25724
  if (!this.EXCLUDE_COLS_FROM_REGS.includes(Object.keys(JSON.parse(report['event']))[i].toLowerCase())) {
25697
- html += '<td part="td-body-register">';
25698
- html += ('<span part="td-head" style="padding-left: 0px !important">' + Object.keys(JSON.parse(report['event']))[i] + '</span>');
25699
- html += ('<span part="td-body"><sf-i-elastic-text exportparts="highlight,highlight-count" text="' + JSON.parse(report['event'])[Object.keys(JSON.parse(report['event']))[i]] + '" lineSize="4" minLength="60"></sf-i-elastic-text>' + '</span>');
25700
- html += '</td>';
25725
+ eventHtml += '<td part="td-body-register">';
25726
+ eventHtml += ('<span part="td-head" style="padding-left: 0px !important">' + Object.keys(JSON.parse(report['event']))[i] + '</span>');
25727
+ eventHtml += ('<span part="td-body"><sf-i-elastic-text exportparts="highlight,highlight-count" text="' + JSON.parse(report['event'])[Object.keys(JSON.parse(report['event']))[i]] + '" lineSize="4" minLength="60"></sf-i-elastic-text>' + '</span>');
25728
+ eventHtml += '</td>';
25701
25729
  }
25702
25730
  }
25731
+ }
25732
+ html += `<td part="td-body">${locationname}</td>`;
25733
+ html += '<th part="td-head">';
25734
+ // const jsonReportEvent = JSON.parse(report['comments'].reportevent);
25735
+ // console.log('jsonReportEvent', report['event']);
25736
+ if (report['event'] != null) {
25737
+ html += '<table>';
25738
+ html += '<tr>';
25739
+ html += eventHtml;
25703
25740
  html += '</tr>';
25704
25741
  html += '</table>';
25705
25742
  }
@@ -25714,13 +25751,16 @@ let SfIEvents = class SfIEvents extends LitElement {
25714
25751
  const arrButtonSelect = this._SfIEventsC.querySelectorAll('.button-select');
25715
25752
  for (let buttonSelect of arrButtonSelect) {
25716
25753
  buttonSelect.addEventListener('click', (ev) => {
25754
+ var _a;
25717
25755
  const id = ev.target.id;
25718
25756
  console.log('id', id);
25719
25757
  const idArr = id.split("-");
25720
25758
  console.log('idArr', idArr);
25721
25759
  const sortid = idArr[2].replace(/_/g, '-');
25722
25760
  console.log('selected sortid', sortid);
25723
- this.renderDateSelector(sortid);
25761
+ let reportData = JSON.parse(reportsData[sortid]);
25762
+ console.log('selectedReportData', reportData);
25763
+ this.renderComplianceSelector(sortid, (_a = reportData.processed) !== null && _a !== void 0 ? _a : false);
25724
25764
  });
25725
25765
  }
25726
25766
  const arrButtonCheck = this._SfIEventsC.querySelectorAll('.button-check');
@@ -25821,85 +25861,136 @@ let SfIEvents = class SfIEvents extends LitElement {
25821
25861
  });
25822
25862
  }
25823
25863
  };
25824
- this.renderDateSelector = (sortid) => {
25864
+ this.renderComplianceSelector = (sortid, processed = false) => {
25825
25865
  let html = '';
25826
25866
  html += '<div class="w-100-m-0 d-flex flex-col justify-center">';
25827
25867
  html += '<div class="w-100-m-0 d-flex justify-start">';
25828
25868
  html += '<button id="button-reports-date-selector-back" part="button-icon" class="button-icon"><span class="material-icons">keyboard_backspace</span></button>';
25829
25869
  html += '</div>';
25830
- html += '<label part="input-label" class="mt-20">Select Date</label>';
25831
- html += '<input part="input" id="input-compliance-date" type="date" class="w-100-m-0" mandatory="" autocomplete="off" style="display: block;">';
25832
- // html += '<button id="button-reports-date-selector-back" class="button-back" part="button">back</button>';
25870
+ 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>`;
25871
+ 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>`;
25872
+ 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>`;
25873
+ html += '<div class="w-100-m-0 d-flex justify-start">';
25874
+ 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>';
25875
+ 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>`;
25876
+ html += '</div>';
25833
25877
  html += '</div>';
25834
25878
  this._SfIEventsC.querySelector('#reports-data').innerHTML = html;
25835
- let inputComplianceDate = this._SfIEventsC.querySelector('#input-compliance-date');
25836
- inputComplianceDate.addEventListener('change', (ev) => {
25837
- let selectedDate = new Date(ev.target.value);
25838
- this.fetchReportCompliances(selectedDate, sortid);
25879
+ let inputReporter = this._SfIEventsC.querySelector('#input-user');
25880
+ let inputEntityForm = this._SfIEventsC.querySelector('#input-entity-tags');
25881
+ let inputLocationForm = this._SfIEventsC.querySelector('#input-location-tags');
25882
+ inputReporter.loadMode();
25883
+ inputReporter.addEventListener('valueChanged', (ev) => {
25884
+ let targetForm = ev.target;
25885
+ let selectedReporter = targetForm.selectedTexts()[0];
25886
+ console.log('reporter selected', selectedReporter);
25887
+ checkButtonSearch();
25888
+ });
25889
+ let entityId = sortid.split(';')[1];
25890
+ inputEntityForm.selectedSearchId = entityId;
25891
+ inputEntityForm.loadMode();
25892
+ inputEntityForm.addEventListener('valueChanged', (ev) => {
25893
+ let targetForm = ev.target;
25894
+ let selectedEntity = targetForm.selectedTexts()[0];
25895
+ console.log('entity selected', selectedEntity);
25896
+ inputLocationForm.searchPhrase = this.projectName + '&Location&' + selectedEntity.replace(/\([^)]*\)/g, "");
25897
+ inputLocationForm.loadMode();
25898
+ checkButtonSearch();
25899
+ });
25900
+ let locationId = sortid.split(';')[2];
25901
+ inputLocationForm.selectedSearchId = locationId;
25902
+ inputLocationForm.loadMode();
25903
+ inputLocationForm.addEventListener('valueChanged', (ev) => {
25904
+ let targetForm = ev.target;
25905
+ let selectedLocation = targetForm.selectedTexts()[0];
25906
+ console.log('location selected', selectedLocation);
25907
+ checkButtonSearch();
25839
25908
  });
25840
25909
  let buttonBack = this._SfIEventsC.querySelector('#button-reports-date-selector-back');
25841
25910
  buttonBack.addEventListener('click', () => {
25842
25911
  this.fetchReports();
25843
25912
  });
25913
+ let buttonSearch = this._SfIEventsC.querySelector('#button-reports-search');
25914
+ buttonSearch.addEventListener('click', () => {
25915
+ let selectedReporterId = inputReporter.selectedValues()[0];
25916
+ let selectedEntityId = inputEntityForm.selectedValues()[0];
25917
+ let selectedLocationId = inputLocationForm.selectedValues()[0];
25918
+ this.fetchReportCompliances(selectedReporterId, selectedEntityId, selectedLocationId, sortid, processed);
25919
+ });
25920
+ let buttonMark = this._SfIEventsC.querySelector('#button-reports-mark');
25921
+ buttonMark.addEventListener('click', () => {
25922
+ let [mmddyyyy, entityid, locationid, complianceid] = sortid.split(';');
25923
+ let year = this.getFinancialYear(mmddyyyy);
25924
+ this.markReport(mmddyyyy, entityid, locationid, complianceid, year, !processed);
25925
+ });
25926
+ function checkButtonSearch() {
25927
+ let selectedReporterId = inputReporter.selectedValues()[0];
25928
+ let selectedEntityId = inputEntityForm.selectedValues()[0];
25929
+ let selectedLocationId = inputLocationForm.selectedValues()[0];
25930
+ if (selectedReporterId != null && selectedEntityId != null && selectedLocationId != null) {
25931
+ buttonSearch.disabled = false;
25932
+ }
25933
+ else {
25934
+ buttonSearch.disabled = true;
25935
+ }
25936
+ }
25844
25937
  };
25845
- this.fetchReportCompliances = async (selectedDate, sortid) => {
25846
- console.log('fetching compliances', sortid);
25847
- let complianceEntityId = sortid.split(';')[1];
25848
- let complianceLocationId = sortid.split(';')[2];
25849
- let url = "https://" + this.apiId + "/getallcountryevents5";
25850
- let sDateObj = selectedDate;
25851
- sDateObj.setDate(selectedDate.getDate() - 60);
25852
- let day = '' + sDateObj.getDate();
25853
- let month = '' + (sDateObj.getMonth() + 1);
25854
- let year = '' + sDateObj.getFullYear();
25855
- if (month.length < 2)
25856
- month = '0' + month;
25857
- if (day.length < 2)
25858
- day = '0' + day;
25859
- let sDate = month + "/" + day + "/" + year;
25860
- let eDateObj = selectedDate;
25861
- eDateObj.setDate(selectedDate.getDate() + 120);
25862
- day = '' + eDateObj.getDate();
25863
- month = '' + (eDateObj.getMonth() + 1);
25864
- year = '' + eDateObj.getFullYear();
25865
- if (month.length < 2)
25866
- month = '0' + month;
25867
- if (day.length < 2)
25868
- day = '0' + day;
25869
- let eDate = month + "/" + day + "/" + year;
25870
- //console.log('fetch calendar url', url);
25871
- let urlBody = { "projectid": this.projectId, "userprofileid": this.userProfileId, "role": this.myRole, "entityid": complianceEntityId, "countryid": "", "functionid": "", "locationid": complianceLocationId, "tagid": this.tagId, "adhoc": "false", "exclusivestartkey": 0, "sdate": sDate, "edate": eDate, "view": "location", "year": this.calendarStartYYYY };
25938
+ this.markReport = async (mmddyyyy, entityid, locationid, eventid, year, processed) => {
25939
+ console.log('marking report', eventid, processed);
25940
+ let url = "https://" + this.apiId + "/markreportprocessed";
25941
+ let urlBody = { "projectid": this.projectId, "eventid": eventid, "mmddyyyy": mmddyyyy, "entityid": entityid, "locationid": locationid, "year": year, "processed": processed };
25872
25942
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
25873
25943
  const xhr = (await this.prepareXhr(urlBody, url, this._SfLoader, authorization, 'Preparing'));
25874
25944
  this._SfLoader.innerHTML = '';
25875
25945
  if (xhr.status == 200) {
25876
- const jsonRespose = JSON.parse(xhr.responseText);
25877
- console.log('jsonRespose', jsonRespose);
25878
- let arrCompliances = (await this.fetchPresignedUrl(jsonRespose.signedUrlGet));
25879
- await this.fetchPresignedUrlDelete(jsonRespose.signedUrlDelete);
25880
- console.log('receivedCompliacnes', arrCompliances);
25881
- this.renderReportsComplainces(arrCompliances, sortid);
25946
+ this.setSuccess("Report " + ((processed == true) ? "marked" : "unmarked") + " successfully.");
25947
+ this.fetchReports();
25948
+ setTimeout(() => {
25949
+ this.clearMessages();
25950
+ }, 5000);
25882
25951
  }
25883
25952
  else {
25884
- if (xhr.status == 401) {
25885
- let changeEvent = new CustomEvent('tokenExpired', { bubbles: true });
25886
- this.dispatchEvent(changeEvent);
25887
- }
25888
- if (xhr.status === 404) {
25889
- this.showChosenProject();
25890
- this._SfTitleChosenProject.innerHTML = this._SfProject[0].querySelector('#sf-i-project').selectedTexts()[0];
25891
- this.renderChosenProject();
25892
- }
25893
- else {
25894
- const jsonRespose = JSON.parse(xhr.responseText);
25895
- this.setError(jsonRespose.error);
25953
+ const jsonResponse = JSON.parse(xhr.responseText);
25954
+ this.setError(jsonResponse.error);
25955
+ setTimeout(() => {
25956
+ this.clearMessages();
25957
+ }, 5000);
25958
+ }
25959
+ };
25960
+ this.fetchReportCompliances = async (reporterid, entityid, locationid, sortid, processed) => {
25961
+ console.log('fetching compliances', sortid);
25962
+ let url = "https://" + this.apiId + "/geteventfromreport";
25963
+ let urlBody = { "projectid": this.projectId, "sortid": sortid, "reporterid": reporterid, "entityid": entityid, "locationid": locationid };
25964
+ const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
25965
+ const xhr = (await this.prepareXhr(urlBody, url, this._SfLoader, authorization, 'Preparing'));
25966
+ this._SfLoader.innerHTML = '';
25967
+ if (xhr.status == 200) {
25968
+ const jsonResponse = JSON.parse(xhr.responseText);
25969
+ console.log('fetch compliances jsonRespose', jsonResponse);
25970
+ if (jsonResponse.event == null) {
25971
+ this.setError("Compliance status is - " + jsonResponse.completenessstatus);
25896
25972
  setTimeout(() => {
25897
25973
  this.clearMessages();
25898
25974
  }, 5000);
25899
25975
  }
25976
+ else {
25977
+ let returnedEvent = jsonResponse.event;
25978
+ let arrCompliances = [(returnedEvent)];
25979
+ let assocEvents = {};
25980
+ let mmdd = (returnedEvent.duedate).split('/')[1] + "/" + (returnedEvent.duedate).split('/')[0];
25981
+ assocEvents[mmdd] = arrCompliances;
25982
+ this.renderReportsCompliances(assocEvents, sortid, processed);
25983
+ }
25984
+ }
25985
+ else {
25986
+ const jsonResponse = JSON.parse(xhr.responseText);
25987
+ this.setError(jsonResponse.error);
25988
+ setTimeout(() => {
25989
+ this.clearMessages();
25990
+ }, 5000);
25900
25991
  }
25901
25992
  };
25902
- this.renderReportsComplainces = (compliancesData, sortid) => {
25993
+ this.renderReportsCompliances = (compliancesData, sortid, processed) => {
25903
25994
  let eventsData = {};
25904
25995
  let complianceId = sortid.split(';')[3];
25905
25996
  console.log('renderReportsComplainces', compliancesData, complianceId);
@@ -25994,21 +26085,22 @@ let SfIEvents = class SfIEvents extends LitElement {
25994
26085
  const id = ev.target.id;
25995
26086
  const idArr = id.split("-");
25996
26087
  const mmdd = idArr[3] + "/" + idArr[4];
25997
- // const j = idArr[5];
26088
+ const j = idArr[5];
26089
+ let eventObj = eventsData[mmdd][j];
25998
26090
  console.log('move reporting', mmdd + '/' + this.calendarStartYYYY, sortid);
25999
- this.submitUpdateReporting(mmdd + '/' + this.calendarStartYYYY, sortid);
26091
+ this.submitUpdateReporting(mmdd + '/' + this.calendarStartYYYY, eventObj['entityid'], eventObj['locationid'], sortid);
26000
26092
  });
26001
26093
  }
26002
26094
  let buttonBack = this._SfIEventsC.querySelector('#button-reports-date-selector-back');
26003
26095
  buttonBack.addEventListener('click', () => {
26004
- this.renderDateSelector(sortid);
26096
+ this.renderComplianceSelector(sortid, processed);
26005
26097
  });
26006
26098
  };
26007
- this.submitUpdateReporting = async (mmddyyyy, sortid) => {
26099
+ this.submitUpdateReporting = async (mmddyyyy, entityid, locationid, sortid) => {
26008
26100
  let url = "https://" + this.apiId + "/updatereportdate";
26009
26101
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
26010
26102
  console.log('this.myroles', this.myroles);
26011
- const xhr = (await this.prepareXhr({ "projectid": this.projectId, "mmddyyyy": mmddyyyy, "sortid": sortid }, url, this._SfLoader, authorization));
26103
+ const xhr = (await this.prepareXhr({ "projectid": this.projectId, "mmddyyyy": mmddyyyy, "entityid": entityid, "locationid": locationid, "sortid": sortid }, url, this._SfLoader, authorization));
26012
26104
  this._SfLoader.innerHTML = '';
26013
26105
  if (xhr.status == 200) {
26014
26106
  this.setSuccess("update successful!");
@@ -27841,6 +27933,9 @@ __decorate([
27841
27933
  __decorate([
27842
27934
  property()
27843
27935
  ], SfIEvents.prototype, "apiIdTags", void 0);
27936
+ __decorate([
27937
+ property()
27938
+ ], SfIEvents.prototype, "apiIdUserProfiles", void 0);
27844
27939
  __decorate([
27845
27940
  property()
27846
27941
  ], 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
 
@@ -10499,13 +10502,13 @@ export class SfIEvents extends LitElement {
10499
10502
  this.renderOnboardingCalendar(calendarJobs);
10500
10503
  }
10501
10504
 
10502
- loadOnboardingSuspense = async () => {
10505
+ loadOnboardingSuspense = async (year: string = this.getCurrentYearGeneric()) => {
10503
10506
  this.hideTabContainers();
10504
10507
  (this._SfOnboardingSuspenseContainer as HTMLDivElement).style.display = 'flex';
10505
10508
  const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10506
- const suspenseList = await this.fetchSuspenseList();
10509
+ const suspenseList = await this.fetchSuspenseList(year);
10507
10510
  console.log('suspenseList', suspenseList);
10508
- this.renderOnboardingSuspense(mappedSerializedLocations, suspenseList);
10511
+ this.renderOnboardingSuspense(mappedSerializedLocations, suspenseList, year);
10509
10512
  }
10510
10513
 
10511
10514
  calculateStartAndEndDateOfPast = (index: number = 0) => {
@@ -22587,7 +22590,21 @@ export class SfIEvents extends LitElement {
22587
22590
 
22588
22591
  }
22589
22592
 
22590
- renderOnboardingSuspense = (sourceArray: any, suspenseList: any) => {
22593
+ getAllPastFiscals = (startDate: Date) => {
22594
+ let retArr = []
22595
+ let date = new Date()
22596
+ while (date.getTime() > startDate.getTime()) {
22597
+ if (date.getMonth() < 3) {
22598
+ retArr.push(date.getFullYear() - 1)
22599
+ } else {
22600
+ retArr.push(date.getFullYear())
22601
+ }
22602
+ date.setFullYear(date.getFullYear() - 1)
22603
+ }
22604
+ return retArr;
22605
+ }
22606
+
22607
+ renderOnboardingSuspense = (sourceArray: any, suspenseList: any, year: string) => {
22591
22608
 
22592
22609
  console.log('sourceList', sourceArray);
22593
22610
  console.log('suspenseList', suspenseList);
@@ -22617,8 +22634,13 @@ export class SfIEvents extends LitElement {
22617
22634
  changed++;
22618
22635
  }
22619
22636
  }
22620
-
22621
- 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></div>');
22637
+ let pastFiscals = [parseInt(this.getCurrentYearGeneric())]
22638
+ if (this.contractStartDate != null) {
22639
+ pastFiscals = this.getAllPastFiscals(new Date(this.contractStartDate));
22640
+ }
22641
+ 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) => {
22642
+ return `<option value="${fiscal}"${fiscal == parseInt(year) ? " selected" : ""}>${fiscal}-${(fiscal % 100) + 1}</option>`
22643
+ })}</select></div>`);
22622
22644
 
22623
22645
 
22624
22646
  if (changed > 0) {
@@ -22771,6 +22793,11 @@ export class SfIEvents extends LitElement {
22771
22793
  html += '</div>';
22772
22794
 
22773
22795
  (this._SfOnboardingSuspenseContainer as HTMLDivElement).innerHTML = html;
22796
+ const inputYear = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('#select-year') as HTMLSelectElement;
22797
+ inputYear.addEventListener('change', (e: any) => {
22798
+ const selectedYear = e.currentTarget.value;
22799
+ this.loadOnboardingSuspense(selectedYear);
22800
+ })
22774
22801
 
22775
22802
  const buttonApply = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('.button-apply') as HTMLButtonElement;
22776
22803
  buttonApply.addEventListener('click', () => {
@@ -22784,15 +22811,15 @@ export class SfIEvents extends LitElement {
22784
22811
  tempSuspenseList[suspenseKey] = true
22785
22812
  }
22786
22813
  }
22787
- this.renderOnboardingSuspense(sourceArray, tempSuspenseList)
22814
+ this.renderOnboardingSuspense(sourceArray, tempSuspenseList, year)
22788
22815
  })
22789
22816
 
22790
22817
  const buttonSave = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('.button-save') as HTMLButtonElement;
22791
22818
  buttonSave.addEventListener('click', async () => {
22792
22819
  console.log('saving suspense', suspenseList, Object.keys(suspenseList).length);
22793
- let response = await this.uploadMappedSuspense(suspenseList)
22820
+ let response = await this.uploadMappedSuspense(suspenseList, year)
22794
22821
  console.log('suspense save response', response);
22795
- this.loadOnboardingSuspense()
22822
+ this.loadOnboardingSuspense(year)
22796
22823
  })
22797
22824
 
22798
22825
  const buttonToggleMoreBack = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('.button-toggle-more-back') as HTMLButtonElement;
@@ -22879,7 +22906,7 @@ export class SfIEvents extends LitElement {
22879
22906
  },
22880
22907
  () => {
22881
22908
  this.clearMessages();
22882
- this.renderOnboardingSuspense(sourceArray, tempSuspenseList);
22909
+ this.renderOnboardingSuspense(sourceArray, tempSuspenseList, year);
22883
22910
  }
22884
22911
  ])
22885
22912
  // let tempObj:any = {"data":{"mappings":{"mappings":tempArr}}}
@@ -28156,7 +28183,7 @@ export class SfIEvents extends LitElement {
28156
28183
  await this.uploadOnboardingMapping(data, 'countries');
28157
28184
  }
28158
28185
 
28159
- uploadMappedSuspense = async (data: any) => {
28186
+ uploadMappedSuspense = async (data: any, year: string) => {
28160
28187
 
28161
28188
  //console.log('uploading..', data);
28162
28189
 
@@ -28165,6 +28192,7 @@ export class SfIEvents extends LitElement {
28165
28192
  const body = {
28166
28193
  "projectid": this.projectId,
28167
28194
  "data": JSON.stringify(data),
28195
+ "year": year
28168
28196
  }
28169
28197
 
28170
28198
  let authorization: any = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
@@ -30230,11 +30258,13 @@ export class SfIEvents extends LitElement {
30230
30258
  }
30231
30259
  }
30232
30260
 
30233
- fetchSuspenseList = async () => {
30261
+ fetchSuspenseList = async (year: string = "") => {
30234
30262
 
30235
30263
  let url = "https://" + this.apiId + "/getsuspenselist1";
30236
30264
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
30237
- const year = this.getCurrentYearGeneric();
30265
+ if (year == "") {
30266
+ year = this.getCurrentYearGeneric();
30267
+ }
30238
30268
  const xhr: any = (await this.prepareXhr({ "projectid": this.projectId, "year": year }, url, this._SfLoader, authorization)) as any;
30239
30269
  this._SfLoader.innerHTML = '';
30240
30270
  if (xhr.status == 200) {
@@ -30944,7 +30974,7 @@ export class SfIEvents extends LitElement {
30944
30974
  this.edate = endDate;
30945
30975
 
30946
30976
 
30947
- path = "getstatistics";
30977
+ path = "getstatistics1";
30948
30978
 
30949
30979
  let sDate = "";
30950
30980
  let eDate = "";
@@ -32175,15 +32205,15 @@ export class SfIEvents extends LitElement {
32175
32205
 
32176
32206
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
32177
32207
  console.log('this.myroles', this.myroles)
32178
- const xhr: any = (await this.prepareXhr({ "projectid": this.projectId, "userprofileid": this.userProfileId }, url, this._SfLoader, authorization)) as any;
32208
+ const xhr: any = (await this.prepareXhr({ "projectid": this.projectId, "userprofileid": this.userProfileId, "year": this.calendarStartYYYY }, url, this._SfLoader, authorization)) as any;
32179
32209
  this._SfLoader.innerHTML = '';
32180
32210
  if (xhr.status == 200) {
32181
32211
 
32182
32212
  const jsonRespose = JSON.parse(xhr.responseText);
32183
32213
  let arrReports = (await this.fetchPresignedUrl(jsonRespose.signedUrlGet));
32184
32214
  await this.fetchPresignedUrlDelete(jsonRespose.signedUrlDelete)
32185
- console.log('reports response', arrReports);
32186
- console.log('report', arrReports['3/31/*,30;c989a44e-7d3d-427e-b712-90eacf585075;38dc8c53-643f-4fee-83fe-f15239606277;0a5fb99f-c36f-46c0-85b4-7fa3d48fa134']);
32215
+ console.log('reports response', Object.keys(arrReports).length);
32216
+ console.log('report', arrReports);
32187
32217
  this.renderReports(arrReports)
32188
32218
  } else {
32189
32219
  if (xhr.status == 401) {
@@ -32216,42 +32246,49 @@ export class SfIEvents extends LitElement {
32216
32246
 
32217
32247
  html += '<tr>';
32218
32248
  html += '<th part="td-head">Select</th>'
32219
- html += '<th part="td-head">Zombie</th>'
32249
+ html += '<th part="td-head">Processed</th>'
32220
32250
  html += '<th part="td-head">Date</th>'
32221
32251
  html += '<th part="td-head">Docs</th>'
32222
32252
  html += '<th part="td-head">Comments</th>'
32223
32253
  html += '<th part="td-head">LastUpdated</th>'
32224
32254
  html += '<th part="td-head">CompletionDate</th>'
32255
+ html += '<th part="td-head">Location</th>'
32225
32256
  html += '<th part="td-head">Compliance</th>'
32226
32257
  html += '</tr>';
32227
32258
 
32228
32259
  html += '<tr>';
32229
32260
  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>'
32230
- 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>'
32261
+ html += `<td part="td-body"><span class="material-symbols-outlined mr-10">${report['processed'] ?? false ? "done_all" : ""}</span></td>`
32231
32262
  html += `<td part="td-body">${reportKey.split(';')[0]}</td>`;
32232
32263
  html += `<td part="td-body">${JSON.parse(report['docs']).length}</td>`;
32233
32264
  html += `<td part="td-body">${report['comments'].length}</td>`;
32234
32265
  html += `<td part="td-body">${Util.getDateTimeStrings(new Date(report['lastupdated']).getTime())}</td>`;
32235
32266
  html += `<td part="td-body">${new Date(parseInt(report['dateofcompletion'])).toLocaleDateString('en-US', { timeZone: 'Asia/Kolkata' })}</td>`;
32236
- html += '<th part="td-head">';
32237
-
32238
- // const jsonReportEvent = JSON.parse(report['comments'].reportevent);
32239
- console.log('jsonReportEvent', report['event']);
32267
+ let locationname = ""
32268
+ let eventHtml = ""
32240
32269
  if (report['event'] != null) {
32241
- html += '<table>';
32242
- html += '<tr>';
32270
+ locationname = JSON.parse(report['event'])['locationname'] ?? "";
32243
32271
  for (var i = 0; i < Object.keys(JSON.parse(report['event'])).length; i++) {
32244
-
32245
32272
  if (!this.EXCLUDE_COLS_FROM_REGS.includes(Object.keys(JSON.parse(report['event']))[i].toLowerCase())) {
32246
32273
 
32247
- html += '<td part="td-body-register">';
32248
- html += ('<span part="td-head" style="padding-left: 0px !important">' + Object.keys(JSON.parse(report['event']))[i] + '</span>');
32249
- html += ('<span part="td-body"><sf-i-elastic-text exportparts="highlight,highlight-count" text="' + JSON.parse(report['event'])[Object.keys(JSON.parse(report['event']))[i]] + '" lineSize="4" minLength="60"></sf-i-elastic-text>' + '</span>');
32250
- html += '</td>';
32274
+ eventHtml += '<td part="td-body-register">';
32275
+ eventHtml += ('<span part="td-head" style="padding-left: 0px !important">' + Object.keys(JSON.parse(report['event']))[i] + '</span>');
32276
+ eventHtml += ('<span part="td-body"><sf-i-elastic-text exportparts="highlight,highlight-count" text="' + JSON.parse(report['event'])[Object.keys(JSON.parse(report['event']))[i]] + '" lineSize="4" minLength="60"></sf-i-elastic-text>' + '</span>');
32277
+ eventHtml += '</td>';
32251
32278
 
32252
32279
  }
32253
32280
 
32254
32281
  }
32282
+ }
32283
+ html += `<td part="td-body">${locationname}</td>`;
32284
+ html += '<th part="td-head">';
32285
+
32286
+ // const jsonReportEvent = JSON.parse(report['comments'].reportevent);
32287
+ // console.log('jsonReportEvent', report['event']);
32288
+ if (report['event'] != null) {
32289
+ html += '<table>';
32290
+ html += '<tr>';
32291
+ html += eventHtml;
32255
32292
  html += '</tr>';
32256
32293
  html += '</table>';
32257
32294
  }
@@ -32280,7 +32317,9 @@ export class SfIEvents extends LitElement {
32280
32317
  console.log('idArr', idArr)
32281
32318
  const sortid = idArr[2].replace(/_/g, '-')
32282
32319
  console.log('selected sortid', sortid)
32283
- this.renderDateSelector(sortid);
32320
+ let reportData = JSON.parse(reportsData[sortid]);
32321
+ console.log('selectedReportData', reportData);
32322
+ this.renderComplianceSelector(sortid, reportData.processed ?? false);
32284
32323
  })
32285
32324
  }
32286
32325
 
@@ -32389,90 +32428,143 @@ export class SfIEvents extends LitElement {
32389
32428
  }
32390
32429
 
32391
32430
  }
32392
- renderDateSelector = (sortid: string) => {
32431
+ renderComplianceSelector = (sortid: string, processed: boolean = false) => {
32393
32432
  let html = ''
32394
32433
  html += '<div class="w-100-m-0 d-flex flex-col justify-center">'
32395
32434
  html += '<div class="w-100-m-0 d-flex justify-start">'
32396
32435
  html += '<button id="button-reports-date-selector-back" part="button-icon" class="button-icon"><span class="material-icons">keyboard_backspace</span></button>'
32397
32436
  html += '</div>'
32398
- html += '<label part="input-label" class="mt-20">Select Date</label>'
32399
- html += '<input part="input" id="input-compliance-date" type="date" class="w-100-m-0" mandatory="" autocomplete="off" style="display: block;">'
32400
- // html += '<button id="button-reports-date-selector-back" class="button-back" part="button">back</button>';
32437
+ 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>`
32438
+ 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>`
32439
+ 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>`
32440
+ html += '<div class="w-100-m-0 d-flex justify-start">'
32441
+ 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>'
32442
+ 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>`
32443
+ html += '</div>';
32401
32444
  html += '</div>';
32402
32445
  (this._SfIEventsC.querySelector('#reports-data') as HTMLDivElement).innerHTML = html;
32403
- let inputComplianceDate = (this._SfIEventsC.querySelector('#input-compliance-date') as HTMLInputElement)
32404
- inputComplianceDate.addEventListener('change', (ev: any) => {
32405
- let selectedDate = new Date((ev.target as HTMLInputElement).value)
32406
- this.fetchReportCompliances(selectedDate, sortid)
32446
+ let inputReporter = (this._SfIEventsC.querySelector('#input-user') as SfIForm)
32447
+ let inputEntityForm = (this._SfIEventsC.querySelector('#input-entity-tags') as SfIForm);
32448
+ let inputLocationForm = (this._SfIEventsC.querySelector('#input-location-tags') as SfIForm);
32449
+
32450
+ inputReporter.loadMode();
32451
+ inputReporter.addEventListener('valueChanged', (ev: any) => {
32452
+ let targetForm = ev.target as SfIForm;
32453
+ let selectedReporter = targetForm.selectedTexts()[0]
32454
+ console.log('reporter selected', selectedReporter)
32455
+ checkButtonSearch()
32456
+ })
32457
+ let entityId = sortid.split(';')[1]
32458
+ inputEntityForm.selectedSearchId = entityId;
32459
+ inputEntityForm.loadMode();
32460
+ inputEntityForm.addEventListener('valueChanged', (ev: any) => {
32461
+ let targetForm = ev.target as SfIForm;
32462
+ let selectedEntity = targetForm.selectedTexts()[0]
32463
+ console.log('entity selected', selectedEntity)
32464
+ inputLocationForm.searchPhrase = this.projectName + '&Location&' + selectedEntity.replace(/\([^)]*\)/g, "");
32465
+ inputLocationForm.loadMode();
32466
+ checkButtonSearch()
32467
+ })
32468
+ let locationId = sortid.split(';')[2]
32469
+ inputLocationForm.selectedSearchId = locationId;
32470
+ inputLocationForm.loadMode();
32471
+ inputLocationForm.addEventListener('valueChanged', (ev: any) => {
32472
+ let targetForm = ev.target as SfIForm;
32473
+ let selectedLocation = targetForm.selectedTexts()[0]
32474
+ console.log('location selected', selectedLocation)
32475
+ checkButtonSearch()
32407
32476
  })
32477
+
32408
32478
  let buttonBack = (this._SfIEventsC.querySelector('#button-reports-date-selector-back') as HTMLButtonElement)
32409
32479
  buttonBack.addEventListener('click', () => {
32410
32480
  this.fetchReports()
32411
32481
  })
32482
+ let buttonSearch = (this._SfIEventsC.querySelector('#button-reports-search') as HTMLButtonElement)
32483
+ buttonSearch.addEventListener('click', () => {
32484
+ let selectedReporterId = inputReporter.selectedValues()[0];
32485
+ let selectedEntityId = inputEntityForm.selectedValues()[0];
32486
+ let selectedLocationId = inputLocationForm.selectedValues()[0];
32487
+ this.fetchReportCompliances(selectedReporterId, selectedEntityId, selectedLocationId, sortid, processed)
32488
+ })
32489
+
32490
+ let buttonMark = (this._SfIEventsC.querySelector('#button-reports-mark') as HTMLButtonElement)
32491
+ buttonMark.addEventListener('click', () => {
32492
+ let [mmddyyyy, entityid, locationid, complianceid] = sortid.split(';');
32493
+ let year = this.getFinancialYear(mmddyyyy)
32494
+ this.markReport(mmddyyyy, entityid, locationid, complianceid, year, !processed)
32495
+ })
32496
+ function checkButtonSearch() {
32497
+ let selectedReporterId = inputReporter.selectedValues()[0];
32498
+ let selectedEntityId = inputEntityForm.selectedValues()[0];
32499
+ let selectedLocationId = inputLocationForm.selectedValues()[0];
32500
+ if (selectedReporterId != null && selectedEntityId != null && selectedLocationId != null) {
32501
+ buttonSearch.disabled = false;
32502
+ } else {
32503
+ buttonSearch.disabled = true;
32504
+ }
32505
+ }
32412
32506
 
32413
32507
  }
32414
32508
 
32415
- fetchReportCompliances = async (selectedDate: Date, sortid: string) => {
32416
- console.log('fetching compliances', sortid)
32417
- let complianceEntityId = sortid.split(';')[1]
32418
- let complianceLocationId = sortid.split(';')[2]
32419
- let url = "https://" + this.apiId + "/getallcountryevents5";
32420
- let sDateObj = selectedDate
32421
- sDateObj.setDate(selectedDate.getDate() - 60)
32422
- let day = '' + sDateObj.getDate();
32423
- let month = '' + (sDateObj.getMonth() + 1);
32424
- let year = '' + sDateObj.getFullYear();
32425
- if (month.length < 2)
32426
- month = '0' + month;
32427
- if (day.length < 2)
32428
- day = '0' + day;
32429
- let sDate = month + "/" + day + "/" + year
32430
- let eDateObj = selectedDate
32431
- eDateObj.setDate(selectedDate.getDate() + 120)
32432
- day = '' + eDateObj.getDate();
32433
- month = '' + (eDateObj.getMonth() + 1);
32434
- year = '' + eDateObj.getFullYear();
32435
- if (month.length < 2)
32436
- month = '0' + month;
32437
- if (day.length < 2)
32438
- day = '0' + day;
32439
- let eDate = month + "/" + day + "/" + year
32440
- //console.log('fetch calendar url', url);
32441
- let urlBody: any = { "projectid": this.projectId, "userprofileid": this.userProfileId, "role": this.myRole, "entityid": complianceEntityId, "countryid": "", "functionid": "", "locationid": complianceLocationId, "tagid": this.tagId, "adhoc": "false", "exclusivestartkey": 0, "sdate": sDate, "edate": eDate, "view": "location", "year": this.calendarStartYYYY };
32509
+ markReport = async (mmddyyyy: string, entityid: string, locationid: string, eventid: string, year: string, processed: boolean) => {
32510
+ console.log('marking report', eventid, processed)
32511
+ let url = "https://" + this.apiId + "/markreportprocessed";
32512
+
32513
+ let urlBody: any = { "projectid": this.projectId, "eventid": eventid, "mmddyyyy": mmddyyyy, "entityid": entityid, "locationid": locationid, "year": year, "processed": processed };
32442
32514
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
32443
32515
  const xhr: any = (await this.prepareXhr(urlBody, url, this._SfLoader, authorization, 'Preparing')) as any;
32444
32516
  this._SfLoader.innerHTML = '';
32445
32517
  if (xhr.status == 200) {
32446
-
32447
- const jsonRespose = JSON.parse(xhr.responseText);
32448
- console.log('jsonRespose', jsonRespose);
32449
- let arrCompliances = (await this.fetchPresignedUrl(jsonRespose.signedUrlGet));
32450
- await this.fetchPresignedUrlDelete(jsonRespose.signedUrlDelete);
32451
- console.log('receivedCompliacnes', arrCompliances)
32452
- this.renderReportsComplainces(arrCompliances, sortid);
32518
+ this.setSuccess("Report " + ((processed == true) ? "marked" : "unmarked") + " successfully.");
32519
+ this.fetchReports();
32520
+ setTimeout(() => {
32521
+ this.clearMessages();
32522
+ }, 5000);
32453
32523
  } else {
32454
- if (xhr.status == 401) {
32455
- let changeEvent = new CustomEvent('tokenExpired', { bubbles: true });
32456
- this.dispatchEvent(changeEvent);
32457
- }
32458
- if (xhr.status === 404) {
32524
+ const jsonResponse = JSON.parse(xhr.responseText);
32525
+ this.setError(jsonResponse.error);
32526
+ setTimeout(() => {
32527
+ this.clearMessages();
32528
+ }, 5000);
32529
+ }
32530
+ }
32459
32531
 
32460
- this.showChosenProject();
32461
- (this._SfTitleChosenProject as HTMLElement).innerHTML = (this._SfProject[0].querySelector('#sf-i-project') as SfIForm).selectedTexts()[0];
32462
- this.renderChosenProject();
32532
+ fetchReportCompliances = async (reporterid: string, entityid: string, locationid: string, sortid: string, processed: boolean) => {
32533
+ console.log('fetching compliances', sortid)
32534
+ let url = "https://" + this.apiId + "/geteventfromreport";
32463
32535
 
32464
- } else {
32465
- const jsonRespose = JSON.parse(xhr.responseText);
32466
- this.setError(jsonRespose.error);
32536
+ let urlBody: any = { "projectid": this.projectId, "sortid": sortid, "reporterid": reporterid, "entityid": entityid, "locationid": locationid };
32537
+ const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
32538
+ const xhr: any = (await this.prepareXhr(urlBody, url, this._SfLoader, authorization, 'Preparing')) as any;
32539
+ this._SfLoader.innerHTML = '';
32540
+ if (xhr.status == 200) {
32541
+
32542
+ const jsonResponse = JSON.parse(xhr.responseText);
32543
+ console.log('fetch compliances jsonRespose', jsonResponse);
32544
+
32545
+ if (jsonResponse.event == null) {
32546
+ this.setError("Compliance status is - " + jsonResponse.completenessstatus);
32467
32547
  setTimeout(() => {
32468
32548
  this.clearMessages();
32469
32549
  }, 5000);
32550
+ } else {
32551
+ let returnedEvent = jsonResponse.event
32552
+ let arrCompliances = [(returnedEvent)];
32553
+ let assocEvents: any = {};
32554
+ let mmdd = (returnedEvent.duedate).split('/')[1] + "/" + (returnedEvent.duedate).split('/')[0];
32555
+ assocEvents[mmdd] = arrCompliances;
32556
+ this.renderReportsCompliances(assocEvents, sortid, processed);
32470
32557
  }
32471
-
32558
+ } else {
32559
+ const jsonResponse = JSON.parse(xhr.responseText);
32560
+ this.setError(jsonResponse.error);
32561
+ setTimeout(() => {
32562
+ this.clearMessages();
32563
+ }, 5000);
32472
32564
  }
32473
32565
  }
32474
32566
 
32475
- renderReportsComplainces = (compliancesData: any, sortid: string) => {
32567
+ renderReportsCompliances = (compliancesData: any, sortid: string, processed: boolean) => {
32476
32568
  let eventsData: any = {}
32477
32569
  let complianceId = sortid.split(';')[3]
32478
32570
  console.log('renderReportsComplainces', compliancesData, complianceId);
@@ -32577,24 +32669,25 @@ export class SfIEvents extends LitElement {
32577
32669
  const id = ev.target.id;
32578
32670
  const idArr = id.split("-")
32579
32671
  const mmdd = idArr[3] + "/" + idArr[4];
32580
- // const j = idArr[5];
32672
+ const j = idArr[5];
32673
+ let eventObj = eventsData[mmdd][j];
32581
32674
  console.log('move reporting', mmdd + '/' + this.calendarStartYYYY, sortid)
32582
- this.submitUpdateReporting(mmdd + '/' + this.calendarStartYYYY, sortid);
32675
+ this.submitUpdateReporting(mmdd + '/' + this.calendarStartYYYY, eventObj['entityid'], eventObj['locationid'], sortid);
32583
32676
  })
32584
32677
  }
32585
32678
 
32586
32679
  let buttonBack = (this._SfIEventsC.querySelector('#button-reports-date-selector-back') as HTMLButtonElement)
32587
32680
  buttonBack.addEventListener('click', () => {
32588
- this.renderDateSelector(sortid)
32681
+ this.renderComplianceSelector(sortid, processed)
32589
32682
  })
32590
32683
  }
32591
32684
 
32592
- submitUpdateReporting = async (mmddyyyy: string, sortid: string) => {
32685
+ submitUpdateReporting = async (mmddyyyy: string, entityid: string, locationid: string, sortid: string) => {
32593
32686
  let url = "https://" + this.apiId + "/updatereportdate";
32594
32687
 
32595
32688
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
32596
32689
  console.log('this.myroles', this.myroles)
32597
- const xhr: any = (await this.prepareXhr({ "projectid": this.projectId, "mmddyyyy": mmddyyyy, "sortid": sortid }, url, this._SfLoader, authorization)) as any;
32690
+ const xhr: any = (await this.prepareXhr({ "projectid": this.projectId, "mmddyyyy": mmddyyyy, "entityid": entityid, "locationid": locationid, "sortid": sortid }, url, this._SfLoader, authorization)) as any;
32598
32691
  this._SfLoader.innerHTML = '';
32599
32692
  if (xhr.status == 200) {
32600
32693
  this.setSuccess("update successful!");