(window["webpackJsonp"] = window["webpackJsonp"] || []).push([["app-pages-cadastro-cadastros-auxiliares-cadastros-auxiliares-module"],{

/***/ "./node_modules/raw-loader/dist/cjs.js!./src/app/pages/cadastro/cadastros-auxiliares/cadastros-auxiliares.component.html":
/*!*******************************************************************************************************************************!*\
  !*** ./node_modules/raw-loader/dist/cjs.js!./src/app/pages/cadastro/cadastros-auxiliares/cadastros-auxiliares.component.html ***!
  \*******************************************************************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony default export */ __webpack_exports__["default"] = ("<div class=\"row mb-4\">\r\n    <div class=\"col-lg-12\">\r\n        <div class=\"card\">\r\n            <div class=\"row\">\r\n                <div class=\"col-12\">\r\n                    <input type=\"text\" \r\n                           class=\"form-control\" \r\n                           placeholder=\"{{ 'labels.filtrar' | translate }}\"\r\n                           [(ngModel)]=\"filtro\"\r\n                           (keyup)=\"getDados()\"\r\n                           autofocus>\r\n                </div>\r\n            </div>\r\n        </div>\r\n    </div>\r\n</div>\r\n<div class=\"border shadow\">\r\n    <div class=\"d-flex flex-row div.flex-wrap bd-highlight mb-3\">\r\n        <div class=\"col-12 d-flex flex-wrap\" [innerHTML]=\"htmlOut | safeHtml\">\r\n        </div>\r\n    </div>\r\n</div>\r\n");

/***/ }),

/***/ "./src/app/pages/cadastro/cadastros-auxiliares/cadastros-auxiliares.component.ts":
/*!***************************************************************************************!*\
  !*** ./src/app/pages/cadastro/cadastros-auxiliares/cadastros-auxiliares.component.ts ***!
  \***************************************************************************************/
/*! exports provided: CadastrosAuxiliaresComponent */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CadastrosAuxiliaresComponent", function() { return CadastrosAuxiliaresComponent; });
/* harmony import */ var _shared_services_auth_auth_service__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../../../shared/services/auth/auth.service */ "./src/app/shared/services/auth/auth.service.ts");
/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
/* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/router */ "./node_modules/@angular/router/fesm5/router.js");
/* harmony import */ var app_app_settings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! app/app.settings */ "./src/app/app.settings.ts");
/* harmony import */ var _pages_admin_corporate_corporate_service__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../pages/admin/corporate/corporate.service */ "./src/app/pages/admin/corporate/corporate.service.ts");
/* harmony import */ var _shared_services_funcoes_string_utils_string_utils_service__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../shared/services/funcoes/string-utils/string-utils.service */ "./src/app/shared/services/funcoes/string-utils/string-utils.service.ts");
/* harmony import */ var _shared_services_message_message_service__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../shared/services/message/message.service */ "./src/app/shared/services/message/message.service.ts");
/* harmony import */ var _login_login_service__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../login/login.service */ "./src/app/pages/login/login.service.ts");
var __decorate = (undefined && undefined.__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 = (undefined && undefined.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [op[0] & 2, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
};
var __importDefault = (undefined && undefined.__importDefault) || function (mod) {
  return (mod && mod.__esModule) ? mod : { "default": mod };
};








var CadastrosAuxiliaresComponent = /** @class */ (function () {
    function CadastrosAuxiliaresComponent(appSettings, cdRef, elRef, messageService, router, stringUtilsService, loginService, corporate) {
        var _this = this;
        this.appSettings = appSettings;
        this.cdRef = cdRef;
        this.elRef = elRef;
        this.messageService = messageService;
        this.router = router;
        this.stringUtilsService = stringUtilsService;
        this.loginService = loginService;
        this.corporate = corporate;
        this.filtro = '';
        this.htmlOut = '';
        this.selectedCardId = 0;
        this.navegateToUrl = function (linkUrl) {
            var url = _this.router.url;
            if (url.indexOf('popup/') >= 0) {
                linkUrl.currentTarget.rel = linkUrl.currentTarget.rel.replace('pages', 'popup');
            }
            _this.router.navigate([linkUrl.currentTarget.rel]);
        };
        this.hasDados = false;
    }
    CadastrosAuxiliaresComponent.prototype.ngOnInit = function () {
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, this.appSettings.getMenusAsync()];
                    case 1:
                        _a.sent();
                        this.listaMenus = this.appSettings.settings.menus;
                        this.filtro = '';
                        this.getDados();
                        return [2 /*return*/];
                }
            });
        });
    };
    CadastrosAuxiliaresComponent.prototype.ngAfterViewInit = function () {
        this.addNavegate();
    };
    CadastrosAuxiliaresComponent.prototype.addNavegate = function () {
        var _this = this;
        this.cdRef.detectChanges();
        var aElements = this.elRef.nativeElement.querySelectorAll('a');
        aElements.forEach(function (element) {
            var valueLink = element.rel;
            element.addEventListener('click', _this.navegateToUrl.bind(valueLink));
        });
        this.cdRef.detectChanges();
    };
    CadastrosAuxiliaresComponent.prototype.getDados = function () {
        this.drawItens(this.listaMenus);
    };
    CadastrosAuxiliaresComponent.prototype.drawItens = function (listMenus) {
        var _this = this;
        var parents = [];
        var auxiliares = listMenus.filter(function (m) { return m.apresenta === "Auxiliares"; }).map(function (m) { return m.id; }).sort();
        var listChilds = this.listaMenus
            .filter(function (v) { return _this.stringUtilsService.exist(v["descricao"], _this.filtro); })
            .sort(function (a, b) {
            if (a.descricao > b.descricao) {
                return 1;
            }
            else {
                return -1;
            }
        });
        auxiliares.forEach(function (element) {
            parents = listMenus.filter(function (m) { return m.parentId === element; }).map(function (m) { return m.id; });
        });
        var numItens = parents.length;
        var contentResult = '';
        var _loop_1 = function (i) {
            var item = listMenus.find(function (m) { return m.id === parents[i]; });
            var hasChilds = (listChilds.filter(function (m) { return m.parentId === item.id; }).length > 0);
            var permissao = false;
            if (_shared_services_auth_auth_service__WEBPACK_IMPORTED_MODULE_0__["AuthService"].isPoweuser() && (item.apresenta === "Admin" || item.apresenta === "Todos")) {
                permissao = true;
            }
            else if (!_shared_services_auth_auth_service__WEBPACK_IMPORTED_MODULE_0__["AuthService"].isPoweuser() && (item.apresenta === "Client" || item.apresenta === "Todos")) {
                permissao = true;
            }
            if (hasChilds && permissao) {
                contentResult += '<div class="col-lg-4 col-md-6 mb-2">';
                contentResult += '<ul class="list-unstyled">';
                contentResult += '<li class="liroot" style="cursor: pointer">';
                contentResult += '<button type="button" class="btn btn-block btn-outline-secondary" data-toggle="collapse" data-target="#' + item.id + '">';
                var adescricao = item.title.split('.');
                if (adescricao.length === 2) {
                    contentResult += this_1.messageService.getTranslates(adescricao[0], adescricao[1]) + '</a></li></ul>';
                }
                else {
                    contentResult += '<strong>' + item.descricao + '</strong>';
                }
                contentResult += '</button>';
                contentResult += '<div class="collapse show" id="' + item.id + '">';
                contentResult += this_1.getMenusParent(item.id, listChilds);
                contentResult += '</div>';
                contentResult += '</li>';
                contentResult += '</ul>';
                contentResult += '</div>';
            }
        };
        var this_1 = this;
        for (var i = 0; i < numItens; i++) {
            _loop_1(i);
        }
        this.htmlOut = contentResult;
        this.addNavegate();
    };
    CadastrosAuxiliaresComponent.prototype.getMenusParent = function (menuId, listChilds) {
        var _this = this;
        var strRetorno = '';
        // const childs = listChilds.filter(m => m.parentId === menuId);
        var childs = listChilds
            .filter(function (m) { return m.parentId === menuId; })
            .sort(function (a, b) {
            if (a.descricao > b.descricao) {
                return 1;
            }
            else {
                return -1;
            }
        });
        childs.forEach(function (elem) {
            var hasChilds = (_this.listaMenus.filter(function (m) { return m.parentId === elem.id; }).length > 0);
            var permissao = false;
            if (_shared_services_auth_auth_service__WEBPACK_IMPORTED_MODULE_0__["AuthService"].isPoweuser() && (elem.apresenta === "Admin" || elem.apresenta === "Todos")) {
                permissao = true;
            }
            else if (!_shared_services_auth_auth_service__WEBPACK_IMPORTED_MODULE_0__["AuthService"].isPoweuser() && (elem.apresenta === "Client" || elem.apresenta === "Todos")) {
                permissao = true;
            }
            if (permissao) {
                if (!hasChilds) {
                    strRetorno += '<ul class="list-unstyled"><li>';
                    strRetorno += '<a class="btn btn-link" rel="' + elem.routerLink + '"><i class="fa fa-angle-right"></i>&nbsp;';
                    var adescricao = elem.title.split('.');
                    if (adescricao.length === 2) {
                        strRetorno += _this.messageService.getTranslates(adescricao[0], adescricao[1]) + '</a></li></ul>';
                    }
                    else {
                        strRetorno += adescricao + '</a></li></ul>';
                    }
                }
                else {
                    strRetorno += '<ul class="list-unstyled"><li><strong>' + elem.descricao + '</strong>';
                    strRetorno += _this.getMenusParent(elem.id, listChilds);
                    strRetorno += '</li></ul>';
                }
            }
        });
        return strRetorno;
    };
    CadastrosAuxiliaresComponent.ctorParameters = function () { return [
        { type: app_app_settings__WEBPACK_IMPORTED_MODULE_3__["AppSettings"] },
        { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ChangeDetectorRef"] },
        { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"] },
        { type: _shared_services_message_message_service__WEBPACK_IMPORTED_MODULE_6__["MessageService"] },
        { type: _angular_router__WEBPACK_IMPORTED_MODULE_2__["Router"] },
        { type: _shared_services_funcoes_string_utils_string_utils_service__WEBPACK_IMPORTED_MODULE_5__["StringUtilsService"] },
        { type: _login_login_service__WEBPACK_IMPORTED_MODULE_7__["LoginService"] },
        { type: _pages_admin_corporate_corporate_service__WEBPACK_IMPORTED_MODULE_4__["CorporateService"] }
    ]; };
    CadastrosAuxiliaresComponent = __decorate([
        Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Component"])({
            selector: "app-cadastros-auxiliares",
            template: __importDefault(__webpack_require__(/*! raw-loader!./cadastros-auxiliares.component.html */ "./node_modules/raw-loader/dist/cjs.js!./src/app/pages/cadastro/cadastros-auxiliares/cadastros-auxiliares.component.html")).default,
            encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ViewEncapsulation"].None
        }),
        __metadata("design:paramtypes", [app_app_settings__WEBPACK_IMPORTED_MODULE_3__["AppSettings"],
            _angular_core__WEBPACK_IMPORTED_MODULE_1__["ChangeDetectorRef"],
            _angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"],
            _shared_services_message_message_service__WEBPACK_IMPORTED_MODULE_6__["MessageService"],
            _angular_router__WEBPACK_IMPORTED_MODULE_2__["Router"],
            _shared_services_funcoes_string_utils_string_utils_service__WEBPACK_IMPORTED_MODULE_5__["StringUtilsService"],
            _login_login_service__WEBPACK_IMPORTED_MODULE_7__["LoginService"],
            _pages_admin_corporate_corporate_service__WEBPACK_IMPORTED_MODULE_4__["CorporateService"]])
    ], CadastrosAuxiliaresComponent);
    return CadastrosAuxiliaresComponent;
}());



/***/ }),

/***/ "./src/app/pages/cadastro/cadastros-auxiliares/cadastros-auxiliares.module.ts":
/*!************************************************************************************!*\
  !*** ./src/app/pages/cadastro/cadastros-auxiliares/cadastros-auxiliares.module.ts ***!
  \************************************************************************************/
/*! exports provided: CadastrosAuxiliaresModule */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CadastrosAuxiliaresModule", function() { return CadastrosAuxiliaresModule; });
/* harmony import */ var _cadastros_auxiliares_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cadastros-auxiliares.component */ "./src/app/pages/cadastro/cadastros-auxiliares/cadastros-auxiliares.component.ts");
/* harmony import */ var _shared_shared_module__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../shared/shared.module */ "./src/app/shared/shared.module.ts");
/* harmony import */ var _cadastros_auxiliares_routing_module__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./cadastros-auxiliares.routing.module */ "./src/app/pages/cadastro/cadastros-auxiliares/cadastros-auxiliares.routing.module.ts");
/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
var __decorate = (undefined && undefined.__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 __importDefault = (undefined && undefined.__importDefault) || function (mod) {
  return (mod && mod.__esModule) ? mod : { "default": mod };
};




var CadastrosAuxiliaresModule = /** @class */ (function () {
    function CadastrosAuxiliaresModule() {
    }
    CadastrosAuxiliaresModule = __decorate([
        Object(_angular_core__WEBPACK_IMPORTED_MODULE_3__["NgModule"])({
            imports: [_shared_shared_module__WEBPACK_IMPORTED_MODULE_1__["SharedModule"], _cadastros_auxiliares_routing_module__WEBPACK_IMPORTED_MODULE_2__["CadastrosAuxiliaresRoutingModule"]],
            declarations: [_cadastros_auxiliares_component__WEBPACK_IMPORTED_MODULE_0__["CadastrosAuxiliaresComponent"]]
        })
    ], CadastrosAuxiliaresModule);
    return CadastrosAuxiliaresModule;
}());



/***/ }),

/***/ "./src/app/pages/cadastro/cadastros-auxiliares/cadastros-auxiliares.routing.module.ts":
/*!********************************************************************************************!*\
  !*** ./src/app/pages/cadastro/cadastros-auxiliares/cadastros-auxiliares.routing.module.ts ***!
  \********************************************************************************************/
/*! exports provided: CadastrosAuxiliaresRoutingModule */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CadastrosAuxiliaresRoutingModule", function() { return CadastrosAuxiliaresRoutingModule; });
/* harmony import */ var _cadastros_auxiliares_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cadastros-auxiliares.component */ "./src/app/pages/cadastro/cadastros-auxiliares/cadastros-auxiliares.component.ts");
/* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/router */ "./node_modules/@angular/router/fesm5/router.js");
/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
var __decorate = (undefined && undefined.__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 __importDefault = (undefined && undefined.__importDefault) || function (mod) {
  return (mod && mod.__esModule) ? mod : { "default": mod };
};



var MRoutes = [
    {
        path: "",
        component: _cadastros_auxiliares_component__WEBPACK_IMPORTED_MODULE_0__["CadastrosAuxiliaresComponent"],
        data: { breadcrumb: "cadastrosAuxiliares" }
    }
];
var CadastrosAuxiliaresRoutingModule = /** @class */ (function () {
    function CadastrosAuxiliaresRoutingModule() {
    }
    CadastrosAuxiliaresRoutingModule = __decorate([
        Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["NgModule"])({
            imports: [_angular_router__WEBPACK_IMPORTED_MODULE_1__["RouterModule"].forChild(MRoutes)],
            exports: [_angular_router__WEBPACK_IMPORTED_MODULE_1__["RouterModule"]]
        })
    ], CadastrosAuxiliaresRoutingModule);
    return CadastrosAuxiliaresRoutingModule;
}());



/***/ })

}]);
//# sourceMappingURL=app-pages-cadastro-cadastros-auxiliares-cadastros-auxiliares-module.js.map