update shipment list and editor

This commit is contained in:
tzw
2024-01-30 17:24:28 +06:30
parent c9680ca3ca
commit a944357490
8 changed files with 152 additions and 156 deletions

View File

@@ -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 ================================================================":"",

View File

@@ -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 ================================================================":"",

View File

@@ -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(
padding: const EdgeInsets.symmetric(horizontal: 30),
child: LocalButton(
textKey: "FCSshipment.create", textKey: "FCSshipment.create",
callBack: _create, callBack: _create,
),
); );
final updateBtn = LocalButton( final updateBtn = Padding(
padding: const EdgeInsets.symmetric(horizontal: 30),
child: LocalButton(
textKey: "FCSshipment.update", textKey: "FCSshipment.update",
callBack: _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,9 +111,9 @@ 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,
@@ -119,11 +124,6 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
iconData: Icons.date_range, iconData: Icons.date_range,
controller: _cutoffDateController, controller: _cutoffDateController,
), ),
// InputDate(
// labelTextKey: "FCSshipment.departure_date",
// iconData: Icons.date_range,
// controller: _departureDateControler,
// ),
InputDate( InputDate(
labelTextKey: "FCSshipment.ETA", labelTextKey: "FCSshipment.ETA",
iconData: Icons.date_range, iconData: Icons.date_range,
@@ -134,6 +134,8 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
decoration: InputDecoration( decoration: InputDecoration(
enabledBorder: UnderlineInputBorder( enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: primaryColor)), borderSide: BorderSide(color: primaryColor)),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
fillColor: Colors.white, fillColor: Colors.white,
labelStyle: languageModel.isEng labelStyle: languageModel.isEng
? newLabelStyle(color: Colors.black54, fontSize: 20) ? newLabelStyle(color: Colors.black54, fontSize: 20)
@@ -162,20 +164,11 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
labelTextKey: 'FCSshipment.final_destination', labelTextKey: 'FCSshipment.final_destination',
iconData: MaterialCommunityIcons.location_enter, iconData: MaterialCommunityIcons.location_enter,
controller: _destinationController), controller: _destinationController),
_isNew SizedBox(height: 20),
? Container()
: Container(
padding: EdgeInsets.only(top: 5),
child: DisplayText(
text: _statusController.text,
iconData: Icons.av_timer,
labelTextKey: 'FCSshipment.status',
)),
_isNew ? createBtn : updateBtn, _isNew ? createBtn : updateBtn,
SizedBox(height: 15) 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;
} }

View File

@@ -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",

View File

@@ -37,19 +37,18 @@ class FcsShipmentListRow extends StatelessWidget {
), ),
), ),
new Expanded( new Expanded(
child: Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Column( child: new Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Padding( new Text(
padding: const EdgeInsets.only(left: 8.0),
child: 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(left: 10.0, top: 10), padding: const EdgeInsets.only(top: 5),
child: new Text( child: new Text(
dateFormatter.format(shipment!.cutoffDate!), dateFormatter.format(shipment!.cutoffDate!),
style: new TextStyle( style: new TextStyle(
@@ -59,6 +58,7 @@ class FcsShipmentListRow extends StatelessWidget {
], ],
), ),
), ),
),
], ],
), ),
), ),

View File

@@ -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;

View File

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

View File

@@ -20,19 +20,12 @@ 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: ButtonTheme(
minWidth: 900.0,
height: 100.0,
child: TextButton(
onPressed: callBack == null ? null : () => callBack!(),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
@@ -52,10 +45,6 @@ class LocalButton extends StatelessWidget {
fontSize: 16, fontSize: 16,
), ),
], ],
), ));
),
),
),
);
} }
} }