Add color to selected Rohrfarbe!

This commit is contained in:
Frank Schubert
2021-08-30 21:56:43 +02:00
parent 54b6b6b501
commit d66810de7e
3 changed files with 92 additions and 1 deletions

View File

@@ -15,6 +15,24 @@
<script type="text/javascript">
$('#wfitem_<?=$item->name?>_<?=$building->id?>').change(function() {
var color = $('#wfitem_<?=$item->name?>_<?=$building->id?> option:selected').data("bg-color");
//console.log(color);
var name = $('#wfitem_<?=$item->name?>_<?=$building->id?> option:selected').val();
$("wfitem_<?=$item->name?>_<?=$building->id?>").data("style", "btn-danger");
console.log("button [data-id='wfitem_<?=$item->name?>_<?=$building->id?>']");
console.log($("button [data-id='wfitem_<?=$item->name?>_<?=$building->id?>']"));
var matches;
if(matches = name.match(/^(.+)-1R$/)) {
name = matches[1];
}
$("[data-id='wfitem_<?=$item->name?>_<?=$building->id?>']").removeClass(function (index, className) {
console.log(className);
return (className.match (/(^|\s)btn-outline-\S+/g) || []).join(' ');
});
$("[data-id='wfitem_<?=$item->name?>_<?=$building->id?>']").addClass("btn-outline-" + name)
console.log(color);
console.log(name);
});
</script>