PageSourceSearch

https://dzogchen.net/js/app/ManageContactsCtrl.js

js dzogchen.net collected 2026-10-02 09:59:19 UTC 2,501 bytes, 59 lines download raw bytes

1app.controller('ManageContactsCtrl', function ($scope, $location, $rootScope, $stateParams, $http, instantSearch) {
2
3    $http.get('/content/country.txt').then(function (res) { $scope.countries = res.data; });
4    var getContacts = function () {
5        //$scope.engNamePattern = "$rootScope.engNamePattern;
6        $scope.loading = true;
7        $scope.addFormVisible = false;
8        $scope.editFormVisible = false;
9        $http.get("/api/ManageContacts/getContacts/").success(function (contacts) {
10            $scope.contacts = contacts;
11            $scope.loading = false;
12            if ($stateParams.id) {
13                angular.forEach(contacts, function (o) {
14                    if (o.contact.Id == $stateParams.id) {
15                        $scope.contact = o.contact;
16                        $scope.editFormVisible = true;
17                    }
18                });
19            }
20        });
21    };
22    getContacts();
23    $scope.contact = {};
24
25
26    $scope.saveContact = function () {
27
28        var birthDate = $scope.contact.BirthDate ? new Date($scope.contact.BirthDate) : null;
29        $scope.contact.BirthDateStr = birthDate ? birthDate.getMonth() + 1 + "/" + birthDate.getDate() + "/" + birthDate.getFullYear() : null;
30
31        $scope.loading = true;
32        $http.post("/api/ManageContacts/saveContact/", $scope.contact).success(function () {
33            getContacts();
34            $scope.contactForm.$setPristine();
35            $scope.contact = {};
36            $rootScope.successAlert("saved");
37            $scope.loading = false;
38            $location.path("/admin/managecontacts");
39        });
40    };
41    $scope.removeContact = function (c) {
42        $http.get("/api/ManageContacts/removeContact/" + c).success(function (resp) {
43
44            getContacts();
45
46        });
47    };
48
49    $scope.findMembers = function () {
50
51        if ($scope.contact.FirstName && $scope.contact.LastName) {
52            var birthDate = $scope.contact.BirthDate ? new Date($scope.contact.BirthDate) : null;
53            $scope.contact.BirthDateStr = birthDate ? birthDate.getMonth() + 1 + "/" + birthDate.getDate() + "/" + birthDate.getFullYear() : null;
54            //$scope.contact.timezoneOffset = $rootScope.appUser.TimezoneOffset;
55            instantSearch.doRequest($scope, "matches", "/api/ManageContacts/findMembers/", { contact: $scope.contact }); //updates property of $scope
56        } else
57            $scope.members = null;
58    };
59});

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.