Skip to content

Commit

Permalink
#49 search views
Browse files Browse the repository at this point in the history
  • Loading branch information
enmust committed Apr 12, 2021
1 parent f966d72 commit 881587e
Show file tree
Hide file tree
Showing 9 changed files with 118 additions and 74 deletions.
6 changes: 5 additions & 1 deletion src/components/area/AreaTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,14 @@
:title="$t('area.detailView')"
class="table-link"
>
{{ item.name }}
{{ $translate({ et: item.name, en: item.name_en }) }}
</router-link>
</template>

<template v-slot:item.maakond="{ item }">
<div>{{ $translate({ et: item.maakond, en: item.maakond_en }) }}</div>
</template>

<template v-slot:item.maardla="{ item }">
<a
class="table-link"
Expand Down
36 changes: 22 additions & 14 deletions src/components/sample/SampleSearch.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
<template>
<v-card flat>
<h1>
<CardTitleWrapper text="Otsing" :index="0" input-class="display-1" />
<CardTitleWrapper
:text="$t('common.search')"
:index="0"
input-class="display-1"
/>
</h1>

<div v-show="block.search[0]">
<v-row no-gutters class="px-1">
<v-col cols="12" md="6" lg="4" class="pa-1">
<AutocompleteWrapper
label="Maakond"
:label="$t('common.maakond')"
:items="getListCountiesAsArray"
return-object
:value="sampleSearchParams.maakond"
Expand All @@ -24,7 +28,7 @@

<v-col cols="12" md="6" lg="4" class="pa-1">
<AutocompleteWrapper
label="Turbaala"
:label="$t('common.area')"
:items="getListAreasAsArray"
return-object
:value="sampleSearchParams.area"
Expand All @@ -42,7 +46,7 @@
<TextFieldWrapper
:value="sampleSearchParams.site"
@input="updateParam($event, 'site')"
label="Proovipunkt/proov"
:label="$t('sample.siteSearch')"
/>
</v-col>

Expand All @@ -52,7 +56,7 @@
<TextFieldWrapper
:value="sampleSearchParams.depth_start"
@input="updateParam($event, 'depth_start')"
label="Sügavus alates"
:label="$t('common.depthStart')"
type="number"
suffix="(m)"
step="0.25"
Expand All @@ -62,7 +66,7 @@
<TextFieldWrapper
:value="sampleSearchParams.depth_end"
@input="updateParam($event, 'depth_end')"
label="Sügavus kuni"
:label="$t('common.depthEnd')"
type="number"
suffix="(m)"
step="0.25"
Expand All @@ -75,7 +79,7 @@
<TextFieldWrapper
:value="sampleSearchParams.rock"
@input="updateParam($event, 'rock')"
label="Turbaliik"
:label="$t('common.peatType')"
/>
</v-col>

Expand All @@ -102,7 +106,7 @@
<v-row no-gutters>
<v-col cols="4" class="pr-1">
<AutocompleteWrapper
label="Parameeter"
:label="$t('common.parameter')"
:items="distinctListParameters(entity)"
return-object
item-text="name"
Expand All @@ -117,7 +121,7 @@
<v-row no-gutters>
<v-col cols="5" class="px-1">
<AutocompleteWrapper
label="Otsingutüüp"
:label="$t('common.searchType')"
:items="lookUpTypes"
:value="entity.lookUpType"
@input="updateActiveParam($event, 'lookUpType', index)"
Expand All @@ -126,7 +130,7 @@

<v-col cols="7" class="px-1">
<TextFieldWrapper
label="Tekstiväli"
:label="$t('common.textField')"
:value="entity.text"
@input="updateActiveParam($event, 'text', index)"
/>
Expand All @@ -138,7 +142,7 @@
<v-row no-gutters>
<v-col cols="5" class="px-1">
<TextFieldWrapper
label="Alates"
:label="$t('common.from')"
type="number"
:value="entity.start"
@input="updateActiveParam($event, 'start', index)"
Expand All @@ -147,7 +151,7 @@

<v-col cols="5" class="px-1">
<TextFieldWrapper
label="Kuni"
:label="$t('common.to')"
type="number"
:value="entity.end"
@input="updateActiveParam($event, 'end', index)"
Expand Down Expand Up @@ -192,13 +196,13 @@
<v-row no-gutters class="px-1">
<v-col cols="12" class="pa-1">
<AutocompleteWrapper
label="Veerud"
:label="$t('common.columns')"
chips
clearable
multiple
:items="listParameters"
return-object
item-text="name"
item-text="i18n"
item-value="string"
:value="shownActiveListParameters"
@input="updateSampleHeaders"
Expand Down Expand Up @@ -296,6 +300,10 @@ export default {
this.$router.push({ query: query }).catch(err => {});
}
},
getListParameterItemText() {
}
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/sample/SampleTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
:title="$t('site.detailView')"
class="table-link"
>
{{ item.site }}
<div>{{ $translate({ et: item.site, en: item.site_en }) }}</div>
</router-link>
</template>

Expand All @@ -115,7 +115,7 @@
{{ $t(`sample.${item.rock}`) }}
</span>
<span v-else>
{{ item.rock }}
{{ $translate({ et: item.rock, en: item.rock_en }) }}
</span>
</v-card>
</template>
Expand Down
8 changes: 6 additions & 2 deletions src/components/site/SiteTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,21 @@
:title="$t('site.detailView')"
class="table-link"
>
{{ item.name }}
{{ $translate({ et: item.name, en: item.name_en }) }}
</router-link>
</template>

<template v-slot:item.maakond="{ item }">
<div>{{ $translate({ et: item.maakond, en: item.maakond_en }) }}</div>
</template>

<template v-slot:item.area_name="{ item }">
<router-link
:to="`/turbaala/${item.area_id}`"
:title="$t('area.detailView')"
class="table-link"
>
{{ item.area_name }}
{{ $translate({ et: item.area_name, en: item.area_name_en }) }}
</router-link>
</template>
</v-data-table>
Expand Down
26 changes: 25 additions & 1 deletion src/i18n/translations/ee.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
{
"common":{
"maakond": "Maakond",
"area": "Turbaala",
"depthStart": "Sügavus alates",
"depthEnd": "Sügavus kuni",
"search": "Otsing",
"peatType": "Turbaliik",
"parameter": "Parameeter",
"searchType": "Otsingu tüüp",
"textField": "Tekstiväli",
"from": "Alates",
"to": "Kuni",
"columns": "Veerud"
},
"frontpage": {
"title": "Eesti turbauuringute andmebaas",
"titleShort": "Turbauuringute andmebaas",
Expand Down Expand Up @@ -90,8 +104,18 @@
"sample_id": "ID",
"number_additional": "Number",
"site": "Proovipunkt",
"siteSearch": "Proovipunkt/proov",
"depth": "Sügavus",
"depth_interval": "Sügavus kuni",
"rock": "Turbaliik"
"rock": "Turbaliik",
"looduslik_niiskus": "Looduslik niiskus",
"orgaanika": "Orgaanika",
"pH": "pH",
"p_lemissoojus": "Põlemissoojus",
"tuhasus": "Tuhasus",
"turba_kasutusala_hinnang": "Turba kasutusala hinnang",
"turba_kasutusala_kood": "Turba kasutusala kood",
"turba_lagunemisaste": "Turba lagunemisaste",
"turba_lagunemisaste__Von_Post_": "Turba lagunemisaste (Von Post)"
}
}
28 changes: 26 additions & 2 deletions src/i18n/translations/en.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
{
"common": {
"maakond": "Maakond",
"area": "Peat area",
"depthStart": "Depth start",
"depthEnd": "Depth end",
"search": "Search",
"peatType": "Peat type",
"parameter": "Parameter",
"searchType": "Search type",
"textField": "Text field",
"from": "From",
"to": "To",
"columns": "Columns"
},
"frontpage": {
"title": "Estonian peat database",
"titleShort": "Peat database"
Expand Down Expand Up @@ -89,8 +103,18 @@
"sample_id": "ID",
"number_additional": "Number",
"site": "Sampling site",
"siteSearch": "Site/sample",
"depth": "Depth",
"depth_interval": "Depth to",
"rock": "Peat type"
"rock": "Peat type",
"looduslik_niiskus": "Moisture content",
"orgaanika": "Organics",
"pH": "pH",
"p_lemissoojus": "Heat of combustion",
"tuhasus": "Ash content",
"turba_kasutusala_hinnang": "Peat use assessment",
"turba_kasutusala_kood": "Peat use code",
"turba_lagunemisaste": "Degree of degradation",
"turba_lagunemisaste__Von_Post_": "Degree of degradation (Von Post)"
}
}
}
7 changes: 5 additions & 2 deletions src/mixins/tableTranslations.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,13 @@ const tableTranslations = {

translatedSampleHeaders() {
return this.sampleHeaders.map(header => {
console.log(header)
console.log(header);
return {
...header,
text: this.$t(`sample.${header.text}`)
text:
header.text.includes("...") || /[A-Z]/.test(header.text.charAt(0))
? header.text
: this.$t(`sample.${header.value}`)
};
});
}
Expand Down
Loading

0 comments on commit 881587e

Please sign in to comment.