Add ak constraints

This commit is contained in:
Lars Westermann 2019-06-08 22:35:20 +02:00
parent 743e57395a
commit 70e1c2ec26
Signed by: lars.westermann
GPG key ID: 9D417FA5BB9D5E1D
12 changed files with 336 additions and 86 deletions

View file

@ -51,6 +51,44 @@ fun initWorkGroupConstraints() {
}.html)
}
}
addList.textView("Add not on day") {
onClick {
constraints.appendChild(View.wrap(createHtmlView<HTMLDivElement>()) {
classList += "input-group"
html.appendChild(TextView("Not day").apply {
classList += "form-btn"
onClick { this@wrap.html.remove() }
}.html)
html.appendChild(InputView(InputType.NUMBER).apply {
classList += "form-control"
html.name = "constraint-not-on-day-${index++}"
min = -1337.0
max = 1337.0
}.html)
}.html)
}
}
addList.textView("Add only before time") {
onClick {
constraints.appendChild(View.wrap(createHtmlView<HTMLDivElement>()) {
classList += "input-group"
html.appendChild(TextView("Before time").apply {
classList += "form-btn"
onClick { this@wrap.html.remove() }
}.html)
html.appendChild(InputView(InputType.TEXT).apply {
classList += "form-control"
html.name = "constraint-only-before-time-day-${index++}"
}.html)
html.appendChild(InputView(InputType.NUMBER).apply {
classList += "form-control"
html.name = "constraint-only-before-time-${index++}"
min = -1337.0
max = 133700.0
}.html)
}.html)
}
}
addList.textView("Add only after time") {
onClick {
constraints.appendChild(View.wrap(createHtmlView<HTMLDivElement>()) {
@ -59,6 +97,10 @@ fun initWorkGroupConstraints() {
classList += "form-btn"
onClick { this@wrap.html.remove() }
}.html)
html.appendChild(InputView(InputType.TEXT).apply {
classList += "form-control"
html.name = "constraint-only-after-time-day-${index++}"
}.html)
html.appendChild(InputView(InputType.NUMBER).apply {
classList += "form-control"
html.name = "constraint-only-after-time-${index++}"
@ -125,7 +167,6 @@ fun initWorkGroupConstraints() {
}
}
console.log(constraints)
for (child in constraints.children.iterator()) {
console.log(child)
if (child.classList.contains("input-group")) {

View file

@ -15,7 +15,7 @@ import org.w3c.dom.get
class WorkGroupTableLine(view: HTMLElement) : TableLine(view) {
var lineId = dataset["id"]?.toLongOrNull() ?: -1
private var lineId = dataset["id"]?.toLongOrNull() ?: -1
private val workGroup =
RepositoryDelegate(WorkGroupRepository, lineId)

View file

@ -12,6 +12,7 @@
margin: 1px;
transition: border-color $transitionTime;
color: var(--text-primary-color);
min-width: 0;
&:focus {
border-color: var(--primary-color);
@ -41,6 +42,16 @@ select:-moz-focusring {
padding-bottom: 0.3rem;
padding-left: 0.2rem;
}
&:after {
content: attr(data-hint);
position: absolute;
left: 100%;
color: var(--text-secondary-color);
line-height: 2.5rem;
margin-left: 1rem;
width: 100%;
}
}
.form-switch {
@ -177,7 +188,7 @@ form {
& > * {
margin-right: 0;
flex-grow: 1;
flex-shrink: 1;
flex-basis: 0;
&:not(:first-child) {
border-top-left-radius: 0;

View file

@ -90,7 +90,9 @@
margin-bottom: 0.5rem;
span {
width: 4rem;
width: 8rem;
flex-basis: 8rem;
flex-grow: 0;
position: relative;
text-align: center;
overflow: hidden;