2020-10-20 06:19:10 +06:30
|
|
|
import 'package:fcs/domain/constants.dart';
|
2024-02-05 17:28:53 +06:30
|
|
|
import 'package:fcs/domain/entities/cargo_type.dart';
|
2020-10-20 06:19:10 +06:30
|
|
|
import 'package:fcs/domain/entities/carton.dart';
|
2020-10-14 16:53:16 +06:30
|
|
|
import 'package:fcs/domain/entities/package.dart';
|
|
|
|
|
import 'package:fcs/helpers/theme.dart';
|
2024-02-07 17:25:29 +06:30
|
|
|
import 'package:fcs/pages/carton/carton_image_upload.dart';
|
2024-02-08 17:01:32 +06:30
|
|
|
import 'package:fcs/pages/carton/carton_submit.dart';
|
2021-01-07 18:15:39 +06:30
|
|
|
import 'package:fcs/pages/carton_size/model/carton_size_model.dart';
|
2020-10-14 16:53:16 +06:30
|
|
|
import 'package:fcs/pages/main/util.dart';
|
|
|
|
|
import 'package:fcs/pages/package/model/package_model.dart';
|
2020-10-15 03:06:13 +06:30
|
|
|
import 'package:fcs/pages/rates/model/shipment_rate_model.dart';
|
2020-10-14 16:53:16 +06:30
|
|
|
import 'package:fcs/pages/widgets/display_text.dart';
|
2024-01-25 17:40:35 +06:30
|
|
|
import 'package:fcs/pages/widgets/local_app_bar.dart';
|
2020-10-14 16:53:16 +06:30
|
|
|
import 'package:fcs/pages/widgets/local_text.dart';
|
2024-02-05 17:28:53 +06:30
|
|
|
import 'package:fcs/pages/widgets/multi_img_controller.dart';
|
|
|
|
|
import 'package:fcs/pages/widgets/multi_img_file.dart';
|
2020-10-14 16:53:16 +06:30
|
|
|
import 'package:fcs/pages/widgets/progress.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
2021-09-10 12:00:08 +06:30
|
|
|
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
2020-10-14 16:53:16 +06:30
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
2020-10-19 05:13:49 +06:30
|
|
|
import 'carton_editor.dart';
|
2020-10-18 02:38:46 +06:30
|
|
|
import 'model/carton_model.dart';
|
2020-10-14 16:53:16 +06:30
|
|
|
|
|
|
|
|
final DateFormat dateFormat = DateFormat("d MMM yyyy");
|
2024-02-07 17:25:29 +06:30
|
|
|
final NumberFormat numberFormatter = NumberFormat("#,###");
|
2020-10-14 16:53:16 +06:30
|
|
|
|
2020-10-19 05:13:49 +06:30
|
|
|
class CartonInfo extends StatefulWidget {
|
2024-02-05 17:28:53 +06:30
|
|
|
final Package? package;
|
2024-02-08 17:01:32 +06:30
|
|
|
final Carton box;
|
2024-02-08 17:09:01 +06:30
|
|
|
final String? billToValue;
|
|
|
|
|
final CartonSubmit? cartonSubmit;
|
2024-02-08 17:01:32 +06:30
|
|
|
|
2024-02-08 17:09:01 +06:30
|
|
|
CartonInfo(
|
|
|
|
|
{required this.box, this.billToValue, this.package, this.cartonSubmit});
|
2020-10-14 16:53:16 +06:30
|
|
|
|
|
|
|
|
@override
|
2020-10-19 05:13:49 +06:30
|
|
|
_CartonInfoState createState() => _CartonInfoState();
|
2020-10-14 16:53:16 +06:30
|
|
|
}
|
|
|
|
|
|
2020-10-19 05:13:49 +06:30
|
|
|
class _CartonInfoState extends State<CartonInfo> {
|
2020-10-14 16:53:16 +06:30
|
|
|
bool _isLoading = false;
|
2021-09-10 12:00:08 +06:30
|
|
|
Carton? _box;
|
2024-02-05 17:28:53 +06:30
|
|
|
|
2024-02-08 17:09:01 +06:30
|
|
|
CartonSubmit? _cartonSubmit;
|
2024-02-05 17:28:53 +06:30
|
|
|
|
|
|
|
|
MultiImgController multiImgController = MultiImgController();
|
2020-10-14 16:53:16 +06:30
|
|
|
TextEditingController _widthController = new TextEditingController();
|
|
|
|
|
TextEditingController _heightController = new TextEditingController();
|
|
|
|
|
TextEditingController _lengthController = new TextEditingController();
|
2020-12-11 17:34:56 +06:30
|
|
|
TextEditingController _cartonSizeController = new TextEditingController();
|
2020-10-14 16:53:16 +06:30
|
|
|
double volumetricRatio = 0;
|
|
|
|
|
double shipmentWeight = 0;
|
2021-09-10 12:00:08 +06:30
|
|
|
String? selectMixBoxType;
|
2020-10-14 16:53:16 +06:30
|
|
|
|
2021-09-10 12:00:08 +06:30
|
|
|
bool isMixBox = false;
|
|
|
|
|
bool isFromShipments = false;
|
|
|
|
|
bool isFromPackages = false;
|
|
|
|
|
bool isSmallBag = false;
|
|
|
|
|
bool isFromCartons = false;
|
2024-02-08 17:01:32 +06:30
|
|
|
bool isEdiable = false;
|
2024-02-09 12:16:18 +06:30
|
|
|
bool isCutomDuty=false;
|
2024-02-08 17:01:32 +06:30
|
|
|
final List<CargoType> cargoTypes = [];
|
|
|
|
|
final List<CargoType> surchareItems = [];
|
2024-02-09 12:16:18 +06:30
|
|
|
final List<Carton> cartons = [];
|
2024-02-08 17:09:01 +06:30
|
|
|
|
2020-10-14 16:53:16 +06:30
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
_box = widget.box;
|
2024-02-08 17:09:01 +06:30
|
|
|
_box?.billToValue = "Bill to sender";
|
2024-02-09 12:16:18 +06:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-08 17:09:01 +06:30
|
|
|
|
2024-02-06 17:42:12 +06:30
|
|
|
//initPackage(widget.package!);
|
2020-10-14 16:53:16 +06:30
|
|
|
//for shipment weight
|
2020-10-15 03:06:13 +06:30
|
|
|
volumetricRatio = Provider.of<ShipmentRateModel>(context, listen: false)
|
|
|
|
|
.rate
|
|
|
|
|
.volumetricRatio;
|
2020-10-14 16:53:16 +06:30
|
|
|
_lengthController.addListener(_calShipmentWeight);
|
|
|
|
|
_widthController.addListener(_calShipmentWeight);
|
|
|
|
|
_heightController.addListener(_calShipmentWeight);
|
2024-02-08 17:01:32 +06:30
|
|
|
multiImgController.setImageUrls = _box!.photos;
|
|
|
|
|
// _updateBoxData();
|
2020-10-21 02:59:10 +06:30
|
|
|
_loadPackages();
|
2021-01-10 15:56:27 +06:30
|
|
|
_loadMixCartons();
|
2020-10-21 02:59:10 +06:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_updateBoxData() {
|
2021-09-10 12:00:08 +06:30
|
|
|
_widthController.text = _box!.width.toString();
|
|
|
|
|
_heightController.text = _box!.height.toString();
|
|
|
|
|
_lengthController.text = _box!.length.toString();
|
2021-09-10 16:33:52 +06:30
|
|
|
_cartonSizeController.text = _box!.cartonSizeName ?? "";
|
2021-09-10 12:00:08 +06:30
|
|
|
isMixBox = _box!.cartonType == carton_mix_box;
|
|
|
|
|
isFromShipments = _box!.cartonType == carton_from_shipments;
|
|
|
|
|
isFromPackages = _box!.cartonType == carton_from_packages;
|
|
|
|
|
isSmallBag = _box!.cartonType == carton_small_bag;
|
|
|
|
|
isFromCartons = _box!.cartonType == carton_from_cartons;
|
2021-01-09 19:11:47 +06:30
|
|
|
|
|
|
|
|
isEdiable = (isFromPackages || isMixBox || isFromCartons) &&
|
2021-09-10 12:00:08 +06:30
|
|
|
_box!.status == carton_packed_status;
|
|
|
|
|
selectMixBoxType = _box!.mixBoxType;
|
2021-01-07 18:15:39 +06:30
|
|
|
getCartonSize();
|
2020-10-20 06:19:10 +06:30
|
|
|
}
|
|
|
|
|
|
2021-01-07 18:15:39 +06:30
|
|
|
getCartonSize() {
|
|
|
|
|
var cartonSizeModel = Provider.of<CartonSizeModel>(context, listen: false);
|
|
|
|
|
cartonSizeModel.cartonSizes.forEach((c) {
|
2021-09-10 12:00:08 +06:30
|
|
|
if (c.length == _box!.length &&
|
|
|
|
|
c.width == _box!.width &&
|
|
|
|
|
c.height == _box!.height) {
|
2021-01-07 18:15:39 +06:30
|
|
|
setState(() {
|
2021-09-10 16:33:52 +06:30
|
|
|
_cartonSizeController.text = c.name ?? "";
|
2021-01-07 18:15:39 +06:30
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-20 06:19:10 +06:30
|
|
|
_loadPackages() async {
|
2020-10-21 02:59:10 +06:30
|
|
|
if (!isFromPackages && !isSmallBag) return;
|
|
|
|
|
|
2024-02-08 17:01:32 +06:30
|
|
|
// if (_box!.cartonType == carton_from_packages && _box!.userID == null)
|
|
|
|
|
// return;
|
2020-10-20 06:19:10 +06:30
|
|
|
PackageModel packageModel =
|
|
|
|
|
Provider.of<PackageModel>(context, listen: false);
|
2021-09-10 16:33:52 +06:30
|
|
|
List<Package> packages =
|
|
|
|
|
await packageModel.getPackages(_box!.userID ?? "", [
|
2020-10-21 02:59:10 +06:30
|
|
|
package_processed_status,
|
|
|
|
|
package_packed_status,
|
2020-10-23 01:27:23 +06:30
|
|
|
package_shipped_status,
|
|
|
|
|
package_delivered_status
|
2020-10-21 02:59:10 +06:30
|
|
|
]);
|
2021-09-10 12:00:08 +06:30
|
|
|
packages = packages.where((p) => _box!.packageIDs.contains(p.id)).toList();
|
2020-10-20 06:19:10 +06:30
|
|
|
packages.forEach((p) {
|
2020-10-21 02:59:10 +06:30
|
|
|
p.isChecked = true;
|
2020-10-20 06:19:10 +06:30
|
|
|
});
|
|
|
|
|
|
|
|
|
|
setState(() {
|
2021-09-10 12:00:08 +06:30
|
|
|
_box!.packages = packages;
|
2020-10-20 06:19:10 +06:30
|
|
|
});
|
2020-10-14 16:53:16 +06:30
|
|
|
}
|
|
|
|
|
|
2021-01-10 15:56:27 +06:30
|
|
|
_loadMixCartons() async {
|
2021-09-10 12:00:08 +06:30
|
|
|
if (_box!.cartonType != carton_mix_box) return;
|
2021-01-10 15:56:27 +06:30
|
|
|
CartonModel cartonModel = Provider.of<CartonModel>(context, listen: false);
|
|
|
|
|
List<Carton> catons = [];
|
2021-09-10 12:00:08 +06:30
|
|
|
for (var id in _box!.mixCartonIDs) {
|
2021-01-10 15:56:27 +06:30
|
|
|
Carton c = await cartonModel.getCarton(id);
|
|
|
|
|
catons.add(c);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setState(() {
|
2021-09-10 12:00:08 +06:30
|
|
|
_box!.mixCartons = catons;
|
2021-01-10 15:56:27 +06:30
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-14 16:53:16 +06:30
|
|
|
_calShipmentWeight() {
|
2021-09-13 09:51:55 +06:30
|
|
|
double l = double.tryParse(_lengthController.text) ?? 0;
|
|
|
|
|
double w = double.tryParse(_widthController.text) ?? 0;
|
|
|
|
|
double h = double.tryParse(_heightController.text) ?? 0;
|
2020-10-14 16:53:16 +06:30
|
|
|
setState(() {
|
|
|
|
|
shipmentWeight = l * w * h / volumetricRatio;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void dispose() {
|
|
|
|
|
super.dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final DateFormat dateFormat = DateFormat("d MMM yyyy");
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
2024-02-08 17:01:32 +06:30
|
|
|
double totalWeight =
|
|
|
|
|
_box!.cargoTypes.fold(0, (sum, value) => sum + value.weight);
|
|
|
|
|
double totalPieces = surchareItems.fold(0, (sum, value) => sum + value.qty);
|
|
|
|
|
|
2024-02-02 17:51:46 +06:30
|
|
|
final cartonTypeBox = DisplayText(
|
|
|
|
|
text: _box!.cartonNumber,
|
|
|
|
|
labelTextKey: "box.number",
|
|
|
|
|
);
|
|
|
|
|
final cartonQrBox = DisplayText(
|
|
|
|
|
iconData: AntDesign.qrcode,
|
|
|
|
|
);
|
2020-10-14 16:53:16 +06:30
|
|
|
final shipmentBox = DisplayText(
|
2021-09-10 12:00:08 +06:30
|
|
|
text: _box!.fcsShipmentNumber,
|
2020-10-14 16:53:16 +06:30
|
|
|
labelTextKey: "box.fcs_shipment_num",
|
2024-02-02 17:51:46 +06:30
|
|
|
);
|
|
|
|
|
final deliveryBox = DisplayText(
|
|
|
|
|
text: "Delivery Carton",
|
|
|
|
|
labelTextKey: "box.delivery_type",
|
2020-10-14 16:53:16 +06:30
|
|
|
);
|
2024-02-02 17:51:46 +06:30
|
|
|
|
2020-10-14 16:53:16 +06:30
|
|
|
final customerNameBox = DisplayText(
|
2021-09-10 12:00:08 +06:30
|
|
|
text: _box!.userName == null ? "" : _box!.userName,
|
2024-02-05 11:13:12 +06:30
|
|
|
subText: Text(_box!.fcsID ?? "", style: textStyle),
|
2020-10-14 16:53:16 +06:30
|
|
|
labelTextKey: "box.name",
|
|
|
|
|
);
|
|
|
|
|
|
2021-01-09 19:11:47 +06:30
|
|
|
final consigneeNameBox = DisplayText(
|
2024-02-05 17:28:53 +06:30
|
|
|
text: _box!.senderName != null ? _box!.senderName : "",
|
|
|
|
|
subText: Text(_box!.senderFCSID ?? "", style: textStyle),
|
2021-01-09 19:11:47 +06:30
|
|
|
labelTextKey: "processing.consignee.name",
|
2020-10-14 16:53:16 +06:30
|
|
|
);
|
|
|
|
|
|
2024-02-05 11:13:12 +06:30
|
|
|
final packageBox = DisplayText(
|
2024-02-02 17:51:46 +06:30
|
|
|
labelTextKey: "box.package",
|
2024-02-05 17:28:53 +06:30
|
|
|
);
|
2024-02-09 12:16:18 +06:30
|
|
|
final cartonBox = DisplayText(
|
|
|
|
|
labelTextKey: "box.shipment.boxes",
|
|
|
|
|
);
|
2024-02-08 17:01:32 +06:30
|
|
|
final cargosBox = Padding(
|
2024-02-07 17:25:29 +06:30
|
|
|
padding: const EdgeInsets.only(top: 10),
|
|
|
|
|
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
|
|
|
|
Row(
|
2024-02-08 17:01:32 +06:30
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
LocalText(context, 'box.cargo.type',
|
|
|
|
|
color: Colors.black54,
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.normal),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(right: 100),
|
|
|
|
|
child: Text("${removeTrailingZeros(totalWeight)} lb",
|
|
|
|
|
style: TextStyle(color: Colors.black54, fontSize: 15)))
|
|
|
|
|
],
|
|
|
|
|
),
|
2024-02-07 17:25:29 +06:30
|
|
|
//),
|
|
|
|
|
Container(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.only(right: 100),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: _box!.cargoTypes.map((e) {
|
|
|
|
|
return Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 3),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
e.name ?? "",
|
|
|
|
|
style:
|
|
|
|
|
TextStyle(color: Colors.black, fontSize: 15),
|
|
|
|
|
),
|
|
|
|
|
Text("${removeTrailingZeros(e.weight)} lb",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.black, fontSize: 15))
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}).toList()),
|
|
|
|
|
const SizedBox(height: 10),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
);
|
|
|
|
|
final surchargeItemBox = Padding(
|
|
|
|
|
padding: const EdgeInsets.only(top: 10),
|
|
|
|
|
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
|
|
|
|
Row(
|
2024-02-08 17:01:32 +06:30
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
LocalText(context, 'box.surcharge.item',
|
|
|
|
|
color: Colors.black54,
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.normal),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(right: 100),
|
|
|
|
|
child: Text("${removeTrailingZeros(totalPieces)} pcs",
|
|
|
|
|
style: TextStyle(color: Colors.black54, fontSize: 15)))
|
|
|
|
|
],
|
|
|
|
|
),
|
2024-02-07 17:25:29 +06:30
|
|
|
//),
|
|
|
|
|
Container(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.only(right: 100),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: surchareItems.map((e) {
|
|
|
|
|
return Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 3),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
e.name ?? "",
|
|
|
|
|
style:
|
|
|
|
|
TextStyle(color: Colors.black, fontSize: 15),
|
|
|
|
|
),
|
2024-02-08 17:01:32 +06:30
|
|
|
Text(
|
|
|
|
|
"${removeTrailingZeros((e.qty).toDouble())} pc",
|
2024-02-07 17:25:29 +06:30
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.black, fontSize: 15))
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}).toList()),
|
|
|
|
|
const SizedBox(height: 10),
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: surchareItems.map((e) {
|
|
|
|
|
return Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 3),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
e.name ?? "",
|
|
|
|
|
style: TextStyle(color: labelColor, fontSize: 15),
|
|
|
|
|
),
|
|
|
|
|
Text("${numberFormatter.format(e.qty)} pc",
|
|
|
|
|
style:
|
|
|
|
|
TextStyle(color: labelColor, fontSize: 15))
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}).toList()),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
);
|
2024-02-08 17:01:32 +06:30
|
|
|
|
|
|
|
|
final img = MultiImageFile(
|
2024-02-05 17:28:53 +06:30
|
|
|
enabled: false,
|
|
|
|
|
controller: multiImgController,
|
|
|
|
|
title: "Receipt File",
|
2024-02-02 17:51:46 +06:30
|
|
|
);
|
2024-02-09 12:16:18 +06:30
|
|
|
final consigneeBox=Container(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 0),
|
2024-02-08 17:09:01 +06:30
|
|
|
child: Row(
|
2024-02-09 12:16:18 +06:30
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
2024-02-08 17:09:01 +06:30
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
2024-02-06 17:42:12 +06:30
|
|
|
children: [
|
2024-02-09 12:16:18 +06:30
|
|
|
consigneeNameBox,
|
2024-02-08 17:09:01 +06:30
|
|
|
],
|
2024-02-07 17:25:29 +06:30
|
|
|
),
|
2024-02-08 17:09:01 +06:30
|
|
|
),
|
2024-02-09 12:16:18 +06:30
|
|
|
_cartonSubmit?.billToValue == billToSender
|
2024-02-08 17:09:01 +06:30
|
|
|
? Expanded(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.only(left: 0, top: 15),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
2024-02-08 17:01:32 +06:30
|
|
|
children: [
|
2024-02-08 17:09:01 +06:30
|
|
|
Icon(Ionicons.document_text_outline,
|
|
|
|
|
color: primaryColor, size: 20),
|
|
|
|
|
Text("Bill to",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: primaryColor, fontSize: 15))
|
2024-02-08 17:01:32 +06:30
|
|
|
],
|
2024-02-08 17:09:01 +06:30
|
|
|
)))
|
|
|
|
|
: const SizedBox()
|
|
|
|
|
],
|
2024-02-07 17:25:29 +06:30
|
|
|
),
|
2024-02-09 12:16:18 +06:30
|
|
|
));
|
|
|
|
|
final customerBox= Container(
|
2024-02-08 17:09:01 +06:30
|
|
|
child: Row(
|
2024-02-09 12:16:18 +06:30
|
|
|
//crossAxisAlignment: CrossAxisAlignment.start,
|
2024-02-08 17:09:01 +06:30
|
|
|
children: [
|
2024-02-07 17:25:29 +06:30
|
|
|
Expanded(
|
2024-02-08 17:09:01 +06:30
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
2024-02-09 12:16:18 +06:30
|
|
|
customerNameBox,
|
2024-02-08 17:09:01 +06:30
|
|
|
],
|
2024-02-07 17:25:29 +06:30
|
|
|
),
|
2024-02-08 17:09:01 +06:30
|
|
|
),
|
2024-02-09 12:16:18 +06:30
|
|
|
_box?.billToValue == billToSender
|
2024-02-08 17:09:01 +06:30
|
|
|
? Expanded(
|
2024-02-08 17:01:32 +06:30
|
|
|
child: Padding(
|
2024-02-08 17:09:01 +06:30
|
|
|
padding: EdgeInsets.only(left: 0, top: 15),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
2024-02-08 17:01:32 +06:30
|
|
|
children: [
|
2024-02-08 17:09:01 +06:30
|
|
|
Icon(Ionicons.document_text_outline,
|
|
|
|
|
color: primaryColor, size: 20),
|
|
|
|
|
Text("Bill to",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: primaryColor, fontSize: 15))
|
2024-02-08 17:01:32 +06:30
|
|
|
],
|
2024-02-08 17:09:01 +06:30
|
|
|
)))
|
|
|
|
|
: const SizedBox()
|
|
|
|
|
],
|
|
|
|
|
),
|
2024-02-09 12:16:18 +06:30
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
2024-02-08 17:01:32 +06:30
|
|
|
final billWidget = 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))
|
|
|
|
|
],
|
|
|
|
|
)));
|
2020-12-11 17:34:56 +06:30
|
|
|
|
2020-10-14 16:53:16 +06:30
|
|
|
return LocalProgress(
|
2024-02-08 17:01:32 +06:30
|
|
|
inAsyncCall: _isLoading,
|
|
|
|
|
child: Scaffold(
|
|
|
|
|
appBar: LocalAppBar(
|
|
|
|
|
labelKey: "box.info.title",
|
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
|
labelColor: primaryColor,
|
|
|
|
|
arrowColor: primaryColor,
|
|
|
|
|
actions: isEdiable
|
|
|
|
|
? <Widget>[
|
|
|
|
|
IconButton(
|
|
|
|
|
icon: Icon(Icons.edit, color: primaryColor),
|
|
|
|
|
onPressed: _gotoEditor,
|
2024-02-06 17:42:12 +06:30
|
|
|
),
|
2024-02-08 17:01:32 +06:30
|
|
|
IconButton(
|
|
|
|
|
icon: Icon(Icons.delete, color: primaryColor),
|
|
|
|
|
onPressed: _delete,
|
2024-02-07 17:25:29 +06:30
|
|
|
),
|
2024-02-08 17:01:32 +06:30
|
|
|
]
|
|
|
|
|
: [],
|
|
|
|
|
),
|
|
|
|
|
body: Container(
|
|
|
|
|
padding: const EdgeInsets.all(10.0),
|
|
|
|
|
child: ListView(children: <Widget>[
|
|
|
|
|
Row(children: [
|
|
|
|
|
Flexible(child: cartonTypeBox),
|
|
|
|
|
Flexible(
|
|
|
|
|
child: cartonQrBox,
|
2024-02-07 17:25:29 +06:30
|
|
|
),
|
2024-02-08 17:01:32 +06:30
|
|
|
]),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Flexible(
|
|
|
|
|
child: shipmentBox,
|
2024-02-07 17:25:29 +06:30
|
|
|
),
|
2024-02-08 17:01:32 +06:30
|
|
|
Flexible(
|
|
|
|
|
child: deliveryBox,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
2024-02-09 12:16:18 +06:30
|
|
|
// isMixBox
|
|
|
|
|
// ?
|
|
|
|
|
// displayMixBox:Container(),
|
|
|
|
|
|
|
|
|
|
isMixBox?
|
|
|
|
|
|
2020-10-14 16:53:16 +06:30
|
|
|
|
2024-02-09 12:16:18 +06:30
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Row(
|
|
|
|
|
//crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
customerNameBox,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
_box?.billToValue == billToSender
|
|
|
|
|
? billWidget
|
|
|
|
|
: const SizedBox( height: 300.0,)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
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
|
|
|
|
|
? billWidget
|
|
|
|
|
: const SizedBox()
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
))
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
// ,
|
|
|
|
|
|
2024-02-08 17:01:32 +06:30
|
|
|
// Row(
|
|
|
|
|
// children: getPackageList(_box!.packages),
|
|
|
|
|
// ),
|
2024-02-09 12:16:18 +06:30
|
|
|
// ])
|
|
|
|
|
:Container(),
|
|
|
|
|
isMixBox ?
|
|
|
|
|
Column(children: [
|
|
|
|
|
packageBox,
|
|
|
|
|
Row(
|
|
|
|
|
children: getPackageList(_box!.packages),
|
|
|
|
|
),
|
|
|
|
|
],):Column(
|
|
|
|
|
children: [
|
|
|
|
|
cartonBox,
|
|
|
|
|
Row(
|
|
|
|
|
children: getCartonList(_box!.mixCartons),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
isCutomDuty
|
|
|
|
|
?
|
|
|
|
|
surchargeItemBox:
|
2024-02-08 17:01:32 +06:30
|
|
|
cargosBox,
|
2024-02-09 12:16:18 +06:30
|
|
|
|
2024-02-08 17:01:32 +06:30
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(left: 200.0, right: 8.0),
|
|
|
|
|
child: ElevatedButton(
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
backgroundColor: Color(0xff272262),
|
|
|
|
|
elevation: 3,
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(5.0)),
|
|
|
|
|
minimumSize: Size(10, 35), //////// HERE
|
|
|
|
|
),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
CupertinoPageRoute(
|
|
|
|
|
builder: (context) =>
|
|
|
|
|
CartonImageUpload(box: _box)),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
child: const Text('Upload Images'),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
img,
|
|
|
|
|
Center(
|
|
|
|
|
child: ElevatedButton(
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
backgroundColor: Color(0xffff0606),
|
|
|
|
|
elevation: 3,
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(5.0)),
|
|
|
|
|
minimumSize: Size(300, 45), //////// HERE
|
|
|
|
|
),
|
|
|
|
|
onPressed: () {},
|
|
|
|
|
child: const Text('Delete Carton',
|
|
|
|
|
style: TextStyle(fontSize: 20)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
]))));
|
2024-02-06 17:42:12 +06:30
|
|
|
}
|
2020-12-11 17:34:56 +06:30
|
|
|
|
2020-10-14 16:53:16 +06:30
|
|
|
_gotoEditor() async {
|
2021-09-10 12:00:08 +06:30
|
|
|
_box!.mixCartons = _box!.mixCartons;
|
|
|
|
|
bool? updated = await Navigator.push<bool>(
|
2020-10-14 16:53:16 +06:30
|
|
|
context,
|
2021-09-13 09:51:55 +06:30
|
|
|
CupertinoPageRoute(builder: (context) => CartonEditor(carton: _box)),
|
2020-10-14 16:53:16 +06:30
|
|
|
);
|
2020-10-20 06:19:10 +06:30
|
|
|
if (updated ?? false) {
|
|
|
|
|
var cartonModel = Provider.of<CartonModel>(context, listen: false);
|
2024-02-08 17:01:32 +06:30
|
|
|
var c = await cartonModel.getCarton(widget.box.id ?? "");
|
2020-10-20 06:19:10 +06:30
|
|
|
setState(() {
|
|
|
|
|
_box = c;
|
2021-01-10 15:56:27 +06:30
|
|
|
_loadPackages();
|
|
|
|
|
_loadMixCartons();
|
2020-10-21 02:59:10 +06:30
|
|
|
_updateBoxData();
|
2020-10-20 06:19:10 +06:30
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_delete() {
|
|
|
|
|
showConfirmDialog(context, "box.delete.confirm", () {
|
|
|
|
|
_deleteCarton();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_deleteCarton() async {
|
|
|
|
|
setState(() {
|
|
|
|
|
_isLoading = true;
|
|
|
|
|
});
|
|
|
|
|
try {
|
|
|
|
|
var cartonModel = Provider.of<CartonModel>(context, listen: false);
|
2024-02-08 17:01:32 +06:30
|
|
|
await cartonModel.deleteCarton(widget.box);
|
2020-10-20 06:19:10 +06:30
|
|
|
Navigator.pop(context, true);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
showMsgDialog(context, "Error", e.toString());
|
|
|
|
|
} finally {
|
|
|
|
|
setState(() {
|
|
|
|
|
_isLoading = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
2020-10-14 16:53:16 +06:30
|
|
|
}
|
2024-02-06 17:42:12 +06:30
|
|
|
|
2024-02-08 17:01:32 +06:30
|
|
|
List<Widget> getPackageList(List<Package> _p) {
|
|
|
|
|
return _p.map((p) {
|
|
|
|
|
return Container(
|
2024-02-06 17:42:12 +06:30
|
|
|
padding: EdgeInsets.only(top: 0),
|
|
|
|
|
child: Container(
|
|
|
|
|
//padding:
|
2024-02-08 17:01:32 +06:30
|
|
|
//EdgeInsets.only(top: 0.0),
|
|
|
|
|
child: Row(children: <Widget>[new Text(p.trackingID ?? '')]),
|
|
|
|
|
));
|
|
|
|
|
}).toList();
|
|
|
|
|
}
|
2024-02-09 12:16:18 +06:30
|
|
|
List<Widget> getCartonList(List<Carton> _c) {
|
|
|
|
|
return _c.map((c) {
|
|
|
|
|
return Container(
|
|
|
|
|
padding: EdgeInsets.only(top: 0),
|
|
|
|
|
child: Container(
|
|
|
|
|
//padding:
|
|
|
|
|
//EdgeInsets.only(top: 0.0),
|
|
|
|
|
child: Row(children: <Widget>[new Text(c.cartonNumber ?? '')]),
|
|
|
|
|
));
|
|
|
|
|
}).toList();
|
|
|
|
|
}
|
2024-02-08 17:01:32 +06:30
|
|
|
|
|
|
|
|
List<Widget> getCargoList(List<CargoType> _c) {
|
|
|
|
|
return _c.map((c) {
|
|
|
|
|
return Container(
|
2024-02-06 17:42:12 +06:30
|
|
|
padding: EdgeInsets.only(top: 0),
|
|
|
|
|
child: Container(
|
|
|
|
|
//padding:
|
2024-02-08 17:01:32 +06:30
|
|
|
//EdgeInsets.only(top: 0.0),
|
|
|
|
|
child: Row(children: <Widget>[new Text(c.name ?? '')]),
|
|
|
|
|
));
|
|
|
|
|
}).toList();
|
|
|
|
|
}
|
2020-10-14 16:53:16 +06:30
|
|
|
}
|