sf-i-events 1.0.852 → 1.0.853

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.852",
4
+ "version": "1.0.853",
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
@@ -438,6 +438,7 @@ export declare class SfIEvents extends LitElement {
438
438
  insertDates: (month: number, year: number) => string;
439
439
  insertDayNames: () => string;
440
440
  getYearFromMonthAndCalendarStart: (mm: string) => string;
441
+ getAboutToExpire: (mmdd: string, event: any) => boolean;
441
442
  getPastDueDate: (mmdd: string) => boolean;
442
443
  getLateExecuted: (mmdd: string, event: any) => boolean;
443
444
  getLateReported: (mmdd: string, event: any) => boolean;
@@ -463,7 +464,7 @@ export declare class SfIEvents extends LitElement {
463
464
  renderLatestCompliance: (mmddyyyy: string, event: any) => any;
464
465
  getCompletenessStatus: (event: any) => "rejected" | "not-started" | "pending-approval" | "approved";
465
466
  getTimelinessStatus: (mmdd: string, event: any, completeness: string) => "late-executed" | "late-reported" | "late-approved" | "past-due-date" | "in-time";
466
- getComplianceStatus: (completeness: string, timeliness: string, percentage?: string, event?: any) => "active" | "expired" | "scheduled" | "not-complied" | "partially-complied" | "complied" | "complied-with-gaps" | "reported-non-compliance";
467
+ getComplianceStatus: (completeness: string, timeliness: string, percentage?: string, event?: any, mmdd?: string) => "active" | "expired" | "scheduled" | "not-complied" | "partially-complied" | "complied" | "complied-with-gaps" | "reported-non-compliance" | "about-to-expire";
467
468
  numcalled: number;
468
469
  updateStats: (event: any, partStatus: string, lateStatus: string, complianceStatus: string) => void;
469
470
  renderCalendarGraphs: (showGraph: boolean, parametersTitle: string, showBackgroundButton: boolean) => string;
package/sf-i-events.js CHANGED
@@ -1660,6 +1660,24 @@ let SfIEvents = class SfIEvents extends LitElement {
1660
1660
  }
1661
1661
  return yyyy;
1662
1662
  };
1663
+ this.getAboutToExpire = (mmdd, event) => {
1664
+ // console.log('about to expire', mmdd, event.duedate)
1665
+ const tsDoc = new Date(parseInt(event.duedate)).getTime();
1666
+ const dd = mmdd.substring(3, 5);
1667
+ const mm = mmdd.substring(0, 2);
1668
+ var yyyy = this.getYearFromMonthAndCalendarStart(mm);
1669
+ var date = new Date();
1670
+ date.setMonth(parseInt(mm) - 1);
1671
+ date.setDate(parseInt(dd));
1672
+ date.setFullYear(parseInt(yyyy));
1673
+ const tsCurr = date.getTime();
1674
+ console.log('about to expire', mmdd, tsDoc, tsCurr);
1675
+ if ((tsDoc - tsCurr) < (30 * 24 * 60 * 1000)) { // less than 60 days
1676
+ //console.log('late executed', true)
1677
+ return true;
1678
+ }
1679
+ return false;
1680
+ };
1663
1681
  this.getPastDueDate = (mmdd) => {
1664
1682
  const dd = mmdd.substring(3, 5);
1665
1683
  const mm = mmdd.substring(0, 2);
@@ -2113,11 +2131,16 @@ let SfIEvents = class SfIEvents extends LitElement {
2113
2131
  }
2114
2132
  }
2115
2133
  };
2116
- this.getComplianceStatus = (completeness, timeliness, percentage, event = {}) => {
2134
+ this.getComplianceStatus = (completeness, timeliness, percentage, event = {}, mmdd = "") => {
2117
2135
  if (event.module == "agreement") {
2118
2136
  if (completeness == "not-started") {
2119
2137
  if (timeliness == "in-time") {
2120
- return "active";
2138
+ if (this.getAboutToExpire(mmdd, event)) {
2139
+ return "about-to-expire";
2140
+ }
2141
+ else {
2142
+ return "active";
2143
+ }
2121
2144
  }
2122
2145
  else {
2123
2146
  return "expired";
@@ -3657,6 +3657,35 @@ export class SfIEvents extends LitElement {
3657
3657
 
3658
3658
  }
3659
3659
 
3660
+ getAboutToExpire = (mmdd: string, event: any) => {
3661
+
3662
+ // console.log('about to expire', mmdd, event.duedate)
3663
+
3664
+ const tsDoc = new Date(parseInt(event.duedate)).getTime();
3665
+
3666
+ const dd = mmdd.substring(3, 5);
3667
+ const mm = mmdd.substring(0, 2);
3668
+
3669
+ var yyyy = this.getYearFromMonthAndCalendarStart(mm);
3670
+
3671
+ var date = new Date();
3672
+ date.setMonth(parseInt(mm) - 1);
3673
+ date.setDate(parseInt(dd));
3674
+ date.setFullYear(parseInt(yyyy));
3675
+
3676
+ const tsCurr = date.getTime();
3677
+
3678
+ console.log('about to expire', mmdd, tsDoc, tsCurr)
3679
+
3680
+ if ((tsDoc - tsCurr) < (30 * 24 * 60 * 1000)) { // less than 60 days
3681
+ //console.log('late executed', true)
3682
+ return true;
3683
+ }
3684
+
3685
+ return false;
3686
+
3687
+ }
3688
+
3660
3689
  getPastDueDate = (mmdd: string) => {
3661
3690
 
3662
3691
  const dd = mmdd.substring(3, 5);
@@ -4232,12 +4261,16 @@ export class SfIEvents extends LitElement {
4232
4261
 
4233
4262
  }
4234
4263
 
4235
- getComplianceStatus = (completeness: string, timeliness: string, percentage?: string, event: any = {}) => {
4264
+ getComplianceStatus = (completeness: string, timeliness: string, percentage?: string, event: any = {}, mmdd: string = "") => {
4236
4265
  if (event.module == "agreement") {
4237
4266
  if (completeness == "not-started") {
4238
4267
 
4239
4268
  if (timeliness == "in-time") {
4240
- return "active";
4269
+ if(this.getAboutToExpire(mmdd, event)) {
4270
+ return "about-to-expire";
4271
+ }else{
4272
+ return "active";
4273
+ }
4241
4274
  } else {
4242
4275
  return "expired";
4243
4276
  }