Skip to content

Commit

Permalink
Merge pull request #657 from bcgov/vuetify-mt
Browse files Browse the repository at this point in the history
added enter button
  • Loading branch information
suzalflueck authored Oct 30, 2024
2 parents 956a053 + c3764a0 commit 4d3bb52
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 18 deletions.
11 changes: 11 additions & 0 deletions frontend/src/components/Courses/CourseAdvancedSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
v-model="advancedSearchInput.courseCode.value"
placeholder=""
tabindex="1"
v-on:keyup="keyHandler"
/>
</div>
<div class="advanced-search-field col-12 col-md-2">
Expand All @@ -54,6 +55,7 @@
v-model="advancedSearchInput.courseLevel.value"
placeholder=""
tabindex="2"
v-on:keyup="keyHandler"
/>
</div>
<div class="advanced-search-field col-12 col-md-2">
Expand All @@ -80,6 +82,7 @@
v-model="advancedSearchInput.courseName.value"
placeholder=""
tabindex="3"
v-on:keyup="keyHandler"
/>
</div>
<div class="advanced-search-field col-12 col-md-2">
Expand All @@ -92,6 +95,7 @@
item-title="text"
item-value="value"
tabindex="4"
v-on:keyup="keyHandler"
></v-select>
</div>
<div class="advanced-search-field col-12 col-md-auto">
Expand Down Expand Up @@ -122,6 +126,7 @@
:date-format-options="{ year: '4-digit' }"
autocomplete="off"
tabindex="6"
v-on:keyup="keyHandler"
></v-text-field>
</div>
</v-row>
Expand Down Expand Up @@ -303,6 +308,12 @@ export default {
}
}
},
keyHandler: function (e) {
if (e.keyCode === 13) {
//enter key pressed
this.advanceCourseSearch();
}
},
advanceCourseSearch() {
this.totalResults = "";
this.advancedSearchMessage = "";
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/components/Header/BCHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,13 @@
<v-form @submit.prevent class="d-flex mb-0">
<v-text-field
density="compact"
size="small"
variant="outlined"
size="30"
type="search"
v-model="penInput"
maxlength="9"
minlength="9"
placeholder="PEN"
class=""
ref="penSearch"
hide-details
v-on:keyup="keyHandler"
Expand Down
32 changes: 20 additions & 12 deletions frontend/src/components/StudentSearch/StudentAdvancedSearch.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<div class="advanced-search-form mb-4">
<h3>Advanced Student Search</h3>
{{ advancedSearchInput }}
<p class="px-1">
Use the advanced search to look up students by specified criteria.
</p>
Expand Down Expand Up @@ -507,17 +508,17 @@ export default {
this.unsetStudent();
},
methods: {
keyHandler: function (e) {
if (e.keyCode === 13) {
//enter key pressed
this.studentSearchResults = [];
if (this.penInput) {
this.findStudentByPen();
} else if (this.surnameInput) {
this.findStudentBySurname();
}
}
},
// keyHandler: function (e) {
// if (e.keyCode === 13) {
// //enter key pressed
// this.studentSearchResults = [];
// if (this.penInput) {
// this.findStudentByPen();
// } else if (this.surnameInput) {
// this.findStudentBySurname();
// }
// }
// },
findStudentsByAdvancedSearch: function () {
this.advancedSearchMessage = "";
this.message = "";
Expand Down Expand Up @@ -591,9 +592,16 @@ export default {
showAdvancedSearch: function () {
this.showAdvancedSearchForm = true;
},
keyHandler: function (e) {
if (e.keyCode === 13) {
this.studentSearchResults = [];
//enter key pressed
this.findStudentsByAdvancedSearch();
}
},
clearInput: function () {
// this.penInput = "";
this.studentSearchResults = "";
this.studentSearchResults = [];
for (const key in this.advancedSearchInput) {
if (this.advancedSearchInput.hasOwnProperty(key)) {
this.advancedSearchInput[key].value = "";
Expand Down
18 changes: 14 additions & 4 deletions frontend/src/views/PSI.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
class="form__input"
trim
tabindex="1"
v-on:keyup="keyHandler"
></v-text-field>
</div>
<div class="advanced-search-field col-12 col-md-2">
Expand Down Expand Up @@ -61,6 +62,7 @@
class="form__input"
trim
tabindex="2"
v-on:keyup="keyHandler"
></v-text-field>
</div>
<div class="advanced-search-field col-12 col-md-2">
Expand Down Expand Up @@ -91,6 +93,7 @@
class="form__input"
trim
tabindex="3"
v-on:keyup="keyHandler"
></v-text-field>
</div>
<div class="advanced-search-field col-12 col-md-2">
Expand All @@ -103,6 +106,7 @@
item-title="text"
item-value="value"
tabindex="4"
v-on:keyup="keyHandler"
></v-select>
</div>
<div class="advanced-search-field col-12 col-md-2">
Expand Down Expand Up @@ -132,6 +136,7 @@
class="form__input"
trim
tabindex="5"
v-on:keyup="keyHandler"
></v-text-field>
</div>
</div>
Expand Down Expand Up @@ -172,8 +177,8 @@
variant="tonal"
border="start"
class="mt-8 mb-0 ml-1 py-3 width-fit-content"
v-if="!!searchMessage"
:text="searchMessage"
v-if="!!advancedSearchMessage"
:text="advancedSearchMessage"
></v-alert>
</div>
</div>
Expand Down Expand Up @@ -320,8 +325,7 @@ export default {
},
methods: {
clearInput: function () {
this.penInput = "";
this.psiResults = "";
this.psiResults = [];
for (const key in this.advancedSearchInput) {
if (this.advancedSearchInput.hasOwnProperty(key)) {
this.advancedSearchInput[key].value = "";
Expand All @@ -335,6 +339,12 @@ export default {
}
}
},
keyHandler: function (e) {
if (e.keyCode === 13) {
//enter key pressed
this.advancePSISearch();
}
},
advancePSISearch() {
this.totalResults = "";
this.advancedSearchMessage = "";
Expand Down

0 comments on commit 4d3bb52

Please sign in to comment.