{"ast":null,"code":"import { GuiRowSelectionMode, GuiRowSelectionType } from '@generic-ui/ngx-grid';\nimport Swal from 'sweetalert2';\nimport { forkJoin, of } from 'rxjs';\nimport { catchError, finalize } from 'rxjs/operators';\nimport * as i0 from \"@angular/core\";\nimport * as i1 from \"../../services/group.service\";\nimport * as i2 from \"@angular/forms\";\nimport * as i3 from \"../tables/dir-group-table/dir-group-table.component\";\nconst _c0 = [\"dirGroups\"];\nexport class GroupDirImportComponent {\n constructor(gService) {\n this.gService = gService;\n this.initWithoutData = () => {};\n this.dirGroupsRowSelection = {\n enabled: true,\n type: GuiRowSelectionType.CHECKBOX,\n mode: GuiRowSelectionMode.MULTIPLE\n };\n this.dirUsersRowSelection = {\n enabled: true,\n type: GuiRowSelectionType.CHECKBOX,\n mode: GuiRowSelectionMode.MULTIPLE\n };\n }\n ngOnInit() {}\n ngAfterViewInit() {}\n addSelectedGroups() {\n let requests = [];\n let numAdded = 0;\n for (let row of this.dirGroups.selectedRows) {\n requests.push(this.gService.createByDir({\n samaccountname: row?.source?.samaccountname\n }).pipe(catchError(err => {\n return of(null);\n })));\n }\n forkJoin(requests).pipe(\n // finalize is executed after all requests are completed or when an error occurs\n finalize(() => {\n // Show Swal notification after all requests are completed\n Swal.fire({\n icon: \"success\",\n title: \"Completed\",\n text: `${numAdded} new groups added`,\n position: \"center\",\n showConfirmButton: false,\n timer: 3000\n });\n this.dirGroups.safelyUnselectAll();\n })).subscribe({\n next: results => {\n numAdded += results.filter(result => result !== null).length;\n },\n error: err => {}\n });\n }\n static #_ = this.ɵfac = function GroupDirImportComponent_Factory(t) {\n return new (t || GroupDirImportComponent)(i0.ɵɵdirectiveInject(i1.GroupService));\n };\n static #_2 = this.ɵcmp = /*@__PURE__*/i0.ɵɵdefineComponent({\n type: GroupDirImportComponent,\n selectors: [[\"app-group-dir-import\"]],\n viewQuery: function GroupDirImportComponent_Query(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵviewQuery(_c0, 5);\n }\n if (rf & 2) {\n let _t;\n i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.dirGroups = _t.first);\n }\n },\n decls: 12,\n vars: 1,\n consts: [[\"dirGroups\", \"\"], [1, \"row\", \"p-0\", \"m-0\"], [1, \"col\", \"p-0\", \"m-0\"], [1, \"navbar\", \"bg-body-tertiary\"], [1, \"container-fluid\", \"justify-content-start\"], [\"type\", \"button\", 1, \"btn\", \"btn-outline-success\", \"me-2\", 3, \"click\"], [1, \"row\", \"align-items-start\", \"p-0\", \"m-0\"], [3, \"rowSelection\"]],\n template: function GroupDirImportComponent_Template(rf, ctx) {\n if (rf & 1) {\n const _r1 = i0.ɵɵgetCurrentView();\n i0.ɵɵelementStart(0, \"div\", 1)(1, \"div\", 2)(2, \"nav\", 3)(3, \"form\", 4)(4, \"button\", 5);\n i0.ɵɵlistener(\"click\", function GroupDirImportComponent_Template_button_click_4_listener() {\n i0.ɵɵrestoreView(_r1);\n return i0.ɵɵresetView(ctx.addSelectedGroups());\n });\n i0.ɵɵtext(5, \"Gruppen\");\n i0.ɵɵelement(6, \"br\");\n i0.ɵɵtext(7, \"Hinzuf\\u00FCgen\");\n i0.ɵɵelementEnd()()()()();\n i0.ɵɵelementStart(8, \"div\", 6)(9, \"div\", 2);\n i0.ɵɵelement(10, \"app-dir-group-table\", 7, 0);\n i0.ɵɵelementEnd()();\n }\n if (rf & 2) {\n i0.ɵɵadvance(10);\n i0.ɵɵproperty(\"rowSelection\", ctx.dirGroupsRowSelection);\n }\n },\n dependencies: [i2.ɵNgNoValidate, i2.NgControlStatusGroup, i2.NgForm, i3.DirGroupTableComponent],\n styles: [\"/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsImZpbGUiOiJncm91cC1kaXItaW1wb3J0LmNvbXBvbmVudC5jc3MifQ== */\\n/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8uL3NyYy9hcHAvY29tcG9uZW50cy9ncm91cC1kaXItaW1wb3J0L2dyb3VwLWRpci1pbXBvcnQuY29tcG9uZW50LmNzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQ0EsZ0xBQWdMIiwic291cmNlUm9vdCI6IiJ9 */\"]\n });\n}","map":{"version":3,"names":["GuiRowSelectionMode","GuiRowSelectionType","Swal","forkJoin","of","catchError","finalize","GroupDirImportComponent","constructor","gService","initWithoutData","dirGroupsRowSelection","enabled","type","CHECKBOX","mode","MULTIPLE","dirUsersRowSelection","ngOnInit","ngAfterViewInit","addSelectedGroups","requests","numAdded","row","dirGroups","selectedRows","push","createByDir","samaccountname","source","pipe","err","fire","icon","title","text","position","showConfirmButton","timer","safelyUnselectAll","subscribe","next","results","filter","result","length","error","_","i0","ɵɵdirectiveInject","i1","GroupService","_2","selectors","viewQuery","GroupDirImportComponent_Query","rf","ctx","ɵɵelementStart","ɵɵlistener","GroupDirImportComponent_Template_button_click_4_listener","ɵɵrestoreView","_r1","ɵɵresetView","ɵɵtext","ɵɵelement","ɵɵelementEnd","ɵɵadvance","ɵɵproperty"],"sources":["E:\\TekH\\Visual Studio\\WebUserManager\\DigitalData.UserManager.NgWebUI\\ClientApp\\src\\app\\components\\group-dir-import\\group-dir-import.component.ts","E:\\TekH\\Visual Studio\\WebUserManager\\DigitalData.UserManager.NgWebUI\\ClientApp\\src\\app\\components\\group-dir-import\\group-dir-import.component.html"],"sourcesContent":["import { AfterViewInit, Component, Inject, OnInit, ViewChild } from '@angular/core';\r\nimport { GuiRowSelection, GuiRowSelectionMode, GuiRowSelectionType } from '@generic-ui/ngx-grid';\r\nimport Swal from 'sweetalert2';\r\nimport { GroupService } from '../../services/group.service';\r\nimport { forkJoin, of } from 'rxjs';\r\nimport { catchError, finalize } from 'rxjs/operators';\r\nimport { DirGroupTableComponent } from '../tables/dir-group-table/dir-group-table.component';\r\n\r\n@Component({\r\n selector: 'app-group-dir-import',\r\n templateUrl: './group-dir-import.component.html',\r\n styleUrl: './group-dir-import.component.css'\r\n})\r\nexport class GroupDirImportComponent implements OnInit, AfterViewInit {\r\n\r\n initWithoutData = () => { }\r\n\r\n constructor(private gService: GroupService) {\r\n }\r\n\r\n ngOnInit(): void {\r\n }\r\n\r\n\r\n @ViewChild('dirGroups') dirGroups!: DirGroupTableComponent;\r\n\r\n ngAfterViewInit(): void {\r\n }\r\n\r\n dirGroupsRowSelection: GuiRowSelection = {\r\n enabled: true,\r\n type: GuiRowSelectionType.CHECKBOX,\r\n mode: GuiRowSelectionMode.MULTIPLE\r\n }\r\n\r\n dirUsersRowSelection: GuiRowSelection = {\r\n enabled: true,\r\n type: GuiRowSelectionType.CHECKBOX,\r\n mode: GuiRowSelectionMode.MULTIPLE\r\n }\r\n\r\n addSelectedGroups() {\r\n let requests = [];\r\n let numAdded: number = 0;\r\n for (let row of this.dirGroups.selectedRows) {\r\n requests.push(\r\n this.gService.createByDir({ samaccountname: row?.source?.samaccountname }).pipe(\r\n catchError((err) => {\r\n return of(null);\r\n })\r\n )\r\n );\r\n }\r\n\r\n forkJoin(requests).pipe(\r\n // finalize is executed after all requests are completed or when an error occurs\r\n finalize(() => {\r\n // Show Swal notification after all requests are completed\r\n Swal.fire({\r\n icon: \"success\",\r\n title: \"Completed\",\r\n text: `${numAdded} new groups added`,\r\n position: \"center\",\r\n showConfirmButton: false,\r\n timer: 3000\r\n });\r\n\r\n this.dirGroups.safelyUnselectAll();\r\n })\r\n ).subscribe({\r\n next: (results) => {\r\n numAdded += results.filter(result => result !== null).length;\r\n },\r\n error: (err) => {\r\n }\r\n });\r\n }\r\n}\r\n","