Bugfixes
This commit is contained in:
parent
b473221f92
commit
4596a78697
|
@ -21,6 +21,9 @@ class Calendar(calendar: HTMLElement) : View(calendar) {
|
|||
val calendarTable = calendar.getElementsByClassName("calendar-table")[0] as HTMLElement
|
||||
private val calendarTableHeader = calendar.getElementsByClassName("calendar-header")[0] as HTMLElement
|
||||
|
||||
val showAllWorkGroupsBtn =
|
||||
(document.getElementById("calendar-all-work-groups") as? HTMLElement)?.let { wrap(it) }
|
||||
|
||||
private val htmlBody = document.body ?: createHtmlView()
|
||||
|
||||
val day = calendarTable.dataset["day"]?.toIntOrNull() ?: -1
|
||||
|
|
|
@ -58,12 +58,18 @@ class CalendarEdit(
|
|||
|
||||
for (workGroup in WorkGroupRepository.all()) {
|
||||
workGroupList += CalendarWorkGroup(calendar, this, workGroup).also {
|
||||
it.isScheduled = workGroup in scheduled
|
||||
it.isScheduled = !showAll && workGroup in scheduled
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun update() {
|
||||
for (wk in workGroupList) {
|
||||
wk.isScheduled = !showAll && wk.workGroup in scheduled
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
toggleEditButton.onClick {
|
||||
calendar.classList.toggle("edit")
|
||||
|
@ -73,6 +79,12 @@ class CalendarEdit(
|
|||
}
|
||||
}
|
||||
|
||||
calendar.showAllWorkGroupsBtn?.onClick?.addListener {
|
||||
showAll = !showAll
|
||||
calendar.showAllWorkGroupsBtn.classList.toggle("btn-primary", showAll)
|
||||
update()
|
||||
}
|
||||
|
||||
onWheel {
|
||||
it.stopPropagation()
|
||||
}
|
||||
|
@ -95,9 +107,9 @@ class CalendarEdit(
|
|||
|
||||
val schedules = scheduled[schedule.workGroup] ?: emptyList()
|
||||
scheduled += schedule.workGroup to schedules + schedule
|
||||
|
||||
|
||||
workGroupList.firstOrNull { it.workGroup.id == schedule.workGroup.id }?.isScheduled = true
|
||||
|
||||
workGroupList.firstOrNull { it.workGroup.id == schedule.workGroup.id }?.isScheduled =
|
||||
!showAll && schedule.workGroup in scheduled
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,9 +117,15 @@ class CalendarEdit(
|
|||
val schedule = scheduled.values.flatten().firstOrNull { it.id == id } ?: return@onDelete
|
||||
|
||||
val schedules = scheduled[schedule.workGroup] ?: emptyList()
|
||||
scheduled += schedule.workGroup to schedules - schedule
|
||||
|
||||
workGroupList.firstOrNull { it.workGroup.id == schedule.workGroup.id }?.isScheduled = true
|
||||
val new = schedules - schedule
|
||||
if (new.isEmpty())
|
||||
scheduled -= schedule.workGroup
|
||||
else
|
||||
scheduled += schedule.workGroup to schedules - schedule
|
||||
|
||||
workGroupList.firstOrNull { it.workGroup.id == schedule.workGroup.id }?.isScheduled =
|
||||
!showAll && schedule.workGroup in scheduled
|
||||
}
|
||||
|
||||
listView.listFactory(sortedList)
|
||||
|
|
|
@ -202,7 +202,7 @@ fun Route.account() {
|
|||
}
|
||||
|
||||
get("/account/import") {
|
||||
authenticateOrRedirect(Permission.SCHEDULE) { user ->
|
||||
authenticateOrRedirect(Permission.SCHEDULE) {
|
||||
val tracks = TrackRepository.all()
|
||||
val wikiSections = WikiImporter.loadSections()
|
||||
|
||||
|
|
|
@ -308,6 +308,10 @@ fun Route.calendar() {
|
|||
id = "calendar-auto-check-constraints"
|
||||
+"Auto check"
|
||||
}
|
||||
button(classes = "form-btn") {
|
||||
id = "calendar-all-work-groups"
|
||||
+"Alle AKs"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue