refactor: Refines reception validation and quick actions
Allows reception validation regardless of its synchronization status, enabling more flexible use cases. Simplifies the quick actions available on the reception list page by removing the 'Add' and 'Scan' buttons, retaining only the 'Search' option. Adds vertical spacing before the search button within the QuickActionComponent for improved visual layout.
This commit is contained in:
parent
a9d0e4485d
commit
ba1d7a6264
@ -114,7 +114,8 @@ class QuickActionComponent extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
],
|
],
|
||||||
if (onTapSearch != null)
|
if (onTapSearch != null) ...[
|
||||||
|
const SizedBox(height: 12),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: double.maxFinite,
|
width: double.maxFinite,
|
||||||
child: OutlineButtonComponent(
|
child: OutlineButtonComponent(
|
||||||
@ -124,6 +125,7 @@ class QuickActionComponent extends StatelessWidget {
|
|||||||
onPressed: onTapSearch,
|
onPressed: onTapSearch,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -55,28 +55,23 @@ class _ReceptionDetailsPageState extends ConsumerState<ReceptionDetailsPage> {
|
|||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
if (reception?.isDone == false) ...[
|
if (reception?.isDone == false) ...[
|
||||||
QuickActionComponent(
|
QuickActionComponent(
|
||||||
onTapValidateReception: reception?.synchronized == false
|
onTapValidateReception: () {
|
||||||
? () {
|
ref
|
||||||
ref
|
.read(receptionDetailsPageModelProvider.notifier)
|
||||||
.read(
|
.validate(
|
||||||
receptionDetailsPageModelProvider
|
receptionId: widget.receptionId,
|
||||||
.notifier,
|
onSuccess: () {
|
||||||
)
|
Toast.showSuccess(
|
||||||
.validate(
|
'Réception validée avec succès.',
|
||||||
receptionId: widget.receptionId,
|
);
|
||||||
onSuccess: () {
|
},
|
||||||
Toast.showSuccess(
|
onError: () {
|
||||||
'Réception validée avec succès.',
|
Toast.showError(
|
||||||
);
|
'Connexion impossible. Les données seront synchronisées plus tard.',
|
||||||
},
|
);
|
||||||
onError: () {
|
},
|
||||||
Toast.showError(
|
);
|
||||||
'Connexion impossible. Les données seront synchronisées plus tard.',
|
},
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
: null,
|
|
||||||
validateReceptionLoading: state.validateLoading,
|
validateReceptionLoading: state.validateLoading,
|
||||||
syncReceptionLoading: state.saveLoading,
|
syncReceptionLoading: state.saveLoading,
|
||||||
onTapSyncReception: reception?.synchronized == false
|
onTapSyncReception: reception?.synchronized == false
|
||||||
|
@ -48,11 +48,7 @@ class _ReceptionPageState extends ConsumerState<ReceptionPage> {
|
|||||||
child: ListView(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
QuickActionComponent(
|
QuickActionComponent(onTapSearch: () {}),
|
||||||
onTapAdd: () {},
|
|
||||||
onTapScan: () {},
|
|
||||||
onTapSearch: () {},
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
Consumer(
|
Consumer(
|
||||||
builder: (_, WidgetRef ref, _) {
|
builder: (_, WidgetRef ref, _) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user