enhance: Enhances backorder confirmation API
Updates the `createBackorderConfirmation` API call to dynamically specify whether to create a backorder (reliquat) or not. Introduces a `toBackorder` parameter, enabling the API to handle both "with backorder" and "without backorder" scenarios based on user selection. This centralizes the backorder status setting within a single API call. Additionally, adds loading indicators to the backorder dialog buttons for improved user feedback during the confirmation process.
This commit is contained in:
parent
c231790f59
commit
bac7acc185
@ -413,6 +413,7 @@ class ApiCalls {
|
||||
/// either `withBackorder()` or `withoutBackorder()`.
|
||||
static Future<int?> 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
|
||||
},
|
||||
],
|
||||
],
|
||||
|
@ -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 {
|
||||
|
@ -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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user