mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-10 16:07:58 -06:00
Added new query options for tags, added pdf preview on documents scanner page
This commit is contained in:
@@ -420,7 +420,9 @@ class _DocumentDetailsPageState extends State<DocumentDetailsPage> {
|
||||
Future<void> _onOpen(DocumentModel document) async {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => DocumentView(document: document),
|
||||
builder: (context) => DocumentView(
|
||||
documentBytes: getIt<DocumentRepository>().getPreview(document.id),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -53,9 +53,8 @@ class _DocumentEditPageState extends State<DocumentEditPage> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
documentBytes = getIt<DocumentRepository>().getPreview(widget.document.id);
|
||||
|
||||
super.initState();
|
||||
documentBytes = getIt<DocumentRepository>().getPreview(widget.document.id);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -69,10 +68,14 @@ class _DocumentEditPageState extends State<DocumentEditPage> {
|
||||
final updatedDocument = widget.document.copyWith(
|
||||
title: values[fkTitle],
|
||||
created: values[fkCreatedDate],
|
||||
documentType: values[fkDocumentType] as IdQueryParameter,
|
||||
correspondent: values[fkCorrespondent] as IdQueryParameter,
|
||||
storagePath: values[fkStoragePath] as IdQueryParameter,
|
||||
tags: values[fkTags] as TagsQuery,
|
||||
overwriteDocumentType: true,
|
||||
documentType: (values[fkDocumentType] as IdQueryParameter).id,
|
||||
overwriteCorrespondent: true,
|
||||
correspondent: (values[fkCorrespondent] as IdQueryParameter).id,
|
||||
overwriteStoragePath: true,
|
||||
storagePath: (values[fkStoragePath] as IdQueryParameter).id,
|
||||
overwriteTags: true,
|
||||
tags: (values[fkTags] as IdsTagsQuery).includedIds,
|
||||
);
|
||||
setState(() {
|
||||
_isSubmitLoading = true;
|
||||
@@ -181,7 +184,10 @@ class _DocumentEditPageState extends State<DocumentEditPage> {
|
||||
},
|
||||
).padded(),
|
||||
TagFormField(
|
||||
initialValue: TagsQuery.fromIds(widget.document.tags),
|
||||
initialValue: IdsTagsQuery.included(widget.document.tags),
|
||||
notAssignedSelectable: false,
|
||||
anyAssignedSelectable: false,
|
||||
excludeAllowed: false,
|
||||
name: fkTags,
|
||||
).padded(),
|
||||
]),
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:paperless_mobile/di_initializer.dart';
|
||||
import 'package:paperless_mobile/features/documents/model/document.model.dart';
|
||||
@@ -6,11 +7,11 @@ import 'package:paperless_mobile/generated/l10n.dart';
|
||||
import 'package:pdfx/pdfx.dart';
|
||||
|
||||
class DocumentView extends StatefulWidget {
|
||||
final DocumentModel document;
|
||||
final Future<Uint8List> documentBytes;
|
||||
|
||||
const DocumentView({
|
||||
Key? key,
|
||||
required this.document,
|
||||
required this.documentBytes,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
@@ -25,7 +26,7 @@ class _DocumentViewState extends State<DocumentView> {
|
||||
super.initState();
|
||||
_pdfController = PdfController(
|
||||
document: PdfDocument.openData(
|
||||
getIt<DocumentRepository>().getPreview(widget.document.id),
|
||||
widget.documentBytes,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user