feat: sales page

This commit is contained in:
efrilm
2025-08-02 10:50:48 +07:00
parent e825e5daed
commit 45b348684e
17 changed files with 1371 additions and 138 deletions
@@ -32,10 +32,10 @@ class ConfirmPaymentPage extends StatefulWidget {
final TableModel? table;
const ConfirmPaymentPage({
Key? key,
super.key,
required this.isTable,
this.table,
}) : super(key: key);
});
@override
State<ConfirmPaymentPage> createState() => _ConfirmPaymentPageState();
@@ -110,6 +110,7 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
child: Hero(
tag: 'payment_confirmation_screen',
child: Scaffold(
backgroundColor: AppColors.white,
body: Row(
children: [
Expanded(
@@ -401,7 +402,7 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
final subTotal =
price - (discount / 100 * price);
final finalTax = subTotal * (tax / 100);
final finalDiscount = discount / 100 * subTotal;
// final finalDiscount = discount / 100 * subTotal;
// discountAmountValue = finalDiscount.toInt();
// taxFinal = finalTax.toInt();
return Text(
@@ -653,14 +654,19 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
"🔘 Fetching available tables for Bayar Nanti");
isPayNow = false;
isAddToOrder = false;
// Debug: Check all tables first
final allTables = await ProductLocalDatasource.instance.getAllTable();
print("🔘 All tables in database: ${allTables.length}");
final allTables =
await ProductLocalDatasource
.instance
.getAllTable();
print(
"🔘 All tables in database: ${allTables.length}");
allTables.forEach((table) {
print("🔘 Table: ${table.tableName} - Status: ${table.status} - ID: ${table.id}");
print(
"🔘 Table: ${table.tableName} - Status: ${table.status} - ID: ${table.id}");
});
// Fetch available tables for Bayar Nanti
context
.read<GetTableStatusBloc>()
@@ -683,14 +689,19 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
"🔘 Fetching available tables for Bayar Nanti");
isPayNow = false;
isAddToOrder = false;
// Debug: Check all tables first
final allTables = await ProductLocalDatasource.instance.getAllTable();
print("🔘 All tables in database: ${allTables.length}");
final allTables =
await ProductLocalDatasource
.instance
.getAllTable();
print(
"🔘 All tables in database: ${allTables.length}");
allTables.forEach((table) {
print("🔘 Table: ${table.tableName} - Status: ${table.status} - ID: ${table.id}");
print(
"🔘 Table: ${table.tableName} - Status: ${table.status} - ID: ${table.id}");
});
// Fetch available tables for Bayar Nanti
context
.read<GetTableStatusBloc>()
@@ -1516,8 +1527,8 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
await ProductLocalDatasource
.instance
.getDraftOrderById(
selectTable!
.orderId ??
selectTable
?.orderId ??
0);
if (existingDraftOrder !=
@@ -4,6 +4,7 @@ import 'package:enaklo_pos/core/extensions/build_context_ext.dart';
import 'package:enaklo_pos/data/models/response/table_model.dart';
import 'package:enaklo_pos/presentation/home/dialog/type_dialog.dart';
import 'package:enaklo_pos/presentation/home/pages/dashboard_page.dart';
import 'package:enaklo_pos/presentation/sales/pages/sales_page.dart';
import 'package:flutter/material.dart';
class HomeRightTitle extends StatelessWidget {
@@ -33,7 +34,7 @@ class HomeRightTitle extends StatelessWidget {
width: 180.0,
height: 40,
elevation: 0,
onPressed: () {},
onPressed: () => context.push(SalesPage()),
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
icon: Icon(