import { Component } from '@angular/core';
import { MatLegacyTableDataSource as MatTableDataSource } from '@angular/material/legacy-table';
import { HEADER_DATA } from '../shared/constant/app.constant';
import * as i0 from "@angular/core";
import * as i1 from "../shared/services/event.service";
import * as i2 from "../shared/services/shared.service";
import * as i3 from "@angular/material/snack-bar";
import * as i4 from "@angular/router";
import * as i5 from "@angular/common";
import * as i6 from "../../components/role-mapping-generation/role-mapping-generation.component";
import * as i7 from "../../components/role-mapping-list/role-mapping-list.component";
export class InitialScreenComponent {
    constructor(eventSvc, sharedService, snackBar, router) {
        this.eventSvc = eventSvc;
        this.sharedService = sharedService;
        this.snackBar = snackBar;
        this.router = router;
        this.headerData = HEADER_DATA;
        this.title = 'sunbird-cb-staticweb';
        this.selectedValue = '';
        this.searchText = '';
        this.displayedColumns = ['RequestId', 'title', 'requestor', 'requestType',
            'requestStatus', 'assignee', 'requestedOn', 'interests', 'action'];
        this.selectedMinistryType = 'center';
        this.ministryData = [];
        this.ministryFullData = [];
        this.sectorData = [
            {
                value: 'Women and child development'
            },
            {
                value: 'Rural development'
            },
            {
                value: 'Urben development'
            },
            {
                value: 'Healthcare'
            },
            {
                value: 'Agriculture'
            },
            {
                value: 'Others'
            }
        ];
        this.nextStep = 'initial';
        this.loginSuccess = false;
        this.cbpFinalObj = {};
        this.userEmail = '';
        this.dataSource = new MatTableDataSource([]);
        this.isMaintenancePage = window.location.href.includes('/maintenance');
    }
    ngOnInit() {
        this.sharedService.loginSuccess.subscribe((data) => {
            if (!data) {
                this.nextStep = 'initial';
                localStorage.clear();
            }
        });
        this.loginSuccess = this.sharedService.checkIfLogin();
        if (this.loginSuccess) {
            this.userEmail = localStorage.getItem('userEmail');
        }
        this.cbpFinalObj = this.sharedService.getCBPPlanLocalStorage();
        if (this.cbpFinalObj && this.cbpFinalObj?.ministry && (this.cbpFinalObj?.ministry?.sbOrgType === 'ministry' || this.cbpFinalObj?.ministry?.sbOrgType === 'state') &&
            this.cbpFinalObj?.role_mapping_generation?.length) {
            this.nextStep = 'role-mapping';
        }
        else {
            this.nextStep = 'initial';
        }
        //  console.log('this.nextStep',this.nextStep)
        //  console.log('this.sharedService.cb', this.sharedService.cbpPlanFinalObj)
        if (!localStorage.getItem('userEmail')) {
            this.snackBar.open('Session expired. Please login again.', 'X', {
                duration: 3000,
                panelClass: ['snackbar-error']
            });
            this.router.navigate(['/']);
        }
    }
    successRoleMapping(event) {
        this.nextStep = 'role-mapping';
        this.formData = event;
        // console.log('event', event)
    }
    alreadyAvailableRoleMapping(event) {
        this.nextStep = 'role-mapping';
        // console.log('event', event)
        this.formData = event;
    }
    moveToInitialScreen(event) {
        if (event === 'add') {
            this.nextStep = 'initial';
        }
        else if (event === 'edit') {
            this.nextStep = 'initial';
        }
    }
    loginSuccessStatus(event) {
        this.loginSuccess = event;
        this.nextStep = 'initial';
    }
    logout() {
        console.log('Logout successfully');
        this.sharedService.logout().subscribe({
            next: (res) => {
                this.snackBar.open('You are logout successfully', 'X', {
                    duration: 3000,
                    panelClass: ['snackbar-success']
                });
                this.router.navigate(['/']);
                window.location.reload();
                localStorage.clear();
                this.loginSuccess = false;
                this.nextStep = 'initial';
            },
            error: (error) => {
                this.snackBar.open(error?.error?.detail, 'X', {
                    duration: 3000,
                    panelClass: ['snackbar-error']
                });
            }
        });
    }
    goToUploadDocument() {
        this.router.navigate(['/ai/upload-documents']);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InitialScreenComponent, deps: [{ token: i1.EventService }, { token: i2.SharedService }, { token: i3.MatSnackBar }, { token: i4.Router }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: InitialScreenComponent, selector: "initial-screen", ngImport: i0, template: "<div *ngIf=\"nextStep === 'initial'\">\n    <app-role-mapping-generation [loginStatusFlag]=\"loginSuccess\" (successRoleMapping)=\"successRoleMapping($event)\" (loginSuccess)=\"loginSuccessStatus($event)\" (alreadyAvailableRoleMapping)=\"alreadyAvailableRoleMapping($event)\"></app-role-mapping-generation>\n</div>\n<div *ngIf=\"nextStep === 'role-mapping'\">\n    <app-role-mapping-list [formData]=\"formData\" (moveToInitialScreen)=\"moveToInitialScreen($event)\"></app-role-mapping-list>\n</div>", styles: [".container{margin:10px auto}.sub-heading p{color:#000;font-family:Montserrat;font-size:16px;font-style:normal;font-weight:600;line-height:normal}.radio-label{color:#000;font-family:Lato;font-size:16px;font-style:normal;font-weight:400;line-height:normal}.radio-btn-group{display:flex;width:32px;height:32px;padding:2px;gap:10px}.label{color:var(--Body-Text-Body-Color, #212529);font-family:Lato;font-size:14px;font-style:normal;font-weight:700;line-height:150%}::ng-deep mat-form-field{background-color:#fff!important;border-radius:25px!important;padding-left:12px;padding-right:12px;height:42px;width:100%}::ng-deep mat-select{border-radius:25px!important;background-color:#fff!important}::ng-deep .mat-select-panel{background-color:#fff!important}::ng-deep .mat-select-panel .mat-option{border-radius:0!important}::ng-deep mat-form-field .mat-form-field-underline{display:none!important}::ng-deep mat-select .mat-select-placeholder{color:#0006;font-family:Lato;font-size:14px;font-style:normal;font-weight:400;line-height:normal}::ng-deep mat-select .mat-select-value-text{color:#000;font-family:Lato;font-size:14px;font-style:normal;font-weight:400;line-height:normal;line-height:normal!important;padding-top:0!important;padding-bottom:0!important}::ng-deep mat-select .mat-select-value{display:flex!important;align-items:center!important;height:100%!important}.additional-details textarea{display:flex;padding:16px 16px 0;flex-direction:column;align-items:flex-start;gap:10px;flex:1 0 0;align-self:stretch;width:100%;color:#0006;font-family:Lato;font-size:14px;font-style:normal;font-weight:400;line-height:normal;resize:none}.section-header{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.btn-disable{border-radius:var(--Radius-Full-Round, 9999999px);opacity:.4;background:var(--Primary-KB-Primary-Light, #1B4CA1);color:var(--white-kb-white-100, #FFF);text-align:center;font-family:Lato;font-size:14px;font-style:normal;font-weight:700;line-height:normal;display:flex;height:32px;padding:0 16px;justify-content:center;align-items:center;gap:8px;border:none}.btn-group{display:flex;flex-direction:row;justify-content:space-between}.pl-2{padding-left:10px}.search-filter-section{display:flex;flex-direction:row;justify-content:space-between}.search .rsearch{position:relative}.search .search-icon{position:absolute;top:15px;font-size:20px;left:10px}.search .sinput{border-radius:4px;border:1px solid #d5d0d0;padding:15px 36px;font:400 14px Lato}.select-map-route-container{display:flex;flex-direction:row}.selected-mapping-route p{color:#1b4ca1;font-family:Lato;font-size:20px;font-style:normal;font-weight:400;line-height:normal;text-decoration-line:underline;text-decoration-style:solid;-webkit-text-decoration-skip:ink;text-decoration-skip-ink:auto;text-decoration-thickness:auto;text-underline-offset:auto;text-underline-position:from-font}.edit-plan{display:flex;padding:4px;justify-content:center;align-items:center;gap:8px;border-radius:4px;background:#1b4ca129;color:#1b4ca1;font-family:Lato;font-size:14px;font-style:normal;font-weight:400;line-height:normal;margin-left:10px}.search-container{display:flex;flex-direction:row}.course-container{display:flex;width:100%;padding:16px;flex-direction:column;align-items:flex-start;gap:24px;grid-row:2/span 1;grid-column:1/span 1;border-radius:12px;border:1px solid var(--borders-black-border-16-black, rgba(0, 0, 0, .16));background:#fff}.course-header{display:flex;flex-direction:row;justify-content:space-between;width:100%}.course-pill{display:flex;height:24px;padding:8px;align-items:center;gap:4px;border-radius:16px;border:1px solid var(--borders-border-fill-focussed-4-light-100, #EF951E);background:#fefaf4}.ai-recommened-pill{display:flex;padding:4px 8px;align-items:center;gap:8px;border-radius:var(--Radius-4, 4px);border:1px solid #1B4CA1;background:#1b4ca129}.igot-platform-pill{display:flex;padding:4px 8px;align-items:center;gap:8px;border-radius:var(--Radius-4, 4px);border:1px solid #EF951E;background:#ef951e29}.course-title{color:var(--Primary-KB-Primary-Light, #1B4CA1);font-family:Montserrat;font-size:20px;font-style:normal;font-weight:600;line-height:30px}.course-desc{color:#0009;font-family:Lato;font-size:14px;font-style:normal;font-weight:400;line-height:normal}.relevancy,.competencies-matched{color:var(--accessbility-shades-with-opacity-kb-greys-black-60, rgba(0, 0, 0, .6));font-family:Lato;font-size:14px;font-style:normal;font-weight:400;line-height:normal;align-items:center}.percentage{color:#1d8923;font-family:Lato;font-size:14px;font-style:normal;font-weight:800;line-height:normal}.relevancy-container,.competencies-matched-container{display:flex;flex-direction:row;align-items:center}.dash{padding:0 5px}::ng-deep .mat-radio-checked .mat-radio-inner-circle{background:#1b4ca1!important}.course-list-container{display:flex;flex-wrap:wrap;gap:16px}.course-list-item{flex:0 0 48%;box-sizing:border-box;border:1px solid #ccc;padding:16px;background-color:#fff;border-radius:8px}.checked-course-container{display:flex}.ml-2{margin-left:8px}::ng-deep .mat-checkbox-checked .mat-checkbox-background{background:#1b4ca1!important}.ai-recommened-pill-text,.igot-platform-pill-text{color:#1b4ca1;font-family:Lato;font-size:12px;font-style:normal;font-weight:700;line-height:normal}.course-pill-text{color:var(--accessbility-shades-without-opacity-kb-greys-black-87, #212121);text-align:center;font-family:Poppins;font-size:12px;font-style:normal;font-weight:400;line-height:normal}.ai-loader-icon img,.igot-platform-icon img{width:15.714px;height:15.714px;flex-shrink:0}.competency-container{display:flex}.outside-layer{display:flex;padding:4px 12px;justify-content:center;align-items:center;gap:16px;border-radius:12px 4px 4px 12px;border-left:2px solid #F8B861;background:#fde8cc;width:132px}.suggest-courses-header{display:flex;flex-direction:row;justify-content:space-between}.suggest-course-control{display:flex;flex-direction:row}.course-card-container{width:172px;border-radius:3.307px;border:.827px solid var(--borders-border-8-black, rgba(0, 0, 0, .08));background-color:#fff}.highlight-ai{font-family:Montserrat;font-size:24px;font-style:normal;font-weight:600;line-height:normal;background:linear-gradient(90deg,#3b27ff,#2de3d6);background-clip:text;-webkit-background-clip:text;color:transparent;-webkit-text-fill-color:transparent;display:inline-block}.ai-loader-icon-medium img{width:40px;height:40px;flex-shrink:0}.heading{color:#000;font-family:Montserrat;font-size:20px;font-style:normal;font-weight:600;line-height:normal;margin:10px 0}.progress-popup{display:flex;flex-direction:column;justify-content:center;align-items:center}.progress-popup .desc{color:#000000de;text-align:center;font-family:Lato;font-size:14px;font-style:normal;font-weight:400;line-height:normal}.pl-10{padding-left:20px}.profile-pic{width:42px;height:24px;object-fit:cover;border-radius:50%;margin-top:-4px}.header-container{display:flex;flex-direction:row;justify-content:space-between;height:85px;box-shadow:0 4px 6px -1px #0000001a;background:#fff}.right-container{display:flex;margin-right:40px;gap:16px}.left-container{display:flex;gap:8px;width:100%;margin-left:10px}.h-50{height:100%!important}.mb-1{margin-bottom:1rem!important}.cursor-pointer{cursor:pointer}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i6.RoleMappingGenerationComponent, selector: "app-role-mapping-generation", inputs: ["loginStatusFlag"], outputs: ["successRoleMapping", "alreadyAvailableRoleMapping", "loginSuccess"] }, { kind: "component", type: i7.RoleMappingListComponent, selector: "app-role-mapping-list", inputs: ["formData"], outputs: ["moveToInitialScreen"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InitialScreenComponent, decorators: [{
            type: Component,
            args: [{ selector: 'initial-screen', template: "<div *ngIf=\"nextStep === 'initial'\">\n    <app-role-mapping-generation [loginStatusFlag]=\"loginSuccess\" (successRoleMapping)=\"successRoleMapping($event)\" (loginSuccess)=\"loginSuccessStatus($event)\" (alreadyAvailableRoleMapping)=\"alreadyAvailableRoleMapping($event)\"></app-role-mapping-generation>\n</div>\n<div *ngIf=\"nextStep === 'role-mapping'\">\n    <app-role-mapping-list [formData]=\"formData\" (moveToInitialScreen)=\"moveToInitialScreen($event)\"></app-role-mapping-list>\n</div>", styles: [".container{margin:10px auto}.sub-heading p{color:#000;font-family:Montserrat;font-size:16px;font-style:normal;font-weight:600;line-height:normal}.radio-label{color:#000;font-family:Lato;font-size:16px;font-style:normal;font-weight:400;line-height:normal}.radio-btn-group{display:flex;width:32px;height:32px;padding:2px;gap:10px}.label{color:var(--Body-Text-Body-Color, #212529);font-family:Lato;font-size:14px;font-style:normal;font-weight:700;line-height:150%}::ng-deep mat-form-field{background-color:#fff!important;border-radius:25px!important;padding-left:12px;padding-right:12px;height:42px;width:100%}::ng-deep mat-select{border-radius:25px!important;background-color:#fff!important}::ng-deep .mat-select-panel{background-color:#fff!important}::ng-deep .mat-select-panel .mat-option{border-radius:0!important}::ng-deep mat-form-field .mat-form-field-underline{display:none!important}::ng-deep mat-select .mat-select-placeholder{color:#0006;font-family:Lato;font-size:14px;font-style:normal;font-weight:400;line-height:normal}::ng-deep mat-select .mat-select-value-text{color:#000;font-family:Lato;font-size:14px;font-style:normal;font-weight:400;line-height:normal;line-height:normal!important;padding-top:0!important;padding-bottom:0!important}::ng-deep mat-select .mat-select-value{display:flex!important;align-items:center!important;height:100%!important}.additional-details textarea{display:flex;padding:16px 16px 0;flex-direction:column;align-items:flex-start;gap:10px;flex:1 0 0;align-self:stretch;width:100%;color:#0006;font-family:Lato;font-size:14px;font-style:normal;font-weight:400;line-height:normal;resize:none}.section-header{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.btn-disable{border-radius:var(--Radius-Full-Round, 9999999px);opacity:.4;background:var(--Primary-KB-Primary-Light, #1B4CA1);color:var(--white-kb-white-100, #FFF);text-align:center;font-family:Lato;font-size:14px;font-style:normal;font-weight:700;line-height:normal;display:flex;height:32px;padding:0 16px;justify-content:center;align-items:center;gap:8px;border:none}.btn-group{display:flex;flex-direction:row;justify-content:space-between}.pl-2{padding-left:10px}.search-filter-section{display:flex;flex-direction:row;justify-content:space-between}.search .rsearch{position:relative}.search .search-icon{position:absolute;top:15px;font-size:20px;left:10px}.search .sinput{border-radius:4px;border:1px solid #d5d0d0;padding:15px 36px;font:400 14px Lato}.select-map-route-container{display:flex;flex-direction:row}.selected-mapping-route p{color:#1b4ca1;font-family:Lato;font-size:20px;font-style:normal;font-weight:400;line-height:normal;text-decoration-line:underline;text-decoration-style:solid;-webkit-text-decoration-skip:ink;text-decoration-skip-ink:auto;text-decoration-thickness:auto;text-underline-offset:auto;text-underline-position:from-font}.edit-plan{display:flex;padding:4px;justify-content:center;align-items:center;gap:8px;border-radius:4px;background:#1b4ca129;color:#1b4ca1;font-family:Lato;font-size:14px;font-style:normal;font-weight:400;line-height:normal;margin-left:10px}.search-container{display:flex;flex-direction:row}.course-container{display:flex;width:100%;padding:16px;flex-direction:column;align-items:flex-start;gap:24px;grid-row:2/span 1;grid-column:1/span 1;border-radius:12px;border:1px solid var(--borders-black-border-16-black, rgba(0, 0, 0, .16));background:#fff}.course-header{display:flex;flex-direction:row;justify-content:space-between;width:100%}.course-pill{display:flex;height:24px;padding:8px;align-items:center;gap:4px;border-radius:16px;border:1px solid var(--borders-border-fill-focussed-4-light-100, #EF951E);background:#fefaf4}.ai-recommened-pill{display:flex;padding:4px 8px;align-items:center;gap:8px;border-radius:var(--Radius-4, 4px);border:1px solid #1B4CA1;background:#1b4ca129}.igot-platform-pill{display:flex;padding:4px 8px;align-items:center;gap:8px;border-radius:var(--Radius-4, 4px);border:1px solid #EF951E;background:#ef951e29}.course-title{color:var(--Primary-KB-Primary-Light, #1B4CA1);font-family:Montserrat;font-size:20px;font-style:normal;font-weight:600;line-height:30px}.course-desc{color:#0009;font-family:Lato;font-size:14px;font-style:normal;font-weight:400;line-height:normal}.relevancy,.competencies-matched{color:var(--accessbility-shades-with-opacity-kb-greys-black-60, rgba(0, 0, 0, .6));font-family:Lato;font-size:14px;font-style:normal;font-weight:400;line-height:normal;align-items:center}.percentage{color:#1d8923;font-family:Lato;font-size:14px;font-style:normal;font-weight:800;line-height:normal}.relevancy-container,.competencies-matched-container{display:flex;flex-direction:row;align-items:center}.dash{padding:0 5px}::ng-deep .mat-radio-checked .mat-radio-inner-circle{background:#1b4ca1!important}.course-list-container{display:flex;flex-wrap:wrap;gap:16px}.course-list-item{flex:0 0 48%;box-sizing:border-box;border:1px solid #ccc;padding:16px;background-color:#fff;border-radius:8px}.checked-course-container{display:flex}.ml-2{margin-left:8px}::ng-deep .mat-checkbox-checked .mat-checkbox-background{background:#1b4ca1!important}.ai-recommened-pill-text,.igot-platform-pill-text{color:#1b4ca1;font-family:Lato;font-size:12px;font-style:normal;font-weight:700;line-height:normal}.course-pill-text{color:var(--accessbility-shades-without-opacity-kb-greys-black-87, #212121);text-align:center;font-family:Poppins;font-size:12px;font-style:normal;font-weight:400;line-height:normal}.ai-loader-icon img,.igot-platform-icon img{width:15.714px;height:15.714px;flex-shrink:0}.competency-container{display:flex}.outside-layer{display:flex;padding:4px 12px;justify-content:center;align-items:center;gap:16px;border-radius:12px 4px 4px 12px;border-left:2px solid #F8B861;background:#fde8cc;width:132px}.suggest-courses-header{display:flex;flex-direction:row;justify-content:space-between}.suggest-course-control{display:flex;flex-direction:row}.course-card-container{width:172px;border-radius:3.307px;border:.827px solid var(--borders-border-8-black, rgba(0, 0, 0, .08));background-color:#fff}.highlight-ai{font-family:Montserrat;font-size:24px;font-style:normal;font-weight:600;line-height:normal;background:linear-gradient(90deg,#3b27ff,#2de3d6);background-clip:text;-webkit-background-clip:text;color:transparent;-webkit-text-fill-color:transparent;display:inline-block}.ai-loader-icon-medium img{width:40px;height:40px;flex-shrink:0}.heading{color:#000;font-family:Montserrat;font-size:20px;font-style:normal;font-weight:600;line-height:normal;margin:10px 0}.progress-popup{display:flex;flex-direction:column;justify-content:center;align-items:center}.progress-popup .desc{color:#000000de;text-align:center;font-family:Lato;font-size:14px;font-style:normal;font-weight:400;line-height:normal}.pl-10{padding-left:20px}.profile-pic{width:42px;height:24px;object-fit:cover;border-radius:50%;margin-top:-4px}.header-container{display:flex;flex-direction:row;justify-content:space-between;height:85px;box-shadow:0 4px 6px -1px #0000001a;background:#fff}.right-container{display:flex;margin-right:40px;gap:16px}.left-container{display:flex;gap:8px;width:100%;margin-left:10px}.h-50{height:100%!important}.mb-1{margin-bottom:1rem!important}.cursor-pointer{cursor:pointer}\n"] }]
        }], ctorParameters: function () { return [{ type: i1.EventService }, { type: i2.SharedService }, { type: i3.MatSnackBar }, { type: i4.Router }]; } });
//# sourceMappingURL=data:application/json;base64, 