View | Details | Raw Unified | Return to bug 23213
Collapse All | Expand All

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc (-29 / +31 lines)
Lines 132-169 Link Here
132
            </tr>
132
            </tr>
133
        </tfoot>
133
        </tfoot>
134
    </table>
134
    </table>
135
    [% IF ENABLE_OPAC_PAYMENTS && DISPLAY_PAYMENT_BLOCK %]
135
[% END %]
136
        <fieldset class="pay-online hidden">
136
137
            <legend>Pay selected fines and charges</legend>
137
[% IF ENABLE_OPAC_PAYMENTS && DISPLAY_PAYMENT_BLOCK %]
138
                <span class="help-block"><h3>Payment method</h3></span>
138
    <fieldset class="pay-online hidden">
139
139
        <legend>Pay selected fines and charges</legend>
140
                [% IF Koha.Preference('EnablePayPalOpacPayments') %]
140
            <span class="help-block"><h3>Payment method</h3></span>
141
                    <div class="control-group">
141
142
                        <label class="radio">
142
            [% IF Koha.Preference('EnablePayPalOpacPayments') %]
143
                            <input type="radio" name="payment_method" id="payment_method-paypal" value="paypal" checked="checked">
143
                <div class="control-group">
144
                            <!-- PayPal Logo --><a href="https://www.paypal.com/webapps/mpp/paypal-popup" title="How PayPal Works" class="paypal"><img src="https://www.paypalobjects.com/webstatic/mktg/logo/AM_SbyPP_mc_vs_dc_ae.jpg" border="0" alt="PayPal Acceptance Mark"></a><!-- PayPal Logo -->
144
                    <label class="radio">
145
                        </label>
145
                        <input type="radio" name="payment_method" id="payment_method-paypal" value="paypal" checked="checked">
146
                    </div>
146
                        <!-- PayPal Logo --><a href="https://www.paypal.com/webapps/mpp/paypal-popup" title="How PayPal Works" class="paypal"><img src="https://www.paypalobjects.com/webstatic/mktg/logo/AM_SbyPP_mc_vs_dc_ae.jpg" border="0" alt="PayPal Acceptance Mark"></a><!-- PayPal Logo -->
147
                [% END %]
147
                    </label>
148
148
                </div>
149
                [% FOREACH p IN plugins %]
149
            [% END %]
150
                    <div class="control-group">
151
                        <label class="radio">
152
                            <input type="radio" name="payment_method" id="payment_method-[% p.class | html %]" value="[% p.class | html %]" checked="checked">
153
                            [% p.get_metadata.name | html %]
154
                        </label>
155
                    </div>
156
                [% END %]
157
150
151
            [% FOREACH p IN plugins %]
158
                <div class="control-group">
152
                <div class="control-group">
159
                    <input type="hidden" id="payment-amount" name="payment_amount" value="0" />
153
                    <label class="radio">
160
                    <button id="submit-pay" type="submit" class="btn" disabled="disabled">Make payment</button>
154
                        <input type="radio" data-threshold="[% p.opac_online_payment_threshold | html %]" name="payment_method" id="payment_method-[% p.class | html %]" value="[% p.class | html %]" checked="checked">
161
                    <span id="amount-to-pay-label">
155
                        [% p.get_metadata.name | html %]
162
                        Amount to pay: <span id="amount-to-pay">0.00</span>
156
                    </label>
163
                    </span>
157
                    <small class="help-block text-muted"></small>
164
                </div>
158
                </div>
165
        </fieldset>
159
            [% END %]
166
    [% END %]
160
161
            <div class="control-group">
162
                <input type="hidden" id="payment-amount" name="payment_amount" value="0" />
163
                <button id="submit-pay" type="submit" class="btn" disabled="disabled">Make payment</button>
164
                <span id="amount-to-pay-label">
165
                    Amount to pay: <span id="amount-to-pay">0.00</span>
166
                </span>
167
            </div>
168
    </fieldset>
167
[% END %]
169
[% END %]
168
</form>
170
</form>
169
171
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt (-3 / +27 lines)
Lines 81-86 Link Here
81
<script>
81
<script>
82
$( document ).ready(function() {
82
$( document ).ready(function() {
83
83
84
    var MSG_MIN_THRESHOLD = _("Minimum amount needed by this service is %s");
85
84
    $("#finestable").dataTable($.extend(true, {}, dataTablesDefaults, {
86
    $("#finestable").dataTable($.extend(true, {}, dataTablesDefaults, {
85
        "columnDefs": [
87
        "columnDefs": [
86
             { "type": "title-string", "targets" : [ "title-string" ] }
88
             { "type": "title-string", "targets" : [ "title-string" ] }
Lines 97-105 $( document ).ready(function() { Link Here
97
99
98
    $("#amount-to-pay-label").hide();
100
    $("#amount-to-pay-label").hide();
99
101
100
    $(".checkbox-pay").change( function() {
102
    $(".checkbox-pay, input[name='payment_method']").change( function() {
101
        // Disable the pay button if no fees are selected
103
        // Disable the pay button if no fees are selected
102
        $("#submit-pay").prop("disabled", ! $(".checkbox-pay:checked").length );
104
        //$("#submit-pay").prop("disabled", ! $(".checkbox-pay:checked").length );
103
105
104
        // Calculate the total amount to be paid based on selected fees
106
        // Calculate the total amount to be paid based on selected fees
105
        var total = 0;
107
        var total = 0;
Lines 110-121 $( document ).ready(function() { Link Here
110
            }
112
            }
111
        });
113
        });
112
114
115
        var p = Promise.resolve();
113
        if ( total ) {
116
        if ( total ) {
117
            p = Promise.all(
118
                $('input[name="payment_method"]').map(function() {
119
                    var self = this;
120
                    return new Promise(function(resolve, reject) {
121
                        var threshold = $(self).data('threshold');
122
                        var help = $(self).parent().siblings('.help-block');
123
                        if(threshold == '' || threshold <= total) {
124
                            $(self).prop('disabled', false);
125
                            help.addClass('hide');
126
                        } else {
127
                            $(self).prop('disabled', true);
128
                            help.html(MSG_MIN_THRESHOLD.format(parseInt(threshold,10).toFixed(2))).removeClass('hide');
129
                        }
130
                        resolve();
131
                    })
132
                }).toArray()
133
            );
134
114
            $("#amount-to-pay").html( total.toFixed(2) );
135
            $("#amount-to-pay").html( total.toFixed(2) );
115
            $("#amount-to-pay-label").show();
136
            $("#amount-to-pay-label").show();
116
        } else {
137
        } else {
138
            $('input[name="payment_method"]').prop('disabled', false).parent().siblings('.help-block').addClass('hide');
117
            $("#amount-to-pay-label").hide();
139
            $("#amount-to-pay-label").hide();
118
        }
140
        }
141
        p.then(function() {
142
            $("#submit-pay").prop("disabled", ! $(".checkbox-pay:checked").length || ! $('input[name="payment_method"]:checked:not(:disabled)').length);
143
        })
119
    });
144
    });
120
});
145
});
121
</script>
146
</script>
122
- 

Return to bug 23213