diff --git a/src/components/AccountMenu/SearchBar.vue b/src/components/AccountMenu/SearchBar.vue index f3a640e..43a539f 100644 --- a/src/components/AccountMenu/SearchBar.vue +++ b/src/components/AccountMenu/SearchBar.vue @@ -1,24 +1,30 @@ \ No newline at end of file diff --git a/src/views/AccountManagement/AccountAdmin/AccountAdmin.vue b/src/views/AccountManagement/AccountAdmin/AccountAdmin.vue index 043c476..e739e6b 100644 --- a/src/views/AccountManagement/AccountAdmin/AccountAdmin.vue +++ b/src/views/AccountManagement/AccountAdmin/AccountAdmin.vue @@ -6,10 +6,10 @@ items-center px-6 py-[10px]" @click="onCreateNewClick"> {{ i18next.t("AcctMgmt.CreateNew") }} - +
- @@ -145,7 +145,7 @@ function repeatAccountList(accountList, N) { const repeatedAccountList = repeatAccountList(accountList, 20); export default { - setup() { + setup(props, { emit, }) { const acctMgmtStore = useAcctMgmtStore(); const loadingStore = LoadingStore(); const modalStore = useModalStore(); @@ -162,6 +162,8 @@ export default { const isOneAccountJustCreate = computed(() => acctMgmtStore.isOneAccountJustCreate); const justCreateUsername = computed(() => acctMgmtStore.justCreateUsername); + const inputQuery = ref(''); + const fetchLoginUserData = async () => { await loginStore.getUserData(); loginUserData.value = loginStore.userData; @@ -191,6 +193,13 @@ export default { } }; + const accountSearchResults = computed(() => { + if(!inputQuery.value) { + return infiniteAcctData.value; + } + return acctMgmtStore.allUserAccoutList.filter (user => user.username.includes(inputQuery.value)); + }); + const onCreateNewClick = () => { acctMgmtStore.clearCurrentViewingUser(); modalStore.openModal(MODAL_CREATE_NEW); @@ -256,6 +265,10 @@ export default { } }); + const onSearchAccountButtonClick = (inputQueryString) => { + inputQuery.value = inputQueryString; + }; + onMounted(async () => { await fetchLoginUserData(); await acctMgmtStore.getAllUserAccounts(); @@ -298,6 +311,7 @@ export default { }; return { + accountSearchResults, isLoading, modalStore, loginUserData, @@ -306,6 +320,7 @@ export default { justCreateUsername, onCreateNewClick, onAcctDoubleClick, + onSearchAccountButtonClick, handleScroll, getRowClass, onDeleteBtnClick,