mirror of
https://github.com/Mueller-Patrick/Betterzon.git
synced 2024-12-23 20:15:13 +00:00
Compare commits
No commits in common. "be534551bab4dafffc70ccfcfa0c79273dddf999" and "bf56d2b50944fe63c3547bb84e1a7596e51dcaea" have entirely different histories.
be534551ba
...
bf56d2b509
|
@ -38,7 +38,6 @@ import { CopyrightComponent } from './components/copyright/copyright.component';
|
|||
import { GreetingInfoSliderComponent } from './components/greeting-info-slider/greeting-info-slider.component';
|
||||
import { KundenComponent } from './components/kunden/kunden.component';
|
||||
import { AboutUsComponent } from './components/about-us/about-us.component';
|
||||
import { ProfileComponent } from './components/profile/profile.component';
|
||||
|
||||
// For cookie popup
|
||||
const cookieConfig: NgcCookieConsentConfig = {
|
||||
|
@ -103,7 +102,6 @@ const cookieConfig: NgcCookieConsentConfig = {
|
|||
GreetingInfoSliderComponent,
|
||||
KundenComponent,
|
||||
AboutUsComponent,
|
||||
ProfileComponent,
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
|
|
|
@ -11,7 +11,6 @@ import {ImprintComponent} from './pages/imprint/imprint.component';
|
|||
import {PrivacyComponent} from './pages/privacy/privacy.component';
|
||||
import {SigninComponent} from "./components/auth/signin/signin.component";
|
||||
import {RegistrationComponent} from "./components/auth/registration/registration.component";
|
||||
import {ProfileComponent} from "./components/profile/profile.component";
|
||||
|
||||
const routes: Routes = [
|
||||
{path: '', component: LandingpageComponent, pathMatch: 'full'},
|
||||
|
@ -22,7 +21,6 @@ const routes: Routes = [
|
|||
{path: 'signin', component: SigninComponent},
|
||||
{path: 'registration', component: RegistrationComponent},
|
||||
{path: "product-detail", component: ProductDetailPageComponent},
|
||||
{path: "profile", component: ProfileComponent},
|
||||
{path: '**', component: PageNotFoundPageComponent}
|
||||
];
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ export class SigninComponent implements OnInit {
|
|||
private isSignUpFailed: boolean;
|
||||
private errorMessage: '';
|
||||
|
||||
|
||||
constructor(
|
||||
private formBuilder: FormBuilder,
|
||||
private api: ApiService,
|
||||
|
@ -42,9 +43,10 @@ export class SigninComponent implements OnInit {
|
|||
this.api.loginUser(this.loginForm.value.username, this.loginForm.value.password)
|
||||
.subscribe(
|
||||
data => {
|
||||
this.router.navigate(['']);
|
||||
this.isSuccessful = true;
|
||||
this.isSignUpFailed = false;
|
||||
this.router.navigate(['']);
|
||||
this.api.saveSessionInfoToLocalStorage(data);
|
||||
},
|
||||
err => {
|
||||
this.errorMessage = err.error.message;
|
||||
|
|
|
@ -9,18 +9,18 @@
|
|||
<!-- Portfolio Grid Items-->
|
||||
<div class="row justify-content-center">
|
||||
<!-- Portfolio Item 1-->
|
||||
<div class="col-md-4 mx-auto my-5" *ngFor="let productId of bestDealsProductIds" (click)="clickedProduct(productId)">
|
||||
<div class="col-md-4 mx-auto my-5" *ngFor="let product of products" (click)="clickedProduct(product)">
|
||||
<div class="bbb_deals_wrapper">
|
||||
<div class="bbb_deals_image"><img src="https://www.mueller-patrick.tech/betterzon/images/{{productsPricesMap[productId]?.product.image_guid}}.jpg" alt=""></div>
|
||||
<div class="bbb_deals_image"><img src="https://www.mueller-patrick.tech/betterzon/images/{{product.image_guid}}.jpg" alt=""></div>
|
||||
<div class="bbb_deals_content">
|
||||
<div class="bbb_deals_info_line d-flex flex-row justify-content-start">
|
||||
<div class="bbb_deals_item_name">{{productsPricesMap[productId]?.product.name}}</div>
|
||||
<div class="bbb_deals_item_name">{{product.name}}</div>
|
||||
</div>
|
||||
<div class="bbb_deals_info_line d-flex flex-row justify-content-start">
|
||||
<div class="bbb_deals_item_category">Amazon: <span id="bbb_deals_item_price_a"><strike>{{productsPricesMap[productId]?.amazonPrice.price_in_cents}}$</strike></span></div>
|
||||
<div class="bbb_deals_item_category">Amazon: <span id="bbb_deals_item_price_a"><strike>{{product.price}}$</strike></span></div>
|
||||
</div>
|
||||
<div class="bbb_deals_info_line d-flex flex-row justify-content-start">
|
||||
<div class="bbb_deals_item_category">Plantshub: <span id="bbb_deals_item_price_b">{{productsPricesMap[productId]?.lowestPrice.price_in_cents}}</span></div>
|
||||
<div class="bbb_deals_item_category">Plantshub: <span id="bbb_deals_item_price_b">599,00$</span></div>
|
||||
</div>
|
||||
<div class="available_bar">
|
||||
<span style="width:17%"></span>
|
||||
|
|
|
@ -11,9 +11,6 @@ import {ActivatedRoute, Router} from '@angular/router';
|
|||
export class HotDealsWidgetComponent implements OnInit {
|
||||
|
||||
products: Product[] = [];
|
||||
bestDealsProductIds = [];
|
||||
amazonPrices = [];
|
||||
productsPricesMap: any = {};
|
||||
@Input() numberOfProducts: number;
|
||||
@Input() showProductPicture: boolean;
|
||||
@Input() searchQuery: string;
|
||||
|
@ -27,13 +24,12 @@ export class HotDealsWidgetComponent implements OnInit {
|
|||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
this.getBestDeals();
|
||||
this.loadParams();
|
||||
}
|
||||
|
||||
loadParams(): void {
|
||||
if (!this.numberOfProducts) {
|
||||
this.numberOfProducts = 9;
|
||||
this.numberOfProducts = 10;
|
||||
}
|
||||
if (!this.showProductPicture) {
|
||||
this.showProductPicture = false;
|
||||
|
@ -47,59 +43,26 @@ export class HotDealsWidgetComponent implements OnInit {
|
|||
|
||||
switch (this.type) {
|
||||
case 'search': {
|
||||
this.getSearchedProducts();
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
this.getProductsByIds();
|
||||
this.getAmazonPricesForBestDeals();
|
||||
this.getProducts();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getProductsByIds(): void {
|
||||
this.apiService.getProductsByIds(this.bestDealsProductIds).subscribe(
|
||||
products => {
|
||||
products.forEach(product => {
|
||||
this.productsPricesMap [product.product_id].product = product;
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
getBestDeals(): void {
|
||||
this.apiService.getBestDeals(9).subscribe(
|
||||
deals => {
|
||||
deals.forEach(deal => {
|
||||
this.bestDealsProductIds.push(deal.product_id);
|
||||
this.productsPricesMap [deal.product_id] = {lowestPrice: deal}
|
||||
});
|
||||
this.loadParams();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
getAmazonPricesForBestDeals(): void{
|
||||
this.bestDealsProductIds.forEach(id => {
|
||||
this.apiService.getAmazonPrice(id).subscribe(
|
||||
price => {
|
||||
this.amazonPrices.push(price);
|
||||
this.productsPricesMap[price.product_id].amazonPrice = price;
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
console.log(this.amazonPrices);
|
||||
getProducts(): void {
|
||||
this.apiService.getProducts().subscribe(products => this.products = products);
|
||||
}
|
||||
|
||||
getSearchedProducts(): void {
|
||||
this.apiService.getProductsByQuery(this.searchQuery).subscribe(products => this.products = products);
|
||||
}
|
||||
|
||||
clickedProduct(productId: string): void {
|
||||
this.router.navigate([('/product/' + productId)]);
|
||||
clickedProduct(product: Product): void {
|
||||
this.router.navigate([('/product/' + product.product_id)]);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
<div class="container" *ngIf="currentUser; else loggedOut">
|
||||
<p>
|
||||
<strong>e-mail</strong>
|
||||
{{ currentUser.email}}
|
||||
</p>
|
||||
<p>
|
||||
<strong>username:</strong>
|
||||
{{ currentUser.username}}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<ng-template #loggedOut>
|
||||
Please login.
|
||||
</ng-template>
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ProfileComponent } from './profile.component';
|
||||
|
||||
describe('ProfileComponent', () => {
|
||||
let component: ProfileComponent;
|
||||
let fixture: ComponentFixture<ProfileComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ProfileComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ProfileComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
|
@ -1,25 +0,0 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import {ApiService} from "../../services/api.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-profile',
|
||||
templateUrl: './profile.component.html',
|
||||
styleUrls: ['./profile.component.css']
|
||||
})
|
||||
export class ProfileComponent implements OnInit {
|
||||
|
||||
currentUser: any;
|
||||
obj:any
|
||||
|
||||
constructor(private api: ApiService ) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
this.api.getUserInfo().subscribe(
|
||||
user=> {
|
||||
this.currentUser = user
|
||||
console.log(this.currentUser);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
|
@ -15,7 +15,6 @@
|
|||
<li class="nav-item mx-0 mx-lg-1"><a class="nav-link py-3 px-0 px-lg-3 rounded" href="#unsere-kunden">Unsere Kunden</a></li>
|
||||
<li class="nav-item mx-0 mx-lg-1"><a class="nav-link py-3 px-0 px-lg-3 rounded" routerLink="/signin">Anmelden</a></li>
|
||||
<li class="nav-item mx-0 mx-lg-1"><a class="nav-link py-3 px-0 px-lg-3 rounded" routerLink="/registration">Konto Erstellen</a></li>
|
||||
<li class="nav-item mx-0 mx-lg-1"><a class="nav-link py-3 px-0 px-lg-3 rounded" routerLink="/registration">Log Out</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import {Component, OnInit} from '@angular/core';
|
||||
import {Router} from '@angular/router';
|
||||
import {ApiService} from "../../services/api.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-landingpage',
|
||||
|
@ -9,16 +8,13 @@ import {ApiService} from "../../services/api.service";
|
|||
})
|
||||
export class LandingpageComponent implements OnInit {
|
||||
searchInput: string;
|
||||
isLoggedIn = false;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private api: ApiService
|
||||
private router: Router
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
}
|
||||
|
||||
startedSearch(): void {
|
||||
|
@ -29,4 +25,5 @@ export class LandingpageComponent implements OnInit {
|
|||
this.router.navigateByUrl('/', {skipLocationChange: true}).then(() =>
|
||||
this.router.navigate([uri], queryParams));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user