Compare commits
2 commits
e5a8745e0e
...
5923e8dcc5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5923e8dcc5 | ||
|
|
3d6dc742d4 |
3 changed files with 31 additions and 32 deletions
|
|
@ -113,45 +113,42 @@ class _ConfirmationPopupState extends State<ConfirmationPopup> {
|
|||
),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
if (widget.viewModel.askPrice &&
|
||||
_formKey.currentState!.validate()) {
|
||||
_formKey.currentState!.save();
|
||||
}
|
||||
|
||||
var result = await widget.viewModel.sendBook(
|
||||
widget.book,
|
||||
widget.viewModel.currentOwner!,
|
||||
widget.viewModel.currentBal!,
|
||||
price,
|
||||
);
|
||||
|
||||
switch (result) {
|
||||
case Ok():
|
||||
switch (widget.viewModel.askPrice) {
|
||||
case true:
|
||||
if (_formKey.currentState!.validate()) {
|
||||
_formKey.currentState!.save();
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
"\"${widget.book.title}\" ($price€) a bien été enregistré",
|
||||
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()}",
|
||||
),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
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);
|
||||
},
|
||||
child: Text("Ok"),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
widget.exitPopup(context);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case false:
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
"\"${widget.book.title}\" (PL) a bien été enregistré",
|
||||
),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
),
|
||||
);
|
||||
widget.exitPopup(context);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case Error():
|
||||
if (context.mounted) {
|
||||
|
|
|
|||
|
|
@ -139,13 +139,14 @@ class _EditPopup extends State<EditPopup> {
|
|||
),
|
||||
Row(
|
||||
children: [
|
||||
Text("Date de début : "),
|
||||
Text("Date : "),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
_selectRange();
|
||||
},
|
||||
child: Text(
|
||||
"Du ${format.format(start ?? DateTime.now())}\nau ${format.format(end ?? DateTime.now().add(Duration(days: 1)))}",
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -66,13 +66,14 @@ class _CreateConfirmationPopupState extends State<CreateConfirmationPopup> {
|
|||
),
|
||||
Row(
|
||||
children: [
|
||||
Text("Date de début : "),
|
||||
Text("Date : "),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
_selectRange();
|
||||
},
|
||||
child: Text(
|
||||
"Du ${format.format(start ?? DateTime.now())}\nau ${format.format(end ?? DateTime.now().add(Duration(days: 1)))}",
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
|||
Reference in a new issue