sf-i-events 1.0.873 → 1.0.875

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.
@@ -859,7 +859,7 @@ export class SfIEvents extends LitElement {
859
859
 
860
860
  EXCLUDE_COLS_FROM_REGS: Array<string> = ["updatetype", "question", "invalidations", "activations", "alertschedule", "clientquestion", "countryname", "countryid", "entityname", "entityid", "locationname", "locationid", "reporters", "approvers", "timeframe", "responsedays", "execmodule", "functions", "shortid", "shortnumid", "countries", "entities", "locations", "tagsmap", "reportersmap", "approversmap", "functionheadsmap", "auditorsmap", "viewersmap", "approved", "documents", "comments", "lastupdated", "dateofcompletion", "mmdd", "completeness", "timeliness", "compliance", "delta", "triggers"]
861
861
 
862
- CHARTS_LIST_BY_MODULES: { [key: string]: Array<string> } = { "compliances": ["compliance", "timeliness", "completeness", "riskSeverity", "riskArea", "location", "function", "obligationType", "jurisdiction", "frequency", "subCategory"], "notices": ["compliance", "timeliness", "completeness", "riskSeverity", "riskArea", "location", "function", "obligationType", "jurisdiction", "frequency", "subCategory"], "contracts": ["compliance", "timeliness", "completeness", "location"] };
862
+ CHARTS_LIST_BY_MODULES: { [key: string]: Array<string> } = { "compliances": ["compliance", "timeliness", "completeness", "riskSeverity", "riskArea", "location", "function", "obligationType", "jurisdiction", "frequency", "subCategory"], "notices": ["compliance", "timeliness", "completeness", "riskSeverity", "riskArea", "location", "function", "obligationType", "jurisdiction", "frequency", "subCategory"], "contracts": ["compliance", "timeliness", "completeness", "location"], "licenses": ["compliance", "timeliness", "completeness", "riskSeverity", "riskArea", "location", "function", "obligationType", "jurisdiction", "frequency", "subCategory"] };
863
863
 
864
864
  chartSelectedLegend: Array<number> = [];
865
865
 
@@ -1246,6 +1246,9 @@ export class SfIEvents extends LitElement {
1246
1246
  @property()
1247
1247
  apiIdAgreements!: string;
1248
1248
 
1249
+ @property()
1250
+ apiIdLicenses!: string;
1251
+
1249
1252
  @property()
1250
1253
  apiMethodList!: string;
1251
1254
 
@@ -4263,7 +4266,7 @@ export class SfIEvents extends LitElement {
4263
4266
 
4264
4267
  getComplianceStatus = (completeness: string, timeliness: string, percentage?: string, event: any = {}) => {
4265
4268
  if (event.module == "contract") {
4266
- console.log('compliance status', event.terminated)
4269
+ console.log('compliance status', event.terminated, completeness, timeliness)
4267
4270
  if(event.terminated){
4268
4271
  return "terminated"
4269
4272
  }
@@ -5686,7 +5689,7 @@ export class SfIEvents extends LitElement {
5686
5689
  html += '<button id="button-uploader-submit-approve" class="button-submit" part="button">Save</button>'
5687
5690
  html += '</div>'
5688
5691
 
5689
- if (this.myRole != this.TAB_FUNCTION_HEAD && docs.length > 0 && event.module != 'contract') {
5692
+ if (this.myRole != this.TAB_FUNCTION_HEAD && docs.length > 0 && event.module != 'contract' && event.module != 'license') {
5690
5693
  html += '<div class="m-20">';
5691
5694
  html += '<label part="input-label">Supporting Documents</label>';
5692
5695
  html += '<slot name="uploader"></slot>';
@@ -5697,7 +5700,7 @@ export class SfIEvents extends LitElement {
5697
5700
  html += '<div class="d-flex m-20 flex-col">';
5698
5701
  html += '<label part="input-label">Approver Comments*</label>';
5699
5702
  html += '<input id="input-approver-comments" type="text" part="input" value=""/><br />';
5700
- if (event.module != 'contract') {
5703
+ if (event.module != 'contract' && event.module != 'license') {
5701
5704
  html += '<label part="input-label">Date of Completion*</label>';
5702
5705
  html += '<input id="input-approver-doc" part="input" type="date" value="' + (dateOfCompletion == "" ? dateOfCompletion : new Date(parseInt(dateOfCompletion)).toISOString().substring(0, 10)) + '" disabled/><br />';
5703
5706
  html += '<label part="input-label">Percentage</label>';
@@ -5758,7 +5761,7 @@ export class SfIEvents extends LitElement {
5758
5761
  html += '<div class="d-flex m-20 flex-col">';
5759
5762
  html += '<label part="input-label">Reporter Comments*</label>';
5760
5763
  html += '<input id="input-reporter-comments" type="text" part="input" value=""/><br />';
5761
- if (event.module != 'contract') {
5764
+ if (event.module != 'contract' && event.module != 'license') {
5762
5765
  html += '<label part="input-label">Date of Completion*</label>';
5763
5766
  html += '<input id="input-reporter-doc" part="input" type="date" value="' + (dateOfCompletion == "" ? dateOfCompletion : new Date(parseInt(dateOfCompletion)).toISOString().substring(0, 10)) + '" max="' + (new Date().toISOString().substring(0, 10)) + '"/><br />';
5764
5767
  html += '<label part="input-label">Completion Percentage*</label>';
@@ -5816,7 +5819,7 @@ export class SfIEvents extends LitElement {
5816
5819
  html += '<div class="d-flex m-20 flex-col">';
5817
5820
  html += '<label part="input-label">Auditor Comments</label>';
5818
5821
  html += '<input id="input-auditor-comments" type="text" part="input" value=""/><br />';
5819
- if (event.module != 'contract') {
5822
+ if (event.module != 'contract' && event.module != 'license') {
5820
5823
  html += '<label part="input-label">Date of Completion</label>';
5821
5824
  html += '<input id="input-auditor-doc" part="input" type="date" value="' + (dateOfCompletion == "" ? dateOfCompletion : new Date(parseInt(dateOfCompletion)).toISOString().substring(0, 10)) + '" max="' + (new Date().toISOString().substring(0, 10)) + '" readonly/><br />';
5822
5825
  html += '<label part="input-label">Percentage</label>';
@@ -6794,7 +6797,9 @@ export class SfIEvents extends LitElement {
6794
6797
  if (module === "notice") {
6795
6798
  this.renderNoticeDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
6796
6799
  } else if (module === "contract") {
6797
- this.fetchAgreementDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
6800
+ this.fetchContractDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
6801
+ } else if (module === "license") {
6802
+ this.fetchLicenseDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
6798
6803
  } else {
6799
6804
  let found = false;
6800
6805
  for (var k = 0; k < this.selectedItemIds.length; k++) {
@@ -6833,7 +6838,9 @@ export class SfIEvents extends LitElement {
6833
6838
  if (module === "notice") {
6834
6839
  this.renderNoticeDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
6835
6840
  } else if (module === "contract") {
6836
- this.fetchAgreementDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
6841
+ this.fetchContractDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
6842
+ } else if (module === "license") {
6843
+ this.fetchLicenseDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
6837
6844
  } else {
6838
6845
  let found = false;
6839
6846
  for (var k = 0; k < this.selectedItemIds.length; k++) {
@@ -10959,7 +10966,9 @@ export class SfIEvents extends LitElement {
10959
10966
  if (module === "notice") {
10960
10967
  this.renderNoticeDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
10961
10968
  } else if (module === "contract") {
10962
- this.fetchAgreementDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
10969
+ this.fetchContractDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
10970
+ } else if (module === "license") {
10971
+ this.fetchLicenseDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
10963
10972
  } else {
10964
10973
  let found = false;
10965
10974
  for (var k = 0; k < this.selectedItemIds.length; k++) {
@@ -10998,7 +11007,9 @@ export class SfIEvents extends LitElement {
10998
11007
  if (module === "notice") {
10999
11008
  this.renderNoticeDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
11000
11009
  } else if (module === "contract") {
11001
- this.fetchAgreementDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
11010
+ this.fetchContractDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
11011
+ } else if (module === "license") {
11012
+ this.fetchLicenseDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
11002
11013
  } else {
11003
11014
  let found = false;
11004
11015
  for (var k = 0; k < this.selectedItemIds.length; k++) {
@@ -11567,7 +11578,9 @@ export class SfIEvents extends LitElement {
11567
11578
  if (module === "notice") {
11568
11579
  this.renderNoticeDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
11569
11580
  } else if (module === "contract") {
11570
- this.fetchAgreementDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
11581
+ this.fetchContractDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
11582
+ } else if (module === "license") {
11583
+ this.fetchLicenseDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
11571
11584
  } else {
11572
11585
  let found = false;
11573
11586
  for (var k = 0; k < this.selectedItemIds.length; k++) {
@@ -11588,7 +11601,7 @@ export class SfIEvents extends LitElement {
11588
11601
 
11589
11602
 
11590
11603
  // this.renderEventDetail(this.events[mmdd][j], mmdd + "/" + yyyy, (this._SfStreamContainer as HTMLDivElement).querySelector('#stream-month-'+this.currentColumnIndex) as HTMLButtonElement);
11591
- console.log('errorFetchEvent', mmdd, j, buttonArr[i].outerHTML, idArr);
11604
+ // console.log('errorFetchEvent', mmdd, j, buttonArr[i].outerHTML, idArr);
11592
11605
  this.fetchEventDetails(this.events[mmdd][j], mmdd + "/" + yyyy, (this._SfStreamContainer as HTMLDivElement).querySelector('#stream-month-' + this.currentColumnIndex) as HTMLButtonElement, this._SfStreamContainer as HTMLDivElement);
11593
11606
  }
11594
11607
 
@@ -11611,7 +11624,9 @@ export class SfIEvents extends LitElement {
11611
11624
  if (module === "notice") {
11612
11625
  this.renderNoticeDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
11613
11626
  } else if (module === "contract") {
11614
- this.fetchAgreementDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
11627
+ this.fetchContractDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
11628
+ } else if (module === "license") {
11629
+ this.fetchLicenseDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
11615
11630
  } else {
11616
11631
  let found = false;
11617
11632
  for (var k = 0; k < this.selectedItemIds.length; k++) {
@@ -13678,7 +13693,7 @@ export class SfIEvents extends LitElement {
13678
13693
 
13679
13694
  }
13680
13695
  }
13681
- fetchAgreementDetails = async (listEvent: any, mmddyyyy: string) => {
13696
+ fetchContractDetails = async (listEvent: any, mmddyyyy: string) => {
13682
13697
  let entityId = listEvent.entityid;
13683
13698
  let locationId = listEvent.locationid;
13684
13699
  let url = "https://" + this.apiIdAgreements + "/getallobjectdetails";
@@ -13695,7 +13710,7 @@ export class SfIEvents extends LitElement {
13695
13710
 
13696
13711
  const jsonRespose = JSON.parse(xhr.responseText);
13697
13712
  console.log('jsonRespose agreement details', jsonRespose);
13698
- this.renderAgreementDetails(jsonRespose.object, mmddyyyy)
13713
+ this.renderContractDetails(jsonRespose.object, mmddyyyy)
13699
13714
  } else {
13700
13715
  if (xhr.status == 401) {
13701
13716
  let changeEvent = new CustomEvent('tokenExpired', { bubbles: true });
@@ -13709,7 +13724,7 @@ export class SfIEvents extends LitElement {
13709
13724
 
13710
13725
  }
13711
13726
 
13712
- renewAgreement = async (listEvent: any, reportformatvalues: any) => {
13727
+ renewContract = async (listEvent: any, reportformatvalues: any) => {
13713
13728
 
13714
13729
  let url = "https://" + this.apiIdAgreements + "/reopen";
13715
13730
 
@@ -13735,7 +13750,7 @@ export class SfIEvents extends LitElement {
13735
13750
 
13736
13751
  }
13737
13752
  }
13738
- renderAgreementDetails = async (listEvent: any, mmddyyyy: string) => {
13753
+ renderContractDetails = async (listEvent: any, mmddyyyy: string) => {
13739
13754
  // await this.fetchAgreementDetails(listEvent, mmddyyyy);
13740
13755
  // return;
13741
13756
  let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
@@ -13959,7 +13974,7 @@ export class SfIEvents extends LitElement {
13959
13974
  console.log('mmddyyyy', mmddyyyy)
13960
13975
  if (await this.uploadReview(entityId, locationId, mmddyyyy, listEvent["id"], comments, approved, listEvent.module ?? "events")) {
13961
13976
  if (approved) {
13962
- await this.renewAgreement(listEvent, reportformatvalues);
13977
+ await this.renewContract(listEvent, reportformatvalues);
13963
13978
  } else {
13964
13979
  console.log('renew reporting', reportformatvalues)
13965
13980
  }
@@ -14331,7 +14346,7 @@ export class SfIEvents extends LitElement {
14331
14346
  this.events[mmdd][p].lastupdated = new Date().toString()
14332
14347
  }
14333
14348
  }
14334
- await this.renewAgreement(listEvent, reportformatvalues);
14349
+ await this.renewContract(listEvent, reportformatvalues);
14335
14350
  console.log('upload report auto approve single')
14336
14351
  }
14337
14352
  if (this.recentlyReported[mmdd] == null) {
@@ -14570,15 +14585,15 @@ export class SfIEvents extends LitElement {
14570
14585
 
14571
14586
  }
14572
14587
  }
14588
+ fetchLicenseDetails = async (listEvent: any, mmddyyyy: string) => {
14589
+ let entityId = listEvent.entityid;
14590
+ let locationId = listEvent.locationid;
14591
+ let url = "https://" + this.apiIdLicenses + "/getallobjectdetails";
14573
14592
 
14574
- fetchEventDetails = async (listEvent: any, mmddyyyy: any, currentColumnButton: HTMLButtonElement | null, eventsContainer: HTMLDivElement, flagUploadGuidance: boolean = false, listEventContainer: HTMLDivElement | null = null) => {
14575
- console.log('listEvent', listEvent, listEvent.id)
14576
- let url = "https://" + this.apiId + "/getalleventdetails";
14577
-
14578
- //console.log('fetch calendar url', url);
14579
- let urlBody: any = { "projectid": this.projectId, "userprofileid": this.userProfileId, "role": this.myRole, "eventid": listEvent.id, "entityid": listEvent.entityid, "locationid": listEvent.locationid, "mmddyyyy": mmddyyyy, "year": this.getFinancialYear(mmddyyyy) };
14593
+ console.log('fetch license details url', url);
14594
+ let urlBody: any = { projectid: this.projectId, objectid: listEvent.id, entityid: entityId, locationid: locationId, userprofileid: this.userProfileId, role: this.myRole, year: this.calendarStartYYYY, mmddyyyy: mmddyyyy };
14580
14595
 
14581
- //console.log('urlbody', urlBody);
14596
+ console.log('fetch license details urlbody', urlBody);
14582
14597
 
14583
14598
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
14584
14599
  const xhr: any = (await this.prepareXhr(urlBody, url, this._SfLoader, authorization, 'Preparing')) as any;
@@ -14586,197 +14601,1090 @@ export class SfIEvents extends LitElement {
14586
14601
  if (xhr.status == 200) {
14587
14602
 
14588
14603
  const jsonRespose = JSON.parse(xhr.responseText);
14589
- console.log('jsonRespose', jsonRespose);
14590
- if (flagUploadGuidance) {
14591
- if (listEventContainer != null) {
14592
- let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
14593
- if (this.events[mmdd] != null) {
14594
- for (var p = 0; p < this.events[mmdd].length; p++) {
14595
- if (this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == listEvent.locationid && this.events[mmdd][p].entityid == listEvent.entityid) {
14596
- this.events[mmdd][p].uploadguidance = jsonRespose.data.uploadguidance
14597
- }
14598
- }
14599
- }
14600
- this.renderListReporting(listEventContainer, jsonRespose.data, mmddyyyy, eventsContainer)
14601
- }
14602
- } else {
14603
- this.renderEventDetail(jsonRespose.data, mmddyyyy, currentColumnButton, eventsContainer);
14604
- }
14605
-
14604
+ console.log('jsonRespose agreement details', jsonRespose);
14605
+ this.renderLicenseDetails(jsonRespose.object, mmddyyyy)
14606
14606
  } else {
14607
14607
  if (xhr.status == 401) {
14608
14608
  let changeEvent = new CustomEvent('tokenExpired', { bubbles: true });
14609
14609
  this.dispatchEvent(changeEvent);
14610
- }
14611
- if (xhr.status === 404) {
14612
-
14613
- this.showChosenProject();
14614
- (this._SfTitleChosenProject as HTMLElement).innerHTML = (this._SfProject[0].querySelector('#sf-i-project') as SfIForm).selectedTexts()[0];
14615
- this.renderChosenProject();
14616
-
14617
14610
  } else {
14618
14611
  const jsonRespose = JSON.parse(xhr.responseText);
14619
14612
  this.setError(jsonRespose.error);
14620
14613
  }
14621
14614
 
14622
14615
  }
14616
+
14623
14617
  }
14624
14618
 
14625
- renderEventDetail = (event: any, mmddyyyy: any, currentColumnButton: HTMLButtonElement | null, eventsContainer: HTMLDivElement) => {
14626
- console.log('event details', event, mmddyyyy, currentColumnButton == null ? "null currentColumnButton" : currentColumnButton.id);
14619
+ renewLicense = async (listEvent: any, reportformatvalues: any) => {
14627
14620
 
14628
- let comments, docs, approved, /*dateOfCompletion,*/ makercheckers: Array<string>, docsOptional, documentType;
14629
- let entityId: string = "";
14630
- let locationId: string = "";
14631
- let statuteName: string = "";
14632
- let reportformatName: string = "";
14633
- let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
14634
- entityId = event.entityid;
14635
- locationId = event.locationid;
14636
- // let completeness = this.getCompletenessStatus(event);
14637
- comments = event['comments'] == null ? [] : (event['comments']);
14638
- docs = event['documents'] == null ? [] : event['documents'] == null ? [] : (event['documents']);
14639
- approved = event['approved'] == null ? false : event['approved'] == null ? false : event['approved'];
14640
- // dateOfCompletion = event['dateofcompletion'] == null ? '' : event['dateofcompletion'] == null ? '' : event['dateofcompletion'];
14641
- makercheckers = event['makercheckers'] == null ? [] : event['makercheckers'] == null ? [] : event['makercheckers'];
14642
- docsOptional = event['docs'] == null ? [] : event['docs'] == null ? [] : event['docs'];
14643
- documentType = event['documenttype'] == null ? null : event['documenttype'][0] == null ? null : event['documenttype'][0].split(" ")[0];
14621
+ let url = "https://" + this.apiIdLicenses + "/reopen";
14644
14622
 
14645
- statuteName = event['statute'][0].trim();
14646
- if (event['reportformat'] != null) {
14647
- reportformatName = (event['reportformat'][0] ?? "").trim().replace('&amp;', '&');
14648
- }
14623
+ console.log('renewing', reportformatvalues)
14624
+ //console.log('fetch calendar url', url);
14625
+ let urlBody: any = { projectid: this.projectId, objectid: listEvent.id, newvalues: reportformatvalues == "" ? null : JSON.parse(reportformatvalues), published: true, terminated: (JSON.parse(reportformatvalues).terminated ?? false) };
14626
+ // console.log('reopen body', url, urlBody)
14627
+ const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
14628
+ const xhr: any = (await this.prepareXhr(urlBody, url, this._SfLoader, authorization, 'Preparing')) as any;
14629
+ this._SfLoader.innerHTML = '';
14630
+ if (xhr.status == 200) {
14649
14631
 
14650
- console.log('event detail', event, statuteName);
14651
- //console.log('event detail comments', comments);
14652
- //console.log('event dateofcompletion', dateOfCompletion);
14653
- //console.log('event detail documenttype', documentType);
14654
- const basicFields = ['id', 'shortid', 'entityname', 'locationname', 'functions'];
14655
- const statuteFields = ['jurisdiction', 'country', 'state', 'category', 'subcategory', 'statute'];
14656
- const complianceFields = ['specificity', 'reference', 'obligation', 'penalty', 'authority', 'frequency', 'subfrequency', 'obligationtype', 'duedate', 'applicability', 'form', 'additionalurls', 'adhocquestion', 'adhocquestionschedule', 'adhocinstances', 'uploadguidance', 'attachment'];
14657
- const grcFields = ['internalcontrols', 'firstlineofdefence', 'secondlineofdefence', 'thirdlineofdefence', 'risk', 'riskarea'];
14632
+ const jsonRespose = JSON.parse(xhr.responseText);
14633
+ console.log('jsonRespose agreement reopen', jsonRespose);
14634
+ } else {
14635
+ if (xhr.status == 401) {
14636
+ let changeEvent = new CustomEvent('tokenExpired', { bubbles: true });
14637
+ this.dispatchEvent(changeEvent);
14638
+ } else {
14639
+ const jsonRespose = JSON.parse(xhr.responseText);
14640
+ this.setError(jsonRespose.error);
14641
+ }
14658
14642
 
14659
- let listReportingContainers = eventsContainer.querySelectorAll('.list-reporting-container') as NodeListOf<HTMLDivElement>
14660
- for (let tempReportingContainer of listReportingContainers) {
14661
- tempReportingContainer.style.display = 'none';
14662
- tempReportingContainer.innerHTML = '';
14663
- }
14664
- let buttonListReportings = eventsContainer.querySelectorAll('.button-list-reporting') as NodeListOf<HTMLButtonElement>
14665
- for (let buttonListReporting of buttonListReportings) {
14666
- buttonListReporting.setAttribute('part', 'button-list-reporting')
14667
- }
14668
- let streamEventTitles = eventsContainer.querySelectorAll('.stream-event-title') as NodeListOf<SfIElasticText>
14669
- for (let streamEventTitle of streamEventTitles) {
14670
- streamEventTitle.removeAttribute('part')
14671
14643
  }
14672
- var html = `
14673
-
14674
- <div part="compliance-detail-title" class="d-flex justify-between">
14675
- <button part="button-icon" class="material-icons invisible">close</button>
14676
- <h3 part="results-title" class="m-0">Compliance Details</h3>
14677
- <button id="button-detail-close" part="button-icon" class="material-icons">close</button>
14678
- </div>
14679
-
14680
- `;
14681
-
14682
- if (this.selectedItemIds.length > 1) {
14683
-
14684
- html += `
14685
-
14686
- <div class="d-flex justify-between m-20">
14687
- <h4 class="m-0">${this.selectedItemIds.length - 1} other ` + ((this.selectedItemIds.length - 1) === 1 ? `item` : `items`) + ` also selected</h4>
14644
+ }
14645
+ renderLicenseDetails = async (listEvent: any, mmddyyyy: string) => {
14646
+ // await this.fetchAgreementDetails(listEvent, mmddyyyy);
14647
+ // return;
14648
+ let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
14649
+ let entityId = listEvent.entityid;
14650
+ let locationId = listEvent.locationid;
14651
+ let comments = listEvent['comments'];
14652
+ let docs = listEvent['documents'] == null ? [] : listEvent['documents'] == null ? [] : (listEvent['documents']);
14653
+ let approved = listEvent['approved'] == null ? false : listEvent['approved'] == null ? false : listEvent['approved'];
14654
+ let makercheckers = listEvent['makercheckers'] == null ? [] : listEvent['makercheckers'] == null ? [] : listEvent['makercheckers'];
14655
+ // let docsOptional = listEvent['docs'] == null ? [] : listEvent['docs'] == null ? [] : listEvent['docs'];
14656
+ let html: string = '';
14657
+ let documentType = listEvent['documenttype'] == null ? null : listEvent['documenttype'][0] == null ? null : listEvent['documenttype'][0].split(" ")[0];
14658
+ html += `
14659
+ <div part="compliance-detail-title" class="d-flex justify-between">
14660
+ <button part="button-icon" class="material-icons invisible">close</button>
14661
+ <h3 part="results-title" class="m-0">License Details</h3>
14662
+ <button id="button-detail-close" part="button-icon" class="material-icons">close</button>
14688
14663
  </div>
14689
-
14690
- `;
14664
+ `
14665
+ html += `
14666
+ <div class="box-large" id="shimmer-container-agreements" part="shimmer-container-agreements">
14667
+ </div>
14668
+ `
14669
+ html += '<sf-i-reporting id="detail-reporting" class="hide" exportparts="uploader-extracted-text:reporting-uploader-extracted-text, uploader-sf-upload-message:reporting-uploader-sf-upload-message, uploader-sf-upload-submessage:reporting-uploader-sf-upload-submessage, uploader-extracted-text-chip:reporting-uploader-extracted-text-chip, uploader-extracted-text-chip-failed:reporting-uploader-extracted-text-chip-failed, uploader-doctype-verify-badge:reporting-uploader-doctype-verify-badge,span-submit-published:reporting-span-submit-published, span-submit-unpublished:reporting-span-submit-unpublished, reporting-container:reporting-reporting-container, button-icon:reporting-button-icon, uploader-button-icon:reporting-uploader-button-icon, sf-i-form-modal-container:reporting-sf-i-form-modal-container, next-calendar-date:reporting-next-calendar-date, last-calendar-date:reporting-last-calendar-date, input-publish-checkbox:reporting-input-publish-checkbox, button-icon-light:reporting-button-icon-light, button-icon-small:reporting-button-icon-small, uploader-input-label:reporting-uploader-input-label, input-radio:reporting-input-radio, radio-label:reporting-radio-label, input-textarea:reporting-input-textarea, input-textarea-disabled:reporting-input-textarea-disabled, input-date:reporting-input-date, input-date-disabled:reporting-input-date-disabled, input-select-single:reporting-input-select-single, textarea-container:reporting-textarea-container, section-body:reporting-section-body, section-container:reporting-section-container, date-container:reporting-date-container, input-sf-i-uploader:reporting-input-sf-i-uploader, published-container:reporting-published-container, selected-option:reporting-selected-option, input-select-multi-option:reporting-input-select-multi-option, select-option-label:reporting-select-option-label, input-sf-i-form:reporting-input-sf-i-form, input-sf-i-bricks:reporting-input-sf-i-bricks, uploader-input:reporting-uploader-input, form-container:reporting-form-container, published-container:reporting-published-container, form-container-published:reporting-form-container-published, subsection:reporting-subsection, results-title:reporting-results-title, td-head:reporting-td-head, td-action:reporting-td-action, td-body:reporting-td-body, td-body-2:reporting-td-body-2, add-button:reporting-add-button, uploader-button:reporting-uploader-button, section-head-collapsed:reporting-section-head-collapsed, section-title-expanded:reporting-section-title-expanded, section-title-collapsed:reporting-section-title-collapsed, section-head-expanded:reporting-section-head-expanded, progress-bar-finished:reporting-progress-bar-finished, progress-bar-complete:reporting-progress-bar-complete, progress-bar-incomplete:reporting-progress-bar-incomplete, section-success-icon:reporting-section-success-icon, section-body:reporting-section-body, title-section:reporting-title-section, button-lg:reporting-button-lg, uploader-detail-container:reporting-uploader-detail-container, textarea-label:reporting-textarea-label, date-label:reporting-date-label, commentbox:reporting-commentbox, comment-username:reporting-comment-username, detail-head:reporting-detail-head, reporting-uploader-extracted-text:reporting-reporting-uploader-extracted-text, reporting-uploader-sf-upload-message:reporting-reporting-uploader-sf-upload-message, reporting-uploader-sf-upload-submessage:reporting-reporting-uploader-sf-upload-submessage, reporting-uploader-extracted-text-chip:reporting-reporting-uploader-extracted-text-chip, reporting-uploader-extracted-text-chip-failed:reporting-reporting-uploader-extracted-text-chip-failed, reporting-uploader-doctype-verify-badge:reporting-reporting-uploader-doctype-verify-badge, reporting-span-submit-published:reporting-reporting-span-submit-published, reporting-span-submit-unpublished:reporting-reporting-span-submit-unpublished, reporting-reporting-container:reporting-reporting-reporting-container, reporting-button-icon:reporting-reporting-button-icon, reporting-uploader-button-icon:reporting-reporting-uploader-button-icon, reporting-sf-i-form-modal-container:reporting-reporting-sf-i-form-modal-container, reporting-next-calendar-date:reporting-reporting-next-calendar-date, reporting-last-calendar-date:reporting-reporting-last-calendar-date, reporting-input-publish-checkbox:reporting-reporting-input-publish-checkbox, reporting-button-icon-light:reporting-reporting-button-icon-light, reporting-button-icon-small:reporting-reporting-button-icon-small, reporting-uploader-input-label:reporting-reporting-uploader-input-label, reporting-input-radio:reporting-reporting-input-radio, reporting-radio-label:reporting-reporting-radio-label, reporting-input-textarea:reporting-reporting-input-textarea, reporting-input-textarea-disabled:reporting-reporting-input-textarea-disabled, reporting-input-date:reporting-reporting-input-date, reporting-input-date-disabled:reporting-reporting-input-date-disabled, reporting-input-select-single:reporting-reporting-input-select-single, reporting-textarea-container:reporting-reporting-textarea-container, reporting-section-body:reporting-reporting-section-body, reporting-section-container:reporting-reporting-section-container, reporting-date-container:reporting-reporting-date-container, reporting-input-sf-i-uploader:reporting-reporting-input-sf-i-uploader, reporting-published-container:reporting-reporting-published-container, reporting-selected-option:reporting-reporting-selected-option, reporting-input-select-multi-option:reporting-reporting-input-select-multi-option, reporting-select-option-label:reporting-reporting-select-option-label, reporting-input-sf-i-form:reporting-reporting-input-sf-i-form, reporting-input-sf-i-bricks:reporting-reporting-input-sf-i-bricks, reporting-uploader-input:reporting-reporting-uploader-input, reporting-form-container:reporting-reporting-form-container, reporting-published-container:reporting-reporting-published-container, reporting-form-container-published:reporting-reporting-form-container-published, reporting-subsection:reporting-reporting-subsection, reporting-results-title:reporting-reporting-results-title, reporting-td-head:reporting-reporting-td-head, reporting-td-action:reporting-reporting-td-action, reporting-td-body:reporting-reporting-td-body, reporting-td-body-2:reporting-reporting-td-body-2, reporting-add-button:reporting-reporting-add-button, reporting-uploader-button:reporting-reporting-uploader-button, reporting-section-head-collapsed:reporting-reporting-section-head-collapsed, reporting-section-title-expanded:reporting-reporting-section-title-expanded, reporting-section-title-collapsed:reporting-reporting-section-title-collapsed, reporting-section-head-expanded:reporting-reporting-section-head-expanded, reporting-progress-bar-finished:reporting-reporting-progress-bar-finished, reporting-progress-bar-complete:reporting-reporting-progress-bar-complete, reporting-progress-bar-incomplete:reporting-reporting-progress-bar-incomplete, reporting-section-success-icon:reporting-reporting-section-success-icon, reporting-section-body:reporting-reporting-section-body, reporting-title-section:reporting-reporting-title-section, reporting-button-lg:reporting-reporting-button-lg, reporting-uploader-detail-container:reporting-reporting-uploader-detail-container, reporting-textarea-label:reporting-reporting-textarea-label, reporting-date-label:reporting-reporting-date-label, reporting-commentbox:reporting-reporting-commentbox, reporting-comment-username:reporting-reporting-comment-username, reporting-detail-head:reporting-reporting-detail-head, input-sf-i-select:reporting-input-sf-i-select,reporting-input-sf-i-select:reporting-reporting-input-sf-i-select, select-input-select:reporting-select-input-select, checklist-container:reporting-checklist-container, checklist-title:reporting-checklist-title, checklist-list:reporting-checklist-list, checklist-item:reporting-checklist-item, checklist-checkbox:reporting-checklist-checkbox, checklist-checkbox-label:reporting-checklist-checkbox-label, reporting-checklist-container:reporting-reporting-checklist-container, reporting-checklist-title:reporting-reporting-checklist-title, reporting-checklist-list:reporting-reporting-checklist-list, reporting-checklist-item:reporting-reporting-checklist-item, reporting-checklist-checkbox:reporting-reporting-checklist-checkbox, reporting-checklist-checkbox-label:reporting-reporting-checklist-checkbox-label, checklist-add-input:reporting-checklist-add-input, checklist-add-button:reporting-checklist-add-button, terminate-container:reporting-terminate-container, terminate-container-terminated:reporting-terminate-container-terminated, terminate-container-active:reporting-terminate-container-active, input-terminate-checkbox: reporting-input-terminate-checkbox, reporting-terminate-container:reporting-reporting-terminate-container, reporting-terminate-container-terminated:reporting-reporting-terminate-container-terminated, reporting-terminate-container-active:reporting-reporting-terminate-container-active, reporting-input-terminate-checkbox: reporting-reporting-input-terminate-checkbox, uploader-container:reporting-uploader-container, reporting-uploader-container:reporting-reporting-uploader-container, not-selected:reporting-not-selected, reporting-not-selected:reportinig-reporting-not-selected" name="License Details" apiiduploader="1peg5170d3" apiid="' + this.apiIdLicenses + '" mode="admin" flow="details" projectid="' + this.projectId + '" projectname="' + this.projectName + '" editdisable="true" formviewclass="flex-wrap"></sf-i-reporting>';
14691
14670
 
14692
- }
14671
+ html += '<div part="reporting-view-container">'
14693
14672
 
14694
- html += '<div class="accordian-container m-20 pb-20" part="accordian-container">';
14673
+ html += this.renderReporting(listEvent, mmddyyyy);
14674
+ html += "</div>"
14695
14675
 
14696
- html += '<div part="detail-summary">';
14697
- html += ('<div part="detail-summary-title" class="pl-20 pr-20"><h1>' + event['obligationtitle'] + '</h1></div>');
14698
- html += ('<div part="detail-summary-subtitle" class="pl-20 pr-20"><h3>' + event['obligation'].replace(/\n/g, '<br />') + '</h3></div>');
14699
- html += ('<div part="detail-summary-content" class="pl-20 pr-20">' + ('<sf-i-elastic-text text="' + (event['internalcontrols'] + "").replace(/"/g, "").replace(/\n/g, '<br />') + '" minLength="80"></sf-i-elastic-text>') + '</div>');
14676
+ html += '<div class="d-flex justify-between m-20">';
14677
+ html += '<h3 part="results-title" class="m-0"><br />Comments</h3>';
14700
14678
  html += '</div>';
14701
14679
 
14702
- html += '<br />';
14680
+ html += '<div class="m-20">';
14703
14681
 
14704
- html += '<div class="accordian-section section-basic pl-20 pr-20" part="accordian-section">';
14705
- html += '<div class="d-flex justify-between accordian-head head-basic cursor" part="accordian-head">';
14706
- html += '<h3>Basic Information</h3>'
14707
- html += '<h3 class="head-indicator-basic">-</h3>'
14708
- html += '</div>';
14709
- html += '<div class="d-flex flex-wrap accordian-body body-basic" part="accordian-body">';
14682
+ html += '<div class="d-flex flex-col">';
14710
14683
 
14711
- for (var i = 0; i < basicFields.length; i++) {
14684
+ for (var i = 0; i < comments.length; i++) {
14685
+ html += '<div part="commentbox" class="d-flex commentbox ' + (comments[i].author + "").toLowerCase() + 'box">';
14686
+ html += '<div class="mr-20 d-flex flex-col align-end"><span part="comment-username">' + (comments[i].username != null ? comments[i].username : '') + '</span><span part="td-head">' + comments[i].author + '</span>' + ((i === (comments.length - 1) && this.enableDeleteLatestReport) ? '<br /><button class="mt-5 button-delete" part="button">Delete</button>' : '') + '</div>';
14712
14687
 
14713
- if (!this.getEventPreviewFields().includes(basicFields[i])) {
14688
+ const onlyCommentText = (comments[i].comment + "").replace(/ *\([^)]*\) */g, "").trim();
14689
+ try {
14714
14690
 
14715
- if (!this.getEventHideFields().includes(basicFields[i])) {
14691
+ const jsonComments = JSON.parse(onlyCommentText);
14716
14692
 
14717
- console.log('basicFields', event[basicFields[i]] + "");
14718
- if ((event[basicFields[i]] + "").indexOf("[") >= 0) {
14719
- html += '<div class="m-20">';
14720
- html += '<div part="detail-head"><strong>' + basicFields[i] + '</strong></div>'
14721
- html += this.getEventTexts(basicFields[i], JSON.parse(event[basicFields[i]]), event).replace(/ *\([^)]*\) */g, "").trim();
14722
- html += '</div>';
14723
- } else {
14724
- html += '<div class="m-20">';
14725
- html += '<div part="detail-head"><strong>' + basicFields[i] + '</strong></div>'
14726
- html += '<sf-i-elastic-text text="' + (event[basicFields[i]] + "").replace(/"/g, "").replace(/ *\([^)]*\) */g, "").trim().split(';')[0] + '" minLength="80"></sf-i-elastic-text>';
14727
- html += '</div>';
14693
+ if (Util.isInteger(jsonComments)) {
14694
+ html += '<div class="">' + comments[i].comment + '<br /><small><span class="muted">' + Util.getDateTimeStrings(new Date(comments[i].timestamp).getTime()) + '</span></small></div>';
14695
+ } else {
14696
+ //console.log('json comments', jsonComments);
14697
+ var htmlTable = '';
14698
+ for (var j = 0; j < Object.keys(jsonComments).length; j++) {
14699
+ htmlTable += '<div class="mb-20">';
14700
+ htmlTable += ('<div part="detail-head">' + Object.keys(jsonComments)[j] + '</div>');
14701
+ htmlTable += ('<sf-i-elastic-text text="' + jsonComments[Object.keys(jsonComments)[j]] + '" minLength="20"></sf-i-elastic-text>');
14702
+ htmlTable += '</div>';
14728
14703
  }
14729
-
14704
+ html += '<div class="">' + htmlTable + '<small><span class="muted">' + Util.getDateTimeStrings(new Date(comments[i].timestamp).getTime()) + '</span></small></div>';
14730
14705
  }
14731
- }
14732
-
14733
- }
14734
14706
 
14735
- if (this.mode == "consumer") {
14736
- if (approved) {
14737
- html += '<div class="m-20">';
14738
- html += '<div part="detail-head"><strong>Approved</strong></div>'
14739
- html += '<span class="material-icons color-done">check_circle</span>'
14740
- html += '</div>';
14707
+ } catch (e: any) {
14708
+ //console.log('json comments exception', comments[i]);
14709
+ html += '<div class="">' + comments[i].comment + '<br /><small><span class="muted">' + Util.getDateTimeStrings(new Date(comments[i].timestamp).getTime()) + '</span></small></div>';
14741
14710
  }
14742
- }
14743
14711
 
14744
- if (docs != null) {
14745
- html += '<div class="m-20">';
14746
- html += '<div part="detail-head"><strong>Documents</strong></div>'
14747
- html += '<span class="material-icons muted">description</span>'
14748
- html += docs.length
14749
14712
  html += '</div>';
14750
14713
  }
14751
-
14752
- if (comments != null) {
14753
- html += '<div class="m-20">';
14754
- html += '<div part="detail-head"><strong>Comments</strong></div>'
14755
- html += '<span class="material-icons muted">forum</span>'
14756
- html += comments.length
14757
- html += '</div>';
14714
+ if (comments.length === 0) {
14715
+ html += '<div><strong>No comments yet!</strong></div>';
14758
14716
  }
14759
14717
 
14760
- html += '<div class="m-20">';
14761
- html += '<div part="detail-head"><strong>Reporters</strong></div>'
14762
- html += this.getReporterDetailStringFromEvent(event);
14763
14718
  html += '</div>';
14764
14719
 
14765
- html += '<div class="m-20">';
14766
- html += '<div part="detail-head"><strong>Approvers</strong></div>'
14767
- html += this.getApproverDetailStringFromEvent(event);
14768
14720
  html += '</div>';
14721
+ console.log('selected event', JSON.stringify(listEvent));
14722
+ (this._SfDetailContainer as HTMLDivElement).innerHTML = html;
14723
+ (this._SfDetailContainer as HTMLDivElement).style.display = 'block';
14769
14724
 
14770
- html += '</div>';
14771
- html += '</div>';
14725
+ let usermap = Util.getUsermap();
14772
14726
 
14727
+ let sfireporting = (this._SfDetailContainer as HTMLDivElement).querySelector('#detail-reporting') as SfIReporting
14728
+ sfireporting.usermap = JSON.stringify(usermap);
14729
+ sfireporting.selectedItem = listEvent;
14730
+ sfireporting.editdisable = "true"
14731
+ setTimeout(() => {
14732
+ console.log('sfireporting', sfireporting._SfReportingContainer);
14733
+ console.log('sfireporting', sfireporting.selectedItem);
14734
+ sfireporting.loadMode();
14735
+ }, 500);
14773
14736
 
14774
- html += '<div class="accordian-section section-statute pl-20 pr-20" part="accordian-section">';
14775
- html += '<div class="d-flex justify-between accordian-head head-statute cursor" part="accordian-head">';
14776
- html += '<h3>Statute Information</h3>'
14777
- html += '<h3 class="head-indicator-statute">-</h3>'
14778
- html += '</div>';
14779
- html += '<div class="d-flex flex-wrap accordian-body body-statute" part="accordian-body">';
14737
+ sfireporting.addEventListener('valueChanged', () => {
14738
+ sfireporting.classList.remove('hide');
14739
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#shimmer-container-agreements') as HTMLDivElement).classList.add('hide');
14740
+ });
14741
+ let reportingSchemaJson = "";
14742
+ let reportingSchemaValues = ""
14743
+ if (listEvent.reportformatschema != null) {
14744
+ reportingSchemaJson = listEvent.reportformatschema
14745
+ reportingSchemaValues = listEvent.reportformatvalues
14746
+ } else if (listEvent.customreporting != null) {
14747
+ reportingSchemaJson = listEvent.customreporting
14748
+ }
14749
+ if (listEvent.customreporting != null || listEvent.reportformatschema != null) {
14750
+ let reportingHtml = '<sf-i-reporting id="reporting-reporting" exportparts="uploader-extracted-text:reporting-uploader-extracted-text, uploader-sf-upload-message:reporting-uploader-sf-upload-message, uploader-sf-upload-submessage:reporting-uploader-sf-upload-submessage, uploader-extracted-text-chip:reporting-uploader-extracted-text-chip, uploader-extracted-text-chip-failed:reporting-uploader-extracted-text-chip-failed, uploader-doctype-verify-badge:reporting-uploader-doctype-verify-badge,span-submit-published:reporting-span-submit-published, span-submit-unpublished:reporting-span-submit-unpublished, reporting-container:reporting-reporting-container, button-icon:reporting-button-icon, uploader-button-icon:reporting-uploader-button-icon, sf-i-form-modal-container:reporting-sf-i-form-modal-container, next-calendar-date:reporting-next-calendar-date, last-calendar-date:reporting-last-calendar-date, input-publish-checkbox:reporting-input-publish-checkbox, button-icon-light:reporting-button-icon-light, button-icon-small:reporting-button-icon-small, uploader-input-label:reporting-uploader-input-label, input-radio:reporting-input-radio, radio-label:reporting-radio-label, input-textarea:reporting-input-textarea, input-textarea-disabled:reporting-input-textarea-disabled, input-date:reporting-input-date, input-date-disabled:reporting-input-date-disabled, input-select-single:reporting-input-select-single, textarea-container:reporting-textarea-container, section-body:reporting-section-body, section-container:reporting-section-container, date-container:reporting-date-container, input-sf-i-uploader:reporting-input-sf-i-uploader, published-container:reporting-published-container, selected-option:reporting-selected-option, input-select-multi-option:reporting-input-select-multi-option, select-option-label:reporting-select-option-label, input-sf-i-form:reporting-input-sf-i-form, input-sf-i-bricks:reporting-input-sf-i-bricks, uploader-input:reporting-uploader-input, form-container:reporting-form-container, published-container:reporting-published-container, form-container-published:reporting-form-container-published, subsection:reporting-subsection, results-title:reporting-results-title, td-head:reporting-td-head, td-action:reporting-td-action, td-body:reporting-td-body, td-body-2:reporting-td-body-2, add-button:reporting-add-button, uploader-button:reporting-uploader-button, section-head-collapsed:reporting-section-head-collapsed, section-title-expanded:reporting-section-title-expanded, section-title-collapsed:reporting-section-title-collapsed, section-head-expanded:reporting-section-head-expanded, progress-bar-finished:reporting-progress-bar-finished, progress-bar-complete:reporting-progress-bar-complete, progress-bar-incomplete:reporting-progress-bar-incomplete, section-success-icon:reporting-section-success-icon, section-body:reporting-section-body, title-section:reporting-title-section, button-lg:reporting-button-lg, uploader-detail-container:reporting-uploader-detail-container, textarea-label:reporting-textarea-label, date-label:reporting-date-label, commentbox:reporting-commentbox, comment-username:reporting-comment-username, detail-head:reporting-detail-head, reporting-uploader-extracted-text:reporting-reporting-uploader-extracted-text, reporting-uploader-sf-upload-message:reporting-reporting-uploader-sf-upload-message, reporting-uploader-sf-upload-submessage:reporting-reporting-uploader-sf-upload-submessage, reporting-uploader-extracted-text-chip:reporting-reporting-uploader-extracted-text-chip, reporting-uploader-extracted-text-chip-failed:reporting-reporting-uploader-extracted-text-chip-failed, reporting-uploader-doctype-verify-badge:reporting-reporting-uploader-doctype-verify-badge, reporting-span-submit-published:reporting-reporting-span-submit-published, reporting-span-submit-unpublished:reporting-reporting-span-submit-unpublished, reporting-reporting-container:reporting-reporting-reporting-container, reporting-button-icon:reporting-reporting-button-icon, reporting-uploader-button-icon:reporting-reporting-uploader-button-icon, reporting-sf-i-form-modal-container:reporting-reporting-sf-i-form-modal-container, reporting-next-calendar-date:reporting-reporting-next-calendar-date, reporting-last-calendar-date:reporting-reporting-last-calendar-date, reporting-input-publish-checkbox:reporting-reporting-input-publish-checkbox, reporting-button-icon-light:reporting-reporting-button-icon-light, reporting-button-icon-small:reporting-reporting-button-icon-small, reporting-uploader-input-label:reporting-reporting-uploader-input-label, reporting-input-radio:reporting-reporting-input-radio, reporting-radio-label:reporting-reporting-radio-label, reporting-input-textarea:reporting-reporting-input-textarea, reporting-input-textarea-disabled:reporting-reporting-input-textarea-disabled, reporting-input-date:reporting-reporting-input-date, reporting-input-date-disabled:reporting-reporting-input-date-disabled, reporting-input-select-single:reporting-reporting-input-select-single, reporting-textarea-container:reporting-reporting-textarea-container, reporting-section-body:reporting-reporting-section-body, reporting-section-container:reporting-reporting-section-container, reporting-date-container:reporting-reporting-date-container, reporting-input-sf-i-uploader:reporting-reporting-input-sf-i-uploader, reporting-published-container:reporting-reporting-published-container, reporting-selected-option:reporting-reporting-selected-option, reporting-input-select-multi-option:reporting-reporting-input-select-multi-option, reporting-select-option-label:reporting-reporting-select-option-label, reporting-input-sf-i-form:reporting-reporting-input-sf-i-form, reporting-input-sf-i-bricks:reporting-reporting-input-sf-i-bricks, reporting-uploader-input:reporting-reporting-uploader-input, reporting-form-container:reporting-reporting-form-container, reporting-published-container:reporting-reporting-published-container, reporting-form-container-published:reporting-reporting-form-container-published, reporting-subsection:reporting-reporting-subsection, reporting-results-title:reporting-reporting-results-title, reporting-td-head:reporting-reporting-td-head, reporting-td-action:reporting-reporting-td-action, reporting-td-body:reporting-reporting-td-body, reporting-td-body-2:reporting-reporting-td-body-2, reporting-add-button:reporting-reporting-add-button, reporting-uploader-button:reporting-reporting-uploader-button, reporting-section-head-collapsed:reporting-reporting-section-head-collapsed, reporting-section-title-expanded:reporting-reporting-section-title-expanded, reporting-section-title-collapsed:reporting-reporting-section-title-collapsed, reporting-section-head-expanded:reporting-reporting-section-head-expanded, reporting-progress-bar-finished:reporting-reporting-progress-bar-finished, reporting-progress-bar-complete:reporting-reporting-progress-bar-complete, reporting-progress-bar-incomplete:reporting-reporting-progress-bar-incomplete, reporting-section-success-icon:reporting-reporting-section-success-icon, reporting-section-body:reporting-reporting-section-body, reporting-title-section:reporting-reporting-title-section, reporting-button-lg:reporting-reporting-button-lg, reporting-uploader-detail-container:reporting-reporting-uploader-detail-container, reporting-textarea-label:reporting-reporting-textarea-label, reporting-date-label:reporting-reporting-date-label, reporting-commentbox:reporting-reporting-commentbox, reporting-comment-username:reporting-reporting-comment-username, reporting-detail-head:reporting-reporting-detail-head, input-sf-i-select:reporting-input-sf-i-select,reporting-input-sf-i-select:reporting-reporting-input-sf-i-select, select-input-select:reporting-select-input-select, checklist-container:reporting-checklist-container, checklist-title:reporting-checklist-title, checklist-list:reporting-checklist-list, checklist-item:reporting-checklist-item, checklist-checkbox:reporting-checklist-checkbox, checklist-checkbox-label:reporting-checklist-checkbox-label, reporting-checklist-container:reporting-reporting-checklist-container, reporting-checklist-title:reporting-reporting-checklist-title, reporting-checklist-list:reporting-reporting-checklist-list, reporting-checklist-item:reporting-reporting-checklist-item, reporting-checklist-checkbox:reporting-reporting-checklist-checkbox, reporting-checklist-checkbox-label:reporting-reporting-checklist-checkbox-label, checklist-add-input:reporting-checklist-add-input, checklist-add-button:reporting-checklist-add-button, terminate-container:reporting-terminate-container, terminate-container-terminated:reporting-terminate-container-terminated, terminate-container-active:reporting-terminate-container-active, input-terminate-checkbox: reporting-input-terminate-checkbox, reporting-terminate-container:reporting-reporting-terminate-container, reporting-terminate-container-terminated:reporting-reporting-terminate-container-terminated, reporting-terminate-container-active:reporting-reporting-terminate-container-active, reporting-input-terminate-checkbox: reporting-reporting-input-terminate-checkbox, uploader-container:reporting-uploader-container, reporting-uploader-container:reporting-reporting-uploader-container, not-selected:reporting-not-selected, reporting-not-selected:reportinig-reporting-not-selected" mode="edit" flow="reporting" name="License Reporting" formviewclass="flex-wrap" showterminate="true" projectid="' + this.projectId + '"></sf-i-reporting>'
14751
+
14752
+ let reportFormatContainer = (this._SfDetailContainer as HTMLDivElement).querySelector('#report-format-container') as HTMLDivElement;
14753
+ if (reportFormatContainer != null) {
14754
+ reportFormatContainer.innerHTML = reportingHtml;
14755
+ }
14756
+
14757
+ }
14758
+ let reportingReporting = (this._SfDetailContainer as HTMLDivElement).querySelector('#reporting-reporting') as SfIReporting
14759
+
14760
+ if (reportingSchemaJson != "" && reportingReporting != null) {
14761
+ reportingReporting.configjson = reportingSchemaJson;
14762
+ if (reportingSchemaValues != "") reportingReporting.prepopulateValJson = reportingSchemaValues
14763
+ reportingReporting.mode = (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_FUNCTION_HEAD) ? "edit" : "view"
14764
+ reportingReporting.editdisable = (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_FUNCTION_HEAD) ? "false" : "true"
14765
+ reportingReporting.flow = "reporting"
14766
+ setTimeout(() => {
14767
+ reportingReporting.loadMode();
14768
+ console.log('list-customreporting', reportingSchemaJson);
14769
+ console.log('list-customreporting1', reportingSchemaValues);
14770
+ console.log('list-customreporting2', reportingReporting.mode);
14771
+ }, 500)
14772
+ }
14773
+
14774
+ (this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close')?.addEventListener('click', () => {
14775
+
14776
+ (this._SfDetailContainer as HTMLDivElement).innerHTML = '';
14777
+ (this._SfDetailContainer as HTMLDivElement).style.display = 'none';
14778
+
14779
+ });
14780
+
14781
+ (this._SfDetailContainer as HTMLDivElement).querySelector('.button-delete')?.addEventListener('click', async () => {
14782
+
14783
+ // await this.fetchDeleteReview(listEvent["id"], mmddyyyy, entityId, locationId);
14784
+ // this.setSuccess('Deleted successfully!')
14785
+ // setTimeout(() => {
14786
+ // this.clearMessages()
14787
+ // }, 3000);
14788
+ // //console.log('deleted', resultDelete);
14789
+ // if(this.getCurrentTab() == this.TAB_CUSTOM) {
14790
+ // this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
14791
+ // } else {
14792
+ // if(currentColumnButton != null) {
14793
+ // currentColumnButton.click();
14794
+ // }
14795
+ // }
14796
+
14797
+ console.log('delete review clicked')
14798
+
14799
+ var clickEvent = new MouseEvent("click", {
14800
+ "view": window,
14801
+ "bubbles": true,
14802
+ "cancelable": false
14803
+ });
14804
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)!.dispatchEvent(clickEvent);
14805
+
14806
+ });
14807
+ (this._SfDetailContainer as HTMLDivElement).querySelector('#button-auto-approve')?.addEventListener('click', async () => {
14808
+ if (this.selectedItemIds.length === 0) {
14809
+ console.log('audto approve single')
14810
+ } else {
14811
+ console.log('auto approve bulk')
14812
+ }
14813
+ //console.log('deleted', resultDelete);
14814
+ if (this.getCurrentTab() == this.TAB_CUSTOM) {
14815
+ this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
14816
+ } else {
14817
+ // if(currentColumnButton != null) {
14818
+ // currentColumnButton.click();
14819
+ // }
14820
+ }
14821
+
14822
+ var clickEvent = new MouseEvent("click", {
14823
+ "view": window,
14824
+ "bubbles": true,
14825
+ "cancelable": false
14826
+ });
14827
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)!.dispatchEvent(clickEvent);
14828
+
14829
+ });
14830
+
14831
+ if (this.mode == "consumer" || this.mode == "next") {
14832
+
14833
+ (this._SfDetailContainer as HTMLDivElement).querySelector('#button-uploader-submit-approve')?.addEventListener('click', async (ev: any) => {
14834
+ let buttonClick = ev.target as HTMLButtonElement
14835
+ buttonClick.innerHTML = "Saving..."
14836
+ const comments = ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approver-comments') as HTMLInputElement).value;
14837
+ const approved = ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-yes') as HTMLInputElement).checked;
14838
+ let currStatus = this.getCompletenessStatus(listEvent);
14839
+ let newEvent = { ...listEvent };
14840
+ newEvent.comments = comments;
14841
+ newEvent.approved = approved;
14842
+ let newStatus = this.getCompletenessStatus(newEvent);
14843
+ if (currStatus == newStatus) {
14844
+ buttonClick.innerHTML = "Save"
14845
+ this.setError(approved ? 'Already Approved!' : 'Already Rejected!');
14846
+ setTimeout(() => {
14847
+ this.clearMessages();
14848
+ }, 3000);
14849
+ return;
14850
+ }
14851
+ let reportformatvalues = ""
14852
+ let reportingReporting = (this._SfDetailContainer as HTMLDivElement).querySelector('#reporting-reporting') as SfIReporting
14853
+ console.log('renew reporting', reportingReporting)
14854
+ if (reportingReporting != null) {
14855
+ reportformatvalues = JSON.stringify(reportingReporting!.selectedValues()) ?? "";
14856
+ }
14857
+ var clickEvent = new MouseEvent("click", {
14858
+ "view": window,
14859
+ "bubbles": true,
14860
+ "cancelable": false
14861
+ });
14862
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)!.dispatchEvent(clickEvent);
14863
+
14864
+ // await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], comments, approved)
14865
+ let flagBulk = false;
14866
+ if (this.selectedItemIds.length <= 1) {
14867
+ console.log('mmddyyyy', mmddyyyy)
14868
+ if (await this.uploadReview(entityId, locationId, mmddyyyy, listEvent["id"], comments, approved, listEvent.module ?? "events")) {
14869
+ if (approved) {
14870
+ await this.renewLicense(listEvent, reportformatvalues);
14871
+ } else {
14872
+ console.log('renew reporting', reportformatvalues)
14873
+ }
14874
+ for (var p = 0; p < this.events[mmdd].length; p++) {
14875
+ if (this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
14876
+ this.events[mmdd][p].approved = approved
14877
+ this.events[mmdd][p].terminated = (JSON.parse(reportformatvalues).terminated) ?? false
14878
+ this.events[mmdd][p].comments.push({ 'author': 'Approver', 'comment': comments + ` (Approved: ${approved ? 'Yes' : 'No'})`, 'timestamp': new Date().toString() })
14879
+ this.events[mmdd][p].lastupdated = new Date().toString()
14880
+ }
14881
+ }
14882
+ if (this.recentlyReported[mmdd] == null) {
14883
+ this.recentlyReported[mmdd] = []
14884
+ }
14885
+ this.recentlyReported[mmdd].push(listEvent)
14886
+ console.log('review single')
14887
+ }
14888
+ } else {
14889
+ let bulkBodyReview = []
14890
+ for (var k = 0; k < this.selectedItemIds.length; k++) {
14891
+
14892
+ const selectedId = this.selectedItemIds[k];
14893
+ //console.log('selectedid', selectedId);
14894
+ entityId = selectedId.split('-')[7].replace(/_/g, '-');
14895
+ locationId = selectedId.split('-')[8].replace(/_/g, '-');
14896
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
14897
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
14898
+
14899
+ //console.log(entityId, locationId, eventId, mmddyyyy);
14900
+ bulkBodyReview.push({
14901
+ "mmddyyyy": mmddyyyy,
14902
+ "projectid": this.projectId,
14903
+ "type": "review",
14904
+ "eventid": eventId,
14905
+ "comments": comments,
14906
+ "approved": approved,
14907
+ "entityid": entityId,
14908
+ "locationid": locationId,
14909
+ "username": this.userName,
14910
+ "userid": this.userProfileId,
14911
+ "userrole": this.myRole,
14912
+ "year": this.calendarStartYYYY,
14913
+ "module": listEvent.module ?? "events"
14914
+ })
14915
+ // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, comments, approved)
14916
+
14917
+ // this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
14918
+ // await this.sleep(2000);
14919
+ // this.clearMessages();
14920
+
14921
+ }
14922
+ await this.uploadReviewsBulk(bulkBodyReview);
14923
+
14924
+ for (var k = 0; k < this.selectedItemIds.length; k++) {
14925
+
14926
+ const selectedId = this.selectedItemIds[k];
14927
+ //console.log('selectedid', selectedId);
14928
+ entityId = selectedId.split('-')[7].replace(/_/g, '-');
14929
+ locationId = selectedId.split('-')[8].replace(/_/g, '-');
14930
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
14931
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
14932
+ let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
14933
+ for (var p = 0; p < this.events[mmdd].length; p++) {
14934
+ if (this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
14935
+
14936
+ this.events[mmdd][p].isbulk = true
14937
+ flagBulk = true;
14938
+ if (this.recentlyReported[mmdd] == null) {
14939
+ this.recentlyReported[mmdd] = []
14940
+ }
14941
+ this.recentlyReported[mmdd].push(this.events[mmdd][p])
14942
+ }
14943
+ }
14944
+ }
14945
+ console.log('review bulk')
14946
+ }
14947
+
14948
+ if (this.mode == "next") {
14949
+ // this.fetchNext(this.nextPage)
14950
+ this.renderRoleTabsNext(this.nextPage)
14951
+ } else {
14952
+ // if(this.getCurrentTab() == this.TAB_CUSTOM) {
14953
+ // this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
14954
+ // } else
14955
+ if (this.getCurrentTab() == this.TAB_FIND) {
14956
+ const searchString = ((this._SfFindContainer as HTMLDivElement).querySelector('#stream-search') as HTMLInputElement).value;
14957
+ this.processFindSelection((this._SfFindContainer as HTMLDivElement), searchString);
14958
+ } else {
14959
+ if (this.selectedItemIds.length > 0) {
14960
+ await this.fetchBulkReportingData();
14961
+ }
14962
+ this.renderAppropriateStream(this.sdate, this.edate, true, flagBulk);
14963
+ var clickEvent = new MouseEvent("click", {
14964
+ "view": window,
14965
+ "bubbles": true,
14966
+ "cancelable": false
14967
+ });
14968
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)?.dispatchEvent(clickEvent);
14969
+
14970
+ // if(currentColumnButton != null) {
14971
+ // currentColumnButton.click();
14972
+ // }
14973
+ }
14974
+ }
14975
+
14976
+ });
14977
+
14978
+ (this._SfDetailContainer as HTMLDivElement).querySelector('#button-uploader-submit-audit')?.addEventListener('click', async (ev: any) => {
14979
+ let buttonClick = ev.target as HTMLButtonElement
14980
+ buttonClick.innerHTML = "Saving..."
14981
+ const comments = ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-auditor-comments') as HTMLInputElement).value;
14982
+ const approved = ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-yes') as HTMLInputElement).checked;
14983
+ let currStatus = this.getCompletenessStatus(listEvent);
14984
+ let newEvent = { ...listEvent };
14985
+ newEvent.comments = comments;
14986
+ newEvent.approved = approved;
14987
+ let newStatus = this.getCompletenessStatus(newEvent);
14988
+ if (currStatus == newStatus) {
14989
+ buttonClick.innerHTML = "Save"
14990
+ this.setError(approved ? 'Already Approved!' : 'Already Rejected!');
14991
+ setTimeout(() => {
14992
+ this.clearMessages();
14993
+ }, 3000);
14994
+ return;
14995
+ }
14996
+ if (comments.trim().length === 0) {
14997
+ buttonClick.innerHTML = "Save"
14998
+ this.setError('Comments cannot be blank!');
14999
+ setTimeout(() => {
15000
+ this.clearMessages();
15001
+ }, 3000);
15002
+
15003
+ } else {
15004
+ let flagBulk = false;
15005
+ if (this.selectedItemIds.length <= 1) {
15006
+
15007
+ if (await this.uploadAudit(entityId, locationId, mmddyyyy, listEvent["id"], comments, approved, listEvent.module ?? "events")) {
15008
+ for (var p = 0; p < this.events[mmdd].length; p++) {
15009
+ if (this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
15010
+ this.events[mmdd][p].approved = approved
15011
+ this.events[mmdd][p].comments.push({ 'author': 'Auditor', 'comment': comments + ` (Approved: ${approved ? 'Yes' : 'No'})`, 'timestamp': new Date().toString() })
15012
+ this.events[mmdd][p].lastupdated = new Date().toString()
15013
+ }
15014
+ }
15015
+ if (this.recentlyReported[mmdd] == null) {
15016
+ this.recentlyReported[mmdd] = []
15017
+ }
15018
+ this.recentlyReported[mmdd].push(listEvent)
15019
+ }
15020
+ console.log('uploadaudit single')
15021
+ } else {
15022
+ let bulkBodyAudit = []
15023
+ for (var k = 0; k < this.selectedItemIds.length; k++) {
15024
+
15025
+ const selectedId = this.selectedItemIds[k];
15026
+ //console.log('selectedid', selectedId);
15027
+
15028
+ entityId = selectedId.split('-')[7].replace(/_/g, '-');
15029
+ locationId = selectedId.split('-')[8].replace(/_/g, '-');
15030
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
15031
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
15032
+
15033
+ //console.log(entityId, locationId, eventId, mmddyyyy);
15034
+ bulkBodyAudit.push({
15035
+ "mmddyyyy": mmddyyyy,
15036
+ "projectid": this.projectId,
15037
+ "type": "audit",
15038
+ "eventid": eventId,
15039
+ "comments": comments,
15040
+ "approved": approved,
15041
+ "entityid": entityId,
15042
+ "locationid": locationId,
15043
+ "username": this.userName,
15044
+ "userid": this.userProfileId,
15045
+ "userrole": this.myRole,
15046
+ "year": this.calendarStartYYYY,
15047
+ "module": listEvent.module ?? "events"
15048
+ })
15049
+ // await this.uploadAudit(entityId, locationId, mmddyyyy, eventId, comments, approved);
15050
+
15051
+ }
15052
+
15053
+ await this.uploadAuditsBulk(bulkBodyAudit);
15054
+ for (var k = 0; k < this.selectedItemIds.length; k++) {
15055
+
15056
+ const selectedId = this.selectedItemIds[k];
15057
+ //console.log('selectedid', selectedId);
15058
+ let entityId = selectedId.split('-')[7].replace(/_/g, '-');
15059
+ let locationId = selectedId.split('-')[8].replace(/_/g, '-');
15060
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
15061
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
15062
+ let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
15063
+ for (var p = 0; p < this.events[mmdd].length; p++) {
15064
+ if (this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
15065
+
15066
+ this.events[mmdd][p].isbulk = true
15067
+ flagBulk = true;
15068
+ if (this.recentlyReported[mmdd] == null) {
15069
+ this.recentlyReported[mmdd] = []
15070
+ }
15071
+ this.recentlyReported[mmdd].push(this.events[mmdd][p])
15072
+ }
15073
+ }
15074
+ }
15075
+
15076
+ console.log('uploadAudit bulk')
15077
+
15078
+ }
15079
+
15080
+ var clickEvent = new MouseEvent("click", {
15081
+ "view": window,
15082
+ "bubbles": true,
15083
+ "cancelable": false
15084
+ });
15085
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)!.dispatchEvent(clickEvent);
15086
+ if (this.mode == "next") {
15087
+ this.fetchNext(this.nextPage, this.nextTabRole, this.nextTabStatus)
15088
+ } else {
15089
+ // if(this.getCurrentTab() == this.TAB_CUSTOM) {
15090
+ // this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
15091
+ // } else
15092
+ if (this.getCurrentTab() == this.TAB_FIND) {
15093
+ const searchString = ((this._SfFindContainer as HTMLDivElement).querySelector('#stream-search') as HTMLInputElement).value;
15094
+ this.processFindSelection((this._SfFindContainer as HTMLDivElement), searchString);
15095
+ } else {
15096
+ if (this.selectedItemIds.length > 0) {
15097
+ await this.fetchBulkReportingData();
15098
+ }
15099
+ this.renderAppropriateStream(this.sdate, this.edate, true, flagBulk);
15100
+ // if(currentColumnButton != null) {
15101
+ // currentColumnButton.click();
15102
+ // }
15103
+ }
15104
+ }
15105
+
15106
+ }
15107
+
15108
+
15109
+
15110
+ });
15111
+
15112
+ if (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_FUNCTION_HEAD) {
15113
+
15114
+ if (approved) {
15115
+
15116
+ if (((this._SfDetailContainer as HTMLDivElement).querySelector('#button-uploader-submit-report') as HTMLElement) != null) {
15117
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#button-uploader-submit-report') as HTMLElement).style.visibility = 'hidden';
15118
+ }
15119
+
15120
+
15121
+ } else {
15122
+
15123
+ if (((this._SfDetailContainer as HTMLDivElement).querySelector('#button-uploader-submit-report') as HTMLElement) != null) {
15124
+
15125
+
15126
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#button-uploader-submit-report') as HTMLElement).style.visibility = 'visible';
15127
+
15128
+ (this._SfDetailContainer as HTMLDivElement).querySelector('#button-uploader-submit-report')?.addEventListener('click', async (ev: any) => {
15129
+ let buttonClick = ev.target as HTMLButtonElement
15130
+ buttonClick.innerHTML = "Saving..."
15131
+ const reportercomments = ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-reporter-comments') as HTMLInputElement).value;
15132
+
15133
+ //console.log('reporter comments 1', reportercomments);
15134
+
15135
+ // const reporterdoc = ((((this._SfDetailContainer as HTMLDivElement).querySelector('#input-reporter-doc') as HTMLInputElement) != null) && ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-reporter-doc') as HTMLInputElement).value.length > 0) ? (new Date(((this._SfDetailContainer as HTMLDivElement).querySelector('#input-reporter-doc') as HTMLInputElement).value).getTime() + "") : "";
15136
+ const reporterdoc = new Date().getTime() + "";
15137
+ let docs: any[] = [];
15138
+
15139
+ //console.log('reporter comments 2', reportercomments);
15140
+
15141
+ // if(docsOptional.length === 0) {
15142
+ // docs = (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.selectedValues();
15143
+ // }
15144
+
15145
+ //console.log('docs', docs);
15146
+ let reportformatvalues: string = "";
15147
+ let reportformatschema: string = "";
15148
+ if (listEvent.customreporting != null) {
15149
+ let reportingReporting = (this._SfDetailContainer as HTMLDivElement).querySelector('#reporting-reporting') as SfIReporting
15150
+ console.log('reportformatvalues', JSON.stringify(reportingReporting.selectedValues()))
15151
+ reportformatvalues = JSON.stringify(reportingReporting!.selectedValues()) ?? "";
15152
+ reportformatschema = reportingReporting!.configjson ?? "";
15153
+ }
15154
+
15155
+ let percentage: string = "100";
15156
+ if (((this._SfDetailContainer as HTMLDivElement).querySelector('#input-reporter-percentage') as HTMLInputElement) != null) {
15157
+ percentage = ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-reporter-percentage') as HTMLInputElement).value
15158
+ }
15159
+ // if (Number.isNaN(parseInt(percentage)) || parseInt(percentage) < 0 || parseInt(percentage) > 100) {
15160
+
15161
+ // //console.log('reporter comments 3', reportercomments);
15162
+ // buttonClick.innerHTML = "Save"
15163
+ // this.setError('Invalid Percentage!');
15164
+ // setTimeout(() => {
15165
+ // this.clearMessages();
15166
+ // }, 3000);
15167
+
15168
+ // } else {
15169
+ // if (docs.length === 0 && docsOptional.length === 0) {
15170
+
15171
+ // //console.log('reporter comments 3', reportercomments);
15172
+ // buttonClick.innerHTML = "Save"
15173
+ // this.setError('No documents uploaded!');
15174
+ // setTimeout(() => {
15175
+ // this.clearMessages();
15176
+ // }, 3000);
15177
+
15178
+ // } else {
15179
+
15180
+ // //console.log('reporterdoc', reporterdoc);
15181
+
15182
+ // if (reporterdoc.length === 0) {
15183
+ // buttonClick.innerHTML = "Save"
15184
+ // this.setError('Date of completion not selected!');
15185
+ // setTimeout(() => {
15186
+ // this.clearMessages();
15187
+ // }, 3000);
15188
+
15189
+ // } else if (parseInt(reporterdoc) > new Date().getTime()) {
15190
+ // buttonClick.innerHTML = "Save"
15191
+ // this.setError('Date of completion cannot be in future!');
15192
+ // setTimeout(() => {
15193
+ // this.clearMessages();
15194
+ // }, 3000);
15195
+
15196
+ // } else {
15197
+
15198
+ //console.log('makerscheckers 1', reportercomments);
15199
+
15200
+ if (reportercomments.trim().length === 0) {
15201
+ buttonClick.innerHTML = "Save"
15202
+ this.setError('Comments cannot be blank!');
15203
+ setTimeout(() => {
15204
+ this.clearMessages();
15205
+ }, 3000);
15206
+
15207
+ } else {
15208
+
15209
+
15210
+ var clickEvent = new MouseEvent("click", {
15211
+ "view": window,
15212
+ "bubbles": true,
15213
+ "cancelable": false
15214
+ });
15215
+
15216
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)!.dispatchEvent(clickEvent);
15217
+ let flagBulk = false;
15218
+ if (this.selectedItemIds.length <= 1) {
15219
+
15220
+ if (await this.uploadReport(entityId, locationId, mmddyyyy, listEvent["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, listEvent.module, percentage, makercheckers)) {
15221
+ console.log('this.events', this.events);
15222
+ for (var p = 0; p < this.events[mmdd].length; p++) {
15223
+ if (this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
15224
+ this.events[mmdd][p].documents = docs
15225
+ this.events[mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() })
15226
+ this.events[mmdd][p].lastupdated = new Date().toString()
15227
+ }
15228
+ }
15229
+ console.log('uploadReport single')
15230
+ if (makercheckers.length > 0) {
15231
+
15232
+ // await this.uploadReview(entityId, locationId, mmddyyyy, listEvent["id"], "Auto approved", true, "notices");
15233
+ for (var p = 0; p < this.events[mmdd].length; p++) {
15234
+ if (this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
15235
+ this.events[mmdd][p].approved = true
15236
+ this.events[mmdd][p].terminated = (JSON.parse(reportformatvalues).terminated) ?? false
15237
+ // this.events[mmdd][p].documents = docs
15238
+ this.events[mmdd][p].comments.push({ 'author': 'Approver', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString() })
15239
+ this.events[mmdd][p].lastupdated = new Date().toString()
15240
+ }
15241
+ }
15242
+ await this.renewLicense(listEvent, reportformatvalues);
15243
+ console.log('upload report auto approve single')
15244
+ }
15245
+ if (this.recentlyReported[mmdd] == null) {
15246
+ this.recentlyReported[mmdd] = []
15247
+ }
15248
+ this.recentlyReported[mmdd].push(listEvent)
15249
+ }
15250
+ } else {
15251
+ let bulkBody = []
15252
+ let bulkBodyReview = []
15253
+ for (var k = 0; k < this.selectedItemIds.length; k++) {
15254
+
15255
+ const selectedId = this.selectedItemIds[k];
15256
+ //console.log('selectedid', selectedId);
15257
+
15258
+ const makercheckersL = selectedId.split('-')[5];
15259
+ entityId = selectedId.split('-')[7].replace(/_/g, '-');
15260
+ locationId = selectedId.split('-')[8].replace(/_/g, '-');
15261
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
15262
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
15263
+
15264
+ //console.log(entityId, locationId, eventId, mmddyyyy);
15265
+
15266
+ // await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null)
15267
+ // if(parseInt(makercheckersL) > 0) {
15268
+ // bulkBodyReview.push({
15269
+ // "mmddyyyy": mmddyyyy,
15270
+ // "projectid": this.projectId,
15271
+ // "type": "report",
15272
+ // "eventid": eventId,
15273
+ // "comments": reportercomments,
15274
+ // "dateofcompletion": reporterdoc,
15275
+ // "percentage": percentage,
15276
+ // "entityid": entityId,
15277
+ // "locationid": locationId,
15278
+ // "event": null,
15279
+ // "docs": JSON.stringify(docs),
15280
+ // "approved": true,
15281
+ // "username": this.userName,
15282
+ // "reportformatvalues": reportformatvalues,
15283
+ // "reportformatschema": reportformatschema,
15284
+ // "userid": this.userProfileId,
15285
+ // "userrole": this.myRole,
15286
+ // "year": this.calendarStartYYYY,
15287
+ // "module": listEvent.module ?? "events"
15288
+ // } )
15289
+ // // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, "Auto approved", true);
15290
+
15291
+ // }else{
15292
+ bulkBody.push({
15293
+ "mmddyyyy": mmddyyyy,
15294
+ "projectid": this.projectId,
15295
+ "type": "report",
15296
+ "eventid": eventId,
15297
+ "comments": reportercomments,
15298
+ "dateofcompletion": reporterdoc,
15299
+ "percentage": percentage,
15300
+ "entityid": entityId,
15301
+ "locationid": locationId,
15302
+ "event": null,
15303
+ "docs": JSON.stringify(docs),
15304
+ "username": this.userName,
15305
+ "reportformatvalues": reportformatvalues,
15306
+ "reportformatschema": reportformatschema,
15307
+ "userid": this.userProfileId,
15308
+ "userrole": this.myRole,
15309
+ "year": this.calendarStartYYYY,
15310
+ "module": listEvent.module ?? "events",
15311
+ "makercheckers": (parseInt(makercheckersL) > 0) ? ["makercheckers"] : null
15312
+ })
15313
+ // }
15314
+
15315
+ // this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
15316
+ // await this.sleep(2000);
15317
+ // this.clearMessages();
15318
+
15319
+ }
15320
+
15321
+ // await this.uploadReportsBulk(bulkBody);
15322
+ // await this.fetchBulkReportingData();
15323
+ if (bulkBody.length > 0) {
15324
+ await this.uploadReportsBulk(bulkBody, bulkBodyReview.length == 0);
15325
+ }
15326
+
15327
+ // if(bulkBodyReview.length > 0){
15328
+ // await this.uploadReportsReviewsBulk(bulkBodyReview)
15329
+ // }
15330
+ await this.fetchBulkReportingData();
15331
+ console.log('uploadReport bulk')
15332
+ for (var k = 0; k < this.selectedItemIds.length; k++) {
15333
+
15334
+ const selectedId = this.selectedItemIds[k];
15335
+ //console.log('selectedid', selectedId);
15336
+ let entityId = selectedId.split('-')[7].replace(/_/g, '-');
15337
+ let locationId = selectedId.split('-')[8].replace(/_/g, '-');
15338
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
15339
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
15340
+ let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
15341
+ for (var p = 0; p < this.events[mmdd].length; p++) {
15342
+ if (this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
15343
+
15344
+ this.events[mmdd][p].isbulk = true
15345
+ flagBulk = true;
15346
+ if (this.recentlyReported[mmdd] == null) {
15347
+ this.recentlyReported[mmdd] = []
15348
+ }
15349
+ this.recentlyReported[mmdd].push(this.events[mmdd][p])
15350
+ }
15351
+ }
15352
+ }
15353
+
15354
+ }
15355
+
15356
+ if (this.mode == "next") {
15357
+ this.fetchNext(this.nextPage, this.nextTabRole, this.nextTabStatus)
15358
+ } else {
15359
+ // if(this.getCurrentTab() == this.TAB_CUSTOM) {
15360
+ // this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
15361
+ // } else
15362
+ if (this.getCurrentTab() == this.TAB_FIND) {
15363
+ const searchString = ((this._SfFindContainer as HTMLDivElement).querySelector('#stream-search') as HTMLInputElement).value;
15364
+ this.processFindSelection((this._SfFindContainer as HTMLDivElement), searchString);
15365
+ } else {
15366
+ if (this.selectedItemIds.length > 0) {
15367
+ await this.fetchBulkReportingData();
15368
+ }
15369
+ this.renderAppropriateStream(this.sdate, this.edate, true, flagBulk)
15370
+ // if(currentColumnButton != null) {
15371
+ // currentColumnButton.click();
15372
+ // }
15373
+ }
15374
+ }
15375
+
15376
+ }
15377
+
15378
+
15379
+ // }
15380
+ // }
15381
+ // }
15382
+ });
15383
+
15384
+ }
15385
+
15386
+ }
15387
+
15388
+ }
15389
+
15390
+ if (this._SfUploader[0] != null) {
15391
+ (this._SfDetailContainer.querySelector('.uploader-analysis-message') as HTMLDivElement).style.display = "none"
15392
+ this._SfUploader[0].querySelector('#uploader').addEventListener('analysisInProgress', (_ev: any) => {
15393
+ console.log('uploader analysisInProgress', _ev);
15394
+ (this._SfDetailContainer.querySelector('.uploader-analysis-message') as HTMLDivElement).style.display = "block"
15395
+ });
15396
+ this._SfUploader[0].querySelector('#uploader').addEventListener('analysisCompleted', (_ev: any) => {
15397
+ console.log('uploader analysisInProgress', _ev);
15398
+ (this._SfDetailContainer.querySelector('.uploader-analysis-message') as HTMLDivElement).style.display = "none"
15399
+ });
15400
+
15401
+
15402
+ //console.log('documentType checking', documentType);
15403
+
15404
+ if (documentType != null) {
15405
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.docType = documentType;
15406
+ }
15407
+
15408
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.prepopulatedInputArr = JSON.stringify([]);
15409
+ console.log('uploader', (this._SfUploader[0].querySelector('#uploader') as SfIUploader));
15410
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.loadMode();
15411
+
15412
+ if (docs.length > 0) {
15413
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.prepopulatedInputArr = JSON.stringify(docs);
15414
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.loadMode();
15415
+ }
15416
+
15417
+ if (this.myRole == this.TAB_APPROVER || approved) {
15418
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.readOnly = true;
15419
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.loadMode();
15420
+ } else {
15421
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.readOnly = false;
15422
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.loadMode();
15423
+ }
15424
+
15425
+ const dataPassthrough = {
15426
+ projectId: this.projectId,
15427
+ countryId: this.countryId,
15428
+ entityId: listEvent.entityid,
15429
+ locationId: listEvent.locationid,
15430
+ mmddyyyy: mmddyyyy,
15431
+ complianceId: listEvent['id'],
15432
+ path: "uploadextract"
15433
+ };
15434
+
15435
+ const callbackUrlHost = "8icpy39ru0.execute-api.us-east-1.amazonaws.com";
15436
+ const callbackUrlPath = "test/uploadextract";
15437
+
15438
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.projectId = this.projectId;
15439
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.dataPassthrough = JSON.stringify(dataPassthrough);
15440
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.callbackUrlHost = callbackUrlHost;
15441
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.callbackUrlPath = callbackUrlPath;
15442
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.loadMode();
15443
+
15444
+ }
15445
+
15446
+
15447
+
15448
+ //console.log('approved 1', event["approved"], this.myRole, this.TAB_APPROVER);
15449
+ if (this.myRole == this.TAB_APPROVER || this.myRole == this.TAB_VIEWER || this.myRole == this.TAB_AUDITOR || this.myRole == this.TAB_FUNCTION_HEAD) {
15450
+ //console.log('approved 1', event["approved"], this.myRole, this.TAB_APPROVER);
15451
+ if (listEvent["approved"] != null) {
15452
+ if (listEvent["approved"] === true) {
15453
+ //console.log('approved 2', event["approved"], this.myRole, this.TAB_APPROVER);
15454
+ if (((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-yes') as HTMLInputElement) != null) {
15455
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-yes') as HTMLInputElement).checked = true;
15456
+ }
15457
+ if (((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-no') as HTMLInputElement) != null) {
15458
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-no') as HTMLInputElement).checked = false;
15459
+ }
15460
+ } else {
15461
+ if (((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-yes') as HTMLInputElement) != null) {
15462
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-yes') as HTMLInputElement)!.checked = false;
15463
+ }
15464
+ if (((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-no') as HTMLInputElement) != null) {
15465
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-no') as HTMLInputElement)!.checked = true;
15466
+ }
15467
+ }
15468
+ } else {
15469
+ if ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-yes') as HTMLInputElement != null) {
15470
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-yes') as HTMLInputElement).checked = false;
15471
+ }
15472
+ if (((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-no') as HTMLInputElement) != null) {
15473
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-no') as HTMLInputElement).checked = true;
15474
+ }
15475
+
15476
+ }
15477
+ }
15478
+
15479
+ }
15480
+ }
15481
+
15482
+ fetchEventDetails = async (listEvent: any, mmddyyyy: any, currentColumnButton: HTMLButtonElement | null, eventsContainer: HTMLDivElement, flagUploadGuidance: boolean = false, listEventContainer: HTMLDivElement | null = null) => {
15483
+ console.log('listEvent', listEvent, listEvent.id)
15484
+ let url = "https://" + this.apiId + "/getalleventdetails";
15485
+
15486
+ //console.log('fetch calendar url', url);
15487
+ let urlBody: any = { "projectid": this.projectId, "userprofileid": this.userProfileId, "role": this.myRole, "eventid": listEvent.id, "entityid": listEvent.entityid, "locationid": listEvent.locationid, "mmddyyyy": mmddyyyy, "year": this.getFinancialYear(mmddyyyy) };
15488
+
15489
+ //console.log('urlbody', urlBody);
15490
+
15491
+ const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
15492
+ const xhr: any = (await this.prepareXhr(urlBody, url, this._SfLoader, authorization, 'Preparing')) as any;
15493
+ this._SfLoader.innerHTML = '';
15494
+ if (xhr.status == 200) {
15495
+
15496
+ const jsonRespose = JSON.parse(xhr.responseText);
15497
+ console.log('jsonRespose', jsonRespose);
15498
+ if (flagUploadGuidance) {
15499
+ if (listEventContainer != null) {
15500
+ let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
15501
+ if (this.events[mmdd] != null) {
15502
+ for (var p = 0; p < this.events[mmdd].length; p++) {
15503
+ if (this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == listEvent.locationid && this.events[mmdd][p].entityid == listEvent.entityid) {
15504
+ this.events[mmdd][p].uploadguidance = jsonRespose.data.uploadguidance
15505
+ }
15506
+ }
15507
+ }
15508
+ this.renderListReporting(listEventContainer, jsonRespose.data, mmddyyyy, eventsContainer)
15509
+ }
15510
+ } else {
15511
+ this.renderEventDetail(jsonRespose.data, mmddyyyy, currentColumnButton, eventsContainer);
15512
+ }
15513
+
15514
+ } else {
15515
+ if (xhr.status == 401) {
15516
+ let changeEvent = new CustomEvent('tokenExpired', { bubbles: true });
15517
+ this.dispatchEvent(changeEvent);
15518
+ }
15519
+ if (xhr.status === 404) {
15520
+
15521
+ this.showChosenProject();
15522
+ (this._SfTitleChosenProject as HTMLElement).innerHTML = (this._SfProject[0].querySelector('#sf-i-project') as SfIForm).selectedTexts()[0];
15523
+ this.renderChosenProject();
15524
+
15525
+ } else {
15526
+ const jsonRespose = JSON.parse(xhr.responseText);
15527
+ this.setError(jsonRespose.error);
15528
+ }
15529
+
15530
+ }
15531
+ }
15532
+
15533
+ renderEventDetail = (event: any, mmddyyyy: any, currentColumnButton: HTMLButtonElement | null, eventsContainer: HTMLDivElement) => {
15534
+ console.log('event details', event, mmddyyyy, currentColumnButton == null ? "null currentColumnButton" : currentColumnButton.id);
15535
+
15536
+ let comments, docs, approved, /*dateOfCompletion,*/ makercheckers: Array<string>, docsOptional, documentType;
15537
+ let entityId: string = "";
15538
+ let locationId: string = "";
15539
+ let statuteName: string = "";
15540
+ let reportformatName: string = "";
15541
+ let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
15542
+ entityId = event.entityid;
15543
+ locationId = event.locationid;
15544
+ // let completeness = this.getCompletenessStatus(event);
15545
+ comments = event['comments'] == null ? [] : (event['comments']);
15546
+ docs = event['documents'] == null ? [] : event['documents'] == null ? [] : (event['documents']);
15547
+ approved = event['approved'] == null ? false : event['approved'] == null ? false : event['approved'];
15548
+ // dateOfCompletion = event['dateofcompletion'] == null ? '' : event['dateofcompletion'] == null ? '' : event['dateofcompletion'];
15549
+ makercheckers = event['makercheckers'] == null ? [] : event['makercheckers'] == null ? [] : event['makercheckers'];
15550
+ docsOptional = event['docs'] == null ? [] : event['docs'] == null ? [] : event['docs'];
15551
+ documentType = event['documenttype'] == null ? null : event['documenttype'][0] == null ? null : event['documenttype'][0].split(" ")[0];
15552
+
15553
+ statuteName = event['statute'][0].trim();
15554
+ if (event['reportformat'] != null) {
15555
+ reportformatName = (event['reportformat'][0] ?? "").trim().replace('&amp;', '&');
15556
+ }
15557
+
15558
+ console.log('event detail', event, statuteName);
15559
+ //console.log('event detail comments', comments);
15560
+ //console.log('event dateofcompletion', dateOfCompletion);
15561
+ //console.log('event detail documenttype', documentType);
15562
+ const basicFields = ['id', 'shortid', 'entityname', 'locationname', 'functions'];
15563
+ const statuteFields = ['jurisdiction', 'country', 'state', 'category', 'subcategory', 'statute'];
15564
+ const complianceFields = ['specificity', 'reference', 'obligation', 'penalty', 'authority', 'frequency', 'subfrequency', 'obligationtype', 'duedate', 'applicability', 'form', 'additionalurls', 'adhocquestion', 'adhocquestionschedule', 'adhocinstances', 'uploadguidance', 'attachment'];
15565
+ const grcFields = ['internalcontrols', 'firstlineofdefence', 'secondlineofdefence', 'thirdlineofdefence', 'risk', 'riskarea'];
15566
+
15567
+ let listReportingContainers = eventsContainer.querySelectorAll('.list-reporting-container') as NodeListOf<HTMLDivElement>
15568
+ for (let tempReportingContainer of listReportingContainers) {
15569
+ tempReportingContainer.style.display = 'none';
15570
+ tempReportingContainer.innerHTML = '';
15571
+ }
15572
+ let buttonListReportings = eventsContainer.querySelectorAll('.button-list-reporting') as NodeListOf<HTMLButtonElement>
15573
+ for (let buttonListReporting of buttonListReportings) {
15574
+ buttonListReporting.setAttribute('part', 'button-list-reporting')
15575
+ }
15576
+ let streamEventTitles = eventsContainer.querySelectorAll('.stream-event-title') as NodeListOf<SfIElasticText>
15577
+ for (let streamEventTitle of streamEventTitles) {
15578
+ streamEventTitle.removeAttribute('part')
15579
+ }
15580
+ var html = `
15581
+
15582
+ <div part="compliance-detail-title" class="d-flex justify-between">
15583
+ <button part="button-icon" class="material-icons invisible">close</button>
15584
+ <h3 part="results-title" class="m-0">Compliance Details</h3>
15585
+ <button id="button-detail-close" part="button-icon" class="material-icons">close</button>
15586
+ </div>
15587
+
15588
+ `;
15589
+
15590
+ if (this.selectedItemIds.length > 1) {
15591
+
15592
+ html += `
15593
+
15594
+ <div class="d-flex justify-between m-20">
15595
+ <h4 class="m-0">${this.selectedItemIds.length - 1} other ` + ((this.selectedItemIds.length - 1) === 1 ? `item` : `items`) + ` also selected</h4>
15596
+ </div>
15597
+
15598
+ `;
15599
+
15600
+ }
15601
+
15602
+ html += '<div class="accordian-container m-20 pb-20" part="accordian-container">';
15603
+
15604
+ html += '<div part="detail-summary">';
15605
+ html += ('<div part="detail-summary-title" class="pl-20 pr-20"><h1>' + event['obligationtitle'] + '</h1></div>');
15606
+ html += ('<div part="detail-summary-subtitle" class="pl-20 pr-20"><h3>' + event['obligation'].replace(/\n/g, '<br />') + '</h3></div>');
15607
+ html += ('<div part="detail-summary-content" class="pl-20 pr-20">' + ('<sf-i-elastic-text text="' + (event['internalcontrols'] + "").replace(/"/g, "").replace(/\n/g, '<br />') + '" minLength="80"></sf-i-elastic-text>') + '</div>');
15608
+ html += '</div>';
15609
+
15610
+ html += '<br />';
15611
+
15612
+ html += '<div class="accordian-section section-basic pl-20 pr-20" part="accordian-section">';
15613
+ html += '<div class="d-flex justify-between accordian-head head-basic cursor" part="accordian-head">';
15614
+ html += '<h3>Basic Information</h3>'
15615
+ html += '<h3 class="head-indicator-basic">-</h3>'
15616
+ html += '</div>';
15617
+ html += '<div class="d-flex flex-wrap accordian-body body-basic" part="accordian-body">';
15618
+
15619
+ for (var i = 0; i < basicFields.length; i++) {
15620
+
15621
+ if (!this.getEventPreviewFields().includes(basicFields[i])) {
15622
+
15623
+ if (!this.getEventHideFields().includes(basicFields[i])) {
15624
+
15625
+ console.log('basicFields', event[basicFields[i]] + "");
15626
+ if ((event[basicFields[i]] + "").indexOf("[") >= 0) {
15627
+ html += '<div class="m-20">';
15628
+ html += '<div part="detail-head"><strong>' + basicFields[i] + '</strong></div>'
15629
+ html += this.getEventTexts(basicFields[i], JSON.parse(event[basicFields[i]]), event).replace(/ *\([^)]*\) */g, "").trim();
15630
+ html += '</div>';
15631
+ } else {
15632
+ html += '<div class="m-20">';
15633
+ html += '<div part="detail-head"><strong>' + basicFields[i] + '</strong></div>'
15634
+ html += '<sf-i-elastic-text text="' + (event[basicFields[i]] + "").replace(/"/g, "").replace(/ *\([^)]*\) */g, "").trim().split(';')[0] + '" minLength="80"></sf-i-elastic-text>';
15635
+ html += '</div>';
15636
+ }
15637
+
15638
+ }
15639
+ }
15640
+
15641
+ }
15642
+
15643
+ if (this.mode == "consumer") {
15644
+ if (approved) {
15645
+ html += '<div class="m-20">';
15646
+ html += '<div part="detail-head"><strong>Approved</strong></div>'
15647
+ html += '<span class="material-icons color-done">check_circle</span>'
15648
+ html += '</div>';
15649
+ }
15650
+ }
15651
+
15652
+ if (docs != null) {
15653
+ html += '<div class="m-20">';
15654
+ html += '<div part="detail-head"><strong>Documents</strong></div>'
15655
+ html += '<span class="material-icons muted">description</span>'
15656
+ html += docs.length
15657
+ html += '</div>';
15658
+ }
15659
+
15660
+ if (comments != null) {
15661
+ html += '<div class="m-20">';
15662
+ html += '<div part="detail-head"><strong>Comments</strong></div>'
15663
+ html += '<span class="material-icons muted">forum</span>'
15664
+ html += comments.length
15665
+ html += '</div>';
15666
+ }
15667
+
15668
+ html += '<div class="m-20">';
15669
+ html += '<div part="detail-head"><strong>Reporters</strong></div>'
15670
+ html += this.getReporterDetailStringFromEvent(event);
15671
+ html += '</div>';
15672
+
15673
+ html += '<div class="m-20">';
15674
+ html += '<div part="detail-head"><strong>Approvers</strong></div>'
15675
+ html += this.getApproverDetailStringFromEvent(event);
15676
+ html += '</div>';
15677
+
15678
+ html += '</div>';
15679
+ html += '</div>';
15680
+
15681
+
15682
+ html += '<div class="accordian-section section-statute pl-20 pr-20" part="accordian-section">';
15683
+ html += '<div class="d-flex justify-between accordian-head head-statute cursor" part="accordian-head">';
15684
+ html += '<h3>Statute Information</h3>'
15685
+ html += '<h3 class="head-indicator-statute">-</h3>'
15686
+ html += '</div>';
15687
+ html += '<div class="d-flex flex-wrap accordian-body body-statute" part="accordian-body">';
14780
15688
 
14781
15689
  for (var i = 0; i < statuteFields.length; i++) {
14782
15690
 
@@ -15249,13 +16157,21 @@ export class SfIEvents extends LitElement {
15249
16157
  } else {
15250
16158
  feedbackMessage.setAttribute('style', 'border:');
15251
16159
  this.uploadTriggerMyEvent(
15252
- event.id + ";" + event.shortid,
16160
+ event.id + " - " + event.shortid,
15253
16161
  feedbackMessage.value,
15254
- event.countries.join(",").replace(/ *\([^)]*\) */g, ""),
15255
- event.entities.join(',').replace(/ *\([^)]*\) */g, ""),
15256
- event.locations.join(',').replace(/ *\([^)]*\) */g, ""),
16162
+ (event.country[0] ?? "").replace(/ *\([^)]*\) */g, ""),
16163
+ (event.entityname ?? "").replace(/ *\([^)]*\) */g, ""),
16164
+ (event.locationname ?? "").replace(/ *\([^)]*\) */g, ""),
15257
16165
  event.statute[0],
15258
16166
  event.subcategory[0]);
16167
+ // this.uploadTriggerMyEvent(
16168
+ // event.id + ";" + event.shortid,
16169
+ // feedbackMessage.value,
16170
+ // event.countries.join(",").replace(/ *\([^)]*\) */g, ""),
16171
+ // event.entities.join(',').replace(/ *\([^)]*\) */g, ""),
16172
+ // event.locations.join(',').replace(/ *\([^)]*\) */g, ""),
16173
+ // event.statute[0],
16174
+ // event.subcategory[0]);
15259
16175
  buttonCancel.click();
15260
16176
  buttonClose.click();
15261
16177
  }
@@ -16080,15 +16996,15 @@ export class SfIEvents extends LitElement {
16080
16996
  // taggingArray.data.mappings.mappings = [];
16081
16997
 
16082
16998
  const tempArray = [];
16083
-
16999
+ console.log('selectedindexchecking 1', this.selectedCbs)
16084
17000
  for (var count = 0; count < sourceArray.data.mappings.mappings.length; count++) {
16085
17001
 
16086
- //console.log('selectedindexchecking', selectedIndex, count, this.selectedCbs.includes(selectedIndex), this.selectedCbs.includes(count));
17002
+ console.log('selectedindexchecking', selectedIndex, count, this.selectedCbs.includes(selectedIndex + ""), this.selectedCbs.includes(count + ""));
16087
17003
  //taggingArray.data.mappings.mappings[count] = sourceArray.data.mappings.mappings[count];
16088
17004
  //taggingArray.data.mappings.mappings.push(sourceArray.data.mappings.mappings[count]);
16089
17005
  tempArray.push(sourceArray.data.mappings.mappings[count]);
16090
17006
  // //console.log('selectedindexchecking', this.selectedCbs, count, this.selectedCbs.includes(selectedIndex), this.selectedCbs.includes(count));
16091
- if (this.selectedCbs.includes(selectedIndex) && this.selectedCbs.includes(count + '')) {
17007
+ if (this.selectedCbs.includes(selectedIndex + '') && this.selectedCbs.includes(count + '')) {
16092
17008
  if (((divElement as HTMLDivElement).querySelector('#tags-' + selectedIndex) as SfIForm).selectedValues != null) {
16093
17009
 
16094
17010
  if (tempArray[count] == null) tempArray[count] = {};
@@ -16730,16 +17646,16 @@ export class SfIEvents extends LitElement {
16730
17646
  var k = 0;
16731
17647
  for (k = 0; k < taggingArray.data.mappings.mappings.length; k++) {
16732
17648
 
16733
- if (taggingArray.data.mappings.mappings[k].id == sourceArray.data.mappings.mappings[i].id) {
16734
- if (taggingArray.data.mappings.mappings[k].id == "62330e24-298d-4ef2-9449-c0e400e37cac") {
17649
+ // if (taggingArray.data.mappings.mappings[k].id == sourceArray.data.mappings.mappings[i].id) {
17650
+ // if (taggingArray.data.mappings.mappings[k].id == "62330e24-298d-4ef2-9449-c0e400e37cac") {
16735
17651
 
16736
- console.log('found', taggingArray.data.mappings.mappings[k]);
16737
- //console.log('before before filtermatch',sourceCols[l],JSON.parse(sourceArray.data.mappings.mappings[0].cols)[j], colCountry, (sourceArray.data.mappings.mappings[i]), (sourceArray.data.mappings.mappings[i].data), colState);
16738
- //console.log('before filtermatch', colCountry, JSON.parse(sourceArray.data.mappings.mappings[i].data)[colCountry], colState, JSON.parse(sourceArray.data.mappings.mappings[i].data)[colState], JSON.parse(sourceArray.data.mappings.mappings[i].data)[colSubcategory]);
17652
+ // console.log('found', taggingArray.data.mappings.mappings[k]);
17653
+ // //console.log('before before filtermatch',sourceCols[l],JSON.parse(sourceArray.data.mappings.mappings[0].cols)[j], colCountry, (sourceArray.data.mappings.mappings[i]), (sourceArray.data.mappings.mappings[i].data), colState);
17654
+ // //console.log('before filtermatch', colCountry, JSON.parse(sourceArray.data.mappings.mappings[i].data)[colCountry], colState, JSON.parse(sourceArray.data.mappings.mappings[i].data)[colState], JSON.parse(sourceArray.data.mappings.mappings[i].data)[colSubcategory]);
16739
17655
 
16740
- }
16741
- break;
16742
- }
17656
+ // }
17657
+ // break;
17658
+ // }
16743
17659
 
16744
17660
  }
16745
17661
 
@@ -17056,12 +17972,12 @@ export class SfIEvents extends LitElement {
17056
17972
  }
17057
17973
 
17058
17974
  // if(taggingArray.data.mappings.mappings[j].id == "62330e24-298d-4ef2-9449-c0e400e37cac" && equal) {
17059
- if (taggingArray.data.mappings.mappings[j].id == "62330e24-298d-4ef2-9449-c0e400e37cac") {
17975
+ // if (taggingArray.data.mappings.mappings[j].id == "62330e24-298d-4ef2-9449-c0e400e37cac") {
17060
17976
 
17061
- // console.log('rendertagging', taggingArray.data.mappings.mappings[j], sourceArray.data.mappings.mappings[i]);
17062
- console.log('rendertagging', taggingArray.data.mappings.mappings[j]);
17977
+ // // console.log('rendertagging', taggingArray.data.mappings.mappings[j], sourceArray.data.mappings.mappings[i]);
17978
+ // console.log('rendertagging', taggingArray.data.mappings.mappings[j]);
17063
17979
 
17064
- }
17980
+ // }
17065
17981
 
17066
17982
 
17067
17983
  if (equal) {
@@ -22713,7 +23629,7 @@ export class SfIEvents extends LitElement {
22713
23629
 
22714
23630
  html += '<button class="tab-button mb-10" id="calendar-tab-month" part="' + (selectedTab == this.TAB_STREAM ? 'calendar-tab-button-selected' : 'calendar-tab-button-not-selected') + '">Month</button>';
22715
23631
  html += '<button class="tab-button mb-10" id="calendar-tab-custom" part="' + (selectedTab == this.TAB_CUSTOM ? 'calendar-tab-button-selected' : 'calendar-tab-button-not-selected') + '">' + (this.myRole == this.TAB_VIEWER ? "Statistics" : "Range") + '</button>';
22716
- if (this.selectedFeatures.indexOf('contracts') < 0) {
23632
+ if (this.selectedFeatures.indexOf('contracts') < 0 && this.selectedFeatures.indexOf('licenses') < 0) {
22717
23633
  html += '<button class="tab-button mb-10" id="calendar-tab-register" part="' + (selectedTab == this.TAB_REGISTERS ? 'calendar-tab-button-selected' : 'calendar-tab-button-not-selected') + '">Registers</button>';
22718
23634
  html += '<button class="tab-button tab-button-secondary mb-10 ' + (selectedTab == this.TAB_FIND ? '' : 'hide') + '" id="calendar-tab-find" part="' + (selectedTab == this.TAB_FIND ? 'calendar-tab-button-selected' : 'calendar-tab-button-not-selected') + '">Search</button>';
22719
23635
  html += '<button class="tab-button tab-button-secondary mb-10 ' + (selectedTab == this.TAB_THIS ? '' : 'hide') + '" id="calendar-tab-this" part="' + (selectedTab == this.TAB_THIS ? 'calendar-tab-button-selected' : 'calendar-tab-button-not-selected') + '">Current</button>';
@@ -23945,7 +24861,7 @@ export class SfIEvents extends LitElement {
23945
24861
  "module": module
23946
24862
  }
23947
24863
  let retValue = true;
23948
- //console.log('uploading review', body);
24864
+ console.log('uploading review', body);
23949
24865
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
23950
24866
  const xhr: any = (await this.prepareXhr(body, url, this._SfLoader, authorization)) as any;
23951
24867
  this._SfLoader.innerHTML = '';
@@ -24053,7 +24969,7 @@ export class SfIEvents extends LitElement {
24053
24969
  "makercheckers": makercheckers
24054
24970
  }
24055
24971
 
24056
- console.log(body);
24972
+ console.log('reportingbody',body);
24057
24973
  let retValue = true;
24058
24974
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
24059
24975
  const xhr: any = (await this.prepareXhr(body, url, this._SfLoader, authorization)) as any;
@@ -25621,7 +26537,9 @@ export class SfIEvents extends LitElement {
25621
26537
  } else if (this.selectedFeatures.indexOf('notices') >= 0) {
25622
26538
  this.fetchAndRenderNotices(startDate, endDate, searchString, list, month, year);
25623
26539
  } else if (this.selectedFeatures.indexOf('contracts') >= 0) {
25624
- this.fetchAndRenderAgreements(startDate, endDate, searchString, list, month, year);
26540
+ this.fetchAndRenderContracts(startDate, endDate, searchString, list, month, year);
26541
+ } else if (this.selectedFeatures.indexOf('licenses') >= 0) {
26542
+ this.fetchAndRenderLicenses(startDate, endDate, searchString, list, month, year);
25625
26543
  }
25626
26544
  }
25627
26545
  fetchAndYearlyRenderUserCalendar_2 = async (startDate: string = "", endDate: string = "", searchString: string = "", list: string = "yes", month: string = "00", year: string = this.calendarStartYYYY) => {
@@ -25843,7 +26761,7 @@ export class SfIEvents extends LitElement {
25843
26761
 
25844
26762
  }
25845
26763
 
25846
- fetchAndRenderAgreements = async (startDate: string = "", endDate: string = "", searchString: string = "", list: string = "yes", month: string = "00", year: string = this.calendarStartYYYY) => {
26764
+ fetchAndRenderContracts = async (startDate: string = "", endDate: string = "", searchString: string = "", list: string = "yes", month: string = "00", year: string = this.calendarStartYYYY) => {
25847
26765
 
25848
26766
  let path = "", view = "";
25849
26767
  this.sdate = startDate;
@@ -25920,6 +26838,84 @@ export class SfIEvents extends LitElement {
25920
26838
 
25921
26839
  }
25922
26840
 
26841
+ }
26842
+ fetchAndRenderLicenses = async (startDate: string = "", endDate: string = "", searchString: string = "", list: string = "yes", month: string = "00", year: string = this.calendarStartYYYY) => {
26843
+
26844
+ let path = "", view = "";
26845
+ this.sdate = startDate;
26846
+ this.edate = endDate;
26847
+ if (this.tagId != null && this.tagId != "") {
26848
+ view = "tag";
26849
+ } else if (this.countryId != null && this.countryId != "") {
26850
+ view = "country";
26851
+ } else if (this.locationId != null && this.locationId != "") {
26852
+ view = "location";
26853
+ } else {
26854
+ view = "entity";
26855
+ }
26856
+
26857
+ path = "getallcountryobjects";
26858
+
26859
+ let sDate = "";
26860
+ let eDate = "";
26861
+
26862
+ //console.log('currenttab', this.getCurrentTab());
26863
+
26864
+ if (this.getCurrentTab() == this.TAB_YEAR) {
26865
+ sDate = "03/31/" + this.calendarStartYYYY;
26866
+ eDate = "04/01/" + (parseInt(this.calendarStartYYYY) + 1);
26867
+ } else {
26868
+ sDate = startDate;
26869
+ eDate = endDate;
26870
+ }
26871
+
26872
+
26873
+ let url = "https://" + this.apiIdLicenses + "/" + path;
26874
+
26875
+ //console.log('fetch calendar url', url);
26876
+ let urlBody: any = { "projectid": this.projectId, "userprofileid": this.userProfileId, "role": this.myRole, "entityid": this.entityId, "countryid": this.countryId, "functionid": this.functionId, "locationid": this.locationId, "tagid": this.tagId, "adhoc": "false", "exclusivestartkey": 0, "sdate": sDate, "edate": eDate, "view": view, "year": year, "list": list, "month": month };
26877
+
26878
+ if (searchString.length > 0) {
26879
+ urlBody["searchstring"] = searchString;
26880
+ }
26881
+
26882
+ //console.log('urlbody', urlBody);
26883
+
26884
+ const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
26885
+ const xhr: any = (await this.prepareXhr(urlBody, url, this._SfLoader, authorization, 'Preparing')) as any;
26886
+ this._SfLoader.innerHTML = '';
26887
+ if (xhr.status == 200) {
26888
+
26889
+ const jsonRespose = JSON.parse(xhr.responseText);
26890
+ console.log('jsonRespose', jsonRespose);
26891
+ let licenses = (await this.fetchPresignedUrl(jsonRespose.signedUrlGet));
26892
+ await this.fetchPresignedUrlDelete(jsonRespose.signedUrlDelete)
26893
+ this.lastupdated = Util.getDateTimeStrings(new Date().getTime())
26894
+ let tempEvents = this.events
26895
+ for (let mmddyyyy of Object.keys(licenses)) {
26896
+ tempEvents[mmddyyyy] = [...(tempEvents[mmddyyyy] ?? []), ...licenses[mmddyyyy]]
26897
+ }
26898
+ this.events = tempEvents;
26899
+ this.renderAppropriateStream(this.sdate, this.edate, true);
26900
+ console.log('licenses', licenses, tempEvents);
26901
+ } else {
26902
+ if (xhr.status == 401) {
26903
+ let changeEvent = new CustomEvent('tokenExpired', { bubbles: true });
26904
+ this.dispatchEvent(changeEvent);
26905
+ }
26906
+ if (xhr.status === 404) {
26907
+
26908
+ this.showChosenProject();
26909
+ (this._SfTitleChosenProject as HTMLElement).innerHTML = (this._SfProject[0].querySelector('#sf-i-project') as SfIForm).selectedTexts()[0];
26910
+ this.renderChosenProject();
26911
+
26912
+ } else {
26913
+ const jsonRespose = JSON.parse(xhr.responseText);
26914
+ this.setError(jsonRespose.error);
26915
+ }
26916
+
26917
+ }
26918
+
25923
26919
  }
25924
26920
 
25925
26921
  fetchStatistics = async (startDate: string = "", endDate: string = "", filtercriteria: string, filterid: string, subfiltercriteria: string, subfilterid: string) => {
@@ -25951,6 +26947,8 @@ export class SfIEvents extends LitElement {
25951
26947
  url = "https://" + this.apiIdNotices + "/" + path;
25952
26948
  } else if (this.selectedFeatures.indexOf('contracts') >= 0) {
25953
26949
  url = "https://" + this.apiIdAgreements + "/" + path;
26950
+ } else if (this.selectedFeatures.indexOf('licenses') >= 0) {
26951
+ url = "https://" + this.apiIdLicenses + "/" + path;
25954
26952
  }
25955
26953
 
25956
26954
  //console.log('fetch calendar url', url);