diff --git a/src/components/search/EquipmentSearchSelect.vue b/src/components/search/EquipmentSearchSelect.vue index a1a7c08..8feb26a 100644 --- a/src/components/search/EquipmentSearchSelect.vue +++ b/src/components/search/EquipmentSearchSelect.vue @@ -32,12 +32,12 @@ suche - +
  • tippe, um zu suchen...
  • - +
  • Keine Auswahl gefunden.
  • @@ -45,7 +45,7 @@ , filtered: [] as Array, chosen: undefined as undefined | EquipmentViewModel, }; }, computed: { + available() { + return this.query == "" ? this.all : this.filtered; + }, selected: { get() { return this.modelValue; @@ -154,10 +158,22 @@ export default defineComponent({ }, mounted() { this.loadEquipmentInitial(); + this.preloadAll(); }, methods: { - ...mapActions(useEquipmentStore, ["searchEquipments", "fetchEquipmentById"]), + ...mapActions(useEquipmentStore, ["searchEquipments", "fetchEquipmentById", "getAllEquipments"]), ...mapActions(useModalStore, ["openModal"]), + preloadAll() { + this.loading = true; + this.getAllEquipments() + .then((res) => { + this.all = res.data; + }) + .catch((err) => {}) + .finally(() => { + this.loading = false; + }); + }, search() { this.filtered = []; if (this.query == "") return; diff --git a/src/components/search/EquipmentTypeSearchSelect.vue b/src/components/search/EquipmentTypeSearchSelect.vue index 6f5f46b..8d431cb 100644 --- a/src/components/search/EquipmentTypeSearchSelect.vue +++ b/src/components/search/EquipmentTypeSearchSelect.vue @@ -26,12 +26,12 @@ suche - +
  • tippe, um zu suchen...
  • - +
  • Keine Auswahl gefunden.
  • @@ -39,7 +39,7 @@ , filtered: [] as Array, chosen: undefined as undefined | EquipmentTypeViewModel, }; }, computed: { + available() { + return this.query == "" ? this.all : this.filtered; + }, selected: { get() { return this.modelValue; @@ -142,9 +146,21 @@ export default defineComponent({ }, mounted() { this.loadEquipmentTypeInitial(); + this.preloadAll(); }, methods: { - ...mapActions(useEquipmentTypeStore, ["searchEquipmentTypes", "fetchEquipmentTypeById"]), + ...mapActions(useEquipmentTypeStore, ["searchEquipmentTypes", "fetchEquipmentTypeById", "getAllEquipmentTypes"]), + preloadAll() { + this.loading = true; + this.getAllEquipmentTypes() + .then((res) => { + this.all = res.data; + }) + .catch((err) => {}) + .finally(() => { + this.loading = false; + }); + }, search() { this.filtered = []; if (this.query == "") return; diff --git a/src/components/search/InspectionPlanSearchSelect.vue b/src/components/search/InspectionPlanSearchSelect.vue index 4ff6e62..a328fb8 100644 --- a/src/components/search/InspectionPlanSearchSelect.vue +++ b/src/components/search/InspectionPlanSearchSelect.vue @@ -26,12 +26,12 @@ suche - +
  • tippe, um zu suchen...
  • - +
  • Keine Auswahl gefunden.
  • @@ -39,7 +39,7 @@ , filtered: [] as Array, chosen: undefined as undefined | InspectionPlanViewModel, }; }, computed: { + available() { + return this.query == "" ? this.all : this.filtered; + }, selected: { get() { return this.modelValue; @@ -146,9 +150,25 @@ export default defineComponent({ }, mounted() { this.loadInspectionPlanInitial(); + this.preloadAll(); }, methods: { - ...mapActions(useInspectionPlanStore, ["searchInspectionPlans", "fetchInspectionPlanById"]), + ...mapActions(useInspectionPlanStore, [ + "searchInspectionPlans", + "fetchInspectionPlanById", + "getAllInspectionPlans", + ]), + preloadAll() { + this.loading = true; + this.getAllInspectionPlans() + .then((res) => { + this.all = res.data; + }) + .catch((err) => {}) + .finally(() => { + this.loading = false; + }); + }, search() { this.filtered = []; if (this.query == "") return; diff --git a/src/components/search/VehicleSearchSelect.vue b/src/components/search/VehicleSearchSelect.vue index 1fc9afa..c3484db 100644 --- a/src/components/search/VehicleSearchSelect.vue +++ b/src/components/search/VehicleSearchSelect.vue @@ -32,12 +32,12 @@ suche - +
  • tippe, um zu suchen...
  • - +
  • Keine Auswahl gefunden.
  • @@ -45,7 +45,7 @@ , filtered: [] as Array, chosen: undefined as undefined | VehicleViewModel, }; }, computed: { + available() { + return this.query == "" ? this.all : this.filtered; + }, selected: { get() { return this.modelValue; @@ -154,10 +158,22 @@ export default defineComponent({ }, mounted() { this.loadVehicleInitial(); + this.preloadAll(); }, methods: { - ...mapActions(useVehicleStore, ["searchVehicles", "fetchVehicleById"]), + ...mapActions(useVehicleStore, ["searchVehicles", "fetchVehicleById", "getAllVehicles"]), ...mapActions(useModalStore, ["openModal"]), + preloadAll() { + this.loading = true; + this.getAllVehicles() + .then((res) => { + this.all = res.data; + }) + .catch((err) => {}) + .finally(() => { + this.loading = false; + }); + }, search() { this.filtered = []; if (this.query == "") return; diff --git a/src/components/search/VehicleTypeSearchSelect.vue b/src/components/search/VehicleTypeSearchSelect.vue index 53bde5f..c730dc5 100644 --- a/src/components/search/VehicleTypeSearchSelect.vue +++ b/src/components/search/VehicleTypeSearchSelect.vue @@ -26,12 +26,12 @@ suche - +
  • tippe, um zu suchen...
  • - +
  • Keine Auswahl gefunden.
  • @@ -39,7 +39,7 @@ , filtered: [] as Array, chosen: undefined as undefined | VehicleTypeViewModel, }; }, computed: { + available() { + return this.query == "" ? this.all : this.filtered; + }, selected: { get() { return this.modelValue; @@ -142,9 +146,21 @@ export default defineComponent({ }, mounted() { this.loadVehicleTypeInitial(); + this.preloadAll(); }, methods: { - ...mapActions(useVehicleTypeStore, ["searchVehicleTypes", "fetchVehicleTypeById"]), + ...mapActions(useVehicleTypeStore, ["searchVehicleTypes", "fetchVehicleTypeById", "getAllVehicleTypes"]), + preloadAll() { + this.loading = true; + this.getAllVehicleTypes() + .then((res) => { + this.all = res.data; + }) + .catch((err) => {}) + .finally(() => { + this.loading = false; + }); + }, search() { this.filtered = []; if (this.query == "") return; diff --git a/src/components/search/WearableSearchSelect.vue b/src/components/search/WearableSearchSelect.vue index 3248277..e282e72 100644 --- a/src/components/search/WearableSearchSelect.vue +++ b/src/components/search/WearableSearchSelect.vue @@ -32,12 +32,12 @@ suche - +
  • tippe, um zu suchen...
  • - +
  • Keine Auswahl gefunden.
  • @@ -45,7 +45,7 @@ , filtered: [] as Array, chosen: undefined as undefined | WearableViewModel, }; }, computed: { + available() { + return this.query == "" ? this.all : this.filtered; + }, selected: { get() { return this.modelValue; @@ -154,10 +158,22 @@ export default defineComponent({ }, mounted() { this.loadWearableInitial(); + this.preloadAll(); }, methods: { - ...mapActions(useWearableStore, ["searchWearables", "fetchWearableById"]), + ...mapActions(useWearableStore, ["searchWearables", "fetchWearableById", "getAllWearables"]), ...mapActions(useModalStore, ["openModal"]), + preloadAll() { + this.loading = true; + this.getAllWearables() + .then((res) => { + this.all = res.data; + }) + .catch((err) => {}) + .finally(() => { + this.loading = false; + }); + }, search() { this.filtered = []; if (this.query == "") return; @@ -172,7 +188,7 @@ export default defineComponent({ }); }, getWearableFromSearch(id: string) { - return this.filtered.find((f) => f.id == id); + return this.all.find((f) => f.id == id); }, loadWearableInitial() { if (this.modelValue == "") return; diff --git a/src/components/search/WearableTypeSearchSelect.vue b/src/components/search/WearableTypeSearchSelect.vue index 4cb96c8..15deee2 100644 --- a/src/components/search/WearableTypeSearchSelect.vue +++ b/src/components/search/WearableTypeSearchSelect.vue @@ -26,12 +26,12 @@ suche - +
  • tippe, um zu suchen...
  • - +
  • Keine Auswahl gefunden.
  • @@ -39,7 +39,7 @@ , filtered: [] as Array, chosen: undefined as undefined | WearableTypeViewModel, }; }, computed: { + available() { + return this.query == "" ? this.all : this.filtered; + }, selected: { get() { return this.modelValue; @@ -142,9 +146,21 @@ export default defineComponent({ }, mounted() { this.loadWearableTypeInitial(); + this.preloadAll(); }, methods: { - ...mapActions(useWearableTypeStore, ["searchWearableTypes", "fetchWearableTypeById"]), + ...mapActions(useWearableTypeStore, ["searchWearableTypes", "fetchWearableTypeById", "getAllWearableTypes"]), + preloadAll() { + this.loading = true; + this.getAllWearableTypes() + .then((res) => { + this.all = res.data; + }) + .catch((err) => {}) + .finally(() => { + this.loading = false; + }); + }, search() { this.filtered = []; if (this.query == "") return; @@ -159,7 +175,7 @@ export default defineComponent({ }); }, getWearableTypeFromSearch(id: string) { - return this.filtered.find((f) => f.id == id); + return this.all.find((f) => f.id == id); }, loadWearableTypeInitial() { if (this.modelValue == "") return;