aboutsummaryrefslogtreecommitdiff
path: root/resources/vue/components/form_inputs/DayOfWeekSelect.vue
blob: 0f8792c49b2754b53d353b4f8e5b18337c765179 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<template>
    <select :name="name" v-model="selected_value">
        <option v-if="with_indeterminate" value=""
                :selected="!value">
            {{ $gettext('Bitte wählen') }}
        </option>
        <option value="1" :selected="value == '1'">
            {{ $gettext('Montag') }}
        </option>
        <option value="2" :selected="value == '2'">
            {{ $gettext('Dienstag') }}
        </option>
        <option value="3" :selected="value == '3'">
            {{ $gettext('Mittwoch') }}
        </option>
        <option value="4" :selected="value == '4'">
            {{ $gettext('Donnerstag') }}
        </option>
        <option value="5" :selected="value == '5'">
            {{ $gettext('Freitag') }}
        </option>
        <option value="6" :selected="value == '6'">
            {{ $gettext('Samstag') }}
        </option>
        <option value="7" :selected="value == '7'">
            {{ $gettext('Sonntag') }}
        </option>
    </select>
</template>

<script>
export default {
    name: "day-of-week-select",
    emits: ['selected_value'],
    props: {
        name: {
            type: String,
            required: true
        },
        value: {
            type: String,
            required: false
        },
        with_indeterminate: {
            type: Boolean,
            required: false,
            default: false,
        }
    },
    data () {
        return {
            selected_value: this.value
        };
    },
    watch: {
        selected_value(new_value) {
            this.$emit('selected_value', new_value);
        }
    }
}
</script>