mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
ingredient checkboxes and table style
This commit is contained in:
@@ -1,12 +1,25 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-table density="compact" v-if="ingredients.length > 0">
|
<!-- <v-table density="compact" v-if="ingredients.length > 0">-->
|
||||||
|
|
||||||
<tbody>
|
<!-- <tbody>-->
|
||||||
<ingredients-table-row v-for="(ing, i) in ingredients" v-model="ingredients[i]" :key="ing.id" :show-notes="props.showNotes"
|
<!-- <ingredients-table-row v-for="(ing, i) in ingredients" v-model="ingredients[i]" :key="ing.id" :show-notes="props.showNotes"-->
|
||||||
:ingredient-factor="ingredientFactor"></ingredients-table-row>
|
<!-- :ingredient-factor="ingredientFactor"></ingredients-table-row>-->
|
||||||
</tbody>
|
<!-- </tbody>-->
|
||||||
|
|
||||||
|
<!-- </v-table>-->
|
||||||
|
|
||||||
|
<v-data-table :items="ingredients" hide-default-footer hide-default-header :headers="tableHeaders" density="compact" v-if="ingredients.length > 0">
|
||||||
|
<template v-slot:item.checked="{ item }">
|
||||||
|
<v-checkbox-btn v-model="item.checked" color="success"></v-checkbox-btn>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-slot:item.note="{ item }">
|
||||||
|
<v-icon class="far fa-comment float-right" v-if="item.note != '' && item.note != undefined">
|
||||||
|
<v-tooltip activator="parent" open-on-click location="start">{{ item.note }}</v-tooltip>
|
||||||
|
</v-icon>
|
||||||
|
</template>
|
||||||
|
</v-data-table>
|
||||||
|
|
||||||
</v-table>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
@@ -14,6 +27,7 @@ import {onMounted, PropType, ref} from 'vue'
|
|||||||
import {Ingredient} from "@/openapi";
|
import {Ingredient} from "@/openapi";
|
||||||
import IngredientsTableRow from "@/components/display/IngredientsTableRow.vue";
|
import IngredientsTableRow from "@/components/display/IngredientsTableRow.vue";
|
||||||
import draggable from 'vuedraggable'
|
import draggable from 'vuedraggable'
|
||||||
|
import ModelMergeDialog from "@/components/dialogs/ModelMergeDialog.vue";
|
||||||
|
|
||||||
const ingredients = defineModel<Ingredient[]>({required: true})
|
const ingredients = defineModel<Ingredient[]>({required: true})
|
||||||
|
|
||||||
@@ -28,6 +42,15 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const tableHeaders = [
|
||||||
|
{title: '', key: 'checked', align: 'start', width: '1%', noBreak: true, cellProps: {class: 'pa-0'}},
|
||||||
|
{title: '', key: 'amount', align: 'start', width: '1%', noBreak: true, cellProps: {class: 'pr-1'}},
|
||||||
|
{title: '', key: 'unit.name', align: 'start', width: '1%', noBreak: true, cellProps: {class: 'pr-1'}},
|
||||||
|
{title: '', key: 'food.name'},
|
||||||
|
{title: '', key: 'note', align: 'end'},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
const mutable_ingredients = ref([] as Ingredient[])
|
const mutable_ingredients = ref([] as Ingredient[])
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|||||||
@@ -4,10 +4,12 @@
|
|||||||
<td colspan="4"><b>{{ ingredient.note }}</b></td>
|
<td colspan="4"><b>{{ ingredient.note }}</b></td>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<td><v-checkbox-btn v-model="ingredient.checked" color="success"></v-checkbox-btn></td>
|
<td>
|
||||||
<td>{{ ingredient.amount * props.ingredientFactor }}</td>
|
<v-checkbox-btn v-model="ingredient.checked" color="success"></v-checkbox-btn>
|
||||||
<td><span v-if="ingredient.unit != null">{{ ingredient.unit.name }}</span></td>
|
</td>
|
||||||
<td><span v-if="ingredient.food != null">{{ ingredient.food.name }}</span></td>
|
<td @click="ingredient.checked = !ingredient.checked">{{ ingredient.amount * props.ingredientFactor }}</td>
|
||||||
|
<td @click="ingredient.checked = !ingredient.checked"><span v-if="ingredient.unit != null">{{ ingredient.unit.name }}</span></td>
|
||||||
|
<td @click="ingredient.checked = !ingredient.checked"><span v-if="ingredient.food != null">{{ ingredient.food.name }}</span></td>
|
||||||
<td v-if="props.showNotes">
|
<td v-if="props.showNotes">
|
||||||
<v-icon class="far fa-comment float-right" v-if="ingredient.note != '' && ingredient.note != undefined" @click="showTooltip = !showTooltip">
|
<v-icon class="far fa-comment float-right" v-if="ingredient.note != '' && ingredient.note != undefined" @click="showTooltip = !showTooltip">
|
||||||
<v-tooltip v-model="showTooltip" activator="parent" location="start">{{ ingredient.note }}</v-tooltip>
|
<v-tooltip v-model="showTooltip" activator="parent" location="start">{{ ingredient.note }}</v-tooltip>
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="recipe.name != undefined">
|
<template v-if="recipe.name != undefined">
|
||||||
|
|
||||||
<v-card class="mt-md-4 rounded-0">
|
<v-card class="mt-md-4 rounded-0">
|
||||||
<recipe-image
|
<recipe-image
|
||||||
max-height="25vh"
|
max-height="25vh"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<v-expansion-panel-text>
|
<v-expansion-panel-text>
|
||||||
<v-container>
|
<v-container>
|
||||||
<v-row v-for="(s, i) in props.steps">
|
<v-row v-for="(s, i) in props.steps">
|
||||||
<v-col class="pa-1">
|
<v-col class="pa-1" cols="12" md="6">
|
||||||
<b v-if="s.showAsHeader">{{ i + 1 }}. {{ s.name }} </b>
|
<b v-if="s.showAsHeader">{{ i + 1 }}. {{ s.name }} </b>
|
||||||
<ingredients-table v-model="s.ingredients" :ingredient-factor="props.ingredientFactor"></ingredients-table>
|
<ingredients-table v-model="s.ingredients" :ingredient-factor="props.ingredientFactor"></ingredients-table>
|
||||||
</v-col>
|
</v-col>
|
||||||
|
|||||||
Reference in New Issue
Block a user