<commit_before>/*
 * This program is part of the OpenLMIS logistics management information system platform software.
 * Copyright © 2013 VillageReach
 *
 * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.
 * You should have received a copy of the GNU Affero General Public License along with this program.  If not, see http://www.gnu.org/licenses.  For additional information contact <EMAIL>.
 */

function MultipleFacilitySearchFilterController($scope, Facilities) {

  $scope.showResults = false;
  $scope.type = {};
  $scope.zone = {};
  $scope.disableAddFacility = true;
  $scope.tempFacilities = [];

//TODO: write specs for this function.
  $scope.showFacilitySearchResults = function () {
    if (!$scope.facilitySearchParam) return;
    $scope.tempFacilities = [];
    $scope.$parent.$parent.duplicateFacilityName = undefined;
    $scope.facilityQuery = $scope.facilitySearchParam.trim();
    Facilities.get({"searchParam": $scope.facilityQuery, "facilityTypeId": $scope.type.id, "geoZoneId": $scope.zone.id}, function (data) {
      $scope.facilityList = data.facilityList;
      $scope.facilityResultCount = isUndefined($scope.facilityList) ? 0 : $scope.facilityList.length;
      $scope.message = data.message;
    });
  };

  $scope.clearFacilitySearch = function () {
    angular.element("#search .search-list").slideUp("slow", function () {
      $scope.facilitySearchParam = undefined;
      $scope.facilityList = undefined;
      $scope.facilityResultCount = undefined;
      $scope.$apply();
      angular.element('#searchFacility').focus();
    });<commit_msg>#1520|Fixed add selected facilities not getting disabled.<commit_after>/*
 * This program is part of the OpenLMIS logistics management information system platform software.
 * Copyright © 2013 VillageReach
 *
 * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.
 * You should have received a copy of the GNU Affero General Public License along with this program.  If not, see http://www.gnu.org/licenses.  For additional information contact <EMAIL>.
 */

function MultipleFacilitySearchFilterController($scope, Facilities) {

  $scope.showResults = false;
  $scope.type = {};
  $scope.zone = {};
  $scope.disableAddFacility = true;
  $scope.tempFacilities = [];

//TODO: write specs for this function.
  $scope.showFacilitySearchResults = function () {
    if (!$scope.facilitySearchParam) return;
    $scope.tempFacilities = [];
    $scope.$parent.$parent.duplicateFacilityName = undefined;
    $scope.disableAddFacility = true;
    $scope.facilityQuery = $scope.facilitySearchParam.trim();
    Facilities.get({"searchParam": $scope.facilityQuery, "facilityTypeId": $scope.type.id, "geoZoneId": $scope.zone.id}, function (data) {
      $scope.facilityList = data.facilityList;
      $scope.facilityResultCount = isUndefined($scope.facilityList) ? 0 : $scope.facilityList.length;
      $scope.message = data.message;
    });
  };

  $scope.clearFacilitySearch = function () {
    angular.element("#search .search-list").slideUp("slow", function () {
      $scope.facilitySearchParam = undefined;
      $scope.facilityList = undefined;
      $scope.facilityResultCount = undefined;
      $scope.$apply();
      angular.element('#searchFacility').focus();
    });
{'fraction_non_alphanumeric': 0.1068313953488372, 'fraction_numerical': 0.003875968992248062, 'mean_word_length': 4.213383838383838, 'pattern_counts': {'":': 6, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5665754', 'n_tokens_mistral': 1123, 'n_tokens_neox': 1098, 'n_words': 368}