diff --git a/frontend/lib/routes/company/billing/BillingCard.dart b/frontend/lib/routes/company/billing/BillingCard.dart index 6afd84d2..de099aef 100644 --- a/frontend/lib/routes/company/billing/BillingCard.dart +++ b/frontend/lib/routes/company/billing/BillingCard.dart @@ -1,10 +1,13 @@ import 'package:flutter/material.dart'; import 'package:frontend/models/billing.dart'; +import 'package:intl/intl.dart'; class BillingCard extends StatefulWidget { Billing billing; final String id; - BillingCard({Key? key, required this.billing, required this.id}) + final bool small; + BillingCard( + {Key? key, required this.billing, required this.id, required this.small}) : super(key: key); @override @@ -23,17 +26,126 @@ class _BillingCardState extends State }); } + Widget getStatusRow(bool val, String description) { + return Row( + children: [ + val + ? Icon(Icons.check_circle, color: Colors.green) + : Icon(Icons.cancel, color: Colors.red), + Text(description, style: TextStyle(fontSize: 16)) + ], + ); + } + @override Widget build(BuildContext context) { super.build(context); - return Padding( - padding: const EdgeInsets.all(8), - child: Container( - padding: EdgeInsets.fromLTRB(17, 15, 17, 15), - decoration: BoxDecoration( - color: Theme.of(context).cardColor, - borderRadius: BorderRadius.circular(5)), - child: Text(widget.billing.toString())), + return Container( + padding: EdgeInsets.fromLTRB(17, 15, 17, 15), + margin: EdgeInsets.fromLTRB(0, 0, 0, 20), + decoration: BoxDecoration( + color: Theme.of(context).cardColor, + borderRadius: BorderRadius.circular(5)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text("SINFO " + widget.billing.event.toString() + " billing", + textAlign: TextAlign.left, + style: TextStyle( + fontSize: widget.small ? 16 : 22, + fontWeight: FontWeight.bold)), + Row( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: IconButton( + onPressed: () { + // _editFlightModal(context); + }, + color: const Color(0xff5c7ff2), + icon: Icon(Icons.edit)), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: IconButton( + onPressed: () { + // _deleteFlightDialog(context); + }, + color: Colors.red, + icon: Icon(Icons.delete)), + ), + ], + ) + ], + ), + Divider( + color: Colors.grey[600], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + getStatusRow(widget.billing.status.invoice, "Invoice"), + getStatusRow(widget.billing.status.proForma, "ProForma"), + getStatusRow(widget.billing.status.paid, "Paid"), + getStatusRow(widget.billing.status.receipt, "Receipt"), + ], + ), + Column( + children: [ + Icon(Icons.request_quote, color: Colors.black, size: 48), + Text( + widget.billing.invoiceNumber, + style: TextStyle(fontSize: 16), + ), + Text( + "Invoice Number", + style: TextStyle(fontSize: 16), + ), + ], + ), + Column( + children: [ + Icon(Icons.schedule, color: Colors.black, size: 48), + Text( + DateFormat('yyyy-MM-dd HH:mm') + .format(widget.billing.emission), + style: TextStyle(fontSize: 16), + ), + Text( + "Billing emission date", + style: TextStyle(fontSize: 16), + ), + ], + ), + Column( + children: [ + Icon(Icons.monetization_on, color: Colors.black, size: 48), + Text( + (widget.billing.value ~/ 100).toString() + + "," + + (widget.billing.value % 100).toString(), + style: TextStyle(fontSize: 16), + ), + Text( + "Cost", + style: TextStyle(fontSize: 16), + ), + ], + ), + ], + ), + widget.billing.notes != "" + ? Text("Billing notes: " + widget.billing.notes, + textAlign: TextAlign.left, style: TextStyle(fontSize: 18)) + : Container(), + ], + ), ); } } diff --git a/frontend/lib/routes/company/billing/BillingScreen.dart b/frontend/lib/routes/company/billing/BillingScreen.dart index 59c6379f..11695084 100644 --- a/frontend/lib/routes/company/billing/BillingScreen.dart +++ b/frontend/lib/routes/company/billing/BillingScreen.dart @@ -99,7 +99,7 @@ class _BillingScreenState extends State Widget getBillingInfo() { return Container( width: 450, - margin: EdgeInsets.fromLTRB(0, 20, 0, 0), + margin: EdgeInsets.fromLTRB(0, 20, 0, 20), padding: EdgeInsets.fromLTRB(17, 15, 17, 15), decoration: BoxDecoration( color: Theme.of(context).cardColor, diff --git a/frontend/lib/routes/company/billing/participationBillingWidget.dart b/frontend/lib/routes/company/billing/participationBillingWidget.dart index 371d8cb9..6453c5a3 100644 --- a/frontend/lib/routes/company/billing/participationBillingWidget.dart +++ b/frontend/lib/routes/company/billing/participationBillingWidget.dart @@ -17,39 +17,27 @@ class ParticipationBillingWidget extends StatelessWidget { @override Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.all(8.0), - child: FutureBuilder( - future: participation.billing, - builder: (context, snapshot) { - if (snapshot.hasError) { - return Text('Error' + snapshot.error.toString()); - } - if (snapshot.connectionState == ConnectionState.done) { - Billing? bill = snapshot.data as Billing?; + return FutureBuilder( + future: participation.billing, + builder: (context, snapshot) { + if (snapshot.hasError) { + return Text('Error' + snapshot.error.toString()); + } + if (snapshot.connectionState == ConnectionState.done) { + Billing? bill = snapshot.data as Billing?; - if (bill == null) { - return Container(); - } - return Column(children: [ - Align( - alignment: Alignment.centerLeft, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text('SINFO ${participation.event}'), - ), - ), - Divider(), - BillingCard( - billing: bill, - id: id, - ), - ]); - } else { - return Center(child: CircularProgressIndicator()); + if (bill == null) { + return Container(); } - }, - ), + return BillingCard( + billing: bill, + small: small, + id: id, + ); + } else { + return Center(child: CircularProgressIndicator()); + } + }, ); } } diff --git a/frontend/lib/routes/speaker/flights/flightCard.dart b/frontend/lib/routes/speaker/flights/flightCard.dart index fe85d655..2b91233a 100644 --- a/frontend/lib/routes/speaker/flights/flightCard.dart +++ b/frontend/lib/routes/speaker/flights/flightCard.dart @@ -24,7 +24,6 @@ class FlightCard extends StatefulWidget { class _FlightCardState extends State with AutomaticKeepAliveClientMixin { - @override bool get wantKeepAlive => true;