Skip to content

Commit

Permalink
fix: add uniqueOperation params for new departments api
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanBeaurepaire committed Dec 30, 2024
1 parent 59d170d commit 44420be
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ export class LuDepartmentFeederComponent extends ALuTreeOptionOperator<ILuDepart
this._service.filters = filters ?? [];
}

@Input() set uniqueOperation(uniqueOperation: number) {
this._service.uniqueOperation = uniqueOperation;
}

constructor(
@Inject(ALuDepartmentService)
@Optional()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@

<lu-tree-option-picker-advanced [option-comparer]="byId">
<header class="lu-picker-header" [class.mod-multiple]="multiple">
<lu-department-feeder [appInstanceId]="appInstanceId" [operations]="operations" [filters]="filters"></lu-department-feeder>
<lu-department-feeder
[appInstanceId]="appInstanceId"
[operations]="operations"
[filters]="filters"
[uniqueOperation]="uniqueOperation"
></lu-department-feeder>
<lu-tree-option-searcher [searchFn]="searchFn"></lu-tree-option-searcher>
<lu-tree-option-select-all class="option-selector"></lu-tree-option-select-all>
</header>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
LuOptionComparer,
LuTreeOptionItemComponent,
LuTreeOptionPickerAdvancedComponent,
LuTreeOptionPickerComponent,
LuTreeOptionSearcherComponent,
LuTreeOptionSelectAllComponent,
} from '@lucca-front/ng/option';
Expand All @@ -31,7 +30,6 @@ import { LU_DEPARTMENT_SELECT_INPUT_TRANSLATIONS } from './department-select-inp
OverlayModule,
A11yModule,
LuInputClearerComponent,
LuTreeOptionPickerComponent,
LuTreeOptionPickerAdvancedComponent,
LuDepartmentFeederComponent,
LuTreeOptionSearcherComponent,
Expand Down Expand Up @@ -60,6 +58,7 @@ export class LuDepartmentSelectInputComponent<
@Input() appInstanceId: number | string;
@Input() operations: number[];
@Input() filters: string[] = [];
@Input() uniqueOperation: number;

public intl = getIntl(LU_DEPARTMENT_SELECT_INPUT_TRANSLATIONS);

Expand Down
7 changes: 6 additions & 1 deletion packages/ng/department/service/department-v4.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ export class LuDepartmentV4Service {
this._operations = operations;
}

protected _uniqueOperation: number;
set uniqueOperation(uniqueOperation: number) {
this._uniqueOperation = uniqueOperation;
}

constructor(private _http: HttpClient) {}

getTrees() {
Expand All @@ -40,7 +45,7 @@ export class LuDepartmentV4Service {
>(`/api/v3/departments/scopedtree?fields=id,name&${[`appInstanceId=${this._appInstanceId}`, `operations=${this._operations.join(',')}`, this._filters.join(',')].filter((f) => !!f).join('&')}`)
.pipe(map((response) => response.data));
} else {
call = this._http.get<IApiDepartment>(`${this.api}/tree`);
call = this._http.get<IApiDepartment>(`${this.api}/tree`, { params: { uniqueOperation: this.uniqueOperation } });
}

return call.pipe(
Expand Down

0 comments on commit 44420be

Please sign in to comment.