sf-i-events 1.0.676 → 1.0.678

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.676",
4
+ "version": "1.0.678",
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,23 @@ 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
+ });
6879
+ // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, comments, approved)
6880
+ // this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
6881
+ // await this.sleep(2000);
6882
+ // this.clearMessages();
6871
6883
  }
6884
+ await this.uploadReviewsBulk(bulkBodyReview);
6872
6885
  }
6873
6886
  if (this.mode == "next") {
6874
6887
  // this.fetchNext(this.nextPage)
@@ -6903,6 +6916,7 @@ let SfIEvents = class SfIEvents extends LitElement {
6903
6916
  await this.uploadAudit(entityId, locationId, mmddyyyy, event["id"], comments, approved);
6904
6917
  }
6905
6918
  else {
6919
+ let bulkBodyAudit = [];
6906
6920
  for (var k = 0; k < this.selectedItemIds.length; k++) {
6907
6921
  const selectedId = this.selectedItemIds[k];
6908
6922
  //console.log('selectedid', selectedId);
@@ -6911,8 +6925,20 @@ let SfIEvents = class SfIEvents extends LitElement {
6911
6925
  const eventId = selectedId.split('-')[9].replace(/_/g, '-');
6912
6926
  mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
6913
6927
  //console.log(entityId, locationId, eventId, mmddyyyy);
6914
- await this.uploadAudit(entityId, locationId, mmddyyyy, eventId, comments, approved);
6928
+ bulkBodyAudit.push({
6929
+ "mmddyyyy": mmddyyyy,
6930
+ "projectid": this.projectId,
6931
+ "type": "audit",
6932
+ "eventid": eventId,
6933
+ "comments": comments,
6934
+ "approved": approved,
6935
+ "entityid": entityId,
6936
+ "locationid": locationId,
6937
+ "username": this.userName
6938
+ });
6939
+ // await this.uploadAudit(entityId, locationId, mmddyyyy, eventId, comments, approved);
6915
6940
  }
6941
+ await this.uploadAuditsBulk(bulkBodyAudit);
6916
6942
  }
6917
6943
  var clickEvent = new MouseEvent("click", {
6918
6944
  "view": window,
@@ -7005,6 +7031,8 @@ let SfIEvents = class SfIEvents extends LitElement {
7005
7031
  }
7006
7032
  }
7007
7033
  else {
7034
+ let bulkBody = [];
7035
+ let bulkBodyReview = [];
7008
7036
  for (var k = 0; k < this.selectedItemIds.length; k++) {
7009
7037
  const selectedId = this.selectedItemIds[k];
7010
7038
  //console.log('selectedid', selectedId);
@@ -7014,13 +7042,46 @@ let SfIEvents = class SfIEvents extends LitElement {
7014
7042
  const eventId = selectedId.split('-')[9].replace(/_/g, '-');
7015
7043
  mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
7016
7044
  //console.log(entityId, locationId, eventId, mmddyyyy);
7017
- await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null);
7045
+ bulkBody.push({
7046
+ "mmddyyyy": mmddyyyy,
7047
+ "projectid": this.projectId,
7048
+ "type": "report",
7049
+ "eventid": eventId,
7050
+ "comments": reportercomments,
7051
+ "dateofcompletion": reporterdoc,
7052
+ "entityid": entityId,
7053
+ "locationid": locationId,
7054
+ "event": null,
7055
+ "docs": JSON.stringify(docs),
7056
+ "username": this.userName,
7057
+ "reportformatvalues": reportformatvalues,
7058
+ "reportformatschema": reportformatschema,
7059
+ "userid": this.userProfileId,
7060
+ "userrole": this.myRole,
7061
+ "year": this.calendarStartYYYY
7062
+ });
7063
+ // await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null)
7018
7064
  if (parseInt(makercheckersL) > 0) {
7019
- await this.uploadReview(entityId, locationId, mmddyyyy, eventId, "Auto approved", true);
7065
+ bulkBodyReview.push({
7066
+ "mmddyyyy": mmddyyyy,
7067
+ "projectid": this.projectId,
7068
+ "type": "review",
7069
+ "eventid": eventId,
7070
+ "comments": "Auto approved",
7071
+ "approved": true,
7072
+ "entityid": entityId,
7073
+ "locationid": locationId,
7074
+ "username": this.userName
7075
+ });
7076
+ // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, "Auto approved", true);
7020
7077
  }
7021
- this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
7022
- await this.sleep(2000);
7023
- this.clearMessages();
7078
+ // this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
7079
+ // await this.sleep(2000);
7080
+ // this.clearMessages();
7081
+ }
7082
+ await this.uploadReportsBulk(bulkBody);
7083
+ if (bulkBodyReview.length > 0) {
7084
+ await this.uploadReviewsBulk(bulkBodyReview);
7024
7085
  }
7025
7086
  }
7026
7087
  if (this.mode == "next") {
@@ -12979,6 +13040,22 @@ let SfIEvents = class SfIEvents extends LitElement {
12979
13040
  this.setError(jsonRespose.error);
12980
13041
  }
12981
13042
  };
13043
+ this.uploadAuditsBulk = async (bulkBody) => {
13044
+ let url = "https://" + this.apiId + "/uploadauditsbulk";
13045
+ const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
13046
+ const xhr = (await this.prepareXhr(bulkBody, url, this._SfLoader, authorization));
13047
+ this._SfLoader.innerHTML = '';
13048
+ if (xhr.status == 200) {
13049
+ this.setSuccess("Audit report uploaded successfully!");
13050
+ setTimeout(() => {
13051
+ this.clearMessages();
13052
+ }, 2000);
13053
+ }
13054
+ else {
13055
+ const jsonRespose = JSON.parse(xhr.responseText);
13056
+ this.setError(jsonRespose.error);
13057
+ }
13058
+ };
12982
13059
  this.uploadReview = async (entityId, locationId, mmddyyyy, eventid, comments, approved) => {
12983
13060
  let url = "https://" + this.apiId + "/uploadreview";
12984
13061
  const body = {
@@ -13017,6 +13094,23 @@ let SfIEvents = class SfIEvents extends LitElement {
13017
13094
  }
13018
13095
  ``;
13019
13096
  };
13097
+ this.uploadReviewsBulk = async (bulkBody) => {
13098
+ let url = "https://" + this.apiId + "/uploadreviewsbulk";
13099
+ const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
13100
+ const xhr = (await this.prepareXhr(bulkBody, url, this._SfLoader, authorization));
13101
+ this._SfLoader.innerHTML = '';
13102
+ if (xhr.status == 200) {
13103
+ this.setSuccess("Reviews uploaded successfully!");
13104
+ setTimeout(() => {
13105
+ this.clearMessages();
13106
+ }, 2000);
13107
+ }
13108
+ else {
13109
+ const jsonRespose = JSON.parse(xhr.responseText);
13110
+ this.setError(jsonRespose.error);
13111
+ }
13112
+ ``;
13113
+ };
13020
13114
  this.uploadReport = async (entityId, locationId, mmddyyyy, eventid, comments, doc, docs, event, reportformatvalues = "", reportformatschema = "") => {
13021
13115
  let url = "https://" + this.apiId + "/uploadreport";
13022
13116
  let body = {
@@ -13061,6 +13155,22 @@ let SfIEvents = class SfIEvents extends LitElement {
13061
13155
  this.setError(jsonRespose.error);
13062
13156
  }
13063
13157
  };
13158
+ this.uploadReportsBulk = async (bulkBody) => {
13159
+ let url = "https://" + this.apiId + "/uploadreportsbulk";
13160
+ const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
13161
+ const xhr = (await this.prepareXhr(bulkBody, url, this._SfLoader, authorization));
13162
+ this._SfLoader.innerHTML = '';
13163
+ if (xhr.status == 200) {
13164
+ this.setSuccess("Reports uploaded successfully!");
13165
+ setTimeout(() => {
13166
+ this.clearMessages();
13167
+ }, 2000);
13168
+ }
13169
+ else {
13170
+ const jsonRespose = JSON.parse(xhr.responseText);
13171
+ this.setError(jsonRespose.error);
13172
+ }
13173
+ };
13064
13174
  this.uploadMapping = async () => {
13065
13175
  let url = "https://" + this.apiId + "/mapevents";
13066
13176
  const mapping = this.transformMappingsForUpload({
@@ -14281,7 +14391,7 @@ let SfIEvents = class SfIEvents extends LitElement {
14281
14391
  else {
14282
14392
  view = "entity";
14283
14393
  }
14284
- path = "getallcountryevents1";
14394
+ path = "getallcountryevents";
14285
14395
  let sDate = "";
14286
14396
  let eDate = "";
14287
14397
  //console.log('currenttab', this.getCurrentTab());
@@ -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,27 @@ 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
+ })
10217
+ // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, comments, approved)
10218
+
10219
+ // this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
10220
+ // await this.sleep(2000);
10221
+ // this.clearMessages();
10212
10222
 
10213
10223
  }
10224
+ await this.uploadReviewsBulk(bulkBodyReview);
10214
10225
 
10215
10226
  }
10216
10227
 
@@ -10251,7 +10262,7 @@ export class SfIEvents extends LitElement {
10251
10262
  await this.uploadAudit(entityId, locationId, mmddyyyy, event["id"], comments, approved)
10252
10263
 
10253
10264
  } else {
10254
-
10265
+ let bulkBodyAudit = []
10255
10266
  for(var k = 0; k < this.selectedItemIds.length; k++) {
10256
10267
 
10257
10268
  const selectedId = this.selectedItemIds[k];
@@ -10263,11 +10274,23 @@ export class SfIEvents extends LitElement {
10263
10274
  mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
10264
10275
 
10265
10276
  //console.log(entityId, locationId, eventId, mmddyyyy);
10266
-
10267
- await this.uploadAudit(entityId, locationId, mmddyyyy, eventId, comments, approved);
10277
+ bulkBodyAudit.push({
10278
+ "mmddyyyy": mmddyyyy,
10279
+ "projectid": this.projectId,
10280
+ "type": "audit",
10281
+ "eventid": eventId,
10282
+ "comments": comments,
10283
+ "approved": approved,
10284
+ "entityid": entityId,
10285
+ "locationid": locationId,
10286
+ "username": this.userName
10287
+ })
10288
+ // await this.uploadAudit(entityId, locationId, mmddyyyy, eventId, comments, approved);
10268
10289
 
10269
10290
  }
10270
10291
 
10292
+ await this.uploadAuditsBulk(bulkBodyAudit);
10293
+
10271
10294
  }
10272
10295
 
10273
10296
  var clickEvent = new MouseEvent("click", {
@@ -10392,7 +10415,8 @@ export class SfIEvents extends LitElement {
10392
10415
  }
10393
10416
 
10394
10417
  } else {
10395
-
10418
+ let bulkBody = []
10419
+ let bulkBodyReview = []
10396
10420
  for(var k = 0; k < this.selectedItemIds.length; k++) {
10397
10421
 
10398
10422
  const selectedId = this.selectedItemIds[k];
@@ -10405,20 +10429,52 @@ export class SfIEvents extends LitElement {
10405
10429
  mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
10406
10430
 
10407
10431
  //console.log(entityId, locationId, eventId, mmddyyyy);
10408
-
10409
- await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null)
10432
+ bulkBody.push({
10433
+ "mmddyyyy": mmddyyyy,
10434
+ "projectid": this.projectId,
10435
+ "type": "report",
10436
+ "eventid": eventId,
10437
+ "comments": reportercomments,
10438
+ "dateofcompletion": reporterdoc,
10439
+ "entityid": entityId,
10440
+ "locationid": locationId,
10441
+ "event": null,
10442
+ "docs": JSON.stringify(docs),
10443
+ "username": this.userName,
10444
+ "reportformatvalues": reportformatvalues,
10445
+ "reportformatschema": reportformatschema,
10446
+ "userid": this.userProfileId,
10447
+ "userrole": this.myRole,
10448
+ "year": this.calendarStartYYYY
10449
+ })
10450
+ // await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null)
10410
10451
  if(parseInt(makercheckersL) > 0) {
10411
-
10412
- await this.uploadReview(entityId, locationId, mmddyyyy, eventId, "Auto approved", true);
10452
+ bulkBodyReview.push({
10453
+ "mmddyyyy": mmddyyyy,
10454
+ "projectid": this.projectId,
10455
+ "type": "review",
10456
+ "eventid": eventId,
10457
+ "comments": "Auto approved",
10458
+ "approved": true,
10459
+ "entityid": entityId,
10460
+ "locationid": locationId,
10461
+ "username": this.userName
10462
+ } )
10463
+ // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, "Auto approved", true);
10413
10464
 
10414
10465
  }
10415
10466
 
10416
- this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
10417
- await this.sleep(2000);
10418
- this.clearMessages();
10467
+ // this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
10468
+ // await this.sleep(2000);
10469
+ // this.clearMessages();
10419
10470
 
10420
10471
  }
10421
10472
 
10473
+ await this.uploadReportsBulk(bulkBody);
10474
+ if(bulkBodyReview.length > 0){
10475
+ await this.uploadReviewsBulk(bulkBodyReview)
10476
+ }
10477
+
10422
10478
  }
10423
10479
 
10424
10480
  if(this.mode == "next"){
@@ -18110,6 +18166,24 @@ export class SfIEvents extends LitElement {
18110
18166
  this.setError(jsonRespose.error);
18111
18167
  }
18112
18168
  }
18169
+ uploadAuditsBulk = async (bulkBody: any) => {
18170
+ let url = "https://"+this.apiId+"/uploadauditsbulk";
18171
+
18172
+ const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
18173
+ const xhr : any = (await this.prepareXhr(bulkBody, url, this._SfLoader, authorization)) as any;
18174
+ this._SfLoader.innerHTML = '';
18175
+ if(xhr.status == 200) {
18176
+
18177
+ this.setSuccess("Audit report uploaded successfully!");
18178
+ setTimeout(() => {
18179
+ this.clearMessages()
18180
+ }, 2000);
18181
+
18182
+ } else {
18183
+ const jsonRespose = JSON.parse(xhr.responseText);
18184
+ this.setError(jsonRespose.error);
18185
+ }
18186
+ }
18113
18187
 
18114
18188
  uploadReview = async (entityId: string, locationId: string, mmddyyyy: string, eventid: string, comments: string, approved: any) => {
18115
18189
  let url = "https://"+this.apiId+"/uploadreview";
@@ -18151,6 +18225,23 @@ export class SfIEvents extends LitElement {
18151
18225
  this.setError(jsonRespose.error);
18152
18226
  }``
18153
18227
  }
18228
+ uploadReviewsBulk = async (bulkBody: any) => {
18229
+ let url = "https://"+this.apiId+"/uploadreviewsbulk";
18230
+
18231
+ const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
18232
+ const xhr : any = (await this.prepareXhr(bulkBody, url, this._SfLoader, authorization)) as any;
18233
+ this._SfLoader.innerHTML = '';
18234
+ if(xhr.status == 200) {
18235
+ this.setSuccess("Reviews uploaded successfully!");
18236
+ setTimeout(() => {
18237
+ this.clearMessages()
18238
+ }, 2000);
18239
+
18240
+ } else {
18241
+ const jsonRespose = JSON.parse(xhr.responseText);
18242
+ this.setError(jsonRespose.error);
18243
+ }``
18244
+ }
18154
18245
 
18155
18246
  uploadReport = async (entityId: string, locationId: string, mmddyyyy: string, eventid: string, comments: string, doc: string, docs: any, event: any, reportformatvalues: string = "", reportformatschema: string = "") => {
18156
18247
  let url = "https://"+this.apiId+"/uploadreport";
@@ -18201,6 +18292,25 @@ export class SfIEvents extends LitElement {
18201
18292
  }
18202
18293
  }
18203
18294
 
18295
+ uploadReportsBulk = async (bulkBody: any) => {
18296
+ let url = "https://"+this.apiId+"/uploadreportsbulk"
18297
+
18298
+ const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
18299
+ const xhr : any = (await this.prepareXhr(bulkBody, url, this._SfLoader, authorization)) as any;
18300
+ this._SfLoader.innerHTML = '';
18301
+ if(xhr.status == 200) {
18302
+
18303
+ this.setSuccess("Reports uploaded successfully!");
18304
+ setTimeout(() => {
18305
+ this.clearMessages()
18306
+ }, 2000);
18307
+
18308
+ } else {
18309
+ const jsonRespose = JSON.parse(xhr.responseText);
18310
+ this.setError(jsonRespose.error);
18311
+ }
18312
+ }
18313
+
18204
18314
  uploadMapping = async () => {
18205
18315
 
18206
18316
  let url = "https://"+this.apiId+"/mapevents";
@@ -19934,7 +20044,7 @@ export class SfIEvents extends LitElement {
19934
20044
  view = "entity";
19935
20045
  }
19936
20046
 
19937
- path = "getallcountryevents1";
20047
+ path = "getallcountryevents";
19938
20048
 
19939
20049
  let sDate = "";
19940
20050
  let eDate = "";