Components/create-edit-modal: change number of required images

This commit is contained in:
Toast 2025-02-07 18:59:27 +01:00
parent d7c9e892d4
commit c2c008c952
2 changed files with 8 additions and 2 deletions

View file

@ -40,7 +40,7 @@
<input formControlName="{{$index}}" type="text" class="form-control" placeholder="">
<label class="form-label">Image {{ $index + 1 }} URL</label>
</div>
@if (!$first) {
@if ($index >= requiredImages) {
<button type="button" class="btn btn-outline-danger" (click)="removeImageControl($index)">
<i class="bi bi-x-lg"></i>
</button>

View file

@ -24,8 +24,10 @@ export class CreateEditModalComponent {
protected editMode: boolean = false
protected show?: Show
protected requiredImages: number
constructor() {
this.requiredImages = 3
this.initForm()
}
@ -50,7 +52,11 @@ export class CreateEditModalComponent {
this.addImageControl(imageUrl)
})
} else {
let i: number = this.requiredImages
do {
this.addImageControl()
i--
} while (i != 0)
}
}