Fix #782 -- Select2 widget for item selection for vouchers

This commit is contained in:
Raphael Michel
2018-04-03 12:10:34 +02:00
parent 7ec5adb6b4
commit bb10d25561
6 changed files with 163 additions and 36 deletions

View File

@@ -281,7 +281,23 @@ var form_handlers = function (el) {
page: params.page || 1
}
}
}
},
templateResult: function (res) {
if (!res.id) {
return res.text;
}
var $ret = $("<span>").append(
$("<span>").addClass("primary").append($("<div>").text(res.text).html())
);
if (res.event) {
$ret.append(
$("<span>").addClass("secondary").append(
$("<span>").addClass("fa fa-calendar fa-fw")
).append(" ").append($("<div>").text(res.event).html())
);
}
return $ret;
},
}).on("select2:select", function () {
// Allow continuing to select
if ($s.hasAttribute("multiple")) {