Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

Made user search results scrollable #4

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/components/UserSearch/UserSearchComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
</div>
</div>
<div class="flex-column gap-sm-3">
<UserSearchRowComponent v-for="user in sortedUsers" :user="user" :key="user.id" @click="selectUser(user)"/>
<ScrollPanel style="width: 100%; height: 20rem;">
<UserSearchRowComponent v-for="user in sortedUsers" :user="user" :key="user.id"
@click="selectUser(user)"/>
</ScrollPanel>
</div>
</div>
</template>
Expand All @@ -29,6 +32,7 @@ import { useAuthStore } from "@sudosos/sudosos-frontend-common";
import { debounce } from 'lodash';
import type { AxiosResponse } from 'axios';
import { useSettingStore } from "@/stores/settings.store";
import ScrollPanel from "primevue/scrollpanel";

const searchQuery = ref<string>('');

Expand Down Expand Up @@ -73,7 +77,7 @@ const sortedUsers = computed(() => {
const sortedOnId = filteredUsers.sort((a, b) => b.id - a.id);
const validUsers = sortedOnId.filter(user => user.active && user.acceptedToS !== "NOT_ACCEPTED");
const invalidUsers = sortedOnId.filter(user => !user.active || user.acceptedToS === "NOT_ACCEPTED");
return [...validUsers, ...invalidUsers].slice(0, 10);
return [...validUsers, ...invalidUsers];
});

const searchInput = ref<null | HTMLInputElement>(null);
Expand Down
3 changes: 2 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import Dropdown from "primevue/dropdown";

import router from './router';
import App from './App.vue';
import ScrollPanel from "primevue/scrollpanel";

const app = createApp(App);

Expand All @@ -41,6 +42,6 @@ app.component('OverlayPanel', OverlayPanel);
// eslint-disable-next-line
app.component('Dropdown', Dropdown);
app.component('font-awesome-icon', FontAwesomeIcon);

app.component('ScrollPanel', ScrollPanel);
app.use(createPinia());
app.mount('#app');
2 changes: 1 addition & 1 deletion src/stores/pos.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const usePointOfSaleStore = defineStore('pointOfSale', {
},
async fetchUserPointOfSale(id: number): Promise<void> {
this.usersPointOfSales = await fetchAllPages<PointOfSaleResponse>(0, 100, (take, skip) =>
// @ts-ignore
// @ts-ignore
apiService.user.getUsersPointsOfSale(id, take, skip)
);
},
Expand Down