users.component.js 4.85 KB
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@angular/core");
var user_service_1 = require("./user.service");
var router_1 = require("@angular/router");
var forms_1 = require("@angular/forms");
var http_1 = require("@angular/http");
var confirm_service_1 = require("../../Shared/Confirm/confirm.service");
require("rxjs/Rx");
require("rxjs/add/operator/map");
require("rxjs/add/operator/filter");
var UsersList = /** @class */ (function () {
    //@ViewChild("profileModal")
    //profileModal: ModalComponent;
    //errorMessage: any;
    function UsersList(userservice, router, fb, http, _confirmService) {
        this.userservice = userservice;
        this.router = router;
        this.fb = fb;
        this.http = http;
        this._confirmService = _confirmService;
    }
    UsersList.prototype.ngOnInit = function () {
        this.alerts = '';
        //this.userservice.GetUserById(this.UserId);
        this.Users = this.fb.group({
            FirstName: [''],
            LastName: [''],
            EmailId: [''],
            AccountNumber: [''],
            UserTypeId: [''],
            AccountTypeId: ['']
            // Gender: ['', Validators.required],
            //   Email: ['']
        });
        this.GetUserType();
        this.GetAccountType();
        //this.GetUserList();
    };
    UsersList.prototype.GetUserType = function () {
        var _this = this;
        this.userservice.GetUserType().subscribe(function (x) { _this.UserTypeList = x; }, function (error) { return _this.error = error; });
    };
    UsersList.prototype.GetAccountType = function () {
        var _this = this;
        this.userservice.GetAccountType().subscribe(function (x) { _this.AccountTypeList = x; }, function (error) { return _this.error = error; });
    };
    UsersList.prototype.GetUserList = function () {
        //this.userservice.GetUserList().subscribe(x => { this.UserList = x; }, error => this.error = <any>error);
    };
    UsersList.prototype.SearchUserList = function () {
        var _this = this;
        var UserFilterControl = this.Users.value;
        this.userservice.GetUserList({
            FirstName: this.Users.controls['FirstName'].value,
            LastName: this.Users.controls['LastName'].value,
            EmailId: this.Users.controls['EmailId'].value,
            AccountNumber: this.Users.controls['AccountNumber'].value,
            UserTypeId: (this.Users.controls['UserTypeId'].value != null && this.Users.controls['UserTypeId'].value != '' ? this.Users.controls['UserTypeId'].value : 0),
            AccountTypeId: (this.Users.controls['AccountTypeId'].value != null && this.Users.controls['AccountTypeId'].value != '' ? this.Users.controls['AccountTypeId'].value : 0),
        })
            .subscribe(function (x) { _this.UserList = x; }, function (error) { return _this.error = error; });
    };
    UsersList.prototype.AfterInsertData = function (data) {
        if (data == "success") {
            this._confirmService.activate("Userid Updated Successfully.", "alertMsg");
        }
        else {
            this.alerts += '<span>' + data + '</span>';
            return false;
        }
        //if (this.closeflag) {
        //  this.close.emit(null);
        //}
        //else {
        //}
    };
    UsersList.prototype.ResetFormFields = function () {
        //this.ChangeUserIdFrm.reset()
        //this.ChangeUserIdFrm.controls['id'].setValue(this.user.Id)
        //this.ChangeUserIdFrm.controls['loginid'].setValue(this.user.LoginId)
        //this.ChangeUserIdFrm.controls['newloginid'].setValue('')
        //this.ChangeUserIdFrm.controls['confirmloginid'].setValue('')
        this.alerts = '';
    };
    UsersList = __decorate([
        core_1.Component({
            templateUrl: './users.component.html' // '../../../../../wwwroot/html/UpdateProfile/updateuserprofile.component.html'
        }),
        __metadata("design:paramtypes", [user_service_1.UserService, router_1.Router, forms_1.FormBuilder, http_1.Http,
            confirm_service_1.ConfirmService])
    ], UsersList);
    return UsersList;
}());
exports.UsersList = UsersList;
//# sourceMappingURL=users.component.js.map