HouseholdPreferenceEditor

This commit is contained in:
Kuchenpirat 2025-07-29 23:49:49 +00:00
commit 1d20b1455c

View file

@ -41,27 +41,19 @@
</div> </div>
</template> </template>
<script lang="ts"> <script setup lang="ts">
import type { ReadHouseholdPreferences } from "~/lib/api/types/household"; import type { ReadHouseholdPreferences } from "~/lib/api/types/household";
export default defineNuxtComponent({ const preferences = defineModel<ReadHouseholdPreferences>({ required: true });
props: { const i18n = useI18n();
modelValue: {
type: Object,
required: true,
},
},
emits: ["update:modelValue"],
setup(props, context) {
const i18n = useI18n();
type Preference = { type Preference = {
key: keyof ReadHouseholdPreferences; key: keyof ReadHouseholdPreferences;
label: string; label: string;
description: string; description: string;
}; };
const recipePreferences: Preference[] = [ const recipePreferences: Preference[] = [
{ {
key: "recipePublic", key: "recipePublic",
label: i18n.t("group.allow-users-outside-of-your-group-to-see-your-recipes"), label: i18n.t("group.allow-users-outside-of-your-group-to-see-your-recipes"),
@ -92,9 +84,9 @@ export default defineNuxtComponent({
label: i18n.t("group.disable-organizing-recipe-ingredients-by-units-and-food"), 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"), description: i18n.t("group.disable-organizing-recipe-ingredients-by-units-and-food-description"),
}, },
]; ];
const allDays = [ const allDays = [
{ {
name: i18n.t("general.sunday"), name: i18n.t("general.sunday"),
value: 0, value: 0,
@ -123,24 +115,7 @@ export default defineNuxtComponent({
name: i18n.t("general.saturday"), name: i18n.t("general.saturday"),
value: 6, value: 6,
}, },
]; ];
const preferences = computed({
get() {
return props.modelValue;
},
set(val) {
context.emit("update:modelValue", val);
},
});
return {
allDays,
preferences,
recipePreferences,
};
},
});
</script> </script>
<style lang="css"> <style lang="css">