Display units in Sale / Product and don't show brackets when no units entered

This commit is contained in:
Amritanshu 2019-08-21 14:13:53 +05:30
parent b898e26dc6
commit fd1111f378
3 changed files with 3 additions and 3 deletions

View File

@ -187,7 +187,7 @@ class Product(Base):
@hybrid_property
def full_name(self):
return "{0} ({1})".format(self.name, self.units)
return f"{self.name} ({self.units})" if self.units else self.name
@full_name.expression
def full_name(cls):

View File

@ -195,8 +195,7 @@ def show_list_sale(request):
products.append(
{
"id": item.id,
"name": item.name,
"units": item.units,
"name": item.full_name,
"saleCategory": {
"id": item.sale_category_id,
"name": item.sale_category.name,

View File

@ -3,6 +3,7 @@
<mat-card fxLayout="column" class="square-button" matRipple *ngFor="let item of list" (click)="addProduct(item)"
[class.yellow300]="item.hasHappyHour" [class.grey800]="item.isNotAvailable">
<h3 class="item-name">{{item.name}}</h3>
<mat-card-subtitle class="center">{{item.price | currency:'INR'}}</mat-card-subtitle>
</mat-card>
<mat-card fxLayout="column" class="square-button red700" matRipple [routerLink]="['../../menu-categories']"
queryParamsHandling="preserve">