initial commit
This commit is contained in:
commit
d84861949f
92 files changed
+8425
No files matched your search
@@ -0,0 +1,202 @@
|
||||
package net.keinekekse.app.books.ui
|
||||
|
||||
import io.ktor.htmx.html.*
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import kotlinx.html.*
|
||||
import net.keinekekse.app.books.db.BookRepository
|
||||
import net.keinekekse.app.books.model.*
|
||||
import net.keinekekse.app.books.model.Tag
|
||||
|
||||
fun FlowContent.bookEdit(book: Book, booksRepo: BookRepository) {
|
||||
|
||||
val publishers: List<Publisher> = runBlocking {
|
||||
booksRepo.allPublishers()
|
||||
}
|
||||
val series: List<Series> = runBlocking {
|
||||
booksRepo.allSeries()
|
||||
}
|
||||
val artists: List<Artist> = runBlocking {
|
||||
booksRepo.allArtists()
|
||||
}
|
||||
val tags: List<Tag> = runBlocking {
|
||||
booksRepo.allTags()
|
||||
}
|
||||
|
||||
div(classes = "flex flex-col m-8") {
|
||||
form {
|
||||
attributes.hx {
|
||||
post = navBooksEdit.second
|
||||
target = "#response"
|
||||
swap = "innerHTML"
|
||||
}
|
||||
|
||||
div(classes = "flex flex-row mb-5 h-9") {
|
||||
div(classes = "w-30 ") {
|
||||
+"Titel:"
|
||||
}
|
||||
input(classes = "$cssTextInput w-150") {
|
||||
name = "title"
|
||||
tabIndex = "1"
|
||||
value = book.title
|
||||
}
|
||||
|
||||
}
|
||||
div(classes = "flex flex-row mb-5 h-9") {
|
||||
div(classes = "w-30 ") {
|
||||
+"Originaltitel:"
|
||||
}
|
||||
input(classes = "$cssTextInput w-150") {
|
||||
name = "originaltitle"
|
||||
tabIndex = "2"
|
||||
value = book.originalTitle ?: ""
|
||||
}
|
||||
|
||||
}
|
||||
div(classes = "flex flex-row mb-5 h-9") {
|
||||
div(classes = "w-30 ") {
|
||||
+"Untertitel:"
|
||||
}
|
||||
input(classes = "$cssTextInput w-150") {
|
||||
name = "subtitle"
|
||||
tabIndex = "3"
|
||||
value = book.subTitle ?: ""
|
||||
}
|
||||
}
|
||||
div(classes = "flex flex-row mb-5 h-9") {
|
||||
div(classes = "w-30") {
|
||||
+"Sprache"
|
||||
}
|
||||
select(classes = "$cssTextInput w-16") {
|
||||
name = "language"
|
||||
tabIndex = "4"
|
||||
|
||||
for (language in Languages.entries) {
|
||||
option {
|
||||
if (language == book.language)
|
||||
selected = true
|
||||
value = language.ordinal.toString()
|
||||
+language.name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
div(classes = "ml-9 pr-3 ") {
|
||||
+"Erscheinungsjahr:"
|
||||
}
|
||||
input(classes = "$cssTextInput w-16") {
|
||||
name = "year"
|
||||
tabIndex = "5"
|
||||
value = book.year.toString()
|
||||
}
|
||||
|
||||
div(classes = "ml-8 pr-3") {
|
||||
+"Jahr der Originalausgabe:"
|
||||
}
|
||||
input(classes = "$cssTextInput w-16") {
|
||||
name = "originalyear"
|
||||
tabIndex = "6"
|
||||
value = book.originalYear?.toString() ?: ""
|
||||
}
|
||||
|
||||
}
|
||||
div(classes = "flex flex-row mb-5 h-9") {
|
||||
div(classes = "w-30") {
|
||||
+"ISBN"
|
||||
}
|
||||
input(classes = "$cssTextInput w-40") {
|
||||
name = "isbn"
|
||||
tabIndex = "7"
|
||||
value = book.isbn
|
||||
}
|
||||
|
||||
div(classes = "ml-14 pr-3") {
|
||||
+"Verlag"
|
||||
}
|
||||
select(classes = "$cssTextInput w-74") {
|
||||
name = "publisher"
|
||||
tabIndex = "8"
|
||||
|
||||
option {
|
||||
value = "0"
|
||||
+"---"
|
||||
}
|
||||
for (pub in publishers) {
|
||||
option {
|
||||
if (pub == book.publisher)
|
||||
selected = true
|
||||
value = pub.id.toString()
|
||||
+pub.name
|
||||
}
|
||||
}
|
||||
}
|
||||
a(classes = cssFormIcon) {
|
||||
tabIndex = "9"
|
||||
title = "Verlag hinzufügen"
|
||||
materialSymbolFormButton("add_box")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
div(classes = "flex flex-row mb-5 h-9") {
|
||||
div(classes = "w-30") {
|
||||
+"Serie"
|
||||
}
|
||||
select(classes = "$cssTextInput w-98") {
|
||||
name = "series"
|
||||
tabIndex = "10"
|
||||
|
||||
option {
|
||||
value = "0"
|
||||
+"---"
|
||||
}
|
||||
for (serie in series) {
|
||||
option {
|
||||
if (serie == book.series)
|
||||
selected = true
|
||||
value = serie.id.toString()
|
||||
+serie.name
|
||||
}
|
||||
}
|
||||
}
|
||||
a(classes = cssFormIcon) {
|
||||
tabIndex = "11"
|
||||
title = "Serie hinzufügen"
|
||||
materialSymbolFormButton("add_box")
|
||||
}
|
||||
|
||||
div(classes = "ml-13 pr-3 ") {
|
||||
+"Index"
|
||||
}
|
||||
input(classes = "$cssTextInput w-16") {
|
||||
name = "seriesindex"
|
||||
tabIndex = "12"
|
||||
value = book.seriesIndex?.toString() ?: ""
|
||||
}
|
||||
}
|
||||
|
||||
div(classes = "flex flex-row mb-5 h-9") {
|
||||
// artists tags
|
||||
// | | | |
|
||||
// | | | |
|
||||
|
||||
}
|
||||
|
||||
div(classes = "flex flex-row mb-5 h-9") {
|
||||
// evtl. switch
|
||||
// Teil von Sammelband _____v / enthält (-> Link)
|
||||
// comment
|
||||
|
||||
}
|
||||
|
||||
|
||||
button(classes = "$cssButtonPri block mt-8") {
|
||||
tabIndex = "20"
|
||||
type = ButtonType.submit
|
||||
+"Save"
|
||||
}
|
||||
}
|
||||
div {
|
||||
id = "response"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user