dev #1

Merged
aefril merged 128 commits from dev into main 2025-08-13 17:19:48 +00:00
3 changed files with 75 additions and 66 deletions
Showing only changes of commit 49fef5afb2 - Show all commits

View File

@ -113,6 +113,7 @@ class Order {
final DateTime? createdAt; final DateTime? createdAt;
final DateTime? updatedAt; final DateTime? updatedAt;
final List<OrderItem>? orderItems; final List<OrderItem>? orderItems;
final bool? isRefund;
Order({ Order({
this.id, this.id,
@ -131,6 +132,7 @@ class Order {
this.createdAt, this.createdAt,
this.updatedAt, this.updatedAt,
this.orderItems, this.orderItems,
this.isRefund,
}); });
factory Order.fromMap(Map<String, dynamic> json) => Order( factory Order.fromMap(Map<String, dynamic> json) => Order(
@ -147,6 +149,7 @@ class Order {
totalAmount: json["total_amount"], totalAmount: json["total_amount"],
notes: json["notes"], notes: json["notes"],
metadata: json["metadata"] ?? {}, metadata: json["metadata"] ?? {},
isRefund: json["is_refund"],
createdAt: json["created_at"] == null createdAt: json["created_at"] == null
? null ? null
: DateTime.parse(json["created_at"]), : DateTime.parse(json["created_at"]),
@ -175,6 +178,7 @@ class Order {
"metadata": metadata, "metadata": metadata,
"created_at": createdAt?.toIso8601String(), "created_at": createdAt?.toIso8601String(),
"updated_at": updatedAt?.toIso8601String(), "updated_at": updatedAt?.toIso8601String(),
"is_refund": isRefund,
"order_items": orderItems == null "order_items": orderItems == null
? [] ? []
: List<dynamic>.from(orderItems!.map((x) => x.toMap())), : List<dynamic>.from(orderItems!.map((x) => x.toMap())),

View File

@ -39,7 +39,11 @@ class _RefundPageState extends State<RefundPage> with TickerProviderStateMixin {
late Animation<double> _scaleAnimation; late Animation<double> _scaleAnimation;
final List<Map<String, dynamic>> refundReasons = [ final List<Map<String, dynamic>> refundReasons = [
{'value': 'Barang Rusak', 'icon': Icons.broken_image, 'color': Colors.red}, {
'value': 'Barang Rusak',
'icon': Icons.broken_image,
'color': AppColors.primary
},
{'value': 'Salah Item', 'icon': Icons.swap_horiz, 'color': Colors.orange}, {'value': 'Salah Item', 'icon': Icons.swap_horiz, 'color': Colors.orange},
{ {
'value': 'Tidak Sesuai Pesanan', 'value': 'Tidak Sesuai Pesanan',
@ -56,7 +60,11 @@ class _RefundPageState extends State<RefundPage> with TickerProviderStateMixin {
'icon': Icons.thumb_down, 'icon': Icons.thumb_down,
'color': Colors.purple 'color': Colors.purple
}, },
{'value': 'Lainnya', 'icon': Icons.more_horiz, 'color': Colors.grey}, {
'value': 'Lainnya',
'icon': Icons.more_horiz,
'color': Colors.red,
},
]; ];
@override @override
@ -201,13 +209,6 @@ class _RefundPageState extends State<RefundPage> with TickerProviderStateMixin {
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(24), borderRadius: BorderRadius.circular(24),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.08),
blurRadius: 30,
offset: Offset(0, 15),
),
],
), ),
child: Padding( child: Padding(
padding: EdgeInsets.all(20), padding: EdgeInsets.all(20),
@ -220,16 +221,12 @@ class _RefundPageState extends State<RefundPage> with TickerProviderStateMixin {
padding: EdgeInsets.all(12), padding: EdgeInsets.all(12),
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: LinearGradient( gradient: LinearGradient(
colors: [Colors.green[400]!, Colors.green[600]!], colors: [
const Color.fromARGB(255, 96, 56, 148),
AppColors.primary
],
), ),
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.green.withOpacity(0.3),
blurRadius: 15,
offset: Offset(0, 8),
),
],
), ),
child: Icon( child: Icon(
Icons.receipt_long, Icons.receipt_long,
@ -327,13 +324,6 @@ class _RefundPageState extends State<RefundPage> with TickerProviderStateMixin {
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(24), borderRadius: BorderRadius.circular(24),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.08),
blurRadius: 30,
offset: Offset(0, 15),
),
],
), ),
child: Padding( child: Padding(
padding: EdgeInsets.all(20), padding: EdgeInsets.all(20),
@ -345,12 +335,17 @@ class _RefundPageState extends State<RefundPage> with TickerProviderStateMixin {
Container( Container(
padding: EdgeInsets.all(12), padding: EdgeInsets.all(12),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.amber.withOpacity(0.2), gradient: LinearGradient(
colors: [
const Color.fromARGB(255, 96, 56, 148),
AppColors.primary
],
),
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
), ),
child: Icon( child: Icon(
Icons.account_balance_wallet, Icons.account_balance_wallet_outlined,
color: Colors.amber[700], color: AppColors.white,
size: 24, size: 24,
), ),
), ),
@ -402,13 +397,6 @@ class _RefundPageState extends State<RefundPage> with TickerProviderStateMixin {
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(24), borderRadius: BorderRadius.circular(24),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.08),
blurRadius: 30,
offset: Offset(0, 15),
),
],
), ),
child: Padding( child: Padding(
padding: EdgeInsets.all(20), padding: EdgeInsets.all(20),
@ -421,19 +409,15 @@ class _RefundPageState extends State<RefundPage> with TickerProviderStateMixin {
padding: EdgeInsets.all(12), padding: EdgeInsets.all(12),
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: LinearGradient( gradient: LinearGradient(
colors: [Colors.red[400]!, Colors.red[600]!], colors: [
const Color.fromARGB(255, 96, 56, 148),
AppColors.primary
],
), ),
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.red.withOpacity(0.3),
blurRadius: 15,
offset: Offset(0, 8),
),
],
), ),
child: Icon( child: Icon(
Icons.assignment_return, Icons.assignment_return_outlined,
color: Colors.white, color: Colors.white,
size: 24, size: 24,
), ),
@ -655,14 +639,14 @@ class _RefundPageState extends State<RefundPage> with TickerProviderStateMixin {
orElse: () => false, orElse: () => false,
); );
return Container( return SizedBox(
width: double.infinity, width: double.infinity,
height: 64, height: 64,
child: ElevatedButton( child: ElevatedButton(
onPressed: onPressed:
isLoading ? null : () => _processRefund(context), isLoading ? null : () => _processRefund(context),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: Colors.red[600], backgroundColor: AppColors.primary,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(20),
), ),

View File

@ -29,20 +29,39 @@ class SalesCard extends StatelessWidget {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Align( Row(
alignment: Alignment.centerRight, children: [
child: Text( Expanded(
'${order.orderNumber}', child: Text(
style: const TextStyle( '${order.orderNumber}',
fontSize: 12, style: const TextStyle(
fontWeight: FontWeight.w600, fontSize: 12,
fontWeight: FontWeight.w600,
),
),
), ),
), if (order.isRefund == true)
Container(
padding:
const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(
color: Colors.red.withOpacity(0.15),
borderRadius: BorderRadius.circular(16),
),
child: Text(
'Refund',
style: TextStyle(
color: Colors.red,
fontWeight: FontWeight.w600,
fontSize: 10,
letterSpacing: 0.5,
),
),
),
],
), ),
const SizedBox(height: 12), const SizedBox(height: 12),
Row( Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
CircleAvatar( CircleAvatar(
radius: 22, radius: 22,
@ -63,17 +82,19 @@ class SalesCard extends StatelessWidget {
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),
const SizedBox(height: 4), if (order.orderType == "dineIn") ...[
Row( const SizedBox(height: 4),
children: [ Row(
Icon(Icons.table_bar, size: 16, color: Colors.grey), children: [
const SizedBox(width: 4), Icon(Icons.table_bar, size: 16, color: Colors.grey),
Text( const SizedBox(width: 4),
'Meja ${order.tableNumber}', Text(
style: TextStyle(color: Colors.grey[600]), 'Meja ${order.tableNumber}',
), style: TextStyle(color: Colors.grey[600]),
], ),
), ],
),
]
], ],
), ),
), ),