Commit Graph

36 Commits

Author SHA1 Message Date
OlgunR
746465d8fe Revert "Enhance PDF viewing experience with new document viewer"
This reverts commit 1cc617de42.
2026-06-09 11:48:41 +02:00
OlgunR
559829882a Revert "Add DevExpress Document Viewer page and dependencies"
This reverts commit bec9ea2356.
2026-06-09 11:48:31 +02:00
OlgunR
bec9ea2356 Add DevExpress Document Viewer page and dependencies
Updated `_ViewImports.cshtml` to include DevExpress and DevExtreme tag helpers. Created `DocumentViewerDevExpress.cshtml` for displaying a DevExpress Document Viewer with necessary CDN links. Implemented the corresponding code-behind in `DocumentViewerDevExpress.cshtml.cs` to handle model binding and report key generation.
2026-06-08 17:21:36 +02:00
OlgunR
1cc617de42 Enhance PDF viewing experience with new document viewer
- Replaced button in `Details.cshtml` with a link to a new document viewer page.
- Created `DocumentViewer.cshtml` to display PDFs using an iframe, with a back button and a link to an experimental DevExpress viewer.
- Introduced `DocumentViewerModel` in `DocumentViewer.cshtml.cs` for handling invoice ID and PDF URL.
- Updated `OnGetAsync` in `ViewPdf.cshtml.cs` to set `Content-Disposition` to inline for better PDF rendering in the browser.
2026-06-08 16:59:57 +02:00
OlgunR
b515b4f523 Refactor PDF viewing and integrate DevExpress support
- Removed folder reference for "Controllers" in the project file.
- Updated `ViewPdf.cshtml` to include layout and clarify PDF output.
- Enhanced `ViewPdf.cshtml.cs` with improved logging and error handling.
- Added MVC controller services in `Program.cs` for DevExpress functionality.
- Introduced `DocumentViewerController` to manage document viewing requests.
2026-06-08 15:14:15 +02:00
OlgunR
f19251ac1a Add DevExpress Reporting and Custom Report Storage
Updated project dependencies to include DevExpress Reporting and PDF Drawing libraries. Registered DevExpress services and middleware in `Program.cs`. Added `CustomReportStorageWebExtension` to handle read-only invoice reports, including database and file system integration. Enhanced logging for better traceability and error handling.
2026-06-08 08:38:44 +02:00
OlgunR
6dd1fd71da Mark dependencies as peer in package-lock.json
Added the `"peer": true` property to multiple dependencies in the `package-lock.json` file to mark them as peer dependencies. This ensures that these dependencies are provided by the consuming project, improving dependency management and avoiding version conflicts.

Additionally, updated the `license` field formatting for several dependencies to ensure consistency. No changes were made to versions, integrity hashes, or dependency structures.
2026-06-05 11:30:53 +02:00
OlgunR
762f76c920 Regeln für DevExpress- und Azure-Tools hinzugefügt
Neue Regeln für die Nutzung von DevExpress- und Azure-Tools:
- DevExpress: Nutzung des `dxdocs`-Servers und MCP-Tools priorisiert.
- Azure: `azmcp_bestpractices_get` für Best Practices erforderlich.
- Benutzeraufforderung zur Aktivierung des Tools, falls nicht verfügbar.
2026-06-03 10:57:53 +02:00
OlgunR
ba570687b2 Update Workflow-Integration description in Index.cshtml
Revised the description for the "Workflow-Integration" feature
in the `Index.cshtml` file. The previous text, "Durchlauf
definierter Verarbeitungsschritte mit Status-Tracking"
(Execution of defined processing steps with status tracking),
was replaced with "Hier werden Workflow-Schritte durchlaufen
und der Ergebnisbericht erstellt." (Here, workflow steps are
executed, and the result report is generated).
2026-06-02 17:09:11 +02:00
OlgunR
84a4c182e2 Modernize UI with DevExpress icons and improved layout
Updated `Index.cshtml`:
- Added icons and a more descriptive project title.
- Introduced a new introductory paragraph explaining the app's purpose.
- Replaced the old alert section with a detailed workflow explanation.
- Added cards for invoice upload and summary navigation.
- Included a technology stack section with badges for key tools.

Updated `Details.cshtml`:
- Replaced text-based icons with DevExpress icons for titles, buttons, and attachments.
- Improved attachment handling with `<i>` tags and consistent icon usage.
- Updated "No attachments" message to include an icon.

These changes enhance the UI's visual consistency, usability, and professionalism.
2026-06-02 16:56:50 +02:00
OlgunR
a55e53521f Refactor: Remove sample data and add invoice processing
Removed `SampleDataController`, `SampleData`, and `SampleOrder`
classes, along with the `DevExtreme` DataGrid in `Index.cshtml`,
to eliminate reliance on mock data and sample orders.

Updated `Index.cshtml` to introduce a welcome message and
informational section about ZUGFeRD/Factur-X invoice processing,
highlighting features like PDF/A upload, XML extraction, and
result PDF creation. Added navigation links for invoice-related
actions.

Updated `DXApp.TemplateKitProject.csproj` to include a new
`<ItemGroup>` for the `Controllers` folder, preparing the
project structure for future development.
2026-06-02 16:21:18 +02:00
OlgunR
f7cac8c0a7 Improve popup layout and CodeMirror integration
Updated the `ContentTemplate` to enhance the layout of the
`#attachment-content` container by using `display: flex` and
ensuring full height utilization. Added CSS rules for consistent
styling of the `.CodeMirror` editor, including font size and
height adjustments.

Simplified CodeMirror initialization for XML files by removing
redundant `<textarea>` creation and directly embedding the
editor. Added `viewportMargin: Infinity` for better rendering
and used `setTimeout` to ensure proper sizing and refresh.

Refined plain text rendering for non-XML files to maintain a
clean and consistent display.
2026-06-02 15:32:42 +02:00
OlgunR
8065c589bc Enhance file attachment viewing experience
Replaced direct file links with a JavaScript-based viewer
(`openAttachmentViewer`) and added a DevExtreme Popup
(`attachment-viewer-popup`) for displaying attachments in a
modal dialog. The viewer supports PDFs (via PDF.js), XML
(with CodeMirror syntax highlighting), plain text, images,
and provides a fallback for unsupported file types.

Dynamically load CodeMirror for XML files and handle errors
gracefully when loading file content. Added `onAttachmentPopupHiding`
to clear popup content on close.

Updated `ViewAttachmentModel` to return text/XML content
directly for AJAX requests, improving frontend performance
and enabling dynamic content loading.
2026-06-02 15:21:11 +02:00
OlgunR
c9ba7912fa Improve PDF Viewer popup styling and behavior
Added shading and overlay color to the PDF Viewer popup for better user experience. Adjusted z-index values in the `<style>` block to ensure the popup and its overlay appear above other elements. Updated the `openPdfViewer` function to explicitly set the container and position options, and ensured z-index values are reapplied after the popup is shown.
2026-06-02 15:13:54 +02:00
OlgunR
920dce13d5 Add support for invoice attachments
Introduced the `InvoiceAttachment` entity and its relationship with `ZugferdInvoice` to manage extracted invoice attachments. Updated `AppDbContext` and added a migration to create the `InvoiceAttachments` table with cascading delete behavior and an index for optimized queries.

Enhanced the UI to display attachments in `Details.cshtml`, including file type icons, file size, and extraction date. Added a new `ViewAttachment` page to render or download attachments based on their type, with support for XML, plain text, images, and downloads.

Implemented `AttachmentViewerService` to determine viewer types and MIME types for attachments. Registered the service in the DI container. Updated `Upload.cshtml.cs` to save extracted attachments to the database.

Improved user experience with syntax highlighting for XML files and appropriate messages for unsupported file types.
2026-06-02 15:03:37 +02:00
OlgunR
43d63e975d Enhance PDF processing and report integration
Refactor `PdfResultPackageService` to improve PDF handling:
- Load the main document into `PdfDocumentProcessor`.
- Remove original metadata to attribute the result to `DXApp`.
- Replace report file attachment with appending report pages.
- Use a temporary processor to determine report page count.
- Add logging for appended pages and total page count.
- Update save operation to include detailed logging.

Removed the functionality to attach the report file as a PDF attachment.
Improved overall usability, traceability, and document attribution.
2026-06-02 14:06:24 +02:00
OlgunR
03599addb8 Optimize invoice performance with indexes and DTO
Added indexes for `ImportedAt` and a composite key on
`InvoiceNumber` and `SellerTaxId` to improve query performance.
Updated `AppDbContext` and EF Core migrations to reflect these
changes. Introduced `ZugferdInvoiceListDto` to optimize memory
usage by excluding large fields like `RawXml`. Updated the
frontend (`Index.cshtml`) and backend (`Index.cshtml.cs`) to use
the new DTO for better performance.
2026-06-02 13:45:57 +02:00
OlgunR
2ae2bbdaf6 Update PDF metadata handling in PdfResultPackageService
Introduce functionality to remove and replace metadata in the
resulting PDF document. After loading the document with
`PdfDocumentProcessor`, the metadata fields (`Author`, `Creator`,
`Producer`, `Title`, `Subject`, and `Keywords`) are cleared or
replaced with values indicating the document was processed by
the "DXApp" system. This ensures proper attribution and removes
any association with the original document creator.
2026-06-01 16:32:25 +02:00
OlgunR
a4c33e6bac Add MIME type mappings for .mjs and .ftl files
Updated the `Program.cs` file to enhance static file handling:
- Corrected the comment for `.mjs` MIME type registration.
- Added a new MIME type mapping for `.ftl` files as `text/plain`.
- Updated `UseStaticFiles` middleware to use a `StaticFileOptions`
  object with the modified `ContentTypeProvider`.

These changes ensure proper serving of `.mjs` and `.ftl` files with
appropriate content type headers.
2026-06-01 15:43:16 +02:00
OlgunR
346750e933 Enhance PDF viewer with annotations and WebAssembly
Added support for advanced annotation tools, including signature and stamp management, along with accessibility improvements. Introduced WebAssembly binaries (`qcms_bg.wasm`, `quickjs-eval.wasm`, `openjpeg.wasm`, `jbig2.wasm`) for enhanced performance in color management, JavaScript execution, and image decoding.

Implemented a JavaScript fallback (`openjpeg_nowasm_fallback.js`) for environments without WebAssembly support. Updated `Details.cshtml` to include a PDF viewer popup and added a new Razor Page (`ViewPdf.cshtml`) for secure PDF file access. Registered `.mjs` MIME type in `Program.cs` for PDF.js compatibility.

Enhanced localization with translations for multiple languages in `viewer.ftl` and added new icons, dialogs, and accessibility features. Updated `DXApp.sln` to include a new project for template management. These changes improve functionality, modularity, and user experience.
2026-06-01 14:08:17 +02:00
OlgunR
a087baa089 Add stamp to first page of PDF documents
Introduce functionality to add a stamp to the top-right corner of
the first page of a PDF. The stamp includes a white background,
a green border, and two lines of text: "✔ VERARBEITET" in bold
green font and the current date/time in gray font. The stamp is
drawn using `DevExpress.Pdf.PdfDocumentProcessor` and saved to
the document's foreground.
2026-05-29 11:26:25 +02:00
OlgunR
98226f239b Adjust logging levels to reduce verbosity
Changed logging levels from LogInformation to LogDebug in
PdfAttachmentExtractorService and PdfResultPackageService.
This includes logs for PDF conformity levels, ZUGFeRD
Guideline-IDs, saved attachment details, and result report
discovery. These changes aim to reduce log verbosity in
production environments by moving less critical information
to the debug level.
2026-05-29 09:52:05 +02:00
OlgunR
1144c45826 Improve error handling in PDF processing workflow
Refactored the PDF processing workflow to enhance error handling
and provide more descriptive exception messages. Added `try-catch`
blocks around the PDF/A-3b conversion and document saving steps
to handle potential failures.

Labeled the workflow steps for clarity:
- Step 1: Convert to PDF/A-3b
- Step 2: Buffer converted PDF
- Step 3: Embed attachment
- Step 4: Save document

Removed redundant `MemoryStream` initialization for the original
PDF and updated comments to improve code readability and
maintainability.
2026-05-29 09:20:34 +02:00
OlgunR
9adc9ac4ed Add invoice details page and grid column link
Added a "Details" column to the grid in `Index.cshtml` with a button linking to the new invoice details page. The button dynamically generates the URL using the invoice ID.

Created `Details.cshtml` to display detailed invoice information, including metadata such as seller, buyer, amounts, and dates. Added a back button and error handling for missing invoices.

Introduced `DetailsModel` in `Details.cshtml.cs` to fetch invoice data using `AppDbContext`. Implemented the `OnGetAsync` method to retrieve data asynchronously and handle cases where the invoice is not found.
2026-05-28 16:53:50 +02:00
OlgunR
8e329c2b50 Relocate "Result-PDF" success message in Upload.cshtml
The code block displaying the "Result-PDF" success message was removed from its original location and reintroduced in a different section of the `Upload.cshtml` file. The new placement is after the success message confirming that the invoice was saved in the database. The functionality and alert structure remain unchanged, displaying the file path of the generated PDF if `Model.ResultFilePath` is not empty.
2026-05-28 11:41:00 +02:00
OlgunR
245f7a8268 Add duplicate invoice detection and warning message
Added a warning message in `Upload.cshtml` to notify users when a duplicate invoice is detected. Introduced the `IsDuplicate` property in `UploadModel` to track duplicates and updated the `OnPostAsync` method to set this property based on the `ImportedAt` timestamp.

Enhanced the `ImportAsync` method in `ZugferdImportService` to include duplicate detection by checking the database for invoices with the same `InvoiceNumber` and `SellerTaxId`. If a duplicate is found, it logs a warning and returns the existing invoice.

Updated `ImportAsync` to accept an optional `guidelineId` parameter and added logging for duplicate detection and successful imports.
2026-05-28 08:35:01 +02:00
OlgunR
6582370c08 Add GuidelineId property to ZugferdInvoice model
Added a new `GuidelineId` property to the `ZugferdInvoice` model to store the ZUGFeRD Guideline ID extracted from XMP metadata. Updated the `AppDbContextModelSnapshot.cs` to reflect this change and created a migration (`20260527133241_AddGuidelineId`) to add the `GuidelineId` column to the `ZugferdInvoices` table.

Generated the corresponding designer file for the migration to define the updated database schema. Minor formatting changes were made to `ZugferdInvoice.cs` without functional impact.
2026-05-27 16:01:32 +02:00
OlgunR
87f27682ce Add support for generating result PDFs
Introduced the `ResultFilePath` property in the `ZugferdInvoice` model to store the path of generated result PDFs. Added a new service, `PdfResultPackageService`, to create result PDFs by converting the original PDF to PDF/A-3b format and attaching a report file. Updated `Upload.cshtml` and `Upload.cshtml.cs` to handle and display the `ResultFilePath`.

Created a migration to add the `ResultFilePath` column to the database. Updated `Program.cs` to register the new service and added configuration sections in `appsettings.json` for input and output directories. Enhanced error handling and logging for better traceability.
2026-05-27 13:43:14 +02:00
OlgunR
6a46bf4f4b Add ZUGFeRD Guideline-ID extraction and display
Enhanced `PdfExtractionResult` with a new `ZugferdGuidelineId` property to store the ZUGFeRD Guideline-ID extracted from XMP metadata. Updated `Upload.cshtml` to display this information in the UI if available.

Implemented ZUGFeRD Guideline-ID extraction in `PdfAttachmentExtractorService` using a new helper method `ExtractGuidelineId`, which parses XMP metadata for known prefixes. Added logging for extracted Guideline-IDs and improved error handling with a `try-catch` block for metadata processing.

Fixed `FileAttachments` handling in `PdfAttachmentExtractorService` by converting to `List<T>` for proper `Count` property usage.
2026-05-26 17:05:52 +02:00
OlgunR
42d4222fb3 Handle UTF-8 BOM in string conversion
Previously, the method directly converted a byte array to a string
without accounting for a potential UTF-8 Byte Order Mark (BOM).
This commit introduces logic to remove the BOM (if present)
using `TrimStart('\uFEFF')` after converting the byte array
to a string.

Additionally, a comment was added to clarify the purpose of
this change.
2026-05-26 11:24:54 +02:00
OlgunR
4c90d2e5f1 Add PDF/A compliance checks and warnings
Added `PdfALevel` and `PdfAWarning` properties to the `PdfExtractionResult` class to store the PDF/A compliance level and indicate if a warning should be displayed for non-compliance.

Updated `Upload.cshtml` to display the PDF/A compliance level and conditionally show a warning message if the document is not PDF/A compliant.

Enhanced `PdfAttachmentExtractorService` to determine the PDF/A compliance level using `PdfDocumentProcessor`, map it to a string representation, and log the compliance level. Added logic to set `PdfAWarning` for non-compliant documents.
2026-05-26 11:16:28 +02:00
OlgunR
5221ee3594 Add invoices page and navigation menu items
Added new navigation menu items in `_Layout.cshtml` for "Rechnungen" (Invoices) and "PDF hochladen" (Upload PDF) with icons, paths, and selection logic.

Created a new Razor Page `Index.cshtml` to display imported invoices using a `DataGrid` with features like filtering, paging, and column formatting. Added a conditional message for when no invoices are available.

Implemented the `IndexModel` class in `Index.cshtml.cs` to handle backend logic, including fetching and sorting invoices from the database using `AppDbContext`.
2026-05-22 14:30:11 +02:00
OlgunR
c45e837c2b Add ZUGFeRD parsing and invoice storage support
Enhanced `ZugferdInvoice` model with default string values to prevent nulls. Updated `Upload.cshtml` to display parsed invoice data.

Refactored `Upload.cshtml.cs` to handle ZUGFeRD XML parsing and database storage. Introduced `ImportedInvoice` property and buffered file processing with `MemoryStream`.

Extended `ZugferdParserService` to support ZUGFeRD v1, v1.0 FeRD, and v2/Factur-X. Added version-specific parsing methods and namespaces. Improved date and decimal parsing for robustness.

Added database migration (`20260522084606_InitialCreate`) to define `ZugferdInvoices` table. Updated migration snapshot to reflect schema changes.

Fixed localization issue in `Upload.cshtml.cs` error message.
2026-05-22 14:01:07 +02:00
OlgunR
d351a3d577 Update EcmContext connection string in appsettings.json
The `ConnectionStrings` section in the `appsettings.json` file was updated. The `EcmContext` connection string, previously an empty string, was replaced with a connection string pointing to a SQL Server instance.

The new connection string includes the server name, database name, user ID, password, and a flag to trust the server certificate. This change enables the application to connect to the specified SQL Server database.
2026-05-21 16:49:49 +02:00
OlgunR
dc551c2313 Add project files. 2026-05-21 14:35:02 +02:00
OlgunR
b315aead20 Add .gitattributes and .gitignore. 2026-05-21 14:34:58 +02:00