Last change
on this file since 2b0a4db was 2b0a4db, checked in by Gjoko Kostadinov <gjoko.kostadinov@…>, 20 months ago |
Fix page layout and js bugs.
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[a436340] | 1 | $(document).ready(function() {
|
---|
| 2 | var enumerations = {};
|
---|
| 3 | $.ajax({
|
---|
| 4 | url: "http://localhost:8080/api/nomenclatures/businessTypes"
|
---|
| 5 | }).then(function(data) {
|
---|
| 6 | enumerations = data;
|
---|
| 7 | var $el = $("#companyType");
|
---|
| 8 | //$el.empty(); // remove old options
|
---|
| 9 |
|
---|
| 10 | $.each(data, function(index, obj) {
|
---|
[2b0a4db] | 11 | $el.append("<option value=" + obj.value + ">" + obj.text + "</option>");
|
---|
[a436340] | 12 | });
|
---|
| 13 | });
|
---|
| 14 |
|
---|
| 15 | $("#companyType").change(function() {
|
---|
| 16 | var selectedVal = $(this).find(':selected').val();
|
---|
| 17 | alert(JSON.stringify(enumerations[selectedVal-1]));
|
---|
[2b0a4db] | 18 | var selectedObj = enumerations[selectedVal-1];
|
---|
| 19 | var $el = $("#predefined_services");
|
---|
| 20 | $el.empty();
|
---|
| 21 | $.each(selectedObj['serviceTypes'], function (index, obj) {
|
---|
| 22 | $el.append(
|
---|
| 23 | '<div class="form-check">\n' +
|
---|
| 24 | ' <input class="form-check-input" type="checkbox" value=\"' + obj.id + '\" id=\"'+ obj.id +'\">\n' +
|
---|
| 25 | ' <label class="form-check-label" for=\"' + obj.id + '\">\n' +
|
---|
| 26 | obj.name +
|
---|
| 27 | ' </label>\n' +
|
---|
| 28 | ' </div>')
|
---|
| 29 | });
|
---|
[a436340] | 30 | })
|
---|
[2b0a4db] | 31 | }); |
---|
Note:
See
TracBrowser
for help on using the repository browser.