at least basic ui for ingredient editor
This commit is contained in:
parent
1fb6f96571
commit
9f90306f6c
@ -218,8 +218,7 @@
|
|||||||
:href="resolveDjangoUrl('view_recipe',r.id)">{{
|
:href="resolveDjangoUrl('view_recipe',r.id)">{{
|
||||||
r.name
|
r.name
|
||||||
}}</a>
|
}}</a>
|
||||||
<span class="float-right">Imported</span>
|
<span class="float-right">{{ $t('Imported') }}</span>
|
||||||
<!-- TODO localize -->
|
|
||||||
</div>
|
</div>
|
||||||
</b-list-group-item>
|
</b-list-group-item>
|
||||||
|
|
||||||
@ -230,8 +229,7 @@
|
|||||||
<div class="clearfix">
|
<div class="clearfix">
|
||||||
<a class="float-left" target="_blank"
|
<a class="float-left" target="_blank"
|
||||||
rel="noreferrer nofollow" :href="u">{{ u }}</a>
|
rel="noreferrer nofollow" :href="u">{{ u }}</a>
|
||||||
<span class="float-right">Failed</span>
|
<span class="float-right">{{ $t('Failure') }}</span>
|
||||||
<!-- TODO localize -->
|
|
||||||
</div>
|
</div>
|
||||||
</b-list-group-item>
|
</b-list-group-item>
|
||||||
</b-list-group>
|
</b-list-group>
|
||||||
|
@ -1,23 +1,36 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<beta-warning></beta-warning>
|
|
||||||
|
|
||||||
<div class="row mt-2">
|
<div class="row mt-2">
|
||||||
<div class="col col-md-6">
|
<div class="col col-md-6">
|
||||||
|
<b-input-group>
|
||||||
<generic-multiselect @change="food = $event.val; refreshList()" ref="food_multiselect"
|
<generic-multiselect @change="food = $event.val; refreshList()" ref="food_multiselect"
|
||||||
:model="Models.FOOD"
|
:model="Models.FOOD"
|
||||||
:initial_single_selection="food"
|
:initial_single_selection="food"
|
||||||
:multiple="false"></generic-multiselect>
|
:multiple="false"></generic-multiselect>
|
||||||
<b-button @click="generic_model = Models.FOOD; generic_action=Actions.DELETE" :disabled="food === null">
|
|
||||||
<i class="fas fa-trash-alt"></i>
|
|
||||||
</b-button>
|
|
||||||
<b-button @click="generic_model = Models.FOOD; generic_action=Actions.MERGE" :disabled="food === null">
|
|
||||||
<i class="fas fa-compress-arrows-alt"></i>
|
|
||||||
</b-button>
|
|
||||||
|
|
||||||
<b-button @click="generic_model = Models.FOOD; generic_action=Actions.UPDATE" :disabled="food === null">
|
<b-input-group-append>
|
||||||
<i class="fas fa-edit"></i>
|
<b-dropdown no-caret right :disabled="food === null">
|
||||||
</b-button>
|
<template #button-content>
|
||||||
|
<i class="fas fa-ellipsis-v"></i>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<b-dropdown-item @click="generic_model = Models.FOOD; generic_action=Actions.UPDATE"
|
||||||
|
:disabled="food === null">
|
||||||
|
<i class="fas fa-edit fa-fw"></i> {{ $t('Edit') }}
|
||||||
|
</b-dropdown-item>
|
||||||
|
<b-dropdown-item @click="generic_model = Models.FOOD; generic_action=Actions.MERGE"
|
||||||
|
:disabled="food === null">
|
||||||
|
<i class="fas fa-compress-arrows-alt fa-fw"></i> {{ $t('Merge') }}
|
||||||
|
</b-dropdown-item>
|
||||||
|
<b-dropdown-item @click="generic_model = Models.FOOD; generic_action=Actions.DELETE"
|
||||||
|
:disabled="food === null">
|
||||||
|
<i class="fas fa-trash-alt fa-fw"></i> {{ $t('Delete') }}
|
||||||
|
</b-dropdown-item>
|
||||||
|
|
||||||
|
</b-dropdown>
|
||||||
|
</b-input-group-append>
|
||||||
|
</b-input-group>
|
||||||
|
|
||||||
<generic-modal-form :model="Models.FOOD" :action="generic_action" :show="generic_model === Models.FOOD"
|
<generic-modal-form :model="Models.FOOD" :action="generic_action" :show="generic_model === Models.FOOD"
|
||||||
:item1="food"
|
:item1="food"
|
||||||
@ -25,6 +38,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col col-md-6">
|
<div class="col col-md-6">
|
||||||
|
|
||||||
|
<b-input-group>
|
||||||
|
|
||||||
<generic-multiselect
|
<generic-multiselect
|
||||||
@change="unit = $event.val; refreshList()"
|
@change="unit = $event.val; refreshList()"
|
||||||
:model="Models.UNIT"
|
:model="Models.UNIT"
|
||||||
@ -32,29 +47,48 @@
|
|||||||
:initial_single_selection="unit"
|
:initial_single_selection="unit"
|
||||||
:multiple="false"></generic-multiselect>
|
:multiple="false"></generic-multiselect>
|
||||||
|
|
||||||
<b-button @click="generic_model = Models.UNIT; generic_action=Actions.DELETE" :disabled="unit === null">
|
<b-input-group-append>
|
||||||
<i class="fas fa-trash-alt"></i>
|
<b-dropdown no-caret right :disabled="unit === null">
|
||||||
</b-button>
|
<template #button-content>
|
||||||
<b-button @click="generic_model = Models.UNIT; generic_action=Actions.MERGE" :disabled="unit === null">
|
<i class="fas fa-ellipsis-v"></i>
|
||||||
<i class="fas fa-compress-arrows-alt"></i>
|
</template>
|
||||||
</b-button>
|
|
||||||
<b-button @click="generic_model = Models.UNIT; generic_action=Actions.UPDATE" :disabled="unit === null">
|
<b-dropdown-item @click="generic_model = Models.UNIT; generic_action=Actions.UPDATE"
|
||||||
<i class="fas fa-edit"></i>
|
:disabled="unit === null">
|
||||||
</b-button>
|
<i class="fas fa-edit fa-fw"></i> {{ $t('Edit') }}
|
||||||
|
</b-dropdown-item>
|
||||||
|
<b-dropdown-item @click="generic_model = Models.UNIT; generic_action=Actions.MERGE"
|
||||||
|
:disabled="unit === null">
|
||||||
|
<i class="fas fa-compress-arrows-alt fa-fw"></i> {{ $t('Merge') }}
|
||||||
|
</b-dropdown-item>
|
||||||
|
<b-dropdown-item @click="generic_model = Models.UNIT; generic_action=Actions.DELETE"
|
||||||
|
:disabled="unit === null">
|
||||||
|
<i class="fas fa-trash-alt fa-fw"></i> {{ $t('Delete') }}
|
||||||
|
</b-dropdown-item>
|
||||||
|
|
||||||
|
</b-dropdown>
|
||||||
|
</b-input-group-append>
|
||||||
|
</b-input-group>
|
||||||
|
|
||||||
<generic-modal-form :model="Models.UNIT" :action="generic_action" :show="generic_model === Models.UNIT"
|
<generic-modal-form :model="Models.UNIT" :action="generic_action" :show="generic_model === Models.UNIT"
|
||||||
:item1="unit"
|
:item1="unit"
|
||||||
@finish-action="finishGenericAction()"/>
|
@finish-action="finishGenericAction()"/>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<b-pagination pills v-model="current_page" :total-rows="total_object_count" :per-page="page_size"
|
<b-row class="mt-2">
|
||||||
|
<b-col cols="12">
|
||||||
|
<b-pagination align="center" pills v-model="current_page" :total-rows="total_object_count"
|
||||||
|
:per-page="page_size"
|
||||||
@change="pageChange"></b-pagination>
|
@change="pageChange"></b-pagination>
|
||||||
|
</b-col>
|
||||||
|
</b-row>
|
||||||
|
|
||||||
<div class="row mt-2">
|
|
||||||
<div class="col col-md-12">
|
<b-row class="mt-2">
|
||||||
<table class="table table-bordered">
|
<b-col>
|
||||||
|
<table class="table table-bordered table-sm">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ $t('Amount') }}</th>
|
<th>{{ $t('Amount') }}</th>
|
||||||
@ -62,7 +96,8 @@
|
|||||||
<th>{{ $t('Food') }}</th>
|
<th>{{ $t('Food') }}</th>
|
||||||
<th>{{ $t('Note') }}</th>
|
<th>{{ $t('Note') }}</th>
|
||||||
<th>
|
<th>
|
||||||
<b-button variant="success" @click="updateIngredient()"><i class="fas fa-save"></i>
|
<b-button variant="success" class="btn btn-sm" @click="updateIngredient()"><i
|
||||||
|
class="fas fa-save"></i>
|
||||||
</b-button>
|
</b-button>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -108,6 +143,7 @@
|
|||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td style="width: 5vw">
|
<td style="width: 5vw">
|
||||||
|
<b-button-group>
|
||||||
<b-button :disabled="i.changed !== true"
|
<b-button :disabled="i.changed !== true"
|
||||||
:variant="(i.changed !== true) ? 'primary' : 'success'"
|
:variant="(i.changed !== true) ? 'primary' : 'success'"
|
||||||
@click="updateIngredient(i)">
|
@click="updateIngredient(i)">
|
||||||
@ -117,6 +153,7 @@
|
|||||||
@click="deleteIngredient(i)">
|
@click="deleteIngredient(i)">
|
||||||
<i class="fas fa-trash"></i>
|
<i class="fas fa-trash"></i>
|
||||||
</b-button>
|
</b-button>
|
||||||
|
</b-button-group>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
@ -127,12 +164,17 @@
|
|||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<b-pagination pills v-model="current_page" :total-rows="total_object_count" :per-page="page_size"
|
|
||||||
|
</b-col>
|
||||||
|
</b-row>
|
||||||
|
|
||||||
|
<b-row class="mt-2">
|
||||||
|
<b-col cols="12">
|
||||||
|
<b-pagination align="center" pills v-model="current_page" :total-rows="total_object_count"
|
||||||
|
:per-page="page_size"
|
||||||
@change="pageChange"></b-pagination>
|
@change="pageChange"></b-pagination>
|
||||||
</div>
|
</b-col>
|
||||||
</div>
|
</b-row>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -153,7 +195,7 @@ Vue.use(BootstrapVue)
|
|||||||
export default {
|
export default {
|
||||||
name: "IngredientEditorView",
|
name: "IngredientEditorView",
|
||||||
mixins: [ApiMixin, ResolveUrlMixin],
|
mixins: [ApiMixin, ResolveUrlMixin],
|
||||||
components: {BetaWarning, LoadingSpinner, GenericMultiselect, GenericModalForm},
|
components: {LoadingSpinner, GenericMultiselect, GenericModalForm},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
ingredients: [],
|
ingredients: [],
|
||||||
@ -202,7 +244,7 @@ export default {
|
|||||||
if (this.unit !== null) {
|
if (this.unit !== null) {
|
||||||
params.query.unit = this.unit.id
|
params.query.unit = this.unit.id
|
||||||
}
|
}
|
||||||
apiClient.listIngredients(this.current_page, this.page_size,params).then(result => {
|
apiClient.listIngredients(this.current_page, this.page_size, params).then(result => {
|
||||||
this.ingredients = result.data.results
|
this.ingredients = result.data.results
|
||||||
this.total_object_count = result.data.count
|
this.total_object_count = result.data.count
|
||||||
this.loading = false
|
this.loading = false
|
||||||
|
@ -368,6 +368,7 @@
|
|||||||
"no_pinned_recipes": "You have no pinned recipes!",
|
"no_pinned_recipes": "You have no pinned recipes!",
|
||||||
"Planned": "Planned",
|
"Planned": "Planned",
|
||||||
"Pinned": "Pinned",
|
"Pinned": "Pinned",
|
||||||
|
"Imported": "Imported",
|
||||||
"Quick actions": "Quick actions",
|
"Quick actions": "Quick actions",
|
||||||
"Ratings": "Ratings",
|
"Ratings": "Ratings",
|
||||||
"Internal": "Internal",
|
"Internal": "Internal",
|
||||||
|
Loading…
Reference in New Issue
Block a user