Merge branch 'master' of phyothandar/fcs into master
This commit is contained in:
@@ -527,6 +527,9 @@
|
|||||||
|
|
||||||
|
|
||||||
"pickup.date": "Pickup Date",
|
"pickup.date": "Pickup Date",
|
||||||
|
"pickup.location_time": "Pickup Location / Time",
|
||||||
|
"pickup.information": "Pickup Informations",
|
||||||
|
"pickup.recipient_information": "Recipient Informations",
|
||||||
|
|
||||||
"message.btn":"Messages",
|
"message.btn":"Messages",
|
||||||
"message.title":"MESSAGES",
|
"message.title":"MESSAGES",
|
||||||
@@ -541,5 +544,16 @@
|
|||||||
"invoice.payment":"Payment Receipt",
|
"invoice.payment":"Payment Receipt",
|
||||||
"invoice.add_package":"Add Package",
|
"invoice.add_package":"Add Package",
|
||||||
|
|
||||||
"term":"TERMS"
|
"term":"TERMS",
|
||||||
|
"term.btn":"Terms",
|
||||||
|
|
||||||
|
"customer.list.title":"CUSTOMERS",
|
||||||
|
"customer.form.title":"CUSTOMER",
|
||||||
|
|
||||||
|
"contact": "CONTACTS",
|
||||||
|
|
||||||
|
"fcs.profile": "FCS PROFILE",
|
||||||
|
|
||||||
|
"contact.usa.phone": "USA Phone",
|
||||||
|
"contact.mm.phone": "Myanmar Phone"
|
||||||
}
|
}
|
||||||
@@ -552,6 +552,9 @@
|
|||||||
"pickup.new": "New Pickup",
|
"pickup.new": "New Pickup",
|
||||||
"pickup.edit.title": "PICKUP",
|
"pickup.edit.title": "PICKUP",
|
||||||
"pickup.date": "Pickup Date",
|
"pickup.date": "Pickup Date",
|
||||||
|
"pickup.location_time": "Pickup Location / Time",
|
||||||
|
"pickup.information": "Pickup Informations",
|
||||||
|
"pickup.recipient_information": "Recipient Informations",
|
||||||
|
|
||||||
"rate":"အဆင့်သတ်မှတ်ချက်များ",
|
"rate":"အဆင့်သတ်မှတ်ချက်များ",
|
||||||
"rate.title":"အဆင့်သတ်မှတ်ချက်များ",
|
"rate.title":"အဆင့်သတ်မှတ်ချက်များ",
|
||||||
@@ -569,5 +572,16 @@
|
|||||||
"invoice.payment":"Payment Receipt",
|
"invoice.payment":"Payment Receipt",
|
||||||
"invoice.add_package":"Add Package",
|
"invoice.add_package":"Add Package",
|
||||||
|
|
||||||
"term":"TERMS"
|
"term":"စည်းကမ်းချက်များ",
|
||||||
|
"term.btn":"စည်းကမ်းချက်များ",
|
||||||
|
|
||||||
|
"customer.list.title":"ဝယ်ယူသူများ",
|
||||||
|
"customer.form.title":"ဝယ်ယူသူ",
|
||||||
|
|
||||||
|
"contact": "ဆက်သွယ်ရန်",
|
||||||
|
|
||||||
|
"fcs.profile": "FCS ပရိုဖိုင်",
|
||||||
|
|
||||||
|
"contact.usa.phone": "ယူအက်စ်အေ ဖုန်းနံပါတ်",
|
||||||
|
"contact.mm.phone": "မြန်မာ ဖုန်းနံပါတ်"
|
||||||
}
|
}
|
||||||
@@ -19,6 +19,7 @@ import 'package:fcs/pages/login_page.dart';
|
|||||||
|
|
||||||
import 'model/announcement_model.dart';
|
import 'model/announcement_model.dart';
|
||||||
import 'model/chart_model.dart';
|
import 'model/chart_model.dart';
|
||||||
|
import 'model/customer_model.dart';
|
||||||
import 'model/device_model.dart';
|
import 'model/device_model.dart';
|
||||||
import 'model/do_model.dart';
|
import 'model/do_model.dart';
|
||||||
import 'model/employee_model.dart';
|
import 'model/employee_model.dart';
|
||||||
@@ -72,6 +73,7 @@ class _AppState extends State<App> {
|
|||||||
final PackageModel packageModel=new PackageModel();
|
final PackageModel packageModel=new PackageModel();
|
||||||
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();
|
||||||
|
|
||||||
AppTranslationsDelegate _newLocaleDelegate;
|
AppTranslationsDelegate _newLocaleDelegate;
|
||||||
|
|
||||||
@@ -108,7 +110,8 @@ class _AppState extends State<App> {
|
|||||||
..addModel(packageModel)
|
..addModel(packageModel)
|
||||||
..addModel(messageModel)
|
..addModel(messageModel)
|
||||||
..addModel(shipmentRateModel)
|
..addModel(shipmentRateModel)
|
||||||
..addModel(invoiceModel);
|
..addModel(invoiceModel)
|
||||||
|
..addModel(customerModel);
|
||||||
this.mainModel.init();
|
this.mainModel.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,6 +166,7 @@ class _AppState extends State<App> {
|
|||||||
ChangeNotifierProvider(builder: (context) => packageModel),
|
ChangeNotifierProvider(builder: (context) => packageModel),
|
||||||
ChangeNotifierProvider(builder: (context) => messageModel),
|
ChangeNotifierProvider(builder: (context) => messageModel),
|
||||||
ChangeNotifierProvider(builder: (context) => invoiceModel),
|
ChangeNotifierProvider(builder: (context) => invoiceModel),
|
||||||
|
ChangeNotifierProvider(builder: (context) => customerModel),
|
||||||
ChangeNotifierProvider(
|
ChangeNotifierProvider(
|
||||||
builder: (context) => testModel,
|
builder: (context) => testModel,
|
||||||
),
|
),
|
||||||
|
|||||||
67
lib/model/customer_model.dart
Normal file
67
lib/model/customer_model.dart
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||||
|
import 'package:logging/logging.dart';
|
||||||
|
import 'package:fcs/vo/user.dart';
|
||||||
|
|
||||||
|
import '../vo/user.dart';
|
||||||
|
import 'base_model.dart';
|
||||||
|
import 'constants.dart';
|
||||||
|
import 'firebase_helper.dart';
|
||||||
|
|
||||||
|
class CustomerModel extends BaseModel {
|
||||||
|
final log = Logger('CustomerModel');
|
||||||
|
|
||||||
|
List<User> customers = [
|
||||||
|
User(
|
||||||
|
name: 'Ko Nyi',
|
||||||
|
phoneNumber: '+95 9 717273634',
|
||||||
|
),
|
||||||
|
User(name: 'Ko Phyu', phoneNumber: '+1 (939) 382-3844'),
|
||||||
|
User(name: 'Ko Ye', phoneNumber: '+95 9 983734783', status: "Delivered"),
|
||||||
|
];
|
||||||
|
|
||||||
|
void initUser(user) async {
|
||||||
|
super.initUser(user);
|
||||||
|
// _loadCustomer();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
logout() async {
|
||||||
|
customers = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Future<void> _loadCustomer() async {
|
||||||
|
// if (!user.isOwnerAndAbove() && !user.hasAccount()) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// try {
|
||||||
|
// Firestore.instance
|
||||||
|
// .collection("/$biz_collection/${setting.okEnergyId}/$user_collection")
|
||||||
|
// .where("is_employee", isEqualTo: true)
|
||||||
|
// .snapshots()
|
||||||
|
// .listen((QuerySnapshot snapshot) {
|
||||||
|
// customers.clear();
|
||||||
|
// customers = snapshot.documents.map((documentSnapshot) {
|
||||||
|
// var user =
|
||||||
|
// User.fromMap(documentSnapshot.data, documentSnapshot.documentID);
|
||||||
|
// return user;
|
||||||
|
// }).toList();
|
||||||
|
// notifyListeners();
|
||||||
|
// }).onError((e) {
|
||||||
|
// log.warning("Error! $e");
|
||||||
|
// });
|
||||||
|
// } catch (e) {
|
||||||
|
// log.warning("Error!! $e");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Future<void> updatePrivileges(String userID, List<String> privileges) async {
|
||||||
|
// try {
|
||||||
|
// await request("/employee/privileges", "PUT",
|
||||||
|
// payload: {"id": userID, "privileges": privileges},
|
||||||
|
// token: await getToken());
|
||||||
|
// } catch (e) {
|
||||||
|
// throw Exception(e);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -60,9 +60,7 @@ class MainModel extends ChangeNotifier {
|
|||||||
shippingAddress: '154-19 64th Ave.Flushing, \nNY 11367',
|
shippingAddress: '154-19 64th Ave.Flushing, \nNY 11367',
|
||||||
deliveryAddress: '39 42th St. Kyaut Ta Thar Township Yangon');
|
deliveryAddress: '39 42th St. Kyaut Ta Thar Township Yangon');
|
||||||
|
|
||||||
Setting setting = Setting(
|
Setting setting = Setting(terms: '[{"insert":"* Minimum shipping weight is 1lbs.\n* Oversized goods, Light weight/Large volume items, laptops, phones, tablets may incur extra charges based on pecifications.Please contact us for pricing.\n* Goods with lithium battary needs extra packaging and declaration. Please inform us ahead of time so that we can process your package accordingly.\n* Loose Batteries, Drones, and Prescription medicines are not allowed on aircraft.\n* Payment: We accept money orders, any US bank transfers via Zelle, AYA, KBZ and CB. No COD except for pick-ups.\n*Payments made in Myanmar will incur 2% tranfer fee\n"}]');
|
||||||
terms:
|
|
||||||
'[{"insert":"Minimum shipping weight is 1lbs.\nOversized goods, Light weight/Large volume items, laptops, phones, tablets may incur extra charges based on pecifications.Please contact us for pricing.\nGoods with lithium battary needs extra packaging and declaration. Please inform us ahead of time so that we can process your package accordingly.\nLoose Batteries, Drones, and Prescription medicines are not allowed on aircraft.\nPayment: We accept money orders, any US bank transfers via Zelle, AYA, KBZ and CB. No COD except for pick-ups.\nPayments made in Myanmar will incur 2% tranfer fee\n"}]');
|
|
||||||
PackageInfo packageInfo;
|
PackageInfo packageInfo;
|
||||||
bool isLoaded = true;
|
bool isLoaded = true;
|
||||||
bool isOnline = true;
|
bool isOnline = true;
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import 'package:fcs/model/pickup_model.dart';
|
||||||
|
import 'package:fcs/widget/label_widgets.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:package_info/package_info.dart';
|
import 'package:package_info/package_info.dart';
|
||||||
@@ -9,8 +11,6 @@ import 'package:fcs/theme/theme.dart';
|
|||||||
import 'package:fcs/widget/local_text.dart';
|
import 'package:fcs/widget/local_text.dart';
|
||||||
import 'package:fcs/widget/progress.dart';
|
import 'package:fcs/widget/progress.dart';
|
||||||
|
|
||||||
import 'contact_editor.dart';
|
|
||||||
|
|
||||||
class Contact extends StatefulWidget {
|
class Contact extends StatefulWidget {
|
||||||
@override
|
@override
|
||||||
_ContactState createState() => _ContactState();
|
_ContactState createState() => _ContactState();
|
||||||
@@ -21,71 +21,56 @@ class _ContactState extends State<Contact> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
MainModel mainModel = Provider.of<MainModel>(context);
|
var pickupModel = Provider.of<PickUpModel>(context, listen: false);
|
||||||
bool isOwner = mainModel.user != null && mainModel.user.isOwner();
|
|
||||||
bool hasAdmin = mainModel.user != null && mainModel.user.hasAdmin();
|
// MainModel mainModel = Provider.of<MainModel>(context);
|
||||||
|
// bool isOwner = mainModel.user != null && mainModel.user.isOwner();
|
||||||
|
// bool hasAdmin = mainModel.user != null && mainModel.user.hasAdmin();
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: primaryColor,
|
||||||
iconTheme: IconThemeData(
|
|
||||||
color: Colors.grey,
|
|
||||||
),
|
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
title: Image(
|
leading: new IconButton(
|
||||||
height: 30,
|
icon: new Icon(Icons.close),
|
||||||
fit: BoxFit.scaleDown,
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
image: new AssetImage('assets/img/logo.png')),
|
),
|
||||||
actions: <Widget>[
|
title: LocalText(
|
||||||
isOwner || hasAdmin
|
|
||||||
? IconButton(
|
|
||||||
icon: Icon(Icons.edit),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
"contact",
|
||||||
builder: (context) =>
|
fontSize: 25,
|
||||||
ContactEditor(setting: mainModel.setting)),
|
color: Colors.white,
|
||||||
);
|
),
|
||||||
},
|
|
||||||
)
|
|
||||||
: Container()
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Center(
|
link(pickupModel.profile.usaContactNumber, Icons.phone_forwarded,
|
||||||
child: Padding(
|
onTap: () => _call(pickupModel.profile.usaContactNumber),
|
||||||
padding: EdgeInsets.only(top: 5.0, bottom: 5),
|
label: LocalText(
|
||||||
child: LocalText(
|
|
||||||
context,
|
context,
|
||||||
"contact.title",
|
"contact.usa.phone",
|
||||||
fontSize: 25,
|
color: primaryColor,
|
||||||
)),
|
)),
|
||||||
|
link(pickupModel.profile.mmContactNumber, Icons.phone_forwarded,
|
||||||
|
onTap: () => _call(
|
||||||
|
pickupModel.profile.mmContactNumber,
|
||||||
),
|
),
|
||||||
Padding(
|
label: LocalText(
|
||||||
padding: const EdgeInsets.only(bottom: 15.0),
|
context,
|
||||||
child: Column(
|
"contact.mm.phone",
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
color: primaryColor,
|
||||||
children:
|
)),
|
||||||
List.generate(mainModel.setting.phones.length, (index) {
|
link(
|
||||||
return link(mainModel.setting.phones[index], Icons.phone,
|
pickupModel.profile.usaAddress,
|
||||||
onTap: () => _call(mainModel.setting.phones[index]));
|
Icons.location_on,
|
||||||
}),
|
|
||||||
),
|
),
|
||||||
),
|
link(pickupModel.profile.mmAddress, Icons.location_on),
|
||||||
link(mainModel.setting.deliveryPhone, Icons.phone_forwarded,
|
link(pickupModel.profile.mail, Icons.email,
|
||||||
onTap: () => _call(mainModel.setting.deliveryPhone),
|
onTap: () => _email(pickupModel.profile.mail)),
|
||||||
label: LocalText(context, "contact.delivery.phone")),
|
link(pickupModel.profile.facebook, FontAwesomeIcons.facebook,
|
||||||
link(mainModel.setting.email, Icons.email,
|
onTap: () => _openLink(pickupModel.profile.facebook)),
|
||||||
onTap: () => _email(mainModel.setting.email)),
|
|
||||||
link(mainModel.setting.facebook, FontAwesomeIcons.facebook,
|
|
||||||
onTap: () => _openLink(mainModel.setting.facebook)),
|
|
||||||
link(mainModel.setting.website, FontAwesomeIcons.chrome,
|
|
||||||
onTap: () => _openLink(mainModel.setting.website)),
|
|
||||||
link(mainModel.setting.address, Icons.location_on),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -106,17 +91,25 @@ class _ContactState extends State<Contact> {
|
|||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
iconData,
|
iconData,
|
||||||
color: primaryColor,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
label == null ? Container() : label,
|
label == null
|
||||||
Text(
|
? Container()
|
||||||
|
: Padding(
|
||||||
|
padding: EdgeInsets.fromLTRB(10, 10, 10, 0),
|
||||||
|
child: label,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text(
|
||||||
text == null ? "" : text,
|
text == null ? "" : text,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
maxLines: 5,
|
maxLines: 5,
|
||||||
|
style: TextStyle(fontSize: 14.0),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
343
lib/pages/customer_editor.dart
Normal file
343
lib/pages/customer_editor.dart
Normal file
@@ -0,0 +1,343 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:fcs/model/employee_model.dart';
|
||||||
|
import 'package:fcs/model/language_model.dart';
|
||||||
|
import 'package:fcs/model/main_model.dart';
|
||||||
|
import 'package:fcs/model/user_model.dart';
|
||||||
|
import 'package:fcs/theme/theme.dart';
|
||||||
|
import 'package:fcs/vo/role.dart';
|
||||||
|
import 'package:fcs/vo/user.dart';
|
||||||
|
import 'package:fcs/widget/local_text.dart';
|
||||||
|
import 'package:fcs/widget/localization/app_translations.dart';
|
||||||
|
import 'package:fcs/widget/progress.dart';
|
||||||
|
import 'util.dart';
|
||||||
|
|
||||||
|
typedef void FindCallBack();
|
||||||
|
|
||||||
|
class CustomerEditor extends StatefulWidget {
|
||||||
|
final User customer;
|
||||||
|
const CustomerEditor({this.customer});
|
||||||
|
@override
|
||||||
|
_CustomerEditorState createState() => _CustomerEditorState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _CustomerEditorState extends State<CustomerEditor> {
|
||||||
|
TextEditingController _name = new TextEditingController();
|
||||||
|
TextEditingController _phone = new TextEditingController();
|
||||||
|
TextEditingController _phoneInput = new TextEditingController();
|
||||||
|
|
||||||
|
final _formKey = GlobalKey<FormState>();
|
||||||
|
bool _isLoading = false;
|
||||||
|
String currentBizId;
|
||||||
|
bool isSend = false;
|
||||||
|
User user;
|
||||||
|
User selectedUser;
|
||||||
|
List<Privilege> privileges = [];
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
// privileges = Provider.of<UserModel>(context, listen: false).privileges;
|
||||||
|
if (widget.customer != null) {
|
||||||
|
_name.text = widget.customer.name;
|
||||||
|
_phone.text = widget.customer.phone;
|
||||||
|
// privileges.forEach((p) => widget.employee.privilegeIds.contains(p.id)
|
||||||
|
// ? p.isChecked = true
|
||||||
|
// : p.isChecked = false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Widget> showprivilegeList(BuildContext context, UserModel userModel) {
|
||||||
|
return privileges.map((p) {
|
||||||
|
return new ListTile(
|
||||||
|
title: new Row(
|
||||||
|
children: <Widget>[
|
||||||
|
new Checkbox(
|
||||||
|
value: p.isChecked == null ? false : p.isChecked,
|
||||||
|
activeColor: primaryColor,
|
||||||
|
onChanged: (bool value) {
|
||||||
|
setState(() {
|
||||||
|
p.isChecked = value;
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
new Text(
|
||||||
|
p.name,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 15.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// Container(
|
||||||
|
// width: MediaQuery.of(context).size.width * 0.5,
|
||||||
|
// child: new Text(
|
||||||
|
// userModel.getPrivileges[index].desc,
|
||||||
|
// style:
|
||||||
|
// TextStyle(fontSize: 12.0, color: Colors.grey[600]),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget phoneInputbox(BuildContext context, FindCallBack findCallBack) {
|
||||||
|
var languageModel = Provider.of<LanguageModel>(context);
|
||||||
|
return Container(
|
||||||
|
padding: EdgeInsets.only(top: 10),
|
||||||
|
child: Stack(
|
||||||
|
alignment: const Alignment(1.2, 1.0),
|
||||||
|
children: <Widget>[
|
||||||
|
TextFormField(
|
||||||
|
controller: _phoneInput,
|
||||||
|
autofocus: false,
|
||||||
|
cursorColor: primaryColor,
|
||||||
|
keyboardType: TextInputType.phone,
|
||||||
|
style: textStyle,
|
||||||
|
decoration: new InputDecoration(
|
||||||
|
labelText: AppTranslations.of(context).text('employee.phone'),
|
||||||
|
labelStyle: languageModel.isEng ? labelStyle : labelStyleMM,
|
||||||
|
icon: Icon(
|
||||||
|
Icons.phone,
|
||||||
|
color: primaryColor,
|
||||||
|
),
|
||||||
|
enabledBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||||
|
focusedBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
new FlatButton(
|
||||||
|
onPressed: () {
|
||||||
|
this.isSend = true;
|
||||||
|
findCallBack();
|
||||||
|
},
|
||||||
|
child: new Icon(
|
||||||
|
Icons.search,
|
||||||
|
size: 25,
|
||||||
|
))
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
var userModel = Provider.of<UserModel>(context);
|
||||||
|
MainModel mainModel = Provider.of<MainModel>(context);
|
||||||
|
|
||||||
|
final namebox = TextFormField(
|
||||||
|
controller: _name,
|
||||||
|
autofocus: false,
|
||||||
|
readOnly: true,
|
||||||
|
cursorColor: primaryColor,
|
||||||
|
decoration: new InputDecoration(
|
||||||
|
border: InputBorder.none,
|
||||||
|
focusedBorder: InputBorder.none,
|
||||||
|
icon: Icon(
|
||||||
|
Icons.person,
|
||||||
|
color: primaryColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
final displayPhoneNo = TextFormField(
|
||||||
|
controller: _phone,
|
||||||
|
autofocus: false,
|
||||||
|
readOnly: true,
|
||||||
|
cursorColor: primaryColor,
|
||||||
|
decoration: new InputDecoration(
|
||||||
|
border: InputBorder.none,
|
||||||
|
focusedBorder: InputBorder.none,
|
||||||
|
icon: Icon(
|
||||||
|
Icons.phone,
|
||||||
|
color: primaryColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
var phoneNumberBox = Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(child: displayPhoneNo),
|
||||||
|
Expanded(
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () => call(context, _phone.text),
|
||||||
|
child: Icon(
|
||||||
|
Icons.open_in_new,
|
||||||
|
color: Colors.grey,
|
||||||
|
size: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
|
final updateButton = Container(
|
||||||
|
padding: EdgeInsets.only(top: 40),
|
||||||
|
child: Container(
|
||||||
|
height: 45.0,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: primaryColor,
|
||||||
|
shape: BoxShape.rectangle,
|
||||||
|
),
|
||||||
|
child: ButtonTheme(
|
||||||
|
minWidth: 900.0,
|
||||||
|
height: 100.0,
|
||||||
|
child: FlatButton(
|
||||||
|
onPressed: () {},
|
||||||
|
child: LocalText(
|
||||||
|
context,
|
||||||
|
'customer.update',
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
final addButton = Container(
|
||||||
|
padding: EdgeInsets.only(top: 40),
|
||||||
|
child: Container(
|
||||||
|
height: 45.0,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: primaryColor,
|
||||||
|
shape: BoxShape.rectangle,
|
||||||
|
),
|
||||||
|
child: ButtonTheme(
|
||||||
|
minWidth: 900.0,
|
||||||
|
height: 100.0,
|
||||||
|
child: FlatButton(
|
||||||
|
onPressed: () {},
|
||||||
|
child: LocalText(
|
||||||
|
context,
|
||||||
|
'customer.add',
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
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: LocalText(
|
||||||
|
context,
|
||||||
|
"customer.form.title",
|
||||||
|
fontSize: 20,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
// actions: <Widget>[
|
||||||
|
// widget.customer == null || !mainModel.showHistoryBtn()
|
||||||
|
// ? Container()
|
||||||
|
// : IconButton(
|
||||||
|
// icon: Icon(Icons.history),
|
||||||
|
// onPressed: () {
|
||||||
|
// Navigator.push(
|
||||||
|
// context,
|
||||||
|
// MaterialPageRoute(
|
||||||
|
// builder: (context) => DocumentLogPage(
|
||||||
|
// docID: widget.customer.docID)),
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
),
|
||||||
|
body: ListView(
|
||||||
|
shrinkWrap: true,
|
||||||
|
padding: EdgeInsets.only(left: 24.0, right: 24.0),
|
||||||
|
children: <Widget>[
|
||||||
|
widget.customer == null
|
||||||
|
? phoneInputbox(context, () => _findUser(context))
|
||||||
|
: phoneNumberBox,
|
||||||
|
widget.customer == null
|
||||||
|
? this.isSend ? namebox : Container()
|
||||||
|
: namebox,
|
||||||
|
// widget.customer == null ? addButton : updateButton,
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
_add(BuildContext context) async {
|
||||||
|
if (selectedUser == null) return;
|
||||||
|
setState(() {
|
||||||
|
_isLoading = true;
|
||||||
|
});
|
||||||
|
var employeeModel = Provider.of<EmployeeModel>(context);
|
||||||
|
try {
|
||||||
|
await employeeModel.updatePrivileges(
|
||||||
|
this.selectedUser.docID, privilegesIDs());
|
||||||
|
Navigator.pop(context);
|
||||||
|
} catch (e) {
|
||||||
|
showMsgDialog(context, "Error", e.toString());
|
||||||
|
} finally {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> privilegesIDs() {
|
||||||
|
return this.privileges.where((p) => p.isChecked).map((p) => p.id).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
_save() async {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = true;
|
||||||
|
});
|
||||||
|
if (widget.customer == null) return;
|
||||||
|
var employeeModel = Provider.of<EmployeeModel>(context);
|
||||||
|
try {
|
||||||
|
await employeeModel.updatePrivileges(widget.customer.docID, privilegesIDs());
|
||||||
|
Navigator.pop(context);
|
||||||
|
} catch (e) {
|
||||||
|
showMsgDialog(context, "Error", e.toString());
|
||||||
|
} finally {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_findUser(BuildContext context) async {
|
||||||
|
var userModel = Provider.of<UserModel>(context);
|
||||||
|
setState(() {
|
||||||
|
_isLoading = true;
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
selectedUser = await userModel.findUser(_phoneInput.text);
|
||||||
|
setState(() {
|
||||||
|
isSend = true;
|
||||||
|
_name.text = selectedUser.name;
|
||||||
|
if (selectedUser.privilegeIds != null) {
|
||||||
|
privileges.forEach((p) => selectedUser.privilegeIds.contains(p.id)
|
||||||
|
? p.isChecked = true
|
||||||
|
: p.isChecked = false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
showMsgDialog(context, "Error", e.toString());
|
||||||
|
} finally {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
131
lib/pages/customer_list.dart
Normal file
131
lib/pages/customer_list.dart
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
import 'package:fcs/model/customer_model.dart';
|
||||||
|
import 'package:fcs/pages/search_page.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_icons/flutter_icons.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:fcs/theme/theme.dart';
|
||||||
|
import 'package:fcs/widget/progress.dart';
|
||||||
|
|
||||||
|
import '../theme/theme.dart';
|
||||||
|
import '../vo/user.dart';
|
||||||
|
import '../widget/local_text.dart';
|
||||||
|
import 'customer_editor.dart';
|
||||||
|
|
||||||
|
class CustomerList extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_CustomerListState createState() => _CustomerListState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _CustomerListState extends State<CustomerList> {
|
||||||
|
var dateFormatter = new DateFormat('dd MMM yyyy - hh:mm:ss a');
|
||||||
|
final double dotSize = 15.0;
|
||||||
|
bool _isLoading = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
var customerModel = Provider.of<CustomerModel>(context);
|
||||||
|
|
||||||
|
return LocalProgress(
|
||||||
|
inAsyncCall: _isLoading,
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
centerTitle: true,
|
||||||
|
leading: new IconButton(
|
||||||
|
icon: new Icon(Icons.close),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.search,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
iconSize: 30,
|
||||||
|
onPressed: () => showPlacesSearch(context),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
backgroundColor: primaryColor,
|
||||||
|
title: LocalText(
|
||||||
|
context,
|
||||||
|
'customer.list.title',
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 20,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: new ListView.separated(
|
||||||
|
separatorBuilder: (context, index) => Divider(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
scrollDirection: Axis.vertical,
|
||||||
|
padding: EdgeInsets.only(left: 15, right: 15, top: 15),
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: customerModel.customers.length,
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
User user = customerModel.customers[index];
|
||||||
|
return Stack(
|
||||||
|
children: <Widget>[
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) =>
|
||||||
|
CustomerEditor(customer: user)),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: new Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 10.0),
|
||||||
|
child: new Row(
|
||||||
|
children: <Widget>[
|
||||||
|
new Padding(
|
||||||
|
padding: new EdgeInsets.symmetric(
|
||||||
|
horizontal: 32.0 - dotSize / 2),
|
||||||
|
child: Icon(
|
||||||
|
Feather.users,
|
||||||
|
color: primaryColor,
|
||||||
|
size: 40,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
new Expanded(
|
||||||
|
child: new Column(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
new Text(
|
||||||
|
user.name,
|
||||||
|
style: new TextStyle(
|
||||||
|
fontSize: 15.0,
|
||||||
|
color: primaryColor),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.only(top: 8.0),
|
||||||
|
child: new Text(
|
||||||
|
user.phoneNumber,
|
||||||
|
style: new TextStyle(
|
||||||
|
fontSize: 15.0,
|
||||||
|
color: Colors.grey),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
import 'package:fcs/model/pickup_model.dart';
|
import 'package:fcs/model/pickup_model.dart';
|
||||||
|
import 'package:fcs/pages/util.dart';
|
||||||
import 'package:fcs/vo/pickup.dart';
|
import 'package:fcs/vo/pickup.dart';
|
||||||
import 'package:fcs/widget/fcs_text_field.dart';
|
import 'package:fcs/widget/fcs_text_field.dart';
|
||||||
|
import 'package:fcs/widget/local_text.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -49,67 +52,37 @@ class _FCSProfilePageState extends State<FCSProfilePage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final usaAddress = Container(
|
final usaAddress = fcsInput('USA Delivery Address', Icons.location_on,
|
||||||
child: FCSTextField(
|
controller: _usaAddressEditingController);
|
||||||
controller: _usaAddressEditingController,
|
final mmAddress = fcsInput('Yangon, Myanmar Office', Icons.location_on,
|
||||||
label: 'USA Delivery Address',
|
controller: _mmAddressEditingController);
|
||||||
));
|
|
||||||
|
|
||||||
final mmAddress = Container(
|
final contactNumber = fcsInput('USA contact number', Icons.phone,
|
||||||
child: Row(children: <Widget>[
|
controller: _contactEditingController);
|
||||||
Expanded(
|
final mmContactNumber = fcsInput('Myanmar contact number', Icons.phone,
|
||||||
child: FCSTextField(
|
controller: _mmContactEditingController);
|
||||||
controller: _mmAddressEditingController,
|
|
||||||
label: 'Yangon, Myanmar Office',
|
|
||||||
)),
|
|
||||||
]),
|
|
||||||
);
|
|
||||||
|
|
||||||
final contactNumber = Container(
|
final mailBox = fcsInput('Email Address', Icons.mail,
|
||||||
child: Row(children: <Widget>[
|
controller: _mailEditingController);
|
||||||
Expanded(
|
final fbLinkBox = fcsInput('Facebook Link', FontAwesomeIcons.facebook,
|
||||||
child: FCSTextField(
|
controller: _fbLinkEditingController);
|
||||||
controller: _contactEditingController,
|
|
||||||
label: 'USA contact number',
|
|
||||||
)),
|
|
||||||
]),
|
|
||||||
);
|
|
||||||
|
|
||||||
final mmContactNumber = Container(
|
|
||||||
child: Row(children: <Widget>[
|
|
||||||
Expanded(
|
|
||||||
child: FCSTextField(
|
|
||||||
controller: _mmContactEditingController,
|
|
||||||
label: 'Myanmar contact number',
|
|
||||||
)),
|
|
||||||
]),
|
|
||||||
);
|
|
||||||
|
|
||||||
final mailBox = Container(
|
|
||||||
child: Row(children: <Widget>[
|
|
||||||
Expanded(
|
|
||||||
child: FCSTextField(
|
|
||||||
controller: _mailEditingController,
|
|
||||||
label: 'Email Address',
|
|
||||||
)),
|
|
||||||
]),
|
|
||||||
);
|
|
||||||
|
|
||||||
final fbLinkBox = Container(
|
|
||||||
child: Row(children: <Widget>[
|
|
||||||
Expanded(
|
|
||||||
child: FCSTextField(
|
|
||||||
controller: _fbLinkEditingController, label: ' Facebook Link')),
|
|
||||||
]),
|
|
||||||
);
|
|
||||||
|
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
|
leading: new IconButton(
|
||||||
|
icon: new Icon(Icons.close),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
backgroundColor: primaryColor,
|
backgroundColor: primaryColor,
|
||||||
title: Text('FCS PROFILE'),
|
title: LocalText(
|
||||||
|
context,
|
||||||
|
'fcs.profile',
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 20,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
body: Card(
|
body: Card(
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ import 'package:provider/provider.dart';
|
|||||||
import '../theme/theme.dart';
|
import '../theme/theme.dart';
|
||||||
import 'announcement_list.dart';
|
import 'announcement_list.dart';
|
||||||
import 'buying_online.dart';
|
import 'buying_online.dart';
|
||||||
|
import 'customer_list.dart';
|
||||||
import 'do/do_list.dart';
|
import 'do/do_list.dart';
|
||||||
import 'invoice/invoce_list.dart';
|
import 'invoice/invoce_list.dart';
|
||||||
import 'my_registeration.dart';
|
import 'my_registeration.dart';
|
||||||
@@ -157,13 +158,18 @@ class _HomePageState extends State<HomePage> {
|
|||||||
final customersBtn = _buildBtn2("customers.btn",
|
final customersBtn = _buildBtn2("customers.btn",
|
||||||
icon: Feather.users,
|
icon: Feather.users,
|
||||||
btnCallback: () =>
|
btnCallback: () =>
|
||||||
Navigator.of(context).push(BottomUpPageRoute(StaffList())));
|
Navigator.of(context).push(BottomUpPageRoute(CustomerList())));
|
||||||
|
|
||||||
final invoicesBtn = _buildBtn2("invoices.btn",
|
final invoicesBtn = _buildBtn2("invoices.btn",
|
||||||
icon: FontAwesomeIcons.fileInvoice,
|
icon: FontAwesomeIcons.fileInvoice,
|
||||||
btnCallback: () =>
|
btnCallback: () =>
|
||||||
Navigator.of(context).push(BottomUpPageRoute(InvoiceList())));
|
Navigator.of(context).push(BottomUpPageRoute(InvoiceList())));
|
||||||
|
|
||||||
|
final termBtn = _buildBtn2("term.btn",
|
||||||
|
icon: FontAwesomeIcons.info,
|
||||||
|
btnCallback: () =>
|
||||||
|
Navigator.of(context).push(BottomUpPageRoute(Term())));
|
||||||
|
|
||||||
List<Widget> widgets = [];
|
List<Widget> widgets = [];
|
||||||
widgets.add(buyingBtn);
|
widgets.add(buyingBtn);
|
||||||
widgets.add(pickUpBtn);
|
widgets.add(pickUpBtn);
|
||||||
@@ -175,6 +181,7 @@ class _HomePageState extends State<HomePage> {
|
|||||||
widgets.add(packagesBtn);
|
widgets.add(packagesBtn);
|
||||||
widgets.add(customersBtn);
|
widgets.add(customersBtn);
|
||||||
widgets.add(invoicesBtn);
|
widgets.add(invoicesBtn);
|
||||||
|
widgets.add(termBtn);
|
||||||
|
|
||||||
return OfflineRedirect(
|
return OfflineRedirect(
|
||||||
child: FlavorBanner(
|
child: FlavorBanner(
|
||||||
@@ -433,7 +440,10 @@ class _HomePageState extends State<HomePage> {
|
|||||||
|
|
||||||
Widget _buildSmallButton(String text, IconData iconData) {
|
Widget _buildSmallButton(String text, IconData iconData) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () => {},
|
onTap: () => {
|
||||||
|
Navigator.of(context)
|
||||||
|
.push(MaterialPageRoute(builder: (_) => Contact())),
|
||||||
|
},
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(18.0),
|
padding: const EdgeInsets.all(18.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
|
|||||||
@@ -75,110 +75,88 @@ class _PickUpEditorState extends State<PickUpEditor> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var pickupModel = Provider.of<PickUpModel>(context);
|
var pickupModel = Provider.of<PickUpModel>(context);
|
||||||
|
|
||||||
final pickUpAddress = Container(
|
final pickUpAddress = fcsInput('Pickup Address', Icons.location_on,
|
||||||
child: TextFormField(
|
controller: _addressEditingController);
|
||||||
maxLines: null,
|
|
||||||
controller: _addressEditingController,
|
|
||||||
cursorColor: primaryColor,
|
|
||||||
style: textStyle,
|
|
||||||
minLines: 2,
|
|
||||||
decoration: new InputDecoration(
|
|
||||||
labelText: 'Pickup Address',
|
|
||||||
disabledBorder: InputBorder.none,
|
|
||||||
enabledBorder: UnderlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
|
||||||
focusedBorder: UnderlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
|
||||||
),
|
|
||||||
));
|
|
||||||
|
|
||||||
final pickUpAddressReadOnly = Container(
|
final pickUpAddressReadOnly = fcsInputReadOnly(
|
||||||
child: FCSTextFieldReadOnly(
|
'Pickup Address', Icons.location_on,
|
||||||
controller: _addressEditingController,
|
controller: _addressEditingController);
|
||||||
label: 'Pickup Address',
|
|
||||||
));
|
|
||||||
|
|
||||||
final pickupTime = Container(
|
final fromTimeBox = fcsInput(
|
||||||
height: 50.0,
|
'From',
|
||||||
child: Row(children: <Widget>[
|
Icons.timer,
|
||||||
Container(
|
|
||||||
width: 70.0,
|
|
||||||
child: TextFormField(
|
|
||||||
controller: _fromTimeEditingController,
|
controller: _fromTimeEditingController,
|
||||||
cursorColor: primaryColor,
|
);
|
||||||
decoration: new InputDecoration(
|
|
||||||
labelText: 'From',
|
final toTimeBox = fcsInput(
|
||||||
enabledBorder: UnderlineInputBorder(
|
'To',
|
||||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
null,
|
||||||
focusedBorder: UnderlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
|
||||||
),
|
|
||||||
)),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: Text(' - '),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
width: 70.0,
|
|
||||||
child: TextFormField(
|
|
||||||
controller: _toTimeEditingController,
|
controller: _toTimeEditingController,
|
||||||
cursorColor: primaryColor,
|
|
||||||
decoration: new InputDecoration(
|
|
||||||
labelText: 'To',
|
|
||||||
enabledBorder: UnderlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
|
||||||
focusedBorder: UnderlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
|
||||||
),
|
|
||||||
)),
|
|
||||||
]),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
final pickupTimeReadOnly = Container(
|
final fromTimeBoxReadOnly = fcsInputReadOnly(
|
||||||
height: 50.0,
|
'From',
|
||||||
child: Row(children: <Widget>[
|
Icons.timer,
|
||||||
|
controller: _fromTimeEditingController,
|
||||||
|
);
|
||||||
|
|
||||||
|
final toTimeBoxReadOnly = fcsInputReadOnly(
|
||||||
|
'To',
|
||||||
|
null,
|
||||||
|
controller: _toTimeEditingController,
|
||||||
|
);
|
||||||
|
|
||||||
|
final pickupTime = Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 20.0),
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
width: 70.0,
|
child: fromTimeBox,
|
||||||
child: FCSTextFieldReadOnly(
|
width: 120,
|
||||||
controller: _fromTimeEditingController, label: 'From')),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.only(left: 8.0),
|
||||||
child: Text('-'),
|
child: Text('-'),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
width: 70.0,
|
child: toTimeBox,
|
||||||
child: FCSTextFieldReadOnly(
|
width: 120,
|
||||||
controller: _toTimeEditingController, label: 'To')),
|
),
|
||||||
]),
|
],
|
||||||
);
|
|
||||||
|
|
||||||
final noOfPackageBox = Container(
|
|
||||||
height: 50.0,
|
|
||||||
child: Row(children: <Widget>[
|
|
||||||
Expanded(
|
|
||||||
child: TextFormField(
|
|
||||||
controller: _noOfPackageEditingController,
|
|
||||||
cursorColor: primaryColor,
|
|
||||||
textAlign: TextAlign.left,
|
|
||||||
decoration: new InputDecoration(
|
|
||||||
labelText: 'Number of Packages',
|
|
||||||
enabledBorder: UnderlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
|
||||||
focusedBorder: UnderlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
|
||||||
),
|
),
|
||||||
)),
|
|
||||||
]),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
final noOfPackageBoxReadonly = Container(
|
final pickupTimeReadOnly = Padding(
|
||||||
height: 50.0,
|
padding: const EdgeInsets.only(left: 20.0),
|
||||||
child: Row(children: <Widget>[
|
child: Row(
|
||||||
Expanded(
|
children: <Widget>[
|
||||||
child: FCSTextFieldReadOnly(
|
SizedBox(height: 5),
|
||||||
|
Container(
|
||||||
|
child: fromTimeBoxReadOnly,
|
||||||
|
width: 120,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 8.0),
|
||||||
|
child: Text('-'),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: toTimeBoxReadOnly,
|
||||||
|
width: 120,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
final noOfPackageBox = fcsInput(
|
||||||
|
'Number of Packages',
|
||||||
|
Octicons.package,
|
||||||
|
controller: _noOfPackageEditingController,
|
||||||
|
);
|
||||||
|
|
||||||
|
final noOfPackageBoxReadonly = fcsInputReadOnly(
|
||||||
|
'Number of Packages',
|
||||||
|
Octicons.package,
|
||||||
controller: _noOfPackageEditingController,
|
controller: _noOfPackageEditingController,
|
||||||
label: 'Number of Packages')),
|
|
||||||
]),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
final requestDateBox = Container(
|
final requestDateBox = Container(
|
||||||
@@ -212,7 +190,7 @@ class _PickUpEditorState extends State<PickUpEditor> {
|
|||||||
EdgeInsets.symmetric(vertical: 10.0, horizontal: 0.0),
|
EdgeInsets.symmetric(vertical: 10.0, horizontal: 0.0),
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.date_range,
|
Icons.date_range,
|
||||||
color: Colors.black87,
|
color: Colors.grey,
|
||||||
)),
|
)),
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
if (value.isEmpty) {
|
if (value.isEmpty) {
|
||||||
@@ -258,62 +236,22 @@ class _PickUpEditorState extends State<PickUpEditor> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 15),
|
|
||||||
ExpansionTile(
|
ExpansionTile(
|
||||||
title: Text('Pickup Location / Time'),
|
title: Text('Pickup Location / Time'),
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 20.0),
|
padding: const EdgeInsets.only(left: 20.0),
|
||||||
child: Row(
|
|
||||||
children: <Widget>[
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(right: 8.0),
|
|
||||||
child: Icon(Icons.location_on),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: widget.pickUp == null
|
child: widget.pickUp == null
|
||||||
? pickUpAddress
|
? pickUpAddress
|
||||||
: widget.pickUp.status == 'Pending'
|
: widget.pickUp.status == 'Pending'
|
||||||
? pickUpAddress
|
? pickUpAddress
|
||||||
: pickUpAddressReadOnly),
|
: pickUpAddressReadOnly,
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
widget.pickUp == null
|
||||||
SizedBox(height: 15),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(left: 20.0),
|
|
||||||
child: Row(
|
|
||||||
children: <Widget>[
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(right: 8.0),
|
|
||||||
child: Icon(Icons.timer),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(left: 8.0),
|
|
||||||
child: Text('Pickup Time',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.grey, fontSize: 14)),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(left: 20.0),
|
|
||||||
child: Row(
|
|
||||||
children: <Widget>[
|
|
||||||
SizedBox(height: 5),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(left: 33),
|
|
||||||
child: widget.pickUp == null
|
|
||||||
? pickupTime
|
? pickupTime
|
||||||
: widget.pickUp.status == 'Pending'
|
: widget.pickUp.status == 'Pending'
|
||||||
? pickupTime
|
? pickupTime
|
||||||
: pickupTimeReadOnly,
|
: pickupTimeReadOnly,
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 5),
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 20.0),
|
padding: const EdgeInsets.only(left: 20.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
@@ -323,7 +261,6 @@ class _PickUpEditorState extends State<PickUpEditor> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 10),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
ExpansionTile(
|
ExpansionTile(
|
||||||
@@ -331,23 +268,11 @@ class _PickUpEditorState extends State<PickUpEditor> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 20.0),
|
padding: const EdgeInsets.only(left: 20.0),
|
||||||
child: Row(
|
|
||||||
children: <Widget>[
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(right: 8.0),
|
|
||||||
child: Icon(Octicons.package),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: widget.pickUp == null
|
child: widget.pickUp == null
|
||||||
? noOfPackageBox
|
? noOfPackageBox
|
||||||
: widget.pickUp.status == 'Pending'
|
: widget.pickUp.status == 'Pending'
|
||||||
? noOfPackageBox
|
? noOfPackageBox
|
||||||
: noOfPackageBoxReadonly),
|
: noOfPackageBoxReadonly,
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 15,
|
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 20.0),
|
padding: const EdgeInsets.only(left: 20.0),
|
||||||
@@ -363,12 +288,11 @@ class _PickUpEditorState extends State<PickUpEditor> {
|
|||||||
FontAwesomeIcons.weightHanging,
|
FontAwesomeIcons.weightHanging,
|
||||||
controller: _weightEditingController),
|
controller: _weightEditingController),
|
||||||
),
|
),
|
||||||
SizedBox(height: 15),
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 20.0),
|
padding: const EdgeInsets.only(left: 20.0),
|
||||||
child: fcsInput("Remark", MaterialCommunityIcons.note),
|
child: fcsInput("Remark", MaterialCommunityIcons.note),
|
||||||
),
|
),
|
||||||
SizedBox(height: 25),
|
SizedBox(height: 10.0),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
ExpansionTile(
|
ExpansionTile(
|
||||||
@@ -387,22 +311,19 @@ class _PickUpEditorState extends State<PickUpEditor> {
|
|||||||
"Name", FontAwesomeIcons.user,
|
"Name", FontAwesomeIcons.user,
|
||||||
controller:
|
controller:
|
||||||
_recipientNameEditingController)),
|
_recipientNameEditingController)),
|
||||||
SizedBox(height: 25),
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 20.0),
|
padding: const EdgeInsets.only(left: 20.0),
|
||||||
child: widget.pickUp == null
|
child: widget.pickUp == null
|
||||||
? fcsInput("Phone Number", FontAwesomeIcons.phone,
|
? fcsInput("Phone Number", Icons.phone,
|
||||||
controller: _recipientPhoneEditingController)
|
controller: _recipientPhoneEditingController)
|
||||||
: widget.pickUp.status == 'Pending'
|
: widget.pickUp.status == 'Pending'
|
||||||
? fcsInput(
|
? fcsInput("Phone Number", Icons.phone,
|
||||||
"Phone Number", FontAwesomeIcons.phone,
|
|
||||||
controller:
|
controller:
|
||||||
_recipientPhoneEditingController)
|
_recipientPhoneEditingController)
|
||||||
: fcsInputReadOnly(
|
: fcsInputReadOnly(
|
||||||
"Phone Number", FontAwesomeIcons.phone,
|
"Phone Number", Icons.phone,
|
||||||
controller:
|
controller:
|
||||||
_recipientPhoneEditingController)),
|
_recipientPhoneEditingController)),
|
||||||
SizedBox(height: 25),
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 20.0),
|
padding: const EdgeInsets.only(left: 20.0),
|
||||||
child: widget.pickUp == null
|
child: widget.pickUp == null
|
||||||
@@ -417,7 +338,6 @@ class _PickUpEditorState extends State<PickUpEditor> {
|
|||||||
"Address", Icons.location_on,
|
"Address", Icons.location_on,
|
||||||
controller:
|
controller:
|
||||||
_recipientAddressEditingController)),
|
_recipientAddressEditingController)),
|
||||||
SizedBox(height: 25),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
ExpansionTile(
|
ExpansionTile(
|
||||||
@@ -432,9 +352,6 @@ class _PickUpEditorState extends State<PickUpEditor> {
|
|||||||
)
|
)
|
||||||
: Container()
|
: Container()
|
||||||
: Container(),
|
: Container(),
|
||||||
SizedBox(
|
|
||||||
height: 25,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
|
|||||||
@@ -116,16 +116,16 @@ class _ShipmentRatesState extends State<ShipmentRates> {
|
|||||||
),
|
),
|
||||||
_row("Free delivery within Yangon \nfor shipments over","10","pounds"),
|
_row("Free delivery within Yangon \nfor shipments over","10","pounds"),
|
||||||
_row("Delivery fees","\$ 5","below 10 pounds"),
|
_row("Delivery fees","\$ 5","below 10 pounds"),
|
||||||
Padding(
|
// Padding(
|
||||||
padding: const EdgeInsets.only(left: 18.0, right: 18),
|
// padding: const EdgeInsets.only(left: 18.0, right: 18),
|
||||||
child: RichText(
|
// child: RichText(
|
||||||
// overflow: TextOverflow.fade,
|
// // overflow: TextOverflow.fade,
|
||||||
text: TextSpan(
|
// text: TextSpan(
|
||||||
style: TextStyle(color: primaryColor),
|
// style: TextStyle(color: primaryColor),
|
||||||
children: textList,
|
// children: textList,
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
fcsButton(context, "Calculate", callack: () {
|
fcsButton(context, "Calculate", callack: () {
|
||||||
Navigator.of(context)
|
Navigator.of(context)
|
||||||
.push(MaterialPageRoute(builder: (_) => ShipmentRatesCal()));
|
.push(MaterialPageRoute(builder: (_) => ShipmentRatesCal()));
|
||||||
|
|||||||
@@ -31,16 +31,18 @@ class _TermState extends State<Term> {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_controller = ZefyrController(_loadDocument());
|
_controller = ZefyrController(_loadDocument());
|
||||||
|
print("controller terms => ${_controller.document}");
|
||||||
_focusNode = FocusNode();
|
_focusNode = FocusNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
NotusDocument _loadDocument() {
|
NotusDocument _loadDocument() {
|
||||||
MainModel mainModel = Provider.of<MainModel>(context, listen: false);
|
MainModel mainModel = Provider.of<MainModel>(context, listen: false);
|
||||||
String term = mainModel.setting.terms;
|
String term = mainModel.setting.terms;
|
||||||
|
print("terms => $term");
|
||||||
NotusDocument doc;
|
NotusDocument doc;
|
||||||
try {
|
try {
|
||||||
doc = NotusDocument.fromJson(jsonDecode(term));
|
doc = NotusDocument.fromJson(jsonDecode(term));
|
||||||
|
print('doc=> $doc');
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
if (doc == null) {
|
if (doc == null) {
|
||||||
doc = NotusDocument();
|
doc = NotusDocument();
|
||||||
@@ -51,7 +53,6 @@ class _TermState extends State<Term> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
MainModel mainModel = Provider.of<MainModel>(context);
|
MainModel mainModel = Provider.of<MainModel>(context);
|
||||||
print("controller terms => ${_controller.document}");
|
|
||||||
|
|
||||||
bool isOwnerAndAbove =
|
bool isOwnerAndAbove =
|
||||||
mainModel.user != null && mainModel.user.isOwnerAndAbove();
|
mainModel.user != null && mainModel.user.isOwnerAndAbove();
|
||||||
@@ -89,21 +90,41 @@ class _TermState extends State<Term> {
|
|||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
automaticallyImplyLeading: !widget.agreePage,
|
leading: new IconButton(
|
||||||
|
icon: new Icon(Icons.close),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
// automaticallyImplyLeading: !widget.agreePage,
|
||||||
title: LocalText(context, 'term', color: Colors.white, fontSize: 20),
|
title: LocalText(context, 'term', color: Colors.white, fontSize: 20),
|
||||||
backgroundColor: primaryColor,
|
backgroundColor: primaryColor,
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
isOwnerAndAbove || hasAdmin
|
// isOwnerAndAbove || hasAdmin
|
||||||
? IconButton(
|
// ?
|
||||||
|
IconButton(
|
||||||
icon: Icon(Icons.edit),
|
icon: Icon(Icons.edit),
|
||||||
onPressed: () {
|
onPressed: () async {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) => TermEdit()),
|
MaterialPageRoute(
|
||||||
|
builder: (context) => TermEdit((data) {
|
||||||
|
setState(() {
|
||||||
|
_controller = ZefyrController(data);
|
||||||
|
});
|
||||||
|
})),
|
||||||
);
|
);
|
||||||
|
// print('doc=> $doc');
|
||||||
|
|
||||||
|
// setState(() {
|
||||||
|
// document = doc;
|
||||||
|
// });
|
||||||
|
// var document = await
|
||||||
|
// Navigator.push(
|
||||||
|
// context,
|
||||||
|
// MaterialPageRoute(builder: (context) => TermEdit()),
|
||||||
|
// );
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
: Container()
|
// : Container()
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: Column(
|
body: Column(
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ import '../theme/theme.dart';
|
|||||||
typedef void ProfileCallback();
|
typedef void ProfileCallback();
|
||||||
|
|
||||||
class TermEdit extends StatefulWidget {
|
class TermEdit extends StatefulWidget {
|
||||||
|
final ValueChanged onChangedData;
|
||||||
|
TermEdit(this.onChangedData);
|
||||||
@override
|
@override
|
||||||
_TermEditState createState() => _TermEditState();
|
_TermEditState createState() => _TermEditState();
|
||||||
}
|
}
|
||||||
@@ -110,8 +112,10 @@ class _TermEditState extends State<TermEdit> {
|
|||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
final contents = jsonEncode(_controller.document);
|
final contents = jsonEncode(_controller.document);
|
||||||
MainModel mainModel = Provider.of<MainModel>(context, listen: false);
|
print('contents => $contents');
|
||||||
mainModel.updateTerms(contents);
|
widget.onChangedData(_controller.document);
|
||||||
|
// MainModel mainModel = Provider.of<MainModel>(context, listen: false);
|
||||||
|
// mainModel.updateTerms(contents);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
showMsgDialog(context, "Error", e.toString());
|
showMsgDialog(context, "Error", e.toString());
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user