From 3d165ee610d33ec10c7998eada1ac754ad5eebe1 Mon Sep 17 00:00:00 2001 From: Hartmut Bauer Date: Wed, 21 Oct 2026 01:29:35 +0200 Subject: [PATCH] progress --- server/buildnumber.properties | 4 +- server/src/main/kotlin/Version.kt | 12 ++-- .../src/main/kotlin/books/config/Routing.kt | 6 ++ server/src/main/kotlin/books/ui/BookEdit.kt | 62 ++++++++++++++++--- .../src/main/kotlin/books/ui/BookEditPage.kt | 6 +- server/src/main/kotlin/books/ui/BooksPage.kt | 2 +- .../src/main/kotlin/books/ui/BooksTemplate.kt | 6 +- server/src/main/kotlin/books/ui/Helpers.kt | 4 +- .../main/kotlin/books/ui/ImportEditPage.kt | 2 +- server/src/main/kotlin/books/ui/ImportPage.kt | 2 +- server/src/main/kotlin/books/ui/TestPage.kt | 38 +++++++++++- server/src/main/kotlin/core/ui/LandingPage.kt | 2 +- 12 files changed, 116 insertions(+), 30 deletions(-) diff --git a/server/buildnumber.properties b/server/buildnumber.properties index d307f4f..467dc88 100644 --- a/server/buildnumber.properties +++ b/server/buildnumber.properties @@ -1,3 +1,3 @@ #auto generated -#Mon Oct 19 00:45:22 CEST 2026 -build.number=633 +#Wed Oct 21 01:06:20 CEST 2026 +build.number=655 diff --git a/server/src/main/kotlin/Version.kt b/server/src/main/kotlin/Version.kt index 5394b59..92cbc68 100644 --- a/server/src/main/kotlin/Version.kt +++ b/server/src/main/kotlin/Version.kt @@ -4,13 +4,13 @@ import net.keinekekse.version.Version object VERSION: Version { override val version = "0.2.0-alpha" - override val fullVersion = "0.2.0-alpha+build.633" + override val fullVersion = "0.2.0-alpha+build.655" override val major = 0 override val minor = 2 override val patch = 0 override val preRelease = "alpha" - override val buildMetadata = "build.633" - override val buildDate = "2026-10-18T22:45:22.165046Z" + override val buildMetadata = "build.655" + override val buildDate = "2026-10-20T23:06:20.951648Z" override val displayName = "Application Server" override val copyright = "Copyright (c) 2026 Hartmut Bauer" override val name = "server" @@ -18,13 +18,13 @@ object VERSION: Version { } object VERSION_books: Version { override val version = "0.2.0-alpha" - override val fullVersion = "0.2.0-alpha+build.633" + override val fullVersion = "0.2.0-alpha+build.655" override val major = 0 override val minor = 2 override val patch = 0 override val preRelease = "alpha" - override val buildMetadata = "build.633" - override val buildDate = "2026-10-18T22:45:22.165140Z" + override val buildMetadata = "build.655" + override val buildDate = "2026-10-20T23:06:20.951769Z" override val displayName = "Books-DB" override val copyright = "Copyright (c) 2026 Hartmut Bauer" override val name = "books" diff --git a/server/src/main/kotlin/books/config/Routing.kt b/server/src/main/kotlin/books/config/Routing.kt index ba17722..f6b1c1c 100644 --- a/server/src/main/kotlin/books/config/Routing.kt +++ b/server/src/main/kotlin/books/config/Routing.kt @@ -135,6 +135,12 @@ fun Application.configureRouting( val receiveParameters = call.receiveParameters() val session = getSession(receiveParameters["sessionId"], sessions, call.principal.userId) + // TODO + call.application.log.info("## New publisher form OK ") + receiveParameters.forEach { param: String, value: List -> + call.application.log.info("## param: $param, value: $value") + } + } hx.post("${navBooksEdit.second}/addseries") { val receiveParameters = call.receiveParameters() diff --git a/server/src/main/kotlin/books/ui/BookEdit.kt b/server/src/main/kotlin/books/ui/BookEdit.kt index 8fea2ec..09825cc 100644 --- a/server/src/main/kotlin/books/ui/BookEdit.kt +++ b/server/src/main/kotlin/books/ui/BookEdit.kt @@ -136,6 +136,7 @@ fun FlowContent.bookEdit( } select(classes = "$cssTextInput w-74") { name = "publisher" + id = "publisher" option { value = "0" @@ -294,7 +295,7 @@ fun FlowContent.bookEdit( // evtl. switch oder // Teil von Sammelband _____v / enthält (-> Link) - div(classes = "flex flex-row mb-5 mr-2 justify-end") { + div(classes = "flex flex-row mb-5 mr-2 justify-end w-180") { button(classes = "$cssButtonStd block mt-8 mr-10") { type = ButtonType.button onClick = @@ -316,13 +317,58 @@ fun FlowContent.bookEdit( id = "publisherDialog" // attributes["popover"] = "true" // attributes["closedby"] = "any" - div { - +"Test-Verlag" - } - button(classes = cssButtonStd) { - attributes["commandfor"] = "publisherDialog" - attributes["command"] = "close" - +"Close" + form { + id = "publisherDialogForm" + attributes.hx { + post = "${navBooksEdit.second}/addpublisher" + target = "#publisher" + swap = "innerHTML" + validate = true + on( + event = "after-request", + script = "this.reset();document.getElementById('publisherDialog').close()" + ) + } + input(type = InputType.hidden, name = "sessionId") { + value = session.sessionId + } + input(type = InputType.hidden, name = "bookId") { + value = session.data.book.id.toString() + } + + div(classes = "flex flex-row mb-5 h-9") { + div(classes = "content-center pr-6 text-nowrap") { + +"Neuer Verlag:" + } + input(classes = "$cssTextInput w-75") { + name = "newpublisher" + required = true + value = "" + onBlur = """ + const select = document.getElementById('publisher') + const optArray = Array.from(select.options) + if (optArray.some(opt => opt.text.toLowerCase() === this.value.toLowerCase() )) { + this.setCustomValidity('Dieser Verlag existiert bereits.'); + } else { + this.setCustomValidity(''); + } + """ + } + } + div(classes = "flex flex-row mb-5 mr-2 justify-end") { + button(classes = "$cssButtonStd block mt-8 mr-10") { + type = ButtonType.button + onClick = + "document.getElementById('publisherDialogForm').reset()" + attributes["commandfor"] = "publisherDialog" + attributes["command"] = "close" + +"Abbrechen" + } + button(classes = "$cssButtonPri block mt-8") { + type = ButtonType.submit + +"Speichern" + } + } } } output { } diff --git a/server/src/main/kotlin/books/ui/BookEditPage.kt b/server/src/main/kotlin/books/ui/BookEditPage.kt index 2856117..62d2995 100644 --- a/server/src/main/kotlin/books/ui/BookEditPage.kt +++ b/server/src/main/kotlin/books/ui/BookEditPage.kt @@ -1,6 +1,7 @@ package net.keinekekse.app.books.ui import kotlinx.html.HTML +import kotlinx.html.div import net.keinekekse.app.books.db.BookRepository import net.keinekekse.app.books.edit.BooksSessionData import net.keinekekse.app.core.auth.UserSession @@ -14,8 +15,9 @@ fun HTML.bookEditPage( navBooksEdit.first, mapOf(navBooks, Pair(navBooksEdit.first, "")) ) { - - bookEdit(booksRepo, session) + div(classes = "flex flex-row flex-auto overflow-auto w-0 min-w-1/1") { + bookEdit(booksRepo, session) + } } } diff --git a/server/src/main/kotlin/books/ui/BooksPage.kt b/server/src/main/kotlin/books/ui/BooksPage.kt index 75d810e..19d49e3 100644 --- a/server/src/main/kotlin/books/ui/BooksPage.kt +++ b/server/src/main/kotlin/books/ui/BooksPage.kt @@ -33,7 +33,7 @@ fun FlowContent.booksTable(booksRepo: BookRepository) { booksRepo.allBooks() } - div(classes = "flex-auto overflow-auto px-1 pb-1") { + div(classes = "flex-auto overflow-auto px-1 pb-1 w-0 min-w-1/1") { table { id = "bookstable" thead(classes = "$cssFixedTHead ") { diff --git a/server/src/main/kotlin/books/ui/BooksTemplate.kt b/server/src/main/kotlin/books/ui/BooksTemplate.kt index 3c48947..aafdd84 100644 --- a/server/src/main/kotlin/books/ui/BooksTemplate.kt +++ b/server/src/main/kotlin/books/ui/BooksTemplate.kt @@ -7,16 +7,16 @@ import net.keinekekse.app.core.ui.stdHead fun FlowContent.programName() { - a(classes = "flex") { + a(classes = "flex flex-nowrap text-nowrap") { href = navBooks.second title = "v ${VERSION_books.fullVersion}" - img(classes = "h-14 my-2 $bgHeaderIcon") { + img(classes = "h-8 md:h-14 my-2 $bgHeaderIcon") { src = "/static/books.png" } div(classes = "self-center text-right ml-3") { div { - div(classes = "text-3xl") { + div(classes = "text-xl md:text-3xl") { +VERSION_books.displayName } div(classes = "text-xs") { diff --git a/server/src/main/kotlin/books/ui/Helpers.kt b/server/src/main/kotlin/books/ui/Helpers.kt index 835f38a..7294779 100644 --- a/server/src/main/kotlin/books/ui/Helpers.kt +++ b/server/src/main/kotlin/books/ui/Helpers.kt @@ -58,8 +58,8 @@ const val cssFormIcon = "cursor-pointer m-0 px-2 pt-1 no-underline " const val cssTextInput = "rounded-sm border-1 border-slate-400 px-2 py-1 focus:border-orange-400 focus:border-4" + - " invalid:focus:bg-red-200 invalid:focus:border-red-500 invalid:focus:border-5" + - " invalid:bg-red-200 invalid:border-red-500 invalid:border-3 " + " invalid:focus:bg-red-200 invalid:focus:border-red-500 invalid:focus:border-4" + + " invalid:bg-red-200 invalid:border-red-500 invalid:border-2 " const val _cssTextInput = "rounded-sm border-b-1 px-2 py-1 focus:border-b-orange-400 focus:border-b-4" + " invalid:focus:bg-red-200 invalid:focus:border-red-500 invalid:focus:border-5" + diff --git a/server/src/main/kotlin/books/ui/ImportEditPage.kt b/server/src/main/kotlin/books/ui/ImportEditPage.kt index dccd416..ea2de3f 100644 --- a/server/src/main/kotlin/books/ui/ImportEditPage.kt +++ b/server/src/main/kotlin/books/ui/ImportEditPage.kt @@ -22,7 +22,7 @@ fun HTML.importEditPage( navBooksScanEdit.first, mapOf(navBooks, navBooksNew, Pair(navBooksScanEdit.first, "")) ) { - div(classes = "flex flex-row flex-auto") { + div(classes = "flex flex-row flex-auto overflow-auto w-0 min-w-1/1") { session.data.book = Book( title = bookInfo?.title ?: "", diff --git a/server/src/main/kotlin/books/ui/ImportPage.kt b/server/src/main/kotlin/books/ui/ImportPage.kt index 7d5889f..74c57da 100644 --- a/server/src/main/kotlin/books/ui/ImportPage.kt +++ b/server/src/main/kotlin/books/ui/ImportPage.kt @@ -36,7 +36,7 @@ fun HTML.importPage(books: List) { fun FlowContent.importTable(books: List) { - div(classes = "flex-auto overflow-auto px-1 pb-1") { + div(classes = "flex-auto overflow-auto px-1 pb-1 w-0 min-w-1/1") { table { id = "importtable" thead(classes = "$cssFixedTHead ") { diff --git a/server/src/main/kotlin/books/ui/TestPage.kt b/server/src/main/kotlin/books/ui/TestPage.kt index 8d7f954..0edba45 100644 --- a/server/src/main/kotlin/books/ui/TestPage.kt +++ b/server/src/main/kotlin/books/ui/TestPage.kt @@ -234,14 +234,22 @@ fun HTML.testPage(booksDb: Database) { //} fun FlowContent.testTable() { - div(classes = "flex-auto overflow-auto px-1 pb-1") { + div(classes = "flex-auto overflow-auto px-1 pb-1 w-0 min-w-1/1") { table { id = "testtable" thead(classes = "$cssFixedTHead ") { tr { th(classes = "py-3 px-2") { +"#" } - th(classes = "py-3 px-2") { +"Alias" } - th(classes = "py-3 px-2") { +"Score" } + th(classes = "py-3 px-2") { +"Alias0" } + th(classes = "py-3 px-2") { +"Score0" } + th(classes = "py-3 px-2") { +"Alias1" } + th(classes = "py-3 px-2") { +"Score1" } + th(classes = "py-3 px-2") { +"Alias2" } + th(classes = "py-3 px-2") { +"Score2" } + th(classes = "py-3 px-2") { +"Alias3" } + th(classes = "py-3 px-2") { +"Score3" } + th(classes = "py-3 px-2") { +"Alias4" } + th(classes = "py-3 px-2") { +"Score4" } th(classes = "py-3 px-2") { a { href = navBooksNew.second @@ -267,6 +275,30 @@ fun FlowContent.testTable() { td(classes = "border-t-1 $borderTable px-2 py-1") { +Random.nextLong().toString() } + td(classes = "border-t-1 $borderTable px-2 py-1") { + +Random.nextLong().toString() + } + td(classes = "border-t-1 $borderTable px-2 py-1") { + +Random.nextLong().toString() + } + td(classes = "border-t-1 $borderTable px-2 py-1") { + +Random.nextLong().toString() + } + td(classes = "border-t-1 $borderTable px-2 py-1") { + +Random.nextLong().toString() + } + td(classes = "border-t-1 $borderTable px-2 py-1") { + +Random.nextLong().toString() + } + td(classes = "border-t-1 $borderTable px-2 py-1") { + +Random.nextLong().toString() + } + td(classes = "border-t-1 $borderTable px-2 py-1") { + +Random.nextLong().toString() + } + td(classes = "border-t-1 $borderTable px-2 py-1") { + +Random.nextLong().toString() + } td(classes = "border-t-1 $borderTable px-2 py-1 text-nowrap") { materialSymbolButton("Edit") materialSymbolButton("Delete") diff --git a/server/src/main/kotlin/core/ui/LandingPage.kt b/server/src/main/kotlin/core/ui/LandingPage.kt index cae15cc..4db52e9 100644 --- a/server/src/main/kotlin/core/ui/LandingPage.kt +++ b/server/src/main/kotlin/core/ui/LandingPage.kt @@ -39,7 +39,7 @@ fun HTML.landingPage(loggedOn: Boolean) { } } } - div(classes = "lg:hidden p-8") { + div(classes = "md:hidden p-8") { a(classes = "inline-flex $cssMainLink") { href = navBooksScan.second