mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-16 15:40:11 +01:00
product dependente do input
This commit is contained in:
parent
7d6e86a85b
commit
19f6b2493c
5 changed files with 100 additions and 27 deletions
|
|
@ -8,30 +8,31 @@ export class Product {
|
||||||
description!: string;
|
description!: string;
|
||||||
conditionId!: string;
|
conditionId!: string;
|
||||||
price!: number;
|
price!: number;
|
||||||
countryId!: string | null;
|
previousPrice?: number;
|
||||||
stateId!: string | null;
|
countryId?: string;
|
||||||
cityId!: string | null;
|
stateId?: string;
|
||||||
neighbourhoodId!: string | null;
|
cityId?: string;
|
||||||
zip_code!: string | null;
|
neighbourhoodId?: string;
|
||||||
|
zip_code?: string;
|
||||||
createdAt!: Date;
|
createdAt!: Date;
|
||||||
approvedAt!: Date | null;
|
approvedAt?: Date;
|
||||||
updatedAt!: Date | null;
|
updatedAt?: Date;
|
||||||
isActive!: boolean;
|
isActive!: boolean;
|
||||||
isPromoted!: boolean;
|
isPromoted!: boolean;
|
||||||
viewCount!: number | null;
|
viewCount?: number;
|
||||||
//user?: User;
|
//user?: User;
|
||||||
//category?: Category;
|
//category?: Category;
|
||||||
//sub_category?: SubCategory;
|
//sub_category?: SubCategory;
|
||||||
//brand?: Brand;
|
//brand?: Brand;
|
||||||
//condition?: Condition;
|
//condition?: Condition;
|
||||||
//country?: Country | null;
|
//country?: Country;
|
||||||
//state?: State | null;
|
//state?: State;
|
||||||
//city?: City | null;
|
//city?: City;
|
||||||
//neighbourhood?: Neighbourhood | null;
|
//neighbourhood?: Neighbourhood;
|
||||||
//favorites?: Array<Favorite>;
|
//favorites?: Array<Favorite>;
|
||||||
//comments?: Array<Comment>;
|
//comments?: Array<Comment>;
|
||||||
//img_urls?: Array<ProductImg>;
|
img_urls?: Array<string>;
|
||||||
//report?: Report | null;
|
//report?: Report;
|
||||||
//shares?: Array<Share>;
|
//shares?: Array<Share>;
|
||||||
//_count?: ProductCount;
|
//_count?: ProductCount;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex flex-row flex-nowrap overflow-auto">
|
<div class="d-flex flex-row flex-nowrap overflow-auto">
|
||||||
<div *ngFor="let product of products" class="card-col">
|
<div *ngFor="let product of products" class="card-col">
|
||||||
<ngx-home-product></ngx-home-product>
|
<ngx-home-product [product]="product"></ngx-home-product>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ export class HomeComponent implements OnDestroy {
|
||||||
private destroy$: Subject<void> = new Subject<void>();
|
private destroy$: Subject<void> = new Subject<void>();
|
||||||
banners: Banner[];
|
banners: Banner[];
|
||||||
categories: Category[];
|
categories: Category[];
|
||||||
products: any[];
|
products: Product[];
|
||||||
paidAds: any[];
|
paidAds: any[];
|
||||||
|
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
|
@ -78,7 +78,62 @@ export class HomeComponent implements OnDestroy {
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
this.products = [1,1,1,1,1,1]
|
this.products = [{
|
||||||
|
id: "1",
|
||||||
|
userId: "1",
|
||||||
|
categoryId: "1",
|
||||||
|
sub_categoryId: "1",
|
||||||
|
brandId: "1",
|
||||||
|
name: "Maquina de lavar roupa 14kg sper blaster",
|
||||||
|
description: "",
|
||||||
|
conditionId: "1",
|
||||||
|
price: 3458.10,
|
||||||
|
previousPrice: 4458.10,
|
||||||
|
createdAt: new Date(),
|
||||||
|
isActive: true,
|
||||||
|
isPromoted: true,
|
||||||
|
viewCount: 0,
|
||||||
|
img_urls: [
|
||||||
|
"https://img.olx.com.br/images/89/890461810585731.webp"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "1",
|
||||||
|
userId: "1",
|
||||||
|
categoryId: "1",
|
||||||
|
sub_categoryId: "1",
|
||||||
|
brandId: "1",
|
||||||
|
name: "Maquina de lavar roupa 14kg sper blaster 2",
|
||||||
|
description: "",
|
||||||
|
conditionId: "1",
|
||||||
|
price: 3458.10,
|
||||||
|
previousPrice: 4458.10,
|
||||||
|
createdAt: new Date(),
|
||||||
|
isActive: true,
|
||||||
|
isPromoted: false,
|
||||||
|
viewCount: 0,
|
||||||
|
img_urls: [
|
||||||
|
"https://img.olx.com.br/images/89/890461810585731.webp"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "1",
|
||||||
|
userId: "1",
|
||||||
|
categoryId: "1",
|
||||||
|
sub_categoryId: "1",
|
||||||
|
brandId: "1",
|
||||||
|
name: "Maquina de lavar roupa 14kg sper blaster 3",
|
||||||
|
description: "",
|
||||||
|
conditionId: "1",
|
||||||
|
price: 3458.10,
|
||||||
|
createdAt: new Date(),
|
||||||
|
isActive: true,
|
||||||
|
isPromoted: true,
|
||||||
|
viewCount: 0,
|
||||||
|
img_urls: [
|
||||||
|
"https://img.olx.com.br/images/89/890461810585731.webp"
|
||||||
|
]
|
||||||
|
}]
|
||||||
|
|
||||||
this.paidAds = [1,1,1]
|
this.paidAds = [1,1,1]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,30 @@
|
||||||
<nb-card>
|
<nb-card class="product" *ngIf="product">
|
||||||
<nb-card-header class="card-img-top">
|
<nb-card-header class="card-img-top">
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<img src="https://img.olx.com.br/images/89/890461810585731.webp" />
|
<img [src]="product.img_urls[0]" />
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<span class="badge">Destaque</span>
|
<span *ngIf="product.isPromoted" class="badge">Destaque</span>
|
||||||
</nb-card-header>
|
</nb-card-header>
|
||||||
<nb-card-body>
|
<nb-card-body>
|
||||||
<h5 class="card-title">Bioledz 38400 - 800 watts</h5>
|
<h5 class="card-title">{{ product.name }}</h5>
|
||||||
<p class="card-text">R$ 3.475,99</p>
|
<p class="card-text">
|
||||||
|
{{ product.price | currency : "BRL" }}
|
||||||
|
<small *ngIf="product.previousPrice" class="ml-2 text-muted" style="text-decoration: line-through">{{ product.previousPrice | currency : "BRL" }}</small>
|
||||||
|
</p>
|
||||||
</nb-card-body>
|
</nb-card-body>
|
||||||
<ul class="list-group list-group-flush">
|
<ul class="list-group list-group-flush mb-3">
|
||||||
<li class="list-group-item">An item</li>
|
<li class="list-group-item">
|
||||||
|
<p class="card-text mb-1">
|
||||||
|
<i class="fa fa-map-pin mr-2"></i>
|
||||||
|
<small class="text-muted">São Paulo</small>
|
||||||
|
</p>
|
||||||
|
<p class="card-text">
|
||||||
|
<small class="text-muted">{{
|
||||||
|
product.createdAt | date : "dd/MM/yyyy HH:mm"
|
||||||
|
}}</small>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nb-card>
|
</nb-card>
|
||||||
|
|
@ -2,6 +2,10 @@
|
||||||
@import 'bootstrap/scss/mixins/breakpoints';
|
@import 'bootstrap/scss/mixins/breakpoints';
|
||||||
@import '@nebular/theme/styles/global/breakpoints';
|
@import '@nebular/theme/styles/global/breakpoints';
|
||||||
|
|
||||||
|
.product {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
.card-img-top {
|
.card-img-top {
|
||||||
font-size: 1.125rem;
|
font-size: 1.125rem;
|
||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
|
|
@ -73,3 +77,4 @@
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
padding: 4px 8px;
|
padding: 4px 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue