@@ -60,6 +60,18 @@
:placeholder="$t('Servings')">
{{ $t("Servings") }}
+
+
+ {{ $t("Share") }}
+
@@ -103,7 +115,7 @@ export default {
allow_delete: {
type: Boolean,
default: true
- },
+ }
},
mixins: [ApiMixin],
components: {
@@ -114,7 +126,8 @@ export default {
return {
entryEditing: {},
missing_recipe: false,
- missing_meal_type: false
+ missing_meal_type: false,
+ default_plan_share: []
}
},
watch: {
@@ -126,6 +139,23 @@ export default {
}
},
methods: {
+ showModal() {
+ let apiClient = new ApiApiFactory()
+
+ apiClient.listUserPreferences().then(result => {
+ let default_share = result.data[0].plan_share;
+
+ if (default_share !== []) {
+ let apiClient = new ApiApiFactory()
+
+ apiClient.listUsers(default_share).then(result => {
+ if (this.entry.id === -1) {
+ this.entryEditing.shared = result.data
+ }
+ })
+ }
+ })
+ },
editEntry() {
this.missing_meal_type = false
this.missing_recipe = false
@@ -155,6 +185,13 @@ export default {
this.entryEditing.meal_type = null;
}
},
+ selectShared(event) {
+ if (event.val != null) {
+ this.entryEditing.shared = event.val;
+ } else {
+ this.entryEditing.meal_type = null;
+ }
+ },
createMealType(event) {
if (event != "") {
let apiClient = new ApiApiFactory()