insert shipment form
This commit is contained in:
@@ -271,6 +271,7 @@
|
||||
"term.iagree":"I agree on terms and condition.",
|
||||
|
||||
"noti.title":"Notifications",
|
||||
"noti.list.title":"NOTIFICATIONS",
|
||||
"log.title":"Logs",
|
||||
|
||||
"document.log.title":"Document Logs",
|
||||
@@ -490,11 +491,17 @@
|
||||
"notifications.title":"Notification",
|
||||
|
||||
"staff.title":"FCS staffs",
|
||||
"staff.form.title":"FCS staff",
|
||||
"staff.list.title":"FCS STAFFS",
|
||||
"staff.new":"New Staff",
|
||||
"staff.form.title":"FCS STAFF",
|
||||
"staff.add":"Add",
|
||||
"staff.update":"Update",
|
||||
|
||||
"shipment.title":"Shipments",
|
||||
"shipment.list.title":"SHIPMENTS",
|
||||
"shipment.add":"New shipment",
|
||||
"shipment.form.title":"SHIPMENT",
|
||||
"shipment.number":"Shipment number",
|
||||
|
||||
"pickup": "Pickups",
|
||||
"pickup.title": "PICKUPS",
|
||||
|
||||
@@ -266,6 +266,7 @@
|
||||
"term.iagree":"ကျွန်တော် သဘောတူပါသည်",
|
||||
|
||||
"noti.title":"အသိပေးချက်များ",
|
||||
"noti.list.title":"NOTIFICATIONS",
|
||||
"log.title":"မှတ်တမ်းများ",
|
||||
|
||||
"document.log.title":"မှတ်တမ်းများ",
|
||||
@@ -522,11 +523,17 @@
|
||||
"notifications.title":"Notifications",
|
||||
|
||||
"staff.title":"FCS staffs",
|
||||
"staff.form.title":"FCS staff",
|
||||
"staff.list.title":"FCS STAFFS",
|
||||
"staff.new":"New Staff",
|
||||
"staff.form.title":"FCS STAFF",
|
||||
"staff.add":"Add",
|
||||
"staff.update":"Update",
|
||||
|
||||
"shipment.title":"Shipments",
|
||||
"shipment.list.title":"SHIPMENTS",
|
||||
"shipment.add":"New shipment",
|
||||
"shipment.form.title":"SHIPMENT",
|
||||
"shipment.number":"Shipment number",
|
||||
|
||||
"pickup.title": "Pickups",
|
||||
"pickup.new": "New Pickup",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:fcs/model/shipment_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@@ -63,6 +64,7 @@ class _AppState extends State<App> {
|
||||
final ReportUserModel reportUserModel = new ReportUserModel();
|
||||
final PickUpModel pickUpModel = new PickUpModel();
|
||||
final ShipmentRateModel shipmentRateModel = new ShipmentRateModel();
|
||||
final ShipmentModel shipmentModel = new ShipmentModel();
|
||||
|
||||
AppTranslationsDelegate _newLocaleDelegate;
|
||||
|
||||
@@ -94,7 +96,8 @@ class _AppState extends State<App> {
|
||||
..addModel(testModel)
|
||||
..addModel(reportUserModel)
|
||||
..addModel(pickUpModel)
|
||||
..addModel(shipmentRateModel);
|
||||
..addModel(shipmentRateModel)
|
||||
..addModel(shipmentModel);
|
||||
this.mainModel.init();
|
||||
}
|
||||
|
||||
@@ -145,6 +148,7 @@ class _AppState extends State<App> {
|
||||
ChangeNotifierProvider(builder: (context) => reportUserModel),
|
||||
ChangeNotifierProvider(builder: (context) => pickUpModel),
|
||||
ChangeNotifierProvider(builder: (context) => shipmentRateModel),
|
||||
ChangeNotifierProvider(builder: (context) => shipmentModel),
|
||||
ChangeNotifierProvider(
|
||||
builder: (context) => testModel,
|
||||
),
|
||||
|
||||
@@ -2,7 +2,6 @@ import 'dart:async';
|
||||
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:fcs/vo/announcement.dart';
|
||||
import 'package:fcs/vo/shipment.dart';
|
||||
|
||||
import 'base_model.dart';
|
||||
import 'constants.dart';
|
||||
@@ -11,12 +10,6 @@ import 'firebase_helper.dart';
|
||||
class AnnouncementModel extends BaseModel {
|
||||
List<Announcement> announcements = [];
|
||||
|
||||
List<Shipment> shipments = [
|
||||
Shipment(shipDate: DateTime(2020, 4, 23), shipmentNumber: 'A103B',status: 'In progress'),
|
||||
Shipment(shipDate: DateTime(2020, 4, 2), shipmentNumber: 'A100A',status: 'Delivered'),
|
||||
Shipment(shipDate: DateTime(2020, 4, 2), shipmentNumber: 'A100B',status: 'Delivered')
|
||||
];
|
||||
|
||||
void initUser(user) {
|
||||
super.initUser(user);
|
||||
_loadAnnouncements();
|
||||
|
||||
83
lib/model/shipment_model.dart
Normal file
83
lib/model/shipment_model.dart
Normal file
@@ -0,0 +1,83 @@
|
||||
import 'package:fcs/vo/shipment.dart';
|
||||
|
||||
import 'base_model.dart';
|
||||
|
||||
class ShipmentModel extends BaseModel {
|
||||
List<String> shipmentType = ['Air', 'Ship', 'Cargo Truck'];
|
||||
List<Shipment> shipments = [
|
||||
Shipment(
|
||||
shipDate: DateTime(2020, 4, 23),
|
||||
shipmentNumber: 'A103B',
|
||||
status: 'Pending',
|
||||
arrivalDate: DateTime(2020, 4, 30),
|
||||
departureDate: DateTime(2020, 4, 23)),
|
||||
Shipment(
|
||||
shipDate: DateTime(2020, 4, 2),
|
||||
shipmentNumber: 'A100A',
|
||||
status: 'Delivered',
|
||||
arrivalDate: DateTime(2020, 4, 28),
|
||||
departureDate: DateTime(2020, 4, 15)),
|
||||
Shipment(
|
||||
shipDate: DateTime(2020, 4, 2),
|
||||
shipmentNumber: 'A100B',
|
||||
status: 'Delivered',
|
||||
arrivalDate: DateTime(2020, 4, 28),
|
||||
departureDate: DateTime(2020, 4, 15)),
|
||||
Shipment(
|
||||
shipDate: DateTime(2020, 4, 10),
|
||||
shipmentNumber: 'A102B',
|
||||
status: 'Canceled',
|
||||
arrivalDate: DateTime(2020, 4, 20),
|
||||
departureDate: DateTime(2020, 4, 10)),
|
||||
Shipment(
|
||||
shipDate: DateTime(2020, 4, 2),
|
||||
shipmentNumber: 'A100B',
|
||||
status: 'Canceled',
|
||||
arrivalDate: DateTime(2020, 4, 20),
|
||||
departureDate: DateTime(2020, 4, 23)),
|
||||
Shipment(
|
||||
shipDate: DateTime(2020, 4, 10),
|
||||
shipmentNumber: 'A102B',
|
||||
status: 'Assigned',
|
||||
arrivalDate: DateTime(2020, 4, 30),
|
||||
departureDate: DateTime(2020, 4, 20),
|
||||
)
|
||||
];
|
||||
|
||||
List<Shipment> get canceled {
|
||||
List<Shipment> _p = shipments.where((e) => e.status == "Canceled").toList()
|
||||
..sort((e1, e2) {
|
||||
return e2.shipDate.compareTo(e1.shipDate);
|
||||
});
|
||||
return _p;
|
||||
}
|
||||
|
||||
List<Shipment> get completed {
|
||||
return shipments.where((e) => e.status == "Delivered").toList()
|
||||
..sort((e1, e2) {
|
||||
return e2.shipDate.compareTo(e1.shipDate);
|
||||
});
|
||||
}
|
||||
|
||||
List<Shipment> get upcoming {
|
||||
return shipments
|
||||
.where((e) =>
|
||||
e.status == "Pending" ||
|
||||
e.status == "Assigned" ||
|
||||
e.status == "Processed" ||
|
||||
e.status == "Rescheduled")
|
||||
.toList()
|
||||
..sort((e1, e2) {
|
||||
return e2.shipDate.compareTo(e1.shipDate);
|
||||
});
|
||||
}
|
||||
|
||||
void initUser(user) {
|
||||
super.initUser(user);
|
||||
}
|
||||
|
||||
@override
|
||||
logout() async {
|
||||
shipments = [];
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:pin_input_text_field/pin_input_text_field.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../theme/theme.dart';
|
||||
import '../theme/theme.dart';
|
||||
import '../widget/local_text.dart';
|
||||
import '../widget/progress.dart';
|
||||
@@ -66,6 +65,11 @@ class _CodePageState extends State<CodePage> {
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
leading: new IconButton(
|
||||
icon: new Icon(Icons.close),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
),
|
||||
body: ListView(
|
||||
@@ -82,7 +86,7 @@ class _CodePageState extends State<CodePage> {
|
||||
context,
|
||||
'singup.verify.title',
|
||||
fontSize: 21,
|
||||
color: secondaryColor,
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
@@ -161,6 +165,7 @@ class _CodePageState extends State<CodePage> {
|
||||
'login.smscode.retry',
|
||||
fontSize: 15,
|
||||
translationVariables: [_start.toString()],
|
||||
color: primaryColor,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -185,7 +190,7 @@ class _CodePageState extends State<CodePage> {
|
||||
_resend() async {}
|
||||
|
||||
_verify() async {
|
||||
Provider.of<MainModel>(context).saveUser(pin,widget.phoneNumber);
|
||||
Provider.of<MainModel>(context).saveUser(pin, widget.phoneNumber);
|
||||
await Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => UserEditPage()),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:fcs/model/main_model.dart';
|
||||
import 'package:fcs/pages/shipment_list.dart';
|
||||
import 'package:fcs/widget/bottom_up_page_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
@@ -45,7 +46,6 @@ import 'buying_online.dart';
|
||||
import 'do/do_list.dart';
|
||||
import 'my_registeration.dart';
|
||||
import 'pd/pd_list.dart';
|
||||
import 'po/shipment_list.dart';
|
||||
import 'products_list.dart';
|
||||
import 'profile_page.dart';
|
||||
import 'signin_page.dart';
|
||||
@@ -96,7 +96,7 @@ class _HomePageState extends State<HomePage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
login=Provider.of<MainModel>(context).isLogin();
|
||||
login = Provider.of<MainModel>(context).isLogin();
|
||||
final helpBtn = _buildBtn2("manual.title",
|
||||
icon: FontAwesomeIcons.readme,
|
||||
imgIcon: Image.asset(
|
||||
@@ -105,8 +105,8 @@ class _HomePageState extends State<HomePage> {
|
||||
height: 40,
|
||||
color: primaryColor,
|
||||
),
|
||||
btnCallback: () => Navigator.of(context)
|
||||
.push(BottomUpPageRoute(ManualPage()))
|
||||
btnCallback: () =>
|
||||
Navigator.of(context).push(BottomUpPageRoute(ManualPage()))
|
||||
// btnCallback: () => Navigator.of(context)
|
||||
// .push(MaterialPageRoute(builder: (_) => TestList()))
|
||||
);
|
||||
@@ -138,13 +138,13 @@ class _HomePageState extends State<HomePage> {
|
||||
|
||||
final pickUpBtn = _buildBtn2("pickup",
|
||||
icon: MaterialCommunityIcons.directions,
|
||||
btnCallback: () => Navigator.of(context)
|
||||
.push(BottomUpPageRoute(PickUpList())));
|
||||
btnCallback: () =>
|
||||
Navigator.of(context).push(BottomUpPageRoute(PickUpList())));
|
||||
|
||||
final shipmentCostBtn = _buildBtn2("rate",
|
||||
icon: FontAwesomeIcons.calculator,
|
||||
btnCallback: () => Navigator.of(context)
|
||||
.push(BottomUpPageRoute(ShipmentRates())));
|
||||
btnCallback: () =>
|
||||
Navigator.of(context).push(BottomUpPageRoute(ShipmentRates())));
|
||||
|
||||
final fcsProfileBtn = _buildBtn2("profile.title",
|
||||
icon: Icons.account_circle,
|
||||
@@ -229,14 +229,11 @@ class _HomePageState extends State<HomePage> {
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
final buyingBtn = _buildBtn2("buy_online",
|
||||
icon: MaterialCommunityIcons.cart_outline, btnCallback: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
BottomUpPageRoute(BuyingOnlinePage())
|
||||
// MaterialPageRoute(builder: (context) => BuyingOnlinePage()),
|
||||
);
|
||||
Navigator.push(context, BottomUpPageRoute(BuyingOnlinePage())
|
||||
// MaterialPageRoute(builder: (context) => BuyingOnlinePage()),
|
||||
);
|
||||
});
|
||||
|
||||
final notiBtn = _buildBtn2("notifications.title", icon: Icons.notifications,
|
||||
@@ -413,7 +410,7 @@ class _HomePageState extends State<HomePage> {
|
||||
),
|
||||
]
|
||||
: <Widget>[
|
||||
FlatButton(
|
||||
FlatButton(
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
@@ -422,7 +419,10 @@ class _HomePageState extends State<HomePage> {
|
||||
);
|
||||
},
|
||||
// iconSize: 30,
|
||||
child: Text("Sign in",style: siginButtonStyle,),
|
||||
child: Text(
|
||||
"Sign in",
|
||||
style: siginButtonStyle,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
|
||||
@@ -45,15 +45,17 @@ class _InstructionPageState extends State<InstructionPage> {
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
leading: new IconButton(
|
||||
icon: new Icon(Icons.close, color: secondaryColor),
|
||||
icon: new Icon(Icons.close, color: Colors.white),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
title: Text(widget.name),
|
||||
backgroundColor: primaryColor,
|
||||
),
|
||||
body: Container(
|
||||
child: FittedBox(
|
||||
child: Image.asset(widget.image), fit: BoxFit.contain),
|
||||
padding: EdgeInsets.only(left: 5, right: 5, top: 5),
|
||||
child: Card(elevation: 0,
|
||||
child: FittedBox(
|
||||
child: Image.asset(widget.image), fit: BoxFit.contain)),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -50,7 +50,7 @@ class _ManualPageState extends State<ManualPage> {
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: new IconButton(
|
||||
icon: new Icon(Icons.close, color: secondaryColor),
|
||||
icon: new Icon(Icons.close, color: Colors.white),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
title: Text(widget.marketplace == null ? '' : widget.marketplace),
|
||||
|
||||
@@ -3,7 +3,6 @@ import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:fcs/model/notification_model.dart';
|
||||
import 'package:fcs/vo/notification.dart' as Noti;
|
||||
import 'package:fcs/widget/localization/app_translations.dart';
|
||||
import 'package:fcs/widget/progress.dart';
|
||||
|
||||
import '../theme/theme.dart';
|
||||
@@ -33,14 +32,16 @@ class _NotificationListState extends State<NotificationList> {
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
leading: new IconButton(
|
||||
icon: new Icon(Icons.close, ),
|
||||
icon: new Icon(
|
||||
Icons.close,
|
||||
),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
title: LocalText(
|
||||
context,
|
||||
'noti.title',
|
||||
fontSize: 18,
|
||||
'noti.list.title',
|
||||
fontSize: 20,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
@@ -65,12 +66,11 @@ class _NotificationListState extends State<NotificationList> {
|
||||
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(Icons.message),
|
||||
// ),
|
||||
new Padding(padding: EdgeInsets.only(left: 10)),
|
||||
new Padding(
|
||||
padding: new EdgeInsets.symmetric(
|
||||
horizontal: 32.0 - dotSize / 2),
|
||||
child: Icon(Icons.message,color: primaryColor,),
|
||||
),
|
||||
new Expanded(
|
||||
child: new Column(
|
||||
crossAxisAlignment:
|
||||
@@ -85,20 +85,24 @@ class _NotificationListState extends State<NotificationList> {
|
||||
noti.marketPlace == null
|
||||
? Container()
|
||||
: Padding(
|
||||
padding: const EdgeInsets.only(top:8.0),
|
||||
child: new Text(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 8.0),
|
||||
child: new Text(
|
||||
noti.marketPlace,
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0,
|
||||
color: primaryColor),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top:8.0),
|
||||
padding:
|
||||
const EdgeInsets.only(top: 8.0),
|
||||
child: new Text(
|
||||
noti.status == null ? "" : noti.status,
|
||||
noti.status == null
|
||||
? ""
|
||||
: noti.status,
|
||||
style: new TextStyle(
|
||||
fontSize: 16.0,
|
||||
fontSize: 15.0,
|
||||
color: Colors.grey),
|
||||
),
|
||||
),
|
||||
@@ -123,7 +127,7 @@ class _NotificationListState extends State<NotificationList> {
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -1,163 +0,0 @@
|
||||
import 'package:fcs/vo/shipment.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:fcs/theme/theme.dart';
|
||||
import 'package:fcs/widget/progress.dart';
|
||||
|
||||
import '../../model/announcement_model.dart';
|
||||
import '../../widget/local_text.dart';
|
||||
import '../util.dart';
|
||||
|
||||
class ShipmentList extends StatefulWidget {
|
||||
@override
|
||||
_ShipmentListState createState() => _ShipmentListState();
|
||||
}
|
||||
|
||||
class _ShipmentListState extends State<ShipmentList> {
|
||||
var dateFormatter = new DateFormat('dd MMM yyyy');
|
||||
final double dotSize = 10.0;
|
||||
String status;
|
||||
|
||||
bool _isLoading = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var shipmentModel = Provider.of<AnnouncementModel>(context);
|
||||
final addbutton = Container(
|
||||
padding: EdgeInsets.only(left: 10, right: 10, top: 10),
|
||||
child: Container(
|
||||
height: 45.0,
|
||||
decoration: BoxDecoration(
|
||||
color: primaryColor,
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.all(Radius.circular(10.0))),
|
||||
child: ButtonTheme(
|
||||
minWidth: 900.0,
|
||||
height: 100.0,
|
||||
child: FlatButton(
|
||||
onPressed: () {
|
||||
// Navigator.push(
|
||||
// context,
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) => ManualPage(
|
||||
// marketplace: 'Amazon',
|
||||
// )));
|
||||
},
|
||||
child: LocalText(
|
||||
context,
|
||||
'shipment.add',
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: primaryColor,
|
||||
title: LocalText(context, 'shipment.title',
|
||||
fontSize: 18, color: Colors.white),
|
||||
),
|
||||
body: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: new ListView.builder(
|
||||
scrollDirection: Axis.vertical,
|
||||
padding: EdgeInsets.only(left: 15, right: 15, top: 15),
|
||||
shrinkWrap: true,
|
||||
itemCount: shipmentModel.shipments.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
Shipment _shipment = shipmentModel.shipments[index];
|
||||
return Card(
|
||||
elevation: 10,
|
||||
color: Colors.white,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
// Navigator.push(
|
||||
// context,
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) => POSubmissionForm(
|
||||
// poSubmission: _shipment,
|
||||
// )),
|
||||
// );
|
||||
},
|
||||
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: 15.0 - dotSize / 2),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(5.0),
|
||||
child: Image.asset(
|
||||
"assets/truck.png",
|
||||
width: 40,
|
||||
height: 40,
|
||||
color: primaryColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
new Expanded(
|
||||
child: new Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Text(
|
||||
_shipment.shipmentNumber.toString(),
|
||||
style: new TextStyle(
|
||||
fontSize: 12.0,
|
||||
color: Colors.black),
|
||||
),
|
||||
new Text(
|
||||
dateFormatter
|
||||
.format(_shipment.shipDate),
|
||||
style: new TextStyle(
|
||||
fontSize: 12.0,
|
||||
color: Colors.grey),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 18.0),
|
||||
child: getStatus(_shipment.status),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
addbutton,
|
||||
SizedBox(height: 15)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
371
lib/pages/shipment_editor.dart
Normal file
371
lib/pages/shipment_editor.dart
Normal file
@@ -0,0 +1,371 @@
|
||||
import 'package:fcs/model/main_model.dart';
|
||||
import 'package:fcs/model/shipment_model.dart';
|
||||
import 'package:fcs/pages/util.dart';
|
||||
import 'package:fcs/vo/shipment.dart';
|
||||
import 'package:fcs/vo/user.dart';
|
||||
import 'package:fcs/widget/label_widgets.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:fcs/widget/localization/app_translations.dart';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:fcs/widget/progress.dart';
|
||||
|
||||
import '../theme/theme.dart';
|
||||
|
||||
class ShipmentEditor extends StatefulWidget {
|
||||
final Shipment shipment;
|
||||
ShipmentEditor({this.shipment});
|
||||
|
||||
@override
|
||||
_ShipmentEditorState createState() => _ShipmentEditorState();
|
||||
}
|
||||
|
||||
class _ShipmentEditorState extends State<ShipmentEditor> {
|
||||
var dateFormatter = new DateFormat('dd MMM yyyy');
|
||||
TextEditingController _shipmentNumberController = new TextEditingController();
|
||||
TextEditingController _cutoffDateController = new TextEditingController();
|
||||
TextEditingController _arrivalDateController = new TextEditingController();
|
||||
TextEditingController _departureDateControler = new TextEditingController();
|
||||
TextEditingController _consigneeController = new TextEditingController();
|
||||
TextEditingController _portController = new TextEditingController();
|
||||
TextEditingController _destinationController = new TextEditingController();
|
||||
TextEditingController _statusController = new TextEditingController();
|
||||
TextEditingController _remarkController = new TextEditingController();
|
||||
|
||||
Shipment _shipment = new Shipment();
|
||||
bool _isLoading = false;
|
||||
String _currentShipment;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (widget.shipment != null) {
|
||||
_shipment = widget.shipment;
|
||||
_shipmentNumberController.text = _shipment.shipmentNumber;
|
||||
_arrivalDateController.text = dateFormatter.format(_shipment.arrivalDate);
|
||||
_departureDateControler.text =
|
||||
dateFormatter.format(_shipment.departureDate);
|
||||
_statusController.text = _shipment.status;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Widget _showCustomerData(User customer) {
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 10.0, top: 8),
|
||||
child: Text(
|
||||
customer.name,
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 10.0, top: 8),
|
||||
child: Text(
|
||||
customer.phoneNumber,
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
widget.shipment == null
|
||||
? Container()
|
||||
: Padding(
|
||||
padding: const EdgeInsets.only(left: 10.0, top: 8),
|
||||
child: Text(
|
||||
_shipmentNumberController.text,
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget showShipmentNumber(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Icon(Icons.text_rotation_none),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 8.0),
|
||||
child: labeledText(
|
||||
context, _shipmentNumberController.text, "shipment.number"),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget showShipmentTypes(BuildContext context, ShipmentModel shipmentModel) {
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
Icon(MaterialCommunityIcons.box_shadow),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
new Flexible(
|
||||
child: Container(
|
||||
width: 200.0,
|
||||
child: DropdownButton<String>(
|
||||
value: _currentShipment,
|
||||
isExpanded: true,
|
||||
hint: Text(
|
||||
'Select shipment type',
|
||||
),
|
||||
onChanged: changedDropDown,
|
||||
items: shipmentModel.shipmentType
|
||||
.map<DropdownMenuItem<String>>((String shipment) {
|
||||
return new DropdownMenuItem<String>(
|
||||
value: shipment,
|
||||
child: new Text(shipment,
|
||||
style:
|
||||
new TextStyle(color: Colors.black87, fontSize: 17)),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
void changedDropDown(selected) {
|
||||
setState(() {
|
||||
_currentShipment = selected;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var shipmentModel = Provider.of<ShipmentModel>(context);
|
||||
|
||||
final statusBox = Container(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: TextFormField(
|
||||
maxLines: null,
|
||||
controller: _statusController,
|
||||
cursorColor: primaryColor,
|
||||
style: textStyle,
|
||||
decoration: new InputDecoration(
|
||||
labelText: 'Status',
|
||||
labelStyle: TextStyle(fontSize: 14, color: Colors.grey),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||
),
|
||||
));
|
||||
|
||||
MainModel mainModel = Provider.of<MainModel>(context);
|
||||
|
||||
final commercialBtn = Container(
|
||||
padding: EdgeInsets.only(top: 20),
|
||||
child: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 250,
|
||||
child: FlatButton(
|
||||
child: Text('Download commercial invoice'),
|
||||
color: primaryColor,
|
||||
textColor: Colors.white,
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
))),
|
||||
);
|
||||
|
||||
final packingBtn = Container(
|
||||
padding: EdgeInsets.only(top: 5),
|
||||
child: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 250,
|
||||
child: FlatButton(
|
||||
child: Text('Download packing list'),
|
||||
color: primaryColor,
|
||||
textColor: Colors.white,
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
))),
|
||||
);
|
||||
|
||||
final dmsBtn = Container(
|
||||
padding: EdgeInsets.only(top: 5),
|
||||
child: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 250,
|
||||
child: FlatButton(
|
||||
child: Text('Download DMS'),
|
||||
color: primaryColor,
|
||||
textColor: Colors.white,
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
))),
|
||||
);
|
||||
|
||||
final createBtn = Container(
|
||||
padding: EdgeInsets.only(top: 20),
|
||||
child: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 250,
|
||||
child: FlatButton(
|
||||
child: Text('Create'),
|
||||
color: primaryColor,
|
||||
textColor: Colors.white,
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
))),
|
||||
);
|
||||
final updateBtn = Container(
|
||||
padding: EdgeInsets.only(top: 5),
|
||||
child: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 250,
|
||||
child: FlatButton(
|
||||
child: Text('Update'),
|
||||
color: primaryColor,
|
||||
textColor: Colors.white,
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
))),
|
||||
);
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
leading: new IconButton(
|
||||
icon: new Icon(Icons.close),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
title: Text(AppTranslations.of(context).text("shipment.form.title")),
|
||||
),
|
||||
body: Card(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: ListView(children: <Widget>[
|
||||
_showCustomerData(mainModel.customer),
|
||||
widget.shipment == null
|
||||
? fcsInput('Shipment number', Icons.text_rotation_none,
|
||||
controller: _shipmentNumberController)
|
||||
: Container(),
|
||||
widget.shipment == null
|
||||
? Container(
|
||||
padding: EdgeInsets.only(top: 15),
|
||||
child: fcsInput('Cutoff date', Icons.date_range,
|
||||
controller: _cutoffDateController),
|
||||
)
|
||||
: Container(),
|
||||
widget.shipment == null
|
||||
? Container(
|
||||
padding: EdgeInsets.only(top: 15),
|
||||
child: showShipmentTypes(context, shipmentModel))
|
||||
: Container(),
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 15),
|
||||
child: fcsInput('Arrival date', Icons.date_range,
|
||||
controller: _arrivalDateController),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 15),
|
||||
child: fcsInput('Departure date', Icons.date_range,
|
||||
controller: _departureDateControler),
|
||||
),
|
||||
widget.shipment == null
|
||||
? Container(
|
||||
padding: EdgeInsets.only(top: 15),
|
||||
child: fcsInput('Consignee', Icons.work,
|
||||
controller: _consigneeController),
|
||||
)
|
||||
: Container(),
|
||||
widget.shipment == null
|
||||
? Container(
|
||||
padding: EdgeInsets.only(top: 15),
|
||||
child: fcsInput(
|
||||
'Port of loading', FontAwesomeIcons.ship,
|
||||
controller: _portController),
|
||||
)
|
||||
: Container(),
|
||||
widget.shipment == null
|
||||
? Container(
|
||||
padding: EdgeInsets.only(top: 15),
|
||||
child: fcsInput('Final destination',
|
||||
MaterialCommunityIcons.location_enter,
|
||||
controller: _destinationController),
|
||||
)
|
||||
: Container(),
|
||||
widget.shipment == null
|
||||
? Container()
|
||||
: Row(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(top: 15, right: 8.0),
|
||||
child: Image.asset(
|
||||
'assets/status.png',
|
||||
width: 24,
|
||||
height: 24,
|
||||
),
|
||||
),
|
||||
Expanded(child: statusBox)
|
||||
],
|
||||
),
|
||||
widget.shipment == null
|
||||
? Container()
|
||||
: Container(
|
||||
padding: EdgeInsets.only(top: 15),
|
||||
child: fcsInput('Remark', MaterialCommunityIcons.note,
|
||||
controller: _remarkController),
|
||||
),
|
||||
widget.shipment == null ? Container() : commercialBtn,
|
||||
widget.shipment == null ? Container() : packingBtn,
|
||||
widget.shipment == null ? Container() : dmsBtn,
|
||||
widget.shipment == null ? createBtn : updateBtn,
|
||||
SizedBox(height: 15)
|
||||
]),
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
156
lib/pages/shipment_list.dart
Normal file
156
lib/pages/shipment_list.dart
Normal file
@@ -0,0 +1,156 @@
|
||||
import 'package:fcs/model/shipment_model.dart';
|
||||
import 'package:fcs/widget/local_text.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:fcs/pages/search_page.dart';
|
||||
import 'package:fcs/vo/buyer.dart';
|
||||
import 'package:fcs/widget/localization/app_translations.dart';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:fcs/widget/progress.dart';
|
||||
|
||||
import '../theme/theme.dart';
|
||||
import 'shipment_editor.dart';
|
||||
import 'shipment_list_row.dart';
|
||||
|
||||
class ShipmentList extends StatefulWidget {
|
||||
@override
|
||||
_ShipmentListState createState() => _ShipmentListState();
|
||||
}
|
||||
|
||||
class _ShipmentListState extends State<ShipmentList> {
|
||||
Buyer buyer;
|
||||
bool _isLoading = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: DefaultTabController(
|
||||
length: 3,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
leading: new IconButton(
|
||||
icon: new Icon(Icons.close),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
title: LocalText(context, 'shipment.list.title',
|
||||
color: Colors.white, fontSize: 20),
|
||||
actions: <Widget>[
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
Icons.search,
|
||||
color: Colors.white,
|
||||
),
|
||||
iconSize: 30,
|
||||
onPressed: () => showPlacesSearch(context),
|
||||
),
|
||||
],
|
||||
bottom: TabBar(
|
||||
unselectedLabelColor: Colors.grey,
|
||||
tabs: [
|
||||
Tab(
|
||||
text: "Upcoming",
|
||||
),
|
||||
Tab(text: "Completed"),
|
||||
Tab(text: "Canceled"),
|
||||
],
|
||||
),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton.extended(
|
||||
onPressed: () {
|
||||
_newShipment();
|
||||
},
|
||||
icon: Icon(Icons.add),
|
||||
label: Text(AppTranslations.of(context).text("shipment.add")),
|
||||
backgroundColor: primaryColor,
|
||||
),
|
||||
body: TabBarView(
|
||||
children: [_upComing(), _completed(), _canceled()],
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_newShipment() {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => new ShipmentEditor()),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _upComing() {
|
||||
var shipmentModel = Provider.of<ShipmentModel>(context);
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: new ListView.separated(
|
||||
separatorBuilder: (context, index) => Divider(
|
||||
color: Colors.black,
|
||||
),
|
||||
scrollDirection: Axis.vertical,
|
||||
padding: EdgeInsets.only(top: 15),
|
||||
shrinkWrap: true,
|
||||
itemCount: shipmentModel.upcoming.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return ShipmentListRow(shipment: shipmentModel.upcoming[index]);
|
||||
}),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _completed() {
|
||||
var shipmentModel = Provider.of<ShipmentModel>(context);
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: new ListView.separated(
|
||||
separatorBuilder: (context, index) => Divider(
|
||||
color: Colors.black,
|
||||
),
|
||||
scrollDirection: Axis.vertical,
|
||||
padding: EdgeInsets.only(top: 15),
|
||||
shrinkWrap: true,
|
||||
itemCount: shipmentModel.completed.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return ShipmentListRow(
|
||||
shipment: shipmentModel.completed[index]);
|
||||
}),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _canceled() {
|
||||
var shipmentModel = Provider.of<ShipmentModel>(context);
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: new ListView.separated(
|
||||
separatorBuilder: (context, index) => Divider(
|
||||
color: Colors.black,
|
||||
),
|
||||
scrollDirection: Axis.vertical,
|
||||
padding: EdgeInsets.only(top: 15),
|
||||
shrinkWrap: true,
|
||||
itemCount: shipmentModel.canceled.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return ShipmentListRow(shipment: shipmentModel.canceled[index]);
|
||||
}),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
97
lib/pages/shipment_list_row.dart
Normal file
97
lib/pages/shipment_list_row.dart
Normal file
@@ -0,0 +1,97 @@
|
||||
import 'package:fcs/theme/theme.dart';
|
||||
import 'package:fcs/vo/shipment.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import 'shipment_editor.dart';
|
||||
import 'util.dart';
|
||||
|
||||
class ShipmentListRow extends StatefulWidget {
|
||||
final Shipment shipment;
|
||||
const ShipmentListRow({this.shipment});
|
||||
|
||||
@override
|
||||
_ShipmentListRowState createState() => _ShipmentListRowState();
|
||||
}
|
||||
|
||||
class _ShipmentListRowState extends State<ShipmentListRow> {
|
||||
var dateFormatter = new DateFormat('dd MMM yyyy');
|
||||
final double dotSize = 15.0;
|
||||
Shipment _shipment = new Shipment();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
if (widget.shipment != null) {
|
||||
_shipment = widget.shipment;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 15, right: 15),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => ShipmentEditor(shipment: _shipment)),
|
||||
);
|
||||
},
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: new Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10.0),
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 5, right: 10),
|
||||
child: Icon(
|
||||
Ionicons.ios_airplane,
|
||||
color: primaryColor,
|
||||
size: 30,
|
||||
),
|
||||
),
|
||||
new Expanded(
|
||||
child: new Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: new Text(
|
||||
_shipment.shipmentNumber == null
|
||||
? ''
|
||||
: _shipment.shipmentNumber,
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0, color: Colors.black),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 10.0, top: 10),
|
||||
child: new Text(
|
||||
dateFormatter.format(_shipment.shipDate),
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0, color: Colors.grey),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(0),
|
||||
child: getStatus(_shipment.status),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,11 @@ class _SigninPageState extends State<SigninPage> {
|
||||
inAsyncCall: _isLoading,
|
||||
child: new Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
leading: new IconButton(
|
||||
icon: new Icon(Icons.close),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
),
|
||||
body: _buildLogin(context),
|
||||
@@ -53,7 +58,7 @@ class _SigninPageState extends State<SigninPage> {
|
||||
context,
|
||||
'login.title',
|
||||
fontSize: 21,
|
||||
color: secondaryColor,
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
@@ -89,31 +94,27 @@ class _SigninPageState extends State<SigninPage> {
|
||||
),
|
||||
Flexible(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(top: 10, bottom: 10),
|
||||
child: TextFormField(
|
||||
autofocus: true,
|
||||
controller: phonenumberCtl,
|
||||
cursorColor: primaryColor,
|
||||
keyboardType: TextInputType.phone,
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.all(8.0),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(12.0)),
|
||||
padding: EdgeInsets.only(top: 10, bottom: 10),
|
||||
child: TextFormField(
|
||||
controller: phonenumberCtl,
|
||||
cursorColor: primaryColor,
|
||||
textAlign: TextAlign.left,
|
||||
autofocus: true,
|
||||
keyboardType: TextInputType.phone,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
),
|
||||
decoration: new InputDecoration(
|
||||
contentPadding: EdgeInsets.only(top: 8),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Colors.grey[400], width: 1),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(10.0)),
|
||||
borderSide: BorderSide(
|
||||
color: Colors.grey[400],
|
||||
),
|
||||
),
|
||||
),
|
||||
)),
|
||||
BorderSide(color: primaryColor, width: 1.0)),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: primaryColor, width: 1.0)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -167,7 +168,7 @@ class _SigninPageState extends State<SigninPage> {
|
||||
MaterialPageRoute(
|
||||
builder: (context) => CodePage(phoneNumber: phoneNumber)));
|
||||
Navigator.pop(context);
|
||||
|
||||
|
||||
if (exp != null) throw exp;
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
|
||||
@@ -10,7 +10,6 @@ import 'package:fcs/vo/user.dart';
|
||||
import 'package:fcs/widget/local_text.dart';
|
||||
import 'package:fcs/widget/localization/app_translations.dart';
|
||||
import 'package:fcs/widget/progress.dart';
|
||||
import 'document_log_page.dart';
|
||||
import 'util.dart';
|
||||
|
||||
typedef void FindCallBack();
|
||||
@@ -112,16 +111,9 @@ class _StaffEditorState extends State<StaffEditor> {
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value.isEmpty) {
|
||||
return "Please enter phone number";
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
new FlatButton(
|
||||
onPressed: () {
|
||||
if (!_formKey.currentState.validate()) return;
|
||||
this.isSend = true;
|
||||
findCallBack();
|
||||
},
|
||||
@@ -189,9 +181,9 @@ class _StaffEditorState extends State<StaffEditor> {
|
||||
child: Container(
|
||||
height: 45.0,
|
||||
decoration: BoxDecoration(
|
||||
color: primaryColor,
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.all(Radius.circular(10.0))),
|
||||
color: primaryColor,
|
||||
shape: BoxShape.rectangle,
|
||||
),
|
||||
child: ButtonTheme(
|
||||
minWidth: 900.0,
|
||||
height: 100.0,
|
||||
@@ -208,25 +200,23 @@ class _StaffEditorState extends State<StaffEditor> {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
final addButton = Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: 24.0,
|
||||
right: 24.0,
|
||||
),
|
||||
padding: EdgeInsets.only(top: 40),
|
||||
child: Container(
|
||||
height: 45.0,
|
||||
color: primaryColor,
|
||||
decoration: BoxDecoration(
|
||||
color: primaryColor,
|
||||
shape: BoxShape.rectangle,
|
||||
),
|
||||
child: ButtonTheme(
|
||||
minWidth: 900.0,
|
||||
height: 100.0,
|
||||
child: FlatButton(
|
||||
onPressed: () {
|
||||
if (!_formKey.currentState.validate()) return;
|
||||
_add(context);
|
||||
},
|
||||
onPressed: () {},
|
||||
child: LocalText(
|
||||
context,
|
||||
'employee.add',
|
||||
'staff.add',
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -240,6 +230,11 @@ class _StaffEditorState extends State<StaffEditor> {
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
leading: new IconButton(
|
||||
icon: new Icon(Icons.close),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
title: LocalText(
|
||||
context,
|
||||
@@ -276,7 +271,7 @@ class _StaffEditorState extends State<StaffEditor> {
|
||||
Column(
|
||||
children: showprivilegeList(context, userModel),
|
||||
),
|
||||
updateButton,
|
||||
widget.staff == null ? addButton : updateButton,
|
||||
SizedBox(
|
||||
height: 20,
|
||||
)
|
||||
@@ -315,8 +310,7 @@ class _StaffEditorState extends State<StaffEditor> {
|
||||
if (widget.staff == null) return;
|
||||
var employeeModel = Provider.of<EmployeeModel>(context);
|
||||
try {
|
||||
await employeeModel.updatePrivileges(
|
||||
widget.staff.docID, privilegesIDs());
|
||||
await employeeModel.updatePrivileges(widget.staff.docID, privilegesIDs());
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import 'package:fcs/widget/localization/app_translations.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
@@ -30,58 +32,64 @@ class _StaffListState extends State<StaffList> {
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
leading: new IconButton(
|
||||
icon: new Icon(Icons.close),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
title: LocalText(
|
||||
context,
|
||||
'staff.title',
|
||||
'staff.list.title',
|
||||
color: Colors.white,
|
||||
fontSize: 18,
|
||||
fontSize: 20,
|
||||
),
|
||||
),
|
||||
// floatingActionButton: FloatingActionButton(
|
||||
// backgroundColor: primaryColor,
|
||||
// child: Icon(Icons.add),
|
||||
// onPressed: () {
|
||||
// Navigator.push(
|
||||
// context,
|
||||
// MaterialPageRoute(builder: (context) => EmployeeEditor()),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
body: new ListView.builder(
|
||||
padding: EdgeInsets.only(left: 10, right: 10, top: 15),
|
||||
floatingActionButton: FloatingActionButton.extended(
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => StaffEditor()),
|
||||
);
|
||||
},
|
||||
icon: Icon(Icons.add),
|
||||
label: Text(AppTranslations.of(context).text("staff.new")),
|
||||
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: employeeModel.employees.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
User _user = employeeModel.employees[index];
|
||||
return Container(
|
||||
child: Card(
|
||||
elevation: 10,
|
||||
color: Colors.white,
|
||||
child: InkWell(
|
||||
User user = employeeModel.employees[index];
|
||||
return Stack(
|
||||
children: <Widget>[
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
StaffEditor(staff: _user)),
|
||||
builder: (context) => StaffEditor(staff: user)),
|
||||
);
|
||||
},
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: new Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 20.0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 10.0),
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Padding(
|
||||
padding: new EdgeInsets.symmetric(
|
||||
horizontal: 32.0 - dotSize / 2),
|
||||
child: Image.asset(
|
||||
"assets/employee.png",
|
||||
width: 40,
|
||||
height: 40,
|
||||
child: Icon(
|
||||
SimpleLineIcons.people,
|
||||
color: primaryColor,
|
||||
size: 40,
|
||||
),
|
||||
),
|
||||
new Expanded(
|
||||
@@ -90,16 +98,20 @@ class _StaffListState extends State<StaffList> {
|
||||
CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Text(
|
||||
_user.name,
|
||||
user.name,
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0,
|
||||
color: secondaryColor),
|
||||
color: primaryColor),
|
||||
),
|
||||
new Text(
|
||||
_user.phoneNumber,
|
||||
style: new TextStyle(
|
||||
fontSize: 13.0,
|
||||
color: secondaryColor),
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(top: 8.0),
|
||||
child: new Text(
|
||||
user.phoneNumber,
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0,
|
||||
color: Colors.grey),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -108,20 +120,10 @@ class _StaffListState extends State<StaffList> {
|
||||
),
|
||||
),
|
||||
),
|
||||
_user.status == null
|
||||
? Container()
|
||||
: Row(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: getStatus(_user.status),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
),
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import 'package:fcs/model/shared_pref.dart';
|
||||
import 'package:fcs/widget/localization/app_translations.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
import '../theme/theme.dart';
|
||||
import '../theme/theme.dart';
|
||||
import '../widget/local_text.dart';
|
||||
import '../widget/progress.dart';
|
||||
@@ -29,6 +29,11 @@ class _UserEditPageState extends State<UserEditPage> {
|
||||
inAsyncCall: _isLoading,
|
||||
child: new Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
leading: new IconButton(
|
||||
icon: new Icon(Icons.close),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
),
|
||||
body: _buildBody(context),
|
||||
@@ -38,7 +43,7 @@ class _UserEditPageState extends State<UserEditPage> {
|
||||
|
||||
Widget _buildBody(BuildContext context) {
|
||||
return ListView(
|
||||
padding: EdgeInsets.only(top: 5, left: 15, right: 15),
|
||||
padding: EdgeInsets.only(top: 5, left: 10, right: 10),
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 40),
|
||||
@@ -46,7 +51,7 @@ class _UserEditPageState extends State<UserEditPage> {
|
||||
context,
|
||||
'user_edit.welcome',
|
||||
fontSize: 21,
|
||||
color: secondaryColor,
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
@@ -60,28 +65,21 @@ class _UserEditPageState extends State<UserEditPage> {
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 10, bottom: 10),
|
||||
padding: EdgeInsets.only(top: 0, bottom: 10),
|
||||
child: TextFormField(
|
||||
autofocus: true,
|
||||
controller: nameCtl,
|
||||
cursorColor: primaryColor,
|
||||
keyboardType: TextInputType.text,
|
||||
textAlign: TextAlign.left,
|
||||
keyboardType: TextInputType.text,
|
||||
autofocus: true,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.all(8.0),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(12.0)),
|
||||
borderSide: BorderSide(color: Colors.grey[400], width: 1),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(10.0)),
|
||||
borderSide: BorderSide(
|
||||
color: Colors.grey[400],
|
||||
),
|
||||
),
|
||||
decoration: new InputDecoration(
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||
),
|
||||
)),
|
||||
SizedBox(
|
||||
|
||||
@@ -200,17 +200,9 @@ void showCommentDialog(BuildContext context, commentCallback(comment)) {
|
||||
|
||||
Widget getStatus(String status) {
|
||||
return status == "Delivered"
|
||||
? Chip(
|
||||
backgroundColor: Colors.green,
|
||||
avatar: Icon(
|
||||
Icons.check,
|
||||
color: Colors.white,
|
||||
size: 14,
|
||||
),
|
||||
label: Text(
|
||||
status,
|
||||
style: TextStyle(color: Colors.white, fontSize: 12),
|
||||
))
|
||||
? Text(status,
|
||||
style: TextStyle(
|
||||
color: primaryColor, fontSize: 18, fontWeight: FontWeight.bold))
|
||||
: status == "rejected"
|
||||
? Chip(
|
||||
backgroundColor: Colors.red,
|
||||
@@ -224,17 +216,10 @@ Widget getStatus(String status) {
|
||||
style: TextStyle(color: Colors.white, fontSize: 12),
|
||||
))
|
||||
: status == "In progress"
|
||||
? Chip(
|
||||
backgroundColor: Colors.red,
|
||||
avatar: Icon(
|
||||
Icons.timelapse,
|
||||
color: Colors.white,
|
||||
size: 14,
|
||||
),
|
||||
label: Text(
|
||||
status,
|
||||
style: TextStyle(color: Colors.white, fontSize: 12),
|
||||
))
|
||||
? Text(
|
||||
status,
|
||||
style: TextStyle(color: Colors.white, fontSize: 12),
|
||||
)
|
||||
: status == "Pickuped"
|
||||
? Text(
|
||||
status,
|
||||
@@ -400,7 +385,7 @@ Widget phoneWidget(BuildContext context, String phone) {
|
||||
}
|
||||
|
||||
Widget fcsInput(String label, IconData iconData,
|
||||
{TextEditingController controller,String value}) {
|
||||
{TextEditingController controller, String value}) {
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
@@ -409,17 +394,17 @@ Widget fcsInput(String label, IconData iconData,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
height: 50.0,
|
||||
child: Row(children: <Widget>[
|
||||
Expanded(
|
||||
child: TextFormField(
|
||||
initialValue: value,
|
||||
initialValue: value,
|
||||
controller: controller,
|
||||
cursorColor: primaryColor,
|
||||
textAlign: TextAlign.left,
|
||||
decoration: new InputDecoration(
|
||||
contentPadding: EdgeInsets.only(top: 8),
|
||||
labelText: label,
|
||||
labelStyle: TextStyle(fontSize: 14, color: Colors.grey),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
@@ -473,7 +458,7 @@ Widget _dropDown() {
|
||||
);
|
||||
}
|
||||
|
||||
Widget fcsButton(BuildContext context, String text,{Function callack}) {
|
||||
Widget fcsButton(BuildContext context, String text, {Function callack}) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 10, right: 10, top: 10),
|
||||
child: Container(
|
||||
|
||||
@@ -1,6 +1,25 @@
|
||||
class Shipment {
|
||||
DateTime shipDate;
|
||||
String shipmentNumber;
|
||||
DateTime cutoffDate;
|
||||
String shipType;
|
||||
DateTime arrivalDate;
|
||||
DateTime departureDate;
|
||||
String consignee;
|
||||
String port;
|
||||
String destination;
|
||||
String status;
|
||||
Shipment({this.shipDate, this.shipmentNumber,this.status});
|
||||
String remark;
|
||||
Shipment(
|
||||
{this.shipDate,
|
||||
this.shipmentNumber,
|
||||
this.cutoffDate,
|
||||
this.shipType,
|
||||
this.status,
|
||||
this.arrivalDate,
|
||||
this.departureDate,
|
||||
this.consignee,
|
||||
this.port,
|
||||
this.destination,
|
||||
this.remark});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user