feat: start working on sell
This commit is contained in:
parent
f378c8c0be
commit
1803a2b119
8 changed files with 94 additions and 31 deletions
|
|
@ -45,6 +45,9 @@ class AddViewModel extends ChangeNotifier {
|
|||
notifyListeners();
|
||||
}
|
||||
|
||||
Owner? _sectionOwner;
|
||||
Owner? get sectionOwner => _sectionOwner;
|
||||
|
||||
List<Owner> _owners = [];
|
||||
List<Owner>? get owners => _owners;
|
||||
Future<Result<Owner>> addOwner(
|
||||
|
|
@ -176,9 +179,17 @@ class AddViewModel extends ChangeNotifier {
|
|||
),
|
||||
);
|
||||
case Error():
|
||||
break;
|
||||
return result;
|
||||
}
|
||||
|
||||
return result;
|
||||
final result2 = await _ownerRepository.sectionOwner;
|
||||
switch (result2) {
|
||||
case Ok():
|
||||
_sectionOwner = result2.value;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
return result2;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,32 +129,37 @@ class _ConfirmationPopupState extends State<ConfirmationPopup> {
|
|||
case Ok():
|
||||
if (context.mounted) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text(
|
||||
"ID : ${widget.viewModel.currentOwner!.firstName[0]}${widget.viewModel.currentOwner!.lastName[0]}${(price == 0) ? "PL" : price.toString()}",
|
||||
),
|
||||
content: Text(
|
||||
"Identifiant propriétaire de ce livre. Pensez à l'écrire pour retrouver lae propriétaire du livre lors de la vente ou du retour !",
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
widget.exitPopup(context);
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text("Enregistré: ${widget.book.title}"),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Text("Ok"),
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text(
|
||||
"ID : ${widget.viewModel.currentOwner!.firstName[0].toUpperCase()}${widget.viewModel.currentOwner!.lastName[0].toUpperCase()}${(price == 0) ? "PL" : price.toString()}",
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
content: Text(
|
||||
(widget.viewModel.currentOwner!.id ==
|
||||
widget.viewModel.sectionOwner!.id)
|
||||
? "Ce livre appartient à la section. Vous pouvez mettre le code, ou poser une gomette, ..."
|
||||
: "Identifiant propriétaire de ce livre. Pensez à l'écrire pour retrouver lae propriétaire du livre lors de la vente ou du retour !",
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
widget.exitPopup(context);
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
"Enregistré: ${widget.book.title}",
|
||||
),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Text("Ok"),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
break;
|
||||
case Error():
|
||||
if (context.mounted) {
|
||||
|
|
|
|||
Reference in a new issue