Skip to content

Commit

Permalink
hide admin school in school input
Browse files Browse the repository at this point in the history
  • Loading branch information
AmonDeShir committed Dec 9, 2024
1 parent 015e0e3 commit 8e2a00f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion app/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ class UserController extends Controller
public function index(SortHelper $sorter, Request $request): Response
{
$users = User::query()->role("user")->with("school");
$schools = School::query()->orderBy("id")->get();
$schools = School::query()
->where("is_admin_school", false)
->orderBy("name")
->get();

$query = $sorter->sort($users, ["id", "email", "updated_at", "created_at"], ["firstname", "school"]);
$query = $this->filterAnonymizedUsers($query, $request);
Expand Down
6 changes: 4 additions & 2 deletions resources/js/components/Crud/CrudSchoolInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ const selected = ref<School | undefined>(props.schools.find(({ id }) => id === p
const searchResult = computed(() =>
props.schools.filter(school =>
school.city.toLowerCase().includes(searchQuery.value) ||
school.name?.toLowerCase().includes(searchQuery.value),
!school.isDisabled && (
school.city.toLowerCase().includes(searchQuery.value) ||
school.name?.toLowerCase().includes(searchQuery.value)
),
),
)
Expand Down

0 comments on commit 8e2a00f

Please sign in to comment.