add admin navbar and brand/platform management components
This commit is contained in:
@@ -12,7 +12,6 @@ import {
|
||||
MatCardActions,
|
||||
MatCardContent,
|
||||
MatCardHeader,
|
||||
MatCardSubtitle,
|
||||
MatCardTitle
|
||||
} from "@angular/material/card";
|
||||
import {MatCheckbox} from "@angular/material/checkbox";
|
||||
@@ -24,7 +23,9 @@ import {MatOption, MatSelect} from '@angular/material/select';
|
||||
import {Router, RouterLink} from '@angular/router';
|
||||
import {Subscription} from 'rxjs';
|
||||
import {BrandService} from '../../services/brand/brand.service';
|
||||
import {Brand} from '../../models/brand/brand';
|
||||
import {Brand} from '../../interfaces/brand';
|
||||
import {PlatformService} from '../../services/platform/platform.service';
|
||||
import {Platform} from '../../interfaces/platform';
|
||||
|
||||
@Component({
|
||||
selector: 'app-add-product',
|
||||
@@ -36,7 +37,6 @@ import {Brand} from '../../models/brand/brand';
|
||||
MatCardActions,
|
||||
MatCardContent,
|
||||
MatCardHeader,
|
||||
MatCardSubtitle,
|
||||
MatCardTitle,
|
||||
MatCheckbox,
|
||||
MatDivider,
|
||||
@@ -60,11 +60,13 @@ export class AddProductComponent implements OnInit, OnDestroy {
|
||||
isLoading = false;
|
||||
|
||||
brands: Brand[] = [];
|
||||
platforms: Platform[] = [];
|
||||
|
||||
private readonly router: Router = inject(Router);
|
||||
|
||||
private addProductSubscription: Subscription | null = null;
|
||||
private readonly addProductSubscription: Subscription | null = null;
|
||||
private readonly brandService: BrandService = inject(BrandService);
|
||||
private readonly platformService = inject(PlatformService);
|
||||
|
||||
constructor(private readonly formBuilder: FormBuilder) {
|
||||
this.addProductForm = this.formBuilder.group({
|
||||
@@ -126,6 +128,18 @@ export class AddProductComponent implements OnInit, OnDestroy {
|
||||
console.log('Finished fetching brands:', this.brands);
|
||||
}
|
||||
});
|
||||
|
||||
this.platformService.getPlatforms().subscribe({
|
||||
next: (platforms) => {
|
||||
this.platforms = platforms;
|
||||
},
|
||||
error: (error) => {
|
||||
console.error('Error fetching platforms:', error);
|
||||
},
|
||||
complete: () => {
|
||||
console.log('Finished fetching platforms:', this.platforms);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
|
||||
Reference in New Issue
Block a user