Commit 39243c6a2e61dc9f19f5d11fc64282c25b4631f8
1 parent
a27f8c000c
Exists in
master
api integraions
Showing
3 changed files
with
43 additions
and
3 deletions
Show diff stats
app/partials/ContactView/ContactView.controller.js
... | ... | @@ -13,6 +13,30 @@ |
13 | 13 | $scope.contactList = result; |
14 | 14 | }) |
15 | 15 | |
16 | + $scope.search = ""; | |
17 | + $scope.minlength = 2; | |
18 | + | |
19 | + | |
20 | + $scope.searchString= function(value){ | |
21 | + ContactViewService.getSearchResults(value).then(function(result) { | |
22 | + $scope.contactList = result; | |
23 | + console.log("result", result); | |
24 | + for (var i = 0; i < $scope.contactList.length; i++) { | |
25 | + if ($scope.contactList[i].owner != null) { | |
26 | + if ($scope.contactList[i].owner.companyName != null || $scope.contactList[i].owner.companyName != undefined) { | |
27 | + $scope.contactList[i].owner = $scope.contactList[i].owner.companyName; | |
28 | + } | |
29 | + } | |
30 | + } | |
31 | + $scope.displayContactList = new NgTableParams({ | |
32 | + page: 1, | |
33 | + count: 10, | |
34 | + }, { | |
35 | + data: $scope.contactList | |
36 | + }); | |
37 | + }) | |
38 | + } | |
39 | + | |
16 | 40 | $scope.reset = function(){ |
17 | 41 | $("input").val(""); |
18 | 42 | } |
... | ... | @@ -55,10 +79,10 @@ |
55 | 79 | } |
56 | 80 | |
57 | 81 | |
58 | - /*ContactViewService.getCompanies().then(function(result) { | |
82 | + ContactViewService.getCompanies().then(function(result) { | |
59 | 83 | $scope.companies = result; |
60 | 84 | |
61 | - })*/ | |
85 | + }) | |
62 | 86 | |
63 | 87 | $scope.contactData = {}; |
64 | 88 | $scope.contactData.contactList = []; | ... | ... |
app/partials/ContactView/ContactView.html
... | ... | @@ -26,7 +26,7 @@ |
26 | 26 | <i class="fa fa-caret-down" aria-hidden="true"></i> |
27 | 27 | </a> |
28 | 28 | </li> |
29 | - <li style="margin: 0px 10px 4px 40px;"><input type="text" style="height:31px;"class="form-control" name="name" id="name" placeholder="Search In Table"></li> | |
29 | + <li style="margin: 0px 10px 4px 40px;"><input type="text" style="height:31px;"class="form-control" name="name" id="name" placeholder="Search In Table" ng-model="search" ng-keyup="searchString(search)" ng-minlength="minlength"></li> | |
30 | 30 | <li><button type="button" class="btn btn-default btn-sm">Clear Search And Filters</button></li> |
31 | 31 | <li style="float: right"> <button type="submit" data-toggle="modal" data-target="#contact-modal-3" class="btn btn-success btn-sm"> <i class="fa fa-plus" aria-hidden="true"></i> Add Contact </button></li> |
32 | 32 | </ul> | ... | ... |
app/partials/ContactView/ContactView.service.js
... | ... | @@ -21,6 +21,22 @@ |
21 | 21 | }) |
22 | 22 | return deferred.promise; |
23 | 23 | } |
24 | + | |
25 | + this.getSearchResults = function(param) { | |
26 | + | |
27 | + var deferred = $q.defer(); | |
28 | + $http({ | |
29 | + method : 'GET', | |
30 | + url : BASE_URL.url +'/company/contact/search?param='+param, | |
31 | + headers : {'Content-Type': 'application/json'}, | |
32 | + }) | |
33 | + .then(function (result){ | |
34 | + deferred.resolve(result.data); | |
35 | + },function (result){ | |
36 | + deferred.resolve(result.data); | |
37 | + }) | |
38 | + return deferred.promise; | |
39 | + } | |
24 | 40 | |
25 | 41 | this.getCompanies = function() { |
26 | 42 | ... | ... |