PageSourceSearch

https://wlivestock.com/app/directives/invoiceLineItemPaymentAllocations.js?v=buster20250808

js wlivestock.com collected 2026-10-04 06:04:33 UTC 2,890 bytes, 88 lines download raw bytes

1app.directive('invoiceLineItemPaymentAllocations', function () {
2    return {
3        templateUrl: 'app/directives/invoiceLineItemPaymentAllocations.html',
4        restrict: 'EA',
5        scope: {
6            invoiceLineItemId: '=',
7            invoiceId: '=',
8            loadDirective: '='
9        },
10        controller: 'invoiceLineItemPaymentAllocationsController',
11        controllerAs: 'vm',
12        bindToController: true
13    }
14});
15
16app.controller('invoiceLineItemPaymentAllocationsController', ['$scope', '$rootScope', '$q', '$timeout', 'invoicesService', 
17    function ($scope, $rootScope, $q, $timeout, invoicesService) {
18        var vm = this;
19
20        $scope.$watch('vm.loadDirective', function (newValue, oldValue) {
21
22            if (newValue == null) {
23                return;
24            }
25
26            vm.pageIsLoaded = false;
27            $timeout(function () { vm.canShowPageLoading = true; }, 1000);                        
28
29            vm.getAllocations();
30
31
32        });
33        
34
35        vm.getAllocations = function () {
36
37            invoicesService.getInvoiceLineItemPaymentAllocations(vm.invoiceLineItemId).then(function (results) {
38                // Set the allocations
39                vm.paymentAllocations = results.data.paymentAllocations;
40                // Set that the page is loaded
41                vm.pageIsLoaded = true;
42            }, function (error) {
43                // Pop up an error
44                popApiErrorMessage(error);
45            });
46
47        };
48
49        vm.toggleAllocationActive = function (allocation) {
50            var deferred = $q.defer();
51
52            invoicesService.RemovePaymentAllocationFromInvoiceLineItem(vm.invoiceLineItemId, allocation.paymentAllocationId).then(function (results) {
53                // Go get the allocations again
54                vm.getAllocations();
55
56                //Broadcast the deletion so the consumer can reload the UI
57                var invoiceInfo = {
58                    invoiceId: vm.invoiceId,
59                    invoiceLineItemId: vm.invoiceLineItemId
60                }
61                $rootScope.$broadcast('payment-allocation-removed', invoiceInfo);
62
63                // Resolve the promise
64                deferred.resolve();
65            }, function (error) {
66                // Pop up an error
67                popApiErrorMessage(error);
68                // Resolve the promise
69                deferred.resolve();
70            });
71
72            return deferred.promise;
73        };
74
75        vm.formatDateAsUtc = function (dateToFormat) {
76            return formatDateOrDateStringAsUtcDate(dateToFormat);
77        };
78
79        vm.isInRole = function (role) {
80            return $scope.$parent.isInRole(role);
81        }
82        
83        vm.paymentAllocations = [];
84
85        vm.pageIsLoaded = false;
86
87    }]
88);

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.