Merge branch 'master' of phyothandar/fcs into master
This commit is contained in:
@@ -519,6 +519,8 @@
|
|||||||
"cargo.form.title":"CARGO",
|
"cargo.form.title":"CARGO",
|
||||||
"cargo.type":"Cargo Type",
|
"cargo.type":"Cargo Type",
|
||||||
"cargo.weight":"Weight",
|
"cargo.weight":"Weight",
|
||||||
|
"cargo.rate":"Rate",
|
||||||
|
"cargo.amount":"Amount",
|
||||||
|
|
||||||
"boxes.name":"Boxes",
|
"boxes.name":"Boxes",
|
||||||
"boxes.title":"BOXES",
|
"boxes.title":"BOXES",
|
||||||
@@ -528,6 +530,10 @@
|
|||||||
"box.package.desc":"Description",
|
"box.package.desc":"Description",
|
||||||
"box.package.market":"Market",
|
"box.package.market":"Market",
|
||||||
"box.add_package":"Add Package",
|
"box.add_package":"Add Package",
|
||||||
|
"box.number":"Box Number",
|
||||||
|
"box.length":"Length",
|
||||||
|
"box.width":"Width",
|
||||||
|
"box.height":"Height",
|
||||||
|
|
||||||
"package.name":"Packages",
|
"package.name":"Packages",
|
||||||
"package.title":"PACKAGES",
|
"package.title":"PACKAGES",
|
||||||
@@ -579,5 +585,14 @@
|
|||||||
"payment.receipt":"Payment Receipt Amount",
|
"payment.receipt":"Payment Receipt Amount",
|
||||||
"payment.attachment":"Payment Attachment",
|
"payment.attachment":"Payment Attachment",
|
||||||
"pdf_view.title":"Payment File",
|
"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.form.title":"ကုန်ပစ္စည်းအမျိုးအစား",
|
||||||
"cargo.type":"ကုန်ပစ္စည်းအမျိုးအစား",
|
"cargo.type":"ကုန်ပစ္စည်းအမျိုးအစား",
|
||||||
"cargo.weight":"အလေးချိန်",
|
"cargo.weight":"အလေးချိန်",
|
||||||
|
"cargo.rate":"အဆင့်",
|
||||||
|
"cargo.amount":"ပမာဏ",
|
||||||
|
|
||||||
"message.btn":"အသိပေးချက်များ",
|
"message.btn":"အသိပေးချက်များ",
|
||||||
"message.title":"အသိပေးချက်များ",
|
"message.title":"အသိပေးချက်များ",
|
||||||
@@ -600,5 +602,13 @@
|
|||||||
"payment.receipt":"ပေးချေပြီးပမာဏများ",
|
"payment.receipt":"ပေးချေပြီးပမာဏများ",
|
||||||
"payment.attachment":"ပေးချေပြီးဖိုင်များ",
|
"payment.attachment":"ပေးချေပြီးဖိုင်များ",
|
||||||
"pdf_view.title":"ပေးဆောင်ခြင်းဖိုင်",
|
"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/shipment_model.dart';
|
||||||
import 'package:fcs/model_fcs/message_model.dart';
|
import 'package:fcs/model_fcs/message_model.dart';
|
||||||
import 'package:fcs/model_fcs/package_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 MessageModel messageModel = new MessageModel();
|
||||||
final InvoiceModel invoiceModel = new InvoiceModel();
|
final InvoiceModel invoiceModel = new InvoiceModel();
|
||||||
final CustomerModel customerModel = new CustomerModel();
|
final CustomerModel customerModel = new CustomerModel();
|
||||||
|
final DiscountModel discountModel = new DiscountModel();
|
||||||
|
|
||||||
AppTranslationsDelegate _newLocaleDelegate;
|
AppTranslationsDelegate _newLocaleDelegate;
|
||||||
|
|
||||||
@@ -115,7 +117,8 @@ class _AppState extends State<App> {
|
|||||||
..addModel(messageModel)
|
..addModel(messageModel)
|
||||||
..addModel(shipmentRateModel)
|
..addModel(shipmentRateModel)
|
||||||
..addModel(invoiceModel)
|
..addModel(invoiceModel)
|
||||||
..addModel(customerModel);
|
..addModel(customerModel)
|
||||||
|
..addModel(discountModel);
|
||||||
this.mainModel.init();
|
this.mainModel.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,6 +176,7 @@ class _AppState extends State<App> {
|
|||||||
ChangeNotifierProvider(builder: (context) => messageModel),
|
ChangeNotifierProvider(builder: (context) => messageModel),
|
||||||
ChangeNotifierProvider(builder: (context) => invoiceModel),
|
ChangeNotifierProvider(builder: (context) => invoiceModel),
|
||||||
ChangeNotifierProvider(builder: (context) => customerModel),
|
ChangeNotifierProvider(builder: (context) => customerModel),
|
||||||
|
ChangeNotifierProvider(builder: (context) => discountModel),
|
||||||
ChangeNotifierProvider(
|
ChangeNotifierProvider(
|
||||||
builder: (context) => testModel,
|
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:cloud_firestore/cloud_firestore.dart';
|
||||||
import 'package:device_info/device_info.dart';
|
import 'package:device_info/device_info.dart';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:fcs/vo/payment_method.dart';
|
||||||
import 'package:firebase_auth/firebase_auth.dart';
|
import 'package:firebase_auth/firebase_auth.dart';
|
||||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
@@ -81,6 +82,30 @@ class MainModel extends ChangeNotifier {
|
|||||||
_loadFcs();
|
_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 {
|
_loadFcs() async {
|
||||||
user = await SharedPref.getUser();
|
user = await SharedPref.getUser();
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|||||||
@@ -266,6 +266,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 {
|
List<Box> get upcoming {
|
||||||
return boxes
|
return boxes
|
||||||
.where((e) =>
|
.where((e) =>
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ class PackageModel extends BaseModel {
|
|||||||
Status(status: "Arrived", date: DateTime(2020, 6, 7), done: false),
|
Status(status: "Arrived", date: DateTime(2020, 6, 7), done: false),
|
||||||
Status(status: "Delivered", date: DateTime(2020, 6, 15), done: false)
|
Status(status: "Delivered", date: DateTime(2020, 6, 15), done: false)
|
||||||
];
|
];
|
||||||
|
|
||||||
static List<Package> packages = [
|
static List<Package> packages = [
|
||||||
Package(
|
Package(
|
||||||
shipmentNumber: "A202",
|
shipmentNumber: "A202",
|
||||||
@@ -32,7 +33,8 @@ class PackageModel extends BaseModel {
|
|||||||
arrivedDate: DateTime(2020, 6, 1),
|
arrivedDate: DateTime(2020, 6, 1),
|
||||||
market: "Amazon",
|
market: "Amazon",
|
||||||
id: "PKG2039",
|
id: "PKG2039",
|
||||||
trackingID: "23-234s-asdfl",statusHistory: statusHistory),
|
trackingID: "23-234s-asdfl",
|
||||||
|
statusHistory: statusHistory),
|
||||||
Package(
|
Package(
|
||||||
shipmentNumber: "A202",
|
shipmentNumber: "A202",
|
||||||
receiverNumber: "3",
|
receiverNumber: "3",
|
||||||
@@ -47,7 +49,8 @@ class PackageModel extends BaseModel {
|
|||||||
market: "Macy",
|
market: "Macy",
|
||||||
trackingID: "asd-sdf-23498",
|
trackingID: "asd-sdf-23498",
|
||||||
id: "PKG2040",
|
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(
|
Package(
|
||||||
shipmentNumber: "A202",
|
shipmentNumber: "A202",
|
||||||
receiverNumber: "3",
|
receiverNumber: "3",
|
||||||
@@ -62,7 +65,8 @@ class PackageModel extends BaseModel {
|
|||||||
trackingID: "8923-234-sd",
|
trackingID: "8923-234-sd",
|
||||||
id: "PKG2041",
|
id: "PKG2041",
|
||||||
arrivedDate: DateTime(2020, 6, 1),
|
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(
|
Package(
|
||||||
shipmentNumber: "A202",
|
shipmentNumber: "A202",
|
||||||
receiverNumber: "2",
|
receiverNumber: "2",
|
||||||
@@ -77,7 +81,8 @@ class PackageModel extends BaseModel {
|
|||||||
cargoDesc: "Dietary supplement",
|
cargoDesc: "Dietary supplement",
|
||||||
id: "PKG2042",
|
id: "PKG2042",
|
||||||
arrivedDate: DateTime(2020, 6, 1),
|
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(
|
Package(
|
||||||
shipmentNumber: "A202",
|
shipmentNumber: "A202",
|
||||||
receiverNumber: "2",
|
receiverNumber: "2",
|
||||||
@@ -92,7 +97,8 @@ class PackageModel extends BaseModel {
|
|||||||
status: "Shipped",
|
status: "Shipped",
|
||||||
id: "PKG2043",
|
id: "PKG2043",
|
||||||
arrivedDate: DateTime(2020, 6, 1),
|
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(
|
Package(
|
||||||
shipmentNumber: "A201",
|
shipmentNumber: "A201",
|
||||||
receiverNumber: "1",
|
receiverNumber: "1",
|
||||||
@@ -107,7 +113,8 @@ class PackageModel extends BaseModel {
|
|||||||
trackingID: "sdf-asdf-23489",
|
trackingID: "sdf-asdf-23489",
|
||||||
id: "PKG2044",
|
id: "PKG2044",
|
||||||
arrivedDate: DateTime(2020, 5, 21),
|
arrivedDate: DateTime(2020, 5, 21),
|
||||||
receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon',statusHistory: statusHistory),
|
receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon',
|
||||||
|
statusHistory: statusHistory),
|
||||||
Package(
|
Package(
|
||||||
shipmentNumber: "A201",
|
shipmentNumber: "A201",
|
||||||
receiverNumber: "1",
|
receiverNumber: "1",
|
||||||
@@ -122,9 +129,17 @@ class PackageModel extends BaseModel {
|
|||||||
id: "PKG2045",
|
id: "PKG2045",
|
||||||
trackingID: "oiuw-sdfpo-234",
|
trackingID: "oiuw-sdfpo-234",
|
||||||
arrivedDate: DateTime(2020, 5, 21),
|
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 {
|
List<Package> get completed {
|
||||||
return packages.where((e) => e.status == "Processed").toList()
|
return packages.where((e) => e.status == "Processed").toList()
|
||||||
..sort((e1, e2) {
|
..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:country_code_picker/country_code.dart';
|
||||||
import 'package:fcs/model/main_model.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/shipment_list.dart';
|
||||||
import 'package:fcs/pages_fcs/box_list.dart';
|
import 'package:fcs/pages_fcs/box_list.dart';
|
||||||
import 'package:fcs/pages_fcs/delivery_list.dart';
|
import 'package:fcs/pages_fcs/delivery_list.dart';
|
||||||
@@ -175,6 +177,16 @@ class _HomePageState extends State<HomePage> {
|
|||||||
btnCallback: () =>
|
btnCallback: () =>
|
||||||
Navigator.of(context).push(BottomUpPageRoute(InvoiceList())));
|
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",
|
final termBtn = _buildBtn2("term.btn",
|
||||||
icon: FontAwesomeIcons.info,
|
icon: FontAwesomeIcons.info,
|
||||||
btnCallback: () =>
|
btnCallback: () =>
|
||||||
@@ -197,6 +209,8 @@ class _HomePageState extends State<HomePage> {
|
|||||||
owner ? widgets.add(deliveryBtn) : "";
|
owner ? widgets.add(deliveryBtn) : "";
|
||||||
owner ? widgets.add(customersBtn) : "";
|
owner ? widgets.add(customersBtn) : "";
|
||||||
customer || owner ? widgets.add(invoicesBtn) : "";
|
customer || owner ? widgets.add(invoicesBtn) : "";
|
||||||
|
customer || owner ? widgets.add(paymentMethodBtn) : "";
|
||||||
|
customer || owner ? widgets.add(discountBtn) : "";
|
||||||
widgets.add(termBtn);
|
widgets.add(termBtn);
|
||||||
|
|
||||||
return OfflineRedirect(
|
return OfflineRedirect(
|
||||||
|
|||||||
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/main_model.dart';
|
||||||
|
import 'package:fcs/model_fcs/box_model.dart';
|
||||||
import 'package:fcs/pages/invoice/package_addition.dart';
|
import 'package:fcs/pages/invoice/package_addition.dart';
|
||||||
import 'package:fcs/theme/theme.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/invoice.dart';
|
||||||
import 'package:fcs/vo/package.dart';
|
import 'package:fcs/vo/package.dart';
|
||||||
import 'package:fcs/widget/bottom_up_page_route.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 'package:provider/provider.dart';
|
||||||
|
|
||||||
import '../util.dart';
|
import '../util.dart';
|
||||||
|
import 'box_addition.dart';
|
||||||
|
|
||||||
class InvoiceEditor extends StatefulWidget {
|
class InvoiceEditor extends StatefulWidget {
|
||||||
final Invoice invoice;
|
final Invoice invoice;
|
||||||
@@ -39,7 +44,9 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
|||||||
|
|
||||||
Invoice _invoice;
|
Invoice _invoice;
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
List<Package> _packages = [];
|
List<Box> _boxes = [];
|
||||||
|
bool isSwitched = false;
|
||||||
|
String deliveryfee = '\$0';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -52,32 +59,55 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
|||||||
_phoneController.text = _invoice.customerPhoneNumber;
|
_phoneController.text = _invoice.customerPhoneNumber;
|
||||||
_amountController.text = _invoice.getAmount.toString();
|
_amountController.text = _invoice.getAmount.toString();
|
||||||
_statusController.text = _invoice.status.toString();
|
_statusController.text = _invoice.status.toString();
|
||||||
_packages = _invoice.packages;
|
// _boxes = _invoice.packages;
|
||||||
} else {
|
} else {}
|
||||||
_packages = [
|
|
||||||
Package(
|
_boxes = [
|
||||||
|
Box(
|
||||||
shipmentNumber: "A202",
|
shipmentNumber: "A202",
|
||||||
receiverNumber: "3",
|
receiverNumber: "3",
|
||||||
|
receiverName: "Ko Myo Min",
|
||||||
boxNumber: "1",
|
boxNumber: "1",
|
||||||
rate: 7,
|
rate: 7,
|
||||||
packageType: "General",
|
packageType: "General",
|
||||||
weight: 25,
|
weight: 75,
|
||||||
status: "Received",
|
status: "Packed",
|
||||||
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon',
|
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon',
|
||||||
|
cargoDesc: "Clothes",
|
||||||
arrivedDate: DateTime(2020, 6, 1),
|
arrivedDate: DateTime(2020, 6, 1),
|
||||||
),
|
width: 10,
|
||||||
Package(
|
height: 10,
|
||||||
shipmentNumber: "A202",
|
length: 10,
|
||||||
receiverNumber: "3",
|
// packages: packages,
|
||||||
boxNumber: "2",
|
// statusHistory: statusHistory,
|
||||||
rate: 7,
|
cargoTypes: [
|
||||||
packageType: "General",
|
Cargo(type: 'General Cargo', weight: 25),
|
||||||
weight: 20,
|
Cargo(type: 'Medicine', weight: 20),
|
||||||
status: "Received",
|
Cargo(type: 'Dangerous Cargo', weight: 30)
|
||||||
arrivedDate: DateTime(2020, 6, 1),
|
]),
|
||||||
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon'),
|
Box(
|
||||||
];
|
shipmentNumber: "A202",
|
||||||
}
|
receiverNumber: "3",
|
||||||
|
receiverName: "Ko Myo Min",
|
||||||
|
boxNumber: "2",
|
||||||
|
rate: 7,
|
||||||
|
packageType: "General",
|
||||||
|
weight: 75,
|
||||||
|
status: "Packed",
|
||||||
|
cargoDesc: "Clothes",
|
||||||
|
arrivedDate: DateTime(2020, 6, 1),
|
||||||
|
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
|
@override
|
||||||
@@ -88,6 +118,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var mainModel = Provider.of<MainModel>(context);
|
var mainModel = Provider.of<MainModel>(context);
|
||||||
|
var discountModel = Provider.of<DiscountModel>(context);
|
||||||
|
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
@@ -170,8 +201,8 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
|||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
fillColor: Colors.white,
|
fillColor: Colors.white,
|
||||||
labelText: 'Customer Name',
|
labelText: 'Customer Name',
|
||||||
labelStyle:
|
labelStyle: TextStyle(
|
||||||
TextStyle(fontSize: 16, color: primaryColor),
|
fontSize: 16, color: primaryColor),
|
||||||
filled: true,
|
filled: true,
|
||||||
enabledBorder: InputBorder.none,
|
enabledBorder: InputBorder.none,
|
||||||
focusedBorder: InputBorder.none,
|
focusedBorder: InputBorder.none,
|
||||||
@@ -199,31 +230,131 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
|||||||
// color: Colors.grey,
|
// color: Colors.grey,
|
||||||
// ),
|
// ),
|
||||||
// )),
|
// )),
|
||||||
Container(
|
// Container(
|
||||||
padding: EdgeInsets.only(top: 0),
|
// padding: EdgeInsets.only(top: 0),
|
||||||
child: fcsInput('Amount', FontAwesomeIcons.moneyBill,
|
// child: fcsInput('Amount', FontAwesomeIcons.moneyBill,
|
||||||
controller: _amountController),
|
// controller: _amountController),
|
||||||
),
|
// ),
|
||||||
Container(
|
|
||||||
padding: EdgeInsets.only(top: 5),
|
widget.invoice == null
|
||||||
child: fcsInput('Discount', FontAwesomeIcons.tag,
|
? Container()
|
||||||
controller: _discountController),
|
: Container(
|
||||||
),
|
padding: EdgeInsets.only(top: 0),
|
||||||
|
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,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
|
||||||
widget.invoice == null
|
widget.invoice == null
|
||||||
? Container()
|
? Container()
|
||||||
: Container(
|
: Container(
|
||||||
padding: EdgeInsets.only(top: 5),
|
padding: EdgeInsets.only(top: 5),
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: _statusController,
|
controller: _statusController,
|
||||||
|
readOnly: true,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
fillColor: Colors.white,
|
fillColor: Colors.white,
|
||||||
labelText: 'Status',
|
labelText: 'Status',
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontSize: 16, color: primaryColor),
|
||||||
filled: true,
|
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(
|
SizedBox(
|
||||||
height: 20,
|
height: 10,
|
||||||
),
|
),
|
||||||
ExpansionTile(
|
ExpansionTile(
|
||||||
title: Text('Payment Attachment'),
|
title: Text('Payment Attachment'),
|
||||||
@@ -249,7 +380,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
ExpansionTile(
|
ExpansionTile(
|
||||||
title: Text('Package Information'),
|
title: Text('Box Information'),
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
@@ -261,55 +392,63 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
|||||||
MyDataColumn(
|
MyDataColumn(
|
||||||
label: LocalText(
|
label: LocalText(
|
||||||
context,
|
context,
|
||||||
"package.number",
|
"box.number",
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
MyDataColumn(
|
MyDataColumn(
|
||||||
label: LocalText(
|
label: LocalText(
|
||||||
context,
|
context,
|
||||||
"package.rate",
|
"box.length",
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
MyDataColumn(
|
MyDataColumn(
|
||||||
label: LocalText(
|
label: LocalText(
|
||||||
context,
|
context,
|
||||||
"package.weight",
|
"box.width",
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
MyDataColumn(
|
MyDataColumn(
|
||||||
label: LocalText(
|
label: LocalText(
|
||||||
context,
|
context,
|
||||||
"package.amount",
|
"box.height",
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
rows: getPackageRow(context),
|
rows: getBoxRow(context),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
mainModel.isOwner()?Container(
|
mainModel.isOwner()
|
||||||
padding: EdgeInsets.only(top: 20),
|
? Container(
|
||||||
child: Align(
|
padding: EdgeInsets.only(top: 20),
|
||||||
alignment: Alignment.bottomRight,
|
child: Align(
|
||||||
child: FloatingActionButton.extended(
|
alignment: Alignment.bottomRight,
|
||||||
icon: Icon(Icons.add),
|
child: FloatingActionButton.extended(
|
||||||
label: Text(AppTranslations.of(context)
|
icon: Icon(Icons.add),
|
||||||
.text("invoice.add_package")),
|
label: Text(AppTranslations.of(context)
|
||||||
backgroundColor: primaryColor,
|
.text("invoice.add_box")),
|
||||||
onPressed: () {
|
backgroundColor: primaryColor,
|
||||||
Navigator.of(context)
|
onPressed: () {
|
||||||
.push(BottomUpPageRoute(PackageAddition()));
|
Navigator.of(context)
|
||||||
},
|
.push(BottomUpPageRoute(BoxAddition()));
|
||||||
),
|
},
|
||||||
),
|
),
|
||||||
):Container(),
|
),
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
SizedBox(height: 25),
|
SizedBox(height: 25),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
|
//Cargo Table
|
||||||
|
ExpansionTile(
|
||||||
|
title: Text('Cargo Table'),
|
||||||
|
children: getCargoTableByBox(context),
|
||||||
|
),
|
||||||
]),
|
]),
|
||||||
)),
|
)),
|
||||||
widget.invoice == null
|
widget.invoice == null
|
||||||
@@ -327,25 +466,27 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
)))
|
)))
|
||||||
:mainModel.isCustomer()?Container():Container(
|
: mainModel.isCustomer()
|
||||||
child: Column(
|
? Container()
|
||||||
children: <Widget>[
|
: Container(
|
||||||
Align(
|
child: Column(
|
||||||
alignment: Alignment.bottomCenter,
|
children: <Widget>[
|
||||||
child: Center(
|
Align(
|
||||||
child: Container(
|
alignment: Alignment.bottomCenter,
|
||||||
width: 250,
|
child: Center(
|
||||||
child: FlatButton(
|
child: Container(
|
||||||
child: Text('Save invoice'),
|
width: 250,
|
||||||
color: primaryColor,
|
child: FlatButton(
|
||||||
textColor: Colors.white,
|
child: Text('Save invoice'),
|
||||||
onPressed: () {
|
color: primaryColor,
|
||||||
Navigator.pop(context);
|
textColor: Colors.white,
|
||||||
},
|
onPressed: () {
|
||||||
),
|
Navigator.pop(context);
|
||||||
))),
|
},
|
||||||
],
|
),
|
||||||
)),
|
))),
|
||||||
|
],
|
||||||
|
)),
|
||||||
widget.invoice == null
|
widget.invoice == null
|
||||||
? Container()
|
? Container()
|
||||||
: Align(
|
: Align(
|
||||||
@@ -369,25 +510,120 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<MyDataRow> getPackageRow(BuildContext context) {
|
getCargoTableByBox(BuildContext context) {
|
||||||
return _packages.map((p) {
|
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(
|
return MyDataRow(
|
||||||
onSelectChanged: (bool selected) {},
|
onSelectChanged: (bool selected) {},
|
||||||
cells: [
|
cells: [
|
||||||
MyDataCell(new Text(
|
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,
|
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();
|
}).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,36 +268,44 @@ Widget getStatus(String status) {
|
|||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
fontWeight: FontWeight.bold),
|
fontWeight: FontWeight.bold),
|
||||||
)
|
)
|
||||||
: status == "Delivered"
|
: status == "Delivered" || status == "Avaliable"
|
||||||
? Text(
|
? Text(
|
||||||
status,
|
status,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.green, fontSize: 12),
|
color: Colors.green, fontSize: 18),
|
||||||
)
|
)
|
||||||
: status == "Paid"
|
: status == "Used"
|
||||||
? Row(
|
? Text(
|
||||||
children: <Widget>[
|
status,
|
||||||
Padding(
|
style: TextStyle(
|
||||||
padding:
|
color: Colors.red,
|
||||||
const EdgeInsets.all(8.0),
|
fontSize: 18),
|
||||||
child: Icon(Icons.check),
|
)
|
||||||
),
|
: status == "Paid"
|
||||||
Text(
|
? Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.all(8.0),
|
||||||
|
child: Icon(Icons.check),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
status,
|
||||||
|
style: TextStyle(
|
||||||
|
color: primaryColor,
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight:
|
||||||
|
FontWeight.bold),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: Text(
|
||||||
status,
|
status,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: primaryColor,
|
color: primaryColor,
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
fontWeight: FontWeight.bold),
|
fontWeight: FontWeight.bold),
|
||||||
)
|
);
|
||||||
],
|
|
||||||
)
|
|
||||||
: Text(
|
|
||||||
status,
|
|
||||||
style: TextStyle(
|
|
||||||
color: primaryColor,
|
|
||||||
fontSize: 18,
|
|
||||||
fontWeight: FontWeight.bold),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
call(BuildContext context, String phone) {
|
call(BuildContext context, String phone) {
|
||||||
|
|||||||
@@ -37,78 +37,65 @@ class _PackageListState extends State<PackageList> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
var packageModel = Provider.of<PackageModel>(context);
|
||||||
|
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
child: DefaultTabController(
|
child: Scaffold(
|
||||||
length: 5,
|
appBar: AppBar(
|
||||||
child: Scaffold(
|
centerTitle: true,
|
||||||
appBar: AppBar(
|
leading: new IconButton(
|
||||||
centerTitle: true,
|
icon: new Icon(Icons.close),
|
||||||
leading: new IconButton(
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
icon: new Icon(Icons.close),
|
),
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
backgroundColor: primaryColor,
|
||||||
),
|
title: Text(AppTranslations.of(context).text("package.title")),
|
||||||
backgroundColor: primaryColor,
|
actions: <Widget>[
|
||||||
title: Text(AppTranslations.of(context).text("package.title")),
|
// IconButton(
|
||||||
actions: <Widget>[
|
// icon: Icon(
|
||||||
// IconButton(
|
// Ionicons.ios_barcode,
|
||||||
// icon: Icon(
|
// color: Colors.white,
|
||||||
// Ionicons.ios_barcode,
|
// ),
|
||||||
// color: Colors.white,
|
// iconSize: 30,
|
||||||
// ),
|
// onPressed: () {
|
||||||
// iconSize: 30,
|
// Navigator.push(
|
||||||
// onPressed: () {
|
// context,
|
||||||
// Navigator.push(
|
// BottomUpPageRoute(BarcodeScreenPage()),
|
||||||
// context,
|
// );
|
||||||
// BottomUpPageRoute(BarcodeScreenPage()),
|
// },
|
||||||
// );
|
// ),
|
||||||
// },
|
IconButton(
|
||||||
// ),
|
icon: Icon(
|
||||||
IconButton(
|
Icons.search,
|
||||||
icon: Icon(
|
color: Colors.white,
|
||||||
Icons.search,
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
iconSize: 30,
|
|
||||||
onPressed: () => showPlacesSearch(context),
|
|
||||||
),
|
),
|
||||||
],
|
iconSize: 30,
|
||||||
bottom: TabBar(
|
onPressed: () => showPlacesSearch(context),
|
||||||
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: () {
|
floatingActionButton: FloatingActionButton.extended(
|
||||||
_newPickup();
|
onPressed: () {
|
||||||
},
|
_newPickup();
|
||||||
icon: Icon(Icons.add),
|
},
|
||||||
label: Text(AppTranslations.of(context).text("package.new")),
|
icon: Icon(Icons.add),
|
||||||
backgroundColor: primaryColor,
|
label: Text(AppTranslations.of(context).text("package.new")),
|
||||||
),
|
backgroundColor: primaryColor,
|
||||||
body: TabBarView(
|
),
|
||||||
children: [
|
body: new ListView.separated(
|
||||||
_upComing(),
|
separatorBuilder: (context, index) => Divider(
|
||||||
_completed(),
|
color: Colors.black,
|
||||||
_shipped(),
|
),
|
||||||
_arrived(),
|
scrollDirection: Axis.vertical,
|
||||||
_delivered(),
|
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