add payment methods

This commit is contained in:
Sai Naw Wun
2020-09-18 04:04:21 +06:30
parent 33f0c4fd98
commit 00f647e915
47 changed files with 1344 additions and 1043 deletions

View File

@@ -124,6 +124,26 @@
"market.edit.name":"Market Name", "market.edit.name":"Market Name",
"market.remove.confirm":"Remove this market?", "market.remove.confirm":"Remove this market?",
"buy_online.title":"Buying instructions",
"buy_online":"Buying Instructions",
"buy_online.buying_instruction":"See below instructions to add USA shipping address while shoping online",
"buy_online.fullname":"With Full Name",
"buy_online.first.last":"With First Name and Last Name",
"pm.title":"Payment Methods",
"pm.new":"New Payment Method",
"pm.update":"Update Payment Method",
"pm.btn":"Payment Methods",
"pm.name":"Name",
"pm.account.name":"Account Name",
"pm.account.no":"Account Number",
"pm.phone":"Phone Number",
"pm.email":"Email Address",
"pm.link":"Link",
"pm.add.btn":"Add Payment Method",
"pm.save.btn":"Save Payment Method",
"pm.delete.confirm":"Delete this Payment Method?",
"btn.save": "Save", "btn.save": "Save",
"btn.approve":"Approve", "btn.approve":"Approve",
"btn.delete":"Delete", "btn.delete":"Delete",
@@ -577,15 +597,8 @@
"user.fcs_id":"MY FCS_ID", "user.fcs_id":"MY FCS_ID",
"user.shipping_address":"USA SHIPPING ADDRESS", "user.shipping_address":"USA SHIPPING ADDRESS",
"user.deliveryAddress":"My delivery address", "user.deliveryAddress":"My delivery address",
"user.buying_instruction":"See below instructions to add USA shipping address while shoping online",
"user.form.shipping_address":"ADDRESS", "user.form.shipping_address":"ADDRESS",
"buy_online":"Buying Instructions",
"buy_online.title":"BUYING INSTRUCTIONS",
"buy.amazon":"Amazon",
"buy.newegg":"Newegg",
"buy.macy":"Macy",
"buy.instruction":"Adding your shipment address in {0}",
"notifications.title":"Notification", "notifications.title":"Notification",
@@ -661,11 +674,6 @@
"remaining_balance":"Remaining Balance : ", "remaining_balance":"Remaining Balance : ",
"total.amount": "Amount :", "total.amount": "Amount :",
"payment.method.btn":"Payment Methods",
"payment.method.title":"PAYMENT METHODS",
"payment.method.new":"New Payment Method",
"payment.method.form":"PAYMENT METHOD",
"discount.btn":"Discounts", "discount.btn":"Discounts",
"discount.title":"DISCOUNTS", "discount.title":"DISCOUNTS",
"discount.new":"New Discount", "discount.new":"New Discount",

View File

@@ -125,6 +125,26 @@
"market.edit.name":"Market Name", "market.edit.name":"Market Name",
"market.remove.confirm":"Remove this market?", "market.remove.confirm":"Remove this market?",
"buy_online.title":"ဝယ်ယူရန်ညွှန်ကြားချက်များ",
"buy_online":"ဝယ်ယူရန်ညွှန်ကြားချက်များ",
"buy_online.buying_instruction":"လိပ်စာထည့်ရန် ညွှန်ကြားချက်များကို အောက်တွင်ကြည့်ပါ",
"buy_online.fullname":"နာမည် အပြည့်အစုံ",
"buy_online.first.last":"ပထမအမည် နှင့် နောက်ဆုံးအမည်",
"pm.title":"ငွေပေးချေစနစ်များ",
"pm.new":"ငွေပေးချေစနစ်အသစ်",
"pm.update":"ငွေပေးချေစနစ် ပြင်ဆင်ခြင်း",
"pm.btn":"ငွေပေးချေစနစ်များ",
"pm.name":"အမည်",
"pm.account.name":"အကောင့် အမည်",
"pm.account.no":"အကောင့် နံပါတ်",
"pm.phone":"ဖုန်း နံပါတ်",
"pm.email":"အီးမေးလ် လိပ်စာ",
"pm.link":"အင်တာနက် လင့်",
"pm.add.btn":"ပေါင်းထည့်ရန်",
"pm.save.btn":"သိမ်းဆည်းရန်",
"pm.delete.confirm":"ငွေပေးချေစနစ်ကို ဖျက်မလား?",
"btn.save":"သိမ်းဆည်းရန်", "btn.save":"သိမ်းဆည်းရန်",
"btn.approve":"အတည်ပြုရန်", "btn.approve":"အတည်ပြုရန်",
"btn.delete":"ဖျက်ရန်", "btn.delete":"ဖျက်ရန်",
@@ -607,16 +627,8 @@
"user.fcs_id":"My FCS_ID", "user.fcs_id":"My FCS_ID",
"user.shipping_address":"My USA shipping address", "user.shipping_address":"My USA shipping address",
"user.deliveryAddress":"My delivery address", "user.deliveryAddress":"My delivery address",
"user.buying_instruction":"See below instructions to add shipping address",
"user.form.shipping_address":"ကုန်ပစ္စည်းပို့ဆောင်ရမည့်လိပ်စာ", "user.form.shipping_address":"ကုန်ပစ္စည်းပို့ဆောင်ရမည့်လိပ်စာ",
"buy_online":"ဝယ်ယူရန်ညွှန်ကြားချက်များ",
"buy_online.title":"ဝယ်ယူရန်ညွှန်ကြားချက်များ",
"buy.amazon":"Amazon",
"buy.newegg":"Newegg",
"buy.macy":"Macy",
"buy.instruction":"Adding your shipment address in {0}",
"notifications.title":"Notifications", "notifications.title":"Notifications",
"shipment.title":"FCS တင်ပို့ခြင်းများ", "shipment.title":"FCS တင်ပို့ခြင်းများ",
@@ -674,11 +686,6 @@
"remaining_balance":"ပေးချေရန်ကျန်ရှိငွေ : ", "remaining_balance":"ပေးချေရန်ကျန်ရှိငွေ : ",
"total.amount": "ပမာဏ :", "total.amount": "ပမာဏ :",
"payment.method.btn":"ငွေပေးချေစနစ်",
"payment.method.title":"ငွေပေးချေစနစ်",
"payment.method.new":"ငွေပေးချေစနစ်အသစ်",
"payment.method.form":"ငွေပေးချေစနစ်",
"discount.btn":"လျှော့စျေးများ", "discount.btn":"လျှော့စျေးများ",
"discount.title":"လျှော့စျေးများ", "discount.title":"လျှော့စျေးများ",
"discount.new":"လျှော့စျေး", "discount.new":"လျှော့စျေး",

View File

@@ -3,7 +3,7 @@ import 'dart:io';
import 'package:fcs/fcs/common/localization/app_translations_delegate.dart'; import 'package:fcs/fcs/common/localization/app_translations_delegate.dart';
import 'package:fcs/fcs/common/localization/transalation.dart'; import 'package:fcs/fcs/common/localization/transalation.dart';
import 'package:fcs/fcs/common/pages/contact/model/contact_model.dart'; import 'package:fcs/fcs/common/pages/contact/model/contact_model.dart';
import 'package:fcs/fcs/common/pages/customers/model/customer_model.dart'; import 'package:fcs/fcs/common/pages/customer/model/customer_model.dart';
import 'package:fcs/fcs/common/pages/faq/model/faq_model.dart'; import 'package:fcs/fcs/common/pages/faq/model/faq_model.dart';
import 'package:fcs/fcs/common/pages/initial_language_selection.dart'; import 'package:fcs/fcs/common/pages/initial_language_selection.dart';
import 'package:fcs/fcs/common/pages/market/model/market_model.dart'; import 'package:fcs/fcs/common/pages/market/model/market_model.dart';
@@ -11,6 +11,7 @@ import 'package:fcs/fcs/common/pages/model/language_model.dart';
import 'package:fcs/fcs/common/pages/model/main_model.dart' as fcs; import 'package:fcs/fcs/common/pages/model/main_model.dart' as fcs;
import 'package:fcs/fcs/common/pages/package/model/package_model.dart'; import 'package:fcs/fcs/common/pages/package/model/package_model.dart';
import 'package:fcs/fcs/common/pages/package/model/shipment_model.dart'; import 'package:fcs/fcs/common/pages/package/model/shipment_model.dart';
import 'package:fcs/fcs/common/pages/payment_methods/model/payment_method_model.dart';
import 'package:fcs/fcs/common/pages/staff/model/staff_model.dart'; import 'package:fcs/fcs/common/pages/staff/model/staff_model.dart';
import 'package:fcs/fcs/common/pages/term/model/term_model.dart'; import 'package:fcs/fcs/common/pages/term/model/term_model.dart';
import 'package:fcs/fcs/common/services/services.dart'; import 'package:fcs/fcs/common/services/services.dart';
@@ -64,6 +65,7 @@ class _AppState extends State<App> {
final TermModel termModel = new TermModel(); final TermModel termModel = new TermModel();
final MainModel mainModel = new MainModel(); final MainModel mainModel = new MainModel();
final FAQModel faqModel = new FAQModel(); final FAQModel faqModel = new FAQModel();
final PaymentMethodModel paymentMethodModel = new PaymentMethodModel();
final UserModel userModel = new UserModel(); final UserModel userModel = new UserModel();
final ProductModel productModel = new ProductModel(); final ProductModel productModel = new ProductModel();
@@ -259,6 +261,7 @@ class _AppState extends State<App> {
ChangeNotifierProvider.value(value: contactModel), ChangeNotifierProvider.value(value: contactModel),
ChangeNotifierProvider.value(value: termModel), ChangeNotifierProvider.value(value: termModel),
ChangeNotifierProvider.value(value: faqModel), ChangeNotifierProvider.value(value: faqModel),
ChangeNotifierProvider.value(value: paymentMethodModel),
ChangeNotifierProvider.value(value: marketModel), ChangeNotifierProvider.value(value: marketModel),
], ],
child: Consumer<LanguageModel>( child: Consumer<LanguageModel>(

View File

@@ -0,0 +1,23 @@
import 'package:fcs/fcs/common/domain/entities/payment_method.dart';
import 'package:fcs/fcs/common/helpers/api_helper.dart';
import 'package:fcs/fcs/common/helpers/firebase_helper.dart';
import 'package:logging/logging.dart';
class CommonDataProvider {
final log = Logger('CommonDataProvider');
Future<void> createPaymentMethod(PaymentMethod paymentMethod) async {
return await requestAPI("/payment_methods", "POST",
payload: paymentMethod.toMap(), token: await getToken());
}
Future<void> updatePaymentMethod(PaymentMethod paymentMethod) async {
return await requestAPI("/payment_methods", "PUT",
payload: paymentMethod.toMap(), token: await getToken());
}
Future<void> deletePaymentMethod(String id) async {
return await requestAPI("/payment_methods", "DELETE",
payload: {"id": id}, token: await getToken());
}
}

View File

@@ -9,25 +9,23 @@ class FAQ {
String question(bool isEng) => isEng ? questionEng : questionMm; String question(bool isEng) => isEng ? questionEng : questionMm;
String answer(bool isEng) => isEng ? answerEng : answerMm; String answer(bool isEng) => isEng ? answerEng : answerMm;
Map<String, String> imageUrls; FAQ({
FAQ( this.id,
{this.id, this.sn,
this.sn, this.questionEng,
this.questionEng, this.questionMm,
this.questionMm, this.answerEng,
this.answerEng, this.answerMm,
this.answerMm, });
this.imageUrls});
Map<String, dynamic> toMap() { Map<String, dynamic> toMap() {
return { return {
'id': id, 'id': id,
'sn':sn, 'sn': sn,
'question_eng': questionEng, 'question_eng': questionEng,
'answer_eng': answerEng, 'answer_eng': answerEng,
'question_mm': questionMm, 'question_mm': questionMm,
'answer_mm': answerMm, 'answer_mm': answerMm,
'images': imageUrls,
}; };
} }
@@ -39,7 +37,6 @@ class FAQ {
answerEng: map['answer_eng'], answerEng: map['answer_eng'],
questionMm: map['question_mm'], questionMm: map['question_mm'],
answerMm: map['answer_mm'], answerMm: map['answer_mm'],
imageUrls: Map.from(map['images'] ?? Map<String, String>()),
); );
} }

View File

@@ -0,0 +1,42 @@
class PaymentMethod {
String id;
String name;
String accountName;
String account;
String phone;
String email;
String link;
PaymentMethod(
{this.id,
this.name,
this.accountName,
this.account,
this.phone,
this.email,
this.link});
factory PaymentMethod.fromMap(Map<String, dynamic> map, String id) {
return PaymentMethod(
id: id,
name: map['name'],
accountName: map['account_name'],
account: map['account'],
phone: map['phone'],
email: map['email'],
link: map['link'],
);
}
Map<String, dynamic> toMap() {
return {
'id': id,
'name': name,
"account_name": accountName,
"account": account,
"phone": phone,
"email": email,
"link": link,
};
}
}

View File

@@ -24,10 +24,11 @@ class Setting {
String facebookLink; String facebookLink;
bool inviteRequired; bool inviteRequired;
String appUrl; String appUrl;
final String termsEng;
final String termsMm;
final String okEnergyId; final String okEnergyId;
final String about; final String about;
final String terms;
int poExpireInHours; int poExpireInHours;
int doExpireInHours; int doExpireInHours;
int poOpenAt; int poOpenAt;
@@ -88,9 +89,10 @@ class Setting {
this.facebookLink, this.facebookLink,
this.inviteRequired, this.inviteRequired,
this.appUrl, this.appUrl,
this.termsEng,
this.termsMm,
this.about, this.about,
this.okEnergyId, this.okEnergyId,
this.terms,
this.poExpireInHours, this.poExpireInHours,
this.doExpireInHours, this.doExpireInHours,
this.poOpenAt, this.poOpenAt,
@@ -136,7 +138,8 @@ class Setting {
emailAddress: map['email_address'], emailAddress: map['email_address'],
facebookLink: map['facebook_link'], facebookLink: map['facebook_link'],
about: map['about'], about: map['about'],
terms: map['terms'], termsEng: map['terms_eng'],
termsMm: map['terms_mm'],
priceLastUpdate: ts?.toDate(), priceLastUpdate: ts?.toDate(),
okEnergyId: map['ok_energy_id'], okEnergyId: map['ok_energy_id'],
poExpireInHours: map['po_expire_hours'], poExpireInHours: map['po_expire_hours'],
@@ -161,7 +164,8 @@ class Setting {
Map<String, dynamic> toMap() { Map<String, dynamic> toMap() {
return { return {
'terms': terms, 'terms_eng': termsEng,
'terms_mm': termsMm,
}; };
} }

View File

@@ -1,25 +1,24 @@
import 'package:fcs/fcs/common/domain/entities/setting.dart'; import 'package:fcs/fcs/common/domain/entities/setting.dart';
class Term { class Term {
String term; String termEng;
String termMm;
Term({ Term({this.termEng, this.termMm});
this.term,
});
factory Term.fromSetting(Setting setting) { factory Term.fromSetting(Setting setting) {
return Term( return Term(termEng: setting.termsEng, termMm: setting.termsMm);
term: setting.terms,);
} }
Map<String, dynamic> toMap() { Map<String, dynamic> toMap() {
return { return {
'terms': term, 'terms_eng': termEng,
'terms_mm': termMm,
}; };
} }
@override @override
String toString() { String toString() {
return 'Contact{terms:$term}'; return 'Contact{terms_eng:$termEng}';
} }
} }

View File

@@ -0,0 +1,130 @@
import 'package:fcs/fcs/common/helpers/theme.dart';
import 'package:fcs/fcs/common/pages/model/main_model.dart';
import 'package:fcs/fcs/common/pages/util.dart';
import 'package:fcs/fcs/common/pages/widgets/display_text.dart';
import 'package:fcs/fcs/common/pages/widgets/fcs_id_icon.dart';
import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class BuyingOnlinePage extends StatefulWidget {
@override
_BuyingOnlinePagetate createState() => _BuyingOnlinePagetate();
}
class _BuyingOnlinePagetate extends State<BuyingOnlinePage>
with SingleTickerProviderStateMixin {
TabController _tabController;
@override
void initState() {
_tabController = TabController(vsync: this, length: 2);
super.initState();
}
@override
Widget build(BuildContext context) {
MainModel mainModel = Provider.of<MainModel>(context);
final phoneNumberBox = DisplayText(
text: mainModel.user.phone,
labelText: getLocalString(context, "contact.phone"),
iconData: Icons.location_on,
);
final nameBox = Center(
child: Text(
mainModel.user.name,
style: TextStyle(fontSize: 18, color: primaryColor),
));
final fcsIdBox = DisplayText(
text: mainModel.user.fcsID,
labelText: getLocalString(context, "customer.fcs.id"),
icon: FcsIDIcon(),
);
final shippingAddressBox = DisplayText(
text: mainModel.setting.usaAddress,
labelText: getLocalString(context, "profile.usa.shipping.address"),
iconData: Icons.location_on,
);
final instructionBox = Container(
padding: EdgeInsets.only(left: 10, top: 30, bottom: 10),
child: Center(
child: Wrap(
children: <Widget>[
LocalText(
context,
'buy_online.buying_instruction',
color: labelColor,
fontSize: 15,
)
],
),
),
);
return Scaffold(
appBar: AppBar(
centerTitle: true,
leading: new IconButton(
icon: new Icon(
Icons.close,
color: primaryColor,
),
onPressed: () => Navigator.of(context).pop(),
),
title: LocalText(
context,
"buy_online.title",
fontSize: 20,
color: primaryColor,
),
backgroundColor: Colors.white,
shadowColor: Colors.transparent,
),
body: ListView(
shrinkWrap: true,
padding: EdgeInsets.only(top: 10, left: 10, right: 10),
children: <Widget>[
nameBox,
phoneNumberBox,
fcsIdBox,
shippingAddressBox,
instructionBox,
new Container(
decoration: new BoxDecoration(color: Colors.white),
child: new TabBar(
// indicatorColor: primaryColor,
labelColor: primaryColor,
labelStyle: TextStyle(fontWeight: FontWeight.bold),
unselectedLabelColor: Colors.grey,
controller: _tabController,
tabs: [
LocalText(context, "buy_online.fullname"),
LocalText(context, "buy_online.first.last"),
],
),
),
new Container(
padding: EdgeInsets.only(top: 10),
height: 500,
width: 500,
child: new TabBarView(
controller: _tabController,
children: <Widget>[
Container(
child:
Image.asset('assets/Fullname.png', fit: BoxFit.contain),
),
Container(
child: Image.asset('assets/FirstName&LastName.png',
fit: BoxFit.contain),
),
],
),
),
SizedBox(height: 10)
],
),
);
}
}

View File

@@ -4,6 +4,7 @@ import 'package:fcs/fcs/common/localization/app_translations.dart';
import 'package:fcs/fcs/common/pages/contact/model/contact_model.dart'; import 'package:fcs/fcs/common/pages/contact/model/contact_model.dart';
import 'package:fcs/fcs/common/pages/util.dart'; import 'package:fcs/fcs/common/pages/util.dart';
import 'package:fcs/fcs/common/pages/widgets/input_text.dart'; import 'package:fcs/fcs/common/pages/widgets/input_text.dart';
import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
import 'package:fcs/fcs/common/pages/widgets/progress.dart'; import 'package:fcs/fcs/common/pages/widgets/progress.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -27,7 +28,6 @@ class _ContactEditorState extends State<ContactEditor> {
TextEditingController _email = new TextEditingController(); TextEditingController _email = new TextEditingController();
TextEditingController _facebook = new TextEditingController(); TextEditingController _facebook = new TextEditingController();
final _formKey = GlobalKey<FormState>();
bool _isLoading = false; bool _isLoading = false;
@override @override
@@ -76,61 +76,51 @@ class _ContactEditorState extends State<ContactEditor> {
return LocalProgress( return LocalProgress(
inAsyncCall: _isLoading, inAsyncCall: _isLoading,
child: Scaffold( child: Scaffold(
body: CustomScrollView(slivers: [ appBar: AppBar(
SliverAppBar( centerTitle: true,
leading: IconButton( leading: new IconButton(
icon: Icon( icon: new Icon(CupertinoIcons.back, color: primaryColor),
CupertinoIcons.back,
size: 30,
),
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
), ),
backgroundColor: primaryColor, shadowColor: Colors.transparent,
expandedHeight: 150.0, backgroundColor: Colors.white,
floating: false, title: LocalText(
pinned: true, context,
flexibleSpace: FlexibleSpaceBar( 'contact.edit.title',
centerTitle: true, color: primaryColor,
titlePadding: EdgeInsets.symmetric(vertical: 10), fontSize: 20,
title: )),
Text(AppTranslations.of(context).text('contact.edit.title'), body: ListView(
style: TextStyle( children: [
color: Colors.white, Padding(
)), padding: const EdgeInsets.only(left: 18.0, right: 18),
), child: Column(
), children: [
SliverList( itemTitle(context, "contact.callus"),
delegate: SliverChildListDelegate([ usaPhoneBox,
Padding( mmPhoneBox,
padding: const EdgeInsets.only(left: 18.0, right: 18), Divider(),
child: Column( itemTitle(context, "contact.findus"),
children: [ usaAddreesBox,
itemTitle(context, "contact.callus"), mmAddressBox,
usaPhoneBox, Divider(),
mmPhoneBox, itemTitle(context, "contact.emailus"),
Divider(), emailBox,
itemTitle(context, "contact.findus"), Divider(),
usaAddreesBox, itemTitle(context, "contact.visitus"),
mmAddressBox, faceBookBox,
Divider(), SizedBox(
itemTitle(context, "contact.emailus"), height: 10,
emailBox, ),
Divider(), saveBox,
itemTitle(context, "contact.visitus"), SizedBox(
faceBookBox, height: 20,
SizedBox( )
height: 10, ],
),
saveBox,
SizedBox(
height: 20,
)
],
),
), ),
]), ),
) ],
]), ),
)); ));
} }

View File

@@ -4,6 +4,7 @@ import 'package:fcs/fcs/common/helpers/theme.dart';
import 'package:fcs/fcs/common/localization/app_translations.dart'; import 'package:fcs/fcs/common/localization/app_translations.dart';
import 'package:fcs/fcs/common/pages/contact/contact_editor.dart'; import 'package:fcs/fcs/common/pages/contact/contact_editor.dart';
import 'package:fcs/fcs/common/pages/model/main_model.dart'; import 'package:fcs/fcs/common/pages/model/main_model.dart';
import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.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';
@@ -25,45 +26,40 @@ class _ContactPageState extends State<ContactPage> {
bool isEditable = context.select((MainModel m) => m.contactEditable()); bool isEditable = context.select((MainModel m) => m.contactEditable());
return Scaffold( return Scaffold(
body: CustomScrollView(slivers: [ appBar: AppBar(
SliverAppBar( centerTitle: true,
leading: IconButton( leading: new IconButton(
icon: Icon( icon: new Icon(
CupertinoIcons.back, Icons.close,
size: 30, color: primaryColor,
),
onPressed: () => Navigator.of(context).pop(),
), ),
backgroundColor: primaryColor, onPressed: () => Navigator.of(context).pop(),
expandedHeight: 100.0,
floating: false,
pinned: true,
flexibleSpace: FlexibleSpaceBar(
centerTitle: true,
titlePadding: EdgeInsets.symmetric(vertical: 10),
title: Text(AppTranslations.of(context).text('contact.title'),
style: TextStyle(
color: Colors.white,
)),
),
actions: isEditable
? [
IconButton(
onPressed: () =>
Navigator.of(context).push<void>(CupertinoPageRoute(
builder: (context) => ContactEditor(
contact: Contact.fromSetting(setting),
),
)),
icon: Icon(
CupertinoIcons.pen,
color: Colors.white,
))
]
: [],
), ),
SliverList( shadowColor: Colors.transparent,
delegate: SliverChildListDelegate([ backgroundColor: Colors.white,
title: LocalText(
context,
'contact.title',
color: primaryColor,
fontSize: 20,
),
actions: isEditable
? [
IconButton(
onPressed: () =>
Navigator.of(context).push<void>(CupertinoPageRoute(
builder: (context) => ContactEditor(
contact: Contact.fromSetting(setting)),
)),
icon: Icon(
CupertinoIcons.pen,
color: primaryColor,
))
]
: [],
),
body: ListView(
children: [
itemTitle(context, "contact.callus"), itemTitle(context, "contact.callus"),
contactItem(context, setting.usaContactNumber, CupertinoIcons.phone, contactItem(context, setting.usaContactNumber, CupertinoIcons.phone,
onTap: () => _call(setting.usaContactNumber), onTap: () => _call(setting.usaContactNumber),
@@ -106,8 +102,8 @@ class _ContactPageState extends State<ContactPage> {
onTap: () => _opencontactItem(setting.facebookLink), onTap: () => _opencontactItem(setting.facebookLink),
labelKey: "contact.facebook", labelKey: "contact.facebook",
), ),
])) ],
]), ),
); );
} }

View File

@@ -1,9 +1,9 @@
import 'package:fcs/fcs/common/domain/entities/user.dart'; import 'package:fcs/fcs/common/domain/entities/user.dart';
import 'package:fcs/fcs/common/helpers/theme.dart'; import 'package:fcs/fcs/common/helpers/theme.dart';
import 'package:fcs/fcs/common/pages/customers/model/customer_model.dart'; import 'package:fcs/fcs/common/pages/customer/model/customer_model.dart';
import 'package:fcs/fcs/common/pages/util.dart'; import 'package:fcs/fcs/common/pages/util.dart';
import 'package:fcs/fcs/common/pages/widgets/display_text.dart'; import 'package:fcs/fcs/common/pages/widgets/display_text.dart';
import 'package:fcs/fcs/common/pages/widgets/local_text.dart'; import 'package:fcs/fcs/common/pages/widgets/fcs_id_icon.dart';
import 'package:fcs/fcs/common/pages/widgets/progress.dart'; import 'package:fcs/fcs/common/pages/widgets/progress.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@@ -78,7 +78,7 @@ class _CustomerEditorState extends State<CustomerEditor> {
DisplayText( DisplayText(
text: widget.customer.fcsID, text: widget.customer.fcsID,
labelText: getLocalString(context, "customer.fcs.id"), labelText: getLocalString(context, "customer.fcs.id"),
iconData: Icons.account_circle, icon: FcsIDIcon(),
), ),
SizedBox( SizedBox(
height: 20, height: 20,

View File

@@ -1,20 +1,20 @@
import 'package:fcs/fcs/common/domain/constants.dart'; import 'package:fcs/fcs/common/domain/constants.dart';
import 'package:fcs/fcs/common/domain/entities/user.dart'; import 'package:fcs/fcs/common/domain/entities/user.dart';
import 'package:fcs/fcs/common/helpers/theme.dart'; import 'package:fcs/fcs/common/helpers/theme.dart';
import 'package:fcs/fcs/common/pages/customers/customer_editor.dart'; import 'package:fcs/fcs/common/pages/customer/customer_editor.dart';
import 'package:fcs/fcs/common/pages/customers/invitation_list.dart'; import 'package:fcs/fcs/common/pages/customer/model/customer_model.dart';
import 'package:fcs/fcs/common/pages/customers/model/customer_model.dart'; import 'package:fcs/fcs/common/pages/model/main_model.dart';
import 'package:fcs/fcs/common/pages/util.dart';
import 'package:fcs/fcs/common/pages/widgets/bottom_up_page_route.dart'; import 'package:fcs/fcs/common/pages/widgets/bottom_up_page_route.dart';
import 'package:fcs/fcs/common/pages/widgets/local_text.dart'; import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
import 'package:fcs/widget/progress.dart'; import 'package:fcs/widget/progress.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_icons/flutter_icons.dart'; import 'package:flutter_icons/flutter_icons.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:share/share.dart';
import 'invitation_create.dart'; import 'invitation_create.dart';
import 'invitation_editor.dart';
class CustomerList extends StatefulWidget { class CustomerList extends StatefulWidget {
@override @override
@@ -36,7 +36,7 @@ class _CustomerListState extends State<CustomerList> {
appBar: AppBar( appBar: AppBar(
centerTitle: true, centerTitle: true,
leading: new IconButton( leading: new IconButton(
icon: new Icon(Icons.close), icon: new Icon(CupertinoIcons.back),
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
), ),
actions: <Widget>[ actions: <Widget>[
@@ -52,9 +52,9 @@ class _CustomerListState extends State<CustomerList> {
backgroundColor: primaryColor, backgroundColor: primaryColor,
title: LocalText( title: LocalText(
context, context,
'customer.list.title', "customer.list.title",
color: Colors.white,
fontSize: 20, fontSize: 20,
color: Colors.white,
), ),
), ),
floatingActionButton: FloatingActionButton.extended( floatingActionButton: FloatingActionButton.extended(
@@ -89,68 +89,78 @@ class _CustomerListState extends State<CustomerList> {
} }
Widget _item(User customer) { Widget _item(User customer) {
return Stack( return InkWell(
children: <Widget>[ onTap: () => _select(customer),
InkWell( child: Row(
onTap: () => _select(customer), children: <Widget>[
child: Row( Expanded(
children: <Widget>[ child: new Padding(
Expanded( padding: const EdgeInsets.symmetric(vertical: 8.0),
child: new Padding( child: new Row(
padding: const EdgeInsets.symmetric(vertical: 10.0), children: <Widget>[
child: new Row( Icon(
children: <Widget>[ Feather.user,
new Padding( color: primaryColor,
padding: new EdgeInsets.symmetric( size: 40,
horizontal: 32.0 - dotSize / 2),
child: Icon(
Feather.user,
color: primaryColor,
size: 40,
),
),
new Expanded(
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new Text(
customer.name,
style: new TextStyle(
fontSize: 15.0, color: primaryColor),
),
Padding(
padding: const EdgeInsets.only(top: 8.0),
child: new Text(
customer.phoneNumber,
style: new TextStyle(
fontSize: 15.0, color: Colors.grey),
),
),
],
),
),
],
), ),
), new Expanded(
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new Text(
customer.name,
style: new TextStyle(
fontSize: 15.0, color: primaryColor),
),
Padding(
padding: const EdgeInsets.only(top: 8.0),
child: new Text(
customer.phoneNumber,
style: new TextStyle(
fontSize: 15.0, color: Colors.grey),
),
),
],
),
),
],
), ),
),
),
Column(
children: [
Padding( Padding(
padding: const EdgeInsets.only(right: 10), padding: const EdgeInsets.only(right: 5),
child: _status(customer.status), child: _status(customer.status),
), ),
customer.status == user_invited_status
? FlatButton(
onPressed: () => _share(customer),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18.0),
side: BorderSide(color: primaryColor)),
child: Row(
children: [
Text(
"Share",
style: TextStyle(fontSize: 12),
),
Icon(Icons.share, color: primaryColor),
],
),
)
: Container(),
], ],
), ),
), ],
], ),
); );
} }
Widget _status(String status) { Widget _status(String status) {
return Text( return user_requested_status == status
(user_requested_status == status || user_invited_status == status) ? Text(status, style: TextStyle(color: primaryColor, fontSize: 14))
? status : Container();
: "",
style: TextStyle(color: primaryColor, fontSize: 14),
);
} }
_select(User customer) { _select(User customer) {
@@ -158,7 +168,14 @@ class _CustomerListState extends State<CustomerList> {
.push(BottomUpPageRoute(CustomerEditor(customer: customer))); .push(BottomUpPageRoute(CustomerEditor(customer: customer)));
} }
_invitations() { _share(User user) async {
Navigator.of(context).push(BottomUpPageRoute(InvitationList())); MainModel mainModel = Provider.of<MainModel>(context, listen: false);
String appUrl = mainModel.setting.appUrl;
final RenderBox box = context.findRenderObject();
await Share.share(
"Join us on FCS Logistics App. Here is the link:\n $appUrl\n" +
user.share,
subject: "Invitation to FCS Logistics App",
sharePositionOrigin: box.localToGlobal(Offset.zero) & box.size);
} }
} }

View File

@@ -1,8 +1,9 @@
import 'package:country_code_picker/country_code_picker.dart'; import 'package:country_code_picker/country_code_picker.dart';
import 'package:fcs/fcs/common/helpers/theme.dart'; import 'package:fcs/fcs/common/helpers/theme.dart';
import 'package:fcs/fcs/common/localization/app_translations.dart'; import 'package:fcs/fcs/common/localization/app_translations.dart';
import 'package:fcs/fcs/common/pages/customers/model/customer_model.dart'; import 'package:fcs/fcs/common/pages/customer/model/customer_model.dart';
import 'package:fcs/fcs/common/pages/util.dart'; import 'package:fcs/fcs/common/pages/util.dart';
import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
import 'package:fcs/widget/progress.dart'; import 'package:fcs/widget/progress.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@@ -36,22 +37,29 @@ class _InvitationCreateState extends State<InvitationCreate> {
inAsyncCall: _isLoading, inAsyncCall: _isLoading,
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
backgroundColor: Colors.white,
shadowColor: Colors.transparent,
centerTitle: true, centerTitle: true,
leading: new IconButton( leading: new IconButton(
icon: new Icon( icon: new Icon(
Icons.close, Icons.close,
color: primaryColor,
), ),
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
), ),
backgroundColor: primaryColor, title: LocalText(
title: Text(AppTranslations.of(context).text("invitation.new")), context,
"invitation.new",
fontSize: 20,
color: primaryColor,
),
), ),
body: Container( body: Container(
padding: EdgeInsets.all(18), padding: EdgeInsets.all(18),
child: ListView( child: ListView(
children: <Widget>[ children: <Widget>[
fcsInput(getLocalString(context, "customer.name"), Icons.person, fcsInput(getLocalString(context, "customer.name"), Icons.person,
controller: _nameController, autoFocus: true), controller: _nameController, autoFocus: false),
SizedBox(height: 10), SizedBox(height: 10),
Row( Row(
children: <Widget>[ children: <Widget>[

View File

@@ -1,16 +1,11 @@
import 'package:fcs/fcs/common/domain/entities/customer.dart';
import 'package:fcs/fcs/common/domain/entities/role.dart';
import 'package:fcs/fcs/common/domain/entities/user.dart'; import 'package:fcs/fcs/common/domain/entities/user.dart';
import 'package:fcs/fcs/common/localization/app_translations.dart'; import 'package:fcs/fcs/common/helpers/theme.dart';
import 'package:fcs/fcs/common/pages/customers/model/customer_model.dart'; import 'package:fcs/fcs/common/pages/customer/model/customer_model.dart';
import 'package:fcs/fcs/common/pages/model/language_model.dart';
import 'package:fcs/fcs/common/pages/util.dart'; import 'package:fcs/fcs/common/pages/util.dart';
import 'package:fcs/fcs/common/pages/widgets/display_text.dart'; import 'package:fcs/fcs/common/pages/widgets/display_text.dart';
import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
import 'package:fcs/fcs/common/pages/widgets/progress.dart'; import 'package:fcs/fcs/common/pages/widgets/progress.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:fcs/fcs/common/helpers/theme.dart';
typedef void FindCallBack(); typedef void FindCallBack();

View File

@@ -1,148 +0,0 @@
import 'package:fcs/fcs/common/pages/model/main_model.dart';
import 'package:share/share.dart';
import 'package:fcs/fcs/common/domain/entities/user.dart';
import 'package:fcs/fcs/common/localization/app_translations.dart';
import 'package:fcs/fcs/common/pages/customers/invitation_create.dart';
import 'package:fcs/fcs/common/pages/customers/model/customer_model.dart';
import 'package:fcs/fcs/common/pages/util.dart';
import 'package:fcs/fcs/common/pages/widgets/bottom_up_page_route.dart';
import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
import 'package:fcs/fcs/common/pages/widgets/progress.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/fcs/common/helpers/theme.dart';
import 'invitation_editor.dart';
class InvitationList extends StatefulWidget {
@override
_InvitationListState createState() => _InvitationListState();
}
class _InvitationListState extends State<InvitationList> {
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>[],
backgroundColor: primaryColor,
title: LocalText(
context,
'invitation.list',
color: Colors.white,
fontSize: 20,
),
),
floatingActionButton: FloatingActionButton.extended(
onPressed: () {
Navigator.of(context).push(BottomUpPageRoute(InvitationCreate()));
},
icon: Icon(Icons.add),
label: LocalText(context, "invitation.new", color: Colors.white),
backgroundColor: primaryColor,
),
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.invitations.length,
itemBuilder: (BuildContext context, int index) {
User customer = customerModel.invitations[index];
return _item(customer);
}),
),
);
}
Widget _item(User customer) {
return Stack(
children: <Widget>[
InkWell(
onTap: () {
Navigator.of(context)
.push(BottomUpPageRoute(InvitationEditor(customer: customer)));
},
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.user,
color: primaryColor,
size: 40,
),
),
new Expanded(
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new Text(
customer.name,
style: new TextStyle(
fontSize: 15.0, color: primaryColor),
),
Padding(
padding: const EdgeInsets.only(top: 8.0),
child: new Text(
customer.phoneNumber,
style: new TextStyle(
fontSize: 15.0, color: Colors.grey),
),
),
],
),
),
],
),
),
),
FlatButton(
onPressed: () => _share(customer),
child: Row(
children: [
Text("Share"),
Icon(Icons.share),
],
)),
],
),
),
],
);
}
_share(User user) async {
MainModel mainModel = Provider.of<MainModel>(context, listen: false);
String appUrl = mainModel.setting.appUrl;
final RenderBox box = context.findRenderObject();
await Share.share(
user.share + "\n Please join us from this link:\n $appUrl",
subject: "Invitation to FCS App",
sharePositionOrigin: box.localToGlobal(Offset.zero) & box.size);
}
}

View File

@@ -5,6 +5,7 @@ import 'package:fcs/fcs/common/pages/faq/model/faq_model.dart';
import 'package:fcs/fcs/common/pages/faq/widgets.dart'; import 'package:fcs/fcs/common/pages/faq/widgets.dart';
import 'package:fcs/fcs/common/pages/util.dart'; import 'package:fcs/fcs/common/pages/util.dart';
import 'package:fcs/fcs/common/pages/widgets/input_text.dart'; import 'package:fcs/fcs/common/pages/widgets/input_text.dart';
import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
import 'package:fcs/fcs/common/pages/widgets/progress.dart'; import 'package:fcs/fcs/common/pages/widgets/progress.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -89,15 +90,14 @@ class _FAQEditorState extends State<FAQEditor> {
floating: true, floating: true,
pinned: true, pinned: true,
flexibleSpace: FlexibleSpaceBar( flexibleSpace: FlexibleSpaceBar(
centerTitle: true, centerTitle: true,
titlePadding: EdgeInsets.symmetric(vertical: 10), titlePadding: EdgeInsets.symmetric(vertical: 10),
title: Text( title: LocalText(
AppTranslations.of(context) context,
.text(_isNew ? 'faq.add.title' : 'faq.edit.title'), _isNew ? 'faq.add.title' : 'faq.edit.title',
style: TextStyle( fontSize: 20,
color: Colors.white, color: Colors.white,
)), )),
),
), ),
SliverList( SliverList(
delegate: SliverChildListDelegate([ delegate: SliverChildListDelegate([

View File

@@ -68,10 +68,12 @@ class _FAQListPageState extends State<FAQListPage>
centerTitle: true, centerTitle: true,
titlePadding: titlePadding:
EdgeInsets.symmetric(vertical: 10, horizontal: 45), EdgeInsets.symmetric(vertical: 10, horizontal: 45),
title: Text(AppTranslations.of(context).text('faq.title'), title: LocalText(
style: TextStyle( context,
color: Colors.white, "faq.title",
)), fontSize: 20,
color: Colors.white,
),
), ),
actions: isEditable actions: isEditable
? [ ? [

View File

@@ -1,17 +1,18 @@
import 'package:fcs/fcs/common/domain/entities/user.dart'; import 'package:fcs/fcs/common/domain/entities/user.dart';
import 'package:fcs/fcs/common/localization/transalation.dart'; import 'package:fcs/fcs/common/localization/transalation.dart';
import 'package:fcs/fcs/common/pages/customers/customer_list.dart'; import 'package:fcs/fcs/common/pages/buying_instruction/buying_online.dart';
import 'package:fcs/fcs/common/pages/customer/customer_list.dart';
import 'package:fcs/fcs/common/pages/faq/faq_list_page.dart'; import 'package:fcs/fcs/common/pages/faq/faq_list_page.dart';
import 'package:fcs/fcs/common/pages/model/language_model.dart'; import 'package:fcs/fcs/common/pages/model/language_model.dart';
import 'package:fcs/fcs/common/pages/model/main_model.dart'; import 'package:fcs/fcs/common/pages/model/main_model.dart';
import 'package:fcs/fcs/common/pages/package/package_list.dart'; import 'package:fcs/fcs/common/pages/package/package_list.dart';
import 'package:fcs/fcs/common/pages/payment_methods/payment_method_page.dart';
import 'package:fcs/fcs/common/pages/staff/staff_list.dart'; import 'package:fcs/fcs/common/pages/staff/staff_list.dart';
import 'package:fcs/fcs/common/pages/util.dart'; import 'package:fcs/fcs/common/pages/util.dart';
import 'package:fcs/fcs/common/pages/widgets/action_button.dart'; import 'package:fcs/fcs/common/pages/widgets/action_button.dart';
import 'package:fcs/fcs/common/pages/widgets/bottom_widgets.dart'; import 'package:fcs/fcs/common/pages/widgets/bottom_widgets.dart';
import 'package:fcs/pages/discount_list.dart'; import 'package:fcs/pages/discount_list.dart';
import 'package:fcs/pages/notification_list.dart'; import 'package:fcs/pages/notification_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/term.dart'; import 'package:fcs/pages/term.dart';
import 'package:fcs/pages_fcs/box_list.dart'; import 'package:fcs/pages_fcs/box_list.dart';
@@ -28,7 +29,6 @@ import 'package:intl/intl.dart';
import 'package:logging/logging.dart'; import 'package:logging/logging.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../../../pages/buying_online.dart';
import '../../../pages/fcs_profile_page.dart'; import '../../../pages/fcs_profile_page.dart';
import '../../../pages/invoice/invoce_list.dart'; import '../../../pages/invoice/invoce_list.dart';
import '../../../pages/pickup_list.dart'; import '../../../pages/pickup_list.dart';
@@ -88,8 +88,8 @@ class _HomePageState extends State<HomePage> {
final packagesBtn = _buildBtn("package.btn.name", final packagesBtn = _buildBtn("package.btn.name",
icon: Octicons.package, icon: Octicons.package,
btnCallback: () => btnCallback: () => Navigator.of(context).push<void>(
Navigator.of(context).push(BottomUpPageRoute(PackageList()))); CupertinoPageRoute(builder: (context) => PackageList())));
final boxesBtn = _buildBtn("boxes.name", final boxesBtn = _buildBtn("boxes.name",
icon: MaterialCommunityIcons.package, icon: MaterialCommunityIcons.package,
@@ -138,22 +138,26 @@ class _HomePageState extends State<HomePage> {
); );
}); });
final staffBtn = _buildBtn("staff.title", final staffBtn = _buildBtn(
icon: MaterialCommunityIcons.worker, "staff.title",
btnCallback: () => icon: MaterialCommunityIcons.worker,
Navigator.of(context).push(BottomUpPageRoute(StaffList()))); btnCallback: () => Navigator.of(context).push<void>(CupertinoPageRoute(
builder: (context) => StaffList(),
)),
);
final customersBtn = _buildBtn("customers.btn", final customersBtn = _buildBtn("customers.btn",
icon: Feather.users, icon: Feather.users,
btnCallback: () => btnCallback: () => Navigator.of(context).push<void>(CupertinoPageRoute(
Navigator.of(context).push(BottomUpPageRoute(CustomerList()))); builder: (context) => CustomerList(),
)));
final invoicesBtn = _buildBtn("invoices.btn", final invoicesBtn = _buildBtn("invoices.btn",
icon: FontAwesomeIcons.fileInvoice, icon: FontAwesomeIcons.fileInvoice,
btnCallback: () => btnCallback: () =>
Navigator.of(context).push(BottomUpPageRoute(InvoiceList()))); Navigator.of(context).push(BottomUpPageRoute(InvoiceList())));
final paymentMethodBtn = _buildBtn("payment.method.btn", final paymentMethodBtn = _buildBtn("pm.btn",
icon: FontAwesomeIcons.creditCard, icon: FontAwesomeIcons.creditCard,
btnCallback: () => btnCallback: () =>
Navigator.of(context).push(BottomUpPageRoute(PaymentMethodPage()))); Navigator.of(context).push(BottomUpPageRoute(PaymentMethodPage())));
@@ -175,7 +179,7 @@ class _HomePageState extends State<HomePage> {
List<Widget> widgets = []; List<Widget> widgets = [];
widgets.add(faqBtn); widgets.add(faqBtn);
if (user != null) { if (user != null) {
// customer ? widgets.add(buyingBtn) : ""; customer ? widgets.add(buyingBtn) : "";
// customer || owner ? widgets.add(pickUpBtn) : ""; // customer || owner ? widgets.add(pickUpBtn) : "";
// !customer ? widgets.add(shipmentBtn) : ""; // !customer ? widgets.add(shipmentBtn) : "";
// customer || owner ? widgets.add(notiBtn) : ""; // customer || owner ? widgets.add(notiBtn) : "";
@@ -187,7 +191,7 @@ class _HomePageState extends State<HomePage> {
// owner ? widgets.add(deliveryBtn) : ""; // owner ? widgets.add(deliveryBtn) : "";
user.hasCustomers() ? widgets.add(customersBtn) : ""; user.hasCustomers() ? widgets.add(customersBtn) : "";
// customer || owner ? widgets.add(invoicesBtn) : ""; // customer || owner ? widgets.add(invoicesBtn) : "";
// owner ? widgets.add(paymentMethodBtn) : ""; widgets.add(paymentMethodBtn);
// owner ? widgets.add(discountBtn) : ""; // owner ? widgets.add(discountBtn) : "";
// widgets.add(termBtn); // widgets.add(termBtn);
} }
@@ -273,6 +277,7 @@ class _HomePageState extends State<HomePage> {
), ),
), ),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
user.requested user.requested
? Container( ? Container(
@@ -287,7 +292,7 @@ class _HomePageState extends State<HomePage> {
Expanded( Expanded(
child: ListView(children: [ child: ListView(children: [
Wrap( Wrap(
alignment: WrapAlignment.center, alignment: WrapAlignment.start,
children: widgets, children: widgets,
), ),
]), ]),

View File

@@ -1,14 +1,7 @@
import 'package:fcs/fcs/common/domain/entities/market.dart'; import 'package:fcs/fcs/common/domain/entities/market.dart';
import 'package:fcs/fcs/common/domain/entities/role.dart';
import 'package:fcs/fcs/common/domain/entities/user.dart';
import 'package:fcs/fcs/common/helpers/theme.dart'; import 'package:fcs/fcs/common/helpers/theme.dart';
import 'package:fcs/fcs/common/localization/app_translations.dart';
import 'package:fcs/fcs/common/pages/market/model/market_model.dart'; import 'package:fcs/fcs/common/pages/market/model/market_model.dart';
import 'package:fcs/fcs/common/pages/model/language_model.dart';
import 'package:fcs/fcs/common/pages/model/main_model.dart';
import 'package:fcs/fcs/common/pages/staff/model/staff_model.dart';
import 'package:fcs/fcs/common/pages/util.dart'; import 'package:fcs/fcs/common/pages/util.dart';
import 'package:fcs/fcs/common/pages/widgets/display_text.dart';
import 'package:fcs/fcs/common/pages/widgets/input_text.dart'; import 'package:fcs/fcs/common/pages/widgets/input_text.dart';
import 'package:fcs/fcs/common/pages/widgets/local_text.dart'; import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
import 'package:fcs/fcs/common/pages/widgets/progress.dart'; import 'package:fcs/fcs/common/pages/widgets/progress.dart';

View File

@@ -63,6 +63,11 @@ class PackageModel extends BaseModel {
return Services.instance.userService.searchUser(term); return Services.instance.userService.searchUser(term);
} }
Future<List<Package>> searchPackage(String term) {
// return Services.instance.userService.searchUser(term);
return null;
}
Future<void> createPackages(User user, List<Package> packages) { Future<void> createPackages(User user, List<Package> packages) {
return Services.instance.packageService return Services.instance.packageService
.createPackages(packages, user.fcsID); .createPackages(packages, user.fcsID);

View File

@@ -1,427 +0,0 @@
import 'package:fcs/fcs/common/domain/entities/market.dart';
import 'package:fcs/fcs/common/domain/entities/package.dart';
import 'package:fcs/fcs/common/domain/vo/shipping_address.dart';
import 'package:fcs/fcs/common/helpers/theme.dart';
import 'package:fcs/fcs/common/localization/app_translations.dart';
import 'package:fcs/fcs/common/pages/market/market_editor.dart';
import 'package:fcs/fcs/common/pages/market/model/market_model.dart';
import 'package:fcs/fcs/common/pages/model/main_model.dart';
import 'package:fcs/fcs/common/pages/package/tracking_id_page.dart';
import 'package:fcs/fcs/common/pages/package/shipping_address_editor.dart';
import 'package:fcs/fcs/common/pages/package/shipping_address_list.dart';
import 'package:fcs/fcs/common/pages/package/shipping_address_row.dart';
import 'package:fcs/fcs/common/pages/util.dart';
import 'package:fcs/fcs/common/pages/widgets/bottom_up_page_route.dart';
import 'package:fcs/fcs/common/pages/widgets/display_text.dart';
import 'package:fcs/fcs/common/pages/widgets/fcs_expansion_tile.dart';
import 'package:fcs/fcs/common/pages/widgets/image_slider.dart';
import 'package:fcs/fcs/common/pages/widgets/input_text.dart';
import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
import 'package:fcs/fcs/common/pages/widgets/my_data_table.dart';
import 'package:fcs/fcs/common/pages/widgets/progress.dart';
import 'package:fcs/pages/barcode_screen_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:timeline_list/timeline.dart';
import 'package:timeline_list/timeline_model.dart';
class PackageEditorPage extends StatefulWidget {
final Package package;
PackageEditorPage({this.package});
@override
_PackageEditorPageState createState() => _PackageEditorPageState();
}
class _PackageEditorPageState extends State<PackageEditorPage> {
TextEditingController _remarkCtl = new TextEditingController();
TextEditingController _descCtl = new TextEditingController();
Package _package;
bool _isLoading = false;
List<String> images = [
"assets/photos/1.jpg",
"assets/photos/2.jpg",
"assets/photos/3.jpg"
];
ShippingAddress shippingAddress = ShippingAddress(
fullName: 'U Nyi Nyi',
addressLine1: '154-19 64th Ave.',
addressLine2: 'Flushing',
city: 'NY',
state: 'NY',
phoneNumber: '+1 (292)215-2247');
@override
void initState() {
super.initState();
_package = widget.package;
selectedMarket = _package.market;
}
final DateFormat dateFormat = DateFormat("d MMM yyyy");
List<TimelineModel> _models() {
if (_package.shipmentHistory == null) return [];
return _package.shipmentHistory
.map((e) => TimelineModel(
Padding(
padding: const EdgeInsets.all(18.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(e.status,
style: TextStyle(
color: e.done ? primaryColor : Colors.grey,
fontSize: 16,
fontWeight: FontWeight.bold)),
Text(dateFormat.format(e.date)),
],
),
),
iconBackground: e.done ? primaryColor : Colors.grey,
icon: Icon(
e.status == "shipped"
? Ionicons.ios_airplane
: e.status == "delivered"
? MaterialCommunityIcons.truck_fast
: e.status == "processed"
? MaterialIcons.check
: Octicons.package,
color: Colors.white,
)))
.toList();
}
bool isNew = false;
@override
Widget build(BuildContext context) {
var owner = Provider.of<MainModel>(context).user.hasPackages();
final trackingIdBox = DisplayText(
text: _package.trackingID,
labelText: getLocalString(context, "package.tracking.id"),
iconData: MaterialCommunityIcons.barcode_scan,
);
final customerNameBox = DisplayText(
text: _package.userName,
labelText: getLocalString(context, "package.create.name"),
iconData: Icons.perm_identity,
);
final completeProcessingBtn = fcsButton(
context,
getLocalString(context, 'package.edit.complete.process.btn'),
callack: _completeProcessing,
);
final descBox = fcsInput(getLocalString(context, "package.edit.desc"),
MaterialCommunityIcons.message_text_outline,
controller: _descCtl, autoFocus: true);
final remarkBox = fcsInput(
getLocalString(context, "package.edit.remark"), Entypo.new_message,
controller: _remarkCtl, autoFocus: true);
return LocalProgress(
inAsyncCall: _isLoading,
child: Scaffold(
appBar: AppBar(
centerTitle: true,
leading: new IconButton(
icon: new Icon(Icons.close, color: primaryColor, size: 30),
onPressed: () => Navigator.of(context).pop(),
),
shadowColor: Colors.transparent,
backgroundColor: Colors.white,
title: LocalText(
context,
"package.edit.title",
fontSize: 20,
color: primaryColor,
),
),
body: ListView(
children: [
trackingIdBox,
customerNameBox,
owner
? isNew
? Container()
: ExpansionTile(
title: Text(
'Processing',
style: TextStyle(
color: primaryColor, fontWeight: FontWeight.bold),
),
children: [
dropDown(),
descBox,
remarkBox,
],
)
: Container(),
getImgSlider(images),
ExpansionTile(
title: Text(
'Status',
style:
TextStyle(color: primaryColor, fontWeight: FontWeight.bold),
),
children: <Widget>[
Container(
padding: EdgeInsets.only(left: 20),
height: 400,
child: Timeline(
children: _models(), position: TimelinePosition.Left),
),
],
),
completeProcessingBtn,
SizedBox(
height: 20,
)
],
),
),
);
}
String selectedMarket;
Widget dropDown() {
List<Market> _markets = Provider.of<MarketModel>(context).markets;
List<String> markets = _markets.map((e) => e.name).toList();
markets.insert(0, MANAGE_MARKET);
return Row(
children: [
Padding(
padding: const EdgeInsets.only(right: 18.0),
child: LocalText(
context,
"package.create.market",
color: primaryColor,
fontSize: 16,
),
),
Container(
width: 150,
child: DropdownButton<String>(
value: selectedMarket,
style: TextStyle(color: Colors.black, fontSize: 14),
underline: Container(
height: 1,
color: Colors.grey,
),
onChanged: (String newValue) {
setState(() {
if (newValue == MANAGE_MARKET) {
selectedMarket = null;
_manageMarket();
return;
}
selectedMarket = newValue;
});
},
isExpanded: true,
items: markets.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: value == MANAGE_MARKET
? secondaryColor
: primaryColor)),
);
}).toList(),
),
),
],
);
}
_manageMarket() {
Navigator.push<Package>(
context,
BottomUpPageRoute(MarketEditor()),
);
}
Widget getShippingAddressList(BuildContext context) {
return Container(
child: ExpansionTile(
title: Text(
"Shipping Addresses",
style: TextStyle(
fontWeight: FontWeight.bold,
fontStyle: FontStyle.normal,
color: primaryColor),
),
children: <Widget>[
// Column(
// children: getAddressList(context, shipmentModel.shippingAddresses),
// ),
Container(
padding: EdgeInsets.only(left: 10, right: 10),
child: Column(
children: <Widget>[
Row(
children: <Widget>[
Expanded(
child: new Padding(
padding: const EdgeInsets.symmetric(vertical: 10.0),
child: Row(
children: <Widget>[
new Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
shippingAddress.fullName == null
? ''
: shippingAddress.fullName,
style: new TextStyle(
fontSize: 15.0,
color: Colors.black,
fontWeight: FontWeight.bold),
),
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
shippingAddress.addressLine1 == null
? ''
: shippingAddress.addressLine1,
style: new TextStyle(
fontSize: 14.0, color: Colors.grey),
),
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
shippingAddress.addressLine2 == null
? ''
: shippingAddress.addressLine2,
style: new TextStyle(
fontSize: 14.0, color: Colors.grey),
),
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
shippingAddress.city == null
? ''
: shippingAddress.city,
style: new TextStyle(
fontSize: 14.0, color: Colors.grey),
),
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
shippingAddress.state == null
? ''
: shippingAddress.state,
style: new TextStyle(
fontSize: 14.0, color: Colors.grey),
),
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
shippingAddress.phoneNumber == null
? ''
: "Phone:${shippingAddress.phoneNumber}",
style: new TextStyle(
fontSize: 14.0, color: Colors.grey),
),
),
],
),
],
),
),
),
],
),
],
),
),
Container(
padding: EdgeInsets.only(top: 20, bottom: 15, right: 15),
child: Align(
alignment: Alignment.bottomRight,
child: Container(
width: 130,
height: 40,
child: FloatingActionButton.extended(
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
onPressed: () async {
var address = await Navigator.push(
context,
BottomUpPageRoute(ShippingAddressList()),
);
print('address => ${address}');
setState(() {
if (address != null) {
this.shippingAddress = address;
}
});
},
icon: Icon(Icons.add),
label: Text(
'Select \nAddress',
style: TextStyle(fontSize: 12),
),
backgroundColor: primaryColor,
),
),
),
)
],
),
);
}
List<Widget> getAddressList(
BuildContext context, List<ShippingAddress> addresses) {
return addresses.asMap().entries.map((s) {
return InkWell(
onTap: () {
Navigator.push(
context,
BottomUpPageRoute(ShippingAddressEditor(shippingAddress: s.value)),
);
},
child: ShippingAddressRow(shippingAddress: s.value, index: s.key),
);
}).toList();
}
List<MyDataRow> getAddressRows(List<ShippingAddress> addresses) {
return addresses.map((s) {
return MyDataRow(
onSelectChanged: (selected) {},
cells: [
MyDataCell(
new Text(
s.fullName,
style: textStyle,
),
),
MyDataCell(
new Text(
s.phoneNumber,
style: textStyle,
),
),
],
);
}).toList();
}
_completeProcessing() {}
}

View File

@@ -1,6 +1,5 @@
import 'package:fcs/fcs/common/domain/entities/market.dart'; import 'package:fcs/fcs/common/domain/entities/market.dart';
import 'package:fcs/fcs/common/domain/entities/package.dart'; import 'package:fcs/fcs/common/domain/entities/package.dart';
import 'package:fcs/fcs/common/domain/vo/shipping_address.dart';
import 'package:fcs/fcs/common/helpers/theme.dart'; import 'package:fcs/fcs/common/helpers/theme.dart';
import 'package:fcs/fcs/common/pages/market/market_editor.dart'; import 'package:fcs/fcs/common/pages/market/market_editor.dart';
import 'package:fcs/fcs/common/pages/market/model/market_model.dart'; import 'package:fcs/fcs/common/pages/market/model/market_model.dart';
@@ -9,7 +8,6 @@ import 'package:fcs/fcs/common/pages/package/tracking_id_page.dart';
import 'package:fcs/fcs/common/pages/util.dart'; import 'package:fcs/fcs/common/pages/util.dart';
import 'package:fcs/fcs/common/pages/widgets/bottom_up_page_route.dart'; import 'package:fcs/fcs/common/pages/widgets/bottom_up_page_route.dart';
import 'package:fcs/fcs/common/pages/widgets/display_text.dart'; import 'package:fcs/fcs/common/pages/widgets/display_text.dart';
import 'package:fcs/fcs/common/pages/widgets/image_slider.dart';
import 'package:fcs/fcs/common/pages/widgets/local_text.dart'; import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
import 'package:fcs/fcs/common/pages/widgets/multi_img_controller.dart'; import 'package:fcs/fcs/common/pages/widgets/multi_img_controller.dart';
import 'package:fcs/fcs/common/pages/widgets/multi_img_file.dart'; import 'package:fcs/fcs/common/pages/widgets/multi_img_file.dart';
@@ -18,7 +16,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_icons/flutter_icons.dart'; import 'package:flutter_icons/flutter_icons.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:timeline_list/timeline_model.dart';
class PackageEditorPage extends StatefulWidget { class PackageEditorPage extends StatefulWidget {
final Package package; final Package package;
@@ -34,13 +31,6 @@ class _PackageEditorPageState extends State<PackageEditorPage> {
Package _package; Package _package;
bool _isLoading = false; bool _isLoading = false;
ShippingAddress shippingAddress = ShippingAddress(
fullName: 'U Nyi Nyi',
addressLine1: '154-19 64th Ave.',
addressLine2: 'Flushing',
city: 'NY',
state: 'NY',
phoneNumber: '+1 (292)215-2247');
@override @override
void initState() { void initState() {
@@ -54,38 +44,6 @@ class _PackageEditorPageState extends State<PackageEditorPage> {
final DateFormat dateFormat = DateFormat("d MMM yyyy"); final DateFormat dateFormat = DateFormat("d MMM yyyy");
List<TimelineModel> _models() {
if (_package.shipmentHistory == null) return [];
return _package.shipmentHistory
.map((e) => TimelineModel(
Padding(
padding: const EdgeInsets.all(18.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(e.status,
style: TextStyle(
color: e.done ? primaryColor : Colors.grey,
fontSize: 16,
fontWeight: FontWeight.bold)),
Text(dateFormat.format(e.date)),
],
),
),
iconBackground: e.done ? primaryColor : Colors.grey,
icon: Icon(
e.status == "shipped"
? Ionicons.ios_airplane
: e.status == "delivered"
? MaterialCommunityIcons.truck_fast
: e.status == "processed"
? MaterialIcons.check
: Octicons.package,
color: Colors.white,
)))
.toList();
}
bool isNew = false; bool isNew = false;
MultiImgController multiImgController = MultiImgController(); MultiImgController multiImgController = MultiImgController();

View File

@@ -3,9 +3,12 @@ import 'package:fcs/fcs/common/localization/app_translations.dart';
import 'package:fcs/fcs/common/pages/package/model/package_model.dart'; import 'package:fcs/fcs/common/pages/package/model/package_model.dart';
import 'package:fcs/fcs/common/pages/package/package_list_row.dart'; import 'package:fcs/fcs/common/pages/package/package_list_row.dart';
import 'package:fcs/fcs/common/pages/package/package_new.dart'; import 'package:fcs/fcs/common/pages/package/package_new.dart';
import 'package:fcs/fcs/common/pages/package_search/package_serach.dart';
import 'package:fcs/fcs/common/pages/user_search/user_serach.dart'; import 'package:fcs/fcs/common/pages/user_search/user_serach.dart';
import 'package:fcs/fcs/common/pages/widgets/bottom_up_page_route.dart'; import 'package:fcs/fcs/common/pages/widgets/bottom_up_page_route.dart';
import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
import 'package:fcs/fcs/common/pages/widgets/progress.dart'; import 'package:fcs/fcs/common/pages/widgets/progress.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@@ -37,11 +40,16 @@ class _PackageListState extends State<PackageList> {
appBar: AppBar( appBar: AppBar(
centerTitle: true, centerTitle: true,
leading: new IconButton( leading: new IconButton(
icon: new Icon(Icons.close), icon: new Icon(CupertinoIcons.back),
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
), ),
backgroundColor: primaryColor, backgroundColor: primaryColor,
title: Text(AppTranslations.of(context).text("package.title")), title: LocalText(
context,
"package.title",
fontSize: 20,
color: Colors.white,
),
actions: <Widget>[ actions: <Widget>[
// IconButton( // IconButton(
// icon: Icon( // icon: Icon(
@@ -62,7 +70,7 @@ class _PackageListState extends State<PackageList> {
color: Colors.white, color: Colors.white,
), ),
iconSize: 30, iconSize: 30,
onPressed: () => searchUser(context), onPressed: () => searchPackage(context),
), ),
], ],
), ),

View File

@@ -7,6 +7,7 @@ import 'package:fcs/fcs/common/pages/staff/model/staff_model.dart';
import 'package:fcs/fcs/common/pages/util.dart'; import 'package:fcs/fcs/common/pages/util.dart';
import 'package:fcs/fcs/common/pages/widgets/bottom_up_page_route.dart'; import 'package:fcs/fcs/common/pages/widgets/bottom_up_page_route.dart';
import 'package:fcs/fcs/common/pages/widgets/display_text.dart'; import 'package:fcs/fcs/common/pages/widgets/display_text.dart';
import 'package:fcs/fcs/common/pages/widgets/fcs_id_icon.dart';
import 'package:fcs/fcs/common/pages/widgets/local_text.dart'; import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
import 'package:fcs/fcs/common/pages/widgets/progress.dart'; import 'package:fcs/fcs/common/pages/widgets/progress.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -41,7 +42,7 @@ class _PackageNewState extends State<PackageNew> {
child: DisplayText( child: DisplayText(
text: user != null ? user.fcsID : "", text: user != null ? user.fcsID : "",
labelText: getLocalString(context, "package.create.fcs.id"), labelText: getLocalString(context, "package.create.fcs.id"),
iconData: Icons.perm_identity, icon: FcsIDIcon(),
)), )),
IconButton( IconButton(
icon: Icon(Icons.search, color: primaryColor), icon: Icon(Icons.search, color: primaryColor),

View File

@@ -1,4 +1,5 @@
import 'package:fcs/fcs/common/helpers/theme.dart'; import 'package:fcs/fcs/common/helpers/theme.dart';
import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
import 'package:fcs/model/shipment_model.dart'; import 'package:fcs/model/shipment_model.dart';
import 'package:fcs/pages/search_page.dart'; import 'package:fcs/pages/search_page.dart';
@@ -41,7 +42,12 @@ class _ShippingAddressListState extends State<ShippingAddressList> {
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
), ),
backgroundColor: primaryColor, backgroundColor: primaryColor,
title: Text(AppTranslations.of(context).text("shipping_addresses")), title: LocalText(
context,
"shipping_addresses",
fontSize: 20,
color: Colors.white,
),
actions: <Widget>[ actions: <Widget>[
IconButton( IconButton(
icon: Icon( icon: Icon(

View File

@@ -0,0 +1,88 @@
import 'package:fcs/fcs/common/domain/entities/package.dart';
import 'package:fcs/fcs/common/helpers/theme.dart';
import 'package:fcs/fcs/common/pages/package_search/package_serach.dart';
import 'package:flutter/material.dart';
class PackageSearchRow extends StatefulWidget {
final CallbackPackageSelect callbackPackageSelect;
final Package package;
const PackageSearchRow({this.package, this.callbackPackageSelect});
@override
_PackageSearchRowState createState() => _PackageSearchRowState();
}
class _PackageSearchRowState extends State<PackageSearchRow> {
final double dotSize = 15.0;
Package package;
@override
void initState() {
super.initState();
this.package = widget.package;
}
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.only(left: 15, right: 15),
child: Card(
elevation: 10,
color: Colors.white,
child: InkWell(
onTap: () {
Navigator.pop(context);
if (widget.callbackPackageSelect != null)
widget.callbackPackageSelect(package);
},
child: Row(
children: <Widget>[
Expanded(
child: new Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0),
child: new Row(
children: <Widget>[
new Padding(
padding: new EdgeInsets.symmetric(
horizontal: 32.0 - dotSize / 2),
child: Image.asset(
"assets/buyer.png",
width: 40,
height: 40,
color: primaryColor,
),
),
new Expanded(
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new Text(
package.trackingID == null
? ''
: package.trackingID,
style: new TextStyle(
fontSize: 15.0, color: Colors.black),
),
new Text(
package.userName == null ? "" : package.userName,
style: new TextStyle(
fontSize: 13.0, color: Colors.grey),
),
new Text(
package.fcsID == null ? "" : package.fcsID,
style: new TextStyle(
fontSize: 13.0, color: Colors.grey),
),
],
),
),
],
),
),
),
],
),
),
),
);
}
}

View File

@@ -0,0 +1,117 @@
import 'package:fcs/fcs/common/domain/entities/package.dart';
import 'package:fcs/fcs/common/helpers/theme.dart';
import 'package:fcs/fcs/common/pages/package/model/package_model.dart';
import 'package:fcs/fcs/common/pages/package_search/package_search_row.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
typedef CallbackPackageSelect(Package package);
Future<Package> searchPackage(BuildContext context,
{CallbackPackageSelect callbackPackageSelect}) async =>
await showSearch<Package>(
context: context,
delegate:
PackageSearchDelegate(callbackPackageSelect: callbackPackageSelect),
);
class PackageSearchDelegate extends SearchDelegate<Package> {
final CallbackPackageSelect callbackPackageSelect;
PackageSearchDelegate({this.callbackPackageSelect});
@override
String get searchFieldLabel => 'Search by FCS ID or Name';
@override
ThemeData appBarTheme(BuildContext context) {
final ThemeData theme = Theme.of(context);
return theme.copyWith(
inputDecorationTheme: InputDecorationTheme(
hintStyle: TextStyle(
color: theme.primaryTextTheme.caption.color, fontSize: 14)),
textTheme: theme.textTheme.copyWith(
title: theme.textTheme.title.copyWith(
color: theme.primaryTextTheme.title.color, fontSize: 16)),
primaryColor: primaryColor,
);
}
@override
List<Widget> buildActions(BuildContext context) {
return [
IconButton(
icon: Icon(Icons.clear),
onPressed: () => query = '',
),
];
}
@override
Widget buildLeading(BuildContext context) {
return IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () => close(context, null),
);
}
@override
Widget buildResults(BuildContext context) {
final packageModel = Provider.of<PackageModel>(context);
return FutureBuilder(
future: packageModel.searchPackage(query),
builder: (context, AsyncSnapshot<List<Package>> snapshot) {
if (snapshot.hasData) {
if (snapshot.data.length == 0) {
return Container(
child: Center(
child: Text(
"No result found",
textAlign: TextAlign.center,
),
),
);
}
return Container(
padding: EdgeInsets.only(top: 15),
child: ListView(
children: snapshot.data
.map((u) => PackageSearchRow(
package: u,
callbackPackageSelect: callbackPackageSelect,
))
.toList(),
),
);
} else if (snapshot.hasError) {
return Container(
child: Center(
child: Text(
'${snapshot.error}',
textAlign: TextAlign.center,
),
),
);
} else {
return Container(
child: Center(
child: CircularProgressIndicator(
valueColor:
new AlwaysStoppedAnimation<Color>(primaryColor)),
),
);
}
});
}
@override
Widget buildSuggestions(BuildContext context) {
return Container(
child: Center(
child: Opacity(
opacity: 0.2,
child: Icon(Icons.perm_identity, size: 200, color: primaryColor)),
),
);
}
}

View File

@@ -0,0 +1,49 @@
import 'dart:async';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:fcs/fcs/common/domain/entities/payment_method.dart';
import 'package:fcs/fcs/common/pages/model/base_model.dart';
import 'package:fcs/fcs/common/services/services.dart';
import 'package:logging/logging.dart';
class PaymentMethodModel extends BaseModel {
final log = Logger('PaymentMethodModel');
List<PaymentMethod> paymentMethods = [];
PaymentMethod getPaymentMethod(String id) {
return paymentMethods.firstWhere((e) => e.id == id, orElse: () => null);
}
StreamSubscription<QuerySnapshot> listener;
PaymentMethodModel() {
if (listener != null) listener.cancel();
try {
listener = Firestore.instance
.collection("/payment_methods")
.snapshots()
.listen((snaps) {
paymentMethods.clear();
snaps.documents.forEach((d) {
paymentMethods.add(PaymentMethod.fromMap(d.data, d.documentID));
});
notifyListeners();
});
} catch (e) {
log.warning("error:$e");
}
}
Future<void> addPaymentMethod(PaymentMethod paymentMethod) async {
Services.instance.commonService.createPaymentMethod(paymentMethod);
}
Future<void> updatePaymentMethod(PaymentMethod paymentMethod) async {
Services.instance.commonService.updatePaymentMethod(paymentMethod);
}
Future<void> deletePaymentMethod(String id) async {
Services.instance.commonService.deletePayment(id);
}
}

View File

@@ -0,0 +1,212 @@
import 'package:fcs/fcs/common/domain/entities/payment_method.dart';
import 'package:fcs/fcs/common/helpers/theme.dart';
import 'package:fcs/fcs/common/pages/model/main_model.dart';
import 'package:fcs/fcs/common/pages/payment_methods/model/payment_method_model.dart';
import 'package:fcs/fcs/common/pages/util.dart';
import 'package:fcs/fcs/common/pages/widgets/input_text.dart';
import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
import 'package:fcs/fcs/common/pages/widgets/progress.dart';
import 'package:flutter/material.dart';
import 'package:flutter_icons/flutter_icons.dart';
import 'package:provider/provider.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;
TextEditingController _nameController = new TextEditingController();
TextEditingController _accountNameController = new TextEditingController();
TextEditingController _accountNumberController = new TextEditingController();
TextEditingController _mailController = new TextEditingController();
TextEditingController _phoneController = new TextEditingController();
TextEditingController _linkController = new TextEditingController();
bool isNew;
@override
void initState() {
super.initState();
isNew = widget.paymentMethod == null;
if (widget.paymentMethod != null) {
_paymentMethod = widget.paymentMethod;
_nameController.text = _paymentMethod.name;
_accountNameController.text = _paymentMethod.accountName;
_accountNumberController.text = _paymentMethod.account;
_mailController.text = _paymentMethod.email;
_phoneController.text = _paymentMethod.phone;
_linkController.text = _paymentMethod.link;
} else {
_paymentMethod = new PaymentMethod();
_nameController.text = '';
}
}
@override
Widget build(BuildContext context) {
return LocalProgress(
inAsyncCall: _isLoading,
child: Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
centerTitle: true,
leading: new IconButton(
icon: new Icon(Icons.close, color: primaryColor),
onPressed: () => Navigator.of(context).pop(),
),
title: LocalText(
context,
isNew ? "pm.new" : "pm.update",
fontSize: 20,
color: primaryColor,
),
shadowColor: Colors.transparent,
backgroundColor: Colors.white,
actions: <Widget>[
isNew
? Container()
: IconButton(
icon: Icon(
Icons.delete,
color: primaryColor,
),
onPressed: _delete,
)
],
),
body: Padding(
padding: const EdgeInsets.only(left: 20.0, right: 10),
child: ListView(
children: <Widget>[
InputText(
labelTextKey: "pm.name",
iconData: Octicons.tag,
controller: _nameController,
),
InputText(
labelTextKey: "pm.account.name",
iconData: MaterialCommunityIcons.bank,
controller: _accountNameController,
),
InputText(
labelTextKey: "pm.account.no",
iconData: MaterialCommunityIcons.checkbook,
controller: _accountNumberController,
),
InputText(
labelTextKey: "pm.phone",
iconData: Icons.phone,
controller: _phoneController,
),
InputText(
labelTextKey: "pm.email",
iconData: Icons.mail,
controller: _mailController,
),
InputText(
labelTextKey: "pm.link",
iconData: Icons.link,
controller: _linkController,
),
SizedBox(
height: 20,
),
isNew
? fcsButton(context, getLocalString(context, "pm.add.btn"),
callack: _add)
: fcsButton(context, getLocalString(context, "pm.save.btn"),
callack: _save),
SizedBox(
height: 30,
)
],
),
)),
);
}
_add() async {
if (_nameController.text == "") {
showMsgDialog(context, "Error", "Need a name for a payment method");
return;
}
setState(() {
_isLoading = true;
});
try {
PaymentMethod pm = PaymentMethod(
name: _nameController.text,
accountName: _accountNameController.text,
account: _accountNumberController.text,
email: _mailController.text,
phone: _phoneController.text,
link: _linkController.text);
await Provider.of<PaymentMethodModel>(context, listen: false)
.addPaymentMethod(pm);
Navigator.pop(context);
} catch (e) {
showMsgDialog(context, "Error", e.toString());
} finally {
setState(() {
_isLoading = false;
});
}
}
_save() async {
if (_nameController.text == "") {
showMsgDialog(context, "Error", "Need a name for a payment method");
return;
}
setState(() {
_isLoading = true;
});
try {
PaymentMethod pm = PaymentMethod(
id: _paymentMethod.id,
name: _nameController.text,
accountName: _accountNameController.text,
account: _accountNumberController.text,
email: _mailController.text,
phone: _phoneController.text,
link: _linkController.text);
await Provider.of<PaymentMethodModel>(context, listen: false)
.updatePaymentMethod(pm);
Navigator.pop(context);
} catch (e) {
showMsgDialog(context, "Error", e.toString());
} finally {
setState(() {
_isLoading = false;
});
}
}
_delete() {
showConfirmDialog(context, "pm.delete.confirm", () => _deleteConfirmed());
}
_deleteConfirmed() async {
setState(() {
_isLoading = true;
});
try {
await Provider.of<PaymentMethodModel>(context, listen: false)
.deletePaymentMethod(_paymentMethod.id);
Navigator.pop(context);
} catch (e) {
showMsgDialog(context, "Error", e.toString());
} finally {
setState(() {
_isLoading = false;
});
}
}
}

View File

@@ -0,0 +1,155 @@
import 'package:fcs/fcs/common/domain/entities/payment_method.dart';
import 'package:fcs/fcs/common/helpers/theme.dart';
import 'package:fcs/fcs/common/localization/app_translations.dart';
import 'package:fcs/fcs/common/pages/payment_methods/model/payment_method_model.dart';
import 'package:fcs/fcs/common/pages/payment_methods/payment_method_editor.dart';
import 'package:fcs/fcs/common/pages/util.dart';
import 'package:fcs/fcs/common/pages/widgets/bottom_up_page_route.dart';
import 'package:fcs/fcs/common/pages/widgets/display_text.dart';
import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
import 'package:fcs/fcs/common/pages/widgets/progress.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_icons/flutter_icons.dart';
import 'package:provider/provider.dart';
class PaymentMethodPage extends StatefulWidget {
@override
_PaymentMethodPageState createState() => _PaymentMethodPageState();
}
class _PaymentMethodPageState extends State<PaymentMethodPage> {
GlobalKey key = GlobalKey();
bool _isLoading = false;
@override
Widget build(BuildContext context) {
PaymentMethodModel mainModel = Provider.of<PaymentMethodModel>(context);
return LocalProgress(
inAsyncCall: _isLoading,
child: Scaffold(
key: key,
appBar: AppBar(
leading: new IconButton(
icon: new Icon(
Icons.close,
color: primaryColor,
),
onPressed: () => Navigator.of(context).pop(),
),
centerTitle: true,
title: LocalText(
context,
"pm.title",
fontSize: 20,
color: primaryColor,
),
shadowColor: Colors.transparent,
backgroundColor: Colors.white,
actions: <Widget>[],
),
body: Padding(
padding: const EdgeInsets.all(12.0),
child: ListView.separated(
separatorBuilder: (context, index) => Divider(
color: Colors.black,
),
itemCount: mainModel.paymentMethods.length,
itemBuilder: (BuildContext context, int index) {
var method = mainModel.paymentMethods[index];
return _item(method);
},
),
),
floatingActionButton: FloatingActionButton.extended(
onPressed: () {
Navigator.push(
context,
BottomUpPageRoute(PaymentMethodEditor()),
);
},
icon: Icon(Icons.add),
label: LocalText(context, "pm.new", color: Colors.white),
backgroundColor: primaryColor,
),
),
);
}
_item(PaymentMethod method) {
final accountName = _itemRow(method.accountName, "pm.account.name",
iconData: MaterialCommunityIcons.bank);
final accountNumber = _itemRow(method.account, "pm.account.no",
iconData: MaterialCommunityIcons.checkbook);
final phone = _itemRow(method.phone, "pm.phone", iconData: Icons.phone);
final email = _itemRow(method.email, "pm.email", iconData: Icons.mail);
final link = _itemRow(method.link, "pm.link", iconData: Icons.link);
return InkWell(
onTap: () {
Navigator.push(
context,
BottomUpPageRoute(PaymentMethodEditor(
paymentMethod: method,
)),
);
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
method.name,
style: TextStyle(
color: primaryColor,
fontWeight: FontWeight.bold,
fontSize: 18),
),
),
accountName,
accountNumber,
phone,
email,
link
],
),
);
}
_itemRow(String text, String labelKey, {IconData iconData}) {
return text == null || text == ""
? Container()
: Row(
children: [
Expanded(
child: DisplayText(
text: text,
labelText: getLocalString(context, labelKey),
iconData: iconData,
),
),
IconButton(
icon: Icon(Icons.content_copy, color: Colors.grey),
onPressed: () => _copy(getLocalString(context, labelKey), text),
)
],
);
}
_copy(String title, String data) {
Clipboard.setData(ClipboardData(text: data));
_showToast(title);
}
void _showToast(String title) {
final ScaffoldState scaffold = key.currentState;
scaffold.showSnackBar(
SnackBar(
content: Text('copied "$title" data to clipboard'),
backgroundColor: secondaryColor,
duration: Duration(seconds: 1),
),
);
}
}

View File

@@ -2,6 +2,7 @@ import 'package:fcs/fcs/common/helpers/theme.dart';
import 'package:fcs/fcs/common/localization/app_translations.dart'; import 'package:fcs/fcs/common/localization/app_translations.dart';
import 'package:fcs/fcs/common/pages/model/language_model.dart'; import 'package:fcs/fcs/common/pages/model/language_model.dart';
import 'package:fcs/fcs/common/pages/model/main_model.dart'; import 'package:fcs/fcs/common/pages/model/main_model.dart';
import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
import 'package:fcs/fcs/common/pages/widgets/progress.dart'; import 'package:fcs/fcs/common/pages/widgets/progress.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -59,9 +60,11 @@ class _ProfileEditState extends State<ProfileEdit> {
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
centerTitle: true, centerTitle: true,
title: Text( title: LocalText(
AppTranslations.of(context).text("profile.edit_title"), context,
style: TextStyle(color: primaryColor), "profile.edit_title",
fontSize: 20,
color: primaryColor,
), ),
backgroundColor: Colors.white, backgroundColor: Colors.white,
shadowColor: Colors.transparent, shadowColor: Colors.transparent,

View File

@@ -4,6 +4,8 @@ import 'package:fcs/fcs/common/pages/model/language_model.dart';
import 'package:fcs/fcs/common/pages/model/main_model.dart'; import 'package:fcs/fcs/common/pages/model/main_model.dart';
import 'package:fcs/fcs/common/pages/profile/profile_edit.dart'; import 'package:fcs/fcs/common/pages/profile/profile_edit.dart';
import 'package:fcs/fcs/common/pages/widgets/display_text.dart'; import 'package:fcs/fcs/common/pages/widgets/display_text.dart';
import 'package:fcs/fcs/common/pages/widgets/fcs_id_icon.dart';
import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
import 'package:fcs/fcs/common/pages/widgets/progress.dart'; import 'package:fcs/fcs/common/pages/widgets/progress.dart';
import 'package:fcs/model/shipment_model.dart'; import 'package:fcs/model/shipment_model.dart';
import 'package:fcs/model/user_model.dart'; import 'package:fcs/model/user_model.dart';
@@ -74,7 +76,7 @@ class _ProfileState extends State<Profile> {
child: DisplayText( child: DisplayText(
text: mainModel.user.fcsID, text: mainModel.user.fcsID,
labelText: getLocalString(context, "customer.fcs.id"), labelText: getLocalString(context, "customer.fcs.id"),
iconData: Icons.account_circle, icon: FcsIDIcon(),
), ),
), ),
IconButton( IconButton(
@@ -120,9 +122,11 @@ class _ProfileState extends State<Profile> {
), ),
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
), ),
title: Text( title: LocalText(
AppTranslations.of(context).text("profile.title"), context,
style: TextStyle(color: primaryColor), "profile.title",
fontSize: 20,
color: primaryColor,
), ),
shadowColor: Colors.transparent, shadowColor: Colors.transparent,
backgroundColor: Colors.white, backgroundColor: Colors.white,

View File

@@ -1,11 +1,8 @@
import 'package:country_code_picker/country_code_picker.dart'; import 'package:country_code_picker/country_code_picker.dart';
import 'package:fcs/fcs/common/domain/entities/auth_result.dart'; import 'package:fcs/fcs/common/domain/entities/auth_result.dart';
import 'package:fcs/fcs/common/domain/entities/auth_status.dart'; import 'package:fcs/fcs/common/domain/entities/auth_status.dart';
import 'package:fcs/fcs/common/domain/entities/setting.dart';
import 'package:fcs/fcs/common/domain/entities/user.dart';
import 'package:fcs/fcs/common/pages/model/main_model.dart'; import 'package:fcs/fcs/common/pages/model/main_model.dart';
import 'package:fcs/fcs/common/pages/signin/signin_logic.dart'; import 'package:fcs/fcs/common/pages/signin/signin_logic.dart';
import 'package:fcs/fcs/common/pages/signin/signup_page.dart';
import 'package:fcs/fcs/common/pages/widgets/local_text.dart'; import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
import 'package:fcs/widget/bottom_up_page_route.dart'; import 'package:fcs/widget/bottom_up_page_route.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -13,10 +10,10 @@ import 'package:flutter/services.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../../helpers/theme.dart';
import '../../../../widget/progress.dart'; import '../../../../widget/progress.dart';
import 'sms_code_page.dart'; import '../../helpers/theme.dart';
import '../util.dart'; import '../util.dart';
import 'sms_code_page.dart';
class SigninPage extends StatefulWidget { class SigninPage extends StatefulWidget {
@override @override

View File

@@ -73,10 +73,10 @@ class _StaffEditorState extends State<StaffEditor> {
children: <Widget>[ children: <Widget>[
new Text( new Text(
p.name, p.name,
style: TextStyle( style: TextStyle(fontSize: 15.0, color: primaryColor),
fontSize: 15.0,
),
), ),
Text(p.desc,
style: TextStyle(fontSize: 13, color: Colors.grey[600]))
], ],
), ),
], ],
@@ -185,6 +185,10 @@ class _StaffEditorState extends State<StaffEditor> {
: Container(), : Container(),
phoneNumberBox, phoneNumberBox,
namebox, namebox,
Padding(
padding: const EdgeInsets.only(top: 18.0),
child: Text("Privileges"),
),
Column( Column(
children: showprivilegeList(context), children: showprivilegeList(context),
), ),

View File

@@ -5,6 +5,7 @@ import 'package:fcs/fcs/common/pages/widgets/bottom_up_page_route.dart';
import 'package:fcs/fcs/common/pages/widgets/local_text.dart'; import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
import 'package:fcs/fcs/common/helpers/theme.dart'; import 'package:fcs/fcs/common/helpers/theme.dart';
import 'package:fcs/fcs/common/pages/widgets/progress.dart'; import 'package:fcs/fcs/common/pages/widgets/progress.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_icons/flutter_icons.dart'; import 'package:flutter_icons/flutter_icons.dart';
@@ -33,7 +34,7 @@ class _StaffListState extends State<StaffList> {
appBar: AppBar( appBar: AppBar(
centerTitle: true, centerTitle: true,
leading: new IconButton( leading: new IconButton(
icon: new Icon(Icons.close), icon: new Icon(CupertinoIcons.back),
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
), ),
backgroundColor: primaryColor, backgroundColor: primaryColor,

View File

@@ -22,10 +22,12 @@ class TermEdit extends StatefulWidget {
class _TermEditState extends State<TermEdit> { class _TermEditState extends State<TermEdit> {
/// Allows to control the editor and the document. /// Allows to control the editor and the document.
ZefyrController _controller; ZefyrController _controllerEng;
ZefyrController _controllerMm;
/// Zefyr editor like any other input field requires a focus node. /// Zefyr editor like any other input field requires a focus node.
FocusNode _focusNode; FocusNode _focusNodeEng;
FocusNode _focusNodeMm;
bool _isLoading; bool _isLoading;
@override @override
@@ -34,16 +36,17 @@ class _TermEditState extends State<TermEdit> {
_isLoading = false; _isLoading = false;
// Here we must load the document and pass it to Zefyr controller. // Here we must load the document and pass it to Zefyr controller.
final document = _loadDocument(); _controllerEng = ZefyrController(_loadDocument(widget.term.termEng));
_controller = ZefyrController(document); _controllerMm = ZefyrController(_loadDocument(widget.term.termMm));
_focusNode = FocusNode(); _focusNodeEng = FocusNode();
_focusNodeMm = FocusNode();
} }
/// Loads the document to be edited in Zefyr. /// Loads the document to be edited in Zefyr.
NotusDocument _loadDocument() { NotusDocument _loadDocument(String data) {
NotusDocument doc; NotusDocument doc;
try { try {
doc = NotusDocument.fromJson(jsonDecode(widget.term.term)); doc = NotusDocument.fromJson(jsonDecode(data));
} catch (e) {} } catch (e) {}
if (doc == null) { if (doc == null) {
doc = NotusDocument(); doc = NotusDocument();
@@ -55,58 +58,109 @@ class _TermEditState extends State<TermEdit> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final savebtn = final savebtn =
fcsButton(context, getLocalString(context, "btn.save"), callack: _save); fcsButton(context, getLocalString(context, "btn.save"), callack: _save);
return LocalProgress(
inAsyncCall: _isLoading, return DefaultTabController(
child: Scaffold( length: 2,
appBar: AppBar( child: LocalProgress(
title: LocalLargeTitle( inAsyncCall: _isLoading,
context, child: Scaffold(
"term", appBar: AppBar(
color: Colors.white, title: LocalLargeTitle(
), context,
leading: IconButton( "term",
icon: Icon( color: primaryColor,
CupertinoIcons.back, ),
size: 30, leading: IconButton(
icon: Icon(
CupertinoIcons.back,
color: primaryColor,
size: 30,
),
onPressed: () => Navigator.of(context).pop(),
),
shadowColor: Colors.transparent,
backgroundColor: Colors.white,
bottom: TabBar(
onTap: (index) {
// Tab index when user select it, it start from zero
},
tabs: [
Tab(
icon: Image.asset(
'icons/flags/png/us.png',
package: 'country_icons',
fit: BoxFit.fitWidth,
width: 25,
)),
Tab(
icon: Image.asset(
'icons/flags/png/mm.png',
package: 'country_icons',
fit: BoxFit.fitWidth,
width: 25,
)),
],
), ),
onPressed: () => Navigator.of(context).pop(),
), ),
backgroundColor: primaryColor, body: ListView(
), children: [
body: ListView( Container(
children: [ height: MediaQuery.of(context).size.height - 200,
Container( child: TabBarView(
height: MediaQuery.of(context).size.height - 150, children: [
child: ZefyrScaffold( textEditor(_controllerEng, _focusNodeEng),
child: ZefyrTheme( textEditor(_controllerMm, _focusNodeMm),
data: ZefyrThemeData().copyWith(), ],
child: ZefyrEditor(
padding: EdgeInsets.all(16),
controller: _controller,
focusNode: _focusNode,
),
), ),
), ),
), savebtn,
savebtn, ],
SizedBox( ),
height: 10,
)
],
), ),
), ),
); );
} }
Widget textEditor(ZefyrController controller, FocusNode focusNode) {
return ListView(
children: [
Container(
height: MediaQuery.of(context).size.height - 200,
child: ZefyrScaffold(
child: ZefyrTheme(
data: ZefyrThemeData().copyWith(
defaultLineTheme: LineTheme(
padding: EdgeInsets.all(0),
textStyle: TextStyle(fontFamily: "Myanmar3"),
),
),
child: ZefyrEditor(
autofocus: false,
padding: EdgeInsets.all(16),
controller: controller,
focusNode: focusNode,
),
),
),
),
// savebtn,
SizedBox(
height: 10,
)
],
);
}
_save() async { _save() async {
setState(() { setState(() {
_isLoading = true; _isLoading = true;
}); });
try { try {
final contents = jsonEncode(_controller.document); final contentsEng = jsonEncode(_controllerEng.document);
print('contents => $contents'); final contentsMm = jsonEncode(_controllerMm.document);
print('contents => $contentsEng');
TermModel termModel = Provider.of<TermModel>(context, listen: false); TermModel termModel = Provider.of<TermModel>(context, listen: false);
await termModel.saveTerm(Term(term: contents)); await termModel.saveTerm(Term(termEng: contentsEng, termMm: contentsMm));
} catch (e) { } catch (e) {
showMsgDialog(context, "Error", e.toString()); showMsgDialog(context, "Error", e.toString());
} finally { } finally {

View File

@@ -3,7 +3,7 @@ import 'dart:convert';
import 'package:fcs/fcs/common/domain/entities/setting.dart'; import 'package:fcs/fcs/common/domain/entities/setting.dart';
import 'package:fcs/fcs/common/domain/vo/term.dart'; import 'package:fcs/fcs/common/domain/vo/term.dart';
import 'package:fcs/fcs/common/helpers/theme.dart'; import 'package:fcs/fcs/common/helpers/theme.dart';
import 'package:fcs/fcs/common/localization/app_translations.dart'; import 'package:fcs/fcs/common/pages/model/language_model.dart';
import 'package:fcs/fcs/common/pages/model/main_model.dart'; import 'package:fcs/fcs/common/pages/model/main_model.dart';
import 'package:fcs/fcs/common/pages/term/term_edit.dart'; import 'package:fcs/fcs/common/pages/term/term_edit.dart';
import 'package:fcs/fcs/common/pages/widgets/local_text.dart'; import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
@@ -35,7 +35,8 @@ class _TermPageState extends State<TermPage> {
} }
NotusDocument _loadDocument(Setting setting) { NotusDocument _loadDocument(Setting setting) {
String term = setting.terms; bool isEng = Provider.of<LanguageModel>(context).isEng;
String term = isEng ? setting.termsEng : setting.termsMm;
NotusDocument doc; NotusDocument doc;
try { try {
doc = NotusDocument.fromJson(jsonDecode(term)); doc = NotusDocument.fromJson(jsonDecode(term));
@@ -52,27 +53,22 @@ class _TermPageState extends State<TermPage> {
bool isEditable = context.select((MainModel m) => m.termEditable()); bool isEditable = context.select((MainModel m) => m.termEditable());
return Scaffold( return Scaffold(
body: CustomScrollView(slivers: [ appBar: AppBar(
SliverAppBar( shadowColor: Colors.transparent,
leading: IconButton( backgroundColor: Colors.white,
icon: Icon( centerTitle: true,
CupertinoIcons.back, leading: new IconButton(
size: 30, icon: new Icon(
Icons.close,
color: primaryColor,
), ),
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
), ),
backgroundColor: primaryColor, title: LocalText(
expandedHeight: 100.0, context,
floating: false, 'term',
pinned: true, color: primaryColor,
flexibleSpace: FlexibleSpaceBar( fontSize: 20,
centerTitle: true,
titlePadding: EdgeInsets.symmetric(vertical: 10),
title: LocalLargeTitle(
context,
"term",
color: Colors.white,
),
), ),
actions: isEditable actions: isEditable
? [ ? [
@@ -84,85 +80,30 @@ class _TermPageState extends State<TermPage> {
)), )),
icon: Icon( icon: Icon(
CupertinoIcons.pen, CupertinoIcons.pen,
color: Colors.white, color: primaryColor,
)) ))
] ]
: [], : [],
), ),
SliverFillRemaining( body: ZefyrTheme(
child: ZefyrTheme( data: ZefyrThemeData().copyWith(
data: ZefyrThemeData().copyWith( defaultLineTheme: LineTheme(
defaultLineTheme: LineTheme( padding: EdgeInsets.all(0),
textStyle: TextStyle(color: Colors.black), textStyle: TextStyle(fontFamily: "Myanmar3"),
padding: EdgeInsets.all(0))), ),
child: ZefyrScaffold( ),
child: ZefyrEditor( // data: ZefyrThemeData().copyWith(
mode: ZefyrMode.view, // defaultLineTheme: LineTheme(
padding: EdgeInsets.all(16), // textStyle: TextStyle(color: Colors.black),
controller: ZefyrController(_loadDocument(setting)), // padding: EdgeInsets.all(0))),
focusNode: _focusNode, child: ZefyrScaffold(
), child: ZefyrEditor(
))), mode: ZefyrMode.view,
])); padding: EdgeInsets.all(16),
} controller: ZefyrController(_loadDocument(setting)),
focusNode: _focusNode,
@override ),
Widget build1(BuildContext context) { )),
Setting setting = Provider.of<MainModel>(context).setting;
return CupertinoPageScaffold(
child: NestedScrollView(
floatHeaderSlivers: false,
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverAppBar(
leading: IconButton(
icon: Icon(
CupertinoIcons.back,
size: 30,
),
onPressed: () => Navigator.of(context).pop(),
),
backgroundColor: primaryColor,
expandedHeight: 150.0,
floating: true,
pinned: true,
flexibleSpace: FlexibleSpaceBar(
centerTitle: true,
titlePadding: EdgeInsets.symmetric(vertical: 10),
title: LocalLargeTitle(
context,
"term",
color: Colors.white,
),
),
actions: [
IconButton(
onPressed: () =>
Navigator.of(context).push<void>(CupertinoPageRoute(
builder: (context) =>
TermEdit(term: Term.fromSetting(setting)),
)),
icon: Icon(
CupertinoIcons.pen,
color: Colors.white,
))
],
),
];
},
body: ZefyrTheme(
data: ZefyrThemeData().copyWith(
defaultLineTheme: LineTheme(
textStyle: TextStyle(color: Colors.black),
padding: EdgeInsets.all(0))),
child: ZefyrScaffold(
child: ZefyrEditor(
mode: ZefyrMode.view,
padding: EdgeInsets.all(16),
controller: ZefyrController(_loadDocument(setting)),
focusNode: _focusNode,
),
))),
); );
} }
} }

View File

@@ -109,10 +109,7 @@ class UserSearchDelegate extends SearchDelegate<User> {
child: Center( child: Center(
child: Opacity( child: Opacity(
opacity: 0.2, opacity: 0.2,
child: Icon( child: Icon(Icons.perm_identity, size: 200, color: primaryColor)),
Icons.supervised_user_circle,
size: 200,
)),
), ),
); );
} }

View File

@@ -1,5 +1,4 @@
import 'package:fcs/fcs/common/pages/model/language_model.dart'; import 'package:fcs/fcs/common/pages/model/language_model.dart';
import 'package:fcs/fcs/common/pages/model/main_model.dart';
import 'package:fcs/fcs/common/pages/util.dart'; import 'package:fcs/fcs/common/pages/util.dart';
import 'package:fcs/fcs/common/pages/widgets/bottom_widgets.dart'; import 'package:fcs/fcs/common/pages/widgets/bottom_widgets.dart';
import 'package:fcs/widget/banner.dart'; import 'package:fcs/widget/banner.dart';
@@ -8,12 +7,10 @@ import 'package:fcs/widget/localization/transalation.dart';
import 'package:fcs/widget/offline_redirect.dart'; import 'package:fcs/widget/offline_redirect.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.dart' as intl;
import 'package:logging/logging.dart'; import 'package:logging/logging.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../helpers/theme.dart'; import '../helpers/theme.dart';
import 'profile/profile_page.dart';
import 'signin/signin_page.dart'; import 'signin/signin_page.dart';
final msgLog = Logger('backgroundMessageHandler'); final msgLog = Logger('backgroundMessageHandler');

View File

@@ -1,5 +1,6 @@
import 'package:fcs/fcs/common/pages/contact/contact_page.dart'; import 'package:fcs/fcs/common/pages/contact/contact_page.dart';
import 'package:fcs/fcs/common/pages/term/term_page.dart'; import 'package:fcs/fcs/common/pages/term/term_page.dart';
import 'package:fcs/fcs/common/pages/widgets/bottom_up_page_route.dart';
import 'package:fcs/fcs/common/pages/widgets/local_text.dart'; import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -14,18 +15,14 @@ class BottomWidgets extends StatelessWidget {
children: <Widget>[ children: <Widget>[
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.of(context).push<void>(CupertinoPageRoute( Navigator.of(context).push(BottomUpPageRoute(ContactPage()));
builder: (context) => ContactPage(),
));
}, },
child: _buildSmallButton( child: _buildSmallButton(
context, "contact.btn", SimpleLineIcons.support), context, "contact.btn", SimpleLineIcons.support),
), ),
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.of(context).push<void>(CupertinoPageRoute( Navigator.of(context).push(BottomUpPageRoute(TermPage()));
builder: (context) => TermPage(),
));
}, },
child: _buildSmallButton(context, "term.btn", Icons.info_outline), child: _buildSmallButton(context, "term.btn", Icons.info_outline),
), ),

View File

@@ -11,6 +11,7 @@ class DisplayText extends StatelessWidget {
final int maxLines; final int maxLines;
final bool withBorder; final bool withBorder;
final Color borderColor; final Color borderColor;
final Widget icon;
const DisplayText({ const DisplayText({
Key key, Key key,
@@ -20,6 +21,7 @@ class DisplayText extends StatelessWidget {
this.maxLines = 1, this.maxLines = 1,
this.withBorder = false, this.withBorder = false,
this.borderColor, this.borderColor,
this.icon,
}) : super(key: key); }) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -41,7 +43,7 @@ class DisplayText extends StatelessWidget {
child: Row( child: Row(
children: [ children: [
iconData == null iconData == null
? Container() ? icon == null ? Container() : icon
: Padding( : Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Icon( child: Icon(

View File

@@ -0,0 +1,18 @@
import 'package:flutter/cupertino.dart';
class FcsIDIcon extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: SizedBox(
width: 25,
height: 25,
child: FittedBox(
child: Image.asset("assets/logo.jpg"),
fit: BoxFit.fill,
),
),
);
}
}

View File

@@ -0,0 +1,29 @@
import 'package:fcs/fcs/common/data/providers/common_data_provider.dart';
import 'package:fcs/fcs/common/data/providers/user_data_provider.dart';
import 'package:fcs/fcs/common/domain/entities/payment_method.dart';
import 'package:flutter/material.dart';
import 'common_service.dart';
class CommonServiceImp implements CommonService {
CommonServiceImp({
@required this.commonDataProvider,
});
final CommonDataProvider commonDataProvider;
@override
Future<void> createPaymentMethod(PaymentMethod paymentMethod) {
return commonDataProvider.createPaymentMethod(paymentMethod);
}
@override
Future<void> deletePayment(String id) {
return commonDataProvider.deletePaymentMethod(id);
}
@override
Future<void> updatePaymentMethod(PaymentMethod paymentMethod) {
return commonDataProvider.updatePaymentMethod(paymentMethod);
}
}

View File

@@ -0,0 +1,8 @@
import 'package:fcs/fcs/common/domain/entities/payment_method.dart';
abstract class CommonService {
// Payment Service
Future<void> createPaymentMethod(PaymentMethod paymentMethod);
Future<void> updatePaymentMethod(PaymentMethod paymentMethod);
Future<void> deletePayment(String id);
}

View File

@@ -1,7 +1,10 @@
import 'package:fcs/fcs/common/data/providers/auth_fb.dart'; import 'package:fcs/fcs/common/data/providers/auth_fb.dart';
import 'package:fcs/fcs/common/data/providers/common_data_provider.dart';
import 'package:fcs/fcs/common/data/providers/package_data_provider.dart'; import 'package:fcs/fcs/common/data/providers/package_data_provider.dart';
import 'package:fcs/fcs/common/data/providers/user_data_provider.dart'; import 'package:fcs/fcs/common/data/providers/user_data_provider.dart';
import 'package:fcs/fcs/common/services/auth_imp.dart'; import 'package:fcs/fcs/common/services/auth_imp.dart';
import 'package:fcs/fcs/common/services/common_imp.dart';
import 'package:fcs/fcs/common/services/common_service.dart';
import 'package:fcs/fcs/common/services/messaging_imp.dart'; import 'package:fcs/fcs/common/services/messaging_imp.dart';
import 'package:fcs/fcs/common/services/messaging_service.dart'; import 'package:fcs/fcs/common/services/messaging_service.dart';
import 'package:fcs/fcs/common/services/package_imp.dart'; import 'package:fcs/fcs/common/services/package_imp.dart';
@@ -18,6 +21,7 @@ class Services {
UserService _userService; UserService _userService;
PackageService _packageService; PackageService _packageService;
MessagingService _messagingService; MessagingService _messagingService;
CommonService _commonService;
Services._() { Services._() {
_authService = AuthServiceImp( _authService = AuthServiceImp(
authFb: AuthFb.instance, authFb: AuthFb.instance,
@@ -28,10 +32,12 @@ class Services {
_messagingService = MessagingServiceImp(); _messagingService = MessagingServiceImp();
_packageService = PackageServiceImp( _packageService = PackageServiceImp(
connectivity: null, packageDataProvider: PackageDataProvider()); connectivity: null, packageDataProvider: PackageDataProvider());
_commonService = CommonServiceImp(commonDataProvider: CommonDataProvider());
} }
AuthService get authService => _authService; AuthService get authService => _authService;
UserService get userService => _userService; UserService get userService => _userService;
MessagingService get messagingService => _messagingService; MessagingService get messagingService => _messagingService;
PackageService get packageService => _packageService; PackageService get packageService => _packageService;
CommonService get commonService => _commonService;
} }