diff --git a/src/AdminUI/src/app/app.module.ts b/src/AdminUI/src/app/app.module.ts
index c4951143..52720432 100644
--- a/src/AdminUI/src/app/app.module.ts
+++ b/src/AdminUI/src/app/app.module.ts
@@ -119,6 +119,7 @@ import { UnarchiveCustomersDialogComponent } from './components/customer/unarchi
import { DBManagementService } from './services/db-management.service';
import { DBManagementComponent } from './components/db-management/db-management.component';
import { OverviewTabService } from './services/overview-tab.service';
+import { StatusTableComponent } from './components/overview/subscription-status-tab/status-table/status-table.component';
export function app_Init(settingsHttpService: SettingsHttpService) {
return () => settingsHttpService.initializeApp();
@@ -202,6 +203,7 @@ export function app_Init(settingsHttpService: SettingsHttpService) {
LoggingTab,
FailedEmailsTab,
UtilitiesTab,
+ StatusTableComponent,
],
imports: [
BrowserModule,
diff --git a/src/AdminUI/src/app/components/overview/subscription-status-tab/status-table/status-table.component.html b/src/AdminUI/src/app/components/overview/subscription-status-tab/status-table/status-table.component.html
new file mode 100644
index 00000000..c3dc6707
--- /dev/null
+++ b/src/AdminUI/src/app/components/overview/subscription-status-tab/status-table/status-table.component.html
@@ -0,0 +1,90 @@
+
+
+
+ Subscription Name
+ {{ row.name }}
+
+
+
+
+ Start Date
+
+ {{ row.startDate | date : dateFormat }}
+
+
+
+
+
+ End Date
+
+ {{ row.endDate | date : dateFormat }}
+
+
+
+
+
+ Appendix A Date
+
+ {{ row.appendixDate | date : dateFormat }}
+
+
+
+
+
+ Continuous
+
+ check_circle
+
+
+
+
+
+
+ Last Updated
+
+ {{ row.lastUpdated | date : dateFormat }}
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/AdminUI/src/app/components/overview/subscription-status-tab/status-table/status-table.component.scss b/src/AdminUI/src/app/components/overview/subscription-status-tab/status-table/status-table.component.scss
new file mode 100644
index 00000000..e69de29b
diff --git a/src/AdminUI/src/app/components/overview/subscription-status-tab/status-table/status-table.component.spec.ts b/src/AdminUI/src/app/components/overview/subscription-status-tab/status-table/status-table.component.spec.ts
new file mode 100644
index 00000000..0e2ece1b
--- /dev/null
+++ b/src/AdminUI/src/app/components/overview/subscription-status-tab/status-table/status-table.component.spec.ts
@@ -0,0 +1,25 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { StatusTableComponent } from './status-table.component';
+
+describe('StatusTableComponent', () => {
+ let component: StatusTableComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [ StatusTableComponent ]
+ })
+ .compileComponents();
+ });
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(StatusTableComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/AdminUI/src/app/components/overview/subscription-status-tab/status-table/status-table.component.ts b/src/AdminUI/src/app/components/overview/subscription-status-tab/status-table/status-table.component.ts
new file mode 100644
index 00000000..98c1051a
--- /dev/null
+++ b/src/AdminUI/src/app/components/overview/subscription-status-tab/status-table/status-table.component.ts
@@ -0,0 +1,167 @@
+import { Component, Input, OnInit } from '@angular/core';
+import { MatTableDataSource } from '@angular/material/table';
+import { Observable } from 'rxjs';
+import { Router } from '@angular/router';
+import { AppSettings } from 'src/app/AppSettings';
+import { SubscriptionService } from 'src/app/services/subscription.service';
+import { DataSource } from '@angular/cdk/collections';
+
+@Component({
+ selector: 'app-status-table',
+ templateUrl: './status-table.component.html',
+ styleUrls: ['./status-table.component.scss']
+})
+export class StatusTableComponent implements OnInit {
+
+
+ @Input() tableName: string
+ apiMethod: any;
+
+ dateFormat = AppSettings.DATE_FORMAT;
+ itemCount = 10;
+ pageNumber = 0;
+ pageSize = 5;
+ sortBy = "name"
+ sortOrder = "asc"
+
+ public tableDataSource: MatTableDataSource;
+ displayColumns = [
+ 'name',
+ 'startDate',
+ 'endDate',
+ 'appendixDate',
+ 'isContinuous',
+ 'lastUpdated',
+ ];
+
+ constructor(
+ private router: Router,
+ private subSvc: SubscriptionService,
+ ) {
+ console.log(this.tableName)
+ }
+
+ getAPIMethod(){
+ }
+
+ ngOnInit(): void {
+ this.getSize()
+ // this.refreshData()
+ }
+
+ getSize(){
+ //TODO : Create seconddary API call to get size
+ if(this.tableName == "endingSoon"){
+ this.subSvc.getSubStatusEndingSoon(0,100000,this.sortBy,this.sortOrder).subscribe(
+ (success) => {
+ let arrayVal = []
+ arrayVal = success as Array
+ this.itemCount = arrayVal.length;
+ this.setData(success)
+ }
+ )
+ }
+ if(this.tableName == "inProgress"){
+ this.subSvc.getSubStatusInProgress(0,100000,this.sortBy,this.sortOrder).subscribe(
+ (success) => {
+ let arrayVal = []
+ arrayVal = success as Array
+ this.itemCount = arrayVal.length;
+ this.setData(success)
+ }
+ )
+ }
+ if(this.tableName == "stopped"){
+ this.subSvc.getSubStatusStopped(0,100000,this.sortBy,this.sortOrder).subscribe(
+ (success) => {
+ let arrayVal = []
+ arrayVal = success as Array
+ this.itemCount = arrayVal.length;
+ this.setData(success)
+ }
+ )
+ }
+ }
+ refreshData(){
+ //Why wont it let me set the method as a variable and use it based on that :<
+ if(this.tableName == "endingSoon"){
+ this.subSvc.getSubStatusEndingSoon(this.pageNumber,this.pageSize,this.sortBy,this.sortOrder).subscribe(
+ (success) => {
+ this.setData(success)
+ }
+ )
+ }
+ if(this.tableName == "inProgress"){
+ this.subSvc.getSubStatusInProgress(this.pageNumber,this.pageSize,this.sortBy,this.sortOrder).subscribe(
+ (success) => {
+ this.setData(success)
+ }
+ )
+ }
+ if(this.tableName == "stopped"){
+ this.subSvc.getSubStatusStopped(this.pageNumber,this.pageSize,this.sortBy,this.sortOrder).subscribe(
+ (success) => {
+ this.setData(success)
+ }
+ )
+ }
+ }
+
+
+ changeSort(sortEvent) {
+ this.sortOrder = sortEvent.direction;
+ if (sortEvent.direction == '') {
+ this.sortOrder = 'asc';
+ this.sortBy = 'name';
+ } else {
+ this.sortBy = sortEvent.active;
+ }
+ this.refreshData();
+ }
+
+ paginationChange(event) {
+ this.pageNumber = event.pageIndex;
+ this.pageSize = event.pageSize;
+ this.refreshData();
+ }
+
+ setData(success){
+ this.tableDataSource = new MatTableDataSource();
+ this.tableDataSource.data = success as any
+ // this.sortingDataAccessor(this.tableDataSource);
+ }
+
+ // private sortingDataAccessor(callBack: any) {
+ // callBack.sortingDataAccessor = (item, property) => {
+ // switch (property) {
+ // case 'startDate':
+ // return new Date(item.cycle_start_date);
+ // case 'endDate':
+ // return new Date(item.cycle_end_date);
+ // case 'appendixDate':
+ // return new Date(item.appendix_a_date);
+ // case 'isContinuous':
+ // return item.continuous_subscription ? 1 : 0;
+ // case 'lastUpdated':
+ // return new Date(item.updated);
+ // default:
+ // return item[property];
+ // }
+ // };
+ // }
+
+ public editSubscription(row) {
+ this.router.navigate(['/view-subscription', row._id]);
+ }
+
+}
+
+interface SubscriptionWithEndDate {
+ // top-level primitives for column sorting
+ name: string;
+ cycle_start_date: Date;
+ cycle_end_date: Date;
+ appendix_a_date: Date;
+ is_continuous: string;
+ last_updated: Date;
+}
\ No newline at end of file
diff --git a/src/AdminUI/src/app/components/overview/subscription-status-tab/subscription-status-tab.component.html b/src/AdminUI/src/app/components/overview/subscription-status-tab/subscription-status-tab.component.html
index ac88b9a5..506cfe22 100644
--- a/src/AdminUI/src/app/components/overview/subscription-status-tab/subscription-status-tab.component.html
+++ b/src/AdminUI/src/app/components/overview/subscription-status-tab/subscription-status-tab.component.html
@@ -13,247 +13,13 @@
Subscriptions Ending Soon
-
-
-
- Subscription Name
- {{ row.name }}
-
-
-
-
- Start Date
-
- {{ row.cycle_start_date | date : dateFormat }}
-
-
-
-
-
- End Date
-
- {{ row.cycle_end_date | date : dateFormat }}
-
-
-
-
-
- Appendix A Date
-
- {{ row.appendix_a_date | date : dateFormat }}
-
-
-
-
-
- Continuous
-
- check_circle
-
-
-
-
-
-
- Last Updated
-
- {{ row.updated | date : dateFormat }}
-
-
-
-
-
-
-
-
-
-
+
Subscriptions in Progress
-
-
-
- Subscription Name
- {{ row.name }}
-
-
-
-
- Start Date
-
- {{ row.cycle_start_date | date : dateFormat }}
-
-
-
-
-
- End Date
-
- {{ row.cycle_end_date | date : dateFormat }}
-
-
-
-
-
- Appendix A Date
-
- {{ row.appendix_a_date | date : dateFormat }}
-
-
-
-
-
- Continuous
-
- check_circle
-
-
-
-
-
-
- Last Updated
-
- {{ row.updated | date : dateFormat }}
-
-
-
-
-
-
-
-
-
-
-
+
Stopped Subscriptions
-
-
-
- Subscription Name
- {{ row.name }}
-
-
-
-
- Start Date
-
- {{ row.cycle_start_date | date : dateFormat }}
-
-
-
-
-
- Appendix A Date
-
- {{ row.appendix_a_date | date : dateFormat }}
-
-
-
-
-
- Continuous
-
- check_circle
-
-
-
-
-
-
- Last Updated
-
- {{ row.updated | date : dateFormat }}
-
-
-
-
-
-
-
-
-
-
+
diff --git a/src/AdminUI/src/app/components/overview/subscription-status-tab/subscription-status-tab.component.ts b/src/AdminUI/src/app/components/overview/subscription-status-tab/subscription-status-tab.component.ts
index 44191d5d..16b739af 100644
--- a/src/AdminUI/src/app/components/overview/subscription-status-tab/subscription-status-tab.component.ts
+++ b/src/AdminUI/src/app/components/overview/subscription-status-tab/subscription-status-tab.component.ts
@@ -69,9 +69,11 @@ export class SubscriptionStatusTab implements OnInit {
'lastUpdated',
];
+ endingSoonMethod = this.subscriptionSvc.getSubStatusEndingSoon
+
constructor(
private router: Router,
- private subscriptionSvc: SubscriptionService,
+ public subscriptionSvc: SubscriptionService,
private tabSvc: OverviewTabService,
) {
this.clickStatus = this.tabClicked;
diff --git a/src/AdminUI/src/app/services/subscription.service.ts b/src/AdminUI/src/app/services/subscription.service.ts
index 3f1e7789..970efd71 100644
--- a/src/AdminUI/src/app/services/subscription.service.ts
+++ b/src/AdminUI/src/app/services/subscription.service.ts
@@ -83,6 +83,34 @@ export class SubscriptionService {
return this.http.get(url);
}
+ public getSubStatusEndingSoon(
+ page,
+ pageSize,
+ sortBy,
+ sortOrder = 'asc')
+ {
+ let url = `${this.settingsService.settings.apiUrl}/api/subscriptions/status/ending_soon/${page}/${pageSize}/${sortBy}/${sortOrder}/`;
+ return this.http.get(url);
+ }
+ public getSubStatusInProgress(
+ page,
+ pageSize,
+ sortBy,
+ sortOrder = 'asc')
+ {
+ let url = `${this.settingsService.settings.apiUrl}/api/subscriptions/status/in_progress/${page}/${pageSize}/${sortBy}/${sortOrder}/`;
+ return this.http.get(url);
+ }
+ public getSubStatusStopped(
+ page,
+ pageSize,
+ sortBy,
+ sortOrder = 'asc')
+ {
+ let url = `${this.settingsService.settings.apiUrl}/api/subscriptions/status/stopped/${page}/${pageSize}/${sortBy}/${sortOrder}/`;
+ return this.http.get(url);
+ }
+
public getSubscriptionCount(searchFilter = '', archived = false) {
let url = `${this.settingsService.settings.apiUrl}/api/subscriptions/count/`;