import {
  DataTableComponent,
  ExportService
} from "./chunk-KV3IUGXW.js";
import "./chunk-TN2NHK56.js";
import "./chunk-TIV2UYBT.js";
import {
  jspdf_es_min_default,
  readSync,
  utils
} from "./chunk-YWQICJL7.js";
import "./chunk-LAL7OD5G.js";
import "./chunk-BP5JJWGC.js";
import "./chunk-IAAODDF7.js";
import "./chunk-2XS6LH2E.js";
import "./chunk-FXJXZPYD.js";
import "./chunk-NFRJCL7R.js";
import "./chunk-62OL73TD.js";
import "./chunk-IGGXREIH.js";
import {
  LoaderComponent
} from "./chunk-X5XWBDVM.js";
import "./chunk-KLTWPXW2.js";
import "./chunk-XKNDBYX7.js";
import {
  MenuMapService
} from "./chunk-3FLJCSSF.js";
import {
  ToastrService
} from "./chunk-2YLAF7RI.js";
import {
  CommonSharedModule,
  DynamicFontSizeDirective,
  NgxTippyDirective,
  Store,
  TimezoneService
} from "./chunk-7NQGM4EA.js";
import {
  DefaultValueAccessor,
  FormBuilder,
  FormControlName,
  FormGroupDirective,
  NgControlStatus,
  NgControlStatusGroup,
  RadioControlValueAccessor,
  ReactiveFormsModule,
  TranslatePipe,
  TranslateService,
  Validators,
  ɵNgNoValidate
} from "./chunk-NLYGDKUR.js";
import {
  animate,
  style,
  transition,
  trigger
} from "./chunk-ZEL7H2AL.js";
import {
  ActivatedRoute,
  GridApiService,
  LocalStorageService,
  Router
} from "./chunk-P7K2QEDI.js";
import {
  ChangeDetectorRef,
  DatePipe,
  HttpClientModule,
  NgClass,
  NgForOf,
  NgIf,
  Title,
  ɵsetClassDebugInfo,
  ɵɵProvidersFeature,
  ɵɵStandaloneFeature,
  ɵɵadvance,
  ɵɵattribute,
  ɵɵclassMapInterpolate1,
  ɵɵconditional,
  ɵɵdefineComponent,
  ɵɵdirectiveInject,
  ɵɵelement,
  ɵɵelementContainerEnd,
  ɵɵelementContainerStart,
  ɵɵelementEnd,
  ɵɵelementStart,
  ɵɵgetCurrentView,
  ɵɵlistener,
  ɵɵloadQuery,
  ɵɵnextContext,
  ɵɵpipe,
  ɵɵpipeBind1,
  ɵɵproperty,
  ɵɵpureFunction0,
  ɵɵpureFunction1,
  ɵɵpureFunction2,
  ɵɵqueryRefresh,
  ɵɵresetView,
  ɵɵrestoreView,
  ɵɵtemplate,
  ɵɵtemplateRefExtractor,
  ɵɵtext,
  ɵɵtextInterpolate,
  ɵɵtextInterpolate1,
  ɵɵviewQuery
} from "./chunk-GKZIWABI.js";
import {
  __async,
  __objRest,
  __spreadProps,
  __spreadValues
} from "./chunk-CVWHNZRK.js";

// src/app/@lcp-framework/pages/approval-requests/approval-requests.component.ts
var _c0 = ["actionTemplate"];
var _c1 = ["statusTemplate"];
var _c2 = ["approvalStatusTemplate"];
var _c3 = ["approverListTemplate"];
var _c4 = ["pendingApproverListTemplate"];
var _c5 = (a0) => ({ "!border-white-light !border-b-white text-primary dark:!border-[#191e3a] dark:!border-b-black": a0 });
var _c6 = () => ["pending_on_me", "delegated_on_me"];
var _c7 = (a0, a1) => [a0, a1];
var _c8 = (a0) => [a0];
function ApprovalRequestsComponent_ng_container_1_Template(rf, ctx) {
  if (rf & 1) {
    const _r2 = \u0275\u0275getCurrentView();
    \u0275\u0275elementContainerStart(0);
    \u0275\u0275elementStart(1, "button", 11);
    \u0275\u0275listener("click", function ApprovalRequestsComponent_ng_container_1_Template_button_click_1_listener() {
      const tab_r3 = \u0275\u0275restoreView(_r2).$implicit;
      const ctx_r3 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r3.setActiveTab(tab_r3.name));
    });
    \u0275\u0275text(2);
    \u0275\u0275pipe(3, "translate");
    \u0275\u0275elementEnd();
    \u0275\u0275elementContainerEnd();
  }
  if (rf & 2) {
    const tab_r3 = ctx.$implicit;
    const ctx_r3 = \u0275\u0275nextContext();
    \u0275\u0275advance();
    \u0275\u0275property("ngClass", \u0275\u0275pureFunction1(4, _c5, ctx_r3.activeTab == tab_r3.name));
    \u0275\u0275advance();
    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(3, 2, tab_r3.name), " ");
  }
}
function ApprovalRequestsComponent_ng_template_4_a_1_Template(rf, ctx) {
  if (rf & 1) {
    const _r6 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "a", 15);
    \u0275\u0275listener("click", function ApprovalRequestsComponent_ng_template_4_a_1_Template_a_click_0_listener() {
      \u0275\u0275restoreView(_r6);
      const item_r7 = \u0275\u0275nextContext().$implicit;
      const ctx_r3 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r3.viewItem(item_r7));
    });
    \u0275\u0275element(1, "i");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r3 = \u0275\u0275nextContext(2);
    \u0275\u0275advance();
    \u0275\u0275classMapInterpolate1("fa-regular fa-eye ", ctx_r3.store.fontsize === "large" ? "h-5.5 w-5.5" : ctx_r3.store.fontsize === "medium" ? "h-4.5 w-4.5" : "h-3.5 w-3.5", "");
  }
}
function ApprovalRequestsComponent_ng_template_4_Conditional_4_Template(rf, ctx) {
  if (rf & 1) {
    const _r8 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "button", 16);
    \u0275\u0275listener("click", function ApprovalRequestsComponent_ng_template_4_Conditional_4_Template_button_click_0_listener() {
      \u0275\u0275restoreView(_r8);
      const item_r7 = \u0275\u0275nextContext().$implicit;
      const ctx_r3 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r3.openApprovalProcessPopup(item_r7, "approval_completed"));
    });
    \u0275\u0275text(1);
    \u0275\u0275pipe(2, "translate");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(3, "button", 17);
    \u0275\u0275listener("click", function ApprovalRequestsComponent_ng_template_4_Conditional_4_Template_button_click_3_listener() {
      \u0275\u0275restoreView(_r8);
      const item_r7 = \u0275\u0275nextContext().$implicit;
      const ctx_r3 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r3.openApprovalProcessPopup(item_r7, "approval_rejected"));
    });
    \u0275\u0275text(4);
    \u0275\u0275pipe(5, "translate");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    \u0275\u0275advance();
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(2, 2, "approve"));
    \u0275\u0275advance(3);
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(5, 4, "reject"));
  }
}
function ApprovalRequestsComponent_ng_template_4_Template(rf, ctx) {
  if (rf & 1) {
    const _r5 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "div", 12);
    \u0275\u0275template(1, ApprovalRequestsComponent_ng_template_4_a_1_Template, 2, 3, "a", 13);
    \u0275\u0275elementStart(2, "a", 14);
    \u0275\u0275listener("click", function ApprovalRequestsComponent_ng_template_4_Template_a_click_2_listener() {
      const item_r7 = \u0275\u0275restoreView(_r5).$implicit;
      const ctx_r3 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r3.navigateToDetailPage(item_r7));
    });
    \u0275\u0275element(3, "i");
    \u0275\u0275elementEnd();
    \u0275\u0275template(4, ApprovalRequestsComponent_ng_template_4_Conditional_4_Template, 6, 6);
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r3 = \u0275\u0275nextContext();
    \u0275\u0275advance();
    \u0275\u0275property("ngIf", ctx_r3.masterInfo.permissions.details);
    \u0275\u0275advance(2);
    \u0275\u0275classMapInterpolate1("fa-solid fa-arrow-up-right-from-square ", ctx_r3.store.fontsize === "large" ? "h-5.5 w-5.5" : ctx_r3.store.fontsize === "medium" ? "h-4.5 w-4.5" : "h-3.5 w-3.5", "");
    \u0275\u0275advance();
    \u0275\u0275conditional(4, \u0275\u0275pureFunction0(5, _c6).includes(ctx_r3.activeTab) ? 4 : -1);
  }
}
function ApprovalRequestsComponent_ng_template_6_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "span", 18);
    \u0275\u0275text(1);
    \u0275\u0275pipe(2, "translate");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const item_r9 = ctx.$implicit;
    const ctx_r3 = \u0275\u0275nextContext();
    \u0275\u0275property("ngClass", \u0275\u0275pureFunction2(4, _c7, ctx_r3.store.fontsize === "large" ? "text-base" : ctx_r3.store.fontsize === "medium" ? "text-sm" : "text-xs", ctx_r3.statuses[item_r9.status] == null ? null : ctx_r3.statuses[item_r9.status].border_color));
    \u0275\u0275advance();
    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(2, 2, ctx_r3.statuses[item_r9.status].value), " ");
  }
}
function ApprovalRequestsComponent_ng_template_8_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "span", 19);
    \u0275\u0275text(1);
    \u0275\u0275pipe(2, "translate");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const item_r10 = ctx.$implicit;
    const ctx_r3 = \u0275\u0275nextContext();
    \u0275\u0275property("ngClass", \u0275\u0275pureFunction1(5, _c8, ctx_r3.store.fontsize === "large" ? "text-base" : ctx_r3.store.fontsize === "medium" ? "text-sm" : "text-xs"));
    \u0275\u0275attribute("data-tippy-content", item_r10.approvers);
    \u0275\u0275advance();
    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(2, 3, item_r10.approver_type), " ");
  }
}
function ApprovalRequestsComponent_ng_template_10_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "span", 19);
    \u0275\u0275text(1);
    \u0275\u0275pipe(2, "translate");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const item_r11 = ctx.$implicit;
    const ctx_r3 = \u0275\u0275nextContext();
    \u0275\u0275property("ngClass", \u0275\u0275pureFunction1(5, _c8, ctx_r3.store.fontsize === "large" ? "text-base" : ctx_r3.store.fontsize === "medium" ? "text-sm" : "text-xs"));
    \u0275\u0275attribute("data-tippy-content", item_r11.pending_approvers);
    \u0275\u0275advance();
    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(2, 3, item_r11.pending_with), " ");
  }
}
function ApprovalRequestsComponent_ng_template_12_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "span", 18);
    \u0275\u0275text(1);
    \u0275\u0275pipe(2, "translate");
    \u0275\u0275pipe(3, "translate");
    \u0275\u0275pipe(4, "translate");
    \u0275\u0275pipe(5, "translate");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const item_r12 = ctx.$implicit;
    const ctx_r3 = \u0275\u0275nextContext();
    \u0275\u0275property("ngClass", \u0275\u0275pureFunction2(10, _c7, ctx_r3.store.fontsize === "large" ? "text-base" : ctx_r3.store.fontsize === "medium" ? "text-sm" : "text-xs", item_r12.review_status === "approval_completed" ? "badge-outline-success" : "badge-outline-danger"));
    \u0275\u0275advance();
    \u0275\u0275textInterpolate1(" ", item_r12.review_status == "pending" ? \u0275\u0275pipeBind1(2, 2, "table_status_val_pending") : item_r12.review_status == "approval_needed" ? \u0275\u0275pipeBind1(3, 4, "table_status_val_approval_needed") : item_r12.review_status == "approval_completed" ? \u0275\u0275pipeBind1(4, 6, "table_status_val_approval_completed") : \u0275\u0275pipeBind1(5, 8, "table_status_val_approval_rejected"), " ");
  }
}
function ApprovalRequestsComponent_div_14_div_31_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "div", 44);
    \u0275\u0275text(1);
    \u0275\u0275pipe(2, "translate");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r3 = \u0275\u0275nextContext(2);
    \u0275\u0275advance();
    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(2, 1, ctx_r3.getErrorMessage("review_status")), " ");
  }
}
function ApprovalRequestsComponent_div_14_div_37_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "div", 44);
    \u0275\u0275text(1);
    \u0275\u0275pipe(2, "translate");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r3 = \u0275\u0275nextContext(2);
    \u0275\u0275advance();
    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(2, 1, ctx_r3.getErrorMessage("reason")), " ");
  }
}
function ApprovalRequestsComponent_div_14_Template(rf, ctx) {
  if (rf & 1) {
    const _r13 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "div", 20);
    \u0275\u0275element(1, "div", 21);
    \u0275\u0275elementStart(2, "div", 22)(3, "div", 23)(4, "div", 24)(5, "div", 25)(6, "div", 26)(7, "p", 27);
    \u0275\u0275text(8);
    \u0275\u0275pipe(9, "translate");
    \u0275\u0275elementEnd()();
    \u0275\u0275elementStart(10, "button", 28);
    \u0275\u0275listener("click", function ApprovalRequestsComponent_div_14_Template_button_click_10_listener() {
      \u0275\u0275restoreView(_r13);
      const ctx_r3 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r3.closeApprovalProcessPopup());
    });
    \u0275\u0275elementStart(11, "span", 29);
    \u0275\u0275text(12, "Close");
    \u0275\u0275elementEnd();
    \u0275\u0275element(13, "i", 30);
    \u0275\u0275elementEnd()()();
    \u0275\u0275elementStart(14, "div", 31)(15, "form", 32);
    \u0275\u0275listener("ngSubmit", function ApprovalRequestsComponent_div_14_Template_form_ngSubmit_15_listener() {
      \u0275\u0275restoreView(_r13);
      const ctx_r3 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r3.onSubmit());
    });
    \u0275\u0275elementStart(16, "div", 33)(17, "label", 34);
    \u0275\u0275text(18);
    \u0275\u0275pipe(19, "translate");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(20, "div", 35)(21, "label", 36);
    \u0275\u0275element(22, "input", 37);
    \u0275\u0275elementStart(23, "span", 38);
    \u0275\u0275text(24);
    \u0275\u0275pipe(25, "translate");
    \u0275\u0275elementEnd()();
    \u0275\u0275elementStart(26, "label", 36);
    \u0275\u0275element(27, "input", 37);
    \u0275\u0275elementStart(28, "span", 38);
    \u0275\u0275text(29);
    \u0275\u0275pipe(30, "translate");
    \u0275\u0275elementEnd()()();
    \u0275\u0275template(31, ApprovalRequestsComponent_div_14_div_31_Template, 3, 3, "div", 39);
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(32, "div", 33)(33, "label", 40);
    \u0275\u0275text(34);
    \u0275\u0275pipe(35, "translate");
    \u0275\u0275elementEnd();
    \u0275\u0275element(36, "textarea", 41);
    \u0275\u0275template(37, ApprovalRequestsComponent_div_14_div_37_Template, 3, 3, "div", 39);
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(38, "div", 42)(39, "button", 43);
    \u0275\u0275text(40, "Submit");
    \u0275\u0275elementEnd()()()()()()();
  }
  if (rf & 2) {
    let tmp_14_0;
    const ctx_r3 = \u0275\u0275nextContext();
    \u0275\u0275advance(8);
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(9, 11, "approval_process"));
    \u0275\u0275advance(7);
    \u0275\u0275property("formGroup", ctx_r3.approvalForm);
    \u0275\u0275advance(3);
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(19, 13, "review_status"));
    \u0275\u0275advance(4);
    \u0275\u0275property("value", "approval_completed");
    \u0275\u0275advance(2);
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(25, 15, "table_status_val_approval_completed"));
    \u0275\u0275advance(3);
    \u0275\u0275property("value", "approval_rejected");
    \u0275\u0275advance(2);
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(30, 17, "table_status_val_approval_rejected"));
    \u0275\u0275advance(2);
    \u0275\u0275property("ngIf", ctx_r3.isFieldInvalid("review_status"));
    \u0275\u0275advance(2);
    \u0275\u0275property("ngClass", \u0275\u0275pureFunction1(21, _c8, ((tmp_14_0 = ctx_r3.approvalForm.get("review_status")) == null ? null : tmp_14_0.value) === "approval_rejected" ? "required-mark" : ""));
    \u0275\u0275advance();
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(35, 19, "reason"));
    \u0275\u0275advance(3);
    \u0275\u0275property("ngIf", ctx_r3.isFieldInvalid("reason"));
  }
}
function ApprovalRequestsComponent_app_loader_15_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275element(0, "app-loader");
  }
}
var Tabs;
(function(Tabs2) {
  Tabs2["pending_on_me"] = "pending_on_me";
  Tabs2["pending"] = "pending";
  Tabs2["completed"] = "completed";
  Tabs2["delegated_on_me"] = "delegated_on_me";
})(Tabs || (Tabs = {}));
var _ApprovalRequestsComponent = class _ApprovalRequestsComponent {
  constructor(toastr, gridApiService, route, cdr, datepipe, router, storeData, exportService, datePipe, translate, localStorageService, commonService, titleService, fb, timezoneService) {
    this.toastr = toastr;
    this.gridApiService = gridApiService;
    this.route = route;
    this.cdr = cdr;
    this.datepipe = datepipe;
    this.router = router;
    this.storeData = storeData;
    this.exportService = exportService;
    this.datePipe = datePipe;
    this.translate = translate;
    this.localStorageService = localStorageService;
    this.commonService = commonService;
    this.titleService = titleService;
    this.fb = fb;
    this.timezoneService = timezoneService;
    this.customTemplates = {};
    this.column = "";
    this.query = "";
    this.activeTab = Tabs.pending_on_me;
    this.selectcolumns = [];
    this.headercolumns = [];
    this.approvalStatusData = {
      pending_on_me: ["approval_needed"],
      pending: ["pending"],
      completed: ["approval_completed", "approval_rejected"],
      delegated_on_me: ["approval_needed"]
    };
    this.headerColumnData = [];
    this.items = [];
    this.totalItems = 0;
    this.currentPage = 1;
    this.resultsPerPage = 10;
    this.enableCheckBox = false;
    this.policyData = null;
    this.loading = false;
    this.gridloading = true;
    this.title = "";
    this.listQuery = "";
    this.defaultQuery = "";
    this.attachedPolicies = [];
    this.requestTabs = [
      {
        name: Tabs.pending_on_me
      },
      {
        name: Tabs.pending
      },
      {
        name: Tabs.completed
      },
      {
        name: Tabs.delegated_on_me
      }
    ];
    this.isInfoModalOpen = false;
    this.submitted = false;
    this.selectedRequest = null;
    this.statuses = {
      1: {
        value: "table_status_val_0",
        border_color: "badge-outline-success"
      },
      2: {
        value: "table_status_val_1",
        border_color: "badge-outline-danger"
      },
      3: {
        value: "table_status_val_2",
        border_color: "badge-outline-secondary"
      }
    };
    this.initStore();
  }
  ngAfterViewInit() {
    this.config = JSON.parse(this.localStorageService.getData("config"));
    const pageInfo = this.route.snapshot.data["pageInfo"] || "";
    this.user_info = JSON.parse(this.localStorageService.getData("user_data"));
    this.resultsPerPage = parseInt(this.config.grid_pagination_default);
    this.grid_records_delete = this.config.grid_enable_associated_records_deletion;
    this.approvalForm = this.fb.group({
      review_status: ["approval_completed", Validators.required],
      reason: [""]
    });
    this.reviewStatusSub = this.approvalForm.get("review_status")?.valueChanges.subscribe((status) => {
      const reasonControl = this.approvalForm.get("reason");
      if (status === "approval_rejected") {
        reasonControl?.setValidators([Validators.required]);
      } else {
        reasonControl?.clearValidators();
      }
      reasonControl?.updateValueAndValidity();
    });
    this.user_id = this.user_info.main?.id;
    if (pageInfo && this.resultsPerPage) {
      if (this.user_info.main?.policies) {
        this.policyData = this.user_info.main?.policies || null;
      }
      this.masterInfo = pageInfo;
      const masterListConfig = pageInfo;
      const translateTitle = this.translate.instant(masterListConfig.fullEntity);
      this.titleService.setTitle(translateTitle);
      this.enableCheckBox = masterListConfig.enable_row_checkbox;
      this.title = masterListConfig.fullEntity;
      this.setHeader();
      this.setDefaultQuery();
      this.listQuery.start_index = 0;
      this.fetchAttachedPolicies(this.listQuery);
    } else {
      this.title = "Default Title";
      this.headercolumns = [];
      this.items = [];
    }
    this.cdr.detectChanges();
  }
  ngOnDestroy() {
    if (this.reviewStatusSub) {
      this.reviewStatusSub.unsubscribe();
    }
  }
  setHeader() {
    this.headerColumnData = [
      {
        header: "name",
        clause_type: "where",
        field_value: "approval_process_job_workflows.approval_process_job_name",
        is_sortable: "true",
        column_order: "1.00",
        column_width: "1.00",
        is_searchable: "true",
        is_grid_column: "true"
      },
      ...this.activeTab !== Tabs.pending ? [
        // {
        //   header: 'approver_type',
        //   clause_type: 'where',
        //   field_value: 'approval_process_job_workflows.approver_type',
        //   is_sortable: 'true',
        //   column_order: '2.00',
        //   column_width: '1.00',
        //   is_searchable: 'true',
        //   is_grid_column: 'true',
        // },
        // {
        //   header: 'approval_level',
        //   clause_type: 'where',
        //   field_value: 'approval_process_job_workflows.approver_order_no',
        //   is_sortable: 'true',
        //   column_order: '3.00',
        //   column_width: '1.00',
        //   is_searchable: 'true',
        //   is_grid_column: 'true',
        // },
        {
          header: "details",
          clause_type: "where",
          field_value: "approval_process_job_workflows.details",
          is_sortable: "true",
          column_order: "3.00",
          column_width: "1.00",
          is_searchable: "true",
          is_grid_column: "true"
        }
      ] : [
        {
          header: "details",
          clause_type: "where",
          field_value: "approval_process_job_workflows.details",
          is_sortable: "true",
          column_order: "3.00",
          column_width: "1.00",
          is_searchable: "true",
          is_grid_column: "true"
        }
      ],
      ...this.activeTab === Tabs.delegated_on_me ? [
        {
          header: "delegated_by",
          clause_type: "where",
          field_value: `u_delegator.email`,
          is_sortable: "true",
          column_order: "4.00",
          column_width: "1.00",
          is_searchable: "true",
          is_grid_column: "true"
        },
        {
          header: "start_date",
          clause_type: "where",
          field_value: `d.start_date`,
          is_sortable: "true",
          column_order: "5.00",
          column_width: "1.00",
          is_searchable: "true",
          is_grid_column: "true"
        },
        {
          header: "end_date",
          clause_type: "where",
          field_value: `d.end_date`,
          is_sortable: "true",
          column_order: "6.00",
          column_width: "1.00",
          is_searchable: "true",
          is_grid_column: "true"
        },
        {
          header: "details",
          clause_type: "where",
          field_value: "approval_process_job_workflows.details",
          is_sortable: "true",
          column_order: "3.00",
          column_width: "1.00",
          is_searchable: "true",
          is_grid_column: "true"
        }
      ] : [],
      // {
      //   header: 'name',
      //   clause_type: 'where',
      //   field_value: "concat(ud1.first_name, ' ', ud1.last_name)",
      //   is_sortable: 'true',
      //   column_order: '2.00',
      //   column_width: '2.00',
      //   is_searchable: 'true',
      //   is_grid_column: 'true',
      // },
      {
        header: "requested_by",
        clause_type: "where",
        field_value: "u1.email",
        is_sortable: "true",
        column_order: "7.00",
        column_width: "1.00",
        is_searchable: "true",
        is_grid_column: "true"
      },
      ...this.activeTab === Tabs.pending ? [
        {
          header: "pending_with",
          clause_type: "where",
          field_value: "pending.approver_type",
          is_sortable: "true",
          column_order: "8.00",
          column_width: "1.00",
          is_searchable: "true",
          is_grid_column: "true"
        },
        {
          header: "pending_level",
          clause_type: "where",
          field_value: "pending.approver_order_no",
          is_sortable: "true",
          column_order: "9.00",
          column_width: "1.00",
          is_searchable: "true",
          is_grid_column: "true"
        },
        {
          header: "pending_approvers",
          clause_type: "where",
          field_value: "pending.pending_approvers",
          is_sortable: "false",
          column_order: "0.00",
          column_width: "0.00",
          is_searchable: "false",
          is_grid_column: "false"
        }
      ] : [],
      ...this.activeTab === Tabs.completed ? [
        {
          header: "reviewed_by",
          clause_type: "where",
          field_value: "u2.email",
          is_sortable: "true",
          column_order: "10.00",
          column_width: "3.00",
          is_searchable: "true",
          is_grid_column: "true"
        },
        {
          header: "review_status",
          clause_type: "where",
          field_value: "approval_process_job_workflows.review_status",
          is_sortable: "true",
          column_order: "11.00",
          column_width: "1.00",
          is_searchable: "true",
          is_grid_column: "true"
        },
        {
          header: "reason",
          clause_type: "where",
          field_value: "approval_process_job_workflows.reason",
          is_sortable: "true",
          column_order: "12.00",
          column_width: "1.00",
          is_searchable: "true",
          is_grid_column: "true"
        }
      ] : [],
      // {
      //   header: 'status',
      //   clause_type: 'where',
      //   field_value: 'approval_process_job_workflow_users.status_id',
      //   is_sortable: 'true',
      //   column_order: '13.00',
      //   column_width: '1.00',
      //   is_searchable: 'false',
      //   is_grid_column: 'true',
      // },
      {
        header: "screen_id",
        clause_type: "where",
        field_value: "approval_process_job_workflows.screen_id",
        is_sortable: "false",
        column_order: "0.00",
        column_width: "0.00",
        is_searchable: "false",
        is_grid_column: "false"
      },
      {
        header: "url",
        clause_type: "where",
        field_value: "approval_process_job_workflows.url",
        is_sortable: "false",
        column_order: "16.00",
        column_width: "1.00",
        is_searchable: "false",
        is_grid_column: "false"
      },
      ...this.activeTab !== Tabs.pending ? [
        {
          header: "approval_process_job_workflow_id",
          clause_type: "where",
          field_value: "approval_process_job_workflow_users.approval_process_job_workflow_id",
          is_sortable: "false",
          column_order: "0.00",
          column_width: "0.00",
          is_searchable: "false",
          is_grid_column: "false"
        }
      ] : [],
      {
        header: "approval_process_job_id",
        clause_type: "where",
        field_value: "approval_process_job_workflows.approval_process_job_id",
        is_sortable: "false",
        column_order: "0.00",
        column_width: "0.00",
        is_searchable: "false",
        is_grid_column: "false"
      },
      ...this.activeTab !== Tabs.pending ? [
        {
          header: "approvers",
          clause_type: "where",
          field_value: `(
            SELECT string_agg(u3.email, ', ')
            FROM users u3
            WHERE u3.id IN (
              SELECT apjwu1.user_id 
              FROM approval_process_job_workflow_users apjwu1 
              WHERE apjwu1.approval_process_job_workflow_id = approval_process_job_workflow_users.approval_process_job_workflow_id
                AND apjwu1.status_id != 3
            )
          )`,
          is_sortable: "false",
          column_order: "0.00",
          column_width: "0.00",
          is_searchable: "false",
          is_grid_column: "false"
        }
      ] : []
    ];
  }
  setDefaultQuery() {
    this.defaultQuery = {
      pending_on_me: {
        print_query: true,
        company_id: 1,
        primary_table: "approval_process_job_workflow_users",
        start_index: 0,
        limit_range: 10,
        sort_columns: [["approval_process_job_workflows.approval_process_job_id", "desc"]],
        group_by: [
          "approval_process_job_workflows.approval_process_job_name",
          "ud1.first_name",
          "ud1.last_name",
          "u1.email",
          "u2.email",
          "approval_process_job_workflows.review_status",
          "approval_process_job_workflows.approver_type",
          "approval_process_job_workflows.approver_order_no",
          "approval_process_job_workflows.reason",
          "approval_process_job_workflow_users.status_id",
          "approval_process_job_workflows.screen_id",
          "approval_process_job_workflows.url",
          "approval_process_job_workflow_users.approval_process_job_workflow_id",
          "approval_process_job_workflows.approval_process_job_id",
          "approval_process_job_workflows.details"
        ],
        includes: [
          {
            join_type: "INNER",
            table_name: "approval_process_job_workflows",
            join_condition: `approval_process_job_workflows.id = approval_process_job_workflow_users.approval_process_job_workflow_id 
              AND approval_process_job_workflows.review_status IN (${this.approvalStatusData[this.activeTab].map((status) => `'${status}'`).join(",")})
              AND approval_process_job_workflows.status_id != 3`
          },
          {
            join_type: "LEFT",
            table_name: "users u1",
            join_condition: "u1.id = approval_process_job_workflows.user_id AND u1.status_id != 3"
          },
          {
            join_type: "LEFT",
            table_name: "user_details ud1",
            join_condition: "ud1.user_id = u1.id"
          },
          {
            join_type: "LEFT",
            table_name: "users u2",
            join_condition: "u2.id = approval_process_job_workflows.reviewed_by AND u2.status_id != 3"
          },
          {
            join_type: "LEFT",
            table_name: "user_details ud2",
            join_condition: "ud2.user_id = u2.id"
          }
        ],
        // having_conditions: null,
        // having_any_conditions: null,
        search_all: [
          {
            column_name: "approval_process_job_workflow_users.status_id",
            value: 3,
            operator: "!="
          },
          {
            column_name: "approval_process_job_workflow_users.user_id",
            value: this.user_info.main.id,
            operator: "="
          }
        ],
        search_any: [],
        select_columns: [...this.headerColumnData.map((column) => [column.field_value, column.header])]
      },
      pending: {
        print_query: true,
        company_id: 1,
        primary_table: "approval_process_job_workflows",
        start_index: 0,
        limit_range: 10,
        sort_columns: [["approval_process_job_workflows.id", "desc"]],
        group_by: [
          "approval_process_job_workflows.id",
          "approval_process_job_workflows.approval_process_job_name",
          "ud1.first_name",
          "ud1.last_name",
          "u1.email",
          "u2.email",
          "approval_process_job_workflows.reason",
          "approval_process_job_workflows.screen_id",
          "approval_process_job_workflows.url",
          "approval_process_job_workflows.approval_process_job_id",
          "pending.approver_type",
          "pending.approver_order_no",
          "pending.pending_approvers",
          "approval_process_job_workflows.details"
        ],
        includes: [
          {
            join_type: "INNER",
            table_name: `(
              SELECT DISTINCT
                apjw_inner.approval_process_job_id,
                apjw_inner.company_id
              FROM approval_process_job_workflow_users apjwu
              INNER JOIN approval_process_job_workflows apjw_inner
                ON apjwu.company_id = apjw_inner.company_id
                AND apjwu.approval_process_job_workflow_id = apjw_inner.id
              WHERE (
                apjwu.user_id = ${this.user_info.main.id} -- direct user
                OR (
                  EXISTS (
                    SELECT 1
                    FROM delegations d
                    WHERE d.delegated_user_id = ${this.user_info.main.id}
                      AND d.user_id = apjwu.user_id
                      AND d.company_id = apjwu.company_id
                      AND NOW() BETWEEN d.start_date AND d.end_date
                  )
                  AND apjw_inner.reviewed_by IS NULL
                )
                OR apjw_inner.reviewed_by = ${this.user_info.main.id} -- user has reviewed (delegated)
              )
              AND apjwu.status_id != 3
              AND apjwu.company_id = 1
            )  user_jobs`,
            join_condition: `approval_process_job_workflows.approval_process_job_id = user_jobs.approval_process_job_id 
              AND approval_process_job_workflows.company_id = user_jobs.company_id
              AND approval_process_job_workflows.status_id != 3`
          },
          {
            join_type: "LEFT",
            table_name: "users u1",
            join_condition: "u1.id = approval_process_job_workflows.user_id AND u1.status_id != 3"
          },
          {
            join_type: "LEFT",
            table_name: "user_details ud1",
            join_condition: "ud1.user_id = u1.id"
          },
          {
            join_type: "LEFT",
            table_name: "users u2",
            join_condition: "u2.id = approval_process_job_workflows.reviewed_by AND u2.status_id != 3"
          },
          {
            join_type: "LEFT",
            table_name: "user_details ud2",
            join_condition: "ud2.user_id = u2.id"
          },
          {
            join_type: "LEFT",
            table_name: `LATERAL (
              SELECT awf.approver_type, awf.approver_order_no, (
                  SELECT string_agg(u4.email, ', ')
                  FROM users u4
                  WHERE u4.id IN (
                    SELECT apjwu1.user_id
                    FROM approval_process_job_workflow_users apjwu1
                    WHERE apjwu1.approval_process_job_workflow_id = awf.id
                      AND apjwu1.status_id != 3
                  )
                ) pending_approvers
              FROM approval_process_job_workflows awf
              WHERE awf.approval_process_job_id = approval_process_job_workflows.approval_process_job_id
                AND awf.review_status = 'approval_needed'
                AND awf.status_id != 3
                AND awf.company_id = approval_process_job_workflows.company_id
              ORDER BY awf.approver_order_no ASC
            ) pending`,
            join_condition: "true"
          }
        ],
        // having_conditions: null,
        // having_any_conditions: null,
        search_all: [
          {
            column_name: "approval_process_job_workflows.review_status",
            value: "approval_needed",
            operator: "="
          },
          {
            column_name: "approval_process_job_workflows.status_id",
            value: 3,
            operator: "!="
          },
          {
            column_name: "approval_process_job_workflows.company_id",
            value: 1,
            operator: "="
          }
        ],
        search_any: [],
        select_columns: [...this.headerColumnData.map((column) => [column.field_value, column.header])]
      },
      completed: {
        print_query: true,
        company_id: 1,
        primary_table: "approval_process_job_workflow_users",
        start_index: 0,
        limit_range: 10,
        sort_columns: [["approval_process_job_workflows.approval_process_job_id", "desc"]],
        group_by: [
          "approval_process_job_workflows.approval_process_job_name",
          "ud1.first_name",
          "ud1.last_name",
          "u1.email",
          "u2.email",
          "approval_process_job_workflows.review_status",
          "approval_process_job_workflows.approver_type",
          "approval_process_job_workflows.approver_order_no",
          "approval_process_job_workflows.reason",
          "approval_process_job_workflow_users.status_id",
          "approval_process_job_workflows.screen_id",
          "approval_process_job_workflows.url",
          "approval_process_job_workflow_users.approval_process_job_workflow_id",
          "approval_process_job_workflows.approval_process_job_id",
          "approval_process_job_workflows.details"
        ],
        includes: [
          {
            join_type: "INNER",
            table_name: "approval_process_job_workflows",
            join_condition: `
              approval_process_job_workflows.company_id = approval_process_job_workflow_users.company_id 
              AND approval_process_job_workflows.status_id != 3
              AND approval_process_job_workflows.approval_process_job_id IN (
                SELECT DISTINCT 
                    apjw1.approval_process_job_id
                FROM 
                    approval_process_job_workflows apjw1
                LEFT JOIN approval_process_job_workflow_users apjwu1
                  ON apjwu1.approval_process_job_workflow_id = apjw1.id
                  AND apjwu1.company_id = apjw1.company_id
                  AND apjwu1.status_id != 3
                  AND apjwu1.user_id = ${this.user_info.main.id}
                LEFT JOIN delegations d
                  ON d.delegated_user_id = ${this.user_info.main.id}
                  AND d.status_id != 3
                  AND d.company_id = apjw1.company_id
                  AND apjw1.processed_at BETWEEN d.start_date AND d.end_date
                WHERE apjw1.company_id = approval_process_job_workflow_users.company_id
                  AND apjw1.status_id != 3
                  AND (
                    apjwu1.id IS NOT NULL                          -- directly assigned
                    OR (apjw1.reviewed_by = ${this.user_info.main.id} AND d.id IS NOT NULL) -- acted as delegate
                  )
              )
              AND (
                approval_process_job_workflows.review_status = 'approval_rejected'
                OR (
                  approval_process_job_workflows.review_status = 'approval_completed'
                  AND approval_process_job_workflows.approver_order_no = (
                    SELECT
                      MAX(approver_order_no)
                    FROM
                      approval_process_job_workflows apjw2
                    WHERE
                      apjw2.approval_process_job_id = approval_process_job_workflows.approval_process_job_id
                      AND apjw2.status_id != 3
                      AND apjw2.company_id = approval_process_job_workflow_users.company_id
                  )
                  AND (
                    SELECT
                      COUNT(*)
                    FROM
                      approval_process_job_workflows apjw3
                    WHERE
                      apjw3.approval_process_job_id = approval_process_job_workflows.approval_process_job_id
                      AND apjw3.status_id != 3
                      AND apjw3.company_id = approval_process_job_workflow_users.company_id
                      AND apjw3.review_status = 'approval_completed'
                  ) = (
                    SELECT
                      COUNT(*)
                    FROM
                      approval_process_job_workflows apjw4
                    WHERE
                      apjw4.approval_process_job_id = approval_process_job_workflows.approval_process_job_id
                      AND apjw4.status_id != 3
                      AND apjw4.company_id = approval_process_job_workflow_users.company_id
                  )
                )
              )
              AND approval_process_job_workflows.id = approval_process_job_workflow_users.approval_process_job_workflow_id
            `
          },
          {
            join_type: "LEFT",
            table_name: "users u1",
            join_condition: "u1.id = approval_process_job_workflows.user_id AND u1.status_id != 3"
          },
          {
            join_type: "LEFT",
            table_name: "user_details ud1",
            join_condition: "ud1.user_id = u1.id"
          },
          {
            join_type: "LEFT",
            table_name: "users u2",
            join_condition: "u2.id = approval_process_job_workflows.reviewed_by AND u2.status_id != 3"
          },
          {
            join_type: "LEFT",
            table_name: "user_details ud2",
            join_condition: "ud2.user_id = u2.id"
          }
        ],
        // having_conditions: null,
        // having_any_conditions: null,
        search_all: [
          {
            column_name: "approval_process_job_workflow_users.status_id",
            value: 1,
            operator: "="
          },
          {
            column_name: "approval_process_job_workflow_users.company_id",
            value: 1,
            operator: "="
          }
        ],
        search_any: [],
        select_columns: [...this.headerColumnData.map((column) => [column.field_value, column.header])]
      },
      delegated_on_me: {
        print_query: true,
        company_id: 1,
        primary_table: "approval_process_job_workflow_users",
        start_index: 0,
        limit_range: 10,
        sort_columns: [["approval_process_job_workflows.approval_process_job_id", "desc"]],
        group_by: [
          "approval_process_job_workflows.approval_process_job_name",
          "ud1.first_name",
          "ud1.last_name",
          "u1.email",
          "u2.email",
          "approval_process_job_workflows.review_status",
          "approval_process_job_workflows.approver_type",
          "approval_process_job_workflows.approver_order_no",
          "approval_process_job_workflows.reason",
          "approval_process_job_workflow_users.status_id",
          "approval_process_job_workflows.screen_id",
          "approval_process_job_workflows.url",
          "approval_process_job_workflow_users.approval_process_job_workflow_id",
          "approval_process_job_workflows.approval_process_job_id",
          "u_delegator.email",
          "d.start_date",
          "d.end_date",
          "approval_process_job_workflows.details"
        ],
        includes: [
          {
            join_type: "INNER",
            table_name: "delegations d",
            join_condition: `D.delegated_user_id = ${this.user_info.main?.id} 
            AND d.status_id != 3 
            AND d.company_id = approval_process_job_workflow_users.company_id
            AND NOW() BETWEEN d.start_date AND d.end_date
            AND approval_process_job_workflow_users.user_id = d.user_id`
          },
          {
            join_type: "INNER",
            table_name: "approval_process_job_workflows",
            join_condition: `approval_process_job_workflows.id = approval_process_job_workflow_users.approval_process_job_workflow_id 
              AND approval_process_job_workflows.review_status IN (${this.approvalStatusData[this.activeTab].map((status) => `'${status}'`).join(",")})
              AND approval_process_job_workflows.status_id != 3`
          },
          {
            join_type: "LEFT",
            table_name: "users u1",
            join_condition: "u1.id = approval_process_job_workflows.user_id AND u1.status_id != 3"
          },
          {
            join_type: "LEFT",
            table_name: "user_details ud1",
            join_condition: "ud1.user_id = u1.id"
          },
          {
            join_type: "LEFT",
            table_name: "users u2",
            join_condition: "u2.id = approval_process_job_workflows.reviewed_by AND u2.status_id != 3"
          },
          {
            join_type: "LEFT",
            table_name: "user_details ud2",
            join_condition: "ud2.user_id = u2.id"
          },
          {
            join_type: "LEFT",
            table_name: "users u_delegator",
            join_condition: "u_delegator.id = d.user_id"
          }
        ],
        // having_conditions: null,
        // having_any_conditions: null,
        search_all: [
          {
            column_name: "approval_process_job_workflow_users.status_id",
            value: 3,
            operator: "!="
          }
        ],
        search_any: [],
        select_columns: [...this.headerColumnData.map((column) => [column.field_value, column.header])]
      }
    };
    this.listQuery = JSON.parse(JSON.stringify(this.defaultQuery[this.activeTab]));
  }
  setActiveTab(tab) {
    return __async(this, null, function* () {
      this.activeTab = tab;
      this.query = "";
      this.setHeader();
      this.setDefaultQuery();
      this.fetchData(this.listQuery);
      this.cdr.detectChanges();
    });
  }
  initStore() {
    return __async(this, null, function* () {
      this.storeData.select((d) => d.index).subscribe((d) => {
        this.store = d;
      });
    });
  }
  sortColumn(column) {
    this.column = column;
    this.listQuery.limit_range = this.resultsPerPage;
    this.listQuery.sort_columns = [[this.column.field_value, this.column.sortDirection]];
    this.fetchData(this.listQuery);
  }
  advancedSearchData(data) {
    const query = data.data;
    const uncleanedwhereConditions = query.filter((d) => !d.isAggregate);
    const whereConditions = uncleanedwhereConditions.map((_a) => {
      var _b = _a, { isAggregate } = _b, rest = __objRest(_b, ["isAggregate"]);
      return rest;
    });
    const uncleanedhavingConditions = query.filter((d) => d.isAggregate);
    const havingConditions = uncleanedhavingConditions.map((_c) => {
      var _d = _c, { isAggregate } = _d, rest = __objRest(_d, ["isAggregate"]);
      return rest;
    });
    const condition = data.condition;
    const clonedListQuery = this.listQuery;
    const orgListQuery = this.defaultQuery[this.activeTab];
    if (whereConditions.length == 0 && havingConditions.length == 0) {
      if (condition == "AND") {
        clonedListQuery.search_all = [...orgListQuery.search_all];
      } else {
        clonedListQuery.search_any = [...orgListQuery.search_any];
      }
      this.fetchData(clonedListQuery);
      return;
    }
    if (havingConditions.length > 0) {
      if (condition == "AND") {
        clonedListQuery.having_conditions = [...havingConditions];
      } else {
        clonedListQuery.having_any_conditions = [...havingConditions];
      }
    }
    if (condition == "AND") {
      if (whereConditions.length === 1 && whereConditions[0].column_name === "") {
        clonedListQuery.search_all = [];
        clonedListQuery.search_all = [...orgListQuery.search_all];
      } else {
        clonedListQuery.search_all = [];
        clonedListQuery.search_all = [...orgListQuery.search_all, ...whereConditions];
      }
      clonedListQuery.start_index = 0;
      this.currentPage = 1;
      this.fetchData(clonedListQuery);
    } else {
      if (whereConditions.length === 1 && whereConditions[0].column_name === "") {
        clonedListQuery.search_any = [...clonedListQuery.search_any];
      } else {
        clonedListQuery.search_any = [...clonedListQuery.search_any, ...whereConditions];
      }
      clonedListQuery.start_index = 0;
      this.currentPage = 1;
      this.fetchData(clonedListQuery);
    }
  }
  searchData(input) {
    const clonedListQuery = this.listQuery;
    if (input.where.data.length) {
      const query = input.where.data;
      const search = input.where.search;
      if (search == "") {
        const orgListQuery = this.defaultQuery[this.activeTab];
        clonedListQuery.search_any = [];
        clonedListQuery.search_any = [...orgListQuery.search_any];
        this.fetchData(clonedListQuery);
        return;
      }
      if (query.length === 1 && query[0].column_name === "") {
        clonedListQuery.search_any = [...clonedListQuery.search_any];
      } else {
        clonedListQuery.search_any = [...query];
      }
    }
    if (input.having.data.length) {
      const query = input.having.data;
      const search = input.having.search;
      if (search.length)
        clonedListQuery.having_any_conditions = [...query];
    }
    clonedListQuery.start_index = 0;
    this.currentPage = 1;
    this.fetchData(clonedListQuery);
  }
  exportTable(item) {
    if (this.masterInfo.permissions.export_excel) {
      this.loading = true;
      if (this.masterInfo.children.export_excel && this.masterInfo.children.export_excel.component_class_name == "export_module") {
        this.exportItem(item);
      } else {
        const query = __spreadValues({}, this.listQuery);
        query.limit_range = 1e6;
        const export_download = this.masterInfo?.Listname.replace("_grid", "") + "_table_data";
        this.gridApiService.getAllRecords(this.localStorageService.replaceUniqueId(this.localStorageService.formatPayloadWithPolicyConditions(query, this.policyData, this.attachedPolicies), "$session_user_id", this.user_info.main.id)).subscribe((response) => {
          if (response.status && response.code === 200) {
            if (response.data.records && response.data.headers) {
              const filteredData = this.filterAndTransformData(response.data.headers, response.data.records);
              if (item.type == "pdf") {
                this.exportService.exportToPDF(filteredData, export_download);
              } else {
                this.exportService.exportToExcel(filteredData, export_download);
              }
              this.loading = false;
            }
          } else {
            this.loading = false;
            this.items = [];
            this.totalItems = 0;
            const key = response.message;
            const errorMessage = this.translate.instant(key);
            this.toastr.error(errorMessage, "Error");
          }
        }, (error) => {
          this.loading = false;
          const key = "error";
          const errorMessage = this.translate.instant(key);
          this.toastr.error(errorMessage, "Error");
        });
      }
    }
  }
  filterAndTransformData(headers, records) {
    const filteredHeaders = headers.filter((header) => header.header !== "id" && header.header !== "uuid");
    const transformedRecords = records.map((record) => {
      const transformedRecord = {};
      filteredHeaders.forEach((header) => {
        const translationKey = `${header.header}`;
        const translatedHeader = this.translate.instant(translationKey);
        if (header.field_type_id == "5") {
          transformedRecord[translatedHeader] = this.timezoneService.transformDateOnly(record[header.header]);
        } else if (header.field_type_id == "7") {
          transformedRecord[translatedHeader] = this.timezoneService.transformDateTime(record[header.header]);
        } else if (header.header == "status") {
          transformedRecord[translatedHeader] = this.getStatusTranslation(record[header.header]);
        } else {
          transformedRecord[translatedHeader] = record[header.header];
        }
      });
      return transformedRecord;
    });
    return transformedRecords;
  }
  getStatusTranslation(status) {
    return this.translate.instant(this.statuses[status].value);
  }
  fetchAttachedPolicies(params) {
    this.gridApiService.getAttachedPolicies({ entity_name: params.primary_table }).subscribe((response) => {
      if (response.status && response.code === 200) {
        this.attachedPolicies = response.data.attached_policies || [];
      }
    }, (error) => {
      const key = "error";
      const errorMessage = this.translate.instant(key);
      this.toastr.error(errorMessage, "Error");
    }, () => {
      this.fetchColumns();
      this.fetchData(this.listQuery);
    });
  }
  fetchColumns() {
    const data = [
      {
        order_no: 2,
        status_id: 1,
        company_id: 1,
        field: "approval_process_job_workflows.approval_process_job_name",
        clause_type: "where",
        sorting: true,
        title: this.translate.instant("job_name"),
        field_type_id: 3,
        searchable: true,
        is_grid_column: true,
        enable: true
      },
      {
        order_no: 3,
        status_id: 1,
        company_id: 1,
        field: "approval_process_job_workflows.details",
        clause_type: "where",
        sorting: true,
        title: this.translate.instant("details"),
        field_type_id: 3,
        searchable: false,
        is_grid_column: true,
        enable: true
      },
      // {
      //   order_no: 3,
      //   status_id: 1,
      //   company_id: 1,
      //   field: 'approval_process_job_workflows.approver_type',
      //   clause_type: 'where',
      //   sorting: true,
      //   title: this.translate.instant('approver_type'),
      //   field_type_id: 3,
      //   searchable: false,
      //   is_grid_column: true,
      //   enable: true,
      // },
      // {
      //   order_no: 4,
      //   status_id: 1,
      //   company_id: 1,
      //   field: 'approval_process_job_workflows.approver_order_no',
      //   clause_type: 'where',
      //   sorting: true,
      //   title: this.translate.instant('approval_level'),
      //   field_type_id: 1,
      //   searchable: true,
      //   is_grid_column: true,
      //   enable: true,
      // },
      // {
      //   order_no: 2,
      //   status_id: 1,
      //   company_id: 1,
      //   field: "concat(ud1.first_name, ' ', ud1.last_name)",
      //   clause_type: 'where',
      //   sorting: true,
      //   title: this.translate.instant('requested_user_name'),
      //   field_type_id: 3,
      //   searchable: true,
      //   is_grid_column: true,
      //   enable: true,
      // },
      {
        order_no: 5,
        status_id: 1,
        company_id: 1,
        field: "u1.email",
        clause_type: "where",
        sorting: true,
        title: this.translate.instant("requested_by"),
        field_type_id: 3,
        searchable: true,
        is_grid_column: true,
        enable: true
      },
      ...this.activeTab === Tabs.completed ? [
        {
          order_no: 6,
          status_id: 1,
          company_id: 1,
          field: "approval_process_job_workflows.reason",
          clause_type: "where",
          sorting: true,
          title: this.translate.instant("reason"),
          field_type_id: 3,
          searchable: true,
          is_grid_column: true,
          enable: true
        },
        {
          order_no: 7,
          status_id: 1,
          company_id: 1,
          field: "approval_process_job_workflows.review_status",
          clause_type: "where",
          sorting: true,
          title: this.translate.instant("review_status"),
          field_type_id: 3,
          searchable: true,
          is_grid_column: true,
          enable: true
        },
        {
          order_no: 8,
          status_id: 1,
          company_id: 1,
          field: "u2.email",
          clause_type: "where",
          sorting: true,
          title: this.translate.instant("reviewed_by"),
          field_type_id: 3,
          searchable: true,
          is_grid_column: true,
          enable: true
        }
        // {
        //   order_no: 2,
        //   status_id: 1,
        //   company_id: 1,
        //   field: "concat(ud2.first_name, ' ', ud2.last_name)",
        //   clause_type: 'where',
        //   sorting: true,
        //   title: this.translate.instant('requested_user_name'),
        //   field_type_id: 3,
        //   searchable: true,
        //   is_grid_column: true,
        //   enable: true,
        // },
      ] : [],
      {
        order_no: 9,
        status_id: 1,
        company_id: 1,
        field: "approval_process_job_workflows.review_status",
        clause_type: "where",
        sorting: false,
        title: this.translate.instant("review_status"),
        field_type_id: 3,
        searchable: false,
        is_grid_column: true,
        enable: false
      }
    ];
    this.selectcolumns = [
      {
        field: "S.No",
        title: "S.No",
        sorting: false,
        searchable: false,
        enable: false,
        field_type_id: 1
      },
      ...data,
      {
        field: "Status",
        title: "Status",
        sorting: false,
        searchable: false,
        enable: false,
        field_type_id: 1
      },
      {
        field: "Action",
        title: "Action",
        sorting: false,
        searchable: false,
        enable: false,
        field_type_id: 0
      }
    ];
  }
  fetchData(params) {
    params.limit_range = this.resultsPerPage;
    const payload = this.localStorageService.replaceUniqueId(this.localStorageService.formatPayloadWithPolicyConditions(params, this.policyData, this.attachedPolicies), "$session_user_id", this.user_info.main.id);
    this.commonService.getCommonList(payload).subscribe((response) => {
      if (response.status && response.code === 200) {
        const data = this.headerColumnData.filter((key) => key.is_grid_column == "true").map((key) => __spreadProps(__spreadValues({}, key), {
          column_width: "40px"
        }));
        const isOnlyViewOrViewExport = (!this.masterInfo.permissions.export_excel || this.masterInfo.permissions.export_excel === true) && (!this.masterInfo.permissions.create || this.masterInfo.permissions.create === true) && Object.keys(this.masterInfo.permissions).every((key) => key === "export_excel" || key === "create" || this.masterInfo.permissions[key] === false);
        if (this.config.grid_show_serial_number == "true") {
          this.headercolumns = [
            {
              header: "table_column_sno",
              field_value: "S.No",
              is_sortable: "false",
              column_order: "0.00",
              column_width: "40px",
              is_searchable: "false",
              is_grid_column: "true"
            },
            ...data
          ];
          if (!isOnlyViewOrViewExport) {
            this.headercolumns.push({
              header: "table_column_action",
              field_value: "Action",
              is_sortable: "false",
              column_order: "0.00",
              column_width: "50px",
              is_searchable: "false",
              is_grid_column: "true"
            });
          }
        } else {
          this.headercolumns = [...data];
          this.headercolumns.push({
            header: "table_column_action",
            field_value: "Action",
            is_sortable: "false",
            column_order: "0.00",
            column_width: "50px",
            is_searchable: "false",
            is_grid_column: "true"
          });
        }
        this.headercolumns = this.headercolumns.map((item) => {
          if (item.header === "status") {
            return __spreadProps(__spreadValues({}, item), {
              customTemplate: this.statusTemplate
            });
          } else if (item.header === "review_status") {
            return __spreadProps(__spreadValues({}, item), {
              customTemplate: this.approvalStatusTemplate
            });
          } else if (item.header === "table_column_action") {
            return __spreadProps(__spreadValues({}, item), {
              customTemplate: this.actionTemplate
            });
          } else if (item.header === "approver_type") {
            return __spreadProps(__spreadValues({}, item), {
              customTemplate: this.approverListTemplate
            });
          } else if (item.header === "pending_with") {
            return __spreadProps(__spreadValues({}, item), {
              customTemplate: this.pendingApproverListTemplate
            });
          } else {
            return __spreadValues({}, item);
          }
        });
        if (response.data.records) {
          this.items = response.data.records.map((item, index) => {
            const formattedItem = __spreadValues({}, item);
            for (const key in formattedItem) {
              if (formattedItem.hasOwnProperty(key) && (key.toLowerCase().includes("date") || key.toLowerCase().includes("created_at") || key.toLowerCase().includes("updated_at")) && this.isDate(formattedItem[key])) {
                const transformedDate = this.timezoneService.transformDateTime(formattedItem[key]);
                if (transformedDate) {
                  formattedItem[key] = transformedDate;
                }
              }
            }
            if (this.config.grid_show_serial_number == "true") {
              return __spreadProps(__spreadValues({
                table_column_sno: this.listQuery.start_index + index + 1
              }, formattedItem), {
                Action: index + 1
              });
            }
            return __spreadProps(__spreadValues({}, formattedItem), {
              // approver_type: this.translate.instant(item.approver_type),
              // ...(this.activeTab === Tabs.pending && { pending_with: this.translate.instant(item.pending_with) }),
              Action: index + 1
            });
          });
          this.totalItems = response.data.total_records;
          this.gridloading = false;
        } else {
          this.items = [];
          this.totalItems = 0;
          this.gridloading = false;
        }
      } else {
        this.items = [];
        this.totalItems = 0;
        this.gridloading = false;
        const key = response.message;
        const errorMessage = this.translate.instant(key);
        this.toastr.error(errorMessage, "Error");
      }
    }, (error) => {
      const key = "error";
      const errorMessage = this.translate.instant(key);
      this.toastr.error(errorMessage, "Error");
      this.gridloading = false;
    });
  }
  isDate(value) {
    return !isNaN(Date.parse(value));
  }
  formatDate(value) {
    return this.timezoneService.transformDateOnly(value);
  }
  capitalizeFirstLetter(string) {
    return string.charAt(0).toUpperCase() + string.slice(1);
  }
  handleCustomAction(action) {
    if (action === "addNew" && this.masterInfo.children.add) {
      this.router.navigate([`${this.masterInfo.children.add.target}`]);
    }
  }
  exportItem(item) {
    if (this.masterInfo.children.export_excel) {
      this.gridApiService.exportAllRecords(this.masterInfo.children.export_excel.id).subscribe({
        next: (response) => {
          try {
            const blob = new Blob([response.blob], {
              type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
            });
            if (item.type === "excel") {
              const url = window.URL.createObjectURL(blob);
              const link = document.createElement("a");
              link.href = url;
              link.download = response.fileName;
              document.body.appendChild(link);
              link.click();
              document.body.removeChild(link);
              window.URL.revokeObjectURL(url);
              this.loading = false;
            } else if (item.type === "pdf") {
              this.convertExcelToPDF(blob, response.fileName.replace(".xlsx", ".pdf"));
              this.loading = false;
            }
          } catch (err) {
            this.loading = false;
            console.error("Download error:", err);
            this.toastr.error("Error downloading file");
          }
        },
        error: (error) => {
          this.loading = false;
          console.error("Export error:", error);
          this.toastr.error("Error exporting data");
        }
      });
    }
  }
  convertExcelToPDF(blob, pdfFileName) {
    const reader = new FileReader();
    reader.onload = (event) => {
      const data = new Uint8Array(event.target.result);
      const workbook = readSync(data, { type: "array" });
      const firstSheetName = workbook.SheetNames[0];
      const worksheet = workbook.Sheets[firstSheetName];
      const sheetData = utils.sheet_to_json(worksheet, { header: 1 });
      const doc = new jspdf_es_min_default();
      let y = 10;
      sheetData.forEach((row) => {
        const rowText = row.join("  ");
        doc.text(rowText, 10, y);
        y += 10;
      });
      doc.save(pdfFileName);
    };
    reader.readAsArrayBuffer(blob);
  }
  commonTranslate(msg) {
    return this.translate.instant(msg);
  }
  viewItem(item) {
    if (this.masterInfo.children.details) {
      const targetRoute = this.masterInfo.children.details.target.replace(":uuid", item.approval_process_job_id);
      this.router.navigate([targetRoute]);
    }
  }
  navigateToDetailPage(item) {
    const fullUrl = `${item.url}${item.screen_id}`;
    this.router.navigate([fullUrl]);
  }
  onPageChange(event) {
    this.currentPage = event.page;
    this.listQuery.start_index = event.start_index;
    this.listQuery.limit_range = this.resultsPerPage;
    this.fetchData(this.listQuery);
  }
  onResultsPerPageChange(event) {
    this.currentPage = 1;
    this.resultsPerPage = event.resultsPerPage;
    this.listQuery.start_index = event.start_index;
    this.listQuery.limit_range = event.resultsPerPage;
    this.fetchData(this.listQuery);
  }
  openApprovalProcessPopup(item, status) {
    this.isInfoModalOpen = true;
    this.selectedRequest = item;
    this.approvalForm.controls["review_status"].setValue(status);
  }
  closeApprovalProcessPopup() {
    this.isInfoModalOpen = false;
    this.selectedRequest = null;
  }
  onSubmit() {
    this.submitted = true;
    if (this.approvalForm.invalid) {
      this.approvalForm.markAllAsTouched();
      return;
    }
    if (this.activeTab === Tabs.delegated_on_me) {
      const nowUtc = (/* @__PURE__ */ new Date()).toISOString();
      const startUtc = new Date(this.selectedRequest.start_date).toISOString();
      const endUtc = new Date(this.selectedRequest.end_date).toISOString();
      const isWithinRange = nowUtc >= startUtc && nowUtc <= endUtc;
      if (!isWithinRange)
        return;
    }
    const payload = {
      data: {
        table1: [
          {
            reason: this.approvalForm.value.reason,
            review_status: this.approvalForm.value.review_status,
            processed_at: /* @__PURE__ */ new Date(),
            reviewed_by: this.user_id
          }
        ]
      },
      table: ["approval_process_job_workflows"],
      action: ["update"],
      conditions: {
        table1: [
          {
            id: this.selectedRequest.approval_process_job_workflow_id,
            review_status: "approval_needed"
          }
        ]
      },
      table_mapping: ["table1"]
    };
    this.loading = true;
    this.gridApiService.executeRecords(payload).subscribe({
      next: (response) => {
        this.loading = false;
        if (response.code === 200 && response.status) {
          this.toastr.success("Record updated successfully", "Success");
          this.setActiveTab(Tabs.pending_on_me);
        } else {
          this.toastr.error("Error updating record", "Error");
        }
      },
      error: (error) => {
        this.loading = false;
        this.toastr.error("Error updating record", "Error");
      }
    });
    this.closeApprovalProcessPopup();
  }
  isFieldInvalid(fieldName) {
    const field = this.approvalForm.get(fieldName);
    return field ? field.invalid && (field.touched || this.submitted) : false;
  }
  getErrorMessage(fieldName) {
    const field = this.approvalForm.get(fieldName);
    if (field) {
      if (field.hasError("required")) {
        return "required_message";
      }
      if (field.hasError("maxlength")) {
        return `Maximum length exceeded (${field.errors?.["maxlength"].requiredLength} characters allowed)`;
      }
      if (field.hasError("min")) {
        return `Minimum value is ${field.errors?.["min"].min}`;
      }
      if (field.hasError("viewMandatory")) {
        return '"view" option is mandatory';
      }
    }
    return "";
  }
};
_ApprovalRequestsComponent.\u0275fac = function ApprovalRequestsComponent_Factory(t) {
  return new (t || _ApprovalRequestsComponent)(\u0275\u0275directiveInject(ToastrService), \u0275\u0275directiveInject(GridApiService), \u0275\u0275directiveInject(ActivatedRoute), \u0275\u0275directiveInject(ChangeDetectorRef), \u0275\u0275directiveInject(DatePipe), \u0275\u0275directiveInject(Router), \u0275\u0275directiveInject(Store), \u0275\u0275directiveInject(ExportService), \u0275\u0275directiveInject(DatePipe), \u0275\u0275directiveInject(TranslateService), \u0275\u0275directiveInject(LocalStorageService), \u0275\u0275directiveInject(MenuMapService), \u0275\u0275directiveInject(Title), \u0275\u0275directiveInject(FormBuilder), \u0275\u0275directiveInject(TimezoneService));
};
_ApprovalRequestsComponent.\u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _ApprovalRequestsComponent, selectors: [["app-approval-requests"]], viewQuery: function ApprovalRequestsComponent_Query(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275viewQuery(_c0, 5);
    \u0275\u0275viewQuery(_c1, 5);
    \u0275\u0275viewQuery(_c2, 5);
    \u0275\u0275viewQuery(_c3, 5);
    \u0275\u0275viewQuery(_c4, 5);
  }
  if (rf & 2) {
    let _t;
    \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx.actionTemplate = _t.first);
    \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx.statusTemplate = _t.first);
    \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx.approvalStatusTemplate = _t.first);
    \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx.approverListTemplate = _t.first);
    \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx.pendingApproverListTemplate = _t.first);
  }
}, standalone: true, features: [\u0275\u0275ProvidersFeature([DatePipe]), \u0275\u0275StandaloneFeature], decls: 16, vars: 16, consts: [["actionTemplate", ""], ["statusTemplate", ""], ["approverListTemplate", ""], ["pendingApproverListTemplate", ""], ["approvalStatusTemplate", ""], [1, "flex", "flex-wrap", "border-b", "border-white-light", "dark:border-[#191e3a]"], [4, "ngFor", "ngForOf"], [1, "flex-1", "p-3", "pt-6"], [3, "view", "customAction", "pageChange", "resultsPerPageChange", "columnSort", "searchQuery", "exportType", "advancedSearchQuery", "loading", "masterInfo", "enableCheckBox", "customTemplates", "headercolumns", "selectcolumns", "items", "totalItems", "currentPage", "resultsPerPage", "column", "title", "query"], ["class", "fixed inset-0 z-50 overflow-y-auto", 4, "ngIf"], [4, "ngIf"], [1, "-mb-[1px]", "block", "border", "border-transparent", "p-3.5", "py-2", "!outline-none", "transition", "duration-300", "hover:text-primary", "dark:hover:border-b-black", 3, "click", "ngClass"], [1, "flex", "items-center", "gap-4"], ["href", "javascript:void(0);", "class", "hover:text-primary", "ngxTippy", "", "data-tippy-content", "Details", "appDynamicFontSize", "body", 3, "click", 4, "ngIf"], ["href", "javascript:void(0);", "appDynamicFontSize", "body", "ngxTippy", "", "data-tippy-content", "View Requested Information", 1, "hover:text-primary", 3, "click"], ["href", "javascript:void(0);", "ngxTippy", "", "data-tippy-content", "Details", "appDynamicFontSize", "body", 1, "hover:text-primary", 3, "click"], [1, "btn", "btn-success", 3, "click"], [1, "btn", "btn-danger", 3, "click"], [1, "badge", 3, "ngClass"], ["ngxTippy", "", 1, "text-blue-600", 3, "ngClass"], [1, "fixed", "inset-0", "z-50", "overflow-y-auto"], [1, "fixed", "inset-0", "bg-black/50", "transition-opacity", "dark:bg-black/70"], [1, "flex", "min-h-screen", "items-center", "justify-center", "p-2", "sm:p-4"], [1, "max-w-auto", "relative", "w-10/12", "transform", "overflow-hidden", "rounded-lg", "bg-white", "shadow-xl", "transition-all", "dark:border", "dark:border-gray-700", "dark:bg-gray-800", "sm:w-8/12"], [1, "border-b", "bg-gray-50", "px-4", "py-3", "dark:border-gray-700", "dark:bg-gray-900", "sm:px-6"], [1, "flex", "items-center", "justify-between"], [1, "flex", "gap-4"], ["appDynamicFontSize", "body", 1, "text-md", "font-bold"], [1, "close-btn", 3, "click"], [1, "sr-only"], [1, "fa-solid", "fa-xmark"], [1, "max-h-auto", "gap-5", "overflow-y-auto", "px-4", "py-4", "sm:px-6"], [3, "ngSubmit", "formGroup"], [1, "mt-1"], ["for", "review_status", 1, "required-mark", "mb-2", "block", "font-medium"], [1, "flex", "items-center", "space-x-4"], [1, "disabled-input", "flex", "cursor-pointer", "items-center"], ["type", "radio", "formControlName", "review_status", "appDynamicFontSize", "body", 1, "form-radio", 3, "value"], [1, "ml-2", "text-white-dark"], ["class", "invalid-feedback mt-1 text-danger", 4, "ngIf"], ["for", "reason", 1, "mb-2", "block", "font-medium", 3, "ngClass"], ["id", "reason", "formControlName", "reason", "rows", "4", 1, "form-textarea"], [1, "mt-1", "flex", "justify-end"], ["type", "submit", 1, "btn", "btn-primary"], [1, "invalid-feedback", "mt-1", "text-danger"]], template: function ApprovalRequestsComponent_Template(rf, ctx) {
  if (rf & 1) {
    const _r1 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "div", 5);
    \u0275\u0275template(1, ApprovalRequestsComponent_ng_container_1_Template, 4, 6, "ng-container", 6);
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(2, "div", 7)(3, "app-datatable", 8);
    \u0275\u0275listener("view", function ApprovalRequestsComponent_Template_app_datatable_view_3_listener($event) {
      \u0275\u0275restoreView(_r1);
      return \u0275\u0275resetView(ctx.viewItem($event));
    })("customAction", function ApprovalRequestsComponent_Template_app_datatable_customAction_3_listener($event) {
      \u0275\u0275restoreView(_r1);
      return \u0275\u0275resetView(ctx.handleCustomAction($event));
    })("pageChange", function ApprovalRequestsComponent_Template_app_datatable_pageChange_3_listener($event) {
      \u0275\u0275restoreView(_r1);
      return \u0275\u0275resetView(ctx.onPageChange($event));
    })("resultsPerPageChange", function ApprovalRequestsComponent_Template_app_datatable_resultsPerPageChange_3_listener($event) {
      \u0275\u0275restoreView(_r1);
      return \u0275\u0275resetView(ctx.onResultsPerPageChange($event));
    })("columnSort", function ApprovalRequestsComponent_Template_app_datatable_columnSort_3_listener($event) {
      \u0275\u0275restoreView(_r1);
      return \u0275\u0275resetView(ctx.sortColumn($event));
    })("searchQuery", function ApprovalRequestsComponent_Template_app_datatable_searchQuery_3_listener($event) {
      \u0275\u0275restoreView(_r1);
      return \u0275\u0275resetView(ctx.searchData($event));
    })("exportType", function ApprovalRequestsComponent_Template_app_datatable_exportType_3_listener($event) {
      \u0275\u0275restoreView(_r1);
      return \u0275\u0275resetView(ctx.exportTable($event));
    })("advancedSearchQuery", function ApprovalRequestsComponent_Template_app_datatable_advancedSearchQuery_3_listener($event) {
      \u0275\u0275restoreView(_r1);
      return \u0275\u0275resetView(ctx.advancedSearchData($event));
    });
    \u0275\u0275elementEnd();
    \u0275\u0275template(4, ApprovalRequestsComponent_ng_template_4_Template, 5, 6, "ng-template", null, 0, \u0275\u0275templateRefExtractor)(6, ApprovalRequestsComponent_ng_template_6_Template, 3, 7, "ng-template", null, 1, \u0275\u0275templateRefExtractor)(8, ApprovalRequestsComponent_ng_template_8_Template, 3, 7, "ng-template", null, 2, \u0275\u0275templateRefExtractor)(10, ApprovalRequestsComponent_ng_template_10_Template, 3, 7, "ng-template", null, 3, \u0275\u0275templateRefExtractor)(12, ApprovalRequestsComponent_ng_template_12_Template, 6, 13, "ng-template", null, 4, \u0275\u0275templateRefExtractor);
    \u0275\u0275elementEnd();
    \u0275\u0275template(14, ApprovalRequestsComponent_div_14_Template, 41, 23, "div", 9)(15, ApprovalRequestsComponent_app_loader_15_Template, 1, 0, "app-loader", 10);
  }
  if (rf & 2) {
    \u0275\u0275advance();
    \u0275\u0275property("ngForOf", ctx.requestTabs);
    \u0275\u0275advance(2);
    \u0275\u0275property("loading", ctx.gridloading)("masterInfo", ctx.masterInfo)("enableCheckBox", ctx.enableCheckBox)("customTemplates", ctx.customTemplates)("headercolumns", ctx.headercolumns)("selectcolumns", ctx.selectcolumns)("items", ctx.items)("totalItems", ctx.totalItems)("currentPage", ctx.currentPage)("resultsPerPage", ctx.resultsPerPage)("column", ctx.column)("title", ctx.title)("query", ctx.query);
    \u0275\u0275advance(11);
    \u0275\u0275property("ngIf", ctx.isInfoModalOpen);
    \u0275\u0275advance();
    \u0275\u0275property("ngIf", ctx.loading);
  }
}, dependencies: [CommonSharedModule, NgClass, NgForOf, NgIf, \u0275NgNoValidate, DefaultValueAccessor, RadioControlValueAccessor, NgControlStatus, NgControlStatusGroup, NgxTippyDirective, DynamicFontSizeDirective, TranslatePipe, HttpClientModule, DataTableComponent, LoaderComponent, ReactiveFormsModule, FormGroupDirective, FormControlName], data: { animation: [
  trigger("toggleAnimation", [
    transition(":enter", [style({ opacity: 0, transform: "scale(0.95)" }), animate("100ms ease-out", style({ opacity: 1, transform: "scale(1)" }))]),
    transition(":leave", [animate("75ms", style({ opacity: 0, transform: "scale(0.95)" }))])
  ])
] } });
var ApprovalRequestsComponent = _ApprovalRequestsComponent;
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(ApprovalRequestsComponent, { className: "ApprovalRequestsComponent", filePath: "src\\app\\@lcp-framework\\pages\\approval-requests\\approval-requests.component.ts", lineNumber: 64 });
})();
export {
  ApprovalRequestsComponent
};
//# sourceMappingURL=chunk-JWSLKLJW.js.map
