Fixed: [activity] fetch all the available location, beyond the first page

This commit is contained in:
Mathieu Jaumotte 2023-02-08 14:42:16 +00:00 committed by Julien Fastré
parent af5f27ff49
commit 68f7a832b4
2 changed files with 6 additions and 12 deletions

View File

@ -28,7 +28,7 @@ class LocationController extends CRUDController
protected function customizeQuery(string $action, Request $request, $query): void
{
$query->where('e.availableForUsers = true'); //TODO not working
$query->where('e.availableForUsers = "TRUE"');
}
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)

View File

@ -34,7 +34,7 @@
<script>
import VueMultiselect from 'vue-multiselect';
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';
import { fetchResults } from 'ChillMainAssets/lib/api/apiMethods';
import { mapState, mapGetters } from 'vuex';
export default {
@ -58,23 +58,17 @@ export default {
},
methods: {
getOptions() {
const url = `/api/1.0/main/location.json`;
makeFetch('GET', url)
fetchResults(`/api/1.0/main/location.json`)
.then(response => {
let options = response.results;
let uniqueLocationTypeId = [...new Set(options.map(o => o.locationType.id))];
let uniqueLocationTypeId = [...new Set(response.map(o => o.locationType.id))];
let results = [];
for (let id of uniqueLocationTypeId) {
results.push({
locationCategories: options.filter(o => o.locationType.id === id)[0].locationType.title.fr,
locations: options.filter(o => o.locationType.id === id)
locationCategories: response.filter(o => o.locationType.id === id)[0].locationType.title.fr,
locations: response.filter(o => o.locationType.id === id)
})
}
this.options = results;
return response;
})
.catch((error) => {
this.$toast.open({message: error.txt})
})
},
updateAdminLocation(value) {