progress in cheques

This commit is contained in:
Hesabix 2025-10-11 02:32:13 +03:30
parent ff968aed7a
commit 76ab27aa24
5 changed files with 131 additions and 0 deletions

View file

@ -36,6 +36,8 @@ import 'pages/business/price_lists_page.dart';
import 'pages/business/price_list_items_page.dart'; import 'pages/business/price_list_items_page.dart';
import 'pages/business/cash_registers_page.dart'; import 'pages/business/cash_registers_page.dart';
import 'pages/business/petty_cash_page.dart'; import 'pages/business/petty_cash_page.dart';
import 'pages/business/checks_page.dart';
import 'pages/business/check_form_page.dart';
import 'pages/error_404_page.dart'; import 'pages/error_404_page.dart';
import 'core/locale_controller.dart'; import 'core/locale_controller.dart';
import 'core/calendar_controller.dart'; import 'core/calendar_controller.dart';
@ -792,6 +794,63 @@ class _MyAppState extends State<MyApp> {
); );
}, },
), ),
// Checks: list, new, edit
GoRoute(
path: 'checks',
name: 'business_checks',
builder: (context, state) {
final businessId = int.parse(state.pathParameters['business_id']!);
return BusinessShell(
businessId: businessId,
authStore: _authStore!,
localeController: controller,
calendarController: _calendarController!,
themeController: themeController,
child: ChecksPage(
businessId: businessId,
authStore: _authStore!,
),
);
},
),
GoRoute(
path: 'checks/new',
name: 'business_new_check',
builder: (context, state) {
final businessId = int.parse(state.pathParameters['business_id']!);
return BusinessShell(
businessId: businessId,
authStore: _authStore!,
localeController: controller,
calendarController: _calendarController!,
themeController: themeController,
child: CheckFormPage(
businessId: businessId,
authStore: _authStore!,
),
);
},
),
GoRoute(
path: 'checks/:check_id/edit',
name: 'business_edit_check',
builder: (context, state) {
final businessId = int.parse(state.pathParameters['business_id']!);
final checkId = int.tryParse(state.pathParameters['check_id'] ?? '0');
return BusinessShell(
businessId: businessId,
authStore: _authStore!,
localeController: controller,
calendarController: _calendarController!,
themeController: themeController,
child: CheckFormPage(
businessId: businessId,
authStore: _authStore!,
checkId: checkId,
),
);
},
),
// TODO: Add other business routes (sales, accounting, etc.) // TODO: Add other business routes (sales, accounting, etc.)
], ],
), ),

View file

@ -951,6 +951,9 @@ class _BusinessShellState extends State<BusinessShell> {
} else if (item.label == t.invoice) { } else if (item.label == t.invoice) {
// Navigate to add invoice // Navigate to add invoice
context.go('/business/${widget.businessId}/invoice/new'); context.go('/business/${widget.businessId}/invoice/new');
} else if (item.label == t.checks) {
// Navigate to add check
context.go('/business/${widget.businessId}/checks/new');
} }
// سایر مسیرهای افزودن در آینده متصل میشوند // سایر مسیرهای افزودن در آینده متصل میشوند
}, },
@ -1050,6 +1053,9 @@ class _BusinessShellState extends State<BusinessShell> {
} else if (item.label == t.invoice) { } else if (item.label == t.invoice) {
// Navigate to add invoice // Navigate to add invoice
context.go('/business/${widget.businessId}/invoice/new'); context.go('/business/${widget.businessId}/invoice/new');
} else if (item.label == t.checks) {
// Navigate to add check
context.go('/business/${widget.businessId}/checks/new');
} }
}, },
child: Container( child: Container(

View file

@ -0,0 +1,22 @@
import 'package:flutter/material.dart';
import '../../core/auth_store.dart';
class CheckFormPage extends StatelessWidget {
final int businessId;
final AuthStore authStore;
final int? checkId; // null => new, not null => edit
const CheckFormPage({
super.key,
required this.businessId,
required this.authStore,
this.checkId,
});
@override
Widget build(BuildContext context) {
return const SizedBox.expand();
}
}

View file

@ -0,0 +1,20 @@
import 'package:flutter/material.dart';
import '../../core/auth_store.dart';
class ChecksPage extends StatelessWidget {
final int businessId;
final AuthStore authStore;
const ChecksPage({
super.key,
required this.businessId,
required this.authStore,
});
@override
Widget build(BuildContext context) {
return const SizedBox.expand();
}
}

View file

@ -0,0 +1,24 @@
import 'package:flutter/material.dart';
import '../../core/auth_store.dart';
class CheckFormPage extends StatelessWidget {
final int businessId;
final AuthStore authStore;
final int? checkId; // null => new, not null => edit
const CheckFormPage({
super.key,
required this.businessId,
required this.authStore,
this.checkId,
});
@override
Widget build(BuildContext context) {
return const Scaffold(
body: SizedBox.expand(),
);
}
}