Skip to content

Commit

Permalink
Visitorbook: minor bug fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
kreinhard committed Dec 18, 2024
1 parent 287b408 commit 0e69d3e
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 23 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ projectforge-application/src/main/kotlin/local
build
.kotlin
projectforge-webapp/node
projectforge-business/src/main/kotlin/testscripts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
<logger name="org.apache.wicket.Localizer" level="ERROR"/>

<logger name="org.hibernate.engine.internal.StatisticalLoggingSessionEventListener" level="ERROR"/>
<logger name="org.apache.poi.xssf.usermodel.XSSFWorkbook" level="ERROR"/>

<!-- For debugging Persistence calls, add to your projectforge.properties file: -->
<!--
# Logs all persistance calls (without lazy loadings by hibernate, but gives you a good overview):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ class Visitorbook(var lastname: String? = null,

var numberOfVisits: Int? = 0

var entries: List<VisitorbookEntry>? = null
var entries = emptyList<VisitorbookEntry>() // empty list required by frontend.

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import org.projectforge.framework.persistence.api.MagicFilter
import org.projectforge.rest.config.Rest
import org.projectforge.rest.core.AbstractDTOPagesRest
import org.projectforge.rest.core.PagesResolver
import org.projectforge.rest.dto.PostData
import org.projectforge.rest.dto.Visitorbook
import org.projectforge.rest.dto.VisitorbookEntry
import org.projectforge.ui.*
Expand Down Expand Up @@ -131,32 +132,39 @@ class VisitorbookPagesRest : AbstractDTOPagesRest<VisitorbookDO, Visitorbook, Vi
.add(company)
.add(UISelect.createUserSelect(lc, "contactPersons", true, "orga.visitorbook.contactPerson"))
.add(lc, "visitortype")
layout.layoutBelowActions.add(
UIFieldset(title = "orga.visitorbook.visits")
.add(
UIButton.createAddButton(
responseAction = ResponseAction(
createModalUrl(dto, true),
targetType = TargetType.MODAL
),
default = false,
)
)
.add(
UIAgGrid("entries")
.add(UIAgGridColumnDef.createCol(lc, "dateOfVisit", headerName = "date"))
.add(UIAgGridColumnDef.createCol(lc, "arrived", headerName = "orga.visitorbook.arrive"))
.add(UIAgGridColumnDef.createCol(lc, "departed", headerName = "orga.visitorbook.depart"))
.add(UIAgGridColumnDef.createCol(lc, "comment", headerName = "comment"))
.withRowClickRedirectUrl(
createModalUrl(dto),
openModal = true,
if (dto.id != null) {
layout.layoutBelowActions.add(
UIFieldset(title = "orga.visitorbook.visits")
.add(
UIButton.createAddButton(
responseAction = ResponseAction(
createModalUrl(dto, true),
targetType = TargetType.MODAL
),
default = false,
)
)
)
)
.add(
UIAgGrid("entries")
.add(UIAgGridColumnDef.createCol(lc, "dateOfVisit", headerName = "date"))
.add(UIAgGridColumnDef.createCol(lc, "arrived", headerName = "orga.visitorbook.arrive"))
.add(UIAgGridColumnDef.createCol(lc, "departed", headerName = "orga.visitorbook.depart"))
.add(UIAgGridColumnDef.createCol(lc, "comment", headerName = "comment"))
.withRowClickRedirectUrl(
createModalUrl(dto),
openModal = true,
)
)
)
}
return LayoutUtils.processEditPage(layout, dto, this)
}

override fun onAfterSave(obj: VisitorbookDO, postData: PostData<Visitorbook>): ResponseAction {
return ResponseAction(PagesResolver.getEditPageUrl(VisitorbookPagesRest::class.java, obj.id, absolute = true))
.addVariable("id", obj.id ?: -1)
}

private fun createModalUrl(
visitorbook: Visitorbook,
newEntry: Boolean = false
Expand Down

0 comments on commit 0e69d3e

Please sign in to comment.