diff --git a/matsen-tool/src/app/_views/partners/partner-list/partner-list.component.html b/matsen-tool/src/app/_views/partners/partner-list/partner-list.component.html index 8be383a..0c3583a 100644 --- a/matsen-tool/src/app/_views/partners/partner-list/partner-list.component.html +++ b/matsen-tool/src/app/_views/partners/partner-list/partner-list.component.html @@ -63,7 +63,7 @@ {{ 'overview.details' | translate }} - + diff --git a/matsen-tool/src/app/_views/partners/partner-list/partner-list.component.ts b/matsen-tool/src/app/_views/partners/partner-list/partner-list.component.ts index 23bdd48..69bdb14 100644 --- a/matsen-tool/src/app/_views/partners/partner-list/partner-list.component.ts +++ b/matsen-tool/src/app/_views/partners/partner-list/partner-list.component.ts @@ -52,7 +52,7 @@ export class PartnerListComponent implements OnInit, AfterViewInit { private translateService: TranslateService, protected appHelperService: AppHelperService, ) { - this.displayedColumns = ['pos', 'image', 'name', 'address', 'website', 'details']; + this.displayedColumns = ['details', 'pos', 'image', 'name', 'address', 'website']; this.sort = new MatSort(); this.partnersSub = new Subscription(); this.partners = []; diff --git a/matsen-tool/src/app/_views/products/product-list/product-list.component.html b/matsen-tool/src/app/_views/products/product-list/product-list.component.html index 7a5c303..e3e9f33 100644 --- a/matsen-tool/src/app/_views/products/product-list/product-list.component.html +++ b/matsen-tool/src/app/_views/products/product-list/product-list.component.html @@ -61,7 +61,7 @@ {{ 'overview.details' | translate }} - + diff --git a/matsen-tool/src/app/_views/products/product-list/product-list.component.ts b/matsen-tool/src/app/_views/products/product-list/product-list.component.ts index abf02fe..e5988d7 100644 --- a/matsen-tool/src/app/_views/products/product-list/product-list.component.ts +++ b/matsen-tool/src/app/_views/products/product-list/product-list.component.ts @@ -47,7 +47,7 @@ export class ProductListComponent implements OnInit, AfterViewInit { protected appHelperService: AppHelperService, ) { this.sort = new MatSort(); - this.displayedColumns = ['pos', 'image', 'name', 'storage', 'number', 'details']; + this.displayedColumns = ['details', 'pos', 'image', 'name', 'storage', 'number']; this.productsSub = new Subscription(); this.products = []; diff --git a/matsen-tool/src/app/_views/sales/sale-list/sale-list.component.html b/matsen-tool/src/app/_views/sales/sale-list/sale-list.component.html index bfe32a2..68ba7ea 100644 --- a/matsen-tool/src/app/_views/sales/sale-list/sale-list.component.html +++ b/matsen-tool/src/app/_views/sales/sale-list/sale-list.component.html @@ -83,7 +83,7 @@ {{ 'overview.details' | translate }} - + diff --git a/matsen-tool/src/app/_views/sales/sale-list/sale-list.component.ts b/matsen-tool/src/app/_views/sales/sale-list/sale-list.component.ts index cf95d00..844a2a7 100644 --- a/matsen-tool/src/app/_views/sales/sale-list/sale-list.component.ts +++ b/matsen-tool/src/app/_views/sales/sale-list/sale-list.component.ts @@ -37,7 +37,7 @@ export class SaleListComponent implements OnInit, AfterViewInit { protected accountService: AccountService, ) { this.sort = new MatSort(); - this.displayedColumns = ['pos', 'user', 'partner', 'product', 'turnover', 'profit', 'date', 'details']; + this.displayedColumns = ['details', 'pos', 'user', 'partner', 'product', 'turnover', 'profit', 'date']; this.salesSub = new Subscription(); this.sales = []; this.salesSummarySub = new Subscription(); diff --git a/matsen-tool/src/app/_views/sales/sale-summary/sale-summary.component.ts b/matsen-tool/src/app/_views/sales/sale-summary/sale-summary.component.ts index 8bc2cb2..be23afa 100644 --- a/matsen-tool/src/app/_views/sales/sale-summary/sale-summary.component.ts +++ b/matsen-tool/src/app/_views/sales/sale-summary/sale-summary.component.ts @@ -36,9 +36,8 @@ export class SaleSummaryComponent implements OnInit, AfterViewInit { getData() { if (this.user !== undefined) { - console.log(this.user); this.salesSummarySub = this.saleSummaryService.saleSummariesUserIdGet( - String(this.user?.id) + this.appHelperService.extractId(String(this.user?.id)) ).subscribe( data => { this.saleSummaries = [data]; diff --git a/matsen-tool/src/app/_views/user/user-detail/user-detail.component.ts b/matsen-tool/src/app/_views/user/user-detail/user-detail.component.ts index 2a51334..8d93c98 100644 --- a/matsen-tool/src/app/_views/user/user-detail/user-detail.component.ts +++ b/matsen-tool/src/app/_views/user/user-detail/user-detail.component.ts @@ -39,7 +39,6 @@ export class UserDetailComponent implements OnInit, AfterViewInit { protected userSub: Subscription; protected isCurrentUser: boolean; - protected userId!: string; constructor( private accountService: AccountService, @@ -48,34 +47,44 @@ export class UserDetailComponent implements OnInit, AfterViewInit { private route: ActivatedRoute, ) { this.userSub = new Subscription(); - this.isCurrentUser = false; - } ngOnInit() { - this.route.params.subscribe(params => { - this.userId = params['id']; - }); - console.log(this.userId); + if (this.user === undefined) { + this.route.params.subscribe(params => { + this.getUserData(params['id']); + }); + } else { + this.setIsCurrentUser(); + } } ngAfterViewInit(): void { - if (this.accountService.userValue?.userResource) { - let user = this.accountService.userValue?.userResource; - this.isCurrentUser = this.userId == user?.id; - } - this.getData(); + // if (this.accountService.userValue?.userResource) { + // let user = this.accountService.userValue?.userResource; + // if (this.user.id === user.id) { + // this.isCurrentUser = true; + // } + // this.isCurrentUser = this.userId == user?.id; + // } } - getData() { - + getUserData(userId: string) { this.userSub = this.userService.usersIdGet( - this.userId + userId ).subscribe( data => { this.user = data; + this.setIsCurrentUser(); } ); } + + setIsCurrentUser() { + if (this.accountService.userValue?.userResource) { + let user = this.accountService.userValue?.userResource; + this.isCurrentUser = this.user.id == user?.id; + } + } } diff --git a/matsen-tool/src/app/_views/user/user-list/user-list.component.html b/matsen-tool/src/app/_views/user/user-list/user-list.component.html index 3a0cb3a..d14c215 100644 --- a/matsen-tool/src/app/_views/user/user-list/user-list.component.html +++ b/matsen-tool/src/app/_views/user/user-list/user-list.component.html @@ -56,7 +56,7 @@ {{ 'overview.details' | translate }} - + diff --git a/matsen-tool/src/app/_views/user/user-list/user-list.component.ts b/matsen-tool/src/app/_views/user/user-list/user-list.component.ts index 7fe7130..ac36e40 100644 --- a/matsen-tool/src/app/_views/user/user-list/user-list.component.ts +++ b/matsen-tool/src/app/_views/user/user-list/user-list.component.ts @@ -30,7 +30,7 @@ export class UserListComponent implements OnInit, AfterViewInit { private router: Router, protected appHelperService: AppHelperService, ) { - this.displayedColumns = ['pos', 'image', 'firstName', 'lastName', 'email', 'details']; + this.displayedColumns = ['details', 'pos', 'image', 'firstName', 'lastName', 'email']; this.sort = new MatSort(); this.sort = new MatSort(); diff --git a/matsen-tool/src/assets/scss/_button.scss b/matsen-tool/src/assets/scss/_button.scss index 033a2e8..68bb6a2 100644 --- a/matsen-tool/src/assets/scss/_button.scss +++ b/matsen-tool/src/assets/scss/_button.scss @@ -90,6 +90,7 @@ body { } .spt-icon-details { + display: block; width: 48px; height: 48px; background: #2e3a43 url("/assets/images/icons/details.svg") no-repeat center center; diff --git a/matsen-tool/src/assets/scss/_table.scss b/matsen-tool/src/assets/scss/_table.scss index 2d6a9c5..acbcb4e 100644 --- a/matsen-tool/src/assets/scss/_table.scss +++ b/matsen-tool/src/assets/scss/_table.scss @@ -22,12 +22,13 @@ th.mat-sort-header-sorted { .mdc-data-table__header-cell { padding-top: 8px; padding-bottom: 8px; + @include transition(); } .mat-mdc-row { &:hover { .mdc-data-table__cell { - background: #fbfbfb; + background: #f6f6f6; } } } @@ -88,3 +89,7 @@ th.mat-sort-header-sorted { app-paging > .mat-mdc-paginator:first-child { border-width: 4px; } + +.spt-button-td { + width: 85px; +} \ No newline at end of file