diff --git a/frontend/cypress/e2e/checkIn.cy.ts b/frontend/cypress/e2e/checkIn.cy.ts index 6335938413..b4a84a3fa9 100644 --- a/frontend/cypress/e2e/checkIn.cy.ts +++ b/frontend/cypress/e2e/checkIn.cy.ts @@ -173,7 +173,6 @@ describe('OKR Check-in e2e tests', () => { cy.contains('5/10'); cy.getByTestId('check-in-metric-value').clear().type('200'); cy.getByTestId('confidence-slider').realMouseDown(); - cy.getByTestId('check-in-next').click(); cy.contains('Here we are'); cy.contains('A cat would be great'); cy.getByTestId('changeInfo').clear().type('We bought a new sheep'); @@ -217,7 +216,6 @@ describe('OKR Check-in e2e tests', () => { cy.contains('6/10'); cy.getByTestId('stretch-radio').click(); cy.getByTestId('confidence-slider').realMouseDown(); - cy.getByTestId('check-in-next').click(); cy.contains('There is a new car'); cy.contains('Buy now a new pool'); cy.getByTestId('changeInfo').clear().type('We bought a new dog'); @@ -233,17 +231,16 @@ describe('OKR Check-in e2e tests', () => { function checkForDialogTextMetric() { cy.contains('Very important keyresult'); - cy.contains('Check-in erfassen (1/2)'); + cy.contains('Check-in erfassen'); cy.contains('Key Result'); cy.contains('Aktueller Wert'); cy.contains('Confidence um Target (42.7%) zu erreichen'); - cy.contains('Weiter'); cy.contains('Abbrechen'); } function checkForDialogTextOrdinal() { cy.contains('A new ordinal keyresult for our company'); - cy.contains('Check-in erfassen (1/2)'); + cy.contains('Check-in erfassen'); cy.contains('Key Result'); cy.contains('Zone (Commit / Target / Stretch) noch nicht erreicht '); cy.contains('Commit:'); @@ -253,7 +250,6 @@ function checkForDialogTextOrdinal() { cy.contains('New house'); cy.contains('New pool'); cy.contains('Confidence um Target zu erreichen'); - cy.contains('Weiter'); cy.contains('Abbrechen'); } diff --git a/frontend/cypress/e2e/scoring.cy.ts b/frontend/cypress/e2e/scoring.cy.ts index 2566485f31..aeaa7c25a5 100644 --- a/frontend/cypress/e2e/scoring.cy.ts +++ b/frontend/cypress/e2e/scoring.cy.ts @@ -22,10 +22,9 @@ describe('Scoring component e2e tests', () => { cy.getByTestId('key-result-metric-value').clear().type(String(value)); cy.getByTestId('confidence-slider').click(); cy.realPress('{rightarrow}').realPress('{rightarrow}').realPress('{rightarrow}'); - cy.getByTestId('check-in-next').click(); cy.getByTestId('changeInfo').click().type('Testveränderungen'); cy.getByTestId('initiatives').click().type('Testmassnahmen'); - cy.getByTestId('create-checkin').click(); + cy.getByTestId('submit-check-in').click(); const percentage = getPercentageMetric(baseline, stretchgoal, value); cy.validateScoring(false, percentage); cy.getByTestId('close-drawer').click(); @@ -41,10 +40,9 @@ describe('Scoring component e2e tests', () => { cy.getByTestId(`${zoneName}-radio`).click(); cy.getByTestId('confidence-slider').click(); cy.realPress('{rightarrow}').realPress('{rightarrow}').realPress('{rightarrow}'); - cy.getByTestId('check-in-next').click(); cy.getByTestId('changeInfo').click().type('Testveränderungen'); cy.getByTestId('initiatives').click().type('Testmassnahmen'); - cy.getByTestId('create-checkin').click(); + cy.getByTestId('submit-check-in').click(); const percentage = getPercentageOrdinal(zoneName); cy.validateScoring(false, percentage); cy.getByTestId('close-drawer').click(); diff --git a/frontend/cypress/support/commands.ts b/frontend/cypress/support/commands.ts index 8ae4fa1522..e83e04410b 100644 --- a/frontend/cypress/support/commands.ts +++ b/frontend/cypress/support/commands.ts @@ -49,7 +49,6 @@ Cypress.Commands.add( (currentValue: number, shouldChangeConfidence: boolean, changeInfo: string | null, initiatives: string | null) => { cy.getByTestId('check-in-metric-value').clear().type(currentValue.toString()); changeConfidence(shouldChangeConfidence); - cy.getByTestId('check-in-next').click(); if (changeInfo) { cy.getByTestId('changeInfo').clear().type(changeInfo!); } @@ -83,7 +82,6 @@ Cypress.Commands.add( break; } changeConfidence(shouldChangeConfidence); - cy.getByTestId('check-in-next').click(); if (changeInfo) { cy.getByTestId('changeInfo').clear().type(changeInfo!); } diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts index 7a6b98b188..0ac15b4dd3 100644 --- a/frontend/src/app/app.module.ts +++ b/frontend/src/app/app.module.ts @@ -50,7 +50,6 @@ import { MatCheckboxModule } from '@angular/material/checkbox'; import { CheckInFormMetricComponent } from './shared/dialog/checkin/check-in-form-metric/check-in-form-metric.component'; import { UnitValueTransformationPipe } from './shared/pipes/unit-value-transformation/unit-value-transformation.pipe'; import { CheckInFormOrdinalComponent } from './shared/dialog/checkin/check-in-form-ordinal/check-in-form-ordinal.component'; -import { CheckInBaseInformationsComponent } from './shared/dialog/checkin/check-in-base-informations/check-in-base-informations.component'; import { CustomInputComponent } from './shared/custom/custom-input/custom-input.component'; import { ConfirmDialogComponent } from './shared/dialog/confirm-dialog/confirm-dialog.component'; import { CheckInFormComponent } from './shared/dialog/checkin/check-in-form/check-in-form.component'; @@ -121,7 +120,6 @@ export const MY_FORMATS = { CheckInFormMetricComponent, UnitValueTransformationPipe, CheckInFormOrdinalComponent, - CheckInBaseInformationsComponent, CustomInputComponent, CheckInFormComponent, UnitLabelTransformationPipe, diff --git a/frontend/src/app/confidence/confidence.component.html b/frontend/src/app/confidence/confidence.component.html index b257a273bd..53a8596cbb 100644 --- a/frontend/src/app/confidence/confidence.component.html +++ b/frontend/src/app/confidence/confidence.component.html @@ -1,4 +1,8 @@ -
+

{{ checkIn.confidence }}/{{ max }} diff --git a/frontend/src/app/confidence/confidence.component.scss b/frontend/src/app/confidence/confidence.component.scss index 3c29f34756..04762dddbc 100644 --- a/frontend/src/app/confidence/confidence.component.scss +++ b/frontend/src/app/confidence/confidence.component.scss @@ -14,7 +14,8 @@ p { } mat-slider { - min-width: 350px; + width: 100%; + max-width: 350px; } .bg-light-gray { diff --git a/frontend/src/app/keyresult-detail/keyresult-detail.component.html b/frontend/src/app/keyresult-detail/keyresult-detail.component.html index 76e39fbbea..5bf14a866c 100644 --- a/frontend/src/app/keyresult-detail/keyresult-detail.component.html +++ b/frontend/src/app/keyresult-detail/keyresult-detail.component.html @@ -24,11 +24,7 @@ Confidence - +

diff --git a/frontend/src/app/keyresult-detail/keyresult-detail.component.scss b/frontend/src/app/keyresult-detail/keyresult-detail.component.scss index 31ca3e363f..c986515fcd 100644 --- a/frontend/src/app/keyresult-detail/keyresult-detail.component.scss +++ b/frontend/src/app/keyresult-detail/keyresult-detail.component.scss @@ -1,7 +1,7 @@ @import "_variables"; .keyResult-detail-attribute-show { - background-color: $keyResult-detail-attribute-bg; + background-color: $show-element; height: 100%; font-size: 0.85rem; } diff --git a/frontend/src/app/keyresult-detail/keyresult-detail.component.ts b/frontend/src/app/keyresult-detail/keyresult-detail.component.ts index 47b904fd8d..43866cd5dd 100644 --- a/frontend/src/app/keyresult-detail/keyresult-detail.component.ts +++ b/frontend/src/app/keyresult-detail/keyresult-detail.component.ts @@ -34,7 +34,9 @@ export class KeyresultDetailComponent implements OnInit { private refreshDataService: RefreshDataService, private dialog: MatDialog, private router: Router, - ) {} + ) { + this.refreshDataService.reloadOverviewSubject.subscribe(() => this.loadKeyResult()); + } ngOnInit(): void { this.loadKeyResult(); @@ -69,7 +71,6 @@ export class KeyresultDetailComponent implements OnInit { width: '721px', }); dialogRef.afterClosed().subscribe(() => { - this.loadKeyResult(); this.refreshDataService.markDataRefresh(); }); } diff --git a/frontend/src/app/shared/dialog/check-in-history-dialog/check-in-history-dialog.component.ts b/frontend/src/app/shared/dialog/check-in-history-dialog/check-in-history-dialog.component.ts index 419194ddf5..efdeadf9f0 100644 --- a/frontend/src/app/shared/dialog/check-in-history-dialog/check-in-history-dialog.component.ts +++ b/frontend/src/app/shared/dialog/check-in-history-dialog/check-in-history-dialog.component.ts @@ -7,6 +7,7 @@ import { KeyResult } from '../../types/model/KeyResult'; import { CheckInFormComponent } from '../checkin/check-in-form/check-in-form.component'; import { Observable, of } from 'rxjs'; import { KeyResultMetric } from '../../types/model/KeyResultMetric'; +import { RefreshDataService } from '../../services/refresh-data.service'; @Component({ selector: 'app-check-in-history-dialog', @@ -24,6 +25,7 @@ export class CheckInHistoryDialogComponent implements OnInit { private checkInService: CheckInService, private dialog: MatDialog, public dialogRef: MatDialogRef, + private refreshDataService: RefreshDataService, ) {} ngOnInit(): void { @@ -42,6 +44,7 @@ export class CheckInHistoryDialogComponent implements OnInit { }); dialogRef.afterClosed().subscribe(() => { this.loadCheckInHistory(); + this.refreshDataService.markDataRefresh(); }); } diff --git a/frontend/src/app/shared/dialog/checkin/check-in-base-informations/check-in-base-informations.component.html b/frontend/src/app/shared/dialog/checkin/check-in-base-informations/check-in-base-informations.component.html deleted file mode 100644 index 358d08b966..0000000000 --- a/frontend/src/app/shared/dialog/checkin/check-in-base-informations/check-in-base-informations.component.html +++ /dev/null @@ -1,39 +0,0 @@ -
- - Veränderungen seit letztem Check-in (optional) - -
- - {{ errorMessages[errorKey.toUpperCase()] }} - -
- - - Massnahmen (optional) - -
- - {{ errorMessages[errorKey.toUpperCase()] }} - -
- -
- Action Plan -
- -
- {{ action.action }} -
-
-
-
diff --git a/frontend/src/app/shared/dialog/checkin/check-in-base-informations/check-in-base-informations.component.scss b/frontend/src/app/shared/dialog/checkin/check-in-base-informations/check-in-base-informations.component.scss deleted file mode 100644 index f5e4d40cc7..0000000000 --- a/frontend/src/app/shared/dialog/checkin/check-in-base-informations/check-in-base-informations.component.scss +++ /dev/null @@ -1,7 +0,0 @@ -.action-list-item { - background-color: #f5f5f5; - height: 40px; - padding: 10px; - margin: auto; - color: black; -} diff --git a/frontend/src/app/shared/dialog/checkin/check-in-base-informations/check-in-base-informations.component.spec.ts b/frontend/src/app/shared/dialog/checkin/check-in-base-informations/check-in-base-informations.component.spec.ts deleted file mode 100644 index 037947b4d2..0000000000 --- a/frontend/src/app/shared/dialog/checkin/check-in-base-informations/check-in-base-informations.component.spec.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { CheckInBaseInformationsComponent } from './check-in-base-informations.component'; -import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms'; -import { HarnessLoader } from '@angular/cdk/testing'; -import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; -import { MatInputHarness } from '@angular/material/input/testing'; -import { By } from '@angular/platform-browser'; -// @ts-ignore -import * as errorData from '../../../../../assets/errors/error-messages.json'; -import { MatInputModule } from '@angular/material/input'; -import { MatDialogModule } from '@angular/material/dialog'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { MatSelectModule } from '@angular/material/select'; -import { MatRadioModule } from '@angular/material/radio'; -import { Action } from '../../../types/model/Action'; -import { action1, action2 } from '../../../testData'; - -describe('CheckInBaseInformationsComponent', () => { - let component: CheckInBaseInformationsComponent; - let fixture: ComponentFixture; - let loader: HarnessLoader; - let errors = errorData; - - let changeInfoText = 'ChangeInfo'; - let initiativesText = 'Initiatives'; - - let action3: Action = { id: 3, version: 1, action: '', priority: 3, isChecked: true, keyResultId: 1 }; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - MatDialogModule, - NoopAnimationsModule, - MatSelectModule, - MatInputModule, - MatRadioModule, - ReactiveFormsModule, - ], - declarations: [CheckInBaseInformationsComponent], - }); - fixture = TestBed.createComponent(CheckInBaseInformationsComponent); - component = fixture.componentInstance; - component.dialogForm = new FormGroup({ - changeInfo: new FormControl('', [Validators.maxLength(4096)]), - initiatives: new FormControl('', [Validators.maxLength(4096)]), - actionList: new FormControl([action1, action2, action3]), - }); - fixture.detectChanges(); - loader = TestbedHarnessEnvironment.loader(fixture); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); - - it('should save given text in input to form-group in typescript', async () => { - const changeInfoTextbox = fixture.debugElement.query(By.css('[data-testId="changeInfo"]')).nativeElement; - const initiativesTextbox = fixture.debugElement.query(By.css('[data-testId="initiatives"]')).nativeElement; - changeInfoTextbox.value = changeInfoText; - initiativesTextbox.value = initiativesText; - - //Update values in form - initiativesTextbox.dispatchEvent(new Event('input')); - changeInfoTextbox.dispatchEvent(new Event('input')); - - expect(component.dialogForm.controls['changeInfo'].value).toBe(changeInfoText); - expect(component.dialogForm.controls['initiatives'].value).toBe(initiativesText); - }); - - it('should display error message if text input too long', () => { - //Insert values into name input which don't match length validator - loader.getAllHarnesses(MatInputHarness).then(async (inputs) => { - const changeInfoTextbox = inputs[0]; - const initiativesTextbox = inputs[1]; - await changeInfoTextbox.setValue('x'.repeat(4097)); - await initiativesTextbox.setValue('x'.repeat(4097)); - - //Verify error message - const errorMessage = fixture.debugElement.query(By.css('mat-error')); - expect(errorMessage.nativeElement.textContent).toContain(errors.MAXLENGTH); - }); - }); - - it('should display action list', async () => { - const checkboxes = fixture.nativeElement.querySelectorAll('mat-checkbox'); - expect(checkboxes.length).toEqual(3); - expect(checkboxes[0].checked!).toBe(action1.isChecked); - expect(checkboxes[1].checked!).toBe(action2.isChecked); - }); - - it('should change state of action isChecked', async () => { - expect(component.dialogForm.value.actionList[0].isChecked).toBeFalsy(); - let event = { checked: true }; - component.changeIsChecked(event, 0); - expect(component.dialogForm.value.actionList[0].isChecked).toBeTruthy(); - - event = { checked: false }; - component.changeIsChecked(event, 0); - expect(component.dialogForm.value.actionList[0].isChecked).toBeFalsy(); - }); -}); diff --git a/frontend/src/app/shared/dialog/checkin/check-in-base-informations/check-in-base-informations.component.ts b/frontend/src/app/shared/dialog/checkin/check-in-base-informations/check-in-base-informations.component.ts deleted file mode 100644 index c3b981a0b6..0000000000 --- a/frontend/src/app/shared/dialog/checkin/check-in-base-informations/check-in-base-informations.component.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { Component, Input } from '@angular/core'; -import { FormGroup } from '@angular/forms'; -import errorMessages from '../../../../../assets/errors/error-messages.json'; -import { formInputCheck } from '../../../common'; -import { Action } from '../../../types/model/Action'; - -@Component({ - selector: 'app-check-in-base-informations', - templateUrl: './check-in-base-informations.component.html', - styleUrls: ['./check-in-base-informations.component.scss'], -}) -export class CheckInBaseInformationsComponent { - @Input() - dialogForm!: FormGroup; - protected readonly errorMessages: any = errorMessages; - protected readonly formInputCheck = formInputCheck; - - isTouchedOrDirty(name: string) { - return this.dialogForm.get(name)?.dirty || this.dialogForm.get(name)?.touched; - } - - getErrorKeysOfFormField(name: string): string[] { - const errors = this.dialogForm.get(name)?.errors; - return errors == null ? [] : Object.keys(errors); - } - - changeIsChecked(event: any, index: number) { - const actions = this.dialogForm.value.actionList; - actions[index] = { ...actions[index], isChecked: event.checked }; - this.dialogForm.patchValue({ actionList: actions }); - } - - getActions(): Action[] { - return this.dialogForm.controls['actionList'].value; - } -} diff --git a/frontend/src/app/shared/dialog/checkin/check-in-form-metric/check-in-form-metric.component.html b/frontend/src/app/shared/dialog/checkin/check-in-form-metric/check-in-form-metric.component.html index e9269f4519..50de1bcbb9 100644 --- a/frontend/src/app/shared/dialog/checkin/check-in-form-metric/check-in-form-metric.component.html +++ b/frontend/src/app/shared/dialog/checkin/check-in-form-metric/check-in-form-metric.component.html @@ -1,14 +1,13 @@
-
+
Aktueller Wert ({{ keyResult.unit | unitLabelTransformation }}): -
+
-
- Confidence um Target ({{ calculateTarget() | unitValueTransformation: keyResult.unit }}) zu erreichen - -
diff --git a/frontend/src/app/shared/dialog/checkin/check-in-form-metric/check-in-form-metric.component.ts b/frontend/src/app/shared/dialog/checkin/check-in-form-metric/check-in-form-metric.component.ts index 8194d5428d..9cc5ca0d9d 100644 --- a/frontend/src/app/shared/dialog/checkin/check-in-form-metric/check-in-form-metric.component.ts +++ b/frontend/src/app/shared/dialog/checkin/check-in-form-metric/check-in-form-metric.component.ts @@ -45,11 +45,9 @@ export class CheckInFormMetricComponent implements AfterViewInit { return errors === null ? [] : Object.keys(errors!); } - calculateTarget(): number { - return this.keyResult.stretchGoal - (this.keyResult.stretchGoal - this.keyResult.baseline) * 0.3; - } - ngAfterViewInit(): void { - this.formatValue(); + if (this.checkIn.id) { + this.formatValue(); + } } } diff --git a/frontend/src/app/shared/dialog/checkin/check-in-form-ordinal/check-in-form-ordinal.component.html b/frontend/src/app/shared/dialog/checkin/check-in-form-ordinal/check-in-form-ordinal.component.html index cf9f33687d..2bf90b45ac 100644 --- a/frontend/src/app/shared/dialog/checkin/check-in-form-ordinal/check-in-form-ordinal.component.html +++ b/frontend/src/app/shared/dialog/checkin/check-in-form-ordinal/check-in-form-ordinal.component.html @@ -1,29 +1,25 @@
- Erreichten Bereich wählen - - + Erreichten Bereich wählen: + +
Zone (Commit / Target / Stretch) noch nicht erreicht
- +

Commit:  {{ keyResult.commitZone }}

- -
+ +

Target:  {{ keyResult.targetZone }}

- +

Stretch:  {{ keyResult.stretchZone }}

-
- Confidence um Target zu erreichen - -
diff --git a/frontend/src/app/shared/dialog/checkin/check-in-form-ordinal/check-in-form-ordinal.component.scss b/frontend/src/app/shared/dialog/checkin/check-in-form-ordinal/check-in-form-ordinal.component.scss index 23479c54d0..34a5c85a4d 100644 --- a/frontend/src/app/shared/dialog/checkin/check-in-form-ordinal/check-in-form-ordinal.component.scss +++ b/frontend/src/app/shared/dialog/checkin/check-in-form-ordinal/check-in-form-ordinal.component.scss @@ -1,4 +1,4 @@ -@import "../style/variables"; +@import "variables"; .submit { background-color: $pz-dark-blue; @@ -17,8 +17,6 @@ mat-label { color: black; } .radio-text-container { - background: #f5f5f5; + background: $show-element; height: auto; - width: 625px; - border: 1px solid lightgray; } diff --git a/frontend/src/app/shared/dialog/checkin/check-in-form-ordinal/check-in-form-ordinal.component.spec.ts b/frontend/src/app/shared/dialog/checkin/check-in-form-ordinal/check-in-form-ordinal.component.spec.ts index f6caf13f15..075022da57 100644 --- a/frontend/src/app/shared/dialog/checkin/check-in-form-ordinal/check-in-form-ordinal.component.spec.ts +++ b/frontend/src/app/shared/dialog/checkin/check-in-form-ordinal/check-in-form-ordinal.component.spec.ts @@ -47,7 +47,7 @@ describe('CheckInFormOrdinalComponent', () => { }); it('should set zone of check-in to fail if value is empty', waitForAsync(async () => { - expect(component.dialogForm.controls['value'].value).toBe(Zone.FAIL); + expect(component.dialogForm.controls['value'].value).toBe(''); })); it('should set zone to Fail', waitForAsync(async () => { diff --git a/frontend/src/app/shared/dialog/checkin/check-in-form-ordinal/check-in-form-ordinal.component.ts b/frontend/src/app/shared/dialog/checkin/check-in-form-ordinal/check-in-form-ordinal.component.ts index e1e31e2f94..76850e2553 100644 --- a/frontend/src/app/shared/dialog/checkin/check-in-form-ordinal/check-in-form-ordinal.component.ts +++ b/frontend/src/app/shared/dialog/checkin/check-in-form-ordinal/check-in-form-ordinal.component.ts @@ -9,7 +9,7 @@ import { CheckInMin } from '../../../types/model/CheckInMin'; templateUrl: './check-in-form-ordinal.component.html', styleUrls: ['./check-in-form-ordinal.component.scss'], }) -export class CheckInFormOrdinalComponent implements OnInit { +export class CheckInFormOrdinalComponent { @Input() keyResult!: KeyResultOrdinal; @Input() @@ -17,10 +17,4 @@ export class CheckInFormOrdinalComponent implements OnInit { @Input() dialogForm!: FormGroup; protected readonly Zone = Zone; - - ngOnInit(): void { - if (this.dialogForm.controls['value'].value === '') { - this.dialogForm.controls['value'].setValue(Zone.FAIL); - } - } } diff --git a/frontend/src/app/shared/dialog/checkin/check-in-form/check-in-form.component.html b/frontend/src/app/shared/dialog/checkin/check-in-form/check-in-form.component.html index 12b188273a..3d65f53c81 100644 --- a/frontend/src/app/shared/dialog/checkin/check-in-form/check-in-form.component.html +++ b/frontend/src/app/shared/dialog/checkin/check-in-form/check-in-form.component.html @@ -1,75 +1,98 @@ -
- - - -
-

Key Result

-

{{ keyResult.title }}

-
- - - -
-
- -
- -
- -
- - - - -
-
+
+ + +

Key Result

+

{{ keyResult.title }}

+
+ + +
+
+ Action Plan: + + + + {{ action.action }} + + +
+ +
+ Kommentar/ Veränderung seit letztem Check-in (optional): + +
+ + {{ errorMessages[errorKey.toUpperCase()] }} + +
+
+ + + + +
+ Massnahmen (optional): + +
+ + {{ errorMessages[errorKey.toUpperCase()] }} + +
+
+ +
+ Confidence um Target + + ({{ calculateTarget(kr) | unitValueTransformation: kr.unit }}) + + zu erreichen: + + +
+
+
+ + + + + diff --git a/frontend/src/app/shared/dialog/checkin/check-in-form/check-in-form.component.scss b/frontend/src/app/shared/dialog/checkin/check-in-form/check-in-form.component.scss index 13fde69e93..5e093c6b7d 100644 --- a/frontend/src/app/shared/dialog/checkin/check-in-form/check-in-form.component.scss +++ b/frontend/src/app/shared/dialog/checkin/check-in-form/check-in-form.component.scss @@ -1,19 +1,21 @@ -@import "../style/variables"; +@import "variables"; -.submit { - background-color: $pz-dark-blue; - border-radius: 8px; +.action-list-item { + background-color: $show-element; + height: 40px; + padding: 10px; + margin: auto; + color: black; } -.cancel { - background-color: white; - color: $pz-dark-blue; +.confidence-label { + margin-bottom: -7px; } -.disabled { - background-color: gray; +section[mat-dialog-title] { + margin-bottom: 0.1rem; } -.buttons { - margin-top: 30px; +app-check-in-form-ordinal { + padding-top: 0.1rem; } diff --git a/frontend/src/app/shared/dialog/checkin/check-in-form/check-in-form.component.spec.ts b/frontend/src/app/shared/dialog/checkin/check-in-form/check-in-form.component.spec.ts index 82d8915e8f..bb5f938552 100644 --- a/frontend/src/app/shared/dialog/checkin/check-in-form/check-in-form.component.spec.ts +++ b/frontend/src/app/shared/dialog/checkin/check-in-form/check-in-form.component.spec.ts @@ -135,7 +135,7 @@ describe('CheckInFormComponent', () => { component.setDefaultValues(); expect(component.dialogForm.value).toStrictEqual({ confidence: keyResultOrdinal.lastCheckIn!.confidence, - value: keyResultOrdinal.lastCheckIn!.value, + value: '', changeInfo: '', initiatives: '', actionList: [], @@ -148,7 +148,7 @@ describe('CheckInFormComponent', () => { component.setDefaultValues(); expect(component.dialogForm.value).toStrictEqual({ confidence: keyResultActions.lastCheckIn!.confidence, - value: keyResultActions.lastCheckIn!.value.toString(), + value: '', changeInfo: '', initiatives: '', actionList: [action1, action2], diff --git a/frontend/src/app/shared/dialog/checkin/check-in-form/check-in-form.component.ts b/frontend/src/app/shared/dialog/checkin/check-in-form/check-in-form.component.ts index e674f9bec2..e898eb5269 100644 --- a/frontend/src/app/shared/dialog/checkin/check-in-form/check-in-form.component.ts +++ b/frontend/src/app/shared/dialog/checkin/check-in-form/check-in-form.component.ts @@ -8,8 +8,9 @@ import { CheckInMin } from '../../../types/model/CheckInMin'; import { ParseUnitValuePipe } from '../../../pipes/parse-unit-value/parse-unit-value.pipe'; import { CheckInService } from '../../../services/check-in.service'; import { Action } from '../../../types/model/Action'; -import { DATE_FORMAT } from '../../../constantLibary'; import { ActionService } from '../../../services/action.service'; +import { formInputCheck } from '../../../common'; +import errorMessages from '../../../../../assets/errors/error-messages.json'; @Component({ selector: 'app-check-in-form', @@ -22,8 +23,6 @@ export class CheckInFormComponent implements OnInit { checkIn!: CheckInMin; currentDate: Date; continued: boolean = false; - protected readonly DATE_FORMAT = DATE_FORMAT; - dialogForm = new FormGroup({ value: new FormControl('', [Validators.required]), confidence: new FormControl(5, [Validators.required, Validators.min(1), Validators.max(10)]), @@ -31,6 +30,8 @@ export class CheckInFormComponent implements OnInit { initiatives: new FormControl('', [Validators.maxLength(4096)]), actionList: new FormControl([]), }); + protected readonly formInputCheck = formInputCheck; + protected readonly errorMessages: { [key: string]: string } = errorMessages; constructor( public dialogRef: MatDialogRef, @@ -48,6 +49,15 @@ export class CheckInFormComponent implements OnInit { this.dialogForm.patchValue({ actionList: this.keyResult.actionList }); } + isTouchedOrDirty(name: string) { + return this.dialogForm.get(name)?.dirty || this.dialogForm.get(name)?.touched; + } + + getErrorKeysOfFormField(name: string): string[] { + const errors = this.dialogForm.get(name)?.errors; + return errors == null ? [] : Object.keys(errors); + } + setDefaultValues() { this.dialogForm.controls.actionList.setValue(this.keyResult.actionList); if (this.data.checkIn != null) { @@ -61,7 +71,6 @@ export class CheckInFormComponent implements OnInit { /* If KeyResult has lastCheckIn set checkIn to this value */ if (this.keyResult.lastCheckIn != null) { this.checkIn = { ...this.keyResult.lastCheckIn, id: undefined }; - this.dialogForm.controls.value.setValue(this.checkIn.value!.toString()); this.dialogForm.controls.confidence.setValue(this.checkIn.confidence); return; } @@ -69,6 +78,10 @@ export class CheckInFormComponent implements OnInit { this.checkIn = { confidence: 5 } as CheckInMin; } + calculateTarget(keyResult: KeyResultMetric): number { + return keyResult.stretchGoal - (keyResult.stretchGoal - keyResult.baseline) * 0.3; + } + saveCheckIn() { this.dialogForm.controls.confidence.setValue(this.checkIn.confidence); let checkIn: any = { @@ -102,10 +115,13 @@ export class CheckInFormComponent implements OnInit { return this.keyResult as KeyResultOrdinal; } - getStepLabel(): string { - if (this.continued) { - return '(2/2)'; - } - return '(1/2)'; + getActions(): Action[] | null { + return this.dialogForm.controls['actionList'].value; + } + + changeIsChecked(event: any, index: number) { + const actions = this.dialogForm.value.actionList!; + actions[index] = { ...actions[index], isChecked: event.checked }; + this.dialogForm.patchValue({ actionList: actions }); } } diff --git a/frontend/src/app/shared/pipes/parse-unit-value/parse-unit-value.pipe.ts b/frontend/src/app/shared/pipes/parse-unit-value/parse-unit-value.pipe.ts index 1db5299427..9e8705f9e0 100644 --- a/frontend/src/app/shared/pipes/parse-unit-value/parse-unit-value.pipe.ts +++ b/frontend/src/app/shared/pipes/parse-unit-value/parse-unit-value.pipe.ts @@ -5,10 +5,11 @@ import { CHAR_REGEX } from '../../regexLibrary'; name: 'parseUnitValue', }) export class ParseUnitValuePipe implements PipeTransform { - transform(value: string): number { + transform(param: string | null): number { + const value: string = param || '0'; if (value.toString().at(0) == '-') { return +('-' + value.toString().replace(CHAR_REGEX, '')); } - return +value.toString().replace(CHAR_REGEX, ''); + return Number(value.toString().replace(CHAR_REGEX, '')); } } diff --git a/frontend/src/style/_variables.scss b/frontend/src/style/_variables.scss index 5a407bb7a1..22222745d5 100644 --- a/frontend/src/style/_variables.scss +++ b/frontend/src/style/_variables.scss @@ -14,10 +14,10 @@ $top-bar-height: 48px; $overview-bg: #d9d9d9; $keyResult-attribute-bg: #ffffff; -$keyResult-detail-attribute-bg: #f5f5f5; $keyResult-attribute-edit-border: #ddddddff; $error-color: #b3261b; +$show-element: #f5f5f5; $pz-dark-blue-palette: ( 50: lighten($pz-dark-blue, 50%), diff --git a/frontend/src/style/custom_angular.components.scss b/frontend/src/style/custom_angular.components.scss index 310bb4c8a2..5a6889f307 100644 --- a/frontend/src/style/custom_angular.components.scss +++ b/frontend/src/style/custom_angular.components.scss @@ -12,6 +12,24 @@ } } +.mdc-dialog__title::before { + display: none !important; +} + +.mat-mdc-dialog-surface { + padding: 1rem 0 1rem 0; +} + +.ordinal-zone .mdc-form-field, +.mdc-label { + width: 100% !important; +} + +mat-dialog-content, +mat-dialog-actions { + padding: 0 1.62rem 0 1.62rem !important; +} + .mat-mdc-menu-item.objective-menu-option { line-height: normal !important; font-size: 1rem; diff --git a/frontend/src/style/custom_bootstrap.scss b/frontend/src/style/custom_bootstrap.scss index cc241fe7ff..b19d25c264 100644 --- a/frontend/src/style/custom_bootstrap.scss +++ b/frontend/src/style/custom_bootstrap.scss @@ -2,7 +2,7 @@ $theme-colors: ( "pz-dark-blue": $pz-dark-blue, "eggshell": $eggshell, - "keyResult-detail-attribute": $keyResult-detail-attribute-bg, + "display-element": $show-element, "keyResult-attribute": $keyResult-attribute-bg, "error": $error, ); diff --git a/frontend/src/style/styles.scss b/frontend/src/style/styles.scss index 15094b95ab..add339c16d 100644 --- a/frontend/src/style/styles.scss +++ b/frontend/src/style/styles.scss @@ -113,14 +113,10 @@ body pzsh-backdrop { color: $error-color; } -.big-dialog-form-field { - height: 4.375rem !important; - padding: 0.437rem 0.625rem 0.375rem 0.625rem !important; -} - -.dialog-form-field { - resize: none; - outline: none; +textarea, +input:not([type]), +input[type="text"] { + @extend .ps-1; } .dialog-form-field-error { @@ -150,7 +146,7 @@ body pzsh-backdrop { } .dialog-padding { - padding: 1.62rem !important; + padding: 0 1.62rem 0 1.62rem !important; } .objective-three-dot-menu {