feat: New Open Tab dialog with search and optional customer email. Drinks are now grouped per order. Payments trigger cha-ching and money rain.

This commit is contained in:
2026-10-28 02:11:32 +01:00
parent 1aee0541c4
commit 29ceb51177
41 changed files with 2771 additions and 812 deletions
+17
View File
@@ -1,3 +1,6 @@
import 'dart:math';
import 'package:audioplayers/audioplayers.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:provider/provider.dart';
@@ -6,6 +9,7 @@ import '../../l10n/app_localizations.dart';
import '../../models/payment_method.dart';
import '../../utils/money.dart';
import '../../viewmodels/bar_screen_view_model.dart';
import '../widgets/money_rain.dart';
import '../widgets/slide_confirm.dart';
Future<void> confirmCloseTab(BuildContext context) async {
@@ -73,6 +77,9 @@ Future<void> confirmCloseTab(BuildContext context) async {
try {
await viewModel.closeSelectedTab(paymentMethod: paymentMethod);
_playChaChing();
// Make it rain, but only once in a hundred tabs.
if (context.mounted && Random().nextInt(25) == 0) showMoneyRain(context);
} catch (_) {
if (!context.mounted) return;
ScaffoldMessenger.of(
@@ -81,6 +88,16 @@ Future<void> confirmCloseTab(BuildContext context) async {
}
}
final _chaChingPlayer = AudioPlayer();
/// Plays the till sound once a tab is paid; a sound that fails to play never
/// gets in the way of closing the tab.
void _playChaChing() {
_chaChingPlayer
.play(AssetSource('Cha-Ching.mp3'))
.catchError((Object e) => debugPrint('Could not play cha-ching: $e'));
}
const _payconiqQrAsset = 'assets/payconiq/qr.png';
/// Shows the Payconiq QR code for the customer to scan. Resolves to true