Skip to content

Commit

Permalink
Merge pull request #254 from amosproj/feat/xd-229
Browse files Browse the repository at this point in the history
Feat/xd 229
  • Loading branch information
Hydraneut authored Jul 13, 2024
2 parents 94ee806 + e86e539 commit fb65310
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@if(casedetail(); as _case){

<ix-button class="absolute top-20 right-32 z-50" (click)="toggleEdit()">
<ix-button class="absolute top-20 right-32 z-50" (click)="toggleEdit()" xmlns="http://www.w3.org/1999/html">
{{ isEditing ? 'Submit changes' : 'Update Case' }}
</ix-button>
<ix-icon-button *ngIf="isEditing" class="absolute top-20 right-64 z-50 text-red-600" (click)="cancelEdit()" icon="cancel" iconColor="red">
Expand Down Expand Up @@ -34,7 +34,7 @@ <h1 class="text-xl mb-5">_Case {{ _case.handle }}</h1>
<div class="form-row flex justify-between">
<div class="form-group mb-4 flex flex-col w-[48%]">
<label for="assignedTo" class="mb-1 font-bold">Assigned to</label>
<input type="email" id="assignedTo" [(ngModel)]="_case.modifiedBy" name="assignedTo" [readonly]="!isEditing" class="w-full p-2 mb-1 rounded border-box">
<input type="email" id="assignedTo" [(ngModel)]="_case.createdBy" name="assignedTo" [readonly]="!isEditing" class="w-full p-2 mb-1 rounded border-box">
</div>
<div class="form-group mb-4 flex flex-col w-[48%]">
<label for="dueDate" class="mb-1 font-bold">Due date (UTC)</label>
Expand Down Expand Up @@ -64,11 +64,16 @@ <h1 class="text-xl mb-5">_Case {{ _case.handle }}</h1>
</div>
<div class="form-row flex justify-between">
<div class="form-group mb-4 flex flex-col w-[48%]">
<label *ngIf="!isEditing" for="createdBy" class="font-normal">Created by</label>
<input *ngIf="!isEditing" type="text" id="createdBy" [(ngModel)]="_case.createdBy" name="createdBy" readonly class="w-full p-2 mb-1 rounded border-box">
<label for="modifiedBy" *ngIf="isEditing" class="font-bold">Modified by</label>
<input *ngIf="isEditing" type="text" id="modifiedBy" [(ngModel)]="_case.modifiedBy" name="modifiedBy" class="w-full p-2 mb-1 rounded border-box">
<label for="createdBy" class="font-normal">Created by</label>
<input type="text" id="createdBy" [(ngModel)]="_case.createdBy" name="createdBy" readonly class="w-full p-2 mb-1 rounded border-box">
</div>
<div class="form-group mb-4 flex flex-col w-[48%]">
<label for="modifiedBy" class="font-bold">Last modified by</label>
<input readonly *ngIf="!isEditing" type="text" id="modifiedBy" [(ngModel)]="_case.modifiedBy" name="modifiedBy" class="w-full p-2 mb-1 rounded border-box">
<input readonly *ngIf="isEditing" type="text" id="NewModifiedBy" value={{getUserMail()}} name="modifiedBy" class="w-full p-2 mb-1 rounded border-box">
</div>
</div>
<div class="form-row flex justify-between">
<div class="form-group mb-4 flex flex-col w-[48%]">
<label for="createdDate" class="mb-1 font-bold">Creation date</label>
<input type="text" id="createdDate" [(ngModel)]="_case.createdAt" name="createdDate" readonly class="w-full p-2 mb-1 rounded border-box">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { ActivatedRoute, RouterLink } from '@angular/router';
import { XdCasesFacade } from '@frontend/cases/frontend/domain';
import { IxModule, ModalService, ToastService } from '@siemens/ix-angular';
import { ECasePriority, ECaseStatus, ECaseType, ICaseResponse } from 'cases-shared-models';
import { AuthenticationService } from 'common-frontend-models';

import DeleteModalComponent from './delete-modal/deleteModal.component';

Expand Down Expand Up @@ -43,6 +44,7 @@ export class DetailCaseComponent {
protected readonly route: ActivatedRoute,
private readonly _modalService: ModalService,
private readonly toastService: ToastService,
protected _authenticationService: AuthenticationService,
) {}

deleteCase() {
Expand Down Expand Up @@ -86,8 +88,15 @@ export class DetailCaseComponent {
}
}

getUserMail() {
return this._authenticationService.getUserMail();
}

onSubmit(): void {
const casedetail = this.casedetail();
if (casedetail !== undefined) {
casedetail.modifiedBy = <string>this.getUserMail();
}

if (casedetail !== undefined) {
const validationString = this.validateForm(casedetail);
Expand Down

0 comments on commit fb65310

Please sign in to comment.