Merge branch 'master' of phyothandar/fcs into master
This commit is contained in:
BIN
assets/Invoice-A092(A)-32.pdf
Normal file
BIN
assets/Invoice-A092(A)-32.pdf
Normal file
Binary file not shown.
51897
assets/demo.pdf
Normal file
51897
assets/demo.pdf
Normal file
File diff suppressed because it is too large
Load Diff
@@ -565,5 +565,9 @@
|
||||
"fcs.profile": "FCS PROFILE",
|
||||
|
||||
"contact.usa.phone": "USA Phone",
|
||||
"contact.mm.phone": "Myanmar Phone"
|
||||
"contact.mm.phone": "Myanmar Phone",
|
||||
|
||||
"payment.title": "PAYMENT",
|
||||
"payment.date": "Date",
|
||||
"payment.amount": "Amount"
|
||||
}
|
||||
@@ -586,5 +586,9 @@
|
||||
"fcs.profile": "ပရိုဖိုင်",
|
||||
|
||||
"contact.usa.phone": "ယူအက်စ်အေ ဖုန်းနံပါတ်",
|
||||
"contact.mm.phone": "မြန်မာ ဖုန်းနံပါတ်"
|
||||
"contact.mm.phone": "မြန်မာ ဖုန်းနံပါတ်",
|
||||
|
||||
"payment.title": "ငွေပေးချေခြင်း",
|
||||
"payment.date": "Date",
|
||||
"payment.amount": "Amount"
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import 'base_model.dart';
|
||||
class InvoiceModel extends BaseModel {
|
||||
List<Invoice> invoices = [
|
||||
Invoice(
|
||||
invoiceNumber: 'INV202004050010',
|
||||
invoiceNumber: 'A092(A)-30',
|
||||
invoiceDate: DateTime(2020, 4, 5, 12, 30),
|
||||
customerName: 'Ko Nyi',
|
||||
customerPhoneNumber: '+959 888888888',
|
||||
@@ -34,9 +34,13 @@ class InvoiceModel extends BaseModel {
|
||||
status: "Received",
|
||||
arrivedDate: DateTime(2020, 6, 1),
|
||||
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon'),
|
||||
],
|
||||
receipts: [
|
||||
Receipt(amount: 2000, date: DateTime(2020, 6, 1)),
|
||||
Receipt(amount: 1000, date: DateTime(2020, 6, 16)),
|
||||
]),
|
||||
Invoice(
|
||||
invoiceNumber: 'INV202004050011',
|
||||
invoiceNumber: 'A092(A)-31',
|
||||
invoiceDate: DateTime(2020, 4, 5, 9, 30),
|
||||
customerName: 'Ko Aung Myo',
|
||||
customerPhoneNumber: '+959 444444444',
|
||||
@@ -63,9 +67,12 @@ class InvoiceModel extends BaseModel {
|
||||
status: "Processing",
|
||||
arrivedDate: DateTime(2020, 6, 1),
|
||||
receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon'),
|
||||
],
|
||||
receipts: [
|
||||
Receipt(amount: 2000, date: DateTime(2020, 6, 1)),
|
||||
]),
|
||||
Invoice(
|
||||
invoiceNumber: 'INV202004060010',
|
||||
invoiceNumber: 'A092(A)-32',
|
||||
invoiceDate: DateTime(2020, 4, 6, 10, 10),
|
||||
customerName: 'Ko Zaw Thu',
|
||||
customerPhoneNumber: '+959 777777777',
|
||||
@@ -92,14 +99,20 @@ class InvoiceModel extends BaseModel {
|
||||
status: "Delivered",
|
||||
arrivedDate: DateTime(2020, 5, 21),
|
||||
receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon'),
|
||||
],
|
||||
receipts: [
|
||||
Receipt(amount: 2000, date: DateTime(2020, 6, 1)),
|
||||
]),
|
||||
Invoice(
|
||||
invoiceNumber: 'INV202004060011',
|
||||
invoiceNumber: 'A092(A)-33',
|
||||
invoiceDate: DateTime(2020, 4, 6, 12, 15),
|
||||
customerName: 'Ko Myo Min',
|
||||
customerPhoneNumber: '+959 555555555',
|
||||
amount: 3000,
|
||||
status: 'Pending',
|
||||
receipts: [
|
||||
Receipt(amount: 2000, date: DateTime(2020, 6, 1)),
|
||||
],
|
||||
packages: [
|
||||
Package(
|
||||
shipmentNumber: "A201",
|
||||
|
||||
@@ -31,7 +31,7 @@ class PackageModel extends BaseModel {
|
||||
arrivedDate: DateTime(2020, 6, 1),
|
||||
market: "Amazon",
|
||||
id: "PKG2039",
|
||||
trackingID: "23-234s-asdfl"),
|
||||
trackingID: "23-234s-asdfl",statusHistory: statusHistory),
|
||||
Package(
|
||||
shipmentNumber: "A202",
|
||||
receiverNumber: "3",
|
||||
@@ -46,7 +46,7 @@ class PackageModel extends BaseModel {
|
||||
market: "Macy",
|
||||
trackingID: "asd-sdf-23498",
|
||||
id: "PKG2040",
|
||||
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon'),
|
||||
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon',statusHistory: statusHistory),
|
||||
Package(
|
||||
shipmentNumber: "A202",
|
||||
receiverNumber: "3",
|
||||
@@ -61,7 +61,7 @@ class PackageModel extends BaseModel {
|
||||
trackingID: "8923-234-sd",
|
||||
id: "PKG2041",
|
||||
arrivedDate: DateTime(2020, 6, 1),
|
||||
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon'),
|
||||
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon',statusHistory: statusHistory),
|
||||
Package(
|
||||
shipmentNumber: "A202",
|
||||
receiverNumber: "2",
|
||||
@@ -76,7 +76,7 @@ class PackageModel extends BaseModel {
|
||||
cargoDesc: "Dietary supplement",
|
||||
id: "PKG2042",
|
||||
arrivedDate: DateTime(2020, 6, 1),
|
||||
receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon'),
|
||||
receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon',statusHistory: statusHistory),
|
||||
Package(
|
||||
shipmentNumber: "A202",
|
||||
receiverNumber: "2",
|
||||
@@ -91,7 +91,7 @@ class PackageModel extends BaseModel {
|
||||
status: "Processed",
|
||||
id: "PKG2043",
|
||||
arrivedDate: DateTime(2020, 6, 1),
|
||||
receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon'),
|
||||
receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon',statusHistory: statusHistory),
|
||||
Package(
|
||||
shipmentNumber: "A201",
|
||||
receiverNumber: "1",
|
||||
@@ -106,7 +106,7 @@ class PackageModel extends BaseModel {
|
||||
trackingID: "sdf-asdf-23489",
|
||||
id: "PKG2044",
|
||||
arrivedDate: DateTime(2020, 5, 21),
|
||||
receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon'),
|
||||
receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon',statusHistory: statusHistory),
|
||||
Package(
|
||||
shipmentNumber: "A201",
|
||||
receiverNumber: "1",
|
||||
@@ -121,7 +121,7 @@ class PackageModel extends BaseModel {
|
||||
id: "PKG2045",
|
||||
trackingID: "oiuw-sdfpo-234",
|
||||
arrivedDate: DateTime(2020, 5, 21),
|
||||
receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon'),
|
||||
receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon',statusHistory: statusHistory),
|
||||
];
|
||||
|
||||
List<Package> get completed {
|
||||
|
||||
112
lib/pages/barcode_screen_page.dart
Normal file
112
lib/pages/barcode_screen_page.dart
Normal file
@@ -0,0 +1,112 @@
|
||||
import 'package:barcode_scan/barcode_scan.dart';
|
||||
import 'package:barcode_scan/model/scan_result.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:fcs/model/product_model.dart';
|
||||
import 'package:fcs/theme/theme.dart';
|
||||
import 'package:fcs/vo/buyer.dart';
|
||||
import 'package:fcs/vo/product.dart';
|
||||
import 'package:fcs/widget/progress.dart';
|
||||
|
||||
class BarcodeScreenPage extends StatefulWidget {
|
||||
final BuyerProduct buyerProduct;
|
||||
const BarcodeScreenPage({Key key, this.buyerProduct}) : super(key: key);
|
||||
@override
|
||||
_BarcodeScreenPageState createState() => _BarcodeScreenPageState();
|
||||
}
|
||||
|
||||
class _BarcodeScreenPageState extends State<BarcodeScreenPage> {
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
bool _isLoading = false;
|
||||
ScanResult scanResult;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
Widget showProducts(BuildContext context, ProductModel productModel) {
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
FontAwesomeIcons.tag,
|
||||
color: primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
new Flexible(
|
||||
child: Container(
|
||||
width: 170.0,
|
||||
child: DropdownButton<String>(
|
||||
// value: currentProductID,
|
||||
isExpanded: true,
|
||||
hint: Text(
|
||||
'Select Product',
|
||||
style: labelStyle,
|
||||
),
|
||||
onChanged: changedProduct,
|
||||
items: productModel.products
|
||||
.map<DropdownMenuItem<String>>((Product product) {
|
||||
return new DropdownMenuItem<String>(
|
||||
value: product.id,
|
||||
child: new Text(product.name, style: textStyle),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
void changedProduct(selected) {
|
||||
setState(() {
|
||||
// currentProductID = selected;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: primaryColor,
|
||||
title: Text("Bar Code Scranner"),
|
||||
),
|
||||
body: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: <Widget>[
|
||||
RaisedButton(
|
||||
child: Icon(Icons.scanner),
|
||||
onPressed: () async {
|
||||
await scan();
|
||||
},
|
||||
)
|
||||
],
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
Future scan() async {
|
||||
var result = await BarcodeScanner.scan();
|
||||
print("ScanResult => $result");
|
||||
setState(() => scanResult = result);
|
||||
}
|
||||
|
||||
// _save() {
|
||||
// if (currentProductID == null) return;
|
||||
// this.buyerProduct.productID = currentProductID;
|
||||
// var productName =
|
||||
// Provider.of<ProductModel>(context).getProductName(currentProductID);
|
||||
// this.buyerProduct.productName = productName;
|
||||
// this.buyerProduct.storageCapacityQty = int.parse(_storage.text);
|
||||
// this.buyerProduct.dailySaleQty = int.parse(_sales.text);
|
||||
// Navigator.pop<BuyerProduct>(context, this.buyerProduct);
|
||||
// }
|
||||
}
|
||||
@@ -249,7 +249,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
],
|
||||
),
|
||||
ExpansionTile(
|
||||
title: Text('Box Information'),
|
||||
title: Text('Package Information'),
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: SingleChildScrollView(
|
||||
|
||||
@@ -1,13 +1,22 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:fcs/model/main_model.dart';
|
||||
import 'package:fcs/pages/invoice/payment_pdf_screen.dart';
|
||||
import 'package:fcs/theme/theme.dart';
|
||||
import 'package:fcs/vo/invoice.dart';
|
||||
import 'package:fcs/widget/bottom_up_page_route.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../util.dart';
|
||||
import 'invoice_editor.dart';
|
||||
import 'payment_page.dart';
|
||||
|
||||
class InvoiceListRow extends StatefulWidget {
|
||||
final Invoice invoice;
|
||||
@@ -21,6 +30,8 @@ class _InvoiceListRowState extends State<InvoiceListRow> {
|
||||
var dateFormatter = new DateFormat('dd MMM yyyy');
|
||||
final double dotSize = 15.0;
|
||||
Invoice _invoice = new Invoice();
|
||||
// String pdfPath = 'assets/Invoice-A092(A)-32.pdf';
|
||||
String pdfPath = '';
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -29,16 +40,47 @@ class _InvoiceListRowState extends State<InvoiceListRow> {
|
||||
if (widget.invoice != null) {
|
||||
_invoice = widget.invoice;
|
||||
}
|
||||
|
||||
fromAsset('assets/demo.pdf', 'demo.pdf').then((f) {
|
||||
setState(() {
|
||||
pdfPath = f.path;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Future<File> fromAsset(String asset, String filename) async {
|
||||
// To open from assets, you can copy them to the app storage folder, and the access them "locally"
|
||||
Completer<File> completer = Completer();
|
||||
print('asset => $asset');
|
||||
print('assest => ${await rootBundle.load(asset)}');
|
||||
try {
|
||||
var dir = await getApplicationDocumentsDirectory();
|
||||
File file = File("${dir.path}/$filename");
|
||||
var data = await rootBundle.load(asset);
|
||||
print('data => $data');
|
||||
var bytes = data.buffer.asUint8List();
|
||||
await file.writeAsBytes(bytes, flush: true);
|
||||
completer.complete(file);
|
||||
} catch (e) {
|
||||
throw Exception('Error parsing asset file!'+ e.toString());
|
||||
}
|
||||
|
||||
return completer.future;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var owner = Provider.of<MainModel>(context).isOwner();
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 15, right: 15),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context)
|
||||
.push(BottomUpPageRoute(InvoiceEditor(invoice: _invoice)));
|
||||
owner
|
||||
? Navigator.of(context)
|
||||
.push(BottomUpPageRoute(InvoiceEditor(invoice: _invoice)))
|
||||
: Navigator.of(context).push(BottomUpPageRoute(PaymentPDFScreen(
|
||||
path: pdfPath,
|
||||
)));
|
||||
},
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
@@ -88,9 +130,49 @@ class _InvoiceListRowState extends State<InvoiceListRow> {
|
||||
padding: const EdgeInsets.all(0),
|
||||
child: getStatus(_invoice.status),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 10.0),
|
||||
child: InkWell(
|
||||
child: Icon(
|
||||
Icons.payment,
|
||||
color: primaryColor,
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.of(context)
|
||||
.push(BottomUpPageRoute(PaymentPage(invoice: _invoice)));
|
||||
},
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: InkWell(
|
||||
child: Icon(
|
||||
Icons.more_vert,
|
||||
color: primaryColor,
|
||||
),
|
||||
onTap: () {
|
||||
var act = actionSheet(context);
|
||||
showCupertinoModalPopup(
|
||||
context: context, builder: (BuildContext context) => act);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
actionSheet(BuildContext context) {
|
||||
return CupertinoActionSheet(
|
||||
actions: <Widget>[
|
||||
CupertinoActionSheetAction(
|
||||
child: Text("Download"),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
202
lib/pages/invoice/payment_page.dart
Normal file
202
lib/pages/invoice/payment_page.dart
Normal file
@@ -0,0 +1,202 @@
|
||||
import 'package:fcs/model/main_model.dart';
|
||||
import 'package:fcs/pages/util.dart';
|
||||
import 'package:fcs/theme/theme.dart';
|
||||
import 'package:fcs/vo/invoice.dart';
|
||||
import 'package:fcs/vo/package.dart';
|
||||
import 'package:fcs/widget/local_text.dart';
|
||||
import 'package:fcs/widget/localization/app_translations.dart';
|
||||
import 'package:fcs/widget/multi_img_controller.dart';
|
||||
import 'package:fcs/widget/multi_img_file.dart';
|
||||
import 'package:fcs/widget/my_data_table.dart';
|
||||
import 'package:fcs/widget/number_cell.dart';
|
||||
import 'package:fcs/widget/progress.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:timeline_list/timeline.dart';
|
||||
import 'package:timeline_list/timeline_model.dart';
|
||||
|
||||
class PaymentPage extends StatefulWidget {
|
||||
final Invoice invoice;
|
||||
PaymentPage({this.invoice});
|
||||
|
||||
@override
|
||||
_PaymentPageState createState() => _PaymentPageState();
|
||||
}
|
||||
|
||||
class _PaymentPageState extends State<PaymentPage> {
|
||||
TextEditingController _addressEditingController = new TextEditingController();
|
||||
TextEditingController _fromTimeEditingController =
|
||||
new TextEditingController();
|
||||
TextEditingController _toTimeEditingController = new TextEditingController();
|
||||
TextEditingController _noOfPackageEditingController =
|
||||
new TextEditingController();
|
||||
TextEditingController _weightEditingController = new TextEditingController();
|
||||
MultiImgController multiImgController = MultiImgController();
|
||||
var dateFormatter = new DateFormat('dd MMM yyyy');
|
||||
|
||||
Invoice _invoice = new Invoice();
|
||||
bool _isLoading = false;
|
||||
List<String> _receipts = [
|
||||
"assets/photos/1.jpg",
|
||||
"assets/photos/2.jpg",
|
||||
"assets/photos/3.jpg"
|
||||
];
|
||||
bool isNew;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
if (widget.invoice != null) {
|
||||
_invoice = widget.invoice;
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
final DateFormat dateFormat = DateFormat("d MMM yyyy");
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var owner = Provider.of<MainModel>(context).isOwner();
|
||||
|
||||
// var images = isNew ? [] : _images;
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
leading: new IconButton(
|
||||
icon: new Icon(Icons.close),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
title: Text(AppTranslations.of(context).text("payment.title")),
|
||||
),
|
||||
body: Card(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: Container(
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'Remaining Balance : ',
|
||||
style: TextStyle(fontSize: 16),
|
||||
),
|
||||
Text(
|
||||
'${_invoice.amount}',
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold),
|
||||
)
|
||||
],
|
||||
)),
|
||||
),
|
||||
Expanded(
|
||||
child: ListView(
|
||||
children: [
|
||||
ExpansionTile(
|
||||
title: Text('Payment Attachment'),
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 20),
|
||||
child: Row(children: <Widget>[
|
||||
LocalText(
|
||||
context,
|
||||
"invoice.payment",
|
||||
color: Colors.grey,
|
||||
fontSize: 14,
|
||||
),
|
||||
MultiImageFile(
|
||||
enabled: true,
|
||||
controller: multiImgController,
|
||||
title: "Receipt File",
|
||||
)
|
||||
])),
|
||||
SizedBox(
|
||||
height: 25,
|
||||
),
|
||||
],
|
||||
),
|
||||
ExpansionTile(
|
||||
title: Text('Receipt'),
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: MyDataTable(
|
||||
headingRowHeight: 40,
|
||||
columnSpacing: 20,
|
||||
columns: [
|
||||
MyDataColumn(
|
||||
label: LocalText(
|
||||
context,
|
||||
"payment.date",
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
MyDataColumn(
|
||||
label: LocalText(
|
||||
context,
|
||||
"payment.amount",
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
],
|
||||
rows: getPackageRow(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
owner
|
||||
? Container(
|
||||
padding: EdgeInsets.only(top: 20),
|
||||
child: Align(
|
||||
alignment: Alignment.bottomRight,
|
||||
child: FloatingActionButton.extended(
|
||||
icon: Icon(Icons.add),
|
||||
label: Text(AppTranslations.of(context)
|
||||
.text("invoice.add_box")),
|
||||
backgroundColor: primaryColor,
|
||||
onPressed: () {
|
||||
// Navigator.of(context)
|
||||
// .push(BottomUpPageRoute(PackageAddition()));
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
SizedBox(height: 25),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
List<MyDataRow> getPackageRow(BuildContext context) {
|
||||
return _invoice.receipts.map((r) {
|
||||
return MyDataRow(
|
||||
onSelectChanged: (bool selected) {},
|
||||
cells: [
|
||||
MyDataCell(
|
||||
new Text(dateFormatter.format(r.date), style: textStyle),
|
||||
),
|
||||
MyDataCell(NumberCell(r.amount))
|
||||
],
|
||||
);
|
||||
}).toList();
|
||||
}
|
||||
}
|
||||
113
lib/pages/invoice/payment_pdf_screen.dart
Normal file
113
lib/pages/invoice/payment_pdf_screen.dart
Normal file
@@ -0,0 +1,113 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:fcs/theme/theme.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_pdfview/flutter_pdfview.dart';
|
||||
|
||||
class PaymentPDFScreen extends StatefulWidget {
|
||||
final String path;
|
||||
|
||||
PaymentPDFScreen({Key key, this.path}) : super(key: key);
|
||||
|
||||
_PaymentPDFScreenState createState() => _PaymentPDFScreenState();
|
||||
}
|
||||
|
||||
class _PaymentPDFScreenState extends State<PaymentPDFScreen>
|
||||
with WidgetsBindingObserver {
|
||||
final Completer<PDFViewController> _controller =
|
||||
Completer<PDFViewController>();
|
||||
int pages = 0;
|
||||
int currentPage = 0;
|
||||
bool isReady = false;
|
||||
String errorMessage = '';
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
print(' widget.path => ${widget.path}');
|
||||
print(' pages => ${pages}');
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: primaryColor,
|
||||
title: Text("Document"),
|
||||
actions: <Widget>[
|
||||
IconButton(
|
||||
icon: Icon(Icons.share),
|
||||
onPressed: () {},
|
||||
),
|
||||
],
|
||||
),
|
||||
body: Stack(
|
||||
children: <Widget>[
|
||||
PDFView(
|
||||
filePath: widget.path,
|
||||
enableSwipe: true,
|
||||
swipeHorizontal: true,
|
||||
autoSpacing: false,
|
||||
pageFling: true,
|
||||
pageSnap: true,
|
||||
defaultPage: currentPage,
|
||||
fitPolicy: FitPolicy.BOTH,
|
||||
preventLinkNavigation:
|
||||
false, // if set to true the link is handled in flutter
|
||||
onRender: (_pages) {
|
||||
print(('pages => $pages'));
|
||||
setState(() {
|
||||
pages = _pages;
|
||||
isReady = true;
|
||||
});
|
||||
},
|
||||
// onError: (error) {
|
||||
// setState(() {
|
||||
// errorMessage = error.toString();
|
||||
// });
|
||||
// print(error.toString());
|
||||
// },
|
||||
// onPageError: (page, error) {
|
||||
// setState(() {
|
||||
// errorMessage = '$page: ${error.toString()}';
|
||||
// });
|
||||
// print('$page: ${error.toString()}');
|
||||
// },
|
||||
onViewCreated: (PDFViewController pdfViewController) {
|
||||
_controller.complete(pdfViewController);
|
||||
},
|
||||
onLinkHandler: (String uri) {
|
||||
print('goto uri: $uri');
|
||||
},
|
||||
onPageChanged: (int page, int total) {
|
||||
print('page change: $page/$total');
|
||||
setState(() {
|
||||
currentPage = page;
|
||||
});
|
||||
},
|
||||
),
|
||||
// errorMessage.isEmpty
|
||||
// ? !isReady
|
||||
// ? Center(
|
||||
// child: CircularProgressIndicator(),
|
||||
// )
|
||||
// : Container()
|
||||
// : Center(
|
||||
// child: Text(errorMessage),
|
||||
// )
|
||||
],
|
||||
),
|
||||
floatingActionButton: FutureBuilder<PDFViewController>(
|
||||
future: _controller.future,
|
||||
builder: (context, AsyncSnapshot<PDFViewController> snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
return FloatingActionButton.extended(
|
||||
label: Text("Go to ${pages ~/ 2}"),
|
||||
onPressed: () async {
|
||||
await snapshot.data.setPage(pages ~/ 2);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
return Container();
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -90,13 +90,13 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
|
||||
SizedBox(height: 50),
|
||||
Center(
|
||||
child: Text(
|
||||
"Delivery fee:\$ 5",
|
||||
"Delivery fee:\$ 0",
|
||||
style: TextStyle(color: primaryColor, fontSize: 16),
|
||||
)),
|
||||
SizedBox(height: 20),
|
||||
Center(
|
||||
child: Text(
|
||||
"Total estimated amount:\$ 38",
|
||||
"Total estimated amount:\$ 95",
|
||||
style: TextStyle(color: primaryColor, fontSize: 20),
|
||||
))
|
||||
],
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:fcs/model/main_model.dart';
|
||||
import 'package:fcs/pages/util.dart';
|
||||
import 'package:fcs/vo/package.dart';
|
||||
import 'package:fcs/widget/localization/app_translations.dart';
|
||||
@@ -6,6 +7,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:timeline_list/timeline.dart';
|
||||
import 'package:timeline_list/timeline_model.dart';
|
||||
|
||||
@@ -61,8 +63,49 @@ class _PackageEditorState extends State<PackageEditor> {
|
||||
|
||||
final DateFormat dateFormat = DateFormat("d MMM yyyy");
|
||||
|
||||
List<TimelineModel> _models() {
|
||||
print('_package.statusHistory=> ${_package.statusHistory}');
|
||||
return _package.statusHistory
|
||||
.map((e) => TimelineModel(
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(18.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(e.status,
|
||||
style: TextStyle(
|
||||
color: e.done ? primaryColor : Colors.grey,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold)),
|
||||
e.status == "Processed"
|
||||
? Text("(Waiting for payment)",
|
||||
style: TextStyle(
|
||||
color: e.done ? primaryColor : Colors.grey,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold))
|
||||
: Container(),
|
||||
Text(dateFormat.format(e.date)),
|
||||
],
|
||||
),
|
||||
),
|
||||
iconBackground: e.done ? primaryColor : Colors.grey,
|
||||
icon: Icon(
|
||||
e.status == "Shipped"
|
||||
? Ionicons.ios_airplane
|
||||
: e.status == "Delivered"
|
||||
? MaterialCommunityIcons.truck_fast
|
||||
: e.status == "Processed"
|
||||
? MaterialIcons.check
|
||||
: Octicons.package,
|
||||
color: Colors.white,
|
||||
)))
|
||||
.toList();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var owner = Provider.of<MainModel>(context).isOwner();
|
||||
|
||||
var images = isNew ? [] : _images;
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
@@ -89,15 +132,18 @@ class _PackageEditorState extends State<PackageEditor> {
|
||||
Expanded(
|
||||
child: ListView(
|
||||
children: [
|
||||
ExpansionTile(
|
||||
owner
|
||||
? ExpansionTile(
|
||||
title: Text(
|
||||
'Receiving',
|
||||
style: TextStyle(
|
||||
color: primaryColor, fontWeight: FontWeight.bold),
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
padding: const EdgeInsets.only(
|
||||
left: 20.0, right: 20),
|
||||
child: TextFormField(
|
||||
initialValue: isNew ? "" : "PKG2039",
|
||||
decoration: InputDecoration(
|
||||
@@ -111,7 +157,8 @@ class _PackageEditorState extends State<PackageEditor> {
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
padding: const EdgeInsets.only(
|
||||
left: 20.0, right: 20),
|
||||
child: TextFormField(
|
||||
initialValue: isNew ? "" : "Amazon",
|
||||
decoration: InputDecoration(
|
||||
@@ -119,13 +166,15 @@ class _PackageEditorState extends State<PackageEditor> {
|
||||
labelText: 'Market',
|
||||
hintText: 'FCS_ID',
|
||||
filled: true,
|
||||
icon: Icon(MaterialCommunityIcons.cart_outline,
|
||||
icon: Icon(
|
||||
MaterialCommunityIcons.cart_outline,
|
||||
color: primaryColor),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
padding: const EdgeInsets.only(
|
||||
left: 20.0, right: 20),
|
||||
child: TextFormField(
|
||||
initialValue: isNew ? "" : "zdf-sdfl-37sdfks",
|
||||
decoration: InputDecoration(
|
||||
@@ -133,12 +182,14 @@ class _PackageEditorState extends State<PackageEditor> {
|
||||
labelText: 'Tracking ID',
|
||||
hintText: 'Tracking ID',
|
||||
filled: true,
|
||||
icon: Icon(Octicons.package, color: primaryColor),
|
||||
icon: Icon(Octicons.package,
|
||||
color: primaryColor),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
padding: const EdgeInsets.only(
|
||||
left: 20.0, right: 20),
|
||||
child: TextFormField(
|
||||
initialValue: isNew ? "" : "FCS-0203-390-2",
|
||||
decoration: InputDecoration(
|
||||
@@ -146,35 +197,40 @@ class _PackageEditorState extends State<PackageEditor> {
|
||||
labelText: 'FCS_ID',
|
||||
hintText: 'FCS_ID',
|
||||
filled: true,
|
||||
icon: Icon(Feather.user, color: primaryColor),
|
||||
icon: Icon(Feather.user,
|
||||
color: primaryColor),
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(Icons.search),
|
||||
onPressed: () {})),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
padding: const EdgeInsets.only(
|
||||
left: 20.0, right: 20),
|
||||
child: TextFormField(
|
||||
initialValue: _package.receiverName,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Customer Name',
|
||||
filled: true,
|
||||
icon: Icon(Feather.user, color: Colors.white),
|
||||
icon: Icon(Feather.user,
|
||||
color: Colors.white),
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(Icons.search),
|
||||
onPressed: () {})),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
padding: const EdgeInsets.only(
|
||||
left: 20.0, right: 20),
|
||||
child: TextFormField(
|
||||
initialValue: isNew ? "" : "",
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Pickup ID',
|
||||
filled: true,
|
||||
icon: Icon(MaterialCommunityIcons.directions,
|
||||
icon: Icon(
|
||||
MaterialCommunityIcons.directions,
|
||||
color: primaryColor),
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(Icons.search),
|
||||
@@ -182,8 +238,10 @@ class _PackageEditorState extends State<PackageEditor> {
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
isNew
|
||||
)
|
||||
: Container(),
|
||||
owner
|
||||
? isNew
|
||||
? Container()
|
||||
: ExpansionTile(
|
||||
title: Text(
|
||||
@@ -209,7 +267,8 @@ class _PackageEditorState extends State<PackageEditor> {
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
isNew
|
||||
? Container()
|
||||
: ExpansionTile(
|
||||
@@ -267,10 +326,32 @@ class _PackageEditorState extends State<PackageEditor> {
|
||||
),
|
||||
],
|
||||
),
|
||||
isNew
|
||||
? Container()
|
||||
: ExpansionTile(
|
||||
title: Text(
|
||||
'Status',
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
children: <Widget>[
|
||||
Container(
|
||||
height: 500,
|
||||
padding: EdgeInsets.only(left: 20),
|
||||
child: isNew
|
||||
? Container()
|
||||
: Timeline(
|
||||
children: _models(),
|
||||
position: TimelinePosition.Left),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
widget.package == null
|
||||
owner
|
||||
? widget.package == null
|
||||
? Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Center(
|
||||
@@ -304,6 +385,7 @@ class _PackageEditorState extends State<PackageEditor> {
|
||||
))),
|
||||
],
|
||||
))
|
||||
: Container()
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:fcs/model/pickup_model.dart';
|
||||
import 'package:fcs/model_fcs/package_model.dart';
|
||||
import 'package:fcs/pages/barcode_screen_page.dart';
|
||||
import 'package:fcs/pages/pickup_list_row.dart';
|
||||
import 'package:fcs/pages/search_page.dart';
|
||||
import 'package:fcs/pages_fcs/package_editor.dart';
|
||||
@@ -9,6 +10,7 @@ import 'package:fcs/widget/bottom_up_page_route.dart';
|
||||
import 'package:fcs/widget/localization/app_translations.dart';
|
||||
import 'package:fcs/widget/progress.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../theme/theme.dart';
|
||||
@@ -49,6 +51,19 @@ class _PackageListState extends State<PackageList> {
|
||||
backgroundColor: primaryColor,
|
||||
title: Text(AppTranslations.of(context).text("package.title")),
|
||||
actions: <Widget>[
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.barcode,
|
||||
color: Colors.white,
|
||||
),
|
||||
iconSize: 30,
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
BottomUpPageRoute(BarcodeScreenPage()),
|
||||
);
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
Icons.search,
|
||||
|
||||
@@ -90,6 +90,10 @@ class _PackageListRowtate extends State<PackageListRow> {
|
||||
),
|
||||
Column(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(3.0),
|
||||
child: getStatus(_package.status),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(0),
|
||||
child: new Text(
|
||||
@@ -97,27 +101,27 @@ class _PackageListRowtate extends State<PackageListRow> {
|
||||
style: new TextStyle(fontSize: 15.0, color: Colors.grey),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0, top: 5, bottom: 5),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
new Text(
|
||||
_package.weight == null
|
||||
? ''
|
||||
: _package.weight.toString() + 'lb - ',
|
||||
style:
|
||||
new TextStyle(fontSize: 15.0, color: Colors.grey),
|
||||
),
|
||||
new Text(
|
||||
_package.price == null
|
||||
? ""
|
||||
: "\$ " + _package.price.toString(),
|
||||
style:
|
||||
new TextStyle(fontSize: 15.0, color: Colors.grey),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(left: 8.0, top: 5, bottom: 5),
|
||||
// child: Row(
|
||||
// children: <Widget>[
|
||||
// new Text(
|
||||
// _package.weight == null
|
||||
// ? ''
|
||||
// : _package.weight.toString() + 'lb - ',
|
||||
// style:
|
||||
// new TextStyle(fontSize: 15.0, color: Colors.grey),
|
||||
// ),
|
||||
// new Text(
|
||||
// _package.price == null
|
||||
// ? ""
|
||||
// : "\$ " + _package.price.toString(),
|
||||
// style:
|
||||
// new TextStyle(fontSize: 15.0, color: Colors.grey),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
)
|
||||
],
|
||||
|
||||
@@ -11,6 +11,9 @@ class Invoice {
|
||||
String paymentAttachment;
|
||||
|
||||
List<Package> packages;
|
||||
List<Receipt> receipts;
|
||||
List<String> receiptPhotos;
|
||||
|
||||
Invoice(
|
||||
{this.invoiceNumber,
|
||||
this.invoiceDate,
|
||||
@@ -20,7 +23,16 @@ class Invoice {
|
||||
this.discount,
|
||||
this.status,
|
||||
this.paymentAttachment,
|
||||
this.packages});
|
||||
this.packages,
|
||||
this.receiptPhotos,
|
||||
this.receipts});
|
||||
|
||||
double get getAmount => packages.fold(0, (p, e) => (e.rate * e.weight) + p);
|
||||
}
|
||||
|
||||
class Receipt {
|
||||
int amount;
|
||||
DateTime date;
|
||||
|
||||
Receipt({this.amount, this.date});
|
||||
}
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
// class Status {
|
||||
// String status;
|
||||
// DateTime date;
|
||||
// bool done;
|
||||
// Status({this.status, this.date, this.done});
|
||||
// }
|
||||
import 'box.dart';
|
||||
|
||||
class Package {
|
||||
String id;
|
||||
@@ -34,7 +29,7 @@ class Package {
|
||||
shipmentNumber + "-" + receiverNumber + " #" + boxNumber;
|
||||
double get price => rate.toDouble() * weight;
|
||||
|
||||
// List<Status> statusHistory;
|
||||
List<Status> statusHistory;
|
||||
|
||||
Package(
|
||||
{this.id,
|
||||
@@ -55,7 +50,6 @@ class Package {
|
||||
this.arrivedDate,
|
||||
this.cargoDesc,
|
||||
this.market,
|
||||
this.trackingID
|
||||
// this.statusHistory
|
||||
});
|
||||
this.trackingID,
|
||||
this.statusHistory});
|
||||
}
|
||||
|
||||
@@ -540,7 +540,7 @@ packages:
|
||||
name: pin_input_text_field
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
version: "3.0.2"
|
||||
platform:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -42,7 +42,7 @@ dependencies:
|
||||
uuid: ^2.0.4
|
||||
zefyr:
|
||||
flutter_signature_pad: ^2.0.0+1
|
||||
path_provider: ^1.5.1
|
||||
path_provider: ^1.6.11
|
||||
flutter_ringtone_player: ^2.0.0
|
||||
http_server: ^0.9.8+3
|
||||
archive: ^2.0.11
|
||||
@@ -67,6 +67,8 @@ dependencies:
|
||||
flutter_icons: ^1.1.0
|
||||
country_icons: ^1.1.1
|
||||
timeline_list: ^0.0.5
|
||||
barcode_scan: ^3.0.1
|
||||
flutter_pdfview: ^1.0.3
|
||||
|
||||
|
||||
|
||||
@@ -80,6 +82,7 @@ flutter:
|
||||
- assets/
|
||||
- assets/local/
|
||||
- assets/photos/
|
||||
- assets/demo.pdf
|
||||
|
||||
|
||||
fonts:
|
||||
|
||||
Reference in New Issue
Block a user