enrecipes/app/components/settings/MPSettings.vue

91 lines
2.3 KiB
Vue
Raw Permalink 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-06-28 11:38:21 +00:00
<Button class="ico" :text="icon.back" @tap="$navigateBack()" />
2021-05-25 14:32:53 +00:00
</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-18 18:37:01 +00:00
...mapState(["icon", "startMon", "RTL", "plannerV", "planDel"]),
2021-05-25 14:32:53 +00:00
items() {
return [
{},
2021-06-15 11:04:42 +00:00
{
type: "list",
icon: "calv",
title: "calVM",
2021-06-18 18:37:01 +00:00
subTitle: localize(this.plannerV),
2021-06-15 11:04:42 +00:00
action: this.selectPlannerView,
},
2021-05-25 14:32:53 +00:00
{
type: "switch",
icon: "week",
title: "swm",
2021-06-18 18:37:01 +00:00
checked: !!this.startMon,
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",
2021-06-18 18:37:01 +00:00
subTitle: localize(this.planDel),
2021-06-15 11:04:42 +00:00
action: this.selectDeletionTime,
},
2021-05-25 14:32:53 +00:00
{},
];
},
},
methods: {
2021-06-18 18:37:01 +00:00
...mapActions(["setFD", "setPlannerV", "setPlanDel"]),
2021-06-15 11:04:42 +00:00
pgLoad({ object }) {
2021-05-25 14:32:53 +00:00
object.bindingContext = new Observable();
},
toggleFirstDay() {
2021-06-18 18:37:01 +00:00
this.setFD(!this.startMon | 0);
2021-06-15 11:04:42 +00:00
},
selectPlannerView() {
this.$showModal(Action, {
props: {
title: "calVM",
2021-06-18 12:52:03 +00:00
list: ["d", "wk", "mnth"],
2021-06-18 18:37:01 +00:00
selected: this.plannerV,
2021-06-15 11:04:42 +00:00
},
}).then((res) => {
2021-06-18 18:37:01 +00:00
if (res && this.plannerV != res) this.setPlannerV(res);
2021-06-15 11:04:42 +00:00
});
},
selectDeletionTime() {
this.$showModal(Action, {
props: {
title: "admp",
2021-06-18 12:52:03 +00:00
list: ["otaw", "otam", "otay", "nvr"],
2021-06-18 18:37:01 +00:00
selected: this.planDel,
2021-06-15 11:04:42 +00:00
},
}).then((res) => {
2021-06-18 18:37:01 +00:00
if (res && this.planDel != res) this.setPlanDel(res);
2021-06-15 11:04:42 +00:00
});
2021-05-25 14:32:53 +00:00
},
},
};
</script>