QOL: Add confirmation dialogs and re-add total pay as a single final number at the end of work day
This commit is contained in:
parent
199a3585d7
commit
ac7a5c885d
6 changed files with 241 additions and 38 deletions
|
@ -96,10 +96,43 @@ class _WebMain extends State<WebMain> {
|
|||
),
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
SessionData.IsReadOnly = false;
|
||||
SessionData.Trips = [];
|
||||
SessionData.positions = [];
|
||||
SessionData.DisplayError = "";
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (builder) {
|
||||
return AlertDialog(
|
||||
icon: Icon(Icons.warning_amber),
|
||||
title: Text("Are you sure?"),
|
||||
content: Text(
|
||||
"If you close the session, you will need to re-enter the session code if you wish to load it again.",
|
||||
),
|
||||
actions: [
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
SessionData.IsReadOnly = false;
|
||||
SessionData.Trips = [];
|
||||
SessionData.positions = [];
|
||||
SessionData.DisplayError = "";
|
||||
SessionData.StartTime = DateTime(0);
|
||||
SessionData.EndTime = DateTime(0);
|
||||
SessionData.LastSessionID = "";
|
||||
sessionIDController.text = "";
|
||||
|
||||
setState(() {});
|
||||
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Text("Yes"),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Text("Cancel"),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Text("Close Session"),
|
||||
),
|
||||
|
@ -119,7 +152,22 @@ class _WebMain extends State<WebMain> {
|
|||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
SessionData.LastSessionID = sessionIDController.text;
|
||||
await SessionData.DownloadData();
|
||||
bool success = await SessionData.DownloadData();
|
||||
|
||||
if (!success) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
"ERROR: The provided session code was not found on the server",
|
||||
style: TextStyle(fontSize: 18, color: Colors.white),
|
||||
),
|
||||
backgroundColor: LibACFlutterConstants.TITLEBAR_COLOR,
|
||||
),
|
||||
snackBarAnimationStyle: AnimationStyle(
|
||||
duration: Duration(seconds: 5),
|
||||
),
|
||||
);
|
||||
}
|
||||
setState(() {});
|
||||
},
|
||||
child: Text("Load Session", style: TextStyle(fontSize: 18)),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue