-
{{ partnerName }}
+
{{ headline }}
diff --git a/matsen-tool/src/app/partners/partners.component.ts b/matsen-tool/src/app/partners/partners.component.ts
index 8d9862f..6b6ce6c 100644
--- a/matsen-tool/src/app/partners/partners.component.ts
+++ b/matsen-tool/src/app/partners/partners.component.ts
@@ -33,7 +33,7 @@ export class PartnersComponent implements OnInit, AfterViewInit {
protected websiteOrderAsc: OrderFilter;
protected dataType!: string;
- protected partnerName: string;
+ protected headline: string;
protected partnerNameOne: string;
protected displayedColumns: string[];
@@ -71,7 +71,7 @@ export class PartnersComponent implements OnInit, AfterViewInit {
this.partnersPageSize = 10;
this.partnersPageIndex = 0;
- this.partnerName = "";
+ this.headline = "";
this.partnerNameOne = "";
}
@@ -79,7 +79,7 @@ export class PartnersComponent implements OnInit, AfterViewInit {
this.dataType = this.route.snapshot.data['dataType'];
// this.translateService.use(this.translateService.getDefaultLang());
this.translateService.get('basic.' + this.dataType).subscribe((translation: string) => {
- this.partnerName = translation;
+ this.headline = translation;
});
this.translateService.get('basic.' + this.dataType + 'One').subscribe((translation: string) => {
this.partnerNameOne = translation;
diff --git a/matsen-tool/src/app/sales/sales-detail/sales-detail.component.html b/matsen-tool/src/app/sales/sales-detail/sales-detail.component.html
new file mode 100644
index 0000000..30220e8
--- /dev/null
+++ b/matsen-tool/src/app/sales/sales-detail/sales-detail.component.html
@@ -0,0 +1 @@
+
sales-detail works!
diff --git a/matsen-tool/src/app/sales/sales-detail/sales-detail.component.scss b/matsen-tool/src/app/sales/sales-detail/sales-detail.component.scss
new file mode 100644
index 0000000..e69de29
diff --git a/matsen-tool/src/app/sales/sales-detail/sales-detail.component.spec.ts b/matsen-tool/src/app/sales/sales-detail/sales-detail.component.spec.ts
new file mode 100644
index 0000000..94ce4c2
--- /dev/null
+++ b/matsen-tool/src/app/sales/sales-detail/sales-detail.component.spec.ts
@@ -0,0 +1,23 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { SalesDetailComponent } from './sales-detail.component';
+
+describe('SalesDetailComponent', () => {
+ let component: SalesDetailComponent;
+ let fixture: ComponentFixture
;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [SalesDetailComponent]
+ })
+ .compileComponents();
+
+ fixture = TestBed.createComponent(SalesDetailComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/matsen-tool/src/app/sales/sales-detail/sales-detail.component.ts b/matsen-tool/src/app/sales/sales-detail/sales-detail.component.ts
new file mode 100644
index 0000000..3e91f64
--- /dev/null
+++ b/matsen-tool/src/app/sales/sales-detail/sales-detail.component.ts
@@ -0,0 +1,10 @@
+import { Component } from '@angular/core';
+
+@Component({
+ selector: 'app-sales-detail',
+ templateUrl: './sales-detail.component.html',
+ styleUrl: './sales-detail.component.scss'
+})
+export class SalesDetailComponent {
+
+}
diff --git a/matsen-tool/src/app/sales/sales.component.html b/matsen-tool/src/app/sales/sales.component.html
new file mode 100644
index 0000000..9540d44
--- /dev/null
+++ b/matsen-tool/src/app/sales/sales.component.html
@@ -0,0 +1,96 @@
+
+
{{ saleSummary.ownerName }} - {{ saleSummary.turnover }} - {{ saleSummary.profit }}
+
+
+
+
+
+
{{ 'basic.sales' | translate }}
+
+
+
+
+
+ |
+ {{ 'overview.number' | translate }}
+ |
+ {{ (pageSize * pageIndex) + dataSource.filteredData.indexOf(element) + 1 }}
+ |
+
+
+
+
+ {{ 'overview.sale-user' | translate }}
+ |
+
+
+ {{ element.ownerName }}
+
+ |
+
+
+
+
+ {{ 'overview.sale-partner' | translate }}
+ |
+
+ {{ element.partnerName }}
+ |
+
+
+
+
+ {{ 'overview.productname' | translate }}
+ |
+
+ {{ element.productName }}
+ |
+
+
+
+
+ {{ 'overview.turnover' | translate }}
+ |
+
+ {{ element.turnover }}
+ |
+
+
+
+
+ {{ 'overview.profit' | translate }}
+ |
+
+ {{ element.profit }}
+ |
+
+
+
+
+ {{ 'overview.createdAt' | translate }}
+ |
+
+ {{ element.createdAt }}
+ |
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/matsen-tool/src/app/sales/sales.component.scss b/matsen-tool/src/app/sales/sales.component.scss
new file mode 100644
index 0000000..e69de29
diff --git a/matsen-tool/src/app/sales/sales.component.spec.ts b/matsen-tool/src/app/sales/sales.component.spec.ts
new file mode 100644
index 0000000..9eb2cff
--- /dev/null
+++ b/matsen-tool/src/app/sales/sales.component.spec.ts
@@ -0,0 +1,23 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { SalesComponent } from './sales.component';
+
+describe('SalesComponent', () => {
+ let component: SalesComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [SalesComponent]
+ })
+ .compileComponents();
+
+ fixture = TestBed.createComponent(SalesComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/matsen-tool/src/app/sales/sales.component.ts b/matsen-tool/src/app/sales/sales.component.ts
new file mode 100644
index 0000000..b1550c5
--- /dev/null
+++ b/matsen-tool/src/app/sales/sales.component.ts
@@ -0,0 +1,154 @@
+import {ChangeDetectorRef, Component, OnInit, ViewChild} from '@angular/core';
+import {
+ PartnerJsonld, ProductJsonld,
+ SaleJsonld,
+ SaleService,
+ SaleSummaryJsonld,
+ SaleSummaryService
+} from "@app/core/api/v1";
+import {Subscription} from "rxjs";
+import {MatPaginator, MatPaginatorIntl, PageEvent} from "@angular/material/paginator";
+import {MatSort, Sort} from "@angular/material/sort";
+import {TranslateService} from "@ngx-translate/core";
+import {NewPartnerComponent} from "@app/partners/new-partner/new-partner.component";
+import {ModalStatus} from "@app/_helpers/modal.states";
+import {NgbModal, NgbModalOptions} from "@ng-bootstrap/ng-bootstrap";
+import {MatTableDataSource} from "@angular/material/table";
+import {OrderFilter} from "@app/_models/orderFilter";
+import {ApiConverter} from "@app/_helpers/api.converter";
+import {Router} from "@angular/router";
+
+@Component({
+ selector: 'app-sales',
+ templateUrl: './sales.component.html',
+ styleUrl: './sales.component.scss'
+})
+export class SalesComponent implements OnInit {
+ @ViewChild(MatSort) sort;
+ @ViewChild(MatPaginator) paginator: MatPaginator;
+
+
+ protected displayedColumns: string[];
+ protected salesSub: Subscription;
+ protected sales: Array;
+ protected salesSummarySub: Subscription;
+ protected saleSummaries: Array;
+
+ protected dataSource;
+ protected length: number;
+ protected pageEvent: PageEvent;
+ protected pageSize: number;
+ protected pageIndex: number;
+
+ protected modalOptions: NgbModalOptions = {
+ centered: true
+ };
+
+ constructor(
+ private saleService: SaleService,
+ private saleSummaryService: SaleSummaryService,
+ private translateService: TranslateService,
+ private modalService: NgbModal,
+ private router: Router,
+
+ ) {
+ this.sort = new MatSort();
+ this.displayedColumns = ['pos', 'user', 'partner', 'product', 'turnover', 'profit', 'date'];
+ this.salesSub = new Subscription();
+ this.sales = [];
+ this.salesSummarySub = new Subscription();
+ this.saleSummaries = [];
+
+ this.dataSource = new MatTableDataSource(this.sales);
+ this.paginator = new MatPaginator(new MatPaginatorIntl(), ChangeDetectorRef.prototype);
+ this.length = 0;
+ this.pageEvent = new PageEvent();
+ this.pageSize = 10;
+ this.pageIndex = 0;
+ }
+
+ ngOnInit() {
+ this.getSalesData();
+ this.getSalesSummaryData();
+ }
+
+ getSalesData() {
+ this.salesSub = this.saleService.salesGetCollection(
+ this.pageIndex + 1,
+ this.pageSize,
+ ).subscribe(
+ data => {
+ this.sales = data["hydra:member"];
+ this.dataSource = new MatTableDataSource(this.sales);
+ this.length = Number(data["hydra:totalItems"]);
+ this.paginator.length = this.length;
+ console.log(this.sales);
+ }
+ )
+ }
+
+ getSalesSummaryData() {
+ this.salesSummarySub = this.saleSummaryService.saleSummariesGetCollection(
+ 1,
+ 50
+ ).subscribe(
+ data => {
+ this.saleSummaries = data["hydra:member"];
+ console.log(this.saleSummaries);
+ }
+ )
+ }
+
+ onSortChange(sortState: Sort) {
+ // Reset page index to first page
+ this.pageIndex = 0;
+
+ let order: OrderFilter;
+ if (sortState.direction === "") {
+ order = OrderFilter.Undefined;
+ } else {
+ order = sortState.direction;
+ }
+
+ // this.nameOrderAsc = OrderFilter.Undefined;
+ // this.cityOrderAsc = OrderFilter.Undefined;
+ // this.websiteOrderAsc = OrderFilter.Undefined;
+ // switch (sortState.active) {
+ // case "name":
+ // this.nameOrderAsc = order;
+ // break;
+ // case "address":
+ // this.cityOrderAsc = order;
+ // break;
+ // case "website":
+ // this.websiteOrderAsc = order;
+ // break;
+ // }
+ this.getSalesData();
+ }
+
+ handlePageEvent(e: PageEvent) {
+ this.pageEvent = e;
+ this.length = e.length;
+ this.pageIndex = e.pageIndex.valueOf();
+ this.pageSize = e.pageSize.valueOf();
+ this.getSalesData();
+ }
+
+ navigateToSaleDetails(element: any) {
+ const product: ProductJsonld = element as ProductJsonld;
+ this.router.navigate(['/products', ApiConverter.extractId(product.id)]);
+ }
+
+ openModalNewSale() {
+ const modalRefContact = this.modalService.open(NewPartnerComponent, this.modalOptions);
+ let sale: SaleJsonld = {} as SaleJsonld;
+ modalRefContact.componentInstance.partner = sale;
+ modalRefContact.componentInstance.submit.subscribe((modalStatus: ModalStatus) => {
+ if (modalStatus === ModalStatus.Submitted) {
+ modalRefContact.dismiss();
+ this.getSalesData();
+ }
+ });
+ }
+}
diff --git a/matsen-tool/src/assets/i18n/de.json b/matsen-tool/src/assets/i18n/de.json
index 17049d2..60464b7 100644
--- a/matsen-tool/src/assets/i18n/de.json
+++ b/matsen-tool/src/assets/i18n/de.json
@@ -18,6 +18,7 @@
"serviceOne": "Lieferant",
"products": "Produkte",
"documents": "Dokumente",
+ "sales": "Verkäufe",
"tasks": "Aufgaben",
"contacts": "Kontakte",
"posts": "Notizen",
@@ -30,6 +31,7 @@
"new-post": "Neue Notiz",
"new-comment": "Neuer Kommentar",
"new-task-note": "Neue Anmerkung",
+ "new-sale": "Neuer Verkauf",
"edit-before": "",
"edit-after": "bearbeiten",
"edit-product": "Produkt bearbeiten",
@@ -58,7 +60,7 @@
"address": "Adresse",
"website": "Website",
"image": "Bild",
- "productname": "Produktname",
+ "productname": "Produkt",
"storage": "Lagerbestand",
"number-long": "Nummer",
"document": "Dokument",
@@ -68,7 +70,12 @@
"createdBy": "Erstellt von",
"download": "Download",
"partner": "Partner",
- "product": "Produkt"
+ "product": "Produkt",
+ "sale-user": "Verkäufer",
+ "sale-partner": "Kunde",
+ "turnover": "Umsatz",
+ "profit": "Gewinn",
+ "createdAt": "erstellt am"
},
"form":
{