Skip to content

Commit

Permalink
Updated: added searchbar functionality on the otherInventoryModal(#386)
Browse files Browse the repository at this point in the history
  • Loading branch information
R-Sourabh committed May 10, 2024
1 parent 40a4fb9 commit 02f00ed
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions src/views/OtherStoresInventoryModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
</ion-toolbar>
</ion-header>
<ion-content class="ion-padding">
<ion-searchbar/>
<ion-list v-if="otherStoresInventory.length">
<ion-item v-for="details in otherStoresInventory" :key="details.facilityName">
<ion-searchbar v-model="queryString" @keyup.enter="queryString = $event.target.value; searchFacilities()"/>
<ion-list v-if="filteredInventory.length">
<ion-item v-for="details in filteredInventory" :key="details.facilityName">
<ion-label class="ion-text-wrap">{{ details.facilityName }}</ion-label>
<ion-note slot="end">{{ details.stock }}</ion-note>
</ion-item>
Expand All @@ -36,7 +36,8 @@ import {
IonNote,
IonTitle,
IonToolbar,
modalController } from "@ionic/vue";
modalController
} from "@ionic/vue";
import { defineComponent } from "vue";
import { close } from "ionicons/icons";
import { useStore } from "@/store";
Expand All @@ -58,9 +59,26 @@ export default defineComponent({
IonToolbar
},
props: ["otherStoresInventory"],
data() {
return{
queryString: "",
filteredInventory: [] as any
}
},
mounted() {
this.filteredInventory = this.otherStoresInventory.slice();
},
methods: {
closeModal() {
modalController.dismiss({ dismissed: true });
},
searchFacilities(){
if (this.queryString !== "") {
this.filteredInventory = this.otherStoresInventory.filter((facility: any) =>
facility.facilityName.toLowerCase().includes(this.queryString.toLowerCase()));
} else {
this.filteredInventory = this.otherStoresInventory.slice();
}
}
},
setup() {
Expand Down

0 comments on commit 02f00ed

Please sign in to comment.