|
42 | 42 | </template> |
43 | 43 | </NcActionInput> |
44 | 44 | </template> |
| 45 | + <template v-if="answerType.pickerType === 'time'" #actions> |
| 46 | + <NcActionCheckbox v-model="timeRange"> |
| 47 | + {{ t('forms', 'Use time range') }} |
| 48 | + </NcActionCheckbox> |
| 49 | + <NcActionInput |
| 50 | + v-model="timeMin" |
| 51 | + type="time" |
| 52 | + :label="t('forms', 'Earliest time')" |
| 53 | + hide-label |
| 54 | + :formatter="formatter" |
| 55 | + is-native-picker |
| 56 | + :max="timeMax"> |
| 57 | + <template #icon> |
| 58 | + <NcIconSvgWrapper |
| 59 | + :svg="svgClockArrowUpIcon" |
| 60 | + :name="t('forms', 'Earliest time')" /> |
| 61 | + </template> |
| 62 | + </NcActionInput> |
| 63 | + <NcActionInput |
| 64 | + v-model="timeMax" |
| 65 | + type="time" |
| 66 | + :label="t('forms', 'Latest time')" |
| 67 | + hide-label |
| 68 | + :formatter="formatter" |
| 69 | + is-native-picker |
| 70 | + :min="timeMin"> |
| 71 | + <template #icon> |
| 72 | + <NcIconSvgWrapper |
| 73 | + :svg="svgClockArrowDownIcon" |
| 74 | + :name="t('forms', 'Latest time')" /> |
| 75 | + </template> |
| 76 | + </NcActionInput> |
| 77 | + </template> |
45 | 78 | <div class="question__content"> |
46 | 79 | <NcDateTimePicker |
47 | 80 | :value="time" |
|
60 | 93 | </template> |
61 | 94 |
|
62 | 95 | <script> |
| 96 | +import svgClockArrowDownIcon from '../../../img/clock_arrow_down.svg?raw' |
| 97 | +import svgClockArrowUpIcon from '../../../img/clock_arrow_up.svg?raw' |
63 | 98 | import svgEventIcon from '../../../img/event.svg?raw' |
64 | 99 | import svgTodayIcon from '../../../img/today.svg?raw' |
65 | 100 |
|
@@ -92,6 +127,8 @@ export default { |
92 | 127 | stringify: this.stringifyDate, |
93 | 128 | parse: this.parseTimestampToDate, |
94 | 129 | }, |
| 130 | + svgClockArrowDownIcon, |
| 131 | + svgClockArrowUpIcon, |
95 | 132 | svgEventIcon, |
96 | 133 | svgTodayIcon, |
97 | 134 | } |
@@ -170,6 +207,53 @@ export default { |
170 | 207 | this.onExtraSettingsChange({ dateRange: value === true ?? null }) |
171 | 208 | }, |
172 | 209 | }, |
| 210 | +
|
| 211 | + /** |
| 212 | + * The maximum allowable time for the time input field |
| 213 | + */ |
| 214 | + timeMax: { |
| 215 | + get() { |
| 216 | + return this.extraSettings?.timeMax |
| 217 | + ? moment(this.extraSettings.timeMax, [ |
| 218 | + this.answerType.momentFormat, |
| 219 | + this.answerType.storageFormat, |
| 220 | + ]).toDate() |
| 221 | + : null |
| 222 | + }, |
| 223 | + set(value) { |
| 224 | + this.onExtraSettingsChange({ |
| 225 | + timeMax: this.stringify(value), |
| 226 | + }) |
| 227 | + }, |
| 228 | + }, |
| 229 | +
|
| 230 | + /** |
| 231 | + * The minimum allowable date for the date input field |
| 232 | + */ |
| 233 | + timeMin: { |
| 234 | + get() { |
| 235 | + return this.extraSettings?.timeMin |
| 236 | + ? moment(this.extraSettings.timeMin, [ |
| 237 | + this.answerType.momentFormat, |
| 238 | + this.answerType.storageFormat, |
| 239 | + ]).toDate() |
| 240 | + : null |
| 241 | + }, |
| 242 | + set(value) { |
| 243 | + this.onExtraSettingsChange({ |
| 244 | + timeMin: this.stringify(value), |
| 245 | + }) |
| 246 | + }, |
| 247 | + }, |
| 248 | +
|
| 249 | + timeRange: { |
| 250 | + get() { |
| 251 | + return this.extraSettings?.timeRange ?? false |
| 252 | + }, |
| 253 | + set(value) { |
| 254 | + this.onExtraSettingsChange({ timeRange: value === true ?? null }) |
| 255 | + }, |
| 256 | + }, |
173 | 257 | }, |
174 | 258 |
|
175 | 259 | methods: { |
|
0 commit comments