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()`.
|
/// either `withBackorder()` or `withoutBackorder()`.
|
||||||
static Future<int?> createBackorderConfirmation({
|
static Future<int?> createBackorderConfirmation({
|
||||||
required int stockPickingId,
|
required int stockPickingId,
|
||||||
|
required bool toBackorder,
|
||||||
}) async {
|
}) async {
|
||||||
try {
|
try {
|
||||||
final response = await dioService.post(
|
final response = await dioService.post(
|
||||||
@ -440,7 +441,8 @@ class ApiCalls {
|
|||||||
0,
|
0,
|
||||||
{
|
{
|
||||||
"picking_id": stockPickingId, // stock picking id
|
"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
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
final state = ref.watch(receptionDetailsPageModelProvider);
|
||||||
return Container(
|
return Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -74,6 +75,7 @@ class DeleteCategorieDialogComponentWidget extends ConsumerWidget {
|
|||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: PrimaryButtonComponent(
|
child: PrimaryButtonComponent(
|
||||||
|
loading: state.withBackorderLoading,
|
||||||
text: 'Créer un reliquat',
|
text: 'Créer un reliquat',
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await ref
|
await ref
|
||||||
@ -89,6 +91,7 @@ class DeleteCategorieDialogComponentWidget extends ConsumerWidget {
|
|||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: PrimaryButtonComponent(
|
child: PrimaryButtonComponent(
|
||||||
|
loading: state.withoutBackorderLoading,
|
||||||
backgroundColor: Colors.red,
|
backgroundColor: Colors.red,
|
||||||
text: 'Aucun reliquat',
|
text: 'Aucun reliquat',
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
|
@ -113,6 +113,7 @@ class ReceptionDetailsPageModel
|
|||||||
final createBackorderConfirmationId =
|
final createBackorderConfirmationId =
|
||||||
await ApiCalls.createBackorderConfirmation(
|
await ApiCalls.createBackorderConfirmation(
|
||||||
stockPickingId: receptionId,
|
stockPickingId: receptionId,
|
||||||
|
toBackorder: true,
|
||||||
);
|
);
|
||||||
if (createBackorderConfirmationId != null) {
|
if (createBackorderConfirmationId != null) {
|
||||||
final res = await ApiCalls.withBackorder(
|
final res = await ApiCalls.withBackorder(
|
||||||
@ -146,6 +147,7 @@ class ReceptionDetailsPageModel
|
|||||||
final createBackorderConfirmationId =
|
final createBackorderConfirmationId =
|
||||||
await ApiCalls.createBackorderConfirmation(
|
await ApiCalls.createBackorderConfirmation(
|
||||||
stockPickingId: receptionId,
|
stockPickingId: receptionId,
|
||||||
|
toBackorder: false,
|
||||||
);
|
);
|
||||||
if (createBackorderConfirmationId != null) {
|
if (createBackorderConfirmationId != null) {
|
||||||
final res = await ApiCalls.withoutBackorder(
|
final res = await ApiCalls.withoutBackorder(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user