From a4052ffee8bc7c6c8a69eba5120b5c6c2d951b0f Mon Sep 17 00:00:00 2001
From: Leonardo Bishop <me@leonardobishop.com>
Date: Tue, 12 Mar 2024 19:18:52 +0000
Subject: Add items

---
 components/base/ItemStack/ItemStackModal.vue | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

(limited to 'components/base/ItemStack/ItemStackModal.vue')

diff --git a/components/base/ItemStack/ItemStackModal.vue b/components/base/ItemStack/ItemStackModal.vue
index 7cf4db9..865c054 100644
--- a/components/base/ItemStack/ItemStackModal.vue
+++ b/components/base/ItemStack/ItemStackModal.vue
@@ -3,12 +3,11 @@ import { computed, ref } from 'vue';
 import materials from '@/lib/materials';
 
 const model = defineModel();
-
 const emit = defineEmits(['confirm']);
-
 const props = defineProps<{
   value: any
 }>();
+const session = useSessionStore();
 
 //TODO unshitify
 const value = ref<any>(props.value);
@@ -42,6 +41,17 @@ const selectedType = ref(
 const noTypeSelected = computed(() => selectedType.value === '');
 const noValue = computed(() => !isQuestItem.value && !isItemStack.value && !isMaterial.value);
 
+const selectedQuestItem = computed({
+  get() {
+    return value.value?.['quest-item'];
+  },
+  set(newValue: string) {
+    value.value = {}
+    value.value['quest-item'] = newValue;
+  }
+})
+const knownQuestItems = computed(() => { return session.session.items.map((item) => item.id) });
+
 const setSelectedType = (type: string) => {
   if (type === 'questitem') {
     value.value = {};
@@ -98,6 +108,11 @@ const confirm = () => {
         <ItemStackForm v-model="value" />
       </div>
 
+      <div id="quest-item" class="option-group" v-if="selectedType === 'questitem'">
+        <label for="quest-item">Quest Item</label>
+        <multiselect v-model="selectedQuestItem" :options="knownQuestItems" :searchable="true"
+          placeholder="Enter quest item" />
+      </div>
 
       <div id="confirm" class="control-group">
         <Button :icon="['fas', 'times']" :label="'Cancel'" @click="model = false"></Button>
-- 
cgit v1.2.3-70-g09d2

