diff --git a/frontend/src/app/modules/page/other-parts/presentation/customer-parts/customer-parts.component.html b/frontend/src/app/modules/page/other-parts/presentation/customer-parts/customer-parts.component.html index 43c2be6d26..f0ea86ad5a 100644 --- a/frontend/src/app/modules/page/other-parts/presentation/customer-parts/customer-parts.component.html +++ b/frontend/src/app/modules/page/other-parts/presentation/customer-parts/customer-parts.component.html @@ -38,6 +38,7 @@ [tableHeader]='"page.asBuiltParts" | i18n' (filterActivated)="filterActivated(true, $event )" [tableType]="TableType.AS_BUILT_CUSTOMER" + [mainAspectType]="bomLifecycle" > @@ -64,6 +65,7 @@ [multiSortList]="tableCustomerAsPlannedSortList" (filterActivated)="filterActivated(false, $event )" [tableType]="TableType.AS_PLANNED_CUSTOMER" + [mainAspectType]="bomLifecycle" > diff --git a/frontend/src/app/modules/page/other-parts/presentation/supplier-parts/supplier-parts.component.html b/frontend/src/app/modules/page/other-parts/presentation/supplier-parts/supplier-parts.component.html index 58d6e2a919..537ff09c0c 100644 --- a/frontend/src/app/modules/page/other-parts/presentation/supplier-parts/supplier-parts.component.html +++ b/frontend/src/app/modules/page/other-parts/presentation/supplier-parts/supplier-parts.component.html @@ -45,6 +45,7 @@ [multiSortList]="tableSupplierAsBuiltSortList" (filterActivated)="filterActivated(true, $event )" [tableType]="TableType.AS_BUILT_SUPPLIER" + [mainAspectType]="bomLifecycle" > @@ -75,6 +76,7 @@ [multiSortList]="tableSupplierAsPlannedSortList" (filterActivated)="filterActivated(false, $event )" [tableType]="TableType.AS_PLANNED_SUPPLIER" + [mainAspectType]="bomLifecycle" > diff --git a/frontend/src/app/modules/page/parts/presentation/parts.component.html b/frontend/src/app/modules/page/parts/presentation/parts.component.html index dfacd88c58..d99d9c3778 100644 --- a/frontend/src/app/modules/page/parts/presentation/parts.component.html +++ b/frontend/src/app/modules/page/parts/presentation/parts.component.html @@ -89,6 +89,7 @@ [multiSortList]="tableAsBuiltSortList" [tableHeader]='"page.asBuiltParts" | i18n' [tableType]="TableType.AS_BUILT_OWN" + [mainAspectType]="MainAspectType.AS_BUILT" > @@ -115,6 +116,7 @@ [multiSortList]="tableAsPlannedSortList" [tableHeader]='"page.asPlannedParts" | i18n' [tableType]="TableType.AS_PLANNED_OWN" + [mainAspectType]="MainAspectType.AS_PLANNED" > diff --git a/frontend/src/app/modules/shared/components/parts-table/parts-table.component.html b/frontend/src/app/modules/shared/components/parts-table/parts-table.component.html index b0347d349e..9433105531 100644 --- a/frontend/src/app/modules/shared/components/parts-table/parts-table.component.html +++ b/frontend/src/app/modules/shared/components/parts-table/parts-table.component.html @@ -29,19 +29,19 @@

{{ selectedPartsInfoLabel | i18n : {count: selection?.selected?.length || 0} }}

announcement diff --git a/frontend/src/app/modules/shared/components/parts-table/parts-table.component.ts b/frontend/src/app/modules/shared/components/parts-table/parts-table.component.ts index aad99d9269..997b578e64 100644 --- a/frontend/src/app/modules/shared/components/parts-table/parts-table.component.ts +++ b/frontend/src/app/modules/shared/components/parts-table/parts-table.component.ts @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -import {SelectionModel} from '@angular/cdk/collections'; +import { SelectionModel } from '@angular/cdk/collections'; import { Component, ElementRef, @@ -29,46 +29,37 @@ import { ViewChild, ViewChildren, } from '@angular/core'; -import {FormGroup} from '@angular/forms'; -import {MatDialog, MatDialogConfig} from '@angular/material/dialog'; -import {MatPaginator, PageEvent} from '@angular/material/paginator'; -import {MatSort, Sort} from '@angular/material/sort'; -import {MatTableDataSource} from '@angular/material/table'; -import {Router} from '@angular/router'; -import {EmptyPagination, Pagination} from '@core/model/pagination.model'; -import {RoleService} from '@core/user/role.service'; -import {TableSettingsService} from '@core/user/table-settings.service'; -import { - MultiSelectAutocompleteComponent -} from '@shared/components/multi-select-autocomplete/multi-select-autocomplete.component'; -import {TableType} from '@shared/components/multi-select-autocomplete/table-type.model'; -import {PartsAsBuiltConfigurationModel} from '@shared/components/parts-table/parts-as-built-configuration.model'; -import { - PartsAsBuiltCustomerConfigurationModel -} from '@shared/components/parts-table/parts-as-built-customer-configuration.model'; -import { - PartsAsBuiltSupplierConfigurationModel -} from '@shared/components/parts-table/parts-as-built-supplier-configuration.model'; -import {PartsAsPlannedConfigurationModel} from '@shared/components/parts-table/parts-as-planned-configuration.model'; -import { - PartsAsPlannedCustomerConfigurationModel -} from '@shared/components/parts-table/parts-as-planned-customer-configuration.model'; -import { - PartsAsPlannedSupplierConfigurationModel -} from '@shared/components/parts-table/parts-as-planned-supplier-configuration.model'; -import {TableViewConfig} from '@shared/components/parts-table/table-view-config.model'; -import {TableSettingsComponent} from '@shared/components/table-settings/table-settings.component'; +import { FormGroup } from '@angular/forms'; +import { MatDialog, MatDialogConfig } from '@angular/material/dialog'; +import { MatPaginator, PageEvent } from '@angular/material/paginator'; +import { MatSort, Sort } from '@angular/material/sort'; +import { MatTableDataSource } from '@angular/material/table'; +import { Router } from '@angular/router'; +import { EmptyPagination, Pagination } from '@core/model/pagination.model'; +import { RoleService } from '@core/user/role.service'; +import { TableSettingsService } from '@core/user/table-settings.service'; +import { MainAspectType } from '@page/parts/model/mainAspectType.enum'; +import { MultiSelectAutocompleteComponent } from '@shared/components/multi-select-autocomplete/multi-select-autocomplete.component'; +import { TableType } from '@shared/components/multi-select-autocomplete/table-type.model'; +import { PartsAsBuiltConfigurationModel } from '@shared/components/parts-table/parts-as-built-configuration.model'; +import { PartsAsBuiltCustomerConfigurationModel } from '@shared/components/parts-table/parts-as-built-customer-configuration.model'; +import { PartsAsBuiltSupplierConfigurationModel } from '@shared/components/parts-table/parts-as-built-supplier-configuration.model'; +import { PartsAsPlannedConfigurationModel } from '@shared/components/parts-table/parts-as-planned-configuration.model'; +import { PartsAsPlannedCustomerConfigurationModel } from '@shared/components/parts-table/parts-as-planned-customer-configuration.model'; +import { PartsAsPlannedSupplierConfigurationModel } from '@shared/components/parts-table/parts-as-planned-supplier-configuration.model'; +import { TableViewConfig } from '@shared/components/parts-table/table-view-config.model'; +import { TableSettingsComponent } from '@shared/components/table-settings/table-settings.component'; import { CreateHeaderFromColumns, TableConfig, TableEventConfig, TableHeaderSort, } from '@shared/components/table/table.model'; -import {ToastService} from '@shared/components/toasts/toast.service'; -import {isDateFilter} from '@shared/helper/filter-helper'; -import {addSelectedValues, removeSelectedValues} from '@shared/helper/table-helper'; -import {NotificationColumn} from '@shared/model/notification.model'; -import {DeeplinkService} from '@shared/service/deeplink.service'; +import { ToastService } from '@shared/components/toasts/toast.service'; +import { isDateFilter } from '@shared/helper/filter-helper'; +import { addSelectedValues, removeSelectedValues } from '@shared/helper/table-helper'; +import { NotificationColumn } from '@shared/model/notification.model'; +import { DeeplinkService } from '@shared/service/deeplink.service'; @Component({ @@ -93,6 +84,7 @@ export class PartsTableComponent implements OnInit { @Input() multiSortList: TableHeaderSort[]; @Input() tableType: TableType; + @Input() mainAspectType: MainAspectType; public tableConfig: TableConfig; @@ -218,7 +210,7 @@ export class PartsTableComponent implements OnInit { this.filterFormGroup.valueChanges.subscribe((formValues) => { this.filterActivated.emit(formValues); }); - + console.log(this.mainAspectType) } @@ -362,4 +354,5 @@ export class PartsTableComponent implements OnInit { } protected readonly TableType = TableType; + protected readonly MainAspectType = MainAspectType; } diff --git a/frontend/src/app/modules/shared/modules/part-details/presentation/part-detail.component.html b/frontend/src/app/modules/shared/modules/part-details/presentation/part-detail.component.html index e041210b75..37cdfbc044 100644 --- a/frontend/src/app/modules/shared/modules/part-details/presentation/part-detail.component.html +++ b/frontend/src/app/modules/shared/modules/part-details/presentation/part-detail.component.html @@ -78,13 +78,13 @@ {{ 'partDetail.investigation.tab.header' | i18n }} diff --git a/frontend/src/app/modules/shared/modules/part-details/presentation/part-detail.component.ts b/frontend/src/app/modules/shared/modules/part-details/presentation/part-detail.component.ts index d84d921302..d3b294bb19 100644 --- a/frontend/src/app/modules/shared/modules/part-details/presentation/part-detail.component.ts +++ b/frontend/src/app/modules/shared/modules/part-details/presentation/part-detail.component.ts @@ -54,6 +54,8 @@ export class PartDetailComponent implements AfterViewInit, OnDestroy { public readonly displayedColumns: string[]; + public isAsPlannedPart: boolean; + public customerOrPartSiteDetailsHeader$: Subscription; public customerOrPartSiteHeader: string; @@ -65,13 +67,19 @@ export class PartDetailComponent implements AfterViewInit, OnDestroy { private readonly isOpenState: State = new State(false); + public authorizationTooltipMessage: string; + constructor(private readonly partDetailsFacade: PartDetailsFacade, private readonly router: Router, public roleService: RoleService) { this.isOpen$ = this.isOpenState.observable; this.selectedPartDetails$ = this.partDetailsFacade.selectedPart$; this.shortenPartDetails$ = this.partDetailsFacade.selectedPart$.pipe( PartsAssembler.mapPartForView(), - tap(({ data }) => this.qualityTypeControl.patchValue(data.qualityType, { emitEvent: false, onlySelf: true })), + tap(({ data }) => { + this.qualityTypeControl.patchValue(data.qualityType, { emitEvent: false, onlySelf: true }) + this.isAsPlannedPart = data.semanticDataModel.toString() === 'PartAsPlanned'; + console.log(this.isAsPlannedPart); + }), ); this.manufacturerDetails$ = this.partDetailsFacade.selectedPart$.pipe(PartsAssembler.mapPartForManufacturerView()); @@ -95,6 +103,15 @@ export class PartDetailComponent implements AfterViewInit, OnDestroy { label: value, value: value, })); + + this.selectedPartDetails$.subscribe(part => { + if(part?.data?.children?.length > 0 ) { + this.authorizationTooltipMessage = this.getRestrictionMessageKey(true); + } else { + this.authorizationTooltipMessage = this.getRestrictionMessageKey(false); + } + }); + this.displayedColumns = [ 'position', 'productType', 'tractionBatteryCode' ]; } @@ -119,6 +136,23 @@ export class PartDetailComponent implements AfterViewInit, OnDestroy { this.router.navigate([ `parts/relations/${ part.id }` ]).then(_ => window.location.reload()); } + getRestrictionMessageKey(hasChildren: boolean): string { + if(this.isAsPlannedPart) { + return 'routing.notAllowedForAsPlanned'; + } + + else if(!hasChildren) { + return 'routing.noChildPartsForInvestigation'; + } + + else if(this.roleService.isAdmin()) { + return 'routing.unauthorized'; + } else { + return null; + } + + } + protected readonly NotificationAction = NotificationAction; protected readonly Owner = Owner; }