2019-06-07 11:22:13 +02:00
|
|
|
<div class="cr-form-wrapper box">
|
2016-07-05 11:26:03 +02:00
|
|
|
{{#if errorMessage}}
|
|
|
|
{{#bs-alert type="warning"}}
|
|
|
|
{{t errorMessage}}
|
|
|
|
{{/bs-alert}}
|
|
|
|
{{/if}}
|
|
|
|
|
2016-06-06 00:37:26 +02:00
|
|
|
{{#bs-form
|
2018-12-29 20:35:04 +01:00
|
|
|
onSubmit=(action "submit")
|
|
|
|
formLayout="horizontal"
|
2016-06-06 00:37:26 +02:00
|
|
|
model=this
|
2016-08-20 23:41:27 +02:00
|
|
|
novalidate=true
|
2018-12-29 20:35:04 +01:00
|
|
|
as |form|
|
2016-01-20 02:52:21 +01:00
|
|
|
}}
|
2016-06-08 13:55:00 +02:00
|
|
|
<div class="days">
|
|
|
|
{{#each dates as |date index|}}
|
2016-06-08 18:42:26 +02:00
|
|
|
{{!
|
2016-08-01 21:35:06 +02:00
|
|
|
show summarized validation state for all times in a day
|
2016-06-08 18:42:26 +02:00
|
|
|
}}
|
2018-12-29 20:35:04 +01:00
|
|
|
<div
|
|
|
|
class={{if
|
|
|
|
(get daysValidationState date.day)
|
|
|
|
(concat "label-has-" (get daysValidationState date.day))
|
|
|
|
"label-has-no-validation"
|
|
|
|
}}
|
2019-01-03 00:05:21 +01:00
|
|
|
data-test-day={{date.day}}
|
2018-12-29 20:35:04 +01:00
|
|
|
>
|
2016-08-01 21:35:06 +02:00
|
|
|
{{!
|
|
|
|
show label only if it differ from label before
|
|
|
|
Nested-helpers are called first and object-at requires a positive integer
|
|
|
|
but returns undefined if an element with the passed in index does not exist.
|
|
|
|
Therefore we pass in array length if index is null. Cause index starting
|
|
|
|
by zero there can't be any element with an index === array.length.
|
|
|
|
}}
|
2018-10-28 22:54:14 +01:00
|
|
|
{{#form.element
|
2018-12-29 20:35:04 +01:00
|
|
|
classNames="option"
|
2016-08-01 21:35:06 +02:00
|
|
|
label=date.dayFormatted
|
2018-12-29 20:35:04 +01:00
|
|
|
invisibleLabel=(eq date.dayFormatted (get (object-at (if index (sub index 1) dates.length) dates) "dayFormatted"))
|
2016-08-01 21:35:06 +02:00
|
|
|
model=date
|
2018-12-29 20:35:04 +01:00
|
|
|
property="time"
|
|
|
|
as |el|
|
2016-08-01 21:35:06 +02:00
|
|
|
}}
|
|
|
|
<div class="input-group">
|
2019-06-07 11:22:13 +02:00
|
|
|
{{el.control
|
2016-08-26 00:10:22 +02:00
|
|
|
autofocus=(unless index true false)
|
2018-10-28 22:54:14 +01:00
|
|
|
id=el.id
|
2018-12-29 20:35:04 +01:00
|
|
|
placeholder="00:00"
|
|
|
|
type="time"
|
2018-10-28 22:54:14 +01:00
|
|
|
value=el.value
|
|
|
|
onChange=(action (mut el.value))
|
2016-08-01 21:35:06 +02:00
|
|
|
}}
|
2019-06-07 11:22:13 +02:00
|
|
|
<div class="input-group-append">
|
2016-08-01 21:35:06 +02:00
|
|
|
{{! disable delete button if there is only one option }}
|
2018-12-29 20:35:04 +01:00
|
|
|
{{#bs-button
|
|
|
|
onClick=(action "deleteOption" date)
|
2019-06-07 11:22:13 +02:00
|
|
|
type="link"
|
2018-12-29 20:35:04 +01:00
|
|
|
class="delete"
|
2019-06-07 11:22:13 +02:00
|
|
|
disabled=(lte dates.length 1)
|
2018-12-29 20:35:04 +01:00
|
|
|
}}
|
2019-06-07 11:22:13 +02:00
|
|
|
<span class="oi oi-trash" title={{t "create.options.button.delete.label"}} aria-hidden="true"></span>
|
2018-12-29 20:35:04 +01:00
|
|
|
<span class="sr-only">{{t "create.options.button.delete.label"}}</span>
|
|
|
|
{{/bs-button}}
|
2016-08-01 21:35:06 +02:00
|
|
|
</div>
|
2016-06-06 00:37:26 +02:00
|
|
|
</div>
|
2019-06-07 11:22:13 +02:00
|
|
|
{{#bs-button
|
|
|
|
onClick=(action "addOption" date)
|
|
|
|
type="link"
|
|
|
|
size="sm"
|
|
|
|
class="add cr-option-menu__button cr-option-menu__add-button"
|
|
|
|
}}
|
|
|
|
<span class="oi oi-plus" title={{t "create.options.button.add.label"}} aria-hidden="true"></span>
|
|
|
|
<span class="sr-only">{{t "create.options.button.add.label"}}</span>
|
|
|
|
{{/bs-button}}
|
2018-10-28 22:54:14 +01:00
|
|
|
{{/form.element}}
|
2016-08-01 21:35:06 +02:00
|
|
|
</div>
|
2016-06-08 13:55:00 +02:00
|
|
|
{{/each}}
|
|
|
|
</div>
|
2016-05-18 22:18:36 +02:00
|
|
|
|
2016-07-28 01:22:09 +02:00
|
|
|
{{#if (gt groupedDates.length 1)}}
|
2018-10-28 22:54:14 +01:00
|
|
|
{{#form.element}}
|
2018-12-29 20:35:04 +01:00
|
|
|
{{#bs-button
|
|
|
|
onClick=(action "adoptTimesOfFirstDay")
|
|
|
|
class="adopt-times-of-first-day"
|
2019-06-07 11:22:13 +02:00
|
|
|
size="sm"
|
2018-12-29 20:35:04 +01:00
|
|
|
}}
|
|
|
|
{{t "create.options-datetime.copy-first-line"}}
|
|
|
|
{{/bs-button}}
|
2018-10-28 22:54:14 +01:00
|
|
|
{{/form.element}}
|
2016-07-28 01:22:09 +02:00
|
|
|
{{/if}}
|
2016-06-06 00:37:26 +02:00
|
|
|
|
2016-09-23 19:39:31 +02:00
|
|
|
{{form-navigation-buttons
|
2018-12-29 20:35:04 +01:00
|
|
|
onPrev=(action "previousPage")
|
2016-09-23 19:39:31 +02:00
|
|
|
}}
|
2016-06-06 00:37:26 +02:00
|
|
|
{{/bs-form}}
|
2016-01-20 02:52:21 +01:00
|
|
|
</div>
|