Fix typo
This commit is contained in:
parent
70e1c2ec26
commit
f417764695
|
@ -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 {
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -19,35 +19,35 @@ class CalendarTools(entry: CalendarEntry) : ViewCollection<View>() {
|
|||
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<View>() {
|
|||
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<View>() {
|
|||
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<View>() {
|
|||
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<View>() {
|
|||
textView("+10") {
|
||||
title = "Schedule 10 minutes later"
|
||||
onClick {
|
||||
if (schedule.lookTime) return@onClick
|
||||
if (schedule.lockTime) return@onClick
|
||||
|
||||
entry.pending = true
|
||||
launch {
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -24,8 +24,8 @@ object ScheduleRepository : Repository<Schedule> {
|
|||
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<Schedule> {
|
|||
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<Schedule> {
|
|||
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<Schedule> {
|
|||
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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue