diff --git a/src/components/views/DataView.vue b/src/components/views/DataView.vue
index 58a2f74..739b1c3 100644
--- a/src/components/views/DataView.vue
+++ b/src/components/views/DataView.vue
@@ -15,6 +15,11 @@
v-show="pinCorrect"
class="lg:p-6"
>
+
([]);
+const initialData = ref([]);
const contactName = ref('');
const contact = ref([]);
const contactModalId = 'contact-modal';
@@ -113,6 +119,7 @@ const tableHeaders = [
onMounted(async () => {
data.value = await DataService.getAllData();
+ initialData.value = data.value;
});
function openContactModal(data: { name: string, contact: string[] }) {
@@ -122,6 +129,7 @@ function openContactModal(data: { name: string, contact: string[] }) {
function addAccount(account: IAccountData) {
data.value.push(account);
+ initialData.value = data.value;
}
function inputEvent(event: Event) {
@@ -129,6 +137,17 @@ function inputEvent(event: Event) {
pinCorrect.value = true;
}
}
+
+function filterEvent(event: Event) {
+ const input = (event.target as HTMLInputElement).value;
+ data.value = initialData.value;
+ if(input === '') {
+ return;
+ }
+ data.value = data.value.filter((account: IAccountData) => {
+ return `${account.firstName} ${account.lastName}`.toLocaleLowerCase().includes(input);
+ });
+}