2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-12 02:05:29 +00:00

Order picture action (#557)

* Add "take picture" to purchase order detail

* Rename uploaded images

* Provide prefix when uploading images

* Add similar functionality for "sales order" detail

* Add new settings screens

* Control camera shortcut

* Bump release notes
This commit is contained in:
Oliver
2024-12-05 14:38:53 +11:00
committed by GitHub
parent 4698e7e82c
commit 2e798b1bd1
14 changed files with 321 additions and 17 deletions

View File

@ -26,11 +26,12 @@ import "package:inventree/widget/refreshable_state.dart";
*/
class AttachmentWidget extends StatefulWidget {
const AttachmentWidget(this.attachmentClass, this.modelId, this.hasUploadPermission) : super();
const AttachmentWidget(this.attachmentClass, this.modelId, this.imagePrefix, this.hasUploadPermission) : super();
final InvenTreeAttachment attachmentClass;
final int modelId;
final bool hasUploadPermission;
final String imagePrefix;
@override
_AttachmentWidgetState createState() => _AttachmentWidgetState();
@ -54,6 +55,10 @@ class _AttachmentWidgetState extends RefreshableState<AttachmentWidget> {
IconButton(
icon: Icon(TablerIcons.camera),
onPressed: () async {
widget.attachmentClass.uploadImage(
widget.modelId,
prefix: widget.imagePrefix,
);
FilePickerDialog.pickImageFromCamera().then((File? file) {
upload(context, file);
});
@ -78,7 +83,6 @@ class _AttachmentWidgetState extends RefreshableState<AttachmentWidget> {
final bool result = await widget.attachmentClass.uploadAttachment(
file,
widget.attachmentClass.REF_MODEL_TYPE,
widget.modelId
);