added simple edit modal to recipe import

This commit is contained in:
vabene1111
2023-01-16 21:06:29 +01:00
parent 3b9d221258
commit 97bcf1111b
2 changed files with 187 additions and 158 deletions

View File

@@ -23,7 +23,12 @@
:empty-insert-threshold="10">
<b-list-group-item v-for="i in s.ingredients"
v-bind:key="i.original_text"><i
class="fas fa-arrows-alt"></i> {{ i.original_text }}
class="fas fa-arrows-alt mr-2"></i>
<b-badge variant="light">{{ i.amount }}</b-badge>
<b-badge variant="secondary">{{ i.unit.name }}</b-badge>
<b-badge variant="info">{{ i.food.name }}</b-badge>
({{ i.original_text }})
<b-button @click="current_edit_ingredient = i" v-b-modal.ingredient_edit_modal class="float-right btn-sm"><i class="fas fa-pencil-alt"></i></b-button>
</b-list-group-item>
</draggable>
</div>
@@ -56,6 +61,27 @@
</div>
</div>
<b-modal id="ingredient_edit_modal" :title="$t('Edit')" ok-only>
<div v-if="current_edit_ingredient !== null">
<b-form-group v-bind:label="$t('Original_Text')" class="mb-3">
<b-form-input v-model="current_edit_ingredient.original_text" type="text" disabled></b-form-input>
</b-form-group>
<b-form-group v-bind:label="$t('Amount')" class="mb-3">
<b-form-input v-model="current_edit_ingredient.amount" type="number" ></b-form-input>
</b-form-group>
<b-form-group v-bind:label="$t('Unit')" class="mb-3">
<b-form-input v-model="current_edit_ingredient.unit.name" type="text" ></b-form-input>
</b-form-group>
<b-form-group v-bind:label="$t('Food')" class="mb-3">
<b-form-input v-model="current_edit_ingredient.food.name" type="text" ></b-form-input>
</b-form-group>
</div>
</b-modal>
</div>
</div>
</template>
@@ -76,7 +102,8 @@ export default {
},
data() {
return {
recipe_json: undefined
recipe_json: undefined,
current_edit_ingredient: null,
}
},
watch: {

View File

@@ -65,6 +65,7 @@
"Step_Type": "Step Type",
"Make_Header": "Make Header",
"Make_Ingredient": "Make Ingredient",
"Amount": "Amount",
"Enable_Amount": "Enable Amount",
"Disable_Amount": "Disable Amount",
"Ingredient Editor": "Ingredient Editor",
@@ -160,6 +161,7 @@
"merge_title": "Merge {type}",
"move_title": "Move {type}",
"Food": "Food",
"Original_Text": "Original Text",
"Recipe_Book": "Recipe Book",
"del_confirmation_tree": "Are you sure that you want to delete {source} and all of it's children?",
"delete_title": "Delete {type}",