83 lines
2.7 KiB
Vue
83 lines
2.7 KiB
Vue
<template>
|
|
<textarea v-if="type === 'textarea'" class="form-control" rows="2" v-model="localValue"></textarea>
|
|
|
|
<input v-else-if="type === 'number'" type="number" class="form-control" min="0" v-model.number="localValue">
|
|
|
|
<!-- Tags/properties mutate the passed-in array in place (same convention as
|
|
InventoryNew.vue's own `:value="item.tags"`), so no v-model wiring is needed here. -->
|
|
<tag-field v-else-if="type === 'tags'" :value="modelValue"></tag-field>
|
|
|
|
<property-field v-else-if="type === 'properties'" :value="modelValue"></property-field>
|
|
|
|
<select v-else-if="type === 'owner_group'" class="form-select" v-model="localValue">
|
|
<option :value="null">Myself</option>
|
|
<option v-for="group in ownerGroups" :key="group.handle" :value="group.handle">{{ group.handle }}</option>
|
|
</select>
|
|
|
|
<select v-else-if="type === 'availability_policy'" class="form-select" v-model="localValue">
|
|
<option v-for="policy in availabilityPolicies" :key="policy.slug" :value="policy.slug">
|
|
{{ policy.text }}
|
|
</option>
|
|
</select>
|
|
|
|
<select v-else-if="type === 'visibility_policy'" class="form-select" v-model="localValue">
|
|
<option v-for="policy in visibilityPolicies" :key="policy.slug" :value="policy.slug">
|
|
{{ policy.text }}
|
|
</option>
|
|
</select>
|
|
|
|
<select v-else-if="type === 'storage_location'" class="form-select" v-model="localValue">
|
|
<option :value="null">No storage location</option>
|
|
<option v-for="location in storageLocations" :key="location.id" :value="location.id">
|
|
{{ location.path }}
|
|
</option>
|
|
</select>
|
|
|
|
<input v-else type="text" class="form-control" v-model="localValue">
|
|
</template>
|
|
|
|
<script>
|
|
import TagField from "@/components/TagField.vue";
|
|
import PropertyField from "@/components/PropertyField.vue";
|
|
|
|
export default {
|
|
name: 'FotoFirstFieldInput',
|
|
components: {TagField, PropertyField},
|
|
props: {
|
|
type: {
|
|
type: String,
|
|
required: true
|
|
},
|
|
modelValue: {
|
|
default: null
|
|
},
|
|
ownerGroups: {
|
|
type: Array,
|
|
default: () => []
|
|
},
|
|
availabilityPolicies: {
|
|
type: Array,
|
|
default: () => []
|
|
},
|
|
visibilityPolicies: {
|
|
type: Array,
|
|
default: () => []
|
|
},
|
|
storageLocations: {
|
|
type: Array,
|
|
default: () => []
|
|
}
|
|
},
|
|
emits: ['update:modelValue'],
|
|
computed: {
|
|
localValue: {
|
|
get() {
|
|
return this.modelValue;
|
|
},
|
|
set(value) {
|
|
this.$emit('update:modelValue', value);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|