PageSourceSearch

https://www.borderstates.com/_ui/responsive/common/js/acc.invoiceMakePaymentList.js

js borderstates.com collected 2026-10-03 21:44:13 UTC 15,486 bytes, 339 lines download raw bytes

1ACC.invoiceMakePaymentList= {
2    _autoload: [
3        "bindAdvancedSearchModalCurrentPayment",
4        "initSelectedInvoiceCount",
5        "selectInvoiceListItemsDesktop",
6        "selectInvoiceListItemsMobile",
7        "totalScrollerDisplay",
8        "submitInvoicesForm"
9    ],
10
11    bindAdvancedSearchModalCurrentPayment: function () {
12        $('.bse-advanced-search-btn-payment').on('click touchstart', function (e) {
13            e.preventDefault();
14            $.colorbox({
15                href: "#filterModal",
16                maxWidth: "100%",
17                width: "80%",
18                opacity: 0.9,
19                inline: true,
20                close: '<span class="glyphicon glyphicon-remove"></span>',
21                onOpen: function () {
22                    $('#filterModal').fadeIn();
23                },
24                onComplete: function () {
25                    $("#cboxTitle").hide();
26                    $("#invoiceModalToDate").datepicker();
27                    $("#invoiceModalFromDate").datepicker();
28                    $("#cboxLoadedContent").css("margin-top", "0");
29
30                },
31                onCleanup: function () {
32                    $('#filterModal').hide();
33                }
34            });
35        })
36    },
37
38    initSelectedInvoiceCount: function () {
39        $(".bse-make-payment-selected-total").text(ACC.invoiceMakePayment.currencyFormatter.format($("#selectedInvoiceTotal").val()));
40
41        $(".bse-make-payment-selected-invoices").text($("#selectedInvoiceCount").val());
42        if ($('.js-checkbox-select-invoice:checked').length == $('.js-checkbox-select-invoice').length) {
43            $('.js-all-invoice-selection').prop('checked', true);
44        };
45        var invoiceCount = parseInt($("#selectedInvoiceCount").val());
46        if (invoiceCount > 0 ){
47            ACC.invoiceMakePaymentList.toggleMakePaymentButtonActivation(1);
48
49        }
50        $('.js-checkbox-select-invoice:checkbox:checked').each(function () {
51          ACC.invoiceMakePaymentList.validateCheckBoxValues($(this));
52        });
53
54    },
55
56    selectInvoiceListItemsDesktop: function () {
57        $('.js-bse-select-all-invoices').on('click', function () {
58            var listOfInvoices = []
59            invoiceCount = parseInt($("#selectedInvoiceCount").val());
60            invoiceTotal = parseFloat($("#selectedInvoiceTotal").val());
61            if (this.checked) {
62                $('.js-checkbox-select-invoice:checkbox:not(:checked)').each(function () {
63                    ACC.invoiceMakePaymentList.validateCheckBoxValues($(this));
64                    listOfInvoices.push($(this).data("invoice-selected"));
65                    invoiceAmount = parseFloat($(this).data("invoice-total"));
66                    invoiceTotal = invoiceTotal + invoiceAmount;
67                    invoiceCount = invoiceCount + 1;
68                });
69                ACC.invoiceMakePaymentList.addInvoice(listOfInvoices.toString(), invoiceTotal)
70
71            } else {
72                $('.js-all-invoice-selection').prop('checked', false);
73                $('.js-checkbox-select-invoice').each(function () {
74                    listOfInvoices.push($(this).data("invoice-selected"))
75                    invoiceAmount = parseFloat($(this).data("invoice-total"));
76                    invoiceTotal = invoiceTotal - invoiceAmount;
77                    invoiceCount = invoiceCount - 1;
78                    ACC.invoiceMakePaymentList.removeCheckBoxValues($(this));
79                  });
80                ACC.invoiceMakePaymentList.removeInvoice(listOfInvoices.toString(), invoiceTotal)
81            }
82            ACC.invoiceMakePaymentList.toggleMakePaymentButtonActivation(invoiceCount);
83            $(".bse-make-payment-selected-invoices").text(invoiceCount);
84            $("#selectedInvoiceCount").val(invoiceCount)
85            $(".bse-make-payment-selected-total").text(ACC.invoiceMakePayment.currencyFormatter.format(invoiceTotal));
86            $("#selectedInvoiceTotal").val(invoiceTotal)
87
88        });
89
90        $('.js-checkbox-select-invoice').on('click', function () {
91
92            invoiceCount = parseInt($("#selectedInvoiceCount").val());
93            invoiceTotal = parseFloat($("#selectedInvoiceTotal").val());
94            if ($('.js-checkbox-select-invoice:checked').length == $('.js-checkbox-select-invoice').length) {
95                $('.js-all-invoice-selection').prop('checked', true);
96                invoiceCount = invoiceCount + 1;
97                invoiceAmount = parseFloat($(this).data("invoice-total"));
98                invoiceTotal = invoiceTotal + invoiceAmount;
99                ACC.invoiceMakePaymentList.addInvoice($(this).data("invoice-selected"), invoiceTotal)
100                ACC.invoiceMakePaymentList.validateCheckBoxValues($(this));
101            } else {
102
103                if (this.checked) {
104                    invoiceCount = invoiceCount + 1;
105                    invoiceAmount = parseFloat($(this).data("invoice-total"));
106                    invoiceTotal = invoiceTotal + invoiceAmount;
107                    serviceResult = ACC.invoiceMakePaymentList.addInvoice($(this).data("invoice-selected"), invoiceTotal)
108                    ACC.invoiceMakePaymentList.validateCheckBoxValues($(this));
109
110                } else {
111                    invoiceCount = invoiceCount - 1;
112                    invoiceAmount = parseFloat($(this).data("invoice-total"));
113                    invoiceTotal = invoiceTotal - invoiceAmount;
114                    serviceResult = ACC.invoiceMakePaymentList.removeInvoice($(this).data("invoice-selected"), invoiceTotal)
115                    ACC.invoiceMakePaymentList.removeCheckBoxValues($(this));
116                }
117
118                $('.js-all-invoice-selection').prop('checked', false);
119
120            }
121
122            ACC.invoiceMakePaymentList.toggleMakePaymentButtonActivation(invoiceCount);
123            $(".bse-make-payment-selected-invoices").text(invoiceCount);
124            $("#selectedInvoiceCount").val(invoiceCount)
125
126            $(".bse-make-payment-selected-total").text(ACC.invoiceMakePayment.currencyFormatter.format(invoiceTotal));
127            $("#selectedInvoiceTotal").val(invoiceTotal)
128
129        });
130
131        $('.bse-button-clear-list').on('click', function () {
132            ACC.invoiceMakePaymentList.clearAllInvoice();
133
134            ACC.invoiceMakePaymentList.toggleMakePaymentButtonActivation(0);
135            $(".bse-make-payment-selected-invoices").text(0);
136            $("#selectedInvoiceCount").val(0);
137
138            $(".bse-make-payment-selected-total").text(ACC.invoiceMakePayment.currencyFormatter.format(0));
139            $("#selectedInvoiceTotal").val(0);
140            $('.js-all-invoice-selection').prop('checked', false);
141            $('.js-checkbox-select-invoice').each(function () {
142                ACC.invoiceMakePaymentList.removeCheckBoxValues($(this));
143
144            });
145        });
146    },
147
148    selectInvoiceListItemsMobile: function () {
149        $('.js-bse-select-all-mobile-invoices').on('click', function () {
150            var listOfInvoices = []
151            invoiceCount = parseInt($("#selectedInvoiceCount").val());
152            invoiceTotal = parseFloat($("#selectedInvoiceTotal").val());
153            if (this.checked) {
154                $('.js-checkbox-select-invoice-mobile:checkbox:not(:checked)').each(function () {
155                    ACC.invoiceMakePaymentList.validateCheckBoxValues($(this));
156                    listOfInvoices.push($(this).data("invoice-selected"));
157                    invoiceAmount = parseFloat($(this).data("invoice-total"));
158                    invoiceTotal = invoiceTotal + invoiceAmount;
159                    invoiceCount = invoiceCount + 1;
160                });
161                ACC.invoiceMakePaymentList.addInvoice(listOfInvoices.toString(), invoiceTotal)
162
163            } else {
164                $('.js-all-invoice-selection').prop('checked', false);
165                $('.js-checkbox-select-invoice-mobile').each(function () {
166                    listOfInvoices.push($(this).data("invoice-selected"))
167                    invoiceAmount = parseFloat($(this).data("invoice-total"));
168                    invoiceTotal = invoiceTotal - invoiceAmount;
169                    invoiceCount = invoiceCount - 1;
170                    ACC.invoiceMakePaymentList.removeCheckBoxValues($(this));
171                });
172                ACC.invoiceMakePaymentList.removeInvoice(listOfInvoices.toString(), invoiceTotal)
173            }
174            ACC.invoiceMakePaymentList.toggleMakePaymentButtonActivation(invoiceCount);
175            $(".bse-make-payment-selected-invoices").text(invoiceCount);
176            $("#selectedInvoiceCount").val(invoiceCount)
177            $(".bse-make-payment-selected-total").text(ACC.invoiceMakePayment.currencyFormatter.format(invoiceTotal));
178            $("#selectedInvoiceTotal").val(invoiceTotal)
179
180        });
181
182        $('.js-checkbox-select-invoice-mobile').on('click', function () {
183            invoiceCount = parseInt($("#selectedInvoiceCount").val());
184            invoiceTotal = parseFloat($("#selectedInvoiceTotal").val());
185            if ($('.js-checkbox-select-invoice-mobile:checked').length == $('.js-checkbox-select-invoice').length) {
186                $('.js-all-invoice-selection').prop('checked', true);
187                invoiceCount = invoiceCount + 1;
188                invoiceAmount = parseFloat($(this).data("invoice-total"));
189                invoiceTotal = invoiceTotal + invoiceAmount;
190                ACC.invoiceMakePaymentList.addInvoice($(this).data("invoice-selected"), invoiceTotal)
191                ACC.invoiceMakePaymentList.validateCheckBoxValues($(this));
192            } else {
193
194                if (this.checked) {
195                    invoiceCount = invoiceCount + 1;
196                    invoiceAmount = parseFloat($(this).data("invoice-total"));
197                    invoiceTotal = invoiceTotal + invoiceAmount;
198                    serviceResult = ACC.invoiceMakePaymentList.addInvoice($(this).data("invoice-selected"), invoiceTotal)
199                    ACC.invoiceMakePaymentList.validateCheckBoxValues($(this));
200
201                } else {
202                    invoiceCount = invoiceCount - 1;
203                    invoiceAmount = parseFloat($(this).data("invoice-total"));
204                    invoiceTotal = invoiceTotal - invoiceAmount;
205                    serviceResult = ACC.invoiceMakePaymentList.removeInvoice($(this).data("invoice-selected"), invoiceTotal)
206                    ACC.invoiceMakePaymentList.removeCheckBoxValues($(this));
207                }
208
209                $('.js-all-invoice-selection').prop('checked', false);
210
211            }
212
213            ACC.invoiceMakePaymentList.toggleMakePaymentButtonActivation(invoiceCount);
214            $(".bse-make-payment-selected-invoices").text(invoiceCount);
215            $("#selectedInvoiceCount").val(invoiceCount)
216
217            $(".bse-make-payment-selected-total").text(ACC.invoiceMakePayment.currencyFormatter.format(invoiceTotal));
218            $("#selectedInvoiceTotal").val(invoiceTotal)
219        });
220
221    },
222    
223    validateCheckBoxValues: function (selector) {
224        $('[data-invoice-selected='.concat($(selector).data('invoiceSelected')).concat(']')).each(function () {
225            this.checked = true;
226            $(this).parent(".bse-checkbox-container").parent(".bse-results-sub-header").addClass("bse-background-selected-item");
227            $(this).parent(".results-cell").parent(".results-row").addClass("bse-background-selected-item");
228        });
229    },
230
231    removeCheckBoxValues: function (selector) {
232        $('[data-invoice-selected='.concat($(selector).data('invoiceSelected')).concat(']')).each(function () {
233            this.checked = false;
234            $(this).parents(".results-table").find(".results-cell").removeClass("bse-background-selected-item");
235            $(this).parents(".bse-results-sub-header").removeClass("bse-background-selected-item");
236            $(this).parent(".results-cell").parent(".results-row").removeClass("bse-background-selected-item");
237        });
238    },
239
240    toggleMakePaymentButtonActivation: function (value) {
241        if ($(value).length > 0) {
242            $(".bse-button-make-payment").addClass("bse-make-payment-active");
243            $(".bse-button-make-payment").prop("disabled", false);
244            $(".bse-button-clear-list").addClass("bse-make-payment-active");
245            $(".bse-button-clear-list").prop("disabled", false);
246        } else {
247            $(".bse-button-make-payment").removeClass("bse-make-payment-active");
248            $(".bse-button-make-payment").prop("disabled", true);
249            $(".bse-button-clear-list").removeClass("bse-make-payment-active");
250            $(".bse-button-clear-list").prop("disabled", true);
251
252        }
253    },
254    getSelectedInvoicesTotal: function (selectionCheckboxClass) {
255        var selectedInvoicesTotal = 0.0;
256        $('.' + selectionCheckboxClass + ':checked').each(function () {
257            selectedInvoicesTotal = selectedInvoicesTotal + parseFloat($(this).attr("data-invoice-total"));
258        });
259        return selectedInvoicesTotal;
260    },
261    updateSelectedInvoicesTotal: function (selectionCheckboxClass) {
262        var selectedInvoicesTotal = ACC.invoiceMakePaymentList.getSelectedInvoicesTotal(selectionCheckboxClass);
263        $(".bse-make-payment-selected-total").text(ACC.invoiceMakePayment.currencyFormatter.format(selectedInvoicesTotal));
264    },
265
266    submitInvoicesForm: function () {
267        $('.bse-make-payment-button-container input').on('click', function () {
268            $('form.invoices-form').submit();
269        });
270
271        $('.js-make-payment-confirmation-print').on('click', function () {
272            window.print();
273        });
274    },
275
276    totalScrollerDisplay: function () {
277        $(window).scroll(function() {
278
279            var scroll = $(window).scrollTop();
280            var maxScroll = $(".invoices-form").height();
281
282            if (scroll >= 500) {
283                $(".result-scroller").addClass("sticky");
284            } else {
285                $(".result-scroller").removeClass("sticky");
286            }
287        });
288    },
289    addInvoice : function(invoiceNumber, invoiceTotal) {
290        $.ajax({
291            dataType : "json",
292            url : ACC.config.encodedContextPath	+ 'addInvoice',
293            data : {
294                invoiceNumber : invoiceNumber,
295                invoiceTotal: invoiceTotal
296            },
297            type : "POST",
298            traditional : true,
299            success : function() {
300                return true;
301            },
302            error: function() {
303                return false;
304            }
305        })
306    },
307    removeInvoice : function(invoiceNumber, invoiceTotal) {
308        $.ajax({
309            dataType : "json",
310            url : ACC.config.encodedContextPath	+ 'removeInvoice',
311            data : {
312                invoiceNumber : invoiceNumber,
313                invoiceTotal: invoiceTotal
314            },
315            type : "POST",
316            traditional : true,
317            success : function() {
318                return true;
319            },
320            error: function() {
321                return false;
322            }
323        })
324    },
325    clearAllInvoice : function() {
326        $.ajax({
327            dataType : "json",
328            url : ACC.config.encodedContextPath	+ 'clearlist',
329            type : "POST",
330            traditional : true,
331            success : function() {
332                return true;
333            },
334            error: function() {
335                return false;
336            }
337        })
338    }
339};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.