diff --git a/apps/web-giddh-admin/src/app/header/header.component.ts b/apps/web-giddh-admin/src/app/header/header.component.ts index af5eece..c262c2d 100644 --- a/apps/web-giddh-admin/src/app/header/header.component.ts +++ b/apps/web-giddh-admin/src/app/header/header.component.ts @@ -60,6 +60,8 @@ export class HeaderComponent implements OnInit { public clearData() { this.generalService.clearUserSession(); + // To clear all stored local storage filter + this.generalService.clearCacheStoredFilter(); } public getCompaniesList() { diff --git a/apps/web-giddh-admin/src/app/licence-key/licence-key-component/licence-key.component.html b/apps/web-giddh-admin/src/app/licence-key/licence-key-component/licence-key.component.html index e54fc4a..8c95210 100644 --- a/apps/web-giddh-admin/src/app/licence-key/licence-key-component/licence-key.component.html +++ b/apps/web-giddh-admin/src/app/licence-key/licence-key-component/licence-key.component.html @@ -140,7 +140,7 @@

No records found.

- +
diff --git a/apps/web-giddh-admin/src/app/licence-key/licence-key-component/licence-key.component.ts b/apps/web-giddh-admin/src/app/licence-key/licence-key-component/licence-key.component.ts index 3ca1317..da9d952 100644 --- a/apps/web-giddh-admin/src/app/licence-key/licence-key-component/licence-key.component.ts +++ b/apps/web-giddh-admin/src/app/licence-key/licence-key-component/licence-key.component.ts @@ -1,7 +1,6 @@ import { Component, OnInit, ViewChild } from '@angular/core'; import { LicenceService } from '../../services/licence.service'; import { SubscriberList, PAGINATION_COUNT } from '../../modules/modules/api-modules/subscription'; -import { BsModalService, BsModalRef } from 'ngx-bootstrap/modal'; import { GeneralService } from '../../services/general.service'; import { Router } from '@angular/router'; import { FavouriteColumnPageTypeEnum } from '../../actions/general/general.const'; @@ -9,6 +8,7 @@ import { ColumnFilterService } from '../../services/column-filter.service'; import { ToasterService } from '../../services/toaster.service'; import { cloneDeep } from '../../lodash-optimized'; import { LicenseFieldFilterColumnNames } from '../../models/company'; +import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal'; import { BsDropdownDirective } from 'ngx-bootstrap/dropdown'; @Component({ @@ -47,9 +47,11 @@ export class LicenceKeyComponent implements OnInit { this.generalService.setCurrentPageTitle("License Keys"); this.getAllLicenceKeyRequest.count = PAGINATION_COUNT; this.getAllLicenceKeyRequest.page = 1; - this.getAllLicenceKey(); + /** To get dynamic column filter */ this.getColumnFilter(); + /** To check local storage filter available */ + this.checkLocalStorageFilter(); } /** @@ -58,6 +60,8 @@ export class LicenceKeyComponent implements OnInit { * @memberof LicenceKeyComponent */ public getAllLicenceKey() { + + localStorage.setItem("licensePaginationFilter", JSON.stringify(this.getAllLicenceKeyRequest)); this.licenseService.getAllLicenseKeys(this.getAllLicenceKeyRequest).subscribe(res => { if (res.status === 'success') { this.LicenceKeyRes = res.body; @@ -261,4 +265,21 @@ export class LicenceKeyComponent implements OnInit { } }); } + + /** + *To check local storage filter available + * + * @memberof UserListComponent + */ + public checkLocalStorageFilter() { + + let licensePaginationFilter = localStorage.getItem("licensePaginationFilter"); + if (licensePaginationFilter) { + let retrievedLicensePaginationFilterObject = JSON.parse(licensePaginationFilter); + this.getAllLicenceKeyRequest = retrievedLicensePaginationFilterObject; + this.getAllLicenceKey(); + } else { + this.getAllLicenceKey(); + } + } } \ No newline at end of file diff --git a/apps/web-giddh-admin/src/app/licence-key/licence-key.module.ts b/apps/web-giddh-admin/src/app/licence-key/licence-key.module.ts index 4d5490c..1363780 100644 --- a/apps/web-giddh-admin/src/app/licence-key/licence-key.module.ts +++ b/apps/web-giddh-admin/src/app/licence-key/licence-key.module.ts @@ -2,14 +2,14 @@ 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 { BsDropdownModule } from 'ngx-bootstrap/dropdown'; -import { TooltipModule } from 'ngx-bootstrap/tooltip'; import { LicenceKeyRoutingModule } from './licence-key-routing.module'; import { LicenceKeyComponent } from './licence-key-component/licence-key.component'; import { GenerateKeyComponent } from './components/generate-key/generate-key.component'; import { ShSelectModule } from '../theme/ng-virtual-select/sh-select.module'; +import { BsDatepickerModule } from 'ngx-bootstrap/datepicker'; +import { BsDropdownModule } from 'ngx-bootstrap/dropdown'; +import { PaginationModule } from 'ngx-bootstrap/pagination'; +import { TooltipModule } from 'ngx-bootstrap/tooltip'; @NgModule({ declarations: [LicenceKeyComponent, GenerateKeyComponent], diff --git a/apps/web-giddh-admin/src/app/login/login.module.ts b/apps/web-giddh-admin/src/app/login/login.module.ts index b1aa649..160e900 100644 --- a/apps/web-giddh-admin/src/app/login/login.module.ts +++ b/apps/web-giddh-admin/src/app/login/login.module.ts @@ -2,10 +2,10 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar'; -import { BsDatepickerModule } from 'ngx-bootstrap/datepicker'; import { LoginComponent } from './login.component' import { LoginRoutingModule } from './login-routing.module'; +import { BsDatepickerModule } from 'ngx-bootstrap/datepicker'; diff --git a/apps/web-giddh-admin/src/app/plans/components/create-plans/create-plans.component.html b/apps/web-giddh-admin/src/app/plans/components/create-plans/create-plans.component.html index d8aa56f..0836a53 100644 --- a/apps/web-giddh-admin/src/app/plans/components/create-plans/create-plans.component.html +++ b/apps/web-giddh-admin/src/app/plans/components/create-plans/create-plans.component.html @@ -1,52 +1,138 @@ -
-
-
-

Create Plan

- -
-
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
- -
- - -
-
- - -
-
- - -
-
- - -
- -
-
-
\ No newline at end of file +
+
+
+

Create Plan

+ +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
diff --git a/apps/web-giddh-admin/src/app/plans/plans-component/plans.component.html b/apps/web-giddh-admin/src/app/plans/plans-component/plans.component.html index 59ee0e4..4ab0edc 100644 --- a/apps/web-giddh-admin/src/app/plans/plans-component/plans.component.html +++ b/apps/web-giddh-admin/src/app/plans/plans-component/plans.component.html @@ -74,14 +74,14 @@ -
+
Plan Name
-
- +
+
@@ -95,7 +95,7 @@ Total Amount - Expiry in next 30 days + Expiry in next 30 days @@ -135,7 +135,9 @@ -

No records found.

+ +

No records found.

+ @@ -143,7 +145,7 @@
- +
@@ -151,7 +153,7 @@
-

{{planStats?.commonPlans}}

+

{{planStates?.commonPlans}}

Common Plans

@@ -159,7 +161,7 @@

{{planStats?.commonPlans}}

-

{{planStats?.adminPlans}}

+

{{planStates?.adminPlans}}

Admin Plans

@@ -167,7 +169,7 @@

{{planStats?.adminPlans}}

-

{{planStats?.totalPlans}}

+

{{planStates?.totalPlans}}

Total Plans

@@ -175,7 +177,7 @@

{{planStats?.totalPlans}}

-

{{planStats?.paidPlans}}

+

{{planStates?.paidPlans}}

Paid Plans

@@ -183,7 +185,7 @@

{{planStats?.paidPlans}}

-

{{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}}/-

--> - - -
-
- Back -
-
+
@@ -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 @@
-
- -
+
diff --git a/apps/web-giddh-admin/src/app/subscription/components/user-list/user-list.component.ts b/apps/web-giddh-admin/src/app/subscription/components/user-list/user-list.component.ts index 398850a..92ade61 100644 --- a/apps/web-giddh-admin/src/app/subscription/components/user-list/user-list.component.ts +++ b/apps/web-giddh-admin/src/app/subscription/components/user-list/user-list.component.ts @@ -1,7 +1,6 @@ import { Component, OnInit, ViewChild, Input } from '@angular/core'; import { Observable, Subject } from 'rxjs'; import { UserService } from '../../../services/user.service'; -import { BsModalService, BsModalRef } from 'ngx-bootstrap/modal'; import { SubscriberList, PAGINATION_COUNT, TotalUsersCount, CommonPaginatedRequest, StatusModel, TotalSubscribers } from '../../../modules/modules/api-modules/subscription'; import * as moment from 'moment/moment'; import { GeneralService } from '../../../services/general.service'; @@ -15,9 +14,10 @@ import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; import { cloneDeep } from '../../../lodash-optimized'; import { ColumnFilterService } from '../../../services/column-filter.service'; import { FavouriteColumnPageTypeEnum } from '../../../actions/general/general.const'; -import { BsDropdownDirective } from 'ngx-bootstrap/dropdown'; import { UserFieldFilterColumnNames } from '../../../models/company'; import { SubscriptionService } from '../../../services/subscription.service'; +import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal'; +import { BsDropdownDirective } from 'ngx-bootstrap/dropdown'; @Component({ selector: 'app-user-list', templateUrl: './user-list.component.html', @@ -71,7 +71,8 @@ export class UserListComponent implements OnInit { public timeoutLastSeen: any; public tempOperation: any = ""; @ViewChild("dp") public dp; - public adminUsersList: any; + /** Admin user list */ + public adminUsersList: any[] = []; public isAllOwnerSelected: boolean = false; public selectedOwners: string[] = []; public today: Date; @@ -121,11 +122,9 @@ export class UserListComponent implements OnInit { } constructor(private generalService: GeneralService, private userService: UserService, private modalService: BsModalService, private router: Router, private toaster: ToasterService, private plansService: PlansService, - private authenticationService: AuthenticationService, private columnFilterService: ColumnFilterService, private subscriptionService: SubscriptionService, ) { + private authenticationService: AuthenticationService, private columnFilterService: ColumnFilterService, private subscriptionService: SubscriptionService,) { this.today = new Date(); this.getUserListPostRequest.lastSeen = {} - this.getUserListPostRequest.lastSeen.operation = "BEFORE"; - this.tempOperation = "relative_before"; this.getAllAdminUsers(); } @@ -140,11 +139,16 @@ export class UserListComponent implements OnInit { this.getUserListRequest.page = 1; this.getUserListRequest.sortBy = ''; this.getUserListRequest.sortType = ''; - this.getAllUserData(); + // this.getAllUserData(); this.getAllSubscriptionTotalData(); this.getAllPlans(); this.getOnboardCountries(); + /** To check local storage filter available */ + this.checkLocalStorageFilter(); + + + /** Search using user name */ this.searchViaUserName$.pipe( debounceTime(1000), @@ -420,6 +424,8 @@ export class UserListComponent implements OnInit { */ public getAllUserData() { this.getAllSubscriptionTotalData(); + localStorage.setItem("userListFilter", JSON.stringify(this.getUserListPostRequest)); + localStorage.setItem("userPaginationFilter", JSON.stringify(this.getUserListRequest)); this.userService.getAllSubscriptionsByUser(this.getUserListRequest, this.getUserListPostRequest).subscribe(res => { if (res.status === 'success') { this.userlistRes = res.body; @@ -511,7 +517,7 @@ export class UserListComponent implements OnInit { */ public resetFilters() { this.bsValue = null; - this.tempOperation = 'relative_before'; + this.tempOperation = 'BEFORE'; this.getUserListPostRequest.lastSeen = {}; this.getUserListPostRequest.lastSeen.operation = 'relative_before'; this.getUserListPostRequest.lastSeen.from = ''; @@ -525,7 +531,7 @@ export class UserListComponent implements OnInit { this.getUserListPostRequest.mobile = ''; this.getUserListPostRequest.subscriptionId = ''; this.getUserListPostRequest.planUniqueNames = this.selectedPlans = []; - this.getUserListPostRequest.countryCodes = this.selectedCountries = []; + this.getUserListPostRequest.userCountryCodes = this.selectedCountries = []; this.getUserListPostRequest.status = this.selectedPlanStatus = []; this.getUserListPostRequest.startedAtFrom = ''; this.getUserListPostRequest.managerUniqueNames = []; @@ -534,6 +540,7 @@ export class UserListComponent implements OnInit { this.getUserListPostRequest.expiry = ''; this.inlineSearch = null; this.getUserListPostRequest.transactionLimitField = ''; + this.getUserListPostRequest.transactionLimit = ''; this.getUserListPostRequest.remainingTxn = ''; this.getUserListPostRequest.addOnTxn = ''; this.getUserListPostRequest.ratePerExtraTxn = ''; @@ -736,11 +743,12 @@ export class UserListComponent implements OnInit { this.getAllPlansRequest.sortBy = ''; this.getAllPlansRequest.sortType = ''; this.plansService.getAllPlans(this.getAllPlansRequest, this.getAllPlansPostRequest).subscribe(res => { + this.allPlans = []; if (res.status === 'success') { - this.allPlans = []; res.body.results.forEach(key => { this.allPlans.push({ label: key.name, value: key.uniqueName, additional: false }); }); + this.checkLocalStorageFilter(); } else { this.toaster.clearAllToaster(); this.toaster.errorToast("Something went wrong in getting plans! Please try again."); @@ -930,7 +938,7 @@ export class UserListComponent implements OnInit { }); } this.isAllCountriesSelected(); - this.getUserListPostRequest.countryCodes = this.selectedCountries; + this.getUserListPostRequest.userCountryCodes = this.selectedCountries; this.getAllUserData(); // this.getAllPlans(); } @@ -952,7 +960,7 @@ export class UserListComponent implements OnInit { let index = this.selectedCountries.indexOf(item.value); this.selectedCountries.splice(index, 1); } - this.getUserListPostRequest.countryCodes = this.selectedCountries; + this.getUserListPostRequest.userCountryCodes = this.selectedCountries; this.isAllCountriesSelected(); this.getAllUserData(); // this.getAllPlans(); @@ -1159,4 +1167,61 @@ export class UserListComponent implements OnInit { } }); } + + /** + *To check local storage filter available + * + * @memberof UserListComponent + */ + public checkLocalStorageFilter(): void { + + let userFilter = localStorage.getItem("userListFilter"); + let userPaginationFilter = localStorage.getItem("userPaginationFilter"); + if (userFilter || userPaginationFilter) { + let retrievedUserFilterObject = JSON.parse(userFilter); + let retrievedUserPaginationFilterObject = JSON.parse(userPaginationFilter); + this.getUserListPostRequest = retrievedUserFilterObject; + this.getUserListRequest = retrievedUserPaginationFilterObject; + if (this.getUserListPostRequest && this.getUserListPostRequest.planUniqueNames && this.getUserListPostRequest.planUniqueNames.length > 0) { + this.selectedPlans = this.getUserListPostRequest.planUniqueNames; + this.allPlans.map(res => { + res.additional = this.getUserListPostRequest.planUniqueNames.includes(res.value); + }); + } + if (this.getUserListPostRequest && this.getUserListPostRequest.managerUniqueNames && this.getUserListPostRequest.managerUniqueNames.length > 0) { + this.selectedOwners = this.getUserListPostRequest.managerUniqueNames; + this.adminUsersList.map(res => { + res.additional = this.getUserListPostRequest.managerUniqueNames.includes(res.uniqueName); + }); + } + 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.getUserListPostRequest && this.getUserListPostRequest.lastSeen && this.getUserListPostRequest.lastSeen.operation) { + if (this.getUserListPostRequest.lastSeen.days) { + this.tempOperation = 'RELATIVE_' + this.getUserListPostRequest.lastSeen.operation; + } else if (this.getUserListPostRequest.lastSeen.from || this.getUserListPostRequest.lastSeen.to) { + this.tempOperation = 'ABSOLUTE_' + this.getUserListPostRequest.lastSeen.operation; + } else if (this.getUserListPostRequest.lastSeen.operation === 'UNAVAILABLE' || this.getUserListPostRequest.lastSeen.operation === 'AVAILABLE') { + this.tempOperation = this.getUserListPostRequest.lastSeen.operation; + } + + } + this.getAllUserData(); + } else { + this.getUserListPostRequest.lastSeen.operation = "BEFORE"; + this.tempOperation = "BEFORE"; + this.getAllUserData(); + } + } } \ No newline at end of file diff --git a/apps/web-giddh-admin/src/app/subscription/subscription.module.ts b/apps/web-giddh-admin/src/app/subscription/subscription.module.ts index 5b96f58..b3a1d32 100644 --- a/apps/web-giddh-admin/src/app/subscription/subscription.module.ts +++ b/apps/web-giddh-admin/src/app/subscription/subscription.module.ts @@ -6,9 +6,6 @@ import { SubscriptionRoutingModule } from './subscription-routing.module'; import { SubscriptionComponent } from './subscription-component/subscription.component'; import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar'; import { UserListComponent } from './components/user-list/user-list.component'; -import { BsDatepickerModule } from 'ngx-bootstrap/datepicker'; -import { PaginationModule } from 'ngx-bootstrap/pagination'; -import { TooltipModule } from 'ngx-bootstrap/tooltip'; import { CompanyAdvanceSearchComponent } from './components/company-advance-search/company-advance-search.component'; import { AdvanceSearchComponent } from './components/advance-search/advance-search.component'; import { TabsModule } from 'ngx-bootstrap/tabs'; @@ -22,6 +19,9 @@ import { TimeAgoPipe } from 'time-ago-pipe'; import { UpdateTransactionsComponent } from './components/update-transactions/update-transactions.component'; import { ShSelectModule } from '../theme/ng-virtual-select/sh-select.module'; import { AssignPlanComponent } from './components/assign-plan/assign-plan.component'; +import { PaginationModule } from 'ngx-bootstrap/pagination'; +import { BsDatepickerModule } from 'ngx-bootstrap/datepicker'; +import { TooltipModule } from 'ngx-bootstrap/tooltip'; @NgModule({ declarations: [SubscriptionComponent, SubscriptionContainerComponent, UserListComponent, AdvanceSearchComponent, EditPlanModalComponent, EditSubscriptionsComponent, TimeAgoPipe, UpdateTransactionsComponent, AssignPlanComponent, CompanyAdvanceSearchComponent], diff --git a/apps/web-giddh-admin/src/assets/css/style-2.css b/apps/web-giddh-admin/src/assets/css/style-2.css index c3fa394..26df4b9 100644 --- a/apps/web-giddh-admin/src/assets/css/style-2.css +++ b/apps/web-giddh-admin/src/assets/css/style-2.css @@ -1176,11 +1176,15 @@ bs-datepicker-container { background: #eeeff9!important; } +.min-width-120 { + min-width: 120px !important; +} +.min-width-210 { + min-width: 210px !important; +} .min-width-110 { - min-width: 101px !important; + min-width: 110px !important; } - - /* .multiselect-dropdown { max-width: 200px !important; min-width: 200px !important;