Skip to content

Commit

Permalink
Update style of create and edit component
Browse files Browse the repository at this point in the history
  • Loading branch information
Popovkov57 committed Oct 5, 2022
1 parent a6c7923 commit 7aaa5e1
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/app/admin/admin.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</div>

<div class="container-fluid" style="padding-top: 60px;">
<div class="row mt-2">
<div class="row m-2">
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link active" routerLink="/admin/main/products" routerLinkActive="active" aria-current="page" href="#">Products</a>
Expand Down
25 changes: 12 additions & 13 deletions src/app/admin/productEditor.component.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
<div class="bg-primary p-2 text-white" [class.bg-warning]="editing" [class.text-dark]="editing">
<h5> {{ editing ? "Edit" : "Create" }} Product </h5>
</div>
<form novalidate #form="ngForm" (submit)="save(form)">
<div class="form-group">
<div class="form-group mt-3">
<label>Name</label>
<input class="form-control" name="name" [(ngModel)]="product.name"/>
</div>
<div class="form-group">
<div class="form-group mt-2">
<label>Category</label>
<input class="form-control" name="category" [(ngModel)]="product.category"/>
</div>
<div class="form-group">
<div class="form-group mt-2">
<label>Description</label>
<textarea class="form-control" name="description" [(ngModel)]="product.description"></textarea>
</div>
<div class="form-group">
<div class="form-group mt-2">
<label>Price</label>
<input class="form-control" name="price" [(ngModel)]="product.price"/>
</div>
<button type="submit" class="btn btn-primary" [class.btn-warning]="editing">
{{ editing ? "Save" : "Create" }}
</button>
<button type="reset" class="btn btn-secondary" routerLink="/admin/main/products">
Cancel
</button>
<div class="btn-group float-end mt-3" role="group" aria-label="Basic example">
<button type="submit" class="btn btn-primary text-white" style="background-color: #6768A9;border-color: #6768A9;" [class.btn-warning]="editing">
{{ editing ? "Save" : "Create" }}
</button>
<button type="reset" class="btn btn-secondary" routerLink="/admin/main/products">
Cancel
</button>
</div>
</form>
43 changes: 23 additions & 20 deletions src/app/admin/productTable.component.html
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
<table class="table table-sm table-striped">
<table class="table table-sm table-striped mt-2">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Category</th>
<th>Price</th>
<th></th>
<tr class="d-flex">
<th class="col-1">ID</th>
<th class="col-4">Name</th>
<th class="col-4">Category</th>
<th class="col-2">Price</th>
<th class="col-1"></th>
</tr>
</thead>
<tbody>
<tr *ngFor="let product of getProducts()">
<td>{{ product.id }}</td>
<td>{{ product.name }}</td>
<td>{{ product.category }}</td>
<td>{{ product.price | currency:"USD":"symbol":"2.2-2" }}</td>
<td>
<button class="btn btn-sm btn-warning" [routerLink]="['/admin/main/products/edit', product.id]">
Edit
</button>
<button class="btn btn-sm btn-danger" (click)="deleteProduct(product.id)">
Delete
</button>
<tr *ngFor="let product of getProducts()" class="d-flex">
<td class="col-1">{{ product.id }}</td>
<td class="col-4">{{ product.name }}</td>
<td class="col-4">{{ product.category }}</td>
<td class="col-2">{{ product.price | currency:"USD":"symbol":"2.2-2" }}</td>
<td class="col-1">
<div class="btn-group float-end" role="group" aria-label="Basic example">
<button class="btn btn-sm btn-warning" [routerLink]="['/admin/main/products/edit', product.id]">
<i class="fa fa-pencil-square-o" aria-hidden="true"></i>
</button>
<button class="btn btn-sm btn-danger" (click)="deleteProduct(product.id)">
<i class="fa fa-trash-o" aria-hidden="true"></i>
</button>
</div>
</td>
</tr>
</tbody>
</table>
<button class="btn btn-primary" routerLink="/admin/main/products/create">
<button class="btn btn-primary float-end" style="background-color: #6768A9;border-color: #6768A9;" routerLink="/admin/main/products/create">
<i class="fa fa-plus" aria-hidden="true"></i>
Create New Product
</button>

0 comments on commit 7aaa5e1

Please sign in to comment.