Commit d011f511c90819393142ad4f5f5d111b80749799

Authored by Swarn Singh
Exists in master

Merge branch 'master' of git.viithiisys.com:viithiisys/acufuel

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 }
... ... @@ -62,10 +86,10 @@
62 86 }
63 87  
64 88  
65   - /*ContactViewService.getCompanies().then(function(result) {
  89 + ContactViewService.getCompanies().then(function(result) {
66 90 $scope.companies = result;
67 91  
68   - })*/
  92 + })
69 93  
70 94 $scope.contactData = {};
71 95 $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  
... ...