Commit 5e7aae2d25fb77bd9335ecb177cd181c6dc00013

Authored by Anchit Jindal
1 parent a9aef0b1c2
Exists in master

new changes

app/partials/customers/customers.controller.js
... ... @@ -135,6 +135,10 @@
135 135 $scope.removeValidation = function(){
136 136 $scope.showCompanyError = false;
137 137 $('.companyNameInput').removeClass('customErrorInput');
  138 + if($scope.data.companyName == 'undefined' || $scope.data.companyName == '') {
  139 + $('.companyNameInput').addClass('customErrorInput');
  140 + $scope.showCompanyError = true;
  141 + }
138 142 }
139 143  
140 144 $scope.removeMarginValidation = function(){
... ... @@ -270,10 +274,9 @@
270 274 $scope.showLoader = false;
271 275 })
272 276 }
273   -
274   - $scope.getCompanyName = function(parm){
275   - $scope.showLoader = true;
276   - CustomersService.getCompanyName(parm).then(function(result) {
  277 + getCompanyName();
  278 + function getCompanyName(){
  279 + CustomersService.getCompanyName().then(function(result) {
277 280 $scope.compNameList = result;
278 281 })
279 282 }
... ...
app/partials/customers/customers.html
... ... @@ -179,7 +179,8 @@
179 179 <label class="new-input-label"><b>Company Name *</b></label>
180 180 </div>
181 181 <div class="pull-left" style="margin-left: 15px;">
182   - <input type="text" ng-model="data.companyName" class="form-control companyNameInput" ng-keyup="removeValidation()" placeholder="" required>
  182 + <input type="text" ng-keyup="removeValidation()" ng-model="data.companyName" uib-typeahead="company.companyName for company in compNameList | filter:$viewValue | limitTo:8" class="form-control companyNameInput">
  183 +
183 184 <label class="customErrorMessage" ng-show="showCompanyError">This field is required.</label>
184 185 </div>
185 186 <div class="clearfix"></div>
... ...
app/partials/customers/customers.service.js
... ... @@ -164,11 +164,11 @@
164 164 return deferred.promise;
165 165 }
166 166  
167   - this.getCompanyName = function(parm) {
  167 + this.getCompanyName = function() {
168 168 var deferred = $q.defer();
169 169 $http({
170 170 method : 'GET',
171   - url : BASE_URL.url +'/company/searchName?query='+parm,
  171 + url : BASE_URL.url +'/company/searchName',
172 172 headers : {'Content-Type': 'application/json'},
173 173 })
174 174 .then(function (result){
... ...