| 
									
										
										
										
											2021-08-06 16:28:12 -08:00
										 |  |  | <template> | 
					
						
							| 
									
										
										
										
											2021-09-05 22:05:29 -08:00
										 |  |  |   <v-container class="narrow-container"> | 
					
						
							|  |  |  |     <BasePageTitle class="mb-5"> | 
					
						
							| 
									
										
										
										
											2021-09-04 20:24:32 -08:00
										 |  |  |       <template #header> | 
					
						
							|  |  |  |         <v-img max-height="100" max-width="100" :src="require('~/static/svgs/manage-group-settings.svg')"></v-img> | 
					
						
							|  |  |  |       </template> | 
					
						
							| 
									
										
										
										
											2023-02-26 12:39:36 -09:00
										 |  |  |       <template #title> {{ $t("profile.group-settings") }} </template> | 
					
						
							|  |  |  |       {{ $t("profile.group-description") }} | 
					
						
							| 
									
										
										
										
											2021-09-04 20:24:32 -08:00
										 |  |  |     </BasePageTitle> | 
					
						
							| 
									
										
										
										
											2021-09-05 22:05:29 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     <section v-if="group"> | 
					
						
							| 
									
										
										
										
											2023-01-29 02:39:51 +01:00
										 |  |  |       <BaseCardSectionTitle class="mt-10" :title="$tc('group.group-preferences')"></BaseCardSectionTitle> | 
					
						
							| 
									
										
										
										
											2023-02-26 12:39:36 -09:00
										 |  |  |       <div class="mb-6"> | 
					
						
							|  |  |  |         <v-checkbox | 
					
						
							|  |  |  |           v-model="group.preferences.privateGroup" | 
					
						
							|  |  |  |           hide-details | 
					
						
							|  |  |  |           dense | 
					
						
							|  |  |  |           :label="$t('group.private-group')" | 
					
						
							|  |  |  |           @change="groupActions.updatePreferences()" | 
					
						
							|  |  |  |         /> | 
					
						
							|  |  |  |         <div class="ml-8"> | 
					
						
							|  |  |  |           <p class="text-subtitle-2 my-0 py-0"> | 
					
						
							|  |  |  |             {{ $t("group.private-group-description") }} | 
					
						
							|  |  |  |           </p> | 
					
						
							|  |  |  |           <DocLink class="mt-2" link="/documentation/getting-started/faq/#how-do-private-groups-and-recipes-work" /> | 
					
						
							|  |  |  |         </div> | 
					
						
							|  |  |  |       </div> | 
					
						
							| 
									
										
										
										
											2021-09-05 22:05:29 -08:00
										 |  |  |       <v-select | 
					
						
							|  |  |  |         v-model="group.preferences.firstDayOfWeek" | 
					
						
							|  |  |  |         :prepend-icon="$globals.icons.calendarWeekBegin" | 
					
						
							|  |  |  |         :items="allDays" | 
					
						
							|  |  |  |         item-text="name" | 
					
						
							|  |  |  |         item-value="value" | 
					
						
							|  |  |  |         :label="$t('settings.first-day-of-week')" | 
					
						
							|  |  |  |         @change="groupActions.updatePreferences()" | 
					
						
							|  |  |  |       /> | 
					
						
							|  |  |  |     </section> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     <section v-if="group"> | 
					
						
							| 
									
										
										
										
											2023-01-29 02:39:51 +01:00
										 |  |  |       <BaseCardSectionTitle class="mt-10" :title="$tc('group.default-recipe-preferences')"> | 
					
						
							| 
									
										
										
										
											2023-02-26 12:39:36 -09:00
										 |  |  |         {{ $t("group.default-recipe-preferences-description") }} | 
					
						
							| 
									
										
										
										
											2021-09-05 22:05:29 -08:00
										 |  |  |       </BaseCardSectionTitle> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-26 12:39:36 -09:00
										 |  |  |       <div class="preference-container"> | 
					
						
							|  |  |  |         <div v-for="p in preferencesEditor" :key="p.key"> | 
					
						
							|  |  |  |           <v-checkbox | 
					
						
							|  |  |  |             v-model="group.preferences[p.key]" | 
					
						
							|  |  |  |             hide-details | 
					
						
							|  |  |  |             dense | 
					
						
							|  |  |  |             :label="p.label" | 
					
						
							|  |  |  |             @change="groupActions.updatePreferences()" | 
					
						
							|  |  |  |           /> | 
					
						
							|  |  |  |           <p class="ml-8 text-subtitle-2 my-0 py-0"> | 
					
						
							|  |  |  |             {{ p.description }} | 
					
						
							|  |  |  |           </p> | 
					
						
							|  |  |  |         </div> | 
					
						
							|  |  |  |       </div> | 
					
						
							| 
									
										
										
										
											2021-09-05 22:05:29 -08:00
										 |  |  |     </section> | 
					
						
							| 
									
										
										
										
											2021-08-06 16:28:12 -08:00
										 |  |  |   </v-container> | 
					
						
							|  |  |  | </template> | 
					
						
							| 
									
										
										
										
											2022-02-07 19:03:11 -09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-06 16:28:12 -08:00
										 |  |  | <script lang="ts"> | 
					
						
							| 
									
										
										
										
											2023-02-26 12:39:36 -09:00
										 |  |  | import { computed, defineComponent, useContext } from "@nuxtjs/composition-api"; | 
					
						
							| 
									
										
										
										
											2022-02-07 19:03:11 -09:00
										 |  |  | import { useGroupSelf } from "~/composables/use-groups"; | 
					
						
							| 
									
										
										
										
											2023-02-26 12:39:36 -09:00
										 |  |  | import { ReadGroupPreferences } from "~/lib/api/types/group"; | 
					
						
							| 
									
										
										
										
											2021-08-06 16:28:12 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | export default defineComponent({ | 
					
						
							|  |  |  |   setup() { | 
					
						
							| 
									
										
										
										
											2021-09-05 22:05:29 -08:00
										 |  |  |     const { group, actions: groupActions } = useGroupSelf(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const { i18n } = useContext(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-26 12:39:36 -09:00
										 |  |  |     type Preference = { | 
					
						
							|  |  |  |       key: keyof ReadGroupPreferences; | 
					
						
							|  |  |  |       value: boolean; | 
					
						
							|  |  |  |       label: string; | 
					
						
							|  |  |  |       description: string; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const preferencesEditor = computed<Preference[]>(() => { | 
					
						
							|  |  |  |       if (!group.value || !group.value.preferences) { | 
					
						
							|  |  |  |         return []; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       return [ | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           key: "recipePublic", | 
					
						
							|  |  |  |           value: group.value.preferences.recipePublic || false, | 
					
						
							|  |  |  |           label: i18n.t("group.allow-users-outside-of-your-group-to-see-your-recipes"), | 
					
						
							|  |  |  |           description: i18n.t("group.allow-users-outside-of-your-group-to-see-your-recipes-description"), | 
					
						
							|  |  |  |         } as Preference, | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           key: "recipeShowNutrition", | 
					
						
							|  |  |  |           value: group.value.preferences.recipeShowNutrition || false, | 
					
						
							|  |  |  |           label: i18n.t("group.show-nutrition-information"), | 
					
						
							|  |  |  |           description: i18n.t("group.show-nutrition-information-description"), | 
					
						
							|  |  |  |         } as Preference, | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           key: "recipeShowAssets", | 
					
						
							|  |  |  |           value: group.value.preferences.recipeShowAssets || false, | 
					
						
							|  |  |  |           label: i18n.t("group.show-recipe-assets"), | 
					
						
							|  |  |  |           description: i18n.t("group.show-recipe-assets-description"), | 
					
						
							|  |  |  |         } as Preference, | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           key: "recipeLandscapeView", | 
					
						
							|  |  |  |           value: group.value.preferences.recipeLandscapeView || false, | 
					
						
							|  |  |  |           label: i18n.t("group.default-to-landscape-view"), | 
					
						
							|  |  |  |           description: i18n.t("group.default-to-landscape-view-description"), | 
					
						
							|  |  |  |         } as Preference, | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           key: "recipeDisableComments", | 
					
						
							|  |  |  |           value: group.value.preferences.recipeDisableComments || false, | 
					
						
							|  |  |  |           label: i18n.t("group.disable-users-from-commenting-on-recipes"), | 
					
						
							|  |  |  |           description: i18n.t("group.disable-users-from-commenting-on-recipes-description"), | 
					
						
							|  |  |  |         } as Preference, | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           key: "recipeDisableAmount", | 
					
						
							|  |  |  |           value: group.value.preferences.recipeDisableAmount || false, | 
					
						
							|  |  |  |           label: i18n.t("group.disable-organizing-recipe-ingredients-by-units-and-food"), | 
					
						
							|  |  |  |           description: i18n.t("group.disable-organizing-recipe-ingredients-by-units-and-food-description"), | 
					
						
							|  |  |  |         } as Preference, | 
					
						
							|  |  |  |       ]; | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-05 22:05:29 -08:00
										 |  |  |     const allDays = [ | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         name: i18n.t("general.sunday"), | 
					
						
							|  |  |  |         value: 0, | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         name: i18n.t("general.monday"), | 
					
						
							|  |  |  |         value: 1, | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         name: i18n.t("general.tuesday"), | 
					
						
							|  |  |  |         value: 2, | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         name: i18n.t("general.wednesday"), | 
					
						
							|  |  |  |         value: 3, | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         name: i18n.t("general.thursday"), | 
					
						
							|  |  |  |         value: 4, | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         name: i18n.t("general.friday"), | 
					
						
							|  |  |  |         value: 5, | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         name: i18n.t("general.saturday"), | 
					
						
							|  |  |  |         value: 6, | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |     ]; | 
					
						
							| 
									
										
										
										
											2021-09-01 21:39:40 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     return { | 
					
						
							| 
									
										
										
										
											2021-09-05 22:05:29 -08:00
										 |  |  |       group, | 
					
						
							|  |  |  |       groupActions, | 
					
						
							|  |  |  |       allDays, | 
					
						
							| 
									
										
										
										
											2023-02-26 12:39:36 -09:00
										 |  |  |       preferencesEditor, | 
					
						
							| 
									
										
										
										
											2021-09-01 21:39:40 -08:00
										 |  |  |     }; | 
					
						
							| 
									
										
										
										
											2021-08-06 16:28:12 -08:00
										 |  |  |   }, | 
					
						
							| 
									
										
										
										
											2021-10-07 09:39:47 -08:00
										 |  |  |   head() { | 
					
						
							|  |  |  |     return { | 
					
						
							|  |  |  |       title: this.$t("group.group") as string, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |   }, | 
					
						
							| 
									
										
										
										
											2021-08-06 16:28:12 -08:00
										 |  |  | }); | 
					
						
							|  |  |  | </script> | 
					
						
							| 
									
										
										
										
											2023-02-26 12:39:36 -09:00
										 |  |  | 
 | 
					
						
							|  |  |  | <style lang="css"> | 
					
						
							|  |  |  | .preference-container { | 
					
						
							|  |  |  |   display: flex; | 
					
						
							|  |  |  |   flex-direction: column; | 
					
						
							|  |  |  |   gap: 0.5rem; | 
					
						
							|  |  |  |   max-width: 600px; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | </style> |