Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export abstract class AbstractHeaderComponent implements OnInit, OnDestroy {
@Input() showSearchButton = true;
@Input() showTableSection = true;
@Input() public approval: boolean;
@Input() public disabled: boolean = false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename approval and rework to enum, and remove this disabled property


public headerService: AbstractHeaderService;
protected _headerSearch: HeaderSearchService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export abstract class AbstractHeaderModeComponent {
@Input() public indeterminate: boolean;
@Input() public approvalFormControl: FormControl;
@Input() public typeApproval: string;
@Input() public disabled: boolean = false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename approval and rework to enum, and remove this disabled property


constructor() {
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Component, Input, Optional} from '@angular/core';
import {Component,EventEmitter,Input,Optional,Output} from '@angular/core';

Check warning on line 1 in projects/netgrif-components-core/src/lib/panel/case-panel/abstract-case-panel.component.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unused import of 'EventEmitter'.

See more on https://sonarcloud.io/project/issues?id=netgrif_components&issues=AZ5AT8Bo5I_hktsxXKDn&open=AZ5AT8Bo5I_hktsxXKDn&pullRequest=330

Check warning on line 1 in projects/netgrif-components-core/src/lib/panel/case-panel/abstract-case-panel.component.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unused import of 'Output'.

See more on https://sonarcloud.io/project/issues?id=netgrif_components&issues=AZ5AT8Bo5I_hktsxXKDo&open=AZ5AT8Bo5I_hktsxXKDo&pullRequest=330
import {Observable} from 'rxjs';
import {Case} from '../../resources/interface/case';
import {toMoment} from '../../resources/types/nae-date-type';
Expand Down Expand Up @@ -38,6 +38,7 @@
@Input() showCasePanelIcon = true;
@Input() showDeleteMenu = false;
@Input() textEllipsis = false;
@Input() public disabled: boolean = false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is replaced with enu, in previous comment

protected _approvalFormControl: FormControl;

protected constructor(protected _caseResourceService: CaseResourceService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ import {InjectedTabData} from '../../../tabs/interfaces';
selector: 'ncc-abstract-default-task-list',
template: ''
})
export abstract class AbstractDefaultTaskListComponent extends TabbedVirtualScrollComponent implements AfterViewInit, OnDestroy {

export abstract class AbstractDefaultTaskListComponent
extends TabbedVirtualScrollComponent
implements AfterViewInit, OnDestroy {
protected _tasks$: Observable<Array<TaskPanelData>>;
protected _redirectTaskId: string;
protected _unsubscribe$: Subject<void>;
Expand All @@ -30,6 +31,7 @@ export abstract class AbstractDefaultTaskListComponent extends TabbedVirtualScro
@Input() forceLoadDataOnOpen = false;
@Input() textEllipsis = false;
@Input() showMoreMenu: boolean = true;
@Input() public disabled: boolean = false;

@Input()
set allowMultiOpen(bool: boolean) {
Expand All @@ -48,24 +50,26 @@ export abstract class AbstractDefaultTaskListComponent extends TabbedVirtualScro
protected _unsub: Subscription;
protected _canReload: boolean;

constructor(protected _taskViewService: TaskViewService,
protected _log: LoggerService,
@Optional() @Inject(NAE_TAB_DATA) injectedTabData: InjectedTabData,
protected route?: ActivatedRoute) {
constructor(
protected _taskViewService: TaskViewService,
protected _log: LoggerService,
@Optional() @Inject(NAE_TAB_DATA) injectedTabData: InjectedTabData,
protected route?: ActivatedRoute
) {
super(injectedTabData);
this.taskEvent = new EventEmitter<TaskEventNotification>();
this._taskPanelRefs = new Map<string, MatExpansionPanel>();
this._unsubscribe$ = new Subject<void>();
if (injectedTabData !== null) {
this._unsub = injectedTabData.tabSelected$.pipe(
filter(bool => bool)
).subscribe( () => {
if (this._canReload) {
this._taskViewService.reloadCurrentPage();
} else {
this._canReload = true;
}
});
this._unsub = injectedTabData.tabSelected$
.pipe(filter(bool => bool))
.subscribe(() => {
if (this._canReload) {
this._taskViewService.reloadCurrentPage();
} else {
this._canReload = true;
}
});
}
}

Expand Down Expand Up @@ -99,16 +103,22 @@ export abstract class AbstractDefaultTaskListComponent extends TabbedVirtualScro
}

public onRedirect() {
this.route.queryParams.pipe(filter(pm => !!pm['taskId'])).subscribe(pm => {
this._redirectTaskId = pm['taskId'];
this._tasks$.pipe().subscribe(tasks => {
const task = tasks.find(t => t.task.stringId === this._redirectTaskId);
if (!!task && !task.initiallyExpanded) {
this._taskPanelRefs.get(this._redirectTaskId).open();
this._taskPanelRefs.get(this._redirectTaskId).expanded = true;
this._unsubscribe$.next();
}
this.route.queryParams
.pipe(filter(pm => !!pm["taskId"]))
.subscribe(pm => {
this._redirectTaskId = pm["taskId"];
this._tasks$.pipe().subscribe(tasks => {
const task = tasks.find(
t => t.task.stringId === this._redirectTaskId
);
if (!!task && !task.initiallyExpanded) {
this._taskPanelRefs.get(this._redirectTaskId).open();
this._taskPanelRefs.get(
this._redirectTaskId
).expanded = true;
this._unsubscribe$.next();
}
});
});
Comment thread
coderabbitai[bot] marked this conversation as resolved.
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export abstract class AbstractTaskPanelComponent extends AbstractPanelWithImmedi
@Input() actionRowJustifyContent: 'space-between' | 'flex-start' | 'flex-end' | 'center' | 'space-around' |
'initial' | 'start' | 'end' | 'left' | 'right' | 'revert' | 'inherit' | 'unset'
@Input() showMoreMenu: boolean = true;
@Input() public disabled: boolean = false;

thisContext: TaskPanelContext = {
canAssign: () => this.canAssign(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export abstract class AbstractCaseListPaginatorComponent extends AbstractDefault
public pageIndex = 0;
public pageSizeOptions: number[] = [10, 20, 50, 100];
@Input() public approval: boolean;
@Input() public disabled: boolean;

constructor(protected _caseViewService: CaseViewService,
protected _log: LoggerService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export abstract class AbstractDefaultCaseListComponent extends TabbedVirtualScro
@Input() textEllipsis = false;
@Input() width: string;
@Input() redirectEnabled = true;
@Input() public disabled: boolean;

public cases$: Observable<Array<Case>>;
public loading$: Observable<boolean>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div fxLayout="row" fxFlex="100" fxLayoutAlign="start center" class="netgrif-input netgrif-header-input netgrif-input-fix netgrif-zero-field-wrapper">
<mat-checkbox *ngIf="approval && typeApproval === 'multichoice'" [formControl]="approvalFormControl" [indeterminate]="indeterminate"
(click)="$event.stopPropagation();" color='primary' class="checkbox-padding"></mat-checkbox>
(click)="$event.stopPropagation();" color='primary' class="checkbox-padding" [disabled]="disabled"></mat-checkbox>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

turn of the ripple if you change this to button

<mat-icon *ngIf="approval && typeApproval === 'enumeration'" color="warn" (click)="setValue();$event.stopPropagation();" class="checkbox-padding cursor-fix">close</mat-icon>
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
<mat-form-field *ngFor="let header of this.headerService.selectedHeaders$ | async; let i = index" fxLayout="row"
fxLayoutAlign=" center" fxFlex [ngStyle]="{'min-width': getMinWidth()}" appearance="outline"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div fxFlex="100" fxLayout="row" fxLayoutAlign=" center">
<mat-checkbox *ngIf="approval && typeApproval === 'multichoice'" [formControl]="approvalFormControl" [indeterminate]="indeterminate"
(click)="$event.stopPropagation();" color='primary' class="checkbox-padding"></mat-checkbox>
(click)="$event.stopPropagation();" color='primary' class="checkbox-padding" [disabled]="disabled"></mat-checkbox>
<mat-icon *ngIf="approval && typeApproval === 'enumeration'" color="warn" (click)="setValue();$event.stopPropagation();" class="checkbox-padding cursor-fix">close</mat-icon>
<div *ngFor="let header of this.headerService.selectedHeaders$ | async; let i = index"
[fxHide.lt-xl]="i >= 4 && this.headerService.responsiveHeaders && !this.headerService.overflowMode"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div matSort (matSortChange)="sortHeaderChanged($event)" fxFlex="100" fxLayout="row" fxLayoutAlign=" center">
<mat-checkbox *ngIf="approval && typeApproval === 'multichoice'" [formControl]="approvalFormControl" [indeterminate]="indeterminate"
(click)="$event.stopPropagation();" color='primary' class="checkbox-padding"></mat-checkbox>
(click)="$event.stopPropagation();" color='primary' class="checkbox-padding" [disabled]="disabled"></mat-checkbox>
<mat-icon *ngIf="approval && typeApproval === 'enumeration'" color="warn" (click)="setValue();$event.stopPropagation();" class="checkbox-padding cursor-fix">close</mat-icon>
<div [ngStyle]="{'min-width': getMinWidth()}" *ngFor="let header of headerService.headerState.selectedHeaders$ | async; let i = index" fxFlex
[fxHide.lt-xl]="i >= 4 && this.headerService.responsiveHeaders && !this.headerService.overflowMode"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
[indeterminate]="indeterminate()"
[approval]="approval"
[typeApproval]="typeApproval()"
[disabled]="disabled"
></nc-sort-mode>
</div>
<div *ngSwitchCase="headerModeEnum.SEARCH" fxFlex="100" fxLayout="row">
Expand All @@ -18,6 +19,7 @@
[indeterminate]="indeterminate()"
[approval]="approval"
[typeApproval]="typeApproval()"
[disabled]="disabled"
></nc-search-mode>
</div>
<div *ngSwitchCase="headerModeEnum.EDIT" fxFlex="100" fxLayout="row">
Expand All @@ -27,6 +29,7 @@
[indeterminate]="indeterminate()"
[approval]="approval"
[typeApproval]="typeApproval()"
[disabled]="disabled"
></nc-edit-mode>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<div class="full-height transform-div custom-scrollbar" [ngClass]="{'overflow-div': getOverflowStatus()}" fxLayout="column" fxLayoutAlign="start stretch">
<div class="full-height transform-div max-width-fix" fxLayout="column" fxLayoutAlign="start stretch">
<nc-header #header [type]="headerType" [responsiveHeaders]="true" class="case-header-padding" [ngStyle]="{'width': getWidth()}" [approval]="isApproval()"></nc-header>
<nc-header #header [type]="headerType" [responsiveHeaders]="true" class="case-header-padding" [ngStyle]="{'width': getWidth()}" [approval]="isApproval()" [disabled]="disabled()"></nc-header>

<nc-case-list-paginator [selectedHeaders$]="selectedHeaders$" [showDeleteMenu]="false" [width]="getWidth()" [approval]="isApproval()" [disabled]="disabled()"
(caseClick)="handleCaseClick($event)" [responsiveBody]="true" fxFlex [textEllipsis]="true"></nc-case-list-paginator>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<div fxLayout="column" fxLayoutAlign="start stretch" class="content-margin full-height" >
<nc-header #header type="task" [responsiveHeaders]="true" class="task-panel-padding-mini"></nc-header>
<nc-task-list-pagination [allowMultiOpen]="false" [tasks$]="tasks$" [loading$]="loading$" [textEllipsis]="true" [forceLoadDataOnOpen]="true" [responsiveBody]="true"
[selectedHeaders$]="selectedHeaders$" (taskEvent)="logEvent($event)" fxFlex></nc-task-list-pagination>
[selectedHeaders$]="selectedHeaders$" (taskEvent)="logEvent($event)" fxFlex [disabled]="disabled()"></nc-task-list-pagination>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import {AfterViewInit, Component, ViewChild} from '@angular/core';
import {AfterViewInit,Component,Inject,Optional,ViewChild} from '@angular/core';
import {
AbstractTaskViewComponent,
AllowedNetsService,
AllowedNetsServiceFactory,
AllowedNetsServiceFactory, CaseRefField,
CategoryFactory,
ChangedFieldsService,
ChangedFieldsService, DATA_FIELD_PORTAL_DATA, DataFieldPortalData, EnumerationField, MultichoiceField,
NAE_ASYNC_RENDERING_CONFIGURATION,
NAE_TASK_FORCE_OPEN,
SearchService,
TaskEventNotification,
TaskViewService, ViewIdService
} from "@netgrif/components-core";
import {HeaderComponent} from "../../../../../header/header.component";
} from '@netgrif/components-core';
import {HeaderComponent} from '../../../../../header/header.component';

const localAllowedNetsFactory = (factory: AllowedNetsServiceFactory) => {
return factory.createWithAllNets();
Expand Down Expand Up @@ -43,7 +43,9 @@ export class DefaultTaskViewComponent extends AbstractTaskViewComponent implemen

@ViewChild('header') public taskHeaderComponent: HeaderComponent;

constructor(taskViewService: TaskViewService) {
constructor(taskViewService: TaskViewService,
@Optional() @Inject(DATA_FIELD_PORTAL_DATA)
protected _dataFieldPortalData: DataFieldPortalData<MultichoiceField | CaseRefField | EnumerationField>) {
super(taskViewService);
}

Expand All @@ -55,4 +57,7 @@ export class DefaultTaskViewComponent extends AbstractTaskViewComponent implemen
console.log(event);
}

public disabled(): boolean {
return this._dataFieldPortalData?.dataField?.formControlRef.disabled;
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
[caseColor]=case_.color>
<ng-template #casePanelHeader>
<div fxLayoutAlign="start center" fxLayout="row" fxFlex="95" (click)="preventSelectionClick($event)">
<mat-checkbox *ngIf="approval && typeApproval() === 'multichoice'" [formControl]="approvalFormControl" (click)="$event.stopPropagation();" color='primary' class="checkbox-padding"></mat-checkbox>
<mat-radio-group *ngIf="approval && typeApproval() === 'enumeration'" [formControl]="approvalFormControl" (click)="$event.stopPropagation();" class="radio-padding" color='primary'>
<mat-checkbox *ngIf="approval && typeApproval() === 'multichoice'" [formControl]="approvalFormControl" (click)="$event.stopPropagation();" color='primary' class="checkbox-padding" [disabled]="disabled"></mat-checkbox>
<mat-radio-group *ngIf="approval && typeApproval() === 'enumeration'" [formControl]="approvalFormControl" (click)="$event.stopPropagation();" class="radio-padding" color='primary' [disabled]="disabled">
<mat-radio-button [value]="caseValue()"></mat-radio-button>
</mat-radio-group>
<div *ngFor="let field of featuredFieldsValues; let i = index" fxFlex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
[responsiveBody]="responsiveBody"
(taskEvent)="emitTaskEvent($event)"
(panelRefOutput)="addToPanelRefs(task, $event)"
[showMoreMenu]="showMoreMenu"
[showMoreMenu]="showMoreMenu" [disabled]="disabled"
class="panel-expanded-spacing" [ngClass]="{'single-task-fix': tasks.length === 1 && panel.isExpanded()}">
</nc-task-panel>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<div fxLayout="row" fxLayoutAlign="end center" fxFlex="5">
<button mat-icon-button (click)="preventPanelOpen($event)"
*ngIf="!isLoading && showMoreMenu && (canAssign() || canDo('delegate') || canReassign() || canCancel() || canFinish())"
[disabled]="disabled"
[matMenuTriggerFor]="menu">
<mat-icon>more_vert</mat-icon>
</button>
Expand Down Expand Up @@ -70,27 +71,27 @@
</nc-app-panel>

<ng-template #assignButton>
<button *ngIf="canAssign() && getAssignTitle()?.length > 0" (click)="assign()" mat-stroked-button color="primary" [disabled]="canDisable('assign')">
<button *ngIf="canAssign() && getAssignTitle()?.length > 0" (click)="assign()" mat-stroked-button color="primary" [disabled]="canDisable('assign') || disabled">
{{ getAssignTitle() | translate | uppercase }}</button>
</ng-template>

<ng-template #delegateButton>
<button *ngIf="canDo('delegate') && getDelegateTitle()?.length > 0" (click)="delegate()" mat-stroked-button color="primary" [disabled]="canDisable('delegate')">
<button *ngIf="canDo('delegate') && getDelegateTitle()?.length > 0" (click)="delegate()" mat-stroked-button color="primary" [disabled]="canDisable('delegate') || disabled">
{{ getDelegateTitle() | translate | uppercase }}</button>
</ng-template>

<ng-template #reassignButton>
<button *ngIf="canReassign()" (click)="delegate()" mat-stroked-button color="primary" [disabled]="canDisable('reassign')">
<button *ngIf="canReassign()" (click)="delegate()" mat-stroked-button color="primary" [disabled]="canDisable('reassign') || disabled">
{{ 'tasks.view.reassign' | translate | uppercase }}</button>
</ng-template>

<ng-template #cancelButton>
<button *ngIf="canCancel() && getCancelTitle()?.length > 0" (click)="cancel()" mat-stroked-button color="primary" [disabled]="canDisable('cancel')">
<button *ngIf="canCancel() && getCancelTitle()?.length > 0" (click)="cancel()" mat-stroked-button color="primary" [disabled]="canDisable('cancel') || disabled">
{{ getCancelTitle() | translate | uppercase }}</button>
</ng-template>

<ng-template #finishButton>
<button *ngIf="canFinish() && getFinishTitle()?.length > 0" (click)="finish()" mat-stroked-button color="primary" [disabled]="canDisable('finish')">
<button *ngIf="canFinish() && getFinishTitle()?.length > 0" (click)="finish()" mat-stroked-button color="primary" [disabled]="canDisable('finish') || disabled">
{{ getFinishTitle() | translate | uppercase }}</button>
</ng-template>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
trackBy: trackById"
[showCasePanelIcon]="showCasePanelIcon" [approval]="approval"
[showDeleteMenu]="showDeleteMenu" [first]="first" [last]="last"
[case_]="case_" [selectedHeaders$]="selectedHeaders$" (click)="onCaseClick(case_)">
[case_]="case_" [selectedHeaders$]="selectedHeaders$" (click)="onCaseClick(case_)"
[disabled]="disabled"
>
</nc-case-panel>

<div *ngIf="loading$ | async" fxLayout="column" fxLayoutAlign="center center"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
[showCasePanelIcon]="showCasePanelIcon"
[showDeleteMenu]="showDeleteMenu"
[case_]="case_" [selectedHeaders$]="selectedHeaders$" (click)="onCaseClick(case_)"
[first]="first" [last]="last">
[first]="first" [last]="last"
[disabled]="disabled"
>
</nc-case-panel>

<div *ngIf="loading$ | async" fxLayout="column" fxLayoutAlign="center center"
Expand Down
Loading