Skip to content

Commit

Permalink
feat: finished billing card #298
Browse files Browse the repository at this point in the history
  • Loading branch information
bvlourenco committed Dec 28, 2022
1 parent 41860c8 commit 30305de
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 42 deletions.
130 changes: 121 additions & 9 deletions frontend/lib/routes/company/billing/BillingCard.dart
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -23,17 +26,126 @@ class _BillingCardState extends State<BillingCard>
});
}

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(),
],
),
);
}
}
2 changes: 1 addition & 1 deletion frontend/lib/routes/company/billing/BillingScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class _BillingScreenState extends State<BillingScreen>
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,
Expand Down
50 changes: 19 additions & 31 deletions frontend/lib/routes/company/billing/participationBillingWidget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
},
);
}
}
1 change: 0 additions & 1 deletion frontend/lib/routes/speaker/flights/flightCard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class FlightCard extends StatefulWidget {

class _FlightCardState extends State<FlightCard>
with AutomaticKeepAliveClientMixin {

@override
bool get wantKeepAlive => true;

Expand Down

0 comments on commit 30305de

Please sign in to comment.