sf-i-events 1.0.677 → 1.0.679

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sf-i-events",
3
3
  "private": false,
4
- "version": "1.0.677",
4
+ "version": "1.0.679",
5
5
  "description": "Superflows Navigation Component",
6
6
  "main": "sf-i-events.js",
7
7
  "module": "sf-i-events.js",
package/sf-i-events.d.ts CHANGED
@@ -675,8 +675,11 @@ export declare class SfIEvents extends LitElement {
675
675
  uploadTriggerMyEvent: (complianceid: string, message: string, countryname: string, entityname: string, locationname: string, statute: string, subcategory: string) => Promise<void>;
676
676
  uploadTriggerEvent: (triggeredCompliances: any) => Promise<void>;
677
677
  uploadAudit: (entityId: string, locationId: string, mmddyyyy: string, eventid: string, comments: string, approved: any) => Promise<void>;
678
+ uploadAuditsBulk: (bulkBody: any) => Promise<void>;
678
679
  uploadReview: (entityId: string, locationId: string, mmddyyyy: string, eventid: string, comments: string, approved: any) => Promise<void>;
680
+ uploadReviewsBulk: (bulkBody: any) => Promise<void>;
679
681
  uploadReport: (entityId: string, locationId: string, mmddyyyy: string, eventid: string, comments: string, doc: string, docs: any, event: any, reportformatvalues?: string, reportformatschema?: string) => Promise<void>;
682
+ uploadReportsBulk: (bulkBody: any) => Promise<void>;
680
683
  uploadMapping: () => Promise<void>;
681
684
  uploadEvents: () => Promise<void>;
682
685
  uploadReprogramTrigger: (eventid: string, timestamp: string) => Promise<void>;
package/sf-i-events.js CHANGED
@@ -6856,6 +6856,7 @@ let SfIEvents = class SfIEvents extends LitElement {
6856
6856
  await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], comments, approved);
6857
6857
  }
6858
6858
  else {
6859
+ let bulkBodyReview = [];
6859
6860
  for (var k = 0; k < this.selectedItemIds.length; k++) {
6860
6861
  const selectedId = this.selectedItemIds[k];
6861
6862
  //console.log('selectedid', selectedId);
@@ -6864,11 +6865,26 @@ let SfIEvents = class SfIEvents extends LitElement {
6864
6865
  const eventId = selectedId.split('-')[9].replace(/_/g, '-');
6865
6866
  mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
6866
6867
  //console.log(entityId, locationId, eventId, mmddyyyy);
6867
- await this.uploadReview(entityId, locationId, mmddyyyy, eventId, comments, approved);
6868
- this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
6869
- await this.sleep(2000);
6870
- this.clearMessages();
6868
+ bulkBodyReview.push({
6869
+ "mmddyyyy": mmddyyyy,
6870
+ "projectid": this.projectId,
6871
+ "type": "review",
6872
+ "eventid": eventId,
6873
+ "comments": comments,
6874
+ "approved": approved,
6875
+ "entityid": entityId,
6876
+ "locationid": locationId,
6877
+ "username": this.userName,
6878
+ "userid": this.userProfileId,
6879
+ "userrole": this.myRole,
6880
+ "year": this.calendarStartYYYY
6881
+ });
6882
+ // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, comments, approved)
6883
+ // this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
6884
+ // await this.sleep(2000);
6885
+ // this.clearMessages();
6871
6886
  }
6887
+ await this.uploadReviewsBulk(bulkBodyReview);
6872
6888
  }
6873
6889
  if (this.mode == "next") {
6874
6890
  // this.fetchNext(this.nextPage)
@@ -6903,6 +6919,7 @@ let SfIEvents = class SfIEvents extends LitElement {
6903
6919
  await this.uploadAudit(entityId, locationId, mmddyyyy, event["id"], comments, approved);
6904
6920
  }
6905
6921
  else {
6922
+ let bulkBodyAudit = [];
6906
6923
  for (var k = 0; k < this.selectedItemIds.length; k++) {
6907
6924
  const selectedId = this.selectedItemIds[k];
6908
6925
  //console.log('selectedid', selectedId);
@@ -6911,8 +6928,23 @@ let SfIEvents = class SfIEvents extends LitElement {
6911
6928
  const eventId = selectedId.split('-')[9].replace(/_/g, '-');
6912
6929
  mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
6913
6930
  //console.log(entityId, locationId, eventId, mmddyyyy);
6914
- await this.uploadAudit(entityId, locationId, mmddyyyy, eventId, comments, approved);
6931
+ bulkBodyAudit.push({
6932
+ "mmddyyyy": mmddyyyy,
6933
+ "projectid": this.projectId,
6934
+ "type": "audit",
6935
+ "eventid": eventId,
6936
+ "comments": comments,
6937
+ "approved": approved,
6938
+ "entityid": entityId,
6939
+ "locationid": locationId,
6940
+ "username": this.userName,
6941
+ "userid": this.userProfileId,
6942
+ "userrole": this.myRole,
6943
+ "year": this.calendarStartYYYY
6944
+ });
6945
+ // await this.uploadAudit(entityId, locationId, mmddyyyy, eventId, comments, approved);
6915
6946
  }
6947
+ await this.uploadAuditsBulk(bulkBodyAudit);
6916
6948
  }
6917
6949
  var clickEvent = new MouseEvent("click", {
6918
6950
  "view": window,
@@ -7005,6 +7037,8 @@ let SfIEvents = class SfIEvents extends LitElement {
7005
7037
  }
7006
7038
  }
7007
7039
  else {
7040
+ let bulkBody = [];
7041
+ let bulkBodyReview = [];
7008
7042
  for (var k = 0; k < this.selectedItemIds.length; k++) {
7009
7043
  const selectedId = this.selectedItemIds[k];
7010
7044
  //console.log('selectedid', selectedId);
@@ -7014,13 +7048,49 @@ let SfIEvents = class SfIEvents extends LitElement {
7014
7048
  const eventId = selectedId.split('-')[9].replace(/_/g, '-');
7015
7049
  mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
7016
7050
  //console.log(entityId, locationId, eventId, mmddyyyy);
7017
- await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null);
7051
+ bulkBody.push({
7052
+ "mmddyyyy": mmddyyyy,
7053
+ "projectid": this.projectId,
7054
+ "type": "report",
7055
+ "eventid": eventId,
7056
+ "comments": reportercomments,
7057
+ "dateofcompletion": reporterdoc,
7058
+ "entityid": entityId,
7059
+ "locationid": locationId,
7060
+ "event": null,
7061
+ "docs": JSON.stringify(docs),
7062
+ "username": this.userName,
7063
+ "reportformatvalues": reportformatvalues,
7064
+ "reportformatschema": reportformatschema,
7065
+ "userid": this.userProfileId,
7066
+ "userrole": this.myRole,
7067
+ "year": this.calendarStartYYYY
7068
+ });
7069
+ // await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null)
7018
7070
  if (parseInt(makercheckersL) > 0) {
7019
- await this.uploadReview(entityId, locationId, mmddyyyy, eventId, "Auto approved", true);
7071
+ bulkBodyReview.push({
7072
+ "mmddyyyy": mmddyyyy,
7073
+ "projectid": this.projectId,
7074
+ "type": "review",
7075
+ "eventid": eventId,
7076
+ "comments": "Auto approved",
7077
+ "approved": true,
7078
+ "entityid": entityId,
7079
+ "locationid": locationId,
7080
+ "username": this.userName,
7081
+ "userid": this.userProfileId,
7082
+ "userrole": this.myRole,
7083
+ "year": this.calendarStartYYYY
7084
+ });
7085
+ // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, "Auto approved", true);
7020
7086
  }
7021
- this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
7022
- await this.sleep(2000);
7023
- this.clearMessages();
7087
+ // this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
7088
+ // await this.sleep(2000);
7089
+ // this.clearMessages();
7090
+ }
7091
+ await this.uploadReportsBulk(bulkBody);
7092
+ if (bulkBodyReview.length > 0) {
7093
+ await this.uploadReviewsBulk(bulkBodyReview);
7024
7094
  }
7025
7095
  }
7026
7096
  if (this.mode == "next") {
@@ -12979,6 +13049,22 @@ let SfIEvents = class SfIEvents extends LitElement {
12979
13049
  this.setError(jsonRespose.error);
12980
13050
  }
12981
13051
  };
13052
+ this.uploadAuditsBulk = async (bulkBody) => {
13053
+ let url = "https://" + this.apiId + "/uploadauditsbulk";
13054
+ const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
13055
+ const xhr = (await this.prepareXhr(bulkBody, url, this._SfLoader, authorization));
13056
+ this._SfLoader.innerHTML = '';
13057
+ if (xhr.status == 200) {
13058
+ this.setSuccess("Bulk upload initiated. Processing will occur in the background, and you'll receive an email notification once it's complete.");
13059
+ setTimeout(() => {
13060
+ this.clearMessages();
13061
+ }, 2000);
13062
+ }
13063
+ else {
13064
+ const jsonRespose = JSON.parse(xhr.responseText);
13065
+ this.setError(jsonRespose.error);
13066
+ }
13067
+ };
12982
13068
  this.uploadReview = async (entityId, locationId, mmddyyyy, eventid, comments, approved) => {
12983
13069
  let url = "https://" + this.apiId + "/uploadreview";
12984
13070
  const body = {
@@ -13017,6 +13103,23 @@ let SfIEvents = class SfIEvents extends LitElement {
13017
13103
  }
13018
13104
  ``;
13019
13105
  };
13106
+ this.uploadReviewsBulk = async (bulkBody) => {
13107
+ let url = "https://" + this.apiId + "/uploadreviewsbulk";
13108
+ const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
13109
+ const xhr = (await this.prepareXhr(bulkBody, url, this._SfLoader, authorization));
13110
+ this._SfLoader.innerHTML = '';
13111
+ if (xhr.status == 200) {
13112
+ this.setSuccess("Bulk upload initiated. Processing will occur in the background, and you'll receive an email notification once it's complete.");
13113
+ setTimeout(() => {
13114
+ this.clearMessages();
13115
+ }, 2000);
13116
+ }
13117
+ else {
13118
+ const jsonRespose = JSON.parse(xhr.responseText);
13119
+ this.setError(jsonRespose.error);
13120
+ }
13121
+ ``;
13122
+ };
13020
13123
  this.uploadReport = async (entityId, locationId, mmddyyyy, eventid, comments, doc, docs, event, reportformatvalues = "", reportformatschema = "") => {
13021
13124
  let url = "https://" + this.apiId + "/uploadreport";
13022
13125
  let body = {
@@ -13061,6 +13164,22 @@ let SfIEvents = class SfIEvents extends LitElement {
13061
13164
  this.setError(jsonRespose.error);
13062
13165
  }
13063
13166
  };
13167
+ this.uploadReportsBulk = async (bulkBody) => {
13168
+ let url = "https://" + this.apiId + "/uploadreportsbulk";
13169
+ const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
13170
+ const xhr = (await this.prepareXhr(bulkBody, url, this._SfLoader, authorization));
13171
+ this._SfLoader.innerHTML = '';
13172
+ if (xhr.status == 200) {
13173
+ this.setSuccess("Bulk upload initiated. Processing will occur in the background, and you'll receive an email notification once it's complete.");
13174
+ setTimeout(() => {
13175
+ this.clearMessages();
13176
+ }, 2000);
13177
+ }
13178
+ else {
13179
+ const jsonRespose = JSON.parse(xhr.responseText);
13180
+ this.setError(jsonRespose.error);
13181
+ }
13182
+ };
13064
13183
  this.uploadMapping = async () => {
13065
13184
  let url = "https://" + this.apiId + "/mapevents";
13066
13185
  const mapping = this.transformMappingsForUpload({
@@ -10192,7 +10192,7 @@ export class SfIEvents extends LitElement {
10192
10192
  await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], comments, approved)
10193
10193
 
10194
10194
  } else {
10195
-
10195
+ let bulkBodyReview = []
10196
10196
  for(var k = 0; k < this.selectedItemIds.length; k++) {
10197
10197
 
10198
10198
  const selectedId = this.selectedItemIds[k];
@@ -10201,16 +10201,30 @@ export class SfIEvents extends LitElement {
10201
10201
  locationId = selectedId.split('-')[8].replace(/_/g, '-');
10202
10202
  const eventId = selectedId.split('-')[9].replace(/_/g, '-');
10203
10203
  mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
10204
-
10204
+
10205
10205
  //console.log(entityId, locationId, eventId, mmddyyyy);
10206
-
10207
- await this.uploadReview(entityId, locationId, mmddyyyy, eventId, comments, approved)
10208
-
10209
- this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
10210
- await this.sleep(2000);
10211
- this.clearMessages();
10206
+ bulkBodyReview.push({
10207
+ "mmddyyyy": mmddyyyy,
10208
+ "projectid": this.projectId,
10209
+ "type": "review",
10210
+ "eventid": eventId,
10211
+ "comments": comments,
10212
+ "approved": approved,
10213
+ "entityid": entityId,
10214
+ "locationid": locationId,
10215
+ "username": this.userName,
10216
+ "userid": this.userProfileId,
10217
+ "userrole": this.myRole,
10218
+ "year": this.calendarStartYYYY
10219
+ })
10220
+ // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, comments, approved)
10221
+
10222
+ // this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
10223
+ // await this.sleep(2000);
10224
+ // this.clearMessages();
10212
10225
 
10213
10226
  }
10227
+ await this.uploadReviewsBulk(bulkBodyReview);
10214
10228
 
10215
10229
  }
10216
10230
 
@@ -10251,7 +10265,7 @@ export class SfIEvents extends LitElement {
10251
10265
  await this.uploadAudit(entityId, locationId, mmddyyyy, event["id"], comments, approved)
10252
10266
 
10253
10267
  } else {
10254
-
10268
+ let bulkBodyAudit = []
10255
10269
  for(var k = 0; k < this.selectedItemIds.length; k++) {
10256
10270
 
10257
10271
  const selectedId = this.selectedItemIds[k];
@@ -10263,11 +10277,26 @@ export class SfIEvents extends LitElement {
10263
10277
  mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
10264
10278
 
10265
10279
  //console.log(entityId, locationId, eventId, mmddyyyy);
10266
-
10267
- await this.uploadAudit(entityId, locationId, mmddyyyy, eventId, comments, approved);
10280
+ bulkBodyAudit.push({
10281
+ "mmddyyyy": mmddyyyy,
10282
+ "projectid": this.projectId,
10283
+ "type": "audit",
10284
+ "eventid": eventId,
10285
+ "comments": comments,
10286
+ "approved": approved,
10287
+ "entityid": entityId,
10288
+ "locationid": locationId,
10289
+ "username": this.userName,
10290
+ "userid": this.userProfileId,
10291
+ "userrole": this.myRole,
10292
+ "year": this.calendarStartYYYY
10293
+ })
10294
+ // await this.uploadAudit(entityId, locationId, mmddyyyy, eventId, comments, approved);
10268
10295
 
10269
10296
  }
10270
10297
 
10298
+ await this.uploadAuditsBulk(bulkBodyAudit);
10299
+
10271
10300
  }
10272
10301
 
10273
10302
  var clickEvent = new MouseEvent("click", {
@@ -10392,7 +10421,8 @@ export class SfIEvents extends LitElement {
10392
10421
  }
10393
10422
 
10394
10423
  } else {
10395
-
10424
+ let bulkBody = []
10425
+ let bulkBodyReview = []
10396
10426
  for(var k = 0; k < this.selectedItemIds.length; k++) {
10397
10427
 
10398
10428
  const selectedId = this.selectedItemIds[k];
@@ -10405,18 +10435,53 @@ export class SfIEvents extends LitElement {
10405
10435
  mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
10406
10436
 
10407
10437
  //console.log(entityId, locationId, eventId, mmddyyyy);
10408
-
10409
- await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null)
10438
+ bulkBody.push({
10439
+ "mmddyyyy": mmddyyyy,
10440
+ "projectid": this.projectId,
10441
+ "type": "report",
10442
+ "eventid": eventId,
10443
+ "comments": reportercomments,
10444
+ "dateofcompletion": reporterdoc,
10445
+ "entityid": entityId,
10446
+ "locationid": locationId,
10447
+ "event": null,
10448
+ "docs": JSON.stringify(docs),
10449
+ "username": this.userName,
10450
+ "reportformatvalues": reportformatvalues,
10451
+ "reportformatschema": reportformatschema,
10452
+ "userid": this.userProfileId,
10453
+ "userrole": this.myRole,
10454
+ "year": this.calendarStartYYYY
10455
+ })
10456
+ // await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null)
10410
10457
  if(parseInt(makercheckersL) > 0) {
10411
-
10412
- await this.uploadReview(entityId, locationId, mmddyyyy, eventId, "Auto approved", true);
10458
+ bulkBodyReview.push({
10459
+ "mmddyyyy": mmddyyyy,
10460
+ "projectid": this.projectId,
10461
+ "type": "review",
10462
+ "eventid": eventId,
10463
+ "comments": "Auto approved",
10464
+ "approved": true,
10465
+ "entityid": entityId,
10466
+ "locationid": locationId,
10467
+ "username": this.userName,
10468
+ "userid": this.userProfileId,
10469
+ "userrole": this.myRole,
10470
+ "year": this.calendarStartYYYY
10471
+ } )
10472
+ // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, "Auto approved", true);
10413
10473
 
10414
10474
  }
10415
10475
 
10416
- this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
10417
- await this.sleep(2000);
10418
- this.clearMessages();
10476
+ // this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
10477
+ // await this.sleep(2000);
10478
+ // this.clearMessages();
10479
+
10480
+ }
10419
10481
 
10482
+ await this.uploadReportsBulk(bulkBody);
10483
+ if(bulkBodyReview.length > 0){
10484
+ await this.uploadReviewsBulk(bulkBodyReview)
10420
10485
  }
10421
10486
 
10422
10487
  }
@@ -18110,6 +18175,24 @@ export class SfIEvents extends LitElement {
18110
18175
  this.setError(jsonRespose.error);
18111
18176
  }
18112
18177
  }
18178
+ uploadAuditsBulk = async (bulkBody: any) => {
18179
+ let url = "https://"+this.apiId+"/uploadauditsbulk";
18180
+
18181
+ const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
18182
+ const xhr : any = (await this.prepareXhr(bulkBody, url, this._SfLoader, authorization)) as any;
18183
+ this._SfLoader.innerHTML = '';
18184
+ if(xhr.status == 200) {
18185
+
18186
+ this.setSuccess("Bulk upload initiated. Processing will occur in the background, and you'll receive an email notification once it's complete.");
18187
+ setTimeout(() => {
18188
+ this.clearMessages()
18189
+ }, 2000);
18190
+
18191
+ } else {
18192
+ const jsonRespose = JSON.parse(xhr.responseText);
18193
+ this.setError(jsonRespose.error);
18194
+ }
18195
+ }
18113
18196
 
18114
18197
  uploadReview = async (entityId: string, locationId: string, mmddyyyy: string, eventid: string, comments: string, approved: any) => {
18115
18198
  let url = "https://"+this.apiId+"/uploadreview";
@@ -18151,6 +18234,23 @@ export class SfIEvents extends LitElement {
18151
18234
  this.setError(jsonRespose.error);
18152
18235
  }``
18153
18236
  }
18237
+ uploadReviewsBulk = async (bulkBody: any) => {
18238
+ let url = "https://"+this.apiId+"/uploadreviewsbulk";
18239
+
18240
+ const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
18241
+ const xhr : any = (await this.prepareXhr(bulkBody, url, this._SfLoader, authorization)) as any;
18242
+ this._SfLoader.innerHTML = '';
18243
+ if(xhr.status == 200) {
18244
+ this.setSuccess("Bulk upload initiated. Processing will occur in the background, and you'll receive an email notification once it's complete.");
18245
+ setTimeout(() => {
18246
+ this.clearMessages()
18247
+ }, 2000);
18248
+
18249
+ } else {
18250
+ const jsonRespose = JSON.parse(xhr.responseText);
18251
+ this.setError(jsonRespose.error);
18252
+ }``
18253
+ }
18154
18254
 
18155
18255
  uploadReport = async (entityId: string, locationId: string, mmddyyyy: string, eventid: string, comments: string, doc: string, docs: any, event: any, reportformatvalues: string = "", reportformatschema: string = "") => {
18156
18256
  let url = "https://"+this.apiId+"/uploadreport";
@@ -18201,6 +18301,25 @@ export class SfIEvents extends LitElement {
18201
18301
  }
18202
18302
  }
18203
18303
 
18304
+ uploadReportsBulk = async (bulkBody: any) => {
18305
+ let url = "https://"+this.apiId+"/uploadreportsbulk"
18306
+
18307
+ const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
18308
+ const xhr : any = (await this.prepareXhr(bulkBody, url, this._SfLoader, authorization)) as any;
18309
+ this._SfLoader.innerHTML = '';
18310
+ if(xhr.status == 200) {
18311
+
18312
+ this.setSuccess("Bulk upload initiated. Processing will occur in the background, and you'll receive an email notification once it's complete.");
18313
+ setTimeout(() => {
18314
+ this.clearMessages()
18315
+ }, 2000);
18316
+
18317
+ } else {
18318
+ const jsonRespose = JSON.parse(xhr.responseText);
18319
+ this.setError(jsonRespose.error);
18320
+ }
18321
+ }
18322
+
18204
18323
  uploadMapping = async () => {
18205
18324
 
18206
18325
  let url = "https://"+this.apiId+"/mapevents";