From 47e8f553ff49ed5874d622f73a7927d9343aa0b5 Mon Sep 17 00:00:00 2001
From: Hayden <64056131+hay-kot@users.noreply.github.com>
Date: Sat, 28 Jan 2023 11:31:37 -0900
Subject: [PATCH] update location selectors
---
frontend/components/Form/Autocomplete.vue | 4 +-
frontend/components/Location/CreateModal.vue | 23 +--------
frontend/components/Location/Selector.vue | 49 ++++++++++++++++++++
frontend/pages/item/[id]/index/edit.vue | 8 +---
frontend/pages/location/[id].vue | 2 +-
5 files changed, 54 insertions(+), 32 deletions(-)
create mode 100644 frontend/components/Location/Selector.vue
diff --git a/frontend/components/Form/Autocomplete.vue b/frontend/components/Form/Autocomplete.vue
index 1352067..b2e2d44 100644
--- a/frontend/components/Form/Autocomplete.vue
+++ b/frontend/components/Form/Autocomplete.vue
@@ -51,7 +51,7 @@
interface Props {
label: string;
- modelValue: string | ItemsObject;
+ modelValue: string | ItemsObject | null | undefined;
items: ItemsObject[] | string[];
itemText?: keyof ItemsObject;
itemSearch?: keyof ItemsObject | null;
@@ -129,7 +129,7 @@
}
);
- function select(obj: string | ItemsObject) {
+ function select(obj: Props["modelValue"]) {
if (isStrings(props.items)) {
if (obj === value.value) {
value.value = "";
diff --git a/frontend/components/Location/CreateModal.vue b/frontend/components/Location/CreateModal.vue
index 32381ac..579b962 100644
--- a/frontend/components/Location/CreateModal.vue
+++ b/frontend/components/Location/CreateModal.vue
@@ -10,24 +10,7 @@
label="Location Name"
/>