sf-i-events 1.0.968 → 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
@@ -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,11 +1231,11 @@
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="dwqyez2puoxmu.cloudfront.net/event" apiidtags="dnytrdlrmxgsy.cloudfront.net/tagging" apiIdUserProfiles="dnytrdlrmxgsy.cloudfront.net/userprofile" mode="reports" fill="pattern"
1235
1235
  username="Local Reporter 1" userprofileid="e9684b5d-ddbc-46d3-ae07-51706bf75410"
1236
1236
  projectid="41ab3c86-ccc0-4c0e-8e31-cd079a07a710" projectname="ABC Global" calendarstartyyyy="2025"
1237
1237
  myrole="reporter">
1238
- </sf-i-events> -->
1238
+ </sf-i-events>
1239
1239
  <!-- <sf-i-events name="Calendar" apiid="dwqyez2puoxmu.cloudfront.net/event" apiidtags="dnytrdlrmxgsy.cloudfront.net/tagging" mode="reports" fill="pattern"
1240
1240
  username="Pushti Goenka" userprofileid="8ac7f984-a9e2-46ef-a815-c5116f3e4638"
1241
1241
  projectid="7f928276-a9ff-4bcd-a8db-874f618a92ea" projectname="Transvolt" calendarstartyyyy="2025" 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.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;
@@ -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
@@ -25684,7 +25684,7 @@ let SfIEvents = class SfIEvents extends LitElement {
25684
25684
  }
25685
25685
  };
25686
25686
  this.renderReports = (reportsData) => {
25687
- var _a;
25687
+ var _a, _b;
25688
25688
  let html = '<div class="d-flex flex-col w-100-m-0">';
25689
25689
  html += '<div part="stream-event-list" class="d-flex flex-col align-stretch">';
25690
25690
  for (let reportKey of Object.keys(reportsData)) {
@@ -25699,7 +25699,7 @@ let SfIEvents = class SfIEvents extends LitElement {
25699
25699
  html += '<table>';
25700
25700
  html += '<tr>';
25701
25701
  html += '<th part="td-head">Select</th>';
25702
- html += '<th part="td-head">Zombie</th>';
25702
+ html += '<th part="td-head">Processed</th>';
25703
25703
  html += '<th part="td-head">Date</th>';
25704
25704
  html += '<th part="td-head">Docs</th>';
25705
25705
  html += '<th part="td-head">Comments</th>';
@@ -25710,7 +25710,7 @@ let SfIEvents = class SfIEvents extends LitElement {
25710
25710
  html += '</tr>';
25711
25711
  html += '<tr>';
25712
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>';
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>';
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>`;
25714
25714
  html += `<td part="td-body">${reportKey.split(';')[0]}</td>`;
25715
25715
  html += `<td part="td-body">${JSON.parse(report['docs']).length}</td>`;
25716
25716
  html += `<td part="td-body">${report['comments'].length}</td>`;
@@ -25719,7 +25719,7 @@ let SfIEvents = class SfIEvents extends LitElement {
25719
25719
  let locationname = "";
25720
25720
  let eventHtml = "";
25721
25721
  if (report['event'] != null) {
25722
- locationname = (_a = JSON.parse(report['event'])['locationname']) !== null && _a !== void 0 ? _a : "";
25722
+ locationname = (_b = JSON.parse(report['event'])['locationname']) !== null && _b !== void 0 ? _b : "";
25723
25723
  for (var i = 0; i < Object.keys(JSON.parse(report['event'])).length; i++) {
25724
25724
  if (!this.EXCLUDE_COLS_FROM_REGS.includes(Object.keys(JSON.parse(report['event']))[i].toLowerCase())) {
25725
25725
  eventHtml += '<td part="td-body-register">';
@@ -25751,13 +25751,16 @@ let SfIEvents = class SfIEvents extends LitElement {
25751
25751
  const arrButtonSelect = this._SfIEventsC.querySelectorAll('.button-select');
25752
25752
  for (let buttonSelect of arrButtonSelect) {
25753
25753
  buttonSelect.addEventListener('click', (ev) => {
25754
+ var _a;
25754
25755
  const id = ev.target.id;
25755
25756
  console.log('id', id);
25756
25757
  const idArr = id.split("-");
25757
25758
  console.log('idArr', idArr);
25758
25759
  const sortid = idArr[2].replace(/_/g, '-');
25759
25760
  console.log('selected sortid', sortid);
25760
- 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);
25761
25764
  });
25762
25765
  }
25763
25766
  const arrButtonCheck = this._SfIEventsC.querySelectorAll('.button-check');
@@ -25858,110 +25861,136 @@ let SfIEvents = class SfIEvents extends LitElement {
25858
25861
  });
25859
25862
  }
25860
25863
  };
25861
- this.renderDateSelector = (sortid) => {
25864
+ this.renderComplianceSelector = (sortid, processed = false) => {
25862
25865
  let html = '';
25863
25866
  html += '<div class="w-100-m-0 d-flex flex-col justify-center">';
25864
25867
  html += '<div class="w-100-m-0 d-flex justify-start">';
25865
25868
  html += '<button id="button-reports-date-selector-back" part="button-icon" class="button-icon"><span class="material-icons">keyboard_backspace</span></button>';
25866
25869
  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>';
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>';
25871
25877
  html += '</div>';
25872
25878
  this._SfIEventsC.querySelector('#reports-data').innerHTML = html;
25873
- let inputComplianceDate = this._SfIEventsC.querySelector('#input-compliance-date');
25879
+ let inputReporter = this._SfIEventsC.querySelector('#input-user');
25880
+ let inputEntityForm = this._SfIEventsC.querySelector('#input-entity-tags');
25874
25881
  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);
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();
25884
25899
  });
25885
25900
  let locationId = sortid.split(';')[2];
25886
25901
  inputLocationForm.selectedSearchId = locationId;
25887
25902
  inputLocationForm.loadMode();
25888
25903
  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);
25904
+ let targetForm = ev.target;
25905
+ let selectedLocation = targetForm.selectedTexts()[0];
25906
+ console.log('location selected', selectedLocation);
25907
+ checkButtonSearch();
25901
25908
  });
25902
25909
  let buttonBack = this._SfIEventsC.querySelector('#button-reports-date-selector-back');
25903
25910
  buttonBack.addEventListener('click', () => {
25904
25911
  this.fetchReports();
25905
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
+ }
25906
25937
  };
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 };
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 };
25934
25942
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
25935
25943
  const xhr = (await this.prepareXhr(urlBody, url, this._SfLoader, authorization, 'Preparing'));
25936
25944
  this._SfLoader.innerHTML = '';
25937
25945
  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);
25946
+ this.setSuccess("Report " + ((processed == true) ? "marked" : "unmarked") + " successfully.");
25947
+ this.fetchReports();
25948
+ setTimeout(() => {
25949
+ this.clearMessages();
25950
+ }, 5000);
25944
25951
  }
25945
25952
  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);
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);
25958
25972
  setTimeout(() => {
25959
25973
  this.clearMessages();
25960
25974
  }, 5000);
25961
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);
25962
25991
  }
25963
25992
  };
25964
- this.renderReportsCompliances = (compliancesData, sortid) => {
25993
+ this.renderReportsCompliances = (compliancesData, sortid, processed) => {
25965
25994
  let eventsData = {};
25966
25995
  let complianceId = sortid.split(';')[3];
25967
25996
  console.log('renderReportsComplainces', compliancesData, complianceId);
@@ -26056,21 +26085,22 @@ let SfIEvents = class SfIEvents extends LitElement {
26056
26085
  const id = ev.target.id;
26057
26086
  const idArr = id.split("-");
26058
26087
  const mmdd = idArr[3] + "/" + idArr[4];
26059
- // const j = idArr[5];
26088
+ const j = idArr[5];
26089
+ let eventObj = eventsData[mmdd][j];
26060
26090
  console.log('move reporting', mmdd + '/' + this.calendarStartYYYY, sortid);
26061
- this.submitUpdateReporting(mmdd + '/' + this.calendarStartYYYY, sortid);
26091
+ this.submitUpdateReporting(mmdd + '/' + this.calendarStartYYYY, eventObj['entityid'], eventObj['locationid'], sortid);
26062
26092
  });
26063
26093
  }
26064
26094
  let buttonBack = this._SfIEventsC.querySelector('#button-reports-date-selector-back');
26065
26095
  buttonBack.addEventListener('click', () => {
26066
- this.renderDateSelector(sortid);
26096
+ this.renderComplianceSelector(sortid, processed);
26067
26097
  });
26068
26098
  };
26069
- this.submitUpdateReporting = async (mmddyyyy, sortid) => {
26099
+ this.submitUpdateReporting = async (mmddyyyy, entityid, locationid, sortid) => {
26070
26100
  let url = "https://" + this.apiId + "/updatereportdate";
26071
26101
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
26072
26102
  console.log('this.myroles', this.myroles);
26073
- 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));
26074
26104
  this._SfLoader.innerHTML = '';
26075
26105
  if (xhr.status == 200) {
26076
26106
  this.setSuccess("update successful!");
@@ -27903,6 +27933,9 @@ __decorate([
27903
27933
  __decorate([
27904
27934
  property()
27905
27935
  ], SfIEvents.prototype, "apiIdTags", void 0);
27936
+ __decorate([
27937
+ property()
27938
+ ], SfIEvents.prototype, "apiIdUserProfiles", void 0);
27906
27939
  __decorate([
27907
27940
  property()
27908
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
 
@@ -22632,11 +22635,11 @@ export class SfIEvents extends LitElement {
22632
22635
  }
22633
22636
  }
22634
22637
  let pastFiscals = [parseInt(this.getCurrentYearGeneric())]
22635
- if(this.contractStartDate != null) {
22638
+ if (this.contractStartDate != null) {
22636
22639
  pastFiscals = this.getAllPastFiscals(new Date(this.contractStartDate));
22637
22640
  }
22638
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) => {
22639
- return `<option value="${fiscal}"${fiscal == parseInt(year) ? " selected" : ""}>${fiscal}-${(fiscal % 100) + 1}</option>`
22642
+ return `<option value="${fiscal}"${fiscal == parseInt(year) ? " selected" : ""}>${fiscal}-${(fiscal % 100) + 1}</option>`
22640
22643
  })}</select></div>`);
22641
22644
 
22642
22645
 
@@ -32243,7 +32246,7 @@ export class SfIEvents extends LitElement {
32243
32246
 
32244
32247
  html += '<tr>';
32245
32248
  html += '<th part="td-head">Select</th>'
32246
- html += '<th part="td-head">Zombie</th>'
32249
+ html += '<th part="td-head">Processed</th>'
32247
32250
  html += '<th part="td-head">Date</th>'
32248
32251
  html += '<th part="td-head">Docs</th>'
32249
32252
  html += '<th part="td-head">Comments</th>'
@@ -32255,7 +32258,7 @@ export class SfIEvents extends LitElement {
32255
32258
 
32256
32259
  html += '<tr>';
32257
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>'
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>'
32261
+ html += `<td part="td-body"><span class="material-symbols-outlined mr-10">${report['processed'] ?? false ? "done_all" : ""}</span></td>`
32259
32262
  html += `<td part="td-body">${reportKey.split(';')[0]}</td>`;
32260
32263
  html += `<td part="td-body">${JSON.parse(report['docs']).length}</td>`;
32261
32264
  html += `<td part="td-body">${report['comments'].length}</td>`;
@@ -32314,7 +32317,9 @@ export class SfIEvents extends LitElement {
32314
32317
  console.log('idArr', idArr)
32315
32318
  const sortid = idArr[2].replace(/_/g, '-')
32316
32319
  console.log('selected sortid', sortid)
32317
- this.renderDateSelector(sortid);
32320
+ let reportData = JSON.parse(reportsData[sortid]);
32321
+ console.log('selectedReportData', reportData);
32322
+ this.renderComplianceSelector(sortid, reportData.processed ?? false);
32318
32323
  })
32319
32324
  }
32320
32325
 
@@ -32423,117 +32428,143 @@ export class SfIEvents extends LitElement {
32423
32428
  }
32424
32429
 
32425
32430
  }
32426
- renderDateSelector = (sortid: string) => {
32431
+ renderComplianceSelector = (sortid: string, processed: boolean = false) => {
32427
32432
  let html = ''
32428
32433
  html += '<div class="w-100-m-0 d-flex flex-col justify-center">'
32429
32434
  html += '<div class="w-100-m-0 d-flex justify-start">'
32430
32435
  html += '<button id="button-reports-date-selector-back" part="button-icon" class="button-icon"><span class="material-icons">keyboard_backspace</span></button>'
32431
32436
  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>';
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>';
32436
32444
  html += '</div>';
32437
32445
  (this._SfIEventsC.querySelector('#reports-data') as HTMLDivElement).innerHTML = html;
32438
- let inputComplianceDate = (this._SfIEventsC.querySelector('#input-compliance-date') as HTMLInputElement)
32446
+ let inputReporter = (this._SfIEventsC.querySelector('#input-user') as SfIForm)
32447
+ let inputEntityForm = (this._SfIEventsC.querySelector('#input-entity-tags') as SfIForm);
32439
32448
  let inputLocationForm = (this._SfIEventsC.querySelector('#input-location-tags') as SfIForm);
32440
32449
 
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)
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()
32450
32467
  })
32451
32468
  let locationId = sortid.split(';')[2]
32452
32469
  inputLocationForm.selectedSearchId = locationId;
32453
32470
  inputLocationForm.loadMode();
32454
32471
  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)
32472
+ let targetForm = ev.target as SfIForm;
32473
+ let selectedLocation = targetForm.selectedTexts()[0]
32474
+ console.log('location selected', selectedLocation)
32475
+ checkButtonSearch()
32467
32476
  })
32468
32477
 
32469
32478
  let buttonBack = (this._SfIEventsC.querySelector('#button-reports-date-selector-back') as HTMLButtonElement)
32470
32479
  buttonBack.addEventListener('click', () => {
32471
32480
  this.fetchReports()
32472
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
+ }
32473
32506
 
32474
32507
  }
32475
32508
 
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 };
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 };
32503
32514
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
32504
32515
  const xhr: any = (await this.prepareXhr(urlBody, url, this._SfLoader, authorization, 'Preparing')) as any;
32505
32516
  this._SfLoader.innerHTML = '';
32506
32517
  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);
32518
+ this.setSuccess("Report " + ((processed == true) ? "marked" : "unmarked") + " successfully.");
32519
+ this.fetchReports();
32520
+ setTimeout(() => {
32521
+ this.clearMessages();
32522
+ }, 5000);
32514
32523
  } else {
32515
- if (xhr.status == 401) {
32516
- let changeEvent = new CustomEvent('tokenExpired', { bubbles: true });
32517
- this.dispatchEvent(changeEvent);
32518
- }
32519
- 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
+ }
32520
32531
 
32521
- this.showChosenProject();
32522
- (this._SfTitleChosenProject as HTMLElement).innerHTML = (this._SfProject[0].querySelector('#sf-i-project') as SfIForm).selectedTexts()[0];
32523
- 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";
32524
32535
 
32525
- } else {
32526
- const jsonRespose = JSON.parse(xhr.responseText);
32527
- 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);
32528
32547
  setTimeout(() => {
32529
32548
  this.clearMessages();
32530
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);
32531
32557
  }
32532
-
32558
+ } else {
32559
+ const jsonResponse = JSON.parse(xhr.responseText);
32560
+ this.setError(jsonResponse.error);
32561
+ setTimeout(() => {
32562
+ this.clearMessages();
32563
+ }, 5000);
32533
32564
  }
32534
32565
  }
32535
32566
 
32536
- renderReportsCompliances = (compliancesData: any, sortid: string) => {
32567
+ renderReportsCompliances = (compliancesData: any, sortid: string, processed: boolean) => {
32537
32568
  let eventsData: any = {}
32538
32569
  let complianceId = sortid.split(';')[3]
32539
32570
  console.log('renderReportsComplainces', compliancesData, complianceId);
@@ -32638,24 +32669,25 @@ export class SfIEvents extends LitElement {
32638
32669
  const id = ev.target.id;
32639
32670
  const idArr = id.split("-")
32640
32671
  const mmdd = idArr[3] + "/" + idArr[4];
32641
- // const j = idArr[5];
32672
+ const j = idArr[5];
32673
+ let eventObj = eventsData[mmdd][j];
32642
32674
  console.log('move reporting', mmdd + '/' + this.calendarStartYYYY, sortid)
32643
- this.submitUpdateReporting(mmdd + '/' + this.calendarStartYYYY, sortid);
32675
+ this.submitUpdateReporting(mmdd + '/' + this.calendarStartYYYY, eventObj['entityid'], eventObj['locationid'], sortid);
32644
32676
  })
32645
32677
  }
32646
32678
 
32647
32679
  let buttonBack = (this._SfIEventsC.querySelector('#button-reports-date-selector-back') as HTMLButtonElement)
32648
32680
  buttonBack.addEventListener('click', () => {
32649
- this.renderDateSelector(sortid)
32681
+ this.renderComplianceSelector(sortid, processed)
32650
32682
  })
32651
32683
  }
32652
32684
 
32653
- submitUpdateReporting = async (mmddyyyy: string, sortid: string) => {
32685
+ submitUpdateReporting = async (mmddyyyy: string, entityid: string, locationid: string, sortid: string) => {
32654
32686
  let url = "https://" + this.apiId + "/updatereportdate";
32655
32687
 
32656
32688
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
32657
32689
  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;
32690
+ const xhr: any = (await this.prepareXhr({ "projectid": this.projectId, "mmddyyyy": mmddyyyy, "entityid": entityid, "locationid": locationid, "sortid": sortid }, url, this._SfLoader, authorization)) as any;
32659
32691
  this._SfLoader.innerHTML = '';
32660
32692
  if (xhr.status == 200) {
32661
32693
  this.setSuccess("update successful!");