diff --git a/lib/backend/api/api_calls.dart b/lib/backend/api/api_calls.dart index a5de2de..6a04989 100644 --- a/lib/backend/api/api_calls.dart +++ b/lib/backend/api/api_calls.dart @@ -413,6 +413,7 @@ class ApiCalls { /// either `withBackorder()` or `withoutBackorder()`. static Future createBackorderConfirmation({ required int stockPickingId, + required bool toBackorder, }) async { try { final response = await dioService.post( @@ -440,7 +441,8 @@ class ApiCalls { 0, { "picking_id": stockPickingId, // stock picking id - //"to_backorder": false // true = avec reliquat / false = sans reliquat + "to_backorder": + toBackorder, // true = avec reliquat / false = sans reliquat }, ], ], diff --git a/lib/components/backorder_dialog_component.dart b/lib/components/backorder_dialog_component.dart index fa2349b..c996ea3 100644 --- a/lib/components/backorder_dialog_component.dart +++ b/lib/components/backorder_dialog_component.dart @@ -42,6 +42,7 @@ class DeleteCategorieDialogComponentWidget extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { + final state = ref.watch(receptionDetailsPageModelProvider); return Container( width: double.infinity, decoration: BoxDecoration( @@ -74,6 +75,7 @@ class DeleteCategorieDialogComponentWidget extends ConsumerWidget { children: [ Expanded( child: PrimaryButtonComponent( + loading: state.withBackorderLoading, text: 'Créer un reliquat', onPressed: () async { await ref @@ -89,6 +91,7 @@ class DeleteCategorieDialogComponentWidget extends ConsumerWidget { ), Expanded( child: PrimaryButtonComponent( + loading: state.withoutBackorderLoading, backgroundColor: Colors.red, text: 'Aucun reliquat', onPressed: () async { diff --git a/lib/pages/operation/reception/reception_details_page_model.dart b/lib/pages/operation/reception/reception_details_page_model.dart index e9d2356..e55bac1 100644 --- a/lib/pages/operation/reception/reception_details_page_model.dart +++ b/lib/pages/operation/reception/reception_details_page_model.dart @@ -113,6 +113,7 @@ class ReceptionDetailsPageModel final createBackorderConfirmationId = await ApiCalls.createBackorderConfirmation( stockPickingId: receptionId, + toBackorder: true, ); if (createBackorderConfirmationId != null) { final res = await ApiCalls.withBackorder( @@ -146,6 +147,7 @@ class ReceptionDetailsPageModel final createBackorderConfirmationId = await ApiCalls.createBackorderConfirmation( stockPickingId: receptionId, + toBackorder: false, ); if (createBackorderConfirmationId != null) { final res = await ApiCalls.withoutBackorder(