ngx-monitorias-uniandes-lib
Version:
This library is used for Monitorias-Uniandes system.
102 lines • 3.94 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@angular/core");
var service_locator_1 = require("../service-locator");
var core_2 = require("@ngx-translate/core");
var SearchComboBoxService = /** @class */ (function () {
function SearchComboBoxService(urlService, translateService) {
this.urlService = urlService;
this.translateService = translateService;
}
SearchComboBoxService.prototype.getLabelsForStudents = function (types) {
var label;
var it = types[Symbol.iterator]();
var item = it.next();
while (!item.done) {
if (item.value == 1 || item.value == 3) {
item = it.next();
}
if (item.value == 2) {
label = this.translateService.instant('PHD_STUDENT');
}
if (item.value == 4) {
label = this.translateService.instant('MASTER_STUDENT');
}
if (item.value == 6) {
label = this.translateService.instant('POSTDOC_STUDENT');
}
if (item.value == 7) {
label = this.translateService.instant('UNDERGRADUATE_STUDENT');
;
}
item = it.next();
if (!item.done) {
label = label + ', ';
}
}
return label;
};
/**
*
* Establishes url service according queryParam => PersonType
* PersonType = 1 > Faculty
* PersonType = 2 > PhdStudent
* PersonType = 3 > ExternalPeople
* PersonType = [4,5,6,7] > Students
*/
/**
*
* Establishes url service according queryParam => PersonType
* PersonType = 1 > Faculty
* PersonType = 2 > PhdStudent
* PersonType = 3 > ExternalPeople
* PersonType = [4,5,6,7] > Students
*/
SearchComboBoxService.prototype.setUrlService = /**
*
* Establishes url service according queryParam => PersonType
* PersonType = 1 > Faculty
* PersonType = 2 > PhdStudent
* PersonType = 3 > ExternalPeople
* PersonType = [4,5,6,7] > Students
*/
function (model, debugFlag) {
var _this = this;
if (debugFlag === void 0) { debugFlag = false; }
if (model.queryParams) {
model.queryParams.forEach(function (qp) {
if (qp.name === 'personType') {
var qvalue = JSON.parse(qp.value);
if (qvalue instanceof Array) {
model.urlService = _this.urlService.getExternalPersonUrl(debugFlag);
model.collectionName = 'results';
}
else {
qp.value = Number(qp.value);
switch (qp.value) {
case 1:
model.urlService = _this.urlService.getFacultyUrl(debugFlag);
model.collectionName = 'faculties';
break;
default:
model.urlService = _this.urlService.getStudentUrl(debugFlag);
model.collectionName = 'students';
break;
}
}
}
});
}
};
SearchComboBoxService.decorators = [
{ type: core_1.Injectable },
];
/** @nocollapse */
SearchComboBoxService.ctorParameters = function () { return [
{ type: service_locator_1.ServiceLocator, },
{ type: core_2.TranslateService, },
]; };
return SearchComboBoxService;
}());
exports.SearchComboBoxService = SearchComboBoxService;
//# sourceMappingURL=search-combo-box.service.js.map