Add check-in simulator (#3380)

This commit is contained in:
Raphael Michel
2023-06-13 14:57:24 +02:00
committed by GitHub
parent 4917249bab
commit 002416e435
15 changed files with 544 additions and 137 deletions

View File

@@ -93,13 +93,19 @@ $(function () {
},
};
Vue.component('checkin-rule', CheckinRule.default);
var app = new Vue({
el: '#rules-editor',
components: {
var components = {
CheckinRulesVisualization: CheckinRulesVisualization.default,
}
if (typeof CheckinRule !== "undefined") {
Vue.component('checkin-rule', CheckinRule.default);
components = {
CheckinRulesEditor: CheckinRulesEditor.default,
CheckinRulesVisualization: CheckinRulesVisualization.default,
},
}
}
var app = new Vue({
el: '#rules-editor',
components: components,
data: function () {
return {
rules: {},
@@ -187,17 +193,23 @@ $(function () {
},
created: function () {
this.rules = JSON.parse($("#id_rules").val());
this.items = JSON.parse($("#items").html());
if ($("#items").length) {
this.items = JSON.parse($("#items").html());
var root = this.$root
function _update() {
root.all_products = $("#id_all_products").prop("checked")
root.limit_products = $("input[name=limit_products]:checked").map(function () { return parseInt($(this).val()) }).toArray()
var root = this.$root
function _update() {
root.all_products = $("#id_all_products").prop("checked")
root.limit_products = $("input[name=limit_products]:checked").map(function () {
return parseInt($(this).val())
}).toArray()
}
$("#id_all_products, input[name=limit_products]").on("change", function () {
_update();
})
_update()
}
$("#id_all_products, input[name=limit_products]").on("change", function () {
_update();
})
_update()
},
watch: {
rules: {