275 lines
16 KiB
JavaScript
275 lines
16 KiB
JavaScript
"use strict";
|
|
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
var useValue = arguments.length > 2;
|
|
for (var i = 0; i < initializers.length; i++) {
|
|
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
}
|
|
return useValue ? value : void 0;
|
|
};
|
|
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
var _, done = false;
|
|
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
var context = {};
|
|
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
if (kind === "accessor") {
|
|
if (result === void 0) continue;
|
|
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
if (_ = accept(result.get)) descriptor.get = _;
|
|
if (_ = accept(result.set)) descriptor.set = _;
|
|
if (_ = accept(result.init)) initializers.unshift(_);
|
|
}
|
|
else if (_ = accept(result)) {
|
|
if (kind === "field") initializers.unshift(_);
|
|
else descriptor[key] = _;
|
|
}
|
|
}
|
|
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
done = true;
|
|
};
|
|
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
|
|
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.QuestionPickerComponent = void 0;
|
|
var core_1 = require("@angular/core");
|
|
var forms_1 = require("@angular/forms");
|
|
var enums_1 = require("../_models/enums");
|
|
var Dynamic_Picker_1 = require("./dynamic-picker/Dynamic-Picker");
|
|
var survey_1 = require("../_models/survey/survey");
|
|
var QuestionPickerComponent = function () {
|
|
var _classDecorators = [(0, core_1.Component)({
|
|
selector: 'app-question-picker',
|
|
templateUrl: './question-picker.component.html',
|
|
//styleUrls: ['../../assets/kendo-grid/grid.css'],
|
|
encapsulation: core_1.ViewEncapsulation.None,
|
|
standalone: false,
|
|
})];
|
|
var _classDescriptor;
|
|
var _classExtraInitializers = [];
|
|
var _classThis;
|
|
var _instanceExtraInitializers = [];
|
|
var _pickerFormGroup_decorators;
|
|
var _pickerFormGroup_initializers = [];
|
|
var _pickerFormGroup_extraInitializers = [];
|
|
var _ItemSelected_decorators;
|
|
var _ItemSelected_initializers = [];
|
|
var _ItemSelected_extraInitializers = [];
|
|
var _pickerformControlName_decorators;
|
|
var _pickerformControlName_initializers = [];
|
|
var _pickerformControlName_extraInitializers = [];
|
|
var _set_setSelectedItem_decorators;
|
|
var _set_MultiSelect_decorators;
|
|
var _set_isStatusActive_decorators;
|
|
var _set_setStatus_decorators;
|
|
var QuestionPickerComponent = _classThis = /** @class */ (function () {
|
|
/** role-permission-entry ctor */
|
|
function QuestionPickerComponent_1(api, apiService, formBuilder, router, route, empSrvc, basicService, pickerService, loadingService, recruitmentService, exitClearanceService, surveyService, notificationService) {
|
|
this.api = (__runInitializers(this, _instanceExtraInitializers), api);
|
|
this.apiService = apiService;
|
|
this.formBuilder = formBuilder;
|
|
this.router = router;
|
|
this.route = route;
|
|
this.empSrvc = empSrvc;
|
|
this.basicService = basicService;
|
|
this.pickerService = pickerService;
|
|
this.loadingService = loadingService;
|
|
this.recruitmentService = recruitmentService;
|
|
this.exitClearanceService = exitClearanceService;
|
|
this.surveyService = surveyService;
|
|
this.notificationService = notificationService;
|
|
this.genders = enums_1.EnumExtension.getNamesAndValues(enums_1.EnumGender);
|
|
this.active = false;
|
|
this.showPopUp = false;
|
|
this.checkboxOnly = false;
|
|
this.mode = 'multiple';
|
|
this.taggedSelection = [];
|
|
this.assetList = [];
|
|
this.searchQuestion = [];
|
|
this.questionCategoryList = [];
|
|
this.requisitionName = 'Search Questions';
|
|
this.searchIcon = 'Search';
|
|
this.ItemCount = 0;
|
|
this.searchItema = [];
|
|
this.statusList = enums_1.EnumExtension.getNamesAndValues(enums_1.EnumAssetStatus);
|
|
this.pickerFormGroup = __runInitializers(this, _pickerFormGroup_initializers, void 0);
|
|
this.ItemSelected = (__runInitializers(this, _pickerFormGroup_extraInitializers), __runInitializers(this, _ItemSelected_initializers, new core_1.EventEmitter()));
|
|
this.pickerformControlName = (__runInitializers(this, _ItemSelected_extraInitializers), __runInitializers(this, _pickerformControlName_initializers, "itemselected"));
|
|
this.empCodeNameList = __runInitializers(this, _pickerformControlName_extraInitializers);
|
|
this.gridMultiSelect = false;
|
|
if (this.pickerFormGroup === undefined) {
|
|
this.pickerFormGroup = new forms_1.FormGroup({});
|
|
}
|
|
this.getQuestionCategory();
|
|
}
|
|
Object.defineProperty(QuestionPickerComponent_1.prototype, "setSelectedItem", {
|
|
set: function (inputedItem) {
|
|
if (inputedItem !== undefined) {
|
|
this.selectedQuestion = inputedItem;
|
|
this.taggedSelection = [];
|
|
this.taggedSelection.push(this.selectedQuestion.id);
|
|
}
|
|
else {
|
|
this.selectedQuestion = new survey_1.Question();
|
|
}
|
|
},
|
|
enumerable: false,
|
|
configurable: true
|
|
});
|
|
Object.defineProperty(QuestionPickerComponent_1.prototype, "MultiSelect", {
|
|
set: function (ismultiselect) {
|
|
if (ismultiselect !== undefined) {
|
|
/* this.gridMultiSelect = true;*/
|
|
this.gridMultiSelect = ismultiselect;
|
|
this.setSelectableSettings();
|
|
}
|
|
},
|
|
enumerable: false,
|
|
configurable: true
|
|
});
|
|
Object.defineProperty(QuestionPickerComponent_1.prototype, "isStatusActive", {
|
|
set: function (isActive) {
|
|
debugger;
|
|
this.active = isActive;
|
|
},
|
|
enumerable: false,
|
|
configurable: true
|
|
});
|
|
Object.defineProperty(QuestionPickerComponent_1.prototype, "setStatus", {
|
|
set: function (Status) {
|
|
debugger;
|
|
this.status = Status;
|
|
},
|
|
enumerable: false,
|
|
configurable: true
|
|
});
|
|
QuestionPickerComponent_1.prototype.getQuestionCategory = function () {
|
|
var _this = this;
|
|
this.loadingService.ShowLoadingPanel = true;
|
|
this.surveyService.getQuestionCategories().subscribe(function (x) {
|
|
_this.questionCategoryList = x;
|
|
}, function (x) {
|
|
_this.loadingService.ShowLoadingPanel = false;
|
|
_this.notificationService.showError(x);
|
|
}, function () {
|
|
_this.loadingService.ShowLoadingPanel = false;
|
|
});
|
|
};
|
|
QuestionPickerComponent_1.prototype.ngOnInit = function () {
|
|
debugger;
|
|
this.assetCategoryPicker = new Dynamic_Picker_1.DynamicPicker(Dynamic_Picker_1.EnumDynamicpickerType.AssetCategory, true);
|
|
// this.status = EnumAssetStatus.Free;
|
|
this.setSelectableSettings();
|
|
this.valueChangedSubscription == this.pickerService.dataChanged.subscribe(function (x) {
|
|
if (x) {
|
|
//this.employeeCount = x;
|
|
}
|
|
});
|
|
};
|
|
QuestionPickerComponent_1.prototype.clear = function () {
|
|
// this.dynamicPickerView.selectedID = 0;
|
|
// this.dynamicPickerView.selectedIDs = [];
|
|
// this.dynamicPickerView.selecteditemText = '';
|
|
};
|
|
QuestionPickerComponent_1.prototype.setSelectableSettings = function () {
|
|
debugger;
|
|
if (this.gridMultiSelect === false) {
|
|
this.selectableSettings = {
|
|
checkboxOnly: true,
|
|
mode: 'single', // this.mode
|
|
};
|
|
}
|
|
else {
|
|
this.selectableSettings = {
|
|
checkboxOnly: true,
|
|
mode: 'multiple', // this.mode
|
|
};
|
|
}
|
|
};
|
|
QuestionPickerComponent_1.prototype.search = function () {
|
|
var _this = this;
|
|
this.taggedSelection = [];
|
|
this.searchItems = [];
|
|
var categoryId = (this.categoryID == undefined || this.categoryID == null) ? 0 : this.categoryID;
|
|
this.loadingService.ShowLoadingPanel = true;
|
|
this.surveyService.getByCategory(categoryId)
|
|
.subscribe(function (x) { _this.searchItems = x; }, function (err) {
|
|
_this.loadingService.ShowLoadingPanel = false;
|
|
_this.notificationService.showError(err.error);
|
|
}, function () {
|
|
_this.loadingService.ShowLoadingPanel = false;
|
|
});
|
|
};
|
|
QuestionPickerComponent_1.prototype.onCancel = function (e) {
|
|
this.closeForm();
|
|
};
|
|
QuestionPickerComponent_1.prototype.onSelect = function (e) {
|
|
var _this = this;
|
|
debugger;
|
|
this.searchQuestion = [];
|
|
this.selectedQuestion = new survey_1.Question();
|
|
if (this.taggedSelection.length > 0) {
|
|
if (this.gridMultiSelect === true) {
|
|
this.taggedSelection.forEach(function (positionid) {
|
|
_this.searchQuestion.push(_this.searchItems.find(function (x) { return x.id === positionid; }));
|
|
});
|
|
}
|
|
else {
|
|
this.taggedSelection.forEach(function (positionid) {
|
|
_this.selectedQuestion = _this.searchItems.find(function (x) { return x.id === positionid; });
|
|
});
|
|
}
|
|
}
|
|
if (this.gridMultiSelect === false) {
|
|
this.ItemSelected.emit(this.selectedQuestion);
|
|
// this.requisitionName = this.selectedAssetSerial.serialNo;
|
|
}
|
|
else {
|
|
this.ItemSelected.emit(this.searchQuestion);
|
|
}
|
|
this.showPopUp = false;
|
|
};
|
|
QuestionPickerComponent_1.prototype.closeForm = function () {
|
|
this.showPopUp = false;
|
|
};
|
|
QuestionPickerComponent_1.prototype.OpenForm = function () {
|
|
this.showPopUp = true;
|
|
};
|
|
QuestionPickerComponent_1.prototype.ngOnDestroy = function () {
|
|
this.loadingService.ShowLoadingPanel = false;
|
|
};
|
|
return QuestionPickerComponent_1;
|
|
}());
|
|
__setFunctionName(_classThis, "QuestionPickerComponent");
|
|
(function () {
|
|
var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
_pickerFormGroup_decorators = [(0, core_1.Input)()];
|
|
_ItemSelected_decorators = [(0, core_1.Output)()];
|
|
_pickerformControlName_decorators = [(0, core_1.Input)()];
|
|
_set_setSelectedItem_decorators = [(0, core_1.Input)()];
|
|
_set_MultiSelect_decorators = [(0, core_1.Input)()];
|
|
_set_isStatusActive_decorators = [(0, core_1.Input)()];
|
|
_set_setStatus_decorators = [(0, core_1.Input)()];
|
|
__esDecorate(_classThis, null, _set_setSelectedItem_decorators, { kind: "setter", name: "setSelectedItem", static: false, private: false, access: { has: function (obj) { return "setSelectedItem" in obj; }, set: function (obj, value) { obj.setSelectedItem = value; } }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
__esDecorate(_classThis, null, _set_MultiSelect_decorators, { kind: "setter", name: "MultiSelect", static: false, private: false, access: { has: function (obj) { return "MultiSelect" in obj; }, set: function (obj, value) { obj.MultiSelect = value; } }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
__esDecorate(_classThis, null, _set_isStatusActive_decorators, { kind: "setter", name: "isStatusActive", static: false, private: false, access: { has: function (obj) { return "isStatusActive" in obj; }, set: function (obj, value) { obj.isStatusActive = value; } }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
__esDecorate(_classThis, null, _set_setStatus_decorators, { kind: "setter", name: "setStatus", static: false, private: false, access: { has: function (obj) { return "setStatus" in obj; }, set: function (obj, value) { obj.setStatus = value; } }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
__esDecorate(null, null, _pickerFormGroup_decorators, { kind: "field", name: "pickerFormGroup", static: false, private: false, access: { has: function (obj) { return "pickerFormGroup" in obj; }, get: function (obj) { return obj.pickerFormGroup; }, set: function (obj, value) { obj.pickerFormGroup = value; } }, metadata: _metadata }, _pickerFormGroup_initializers, _pickerFormGroup_extraInitializers);
|
|
__esDecorate(null, null, _ItemSelected_decorators, { kind: "field", name: "ItemSelected", static: false, private: false, access: { has: function (obj) { return "ItemSelected" in obj; }, get: function (obj) { return obj.ItemSelected; }, set: function (obj, value) { obj.ItemSelected = value; } }, metadata: _metadata }, _ItemSelected_initializers, _ItemSelected_extraInitializers);
|
|
__esDecorate(null, null, _pickerformControlName_decorators, { kind: "field", name: "pickerformControlName", static: false, private: false, access: { has: function (obj) { return "pickerformControlName" in obj; }, get: function (obj) { return obj.pickerformControlName; }, set: function (obj, value) { obj.pickerformControlName = value; } }, metadata: _metadata }, _pickerformControlName_initializers, _pickerformControlName_extraInitializers);
|
|
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
QuestionPickerComponent = _classThis = _classDescriptor.value;
|
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
__runInitializers(_classThis, _classExtraInitializers);
|
|
})();
|
|
return QuestionPickerComponent = _classThis;
|
|
}();
|
|
exports.QuestionPickerComponent = QuestionPickerComponent;
|
|
//# sourceMappingURL=question-picker.component.js.map
|