diff --git a/build.gradle.kts b/build.gradle.kts index de0a08a..9b25b66 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -56,7 +56,6 @@ repositories { vaadin.productionMode = System.getenv("PROD_MODE")?.toBoolean() ?: false - vaadin { forceProductionBuild = System.getenv("PROD_MODE")?.toBoolean() ?: false productionMode = System.getenv("PROD_MODE")?.toBoolean() ?: false diff --git a/src/main/kotlin/com/albatros/springsecurity/data/repository/TenderSearchRepository.kt b/src/main/kotlin/com/albatros/springsecurity/data/repository/TenderSearchRepository.kt index 140184e..139b8e7 100644 --- a/src/main/kotlin/com/albatros/springsecurity/data/repository/TenderSearchRepository.kt +++ b/src/main/kotlin/com/albatros/springsecurity/data/repository/TenderSearchRepository.kt @@ -74,17 +74,15 @@ interface TenderSearchRepository : ElasticsearchRepository { """ ) fun fullTextSearchOr(keywords: String, exclude: String): List + + fun findAllByCategoryIgnoreCase(category: String, pageable: Pageable): List + fun findAllByTenderId(tenderId: String, pageable: Pageable): Page fun findAllByCustomerContainsIgnoreCase(customer: String, pageable: Pageable): Page fun findAllByRegionContainsIgnoreCase(region: String, pageable: Pageable): Page - fun findAllByRegion(region: String, pageable: Pageable): Page - fun findAllByRegionIgnoreCase(region: String, pageable: Pageable): Page - - fun findAllByCategoryIgnoreCase(category: String, pageable: Pageable): Page - fun findAllByCategory(category: String, pageable: Pageable): Page fun findAllByEtpEqualsIgnoreCase(etp: String, pageable: Pageable): Page diff --git a/src/main/kotlin/com/albatros/springsecurity/presentation/route/MainRoute.kt b/src/main/kotlin/com/albatros/springsecurity/presentation/route/MainRoute.kt deleted file mode 100644 index 055f240..0000000 --- a/src/main/kotlin/com/albatros/springsecurity/presentation/route/MainRoute.kt +++ /dev/null @@ -1,38 +0,0 @@ -package com.albatros.springsecurity.presentation.route - -import com.albatros.springsecurity.data.model.database.TenderProvider -import com.albatros.springsecurity.data.repository.TenderProviderRepository -import com.vaadin.flow.component.Text -import com.vaadin.flow.component.button.Button -import com.vaadin.flow.component.grid.Grid -import com.vaadin.flow.component.notification.Notification -import com.vaadin.flow.component.orderedlayout.VerticalLayout -import com.vaadin.flow.router.Route -import com.vaadin.flow.spring.data.VaadinSpringDataHelpers - -@Route("") -class MainRoute( - repository: TenderProviderRepository -) : VerticalLayout() { - - init { - add( - Text("Lig ma who?"), - Button( - "Lig ma Balls" - ) { - Notification.show("CDs nuts").open() - }, - Grid().apply { - addColumn(TenderProvider::tenderId).setHeader("Tender Id") - addColumn(TenderProvider::etpName).setHeader("Name") - - setItems { - repository.findAll( - VaadinSpringDataHelpers.toSpringPageRequest(it) - ).stream() - } - } - ) - } -} diff --git a/src/main/kotlin/com/albatros/springsecurity/presentation/route/TestRoute.kt b/src/main/kotlin/com/albatros/springsecurity/presentation/route/TestRoute.kt index 971cadc..20f2a24 100644 --- a/src/main/kotlin/com/albatros/springsecurity/presentation/route/TestRoute.kt +++ b/src/main/kotlin/com/albatros/springsecurity/presentation/route/TestRoute.kt @@ -16,7 +16,7 @@ import com.vaadin.flow.component.textfield.TextField import com.vaadin.flow.router.Route import com.vaadin.flow.spring.data.VaadinSpringDataHelpers -@Route("test") +@Route("") class TestRoute(repository: TenderSearchRepository) : VerticalLayout() { init { @@ -50,16 +50,10 @@ class TestRoute(repository: TenderSearchRepository) : VerticalLayout() { val sheet: Grid = getBaseTable() -// val dialog = Dialog().apply { -// headerTitle = "Test" -// } - val button = Button("Найти", VaadinIcon.SEARCH.create()) { val includeText = includeTextField.value val excludeText = excludeTextField.value -// dialog.open() - sheet.setItems( repository.fullTextSearchOr( includeText, @@ -82,7 +76,6 @@ class TestRoute(repository: TenderSearchRepository) : VerticalLayout() { return Div( horizontalLayout, sheet, -// dialog ) } private fun getLockedSearch(repository: TenderSearchRepository): Div { @@ -92,6 +85,8 @@ class TestRoute(repository: TenderSearchRepository) : VerticalLayout() { select.setItems( "По категории", "По площадке", + "По тендеру", + "По покупателю", ) val div = Div(getBaseTable()) @@ -160,6 +155,76 @@ class TestRoute(repository: TenderSearchRepository) : VerticalLayout() { button, ) + div.add( + hl, + sheet, + ) + } + if (select.value == "По тендеру") { + div.removeAll() + + val sheet: Grid = getBaseTable() + + val tenderText = TextField() + + tenderText.placeholder = "Тендер" + + val button = Button("Найти", VaadinIcon.SEARCH.create()) { + val tender = tenderText.value + + sheet.setItems { + repository.findAllByTenderNameContainingIgnoreCase( + tender, + VaadinSpringDataHelpers.toSpringPageRequest(it) + ).stream() + } + } + + button.addThemeVariants( + ButtonVariant.LUMO_PRIMARY, + ButtonVariant.LUMO_CONTRAST, + ) + + val hl = HorizontalLayout( + tenderText, + button, + ) + + div.add( + hl, + sheet, + ) + } + if (select.value == "По покупателю") { + div.removeAll() + + val sheet: Grid = getBaseTable() + + val customerText = TextField() + + customerText.placeholder = "Покупатель" + + val button = Button("Найти", VaadinIcon.SEARCH.create()) { + val customer = customerText.value + + sheet.setItems { + repository.findAllByCustomerContainsIgnoreCase( + customer, + VaadinSpringDataHelpers.toSpringPageRequest(it) + ).stream() + } + } + + button.addThemeVariants( + ButtonVariant.LUMO_PRIMARY, + ButtonVariant.LUMO_CONTRAST, + ) + + val hl = HorizontalLayout( + customerText, + button, + ) + div.add( hl, sheet, @@ -179,6 +244,7 @@ class TestRoute(repository: TenderSearchRepository) : VerticalLayout() { private fun getBaseTable(): Grid { + val sheet: Grid = Grid().apply { addColumn(Tender::tenderName) .setHeader("Тендер")