Skip to content
Snippets Groups Projects
Verified Commit 9616f300 authored by Florian Azizian's avatar Florian Azizian
Browse files

FIX #12091 TIME 0:20 disabled current resId in searchList

parent 6b0b696c
No related branches found
No related tags found
No related merge requests found
...@@ -943,7 +943,7 @@ class ResController extends ResourceControlController ...@@ -943,7 +943,7 @@ class ResController extends ResourceControlController
try { try {
$res = ResModel::getOnView(['select' => ['res_id'], 'where' => ['res_id in (?)', "({$whereClause})"], 'data' => [$args['resources'], $args['userId'], $entities, $args['userId']]]); $res = ResModel::getOnView(['select' => ['res_id'], 'where' => ['res_id in (?)', "({$whereClause})"], 'data' => [$args['resources'], $args['userId'], $entities, $args['userId']]]);
return $res; return array_column($res, 'res_id');
} catch (\Exception $e) { } catch (\Exception $e) {
return []; return [];
} }
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
</mat-header-cell> </mat-header-cell>
<mat-cell *matCellDef="let row" style="width: 70px;flex: initial;"> <mat-cell *matCellDef="let row" style="width: 70px;flex: initial;">
<mat-checkbox color="primary" [checked]="row.checked" (change)="toggleRes($event,row)" <mat-checkbox color="primary" [checked]="row.checked" (change)="toggleRes($event,row)"
(click)="$event.stopPropagation();"> (click)="$event.stopPropagation();" [disabled]="row.resId == currentResId">
</mat-checkbox> </mat-checkbox>
</mat-cell> </mat-cell>
</ng-container> </ng-container>
...@@ -71,4 +71,4 @@ ...@@ -71,4 +71,4 @@
<mat-header-row *matHeaderRowDef="displayedColumnsResource"></mat-header-row> <mat-header-row *matHeaderRowDef="displayedColumnsResource"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumnsResource;" class="rowData"></mat-row> <mat-row *matRowDef="let row; columns: displayedColumnsResource;" class="rowData"></mat-row>
</mat-table> </mat-table>
</div> </div>
\ No newline at end of file
...@@ -38,6 +38,7 @@ export class SearchAdvListComponent implements OnInit { ...@@ -38,6 +38,7 @@ export class SearchAdvListComponent implements OnInit {
searchResource = new FormControl(); searchResource = new FormControl();
@Input('search') search: string = ''; @Input('search') search: string = '';
@Input('currentResId') currentResId: number;
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator; @ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
@ViewChild('tableResourceListSort', { static: true }) sort: MatSort; @ViewChild('tableResourceListSort', { static: true }) sort: MatSort;
...@@ -129,9 +130,12 @@ export class SearchAdvListComponent implements OnInit { ...@@ -129,9 +130,12 @@ export class SearchAdvListComponent implements OnInit {
this.selectedRes = []; this.selectedRes = [];
if (e.checked) { if (e.checked) {
this.data.forEach((element: any) => { this.data.forEach((element: any) => {
element['checked'] = true; if (element['resId'] != this.currentResId) {
element['checked'] = true;
}
}); });
this.selectedRes = JSON.parse(JSON.stringify(this.allResInSearch)); let selectResEnabled = this.allResInSearch.filter(elem => elem != this.currentResId)
this.selectedRes = JSON.parse(JSON.stringify(selectResEnabled));
} else { } else {
this.data.forEach((element: any) => { this.data.forEach((element: any) => {
element['checked'] = false; element['checked'] = false;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
</button></h1> </button></h1>
<mat-dialog-content class="modal-container"> <mat-dialog-content class="modal-container">
<app-criteria-tool (searchUrlGenerated)="launchSearch($event)" [defaultCriteria]="['resourceField','contactField']"></app-criteria-tool> <app-criteria-tool (searchUrlGenerated)="launchSearch($event)" [defaultCriteria]="['resourceField','contactField']"></app-criteria-tool>
<search-adv-list #appSearchAdvList></search-adv-list> <search-adv-list #appSearchAdvList [currentResId]="data.resId"></search-adv-list>
</mat-dialog-content> </mat-dialog-content>
<div mat-dialog-actions class="actions"> <div mat-dialog-actions class="actions">
<button mat-raised-button color="primary" [disabled]="appSearchAdvList.getSelectedRessources().length === 0" <button mat-raised-button color="primary" [disabled]="appSearchAdvList.getSelectedRessources().length === 0"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment