Added CAD/USD pricing options

This commit is contained in:
2018-07-23 12:09:11 -04:00
parent 9645a6b81f
commit 7c9e272a86
4 changed files with 14 additions and 9 deletions

View File

@ -15,9 +15,14 @@
<textarea matInput rows="5" placeholder="Description" name="description" [(ngModel)]="description"></textarea>
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Price" type="number" name="price" [(ngModel)]="price">
<span matPrefix>$&nbsp;</span>
<input matInput placeholder="Price" type="number" name="price" [(ngModel)]="price">
<mat-hint *ngIf="!price" align="start">0 will display "Contact For Price"</mat-hint>
</mat-form-field>
<mat-radio-group [(ngModel)]="currency" name="currency">
<mat-radio-button value="CAD" class="pl-3">CAD</mat-radio-button>
<mat-radio-button value="USD" class="pl-3">USD</mat-radio-button>
</mat-radio-group>
<input #fileInput type="file" (change)="imageChanged()" hidden>
</form>
</mat-dialog-content>

View File

@ -11,8 +11,9 @@ export class NewProductComponent {
categories;
category;
name: string;
currency = 'CAD';
description: string;
name: string;
price: number = 0.0;
image: string;
@ -26,8 +27,9 @@ export class NewProductComponent {
if (data.product) {
this.category = data.product.category;
this.name = data.product.name;
this.currency = data.product.currency;
this.description = data.product.description;
this.name = data.product.name;
this.price = data.product.price;
}
}
@ -40,15 +42,14 @@ export class NewProductComponent {
submit() {
let newProduct = {
name: this.name,
category: this.category,
currency: this.currency,
description: this.description,
name: this.name,
price: Number(this.price)
};
if (this.image) newProduct['image'] = this.image;
console.log(newProduct.description);
if (!this.data.product) {
this.db
.collection('products')

View File

@ -12,7 +12,7 @@
</button>
</div>
<h2 class="roboto">{{product.name}}</h2>
<h5 *ngIf="product.price" class="text-muted">{{product.price | currency}}</h5>
<h5 *ngIf="product.price" class="text-muted">{{product.currency}} {{product.price | currency}}</h5>
<h5 *ngIf="!product.price" class="text-muted">Contact For Price</h5>
<hr class="ml-4" />
<p [innerHtml]="product.description"></p>