fix attachments
All checks were successful
Build and Release FLUX (Multi-Platform) / build-android (push) Successful in 1m44s
Build and Release FLUX (Multi-Platform) / build-web (push) Successful in 1m5s
Build and Release FLUX (Multi-Platform) / build-windows (push) Successful in 8m7s

This commit is contained in:
2026-06-08 14:36:31 +02:00
parent 22bb86f052
commit f8504d466a
3 changed files with 28 additions and 13 deletions

View File

@@ -34,14 +34,14 @@ class SharedAttachmentsSection extends StatefulWidget {
final String? parentId;
final String titleForUpload;
final AttachmentParentType parentType;
final Future<String?> Function()? onGenerateIdForQr;
final Future<String?> Function()? onEnsureEntitySaved;
const SharedAttachmentsSection({
super.key,
this.parentId,
this.titleForUpload = 'Cliente_sconosciuto',
required this.parentType,
this.onGenerateIdForQr,
this.onEnsureEntitySaved,
});
@override
@@ -95,7 +95,7 @@ class _SharedAttachmentsSectionState extends State<SharedAttachmentsSection> {
// 🥷 SE L'ID NON C'È (Nuova Operazione), FORZIAMO IL SALVATAGGIO PREVENTIVO!
if (targetId == null || targetId.isEmpty) {
if (widget.onGenerateIdForQr != null) {
if (widget.onEnsureEntitySaved != null) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Salvataggio rapido scheda per allegati... ⏳'),
@@ -104,7 +104,7 @@ class _SharedAttachmentsSectionState extends State<SharedAttachmentsSection> {
);
// Chiamiamo la funzione passata dal TicketForm/OperationForm
targetId = await widget.onGenerateIdForQr!();
targetId = await widget.onEnsureEntitySaved!();
}
// Se il salvataggio fallisce (es. form non valido), ci fermiamo per evitare file orfani
@@ -507,7 +507,7 @@ class _SharedAttachmentsSectionState extends State<SharedAttachmentsSection> {
// SE L'ID NON C'È, CHIAMIAMO IL SALVATAGGIO IN BACKGROUND!
if (targetId == null) {
if (widget.onGenerateIdForQr != null) {
if (widget.onEnsureEntitySaved != null) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text(
@@ -518,7 +518,7 @@ class _SharedAttachmentsSectionState extends State<SharedAttachmentsSection> {
);
// Aspettiamo che il TicketFormCubit faccia il suo lavoro
targetId = await widget.onGenerateIdForQr!();
targetId = await widget.onEnsureEntitySaved!();
}
// Se fallisce (es. validazione form non passata), ci fermiamo