From 97785d17addaeb1e5d52c28153b45b5556e6eadd Mon Sep 17 00:00:00 2001 From: Simon Giesel Date: Tue, 11 Jul 2023 17:14:28 +0200 Subject: [PATCH] feat(webapp): add company overview in admin settings --- .../components/views/ViewCompaniesData.vue | 117 ++++++++++++++++++ .../src/components/views/ViewStatePortal.vue | 7 ++ webapp/src/router/router.ts | 7 ++ webapp/src/services/account.service.ts | 1 - webapp/src/services/company.service.ts | 12 +- 5 files changed, 142 insertions(+), 2 deletions(-) create mode 100644 webapp/src/components/views/ViewCompaniesData.vue diff --git a/webapp/src/components/views/ViewCompaniesData.vue b/webapp/src/components/views/ViewCompaniesData.vue new file mode 100644 index 0000000..e210a38 --- /dev/null +++ b/webapp/src/components/views/ViewCompaniesData.vue @@ -0,0 +1,117 @@ + + + + + \ No newline at end of file diff --git a/webapp/src/components/views/ViewStatePortal.vue b/webapp/src/components/views/ViewStatePortal.vue index 27c2c09..d90b5ff 100644 --- a/webapp/src/components/views/ViewStatePortal.vue +++ b/webapp/src/components/views/ViewStatePortal.vue @@ -71,6 +71,13 @@ Stammdaten-Übersicht + + + Firmen-Übersicht + { + window.scrollTo(0, 0); if(to.name === 'admin') { useEventBus('hideNavigation').emit(true); } else { diff --git a/webapp/src/services/account.service.ts b/webapp/src/services/account.service.ts index 3ebab17..9db4a28 100644 --- a/webapp/src/services/account.service.ts +++ b/webapp/src/services/account.service.ts @@ -31,7 +31,6 @@ export class AccountService { public static async updateWage(accountId: string, wageFactor: number): Promise { return COLLECTION.update(accountId, { wageFactor }); } - public static async subscribeToAccountChanges( callback: (data: RecordSubscription)=> void, ): Promise { diff --git a/webapp/src/services/company.service.ts b/webapp/src/services/company.service.ts index 4241c61..043ef3b 100644 --- a/webapp/src/services/company.service.ts +++ b/webapp/src/services/company.service.ts @@ -1,4 +1,4 @@ -import { RecordAuthResponse } from 'pocketbase'; +import { RecordAuthResponse, RecordSubscription, UnsubscribeFunc } from 'pocketbase'; import { Collections, CompaniesRecord, CompaniesResponse } from '../types/pocketbase.types'; import { PocketbaseService } from './pocketbase.service'; import { useEventBus } from '@vueuse/core'; @@ -43,4 +43,14 @@ export class CompanyService { public static async getCompanyByAccountNumber(accountNumber: string): Promise { return COLLECTION.getFirstListItem(`accountNumber="${accountNumber}"`); } + public static async updateAccountNumber(accountId: string, accountNumber: string): Promise { + return COLLECTION.update(accountId, { accountNumber }); + } + public static async subscribeToCompanyChanges( + callback: (data: RecordSubscription)=> void, + ): Promise { + return await COLLECTION.subscribe('*', (data) => { + callback(data); + }); + } } \ No newline at end of file