<c:forEach var="tariff" items="${allTariffs}" varStatus="loop">
<c:set var="t">${tempId.add(tariff.tariffId)}</c:set>
<c:if test="${contract.tariff==tariff}">
<h3>
<div class="radio">
<label>
<input type="radio" name="optionsRadios${loopOne.index}"
id="optionsRadios${loopOne.index}"
${loop.index} value="option${loop.index}" checked disabled>
<b>${tariff.title}</b>
</label>
</div>
</h3>
</c:if>
<c:if test="${contract.tariff!=tariff}">
<h3>
<div class="radio">
<label>
<input type="radio" name="optionsRadios${loopOne.index}"
id="optionsRadios${loopOne.index}"
${loop.index} value="option${loop.index}">
<b>${tariff.title}</b>
</label>
</div>
</h3>
</c:if>
</c:forEach>
<div class="modal-footer">
<form name="test"
onclick="change(${loopOne.index},${tempId},${contract.number})">
<button type="submit" class="btn btn-success">Change</button>
</form>
<script>
function change(par1, par2, par3) {
var rad = document.getElementsByName('optionsRadios' + par1);
for (var i = 0; i < rad.length; i++) {
if (rad[i].checked) {
popBox(par2[i], par3);
}
}
function popBox(num1, num2) {
x = confirm('Are you sure? ');
if (x == true) {
var xhr = new XMLHttpRequest();
xhr.open("POST", "userChangeTariff?tariffId=" + num1 + "&contractNumber=" + num2, false);
xhr.send();
}
}
}
</script>
<div class="panel-body">
<h2>
<small>Tariff :</small>
${contract.tariff.title}
<br>
<small>Month payment :</small>
${contract.tariff.price} "RUB"
<small><br>Status :</small>
<c:if test="${contract.isBlocked() && contract.isBlockedByAdmin()}">
<font color="red">Blocked by manager</font>
</c:if>
<c:if test="${contract.isBlocked() && !contract.isBlockedByAdmin()}">
<font color="red">Blocked by user</font>
</c:if>
<c:if test="${!contract.isBlocked()}">
<font color="green">Active</font>
</c:if>
</h2>