|
Lines 1-22
Link Here
|
| 1 |
$(document).ready(function() { |
1 |
$(document).ready(function() { |
| 2 |
$("#desk_id").children().each(function() { |
|
|
| 3 |
var selectedBranch = $("#branch"). children("option:selected"). val(); |
| 4 |
if ($(this).attr('id') === "nodesk") { //set no desk by default, should be first element |
| 5 |
$(this).prop("selected", true); |
| 6 |
$(this).prop("disabled", false); |
| 7 |
$(this).show(); |
| 8 |
} |
| 9 |
else if ($(this).hasClass(selectedBranch)) { |
| 10 |
$('#nodesk').prop("disabled", true); // we have desk, no need for nodesk option |
| 11 |
$('#nodesk').hide(); |
| 12 |
$(this).prop("disabled", false); |
| 13 |
$(this).show(); |
| 14 |
$(this).prop("selected", true) |
| 15 |
} else { |
| 16 |
$(this).prop("disabled", true); |
| 17 |
$(this).hide(); |
| 18 |
} |
| 19 |
}); |
| 20 |
|
2 |
|
| 21 |
$("#branch").on("change", function() { |
3 |
$("#branch").on("change", function() { |
| 22 |
|
4 |
|
|
Lines 32-42
$(document).ready(function() {
Link Here
|
| 32 |
$('#nodesk').hide(); |
14 |
$('#nodesk').hide(); |
| 33 |
$(this).prop("disabled", false); |
15 |
$(this).prop("disabled", false); |
| 34 |
$(this).show(); |
16 |
$(this).show(); |
| 35 |
$(this).prop("selected", true) |
17 |
if ( selectedBranch == $(".logged-in-branch-code").html() ) { |
|
|
18 |
$("#desk_id").val($(".logged-in-desk-id").html()); |
| 19 |
} |
| 20 |
else { |
| 21 |
$("#desk_id").val($("#desk_id option:not([disabled]):first").val()); |
| 22 |
} |
| 36 |
} else { |
23 |
} else { |
| 37 |
$(this).prop("disabled", true); |
24 |
$(this).prop("disabled", true); |
| 38 |
$(this).hide(); |
25 |
$(this).hide(); |
| 39 |
} |
26 |
} |
| 40 |
}); |
27 |
}); |
| 41 |
}); |
28 |
}); |
| 42 |
}) ; |
29 |
}); |
| 43 |
- |
|
|