import { Component, ViewChild } from '@angular/core';
import { FormControl, Validators } from '@angular/forms';
import { MatPaginator } from '@angular/material/paginator';
import { MatTableDataSource } from '@angular/material/table';
import { ListPopupComponent } from '../list-popup/list-popup.component';
import * as i0 from "@angular/core";
import * as i1 from "@angular/material/dialog";
import * as i2 from "../../modules/shared/services/shared.service";
import * as i3 from "@angular/material/snack-bar";
import * as i4 from "@angular/forms";
import * as i5 from "@angular/router";
import * as i6 from "@angular/common";
import * as i7 from "@angular/material/legacy-card";
import * as i8 from "@angular/material/legacy-form-field";
import * as i9 from "@angular/material/legacy-input";
import * as i10 from "@angular/material/legacy-button";
import * as i11 from "@angular/material/icon";
import * as i12 from "@angular/material/legacy-select";
import * as i13 from "@angular/material/legacy-core";
import * as i14 from "@angular/material/progress-spinner";
import * as i15 from "@angular/material/table";
import * as i16 from "@angular/material/paginator";
import * as i17 from "@angular/material/tooltip";
export class ApprovalRequestsComponent {
    constructor(dialog, sharedService, snackBar, fb, router) {
        this.dialog = dialog;
        this.sharedService = sharedService;
        this.snackBar = snackBar;
        this.fb = fb;
        this.router = router;
        this.dataSource = new MatTableDataSource([]);
        this.selectedMinistryType = 'ministry';
        this.ministryData = [];
        this.ministryFullData = [];
        this.disableBtn = true;
        this.searchText = '';
        this.displayedColumns = ['request_id', 'date', 'designation', 'status', 'actions'];
        this.cbpFinalObj = {};
        this.departmentData = [];
        this.approvalRequests = [
        // {
        //   name: 'Work Allocation',
        //   originalName: 'ACBP_Ministry_of_Women_and_Child_Development_Extract...',
        //   size: 4.5,
        //   date: 'Oct 13, 2025'
        // },
        // {
        //   name: 'Screenshot 2025-10-08 at 12',
        //   originalName: 'Screenshot 2025-10-08 at 12.54.18 PM.png',
        //   size: 331.8,
        //   date: 'Oct 13, 2025'
        // }
        ];
        this.loading = false;
        this.filteredMinistryData = [];
        this.searchControl = new FormControl('');
        this.panelOpen = false;
        this.departmentPanelOpen = false;
        this.filteredList = [];
        this.filteredDepartmentList = [];
        this.loginUserOrgIds = [];
        this.originalMinistryData = [];
        this.status = [
            { "code": "", label: "All Status" },
            { "code": "pending", label: "Pending" },
            { "code": "approved", label: "Approved" },
            { "code": "rejected", label: "Rejected" },
            { "code": "draft", label: "Revoked" },
        ];
        this.time = [
            { "code": "", label: "All Time" },
            { "code": "last_7_days", label: "Last 7 Days" },
            { "code": "last_30_days", label: "Last 30 Days" },
            { "code": "last_90_days", label: "Last 90 Days" }
        ];
        this.filteredStatus = [...this.status];
        this.filteredTime = [...this.time];
        this.pageIndex = 0;
        this.pageSize = 10;
        this.totalRecords = 0;
        this.showRejectPopupFlag = false;
        this.showRevokeRequestPopupFlag = false;
        this.roleMappingForm = this.fb.group({
            ministryType: ['ministry', Validators.required],
            ministry: [null, Validators.required],
            sectors: [[]],
            departments: [[]]
        });
        this.filterForm = this.fb.group({
            status: [''],
            time: [''],
            search: ['']
        });
        // this.cbpFinalObj = this.sharedService.getCBPPlanLocalStorage()
        this.getMinistryData();
    }
    ngOnInit() {
        this.cbpPlanFinalObj = this.sharedService.getCBPPlanLocalStorage();
        console.log('cbpFinalObj--', this.cbpFinalObj);
        this.searchControl.valueChanges.subscribe(searchText => {
            if (searchText) {
                this.filterMinistryData(searchText);
            }
            else {
                this.filteredMinistryData = this.ministryData;
            }
        });
        this.sharedService.summaryTriggerExecuted.subscribe((data) => {
            if (data && data?.file_id) {
                this.getApprovalRequests();
            }
        });
        if (this.cbpPlanFinalObj && this.cbpPlanFinalObj.ministry && this.cbpPlanFinalObj.ministry.identifier) {
            this.getApprovalRequests();
        }
    }
    // ngAfterViewInit() {
    //   this.dataSource.paginator = this.paginator;
    // }
    getApprovalRequests() {
        let reqBody = {
            state_center_id: this.cbpPlanFinalObj?.ministry?.identifier,
            include_summary: true,
            page: this.pageIndex + 1,
            page_size: this.pageSize
        };
        const search = this.filterForm.get('search')?.value;
        const status = this.filterForm.get('status')?.value;
        const time = this.filterForm.get('time')?.value;
        if (search) {
            reqBody.search = search;
        }
        if (status) {
            reqBody.status = status;
        }
        // Time filter
        if (time) {
            const today = new Date();
            let fromDate = new Date();
            if (time === 'last_7_days') {
                fromDate.setDate(today.getDate() - 7);
            }
            if (time === 'last_30_days') {
                fromDate.setDate(today.getDate() - 30);
            }
            if (time === 'last_90_days') {
                fromDate.setDate(today.getDate() - 90);
            }
            reqBody.from_date = fromDate.toISOString().split('T')[0];
            reqBody.to_date = today.toISOString().split('T')[0];
        }
        if (this.cbpPlanFinalObj?.departments) {
            reqBody.department_id = this.cbpPlanFinalObj.departments;
        }
        this.loading = true;
        this.sharedService.getApprovalRequests(reqBody).subscribe((res) => {
            this.loading = false;
            this.approvalRequests = res?.items || [];
            this.dataSource.data = this.approvalRequests;
            this.totalRecords = res?.total || 0;
        });
    }
    filteredapprovalRequests() {
        let data = [...this.approvalRequests];
        const search = this.filterForm.get('search')?.value?.toLowerCase() || '';
        const status = this.filterForm.get('status')?.value;
        const time = this.filterForm.get('time')?.value;
        // Search Filter
        if (search) {
            data = data.filter(r => (r.request_name || '').toLowerCase().includes(search));
        }
        // Status Filter
        if (status) {
            data = data.filter(r => r.status === status);
        }
        // Time Filter
        if (time) {
            const now = new Date();
            data = data.filter(r => {
                const created = new Date(r.created_at);
                const diffDays = (now.getTime() - created.getTime()) / (1000 * 3600 * 24);
                if (time === 'last_7_days')
                    return diffDays <= 7;
                if (time === 'last_30_days')
                    return diffDays <= 30;
                if (time === 'last_90_days')
                    return diffDays <= 90;
                return true;
            });
        }
        return data;
    }
    deleteDocument(docToDelete) {
        this.approvalRequests = this.approvalRequests.filter(doc => doc !== docToDelete);
        this.loading = true;
        this.sharedService.deleteSummary(docToDelete?.file_id).subscribe((res) => {
            if (res) {
                this.sharedService.deleteFile(docToDelete?.file_id).subscribe((dres) => {
                    this.loading = true;
                    if (dres) {
                        this.loading = false;
                        this.snackBar.open('Document Deleted Successfully', 'X', {
                            duration: 3000,
                            panelClass: ['snackbar-success']
                        });
                        this.getApprovalRequests();
                    }
                    else {
                        this.loading = false;
                        this.snackBar.open('Error While Deleting Document', 'X', {
                            duration: 3000,
                            panelClass: ['snackbar-error']
                        });
                        this.getApprovalRequests();
                    }
                });
                this.loading = false;
                this.snackBar.open('Document Summary Deleted Successfully', 'X', {
                    duration: 3000,
                    panelClass: ['snackbar-success']
                });
            }
            else {
                this.loading = false;
                this.snackBar.open('Error While Deleting Document Summary', 'X', {
                    duration: 3000,
                    panelClass: ['snackbar-error']
                });
            }
        });
    }
    applyFilters() {
        const filtered = this.filteredapprovalRequests();
        this.dataSource.data = filtered;
        if (this.paginator) {
            this.paginator.firstPage();
        }
    }
    onMinistryTypeChange(event) {
        this.roleMappingForm.reset();
        // console.log('event', event)
        this.getMinistryData();
        this.sharedService.cbpPlanFinalObj['ministryType'] = event.value;
        localStorage.setItem('cbpPlanFinalObj', JSON.stringify(this.sharedService.cbpPlanFinalObj));
        this.selectedMinistryType = event?.value;
        this.roleMappingForm.get('sectors')?.setValue([]);
        this.roleMappingForm.controls.ministryType.setValue(this.selectedMinistryType);
    }
    onMinistryChange(event) {
        const selectedMinistryId = event.value;
        // console.log('Selected Ministry ID:', selectedMinistryId);
        // You can access the selected object if needed
        const selectedMinistry = this.ministryData.find(item => item.identifier === selectedMinistryId);
        console.log('Selected Ministry:', selectedMinistry);
        ``;
        this.sharedService.cbpPlanFinalObj['ministry'] = { identifier: selectedMinistryId?.identifier, name: selectedMinistryId?.orgName };
        if (selectedMinistryId && this.selectedMinistryType === 'state') {
            this.sharedService.getDepartmentList(selectedMinistryId).subscribe((res) => {
                this.departmentData = res;
            });
        }
        if (this.selectedMinistryType === 'state') {
            this.sharedService.cbpPlanFinalObj['ministryType'] = this.roleMappingForm.controls.ministryType.value;
            this.sharedService.cbpPlanFinalObj['ministry'] = { identifier: selectedMinistry?.identifier, name: selectedMinistry?.orgName };
            this.sharedService.cbpPlanFinalObj['departments'] = this.roleMappingForm.controls.departments.value;
            this.sharedService.cbpPlanFinalObj['sectors'] = this.roleMappingForm.controls.sectors.value;
        }
        else {
            this.sharedService.cbpPlanFinalObj['ministryType'] = this.roleMappingForm.controls.ministryType.value;
            this.sharedService.cbpPlanFinalObj['ministry'] = { identifier: selectedMinistry?.identifier, name: selectedMinistry?.orgName };
        }
        console.log('this.sharedService.cbpPlanFinalObj', this.sharedService.cbpPlanFinalObj);
        localStorage.setItem('cbpPlanFinalObj', JSON.stringify(this.sharedService.cbpPlanFinalObj));
        console.log('this.roleMappingForm', this.roleMappingForm);
    }
    filterMinistryData(searchText) {
        if (searchText) {
            console.log('searhTect, ', searchText);
            const search = searchText?.trim().toLowerCase() || '';
            this.filteredMinistryData = !search
                ? [...this.ministryData]
                : this.ministryData.filter(item => item.orgName?.trim().toLowerCase().startsWith(search));
        }
    }
    getMinistryData() {
        this.loading = true;
        this.sharedService.getMinistryData(this.selectedMinistryType).subscribe((data) => {
            this.loading = false;
            console.log('data--', data);
            this.ministryFullData = data;
            this.ministryData = [];
            if (this.selectedMinistryType === 'ministry') {
                data.forEach((item) => {
                    if (item?.sbOrgType === 'ministry') {
                        this.ministryData.push(item);
                        this.filteredMinistryData = [...this.ministryData];
                    }
                });
            }
            else if (this.selectedMinistryType === 'state') {
                data.forEach((item) => {
                    if (item?.sbOrgType === 'state') {
                        this.ministryData.push(item);
                        this.filteredMinistryData = [...this.ministryData];
                    }
                });
            }
            this.getUserProfileData();
        });
        console.log('this.ministryData--', this.ministryData);
        console.log('this.filteredMinistryData--', this.filteredMinistryData);
    }
    routeToMain() {
        this.router.navigate(['/ai/']);
    }
    viewSummary(doc) {
        const dialogRef = this.dialog.open(ListPopupComponent, {
            width: '800px',
            data: { element: doc, type: 'doc-summary' },
            disableClose: true,
            maxHeight: '80vh'
        });
        dialogRef.afterClosed().subscribe(() => {
            // No need to do anything special here to reset inline expanded state
            // Because you're using dialog, not inline expand – view remains in initial (collapsed) state
        });
    }
    viewRequest(request) {
        console.log('request--', request);
        this.loading = true;
        this.router.navigate(['/ai/review-request', request.id]);
    }
    revokeApprovalRequest(request) {
        this.showRevokeRequestPopupFlag = true;
        this.revokeRequestedRequest = request;
        console.log('request--', request);
    }
    revokeApprovalRequestConfirm() {
        this.loading = true;
        let reqBody = {
            "request_id": this.revokeRequestedRequest?.id
        };
        this.sharedService.revokeApprovalRequest(reqBody).subscribe({
            next: (res) => {
                console.log('res', res);
                this.loading = false;
                this.snackBar.open('Request Revoked Successfully', 'X', {
                    duration: 3000,
                    panelClass: ['snackbar-success']
                });
                this.showRevokeRequestPopupFlag = false;
                this.getApprovalRequests();
            },
            error: () => {
                this.loading = false;
                this.snackBar.open('Failed to revoke the approval request.', 'X', {
                    duration: 3000,
                    panelClass: ['snackbar-error']
                });
            }
        });
    }
    closeRevokePopup() {
        this.showRevokeRequestPopupFlag = false;
    }
    onOpened(opened) {
        this.panelOpen = opened;
    }
    onOpenedDepartment(opened) {
        this.departmentPanelOpen = opened;
    }
    filterData(event) {
        if (event && event.target && event.target.value) {
            const s = event.target.value.toLowerCase();
            this.filteredList = this.ministryData.filter(x => x.orgName.toLowerCase().includes(s));
        }
        else {
            this.filteredList = this.ministryData;
        }
    }
    filterDepartmentData(event) {
        if (event && event.target && event.target.value) {
            const s = event.target.value.toLowerCase();
            this.filteredDepartmentList = this.departmentData.filter(x => x.orgName.toLowerCase().includes(s));
        }
        else {
            this.filteredDepartmentList = this.departmentData;
        }
    }
    getUserProfileData() {
        this.sharedService.getUserProfile().subscribe((data) => {
            console.log('data--', data);
            this.loginUserOrgIds = data?.organization_ids;
            let filteredMinistryData = [];
            console.log('this.ministryFullData--', this.ministryFullData);
            this.ministryFullData.map((item) => {
                if (this.loginUserOrgIds.indexOf(item?.identifier) > -1) {
                    filteredMinistryData.push(item);
                }
            });
            this.ministryData = filteredMinistryData;
            this.originalMinistryData = filteredMinistryData;
            this.filteredList = filteredMinistryData;
            console.log('this.filteredList--', this.filteredList);
        });
    }
    routeToInitial() {
        this.router.navigate(['/ai/initial']);
    }
    filterList(value, type) {
        const search = value.toLowerCase();
        switch (type) {
            case 'status':
                this.filteredStatus = this.status.filter(v => v.label?.toLowerCase().includes(search));
                break;
            case 'time':
                this.filteredTime = this.time.filter(v => v.label?.toLowerCase().includes(search));
                break;
        }
    }
    clearSearch() {
        this.searchText = '';
        this.applyFilters();
    }
    onFilterChange() {
        this.pageIndex = 0;
        this.getApprovalRequests();
    }
    onPageChange(event) {
        this.pageIndex = event.pageIndex;
        this.pageSize = event.pageSize;
        this.getApprovalRequests();
    }
    showRejectPopup(element) {
        console.log('element', element);
        this.showRejectPopupFlag = true;
        this.rejectionDetail = element;
    }
    closeRejectPopup() {
        this.showRejectPopupFlag = false;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ApprovalRequestsComponent, deps: [{ token: i1.MatDialog }, { token: i2.SharedService }, { token: i3.MatSnackBar }, { token: i4.FormBuilder }, { token: i5.Router }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ApprovalRequestsComponent, selector: "app-approval-requests", viewQueries: [{ propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true }], ngImport: i0, template: "<div class=\"upload-container\">\n    <div class=\"header\">\n        <div class=\"sub-heading mt-10 mb-10 ml-10 cursor-pointer\">\n            <p (click)=\"routeToInitial()\"><mat-icon style=\"vertical-align: middle;\">arrow_back</mat-icon><span\n                    class=\"pl-10\">Back to Role Mapping Generation</span></p>\n        </div>\n\n    </div>\n    <mat-card class=\"mat-card-container mt-20\" [formGroup]=\"roleMappingForm\">\n        <div class=\"header\">\n            <div class=\"sub-heading\">\n                <p>Approval Requests</p>\n            </div>\n\n\n        </div>\n        <!-- <div class=\"edit-section mt-4\">\n            <div class=\"select-map-route-container\">\n                <div class=\"select-map-flex-container\">\n                    <div class=\"select-map-flex\">\n                        <div class=\"selected-mapping-route\">\n                            <p>{{cbpPlanFinalObj?.ministry?.orgName}} <span *ngIf=\"cbpPlanFinalObj?.department_name\">\n                                    / {{cbpPlanFinalObj?.department_name}}</span>\n                            </p>\n                        </div>\n                        <div class=\"edit-plan cursor-pointer\" (click)=\"routeToInitial()\">\n                            <mat-icon>edit</mat-icon>Edit\n                        </div>\n                        \n                    </div>\n                    \n                </div>\n            </div>\n        </div> -->\n\n\n\n\n\n    </mat-card>\n    <mat-card class=\"\" style=\"z-index: 0;padding:6px 0\">\n        <form [formGroup]=\"filterForm\">\n            <div class=\"search flex margin-right-m filter-container\">\n                <div>\n                    <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\"\n                        stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\n                        class=\"lucide lucide-filter h-4 w-4\">\n                        <polygon points=\"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3\"></polygon>\n                    </svg>\n                </div>\n                <div>\n                    <b> Filters</b>\n                </div>\n                <div class=\"w-50\">\n\n                    <div class=\"search-container\">\n                        <div class=\"rsearch\">\n                            <mat-icon\n                                class=\"color-60 search-icon mat-icon notranslate material-icons mat-icon-no-color\">search</mat-icon>\n                            <input class=\"sinput color-60 w-full\" label=\"\" formControlName=\"search\"\n                                (keyup)=\"onFilterChange()\" placeholder=\"Search by Request Name\" type=\"Standard\">\n\n                        </div>\n\n                    </div>\n\n\n\n                </div>\n                <div class=\"search-and-buttons-container\">\n                    <div>\n                        <mat-form-field appearance=\"outline\" class=\"language-select\">\n                            <!-- <mat-label style=\"font-weight: normal;\">\n                                {{ filterForm.get('status')?.value ? '' : 'Select Status' }}\n                            </mat-label> -->\n\n                            <mat-select formControlName=\"status\" panelClass=\"select-search-panel\"\n                                (selectionChange)=\"onFilterChange()\">\n\n                                <!-- Search box -->\n                                <input style=\"border:1px solid #ccc; padding: 5px;width: 92%;margin: 5px;\" matInput\n                                    placeholder=\"Search Status\" (click)=\"$event.stopPropagation()\"\n                                    (keydown)=\"$event.stopPropagation()\"\n                                    (keyup)=\"filterList($any($event.target).value, 'status')\" />\n\n                                <!-- Values -->\n                                <mat-option *ngFor=\"let r of filteredStatus\" [value]=\"r?.code\">\n                                    {{ r?.label }}\n                                </mat-option>\n\n                            </mat-select>\n                        </mat-form-field>\n                    </div>\n                </div>\n                <div class=\"search-and-buttons-container\">\n                    <div>\n                        <mat-form-field appearance=\"outline\" class=\"language-select\">\n                            <!-- <mat-label style=\"font-weight: normal;\">\n                                {{ filterForm.get('time')?.value ? '' : 'Select Time' }}\n                            </mat-label> -->\n\n                            <mat-select formControlName=\"time\" panelClass=\"select-search-panel\"\n                                (selectionChange)=\"onFilterChange()\">\n\n                                <!-- Search box -->\n                                <input style=\"border:1px solid #ccc; padding: 5px;width: 92%;margin: 5px;\" matInput\n                                    placeholder=\"Search Time\" (click)=\"$event.stopPropagation()\"\n                                    (keydown)=\"$event.stopPropagation()\"\n                                    (keyup)=\"filterList($any($event.target).value, 'time')\" />\n\n                                <!-- Values -->\n                                <mat-option *ngFor=\"let r of filteredTime\" [value]=\"r?.code\">\n                                    {{ r?.label }}\n                                </mat-option>\n\n                            </mat-select>\n                        </mat-form-field>\n                    </div>\n                </div>\n            </div>\n        </form>\n        <p class=\"mt-15\" style=\"font-family: 'Lato'; font-size: 18px; margin-left: 10px;margin-top: 15px;\">\n            {{totalRecords}} Approval Requests</p>\n        <table style=\"border-radius: 25px 25px 0 0;\n        overflow: hidden;\n        box-shadow: 0 5px 5px rgba(0, 0, 0, 0.12);\" mat-table [dataSource]=\"dataSource\"\n            class=\"mat-elevation-z2 full-width-table mt-10\">\n\n            <!-- Document Column -->\n            <ng-container matColumnDef=\"request_id\">\n                <th mat-header-cell *matHeaderCellDef> Request Name </th>\n                <td mat-cell *matCellDef=\"let request\" style=\"width: 25%;\">\n                    <div>\n                        <div class=\"doc-title\" *ngIf=\"request.request_name\">{{ request.request_name }}</div>\n                        <div class=\"doc-title\" *ngIf=\"!request.request_name\">{{ request.request_name }}</div>\n                    </div>\n                </td>\n            </ng-container>\n\n\n\n            <!-- Summary Text Column -->\n            <!-- <ng-container matColumnDef=\"summary_text\">\n                <th mat-header-cell *matHeaderCellDef> Summary </th>\n                <td mat-cell *matCellDef=\"let doc\">\n                    <div class=\"doc-summary-text\" style=\"width: 80%;\">\n                        <markdown [data]=\"doc?.summary_text | slice : 0 : 200\"></markdown>\n                    </div>\n                </td>\n            </ng-container> -->\n\n            <!-- Date Column -->\n            <ng-container matColumnDef=\"date\">\n                <th mat-header-cell *matHeaderCellDef> Date & Time</th>\n                <td mat-cell *matCellDef=\"let request\" style=\"width: 12%;\"> {{ request.created_at | date: 'MMM d, y hh:mm:ss a'}}\n                </td>\n            </ng-container>\n\n            <ng-container matColumnDef=\"designation\">\n                <th mat-header-cell *matHeaderCellDef> No. of Designation </th>\n                <td mat-cell *matCellDef=\"let request\" style=\"width: 10%; text-align: center;\">\n                    <span class=\"designation-count\">{{request?.designation_count}}</span>\n                </td>\n            </ng-container>\n\n\n            <!-- Summary Status Column -->\n            <ng-container matColumnDef=\"status\">\n                <th mat-header-cell *matHeaderCellDef> Request Status </th>\n                <td mat-cell *matCellDef=\"let request\" style=\"width: 10%;\">\n                    <span *ngIf=\"request.status === 'draft' || request.status === 'DRAFT' || request.status === 'revoke' || request.status === 'REVOKE' || request.status === 'REVOKED' || request.status === 'revoked'\" class=\"draft\"> Revoked </span>\n                    <span *ngIf=\"request.status === 'approved' || request.status === 'APPROVED'\" class=\"success\"> {{ request.status | titlecase\n                        }} </span>\n                    <span *ngIf=\"request.status === 'pending' || request.status === 'PENDING'\" class=\"in-progress\"> {{ request.status |\n                        titlecase }} </span>\n                    <span *ngIf=\"request.status === 'rejected' || request.status === 'REJECTED'\" class=\"rejected\"> {{ request.status |\n                        titlecase }} </span>\n                    <span (click)=\"showRejectPopup(request)\" *ngIf=\"request.status === 'rejected' || request.status === 'REJECTED'\" style=\"margin-left: 10px;cursor: pointer;\"><mat-icon class=\"vertical-middle\">remove_red_eye</mat-icon></span>\n                </td>\n            </ng-container>\n\n            <!-- Actions Column -->\n            <ng-container matColumnDef=\"actions\">\n                <th mat-header-cell *matHeaderCellDef> Actions </th>\n                <td mat-cell *matCellDef=\"let request\" style=\"width: 15%;\">\n                    <div class=\"action-flex\">\n                        <div>\n                            <button class=\"btn-active\" mat-raised-button color=\"primary\" (click)=\"viewRequest(request)\"\n                                matTooltip=\"View/Review Request\">\n                                View Request\n                            </button>\n                        </div>\n                        <div>\n                            <button style=\"margin-left: 15px;\" class=\"btn-gray\" *ngIf=\"request.status === 'PENDING' || request.status === 'pending'\" \n                                 (click)=\"revokeApprovalRequest(request)\" matTooltip=\"Revoke Request\">\n                                <mat-icon>cancel</mat-icon>\n                                Revoke Request\n                            </button>\n                        </div>\n                    </div>\n\n\n\n\n\n                </td>\n            </ng-container>\n\n            <!-- Header and Row Definitions -->\n            <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\n            <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\"></tr>\n\n            <!-- No Data Message -->\n\n        </table>\n        <div *ngIf=\"dataSource.data.length === 0\" class=\"no-data-message\">\n            No record found\n        </div>\n        <!-- Pagination -->\n        <div class=\"mt-1\">\n            <!-- <mat-paginator class=\"custom-pagination\" [pageSize]=\"5\" [pageSizeOptions]=\"[5, 10, 20]\"></mat-paginator> -->\n            <mat-paginator [length]=\"totalRecords\" [pageSize]=\"pageSize\" [pageIndex]=\"pageIndex\"\n                [pageSizeOptions]=\"[5, 10, 20]\" (page)=\"onPageChange($event)\">\n            </mat-paginator>\n        </div>\n\n\n    </mat-card>\n</div>\n\n<!-- Popup Overlay -->\n<div class=\"popup-overlay\" *ngIf=\"showRejectPopupFlag\">\n  <div class=\"popup-card\">\n    \n    <!-- Close Button -->\n    <button class=\"close-btn\" (click)=\"closeRejectPopup()\">&times;</button>\n\n    <!-- Title -->\n    <h2>Rejection Reason</h2>\n\n    <!-- Subtitle -->\n    <p class=\"subtitle\">\n      This request was rejected for the following reason:\n    </p>\n\n    <!-- Error Box -->\n    <div class=\"error-box\">\n      {{rejectionDetail?.reviewer_comments}}\n    </div>\n\n  </div>\n</div>\n\n<div class=\"popup-overlay\" *ngIf=\"showRevokeRequestPopupFlag\">\n  <div class=\"popup-card\">\n    \n    <!-- Close Button -->\n    <button class=\"close-btn\" (click)=\"closeRevokePopup()\">&times;</button>\n\n    <!-- Title -->\n    <h2>Revoke Request</h2>\n\n    <!-- Subtitle -->\n    <p class=\"subtitle\">\n     <strong>Are you sure you want to revoke this request? </strong><br><br>\n     Once revoked, you will not be able to make any changes to this request. If you wish to proceed later, you will need to create a new request and submit it again, Do you want to continue?  <br><br>\n     \n    </p>\n   \n\n   <div class=\"popup-footer\">\n        <div>\n            <input class=\"btn-active-gray\" mat-raised-button type=\"button\" value=\"No\" (click)=\"closeRevokePopup()\" />\n        </div>\n        <div class=\"ml-10\">\n            <button  mat-raised-button\n               class=\"btn-active\" (click)=\"revokeApprovalRequestConfirm()\">\n\n                Yes\n            </button>\n        </div>\n    </div>\n\n  </div>\n</div>\n\n\n<div class=\"overlay-loader\" *ngIf=\"loading\">\n    <mat-spinner diameter=\"50\"></mat-spinner>\n</div>", styles: [".upload-container{background:transparent;min-height:100vh;padding:24px 0;margin:0 30px 0 50px}.header{display:flex;flex-direction:row;justify-content:space-between}.primary-btn{background-color:#1b4ca1;color:#fff}:host .search .rsearch{position:relative}:host .search .search-icon{position:absolute;top:15px;font-size:20px;left:10px}:host .search .clear-icon{position:absolute;top:15px;font-size:20px;right:10px;color:#666}:host .search .clear-icon:hover{color:#333}:host .search .sinput{border-radius:32px;border:1px solid #d5d0d0;padding:12px 36px;font:400 14px Lato;width:100%}.no-data-message{text-align:center;padding:16px;font-style:italic;color:#888}.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:48px;padding:0 16px;justify-content:center;align-items:center;gap:8px;border:none;width:100%}.btn-active{border-radius:var(--Radius-Full-Round, 9999999px);opacity:1;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:34px;padding:0 16px;justify-content:center;align-items:center;gap:8px;border:none;width:100%}.btn-gray{border-radius:var(--Radius-Full-Round, 9999999px);opacity:1;background:var(--Primary-KB-Primary-Light, rgba(91, 90, 90, .7019607843));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:34px;justify-content:center;align-items:center;gap:4px;border:none;width:auto}.btn-gray:hover{background:var(--Primary-KB-Primary-Light, #1B4CA1)}.sub-heading p{color:#000;font-family:Montserrat;font-size:18px;font-style:normal;font-weight:600;line-height:normal}.ml-10{margin-left:10px}.mt-10{margin-top:15px}.mt-20{margin-top:20px}.mb-10{margin-bottom:10px}.cursor-pointer{cursor:pointer}.doc-title{font-weight:700}:host ::ng-deep .mat-mdc-header-row{position:sticky;top:0;z-index:10;background:#fff;font-size:16px;box-shadow:0 2px 4px #0000001a;padding:5px 10px}:host ::ng-deep .mat-mdc-row{font-size:16px}:host ::ng-deep .mat-mdc-cell{padding:5px 10px}:host ::ng-deep .mat-mdc-header-cell{background:#fff;font-weight:600;font-size:18px;border-bottom:2px solid #e0e0e0}:host ::ng-deep th.mat-mdc-header-cell:not(:last-child){position:relative;border-right:none;padding:5px 10px}:host ::ng-deep th.mat-mdc-header-cell:not(:last-child):after{content:\"\";position:absolute;top:12px;bottom:12px;right:0;width:1px;background-color:#e0e0e0}::ng-deep .doc-summary-text ::ng-deep markdown p{line-height:1.5rem;font-family:Lato;font-size:1rem!important;font-style:normal;font-weight:400}:host .mat-select-panel .search-wrapper{width:100%!important;box-sizing:border-box;padding:8px;position:sticky;top:0;z-index:2;background:#fff}.search-input{width:100%;padding:6px 10px;border:1px solid #ccc;border-radius:6px;outline:none;box-sizing:border-box}:host ::ng-deep .mat-select-panel-wrap{overflow:visible!important;padding:0;margin-top:42px}:host ::ng-deep .mat-select-panel{border:1px solid #ccc!important;box-sizing:border-box;max-height:250px}.edit-plan{display:flex;padding:4px 10px;justify-content:center;align-items:center;gap:8px;border-radius:4px;background:#1b4ca129;color:#1b4ca1;font-family:Lato;font-size:17px;font-style:normal;font-weight:400;line-height:normal;margin-left:10px;height:30px}.select-map-route-container{display:flex;flex-direction:row;width:100%}.select-map-flex{display:flex;flex-direction:row}.select-map-flex-container{display:flex;justify-content:space-between;width:100%}.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}.success{background:green;padding:4px 10px;color:#fff;border-radius:20px}.draft{background:#666;padding:4px 10px;color:#fff;border-radius:20px}.in-progress{background:orange;padding:4px 10px;color:#fff;border-radius:20px}.rejected{background:#d32f2f;padding:4px 10px;color:#fff;border-radius:20px}.filter-container{display:flex;align-items:center;flex-direction:row;width:100%;gap:10px;background:#e3ecfa;padding:10px;border-radius:10px}.w-50{width:50%}.search-and-buttons-container{display:flex;justify-content:space-between;gap:4px;flex-direction:column;flex-wrap:wrap;width:20%;margin:0 5px}::ng-deep .select-search-panel{border:1px solid #ccc!important;border-radius:12px!important;box-shadow:0 8px 20px #0000001f}:host ::ng-deep .mat-select-arrow-wrapper{margin-top:15px!important}:host ::ng-deep .mat-form-field-appearance-outline .mat-form-field-outline{color:#ccc}:host ::ng-deep .mat-form-field-appearance-outline.mat-focused .mat-form-field-outline-thick{color:#1b4ca1;border-color:#1b4ca1!important}:host ::ng-deep .select-search-panel .mat-option.mat-selected:not(.mat-option-disabled){background-color:#1b4ca1!important;color:#fff!important}:host ::ng-deep .mat-form-field-focused .mat-form-field-appearance-outline{border-color:#1b4ca1!important}:host ::ng-deep .mat-form-field-appearance-outline .mat-form-field-outline-start{border-radius:25px 0 0 25px;border:none!important}:host ::ng-deep .mat-form-field-appearance-outline .mat-form-field-outline-end{border-right:none!important;border:none!important;border-radius:0 25px 25px 0}:host ::ng-deep .mat-form-field-appearance-outline .mat-form-field-outline-gap{border:none!important;border-radius:25px}:host::ng-deep .mat-form-field-appearance-outline .mat-form-field-infix{background-color:transparent!important}:host ::ng-deep .search-and-buttons-container .mat-option-text{color:#fff!important}.header-container{display:flex;flex-direction:row;justify-content:space-between;width:100%;margin:10px 0}.right-side-container{display:flex;justify-content:space-between}:host ::ng-deep .language-select .mat-select-trigger{font-weight:400!important}:host ::ng-deep .language-select .mat-select-value{color:#fff!important;margin-top:12px!important}:host ::ng-deep .custom-pagination{background-color:transparent!important}.action-flex{display:flex;gap:10px}.designation-count{background:#d1ddf2;padding:9px 13px;border-radius:50%;margin:10px;color:#0f2b5b;text-align:center}.vertical-middle{vertical-align:middle}.popup-overlay{position:fixed;inset:0;background:#00000059;display:flex;justify-content:center;align-items:center;z-index:999}.popup-card{position:relative;width:500px;background:#fff;border-radius:16px;padding:28px 24px 24px;box-shadow:0 10px 30px #00000026;font-family:Arial,sans-serif}.popup-card h2{margin:0;font-size:20px;font-weight:700;color:#1f2937}.popup-card .subtitle{margin-top:10px;font-size:14px;color:#6b7280;line-height:1.4}.close-btn{position:absolute;top:16px;right:16px;width:32px;height:32px;border:2px solid #94a3b8;border-radius:50%;background:transparent;color:#64748b;font-size:18px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:.2s ease}.close-btn:hover{background:#f1f5f9}.error-box{margin-top:24px;padding:18px;border:1px solid #f5b5b5;background:#fff5f5;border-radius:12px;color:#c53030;font-size:18px;line-height:1.5;max-height:200px;overflow-y:auto}.popup-footer{display:flex;flex-direction:row;justify-content:end}.btn-active-gray{border-radius:var(--Radius-Full-Round, 9999999px);opacity:1;background:var(--Primary-KB-Primary-Light, rgba(91, 90, 90, .7019607843));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}\n"], dependencies: [{ kind: "directive", type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i7.MatLegacyCard, selector: "mat-card", exportAs: ["matCard"] }, { kind: "directive", type: i4.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "component", type: i8.MatLegacyFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i9.MatLegacyInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", exportAs: ["matInput"] }, { kind: "component", type: i10.MatLegacyButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button],             button[mat-fab], button[mat-mini-fab], button[mat-stroked-button],             button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i11.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i12.MatLegacySelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "component", type: i13.MatLegacyOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i4.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i14.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: i15.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i15.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i15.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i15.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { kind: "directive", type: i15.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i15.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i15.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i15.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i15.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i15.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "component", type: i16.MatPaginator, selector: "mat-paginator", inputs: ["disabled"], exportAs: ["matPaginator"] }, { kind: "directive", type: i17.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "pipe", type: i6.TitleCasePipe, name: "titlecase" }, { kind: "pipe", type: i6.DatePipe, name: "date" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ApprovalRequestsComponent, decorators: [{
            type: Component,
            args: [{ selector: 'app-approval-requests', template: "<div class=\"upload-container\">\n    <div class=\"header\">\n        <div class=\"sub-heading mt-10 mb-10 ml-10 cursor-pointer\">\n            <p (click)=\"routeToInitial()\"><mat-icon style=\"vertical-align: middle;\">arrow_back</mat-icon><span\n                    class=\"pl-10\">Back to Role Mapping Generation</span></p>\n        </div>\n\n    </div>\n    <mat-card class=\"mat-card-container mt-20\" [formGroup]=\"roleMappingForm\">\n        <div class=\"header\">\n            <div class=\"sub-heading\">\n                <p>Approval Requests</p>\n            </div>\n\n\n        </div>\n        <!-- <div class=\"edit-section mt-4\">\n            <div class=\"select-map-route-container\">\n                <div class=\"select-map-flex-container\">\n                    <div class=\"select-map-flex\">\n                        <div class=\"selected-mapping-route\">\n                            <p>{{cbpPlanFinalObj?.ministry?.orgName}} <span *ngIf=\"cbpPlanFinalObj?.department_name\">\n                                    / {{cbpPlanFinalObj?.department_name}}</span>\n                            </p>\n                        </div>\n                        <div class=\"edit-plan cursor-pointer\" (click)=\"routeToInitial()\">\n                            <mat-icon>edit</mat-icon>Edit\n                        </div>\n                        \n                    </div>\n                    \n                </div>\n            </div>\n        </div> -->\n\n\n\n\n\n    </mat-card>\n    <mat-card class=\"\" style=\"z-index: 0;padding:6px 0\">\n        <form [formGroup]=\"filterForm\">\n            <div class=\"search flex margin-right-m filter-container\">\n                <div>\n                    <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\"\n                        stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\n                        class=\"lucide lucide-filter h-4 w-4\">\n                        <polygon points=\"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3\"></polygon>\n                    </svg>\n                </div>\n                <div>\n                    <b> Filters</b>\n                </div>\n                <div class=\"w-50\">\n\n                    <div class=\"search-container\">\n                        <div class=\"rsearch\">\n                            <mat-icon\n                                class=\"color-60 search-icon mat-icon notranslate material-icons mat-icon-no-color\">search</mat-icon>\n                            <input class=\"sinput color-60 w-full\" label=\"\" formControlName=\"search\"\n                                (keyup)=\"onFilterChange()\" placeholder=\"Search by Request Name\" type=\"Standard\">\n\n                        </div>\n\n                    </div>\n\n\n\n                </div>\n                <div class=\"search-and-buttons-container\">\n                    <div>\n                        <mat-form-field appearance=\"outline\" class=\"language-select\">\n                            <!-- <mat-label style=\"font-weight: normal;\">\n                                {{ filterForm.get('status')?.value ? '' : 'Select Status' }}\n                            </mat-label> -->\n\n                            <mat-select formControlName=\"status\" panelClass=\"select-search-panel\"\n                                (selectionChange)=\"onFilterChange()\">\n\n                                <!-- Search box -->\n                                <input style=\"border:1px solid #ccc; padding: 5px;width: 92%;margin: 5px;\" matInput\n                                    placeholder=\"Search Status\" (click)=\"$event.stopPropagation()\"\n                                    (keydown)=\"$event.stopPropagation()\"\n                                    (keyup)=\"filterList($any($event.target).value, 'status')\" />\n\n                                <!-- Values -->\n                                <mat-option *ngFor=\"let r of filteredStatus\" [value]=\"r?.code\">\n                                    {{ r?.label }}\n                                </mat-option>\n\n                            </mat-select>\n                        </mat-form-field>\n                    </div>\n                </div>\n                <div class=\"search-and-buttons-container\">\n                    <div>\n                        <mat-form-field appearance=\"outline\" class=\"language-select\">\n                            <!-- <mat-label style=\"font-weight: normal;\">\n                                {{ filterForm.get('time')?.value ? '' : 'Select Time' }}\n                            </mat-label> -->\n\n                            <mat-select formControlName=\"time\" panelClass=\"select-search-panel\"\n                                (selectionChange)=\"onFilterChange()\">\n\n                                <!-- Search box -->\n                                <input style=\"border:1px solid #ccc; padding: 5px;width: 92%;margin: 5px;\" matInput\n                                    placeholder=\"Search Time\" (click)=\"$event.stopPropagation()\"\n                                    (keydown)=\"$event.stopPropagation()\"\n                                    (keyup)=\"filterList($any($event.target).value, 'time')\" />\n\n                                <!-- Values -->\n                                <mat-option *ngFor=\"let r of filteredTime\" [value]=\"r?.code\">\n                                    {{ r?.label }}\n                                </mat-option>\n\n                            </mat-select>\n                        </mat-form-field>\n                    </div>\n                </div>\n            </div>\n        </form>\n        <p class=\"mt-15\" style=\"font-family: 'Lato'; font-size: 18px; margin-left: 10px;margin-top: 15px;\">\n            {{totalRecords}} Approval Requests</p>\n        <table style=\"border-radius: 25px 25px 0 0;\n        overflow: hidden;\n        box-shadow: 0 5px 5px rgba(0, 0, 0, 0.12);\" mat-table [dataSource]=\"dataSource\"\n            class=\"mat-elevation-z2 full-width-table mt-10\">\n\n            <!-- Document Column -->\n            <ng-container matColumnDef=\"request_id\">\n                <th mat-header-cell *matHeaderCellDef> Request Name </th>\n                <td mat-cell *matCellDef=\"let request\" style=\"width: 25%;\">\n                    <div>\n                        <div class=\"doc-title\" *ngIf=\"request.request_name\">{{ request.request_name }}</div>\n                        <div class=\"doc-title\" *ngIf=\"!request.request_name\">{{ request.request_name }}</div>\n                    </div>\n                </td>\n            </ng-container>\n\n\n\n            <!-- Summary Text Column -->\n            <!-- <ng-container matColumnDef=\"summary_text\">\n                <th mat-header-cell *matHeaderCellDef> Summary </th>\n                <td mat-cell *matCellDef=\"let doc\">\n                    <div class=\"doc-summary-text\" style=\"width: 80%;\">\n                        <markdown [data]=\"doc?.summary_text | slice : 0 : 200\"></markdown>\n                    </div>\n                </td>\n            </ng-container> -->\n\n            <!-- Date Column -->\n            <ng-container matColumnDef=\"date\">\n                <th mat-header-cell *matHeaderCellDef> Date & Time</th>\n                <td mat-cell *matCellDef=\"let request\" style=\"width: 12%;\"> {{ request.created_at | date: 'MMM d, y hh:mm:ss a'}}\n                </td>\n            </ng-container>\n\n            <ng-container matColumnDef=\"designation\">\n                <th mat-header-cell *matHeaderCellDef> No. of Designation </th>\n                <td mat-cell *matCellDef=\"let request\" style=\"width: 10%; text-align: center;\">\n                    <span class=\"designation-count\">{{request?.designation_count}}</span>\n                </td>\n            </ng-container>\n\n\n            <!-- Summary Status Column -->\n            <ng-container matColumnDef=\"status\">\n                <th mat-header-cell *matHeaderCellDef> Request Status </th>\n                <td mat-cell *matCellDef=\"let request\" style=\"width: 10%;\">\n                    <span *ngIf=\"request.status === 'draft' || request.status === 'DRAFT' || request.status === 'revoke' || request.status === 'REVOKE' || request.status === 'REVOKED' || request.status === 'revoked'\" class=\"draft\"> Revoked </span>\n                    <span *ngIf=\"request.status === 'approved' || request.status === 'APPROVED'\" class=\"success\"> {{ request.status | titlecase\n                        }} </span>\n                    <span *ngIf=\"request.status === 'pending' || request.status === 'PENDING'\" class=\"in-progress\"> {{ request.status |\n                        titlecase }} </span>\n                    <span *ngIf=\"request.status === 'rejected' || request.status === 'REJECTED'\" class=\"rejected\"> {{ request.status |\n                        titlecase }} </span>\n                    <span (click)=\"showRejectPopup(request)\" *ngIf=\"request.status === 'rejected' || request.status === 'REJECTED'\" style=\"margin-left: 10px;cursor: pointer;\"><mat-icon class=\"vertical-middle\">remove_red_eye</mat-icon></span>\n                </td>\n            </ng-container>\n\n            <!-- Actions Column -->\n            <ng-container matColumnDef=\"actions\">\n                <th mat-header-cell *matHeaderCellDef> Actions </th>\n                <td mat-cell *matCellDef=\"let request\" style=\"width: 15%;\">\n                    <div class=\"action-flex\">\n                        <div>\n                            <button class=\"btn-active\" mat-raised-button color=\"primary\" (click)=\"viewRequest(request)\"\n                                matTooltip=\"View/Review Request\">\n                                View Request\n                            </button>\n                        </div>\n                        <div>\n                            <button style=\"margin-left: 15px;\" class=\"btn-gray\" *ngIf=\"request.status === 'PENDING' || request.status === 'pending'\" \n                                 (click)=\"revokeApprovalRequest(request)\" matTooltip=\"Revoke Request\">\n                                <mat-icon>cancel</mat-icon>\n                                Revoke Request\n                            </button>\n                        </div>\n                    </div>\n\n\n\n\n\n                </td>\n            </ng-container>\n\n            <!-- Header and Row Definitions -->\n            <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\n            <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\"></tr>\n\n            <!-- No Data Message -->\n\n        </table>\n        <div *ngIf=\"dataSource.data.length === 0\" class=\"no-data-message\">\n            No record found\n        </div>\n        <!-- Pagination -->\n        <div class=\"mt-1\">\n            <!-- <mat-paginator class=\"custom-pagination\" [pageSize]=\"5\" [pageSizeOptions]=\"[5, 10, 20]\"></mat-paginator> -->\n            <mat-paginator [length]=\"totalRecords\" [pageSize]=\"pageSize\" [pageIndex]=\"pageIndex\"\n                [pageSizeOptions]=\"[5, 10, 20]\" (page)=\"onPageChange($event)\">\n            </mat-paginator>\n        </div>\n\n\n    </mat-card>\n</div>\n\n<!-- Popup Overlay -->\n<div class=\"popup-overlay\" *ngIf=\"showRejectPopupFlag\">\n  <div class=\"popup-card\">\n    \n    <!-- Close Button -->\n    <button class=\"close-btn\" (click)=\"closeRejectPopup()\">&times;</button>\n\n    <!-- Title -->\n    <h2>Rejection Reason</h2>\n\n    <!-- Subtitle -->\n    <p class=\"subtitle\">\n      This request was rejected for the following reason:\n    </p>\n\n    <!-- Error Box -->\n    <div class=\"error-box\">\n      {{rejectionDetail?.reviewer_comments}}\n    </div>\n\n  </div>\n</div>\n\n<div class=\"popup-overlay\" *ngIf=\"showRevokeRequestPopupFlag\">\n  <div class=\"popup-card\">\n    \n    <!-- Close Button -->\n    <button class=\"close-btn\" (click)=\"closeRevokePopup()\">&times;</button>\n\n    <!-- Title -->\n    <h2>Revoke Request</h2>\n\n    <!-- Subtitle -->\n    <p class=\"subtitle\">\n     <strong>Are you sure you want to revoke this request? </strong><br><br>\n     Once revoked, you will not be able to make any changes to this request. If you wish to proceed later, you will need to create a new request and submit it again, Do you want to continue?  <br><br>\n     \n    </p>\n   \n\n   <div class=\"popup-footer\">\n        <div>\n            <input class=\"btn-active-gray\" mat-raised-button type=\"button\" value=\"No\" (click)=\"closeRevokePopup()\" />\n        </div>\n        <div class=\"ml-10\">\n            <button  mat-raised-button\n               class=\"btn-active\" (click)=\"revokeApprovalRequestConfirm()\">\n\n                Yes\n            </button>\n        </div>\n    </div>\n\n  </div>\n</div>\n\n\n<div class=\"overlay-loader\" *ngIf=\"loading\">\n    <mat-spinner diameter=\"50\"></mat-spinner>\n</div>", styles: [".upload-container{background:transparent;min-height:100vh;padding:24px 0;margin:0 30px 0 50px}.header{display:flex;flex-direction:row;justify-content:space-between}.primary-btn{background-color:#1b4ca1;color:#fff}:host .search .rsearch{position:relative}:host .search .search-icon{position:absolute;top:15px;font-size:20px;left:10px}:host .search .clear-icon{position:absolute;top:15px;font-size:20px;right:10px;color:#666}:host .search .clear-icon:hover{color:#333}:host .search .sinput{border-radius:32px;border:1px solid #d5d0d0;padding:12px 36px;font:400 14px Lato;width:100%}.no-data-message{text-align:center;padding:16px;font-style:italic;color:#888}.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:48px;padding:0 16px;justify-content:center;align-items:center;gap:8px;border:none;width:100%}.btn-active{border-radius:var(--Radius-Full-Round, 9999999px);opacity:1;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:34px;padding:0 16px;justify-content:center;align-items:center;gap:8px;border:none;width:100%}.btn-gray{border-radius:var(--Radius-Full-Round, 9999999px);opacity:1;background:var(--Primary-KB-Primary-Light, rgba(91, 90, 90, .7019607843));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:34px;justify-content:center;align-items:center;gap:4px;border:none;width:auto}.btn-gray:hover{background:var(--Primary-KB-Primary-Light, #1B4CA1)}.sub-heading p{color:#000;font-family:Montserrat;font-size:18px;font-style:normal;font-weight:600;line-height:normal}.ml-10{margin-left:10px}.mt-10{margin-top:15px}.mt-20{margin-top:20px}.mb-10{margin-bottom:10px}.cursor-pointer{cursor:pointer}.doc-title{font-weight:700}:host ::ng-deep .mat-mdc-header-row{position:sticky;top:0;z-index:10;background:#fff;font-size:16px;box-shadow:0 2px 4px #0000001a;padding:5px 10px}:host ::ng-deep .mat-mdc-row{font-size:16px}:host ::ng-deep .mat-mdc-cell{padding:5px 10px}:host ::ng-deep .mat-mdc-header-cell{background:#fff;font-weight:600;font-size:18px;border-bottom:2px solid #e0e0e0}:host ::ng-deep th.mat-mdc-header-cell:not(:last-child){position:relative;border-right:none;padding:5px 10px}:host ::ng-deep th.mat-mdc-header-cell:not(:last-child):after{content:\"\";position:absolute;top:12px;bottom:12px;right:0;width:1px;background-color:#e0e0e0}::ng-deep .doc-summary-text ::ng-deep markdown p{line-height:1.5rem;font-family:Lato;font-size:1rem!important;font-style:normal;font-weight:400}:host .mat-select-panel .search-wrapper{width:100%!important;box-sizing:border-box;padding:8px;position:sticky;top:0;z-index:2;background:#fff}.search-input{width:100%;padding:6px 10px;border:1px solid #ccc;border-radius:6px;outline:none;box-sizing:border-box}:host ::ng-deep .mat-select-panel-wrap{overflow:visible!important;padding:0;margin-top:42px}:host ::ng-deep .mat-select-panel{border:1px solid #ccc!important;box-sizing:border-box;max-height:250px}.edit-plan{display:flex;padding:4px 10px;justify-content:center;align-items:center;gap:8px;border-radius:4px;background:#1b4ca129;color:#1b4ca1;font-family:Lato;font-size:17px;font-style:normal;font-weight:400;line-height:normal;margin-left:10px;height:30px}.select-map-route-container{display:flex;flex-direction:row;width:100%}.select-map-flex{display:flex;flex-direction:row}.select-map-flex-container{display:flex;justify-content:space-between;width:100%}.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}.success{background:green;padding:4px 10px;color:#fff;border-radius:20px}.draft{background:#666;padding:4px 10px;color:#fff;border-radius:20px}.in-progress{background:orange;padding:4px 10px;color:#fff;border-radius:20px}.rejected{background:#d32f2f;padding:4px 10px;color:#fff;border-radius:20px}.filter-container{display:flex;align-items:center;flex-direction:row;width:100%;gap:10px;background:#e3ecfa;padding:10px;border-radius:10px}.w-50{width:50%}.search-and-buttons-container{display:flex;justify-content:space-between;gap:4px;flex-direction:column;flex-wrap:wrap;width:20%;margin:0 5px}::ng-deep .select-search-panel{border:1px solid #ccc!important;border-radius:12px!important;box-shadow:0 8px 20px #0000001f}:host ::ng-deep .mat-select-arrow-wrapper{margin-top:15px!important}:host ::ng-deep .mat-form-field-appearance-outline .mat-form-field-outline{color:#ccc}:host ::ng-deep .mat-form-field-appearance-outline.mat-focused .mat-form-field-outline-thick{color:#1b4ca1;border-color:#1b4ca1!important}:host ::ng-deep .select-search-panel .mat-option.mat-selected:not(.mat-option-disabled){background-color:#1b4ca1!important;color:#fff!important}:host ::ng-deep .mat-form-field-focused .mat-form-field-appearance-outline{border-color:#1b4ca1!important}:host ::ng-deep .mat-form-field-appearance-outline .mat-form-field-outline-start{border-radius:25px 0 0 25px;border:none!important}:host ::ng-deep .mat-form-field-appearance-outline .mat-form-field-outline-end{border-right:none!important;border:none!important;border-radius:0 25px 25px 0}:host ::ng-deep .mat-form-field-appearance-outline .mat-form-field-outline-gap{border:none!important;border-radius:25px}:host::ng-deep .mat-form-field-appearance-outline .mat-form-field-infix{background-color:transparent!important}:host ::ng-deep .search-and-buttons-container .mat-option-text{color:#fff!important}.header-container{display:flex;flex-direction:row;justify-content:space-between;width:100%;margin:10px 0}.right-side-container{display:flex;justify-content:space-between}:host ::ng-deep .language-select .mat-select-trigger{font-weight:400!important}:host ::ng-deep .language-select .mat-select-value{color:#fff!important;margin-top:12px!important}:host ::ng-deep .custom-pagination{background-color:transparent!important}.action-flex{display:flex;gap:10px}.designation-count{background:#d1ddf2;padding:9px 13px;border-radius:50%;margin:10px;color:#0f2b5b;text-align:center}.vertical-middle{vertical-align:middle}.popup-overlay{position:fixed;inset:0;background:#00000059;display:flex;justify-content:center;align-items:center;z-index:999}.popup-card{position:relative;width:500px;background:#fff;border-radius:16px;padding:28px 24px 24px;box-shadow:0 10px 30px #00000026;font-family:Arial,sans-serif}.popup-card h2{margin:0;font-size:20px;font-weight:700;color:#1f2937}.popup-card .subtitle{margin-top:10px;font-size:14px;color:#6b7280;line-height:1.4}.close-btn{position:absolute;top:16px;right:16px;width:32px;height:32px;border:2px solid #94a3b8;border-radius:50%;background:transparent;color:#64748b;font-size:18px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:.2s ease}.close-btn:hover{background:#f1f5f9}.error-box{margin-top:24px;padding:18px;border:1px solid #f5b5b5;background:#fff5f5;border-radius:12px;color:#c53030;font-size:18px;line-height:1.5;max-height:200px;overflow-y:auto}.popup-footer{display:flex;flex-direction:row;justify-content:end}.btn-active-gray{border-radius:var(--Radius-Full-Round, 9999999px);opacity:1;background:var(--Primary-KB-Primary-Light, rgba(91, 90, 90, .7019607843));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}\n"] }]
        }], ctorParameters: function () { return [{ type: i1.MatDialog }, { type: i2.SharedService }, { type: i3.MatSnackBar }, { type: i4.FormBuilder }, { type: i5.Router }]; }, propDecorators: { paginator: [{
                type: ViewChild,
                args: [MatPaginator]
            }] } });
//# sourceMappingURL=data:application/json;base64, 