update carton info

This commit is contained in:
tzw
2024-02-09 12:21:49 +06:30
parent aa5b7881d6
commit 62c0da8a96

View File

@@ -60,8 +60,8 @@ class _CartonInfoState extends State<CartonInfo> {
bool isFromPackages = false; bool isFromPackages = false;
bool isSmallBag = false; bool isSmallBag = false;
bool isFromCartons = false; bool isFromCartons = false;
bool isEdiable = false;
bool isCutomDuty=false; bool isCutomDuty = false;
final List<CargoType> cargoTypes = []; final List<CargoType> cargoTypes = [];
final List<CargoType> surchareItems = []; final List<CargoType> surchareItems = [];
final List<Carton> cartons = []; final List<Carton> cartons = [];
@@ -72,9 +72,6 @@ class _CartonInfoState extends State<CartonInfo> {
_box = widget.box; _box = widget.box;
_box?.billToValue = "Bill to sender"; _box?.billToValue = "Bill to sender";
//initPackage(widget.package!); //initPackage(widget.package!);
//for shipment weight //for shipment weight
volumetricRatio = Provider.of<ShipmentRateModel>(context, listen: false) volumetricRatio = Provider.of<ShipmentRateModel>(context, listen: false)
@@ -100,8 +97,6 @@ class _CartonInfoState extends State<CartonInfo> {
isSmallBag = _box!.cartonType == carton_small_bag; isSmallBag = _box!.cartonType == carton_small_bag;
isFromCartons = _box!.cartonType == carton_from_cartons; isFromCartons = _box!.cartonType == carton_from_cartons;
isEdiable = (isFromPackages || isMixBox || isFromCartons) &&
_box!.status == carton_packed_status;
selectMixBoxType = _box!.mixBoxType; selectMixBoxType = _box!.mixBoxType;
getCartonSize(); getCartonSize();
} }
@@ -337,69 +332,6 @@ class _CartonInfoState extends State<CartonInfo> {
controller: multiImgController, controller: multiImgController,
title: "Receipt File", title: "Receipt File",
); );
final consigneeBox=Container(
child: Padding(
padding: const EdgeInsets.only(left: 0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
consigneeNameBox,
],
),
),
_cartonSubmit?.billToValue == billToSender
? Expanded(
child: Padding(
padding: EdgeInsets.only(left: 0, top: 15),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Icon(Ionicons.document_text_outline,
color: primaryColor, size: 20),
Text("Bill to",
style: TextStyle(
color: primaryColor, fontSize: 15))
],
)))
: const SizedBox()
],
),
));
final customerBox= Container(
child: Row(
//crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
customerNameBox,
],
),
),
_box?.billToValue == billToSender
? Expanded(
child: Padding(
padding: EdgeInsets.only(left: 0, top: 15),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Icon(Ionicons.document_text_outline,
color: primaryColor, size: 20),
Text("Bill to",
style: TextStyle(
color: primaryColor, fontSize: 15))
],
)))
: const SizedBox()
],
),
);
final billWidget = Expanded( final billWidget = Expanded(
child: Padding( child: Padding(
@@ -422,19 +354,11 @@ class _CartonInfoState extends State<CartonInfo> {
backgroundColor: Colors.white, backgroundColor: Colors.white,
labelColor: primaryColor, labelColor: primaryColor,
arrowColor: primaryColor, arrowColor: primaryColor,
actions: isEdiable actions: <Widget>[
? <Widget>[
IconButton( IconButton(
icon: Icon(Icons.edit, color: primaryColor), icon: Icon(Icons.edit, color: primaryColor),
onPressed: _gotoEditor, onPressed: _gotoEditor),
), ]),
IconButton(
icon: Icon(Icons.delete, color: primaryColor),
onPressed: _delete,
),
]
: [],
),
body: Container( body: Container(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(10.0),
child: ListView(children: <Widget>[ child: ListView(children: <Widget>[
@@ -459,10 +383,8 @@ class _CartonInfoState extends State<CartonInfo> {
// ? // ?
// displayMixBox:Container(), // displayMixBox:Container(),
isMixBox? isMixBox
? Row(
Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
@@ -471,7 +393,8 @@ class _CartonInfoState extends State<CartonInfo> {
children: [ children: [
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
customerNameBox, customerNameBox,
], ],
@@ -479,7 +402,9 @@ class _CartonInfoState extends State<CartonInfo> {
), ),
_box?.billToValue == billToSender _box?.billToValue == billToSender
? billWidget ? billWidget
: const SizedBox( height: 300.0,) : const SizedBox(
height: 300.0,
)
], ],
), ),
), ),
@@ -491,7 +416,8 @@ class _CartonInfoState extends State<CartonInfo> {
children: [ children: [
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
consigneeNameBox, consigneeNameBox,
], ],
@@ -511,14 +437,17 @@ class _CartonInfoState extends State<CartonInfo> {
// children: getPackageList(_box!.packages), // children: getPackageList(_box!.packages),
// ), // ),
// ]) // ])
:Container(), : Container(),
isMixBox ? isMixBox
Column(children: [ ? Column(
children: [
packageBox, packageBox,
Row( Row(
children: getPackageList(_box!.packages), children: getPackageList(_box!.packages),
), ),
],):Column( ],
)
: Column(
children: [ children: [
cartonBox, cartonBox,
Row( Row(
@@ -526,10 +455,7 @@ class _CartonInfoState extends State<CartonInfo> {
), ),
], ],
), ),
isCutomDuty isCutomDuty ? surchargeItemBox : cargosBox,
?
surchargeItemBox:
cargosBox,
Padding( Padding(
padding: EdgeInsets.only(left: 200.0, right: 8.0), padding: EdgeInsets.only(left: 200.0, right: 8.0),
@@ -571,20 +497,19 @@ class _CartonInfoState extends State<CartonInfo> {
} }
_gotoEditor() async { _gotoEditor() async {
_box!.mixCartons = _box!.mixCartons;
bool? updated = await Navigator.push<bool>( bool? updated = await Navigator.push<bool>(
context, context,
CupertinoPageRoute(builder: (context) => CartonEditor(carton: _box)), CupertinoPageRoute(builder: (context) => CartonEditor(carton: _box)),
); );
if (updated ?? false) { if (updated ?? false) {
var cartonModel = Provider.of<CartonModel>(context, listen: false); // var cartonModel = Provider.of<CartonModel>(context, listen: false);
var c = await cartonModel.getCarton(widget.box.id ?? ""); // var c = await cartonModel.getCarton(widget.box.id ?? "");
setState(() { // setState(() {
_box = c; // _box = c;
_loadPackages(); // _loadPackages();
_loadMixCartons(); // _loadMixCartons();
_updateBoxData(); // _updateBoxData();
}); // });
} }
} }
@@ -622,6 +547,7 @@ class _CartonInfoState extends State<CartonInfo> {
)); ));
}).toList(); }).toList();
} }
List<Widget> getCartonList(List<Carton> _c) { List<Widget> getCartonList(List<Carton> _c) {
return _c.map((c) { return _c.map((c) {
return Container( return Container(