feat: update dashboard

This commit is contained in:
efrilm
2025-08-07 15:47:38 +07:00
parent 5a260ca3a1
commit fbd59964c3
5 changed files with 146 additions and 151 deletions
+4
View File
@@ -101,6 +101,9 @@ class $AssetsIconsGen {
/// File path: assets/icons/payments.svg
SvgGenImage get payments => const SvgGenImage('assets/icons/payments.svg');
/// File path: assets/icons/people.svg
SvgGenImage get people => const SvgGenImage('assets/icons/people.svg');
/// File path: assets/icons/print.svg
SvgGenImage get print => const SvgGenImage('assets/icons/print.svg');
@@ -152,6 +155,7 @@ class $AssetsIconsGen {
orders,
pajak,
payments,
people,
print,
qrCode,
report,
@@ -3,6 +3,7 @@ import 'dart:async';
import 'dart:developer';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:enaklo_pos/presentation/customer/pages/customer_page.dart';
import 'package:enaklo_pos/presentation/setting/pages/setting_page.dart';
import 'package:enaklo_pos/presentation/table/pages/table_page.dart';
import 'package:flutter/material.dart';
@@ -15,7 +16,6 @@ import 'package:enaklo_pos/data/datasources/auth_local_datasource.dart';
import 'package:enaklo_pos/presentation/auth/login_page.dart';
import 'package:enaklo_pos/presentation/report/pages/report_page.dart';
import 'package:enaklo_pos/presentation/setting/bloc/sync_order/sync_order_bloc.dart';
import 'package:enaklo_pos/presentation/setting/pages/printer_configuration_page.dart';
import '../../../core/assets/assets.gen.dart';
import '../../auth/bloc/logout/logout_bloc.dart';
@@ -59,8 +59,7 @@ class _DashboardPageState extends State<DashboardPage> {
),
const TablePage(),
const ReportPage(),
const PrinterConfigurationPage(),
// SalesPage(),
const CustomerPage(),
const SettingPage(),
];
// ignore: unused_local_variable
@@ -121,7 +120,7 @@ class _DashboardPageState extends State<DashboardPage> {
onTap: () => _onItemTapped(2),
),
NavItem(
iconPath: Assets.icons.print.path,
iconPath: Assets.icons.people.path,
isActive: _selectedIndex == 3,
onTap: () => _onItemTapped(3),
),
@@ -3,7 +3,6 @@ import 'package:enaklo_pos/core/constants/colors.dart';
import 'package:enaklo_pos/core/extensions/build_context_ext.dart';
import 'package:enaklo_pos/core/extensions/string_ext.dart';
import 'package:enaklo_pos/data/models/response/table_model.dart';
import 'package:enaklo_pos/presentation/customer/pages/customer_page.dart';
import 'package:enaklo_pos/presentation/home/bloc/checkout/checkout_bloc.dart';
import 'package:enaklo_pos/presentation/home/dialog/delivery_dialog.dart';
import 'package:enaklo_pos/presentation/home/dialog/type_dialog.dart';
@@ -20,7 +19,7 @@ class HomeRightTitle extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
height: context.deviceHeight * 0.15,
height: context.deviceHeight * 0.12,
decoration: BoxDecoration(
color: AppColors.primary,
border: Border(
@@ -33,52 +32,77 @@ class HomeRightTitle extends StatelessWidget {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
children: [
Expanded(
child: Button.filled(
width: 180.0,
height: 40,
elevation: 0,
onPressed: () => context.push(SalesPage(
status: 'pending',
)),
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
icon: Icon(
Icons.list,
color: Colors.white,
size: 24,
Expanded(
child: Row(
children: [
Expanded(
child: Button.filled(
width: 180.0,
height: 40,
elevation: 0,
onPressed: () => context.push(SalesPage(
status: 'pending',
)),
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
icon: Icon(
Icons.list,
color: Colors.white,
size: 24,
),
label: 'Daftar Pesanan',
),
label: 'Daftar Pesanan',
),
),
Expanded(
child: Button.filled(
width: 180.0,
height: 40,
elevation: 0,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
icon: Icon(
Icons.person_outline,
color: Colors.white,
size: 24,
),
onPressed: () {
if (table == null) {
context.push(CustomerPage());
}
},
label: 'Pelanggan',
),
),
],
],
),
),
Row(
children: [
Expanded(
child: BlocBuilder<CheckoutBloc, CheckoutState>(
Expanded(
child: Row(
children: [
Expanded(
child: BlocBuilder<CheckoutBloc, CheckoutState>(
builder: (context, state) {
return state.maybeWhen(
orElse: () => const SizedBox.shrink(),
loaded: (
items,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) {
return Button.filled(
width: 180.0,
height: 40,
elevation: 0,
onPressed: () {
showDialog(
context: context,
builder: (context) {
return TypeDialog();
});
},
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
icon: Icon(
Icons.dinner_dining_outlined,
color: Colors.white,
size: 24,
),
label: orderType.value.toTitleCase(),
);
},
);
},
),
),
BlocBuilder<CheckoutBloc, CheckoutState>(
builder: (context, state) {
return state.maybeWhen(
orElse: () => const SizedBox.shrink(),
@@ -95,109 +119,68 @@ class HomeRightTitle extends StatelessWidget {
orderType,
deliveryType,
) {
return Button.filled(
width: 180.0,
height: 40,
elevation: 0,
onPressed: () {
showDialog(
context: context,
builder: (context) {
return TypeDialog();
});
},
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
icon: Icon(
Icons.dinner_dining_outlined,
color: Colors.white,
size: 24,
),
label: orderType.value.toTitleCase(),
);
switch (orderType) {
case OrderType.dineIn:
return Expanded(
child: Button.filled(
width: 180.0,
height: 40,
elevation: 0,
icon: Icon(
Icons.table_restaurant_outlined,
color: Colors.white,
size: 24,
),
onPressed: () {
if (table == null) {
context.push(DashboardPage(
index: 1,
));
}
},
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
label: table == null
? 'Pilih Meja'
: '${table!.tableName}',
),
);
case OrderType.takeAway:
return const SizedBox.shrink();
case OrderType.delivery:
return Expanded(
child: Button.filled(
width: 180.0,
height: 40,
elevation: 0,
icon: Icon(
Icons.motorcycle_outlined,
color: Colors.white,
size: 24,
),
onPressed: () {
showDialog(
context: context,
builder: (context) {
return DeliveryDialog();
});
},
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
label: deliveryType == null
? 'Pilih Pengiriman'
: deliveryType.name,
),
);
default:
return const SizedBox.shrink();
}
},
);
},
),
),
BlocBuilder<CheckoutBloc, CheckoutState>(
builder: (context, state) {
return state.maybeWhen(
orElse: () => const SizedBox.shrink(),
loaded: (
items,
discountModel,
discount,
discountAmount,
tax,
serviceCharge,
totalQuantity,
totalPrice,
draftName,
orderType,
deliveryType,
) {
switch (orderType) {
case OrderType.dineIn:
return Expanded(
child: Button.filled(
width: 180.0,
height: 40,
elevation: 0,
icon: Icon(
Icons.table_restaurant_outlined,
color: Colors.white,
size: 24,
),
onPressed: () {
if (table == null) {
context.push(DashboardPage(
index: 1,
));
}
},
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
label: table == null
? 'Pilih Meja'
: '${table!.tableName}',
),
);
case OrderType.takeAway:
return const SizedBox.shrink();
case OrderType.delivery:
return Expanded(
child: Button.filled(
width: 180.0,
height: 40,
elevation: 0,
icon: Icon(
Icons.motorcycle_outlined,
color: Colors.white,
size: 24,
),
onPressed: () {
showDialog(
context: context,
builder: (context) {
return DeliveryDialog();
});
},
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
label: deliveryType == null
? 'Pilih Pengiriman'
: deliveryType.name,
),
);
default:
return const SizedBox.shrink();
}
},
);
},
),
],
],
),
),
],
),
@@ -512,12 +512,11 @@ class _$SuccessImpl implements _Success {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$SuccessImpl &&
const DeepCollectionEquality().equals(other.printer, printer));
(identical(other.printer, printer) || other.printer == printer));
}
@override
int get hashCode =>
Object.hash(runtimeType, const DeepCollectionEquality().hash(printer));
int get hashCode => Object.hash(runtimeType, printer);
/// Create a copy of GetPrinterTicketState
/// with the given fields replaced by the non-null parameter values.