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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt (-9 / +76 lines)
Lines 99-107 Link Here
99
<ol>
99
<ol>
100
100
101
    <li>
101
    <li>
102
        <label for="paid">Collect from patron: </label>
102
        <label for="paid">Amount paid: </label>
103
            <!-- default to paying all -->
103
        <input name="paid" id="paid" value="[% amountoutstanding | $Price %]"/>
104
        <input name="paid" id="paid" value="[% amountoutstanding | html %]"  type="text" />
104
    </li>
105
    <li>
106
        <label for="collected">Collect from patron: </label>
107
        <input id="collected" value="[% amountoutstanding | $Price %]"/>
108
    </li>
109
    <li>
110
        <label>Change to give: </label>
111
        <span id="change">0.00</span>
105
    </li>
112
    </li>
106
    [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
113
    [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
107
    [% IF payment_types %]
114
    [% IF payment_types %]
Lines 192-204 Link Here
192
            <span class="debit">[% total | format('%.2f') %]</span>
199
            <span class="debit">[% total | format('%.2f') %]</span>
193
        </li>
200
        </li>
194
    <li>
201
    <li>
202
        <label for="paid">Amount paid :</label>
203
        <input name="paid" id="paid" value="[% total | $Price %]"/>
204
    </li>
205
    <li>
195
        [% IF type == 'writeoff' %]
206
        [% IF type == 'writeoff' %]
196
            <label for="paid">Writeoff amount: </label>
207
            <label for="collected">Writeoff amount: </label>
197
        [% ELSE %]
208
        [% ELSE %]
198
            <label for="paid">Collect from patron: </label>
209
            <label for="collected">Collect from patron: </label>
199
        [% END %]
210
        [% END %]
200
        <!-- default to paying all -->
211
        <input id="collected" value="[% total | $Price %]"/>
201
        <input name="paid" id="paid" value="[% total | format('%.2f') %]" type="text" />
212
    </li>
213
    <li>
214
        <label>Change to give: </label>
215
        <span id="change">0.00</span>
202
    </li>
216
    </li>
203
    [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
217
    [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
204
    [% IF payment_types %]
218
    [% IF payment_types %]
Lines 236-249 Link Here
236
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
250
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
237
     </div> <!-- /.row -->
251
     </div> <!-- /.row -->
238
252
253
<!-- Modal -->
254
<a class="hidden" href="#confirm_change_form" data-toggle="modal"></a>
255
<div id="confirm_change_form" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
256
    <div class="modal-dialog">
257
        <div class="modal-content">
258
            <div class="modal-header">
259
                <h3>Amount collected higher than paid</h3>
260
            </div>
261
            <div class="modal-body">
262
                <p>The amount collected from the patron is higher than the amount paid.</p>
263
                <p>The change to give is <b><span id="modal_change">0.00</span></b>.</p>
264
                <p>Do you still confirm the payment?</p>
265
            </div>
266
            <div class="modal-footer">
267
                <button class="btn btn-default approve" id="modal_submit" type="button"><i class="fa fa-check"></i> Yes</button>
268
                <button class="btn btn-default deny cancel" href="#" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> No</button>
269
            </div>
270
        </div>
271
    </div>
272
</div>
273
239
[% MACRO jsinclude BLOCK %]
274
[% MACRO jsinclude BLOCK %]
240
    [% INCLUDE 'str/members-menu.inc' %]
275
    [% INCLUDE 'str/members-menu.inc' %]
241
    [% Asset.js("js/members-menu.js") | $raw %]
276
    [% Asset.js("js/members-menu.js") | $raw %]
242
    <script>
277
    <script>
243
        $(document).ready(function() {
278
        $(document).ready(function() {
279
            var forms = $('#payindivfine, #payfine');
280
            var change = $('#change')[0];
281
244
            $('#payindivfine, #payfine').preventDoubleFormSubmit();
282
            $('#payindivfine, #payfine').preventDoubleFormSubmit();
245
            $("#paid").on("change",function(){
283
            $("#paid, #collected").on("change",function() {
246
                moneyFormat( this );
284
                moneyFormat( this );
285
                if (change != undefined) {
286
                    updateChangeValues();
287
                }
288
            });
289
290
            if (change != undefined) {
291
                forms.bind('submit', function(e) {
292
                    if (change.innerHTML > 0.00) {
293
                        e.preventDefault();
294
                        $('a[href="#confirm_change_form"]').click();
295
                    }
296
                });
297
            }
298
299
            $('#modal_submit').click(function() {
300
                forms[0].submit();
247
            });
301
            });
248
        });
302
        });
249
303
Lines 313-318 Link Here
313
367
314
            textObj.value = dolAmount + "." + decAmount;
368
            textObj.value = dolAmount + "." + decAmount;
315
        }
369
        }
370
371
        function updateChangeValues() {
372
            var change = $('#change')[0];
373
            change.innerHTML = Math.round(($('#collected')[0].value - $('#paid')[0].value) * 100) / 100;
374
            if (change.innerHTML <= 0) {
375
                change.innerHTML = "0.00";
376
            } else {
377
                change.value = change.innerHTML;
378
                moneyFormat(change);
379
                change.innerHTML = change.value;
380
            }
381
382
            $('#modal_change').html(change.innerHTML);
383
        }
316
    </script>
384
    </script>
317
[% END %]
385
[% END %]
318
386
319
- 

Return to bug 11373