Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix loading of administrator administrations #888

Merged
Merged
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
14 changes: 9 additions & 5 deletions src/pages/HomeAdministrator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
</div>
<div class="text-md text-gray-500 ml-6">Lists administrations assigned to your account</div>
</div>

<div class="flex align-items-center gap-2">
<div class="flex gap-3 align-items-stretch justify-content-start">
<div v-if="isSuperAdmin" class="flex flex-column gap-1">
Expand Down Expand Up @@ -38,6 +39,7 @@
</div>
</div>
</div>

<div class="flex flex-column gap-1">
<small for="dd-sort" class="text-gray-400">Sort by</small>
<PvDropdown
Expand All @@ -51,6 +53,7 @@
</div>
</div>
</div>

<div
v-if="search.length > 0"
class="flex align-items-center gap-3 text-gray-700 px-4 py-3 my-1 bg-gray-100 rounded"
Expand Down Expand Up @@ -212,22 +215,23 @@ const {
* @returns {void}
*/
watch(
() => administrations.value,
(data) => {
if (!data) return;
administrations,
(updatedAdministrationsData) => {
if (!updatedAdministrationsData) return;

// Generate auto-complete search tokens based on the data.
generateAutoCompleteSearchTokens();

// Set the filtered administrations based on the search value.
if (!search.value) {
filteredAdministrations.value = data;
filteredAdministrations.value = updatedAdministrationsData;
} else {
filteredAdministrations.value = data?.filter((item) =>
filteredAdministrations.value = updatedAdministrationsData?.filter((item) =>
item.name.toLowerCase().includes(search.value.toLowerCase()),
);
}
},
{ immediate: true },
);

// Table sort options
Expand Down