Skip to content

Commit

Permalink
Merge pull request #8 from AlbatovK/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbatovK authored Mar 29, 2024
2 parents 0e6a5d4 + 4d7da95 commit 05a11f1
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 52 deletions.
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,15 @@ interface TenderSearchRepository : ElasticsearchRepository<Tender, String> {
"""
)
fun fullTextSearchOr(keywords: String, exclude: String): List<Tender>

fun findAllByCategoryIgnoreCase(category: String, pageable: Pageable): List<Tender>

fun findAllByTenderId(tenderId: String, pageable: Pageable): Page<Tender>

fun findAllByCustomerContainsIgnoreCase(customer: String, pageable: Pageable): Page<Tender>

fun findAllByRegionContainsIgnoreCase(region: String, pageable: Pageable): Page<Tender>

fun findAllByRegion(region: String, pageable: Pageable): Page<Tender>
fun findAllByRegionIgnoreCase(region: String, pageable: Pageable): Page<Tender>

fun findAllByCategoryIgnoreCase(category: String, pageable: Pageable): Page<Tender>

fun findAllByCategory(category: String, pageable: Pageable): Page<Tender>

fun findAllByEtpEqualsIgnoreCase(etp: String, pageable: Pageable): Page<Tender>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -50,16 +50,10 @@ class TestRoute(repository: TenderSearchRepository) : VerticalLayout() {

val sheet: Grid<Tender> = 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,
Expand All @@ -82,7 +76,6 @@ class TestRoute(repository: TenderSearchRepository) : VerticalLayout() {
return Div(
horizontalLayout,
sheet,
// dialog
)
}
private fun getLockedSearch(repository: TenderSearchRepository): Div {
Expand All @@ -92,6 +85,8 @@ class TestRoute(repository: TenderSearchRepository) : VerticalLayout() {
select.setItems(
"По категории",
"По площадке",
"По тендеру",
"По покупателю",
)

val div = Div(getBaseTable())
Expand Down Expand Up @@ -160,6 +155,76 @@ class TestRoute(repository: TenderSearchRepository) : VerticalLayout() {
button,
)

div.add(
hl,
sheet,
)
}
if (select.value == "По тендеру") {
div.removeAll()

val sheet: Grid<Tender> = 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<Tender> = 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,
Expand All @@ -179,6 +244,7 @@ class TestRoute(repository: TenderSearchRepository) : VerticalLayout() {

private fun getBaseTable(): Grid<Tender> {


val sheet: Grid<Tender> = Grid<Tender>().apply {
addColumn(Tender::tenderName)
.setHeader("Тендер")
Expand Down

0 comments on commit 05a11f1

Please sign in to comment.