diff --git a/src/commonMain/kotlin/de/kif/common/model/Schedule.kt b/src/commonMain/kotlin/de/kif/common/model/Schedule.kt index 0931b08..2622d61 100644 --- a/src/commonMain/kotlin/de/kif/common/model/Schedule.kt +++ b/src/commonMain/kotlin/de/kif/common/model/Schedule.kt @@ -10,8 +10,8 @@ data class Schedule( val room: Room, val day: Int, val time: Int, - val lookRoom: Boolean, - val lookTime: Boolean, + val lockRoom: Boolean, + val lockTime: Boolean, override val createdAt: Long = 0, override val updateAt: Long = 0 ) : Model { diff --git a/src/jsMain/kotlin/de/kif/frontend/views/calendar/CalendarEntry.kt b/src/jsMain/kotlin/de/kif/frontend/views/calendar/CalendarEntry.kt index 42dc9f3..599c13e 100644 --- a/src/jsMain/kotlin/de/kif/frontend/views/calendar/CalendarEntry.kt +++ b/src/jsMain/kotlin/de/kif/frontend/views/calendar/CalendarEntry.kt @@ -37,11 +37,11 @@ class CalendarEntry(private val calendar: CalendarBody, view: HTMLElement) : Vie var error by classList.property("error") private var nextScroll = 0.0 - val editable: Boolean + private val editable: Boolean get() = calendar.editable - var moveLookRoom: Long? = null - var moveLookTime: Int? = null + private var moveLockRoom: Long? = null + private var moveLockTime: Int? = null private fun onMove(event: MouseEvent) { val position = event.toPoint() - mouseDelta @@ -51,10 +51,10 @@ class CalendarEntry(private val calendar: CalendarBody, view: HTMLElement) : Vie } if (cell != null) { - if (moveLookRoom != null && cell.roomId != moveLookRoom) { + if (moveLockRoom != null && cell.roomId != moveLockRoom) { return } - if (moveLookTime != null && cell.time != moveLookTime) { + if (moveLockTime != null && cell.time != moveLockTime) { return } @@ -123,8 +123,8 @@ class CalendarEntry(private val calendar: CalendarBody, view: HTMLElement) : Vie newRoom, calendar.day, newTime, - lookRoom = false, - lookTime = false + lockRoom = false, + lockTime = false ) ) html.remove() @@ -175,8 +175,8 @@ class CalendarEntry(private val calendar: CalendarBody, view: HTMLElement) : Vie mouseDelta = event.toPoint() - p - moveLookRoom = if (s.lookRoom) s.room.id else null - moveLookTime = if (s.lookTime) s.time else null + moveLockRoom = if (s.lockRoom) s.room.id else null + moveLockTime = if (s.lockTime) s.time else null startDrag() } diff --git a/src/jsMain/kotlin/de/kif/frontend/views/calendar/CalendarTools.kt b/src/jsMain/kotlin/de/kif/frontend/views/calendar/CalendarTools.kt index 6fd42d4..7cb1223 100644 --- a/src/jsMain/kotlin/de/kif/frontend/views/calendar/CalendarTools.kt +++ b/src/jsMain/kotlin/de/kif/frontend/views/calendar/CalendarTools.kt @@ -19,35 +19,35 @@ class CalendarTools(entry: CalendarEntry) : ViewCollection() { fun update(schedule: Schedule) { this.schedule = schedule setName(schedule.room, schedule.time) - lookRoomButton.classList["disabled"] = !schedule.lookRoom - lookTimeButton.classList["disabled"] = !schedule.lookTime + lockRoomButton.classList["disabled"] = !schedule.lockRoom + lockTimeButton.classList["disabled"] = !schedule.lockTime } private lateinit var nameView: TextView - private lateinit var lookRoomButton: IconView - private lateinit var lookTimeButton: IconView + private lateinit var lockRoomButton: IconView + private lateinit var lockTimeButton: IconView init { boxView { nameView = textView { } - lookRoomButton = iconView(MaterialIcon.GPS_FIXED) { - title = "Look room" + lockRoomButton = iconView(MaterialIcon.GPS_FIXED) { + title = "Lock room" onClick { entry.pending = true launch { val s = entry.schedule.get() - ScheduleRepository.update(s.copy(lookRoom = "disabled" in this.classList)) + ScheduleRepository.update(s.copy(lockRoom = "disabled" in this.classList)) } } } - lookTimeButton = iconView(MaterialIcon.ALARM) { - title = "Look time slot" + lockTimeButton = iconView(MaterialIcon.ALARM) { + title = "Lock time slot" onClick { entry.pending = true launch { val s = entry.schedule.get() - ScheduleRepository.update(s.copy(lookTime = "disabled" in this.classList)) + ScheduleRepository.update(s.copy(lockTime = "disabled" in this.classList)) } } } @@ -56,7 +56,7 @@ class CalendarTools(entry: CalendarEntry) : ViewCollection() { textView("-10") { title = "Schedule 10 minutes earlier" onClick { - if (schedule.lookTime) return@onClick + if (schedule.lockTime) return@onClick entry.pending = true launch { @@ -68,7 +68,7 @@ class CalendarTools(entry: CalendarEntry) : ViewCollection() { textView("-5") { title = "Schedule 5 minutes earlier" onClick { - if (schedule.lookTime) return@onClick + if (schedule.lockTime) return@onClick entry.pending = true launch { @@ -80,7 +80,7 @@ class CalendarTools(entry: CalendarEntry) : ViewCollection() { textView("+5") { title = "Schedule 5 minutes later" onClick { - if (schedule.lookTime) return@onClick + if (schedule.lockTime) return@onClick entry.pending = true launch { @@ -92,7 +92,7 @@ class CalendarTools(entry: CalendarEntry) : ViewCollection() { textView("+10") { title = "Schedule 10 minutes later" onClick { - if (schedule.lookTime) return@onClick + if (schedule.lockTime) return@onClick entry.pending = true launch { diff --git a/src/jvmMain/kotlin/de/kif/backend/database/Schema.kt b/src/jvmMain/kotlin/de/kif/backend/database/Schema.kt index 0ed1351..d71d65b 100644 --- a/src/jvmMain/kotlin/de/kif/backend/database/Schema.kt +++ b/src/jvmMain/kotlin/de/kif/backend/database/Schema.kt @@ -60,8 +60,8 @@ object DbSchedule : Table() { val roomId = long("room_id").index() val day = integer("day").index() val time = integer("time_slot") - val lookRoom = bool("look_room").default(false) - val lookTime = bool("look_time").default(false) + val lockRoom = bool("lock_room").default(false) + val lockTime = bool("lock_time").default(false) val createdAt = long("createdAt") val updatedAt = long("updatedAt") diff --git a/src/jvmMain/kotlin/de/kif/backend/repository/ScheduleRepository.kt b/src/jvmMain/kotlin/de/kif/backend/repository/ScheduleRepository.kt index 9ad772f..52848ad 100644 --- a/src/jvmMain/kotlin/de/kif/backend/repository/ScheduleRepository.kt +++ b/src/jvmMain/kotlin/de/kif/backend/repository/ScheduleRepository.kt @@ -24,8 +24,8 @@ object ScheduleRepository : Repository { val roomId = row[DbSchedule.roomId] val day = row[DbSchedule.day] val time = row[DbSchedule.time] - val lookRoom = row[DbSchedule.lookRoom] - val lookTime = row[DbSchedule.lookTime] + val lockRoom = row[DbSchedule.lockRoom] + val lockTime = row[DbSchedule.lockTime] val createdAt = row[DbSchedule.createdAt] val updatedAt = row[DbSchedule.updatedAt] @@ -35,7 +35,7 @@ object ScheduleRepository : Repository { val room = RoomRepository.get(roomId) ?: throw IllegalStateException("Room for schedule does not exist!") - return Schedule(id, workGroup, room, day, time, lookRoom, lookTime, createdAt, updatedAt) + return Schedule(id, workGroup, room, day, time, lockRoom, lockTime, createdAt, updatedAt) } override suspend fun get(id: Long): Schedule? { @@ -57,8 +57,8 @@ object ScheduleRepository : Repository { it[roomId] = model.room.id ?: throw IllegalArgumentException("Room does not exist!") it[day] = model.day it[time] = model.time - it[lookRoom] = model.lookRoom - it[lookTime] = model.lookTime + it[lockRoom] = model.lockRoom + it[lockTime] = model.lockTime it[createdAt] = now it[updatedAt] = now @@ -81,8 +81,8 @@ object ScheduleRepository : Repository { it[roomId] = model.room.id ?: throw IllegalArgumentException("Room does not exist!") it[day] = model.day it[time] = model.time - it[lookRoom] = model.lookRoom - it[lookTime] = model.lookTime + it[lockRoom] = model.lockRoom + it[lockTime] = model.lockTime it[updatedAt] = now }