import {
  DataTableComponent,
  ExportService,
  ProfileApiService,
  RouteUpdateService
} from "./chunk-KV3IUGXW.js";
import {
  OpenaiService
} from "./chunk-TIV2UYBT.js";
import {
  jspdf_es_min_default,
  readSync,
  utils
} from "./chunk-YWQICJL7.js";
import {
  StaticPageComponent
} from "./chunk-IAAODDF7.js";
import {
  FormBuilderComponent
} from "./chunk-FXJXZPYD.js";
import {
  LoaderComponent
} from "./chunk-X5XWBDVM.js";
import {
  require_sweetalert2_all
} from "./chunk-KLTWPXW2.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,
  ReactiveFormsModule,
  TranslatePipe,
  TranslateService,
  Validators,
  ɵNgNoValidate
} from "./chunk-NLYGDKUR.js";
import {
  animate,
  style,
  transition,
  trigger
} from "./chunk-ZEL7H2AL.js";
import {
  ActivatedRoute,
  GridApiService,
  LocalStorageService,
  Router,
  commonConfig,
  environment
} from "./chunk-P7K2QEDI.js";
import {
  ChangeDetectorRef,
  DatePipe,
  HttpClient,
  HttpClientModule,
  NgClass,
  NgIf,
  Title,
  lastValueFrom,
  ɵsetClassDebugInfo,
  ɵɵNgOnChangesFeature,
  ɵɵProvidersFeature,
  ɵɵStandaloneFeature,
  ɵɵadvance,
  ɵɵattribute,
  ɵɵclassMapInterpolate1,
  ɵɵclassProp,
  ɵɵdefineComponent,
  ɵɵdirectiveInject,
  ɵɵelement,
  ɵɵelementContainerEnd,
  ɵɵelementContainerStart,
  ɵɵelementEnd,
  ɵɵelementStart,
  ɵɵgetCurrentView,
  ɵɵlistener,
  ɵɵloadQuery,
  ɵɵnextContext,
  ɵɵpipe,
  ɵɵpipeBind1,
  ɵɵproperty,
  ɵɵpureFunction1,
  ɵɵpureFunction2,
  ɵɵpureFunction4,
  ɵɵqueryRefresh,
  ɵɵresetView,
  ɵɵrestoreView,
  ɵɵsanitizeUrl,
  ɵɵtemplate,
  ɵɵtemplateRefExtractor,
  ɵɵtext,
  ɵɵtextInterpolate,
  ɵɵtextInterpolate1,
  ɵɵviewQuery
} from "./chunk-GKZIWABI.js";
import {
  __async,
  __objRest,
  __spreadProps,
  __spreadValues,
  __toESM
} from "./chunk-CVWHNZRK.js";

// src/app/@lcp-framework/pages/master-list/master-list.component.ts
var import_sweetalert2 = __toESM(require_sweetalert2_all());
var _c0 = ["actionTemplate"];
var _c1 = ["statusTemplate"];
var _c2 = ["processStatusTemplate"];
var _c3 = ["linkDownloadVideoURLTemplate"];
var _c4 = ["linkDownloadPdfURLTemplate"];
var _c5 = ["linkDownloadWordURLTemplate"];
var _c6 = (a0, a1, a2, a3) => ({ "h-5.5 w-5.5": a0, "h-4.5 w-4.5": a1, "h-3.5 w-3.5": a2, "text-red-500": a3 });
var _c7 = (a0, a1) => [a0, a1];
var _c8 = (a0) => [a0];
function MasterListComponent_app_datatable_1_Template(rf, ctx) {
  if (rf & 1) {
    const _r1 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "app-datatable", 9);
    \u0275\u0275listener("delete", function MasterListComponent_app_datatable_1_Template_app_datatable_delete_0_listener($event) {
      \u0275\u0275restoreView(_r1);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.deleteItems($event));
    })("edit", function MasterListComponent_app_datatable_1_Template_app_datatable_edit_0_listener($event) {
      \u0275\u0275restoreView(_r1);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.editItem($event));
    })("view", function MasterListComponent_app_datatable_1_Template_app_datatable_view_0_listener($event) {
      \u0275\u0275restoreView(_r1);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.viewItem($event));
    })("customAction", function MasterListComponent_app_datatable_1_Template_app_datatable_customAction_0_listener($event) {
      \u0275\u0275restoreView(_r1);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.handleCustomAction($event));
    })("pageChange", function MasterListComponent_app_datatable_1_Template_app_datatable_pageChange_0_listener($event) {
      \u0275\u0275restoreView(_r1);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.onPageChange($event));
    })("resultsPerPageChange", function MasterListComponent_app_datatable_1_Template_app_datatable_resultsPerPageChange_0_listener($event) {
      \u0275\u0275restoreView(_r1);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.onResultsPerPageChange($event));
    })("columnSort", function MasterListComponent_app_datatable_1_Template_app_datatable_columnSort_0_listener($event) {
      \u0275\u0275restoreView(_r1);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.sortColumn($event));
    })("searchQuery", function MasterListComponent_app_datatable_1_Template_app_datatable_searchQuery_0_listener($event) {
      \u0275\u0275restoreView(_r1);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.searchData($event));
    })("exportType", function MasterListComponent_app_datatable_1_Template_app_datatable_exportType_0_listener($event) {
      \u0275\u0275restoreView(_r1);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.exportTable($event));
    })("advancedSearchQuery", function MasterListComponent_app_datatable_1_Template_app_datatable_advancedSearchQuery_0_listener($event) {
      \u0275\u0275restoreView(_r1);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.advancedSearchData($event));
    })("linkComponentClick", function MasterListComponent_app_datatable_1_Template_app_datatable_linkComponentClick_0_listener($event) {
      \u0275\u0275restoreView(_r1);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.onLinkComponentClick($event));
    });
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275property("loading", ctx_r1.gridloading)("masterInfo", ctx_r1.masterInfo)("enableCheckBox", ctx_r1.enableCheckBox)("customTemplates", ctx_r1.customTemplates)("headercolumns", ctx_r1.headercolumns)("selectcolumns", ctx_r1.selectcolumns)("items", ctx_r1.items)("totalItems", ctx_r1.totalItems)("currentPage", ctx_r1.currentPage)("resultsPerPage", ctx_r1.resultsPerPage)("column", ctx_r1.column)("title", ctx_r1.title)("query", ctx_r1.query)("unique_id", ctx_r1.uniqueId);
  }
}
function MasterListComponent_ng_template_2_a_1_Template(rf, ctx) {
  if (rf & 1) {
    const _r3 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "a", 20);
    \u0275\u0275listener("click", function MasterListComponent_ng_template_2_a_1_Template_a_click_0_listener() {
      \u0275\u0275restoreView(_r3);
      const item_r4 = \u0275\u0275nextContext().$implicit;
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.emailResendItem(item_r4));
    });
    \u0275\u0275element(1, "i");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext(2);
    \u0275\u0275advance();
    \u0275\u0275classMapInterpolate1("fa-solid fa-arrows-rotate ", ctx_r1.store.fontsize === "large" ? "h-5.5 w-5.5" : ctx_r1.store.fontsize === "medium" ? "h-4.5 w-4.5" : "h-3.5 w-3.5", "");
  }
}
function MasterListComponent_ng_template_2_a_2_Template(rf, ctx) {
  if (rf & 1) {
    const _r5 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "a", 21);
    \u0275\u0275listener("click", function MasterListComponent_ng_template_2_a_2_Template_a_click_0_listener() {
      \u0275\u0275restoreView(_r5);
      const item_r4 = \u0275\u0275nextContext().$implicit;
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.viewItem(item_r4));
    });
    \u0275\u0275element(1, "i");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext(2);
    \u0275\u0275advance();
    \u0275\u0275classMapInterpolate1("fa-regular fa-eye ", ctx_r1.store.fontsize === "large" ? "h-5.5 w-5.5" : ctx_r1.store.fontsize === "medium" ? "h-4.5 w-4.5" : "h-3.5 w-3.5", "");
  }
}
function MasterListComponent_ng_template_2_a_3_Template(rf, ctx) {
  if (rf & 1) {
    const _r6 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "a", 21);
    \u0275\u0275listener("click", function MasterListComponent_ng_template_2_a_3_Template_a_click_0_listener() {
      \u0275\u0275restoreView(_r6);
      const item_r4 = \u0275\u0275nextContext().$implicit;
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.viewPopupItem(item_r4));
    });
    \u0275\u0275element(1, "i");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext(2);
    \u0275\u0275advance();
    \u0275\u0275classMapInterpolate1("fa-regular fa-eye ", ctx_r1.store.fontsize === "large" ? "h-5.5 w-5.5" : ctx_r1.store.fontsize === "medium" ? "h-4.5 w-4.5" : "h-3.5 w-3.5", "");
  }
}
function MasterListComponent_ng_template_2_a_4_Template(rf, ctx) {
  if (rf & 1) {
    const _r7 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "a", 22);
    \u0275\u0275listener("click", function MasterListComponent_ng_template_2_a_4_Template_a_click_0_listener() {
      \u0275\u0275restoreView(_r7);
      const item_r4 = \u0275\u0275nextContext().$implicit;
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.editItem(item_r4));
    });
    \u0275\u0275element(1, "i");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext(2);
    \u0275\u0275advance();
    \u0275\u0275classMapInterpolate1("fa-regular fa-pen-to-square ", ctx_r1.store.fontsize === "large" ? "h-5.5 w-5.5" : ctx_r1.store.fontsize === "medium" ? "h-4.5 w-4.5" : "h-3.5 w-3.5", "");
  }
}
function MasterListComponent_ng_template_2_a_5_Template(rf, ctx) {
  if (rf & 1) {
    const _r8 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "a", 22);
    \u0275\u0275listener("click", function MasterListComponent_ng_template_2_a_5_Template_a_click_0_listener() {
      \u0275\u0275restoreView(_r8);
      const item_r4 = \u0275\u0275nextContext().$implicit;
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.editPopupItem(item_r4));
    });
    \u0275\u0275element(1, "i");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext(2);
    \u0275\u0275advance();
    \u0275\u0275classMapInterpolate1("fa-regular fa-pen-to-square ", ctx_r1.store.fontsize === "large" ? "h-5.5 w-5.5" : ctx_r1.store.fontsize === "medium" ? "h-4.5 w-4.5" : "h-3.5 w-3.5", "");
  }
}
function MasterListComponent_ng_template_2_a_6_Template(rf, ctx) {
  if (rf & 1) {
    const _r9 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "a", 23);
    \u0275\u0275listener("click", function MasterListComponent_ng_template_2_a_6_Template_a_click_0_listener() {
      \u0275\u0275restoreView(_r9);
      const item_r4 = \u0275\u0275nextContext().$implicit;
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.deleteItem(item_r4));
    });
    \u0275\u0275element(1, "i");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext(2);
    \u0275\u0275advance();
    \u0275\u0275classMapInterpolate1("fa-regular fa-trash-can ", ctx_r1.store.fontsize === "large" ? "h-5.5 w-5.5" : ctx_r1.store.fontsize === "medium" ? "h-4.5 w-4.5" : "h-3.5 w-3.5", "");
  }
}
function MasterListComponent_ng_template_2_a_7_Template(rf, ctx) {
  if (rf & 1) {
    const _r10 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "a", 24);
    \u0275\u0275listener("click", function MasterListComponent_ng_template_2_a_7_Template_a_click_0_listener() {
      \u0275\u0275restoreView(_r10);
      const item_r4 = \u0275\u0275nextContext().$implicit;
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.assignItem(item_r4));
    });
    \u0275\u0275element(1, "i");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext(2);
    \u0275\u0275advance();
    \u0275\u0275classMapInterpolate1("fa fa-tasks ", ctx_r1.store.fontsize === "large" ? "h-5.5 w-5.5" : ctx_r1.store.fontsize === "medium" ? "h-4.5 w-4.5" : "h-3.5 w-3.5", "");
  }
}
function MasterListComponent_ng_template_2_a_8_Template(rf, ctx) {
  if (rf & 1) {
    const _r11 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "a", 25);
    \u0275\u0275listener("click", function MasterListComponent_ng_template_2_a_8_Template_a_click_0_listener() {
      \u0275\u0275restoreView(_r11);
      const item_r4 = \u0275\u0275nextContext().$implicit;
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.printItem(item_r4));
    });
    \u0275\u0275element(1, "i");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext(2);
    \u0275\u0275advance();
    \u0275\u0275classMapInterpolate1("fa fa-print ", ctx_r1.store.fontsize === "large" ? "h-5.5 w-5.5" : ctx_r1.store.fontsize === "medium" ? "h-4.5 w-4.5" : "h-3.5 w-3.5", "");
  }
}
function MasterListComponent_ng_template_2_a_9_Template(rf, ctx) {
  if (rf & 1) {
    const _r12 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "a", 26);
    \u0275\u0275listener("click", function MasterListComponent_ng_template_2_a_9_Template_a_click_0_listener() {
      \u0275\u0275restoreView(_r12);
      const item_r4 = \u0275\u0275nextContext().$implicit;
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.recordExport(item_r4));
    });
    \u0275\u0275element(1, "i");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext(2);
    \u0275\u0275advance();
    \u0275\u0275classMapInterpolate1("fa fa-download ", ctx_r1.store.fontsize === "large" ? "h-5.5 w-5.5" : ctx_r1.store.fontsize === "medium" ? "h-4.5 w-4.5" : "h-3.5 w-3.5", "");
  }
}
function MasterListComponent_ng_template_2_a_10_Template(rf, ctx) {
  if (rf & 1) {
    const _r13 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "a", 27);
    \u0275\u0275listener("click", function MasterListComponent_ng_template_2_a_10_Template_a_click_0_listener() {
      \u0275\u0275restoreView(_r13);
      const item_r4 = \u0275\u0275nextContext().$implicit;
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.generateVector(item_r4));
    });
    \u0275\u0275element(1, "i");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext(2);
    \u0275\u0275advance();
    \u0275\u0275classMapInterpolate1("fa fa-sync ", ctx_r1.store.fontsize === "large" ? "h-5.5 w-5.5" : ctx_r1.store.fontsize === "medium" ? "h-4.5 w-4.5" : "h-3.5 w-3.5", "");
  }
}
function MasterListComponent_ng_template_2_a_11_Template(rf, ctx) {
  if (rf & 1) {
    const _r14 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "a", 28);
    \u0275\u0275listener("click", function MasterListComponent_ng_template_2_a_11_Template_a_click_0_listener() {
      \u0275\u0275restoreView(_r14);
      const item_r4 = \u0275\u0275nextContext().$implicit;
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.passwordModal(item_r4));
    });
    \u0275\u0275element(1, "i", 29);
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const item_r4 = \u0275\u0275nextContext().$implicit;
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275classProp("text-red-500", !item_r4.password)("hover:text-primary", item_r4.password);
    \u0275\u0275attribute("data-tippy-content", !item_r4.password ? "Set New Password" : "Reset Password");
    \u0275\u0275advance();
    \u0275\u0275property("ngClass", \u0275\u0275pureFunction4(6, _c6, ctx_r1.store.fontsize === "large", ctx_r1.store.fontsize === "medium", ctx_r1.store.fontsize === "small", !item_r4.password));
  }
}
function MasterListComponent_ng_template_2_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "div", 10);
    \u0275\u0275template(1, MasterListComponent_ng_template_2_a_1_Template, 2, 3, "a", 11)(2, MasterListComponent_ng_template_2_a_2_Template, 2, 3, "a", 12)(3, MasterListComponent_ng_template_2_a_3_Template, 2, 3, "a", 12)(4, MasterListComponent_ng_template_2_a_4_Template, 2, 3, "a", 13)(5, MasterListComponent_ng_template_2_a_5_Template, 2, 3, "a", 13)(6, MasterListComponent_ng_template_2_a_6_Template, 2, 3, "a", 14)(7, MasterListComponent_ng_template_2_a_7_Template, 2, 3, "a", 15)(8, MasterListComponent_ng_template_2_a_8_Template, 2, 3, "a", 16)(9, MasterListComponent_ng_template_2_a_9_Template, 2, 3, "a", 17)(10, MasterListComponent_ng_template_2_a_10_Template, 2, 3, "a", 18)(11, MasterListComponent_ng_template_2_a_11_Template, 2, 11, "a", 19);
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const item_r4 = ctx.$implicit;
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275advance();
    \u0275\u0275property("ngIf", ctx_r1.masterInfo.permissions.email_resend);
    \u0275\u0275advance();
    \u0275\u0275property("ngIf", ctx_r1.masterInfo.permissions.details);
    \u0275\u0275advance();
    \u0275\u0275property("ngIf", ctx_r1.masterInfo.permissions.popup_details);
    \u0275\u0275advance();
    \u0275\u0275property("ngIf", ctx_r1.masterInfo.permissions.edit && ((ctx_r1.masterInfo == null ? null : ctx_r1.masterInfo.Listname) == "mrn_grid" ? (item_r4 == null ? null : item_r4.mrn_status) != "completed" : (ctx_r1.masterInfo == null ? null : ctx_r1.masterInfo.Listname) == "min_grid" ? (item_r4 == null ? null : item_r4.min_status) != "completed" : true));
    \u0275\u0275advance();
    \u0275\u0275property("ngIf", ctx_r1.masterInfo.permissions.popup_edit && ((ctx_r1.masterInfo == null ? null : ctx_r1.masterInfo.Listname) == "mrn_grid" ? (item_r4 == null ? null : item_r4.mrn_status) != "completed" : (ctx_r1.masterInfo == null ? null : ctx_r1.masterInfo.Listname) == "min_grid" ? (item_r4 == null ? null : item_r4.min_status) != "completed" : true));
    \u0275\u0275advance();
    \u0275\u0275property("ngIf", ctx_r1.masterInfo.permissions.delete);
    \u0275\u0275advance();
    \u0275\u0275property("ngIf", ctx_r1.masterInfo.permissions.assign);
    \u0275\u0275advance();
    \u0275\u0275property("ngIf", ctx_r1.masterInfo.permissions.print);
    \u0275\u0275advance();
    \u0275\u0275property("ngIf", ctx_r1.masterInfo.permissions.record_export);
    \u0275\u0275advance();
    \u0275\u0275property("ngIf", ctx_r1.masterInfo.permissions.generate_vector);
    \u0275\u0275advance();
    \u0275\u0275property("ngIf", ctx_r1.allowPasswordModal);
  }
}
function MasterListComponent_ng_template_4_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "span", 30);
    \u0275\u0275text(1);
    \u0275\u0275pipe(2, "translate");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const item_r15 = ctx.$implicit;
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275property("ngClass", \u0275\u0275pureFunction2(4, _c7, ctx_r1.store.fontsize === "large" ? "text-base" : ctx_r1.store.fontsize === "medium" ? "text-sm" : "text-xs", ctx_r1.statuses[item_r15.status] == null ? null : ctx_r1.statuses[item_r15.status].border_color));
    \u0275\u0275advance();
    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(2, 2, ctx_r1.statuses[item_r15.status].value), " ");
  }
}
function MasterListComponent_ng_template_6_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "span", 30);
    \u0275\u0275text(1);
    \u0275\u0275pipe(2, "translate");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const item_r16 = ctx.$implicit;
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275property("ngClass", \u0275\u0275pureFunction2(4, _c7, ctx_r1.store.fontsize === "large" ? "text-base" : ctx_r1.store.fontsize === "medium" ? "text-sm" : "text-xs", ctx_r1.processStatuses[item_r16.process_status] == null ? null : ctx_r1.processStatuses[item_r16.process_status].border_color));
    \u0275\u0275advance();
    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(2, 2, ctx_r1.processStatuses[item_r16.process_status].value), " ");
  }
}
function MasterListComponent_ng_template_8_a_0_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "a", 32);
    \u0275\u0275element(1, "i", 33);
    \u0275\u0275text(2);
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const item_r17 = \u0275\u0275nextContext().$implicit;
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275property("href", item_r17.documentation_video_url, \u0275\u0275sanitizeUrl)("ngClass", \u0275\u0275pureFunction1(3, _c8, ctx_r1.store.fontsize === "large" ? "text-base" : ctx_r1.store.fontsize === "medium" ? "text-sm" : "text-xs"));
    \u0275\u0275advance(2);
    \u0275\u0275textInterpolate1(" ", item_r17.documentation_video_url, " ");
  }
}
function MasterListComponent_ng_template_8_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275template(0, MasterListComponent_ng_template_8_a_0_Template, 3, 5, "a", 31);
  }
  if (rf & 2) {
    const item_r17 = ctx.$implicit;
    \u0275\u0275property("ngIf", item_r17.documentation_video_url);
  }
}
function MasterListComponent_ng_template_10_a_0_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "a", 32);
    \u0275\u0275element(1, "i", 34);
    \u0275\u0275text(2);
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const item_r18 = \u0275\u0275nextContext().$implicit;
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275property("href", ctx_r1.apiUrl + "/" + item_r18.documentation_pdf, \u0275\u0275sanitizeUrl)("ngClass", \u0275\u0275pureFunction1(3, _c8, ctx_r1.store.fontsize === "large" ? "text-base" : ctx_r1.store.fontsize === "medium" ? "text-sm" : "text-xs"));
    \u0275\u0275advance(2);
    \u0275\u0275textInterpolate1(" ", item_r18.documentation_pdf, " ");
  }
}
function MasterListComponent_ng_template_10_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275template(0, MasterListComponent_ng_template_10_a_0_Template, 3, 5, "a", 31);
  }
  if (rf & 2) {
    const item_r18 = ctx.$implicit;
    \u0275\u0275property("ngIf", item_r18.documentation_pdf);
  }
}
function MasterListComponent_ng_template_12_a_0_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "a", 32);
    \u0275\u0275element(1, "i", 34);
    \u0275\u0275text(2);
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const item_r19 = \u0275\u0275nextContext().$implicit;
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275property("href", ctx_r1.apiUrl + "/" + item_r19.documentation_word, \u0275\u0275sanitizeUrl)("ngClass", \u0275\u0275pureFunction1(3, _c8, ctx_r1.store.fontsize === "large" ? "text-base" : ctx_r1.store.fontsize === "medium" ? "text-sm" : "text-xs"));
    \u0275\u0275advance(2);
    \u0275\u0275textInterpolate1(" ", item_r19.documentation_word, " ");
  }
}
function MasterListComponent_ng_template_12_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275template(0, MasterListComponent_ng_template_12_a_0_Template, 3, 5, "a", 31);
  }
  if (rf & 2) {
    const item_r19 = ctx.$implicit;
    \u0275\u0275property("ngIf", item_r19.documentation_word);
  }
}
function MasterListComponent_app_loader_14_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275element(0, "app-loader");
  }
}
function MasterListComponent_div_15_div_22_ng_container_1_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementContainerStart(0);
    \u0275\u0275text(1, " Password must include at least 8 characters, one uppercase letter, and one special character. ");
    \u0275\u0275elementContainerEnd();
  }
}
function MasterListComponent_div_15_div_22_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "div", 57);
    \u0275\u0275template(1, MasterListComponent_div_15_div_22_ng_container_1_Template, 2, 0, "ng-container", 7);
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    let tmp_8_0;
    const ctx_r1 = \u0275\u0275nextContext(2);
    \u0275\u0275advance();
    \u0275\u0275property("ngIf", (tmp_8_0 = ctx_r1.changePasswordForm.get("new_password")) == null ? null : tmp_8_0.errors == null ? null : tmp_8_0.errors["passwordInvalid"]);
  }
}
function MasterListComponent_div_15_div_28_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "div", 57);
    \u0275\u0275text(1);
    \u0275\u0275pipe(2, "translate");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    \u0275\u0275advance();
    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(2, 1, "form_confirm_new_pwd_req_msg"), " ");
  }
}
function MasterListComponent_div_15_Template(rf, ctx) {
  if (rf & 1) {
    const _r20 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "div", 35);
    \u0275\u0275element(1, "div", 36);
    \u0275\u0275elementStart(2, "div", 37)(3, "div", 38)(4, "div", 39)(5, "div", 40)(6, "h3", 41);
    \u0275\u0275text(7);
    \u0275\u0275pipe(8, "translate");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(9, "button", 42);
    \u0275\u0275listener("click", function MasterListComponent_div_15_Template_button_click_9_listener() {
      \u0275\u0275restoreView(_r20);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.cancelResetPwd());
    });
    \u0275\u0275elementStart(10, "span", 43);
    \u0275\u0275text(11, "Close");
    \u0275\u0275elementEnd();
    \u0275\u0275element(12, "i", 44);
    \u0275\u0275elementEnd()()();
    \u0275\u0275elementStart(13, "div", 45)(14, "form", 46);
    \u0275\u0275listener("ngSubmit", function MasterListComponent_div_15_Template_form_ngSubmit_14_listener() {
      \u0275\u0275restoreView(_r20);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.onChangePassword());
    });
    \u0275\u0275elementStart(15, "div", 47)(16, "div", 48)(17, "div")(18, "label", 49);
    \u0275\u0275text(19);
    \u0275\u0275pipe(20, "translate");
    \u0275\u0275elementEnd();
    \u0275\u0275element(21, "input", 50);
    \u0275\u0275template(22, MasterListComponent_div_15_div_22_Template, 2, 1, "div", 51);
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(23, "div")(24, "label", 52);
    \u0275\u0275text(25);
    \u0275\u0275pipe(26, "translate");
    \u0275\u0275elementEnd();
    \u0275\u0275element(27, "input", 53);
    \u0275\u0275template(28, MasterListComponent_div_15_div_28_Template, 3, 3, "div", 51);
    \u0275\u0275elementEnd()()();
    \u0275\u0275elementStart(29, "div", 54)(30, "button", 55);
    \u0275\u0275text(31);
    \u0275\u0275pipe(32, "translate");
    \u0275\u0275elementEnd()();
    \u0275\u0275elementStart(33, "p", 56)(34, "strong");
    \u0275\u0275text(35, "Note:");
    \u0275\u0275elementEnd();
    \u0275\u0275text(36, " Password must contain at least 8 characters, including one uppercase letter and one special character. ");
    \u0275\u0275elementEnd()()()()()();
  }
  if (rf & 2) {
    let tmp_10_0;
    let tmp_12_0;
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275advance(7);
    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(8, 7, "title_reset_password"), " ");
    \u0275\u0275advance(7);
    \u0275\u0275property("formGroup", ctx_r1.changePasswordForm);
    \u0275\u0275advance(5);
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(20, 9, "form_label_new_pwd"));
    \u0275\u0275advance(3);
    \u0275\u0275property("ngIf", ((tmp_10_0 = ctx_r1.changePasswordForm.get("new_password")) == null ? null : tmp_10_0.invalid) && ((tmp_10_0 = ctx_r1.changePasswordForm.get("new_password")) == null ? null : tmp_10_0.touched));
    \u0275\u0275advance(3);
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(26, 11, "form_label_confirm_new_pwd"));
    \u0275\u0275advance(3);
    \u0275\u0275property("ngIf", ((tmp_12_0 = ctx_r1.changePasswordForm.get("confirm_new_password")) == null ? null : tmp_12_0.invalid) && ((tmp_12_0 = ctx_r1.changePasswordForm.get("confirm_new_password")) == null ? null : tmp_12_0.touched));
    \u0275\u0275advance(3);
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(32, 13, "submit"));
  }
}
function MasterListComponent_div_16_app_loader_9_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275element(0, "app-loader");
  }
}
function MasterListComponent_div_16_div_10_Template(rf, ctx) {
  if (rf & 1) {
    const _r22 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "div", 64)(1, "span", 65);
    \u0275\u0275text(2, "No permission to view the details");
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(3, "button", 66);
    \u0275\u0275listener("click", function MasterListComponent_div_16_div_10_Template_button_click_3_listener() {
      \u0275\u0275restoreView(_r22);
      const ctx_r1 = \u0275\u0275nextContext(2);
      return \u0275\u0275resetView(ctx_r1.closeViewPopup());
    });
    \u0275\u0275text(4, "Close");
    \u0275\u0275elementEnd()();
  }
}
function MasterListComponent_div_16_ng_container_11_app_static_page_1_Template(rf, ctx) {
  if (rf & 1) {
    const _r23 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "app-static-page", 68);
    \u0275\u0275listener("closeModal", function MasterListComponent_div_16_ng_container_11_app_static_page_1_Template_app_static_page_closeModal_0_listener() {
      \u0275\u0275restoreView(_r23);
      const ctx_r1 = \u0275\u0275nextContext(3);
      return \u0275\u0275resetView(ctx_r1.closeViewPopup());
    });
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext(3);
    \u0275\u0275property("uuid", ctx_r1.selectedItemUuid)("entityName", ctx_r1.popupEntityName)("isModal", true);
  }
}
function MasterListComponent_div_16_ng_container_11_app_form_builder_2_Template(rf, ctx) {
  if (rf & 1) {
    const _r24 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "app-form-builder", 68);
    \u0275\u0275listener("closeModal", function MasterListComponent_div_16_ng_container_11_app_form_builder_2_Template_app_form_builder_closeModal_0_listener() {
      \u0275\u0275restoreView(_r24);
      const ctx_r1 = \u0275\u0275nextContext(3);
      return \u0275\u0275resetView(ctx_r1.closeViewPopup());
    });
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext(3);
    \u0275\u0275property("uuid", ctx_r1.selectedItemUuid)("entityName", ctx_r1.popupEntityName)("isModal", true);
  }
}
function MasterListComponent_div_16_ng_container_11_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementContainerStart(0);
    \u0275\u0275template(1, MasterListComponent_div_16_ng_container_11_app_static_page_1_Template, 1, 3, "app-static-page", 67)(2, MasterListComponent_div_16_ng_container_11_app_form_builder_2_Template, 1, 3, "app-form-builder", 67);
    \u0275\u0275elementContainerEnd();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext(2);
    \u0275\u0275advance();
    \u0275\u0275property("ngIf", ctx_r1.popupName == "popup_details");
    \u0275\u0275advance();
    \u0275\u0275property("ngIf", ctx_r1.popupName == "popup_add" || ctx_r1.popupName == "popup_edit");
  }
}
function MasterListComponent_div_16_Template(rf, ctx) {
  if (rf & 1) {
    const _r21 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "div", 35);
    \u0275\u0275element(1, "div", 36);
    \u0275\u0275elementStart(2, "div", 58)(3, "div", 59)(4, "button", 60);
    \u0275\u0275listener("click", function MasterListComponent_div_16_Template_button_click_4_listener() {
      \u0275\u0275restoreView(_r21);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1.closeViewPopup());
    });
    \u0275\u0275elementStart(5, "span", 43);
    \u0275\u0275text(6, "Close");
    \u0275\u0275elementEnd();
    \u0275\u0275element(7, "i", 61);
    \u0275\u0275elementEnd();
    \u0275\u0275elementStart(8, "div", 62);
    \u0275\u0275template(9, MasterListComponent_div_16_app_loader_9_Template, 1, 0, "app-loader", 7)(10, MasterListComponent_div_16_div_10_Template, 5, 0, "div", 63)(11, MasterListComponent_div_16_ng_container_11_Template, 3, 2, "ng-container", 7);
    \u0275\u0275elementEnd()()()();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275advance(9);
    \u0275\u0275property("ngIf", ctx_r1.loadingpopup);
    \u0275\u0275advance();
    \u0275\u0275property("ngIf", ctx_r1.noPopupPermission);
    \u0275\u0275advance();
    \u0275\u0275property("ngIf", !ctx_r1.noPopupPermission);
  }
}
var _MasterListComponent = class _MasterListComponent {
  set popupConfig(config) {
    if (config) {
      this.processPopup(config.popupName, config.selectedItemUuid, config.popupEntityName, config.isViewPopupOpen);
    }
  }
  constructor(toastr, gridApiService, apiService, http, route, cdr, datepipe, router, storeData, exportService, datePipe, translate, localStorageService, commonService, titleService, formBuilder, openaiService, routeUpdateService, timezoneService) {
    this.toastr = toastr;
    this.gridApiService = gridApiService;
    this.apiService = apiService;
    this.http = http;
    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.formBuilder = formBuilder;
    this.openaiService = openaiService;
    this.routeUpdateService = routeUpdateService;
    this.timezoneService = timezoneService;
    this.uuid = null;
    this.entity_name = "";
    this.popupName = "";
    this.isViewPopupOpen = false;
    this.popupEntityName = "";
    this.selectedItemUuid = null;
    this.nonGridPage = false;
    this.customTemplates = {};
    this.isItemModalOpen = false;
    this.column = "";
    this.query = "";
    this.allowPasswordModal = false;
    this.selectcolumns = [];
    this.headercolumns = [];
    this.items = [];
    this.totalItems = 0;
    this.currentPage = 1;
    this.resultsPerPage = 10;
    this.enableCheckBox = false;
    this.policyData = null;
    this.loading = false;
    this.loadingpopup = false;
    this.gridloading = true;
    this.title = "";
    this.listQuery = "";
    this.defaultQuery = "";
    this.attachedPolicies = [];
    this.apiUrl = environment.apiUrl;
    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.processStatuses = {
      submitted: {
        value: "table_process_status_val_0",
        border_color: "badge-outline-primary"
      },
      approved: {
        value: "table_process_status_val_1",
        border_color: "badge-outline-success"
      },
      rejected: {
        value: "table_process_status_val_2",
        border_color: "badge-outline-danger"
      },
      under_approval: {
        value: "table_process_status_val_3",
        border_color: "badge-outline-warning"
      },
      created: {
        value: "table_process_status_val_4",
        border_color: "badge-outline-success"
      },
      not_appear: {
        value: "table_process_status_val_5",
        border_color: "badge-outline-danger"
      }
    };
    this.noPopupPermission = false;
    this.isUUid = true;
    this.initStore();
    this.route.paramMap.subscribe((params) => {
      const id = params.get("id");
      const uuid = params.get("uuid");
      if (id) {
        this.isUUid = false;
      } else {
        this.isUUid = true;
      }
      const value = id || uuid;
      this.uniqueId = value;
    });
    this.changePasswordForm = this.formBuilder.group({
      new_password: ["", [Validators.required, Validators.minLength(8), this.passwordValidator]],
      confirm_new_password: ["", Validators.required]
    }, { validators: this.passwordMatchValidator });
  }
  passwordValidator(control) {
    const value = control.value;
    if (!value) {
      return null;
    }
    const hasUpperCase = /[A-Z]/.test(value);
    const hasSpecialChar = /[!@#$%^&*(),.?":{}|<>]/.test(value);
    const isValid = hasUpperCase && hasSpecialChar;
    return !isValid ? { passwordInvalid: true } : null;
  }
  passwordMatchValidator(group) {
    const newPassword = group.get("new_password")?.value;
    const confirmNewPassword = group.get("confirm_new_password")?.value;
    return newPassword === confirmNewPassword ? null : { passwordsMismatch: true };
  }
  ngAfterViewInit() {
    this.config = JSON.parse(this.localStorageService.getData("config"));
    let pageInfo;
    pageInfo = this.route.snapshot.data["pageInfo"] || "";
    console.log(pageInfo);
    this.user_info = JSON.parse(this.localStorageService.getData("user_data"));
    console.log(this.user_info);
    this.resultsPerPage = parseInt(this.config.grid_pagination_default);
    this.grid_records_delete = this.config.grid_enable_associated_records_deletion;
    if (pageInfo && this.resultsPerPage) {
      if (this.user_info.main?.policies) {
        this.policyData = this.user_info.main?.policies || null;
      }
      this.masterInfo = pageInfo;
      if (this.masterInfo.ListQuery.entity_name == "user") {
        this.allowPasswordModal = true;
      }
      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.defaultQuery = masterListConfig.ListQuery;
      this.listQuery = JSON.parse(JSON.stringify(this.defaultQuery));
      this.listQuery.start_index = 0;
      this.fetchAttachedPolicies(this.listQuery);
    } else {
      this.title = "Default Title";
      this.headercolumns = [];
      this.items = [];
    }
    this.cdr.detectChanges();
  }
  initStore() {
    return __async(this, null, function* () {
      this.storeData.select((d) => d.index).subscribe((d) => {
        this.store = d;
      });
    });
  }
  onChangePassword() {
    if (this.changePasswordForm && this.changePasswordForm.errors && this.changePasswordForm.errors["passwordsMismatch"]) {
      const key = "passwords_do_not_match";
      const errorMessage = this.translate.instant(key);
      this.toastr.error(errorMessage, "Error");
      return;
    }
    if (this.changePasswordForm.invalid) {
      this.markAllAsTouched();
      return;
    }
    const formData = {
      uuid: this.user_id,
      password: this.changePasswordForm.get("new_password")?.value
    };
    this.apiService.resetPasswordAnyUser(formData).subscribe((response) => {
      const key = "password_resetted_successfully";
      const successMessage = this.translate.instant(key);
      this.toastr.success(successMessage);
      this.changePasswordForm.reset();
      this.isItemModalOpen = false;
      this.fetchData(this.listQuery);
    }, (error) => {
      const key = "error_resetting_password";
      const errorMessage = this.translate.instant(key);
      this.toastr.error(errorMessage + error, "Error");
      this.isItemModalOpen = false;
    });
  }
  markAllAsTouched() {
    Object.values(this.changePasswordForm.controls).forEach((control) => {
      control.markAsTouched();
    });
  }
  sortColumn(column) {
    this.column = column;
    this.listQuery.limit_range = this.resultsPerPage;
    this.listQuery.sort_columns = [[this.column.header, this.column.sortDirection]];
    this.fetchData(this.listQuery);
  }
  passwordModal(item) {
    this.isItemModalOpen = true;
    this.user_id = item.uuid;
  }
  cancelResetPwd() {
    this.changePasswordForm.reset();
    this.isItemModalOpen = false;
  }
  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;
    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;
        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";
        let listParams = this.localStorageService.replaceUniqueId(this.localStorageService.formatPayloadWithPolicyConditions(query, this.policyData, this.attachedPolicies), "$session_user_id", this.user_info.main.id);
        listParams = this.localStorageService.replaceUniqueId(listParams, "$unique_id", this.uniqueId || "");
        this.gridApiService.getAllRecords(listParams).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 if (header.header == "process_status") {
          transformedRecord[translatedHeader] = this.getProcessStatusTranslation(record[header.header]);
        } else {
          transformedRecord[translatedHeader] = record[header.header];
        }
      });
      return transformedRecord;
    });
    return transformedRecords;
  }
  getStatusTranslation(status) {
    return this.translate.instant(this.statuses[status].value);
  }
  getProcessStatusTranslation(status) {
    return this.translate.instant(this.processStatuses[status].value);
  }
  fetchAttachedPolicies(params) {
    this.gridApiService.getAttachedPolicies({ entity_name: params.entity_name }).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.listQuery);
      this.fetchData(this.listQuery);
    });
  }
  fetchColumns(params) {
    this.gridApiService.getAllColumns({ entity_name: params.entity_name }).subscribe((response) => {
      if (response.status && response.code === 200) {
        const data = response.data.records.map((key, index) => {
          return __spreadValues({
            field: key.field_name,
            title: this.translate.instant(key.display_name),
            sorting: key.is_sortable,
            searchable: key.is_searchable,
            enable: true
          }, key);
        });
        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
          }
        ];
      }
    }, (error) => {
      const key = "error";
      const errorMessage = this.translate.instant(key);
      this.toastr.error(errorMessage, "Error");
    });
  }
  fetchData(params) {
    params.limit_range = this.resultsPerPage;
    let payload = this.localStorageService.replaceUniqueId(this.localStorageService.formatPayloadWithPolicyConditions(params, this.policyData, this.attachedPolicies), "$session_user_id", this.user_info.main.id);
    console.log(this.uniqueId);
    if (this.uniqueId) {
      payload.unique_id = this.uniqueId;
    }
    if (this.uuid) {
      payload.unique_id = this.uuid;
    }
    payload = this.localStorageService.replaceUniqueId(payload, "$unique_id", this.uniqueId || "");
    console.log(payload);
    this.gridApiService.getAllRecords(payload).subscribe((response) => {
      if (response.status && response.code === 200) {
        if (response.data.headers) {
          if (this.headercolumns.length == 0) {
            const data = response.data.headers.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];
              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"
                });
              }
            }
          }
          this.headercolumns = this.headercolumns.map((item) => {
            if (item.header === "status") {
              return __spreadProps(__spreadValues({}, item), {
                customTemplate: this.statusTemplate
              });
            } else if (item.header === "process_status") {
              return __spreadProps(__spreadValues({}, item), {
                customTemplate: this.processStatusTemplate
              });
            } else if (item.header === "table_column_action") {
              return __spreadProps(__spreadValues({}, item), {
                customTemplate: this.actionTemplate
              });
            } else if (item.header === "documentation_video_url") {
              return __spreadProps(__spreadValues({}, item), {
                customTemplate: this.linkDownloadVideoURLTemplate
              });
            } else if (item.header === "documentation_pdf") {
              return __spreadProps(__spreadValues({}, item), {
                customTemplate: this.linkDownloadPdfURLTemplate
              });
            } else if (item.header === "documentation_word") {
              return __spreadProps(__spreadValues({}, item), {
                customTemplate: this.linkDownloadWordURLTemplate
              });
            } 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("deleted_at") || 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), {
              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;
    });
  }
  executeJob(inputObject) {
    return __async(this, null, function* () {
      if (inputObject.record_info.id) {
        const job_query_information = this.localStorageService.replaceUniqueId(inputObject.query_information, "$unique_id", inputObject.record_info.id);
        try {
          const response = yield lastValueFrom(this.gridApiService.executeTransaction(job_query_information));
          if (!response.status) {
            throw new Error(response.message);
          }
        } catch (error) {
          throw error;
        }
      }
    });
  }
  isDate(value) {
    return !isNaN(Date.parse(value));
  }
  formatDate(value) {
    return this.timezoneService.transformDateOnly(value);
  }
  capitalizeFirstLetter(string) {
    return string.charAt(0).toUpperCase() + string.slice(1);
  }
  deleteItems(items) {
    this.items = this.items.filter((item) => !items.includes(item));
  }
  handleCustomAction(action) {
    console.log(action);
    console.log(this.masterInfo);
    if (action === "addNew" && this.masterInfo.children.add) {
      this.router.navigate([`${this.masterInfo.children.add.target}`]);
    }
    if (action === "addNew" && this.masterInfo.children.popup_add) {
      console.log(this.masterInfo);
      if (!this.masterInfo.permissions.popup_create && !this.masterInfo.permissions.create) {
        this.noPopupPermission = true;
        this.isViewPopupOpen = true;
        return;
      }
      this.loadingpopup = true;
      console.log("coming");
      this.popupName = "popup_add";
      this.selectedItemUuid = null;
      this.popupEntityName = this.masterInfo.children.popup_add.entity_name;
      this.isViewPopupOpen = true;
      setTimeout(() => {
        this.loadingpopup = false;
      }, 500);
    }
  }
  editPopupItem(item) {
    console.log(this.masterInfo);
    if (!this.masterInfo.permissions.popup_edit && !this.masterInfo.permissions.edit) {
      this.noPopupPermission = true;
      this.isViewPopupOpen = true;
      return;
    }
    this.loadingpopup = true;
    this.popupName = "popup_edit";
    console.log(this.popupName);
    console.log(this.masterInfo);
    this.selectedItemUuid = item.uuid;
    this.popupEntityName = this.masterInfo.children.popup_edit.entity_name;
    this.isViewPopupOpen = true;
    setTimeout(() => {
      this.loadingpopup = false;
    }, 500);
  }
  viewPopupItem(item) {
    console.log(this.masterInfo);
    if (this.masterInfo.permissions.popup_details || this.masterInfo.permissions.details) {
      this.loadingpopup = true;
      this.popupName = "popup_details";
      this.selectedItemUuid = item.uuid;
      this.popupEntityName = this.masterInfo.children.popup_details.entity_name;
      this.isViewPopupOpen = true;
      setTimeout(() => {
        this.loadingpopup = false;
      }, 500);
    } else {
      this.noPopupPermission = true;
      this.isViewPopupOpen = true;
      return;
    }
  }
  closeViewPopup() {
    this.isViewPopupOpen = false;
    this.selectedItemUuid = null;
    this.noPopupPermission = false;
  }
  editItem(item) {
    if (this.masterInfo.children.edit) {
      let targetRoute = this.masterInfo.children.edit.target;
      if (targetRoute.includes(":uuid") && item.uuid) {
        console.log("coming");
        targetRoute = targetRoute.replace(":uuid", item.uuid);
      } else if (targetRoute.includes(":id") && item.id) {
        console.log("coming");
        targetRoute = targetRoute.replace(":id", item.uuid);
      }
      this.router.navigate([targetRoute]);
    }
  }
  exportItem(item) {
    if (this.masterInfo.children.export_excel) {
      console.log(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);
  }
  assignItem(item) {
    if (this.masterInfo.children.assign) {
      let targetRoute = this.masterInfo.children.assign.target;
      if (targetRoute.includes(":uuid") && item.uuid) {
        console.log("coming");
        targetRoute = targetRoute.replace(":uuid", item.uuid);
      } else if (targetRoute.includes(":id") && item.id) {
        console.log("coming");
        targetRoute = targetRoute.replace(":id", item.uuid);
      }
      this.router.navigate([targetRoute]);
    }
  }
  recordExport(item) {
    this.loading = true;
    if (this.masterInfo.children.record_export) {
      let targetRoute = this.masterInfo.children.record_export.target;
      let recordID = item.id;
      if (targetRoute.includes(":uuid") && item.uuid) {
        recordID = item.uuid;
      } else if (targetRoute.includes(":id") && item.id) {
        recordID = item.id;
      }
      this.gridApiService.exportIndividualRecords(this.masterInfo.children.record_export.id, recordID).subscribe({
        next: (response) => {
          try {
            const blob = new Blob([response.blob], {
              type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
            });
            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;
          } catch (err) {
            console.error("Download error:", err);
            this.toastr.error("Error downloading file");
            this.loading = false;
          }
        },
        error: (error) => {
          console.error("Export error:", error);
          this.toastr.error("Error exporting data");
          this.loading = false;
        }
      });
    }
  }
  commonTranslate(msg) {
    return this.translate.instant(msg);
  }
  printItem(item) {
    if (this.masterInfo.children.print) {
      let targetRoute = this.masterInfo.children.print.target;
      if (targetRoute.includes(":uuid") && item.uuid) {
        console.log("coming");
        targetRoute = targetRoute.replace(":uuid", item.uuid);
      } else if (targetRoute.includes(":id") && item.id) {
        console.log("coming");
        targetRoute = targetRoute.replace(":id", item.uuid);
      }
      this.router.navigate([targetRoute]);
    }
  }
  directDeleteItem(item) {
    import_sweetalert2.default.fire({
      icon: "warning",
      title: "Are you sure?",
      text: "You won't be able to revert this!",
      showCancelButton: true,
      confirmButtonText: "Delete",
      padding: "2em"
    }).then((result) => __async(this, null, function* () {
      if (result.value) {
        try {
          const jobResponse = yield this.localStorageService.getMasterEntity({
            record_info: item,
            entity_name: this.masterInfo.children.delete.entity_name,
            entity_type: this.masterInfo.children.delete.component_class_name
          });
          if (jobResponse) {
            yield this.executeJob(__spreadProps(__spreadValues({}, jobResponse), { record_info: item }));
            import_sweetalert2.default.fire({ title: "Deleted!", text: "Your file has been deleted.", icon: "success" });
            this.fetchData(this.listQuery);
          }
        } catch (error) {
          const key = "error";
          const errorMessage = this.translate.instant(key);
          this.toastr.error(errorMessage, error.message);
        }
      }
    }));
  }
  generateVector(item) {
    if (this.masterInfo.permissions.generate_vector) {
      import_sweetalert2.default.fire({
        icon: "info",
        title: "Generate Vector?",
        text: "are you sure, you want to generate vector?",
        showCancelButton: true,
        confirmButtonText: "Generate",
        padding: "2em"
      }).then((result) => __async(this, null, function* () {
        if (result.value) {
          this.loading = true;
          this.openaiService.generateVectorForTable({ uuid: item.uuid }).subscribe((res) => {
            this.loading = false;
            if (res.status) {
              this.toastr.success("Vector generated successfully", "Success");
              this.setPageReload();
            } else {
              this.toastr.error("Failed to generate vector", "Error");
            }
          });
        }
      }));
    }
  }
  setPageReload() {
    setTimeout(() => {
      window.location.reload();
    }, 1e3);
  }
  emailResendItem(item) {
    if (this.masterInfo.children.email_resend && this.masterInfo.children.email_resend.component_class_name === commonConfig.ENTITY_TYPES.JOB_BUILDER_MODULE) {
      import_sweetalert2.default.fire({
        icon: "info",
        title: "Resend Notification?",
        text: "are you sure, you want to resend notification?",
        showCancelButton: true,
        confirmButtonText: "Resend",
        padding: "2em"
      }).then((result) => __async(this, null, function* () {
        if (result.value) {
          try {
            const jobResponse = yield this.localStorageService.getMasterEntity({
              record_info: item,
              entity_name: this.masterInfo.children.email_resend.entity_name,
              entity_type: this.masterInfo.children.email_resend.component_class_name
            });
            if (jobResponse) {
              yield this.executeJob(__spreadProps(__spreadValues({}, jobResponse), { record_info: item }));
              import_sweetalert2.default.fire({ title: "Notification resent request initiated!", text: "Notification resent request has been initiated.", icon: "success" });
              this.fetchData(this.listQuery);
            }
          } catch (error) {
            const key = "error";
            const errorMessage = this.translate.instant(key);
            this.toastr.error(errorMessage, error.message);
          }
        }
      }));
    }
  }
  deleteItem(item) {
    if (this.masterInfo.children.delete && this.masterInfo.children.delete.component_class_name === commonConfig.ENTITY_TYPES.JOB_BUILDER_MODULE) {
      if (this.grid_records_delete == "true") {
        const procedureParams = { proc_name: "check_for_related_records", params: { entity_name: this.listQuery.entity_name, record_id: item.id } };
        this.commonService.procedureCall(procedureParams).subscribe({
          next: (response) => {
            if (response.code === 200 && response.status && response.data) {
              const res = response.data?.[0]?.result || [];
              if (Object.keys(res).length > 0) {
                let htmlInput = `
  <span>` + this.commonTranslate("config_delete_msg_0") + `</span><br><br>
  <table style="width: 100%; text-align: center; border-collapse: collapse;">
  <thead>
    <tr>
      <th style="border: 1px solid #ddd; padding: 8px;">` + this.commonTranslate("config_delete_msg_1") + `</th>
      <th style="border: 1px solid #ddd; padding: 8px;">` + this.commonTranslate("config_delete_msg_2") + `</th>
    </tr> </thead><tbody>
`;
                Object.entries(res).forEach(([key, value]) => {
                  htmlInput += `
    <tr>
      <td style="border: 1px solid #ddd; padding: 8px;">${key}</td>
      <td style="border: 1px solid #ddd; padding: 8px;">${value}</td>
    </tr>
  `;
                });
                htmlInput += `</tbody></table>`;
                import_sweetalert2.default.fire({
                  title: `<span style="color: orange;">` + this.commonTranslate("config_delete_msg_3") + `!</span>`,
                  html: htmlInput,
                  customClass: {
                    title: "swal-title"
                  }
                });
              } else {
                this.directDeleteItem(item);
              }
            } else {
              const key = "error";
              const errorMessage = this.translate.instant(key);
              this.toastr.error(errorMessage, "Error");
            }
          },
          error: (error) => {
            console.error("Error fetching data:", error);
          },
          complete: () => {
          }
        });
      } else {
        this.directDeleteItem(item);
      }
    }
  }
  viewItem(item) {
    console.log(item);
    if (this.masterInfo.children.details) {
      let targetRoute = this.masterInfo.children.details.target;
      if (targetRoute.includes(":uuid") && item.uuid) {
        console.log("coming");
        targetRoute = targetRoute.replace(":uuid", item.uuid);
      } else if (targetRoute.includes(":id") && item.id) {
        console.log("coming");
        targetRoute = targetRoute.replace(":id", item.uuid);
      }
      this.router.navigate([targetRoute]);
    }
  }
  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);
  }
  openFormBuilderPopup(entityName, item) {
    this.loadingpopup = true;
    this.popupName = "popup_details";
    this.selectedItemUuid = item.uuid;
    this.popupEntityName = entityName;
    this.isViewPopupOpen = true;
    setTimeout(() => {
      this.loadingpopup = false;
    }, 500);
  }
  onLinkComponentClick(event) {
    console.log(event.col);
    if (event.col.link_type === "component") {
      const mode = event.col.link_mode || "popup_details";
      console.log(mode);
      console.log(this.masterInfo.permissions);
      if (mode == "popup_details" && !this.masterInfo.permissions.popup_details && !this.masterInfo.permissions.details) {
        this.noPopupPermission = true;
        this.isViewPopupOpen = true;
        return;
      } else if (mode == "popup_add" && !this.masterInfo.permissions.popup_create && !this.masterInfo.permissions.create) {
        this.noPopupPermission = true;
        this.isViewPopupOpen = true;
        return;
      } else if (mode == "popup_edit" && !this.masterInfo.permissions.popup_edit && !this.masterInfo.permissions.edit) {
        this.noPopupPermission = true;
        this.isViewPopupOpen = true;
        return;
      }
      this.popupName = mode;
      console.log(this.popupName);
      this.selectedItemUuid = event.item.uuid;
      if (mode === "popup_add") {
        this.selectedItemUuid = null;
      }
      console.log(this.selectedItemUuid);
      this.popupEntityName = event.col.link_action;
      console.log(this.popupEntityName);
      this.isViewPopupOpen = true;
      this.loadingpopup = true;
      setTimeout(() => {
        this.loadingpopup = false;
      }, 500);
    }
  }
  processPopup(popupName, selectedItemUuid, popupEntityName, isViewPopupOpen) {
    this.popupName = popupName;
    const userData = this.user_info || JSON.parse(this.localStorageService.getData("user_data"));
    const unorgmenuList = userData?.unorgmenuList || [];
    const permissions = userData?.permissions || {};
    let menuPermissionId = null;
    if (unorgmenuList && Array.isArray(unorgmenuList)) {
      let menuItem = null;
      if (popupName === "popup_add") {
        menuItem = unorgmenuList.find((item) => item.entity_name === popupEntityName && (item.action_slug === "add" || item.action_slug === "popup_add"));
      } else if (popupName === "popup_edit") {
        menuItem = unorgmenuList.find((item) => item.entity_name === popupEntityName && (item.action_slug === "edit" || item.action_slug === "popup_edit"));
      } else if (popupName === "popup_details") {
        menuItem = unorgmenuList.find((item) => item.entity_name === popupEntityName && (item.action_slug === "details" || item.action_slug === "popup_details"));
      }
      if (menuItem) {
        menuPermissionId = menuItem.permission_id;
      }
    }
    console.log(menuPermissionId);
    console.log(permissions);
    let hasPermission = true;
    if (menuPermissionId && userData?.main?.permissions && Array.isArray(userData.main.permissions)) {
      const permObj = userData.main.permissions.find((perm) => perm.id == menuPermissionId);
      hasPermission = !!(permObj && permObj.accessible);
    }
    if (!hasPermission) {
      this.noPopupPermission = true;
      this.isViewPopupOpen = true;
      return;
    }
    this.selectedItemUuid = selectedItemUuid;
    this.popupEntityName = popupEntityName;
    this.isViewPopupOpen = isViewPopupOpen;
    this.loadingpopup = true;
    setTimeout(() => {
      this.loadingpopup = false;
    }, 500);
  }
  ngOnChanges(changes) {
  }
};
_MasterListComponent.\u0275fac = function MasterListComponent_Factory(t) {
  return new (t || _MasterListComponent)(\u0275\u0275directiveInject(ToastrService), \u0275\u0275directiveInject(GridApiService), \u0275\u0275directiveInject(ProfileApiService), \u0275\u0275directiveInject(HttpClient), \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(OpenaiService), \u0275\u0275directiveInject(RouteUpdateService), \u0275\u0275directiveInject(TimezoneService));
};
_MasterListComponent.\u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _MasterListComponent, selectors: [["master-list"]], viewQuery: function MasterListComponent_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);
    \u0275\u0275viewQuery(_c5, 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.processStatusTemplate = _t.first);
    \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx.linkDownloadVideoURLTemplate = _t.first);
    \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx.linkDownloadPdfURLTemplate = _t.first);
    \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx.linkDownloadWordURLTemplate = _t.first);
  }
}, inputs: { uuid: "uuid", entity_name: "entity_name", popupName: "popupName", isViewPopupOpen: "isViewPopupOpen", popupEntityName: "popupEntityName", selectedItemUuid: "selectedItemUuid", popupConfig: "popupConfig", nonGridPage: "nonGridPage" }, standalone: true, features: [\u0275\u0275ProvidersFeature([DatePipe]), \u0275\u0275NgOnChangesFeature, \u0275\u0275StandaloneFeature], decls: 17, vars: 4, consts: [["actionTemplate", ""], ["statusTemplate", ""], ["processStatusTemplate", ""], ["linkDownloadVideoURLTemplate", ""], ["linkDownloadPdfURLTemplate", ""], ["linkDownloadWordURLTemplate", ""], [3, "loading", "masterInfo", "enableCheckBox", "customTemplates", "headercolumns", "selectcolumns", "items", "totalItems", "currentPage", "resultsPerPage", "column", "title", "query", "unique_id", "delete", "edit", "view", "customAction", "pageChange", "resultsPerPageChange", "columnSort", "searchQuery", "exportType", "advancedSearchQuery", "linkComponentClick", 4, "ngIf"], [4, "ngIf"], ["class", "fixed inset-0 z-50 overflow-y-auto", 4, "ngIf"], [3, "delete", "edit", "view", "customAction", "pageChange", "resultsPerPageChange", "columnSort", "searchQuery", "exportType", "advancedSearchQuery", "linkComponentClick", "loading", "masterInfo", "enableCheckBox", "customTemplates", "headercolumns", "selectcolumns", "items", "totalItems", "currentPage", "resultsPerPage", "column", "title", "query", "unique_id"], [1, "flex", "items-center", "gap-4"], ["href", "javascript:void(0);", "class", "hover:text-primary", "ngxTippy", "", "data-tippy-content", "Resend Email", "appDynamicFontSize", "body", 3, "click", 4, "ngIf"], ["href", "javascript:void(0);", "class", "hover:text-primary", "ngxTippy", "", "data-tippy-content", "Details", "appDynamicFontSize", "body", 3, "click", 4, "ngIf"], ["href", "javascript:void(0);", "class", "hover:text-info", "appDynamicFontSize", "body", "ngxTippy", "", "data-tippy-content", "Edit", 3, "click", 4, "ngIf"], ["href", "javascript:void(0);", "class", "hover:text-primary", "appDynamicFontSize", "body", "ngxTippy", "", "data-tippy-content", "Delete", 3, "click", 4, "ngIf"], ["href", "javascript:void(0);", "class", "hover:text-primary", "appDynamicFontSize", "body", "ngxTippy", "", "data-tippy-content", "Assign", 3, "click", 4, "ngIf"], ["href", "javascript:void(0);", "class", "hover:text-primary", "appDynamicFontSize", "body", "ngxTippy", "", "data-tippy-content", "Print", 3, "click", 4, "ngIf"], ["href", "javascript:void(0);", "class", "hover:text-primary", "appDynamicFontSize", "body", "ngxTippy", "", "data-tippy-content", "Record Export", 3, "click", 4, "ngIf"], ["href", "javascript:void(0);", "class", "hover:text-primary", "appDynamicFontSize", "body", "ngxTippy", "", "data-tippy-content", "Generate Vector", 3, "click", 4, "ngIf"], ["href", "javascript:void(0);", "appDynamicFontSize", "body", "ngxTippy", "", 3, "text-red-500", "hover:text-primary", "click", 4, "ngIf"], ["href", "javascript:void(0);", "ngxTippy", "", "data-tippy-content", "Resend Email", "appDynamicFontSize", "body", 1, "hover:text-primary", 3, "click"], ["href", "javascript:void(0);", "ngxTippy", "", "data-tippy-content", "Details", "appDynamicFontSize", "body", 1, "hover:text-primary", 3, "click"], ["href", "javascript:void(0);", "appDynamicFontSize", "body", "ngxTippy", "", "data-tippy-content", "Edit", 1, "hover:text-info", 3, "click"], ["href", "javascript:void(0);", "appDynamicFontSize", "body", "ngxTippy", "", "data-tippy-content", "Delete", 1, "hover:text-primary", 3, "click"], ["href", "javascript:void(0);", "appDynamicFontSize", "body", "ngxTippy", "", "data-tippy-content", "Assign", 1, "hover:text-primary", 3, "click"], ["href", "javascript:void(0);", "appDynamicFontSize", "body", "ngxTippy", "", "data-tippy-content", "Print", 1, "hover:text-primary", 3, "click"], ["href", "javascript:void(0);", "appDynamicFontSize", "body", "ngxTippy", "", "data-tippy-content", "Record Export", 1, "hover:text-primary", 3, "click"], ["href", "javascript:void(0);", "appDynamicFontSize", "body", "ngxTippy", "", "data-tippy-content", "Generate Vector", 1, "hover:text-primary", 3, "click"], ["href", "javascript:void(0);", "appDynamicFontSize", "body", "ngxTippy", "", 3, "click"], [1, "fa", "fa-key", 3, "ngClass"], [1, "badge", 3, "ngClass"], ["target", "_blank", "rel", "noopener noreferrer", "class", "flex items-center gap-2 text-blue-600 hover:underline", 3, "href", "ngClass", 4, "ngIf"], ["target", "_blank", "rel", "noopener noreferrer", 1, "flex", "items-center", "gap-2", "text-blue-600", "hover:underline", 3, "href", "ngClass"], [1, "fa-solid", "fa-up-right-from-square"], [1, "fa-solid", "fa-download"], [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, "relative", "w-full", "max-w-4xl", "transform", "overflow-hidden", "rounded-lg", "bg-white", "shadow-xl", "transition-all", "dark:border", "dark:border-gray-700", "dark:bg-gray-800"], [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, "text-base", "font-medium", "text-gray-900", "dark:text-gray-100", "sm:text-lg"], ["type", "button", 1, "rounded-md", "p-2", "text-gray-400", "hover:text-gray-900", "focus:outline-none", "focus:ring-2", "focus:ring-blue-500", "dark:hover:text-gray-100", 3, "click"], [1, "sr-only"], [1, "fa-solid", "fa-xmark"], [1, "px-4", "py-4", "sm:px-6"], [1, "mb-5", "rounded-md", "border", "border-[#ebedf2]", "bg-white", "p-4", "dark:border-[#191e3a]", "dark:bg-[#0e1726]", 3, "ngSubmit", "formGroup"], [1, "flex", "flex-col", "sm:flex-row"], [1, "grid", "flex-1", "gap-5", "sm:grid-cols-2"], ["for", "new_password", 1, "form-label"], ["type", "password", "formControlName", "new_password", "id", "new_password", 1, "form-input"], ["class", "text-red-500", 4, "ngIf"], ["for", "confirm_new_password", 1, "form-label"], ["type", "password", "formControlName", "confirm_new_password", "id", "confirm_new_password", 1, "form-input"], [1, "mt-5", "flex", "flex-col", "items-center"], ["appDynamicFontSize", "body", "type", "submit", 1, "btn", "btn-primary"], [1, "mt-3", "text-center", "text-sm", "text-gray-500", "dark:text-gray-400"], [1, "text-red-500"], [1, "flex", "min-h-screen", "items-center", "justify-center", "p-4"], [1, "relative", "w-full", "max-w-5xl", "transform", "overflow-visible", "rounded-lg", "bg-white", "shadow-xl", "transition-all", "dark:border", "dark:border-gray-700", "dark:bg-gray-800"], ["type", "button", 1, "btn-xs", "absolute", "-top-5", "-right-5", "z-20", "rounded-full", "bg-white", "shadow-lg", "border", "border-gray-200", "w-8", "h-8", "flex", "items-center", "justify-center", "text-gray-500", "hover:text-gray-700", "hover:bg-gray-100", "focus:outline-none", 3, "click"], [1, "fa-solid", "fa-xmark", "text-2xl"], [1, "max-h-[80vh]", "overflow-y-auto", "p-4"], ["class", "flex flex-col items-center justify-center min-h-[200px]", 4, "ngIf"], [1, "flex", "flex-col", "items-center", "justify-center", "min-h-[200px]"], [1, "text-lg", "text-red-600", "font-semibold", "mb-4"], [1, "btn", "rounded-md", "p-2", "focus:outline-none", "focus:ring-2", "focus:ring-blue-500", "btn-danger", 3, "click"], [3, "uuid", "entityName", "isModal", "closeModal", 4, "ngIf"], [3, "closeModal", "uuid", "entityName", "isModal"]], template: function MasterListComponent_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "div");
    \u0275\u0275template(1, MasterListComponent_app_datatable_1_Template, 1, 14, "app-datatable", 6)(2, MasterListComponent_ng_template_2_Template, 12, 11, "ng-template", null, 0, \u0275\u0275templateRefExtractor)(4, MasterListComponent_ng_template_4_Template, 3, 7, "ng-template", null, 1, \u0275\u0275templateRefExtractor)(6, MasterListComponent_ng_template_6_Template, 3, 7, "ng-template", null, 2, \u0275\u0275templateRefExtractor)(8, MasterListComponent_ng_template_8_Template, 1, 1, "ng-template", null, 3, \u0275\u0275templateRefExtractor)(10, MasterListComponent_ng_template_10_Template, 1, 1, "ng-template", null, 4, \u0275\u0275templateRefExtractor)(12, MasterListComponent_ng_template_12_Template, 1, 1, "ng-template", null, 5, \u0275\u0275templateRefExtractor);
    \u0275\u0275elementEnd();
    \u0275\u0275template(14, MasterListComponent_app_loader_14_Template, 1, 0, "app-loader", 7)(15, MasterListComponent_div_15_Template, 37, 15, "div", 8)(16, MasterListComponent_div_16_Template, 12, 3, "div", 8);
  }
  if (rf & 2) {
    \u0275\u0275advance();
    \u0275\u0275property("ngIf", !ctx.nonGridPage);
    \u0275\u0275advance(13);
    \u0275\u0275property("ngIf", ctx.loading);
    \u0275\u0275advance();
    \u0275\u0275property("ngIf", ctx.isItemModalOpen);
    \u0275\u0275advance();
    \u0275\u0275property("ngIf", ctx.isViewPopupOpen);
  }
}, dependencies: [CommonSharedModule, NgClass, NgIf, \u0275NgNoValidate, DefaultValueAccessor, NgControlStatus, NgControlStatusGroup, NgxTippyDirective, DynamicFontSizeDirective, TranslatePipe, HttpClientModule, DataTableComponent, LoaderComponent, ReactiveFormsModule, FormGroupDirective, FormControlName, StaticPageComponent, FormBuilderComponent], encapsulation: 2, 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 MasterListComponent = _MasterListComponent;
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(MasterListComponent, { className: "MasterListComponent", filePath: "src\\app\\@lcp-framework\\pages\\master-list\\master-list.component.ts", lineNumber: 65 });
})();

export {
  MasterListComponent
};
//# sourceMappingURL=chunk-EMVZVSCP.js.map
