{"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 \"../../services/user.service\";\nimport * as i3 from \"@angular/forms\";\nimport * as i4 from \"../tables/dir-group-table/dir-group-table.component\";\nimport * as i5 from \"../tables/dir-user-table/dir-user-table.component\";\nconst _c0 = [\"dirGroups\"];\nconst _c1 = [\"dirUsers\"];\nexport class UserGroupDirImportComponent {\n constructor(gService, uService) {\n this.gService = gService;\n this.uService = uService;\n this.initWithoutData = () => {};\n this.dirGroupsRowSelection = {\n enabled: true,\n type: GuiRowSelectionType.ROW,\n mode: GuiRowSelectionMode.SINGLE\n };\n this.dirUsersRowSelection = {\n enabled: true,\n type: GuiRowSelectionType.CHECKBOX,\n mode: GuiRowSelectionMode.MULTIPLE\n };\n this.dirGroupOnSelectedRows = rows => {\n if (rows.length > 0) {\n this.dirGroups.safelyUnselectAll();\n let groupName = rows[rows.length - 1].source.samaccountname;\n this.dirUsers.fetchDataByGroupName(groupName);\n }\n };\n }\n ngOnInit() {}\n ngAfterViewInit() {\n //this.dirUsers.loading = false;\n }\n addSelectedUsers() {\n let requests = new Array();\n let numAdded = 0;\n for (let row of this.dirUsers.selectedRows) {\n // Create an Observable for each request and add it to the requests array\n requests.push(this.uService.create({\n email: row?.source?.mail?.[0],\n prename: row.source?.givenname?.[0],\n username: row.source?.samaccountname?.[0],\n name: row.source?.sn?.[0]\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 users added`,\n position: \"center\",\n showConfirmButton: false,\n timer: 3000\n });\n this.dirUsers.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 UserGroupDirImportComponent_Factory(t) {\n return new (t || UserGroupDirImportComponent)(i0.ɵɵdirectiveInject(i1.GroupService), i0.ɵɵdirectiveInject(i2.UserService));\n };\n static #_2 = this.ɵcmp = /*@__PURE__*/i0.ɵɵdefineComponent({\n type: UserGroupDirImportComponent,\n selectors: [[\"app-user-group-dir-import\"]],\n viewQuery: function UserGroupDirImportComponent_Query(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵviewQuery(_c0, 5);\n i0.ɵɵviewQuery(_c1, 5);\n }\n if (rf & 2) {\n let _t;\n i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.dirGroups = _t.first);\n i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.dirUsers = _t.first);\n }\n },\n decls: 15,\n vars: 4,\n consts: [[\"dirGroups\", \"\"], [\"dirUsers\", \"\"], [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\"], [1, \"col-6\", \"p-0\", \"m-0\"], [3, \"rowSelection\", \"onSelectedRows\"], [3, \"initData\", \"rowSelection\"]],\n template: function UserGroupDirImportComponent_Template(rf, ctx) {\n if (rf & 1) {\n const _r1 = i0.ɵɵgetCurrentView();\n i0.ɵɵelementStart(0, \"div\", 2)(1, \"div\", 3)(2, \"nav\", 4)(3, \"form\", 5)(4, \"button\", 6);\n i0.ɵɵlistener(\"click\", function UserGroupDirImportComponent_Template_button_click_4_listener() {\n i0.ɵɵrestoreView(_r1);\n return i0.ɵɵresetView(ctx.addSelectedUsers());\n });\n i0.ɵɵtext(5, \"Benutzer\");\n i0.ɵɵelement(6, \"br\");\n i0.ɵɵtext(7, \"Hinzuf\\u00FCgen\");\n i0.ɵɵelementEnd()()()()();\n i0.ɵɵelementStart(8, \"div\", 7)(9, \"div\", 8);\n i0.ɵɵelement(10, \"app-dir-group-table\", 9, 0);\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(12, \"div\", 8);\n i0.ɵɵelement(13, \"app-dir-user-table\", 10, 1);\n i0.ɵɵelementEnd()();\n }\n if (rf & 2) {\n i0.ɵɵadvance(10);\n i0.ɵɵproperty(\"rowSelection\", ctx.dirGroupsRowSelection)(\"onSelectedRows\", ctx.dirGroupOnSelectedRows);\n i0.ɵɵadvance(3);\n i0.ɵɵproperty(\"initData\", ctx.initWithoutData)(\"rowSelection\", ctx.dirUsersRowSelection);\n }\n },\n dependencies: [i3.ɵNgNoValidate, i3.NgControlStatusGroup, i3.NgForm, i4.DirGroupTableComponent, i5.DirUserTableComponent],\n styles: [\"/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsImZpbGUiOiJ1c2VyLWdyb3VwLWRpci1pbXBvcnQuY29tcG9uZW50LmNzcyJ9 */\\n/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8uL3NyYy9hcHAvY29tcG9uZW50cy91c2VyLWdyb3VwLWRpci1pbXBvcnQvdXNlci1ncm91cC1kaXItaW1wb3J0LmNvbXBvbmVudC5jc3MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUNBLG9MQUFvTCIsInNvdXJjZVJvb3QiOiIifQ== */\"]\n });\n}","map":{"version":3,"names":["GuiRowSelectionMode","GuiRowSelectionType","Swal","forkJoin","of","catchError","finalize","UserGroupDirImportComponent","constructor","gService","uService","initWithoutData","dirGroupsRowSelection","enabled","type","ROW","mode","SINGLE","dirUsersRowSelection","CHECKBOX","MULTIPLE","dirGroupOnSelectedRows","rows","length","dirGroups","safelyUnselectAll","groupName","source","samaccountname","dirUsers","fetchDataByGroupName","ngOnInit","ngAfterViewInit","addSelectedUsers","requests","Array","numAdded","row","selectedRows","push","create","email","mail","prename","givenname","username","name","sn","pipe","err","fire","icon","title","text","position","showConfirmButton","timer","subscribe","next","results","filter","result","error","_","i0","ɵɵdirectiveInject","i1","GroupService","i2","UserService","_2","selectors","viewQuery","UserGroupDirImportComponent_Query","rf","ctx","ɵɵelementStart","ɵɵlistener","UserGroupDirImportComponent_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\\user-group-dir-import\\user-group-dir-import.component.ts","E:\\TekH\\Visual Studio\\WebUserManager\\DigitalData.UserManager.NgWebUI\\ClientApp\\src\\app\\components\\user-group-dir-import\\user-group-dir-import.component.html"],"sourcesContent":["import { AfterViewInit, Component, Inject, OnInit, ViewChild } from '@angular/core';\r\nimport { GuiRowSelection, GuiRowSelectionMode, GuiRowSelectionType, GuiSelectedRow } from '@generic-ui/ngx-grid';\r\nimport Swal from 'sweetalert2';\r\nimport { GroupService } from '../../services/group.service';\r\nimport { Observable, forkJoin, of } from 'rxjs';\r\nimport { catchError, finalize } from 'rxjs/operators';\r\nimport { DirGroupTableComponent } from '../tables/dir-group-table/dir-group-table.component';\r\nimport { DirUserTableComponent } from '../tables/dir-user-table/dir-user-table.component';\r\nimport { UserService } from '../../services/user.service';\r\nimport {User} from '../../models/user-management.api.models'\r\n\r\n@Component({\r\n selector: 'app-user-group-dir-import',\r\n templateUrl: './user-group-dir-import.component.html',\r\n styleUrl: './user-group-dir-import.component.css'\r\n})\r\nexport class UserGroupDirImportComponent implements OnInit, AfterViewInit {\r\n\r\n initWithoutData = () => { }\r\n\r\n constructor(private gService: GroupService, private uService: UserService) {\r\n }\r\n\r\n ngOnInit(): void {\r\n }\r\n\r\n @ViewChild('dirGroups') dirGroups!: DirGroupTableComponent;\r\n @ViewChild('dirUsers') dirUsers!: DirUserTableComponent;\r\n\r\n ngAfterViewInit(): void {\r\n //this.dirUsers.loading = false;\r\n }\r\n\r\n dirGroupsRowSelection: GuiRowSelection = {\r\n enabled: true,\r\n type: GuiRowSelectionType.ROW,\r\n mode: GuiRowSelectionMode.SINGLE\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 addSelectedUsers() {\r\n let requests = new Array>();\r\n let numAdded: number = 0;\r\n for (let row of this.dirUsers.selectedRows) {\r\n // Create an Observable for each request and add it to the requests array\r\n requests.push(\r\n this.uService.create({\r\n email: row?.source?.mail?.[0],\r\n prename: row.source?.givenname?.[0],\r\n username: row.source?.samaccountname?.[0],\r\n name: row.source?.sn?.[0],\r\n }).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 users added`,\r\n position: \"center\",\r\n showConfirmButton: false,\r\n timer: 3000\r\n });\r\n\r\n this.dirUsers.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 dirGroupOnSelectedRows = (rows: Array) => {\r\n if (rows.length > 0) {\r\n this.dirGroups.safelyUnselectAll()\r\n let groupName: string = rows[rows.length - 1].source.samaccountname;\r\n this.dirUsers.fetchDataByGroupName(groupName);\r\n }\r\n }\r\n}\r\n","
\r\n
\r\n \r\n
\r\n
\r\n
\r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