modify ui
This commit is contained in:
@@ -519,6 +519,8 @@
|
||||
"cargo.form.title":"CARGO",
|
||||
"cargo.type":"Cargo Type",
|
||||
"cargo.weight":"Weight",
|
||||
"cargo.rate":"Rate",
|
||||
"cargo.amount":"Amount",
|
||||
|
||||
"boxes.name":"Boxes",
|
||||
"boxes.title":"BOXES",
|
||||
@@ -528,6 +530,10 @@
|
||||
"box.package.desc":"Description",
|
||||
"box.package.market":"Market",
|
||||
"box.add_package":"Add Package",
|
||||
"box.number":"Box Number",
|
||||
"box.length":"Length",
|
||||
"box.width":"Width",
|
||||
"box.height":"Height",
|
||||
|
||||
"package.name":"Packages",
|
||||
"package.title":"PACKAGES",
|
||||
@@ -579,5 +585,14 @@
|
||||
"payment.receipt":"Payment Receipt Amount",
|
||||
"payment.attachment":"Payment Attachment",
|
||||
"pdf_view.title":"Payment File",
|
||||
"remaining_balance":"Remaining Balance : "
|
||||
"remaining_balance":"Remaining Balance : ",
|
||||
|
||||
"payment.method.btn":"Payment Methods",
|
||||
"payment.method.title":"Payment Methods",
|
||||
"payment.method.new":"Payment Method",
|
||||
|
||||
"discount.btn":"Discounts",
|
||||
"discount.title":"Discounts",
|
||||
"discount.new":"Discount"
|
||||
|
||||
}
|
||||
@@ -566,6 +566,8 @@
|
||||
"cargo.form.title":"ကုန်ပစ္စည်းအမျိုးအစား",
|
||||
"cargo.type":"ကုန်ပစ္စည်းအမျိုးအစား",
|
||||
"cargo.weight":"အလေးချိန်",
|
||||
"cargo.rate":"အဆင့်",
|
||||
"cargo.amount":"ပမာဏ",
|
||||
|
||||
"message.btn":"အသိပေးချက်များ",
|
||||
"message.title":"အသိပေးချက်များ",
|
||||
@@ -600,5 +602,13 @@
|
||||
"payment.receipt":"ပေးချေပြီးပမာဏများ",
|
||||
"payment.attachment":"ပေးချေပြီးဖိုင်များ",
|
||||
"pdf_view.title":"ပေးဆောင်ခြင်းဖိုင်",
|
||||
"remaining_balance":"ပေးချေရန်ကျန်ရှိငွေ : "
|
||||
"remaining_balance":"ပေးချေရန်ကျန်ရှိငွေ : ",
|
||||
|
||||
"payment.method.btn":"ငွေပေးချေစနစ်",
|
||||
"payment.method.title":"ငွေပေးချေစနစ်",
|
||||
"payment.method.new":"ငွေပေးချေစနစ်အသစ်",
|
||||
|
||||
"discount.btn":"Discounts",
|
||||
"discount.title":"Discounts",
|
||||
"discount.new":"Discount"
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:fcs/model/discount_model.dart';
|
||||
import 'package:fcs/model/shipment_model.dart';
|
||||
import 'package:fcs/model_fcs/message_model.dart';
|
||||
import 'package:fcs/model_fcs/package_model.dart';
|
||||
@@ -77,6 +78,7 @@ class _AppState extends State<App> {
|
||||
final MessageModel messageModel = new MessageModel();
|
||||
final InvoiceModel invoiceModel = new InvoiceModel();
|
||||
final CustomerModel customerModel = new CustomerModel();
|
||||
final DiscountModel discountModel = new DiscountModel();
|
||||
|
||||
AppTranslationsDelegate _newLocaleDelegate;
|
||||
|
||||
@@ -115,7 +117,8 @@ class _AppState extends State<App> {
|
||||
..addModel(messageModel)
|
||||
..addModel(shipmentRateModel)
|
||||
..addModel(invoiceModel)
|
||||
..addModel(customerModel);
|
||||
..addModel(customerModel)
|
||||
..addModel(discountModel);
|
||||
this.mainModel.init();
|
||||
}
|
||||
|
||||
@@ -173,6 +176,7 @@ class _AppState extends State<App> {
|
||||
ChangeNotifierProvider(builder: (context) => messageModel),
|
||||
ChangeNotifierProvider(builder: (context) => invoiceModel),
|
||||
ChangeNotifierProvider(builder: (context) => customerModel),
|
||||
ChangeNotifierProvider(builder: (context) => discountModel),
|
||||
ChangeNotifierProvider(
|
||||
builder: (context) => testModel,
|
||||
),
|
||||
|
||||
57
lib/model/discount_model.dart
Normal file
57
lib/model/discount_model.dart
Normal file
@@ -0,0 +1,57 @@
|
||||
import 'package:fcs/vo/discount.dart';
|
||||
|
||||
import 'base_model.dart';
|
||||
|
||||
class DiscountModel extends BaseModel {
|
||||
List<Discount> get discounts {
|
||||
List<Discount> discountList = [
|
||||
Discount(
|
||||
code: 'XMQY01',
|
||||
customer: 'Ko Nyi',
|
||||
amount: 5000,
|
||||
status: 'Used',
|
||||
),
|
||||
Discount(
|
||||
code: 'XMQY02',
|
||||
customer: 'Ko Aung Myo',
|
||||
amount: 3000,
|
||||
status: 'Avaliable',
|
||||
),
|
||||
Discount(
|
||||
code: 'XMQY03',
|
||||
customer: 'Ko Zaw Thu',
|
||||
amount: 2000,
|
||||
status: 'Used',
|
||||
),
|
||||
Discount(
|
||||
code: 'XMQY04',
|
||||
customer: 'Ko Myo Min',
|
||||
amount: 3000,
|
||||
status: 'Avaliable',
|
||||
),
|
||||
Discount(
|
||||
code: 'XMQY05',
|
||||
customer: 'Ko Nyi',
|
||||
amount: 3000,
|
||||
status: 'Avaliable',
|
||||
),
|
||||
];
|
||||
return discountList;
|
||||
}
|
||||
|
||||
// List<Discount> get discountByCustomer {
|
||||
// return invoices.where((e) => e.status == "Avaliable").toList()
|
||||
// ..sort((e1, e2) {
|
||||
// return e2.invoiceNumber.compareTo(e1.invoiceNumber);
|
||||
// });
|
||||
// }
|
||||
|
||||
void initUser(user) {
|
||||
super.initUser(user);
|
||||
}
|
||||
|
||||
@override
|
||||
logout() async {
|
||||
// discounts = [];
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import 'dart:io';
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:device_info/device_info.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:fcs/vo/payment_method.dart';
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
@@ -81,6 +82,30 @@ class MainModel extends ChangeNotifier {
|
||||
_loadFcs();
|
||||
}
|
||||
|
||||
List<PaymentMethod> get paymentMethods {
|
||||
List<PaymentMethod> methods = [
|
||||
PaymentMethod(
|
||||
name: 'AYA Bank',
|
||||
accountName: 'AYA Co,Ltd',
|
||||
account: '100 23404320548398',
|
||||
phone: '+959123456789',
|
||||
mail: 'aya@gmail.com'),
|
||||
PaymentMethod(
|
||||
name: 'KBZ Bank',
|
||||
accountName: 'KBZ Co,Ltd',
|
||||
account: '100 23404320548398',
|
||||
phone: '+959123456789',
|
||||
mail: 'kbz@gmail.com'),
|
||||
PaymentMethod(
|
||||
name: 'PayPal',
|
||||
accountName: 'PayPal Co,Ltd',
|
||||
account: '100 23404320548398',
|
||||
phone: '+959123456789',
|
||||
mail: 'paypal@gmail.com'),
|
||||
];
|
||||
return methods;
|
||||
}
|
||||
|
||||
_loadFcs() async {
|
||||
user = await SharedPref.getUser();
|
||||
notifyListeners();
|
||||
|
||||
@@ -187,6 +187,13 @@ class BoxModel extends BaseModel {
|
||||
});
|
||||
}
|
||||
|
||||
List<Box> get processed {
|
||||
return boxes.where((e) => e.status == "Packed").toList()
|
||||
..sort((e1, e2) {
|
||||
return e2.packageNumber.compareTo(e1.packageNumber);
|
||||
});
|
||||
}
|
||||
|
||||
List<Box> get upcoming {
|
||||
return boxes
|
||||
.where((e) =>
|
||||
|
||||
@@ -17,6 +17,7 @@ class PackageModel extends BaseModel {
|
||||
Status(status: "Arrived", date: DateTime(2020, 6, 7), done: false),
|
||||
Status(status: "Delivered", date: DateTime(2020, 6, 15), done: false)
|
||||
];
|
||||
|
||||
static List<Package> packages = [
|
||||
Package(
|
||||
shipmentNumber: "A202",
|
||||
@@ -32,7 +33,8 @@ class PackageModel extends BaseModel {
|
||||
arrivedDate: DateTime(2020, 6, 1),
|
||||
market: "Amazon",
|
||||
id: "PKG2039",
|
||||
trackingID: "23-234s-asdfl",statusHistory: statusHistory),
|
||||
trackingID: "23-234s-asdfl",
|
||||
statusHistory: statusHistory),
|
||||
Package(
|
||||
shipmentNumber: "A202",
|
||||
receiverNumber: "3",
|
||||
@@ -47,7 +49,8 @@ class PackageModel extends BaseModel {
|
||||
market: "Macy",
|
||||
trackingID: "asd-sdf-23498",
|
||||
id: "PKG2040",
|
||||
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon',statusHistory: statusHistory),
|
||||
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon',
|
||||
statusHistory: statusHistory),
|
||||
Package(
|
||||
shipmentNumber: "A202",
|
||||
receiverNumber: "3",
|
||||
@@ -62,7 +65,8 @@ class PackageModel extends BaseModel {
|
||||
trackingID: "8923-234-sd",
|
||||
id: "PKG2041",
|
||||
arrivedDate: DateTime(2020, 6, 1),
|
||||
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon',statusHistory: statusHistory),
|
||||
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon',
|
||||
statusHistory: statusHistory),
|
||||
Package(
|
||||
shipmentNumber: "A202",
|
||||
receiverNumber: "2",
|
||||
@@ -77,7 +81,8 @@ class PackageModel extends BaseModel {
|
||||
cargoDesc: "Dietary supplement",
|
||||
id: "PKG2042",
|
||||
arrivedDate: DateTime(2020, 6, 1),
|
||||
receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon',statusHistory: statusHistory),
|
||||
receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon',
|
||||
statusHistory: statusHistory),
|
||||
Package(
|
||||
shipmentNumber: "A202",
|
||||
receiverNumber: "2",
|
||||
@@ -92,7 +97,8 @@ class PackageModel extends BaseModel {
|
||||
status: "Shipped",
|
||||
id: "PKG2043",
|
||||
arrivedDate: DateTime(2020, 6, 1),
|
||||
receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon',statusHistory: statusHistory),
|
||||
receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon',
|
||||
statusHistory: statusHistory),
|
||||
Package(
|
||||
shipmentNumber: "A201",
|
||||
receiverNumber: "1",
|
||||
@@ -107,7 +113,8 @@ class PackageModel extends BaseModel {
|
||||
trackingID: "sdf-asdf-23489",
|
||||
id: "PKG2044",
|
||||
arrivedDate: DateTime(2020, 5, 21),
|
||||
receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon',statusHistory: statusHistory),
|
||||
receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon',
|
||||
statusHistory: statusHistory),
|
||||
Package(
|
||||
shipmentNumber: "A201",
|
||||
receiverNumber: "1",
|
||||
@@ -122,9 +129,17 @@ class PackageModel extends BaseModel {
|
||||
id: "PKG2045",
|
||||
trackingID: "oiuw-sdfpo-234",
|
||||
arrivedDate: DateTime(2020, 5, 21),
|
||||
receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon',statusHistory: statusHistory),
|
||||
receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon',
|
||||
statusHistory: statusHistory),
|
||||
];
|
||||
|
||||
List<Package> get getPackages {
|
||||
return packages
|
||||
..sort((e1, e2) {
|
||||
return e2.packageNumber.compareTo(e1.packageNumber);
|
||||
});
|
||||
}
|
||||
|
||||
List<Package> get completed {
|
||||
return packages.where((e) => e.status == "Processed").toList()
|
||||
..sort((e1, e2) {
|
||||
|
||||
133
lib/pages/discount_editor.dart
Normal file
133
lib/pages/discount_editor.dart
Normal file
@@ -0,0 +1,133 @@
|
||||
import 'package:fcs/model/discount_model.dart';
|
||||
import 'package:fcs/pages/util.dart';
|
||||
import 'package:fcs/vo/discount.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:fcs/widget/localization/app_translations.dart';
|
||||
import 'package:fcs/widget/progress.dart';
|
||||
|
||||
import '../theme/theme.dart';
|
||||
|
||||
class DiscountEditor extends StatefulWidget {
|
||||
final Discount discount;
|
||||
|
||||
const DiscountEditor({Key key, this.discount}) : super(key: key);
|
||||
@override
|
||||
_DiscountEditorState createState() => _DiscountEditorState();
|
||||
}
|
||||
|
||||
class _DiscountEditorState extends State<DiscountEditor> {
|
||||
bool _isLoading = false;
|
||||
Discount _discount = new Discount();
|
||||
TextEditingController _codeController = new TextEditingController();
|
||||
TextEditingController _amountController = new TextEditingController();
|
||||
TextEditingController _statusController = new TextEditingController();
|
||||
TextEditingController _customerController = new TextEditingController();
|
||||
|
||||
bool isNew = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (widget.discount != null) {
|
||||
_discount = widget.discount;
|
||||
_codeController.text = _discount.code;
|
||||
_amountController.text = _discount.amount.toString();
|
||||
_statusController.text = _discount.status;
|
||||
_customerController.text = 'Ko Nyi';
|
||||
} else {
|
||||
isNew = true;
|
||||
_customerController.text = '';
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
AppTranslations.of(context).text("discount.new"),
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
actions: <Widget>[],
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
fcsInput('Code', FontAwesomeIcons.algolia,
|
||||
controller: _codeController),
|
||||
fcsInput('Customer Name', Feather.user,
|
||||
controller: _customerController),
|
||||
fcsInput('Amount', FontAwesomeIcons.moneyBill,
|
||||
controller: _amountController),
|
||||
widget.discount == null
|
||||
? Container()
|
||||
: Container(
|
||||
padding: EdgeInsets.only(top: 5),
|
||||
child: TextFormField(
|
||||
controller: _statusController,
|
||||
readOnly: true,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Status',
|
||||
labelStyle: TextStyle(
|
||||
fontSize: 16, color: primaryColor),
|
||||
filled: true,
|
||||
enabledBorder: InputBorder.none,
|
||||
focusedBorder: InputBorder.none,
|
||||
icon: Icon(
|
||||
Icons.av_timer,
|
||||
color: primaryColor,
|
||||
),
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
widget.discount == null
|
||||
? Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 250,
|
||||
child: FlatButton(
|
||||
child: Text('Add Discount'),
|
||||
color: primaryColor,
|
||||
textColor: Colors.white,
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
)))
|
||||
: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 250,
|
||||
child: FlatButton(
|
||||
child: Text('Save box'),
|
||||
color: primaryColor,
|
||||
textColor: Colors.white,
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
))),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
)
|
||||
],
|
||||
),
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
122
lib/pages/discount_list.dart
Normal file
122
lib/pages/discount_list.dart
Normal file
@@ -0,0 +1,122 @@
|
||||
import 'package:fcs/model/discount_model.dart';
|
||||
import 'package:fcs/pages/discount_editor.dart';
|
||||
import 'package:fcs/pages/util.dart';
|
||||
import 'package:fcs/widget/bottom_up_page_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:fcs/widget/localization/app_translations.dart';
|
||||
import 'package:fcs/widget/progress.dart';
|
||||
|
||||
import '../theme/theme.dart';
|
||||
|
||||
class DiscountList extends StatefulWidget {
|
||||
@override
|
||||
_DiscountListState createState() => _DiscountListState();
|
||||
}
|
||||
|
||||
class _DiscountListState extends State<DiscountList> {
|
||||
bool _isLoading = false;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var discountModel = Provider.of<DiscountModel>(context);
|
||||
print('discounts => ${discountModel.discounts}');
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
AppTranslations.of(context).text("discount.title"),
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
actions: <Widget>[
|
||||
IconButton(
|
||||
icon: Icon(Icons.search),
|
||||
onPressed: () {},
|
||||
)
|
||||
],
|
||||
),
|
||||
body: ListView.separated(
|
||||
separatorBuilder: (context, index) => Divider(
|
||||
color: Colors.black,
|
||||
),
|
||||
itemCount: discountModel.discounts.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
var discount = discountModel.discounts[index];
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
BottomUpPageRoute(DiscountEditor(
|
||||
discount: discount,
|
||||
)),
|
||||
);
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
discount.code,
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
discount.customer,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 15),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
getStatus(discount.status),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 10.0),
|
||||
child: Text(
|
||||
'\$${discount.amount.toString()}',
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 15),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
floatingActionButton: FloatingActionButton.extended(
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
BottomUpPageRoute(DiscountEditor()),
|
||||
);
|
||||
},
|
||||
icon: Icon(Icons.add),
|
||||
label: Text(AppTranslations.of(context).text("discount.new")),
|
||||
backgroundColor: primaryColor,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
import 'package:country_code_picker/country_code.dart';
|
||||
import 'package:fcs/model/main_model.dart';
|
||||
import 'package:fcs/pages/discount_list.dart';
|
||||
import 'package:fcs/pages/payment_method_page.dart';
|
||||
import 'package:fcs/pages/shipment_list.dart';
|
||||
import 'package:fcs/pages_fcs/box_list.dart';
|
||||
import 'package:fcs/pages_fcs/package_list.dart';
|
||||
@@ -174,6 +176,16 @@ class _HomePageState extends State<HomePage> {
|
||||
btnCallback: () =>
|
||||
Navigator.of(context).push(BottomUpPageRoute(InvoiceList())));
|
||||
|
||||
final paymentMethodBtn = _buildBtn2("payment.method.btn",
|
||||
icon: FontAwesomeIcons.creditCard,
|
||||
btnCallback: () =>
|
||||
Navigator.of(context).push(BottomUpPageRoute(PaymentMethodPage())));
|
||||
|
||||
final discountBtn = _buildBtn2("discount.btn",
|
||||
icon: FontAwesomeIcons.percent,
|
||||
btnCallback: () =>
|
||||
Navigator.of(context).push(BottomUpPageRoute(DiscountList())));
|
||||
|
||||
final termBtn = _buildBtn2("term.btn",
|
||||
icon: FontAwesomeIcons.info,
|
||||
btnCallback: () =>
|
||||
@@ -191,6 +203,8 @@ class _HomePageState extends State<HomePage> {
|
||||
customer || owner ? widgets.add(boxesBtn) : "";
|
||||
owner ? widgets.add(customersBtn) : "";
|
||||
customer || owner ? widgets.add(invoicesBtn) : "";
|
||||
customer || owner ? widgets.add(paymentMethodBtn) : "";
|
||||
customer || owner ? widgets.add(discountBtn) : "";
|
||||
widgets.add(termBtn);
|
||||
|
||||
return OfflineRedirect(
|
||||
@@ -318,7 +332,8 @@ class _HomePageState extends State<HomePage> {
|
||||
children: <Widget>[
|
||||
// _buildSmallButton(
|
||||
// "Policies", FontAwesomeIcons.fileContract),
|
||||
_buildSmallButton("Contact Us", SimpleLineIcons.support),
|
||||
_buildSmallButton(
|
||||
"Contact Us", SimpleLineIcons.support),
|
||||
],
|
||||
)
|
||||
],
|
||||
|
||||
108
lib/pages/invoice/box_addition.dart
Normal file
108
lib/pages/invoice/box_addition.dart
Normal file
@@ -0,0 +1,108 @@
|
||||
import 'package:fcs/model_fcs/box_model.dart';
|
||||
import 'package:fcs/model_fcs/package_model.dart';
|
||||
import 'package:fcs/theme/theme.dart';
|
||||
import 'package:fcs/vo/box.dart';
|
||||
import 'package:fcs/widget/localization/app_translations.dart';
|
||||
import 'package:fcs/widget/progress.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class BoxAddition extends StatefulWidget {
|
||||
final Box box;
|
||||
BoxAddition({this.box});
|
||||
|
||||
@override
|
||||
_BoxAdditionState createState() => _BoxAdditionState();
|
||||
}
|
||||
|
||||
class _BoxAdditionState extends State<BoxAddition> {
|
||||
Box _box = new Box();
|
||||
bool _isLoading = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (widget.box != null) {
|
||||
_box = widget.box;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var boxModel = Provider.of<BoxModel>(context);
|
||||
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("box.edit.title")),
|
||||
),
|
||||
body: Card(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: ListView(children: <Widget>[
|
||||
DropdownButtonFormField(
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Box Number',
|
||||
icon: Icon(Icons.pages)),
|
||||
items: boxModel.processed
|
||||
.map((e) => DropdownMenuItem(
|
||||
child: Text('${e.shipmentNumber}-${e.receiverNumber} #${e.boxNumber}'), value: e))
|
||||
.toList(),
|
||||
onChanged: (map) => {},
|
||||
),
|
||||
]),
|
||||
)),
|
||||
widget.box == null
|
||||
? Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 250,
|
||||
child: FlatButton(
|
||||
child: Text('Add box'),
|
||||
color: primaryColor,
|
||||
textColor: Colors.white,
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
)))
|
||||
: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 250,
|
||||
child: FlatButton(
|
||||
child: Text('Save box'),
|
||||
color: primaryColor,
|
||||
textColor: Colors.white,
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
))),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,10 @@
|
||||
import 'package:fcs/model/discount_model.dart';
|
||||
import 'package:fcs/model/main_model.dart';
|
||||
import 'package:fcs/model_fcs/box_model.dart';
|
||||
import 'package:fcs/pages/invoice/package_addition.dart';
|
||||
import 'package:fcs/theme/theme.dart';
|
||||
import 'package:fcs/vo/box.dart';
|
||||
import 'package:fcs/vo/cargo.dart';
|
||||
import 'package:fcs/vo/invoice.dart';
|
||||
import 'package:fcs/vo/package.dart';
|
||||
import 'package:fcs/widget/bottom_up_page_route.dart';
|
||||
@@ -17,6 +21,7 @@ import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../util.dart';
|
||||
import 'box_addition.dart';
|
||||
|
||||
class InvoiceEditor extends StatefulWidget {
|
||||
final Invoice invoice;
|
||||
@@ -39,7 +44,9 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
|
||||
Invoice _invoice;
|
||||
bool _isLoading = false;
|
||||
List<Package> _packages = [];
|
||||
List<Box> _boxes = [];
|
||||
bool isSwitched = false;
|
||||
String deliveryfee = '\$0';
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -52,33 +59,56 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
_phoneController.text = _invoice.customerPhoneNumber;
|
||||
_amountController.text = _invoice.getAmount.toString();
|
||||
_statusController.text = _invoice.status.toString();
|
||||
_packages = _invoice.packages;
|
||||
} else {
|
||||
_packages = [
|
||||
Package(
|
||||
// _boxes = _invoice.packages;
|
||||
} else {}
|
||||
|
||||
_boxes = [
|
||||
Box(
|
||||
shipmentNumber: "A202",
|
||||
receiverNumber: "3",
|
||||
receiverName: "Ko Myo Min",
|
||||
boxNumber: "1",
|
||||
rate: 7,
|
||||
packageType: "General",
|
||||
weight: 25,
|
||||
status: "Received",
|
||||
weight: 75,
|
||||
status: "Packed",
|
||||
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon',
|
||||
cargoDesc: "Clothes",
|
||||
arrivedDate: DateTime(2020, 6, 1),
|
||||
),
|
||||
Package(
|
||||
width: 10,
|
||||
height: 10,
|
||||
length: 10,
|
||||
// packages: packages,
|
||||
// statusHistory: statusHistory,
|
||||
cargoTypes: [
|
||||
Cargo(type: 'General Cargo', weight: 25),
|
||||
Cargo(type: 'Medicine', weight: 20),
|
||||
Cargo(type: 'Dangerous Cargo', weight: 30)
|
||||
]),
|
||||
Box(
|
||||
shipmentNumber: "A202",
|
||||
receiverNumber: "3",
|
||||
receiverName: "Ko Myo Min",
|
||||
boxNumber: "2",
|
||||
rate: 7,
|
||||
packageType: "General",
|
||||
weight: 20,
|
||||
status: "Received",
|
||||
weight: 75,
|
||||
status: "Packed",
|
||||
cargoDesc: "Clothes",
|
||||
arrivedDate: DateTime(2020, 6, 1),
|
||||
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon'),
|
||||
width: 10,
|
||||
height: 10,
|
||||
length: 10,
|
||||
// statusHistory: statusHistory,
|
||||
// packages: packages,
|
||||
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon',
|
||||
cargoTypes: [
|
||||
Cargo(type: 'General Cargo', weight: 25),
|
||||
Cargo(type: 'Medicine', weight: 20),
|
||||
Cargo(type: 'Dangerous Cargo', weight: 30)
|
||||
])
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
@@ -88,6 +118,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var mainModel = Provider.of<MainModel>(context);
|
||||
var discountModel = Provider.of<DiscountModel>(context);
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
@@ -170,8 +201,8 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Customer Name',
|
||||
labelStyle:
|
||||
TextStyle(fontSize: 16, color: primaryColor),
|
||||
labelStyle: TextStyle(
|
||||
fontSize: 16, color: primaryColor),
|
||||
filled: true,
|
||||
enabledBorder: InputBorder.none,
|
||||
focusedBorder: InputBorder.none,
|
||||
@@ -199,31 +230,131 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
// color: Colors.grey,
|
||||
// ),
|
||||
// )),
|
||||
Container(
|
||||
// Container(
|
||||
// padding: EdgeInsets.only(top: 0),
|
||||
// child: fcsInput('Amount', FontAwesomeIcons.moneyBill,
|
||||
// controller: _amountController),
|
||||
// ),
|
||||
|
||||
widget.invoice == null
|
||||
? Container()
|
||||
: Container(
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
child: fcsInput('Amount', FontAwesomeIcons.moneyBill,
|
||||
controller: _amountController),
|
||||
child: TextFormField(
|
||||
controller: _amountController,
|
||||
readOnly: true,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Amount',
|
||||
labelStyle: TextStyle(
|
||||
fontSize: 16, color: primaryColor),
|
||||
filled: true,
|
||||
enabledBorder: InputBorder.none,
|
||||
focusedBorder: InputBorder.none,
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.moneyBill,
|
||||
color: primaryColor,
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 5),
|
||||
child: fcsInput('Discount', FontAwesomeIcons.tag,
|
||||
controller: _discountController),
|
||||
)),
|
||||
),
|
||||
|
||||
widget.invoice == null
|
||||
? Container()
|
||||
: Container(
|
||||
padding: EdgeInsets.only(top: 5),
|
||||
child: TextFormField(
|
||||
controller: _statusController,
|
||||
readOnly: true,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Status',
|
||||
labelStyle: TextStyle(
|
||||
fontSize: 16, color: primaryColor),
|
||||
filled: true,
|
||||
icon: Icon(Icons.av_timer,color: primaryColor,),
|
||||
enabledBorder: InputBorder.none,
|
||||
focusedBorder: InputBorder.none,
|
||||
icon: Icon(
|
||||
Icons.av_timer,
|
||||
color: primaryColor,
|
||||
),
|
||||
)),
|
||||
),
|
||||
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 20, left: 18),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Text('Discounts',
|
||||
style: TextStyle(fontSize: 16))),
|
||||
Container(
|
||||
width: 150.0,
|
||||
child: DropdownButtonFormField(
|
||||
items: discountModel.discounts
|
||||
.map((e) => DropdownMenuItem(
|
||||
child: Text(e.code), value: e.code))
|
||||
.toList(),
|
||||
onChanged: (selected) => {},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 5, left: 18),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Text('Payment Method',
|
||||
style: TextStyle(fontSize: 16))),
|
||||
Container(
|
||||
width: 150.0,
|
||||
child: DropdownButtonFormField(
|
||||
items: mainModel.paymentMethods
|
||||
.map((e) => DropdownMenuItem(
|
||||
child: Text(e.name), value: e.name))
|
||||
.toList(),
|
||||
onChanged: (selected) => {},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 5),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 18.0),
|
||||
child: Text(
|
||||
'Delivery fee:',
|
||||
style: TextStyle(fontSize: 16),
|
||||
),
|
||||
)),
|
||||
Switch(
|
||||
value: isSwitched,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
isSwitched = value;
|
||||
if (value) {
|
||||
deliveryfee = '\$5';
|
||||
} else {
|
||||
deliveryfee = '\$0';
|
||||
}
|
||||
print(isSwitched);
|
||||
});
|
||||
},
|
||||
activeTrackColor: primaryColor.withOpacity(0.8),
|
||||
activeColor: primaryColor,
|
||||
),
|
||||
Text('(Delivery fee : $deliveryfee)',style: TextStyle(color: primaryColor,fontWeight: FontWeight.bold),),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
height: 10,
|
||||
),
|
||||
ExpansionTile(
|
||||
title: Text('Payment Attachment'),
|
||||
@@ -249,7 +380,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
],
|
||||
),
|
||||
ExpansionTile(
|
||||
title: Text('Package Information'),
|
||||
title: Text('Box Information'),
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: SingleChildScrollView(
|
||||
@@ -261,55 +392,63 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
MyDataColumn(
|
||||
label: LocalText(
|
||||
context,
|
||||
"package.number",
|
||||
"box.number",
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
MyDataColumn(
|
||||
label: LocalText(
|
||||
context,
|
||||
"package.rate",
|
||||
"box.length",
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
MyDataColumn(
|
||||
label: LocalText(
|
||||
context,
|
||||
"package.weight",
|
||||
"box.width",
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
MyDataColumn(
|
||||
label: LocalText(
|
||||
context,
|
||||
"package.amount",
|
||||
"box.height",
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
],
|
||||
rows: getPackageRow(context),
|
||||
rows: getBoxRow(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
mainModel.isOwner()?Container(
|
||||
mainModel.isOwner()
|
||||
? 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_package")),
|
||||
.text("invoice.add_box")),
|
||||
backgroundColor: primaryColor,
|
||||
onPressed: () {
|
||||
Navigator.of(context)
|
||||
.push(BottomUpPageRoute(PackageAddition()));
|
||||
.push(BottomUpPageRoute(BoxAddition()));
|
||||
},
|
||||
),
|
||||
),
|
||||
):Container(),
|
||||
)
|
||||
: Container(),
|
||||
SizedBox(height: 25),
|
||||
],
|
||||
),
|
||||
|
||||
//Cargo Table
|
||||
ExpansionTile(
|
||||
title: Text('Cargo Table'),
|
||||
children: getCargoTableByBox(context),
|
||||
),
|
||||
]),
|
||||
)),
|
||||
widget.invoice == null
|
||||
@@ -327,7 +466,9 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
},
|
||||
),
|
||||
)))
|
||||
:mainModel.isCustomer()?Container():Container(
|
||||
: mainModel.isCustomer()
|
||||
? Container()
|
||||
: Container(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Align(
|
||||
@@ -369,25 +510,120 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
);
|
||||
}
|
||||
|
||||
List<MyDataRow> getPackageRow(BuildContext context) {
|
||||
return _packages.map((p) {
|
||||
getCargoTableByBox(BuildContext context) {
|
||||
return _boxes.map((b) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Colors.grey[100],
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Container(
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: MyDataTable(
|
||||
headingRowHeight: 40,
|
||||
columnSpacing: 20,
|
||||
columns: [
|
||||
MyDataColumn(
|
||||
label: LocalText(
|
||||
context,
|
||||
"cargo.type",
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
MyDataColumn(
|
||||
label: LocalText(
|
||||
context,
|
||||
"cargo.weight",
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
MyDataColumn(
|
||||
label: LocalText(
|
||||
context,
|
||||
"cargo.rate",
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
MyDataColumn(
|
||||
label: LocalText(
|
||||
context,
|
||||
"cargo.amount",
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
],
|
||||
rows: getCargoDataRow(context, b),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList();
|
||||
}
|
||||
|
||||
List<MyDataRow> getBoxRow(BuildContext context) {
|
||||
return _boxes.map((p) {
|
||||
return MyDataRow(
|
||||
onSelectChanged: (bool selected) {},
|
||||
cells: [
|
||||
MyDataCell(new Text(
|
||||
p.packageNumber == null ? "" : p.packageNumber,
|
||||
p.boxNumber == null
|
||||
? ""
|
||||
: '${p.shipmentNumber}-${p.receiverNumber} #${p.boxNumber}',
|
||||
style: textStyle,
|
||||
)),
|
||||
MyDataCell(new Text(
|
||||
p.length == null ? "" : p.length.toString(),
|
||||
style: textStyle,
|
||||
)),
|
||||
MyDataCell(new Text(
|
||||
p.width == null ? "" : p.width.toString(),
|
||||
style: textStyle,
|
||||
)),
|
||||
MyDataCell(new Text(
|
||||
p.height == null ? "" : p.height.toString(),
|
||||
style: textStyle,
|
||||
)),
|
||||
],
|
||||
);
|
||||
}).toList();
|
||||
}
|
||||
|
||||
List<MyDataRow> getCargoDataRow(BuildContext context, Box box) {
|
||||
var rate = 5;
|
||||
return box.cargoTypes.map((p) {
|
||||
rate++;
|
||||
var amt = p.weight * rate;
|
||||
return MyDataRow(
|
||||
onSelectChanged: (bool selected) {},
|
||||
cells: [
|
||||
MyDataCell(new Text(
|
||||
p.type,
|
||||
style: textStyle,
|
||||
)),
|
||||
MyDataCell(new Text(
|
||||
p.weight.toString(),
|
||||
style: textStyle,
|
||||
)),
|
||||
MyDataCell(new Text(
|
||||
'\$${rate}',
|
||||
style: textStyle,
|
||||
)),
|
||||
MyDataCell(new Text(
|
||||
"\$$amt",
|
||||
style: textStyle,
|
||||
)),
|
||||
MyDataCell(
|
||||
new Text(p.rate.toString(), style: textStyle),
|
||||
),
|
||||
MyDataCell(
|
||||
new Text("${p.weight.toString()} lb", style: textStyle),
|
||||
),
|
||||
MyDataCell(
|
||||
new Text(p.price == null ? "" : "\$ " + p.price.toString(),
|
||||
style: textStyle),
|
||||
),
|
||||
],
|
||||
);
|
||||
}).toList();
|
||||
|
||||
120
lib/pages/payment_editor.dart
Normal file
120
lib/pages/payment_editor.dart
Normal file
@@ -0,0 +1,120 @@
|
||||
import 'package:fcs/model/discount_model.dart';
|
||||
import 'package:fcs/pages/util.dart';
|
||||
import 'package:fcs/vo/discount.dart';
|
||||
import 'package:fcs/vo/payment_method.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:fcs/widget/localization/app_translations.dart';
|
||||
import 'package:fcs/widget/progress.dart';
|
||||
|
||||
import '../theme/theme.dart';
|
||||
|
||||
class PaymentMethodEditor extends StatefulWidget {
|
||||
final PaymentMethod paymentMethod;
|
||||
|
||||
const PaymentMethodEditor({Key key, this.paymentMethod}) : super(key: key);
|
||||
@override
|
||||
_PaymentMethodEditorState createState() => _PaymentMethodEditorState();
|
||||
}
|
||||
|
||||
class _PaymentMethodEditorState extends State<PaymentMethodEditor> {
|
||||
bool _isLoading = false;
|
||||
PaymentMethod _paymentMethod = new PaymentMethod();
|
||||
TextEditingController _nameController = new TextEditingController();
|
||||
TextEditingController _accountNameController = new TextEditingController();
|
||||
TextEditingController _accountNumberController = new TextEditingController();
|
||||
TextEditingController _mailController = new TextEditingController();
|
||||
TextEditingController _phoneController = new TextEditingController();
|
||||
|
||||
bool isNew = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (widget.paymentMethod != null) {
|
||||
_paymentMethod = widget.paymentMethod;
|
||||
_nameController.text = _paymentMethod.name;
|
||||
_accountNameController.text = _paymentMethod.accountName;
|
||||
_accountNumberController.text = _paymentMethod.account;
|
||||
_mailController.text = _paymentMethod.mail;
|
||||
_phoneController.text = _paymentMethod.phone;
|
||||
} else {
|
||||
isNew = true;
|
||||
_nameController.text = '';
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var discountModel = Provider.of<DiscountModel>(context);
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
AppTranslations.of(context).text("payment.method.new"),
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
actions: <Widget>[],
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
fcsInput('Name', FontAwesomeIcons.algolia,
|
||||
controller: _nameController),
|
||||
fcsInput('Account Name', Feather.user,
|
||||
controller: _accountNameController),
|
||||
fcsInput('Account Number', FontAwesomeIcons.moneyBill,
|
||||
controller: _accountNumberController),
|
||||
fcsInput('E-mail', Icons.mail,
|
||||
controller: _mailController),
|
||||
fcsInput('Phone', Icons.phone,
|
||||
controller: _phoneController)
|
||||
],
|
||||
),
|
||||
),
|
||||
widget.paymentMethod == null
|
||||
? Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 250,
|
||||
child: FlatButton(
|
||||
child: Text('Add Payment Method'),
|
||||
color: primaryColor,
|
||||
textColor: Colors.white,
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
)))
|
||||
: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 250,
|
||||
child: FlatButton(
|
||||
child: Text('Save Payment Method'),
|
||||
color: primaryColor,
|
||||
textColor: Colors.white,
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
))),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
)
|
||||
],
|
||||
),
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
169
lib/pages/payment_method_page.dart
Normal file
169
lib/pages/payment_method_page.dart
Normal file
@@ -0,0 +1,169 @@
|
||||
import 'package:fcs/pages/payment_editor.dart';
|
||||
import 'package:fcs/widget/bottom_up_page_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:fcs/model/main_model.dart';
|
||||
import 'package:fcs/widget/localization/app_translations.dart';
|
||||
import 'package:fcs/widget/progress.dart';
|
||||
|
||||
import '../theme/theme.dart';
|
||||
|
||||
class PaymentMethodPage extends StatefulWidget {
|
||||
@override
|
||||
_PaymentMethodPageState createState() => _PaymentMethodPageState();
|
||||
}
|
||||
|
||||
class _PaymentMethodPageState extends State<PaymentMethodPage> {
|
||||
bool _isLoading = false;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
MainModel mainModel = Provider.of<MainModel>(context);
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
AppTranslations.of(context).text("payment.method.title"),
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
actions: <Widget>[],
|
||||
),
|
||||
body: ListView.separated(
|
||||
separatorBuilder: (context, index) => Divider(
|
||||
color: Colors.black,
|
||||
),
|
||||
itemCount: mainModel.paymentMethods.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
var method = mainModel.paymentMethods[index];
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
BottomUpPageRoute(PaymentMethodEditor(
|
||||
paymentMethod: method,
|
||||
)),
|
||||
);
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
method.name,
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 18),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0, top: 8.0),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
// Text(
|
||||
// 'Account Name: ',
|
||||
// style: TextStyle(
|
||||
// color: Colors.black,
|
||||
// fontWeight: FontWeight.normal,
|
||||
// fontSize: 15),
|
||||
// ),
|
||||
Text(
|
||||
method.accountName,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 15),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0, top: 8.0),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
// Text(
|
||||
// 'Account Number: ',
|
||||
// style: TextStyle(
|
||||
// color: Colors.black,
|
||||
// fontWeight: FontWeight.normal,
|
||||
// fontSize: 15),
|
||||
// ),
|
||||
Text(
|
||||
method.account,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 15),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0, top: 8.0),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
// Text(
|
||||
// 'Email: ',
|
||||
// style: TextStyle(
|
||||
// color: Colors.black,
|
||||
// fontWeight: FontWeight.normal,
|
||||
// fontSize: 15),
|
||||
// ),
|
||||
Text(
|
||||
method.mail,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 15),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0, top: 8.0),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
// Text(
|
||||
// 'Phone: ',
|
||||
// style: TextStyle(
|
||||
// color: Colors.black,
|
||||
// fontWeight: FontWeight.normal,
|
||||
// fontSize: 15),
|
||||
// ),
|
||||
Text(
|
||||
method.phone,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 15),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
floatingActionButton: FloatingActionButton.extended(
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
BottomUpPageRoute(PaymentMethodEditor()),
|
||||
);
|
||||
},
|
||||
icon: Icon(Icons.add),
|
||||
label: Text(AppTranslations.of(context).text("discount.new")),
|
||||
backgroundColor: primaryColor,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -268,11 +268,18 @@ Widget getStatus(String status) {
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold),
|
||||
)
|
||||
: status == "Delivered"
|
||||
: status == "Delivered" || status == "Avaliable"
|
||||
? Text(
|
||||
status,
|
||||
style: TextStyle(
|
||||
color: Colors.green, fontSize: 12),
|
||||
color: Colors.green, fontSize: 18),
|
||||
)
|
||||
: status == "Used"
|
||||
? Text(
|
||||
status,
|
||||
style: TextStyle(
|
||||
color: Colors.red,
|
||||
fontSize: 18),
|
||||
)
|
||||
: status == "Paid"
|
||||
? Row(
|
||||
@@ -287,7 +294,8 @@ Widget getStatus(String status) {
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold),
|
||||
fontWeight:
|
||||
FontWeight.bold),
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
@@ -37,10 +37,10 @@ class _PackageListState extends State<PackageList> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var packageModel = Provider.of<PackageModel>(context);
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: DefaultTabController(
|
||||
length: 5,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
@@ -73,23 +73,6 @@ class _PackageListState extends State<PackageList> {
|
||||
onPressed: () => showPlacesSearch(context),
|
||||
),
|
||||
],
|
||||
bottom: TabBar(
|
||||
dragStartBehavior: DragStartBehavior.start,
|
||||
unselectedLabelColor: Colors.grey,
|
||||
tabs: [
|
||||
Tab(
|
||||
text: "Received",
|
||||
),
|
||||
Tab(text: "Processed"),
|
||||
Tab(
|
||||
text: "Shipped",
|
||||
),
|
||||
Tab(text: "Arrived"),
|
||||
Tab(
|
||||
text: "Delivered",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton.extended(
|
||||
onPressed: () {
|
||||
@@ -99,16 +82,20 @@ class _PackageListState extends State<PackageList> {
|
||||
label: Text(AppTranslations.of(context).text("package.new")),
|
||||
backgroundColor: primaryColor,
|
||||
),
|
||||
body: TabBarView(
|
||||
children: [
|
||||
_upComing(),
|
||||
_completed(),
|
||||
_shipped(),
|
||||
_arrived(),
|
||||
_delivered(),
|
||||
],
|
||||
)),
|
||||
body: new ListView.separated(
|
||||
separatorBuilder: (context, index) => Divider(
|
||||
color: Colors.black,
|
||||
),
|
||||
scrollDirection: Axis.vertical,
|
||||
padding: EdgeInsets.only(top: 15),
|
||||
shrinkWrap: true,
|
||||
itemCount: packageModel.getPackages.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return PackageListRow(
|
||||
package: packageModel.getPackages[index],
|
||||
isReadOnly: false,
|
||||
);
|
||||
})),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
8
lib/vo/discount.dart
Normal file
8
lib/vo/discount.dart
Normal file
@@ -0,0 +1,8 @@
|
||||
class Discount {
|
||||
String code;
|
||||
String customer;
|
||||
String status;
|
||||
double amount;
|
||||
|
||||
Discount({this.code, this.customer, this.amount, this.status});
|
||||
}
|
||||
10
lib/vo/payment_method.dart
Normal file
10
lib/vo/payment_method.dart
Normal file
@@ -0,0 +1,10 @@
|
||||
class PaymentMethod {
|
||||
String name;
|
||||
String accountName;
|
||||
String account;
|
||||
String phone;
|
||||
String mail;
|
||||
|
||||
PaymentMethod(
|
||||
{this.name, this.accountName, this.account, this.phone, this.mail});
|
||||
}
|
||||
Reference in New Issue
Block a user