mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-03 05:11:31 -05:00
WIP merge button
This commit is contained in:
41
vue3/src/components/dialogs/ModelMergeDialog.vue
Normal file
41
vue3/src/components/dialogs/ModelMergeDialog.vue
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<template>
|
||||||
|
<v-dialog max-width="600px" :activator="props.activator" v-model="dialog">
|
||||||
|
<v-card>
|
||||||
|
<v-card-title>{{ $t('merge_title', {type: getGenericModelFromString(props.model).model.name}) }}</v-card-title>
|
||||||
|
<!-- TODO localize model name -->
|
||||||
|
<v-card-text>
|
||||||
|
{{ $t('merge_selection', {source: '', type: getGenericModelFromString(props.model).model.name}) }}
|
||||||
|
<model-select append-to-body :model="props.model"></model-select>
|
||||||
|
</v-card-text>
|
||||||
|
<v-card-actions>
|
||||||
|
<v-btn>{{ $t('Cancel') }}</v-btn>
|
||||||
|
<v-btn color="warning">{{ $t('Merge') }}</v-btn>
|
||||||
|
</v-card-actions>
|
||||||
|
</v-card>
|
||||||
|
</v-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
|
||||||
|
import ModelSelect from "@/components/inputs/ModelSelect.vue";
|
||||||
|
import {PropType} from "vue";
|
||||||
|
import {EditorSupportedModels, getGenericModelFromString} from "@/types/Models";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
model: {type: String as PropType<EditorSupportedModels>, required: true},
|
||||||
|
sourceObject: {},
|
||||||
|
activator: {type: String, default: 'parent'},
|
||||||
|
})
|
||||||
|
|
||||||
|
const dialog = defineModel<boolean>({default: false})
|
||||||
|
|
||||||
|
function mergeModel() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -44,8 +44,19 @@
|
|||||||
:items-per-page="useUserPreferenceStore().deviceSettings.general_tableItemsPerPage"
|
:items-per-page="useUserPreferenceStore().deviceSettings.general_tableItemsPerPage"
|
||||||
>
|
>
|
||||||
<template v-slot:item.action="{ item }">
|
<template v-slot:item.action="{ item }">
|
||||||
<v-btn color="edit" :to="{name: 'ModelEditPage', params: {model: model, id: item.id}}">
|
<v-btn class="float-right" icon="$menu" variant="plain">
|
||||||
<v-icon icon="$edit"></v-icon>
|
<v-icon icon="$menu"></v-icon>
|
||||||
|
<v-menu activator="parent">
|
||||||
|
<v-list>
|
||||||
|
<v-list-item prepend-icon="$edit" :to="{name: 'ModelEditPage', params: {model: model, id: item.id}}">
|
||||||
|
{{ $t('Edit') }}
|
||||||
|
</v-list-item>
|
||||||
|
<v-list-item prepend-icon="fa-solid fa-arrows-to-dot" link>
|
||||||
|
{{ $t('Merge') }}
|
||||||
|
<model-merge-dialog :model="model" activator="parent"></model-merge-dialog>
|
||||||
|
</v-list-item>
|
||||||
|
</v-list>
|
||||||
|
</v-menu>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</template>
|
</template>
|
||||||
</v-data-table-server>
|
</v-data-table-server>
|
||||||
@@ -71,6 +82,7 @@ import {useUrlSearchParams} from "@vueuse/core";
|
|||||||
import ModelEditDialog from "@/components/dialogs/ModelEditDialog.vue";
|
import ModelEditDialog from "@/components/dialogs/ModelEditDialog.vue";
|
||||||
import {useRouter} from "vue-router";
|
import {useRouter} from "vue-router";
|
||||||
import {useUserPreferenceStore} from "@/stores/UserPreferenceStore";
|
import {useUserPreferenceStore} from "@/stores/UserPreferenceStore";
|
||||||
|
import ModelMergeDialog from "@/components/dialogs/ModelMergeDialog.vue";
|
||||||
|
|
||||||
type VDataTableProps = InstanceType<typeof VDataTable>['$props']
|
type VDataTableProps = InstanceType<typeof VDataTable>['$props']
|
||||||
|
|
||||||
@@ -156,7 +168,7 @@ function loadItems({page, itemsPerPage, search, sortBy, groupBy}) {
|
|||||||
items.value = r.results
|
items.value = r.results
|
||||||
itemCount.value = r.count
|
itemCount.value = r.count
|
||||||
}).catch((err: any) => {
|
}).catch((err: any) => {
|
||||||
useMessageStore().addError(ErrorMessageType.FETCH_ERROR, err)
|
useMessageStore().addError(ErrorMessageType.FETCH_ERROR, err)
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
tablePage.value = page // TODO remove once page bug is fixed
|
tablePage.value = page // TODO remove once page bug is fixed
|
||||||
|
|||||||
@@ -83,6 +83,8 @@ export type Model = {
|
|||||||
disableListView?: boolean | undefined,
|
disableListView?: boolean | undefined,
|
||||||
|
|
||||||
isPaginated: boolean | undefined,
|
isPaginated: boolean | undefined,
|
||||||
|
isMerge?: boolean | undefined,
|
||||||
|
isTree?: boolean | undefined,
|
||||||
|
|
||||||
tableHeaders: ModelTableHeaders[],
|
tableHeaders: ModelTableHeaders[],
|
||||||
}
|
}
|
||||||
@@ -116,6 +118,7 @@ export const TFood = {
|
|||||||
icon: 'fa-solid fa-carrot',
|
icon: 'fa-solid fa-carrot',
|
||||||
|
|
||||||
isPaginated: true,
|
isPaginated: true,
|
||||||
|
isMerge: true,
|
||||||
toStringKeys: ['name'],
|
toStringKeys: ['name'],
|
||||||
|
|
||||||
tableHeaders: [
|
tableHeaders: [
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ export default createVuetify({
|
|||||||
mealplan: 'fa-solid fa-calendar-days',
|
mealplan: 'fa-solid fa-calendar-days',
|
||||||
recipes: 'fa-solid fa-book',
|
recipes: 'fa-solid fa-book',
|
||||||
books: 'fa-solid fa-book-open',
|
books: 'fa-solid fa-book-open',
|
||||||
|
menu: 'fa-solid fa-ellipsis-vertical'
|
||||||
},
|
},
|
||||||
sets: {
|
sets: {
|
||||||
fa,
|
fa,
|
||||||
|
|||||||
Reference in New Issue
Block a user