PageSourceSearch

https://www.roundhillfishkill.com/js/ng-controllers/customer/violation-detail.js?v=2.1.1.30179

js roundhillfishkill.com collected 2026-09-26 05:00:46 UTC 12,256 bytes, 289 lines download raw bytes

1angular.module('BungeeApp')
2    .controller('ViolationDetailController', function ($scope, $compile, $window, $uibModal, $timeout, DTOptionsBuilder, DTColumnDefBuilder, AppConstants, customerSlug, violationId, customerId, dismissText, isPublic) {
3        $scope.isPublic = isPublic;
4        $scope.slug = customerSlug;
5        $scope.AsyncLoad = async function () {
6            $scope.loadPage();
7        }
8
9        $scope.loadPage = function () {
10            $scope.violationExists = false;
11
12            $scope.customerId = $scope.currentCustomerSite.customerId;
13
14            $scope.dismissText = dismissText;
15
16            $scope.setPage('Violations', 'violations');
17
18            $scope.currentTab = 'details';
19            $scope.setTab = function (tab) {
20                $scope.currentTab = tab;
21            }
22
23            $scope.violation = null;
24
25            $scope.getViolation = function () {
26                $scope.ajaxCall('/Violation/GetViolationDetail', { customerId: $scope.customerId, violationId: violationId }, function (data) {
27                    $scope.violation = data;
28                });
29            }
30
31            $scope.getViolation();
32
33            $scope.customerId = customerId;
34            $scope.violationId = null;
35            $scope.currentUser = AppConstants.CurrentUser;
36            $scope.attachments = [];
37            $scope.comment = { comment: "", adminOnly: $scope.isAdmin };
38            $scope.status = null;
39            $scope.adminOnly = $scope.isAdmin;
40
41            $scope.validationRan = false;
42
43            $scope.addComment = function () {
44                $scope.validationRan = true;
45                if (!$scope.comment.comment.length) {
46                    return;
47                }
48                $scope.validationRan = false;
49
50
51                $scope.ajaxCall('/Violation/AddCommentAdmin', { customerId: $scope.customerId, violationId: violationId, comment: $scope.comment.comment, adminOnly: $scope.comment.adminOnly, attachments: $scope.uploads, isPublic: $scope.isPublic }, function (data) {
52                    $scope.uploads = [];
53                    $scope.comment = { comment: "", adminOnly: $scope.comment.adminOnly };
54                    $scope.getViolation();
55                    //$scope.$close();
56                });
57            }
58
59            $scope.triggerUpload = function () {
60                jQuery('.custom-hidden-upload-label input').click();
61            }
62
63            $scope.initMultipleUpload = function () {
64                $timeout(function () {
65                    jQuery('.customMultipleUpload').each(function () {
66                        jQuery(this).find('input').prop('multiple', true);
67                    });
68
69                }, 50);
70            }
71
72            $scope.file = null;
73
74            $scope.inUpload = false;
75            $scope.startFileUpload = function (files) {
76                $scope.inUpload = true;
77            };
78
79            $scope.successFileUploadCustomMultiple = function (response) {
80                $scope.inUpload = false;
81                if (response.data.success) {
82                    angular.forEach(response.data.results, function (result) {
83                        var folderFile = {};
84                        folderFile.uploadedFileId = result.fileId;
85                        folderFile.sizeInt = result.fileSizeBytes;
86                        folderFile.name = result.fileName;
87                        folderFile.type = result.fileType;
88
89
90                        if (!$scope.uploads) {
91                            $scope.uploads = [];
92                        }
93                        $scope.uploads.push(folderFile);
94                    });
95                } else {
96                    $scope.errorMessage('One or more files exceeds the maximum file size of 15MB.');
97                }
98            };
99
100            $scope.removeFormFile = function (index) {
101                $scope.uploads.splice(index, 1);
102            }
103
104            $scope.triggerAccordion = function (questionId) {
105                var accordion = jQuery('.attachmentCollapse[data-item=' + questionId + ']');
106                if (accordion.hasClass('isExpanded')) {
107                    accordion.removeClass('isExpanded').slideUp();
108                } else {
109                    accordion.addClass('isExpanded').slideDown();
110                }
111            }
112            $scope.editViolation = function (isNew) {
113                $uibModal.open({
114                    templateUrl: 'add-edit-violation-modal',
115                    size: 'lg',
116                    controller: function ($scope, $timeout, violationId, customerId, isNew) {
117                        $scope.violation = null;
118                        $scope.members = null;
119                        $scope.households = null;
120
121                        $scope.users = [];
122                        $scope.households = [];
123                        $scope.ajaxCall('/Customer/GetCustomerMembersNonDirectory', { customerId: customerId }, function (data) {
124                            $scope.users = data;
125                        });
126
127                        $scope.ajaxCall('/Households/GetCustomerHouseholds', { customerId: customerId }, function (data) {
128                            $scope.households = data;
129                        });
130
131                        if (!isNew) {
132                            $scope.ajaxCall('/Violation/GetViolation', { customerId: customerId, violationId: violationId }, function (data) {
133
134                                $scope.violation = data;
135                                if ($scope.violation.assignee != -1 && $scope.violation.assignee != 4) {
136                                    $scope.violationExists = true;
137                                }
138                                else {
139                                    $scope.violationExists = false;
140                                }
141
142                                if ($scope.violation.assignee == -1) {
143                                    $scope.violation.assignee == 0;
144                                }
145
146
147                            });
148                        } else {
149                            $scope.violation = { violationId: violationId, assignee: 0, type: null, status: 3, isFineable: 0, fine: "0.00", uploadedFiles: [], violatorUserId: null, householdId: null };
150                            $scope.violationExists = false;
151                        }
152
153
154                        $scope.$watch('violation.fine', function (input) {
155                            if ($scope.violation.fine != null && input != null && $scope.violation.fine != 0) {
156                                $scope.violation.fine = input.replace(/[^0-9\\.]+/g, '');
157
158                                if ($scope.violation.fine < 0) {
159                                    $scope.violation.fine = 0;
160                                }
161                            }
162                        });
163
164                        $scope.file = null;
165
166                        $scope.inUpload = false;
167                        $scope.startFileUpload = function (files) {
168                            $scope.inUpload = true;
169                        };
170
171                        $scope.successFileUpload = function (response) {
172                            $scope.inUpload = false;
173                            if (response.data.success) {
174
175                                $scope.file = response.data.results[0];
176
177                                angular.forEach(response.data.results, function (result) {
178
179                                    var folderFile = {};
180                                    folderFile.uploadedFileId = result.fileId;
181                                    folderFile.name = result.fileName;
182                                    folderFile.type = result.fileType;
183
184                                    if (!$scope.violation.uploadedFiles) {
185                                        $scope.violation.uploadedFiles = [];
186                                    }
187                                    $scope.violation.uploadedFiles.push(folderFile);
188                                });
189                            } else {
190                                $scope.errorMessage('One or more files exceeds the maximum file size of 15MB.');
191                            }
192                        };
193
194                        $scope.imageSrc = function (fileId) {
195                            if (fileId != null) {
196                                return '/File/Get/' + fileId;
197                            }
198                            return null;
199                        };
200
201                        $scope.removeFile = function (index) {
202                            $scope.violation.uploadedFiles.splice(index, 1);
203                        }
204
205                        $scope.submitAttempt = false;
206                        $scope.save = function (form) {
207                            $scope.submitAttempt = true;
208                            if (form.$invalid) {
209                                return;
210                            }
211
212                            if ($scope.violation.type == null) {
213                                return;
214                            }
215
216                            if ($scope.violation.assignee == 0 && !$scope.violation.violatorUserId) {
217                                return;
218                            }
219
220                            if ($scope.violation.assignee == 1 && !$scope.violation.householdId) {
221                                return;
222                            }
223
224                            $scope.submitAttempt = false;
225                            $scope.submitAttempt = false;
226
227                            $scope.ajaxCall('/Violation/SaveViolation', { customerId: customerId, data: $scope.violation }, function (data) {
228                                $scope.$close();
229                            });
230                        }
231                    },
232                    backdrop: 'static',
233                    resolve: {
234                        violationId: function () {
235                            return violationId;
236                        },
237                        isNew: function () {
238                            return isNew;
239                        },
240                        customerId: function () {
241                            return $scope.customerId;
242                        },
243                    }
244                }).result.then(function () {
245                    $scope.getViolation();
246                }, function () {
247
248                });
249            };
250
251
252            $scope.dismissViolation = function () {
253                $uibModal.open({
254                    templateUrl: 'dismiss-violation-modal',
255                    controller: function ($scope, $timeout, violationId, customerId) {
256                        $scope.confirm = function (form) {                            
257                            $scope.ajaxCall('/Violation/DismissViolation', { customerId: customerId, violationId: violationId }, function (data) {
258                                $scope.$close();
259                            });
260                        }
261                    },
262                    backdrop: 'static',
263                    resolve: {
264                        customerId: function () {
265                            return $scope.customerId;
266                        },
267                        violationId: function () {
268                            return $scope.violation.violationId;
269                        },
270                    }
271                }).result.then(function () {
272                    $scope.$close();
273                }, function () {
274
275                });
276            };
277
278            $scope.updateStatus = function () {
279                $scope.ajaxCall('/Violation/SaveViolation', { customerId: customerId, data: $scope.violation }, function (data) {
280                    $scope.successMessage("Successfully updated the violation");
281                });
282            }
283
284            $scope.$apply();
285        }
286
287        $scope.AsyncLoad();
288
289    });

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.