Disable future/past values only for datetime in record list filter

This commit is contained in:
Jože Fortun
2023-03-20 11:50:14 +01:00
parent 6f5bb2ebd5
commit 09a036bff5
3 changed files with 46 additions and 39 deletions
@@ -327,6 +327,13 @@ export default {
...[...module.fields].map(f => {
f.multi = f.isMulti
f.isMulti = false
// Disable edge case options
if (f.kind === 'DateTime') {
f.options.onlyFutureValues = false
f.options.onlyPastValues = false
}
return f
}),
...this.module.systemFields().map(sf => {
@@ -1,60 +1,60 @@
<template>
<div>
<div>
<b-form-checkbox
v-model="f.options.onlyDate"
:disabled="f.options.onlyTime"
>
{{ $t('kind.dateTime.dateOnly') }}
</b-form-checkbox>
</div>
<div>
<b-form-checkbox
v-model="f.options.onlyTime"
:disabled="f.options.onlyDate"
>
{{ $t('kind.dateTime.timeOnly') }}
</b-form-checkbox>
</div>
<div>
<b-form-checkbox
v-model="f.options.onlyDate"
:disabled="f.options.onlyTime"
>
{{ $t('kind.dateTime.dateOnly') }}
</b-form-checkbox>
<b-form-checkbox
v-model="f.options.onlyTime"
:disabled="f.options.onlyDate"
>
{{ $t('kind.dateTime.timeOnly') }}
</b-form-checkbox>
<template v-if="!f.options.onlyTime">
<b-form-checkbox
v-model="f.options.onlyPastValues"
:disabled="f.options.onlyFutureValues"
>
{{ $t('kind.dateTime.pastValuesOnly') }}
</b-form-checkbox>
</div>
<div>
<b-form-checkbox
v-model="f.options.onlyFutureValues"
:disabled="f.options.onlyPastValues"
>
{{ $t('kind.dateTime.futureValuesOnly') }}
</b-form-checkbox>
</div>
<div>
<b-form-checkbox v-model="f.options.outputRelative">
{{ $t('kind.dateTime.relativeOutput') }}
</b-form-checkbox>
</div>
<div>
{{ $t('kind.dateTime.outputFormat') }}<b-form-input
</template>
<b-form-checkbox v-model="f.options.outputRelative">
{{ $t('kind.dateTime.relativeOutput') }}
</b-form-checkbox>
<b-form-group
:label="$t('kind.dateTime.outputFormat')"
label-class="text-primary"
class="mt-2"
>
<b-form-input
v-model="f.options.format"
plain
placeholder="YYYY-MM-DD HH:ii"
/>
</div>
<i18next
path="kind.dateTime.outputFormatFootnote"
tag="label"
>
<a
href="https://momentjs.com/docs/#/displaying/format/"
target="_blank"
rel="noopener noreferrer"
>Moment.js</a>
</i18next>
<template #description>
<i18next
path="kind.dateTime.outputFormatFootnote"
tag="label"
>
<a
href="https://momentjs.com/docs/#/displaying/format/"
target="_blank"
rel="noopener noreferrer"
>Moment.js</a>
</i18next>
</template>
</b-form-group>
</div>
</template>
+1 -1
View File
@@ -14,7 +14,7 @@ kind:
dateOnly: Date Only
futureValuesOnly: Future Value Only
label: Date and time
outputFormat: 'Output format:'
outputFormat: Output format
outputFormatFootnote: See {{0}} for formatting options
pastValuesOnly: Past Values Only
relativeOutput: 'Output Relative value (eg: 3 days ago)'