mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-17 16:00:14 +01:00
feat(demo): add bundles section to material lending page (#5677)
Co-authored-by: d.strigo <d.strigo@akveo.com>
This commit is contained in:
parent
c416d894d4
commit
50b5696c3b
5 changed files with 38 additions and 13 deletions
|
|
@ -4,7 +4,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*/
|
||||
|
||||
import { AfterViewInit, Component, ElementRef, EventEmitter, Inject, Output } from '@angular/core';
|
||||
import { AfterViewInit, Component, ElementRef, EventEmitter, Inject, Input, Output } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
import { delay, filter, take } from 'rxjs/operators';
|
||||
|
|
@ -12,6 +12,7 @@ import { NB_WINDOW } from '@nebular/theme';
|
|||
|
||||
import {
|
||||
BUNDLE_LICENSE,
|
||||
STORE_PRODUCTS_URL,
|
||||
BundlesService,
|
||||
Feature,
|
||||
Product,
|
||||
|
|
@ -28,13 +29,22 @@ import { LicensePipe } from '../backend-bundles-section/license.pipe';
|
|||
export class BackendBundlesSectionComponent implements AfterViewInit {
|
||||
|
||||
@Output() loaded = new EventEmitter();
|
||||
@Input()
|
||||
set material(value: boolean | undefined) {
|
||||
if (value) {
|
||||
this.productUrl = STORE_PRODUCTS_URL.material;
|
||||
|
||||
this.getProducts();
|
||||
}
|
||||
}
|
||||
|
||||
selectedLicenseType = BUNDLE_LICENSE.personal;
|
||||
productUrl = STORE_PRODUCTS_URL.base;
|
||||
|
||||
licenses = Object.values(BUNDLE_LICENSE);
|
||||
|
||||
descriptions: Observable<Descriptions[]> = this.descriptionService.getBundleDescriptions();
|
||||
products: Observable<Product[]> = this.bundlesService.getProducts();
|
||||
products: Observable<Product[]>;
|
||||
features: Observable<Feature[]> = this.bundlesService.getFeatures();
|
||||
|
||||
constructor(private descriptionService: DescriptionsService,
|
||||
|
|
@ -43,6 +53,7 @@ export class BackendBundlesSectionComponent implements AfterViewInit {
|
|||
private el: ElementRef<HTMLElement>,
|
||||
@Inject(NB_WINDOW) private window,
|
||||
private licensePipe: LicensePipe) {
|
||||
this.getProducts();
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
|
|
@ -57,6 +68,10 @@ export class BackendBundlesSectionComponent implements AfterViewInit {
|
|||
});
|
||||
}
|
||||
|
||||
getProducts() {
|
||||
this.products = this.bundlesService.getProducts(this.productUrl);
|
||||
}
|
||||
|
||||
shouldShowOldPrice(variants: ProductVariant[], selectedLicenseType: string): boolean {
|
||||
const product = this.licensePipe.transform(variants, selectedLicenseType);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue