diff --git a/matsen-tool/src/app/sales/sales.component.html b/matsen-tool/src/app/sales/sales.component.html
index 9540d44..8c26d1b 100644
--- a/matsen-tool/src/app/sales/sales.component.html
+++ b/matsen-tool/src/app/sales/sales.component.html
@@ -1,13 +1,28 @@
-
-
{{ saleSummary.ownerName }} - {{ saleSummary.turnover }} - {{ saleSummary.profit }}
-
-
-
{{ 'basic.sales' | translate }}
+
+
+
{{ saleSummary.ownerName }}
+
+
+
+ {{ 'sales.turnover' | translate }}: {{ saleSummary.turnover | currency: 'EUR' }}
+
+
+
+
+
+
+ {{ 'sales.profit' | translate }}: {{ saleSummary.profit | currency: 'EUR' }}
+
+
+
+
+
+
@@ -58,7 +73,7 @@
{{ 'overview.turnover' | translate }}
|
- {{ element.turnover }}
+ {{ element.turnover | currency: 'EUR' }}
|
@@ -68,7 +83,7 @@
{{ 'overview.profit' | translate }}
- {{ element.profit }}
+ {{ element.profit | currency: 'EUR' }}
|
@@ -78,7 +93,7 @@
{{ 'overview.createdAt' | translate }}
- {{ element.createdAt }}
+ {{ element.createdAt | date:'dd.MM.YYYY HH:mm' }}
|
@@ -93,4 +108,4 @@
[pageIndex]="pageIndex"
showFirstLastButtons>
-
\ No newline at end of file
+
diff --git a/matsen-tool/src/app/sales/sales.component.ts b/matsen-tool/src/app/sales/sales.component.ts
index b1550c5..5f7bd45 100644
--- a/matsen-tool/src/app/sales/sales.component.ts
+++ b/matsen-tool/src/app/sales/sales.component.ts
@@ -1,6 +1,6 @@
-import {ChangeDetectorRef, Component, OnInit, ViewChild} from '@angular/core';
+import {ChangeDetectorRef, Component, LOCALE_ID, OnInit, ViewChild} from '@angular/core';
import {
- PartnerJsonld, ProductJsonld,
+ ProductJsonld,
SaleJsonld,
SaleService,
SaleSummaryJsonld,
@@ -17,17 +17,26 @@ import {MatTableDataSource} from "@angular/material/table";
import {OrderFilter} from "@app/_models/orderFilter";
import {ApiConverter} from "@app/_helpers/api.converter";
import {Router} from "@angular/router";
+import {registerLocaleData} from "@angular/common";
+import localeDe from '@angular/common/locales/de';
+
+registerLocaleData(localeDe);
@Component({
- selector: 'app-sales',
- templateUrl: './sales.component.html',
- styleUrl: './sales.component.scss'
+ selector: 'app-sales',
+ templateUrl: './sales.component.html',
+ styleUrl: './sales.component.scss',
+ providers: [
+ {
+ provide: LOCALE_ID,
+ useValue: 'de-DE',
+ },
+ ],
})
export class SalesComponent implements OnInit {
@ViewChild(MatSort) sort;
@ViewChild(MatPaginator) paginator: MatPaginator;
-
protected displayedColumns: string[];
protected salesSub: Subscription;
protected sales: Array;
@@ -40,6 +49,8 @@ export class SalesComponent implements OnInit {
protected pageSize: number;
protected pageIndex: number;
+ protected saleSummaryMaxTurnover: number;
+
protected modalOptions: NgbModalOptions = {
centered: true
};
@@ -50,7 +61,6 @@ export class SalesComponent implements OnInit {
private translateService: TranslateService,
private modalService: NgbModal,
private router: Router,
-
) {
this.sort = new MatSort();
this.displayedColumns = ['pos', 'user', 'partner', 'product', 'turnover', 'profit', 'date'];
@@ -65,6 +75,8 @@ export class SalesComponent implements OnInit {
this.pageEvent = new PageEvent();
this.pageSize = 10;
this.pageIndex = 0;
+
+ this.saleSummaryMaxTurnover = 0;
}
ngOnInit() {
@@ -95,10 +107,20 @@ export class SalesComponent implements OnInit {
data => {
this.saleSummaries = data["hydra:member"];
console.log(this.saleSummaries);
+ if (this.saleSummaries.length > 0) {
+ this.saleSummaryMaxTurnover = Number(this.saleSummaries[0].turnover);
+ }
}
)
}
+ calculateWidthPercentage(turnover: number, maxTurnOver: number): number {
+ if (turnover && maxTurnOver && maxTurnOver !== 0) {
+ return (turnover / maxTurnOver) * 100;
+ }
+ return 0;
+ }
+
onSortChange(sortState: Sort) {
// Reset page index to first page
this.pageIndex = 0;
@@ -136,8 +158,8 @@ export class SalesComponent implements OnInit {
}
navigateToSaleDetails(element: any) {
- const product: ProductJsonld = element as ProductJsonld;
- this.router.navigate(['/products', ApiConverter.extractId(product.id)]);
+ // const product: ProductJsonld = element as ProductJsonld;
+ // this.router.navigate(['/products', ApiConverter.extractId(product.id)]);
}
openModalNewSale() {
@@ -151,4 +173,6 @@ export class SalesComponent implements OnInit {
}
});
}
+
+ protected readonly Number = Number;
}
diff --git a/matsen-tool/src/assets/i18n/de.json b/matsen-tool/src/assets/i18n/de.json
index 60464b7..be2d8cf 100644
--- a/matsen-tool/src/assets/i18n/de.json
+++ b/matsen-tool/src/assets/i18n/de.json
@@ -108,5 +108,10 @@
"partner": "Partner",
"product": "Produkt",
"send": "Abschicken"
+ },
+ "sales":
+ {
+ "turnover": "Umsatz",
+ "profit": "Gewinn"
}
}
\ No newline at end of file
diff --git a/matsen-tool/src/assets/scss/_sales.scss b/matsen-tool/src/assets/scss/_sales.scss
new file mode 100644
index 0000000..1acb8d3
--- /dev/null
+++ b/matsen-tool/src/assets/scss/_sales.scss
@@ -0,0 +1,35 @@
+.sales-summary-container {
+
+ .sales-summary-bar {
+ border-radius: 5px;
+ background: #bbb;
+ margin: 0 0 0.5rem 0;
+ div {
+ animation: expand 2.5s ease;
+ border-radius: 5px;
+ span {
+ display: block;
+ border-radius: 5px;
+ padding: 15px;
+ white-space: nowrap;
+ }
+ }
+ }
+ .sales-summary-turnover {
+ background: rgb(179,208,47);
+ background: linear-gradient(109deg, rgba(179,208,47,1) 0%, rgba(64,208,70,1) 36%, rgba(44,181,91,1) 100%);
+ }
+ .sales-summary-profit {
+ background: rgb(45,209,159);
+ background: linear-gradient(109deg, rgba(45,209,159,1) 0%, rgba(64,208,203,1) 36%, rgba(44,138,181,1) 100%);
+ }
+}
+
+@keyframes expand {
+ from {
+ width: 0;
+ }
+ to {
+ width: 100%;
+ }
+}
\ No newline at end of file
diff --git a/matsen-tool/src/styles.scss b/matsen-tool/src/styles.scss
index b210243..6ff1372 100644
--- a/matsen-tool/src/styles.scss
+++ b/matsen-tool/src/styles.scss
@@ -6,5 +6,6 @@
@import "assets/scss/modal";
@import "assets/scss/form";
@import "assets/scss/table";
+@import "assets/scss/sales";
@import "assets/scss/button";
@import "assets/scss/accordion";