Display units in Sale / Product and don't show brackets when no units entered
This commit is contained in:
@ -187,7 +187,7 @@ class Product(Base):
|
|||||||
|
|
||||||
@hybrid_property
|
@hybrid_property
|
||||||
def full_name(self):
|
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
|
@full_name.expression
|
||||||
def full_name(cls):
|
def full_name(cls):
|
||||||
|
|||||||
@ -195,8 +195,7 @@ def show_list_sale(request):
|
|||||||
products.append(
|
products.append(
|
||||||
{
|
{
|
||||||
"id": item.id,
|
"id": item.id,
|
||||||
"name": item.name,
|
"name": item.full_name,
|
||||||
"units": item.units,
|
|
||||||
"saleCategory": {
|
"saleCategory": {
|
||||||
"id": item.sale_category_id,
|
"id": item.sale_category_id,
|
||||||
"name": item.sale_category.name,
|
"name": item.sale_category.name,
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
<mat-card fxLayout="column" class="square-button" matRipple *ngFor="let item of list" (click)="addProduct(item)"
|
<mat-card fxLayout="column" class="square-button" matRipple *ngFor="let item of list" (click)="addProduct(item)"
|
||||||
[class.yellow300]="item.hasHappyHour" [class.grey800]="item.isNotAvailable">
|
[class.yellow300]="item.hasHappyHour" [class.grey800]="item.isNotAvailable">
|
||||||
<h3 class="item-name">{{item.name}}</h3>
|
<h3 class="item-name">{{item.name}}</h3>
|
||||||
|
<mat-card-subtitle class="center">{{item.price | currency:'INR'}}</mat-card-subtitle>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
<mat-card fxLayout="column" class="square-button red700" matRipple [routerLink]="['../../menu-categories']"
|
<mat-card fxLayout="column" class="square-button red700" matRipple [routerLink]="['../../menu-categories']"
|
||||||
queryParamsHandling="preserve">
|
queryParamsHandling="preserve">
|
||||||
|
|||||||
Reference in New Issue
Block a user