Added new query options for tags, added pdf preview on documents scanner page

This commit is contained in:
Anton Stubenbord
2022-11-18 00:59:14 +01:00
parent e9019bca9c
commit 070a57aafd
32 changed files with 454 additions and 205 deletions

View File

@@ -172,6 +172,9 @@ class _DocumentUploadPageState extends State<DocumentUploadPage> {
),
const TagFormField(
name: DocumentModel.tagsKey,
notAssignedSelectable: false,
anyAssignedSelectable: false,
excludeAllowed: false,
//Label: "Tags" + " *",
),
Text(
@@ -194,10 +197,9 @@ class _DocumentUploadPageState extends State<DocumentUploadPage> {
final createdAt = fv[DocumentModel.createdKey] as DateTime?;
final title = fv[DocumentModel.titleKey] as String;
final docType = fv[DocumentModel.documentTypeKey] as IdQueryParameter;
final tags = fv[DocumentModel.tagsKey] as TagsQuery;
final tags = fv[DocumentModel.tagsKey] as IdsTagsQuery;
final correspondent =
fv[DocumentModel.correspondentKey] as IdQueryParameter;
await BlocProvider.of<DocumentsCubit>(context).addDocument(
widget.fileBytes,
_formKey.currentState?.value[fkFileName],

View File

@@ -14,6 +14,8 @@ import 'package:paperless_mobile/core/model/error_message.dart';
import 'package:paperless_mobile/core/service/file_service.dart';
import 'package:paperless_mobile/di_initializer.dart';
import 'package:paperless_mobile/features/documents/bloc/documents_cubit.dart';
import 'package:paperless_mobile/features/documents/repository/document_repository.dart';
import 'package:paperless_mobile/features/documents/view/pages/document_view.dart';
import 'package:paperless_mobile/features/home/view/widget/info_drawer.dart';
import 'package:paperless_mobile/features/scan/bloc/document_scanner_cubit.dart';
import 'package:paperless_mobile/features/scan/view/document_upload_page.dart';
@@ -53,6 +55,24 @@ class _ScannerPageState extends State<ScannerPage>
return AppBar(
title: Text(S.of(context).documentScannerPageTitle),
actions: [
BlocBuilder<DocumentScannerCubit, List<File>>(
builder: (context, state) {
return IconButton(
onPressed: state.isNotEmpty
? () => Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => DocumentView(
documentBytes:
_buildDocumentFromImageFiles(state).save(),
),
),
)
: null,
icon: const Icon(Icons.preview),
tooltip: S.of(context).documentScannerPageResetButtonTooltipText,
);
},
),
BlocBuilder<DocumentScannerCubit, List<File>>(
builder: (context, state) {
return IconButton(