Skip to content

Commit 6c720b8

Browse files
committed
[CST-4506] Fix item access condition remove operation
1 parent 232baf5 commit 6c720b8

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/app/submission/sections/accesses/section-accesses.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
[formModel]="formModel"
44
[displaySubmit]="false"
55
[displayCancel]="false"
6-
(dfChange)="onChange($event)"></ds-form>
6+
(dfChange)="onChange($event)"
7+
(removeArrayItem)="onRemove($event)"></ds-form>

src/app/submission/sections/accesses/section-accesses.component.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,17 @@ export class SubmissionSectionAccessesComponent extends SectionModelComponent {
222222
}
223223
}
224224

225+
/**
226+
* Method called when a form removeArrayItem event is fired.
227+
* Dispatch remove form operations based on changes.
228+
*/
229+
onRemove(event: DynamicFormControlEvent) {
230+
const fieldIndex = this.formOperationsService.getArrayIndexFromEvent(event);
231+
const fieldPath = 'accessConditions/' + fieldIndex;
232+
233+
this.operationsBuilder.remove(this.pathCombiner.getPath(fieldPath));
234+
}
235+
225236
/**
226237
* Unsubscribe from all subscriptions
227238
*/

0 commit comments

Comments
 (0)