Merge branch 'TandoorRecipes:develop' into develop
This commit is contained in:
commit
ab24177c89
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,52 @@
|
||||
# Generated by Django 4.1.10 on 2023-08-29 11:59
|
||||
|
||||
from django.db import migrations
|
||||
from django.db.models import F, Value
|
||||
from django.db.models.functions import Concat
|
||||
from django_scopes import scopes_disabled
|
||||
|
||||
|
||||
def migrate_icons(apps, schema_editor):
|
||||
with scopes_disabled():
|
||||
MealType = apps.get_model('cookbook', 'MealType')
|
||||
Keyword = apps.get_model('cookbook', 'Keyword')
|
||||
PropertyType = apps.get_model('cookbook', 'PropertyType')
|
||||
RecipeBook = apps.get_model('cookbook', 'RecipeBook')
|
||||
|
||||
MealType.objects.update(name=Concat(F('icon'), Value(' '), F('name')))
|
||||
Keyword.objects.update(name=Concat(F('icon'), Value(' '), F('name')))
|
||||
PropertyType.objects.update(name=Concat(F('icon'), Value(' '), F('name')))
|
||||
RecipeBook.objects.update(name=Concat(F('icon'), Value(' '), F('name')))
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('cookbook', '0199_alter_propertytype_options_alter_automation_type_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
|
||||
migrations.RunPython(
|
||||
migrate_icons
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='propertytype',
|
||||
options={'ordering': ('order',)},
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='keyword',
|
||||
name='icon',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='mealtype',
|
||||
name='icon',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='propertytype',
|
||||
name='icon',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='recipebook',
|
||||
name='icon',
|
||||
),
|
||||
]
|
@ -116,10 +116,7 @@ class TreeModel(MP_Node):
|
||||
_full_name_separator = ' > '
|
||||
|
||||
def __str__(self):
|
||||
if self.icon:
|
||||
return f"{self.icon} {self.name}"
|
||||
else:
|
||||
return f"{self.name}"
|
||||
return f"{self.name}"
|
||||
|
||||
@property
|
||||
def parent(self):
|
||||
@ -533,7 +530,6 @@ class Keyword(ExportModelOperationsMixin('keyword'), TreeModel, PermissionModelM
|
||||
if SORT_TREE_BY_NAME:
|
||||
node_order_by = ['name']
|
||||
name = models.CharField(max_length=64)
|
||||
icon = models.CharField(max_length=16, blank=True, null=True)
|
||||
description = models.TextField(default="", blank=True)
|
||||
created_at = models.DateTimeField(auto_now_add=True) # TODO deprecate
|
||||
updated_at = models.DateTimeField(auto_now=True) # TODO deprecate
|
||||
@ -767,7 +763,6 @@ class PropertyType(models.Model, PermissionModelMixin):
|
||||
|
||||
name = models.CharField(max_length=128)
|
||||
unit = models.CharField(max_length=64, blank=True, null=True)
|
||||
icon = models.CharField(max_length=16, blank=True, null=True)
|
||||
order = models.IntegerField(default=0)
|
||||
description = models.CharField(max_length=512, blank=True, null=True)
|
||||
category = models.CharField(max_length=64, choices=((NUTRITION, _('Nutrition')), (ALLERGEN, _('Allergen')),
|
||||
@ -937,7 +932,6 @@ class RecipeImport(models.Model, PermissionModelMixin):
|
||||
class RecipeBook(ExportModelOperationsMixin('book'), models.Model, PermissionModelMixin):
|
||||
name = models.CharField(max_length=128)
|
||||
description = models.TextField(blank=True)
|
||||
icon = models.CharField(max_length=16, blank=True, null=True)
|
||||
shared = models.ManyToManyField(User, blank=True, related_name='shared_with')
|
||||
created_by = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||
filter = models.ForeignKey('cookbook.CustomFilter', null=True, blank=True, on_delete=models.SET_NULL)
|
||||
@ -980,7 +974,6 @@ class RecipeBookEntry(ExportModelOperationsMixin('book_entry'), models.Model, Pe
|
||||
class MealType(models.Model, PermissionModelMixin):
|
||||
name = models.CharField(max_length=128)
|
||||
order = models.IntegerField(default=0)
|
||||
icon = models.CharField(max_length=16, blank=True, null=True)
|
||||
color = models.CharField(max_length=7, blank=True, null=True)
|
||||
default = models.BooleanField(default=False, blank=True)
|
||||
created_by = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||
|
@ -342,7 +342,7 @@ class MealTypeSerializer(SpacedModelSerializer, WritableNestedModelSerializer):
|
||||
class Meta:
|
||||
list_serializer_class = SpaceFilterSerializer
|
||||
model = MealType
|
||||
fields = ('id', 'name', 'order', 'icon', 'color', 'default', 'created_by')
|
||||
fields = ('id', 'name', 'order', 'color', 'default', 'created_by')
|
||||
read_only_fields = ('created_by',)
|
||||
|
||||
|
||||
@ -449,7 +449,7 @@ class KeywordSerializer(UniqueFieldsMixin, ExtendedRecipeMixin):
|
||||
class Meta:
|
||||
model = Keyword
|
||||
fields = (
|
||||
'id', 'name', 'icon', 'label', 'description', 'image', 'parent', 'numchild', 'numrecipe', 'created_at',
|
||||
'id', 'name', 'label', 'description', 'image', 'parent', 'numchild', 'numrecipe', 'created_at',
|
||||
'updated_at', 'full_name')
|
||||
read_only_fields = ('id', 'label', 'numchild', 'parent', 'image')
|
||||
|
||||
@ -528,7 +528,7 @@ class PropertyTypeSerializer(OpenDataModelMixin, WritableNestedModelSerializer,
|
||||
|
||||
class Meta:
|
||||
model = PropertyType
|
||||
fields = ('id', 'name', 'icon', 'unit', 'description', 'order', 'open_data_slug')
|
||||
fields = ('id', 'name', 'unit', 'description', 'order', 'open_data_slug')
|
||||
|
||||
|
||||
class PropertySerializer(UniqueFieldsMixin, WritableNestedModelSerializer):
|
||||
@ -939,7 +939,7 @@ class RecipeBookSerializer(SpacedModelSerializer, WritableNestedModelSerializer)
|
||||
|
||||
class Meta:
|
||||
model = RecipeBook
|
||||
fields = ('id', 'name', 'description', 'icon', 'shared', 'created_by', 'filter')
|
||||
fields = ('id', 'name', 'description', 'shared', 'created_by', 'filter')
|
||||
read_only_fields = ('created_by',)
|
||||
|
||||
|
||||
@ -1309,7 +1309,7 @@ class AccessTokenSerializer(serializers.ModelSerializer):
|
||||
class KeywordExportSerializer(KeywordSerializer):
|
||||
class Meta:
|
||||
model = Keyword
|
||||
fields = ('name', 'icon', 'description', 'created_at', 'updated_at')
|
||||
fields = ('name', 'description', 'created_at', 'updated_at')
|
||||
|
||||
|
||||
class NutritionInformationExportSerializer(NutritionInformationSerializer):
|
||||
|
@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-04-26 07:46+0200\n"
|
||||
"POT-Creation-Date: 2023-08-29 13:09+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@ -18,66 +18,120 @@ msgstr ""
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#: .\recipes\settings.py:436
|
||||
#: .\recipes\plugins\enterprise_plugin\helper\permission_helper.py:58
|
||||
msgid ""
|
||||
"You do not have the required permissions to view this page! You need to have "
|
||||
"the following modules licensed: "
|
||||
msgstr ""
|
||||
|
||||
#: .\recipes\plugins\enterprise_plugin\helper\permission_helper.py:76
|
||||
msgid "You are not logged in and therefore cannot view this page!"
|
||||
msgstr ""
|
||||
|
||||
#: .\recipes\plugins\enterprise_plugin\helper\permission_helper.py:79
|
||||
msgid "You do not have the required modules to view this page!"
|
||||
msgstr ""
|
||||
|
||||
#: .\recipes\plugins\enterprise_plugin\helper\permission_helper.py:90
|
||||
msgid "You do not have the required module to view this page!"
|
||||
msgstr ""
|
||||
|
||||
#: .\recipes\plugins\enterprise_plugin\models.py:32
|
||||
msgid "Recipe"
|
||||
msgstr ""
|
||||
|
||||
#: .\recipes\plugins\enterprise_plugin\models.py:32
|
||||
msgid "Recipe Keyword"
|
||||
msgstr ""
|
||||
|
||||
#: .\recipes\plugins\enterprise_plugin\models.py:32
|
||||
msgid "Meal Plan"
|
||||
msgstr ""
|
||||
|
||||
#: .\recipes\plugins\enterprise_plugin\models.py:32
|
||||
msgid "Shopping"
|
||||
msgstr ""
|
||||
|
||||
#: .\recipes\plugins\enterprise_plugin\models.py:32
|
||||
msgid "Book"
|
||||
msgstr ""
|
||||
|
||||
#: .\recipes\plugins\enterprise_plugin\models.py:37
|
||||
msgid "start"
|
||||
msgstr ""
|
||||
|
||||
#: .\recipes\plugins\enterprise_plugin\models.py:37
|
||||
msgid "center"
|
||||
msgstr ""
|
||||
|
||||
#: .\recipes\plugins\enterprise_plugin\models.py:37
|
||||
msgid "end"
|
||||
msgstr ""
|
||||
|
||||
#: .\recipes\settings.py:455
|
||||
msgid "Armenian "
|
||||
msgstr ""
|
||||
|
||||
#: .\recipes\settings.py:437
|
||||
#: .\recipes\settings.py:456
|
||||
msgid "Bulgarian"
|
||||
msgstr ""
|
||||
|
||||
#: .\recipes\settings.py:438
|
||||
#: .\recipes\settings.py:457
|
||||
msgid "Catalan"
|
||||
msgstr ""
|
||||
|
||||
#: .\recipes\settings.py:439
|
||||
#: .\recipes\settings.py:458
|
||||
msgid "Czech"
|
||||
msgstr ""
|
||||
|
||||
#: .\recipes\settings.py:440
|
||||
#: .\recipes\settings.py:459
|
||||
msgid "Danish"
|
||||
msgstr ""
|
||||
|
||||
#: .\recipes\settings.py:441
|
||||
#: .\recipes\settings.py:460
|
||||
msgid "Dutch"
|
||||
msgstr ""
|
||||
|
||||
#: .\recipes\settings.py:442
|
||||
#: .\recipes\settings.py:461
|
||||
msgid "English"
|
||||
msgstr ""
|
||||
|
||||
#: .\recipes\settings.py:443
|
||||
#: .\recipes\settings.py:462
|
||||
msgid "French"
|
||||
msgstr ""
|
||||
|
||||
#: .\recipes\settings.py:444
|
||||
#: .\recipes\settings.py:463
|
||||
msgid "German"
|
||||
msgstr ""
|
||||
|
||||
#: .\recipes\settings.py:445
|
||||
#: .\recipes\settings.py:464
|
||||
msgid "Hungarian"
|
||||
msgstr ""
|
||||
|
||||
#: .\recipes\settings.py:446
|
||||
#: .\recipes\settings.py:465
|
||||
msgid "Italian"
|
||||
msgstr ""
|
||||
|
||||
#: .\recipes\settings.py:447
|
||||
#: .\recipes\settings.py:466
|
||||
msgid "Latvian"
|
||||
msgstr ""
|
||||
|
||||
#: .\recipes\settings.py:448
|
||||
#: .\recipes\settings.py:467
|
||||
msgid "Norwegian "
|
||||
msgstr ""
|
||||
|
||||
#: .\recipes\settings.py:468
|
||||
msgid "Polish"
|
||||
msgstr ""
|
||||
|
||||
#: .\recipes\settings.py:449
|
||||
#: .\recipes\settings.py:469
|
||||
msgid "Russian"
|
||||
msgstr ""
|
||||
|
||||
#: .\recipes\settings.py:450
|
||||
#: .\recipes\settings.py:470
|
||||
msgid "Spanish"
|
||||
msgstr ""
|
||||
|
||||
#: .\recipes\settings.py:451
|
||||
#: .\recipes\settings.py:471
|
||||
msgid "Swedish"
|
||||
msgstr ""
|
||||
|
@ -9,7 +9,6 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/eslint-parser": "^7.21.3",
|
||||
"@emoji-mart/data": "^1.1.1",
|
||||
"@popperjs/core": "^2.11.7",
|
||||
"@riophae/vue-treeselect": "^0.4.0",
|
||||
"@vue/cli": "^5.0.8",
|
||||
@ -20,8 +19,6 @@
|
||||
"babel-loader": "^9.1.0",
|
||||
"bootstrap-vue": "^2.23.1",
|
||||
"core-js": "^3.29.1",
|
||||
"emoji-mart": "^5.4.0",
|
||||
"emoji-mart-vue-fast": "^12.0.1",
|
||||
"html2pdf.js": "^0.10.1",
|
||||
"lodash": "^4.17.21",
|
||||
"mavon-editor": "^2.10.4",
|
||||
@ -40,7 +37,7 @@
|
||||
"vue-multiselect": "^2.1.6",
|
||||
"vue-property-decorator": "^9.1.2",
|
||||
"vue-sanitize": "^0.2.2",
|
||||
"vue-simple-calendar": "TandoorRecipes/vue-simple-calendar#lastvue2",
|
||||
"vue-simple-calendar": "5.0.1",
|
||||
"vue-template-compiler": "2.7.14",
|
||||
"vue2-touch-events": "^3.2.2",
|
||||
"vuedraggable": "^2.24.3",
|
||||
|
@ -24,9 +24,6 @@
|
||||
<div class="col-md-12">
|
||||
<b-card class="d-flex flex-column" v-hover v-on:click="openBook(book.id)">
|
||||
<b-row no-gutters style="height: inherit">
|
||||
<b-col no-gutters md="2" style="height: inherit">
|
||||
<h3>{{ book.icon }}</h3>
|
||||
</b-col>
|
||||
<b-col no-gutters md="10" style="height: inherit">
|
||||
<b-card-body class="m-0 py-0" style="height: inherit">
|
||||
<b-card-text class="h-100 my-0 d-flex flex-column" style="text-overflow: ellipsis">
|
||||
@ -142,7 +139,7 @@ export default {
|
||||
let apiClient = new ApiApiFactory()
|
||||
|
||||
apiClient
|
||||
.createRecipeBook({ name: this.$t("New_Cookbook"), description: "", icon: "", shared: [] })
|
||||
.createRecipeBook({ name: this.$t("New_Cookbook"), description: "", shared: [] })
|
||||
.then((result) => {
|
||||
let new_book = result.data
|
||||
this.refreshData()
|
||||
|
@ -124,31 +124,6 @@
|
||||
</b-tab>
|
||||
<b-tab :title="$t('Settings')">
|
||||
<div class="row mt-3">
|
||||
<div class="col-12 col-md-3 calender-options">
|
||||
<h5>{{ $t("Planner_Settings") }}</h5>
|
||||
<b-form>
|
||||
<b-form-group id="UomInput" :label="$t('Period')" :description="$t('Plan_Period_To_Show')"
|
||||
label-for="UomInput">
|
||||
<b-form-select id="UomInput" v-model="settings.displayPeriodUom"
|
||||
:options="options.displayPeriodUom"></b-form-select>
|
||||
</b-form-group>
|
||||
<b-form-group id="PeriodInput" :label="$t('Periods')"
|
||||
:description="$t('Plan_Show_How_Many_Periods')" label-for="PeriodInput">
|
||||
<b-form-select id="PeriodInput" v-model="settings.displayPeriodCount"
|
||||
:options="options.displayPeriodCount"></b-form-select>
|
||||
</b-form-group>
|
||||
<b-form-group id="DaysInput" :label="$t('Starting_Day')" :description="$t('Starting_Day')"
|
||||
label-for="DaysInput">
|
||||
<b-form-select id="DaysInput" v-model="settings.startingDayOfWeek"
|
||||
:options="dayNames"></b-form-select>
|
||||
</b-form-group>
|
||||
<b-form-group id="WeekNumInput" :label="$t('Week_Numbers')">
|
||||
<b-form-checkbox v-model="settings.displayWeekNumbers" name="week_num">
|
||||
{{ $t("Show_Week_Numbers") }}
|
||||
</b-form-checkbox>
|
||||
</b-form-group>
|
||||
</b-form>
|
||||
</div>
|
||||
<div class="col-12 col-md-9 col-lg-6">
|
||||
<h5>{{ $t("Meal_Types") }}</h5>
|
||||
<div>
|
||||
@ -164,9 +139,7 @@
|
||||
</div>
|
||||
<div class="col-10">
|
||||
<h5 class="mt-1 mb-1">
|
||||
{{ meal_type.icon }} {{
|
||||
meal_type.name
|
||||
}}<span class="float-right text-primary" style="cursor: pointer"
|
||||
{{ meal_type.name }}<span class="float-right text-primary" style="cursor: pointer"
|
||||
><i class="fa"
|
||||
v-bind:class="{ 'fa-pen': !meal_type.editing, 'fa-save': meal_type.editing }"
|
||||
@click="editOrSaveMealType(index)" aria-hidden="true"></i
|
||||
@ -181,10 +154,6 @@
|
||||
<input class="form-control" :placeholder="$t('Name')"
|
||||
v-model="meal_type.name"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<emoji-input :field="'icon'" :label="$t('Icon')"
|
||||
:value="meal_type.icon"></emoji-input>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>{{ $t("Color") }}</label>
|
||||
<input class="form-control" type="color" name="Name"
|
||||
@ -319,7 +288,6 @@ import ContextMenuItem from "@/components/ContextMenu/ContextMenuItem"
|
||||
import MealPlanCard from "@/components/MealPlanCard"
|
||||
import MealPlanEditModal from "@/components/MealPlanEditModal"
|
||||
import MealPlanCalenderHeader from "@/components/MealPlanCalenderHeader"
|
||||
import EmojiInput from "@/components/Modals/EmojiInput"
|
||||
|
||||
import moment from "moment"
|
||||
import draggable from "vuedraggable"
|
||||
@ -351,7 +319,6 @@ export default {
|
||||
ContextMenu,
|
||||
ContextMenuItem,
|
||||
MealPlanCalenderHeader,
|
||||
EmojiInput,
|
||||
draggable,
|
||||
BottomNavigationBar,
|
||||
},
|
||||
@ -418,16 +385,6 @@ export default {
|
||||
detailed_items: function () {
|
||||
return this.settings.displayPeriodUom === "week"
|
||||
},
|
||||
dayNames: function () {
|
||||
let options = []
|
||||
this.getFormattedWeekdayNames(this.userLocale, "long", 0).forEach((day, index) => {
|
||||
options.push({text: day, value: index})
|
||||
})
|
||||
return options
|
||||
},
|
||||
userLocale: function () {
|
||||
return this.getDefaultBrowserLocale
|
||||
},
|
||||
item_height: function () {
|
||||
if (this.settings.displayPeriodUom === "week") {
|
||||
return "10rem"
|
||||
@ -467,7 +424,6 @@ export default {
|
||||
this.settings = Object.assign({}, this.settings, this.$cookies.get(SETTINGS_COOKIE_NAME))
|
||||
}
|
||||
})
|
||||
this.$root.$on("change", this.updateEmoji)
|
||||
this.$i18n.locale = window.CUSTOM_LOCALE
|
||||
moment.locale(window.CUSTOM_LOCALE)
|
||||
},
|
||||
@ -560,13 +516,6 @@ export default {
|
||||
StandardToasts.makeStandardToast(this, StandardToasts.FAIL_DELETE, err)
|
||||
})
|
||||
},
|
||||
updateEmoji: function (field, value) {
|
||||
this.meal_types.forEach((meal_type) => {
|
||||
if (meal_type.editing) {
|
||||
meal_type.icon = value
|
||||
}
|
||||
})
|
||||
},
|
||||
datePickerChanged(ctx) {
|
||||
this.setShowDate(ctx.selectedDate)
|
||||
},
|
||||
|
@ -2,7 +2,7 @@
|
||||
<b-card no-body v-hover>
|
||||
<b-card-header class="p-4">
|
||||
<h5>
|
||||
{{ book_copy.icon }} {{ book_copy.name }}
|
||||
{{ book_copy.name }}
|
||||
<span class="float-right text-primary" @click="editOrSave"><i class="fa" v-bind:class="{ 'fa-pen': !editing, 'fa-save': editing }" aria-hidden="true"></i></span>
|
||||
</h5>
|
||||
<b-badge class="font-weight-normal mr-1" v-for="u in book_copy.shared" v-bind:key="u.id" variant="primary" pill>{{ u.display_name }}</b-badge>
|
||||
@ -12,9 +12,6 @@
|
||||
<label for="inputName1">{{ $t("Name") }}</label>
|
||||
<input class="form-control" id="inputName1" placeholder="Name" v-model="book_copy.name" />
|
||||
</div>
|
||||
<div class="form-group" v-if="editing">
|
||||
<emoji-input :field="'icon'" :label="$t('Icon')" :value="book_copy.icon"></emoji-input>
|
||||
</div>
|
||||
<div class="form-group" v-if="editing">
|
||||
<label for="inputDesc1">{{ $t("Description") }}</label>
|
||||
<textarea class="form-control" id="inputDesc1" rows="3" v-model="book_copy.description"> </textarea>
|
||||
@ -58,12 +55,11 @@
|
||||
<script>
|
||||
import { ApiApiFactory } from "@/utils/openapi/api"
|
||||
import { ApiMixin, StandardToasts } from "@/utils/utils"
|
||||
import EmojiInput from "./Modals/EmojiInput"
|
||||
import GenericMultiselect from "@/components/GenericMultiselect"
|
||||
|
||||
export default {
|
||||
name: "CookbookEditCard",
|
||||
components: { EmojiInput, GenericMultiselect },
|
||||
components: { GenericMultiselect },
|
||||
mixins: [ApiMixin],
|
||||
props: {
|
||||
book: Object,
|
||||
@ -77,7 +73,6 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
this.book_copy = this.book
|
||||
this.$root.$on("change", this.updateEmoji)
|
||||
},
|
||||
directives: {
|
||||
hover: {
|
||||
@ -103,11 +98,6 @@ export default {
|
||||
this.$emit("reload")
|
||||
}
|
||||
},
|
||||
updateEmoji: function (item, value) {
|
||||
if (item === "icon") {
|
||||
this.book_copy.icon = value
|
||||
}
|
||||
},
|
||||
saveData: function () {
|
||||
let apiClient = new ApiApiFactory()
|
||||
|
||||
|
@ -1,64 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<b-form-group
|
||||
v-bind:label="field_label"
|
||||
class="mb-3">
|
||||
|
||||
<input class="form-control" v-model="new_value">
|
||||
|
||||
<Picker :data="emojiIndex" :ref="'_edit_' + id" :native="true"
|
||||
@select="setIcon"/>
|
||||
|
||||
</b-form-group>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import data from "emoji-mart-vue-fast/data/all.json";
|
||||
import "emoji-mart-vue-fast/css/emoji-mart.css";
|
||||
import {Picker, EmojiIndex} from "emoji-mart-vue-fast";
|
||||
let emojiIndex = new EmojiIndex(data);
|
||||
|
||||
export default {
|
||||
name: 'EmojiInput',
|
||||
components: {Picker},
|
||||
props: {
|
||||
field: {type: String, default: 'You Forgot To Set Field Name'},
|
||||
label: {type: String, default: ''},
|
||||
value: {type: String, default: ''},
|
||||
optional: {type: Boolean, default: false},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
new_value: undefined,
|
||||
id: null,
|
||||
emojiIndex: emojiIndex,
|
||||
emojisOutput: ""
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
field_label: function () {
|
||||
if (this.optional) {
|
||||
return this.label
|
||||
} else {
|
||||
return this.label + '*'
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'new_value': function () {
|
||||
this.$root.$emit('change', this.field, this.new_value ?? null)
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.id = this._uid
|
||||
},
|
||||
methods: {
|
||||
setIcon: function (icon) {
|
||||
console.log(icon)
|
||||
this.new_value = icon.native
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
@ -16,7 +16,6 @@
|
||||
<text-input v-if="visibleCondition(f, 'text')" :label="f.label" :value="f.value" :field="f.field" :placeholder="f.placeholder" :help="showHelp && f.help" :subtitle="f.subtitle" :disabled="f.disabled" :optional="f.optional"/>
|
||||
<text-area-input v-if="visibleCondition(f, 'textarea')" :label="f.label" :value="f.value" :field="f.field" :placeholder="f.placeholder" :help="showHelp && f.help" :subtitle="f.subtitle" :disabled="f.disabled" :optional="f.optional"/>
|
||||
<choice-input v-if="visibleCondition(f, 'choice')" :label="f.label" :value="f.value" :field="f.field" :options="f.options" :placeholder="f.placeholder" :optional="f.optional"/>
|
||||
<emoji-input v-if="visibleCondition(f, 'emoji')" :label="f.label" :value="f.value" :field="f.field" @change="storeValue" :optional="f.optional"/>
|
||||
<file-input v-if="visibleCondition(f, 'file')" :label="f.label" :value="f.value" :field="f.field" @change="storeValue" :optional="f.optional"/>
|
||||
<small-text v-if="visibleCondition(f, 'smalltext')" :value="f.value" />
|
||||
<date-input v-if="visibleCondition(f, 'date')" :label="f.label" :value="f.value" :field="f.field" :help="showHelp && f.help" :subtitle="f.subtitle" :optional="f.optional"/>
|
||||
@ -52,7 +51,6 @@ import CheckboxInput from "@/components/Modals/CheckboxInput"
|
||||
import LookupInput from "@/components/Modals/LookupInput"
|
||||
import TextInput from "@/components/Modals/TextInput"
|
||||
import DateInput from "@/components/Modals/DateInput"
|
||||
import EmojiInput from "@/components/Modals/EmojiInput"
|
||||
import ChoiceInput from "@/components/Modals/ChoiceInput"
|
||||
import FileInput from "@/components/Modals/FileInput"
|
||||
import SmallText from "@/components/Modals/SmallText"
|
||||
@ -67,7 +65,6 @@ export default {
|
||||
CheckboxInput,
|
||||
LookupInput,
|
||||
TextInput,
|
||||
EmojiInput,
|
||||
ChoiceInput,
|
||||
SmallText,
|
||||
HelpBadge,
|
||||
|
@ -33,8 +33,7 @@
|
||||
|
||||
<tr v-for="p in property_list" v-bind:key="`id_${p.id}`">
|
||||
<td>
|
||||
|
||||
{{ p.icon }} {{ p.name }}
|
||||
{{ p.name }}
|
||||
</td>
|
||||
<td class="text-right">{{ p.property_amount_per_serving }}</td>
|
||||
<td class="text-right">{{ p.property_amount_total }}</td>
|
||||
|
@ -11,6 +11,29 @@
|
||||
:placeholder="$t('User')"
|
||||
></generic-multiselect>
|
||||
</b-form-group>
|
||||
|
||||
<b-form v-if="meal_plan_store">
|
||||
<b-form-group id="UomInput" :label="$t('Period')" :description="$t('Plan_Period_To_Show')"
|
||||
label-for="UomInput">
|
||||
<b-form-select id="UomInput" v-model="meal_plan_store.client_settings.displayPeriodUom"
|
||||
:options="calendar_options.displayPeriodUom"></b-form-select>
|
||||
</b-form-group>
|
||||
<b-form-group id="PeriodInput" :label="$t('Periods')"
|
||||
:description="$t('Plan_Show_How_Many_Periods')" label-for="PeriodInput">
|
||||
<b-form-select id="PeriodInput" v-model="meal_plan_store.client_settings.displayPeriodCount"
|
||||
:options="calendar_options.displayPeriodCount"></b-form-select>
|
||||
</b-form-group>
|
||||
<b-form-group id="DaysInput" :label="$t('Starting_Day')" :description="$t('Starting_Day')"
|
||||
label-for="DaysInput">
|
||||
<b-form-select id="DaysInput" v-model="meal_plan_store.client_settings.startingDayOfWeek"
|
||||
:options="dayNames()"></b-form-select>
|
||||
</b-form-group>
|
||||
<b-form-group id="WeekNumInput" :label="$t('Week_Numbers')">
|
||||
<b-form-checkbox v-model="meal_plan_store.client_settings.displayWeekNumbers" name="week_num">
|
||||
{{ $t("Show_Week_Numbers") }}
|
||||
</b-form-checkbox>
|
||||
</b-form-group>
|
||||
</b-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -20,6 +43,8 @@ import {ApiMixin, StandardToasts} from "@/utils/utils";
|
||||
|
||||
import axios from "axios";
|
||||
import GenericMultiselect from "@/components/GenericMultiselect";
|
||||
import {useMealPlanStore} from "@/stores/MealPlanStore";
|
||||
import {CalendarMathMixin} from "vue-simple-calendar/src/components/bundle";
|
||||
|
||||
axios.defaults.xsrfCookieName = 'csrftoken'
|
||||
axios.defaults.xsrfHeaderName = "X-CSRFTOKEN"
|
||||
@ -28,7 +53,7 @@ let SETTINGS_COOKIE_NAME = "mealplan_settings"
|
||||
|
||||
export default {
|
||||
name: "MealPlanSettingsComponent",
|
||||
mixins: [ApiMixin],
|
||||
mixins: [ApiMixin, CalendarMathMixin],
|
||||
components: {GenericMultiselect},
|
||||
props: {
|
||||
user_id: Number,
|
||||
@ -37,12 +62,23 @@ export default {
|
||||
return {
|
||||
user_preferences: undefined,
|
||||
languages: [],
|
||||
meal_plan_store: undefined,
|
||||
calendar_options: {
|
||||
displayPeriodUom: [
|
||||
{text: this.$t("Week"), value: "week"},
|
||||
{text: this.$t("Month"), value: "month",},
|
||||
{text: this.$t("Year"), value: "year"},
|
||||
],
|
||||
displayPeriodCount: [1, 2, 3, 4],
|
||||
},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.user_preferences = this.preferences
|
||||
this.languages = window.AVAILABLE_LANGUAGES
|
||||
this.loadSettings()
|
||||
|
||||
this.meal_plan_store = useMealPlanStore()
|
||||
},
|
||||
methods: {
|
||||
loadSettings: function () {
|
||||
@ -64,6 +100,13 @@ export default {
|
||||
StandardToasts.makeStandardToast(this, StandardToasts.FAIL_UPDATE, err)
|
||||
})
|
||||
},
|
||||
dayNames: function () {
|
||||
let options = []
|
||||
this.getFormattedWeekdayNames(this.getDefaultBrowserLocale(), "long", 0).forEach((day, index) => {
|
||||
options.push({text: day, value: index})
|
||||
})
|
||||
return options
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"warning_feature_beta": "This feature is currently in a BETA (testing) state. Please expect bugs and possibly breaking changes in the future (possibly loosing feature related data) when using this feature.",
|
||||
"warning_feature_beta": "This feature is currently in a BETA (testing) state. Please expect bugs and possibly breaking changes in the future (possibly losing feature-related data) when using this feature.",
|
||||
"err_fetching_resource": "There was an error fetching a resource!",
|
||||
"err_creating_resource": "There was an error creating a resource!",
|
||||
"err_updating_resource": "There was an error updating a resource!",
|
||||
|
@ -12,6 +12,12 @@ export const useMealPlanStore = defineStore(_STORE_ID, {
|
||||
state: () => ({
|
||||
plans: {},
|
||||
currently_updating: null,
|
||||
client_settings: {
|
||||
displayPeriodUom: "week",
|
||||
displayPeriodCount: 2,
|
||||
startingDayOfWeek: 1,
|
||||
displayWeekNumbers: true,
|
||||
},
|
||||
}),
|
||||
getters: {
|
||||
plan_list: function () {
|
||||
|
@ -243,7 +243,7 @@ export class Models {
|
||||
},
|
||||
create: {
|
||||
// if not defined partialUpdate will use the same parameters, prepending 'id'
|
||||
params: [["name", "description", "icon"]],
|
||||
params: [["name", "description"]],
|
||||
form: {
|
||||
name: {
|
||||
form_field: true,
|
||||
@ -260,13 +260,6 @@ export class Models {
|
||||
placeholder: "",
|
||||
optional: true,
|
||||
},
|
||||
icon: {
|
||||
form_field: true,
|
||||
type: "emoji",
|
||||
field: "icon",
|
||||
label: "Icon",
|
||||
optional: true,
|
||||
},
|
||||
full_name: {
|
||||
form_field: true,
|
||||
type: "smalltext",
|
||||
@ -382,7 +375,7 @@ export class Models {
|
||||
name: "Recipe_Book",
|
||||
apiName: "RecipeBook",
|
||||
create: {
|
||||
params: [["name", "description", "icon", "filter"]],
|
||||
params: [["name", "description", "filter"]],
|
||||
form: {
|
||||
name: {
|
||||
form_field: true,
|
||||
@ -399,13 +392,7 @@ export class Models {
|
||||
placeholder: "",
|
||||
optional: true,
|
||||
},
|
||||
icon: {
|
||||
form_field: true,
|
||||
type: "emoji",
|
||||
field: "icon",
|
||||
label: "Icon",
|
||||
optional: true,
|
||||
},
|
||||
|
||||
filter: {
|
||||
form_field: true,
|
||||
type: "lookup",
|
||||
@ -710,7 +697,7 @@ export class Models {
|
||||
},
|
||||
},
|
||||
create: {
|
||||
params: [["name", "icon", "unit", "description", "order"]],
|
||||
params: [["name", "unit", "description", "order"]],
|
||||
form: {
|
||||
show_help: true,
|
||||
name: {
|
||||
@ -720,14 +707,7 @@ export class Models {
|
||||
label: "Name",
|
||||
placeholder: "",
|
||||
},
|
||||
icon: {
|
||||
form_field: true,
|
||||
type: "emoji",
|
||||
field: "icon",
|
||||
label: "Icon",
|
||||
placeholder: "",
|
||||
optional: true,
|
||||
},
|
||||
|
||||
unit: {
|
||||
form_field: true,
|
||||
type: "text",
|
||||
|
28971
vue/yarn.lock
28971
vue/yarn.lock
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user