note text saving
This commit is contained in:
@ -9,7 +9,7 @@ class MealPlanSerializer(serializers.ModelSerializer):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = MealPlan
|
model = MealPlan
|
||||||
fields = ('id', 'title', 'recipe', 'date', 'meal_type', 'created_by', 'recipe_name', 'meal_type_name')
|
fields = ('id', 'title', 'recipe', 'note', 'date', 'meal_type', 'created_by', 'recipe_name', 'meal_type_name')
|
||||||
|
|
||||||
|
|
||||||
class MealTypeSerializer(serializers.ModelSerializer):
|
class MealTypeSerializer(serializers.ModelSerializer):
|
||||||
|
@ -46,40 +46,48 @@
|
|||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<table class="table table-sm table-striped table-responsive">
|
<div class="row">
|
||||||
<thead class="thead-dark">
|
<div class="col-md-12">
|
||||||
<tr>
|
<table class="table table-sm table-striped table-responsive-sm">
|
||||||
<th v-for="d in days" style="width: 14.2%; text-align: center">[[d]]</th>
|
<thead class="thead-dark">
|
||||||
</tr>
|
<tr>
|
||||||
</thead>
|
<th v-for="d in days" style="width: 14.2%; text-align: center">[[d]]</th>
|
||||||
<tbody v-for="mp in meal_plan">
|
</tr>
|
||||||
<tr>
|
</thead>
|
||||||
<td colspan="7" style="text-align: center">
|
<tbody v-for="mp in meal_plan">
|
||||||
[[mp.name]]
|
<tr>
|
||||||
</td>
|
<td colspan="7" style="text-align: center">
|
||||||
</tr>
|
[[mp.name]]
|
||||||
<tr>
|
</td>
|
||||||
<td v-for="d in mp.days">
|
</tr>
|
||||||
<draggable class="list-group" :list="d.items" group="plan" style="min-height: 40px"
|
<tr>
|
||||||
@change="dragChanged(d.date, mp.meal_type, $event)"
|
<td v-for="d in mp.days">
|
||||||
:empty-insert-threshold="10">
|
<draggable class="list-group" :list="d.items" group="plan" style="min-height: 40px"
|
||||||
<div class="list-group-item" v-for="(element, index) in d.items" :key="element.id">
|
@change="dragChanged(d.date, mp.meal_type, $event)"
|
||||||
<div class="row">
|
:empty-insert-threshold="10">
|
||||||
<div class="col-md-12">
|
<div class="list-group-item" v-for="(element, index) in d.items" :key="element.id">
|
||||||
<a href="#" v-if="element.title !== ''"
|
<div class="row">
|
||||||
@click="plan_detail = element" data-toggle="modal" data-target="#exampleModal">[[element.title]]</a>
|
<div class="col-md-12">
|
||||||
<a href="#" v-if="element.recipe_name !== ''" @click="plan_detail = element"
|
<a href="#" v-if="element.title !== ''"
|
||||||
data-toggle="modal" data-target="#exampleModal">[[element.recipe_name]]</a>
|
@click="plan_detail = element" data-toggle="modal"
|
||||||
<a href="#" v-if="element.name !== ''"
|
data-target="#exampleModal">[[element.title]]</a>
|
||||||
@click="plan_detail = element" data-toggle="modal" data-target="#exampleModal">[[element.name]]</a>
|
<a href="#" v-if="element.recipe_name !== ''" @click="plan_detail = element"
|
||||||
|
data-toggle="modal"
|
||||||
|
data-target="#exampleModal">[[element.recipe_name]]</a>
|
||||||
|
<a href="#" v-if="element.name !== ''"
|
||||||
|
@click="plan_detail = element" data-toggle="modal"
|
||||||
|
data-target="#exampleModal">[[element.name]]</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</draggable>
|
||||||
</div>
|
</td>
|
||||||
</draggable>
|
</tr>
|
||||||
</td>
|
</tbody>
|
||||||
</tr>
|
</table>
|
||||||
</tbody>
|
</div>
|
||||||
</table>
|
</div>
|
||||||
|
|
||||||
<hr/>
|
<hr/>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
@ -141,17 +149,18 @@
|
|||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title" >[[ plan_detail.title ]] [[ plan_detail.recipe_name ]]</h5>
|
<h5 class="modal-title">[[ plan_detail.title ]] [[ plan_detail.recipe_name ]]</h5>
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
<span aria-hidden="true">×</span>
|
<span aria-hidden="true">×</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
[[ plan_detail.note ]]
|
[[ plan_detail.note ]]
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||||
<button type="button" class="btn btn-danger" @click="deleteEntry(plan_detail)">{% trans 'Delete' %}</button>
|
<button type="button" class="btn btn-danger"
|
||||||
|
@click="deleteEntry(plan_detail)">{% trans 'Delete' %}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -296,7 +305,7 @@
|
|||||||
let new_entry = {
|
let new_entry = {
|
||||||
id: Math.round(Math.random() * 1000) + 10000,
|
id: Math.round(Math.random() * 1000) + 10000,
|
||||||
title: this.new_note_title,
|
title: this.new_note_title,
|
||||||
text: this.new_note_text,
|
note: this.new_note_text,
|
||||||
is_note: true,
|
is_note: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user