-
{{planStats?.trialPlans}}
+ {{planStates?.trialPlans}}
Trial Plans
diff --git a/apps/web-giddh-admin/src/app/plans/plans-component/plans.component.ts b/apps/web-giddh-admin/src/app/plans/plans-component/plans.component.ts
index ff5d9ed..3bc4af0 100644
--- a/apps/web-giddh-admin/src/app/plans/plans-component/plans.component.ts
+++ b/apps/web-giddh-admin/src/app/plans/plans-component/plans.component.ts
@@ -6,11 +6,13 @@ import { ToasterService } from '../../services/toaster.service';
import { AuthenticationService } from '../../services/authentication.service';
import { IOption } from '../../theme/ng-select/ng-select';
import { PAGINATION_COUNT } from '../../modules/modules/api-modules/subscription';
-import { BsDropdownDirective } from 'ngx-bootstrap/dropdown';
import { ColumnFilterService } from '../../services/column-filter.service';
import { FavouriteColumnPageTypeEnum } from '../../actions/general/general.const';
import { cloneDeep } from '../../lodash-optimized';
import { PlanFieldFilterColumnNames } from '../../models/company';
+import { Subject } from 'rxjs';
+import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
+import { BsDropdownDirective } from 'ngx-bootstrap/dropdown';
@Component({
@@ -33,9 +35,8 @@ export class PlansComponent implements OnInit {
public plansData: any;
public plansDataResults: any;
public getAllPlansRequest: any = {};
- public getAllPlansPostRequest: any = {
-
- };
+ public getAllPlansPostRequest: any = {};
+ public searchViaPlanName$ = new Subject
();
public togglePanelBool: boolean;
public togglePlanDetailsPanelBool: boolean;
public selectedPlan: any = '';
@@ -43,7 +44,7 @@ export class PlansComponent implements OnInit {
public timeout: any;
public bsValue: any = '';
public defaultLoad: boolean = true;
- public planStats: any = {};
+ public planStates: any = {};
public countrySource: IOption[] = [];
public selectedCountries: string[] = []
public isAllCountrySelected: boolean = false;
@@ -61,14 +62,25 @@ export class PlansComponent implements OnInit {
this.getAllPlansPostRequest.countries = [];
this.generalService.setCurrentPageTitle("Plans");
this.getAllPlansRequest.count = PAGINATION_COUNT;
- this.getAllPlansRequest.page = 1;
- this.getAllPlansRequest.sortBy = '';
- this.getAllPlansRequest.sortType = '';
- this.getPlansStats();
- this.getAllPlans();
+ this.getPlansStates();
+ // this.getAllPlans();
this.getOnboardCountries();
/** To get dynamic column filter */
this.getColumnFilter();
+
+ /** Search using plan name */
+ this.searchViaPlanName$.pipe(
+ debounceTime(1000),
+ distinctUntilChanged()
+ ).subscribe(term => {
+ if (term) {
+ this.showClearFilter = true;
+ }
+ this.getAllPlansPostRequest.planName = term.trim();
+ this.getAllPlans();
+ });
+
+ this.checkLocalStorageFilter();
}
/**
@@ -86,6 +98,9 @@ export class PlansComponent implements OnInit {
* @memberof PlansComponent
*/
public getAllPlans() {
+ this.getPlansStates();
+ localStorage.setItem("planListFilter", JSON.stringify(this.getAllPlansPostRequest));
+ localStorage.setItem("planPaginationFilter", JSON.stringify(this.getAllPlansRequest));
this.plansService.getAllPlans(this.getAllPlansRequest, this.getAllPlansPostRequest).subscribe(res => {
if (res.status === 'success') {
this.plansData = res.body;
@@ -163,7 +178,7 @@ export class PlansComponent implements OnInit {
if (dates !== null && !this.defaultLoad) {
this.getAllPlansPostRequest.createdAtFrom = moment(dates[0]).format("DD-MM-YYYY");
this.getAllPlansPostRequest.createdAtTo = moment(dates[1]).format("DD-MM-YYYY");
- this.getPlansStats();
+ // this.getPlansStates();
this.getAllPlans();
}
@@ -188,23 +203,6 @@ export class PlansComponent implements OnInit {
}, 200);
}
- /**
- * This function is used to get plans by search
- *
- * @memberof PlansComponent
- */
- public columnSearch(): void {
- if (this.timeout) {
- clearTimeout(this.timeout);
- }
-
- this.timeout = setTimeout(() => {
- this.getAllPlansRequest.page = 1;
- this.getPlansStats();
- this.getAllPlans();
- }, 700);
- }
-
/**
* This function is used to hide aside popup
*
@@ -213,7 +211,7 @@ export class PlansComponent implements OnInit {
public hidePopup() {
this.togglePanelBool = false;
this.getAllPlansRequest.page = 1;
- this.getPlansStats();
+ // this.getPlansStates();
this.getAllPlans();
this.toggleBodyClass();
}
@@ -226,7 +224,7 @@ export class PlansComponent implements OnInit {
public hidePlanDetailsPopup() {
this.selectedPlan = '';
this.togglePlanDetailsPanelBool = false;
- this.getPlansStats();
+ // this.getPlansStates();
this.getAllPlans();
this.toggleBodyClass();
}
@@ -247,7 +245,7 @@ export class PlansComponent implements OnInit {
res.additional = false;
});
this.selectAllColumns(true);
- this.getPlansStats();
+ // this.getPlansStates();
this.getAllPlans();
}
@@ -282,10 +280,10 @@ export class PlansComponent implements OnInit {
*
* @memberof PlansComponent
*/
- public getPlansStats() {
- this.plansService.getPlansStats(this.getAllPlansPostRequest).subscribe(res => {
+ public getPlansStates() {
+ this.plansService.getPlansStates(this.getAllPlansPostRequest).subscribe(res => {
if (res.status === 'success') {
- this.planStats = res.body;
+ this.planStates = res.body;
}
});
}
@@ -298,10 +296,12 @@ export class PlansComponent implements OnInit {
public getOnboardCountries() {
this.authenticationService.getCountry().subscribe(res => {
if (res.status === 'success') {
+ this.countrySource = [];
if (res.body && res.body.length > 0) {
res.body.forEach(key => {
this.countrySource.push({ label: key.countryName, value: key.alpha2CountryCode, additional: false });
});
+ this.checkLocalStorageFilter();
}
} else {
this.toaster.clearAllToaster();
@@ -346,7 +346,7 @@ export class PlansComponent implements OnInit {
}
this.isAllCountriesSelected();
this.getAllPlansPostRequest.countries = this.selectedCountries;
- this.getPlansStats();
+ // this.getPlansStates();
this.getAllPlans();
}
@@ -368,7 +368,7 @@ export class PlansComponent implements OnInit {
}
this.getAllPlansPostRequest.countries = this.selectedCountries;
this.isAllCountriesSelected();
- this.getPlansStats();
+ // this.getPlansStates();
this.getAllPlans();
}
@@ -471,15 +471,15 @@ export class PlansComponent implements OnInit {
this.updateColumnFilter();
}
- /**
- *To check all column filter applied true
- *
- * @memberof PlansComponent
- */
+ /**
+ *To check all column filter applied true
+ *
+ * @memberof PlansComponent
+ */
public isAllColumnFilterApplied(): void {
this.isAllFieldColumnFilterApplied = Object.keys(this.showFieldFilter).every((k) => this.showFieldFilter[k]);
}
-
+
/**
* To get count of colspan
@@ -494,4 +494,35 @@ export class PlansComponent implements OnInit {
}
});
}
+
+
+ /**
+ * To check local storage filter available
+ *
+ * @memberof PlansComponent
+ */
+ public checkLocalStorageFilter(): void {
+ let planFilter = localStorage.getItem("planListFilter");
+ let planPaginationFilter = localStorage.getItem("planPaginationFilter");
+ if (planFilter || planPaginationFilter) {
+ let retrievedUserFilterObject = JSON.parse(planFilter);
+ let retrievedUserPaginationFilterObject = JSON.parse(planPaginationFilter);
+ this.getAllPlansPostRequest = retrievedUserFilterObject;
+ this.getAllPlansRequest = retrievedUserPaginationFilterObject;
+
+ if (this.getAllPlansPostRequest && this.getAllPlansPostRequest.countries && this.getAllPlansPostRequest.countries.length > 0) {
+ this.selectedCountries = this.getAllPlansPostRequest.countries;
+ this.countrySource.map(res => {
+ res.additional = this.selectedCountries.includes(res.label);
+ });
+ this.isAllCountriesSelected();
+ }
+ this.getAllPlans();
+ } else {
+ this.getAllPlansRequest.page = 1;
+ this.getAllPlansRequest.sortBy = '';
+ this.getAllPlansRequest.sortType = '';
+ this.getAllPlans();
+ }
+ }
}
\ No newline at end of file
diff --git a/apps/web-giddh-admin/src/app/plans/plans.module.ts b/apps/web-giddh-admin/src/app/plans/plans.module.ts
index ddb0382..dea249d 100644
--- a/apps/web-giddh-admin/src/app/plans/plans.module.ts
+++ b/apps/web-giddh-admin/src/app/plans/plans.module.ts
@@ -2,9 +2,6 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar';
-import { BsDatepickerModule } from 'ngx-bootstrap/datepicker';
-import { PaginationModule } from 'ngx-bootstrap/pagination';
-import { TooltipModule } from 'ngx-bootstrap/tooltip';
import { PlansRoutingModule } from './plans-routing.module';
import { PlansComponent } from './plans-component/plans.component';
import { CreatePlansComponent } from './components/create-plans/create-plans.component';
@@ -13,6 +10,9 @@ import { ShSelectModule } from '../theme/ng-virtual-select/sh-select.module';
import { ClickOutsideModule } from 'ng-click-outside';
import { MatSelectModule } from '@angular/material/select';
import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
+import { BsDatepickerModule } from 'ngx-bootstrap/datepicker';
+import { PaginationModule } from 'ngx-bootstrap/pagination';
+import { TooltipModule } from 'ngx-bootstrap/tooltip';
diff --git a/apps/web-giddh-admin/src/app/services/general.service.ts b/apps/web-giddh-admin/src/app/services/general.service.ts
index 3a4ba6a..3ca92b0 100644
--- a/apps/web-giddh-admin/src/app/services/general.service.ts
+++ b/apps/web-giddh-admin/src/app/services/general.service.ts
@@ -52,4 +52,23 @@ export class GeneralService {
this.router.navigate(['login']);
}
+ /**
+ * To clear local storage filtered data
+ *
+ * @memberof GeneralService
+ */
+ public clearCacheStoredFilter(): void {
+ localStorage.removeItem('userListFilter');
+ localStorage.removeItem('userPaginationFilter');
+
+ localStorage.removeItem('licensePaginationFilter');
+
+ localStorage.removeItem('planPaginationFilter');
+ localStorage.removeItem('planListFilter');
+
+ localStorage.removeItem('companyListFilter');
+ localStorage.removeItem('companyPaginationFilter');
+
+ }
+
}
diff --git a/apps/web-giddh-admin/src/app/services/plan.service.ts b/apps/web-giddh-admin/src/app/services/plan.service.ts
index 212eb90..4bc816d 100644
--- a/apps/web-giddh-admin/src/app/services/plan.service.ts
+++ b/apps/web-giddh-admin/src/app/services/plan.service.ts
@@ -75,7 +75,7 @@ export class PlansService {
}), catchError((e) => this.errorHandler.HandleCatch(e)));
}
- public getPlansStats(request: any) {
+ public getPlansStates(request: any) {
let url = this.config.apiUrl + PLANS_API.GET_PLAN_STATS;
return this.http.post(url, request).pipe(
map((res) => {
diff --git a/apps/web-giddh-admin/src/app/subscription/components/edit-subscriptions/edit-subscriptions.component.html b/apps/web-giddh-admin/src/app/subscription/components/edit-subscriptions/edit-subscriptions.component.html
index fb39f0a..5de7f45 100644
--- a/apps/web-giddh-admin/src/app/subscription/components/edit-subscriptions/edit-subscriptions.component.html
+++ b/apps/web-giddh-admin/src/app/subscription/components/edit-subscriptions/edit-subscriptions.component.html
@@ -138,17 +138,16 @@ {{plansData?.subscription?.planDetails?.amount}}/-
-->
-
-
-
+
@@ -638,7 +637,9 @@ {{plansData?.subscription?.planDetails?.amount}}/-
- No records found. |
+
+ No records found.
+ |
diff --git a/apps/web-giddh-admin/src/app/subscription/components/edit-subscriptions/edit-subscriptions.component.ts b/apps/web-giddh-admin/src/app/subscription/components/edit-subscriptions/edit-subscriptions.component.ts
index f135ab4..ea69b78 100644
--- a/apps/web-giddh-admin/src/app/subscription/components/edit-subscriptions/edit-subscriptions.component.ts
+++ b/apps/web-giddh-admin/src/app/subscription/components/edit-subscriptions/edit-subscriptions.component.ts
@@ -10,7 +10,6 @@ import { AdminActions } from '../../../actions/admin.actions';
import { CommonPaginatedRequest, SubscriberList, AuditLogsRequest, GetAllCompaniesRequest, PAGINATION_COUNT, StatusModel, CompanyAdvanceSearchRequestSubscriptions } from '../../../modules/modules/api-modules/subscription';
import { SubscriptionService } from '../../../services/subscription.service';
import { ToasterService } from '../../../services/toaster.service';
-import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';
import { IOption } from '../../../theme/ng-select/ng-select';
import { PlansService } from '../../../services/plan.service';
import * as moment from 'moment/moment';
@@ -20,6 +19,7 @@ import { FavouriteColumnPageTypeEnum } from '../../../actions/general/general.co
import { ColumnFilterService } from '../../../services/column-filter.service';
import { cloneDeep } from '../../../lodash-optimized';
import { BsDropdownDirective } from "ngx-bootstrap/dropdown";
+import { BsModalRef, BsModalService } from "ngx-bootstrap/modal";
@Component({
selector: 'edit-subscription',
@@ -58,7 +58,7 @@ export class EditSubscriptionsComponent implements OnInit {
public showFieldFilter: CompanyFieldFilterColumnNames = new CompanyFieldFilterColumnNames();
public isFieldColumnFilterApplied: boolean;
public isAllFieldColumnFilterApplied: boolean;
- public getAllCompaniesRequest:GetAllCompaniesRequest = new GetAllCompaniesRequest();
+ public getAllCompaniesRequest: GetAllCompaniesRequest = new GetAllCompaniesRequest();
public planStatusType: StatusModel = {
trial: false,
active: false,
@@ -91,8 +91,6 @@ export class EditSubscriptionsComponent implements OnInit {
public isAllPlanSelected: boolean = false;
public isAllPlanTypeSelected: boolean = false;
public searchedAdvancedRequestModelByAdvanceSearch: CompanyAdvanceSearchRequestSubscriptions;
- /** Local storage to save filter */
- public localStorageKeysForFilters = { pageType: 'pageTypeName', filter: 'Columnfilter' };
public totalCompanies: number;
public totalUser: number;
public timeoutLastCompanyAccess: any;
@@ -184,6 +182,15 @@ export class EditSubscriptionsComponent implements OnInit {
});
this.getColumnFilter();
this.getCompanyFooter();
+ let companyFilter = localStorage.getItem("companyListFilter");
+ let companyPaginationFilter = localStorage.getItem("companyPaginationFilter");
+
+ if (companyFilter) {
+ let retrievedCompanyFilterObject = JSON.parse(companyFilter);
+ }
+ if (companyPaginationFilter) {
+ let retrievedCompanyPaginationFilterObject = JSON.parse(companyPaginationFilter);
+ }
}
public getAllCompanies() {
@@ -194,6 +201,8 @@ export class EditSubscriptionsComponent implements OnInit {
this.showClearFilter = true;
}
this.getCompanyFooter();
+ localStorage.setItem("companyListFilter", JSON.stringify(this.getAllCompaniesRequest));
+ localStorage.setItem("companyPaginationFilter", JSON.stringify(this.paginationRequest));
this.subscriptionService.getAllCompanies(this.getAllCompaniesRequest, this.paginationRequest).subscribe(resp => {
if (resp) {
if (resp.status === 'success') {
@@ -941,5 +950,59 @@ export class EditSubscriptionsComponent implements OnInit {
days: '',
},
};
+
}
+
+ /**
+ *To check local storage filter available
+ *
+ * @memberof UserListComponent
+ */
+ // public checkLocalStorageFilter() {
+
+ // let companyListFilter = localStorage.getItem("companyListFilter");
+ // let companyPaginationFilter = localStorage.getItem("companyPaginationFilter");
+ // if (companyListFilter || companyPaginationFilter) {
+ // let retrievedCompanyListFilterrObject = JSON.parse(companyListFilter);
+ // let retrievedCompanyPaginationFilterObject = JSON.parse(companyPaginationFilter);
+ // this.getAllCompaniesRequest = retrievedCompanyListFilterrObject;
+ // this.paginationRequest = retrievedCompanyPaginationFilterObject;
+ // if (this.getAllCompaniesRequest && this.getAllCompaniesRequest.planUniqueNames && this.getAllCompaniesRequest.planUniqueNames.length > 0) {
+ // this.selectedPlans = this.getAllCompaniesRequest.planUniqueNames;
+ // this.allPlans.map(res => {
+ // res.additional = this.getAllCompaniesRequest.planUniqueNames.includes(res.value);
+ // });
+ // }
+ // if (this.getUserListPostRequest && this.getUserListPostRequest.status && this.getUserListPostRequest.status.length > 0) {
+ // this.selectedPlanStatus = this.getUserListPostRequest.status;
+ // this.planStatusType.active = this.planStatusType.expired = this.planStatusType.trial = false;
+ // this.selectedPlanStatus.forEach(res => {
+ // this.planStatusType[res] = true;
+ // });
+ // }
+ // if (this.getUserListPostRequest && this.getUserListPostRequest.countryCodes && this.getUserListPostRequest.countryCodes.length > 0) {
+ // this.selectedCountries = this.getUserListPostRequest.countryCodes;
+ // this.countrySource.map(res => {
+ // res.additional = this.getUserListPostRequest.countryCodes.includes(res.value);
+ // });
+ // }
+ // // if (this.getAllCompaniesRequest && this.getAllCompaniesRequest.lastSeen && this.getAllCompaniesRequest.lastSeen.operation) {
+ // // if (this.getAllCompaniesRequest.lastSeen.days) {
+ // // this.tempOperation = 'RELATIVE_' + this.getAllCompaniesRequest.lastSeen.operation;
+ // // } else if (this.getAllCompaniesRequest.lastSeen.from || this.getAllCompaniesRequest.lastSeen.to) {
+ // // this.tempOperation = 'ABSOLUTE_' + this.getAllCompaniesRequest.lastSeen.operation;
+ // // } else if (this.getAllCompaniesRequest.lastSeen.operation === 'UNAVAILABLE' || this.getAllCompaniesRequest.lastSeen.operation === 'AVAILABLE') {
+ // // this.tempOperation = this.getAllCompaniesRequest.lastSeen.operation;
+ // // }
+
+ // // }
+ // console.log('userListFilter', retrievedUserFilterObject);
+ // console.log('userPaginationFilter', retrievedUserPaginationFilterObject);
+ // this.getAllUserData();
+ // } else {
+ // this.getUserListPostRequest.lastSeen.operation = "BEFORE";
+ // this.tempOperation = "BEFORE";
+ // this.getAllUserData();
+ // }
+ // }
}
diff --git a/apps/web-giddh-admin/src/app/subscription/components/user-list/user-list.component.html b/apps/web-giddh-admin/src/app/subscription/components/user-list/user-list.component.html
index 0a953d7..425d9c9 100644
--- a/apps/web-giddh-admin/src/app/subscription/components/user-list/user-list.component.html
+++ b/apps/web-giddh-admin/src/app/subscription/components/user-list/user-list.component.html
@@ -126,260 +126,260 @@