Checkin: Allow to use presence state in rules (#4061)

This commit is contained in:
Raphael Michel
2024-04-18 13:15:31 +02:00
committed by GitHub
parent f09f07ec7c
commit b2842ec3a0
7 changed files with 102 additions and 3 deletions

View File

@@ -56,6 +56,11 @@
<lookup-select2 required v-if="vartype === 'gate' && operator === 'inList'" :multiple="true"
:value="rightoperand" v-on:input="setRightOperandGateList"
:url="gateSelectURL"></lookup-select2>
<select required v-if="vartype === 'enum_entry_status' && operator === '=='"
:value="rightoperand" v-on:input="setRightOperandEnum" class="form-control">
<option value="absent">{{ texts.status_absent }}</option>
<option value="present">{{ texts.status_present }}</option>
</select>
<div class="checkin-rule-childrules" v-if="operator === 'or' || operator === 'and'">
<div v-for="(op, opi) in operands">
<checkin-rule :rule="op" :index="opi" :level="level + 1" v-if="typeof op === 'object'"></checkin-rule>
@@ -312,6 +317,13 @@
this.$set(this.rule[this.operator], 1, products);
}
},
setRightOperandEnum: function (event) {
if (this.rule[this.operator].length === 1) {
this.rule[this.operator].push(event.target.value);
} else {
this.$set(this.rule[this.operator], 1, event.target.value);
}
},
addOperand: function () {
this.rule[this.operator].push({"": []});
},

View File

@@ -75,6 +75,17 @@
{{ rightoperand.objectList.map((o) => o.lookup[2]).join(", ") }}
</strong>
</span>
<span v-else-if="vardata && vardata.type === 'enum_entry_status'">
<span class="fa fa-check-circle-o"></span>
{{ vardata.label }}
<span v-if="varresult !== null">
({{varresult}})
</span>
<br>
<strong>
{{ op.label }} {{ rightoperand }}
</strong>
</span>
</div>
</foreignObject>