Hayden 791aa8c610
feat(backend): refactor/fix group management for admins (#838)
* fix(frontend): 🐛 update dialog implementation to simplify state management

* test(backend):  refactor test fixtures + admin group tests

* chore(backend): 🔨 add launcher.json for python debugging (tests)

* fix typing

* feat(backend):  refactor/fix group management for admins

* feat(frontend):  add/fix admin group management

* add LDAP checker

Co-authored-by: hay-kot <hay-kot@pm.me>
2021-11-25 14:17:02 -09:00

91 lines
2.3 KiB
Vue

<template>
<div v-if="edit || (value && value.length > 0)">
<template v-if="edit">
<v-autocomplete
v-if="tools"
v-model="recipeTools"
:items="tools"
item-text="name"
multiple
return-object
deletable-chips
:prepend-icon="$globals.icons.potSteam"
chips
>
<template #selection="data">
<v-chip
:key="data.index"
small
class="ma-1"
:input-value="data.selected"
close
label
color="accent"
dark
@click:close="recipeTools.splice(data.index, 1)"
>
{{ data.item.name || data.item }}
</v-chip>
</template>
<template #append-outer="">
<BaseDialog v-model="createDialog" title="Create New Tool" @submit="actions.createOne()">
<template #activator>
<v-btn icon @click="createDialog = true">
<v-icon> {{ $globals.icons.create }}</v-icon>
</v-btn>
</template>
<v-card-text>
<v-text-field v-model="workingToolData.name" label="Tool Name"></v-text-field>
<v-checkbox v-model="workingToolData.onHand" label="Show as On Hand (Checked)"></v-checkbox>
</v-card-text>
</BaseDialog>
</template>
</v-autocomplete>
</template>
</div>
</template>
<script lang="ts">
import { defineComponent, ref } from "@nuxtjs/composition-api";
import { computed } from "vue-demi";
import { Tool } from "~/api/class-interfaces/tools";
import { useTools } from "~/composables/recipes";
export default defineComponent({
props: {
value: {
type: Array as () => Tool[],
required: true,
},
edit: {
type: Boolean,
default: false,
},
},
setup(props, context) {
const { tools, actions, workingToolData } = useTools();
const createDialog = ref(false);
const recipeTools = computed({
get: () => {
return props.value;
},
set: (val) => {
context.emit("input", val);
},
});
return {
actions,
createDialog,
recipeTools,
tools,
workingToolData,
};
},
});
</script>
<style lang="scss" scoped>
</style>