(self["webpackChunkapp"] = self["webpackChunkapp"] || []).push([["src_app_pages_select-org_select-org_module_ts"],{

/***/ 6551:
/*!***************************************************************!*\
  !*** ./src/app/pages/select-org/select-org-routing.module.ts ***!
  \***************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   SelectOrgPageRoutingModule: () => (/* binding */ SelectOrgPageRoutingModule)
/* harmony export */ });
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! tslib */ 24398);
/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/core */ 37580);
/* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular/router */ 95072);
/* harmony import */ var _select_org_page__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./select-org.page */ 89785);




const routes = [{
  path: '',
  component: _select_org_page__WEBPACK_IMPORTED_MODULE_0__.SelectOrgPage
}];
let SelectOrgPageRoutingModule = class SelectOrgPageRoutingModule {};
SelectOrgPageRoutingModule = (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__decorate)([(0,_angular_core__WEBPACK_IMPORTED_MODULE_2__.NgModule)({
  imports: [_angular_router__WEBPACK_IMPORTED_MODULE_3__.RouterModule.forChild(routes)],
  exports: [_angular_router__WEBPACK_IMPORTED_MODULE_3__.RouterModule]
})], SelectOrgPageRoutingModule);


/***/ }),

/***/ 39334:
/*!*******************************************************!*\
  !*** ./src/app/pages/select-org/select-org.module.ts ***!
  \*******************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   SelectOrgPageModule: () => (/* binding */ SelectOrgPageModule)
/* harmony export */ });
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ 24398);
/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular/core */ 37580);
/* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular/common */ 60316);
/* harmony import */ var _angular_forms__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @angular/forms */ 34456);
/* harmony import */ var _ionic_angular__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @ionic/angular */ 21507);
/* harmony import */ var _select_org_routing_module__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./select-org-routing.module */ 6551);
/* harmony import */ var _select_org_page__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./select-org.page */ 89785);
/* harmony import */ var _ngx_translate_core__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @ngx-translate/core */ 597);








let SelectOrgPageModule = class SelectOrgPageModule {};
SelectOrgPageModule = (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([(0,_angular_core__WEBPACK_IMPORTED_MODULE_3__.NgModule)({
  imports: [_angular_common__WEBPACK_IMPORTED_MODULE_4__.CommonModule, _angular_forms__WEBPACK_IMPORTED_MODULE_5__.FormsModule, _ionic_angular__WEBPACK_IMPORTED_MODULE_6__.IonicModule, _select_org_routing_module__WEBPACK_IMPORTED_MODULE_0__.SelectOrgPageRoutingModule, _ngx_translate_core__WEBPACK_IMPORTED_MODULE_7__.TranslateModule],
  declarations: [_select_org_page__WEBPACK_IMPORTED_MODULE_1__.SelectOrgPage]
})], SelectOrgPageModule);


/***/ }),

/***/ 89785:
/*!*****************************************************!*\
  !*** ./src/app/pages/select-org/select-org.page.ts ***!
  \*****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   SelectOrgPage: () => (/* binding */ SelectOrgPage)
/* harmony export */ });
/* harmony import */ var D_progr_mobileappv3_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js */ 89204);
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! tslib */ 24398);
/* harmony import */ var _select_org_page_html_ngResource__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./select-org.page.html?ngResource */ 53067);
/* harmony import */ var _select_org_page_scss_ngResource__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./select-org.page.scss?ngResource */ 17655);
/* harmony import */ var _select_org_page_scss_ngResource__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_select_org_page_scss_ngResource__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @angular/core */ 37580);
/* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! rxjs/operators */ 89475);
/* harmony import */ var _services_request_service__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/request.service */ 80931);
/* harmony import */ var _services_search_service__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../services/search.service */ 12186);
/* harmony import */ var _services_helper_service__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../services/helper.service */ 54102);
/* harmony import */ var _ionic_angular__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @ionic/angular */ 4059);
/* harmony import */ var _environments_storage__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../environments/storage */ 12960);
/* harmony import */ var _capacitor_preferences__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @capacitor/preferences */ 46493);
/* harmony import */ var _environments_connection__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../environments/connection */ 48129);













let SelectOrgPage = class SelectOrgPage {
  constructor(request, helper, navCtrl) {
    this.request = request;
    this.helper = helper;
    this.navCtrl = navCtrl;
    this.loading$ = (0,_angular_core__WEBPACK_IMPORTED_MODULE_9__.signal)(false);
    this.searchString = '';
    this.orgsSearched = [];
    this.orgs = [];
  }
  ngOnInit() {
    this.request.setApiUrl(_environments_connection__WEBPACK_IMPORTED_MODULE_8__.DIVO_ORGS_URL);
    this.loadData();
  }
  doRefresh(_event) {
    this.loadData(_event.target).finally(() => {
      _event.target.complete();
    });
  }
  ionViewWillEnter() {
    this.request.setApiUrl(_environments_connection__WEBPACK_IMPORTED_MODULE_8__.DIVO_ORGS_URL);
  }
  loadData(refresher) {
    var _this = this;
    this.loading$.set(true);
    return new Promise(resolve => {
      // Выполняем запрос
      this.request.getRequest(this.request.uri.getDivoOrgs(), {
        preloader: false,
        onlyCacheOrRequest: true,
        forceUpdateCache: refresher
      }).pipe((0,rxjs_operators__WEBPACK_IMPORTED_MODULE_10__.finalize)(() => {
        resolve(true);
        this.loading$.set(false);
      })).subscribe(/*#__PURE__*/function () {
        var _ref = (0,D_progr_mobileappv3_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* (response) {
          if (response.result) _this.orgs = response.data;
          _this.search({
            detail: {
              value: _this.searchString
            }
          });
        });
        return function (_x) {
          return _ref.apply(this, arguments);
        };
      }());
    });
  }
  search(_event) {
    const value = _event.detail.value || '';
    this.searchString = value;
    if (value == '') {
      this.orgsSearched = this.orgs;
    } else {
      let searchedNameByBigrams = _services_search_service__WEBPACK_IMPORTED_MODULE_4__.SearchService.searchBigrams(value, this.orgs, 'name', 0.2);
      let searchedNameByDefault = this.orgs.filter(item => {
        return item.name.toLowerCase().indexOf(value.toLowerCase()) > -1;
      });
      let searchedAddrByBigrams = _services_search_service__WEBPACK_IMPORTED_MODULE_4__.SearchService.searchBigrams(value, this.orgs, 'region_text', 0.3);
      let searchedAddrByDefault = this.orgs.filter(item => {
        return item.region_text.toLowerCase().indexOf(value.toLowerCase()) > -1;
      });
      this.orgsSearched = this.helper.arrayUnique([...searchedNameByBigrams, ...searchedNameByDefault, ...searchedAddrByBigrams, ...searchedAddrByDefault], 'id');
    }
  }
  select(org) {
    _capacitor_preferences__WEBPACK_IMPORTED_MODULE_7__.Preferences.set({
      key: _environments_storage__WEBPACK_IMPORTED_MODULE_6__.DIVO_SELECTED_ORG,
      value: JSON.stringify(org)
    }).then(() => {
      this.request.setApiUrl(org.api_url);
      this.navCtrl.navigateForward('/login', {
        replaceUrl: true
      });
    });
  }
  static {
    this.ctorParameters = () => [{
      type: _services_request_service__WEBPACK_IMPORTED_MODULE_3__.RequestService
    }, {
      type: _services_helper_service__WEBPACK_IMPORTED_MODULE_5__.HelperService
    }, {
      type: _ionic_angular__WEBPACK_IMPORTED_MODULE_11__.NavController
    }];
  }
};
SelectOrgPage = (0,tslib__WEBPACK_IMPORTED_MODULE_12__.__decorate)([(0,_angular_core__WEBPACK_IMPORTED_MODULE_9__.Component)({
  selector: 'app-select-org',
  template: _select_org_page_html_ngResource__WEBPACK_IMPORTED_MODULE_1__,
  styles: [(_select_org_page_scss_ngResource__WEBPACK_IMPORTED_MODULE_2___default())]
})], SelectOrgPage);


/***/ }),

/***/ 17655:
/*!******************************************************************!*\
  !*** ./src/app/pages/select-org/select-org.page.scss?ngResource ***!
  \******************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

// Imports
var ___CSS_LOADER_API_SOURCEMAP_IMPORT___ = __webpack_require__(/*! ../../../../node_modules/css-loader/dist/runtime/sourceMaps.js */ 53142);
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../../node_modules/css-loader/dist/runtime/api.js */ 35950);
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);
// Module
___CSS_LOADER_EXPORT___.push([module.id, `ion-toolbar > ion-searchbar {
  max-width: 562px;
  margin-left: auto;
  margin-right: auto;
}

ion-content::part(background) {
  background: var(--base-color-dark-background);
}

.content-page ion-item > div {
  padding: 6px 16px;
}
.content-page ion-label {
  padding: 0 0 0 0;
}
.content-page ion-note {
  padding: 0 0;
  font-size: 14px;
}`, "",{"version":3,"sources":["webpack://./src/app/pages/select-org/select-org.page.scss"],"names":[],"mappings":"AACA;EACE,gBAAA;EACA,iBAAA;EACA,kBAAA;AAAF;;AAGA;EACE,6CAAA;AAAF;;AAIE;EACE,iBAAA;AADJ;AAGE;EACE,gBAAA;AADJ;AAGE;EACE,YAAA;EACA,eAAA;AADJ","sourcesContent":["\nion-toolbar > ion-searchbar {\n  max-width: 562px;\n  margin-left: auto;\n  margin-right: auto;\n}\n\nion-content::part(background) {\n  background: var(--base-color-dark-background);\n}\n\n.content-page {\n  ion-item > div {\n    padding: 6px 16px;\n  }\n  ion-label {\n    padding: 0 0 0 0;\n  }\n  ion-note {\n    padding: 0 0;\n    font-size: 14px;\n  }\n}"],"sourceRoot":""}]);
// Exports
module.exports = ___CSS_LOADER_EXPORT___.toString();


/***/ }),

/***/ 53067:
/*!******************************************************************!*\
  !*** ./src/app/pages/select-org/select-org.page.html?ngResource ***!
  \******************************************************************/
/***/ ((module) => {

"use strict";
module.exports = "<ion-header>\n  <ion-toolbar>\n    <ion-title>{{ 'PAGES.DIVO_SELECTED_ORG.TITLE' | translate }}</ion-title>\n  </ion-toolbar>\n  <ion-toolbar>\n    <ion-searchbar\n        showCancelButton=\"focus\"\n        animated=\"true\"\n        cancelButtonText=\"{{ 'BUTTONS.CLOSE' | translate }}\"\n        placeholder=\"{{ 'PAGES.DIVO_SELECTED_ORG.SEARCH_DESCRIPTION' | translate }}\"\n        (ionInput)=\"search($event)\"\n    ></ion-searchbar>\n  </ion-toolbar>\n</ion-header>\n\n<ion-content>\n\n  <ion-refresher slot=\"fixed\" (ionRefresh)=\"doRefresh($event)\">\n    <ion-refresher-content ></ion-refresher-content>\n  </ion-refresher>\n\n  <div class=\"content-page\">\n      @if (!loading$()) {\n          <ion-list [inset]=\"true\">\n              @for (org of orgsSearched; track org) {\n                  <ion-item class=\"el-anim-tap\" (click)=\"select(org)\">\n                      <div>\n                          <ion-label>{{ org.name }}</ion-label>\n                          <ion-note>{{ org.region_text }}</ion-note>\n                      </div>\n                  </ion-item>\n              }\n          </ion-list>\n      } @else {\n          <ion-list [inset]=\"true\">\n              <ion-item>\n                  <div style=\"padding: 6px 24px; width: 100%;\">\n                      <p style=\"height: 20px; width: 100%; margin-bottom: 6px\" class=\"skeleton-text\"></p>\n                      <p style=\"height: 14px; width: 100%;\" class=\"skeleton-text\"></p>\n                  </div>\n              </ion-item>\n              <ion-item>\n                  <div style=\"padding: 6px 24px; width: 100%;\">\n                      <p style=\"height: 20px; width: 100%; margin-bottom: 6px\" class=\"skeleton-text\"></p>\n                      <p style=\"height: 14px; width: 100%;\" class=\"skeleton-text\"></p>\n                  </div>\n              </ion-item>\n              <ion-item>\n                  <div style=\"padding: 6px 24px; width: 100%;\">\n                      <p style=\"height: 20px; width: 100%; margin-bottom: 6px\" class=\"skeleton-text\"></p>\n                      <p style=\"height: 14px; width: 100%;\" class=\"skeleton-text\"></p>\n                  </div>\n              </ion-item>\n              <ion-item>\n                  <div style=\"padding: 6px 24px; width: 100%;\">\n                      <p style=\"height: 20px; width: 100%; margin-bottom: 6px\" class=\"skeleton-text\"></p>\n                      <p style=\"height: 14px; width: 100%;\" class=\"skeleton-text\"></p>\n                  </div>\n              </ion-item>\n              <ion-item>\n                  <div style=\"padding: 6px 24px; width: 100%;\">\n                      <p style=\"height: 20px; width: 100%; margin-bottom: 6px\" class=\"skeleton-text\"></p>\n                      <p style=\"height: 14px; width: 100%;\" class=\"skeleton-text\"></p>\n                  </div>\n              </ion-item>\n          </ion-list>\n      }\n  </div>\n\n</ion-content>\n";

/***/ })

}]);
//# sourceMappingURL=src_app_pages_select-org_select-org_module_ts.js.map