diff --git a/frontend/src/e2e-test/pages/mobile/staff-page.ts b/frontend/src/e2e-test/pages/mobile/staff-page.ts index 8f12350864c..27c8ae050f7 100644 --- a/frontend/src/e2e-test/pages/mobile/staff-page.ts +++ b/frontend/src/e2e-test/pages/mobile/staff-page.ts @@ -20,91 +20,6 @@ import { TextInput } from '../../utils/page' -export default class StaffPage { - #staffCount: Element - #staffOtherCount: Element - #cancelButton: Element - #confirmButton: Element - #occupancyRealized: Element - #updated: Element - constructor(readonly page: Page) { - this.#staffCount = page.findByDataQa('staff-count') - this.#staffOtherCount = page.findByDataQa('staff-other-count') - this.#cancelButton = page.findByDataQa('cancel-button') - this.#confirmButton = page.findByDataQa('confirm-button') - this.#occupancyRealized = page.findByDataQa('realized-occupancy') - this.#updated = page.findByDataQa('updated') - } - - private countButton(parent: Element, which: 'plus' | 'minus') { - return parent.find(`[data-qa="${which}-button"]`) - } - - get staffCount() { - return this.#staffCount.find('[data-qa="value"]').text - } - - get staffOtherCount() { - return this.#staffOtherCount.find('[data-qa="value"]').text - } - - async incDecButtonsVisible(): Promise { - return Promise.all( - [this.#staffCount, this.#staffOtherCount] - .map((parent) => - (['plus', 'minus'] as const).map((which) => - this.countButton(parent, which) - ) - ) - .flat() - .map((el) => el.visible) - ) - } - - async incStaffCount() { - return this.countButton(this.#staffCount, 'plus').click() - } - - async decStaffCount() { - return this.countButton(this.#staffCount, 'minus').click() - } - - async incStaffOtherCount() { - return this.countButton(this.#staffOtherCount, 'plus').click() - } - - async decStaffOtherCount() { - return this.countButton(this.#staffOtherCount, 'minus').click() - } - - async cancel() { - return this.#cancelButton.click() - } - - async confirm() { - return this.#confirmButton.click() - } - - get buttonsDisabled() { - return Promise.all([ - this.#cancelButton.disabled, - this.#confirmButton.disabled - ]).then(([cancel, confirm]) => cancel && confirm) - } - - get buttonsEnabled() { - return this.buttonsDisabled.then((disabled) => !disabled) - } - - get updated() { - return this.#updated.text - } - - get occupancy() { - return this.#occupancyRealized.text - } -} - export class StaffAttendancePage { editButton: Element previousAttendancesButton: Element diff --git a/frontend/src/e2e-test/specs/6_mobile/staff.spec.ts b/frontend/src/e2e-test/specs/6_mobile/staff.spec.ts deleted file mode 100644 index 18a4bb583aa..00000000000 --- a/frontend/src/e2e-test/specs/6_mobile/staff.spec.ts +++ /dev/null @@ -1,126 +0,0 @@ -// SPDX-FileCopyrightText: 2017-2022 City of Espoo -// -// SPDX-License-Identifier: LGPL-2.1-or-later - -import HelsinkiDateTime from 'lib-common/helsinki-date-time' - -import { - testDaycareGroup, - Fixture, - familyWithTwoGuardians, - testDaycare, - testCareArea -} from '../../dev-api/fixtures' -import { - createDefaultServiceNeedOptions, - resetServiceState -} from '../../generated/api-clients' -import MobileNav from '../../pages/mobile/mobile-nav' -import StaffPage from '../../pages/mobile/staff-page' -import { waitUntilEqual, waitUntilTrue } from '../../utils' -import { pairMobileDevice } from '../../utils/mobile' -import { Page } from '../../utils/page' - -let page: Page -let nav: MobileNav -let staffPage: StaffPage -let mobileSignupUrl: string - -const now = HelsinkiDateTime.of(2023, 3, 15, 12, 0) -const today = now.toLocalDate() - -beforeEach(async () => { - await resetServiceState() - await Fixture.careArea(testCareArea).save() - await Fixture.daycare(testDaycare).save() - await Fixture.family(familyWithTwoGuardians).save() - await createDefaultServiceNeedOptions() - - await Fixture.daycareGroup(testDaycareGroup).save() - const daycarePlacementFixture = await Fixture.placement({ - childId: familyWithTwoGuardians.children[0].id, - unitId: testDaycare.id, - startDate: today, - endDate: today.addYears(1) - }).save() - await Fixture.groupPlacement({ - daycarePlacementId: daycarePlacementFixture.id, - daycareGroupId: testDaycareGroup.id, - startDate: today, - endDate: today.addYears(1) - }).save() - - page = await Page.open({ mockedTime: now }) - nav = new MobileNav(page) - - mobileSignupUrl = await pairMobileDevice(testDaycare.id) - await page.goto(mobileSignupUrl) - await nav.staff.click() - staffPage = new StaffPage(page) -}) - -describe('Staff page', () => { - test('Staff for all groups is read-only', async () => { - await waitUntilEqual(() => staffPage.staffCount, '0') - await waitUntilEqual(() => staffPage.staffOtherCount, '0') - await waitUntilEqual(() => staffPage.updated, 'Tietoja ei ole päivitetty') - - await waitUntilEqual( - () => staffPage.incDecButtonsVisible(), - [false, false, false, false] - ) - }) - - test('Set group staff', async () => { - await nav.selectGroup(testDaycareGroup.id) - await waitUntilEqual(() => staffPage.staffCount, '0') - await waitUntilEqual(() => staffPage.staffOtherCount, '0') - await waitUntilEqual(() => staffPage.updated, 'Tietoja ei ole päivitetty') - - await staffPage.incStaffCount() - await staffPage.incStaffCount() - await staffPage.incStaffCount() - await waitUntilEqual(() => staffPage.staffCount, '1,5') - await staffPage.incStaffOtherCount() - await waitUntilEqual(() => staffPage.staffOtherCount, '0,5') - await staffPage.confirm() - - await waitUntilEqual( - () => staffPage.occupancy, - 'Ryhmän käyttöaste tänään 9,5 %' - ) - await waitUntilTrue(async () => - (await staffPage.updated).startsWith('Tiedot päivitetty tänään ') - ) - }) - - test('Cancel resets the form', async () => { - await nav.selectGroup(testDaycareGroup.id) - await staffPage.incStaffCount() - await staffPage.confirm() - - await staffPage.incStaffCount() - await staffPage.incStaffOtherCount() - await staffPage.cancel() - - await waitUntilEqual(() => staffPage.staffCount, '0,5') - await waitUntilEqual(() => staffPage.staffOtherCount, '0') - }) - - test('Button state', async () => { - await nav.selectGroup(testDaycareGroup.id) - await waitUntilTrue(() => staffPage.buttonsDisabled) - - await staffPage.incStaffCount() - await waitUntilTrue(() => staffPage.buttonsEnabled) - - await staffPage.decStaffCount() - await waitUntilTrue(() => staffPage.buttonsDisabled) - - await staffPage.incStaffOtherCount() - await waitUntilTrue(() => staffPage.buttonsEnabled) - - await staffPage.decStaffOtherCount() - await waitUntilTrue(() => staffPage.buttonsDisabled) - }) -}) diff --git a/frontend/src/employee-frontend/components/absences/StaffAttendance.tsx b/frontend/src/employee-frontend/components/absences/StaffAttendance.tsx index 1854ce26267..dd0a5f445b1 100755 --- a/frontend/src/employee-frontend/components/absences/StaffAttendance.tsx +++ b/frontend/src/employee-frontend/components/absences/StaffAttendance.tsx @@ -65,8 +65,7 @@ export default React.memo(function StaffAttendance({ body: { groupId, date, - count, - countOther: null + count } }), [groupId] diff --git a/frontend/src/employee-mobile-frontend/App.tsx b/frontend/src/employee-mobile-frontend/App.tsx index 28a678720b0..9677c51d685 100755 --- a/frontend/src/employee-mobile-frontend/App.tsx +++ b/frontend/src/employee-mobile-frontend/App.tsx @@ -61,7 +61,6 @@ import PairingWizard from './pairing/PairingWizard' import { queryClient, QueryClientProvider } from './query' import { RememberContext, RememberContextProvider } from './remember' import { SettingsPage } from './settings/SettingsPage' -import StaffPage from './staff/StaffPage' import ExternalStaffMemberPage from './staff-attendance/ExternalStaffMemberPage' import MarkExternalStaffMemberArrivalPage from './staff-attendance/MarkExternalStaffMemberArrivalPage' import StaffAttendanceEditPage from './staff-attendance/StaffAttendanceEditPage' @@ -212,10 +211,6 @@ function GroupRouter({ unitId }: { unitId: DaycareId }) { path="child-attendance/*" element={} /> - } - /> } @@ -305,14 +300,6 @@ function ChildRouter({ unitId }: { unitId: DaycareId }) { ) } -function StaffRouter({ unitOrGroup }: { unitOrGroup: UnitOrGroup }) { - return ( - - } /> - - ) -} - function StaffAttendanceRouter({ unitOrGroup }: { unitOrGroup: UnitOrGroup }) { return ( @@ -449,9 +436,6 @@ export const routes = { childSensitiveInfo(unitId: UUID, child: UUID): Uri { return uri`${this.child(unitId, child)}/info` }, - staff(unitOrGroup: UnitOrGroup): Uri { - return uri`${this.unitOrGroup(unitOrGroup)}/staff` - }, staffAttendanceRoot(unitOrGroup: UnitOrGroup): Uri { return uri`${this.unitOrGroup(unitOrGroup)}/staff-attendance` }, diff --git a/frontend/src/employee-mobile-frontend/common/BottomNavbar.tsx b/frontend/src/employee-mobile-frontend/common/BottomNavbar.tsx index 9cf952a1938..508e4894689 100644 --- a/frontend/src/employee-mobile-frontend/common/BottomNavbar.tsx +++ b/frontend/src/employee-mobile-frontend/common/BottomNavbar.tsx @@ -140,26 +140,23 @@ export default function BottomNavbar({ /> - + onClick={() => + selected !== 'staff' && + navigate(routes.staffAttendances(unitOrGroup, 'absent').value) + } + > + + + + ) : null} {unit.features.includes('MOBILE_MESSAGING') ? (