Added create product

This commit is contained in:
2018-07-15 14:14:38 -04:00
parent b40064a068
commit ededc2c673
10 changed files with 113 additions and 21 deletions

View File

@ -0,0 +1,33 @@
<mat-dialog-content>
<h3 mat-dialog-title>
<span *ngIf="data.product">Update</span>
<span *ngIf="!data.product">Create</span> Product</h3>
<form id="createForm">
<mat-form-field class="w-100">
<input matInput placeholder="Name" name="name" [(ngModel)]="name">
</mat-form-field>
<mat-form-field class="w-100">
<mat-select placeholder="Category" name="category" [(value)]="category">
<mat-option *ngFor="let c of categories | async" [value]="c.name">{{c.name}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="w-100">
<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>
</mat-form-field>
<input #fileInput type="file" (change)="imageChanged()" hidden>
</form>
</mat-dialog-content>
<mat-dialog-actions>
<button mat-raised-button (click)="fileInput.click()">
<span *ngIf="!image">Add Image</span>
<mat-icon *ngIf="image">check</mat-icon>
</button>
<button mat-raised-button type="submit" form="createForm" color="primary" (click)="submit()">
<span *ngIf="data.product">Update</span>
<span *ngIf="!data.product">Create</span>
</button>
</mat-dialog-actions>