|
1 | | -@using JoinRpg.CommonUI.Models |
2 | 1 | @using JoinRpg.Helpers |
3 | | -@using JoinRpg.Web.Helpers |
4 | 2 | @using JoinRpg.Web.Models |
5 | 3 | @model PaymentViewModel |
6 | 4 |
|
|
45 | 43 | <label for="@Html.IdFor(m => m.Money)" class="col-md-4 control-label">Сумма к оплате:</label> |
46 | 44 | <div class="col-md-8"> |
47 | 45 | <div> |
48 | | - @Html.EditorFor(m => m.Money, new {htmlAttributes = new {@class = "form-control", style = "display: inline-block; max-width: 150px", min="1", max="100000"}}) |
| 46 | + @Html.EditorFor(m => m.Money, new {htmlAttributes = new {@class = "form-control", onchange = "changeHandler()", style = "display: inline-block; max-width: 150px", min="1", max="100000"}}) |
49 | 47 | ₽ |
50 | 48 | </div> |
51 | 49 | @Html.ValidationMessageFor(m => m.Money, "", new {@class = "text-danger"}) |
|
61 | 59 |
|
62 | 60 | <div class="form-group"> |
63 | 61 | <div class="col-md-12"> |
64 | | - @Html.CheckBoxFor(m => m.AcceptContract, new { onchange = "dlgPayContractChange()" }) |
| 62 | + @Html.CheckBoxFor(m => m.AcceptContract, new { onchange = "changeHandler()" }) |
65 | 63 | <label for="@Html.IdFor(m => m.AcceptContract)">Я прочитал(а), понял(а) и принимаю условия @Html.ActionLink("оферты", "user-agreement", "OnlinePayments")</label> |
66 | 64 | </div> |
67 | 65 | </div> |
68 | 66 | </div> |
69 | 67 | </div> |
70 | 68 | <div class="modal-footer" style="display: flex; flex-direction: row; align-items: center;"> |
71 | 69 | <button type="button" class="btn btn-default" style="margin-right: auto;" data-dismiss="modal">Отмена</button> |
72 | | - <div style="display: flex; flex-direction: column; align-items: flex-end;"> |
| 70 | + <div> |
73 | 71 | <button type="submit" id="dlgPayOnline1Submit" disabled name="@Html.NameFor(m => m.Method)" value="@PaymentMethodViewModel.BankCard" class="btn btn-success" style="font-size: larger;" title="@PaymentMethodViewModel.BankCard.GetDescription()">@PaymentMethodViewModel.BankCard.GetDisplayName()</button> |
74 | | - <button type="submit" id="dlgPayOnline2Submit" disabled name="@Html.NameFor(m => m.Method)" value="@PaymentMethodViewModel.FastPaymentsSystem" class="btn btn-secondary" style="font-size: larger; margin-top: 0.5em" title="@PaymentMethodViewModel.FastPaymentsSystem.GetDescription()">@PaymentMethodViewModel.FastPaymentsSystem.GetDisplayName()</button> |
| 72 | + <button type="submit" id="dlgPayOnline2Submit" disabled name="@Html.NameFor(m => m.Method)" value="@PaymentMethodViewModel.FastPaymentsSystem" class="btn btn-secondary" style="font-size: larger; margin-left: 0.5em;" title="@PaymentMethodViewModel.FastPaymentsSystem.GetDescription()">@PaymentMethodViewModel.FastPaymentsSystem.GetDisplayName()</button> |
75 | 73 | </div> |
76 | 74 | </div> |
77 | 75 | } |
|
80 | 78 | </div> |
81 | 79 |
|
82 | 80 | <script type="text/javascript" defer> |
83 | | - function dlgPayContractChange() |
84 | | - { |
85 | | - const edMoney = document.getElementById('@Html.IdFor(m => m.Money)'); |
86 | | - const checkBox = document.getElementById('@Html.IdFor(m => m.AcceptContract)'); |
87 | | - const submitBtn1 = document.getElementById('dlgPayOnline1Submit'); |
88 | | - const submitBtn2 = document.getElementById('dlgPayOnline2Submit'); |
89 | | - const money = parseInt(edMoney.value); |
90 | | - if (money >= 1 && money <= 100000 && checkBox.checked) { |
91 | | - submitBtn1.removeAttribute('disabled'); |
92 | | - submitBtn2.removeAttribute('disabled'); |
93 | | - } else { |
94 | | - submitBtn1.setAttribute('disabled', ''); |
95 | | - submitBtn2.setAttribute('disabled', ''); |
96 | | - } |
97 | | - } |
| 81 | +function changeHandler() |
| 82 | +{ |
| 83 | + const edMoney = document.getElementById('@Html.IdFor(m => m.Money)'); |
| 84 | + const checkBox = document.getElementById('@Html.IdFor(m => m.AcceptContract)'); |
| 85 | + const submitBtn1 = document.getElementById('dlgPayOnline1Submit'); |
| 86 | + const submitBtn2 = document.getElementById('dlgPayOnline2Submit'); |
| 87 | + const money = parseInt(edMoney.value); |
| 88 | + if (money >= 1 && money <= 100000 && checkBox.checked) { |
| 89 | + submitBtn1.removeAttribute('disabled'); |
| 90 | + submitBtn2.removeAttribute('disabled'); |
| 91 | + } else { |
| 92 | + submitBtn1.setAttribute('disabled', ''); |
| 93 | + submitBtn2.setAttribute('disabled', ''); |
| 94 | + } |
| 95 | +} |
98 | 96 | </script> |
0 commit comments