feat: add Agrarmonitor integration to dashboard and stats, and rename accounting permission group
Build and Push Multi-Platform Images / build-and-push (push) Successful in 33s
Build and Push Multi-Platform Images / build-and-push (push) Successful in 33s
This commit is contained in:
@@ -23,6 +23,7 @@ export class StatsController {
|
||||
let posteingangCount = 0;
|
||||
let manuellCount = 0;
|
||||
let mailpostfachCount = 0;
|
||||
let agrarmonitorCount = 0;
|
||||
|
||||
// 1. Eingangsbox (Dateien aus /mnt/scans)
|
||||
if (req.user) {
|
||||
@@ -66,11 +67,24 @@ export class StatsController {
|
||||
this.logger.error('Fehler beim Abrufen der E-Mail-Stats: ' + err.message);
|
||||
}
|
||||
|
||||
// 5. Agrarmonitor (Paperless tag 3)
|
||||
try {
|
||||
const agrarmonitorResponse = await this.paperlessService.getDocuments({
|
||||
page: 1,
|
||||
page_size: 1,
|
||||
tags__id__all: 3,
|
||||
});
|
||||
agrarmonitorCount = agrarmonitorResponse.count || 0;
|
||||
} catch (err) {
|
||||
this.logger.error('Fehler beim Abrufen der Agrarmonitor-Stats: ' + err.message);
|
||||
}
|
||||
|
||||
return {
|
||||
inbox: inboxCount,
|
||||
posteingang: posteingangCount,
|
||||
manuell: manuellCount,
|
||||
mailpostfach: mailpostfachCount,
|
||||
agrarmonitor: agrarmonitorCount,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ export interface StatsCounts {
|
||||
posteingang: number;
|
||||
manuell: number;
|
||||
mailpostfach: number;
|
||||
agrarmonitor: number;
|
||||
}
|
||||
|
||||
export const statsApi = {
|
||||
|
||||
@@ -27,7 +27,7 @@ export function mapGroupsToPermissions(groups: string[] | undefined | null): Per
|
||||
return Array.from(permissions);
|
||||
}
|
||||
|
||||
if (groups.includes('PM_Belege')) {
|
||||
if (groups.includes('PM_Buchhaltung')) {
|
||||
permissions.add(Permission.PROCESS_MANUALLY);
|
||||
}
|
||||
if (groups.includes('PM_Maileingang')) {
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
MailOutlined,
|
||||
EditOutlined,
|
||||
ArrowRightOutlined,
|
||||
GlobalOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import type { ReactNode } from 'react';
|
||||
import { useAuth } from '../auth/AuthContext';
|
||||
@@ -26,6 +27,7 @@ interface DashboardTile {
|
||||
accent: string;
|
||||
accentSoft: string;
|
||||
accentSoftDark: string;
|
||||
externalUrl?: string;
|
||||
}
|
||||
|
||||
const tiles: DashboardTile[] = [
|
||||
@@ -73,6 +75,18 @@ const tiles: DashboardTile[] = [
|
||||
accentSoft: '#f9f0ff',
|
||||
accentSoftDark: 'rgba(114, 46, 209, 0.18)',
|
||||
},
|
||||
{
|
||||
key: 'agrarmonitor',
|
||||
path: '',
|
||||
externalUrl: 'https://admin7.agrarmonitor.de/dateien/eingang#dateien',
|
||||
title: 'In Agrarmonitor',
|
||||
description: 'Dokumente im Agrarmonitor-Eingang anzeigen und verwalten.',
|
||||
icon: <GlobalOutlined />,
|
||||
permission: Permission.PROCESS_MANUALLY,
|
||||
accent: '#52c41a',
|
||||
accentSoft: '#f6ffed',
|
||||
accentSoftDark: 'rgba(82, 196, 26, 0.16)',
|
||||
},
|
||||
];
|
||||
|
||||
export default function DashboardPage() {
|
||||
@@ -158,7 +172,11 @@ export default function DashboardPage() {
|
||||
<Col key={tile.key} xs={24} sm={12} lg={8} xxl={6}>
|
||||
<Card
|
||||
hoverable
|
||||
onClick={() => navigate(tile.path)}
|
||||
onClick={() =>
|
||||
tile.externalUrl
|
||||
? window.open(tile.externalUrl, '_blank', 'noopener,noreferrer')
|
||||
: navigate(tile.path)
|
||||
}
|
||||
styles={{
|
||||
body: {
|
||||
padding: 24,
|
||||
|
||||
Reference in New Issue
Block a user