enrecipes/app/components/settings/MPSettings.vue

91 lines
2.4 KiB
Vue
Raw Normal View History

2021-05-25 14:32:53 +00:00
<template>
2021-06-15 11:04:42 +00:00
<Page @loaded="pgLoad" actionBarHidden="true">
<RGridLayout :rtl="RTL" rows="*, auto" columns="auto, *">
2021-05-25 14:32:53 +00:00
<OptionsList title="Settings" :items="items" />
2021-06-15 11:04:42 +00:00
<GridLayout row="1" class="appbar rtl" rows="*" columns="auto, *">
2021-05-25 14:32:53 +00:00
<Button class="ico" :text="icon.back" @tap="$navigateBack()" />
</GridLayout>
2021-06-18 12:52:03 +00:00
<Label rowSpan="2" class="edge hal rtl" @swipe="swipeBack" />
<Label
rowSpan="2"
colSpan="2"
class="edge har rtl f"
@swipe="swipeBack"
/>
2021-06-15 11:04:42 +00:00
</RGridLayout>
2021-05-25 14:32:53 +00:00
</Page>
</template>
<script>
import { Observable } from "@nativescript/core";
import { mapState, mapActions } from "vuex";
2021-06-15 11:04:42 +00:00
import Action from "../modals/Action";
2021-05-25 14:32:53 +00:00
import OptionsList from "../sub/OptionsList";
2021-06-15 11:04:42 +00:00
import { localize } from "@nativescript/localize";
2021-05-25 14:32:53 +00:00
export default {
components: { OptionsList },
computed: {
2021-06-15 11:04:42 +00:00
...mapState(["icon", "mondayFirst", "RTL", "plannerView", "planDeletion"]),
2021-05-25 14:32:53 +00:00
items() {
return [
{},
2021-06-15 11:04:42 +00:00
{
type: "list",
icon: "calv",
title: "calVM",
subTitle: localize(this.plannerView),
action: this.selectPlannerView,
},
2021-05-25 14:32:53 +00:00
{
type: "switch",
icon: "week",
title: "swm",
2021-06-15 11:04:42 +00:00
checked: !!this.mondayFirst,
2021-05-25 14:32:53 +00:00
action: this.toggleFirstDay,
},
2021-06-15 11:04:42 +00:00
{
type: "list",
icon: "mpd",
title: "admp",
subTitle: localize(this.planDeletion),
action: this.selectDeletionTime,
},
2021-05-25 14:32:53 +00:00
{},
];
},
},
methods: {
2021-06-15 11:04:42 +00:00
...mapActions(["setFirstDay", "setPlannerView", "setPlanDeletion"]),
pgLoad({ object }) {
2021-05-25 14:32:53 +00:00
object.bindingContext = new Observable();
},
toggleFirstDay() {
2021-06-15 11:04:42 +00:00
this.setFirstDay(!this.mondayFirst | 0);
},
selectPlannerView() {
this.$showModal(Action, {
props: {
title: "calVM",
2021-06-18 12:52:03 +00:00
list: ["d", "wk", "mnth"],
selected: this.plannerView,
2021-06-15 11:04:42 +00:00
},
}).then((res) => {
if (res && this.plannerView != res) this.setPlannerView(res);
});
},
selectDeletionTime() {
this.$showModal(Action, {
props: {
title: "admp",
2021-06-18 12:52:03 +00:00
list: ["otaw", "otam", "otay", "nvr"],
selected: this.planDeletion,
2021-06-15 11:04:42 +00:00
},
}).then((res) => {
if (res && this.planDeletion != res) this.setPlanDeletion(res);
});
2021-05-25 14:32:53 +00:00
},
},
};
</script>