import { __decorate } from "tslib";
import { Component, Input } from "@angular/core";
import { Subject } from "rxjs";
import { EmployeeSummaryService } from "./employee-summary.service";
import { finalize, takeUntil } from "rxjs/operators";
var EmployeeSummaryComponent = /** @class */ (function () {
    function EmployeeSummaryComponent(employeeSummaryService) {
        this.employeeSummaryService = employeeSummaryService;
        this.ngUnsubscribe = new Subject();
    }
    Object.defineProperty(EmployeeSummaryComponent.prototype, "employeeId", {
        set: function (value) {
            this._employeeId = value;
            this.getEmployeeBasicInformation();
        },
        enumerable: true,
        configurable: true
    });
    ;
    EmployeeSummaryComponent.prototype.ngOnInit = function () {
        this.getEmployeeBasicInformation();
    };
    EmployeeSummaryComponent.prototype.ngOnDestroy = function () {
        this.ngUnsubscribe.next(true);
        this.ngUnsubscribe.complete();
    };
    EmployeeSummaryComponent.prototype.getEmployeeBasicInformation = function () {
        var _this = this;
        if (this._employeeId && (this._employeeId != this.lastEmployeeId)) {
            this.lastEmployeeId = this._employeeId;
            this.loading = true;
            this.employeeSummaryService.employeeBasicInformations(this._employeeId)
                .pipe(takeUntil(this.ngUnsubscribe), finalize(function () { return _this.loading = false; }))
                .subscribe(function (data) { return _this.currentEmployee = data === null || data === void 0 ? void 0 : data.employeeBasicInformations; });
        }
    };
    EmployeeSummaryComponent.ctorParameters = function () { return [
        { type: EmployeeSummaryService }
    ]; };
    __decorate([
        Input()
    ], EmployeeSummaryComponent.prototype, "employeeId", null);
    EmployeeSummaryComponent = __decorate([
        Component({
            selector: "fnd-employee-summary",
            template: "<s-loading-state [blockWindow]=\"true\" [loading]=\"loading\">\n    <s-object-card *ngIf=\"_employeeId && currentEmployee\">\n        <s-object-card-main label=\"{{currentEmployee.name}}\"\n                            description=\n                            \"{{currentEmployee.jobPosition || ('hcm_contract.employment_contract.not_informed' | translate)}}\"\n                            imageSource=\"{{currentEmployee.imageUrl}}\">\n        </s-object-card-main>\n        <s-object-card-field label=\"{{currentEmployee.e070emp\n        || ('hcm_contract.employment_contract.not_informed' | translate)}}\" description=\"{{currentEmployee.e070fil\n            || ('hcm_contract.employment_contract.not_informed' | translate)}}\">\n        </s-object-card-field>\n        <s-object-card-field label=\"{{'hcm_contract.employment_contract.department' | translate}}\"\n                             description=\n                             \"{{currentEmployee.location || ('hcm_contract.employment_contract.not_informed' | translate)}}\">\n        </s-object-card-field>\n        <s-object-card-field label=\"{{'hcm_contract.employment_contract.situation' | translate}}\"\n                             description=\n                             \"{{currentEmployee.situation\n       || ('hcm_contract.employment_contract.not_informed' | translate)}}\"></s-object-card-field>\n        <s-object-card-field label=\"{{'hcm_contract.employment_contract.hireDate' | translate}}\"\n                             description=\n                             \"{{(currentEmployee.hireDate | localizedDate: 'L' | async) || ('hcm_contract.employment_contract.not_informed' | translate)}}\"\n                             iconClass=\"fa fa-calendar\"></s-object-card-field>\n        <s-object-card-field label=\"{{'hcm_contract.employment_contract.code' | translate}}\"\n                             description=\n                             \"{{currentEmployee.code || ('hcm_contract.employment_contract.not_informed' | translate)}}\"\n                             iconClass=\"fa fa-id-card\"></s-object-card-field>\n        <s-object-card-field label=\"{{'hcm_contract.employment_contract.age' | translate}}\"\n                             description=\n                             \"{{currentEmployee.age || ('hcm_contract.employment_contract.not_informed' | translate)}}\"\n                             iconClass=\"fa fa-birthday-cake\"></s-object-card-field>\n    </s-object-card>\n</s-loading-state>\n"
        })
    ], EmployeeSummaryComponent);
    return EmployeeSummaryComponent;
}());
export { EmployeeSummaryComponent };
//# sourceMappingURL=data:application/json;base64, 