webpackJsonp([18],{

/***/ 1479:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewBuilderModule", function() { return ViewBuilderModule; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__view_builder__ = __webpack_require__(1803);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_ionic_angular__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__ngx_translate_core__ = __webpack_require__(136);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__components_components_module__ = __webpack_require__(958);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__ncinga_sp_nsp_app_core_dist__ = __webpack_require__(7);
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 ViewBuilderModule = /** @class */ (function () {
    function ViewBuilderModule() {
    }
    ViewBuilderModule = __decorate([
        Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"])({
            declarations: [
                __WEBPACK_IMPORTED_MODULE_1__view_builder__["a" /* ViewBuilder */]
            ],
            imports: [
                __WEBPACK_IMPORTED_MODULE_5__ncinga_sp_nsp_app_core_dist__["j" /* CoreModule */],
                __WEBPACK_IMPORTED_MODULE_4__components_components_module__["a" /* ComponentsModule */],
                __WEBPACK_IMPORTED_MODULE_2_ionic_angular__["j" /* IonicPageModule */].forChild(__WEBPACK_IMPORTED_MODULE_1__view_builder__["a" /* ViewBuilder */]),
                __WEBPACK_IMPORTED_MODULE_3__ngx_translate_core__["b" /* TranslateModule */].forChild()
            ],
            exports: [
                __WEBPACK_IMPORTED_MODULE_1__view_builder__["a" /* ViewBuilder */]
            ],
            entryComponents: [
                __WEBPACK_IMPORTED_MODULE_1__view_builder__["a" /* ViewBuilder */]
            ]
        })
    ], ViewBuilderModule);
    return ViewBuilderModule;
}());

//# sourceMappingURL=view-builder.module.js.map

/***/ }),

/***/ 1803:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ViewBuilder; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ionic_angular__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_ngx_logger__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__view_builder_template__ = __webpack_require__(1804);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__components_classification_phase_one_classification_phase_one__ = __webpack_require__(983);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__components_basic_button_basic_button__ = __webpack_require__(982);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_ionic_angular_util_util__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__providers_shared_data_service_shared_data_service__ = __webpack_require__(44);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__providers_activity_log_activity_log__ = __webpack_require__(139);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__ncinga_sp_nsp_app_core_dist__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__candc_module__ = __webpack_require__(142);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__components_modals_sub_settings__ = __webpack_require__(986);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__ncinga_sp_nsp_app_core_dist_providers_business_context__ = __webpack_require__(14);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__providers_application_cache_service_app_cache_service__ = __webpack_require__(138);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__providers_masterdata_service_masterdata_service__ = __webpack_require__(199);
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);
};















var ViewBuilder = /** @class */ (function () {
    function ViewBuilder(navProvider, navParams, logger, sharedService, activityLogService, appState, modalCtrl, businessCtx, loadingCtrl, appCtx, appMasDa, alertCtrl, appCache) {
        this.navProvider = navProvider;
        this.navParams = navParams;
        this.logger = logger;
        this.sharedService = sharedService;
        this.activityLogService = activityLogService;
        this.appState = appState;
        this.modalCtrl = modalCtrl;
        this.businessCtx = businessCtx;
        this.loadingCtrl = loadingCtrl;
        this.appCtx = appCtx;
        this.appMasDa = appMasDa;
        this.alertCtrl = alertCtrl;
        this.appCache = appCache;
        this.pgTitle = 'Active Counters';
        this.evenRowData = [];
        this.oddRowData = [];
        this.demoArray = [];
        this.incre = 0;
        this.dupIncre = 0;
        this.component_Conf_Length = 0;
        this.sub_header = true;
        this.hasFmenu = false;
        this.btnTotals = {};
        this.subcription = [];
        this.view_config = this.navParams.get('conf');
        // this.logger.debug('>>>>>>>>>>listenForStateChanges conf', this.view_config);
        // this.appMasDa.initAppMasterData(this.view_config.masterDataList);
        this.tools = {
            line: true,
            menu: true,
            shift: true,
            user: true,
        };
        this.initEventListeners();
        // this.presentLoadingDefault();
    }
    ViewBuilder.prototype.ngOnInit = function () {
        this.view_config = this.navParams.get('conf');
        if (this.view_config) {
            this.appMasDa.setMsDtList(this.view_config.masterDataList);
            // this.pgTitle = this.view_config['title'];
            // this.sub_header = this.view_config['order_heading'];
            this.logger.debug('listenForStateChanges conf', this.view_config);
            this.components_descriptor = this.view_config.components_descriptor;
            this.component_Conf_Length = this.components_descriptor.length;
            this.confDataAssign();
            // this.setBtnDataStore();
            // enable floating menu
            if (this.view_config['floating_menu']) {
                if (this.view_config['floating_menu'].length > 0) {
                    this.hasFmenu = true;
                }
            }
        }
    };
    ViewBuilder.prototype.initEventListeners = function () {
        var _this = this;
        this.updateSubscription = this.appCache.updates.subscribe(function (res) {
            if (res) {
                // this.calculateTotals();
                if (res === 'START_LOADING') {
                    _this.presentLoadingDefault();
                }
                if (res === 'END_LOADING' && _this.loader) {
                    _this.loader.dismiss();
                }
            }
        });
    };
    ViewBuilder.prototype.ionViewDidLoad = function () {
        if (!Object(__WEBPACK_IMPORTED_MODULE_6_ionic_angular_util_util__["p" /* isUndefined */])(this.basicButton)) {
            this.basicButton.viewMapping();
            this.basicButton.checkAvaliability();
        }
        if (!Object(__WEBPACK_IMPORTED_MODULE_6_ionic_angular_util_util__["p" /* isUndefined */])(this.classificationOnePhase)) {
            this.classificationOnePhase.checkAvaliability();
        }
        // this.appDataEnterValidation();
        this.setBtnDataStore();
    };
    // add conf json data in to RowArray(oddRowData & evenRowData) //
    ViewBuilder.prototype.confDataAssign = function () {
        try {
            for (this.dupIncre; this.dupIncre < this.components_descriptor.length; this.dupIncre++) {
                if (this.component_Conf_Length > 1) {
                    this.demoArray = [];
                    this.incre = 0;
                    for (this.incre; this.incre < 2; this.incre++) {
                        this.demoArray.push(this.components_descriptor[this.incre + this.dupIncre]);
                        this.component_Conf_Length--;
                    }
                    this.evenRowData.push(this.demoArray);
                    this.dupIncre++;
                }
                else {
                    this.oddRowData.push(this.components_descriptor[this.dupIncre]);
                }
            }
        }
        catch (e) {
            this.logger.error(e);
        }
    };
    ViewBuilder.prototype.calculateTotals = function () {
        var _this = this;
        var sub = this.appCtx.getCurrentSubject();
        this.components_descriptor.forEach(function (btn) {
            var total = _this.appCache.calculateContextTotal(sub.id, btn.id);
            _this.btnTotals[btn.id] = total;
        });
        // this.logger.debug("TOTAL :", this.btnTotals);
        // this.logger.debug("TOTAL :", this.evenRowData);
    };
    // set button types for data store//
    ViewBuilder.prototype.setBtnDataStore = function () {
        try {
            this.logger.debug(JSON.stringify(this.sharedService.getSharedBtnService()));
            //  this.activityLogService.initMasterData();
            this.activityLogService.setActivityLogReferenceId();
            this.sharedService.saveReferenceToCache(__WEBPACK_IMPORTED_MODULE_10__candc_module__["b" /* CC_MOD_KEY */], 48);
            var ref = this.activityLogService.getActivityLogReferenceId();
            /*
             check ref id availability in cache
             */
            if (!this.sharedService.getReferenceFromCache(__WEBPACK_IMPORTED_MODULE_10__candc_module__["b" /* CC_MOD_KEY */])) {
                if (JSON.stringify(this.sharedService.getSharedBtnService()) === '{}') {
                    this.sharedService.generateSharedDataSrvKey();
                    for (var _i = 0, _a = this.components_descriptor; _i < _a.length; _i++) {
                        var dataSet = _a[_i];
                        this.activityLogService.initActivityLog(dataSet);
                    }
                }
            }
        }
        catch (e) {
            this.logger.error(e);
        }
    };
    /*
     save existing data in to cache
     */
    ViewBuilder.prototype.saveExsistingDataInToCache = function (type, data) {
        this.activityLogService.updateContextData(type, data);
        this.sharedService.saveReferenceToCache(__WEBPACK_IMPORTED_MODULE_10__candc_module__["b" /* CC_MOD_KEY */], 48);
        // this.setBtnDataStore();
    };
    /*
     * Floating menu controller
     * */
    ViewBuilder.prototype.floatingMenuHandler = function (conf) {
        try {
            switch (conf.type) {
                case 'page': {
                    this.navProvider.nextView(conf.next_view_ref, conf);
                    break;
                }
                case 'popup': {
                    var popup = this.modalCtrl.create(__WEBPACK_IMPORTED_MODULE_11__components_modals_sub_settings__["a" /* SubSettingsModal */], { conf: conf }, { 'cssClass': 'cc_subsettings' });
                    popup.present();
                    break;
                }
            }
        }
        catch (e) {
            this.logger.error('Action not found ');
        }
    };
    /*
     application validation part according to subject select and member count
     */
    ViewBuilder.prototype.appDataEnterValidation = function () {
        this.logger.trace('view conf current page', this.view_config);
        if (this.view_config) {
            if (this.view_config.subject_validation) {
                var sub = this.sharedService.getSubject();
                if (sub === null) {
                    this.btnDisabled = true;
                    var subj = this.appCtx.getCurrentSubject();
                    this.sharedService.setSubject(subj.id);
                }
                else {
                    this.btnDisabled = false;
                }
                this.logger.trace('validation part for member and subject', sub);
            }
            if (this.view_config.member_validation) {
                var mem = this.sharedService.getMemCnt();
                if (mem === null) {
                    this.btnDisabled = true;
                    this.presentAlert();
                }
                else {
                    this.btnDisabled = false;
                }
                this.logger.trace('validation part for member and subject', mem);
            }
        }
    };
    /*
     alert present for validation before data enter
     */
    ViewBuilder.prototype.presentAlert = function () {
        var alert = this.alertCtrl.create({
            title: 'Before Capture Data',
            subTitle: 'Please add member count before data entering',
            buttons: ['Cancel']
        });
        alert.present();
        setTimeout(function () {
            alert.dismiss();
        }, 2000);
    };
    ViewBuilder.prototype.ngOnDestroy = function () {
        var _this = this;
        try {
            if (this.updateSubscription) {
                this.updateSubscription.unsubscribe();
            }
            this.subcription.forEach(function (val) {
                if (val) {
                    _this.appState.unsubscribe(val);
                }
            });
        }
        catch (e) {
            this.logger.debug(e);
        }
    };
    ViewBuilder.prototype.presentLoadingDefault = function () {
        this.loader = this.loadingCtrl.create({
            content: 'Please wait...',
            duration: 2000
        });
        this.loader.present();
    };
    __decorate([
        Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewChild"])(__WEBPACK_IMPORTED_MODULE_4__components_classification_phase_one_classification_phase_one__["a" /* ClassificationPhaseOneComponent */]),
        __metadata("design:type", Object)
    ], ViewBuilder.prototype, "classificationOnePhase", void 0);
    __decorate([
        Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewChild"])(__WEBPACK_IMPORTED_MODULE_5__components_basic_button_basic_button__["a" /* BasicButtonComponent */]),
        __metadata("design:type", Object)
    ], ViewBuilder.prototype, "basicButton", void 0);
    ViewBuilder = __decorate([
        Object(__WEBPACK_IMPORTED_MODULE_1_ionic_angular__["i" /* IonicPage */])(),
        Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({
            selector: 'counting-view-builder',
            template: __WEBPACK_IMPORTED_MODULE_3__view_builder_template__["a" /* VIEW_BUILDER_HTML */]
        }),
        __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_9__ncinga_sp_nsp_app_core_dist__["m" /* NavigationManager */], __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["p" /* NavParams */], __WEBPACK_IMPORTED_MODULE_2_ngx_logger__["b" /* NGXLogger */],
            __WEBPACK_IMPORTED_MODULE_7__providers_shared_data_service_shared_data_service__["a" /* SharedDataProvider */], __WEBPACK_IMPORTED_MODULE_8__providers_activity_log_activity_log__["a" /* ActivityLogProvider */],
            __WEBPACK_IMPORTED_MODULE_9__ncinga_sp_nsp_app_core_dist__["e" /* ApplicationService */], __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["m" /* ModalController */],
            __WEBPACK_IMPORTED_MODULE_12__ncinga_sp_nsp_app_core_dist_providers_business_context__["a" /* BusinessContext */],
            __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["k" /* LoadingController */],
            __WEBPACK_IMPORTED_MODULE_9__ncinga_sp_nsp_app_core_dist__["d" /* ApplicationContext */],
            __WEBPACK_IMPORTED_MODULE_14__providers_masterdata_service_masterdata_service__["a" /* AppMasterDataCntrl */],
            __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["a" /* AlertController */],
            __WEBPACK_IMPORTED_MODULE_13__providers_application_cache_service_app_cache_service__["a" /* AppCacheService */]])
    ], ViewBuilder);
    return ViewBuilder;
}());

//# sourceMappingURL=view-builder.js.map

/***/ }),

/***/ 1804:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return VIEW_BUILDER_HTML; });
/**
 * Created by shadeeka on 5/2/18.
 */
var VIEW_BUILDER_HTML = "\n\n<ion-header>\n       <common-main-header [title]=\"view_config?.title\" [tools]=\"tools\"\n       [header_disabled]=\"view_config?.subject_disable\"></common-main-header>\n</ion-header>\n\n<ion-content class=\"candclanging-page\">\n    <ion-grid no-padding *ngIf=\"view_config?.order_heading\">\n        <ion-row class=\"summary-row\">\n            <ion-col>\n                <core-domain-header></core-domain-header>\n            </ion-col>\n        </ion-row>\n    </ion-grid>\n\n    <ion-grid class=\"grid-content\">\n        <ion-row *ngFor=\"let conf of evenRowData\">\n            <ion-col class=\"btn-pad\" *ngFor=\"let subConf of conf\" col-12 col-lg-6 col-md-6>\n                <basic-button *ngIf=\"subConf.button_type === 'basic_button'\" [btnConfig]=\"subConf\" ></basic-button>\n                <classification-phase-one *ngIf=\"subConf.button_type === 'classification_phase_one'\" [btnConfig]=\"subConf\">\n                </classification-phase-one>\n            </ion-col>\n        </ion-row>\n        <ion-row>\n            <ion-col *ngFor=\"let conf of oddRowData\" col-12 offset-lg-3 offset-md-3 col-lg-6 col-md-6>\n                <basic-button *ngIf=\"conf.button_type === 'basic_button'\" [btnConfig]=\"conf\"></basic-button>\n                <classification-phase-one *ngIf=\"conf.button_type === 'classification_phase_one'\" [btnConfig]=\"conf\">\n                </classification-phase-one>\n            </ion-col>\n        </ion-row>\n    </ion-grid>\n\n<ion-fab right bottom class=\"flting-btn-main\">\n    <button ion-fab color=\"dark\"><ion-icon name=\"arrow-dropleft\"></ion-icon></button>\n    <ion-fab-list side=\"left\">\n      <button class=\"sub-btn\" color=\"dark\" ion-fab *ngFor=\"let item of view_config?.floating_menu\" [title]=\"item.name\"\n      (click)=\"floatingMenuHandler(item)\" >\n      <ion-icon [name]=\"item.icon\"></ion-icon></button>\n    </ion-fab-list>\n  </ion-fab>\n</ion-content>";
//# sourceMappingURL=view-builder-template.js.map

/***/ })

});
//# sourceMappingURL=18.js.map