Add UI to prevent assigning more than 10 asignees

This commit is contained in:
Stanko K.R.
2025-12-15 16:00:11 +01:00
parent 15daa2bf05
commit 15cb1f7fe1
3 changed files with 48 additions and 8 deletions
@@ -0,0 +1,26 @@
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static values = { limit: Number, count: Number }
static targets = ["unassigned", "limitMessage"]
connect() {
this.updateState()
}
countValueChanged() {
this.updateState()
}
updateState() {
const atLimit = this.countValue >= this.limitValue
this.unassignedTargets.forEach(el => {
el.hidden = atLimit
})
if (this.hasLimitMessageTarget) {
this.limitMessageTarget.hidden = !atLimit
}
}
}