2019-11-24 13:16:24 +00:00
|
|
|
<template>
|
|
|
|
<div class="select">
|
2022-05-14 15:04:04 +00:00
|
|
|
<select
|
|
|
|
v-model="priority"
|
|
|
|
@change="updateData"
|
|
|
|
:disabled="disabled || undefined"
|
|
|
|
>
|
2021-06-23 23:24:57 +00:00
|
|
|
<option :value="priorities.UNSET">{{ $t('task.priority.unset') }}</option>
|
|
|
|
<option :value="priorities.LOW">{{ $t('task.priority.low') }}</option>
|
|
|
|
<option :value="priorities.MEDIUM">{{ $t('task.priority.medium') }}</option>
|
|
|
|
<option :value="priorities.HIGH">{{ $t('task.priority.high') }}</option>
|
|
|
|
<option :value="priorities.URGENT">{{ $t('task.priority.urgent') }}</option>
|
|
|
|
<option :value="priorities.DO_NOW">{{ $t('task.priority.doNow') }}</option>
|
2019-11-24 13:16:24 +00:00
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2022-05-14 15:04:04 +00:00
|
|
|
<script setup lang="ts">
|
|
|
|
import {ref, watch} from 'vue'
|
|
|
|
import priorities from '@/models/constants/priorities.json'
|
2019-11-24 13:16:24 +00:00
|
|
|
|
2022-05-14 15:04:04 +00:00
|
|
|
const priority = ref(0)
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
|
|
modelValue: {
|
|
|
|
default: 0,
|
|
|
|
type: Number,
|
2020-09-05 20:35:52 +00:00
|
|
|
},
|
2022-05-14 15:04:04 +00:00
|
|
|
disabled: {
|
|
|
|
default: false,
|
2020-09-05 20:35:52 +00:00
|
|
|
},
|
2022-02-15 12:07:59 +00:00
|
|
|
})
|
2022-05-14 15:04:04 +00:00
|
|
|
|
|
|
|
const emit = defineEmits(['update:modelValue', 'change'])
|
|
|
|
|
|
|
|
// FIXME: store value outside
|
|
|
|
// Set the priority to the :value every time it changes from the outside
|
|
|
|
watch(
|
|
|
|
() => props.modelValue,
|
|
|
|
(value) => {
|
|
|
|
priority.value = value
|
|
|
|
},
|
|
|
|
{immediate: true},
|
|
|
|
)
|
|
|
|
|
|
|
|
function updateData() {
|
|
|
|
emit('update:modelValue', priority.value)
|
|
|
|
emit('change')
|
|
|
|
}
|
2019-11-24 13:16:24 +00:00
|
|
|
</script>
|