Lines 494-508
Link Here
|
494 |
.then(resolve, reject); |
494 |
.then(resolve, reject); |
495 |
}) |
495 |
}) |
496 |
.then(function(profiles) { |
496 |
.then(function(profiles) { |
|
|
497 |
var setDefault = false; |
497 |
profiles.sort( function(a, b) { |
498 |
profiles.sort( function(a, b) { |
498 |
return a.name.localeCompare(b.name); |
499 |
return a.name.localeCompare(b.name); |
499 |
}); |
500 |
}); |
500 |
profiles.forEach(function(profile) { |
501 |
profiles.forEach(function(profile) { |
501 |
const opt = $("<option/>"); |
502 |
const opt = $("<option/>"); |
502 |
select.append(opt); |
503 |
select.append(opt); |
503 |
if(id && profile.profile_id == id) { |
504 |
if(id) { |
|
|
505 |
if(id &&profile.profile_id == id) { |
506 |
opt.prop('selected', true); |
507 |
} |
508 |
}else if (setDefault == false) { |
504 |
opt.prop('selected', true); |
509 |
opt.prop('selected', true); |
505 |
} |
510 |
} |
|
|
511 |
setDefault = true; |
506 |
opt.attr("value", profile.profile_id); |
512 |
opt.attr("value", profile.profile_id); |
507 |
opt.text(profile.name); |
513 |
opt.text(profile.name); |
508 |
opt.data("profile", profile); |
514 |
opt.data("profile", profile); |
509 |
- |
|
|