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AI,EAAGJ,EAAmBE,I,CAGpEvF,QAAQC,IAAI,oBAAsBoF,EAAmB,IACzC,QAAZ,EAAAlF,KAAKE,eAAO,SAAE4D,mBAAmB0B,KAAKN,EAAmB,G,EAG5D,CAEQ,sBAAMO,CAAiBvC,GAC9B,IAAIqB,EAAIC,OAAO5D,SACX6D,EAAO,GAAGF,EAAEG,aAAaH,EAAEE,OAC/BvB,EAAWuB,KAAOA,EACdzE,KAAKE,SAc4B,YAbfF,KAAKtB,UAAU2B,cAAcL,KAAKE,QAAQkB,IAAIC,SAAS,sCAAuC6B,GAClHE,6BAA4BC,MAAMC,EAAiBhC,KAC1B,KAArBA,EAAOiB,WACVvC,KAAKrB,MAAM4E,YAAY,uBAAuB,yEAC7CC,YAAWH,MAAOlC,IACS,GAAvBA,EAAOsC,eACVzD,KAAKE,cAAgBF,KAAKtB,UAAUwB,QAAQF,KAAKE,QAASkB,IAAIjB,IAAI,sBAAsBC,a,IAI1FJ,KAAKrB,MAAM6D,YAAY,qBAAqB,qC,IAE3CF,YACmBC,aACrBW,EAAW0B,eAAiB,IAAeC,QAI9C,CAEQ,aAAAP,CAAcoB,GACrB,MAAO,uEAAuEC,KAAKD,EACpF,CAEQ,iBAAAE,CAAkBC,GACzB,OAAO,IAAeA,EACvB,GAlQG,GAAC,EAAAC,S,0DA2BD,IAAC,IAAAC,cAAa,eAAgB,2BAA4B,2BAA4B,yB,sFAjC7ExH,EAAc,GAD1B,EAAAyH,W,uBAWmC,IAAqC,IAAyB,IAA6B,KAAsB,EAAAC,KACnI,EAAAC,mBAXL3H,E","sources":["webpack://client-app/./src/app/project/project-manager/project-manager.ts"],"sourcesContent":["import { ClassificationDto, ProjectDto,Member, ProjectInvitation, ResponseStatus } from 'app/models/project-dto';\r\nimport { ProjectRole, UIPrjRoleNames } from 'app/models/project-role';\r\nimport { UserDto } from 'app/models/user-administration-dtos';\r\nimport { WhitelistDto } from 'app/models/whitelist-dto';\r\nimport { ApiClient } from 'app/services/api-client';\r\nimport { AppContextService } from 'app/services/app-context-service';\r\nimport { ModalService } from 'app/services/modal-service';\r\nimport { DialogCloseResult } from 'aurelia-dialog';\r\nimport { autoinject,computedFrom,bindable } from 'aurelia-framework';\r\nimport { HttpResponseMessage } from 'aurelia-http-client';\r\nimport { I18N } from 'aurelia-i18n';\r\nimport { Router } from 'aurelia-router';\r\nimport { EventAggregator } from 'aurelia-event-aggregator';\r\nimport { ProjectInvitationDto } from 'app/models/project-invitation-dto';\r\nimport { ErrorService } from 'app/services/error-service';\r\n\r\n\r\n\r\n@autoinject\r\nexport class ProjectManager {\r\n private project: ProjectDto | undefined;\r\n private classifications: ClassificationDto[] = [];\r\n private whitelists: WhitelistDto[] = [];\r\n private projectRoles: string[] = Object.keys(ProjectRole).filter((v) => isNaN(Number(v)));\r\n private admin: UserDto |undefined;\r\n @bindable private searchText: string = \"\";\r\n private searchMemberResult: Member[] = [];\r\n\tprivate asOrgUser: boolean = true;\r\n\r\n constructor (public appContext: AppContextService, public apiClient: ApiClient, public modal: ModalService, public router: Router, private i18n: I18N,\r\n\t\tprivate events: EventAggregator) {}\r\n\r\n async activate(params: any): Promise {\r\n console.log(\"project-manager:activate \" , params);\r\n if (params.projectId) { \r\n this.appContext.setProject(params.projectId); \r\n\r\n this.project = await this.apiClient.project(params.projectId).get('Project/GetProject').jsonResult();//activate\r\n //this.project = await this.apiClient.projectWToken(params.projectId).get('Project/GetProject').jsonResult();//activate\r\n this.classifications = await this.apiClient.projectWToken(params.projectId).get('Classification/GetClassifications').jsonResult();\r\n this.whitelists = await this.apiClient.projectWToken(params.projectId).get('Whitelist/GetWhitelists').jsonResult();\r\n\r\n console.log(\"project\", this.project);\r\n console.log(\"keys\", this.projectRoles);\r\n this.admin = this.appContext.currentUser;\r\n }//in-activate.\r\n }\r\n\r\n async bind(): Promise {\r\n console.log(\"project-manager:bind\");\r\n }\r\n\r\n @computedFrom('project.name', 'project.location.address', 'project.location.zipcode', 'project.location.city')\r\n\tget isFormInvalid(): boolean {\r\n\t\t//Unless these conditions are fullfilled a project can neither be updated or created.\r\n\t\t//This is based on the database setup.\r\n\t\treturn !(\r\n\t\t\t\t(this.project?.name != undefined \t\t\t\t&& this.project.name != '')\r\n\t\t\t&& \t(this.project?.location?.address != undefined \t&& this.project?.location?.address != '')\r\n\t\t\t&&\t(this.project?.location?.zipCode != undefined \t&& this.project?.location?.zipCode != '')\r\n\t\t\t&&\t(this.project?.location?.city != undefined \t\t&& this.project?.location?.city != '')\r\n\t\t);\r\n\t}\r\n\r\n async searchTextChanged(newValue: string, oldValue: string): Promise {\r\n if (!newValue) {\r\n\t\t\tthis.searchMemberResult = [];\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet result:any = undefined; // this is an array of some DTO type, and we should specify that.\r\n\t\ttry {\r\n\t\t\tif (this.project?.id != undefined) {\r\n\t\t\t\tresult = await this.apiClient.projectWToken(this.project?.id).postJson(\"UserInfo/SearchForUsers\", newValue).jsonResult();\r\n\t\t\t\tconsole.log(\"result \" , result);\r\n\t\t\t}\r\n\t\t} catch (reason) {\r\n\t\t\tconsole.error(reason);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\t\r\n\t\tlet currentMemberIds = this.project?.members.map(x => x.userId);\r\n\t\tthis.searchMemberResult = result\r\n\t\t.filter((m: any) => {\t\t\t\t\t\r\n\t\t\treturn currentMemberIds?.indexOf(m.id) === -1\r\n\t\t})\r\n\t\t.map((userDto: any) => {\r\n\t\t\treturn { userId : userDto.id, \r\n\t\t\t\tname : userDto.name, \r\n\t\t\t\temail: userDto.email, \r\n\t\t\t\tcompanyName: userDto.companyName, \r\n\t\t\t\tuserCompanyId: userDto.UserCompanyId };\r\n\t\t});\r\n }\r\n\r\n async saveProjectInformation(): Promise {\r\n //TODO - Save project-information.\r\n if (this.project) {\r\n this.project.name = this.project?.name.trim();\r\n let response: HttpResponseMessage = await this.apiClient.projectWToken(this.project?.id).postJson('PrjManager/UpdateProject/', this.project).response()\r\n if (response.statusCode == 200) {\r\n this.modal.OpenMessage(\"Saved changes\", \"The changes were successfully saved\");\r\n } else {\r\n this.modal.OpenMessage(\"Changes not saved\", \"Some changes were not saved\");\r\n }\r\n }\r\n }\r\n\r\n async openTransferStandards(): Promise {\r\n\t\tthis.router.navigate('project/'+this.project?.id+'/project-manager/transfer');\r\n }\r\n\r\n getRoleName(role: number | string): string {\r\n\t\tif (typeof role === \"number\") {\r\n\t\t\treturn UIPrjRoleNames[ProjectRole[role]];\r\n\t\t} else {\r\n\t\t\treturn UIPrjRoleNames[role];\r\n\t\t}\r\n\t}\r\n\r\n async setNewRole(member: Member, role:string): Promise {\r\n if (this.project) {\r\n let memberRole = ProjectRole[role];\r\n console.log(\"role\",memberRole);\r\n let response = await this.apiClient.projectWToken(this.project.id).postJson(`PrjManager/ChangeMemberRole?userId=${member.userId}`, memberRole).response();\r\n if (response.statusCode == 200) {\r\n member.role = ProjectRole[role];\r\n\t\t\t\tif (member.userId == this.appContext.currentUser?.id) {\r\n\t\t\t\t\tthis.events.publish(\"navigation:update-prj-token\");\r\n\t\t\t\t}\r\n return;\r\n }\r\n }\r\n }\r\n\r\n\tasync setNewRoleForInvitee(invitation: ProjectInvitation, role:string): Promise {\r\n if (this.project) {\r\n let invitationRole = ProjectRole[role];\r\n let response = await this.apiClient.projectWToken(this.project.id).postJson(`Project/UpdateInvitationRole_PRJORGROLE?invitationId=${invitation.id}`, invitationRole)\r\n\t\t\t.handleErrorWithErrorService(async(t: ErrorService, reason: HttpResponseMessage) => {\r\n\t\t\t\tif (reason.statusCode == 410) {\r\n\t\t\t\t\tthis.modal.OpenConfirm(\"Invitation not found\",\"The invitation could not be found. Do you wish to reload the project?\")\r\n\t\t\t\t\t.whenClosed(async (result: DialogCloseResult) => {\r\n\t\t\t\t\t\tif (result.wasCancelled == false) {\r\n\t\t\t\t\t\t\tthis.project = await this.apiClient.project(this.project!.id).get('Project/GetProject').jsonResult();//setNewRoleForInvitee\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis.modal.OpenMessage(\"Role change failed\",\"Changing the role did not succeed.\");\r\n\t\t\t\t}\r\n\t\t\t}).response();\r\n if (response.statusCode == 200) {\r\n invitation.projectRole = ProjectRole[role];\r\n return;\r\n }\r\n }\r\n }\r\n\r\n public async removeInvitee(invitee: ProjectInvitation): Promise {\r\n\t\tif (this.project?.id != undefined) {\r\n\t\t\tlet areYouSure: DialogCloseResult = await this.modal.OpenConfirm(\"Remove invitation\", \"Are you sure you want to remove this invitation?\").whenClosed();\r\n\t\t\tif (areYouSure.wasCancelled == true) { return; }\r\n\t\t\tlet result: HttpResponseMessage = await this.apiClient.projectWToken(this.project.id).postJson('Project/RemoveInvitations_PRJORGROLE', [invitee.id])\r\n\t\t\t.handleErrorWithErrorService(async(t: ErrorService, reason: HttpResponseMessage) => {\r\n\t\t\t\tif (reason.statusCode == 410) {\r\n\t\t\t\t\tthis.modal.OpenConfirm(\"Invitation not found\",\"The invitation could not be found. Do you wish to reload the project?\")\r\n\t\t\t\t\t.whenClosed(async (result: DialogCloseResult) => {\r\n\t\t\t\t\t\tif (result.wasCancelled == false) {\r\n\t\t\t\t\t\t\tthis.project = await this.apiClient.project(this.project!.id).get('Project/GetProject').jsonResult();//removeInvitee\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis.modal.OpenMessage(\"Invitation not deleted\",\"The invitation was not removed.\")\r\n\t\t\t\t}\r\n\t\t\t}).response();\r\n\t\t\tif (result.statusCode == 200) {\r\n\t\t\t\tlet index = this.project?.projectInvitations.indexOf(invitee);\r\n\t\t\t\tif (index != undefined && index != -1) {\r\n\t\t\t\t\tthis.project?.projectInvitations.splice(index, 1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n public async removeMember(member:Member): Promise {\r\n\t\tif (this.project?.id != undefined) {\r\n\t\t\tlet areYouSure: DialogCloseResult = await this.modal.OpenConfirm(\"Remove member\", \"Are you sure you want to remove this member?\").whenClosed();\r\n\t\t\tif (areYouSure.wasCancelled == true) { return; }\r\n\t\t\tlet result: HttpResponseMessage = await this.apiClient.projectWToken(this.project?.id).postJson('Project/RemoveMembers_PRJORGROLE', [member.userId]).response();\r\n\t\t\tif (result.statusCode == 200) {\r\n\t\t\t\tlet index = this.project?.members.indexOf(member);\r\n\t\t\t\tif (index != undefined) {\r\n\t\t\t\t\tthis.project?.members.splice(index, 1); // in ProjectManager.removeMember. hvorfor har vi baade manageproject og projectmanager..\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tthis.modal.OpenMessage(\"User not removed\", \"The user could not be removed from the project.\")\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tpublic async inviteMember(email: string) { // triggers when +Plus-INVITE is clicked.\r\n\t\tconsole.log('inviteMember, email:',email);\r\n\r\n\t\tif (Boolean(this.project?.projectInvitations.find(x => x.email.toLowerCase() === email.toLowerCase())) || Boolean(this.project?.members.find(x => x.email.toLowerCase() === email.toLowerCase()))) {\r\n\t\t\tthis.modal.OpenMessage(\r\n\t\t\t\tthis.i18n.tr(\"Error\"),\r\n\t\t\t\tthis.i18n.tr(\"Invite Member - A user with email: \") + email + this.i18n.tr(\" has already been added to this project.\")\r\n\t\t\t)\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (!this.validateEmail(email)) {\r\n\t\t\tthis.modal.OpenMessage(\r\n\t\t\t\tthis.i18n.tr(\"Error\"),\r\n\t\t\t\tthis.i18n.tr(\"The entered email is invalid\")\r\n\t\t\t)\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlet L = window.location;\r\n\t\tlet host = `${L.protocol}//${L.host}`; \r\n\t\tconsole.log('passing host:',host);\r\n\t\t//let host:string = 'https://aoc-linux-client-test.azurewebsites.net';\r\n\t\tlet invite: ProjectInvitation = { \r\n\t\t\temail: email, \r\n\t\t\tid: \"00000000-0000-0000-0000-000000000000\",\r\n\t\t\tprojectId: \"00000000-0000-0000-0000-000000000000\" ,\r\n\t\t\thost: host,\r\n\t\t\tresponseStatus: ResponseStatus.Pending,\r\n\t\t\tasOrgUser: this.asOrgUser,\r\n\t\t\tinviteeName: \"\",\r\n\t\t\tinviteeOrgName: \"\",\r\n\t\t\tprojectRole: ProjectRole.Prj_User\r\n\t\t};\r\n\r\n\t\tif (this.project?.id != undefined) {\r\n\t\t\t// let userExistResult: HttpResponseMessage = await this.apiClient.project(this.projectId).postJson('Project/IsUserKnown', invite.email).response();\r\n\t\t\t// console.log(\"userExistResult \" , userExistResult);\r\n\t\t\tlet addInviResult: HttpResponseMessage = await this.apiClient.projectWToken(this.project.id).postJson('Project/AddInvitations_PRJORGROLE', [invite]).response();\r\n\t\t\tif (addInviResult.statusCode == 200) {\r\n\t\t\t\tlet updatedInvitations: ProjectInvitation[] = addInviResult.content;\r\n\t\t\t\tfor (let i = 0; i < updatedInvitations.length; i++) {\r\n\t\t\t\t\tlet ix = this.project?.projectInvitations.findIndex(x => x.email == updatedInvitations[i].email);\r\n\t\t\t\t\tif (ix && ix > -1) {\r\n\t\t\t\t\t\tthis.project?.projectInvitations.splice(ix, 1, updatedInvitations[i]);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\t\r\n\t\t\t\tconsole.log(\"updatedInvitaiton\" , updatedInvitations[0]);\r\n\t\t\t\tthis.project?.projectInvitations.push(updatedInvitations[0]);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tprivate async resendInvitation(invitation: ProjectInvitation) {\r\n\t\tlet L = window.location;\r\n\t\tlet host = `${L.protocol}//${L.host}`; \r\n\t\tinvitation.host = host;\r\n\t\tif (this.project) {\r\n\t\t\tlet response = await this.apiClient.projectWToken(this.project.id).postJson(`Project/ResendInvitation_PRJORGROLE`, invitation)\r\n\t\t\t.handleErrorWithErrorService(async(t: ErrorService, reason: HttpResponseMessage) => {\r\n\t\t\t\tif (reason.statusCode == 410) {\r\n\t\t\t\t\tthis.modal.OpenConfirm(\"Invitation not found\",\"The invitation could not be found. Do you wish to reload the project?\")\r\n\t\t\t\t\t.whenClosed(async (result: DialogCloseResult) => {\r\n\t\t\t\t\t\tif (result.wasCancelled == false) {\r\n\t\t\t\t\t\t\tthis.project = await this.apiClient.project(this.project!.id).get('Project/GetProject').jsonResult();//resendInvitation\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis.modal.OpenMessage(\"Role change failed\",\"Changing the role did not succeed.\");\r\n\t\t\t\t}\r\n\t\t\t}).response();\r\n if (response.statusCode == 200) {\r\n\t\t\t\tinvitation.responseStatus = ResponseStatus.Pending;\r\n return;\r\n } \r\n\t\t}\r\n\t}\r\n\r\n\tprivate validateEmail(mail: string): boolean { // UB: inviteMember.\r\n\t\treturn /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*$/.test(mail);\r\n\t}\r\n\r\n\tprivate GetResponseStatus(status: number): string {\r\n\t\treturn ResponseStatus[status];\r\n\t}\r\n\r\n}\r\n"],"names":["ProjectManager","constructor","appContext","apiClient","modal","router","i18n","events","classifications","whitelists","projectRoles","Object","keys","filter","v","isNaN","Number","searchText","searchMemberResult","asOrgUser","activate","params","console","log","projectId","this","setProject","project","get","jsonResult","projectWToken","admin","currentUser","bind","isFormInvalid","undefined","name","location","address","zipCode","city","searchTextChanged","newValue","oldValue","result","id","postJson","reason","error","currentMemberIds","members","map","x","userId","m","indexOf","userDto","email","companyName","userCompanyId","UserCompanyId","saveProjectInformation","trim","response","statusCode","OpenMessage","openTransferStandards","navigate","getRoleName","role","setNewRole","member","memberRole","publish","setNewRoleForInvitee","invitation","invitationRole","handleErrorWithErrorService","async","t","OpenConfirm","whenClosed","wasCancelled","projectRole","removeInvitee","invitee","index","projectInvitations","splice","removeMember","inviteMember","Boolean","find","toLowerCase","tr","validateEmail","L","window","host","protocol","invite","responseStatus","Pending","inviteeName","inviteeOrgName","Prj_User","addInviResult","updatedInvitations","content","i","length","ix","findIndex","push","resendInvitation","mail","test","GetResponseStatus","status","bindable","computedFrom","autoinject","I18N","EventAggregator"],"sourceRoot":""}