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,KAAKE,eAAO,SAAEoD,mBAAmBsB,KAAKN,EAAmB,G,EAG5D,CAEQ3E,uBAAuBiD,GAC9B,IAAIiB,EAAIC,OAAOnD,SACXoD,EAAO,GAAGF,EAAEG,aAAaH,EAAEE,OAC/BnB,EAAWmB,KAAOA,EACd/D,KAAKE,SAc4B,YAbfF,KAAKtB,UAAU2B,cAAcL,KAAKE,QAAQgB,IAAIC,SAAS,sCAAuCyB,GAClHE,6BAA4B,CAACC,EAAiB3B,KACrB,KAArBA,EAAOgB,WACVpC,KAAKrB,MAAMqE,YAAY,uBAAuB,yEAC7CC,YAAWtD,MAAOsB,IACS,GAAvBA,EAAOiC,eACVlD,KAAKE,cAAgBF,KAAKtB,UAAUwB,QAAQF,KAAKE,QAASgB,IAAIf,IAAI,sBAAsBC,a,IAI1FJ,KAAKrB,MAAM0D,YAAY,qBAAqB,qC,IAE3CF,YACmBC,aACrBQ,EAAWsB,eAAiB,YAI/B,CAEQN,cAAciB,GACrB,MAAO,uEAAuEC,KAAKD,EACpF,CAEQE,kBAAkBC,GACzB,OAAO,IAAeA,EACvB,GA/PG,GAAC,EAAAC,S,0DAwBD,IAAC,IAAAC,cAAa,eAAgB,2BAA4B,2BAA4B,yB,sFA9B7E3G,EAAc,GAD1B,EAAA4G,W,uBAWmC,IAAqC,KAAyB,IAA6B,KAAsB,EAAAC,KACnI,OAXL7G,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 this.project = await this.apiClient.project(params.projectId).get('Project/GetProject').jsonResult();\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 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((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();\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((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();\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(\"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((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();\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","async","params","console","log","projectId","this","setProject","project","get","jsonResult","projectWToken","admin","currentUser","isFormInvalid","undefined","name","location","address","zipCode","city","newValue","oldValue","result","id","postJson","reason","error","currentMemberIds","members","map","x","userId","m","indexOf","userDto","email","companyName","userCompanyId","UserCompanyId","trim","response","statusCode","OpenMessage","navigate","getRoleName","role","member","memberRole","publish","invitation","invitationRole","handleErrorWithErrorService","t","OpenConfirm","whenClosed","wasCancelled","projectRole","invitee","index","projectInvitations","splice","Boolean","find","toLowerCase","tr","validateEmail","L","window","host","protocol","invite","responseStatus","inviteeName","inviteeOrgName","addInviResult","updatedInvitations","content","i","length","ix","findIndex","push","mail","test","GetResponseStatus","status","bindable","computedFrom","autoinject","I18N"],"sourceRoot":""}