update shipment list and editor
This commit is contained in:
@@ -319,11 +319,11 @@
|
|||||||
"Delivery End ================================================================":"",
|
"Delivery End ================================================================":"",
|
||||||
|
|
||||||
"FCS Shipment Start ================================================================":"",
|
"FCS Shipment Start ================================================================":"",
|
||||||
"FCSshipment.title":"FCS Shipments",
|
"FCSshipment.title":"Shipments",
|
||||||
"FCSshipment.list.title":"FCS Shipments",
|
"FCSshipment.list.title":"Shipments",
|
||||||
"FCSshipment.add":"New FCS shipment",
|
"FCSshipment.add":"New shipment",
|
||||||
"FCSshipment.form.title":"FCS Shipment",
|
"FCSshipment.form.title":"Shipment",
|
||||||
"FCSshipment.number":"FCS shipment number",
|
"FCSshipment.number":"Shipment number",
|
||||||
"FCSshipment.cutoff_date":"Cutoff date",
|
"FCSshipment.cutoff_date":"Cutoff date",
|
||||||
"FCSshipment.ETA":"ETA",
|
"FCSshipment.ETA":"ETA",
|
||||||
"FCSshipment.departure_date":"Departure date",
|
"FCSshipment.departure_date":"Departure date",
|
||||||
@@ -337,12 +337,13 @@
|
|||||||
"FCSshipment.packing_list":"Download packing list",
|
"FCSshipment.packing_list":"Download packing list",
|
||||||
"FCSshipment.dms":"Download DMS",
|
"FCSshipment.dms":"Download DMS",
|
||||||
"FCSshipment.cargo_manifest":"Download cargo manifest",
|
"FCSshipment.cargo_manifest":"Download cargo manifest",
|
||||||
"FCSshipment.create":"Create FCS shipment",
|
"FCSshipment.create":"Create new shipment",
|
||||||
"FCSshipment.update":"Update FCS shipment",
|
"FCSshipment.update":"Update shipment",
|
||||||
"FCSshipment.ship.btn":"Ship",
|
"FCSshipment.ship.btn":"Ship",
|
||||||
"FCSshipment.ship.confirm":"Confirm ship?",
|
"FCSshipment.ship.confirm":"Confirm ship?",
|
||||||
"FCSshipment.popupmenu.active":"Active FCS shipments",
|
"FCSshipment.popupmenu.all":"All shipments",
|
||||||
"FCSshipment.popupmenu.shipped":"Shipped FCS shipments",
|
"FCSshipment.popupmenu.active":"Active shipments",
|
||||||
|
"FCSshipment.popupmenu.shipped":"Shipped shipments",
|
||||||
"FCS Shipment End ================================================================":"",
|
"FCS Shipment End ================================================================":"",
|
||||||
|
|
||||||
"Shipment Start ================================================================":"",
|
"Shipment Start ================================================================":"",
|
||||||
|
|||||||
@@ -318,11 +318,11 @@
|
|||||||
"Delivery End ================================================================":"",
|
"Delivery End ================================================================":"",
|
||||||
|
|
||||||
"FCS Shipment Start ================================================================":"",
|
"FCS Shipment Start ================================================================":"",
|
||||||
"FCSshipment.title":"FCS တင်ပို့ခြင်းများ",
|
"FCSshipment.title":"တင်ပို့ခြင်းများ",
|
||||||
"FCSshipment.list.title":"FCS တင်ပို့ခြင်းများ",
|
"FCSshipment.list.title":"တင်ပို့ခြင်းများ",
|
||||||
"FCSshipment.add":"FCS တင်ပို့ခြင်းအသစ်",
|
"FCSshipment.add":"တင်ပို့ခြင်းအသစ်",
|
||||||
"FCSshipment.form.title":"FCS တင်ပို့ခြင်း",
|
"FCSshipment.form.title":"တင်ပို့ခြင်း",
|
||||||
"FCSshipment.number":"FCS တင်ပို့နံပါတ်",
|
"FCSshipment.number":"တင်ပို့နံပါတ်",
|
||||||
"FCSshipment.cutoff_date":"သတ်မှတ်ရက်",
|
"FCSshipment.cutoff_date":"သတ်မှတ်ရက်",
|
||||||
"FCSshipment.ETA":"ခန့်မှန်းရောက်ချိန်",
|
"FCSshipment.ETA":"ခန့်မှန်းရောက်ချိန်",
|
||||||
"FCSshipment.departure_date":"ထွက်ခွာသည့်ရက်",
|
"FCSshipment.departure_date":"ထွက်ခွာသည့်ရက်",
|
||||||
@@ -336,12 +336,13 @@
|
|||||||
"FCSshipment.packing_list":"ထုပ်ပိုးစာရင်းကိုဒေါင်းမည်",
|
"FCSshipment.packing_list":"ထုပ်ပိုးစာရင်းကိုဒေါင်းမည်",
|
||||||
"FCSshipment.dms":"DMS ကိုဒေါင်းမည်",
|
"FCSshipment.dms":"DMS ကိုဒေါင်းမည်",
|
||||||
"FCSshipment.cargo_manifest":"ကုန်ပစ္စည်းကိုဒေါင်းမည်",
|
"FCSshipment.cargo_manifest":"ကုန်ပစ္စည်းကိုဒေါင်းမည်",
|
||||||
"FCSshipment.create":"FCS တင်ပို့ခြင်းပြုလုပ်မည်",
|
"FCSshipment.create":"တင်ပို့ခြင်းအသစ်ပြုလုပ်မည်",
|
||||||
"FCSshipment.update":"FCS တင်ပို့ခြင်းပြုပြင်မည်",
|
"FCSshipment.update":"တင်ပို့ခြင်းပြုပြင်မည်",
|
||||||
"FCSshipment.ship.btn":"Ship",
|
"FCSshipment.ship.btn":"Ship",
|
||||||
"FCSshipment.ship.confirm":"Confirm ship?",
|
"FCSshipment.ship.confirm":"Confirm ship?",
|
||||||
"FCSshipment.popupmenu.active":"Active FCS shipments",
|
"FCSshipment.popupmenu.all":"All shipments",
|
||||||
"FCSshipment.popupmenu.shipped":"Shipped FCS shipments",
|
"FCSshipment.popupmenu.active":"Active shipments",
|
||||||
|
"FCSshipment.popupmenu.shipped":"Shipped shipments",
|
||||||
"FCS Shipment End ================================================================":"",
|
"FCS Shipment End ================================================================":"",
|
||||||
|
|
||||||
"Shipment Start ================================================================":"",
|
"Shipment Start ================================================================":"",
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import 'package:fcs/localization/app_translations.dart';
|
|||||||
import 'package:fcs/pages/fcs_shipment/model/fcs_shipment_model.dart';
|
import 'package:fcs/pages/fcs_shipment/model/fcs_shipment_model.dart';
|
||||||
import 'package:fcs/pages/main/model/language_model.dart';
|
import 'package:fcs/pages/main/model/language_model.dart';
|
||||||
import 'package:fcs/pages/main/model/main_model.dart';
|
import 'package:fcs/pages/main/model/main_model.dart';
|
||||||
import 'package:fcs/pages/widgets/display_text.dart';
|
|
||||||
import 'package:fcs/pages/widgets/input_date.dart';
|
import 'package:fcs/pages/widgets/input_date.dart';
|
||||||
import 'package:fcs/pages/widgets/input_text.dart';
|
import 'package:fcs/pages/widgets/input_text.dart';
|
||||||
import 'package:fcs/pages/widgets/local_app_bar.dart';
|
import 'package:fcs/pages/widgets/local_app_bar.dart';
|
||||||
@@ -79,21 +78,27 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
|||||||
var languageModel = Provider.of<LanguageModel>(context);
|
var languageModel = Provider.of<LanguageModel>(context);
|
||||||
var mainModel = Provider.of<MainModel>(context);
|
var mainModel = Provider.of<MainModel>(context);
|
||||||
|
|
||||||
final createBtn = LocalButton(
|
final createBtn = Padding(
|
||||||
textKey: "FCSshipment.create",
|
padding: const EdgeInsets.symmetric(horizontal: 30),
|
||||||
callBack: _create,
|
child: LocalButton(
|
||||||
|
textKey: "FCSshipment.create",
|
||||||
|
callBack: _create,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
final updateBtn = LocalButton(
|
final updateBtn = Padding(
|
||||||
textKey: "FCSshipment.update",
|
padding: const EdgeInsets.symmetric(horizontal: 30),
|
||||||
callBack: _update,
|
child: LocalButton(
|
||||||
|
textKey: "FCSshipment.update",
|
||||||
|
callBack: _update,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: LocalAppBar(
|
appBar: LocalAppBar(
|
||||||
labelKey: "FCSshipment.form.title",
|
labelKey: _isNew ? "FCSshipment.add" : "FCSshipment.form.title",
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
labelColor: primaryColor,
|
labelColor: primaryColor,
|
||||||
arrowColor: primaryColor,
|
arrowColor: primaryColor,
|
||||||
@@ -106,75 +111,63 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
|||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
body: Padding(
|
body: ListView(
|
||||||
padding: const EdgeInsets.all(10.0),
|
padding: const EdgeInsets.only(left: 10, right: 10),
|
||||||
child: ListView(children: <Widget>[
|
children: <Widget>[
|
||||||
InputText(
|
InputText(
|
||||||
labelTextKey: "FCSshipment.number",
|
labelTextKey: "FCSshipment.number",
|
||||||
iconData: Ionicons.ios_airplane,
|
iconData: Ionicons.ios_airplane,
|
||||||
controller: _shipmentNumberController,
|
controller: _shipmentNumberController,
|
||||||
),
|
),
|
||||||
InputDate(
|
InputDate(
|
||||||
labelTextKey: "FCSshipment.cutoff_date",
|
labelTextKey: "FCSshipment.cutoff_date",
|
||||||
iconData: Icons.date_range,
|
iconData: Icons.date_range,
|
||||||
controller: _cutoffDateController,
|
controller: _cutoffDateController,
|
||||||
),
|
),
|
||||||
// InputDate(
|
InputDate(
|
||||||
// labelTextKey: "FCSshipment.departure_date",
|
labelTextKey: "FCSshipment.ETA",
|
||||||
// iconData: Icons.date_range,
|
iconData: Icons.date_range,
|
||||||
// controller: _departureDateControler,
|
controller: _arrivalDateController,
|
||||||
// ),
|
),
|
||||||
InputDate(
|
DropdownButtonFormField(
|
||||||
labelTextKey: "FCSshipment.ETA",
|
value: _currentShipmentType == "" ? null : _currentShipmentType,
|
||||||
iconData: Icons.date_range,
|
decoration: InputDecoration(
|
||||||
controller: _arrivalDateController,
|
enabledBorder: UnderlineInputBorder(
|
||||||
),
|
borderSide: BorderSide(color: primaryColor)),
|
||||||
DropdownButtonFormField(
|
focusedBorder: UnderlineInputBorder(
|
||||||
value: _currentShipmentType == "" ? null : _currentShipmentType,
|
borderSide: BorderSide(color: primaryColor)),
|
||||||
decoration: InputDecoration(
|
fillColor: Colors.white,
|
||||||
enabledBorder: UnderlineInputBorder(
|
labelStyle: languageModel.isEng
|
||||||
borderSide: BorderSide(color: primaryColor)),
|
? newLabelStyle(color: Colors.black54, fontSize: 20)
|
||||||
fillColor: Colors.white,
|
: newLabelStyleMM(color: Colors.black54, fontSize: 20),
|
||||||
labelStyle: languageModel.isEng
|
labelText: AppTranslations.of(context)!
|
||||||
? newLabelStyle(color: Colors.black54, fontSize: 20)
|
.text('FCSshipment.shipment_type'),
|
||||||
: newLabelStyleMM(color: Colors.black54, fontSize: 20),
|
icon: Icon(Ionicons.ios_airplane, color: primaryColor)),
|
||||||
labelText: AppTranslations.of(context)!
|
items: mainModel.setting!.shipmentTypes
|
||||||
.text('FCSshipment.shipment_type'),
|
.map((e) => DropdownMenuItem(child: Text(e), value: e))
|
||||||
icon: Icon(Ionicons.ios_airplane, color: primaryColor)),
|
.toList(),
|
||||||
items: mainModel.setting!.shipmentTypes
|
onChanged: (String? selected) => {
|
||||||
.map((e) => DropdownMenuItem(child: Text(e), value: e))
|
setState(() {
|
||||||
.toList(),
|
_currentShipmentType = selected;
|
||||||
onChanged: (String? selected) => {
|
})
|
||||||
setState(() {
|
},
|
||||||
_currentShipmentType = selected;
|
),
|
||||||
})
|
InputText(
|
||||||
},
|
labelTextKey: 'FCSshipment.consignee',
|
||||||
),
|
iconData: Icons.work,
|
||||||
InputText(
|
controller: _consigneeController),
|
||||||
labelTextKey: 'FCSshipment.consignee',
|
InputText(
|
||||||
iconData: Icons.work,
|
labelTextKey: 'FCSshipment.port_of_loading',
|
||||||
controller: _consigneeController),
|
iconData: FontAwesomeIcons.ship,
|
||||||
InputText(
|
controller: _portController),
|
||||||
labelTextKey: 'FCSshipment.port_of_loading',
|
InputText(
|
||||||
iconData: FontAwesomeIcons.ship,
|
labelTextKey: 'FCSshipment.final_destination',
|
||||||
controller: _portController),
|
iconData: MaterialCommunityIcons.location_enter,
|
||||||
InputText(
|
controller: _destinationController),
|
||||||
labelTextKey: 'FCSshipment.final_destination',
|
SizedBox(height: 20),
|
||||||
iconData: MaterialCommunityIcons.location_enter,
|
_isNew ? createBtn : updateBtn,
|
||||||
controller: _destinationController),
|
SizedBox(height: 15)
|
||||||
_isNew
|
]),
|
||||||
? Container()
|
|
||||||
: Container(
|
|
||||||
padding: EdgeInsets.only(top: 5),
|
|
||||||
child: DisplayText(
|
|
||||||
text: _statusController.text,
|
|
||||||
iconData: Icons.av_timer,
|
|
||||||
labelTextKey: 'FCSshipment.status',
|
|
||||||
)),
|
|
||||||
_isNew ? createBtn : updateBtn,
|
|
||||||
SizedBox(height: 15)
|
|
||||||
]),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -190,13 +183,10 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
|||||||
try {
|
try {
|
||||||
var cutoffDate = _cutoffDateController.text;
|
var cutoffDate = _cutoffDateController.text;
|
||||||
var arrivalDate = _arrivalDateController.text;
|
var arrivalDate = _arrivalDateController.text;
|
||||||
// var depDate = _departureDateControler.text;
|
|
||||||
fcsShipment.cutoffDate =
|
fcsShipment.cutoffDate =
|
||||||
(cutoffDate == "" ? null : dateFormatter.parse(cutoffDate))!;
|
(cutoffDate == "" ? null : dateFormatter.parse(cutoffDate))!;
|
||||||
fcsShipment.arrivalDate =
|
fcsShipment.arrivalDate =
|
||||||
(arrivalDate == "" ? null : dateFormatter.parse(arrivalDate))!;
|
(arrivalDate == "" ? null : dateFormatter.parse(arrivalDate))!;
|
||||||
// fcsShipment.departureDate =
|
|
||||||
// depDate == "" ? null : dateFormatter.parse(depDate);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// showMsgDialog(context, "Error", e.toString()); // shold never happen
|
// showMsgDialog(context, "Error", e.toString()); // shold never happen
|
||||||
}
|
}
|
||||||
@@ -220,10 +210,6 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
|||||||
await showMsgDialog(context, "Error", "Invalid ETA date!");
|
await showMsgDialog(context, "Error", "Invalid ETA date!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// if (fcsShipment.departureDate == null) {
|
|
||||||
// await showMsgDialog(context, "Error", "Invalid departure date!");
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,10 @@ class _FcsShipmentListState extends State<FcsShipmentList> {
|
|||||||
|
|
||||||
final popupMenu = LocalPopupMenuButton(
|
final popupMenu = LocalPopupMenuButton(
|
||||||
popmenus: [
|
popmenus: [
|
||||||
|
LocalPopupMenu(
|
||||||
|
id: 0,
|
||||||
|
textKey: "FCSshipment.popupmenu.all",
|
||||||
|
selected: shipmentModel.selectedIndex == 0),
|
||||||
LocalPopupMenu(
|
LocalPopupMenu(
|
||||||
id: 1,
|
id: 1,
|
||||||
textKey: "FCSshipment.popupmenu.active",
|
textKey: "FCSshipment.popupmenu.active",
|
||||||
|
|||||||
@@ -37,26 +37,26 @@ class FcsShipmentListRow extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
new Expanded(
|
new Expanded(
|
||||||
child: new Column(
|
child: Padding(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
padding: const EdgeInsets.only(left: 8.0),
|
||||||
children: <Widget>[
|
child: new Column(
|
||||||
Padding(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
padding: const EdgeInsets.only(left: 8.0),
|
children: <Widget>[
|
||||||
child: new Text(
|
new Text(
|
||||||
shipment?.shipmentNumber ?? '',
|
shipment?.shipmentNumber ?? '',
|
||||||
style: new TextStyle(
|
style: new TextStyle(
|
||||||
fontSize: 15.0, color: Colors.black),
|
fontSize: 15.0, color: Colors.black),
|
||||||
),
|
),
|
||||||
),
|
Padding(
|
||||||
Padding(
|
padding: const EdgeInsets.only(top: 5),
|
||||||
padding: const EdgeInsets.only(left: 10.0, top: 10),
|
child: new Text(
|
||||||
child: new Text(
|
dateFormatter.format(shipment!.cutoffDate!),
|
||||||
dateFormatter.format(shipment!.cutoffDate!),
|
style: new TextStyle(
|
||||||
style: new TextStyle(
|
fontSize: 15.0, color: Colors.grey),
|
||||||
fontSize: 15.0, color: Colors.grey),
|
),
|
||||||
),
|
)
|
||||||
)
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class FcsShipmentModel extends BaseModel {
|
|||||||
final log = Logger('FcsShipmentModel');
|
final log = Logger('FcsShipmentModel');
|
||||||
PaginatorListener<FcsShipment>? fcsShipments;
|
PaginatorListener<FcsShipment>? fcsShipments;
|
||||||
bool isLoading = false;
|
bool isLoading = false;
|
||||||
int selectedIndex = 1;
|
int selectedIndex = 0;
|
||||||
|
|
||||||
onChanged(int index) {
|
onChanged(int index) {
|
||||||
selectedIndex = index;
|
selectedIndex = index;
|
||||||
|
|||||||
@@ -53,8 +53,23 @@ class InputDate extends StatelessWidget {
|
|||||||
firstDate: DateTime(0),
|
firstDate: DateTime(0),
|
||||||
lastDate: DateTime(2025),
|
lastDate: DateTime(2025),
|
||||||
initialDate: initialDate,
|
initialDate: initialDate,
|
||||||
|
builder: (context, child) {
|
||||||
|
return Theme(
|
||||||
|
data: Theme.of(context).copyWith(
|
||||||
|
colorScheme: ColorScheme.light(
|
||||||
|
background: primaryColor,
|
||||||
|
surfaceTint: Colors.white,
|
||||||
|
primary: primaryColor),
|
||||||
|
textButtonTheme: TextButtonThemeData(
|
||||||
|
style:
|
||||||
|
TextButton.styleFrom(foregroundColor: primaryColor),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: child!,
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
if (d != null && controller.text != "") {
|
if (d != null) {
|
||||||
controller.text = dateFormatter.format(d);
|
controller.text = dateFormatter.format(d);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -20,42 +20,31 @@ class LocalButton extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return ElevatedButton(
|
||||||
padding: EdgeInsets.only(left: 10, right: 10, top: 10),
|
style: ElevatedButton.styleFrom(
|
||||||
child: Container(
|
backgroundColor: color,
|
||||||
height: 45.0,
|
shape:
|
||||||
decoration: BoxDecoration(
|
RoundedRectangleBorder(borderRadius: BorderRadius.circular(5))),
|
||||||
color: color,
|
onPressed: callBack,
|
||||||
shape: BoxShape.rectangle,
|
child: Row(
|
||||||
),
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
child: ButtonTheme(
|
children: [
|
||||||
minWidth: 900.0,
|
iconData == null
|
||||||
height: 100.0,
|
? Container()
|
||||||
child: TextButton(
|
: Icon(
|
||||||
onPressed: callBack == null ? null : () => callBack!(),
|
iconData,
|
||||||
child: Row(
|
color: Colors.white,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
),
|
||||||
children: [
|
SizedBox(
|
||||||
iconData == null
|
width: 15,
|
||||||
? Container()
|
|
||||||
: Icon(
|
|
||||||
iconData,
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: 15,
|
|
||||||
),
|
|
||||||
LocalText(
|
|
||||||
context,
|
|
||||||
textKey!,
|
|
||||||
color: Colors.white,
|
|
||||||
fontSize: 16,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
LocalText(
|
||||||
),
|
context,
|
||||||
),
|
textKey!,
|
||||||
);
|
color: Colors.white,
|
||||||
|
fontSize: 16,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user