Merge branch 'master' of phyothandar/fcs into master

This commit is contained in:
2020-06-02 08:31:29 +00:00
committed by Gogs
14 changed files with 814 additions and 325 deletions

View File

@@ -527,6 +527,9 @@
"pickup.date": "Pickup Date",
"pickup.location_time": "Pickup Location / Time",
"pickup.information": "Pickup Informations",
"pickup.recipient_information": "Recipient Informations",
"message.btn":"Messages",
"message.title":"MESSAGES",
@@ -541,5 +544,16 @@
"invoice.payment":"Payment Receipt",
"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"
}

View File

@@ -552,6 +552,9 @@
"pickup.new": "New Pickup",
"pickup.edit.title": "PICKUP",
"pickup.date": "Pickup Date",
"pickup.location_time": "Pickup Location / Time",
"pickup.information": "Pickup Informations",
"pickup.recipient_information": "Recipient Informations",
"rate":"အဆင့်သတ်မှတ်ချက်များ",
"rate.title":"အဆင့်သတ်မှတ်ချက်များ",
@@ -569,5 +572,16 @@
"invoice.payment":"Payment Receipt",
"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": "မြန်မာ ဖုန်းနံပါတ်"
}

View File

@@ -19,6 +19,7 @@ import 'package:fcs/pages/login_page.dart';
import 'model/announcement_model.dart';
import 'model/chart_model.dart';
import 'model/customer_model.dart';
import 'model/device_model.dart';
import 'model/do_model.dart';
import 'model/employee_model.dart';
@@ -72,6 +73,7 @@ class _AppState extends State<App> {
final PackageModel packageModel=new PackageModel();
final MessageModel messageModel=new MessageModel();
final InvoiceModel invoiceModel = new InvoiceModel();
final CustomerModel customerModel = new CustomerModel();
AppTranslationsDelegate _newLocaleDelegate;
@@ -108,7 +110,8 @@ class _AppState extends State<App> {
..addModel(packageModel)
..addModel(messageModel)
..addModel(shipmentRateModel)
..addModel(invoiceModel);
..addModel(invoiceModel)
..addModel(customerModel);
this.mainModel.init();
}
@@ -163,6 +166,7 @@ class _AppState extends State<App> {
ChangeNotifierProvider(builder: (context) => packageModel),
ChangeNotifierProvider(builder: (context) => messageModel),
ChangeNotifierProvider(builder: (context) => invoiceModel),
ChangeNotifierProvider(builder: (context) => customerModel),
ChangeNotifierProvider(
builder: (context) => testModel,
),

View 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);
// }
// }
}

View File

@@ -60,9 +60,7 @@ class MainModel extends ChangeNotifier {
shippingAddress: '154-19 64th Ave.Flushing, \nNY 11367',
deliveryAddress: '39 42th St. Kyaut Ta Thar Township Yangon');
Setting setting = Setting(
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"}]');
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"}]');
PackageInfo packageInfo;
bool isLoaded = true;
bool isOnline = true;

View File

@@ -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:font_awesome_flutter/font_awesome_flutter.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/progress.dart';
import 'contact_editor.dart';
class Contact extends StatefulWidget {
@override
_ContactState createState() => _ContactState();
@@ -21,71 +21,56 @@ class _ContactState extends State<Contact> {
@override
Widget build(BuildContext context) {
MainModel mainModel = Provider.of<MainModel>(context);
bool isOwner = mainModel.user != null && mainModel.user.isOwner();
bool hasAdmin = mainModel.user != null && mainModel.user.hasAdmin();
var pickupModel = Provider.of<PickUpModel>(context, listen: false);
// MainModel mainModel = Provider.of<MainModel>(context);
// bool isOwner = mainModel.user != null && mainModel.user.isOwner();
// bool hasAdmin = mainModel.user != null && mainModel.user.hasAdmin();
return LocalProgress(
inAsyncCall: _isLoading,
child: Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
iconTheme: IconThemeData(
color: Colors.grey,
),
backgroundColor: primaryColor,
elevation: 0,
centerTitle: true,
title: Image(
height: 30,
fit: BoxFit.scaleDown,
image: new AssetImage('assets/img/logo.png')),
actions: <Widget>[
isOwner || hasAdmin
? IconButton(
icon: Icon(Icons.edit),
onPressed: () {
Navigator.push(
leading: new IconButton(
icon: new Icon(Icons.close),
onPressed: () => Navigator.of(context).pop(),
),
title: LocalText(
context,
MaterialPageRoute(
builder: (context) =>
ContactEditor(setting: mainModel.setting)),
);
},
)
: Container()
],
"contact",
fontSize: 25,
color: Colors.white,
),
),
body: ListView(
children: <Widget>[
Center(
child: Padding(
padding: EdgeInsets.only(top: 5.0, bottom: 5),
child: LocalText(
link(pickupModel.profile.usaContactNumber, Icons.phone_forwarded,
onTap: () => _call(pickupModel.profile.usaContactNumber),
label: LocalText(
context,
"contact.title",
fontSize: 25,
"contact.usa.phone",
color: primaryColor,
)),
link(pickupModel.profile.mmContactNumber, Icons.phone_forwarded,
onTap: () => _call(
pickupModel.profile.mmContactNumber,
),
Padding(
padding: const EdgeInsets.only(bottom: 15.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children:
List.generate(mainModel.setting.phones.length, (index) {
return link(mainModel.setting.phones[index], Icons.phone,
onTap: () => _call(mainModel.setting.phones[index]));
}),
label: LocalText(
context,
"contact.mm.phone",
color: primaryColor,
)),
link(
pickupModel.profile.usaAddress,
Icons.location_on,
),
),
link(mainModel.setting.deliveryPhone, Icons.phone_forwarded,
onTap: () => _call(mainModel.setting.deliveryPhone),
label: LocalText(context, "contact.delivery.phone")),
link(mainModel.setting.email, Icons.email,
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),
link(pickupModel.profile.mmAddress, Icons.location_on),
link(pickupModel.profile.mail, Icons.email,
onTap: () => _email(pickupModel.profile.mail)),
link(pickupModel.profile.facebook, FontAwesomeIcons.facebook,
onTap: () => _openLink(pickupModel.profile.facebook)),
],
),
),
@@ -106,17 +91,25 @@ class _ContactState extends State<Contact> {
padding: const EdgeInsets.all(8.0),
child: Icon(
iconData,
color: primaryColor,
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
label == null ? Container() : label,
Text(
label == null
? Container()
: Padding(
padding: EdgeInsets.fromLTRB(10, 10, 10, 0),
child: label,
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
text == null ? "" : text,
overflow: TextOverflow.ellipsis,
maxLines: 5,
style: TextStyle(fontSize: 14.0),
),
),
],
),

View 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;
});
}
}
}

View 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),
),
),
],
),
),
],
),
),
),
],
),
),
],
);
}),
),
);
}
}

View File

@@ -1,6 +1,9 @@
import 'package:fcs/model/pickup_model.dart';
import 'package:fcs/pages/util.dart';
import 'package:fcs/vo/pickup.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:flutter/material.dart';
@@ -49,67 +52,37 @@ class _FCSProfilePageState extends State<FCSProfilePage> {
@override
Widget build(BuildContext context) {
final usaAddress = Container(
child: FCSTextField(
controller: _usaAddressEditingController,
label: 'USA Delivery Address',
));
final usaAddress = fcsInput('USA Delivery Address', Icons.location_on,
controller: _usaAddressEditingController);
final mmAddress = fcsInput('Yangon, Myanmar Office', Icons.location_on,
controller: _mmAddressEditingController);
final mmAddress = Container(
child: Row(children: <Widget>[
Expanded(
child: FCSTextField(
controller: _mmAddressEditingController,
label: 'Yangon, Myanmar Office',
)),
]),
);
final contactNumber = fcsInput('USA contact number', Icons.phone,
controller: _contactEditingController);
final mmContactNumber = fcsInput('Myanmar contact number', Icons.phone,
controller: _mmContactEditingController);
final contactNumber = Container(
child: Row(children: <Widget>[
Expanded(
child: FCSTextField(
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')),
]),
);
final mailBox = fcsInput('Email Address', Icons.mail,
controller: _mailEditingController);
final fbLinkBox = fcsInput('Facebook Link', FontAwesomeIcons.facebook,
controller: _fbLinkEditingController);
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('FCS PROFILE'),
title: LocalText(
context,
'fcs.profile',
color: Colors.white,
fontSize: 20,
),
),
body: Card(
child: Column(

View File

@@ -46,6 +46,7 @@ import 'package:provider/provider.dart';
import '../theme/theme.dart';
import 'announcement_list.dart';
import 'buying_online.dart';
import 'customer_list.dart';
import 'do/do_list.dart';
import 'invoice/invoce_list.dart';
import 'my_registeration.dart';
@@ -157,13 +158,18 @@ class _HomePageState extends State<HomePage> {
final customersBtn = _buildBtn2("customers.btn",
icon: Feather.users,
btnCallback: () =>
Navigator.of(context).push(BottomUpPageRoute(StaffList())));
Navigator.of(context).push(BottomUpPageRoute(CustomerList())));
final invoicesBtn = _buildBtn2("invoices.btn",
icon: FontAwesomeIcons.fileInvoice,
btnCallback: () =>
Navigator.of(context).push(BottomUpPageRoute(InvoiceList())));
final termBtn = _buildBtn2("term.btn",
icon: FontAwesomeIcons.info,
btnCallback: () =>
Navigator.of(context).push(BottomUpPageRoute(Term())));
List<Widget> widgets = [];
widgets.add(buyingBtn);
widgets.add(pickUpBtn);
@@ -175,6 +181,7 @@ class _HomePageState extends State<HomePage> {
widgets.add(packagesBtn);
widgets.add(customersBtn);
widgets.add(invoicesBtn);
widgets.add(termBtn);
return OfflineRedirect(
child: FlavorBanner(
@@ -433,7 +440,10 @@ class _HomePageState extends State<HomePage> {
Widget _buildSmallButton(String text, IconData iconData) {
return InkWell(
onTap: () => {},
onTap: () => {
Navigator.of(context)
.push(MaterialPageRoute(builder: (_) => Contact())),
},
child: Padding(
padding: const EdgeInsets.all(18.0),
child: Row(

View File

@@ -75,110 +75,88 @@ class _PickUpEditorState extends State<PickUpEditor> {
Widget build(BuildContext context) {
var pickupModel = Provider.of<PickUpModel>(context);
final pickUpAddress = Container(
child: TextFormField(
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 pickUpAddress = fcsInput('Pickup Address', Icons.location_on,
controller: _addressEditingController);
final pickUpAddressReadOnly = Container(
child: FCSTextFieldReadOnly(
controller: _addressEditingController,
label: 'Pickup Address',
));
final pickUpAddressReadOnly = fcsInputReadOnly(
'Pickup Address', Icons.location_on,
controller: _addressEditingController);
final pickupTime = Container(
height: 50.0,
child: Row(children: <Widget>[
Container(
width: 70.0,
child: TextFormField(
final fromTimeBox = fcsInput(
'From',
Icons.timer,
controller: _fromTimeEditingController,
cursorColor: primaryColor,
decoration: new InputDecoration(
labelText: 'From',
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: primaryColor, width: 1.0)),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: primaryColor, width: 1.0)),
),
)),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(' - '),
),
Container(
width: 70.0,
child: TextFormField(
);
final toTimeBox = fcsInput(
'To',
null,
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(
height: 50.0,
child: Row(children: <Widget>[
final fromTimeBoxReadOnly = fcsInputReadOnly(
'From',
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(
width: 70.0,
child: FCSTextFieldReadOnly(
controller: _fromTimeEditingController, label: 'From')),
child: fromTimeBox,
width: 120,
),
Padding(
padding: const EdgeInsets.all(8.0),
padding: const EdgeInsets.only(left: 8.0),
child: Text('-'),
),
Container(
width: 70.0,
child: FCSTextFieldReadOnly(
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)),
child: toTimeBox,
width: 120,
),
],
),
)),
]),
);
final noOfPackageBoxReadonly = Container(
height: 50.0,
child: Row(children: <Widget>[
Expanded(
child: FCSTextFieldReadOnly(
final pickupTimeReadOnly = Padding(
padding: const EdgeInsets.only(left: 20.0),
child: Row(
children: <Widget>[
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,
label: 'Number of Packages')),
]),
);
final requestDateBox = Container(
@@ -212,7 +190,7 @@ class _PickUpEditorState extends State<PickUpEditor> {
EdgeInsets.symmetric(vertical: 10.0, horizontal: 0.0),
icon: Icon(
Icons.date_range,
color: Colors.black87,
color: Colors.grey,
)),
validator: (value) {
if (value.isEmpty) {
@@ -258,62 +236,22 @@ class _PickUpEditorState extends State<PickUpEditor> {
),
),
),
SizedBox(height: 15),
ExpansionTile(
title: Text('Pickup Location / Time'),
children: <Widget>[
Padding(
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
? pickUpAddress
: widget.pickUp.status == 'Pending'
? pickUpAddress
: pickUpAddressReadOnly),
],
: pickUpAddressReadOnly,
),
),
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
widget.pickUp == null
? pickupTime
: widget.pickUp.status == 'Pending'
? pickupTime
: pickupTimeReadOnly,
),
],
),
),
SizedBox(height: 5),
Padding(
padding: const EdgeInsets.only(left: 20.0),
child: Column(
@@ -323,7 +261,6 @@ class _PickUpEditorState extends State<PickUpEditor> {
],
),
),
SizedBox(height: 10),
],
),
ExpansionTile(
@@ -331,23 +268,11 @@ class _PickUpEditorState extends State<PickUpEditor> {
children: <Widget>[
Padding(
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
? noOfPackageBox
: widget.pickUp.status == 'Pending'
? noOfPackageBox
: noOfPackageBoxReadonly),
],
),
),
SizedBox(
height: 15,
: noOfPackageBoxReadonly,
),
Padding(
padding: const EdgeInsets.only(left: 20.0),
@@ -363,12 +288,11 @@ class _PickUpEditorState extends State<PickUpEditor> {
FontAwesomeIcons.weightHanging,
controller: _weightEditingController),
),
SizedBox(height: 15),
Padding(
padding: const EdgeInsets.only(left: 20.0),
child: fcsInput("Remark", MaterialCommunityIcons.note),
),
SizedBox(height: 25),
SizedBox(height: 10.0),
],
),
ExpansionTile(
@@ -387,22 +311,19 @@ class _PickUpEditorState extends State<PickUpEditor> {
"Name", FontAwesomeIcons.user,
controller:
_recipientNameEditingController)),
SizedBox(height: 25),
Padding(
padding: const EdgeInsets.only(left: 20.0),
child: widget.pickUp == null
? fcsInput("Phone Number", FontAwesomeIcons.phone,
? fcsInput("Phone Number", Icons.phone,
controller: _recipientPhoneEditingController)
: widget.pickUp.status == 'Pending'
? fcsInput(
"Phone Number", FontAwesomeIcons.phone,
? fcsInput("Phone Number", Icons.phone,
controller:
_recipientPhoneEditingController)
: fcsInputReadOnly(
"Phone Number", FontAwesomeIcons.phone,
"Phone Number", Icons.phone,
controller:
_recipientPhoneEditingController)),
SizedBox(height: 25),
Padding(
padding: const EdgeInsets.only(left: 20.0),
child: widget.pickUp == null
@@ -417,7 +338,6 @@ class _PickUpEditorState extends State<PickUpEditor> {
"Address", Icons.location_on,
controller:
_recipientAddressEditingController)),
SizedBox(height: 25),
],
),
ExpansionTile(
@@ -432,9 +352,6 @@ class _PickUpEditorState extends State<PickUpEditor> {
)
: Container()
: Container(),
SizedBox(
height: 25,
),
],
),
]),

View File

@@ -116,16 +116,16 @@ class _ShipmentRatesState extends State<ShipmentRates> {
),
_row("Free delivery within Yangon \nfor shipments over","10","pounds"),
_row("Delivery fees","\$ 5","below 10 pounds"),
Padding(
padding: const EdgeInsets.only(left: 18.0, right: 18),
child: RichText(
// overflow: TextOverflow.fade,
text: TextSpan(
style: TextStyle(color: primaryColor),
children: textList,
),
),
),
// Padding(
// padding: const EdgeInsets.only(left: 18.0, right: 18),
// child: RichText(
// // overflow: TextOverflow.fade,
// text: TextSpan(
// style: TextStyle(color: primaryColor),
// children: textList,
// ),
// ),
// ),
fcsButton(context, "Calculate", callack: () {
Navigator.of(context)
.push(MaterialPageRoute(builder: (_) => ShipmentRatesCal()));

View File

@@ -31,16 +31,18 @@ class _TermState extends State<Term> {
void initState() {
super.initState();
_controller = ZefyrController(_loadDocument());
print("controller terms => ${_controller.document}");
_focusNode = FocusNode();
}
NotusDocument _loadDocument() {
MainModel mainModel = Provider.of<MainModel>(context, listen: false);
String term = mainModel.setting.terms;
print("terms => $term");
NotusDocument doc;
try {
doc = NotusDocument.fromJson(jsonDecode(term));
print('doc=> $doc');
} catch (e) {}
if (doc == null) {
doc = NotusDocument();
@@ -51,7 +53,6 @@ class _TermState extends State<Term> {
@override
Widget build(BuildContext context) {
MainModel mainModel = Provider.of<MainModel>(context);
print("controller terms => ${_controller.document}");
bool isOwnerAndAbove =
mainModel.user != null && mainModel.user.isOwnerAndAbove();
@@ -89,21 +90,41 @@ class _TermState extends State<Term> {
child: Scaffold(
appBar: AppBar(
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),
backgroundColor: primaryColor,
actions: <Widget>[
isOwnerAndAbove || hasAdmin
? IconButton(
// isOwnerAndAbove || hasAdmin
// ?
IconButton(
icon: Icon(Icons.edit),
onPressed: () {
onPressed: () async {
Navigator.push(
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(

View File

@@ -14,6 +14,8 @@ import '../theme/theme.dart';
typedef void ProfileCallback();
class TermEdit extends StatefulWidget {
final ValueChanged onChangedData;
TermEdit(this.onChangedData);
@override
_TermEditState createState() => _TermEditState();
}
@@ -110,8 +112,10 @@ class _TermEditState extends State<TermEdit> {
});
try {
final contents = jsonEncode(_controller.document);
MainModel mainModel = Provider.of<MainModel>(context, listen: false);
mainModel.updateTerms(contents);
print('contents => $contents');
widget.onChangedData(_controller.document);
// MainModel mainModel = Provider.of<MainModel>(context, listen: false);
// mainModel.updateTerms(contents);
} catch (e) {
showMsgDialog(context, "Error", e.toString());
} finally {