add submit widget for mix carton
This commit is contained in:
@@ -14,7 +14,9 @@ import 'package:fcs/pages/widgets/progress.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
||||
import 'mix_cation/mix_cartion_editor.dart';
|
||||
import '../main/util.dart';
|
||||
import 'carton_editor_for_package.dart';
|
||||
import 'mix_carton/mix_carton_editor.dart';
|
||||
import 'carton_row.dart';
|
||||
|
||||
class CartonEditor extends StatefulWidget {
|
||||
@@ -26,7 +28,7 @@ class CartonEditor extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _CartonEditorState extends State<CartonEditor> {
|
||||
List<String> cartonTypes = [carton_from_packages, carton_mix_carton];
|
||||
List<String> _cartonTypes = [carton_from_packages, carton_mix_carton];
|
||||
List<Carton> _cartons = [];
|
||||
|
||||
bool _isLoading = false;
|
||||
@@ -34,23 +36,26 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
int _billToValue = 1;
|
||||
String? _selectedCartonType;
|
||||
|
||||
User? consignee;
|
||||
User? sender;
|
||||
User? _consignee;
|
||||
User? _sender;
|
||||
Carton? _carton;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_init();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
_init() {
|
||||
if (widget.carton != null) {
|
||||
_carton = widget.carton;
|
||||
_selectedCartonType = _carton!.cartonType;
|
||||
|
||||
_isNew = false;
|
||||
|
||||
consignee = User(
|
||||
_consignee = User(
|
||||
id: _carton!.userID, fcsID: _carton!.fcsID, name: _carton!.userName);
|
||||
sender = User(
|
||||
_sender = User(
|
||||
id: _carton!.senderID,
|
||||
fcsID: _carton!.senderFCSID,
|
||||
name: _carton!.senderName);
|
||||
@@ -62,6 +67,20 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
Carton(cartonNumber: "A177(A)-3#2", cartonWeight: 35.5),
|
||||
Carton(cartonNumber: "A177(A)-3#1", cartonWeight: 25.5)
|
||||
];
|
||||
_sender = User(
|
||||
name: "ptd-phyo44 kaelone",
|
||||
fcsID: "FCS-8X6V",
|
||||
phoneNumber: "+959444444444",
|
||||
id: "48u_4s-HiQeW-HwSqeRd9TSMWh3mLZfSk5rpaUEh_zw");
|
||||
|
||||
_consignee = User(
|
||||
id: "HsIwG88K-0_HSazgEy5QR27kcjkOvfv7_Sr1JP18Q1A",
|
||||
name: "One One",
|
||||
phoneNumber: "+959111111111",
|
||||
fcsID: "FCS-EFRF");
|
||||
}
|
||||
if (mounted) {
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +126,7 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
|
||||
final cartonTypeBox = LocalRadioButtons(
|
||||
readOnly: !_isNew,
|
||||
values: cartonTypes,
|
||||
values: _cartonTypes,
|
||||
selectedValue: _selectedCartonType,
|
||||
callback: (String? v) {
|
||||
setState(() {
|
||||
@@ -125,6 +144,22 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
onTap: () {
|
||||
//for packages
|
||||
if (isFromPackages) {
|
||||
if (_sender == null) {
|
||||
showMsgDialog(
|
||||
context, "Error", "Please select sender's FCS ID");
|
||||
return;
|
||||
}
|
||||
if (_consignee == null) {
|
||||
showMsgDialog(
|
||||
context, "Error", "Please select consignee's FCS ID");
|
||||
return;
|
||||
}
|
||||
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (context) => CartonEditorForPackage(
|
||||
sender: _sender!, consignee: _consignee!)));
|
||||
}
|
||||
// for mix cartion
|
||||
else {
|
||||
@@ -153,25 +188,25 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
icon: Icon(Icons.search, color: Colors.black),
|
||||
onPressed: () => searchUser(context, onUserSelect: (u) {
|
||||
setState(() {
|
||||
this.consignee = u;
|
||||
this._consignee = u;
|
||||
});
|
||||
}, popPage: true)),
|
||||
],
|
||||
);
|
||||
|
||||
final consigneefcsIDBox = DisplayText(
|
||||
text: consignee != null ? consignee!.fcsID : "",
|
||||
text: _consignee != null ? _consignee!.fcsID : "",
|
||||
labelTextKey: "processing.fcs.id",
|
||||
icon: FcsIDIcon(),
|
||||
);
|
||||
|
||||
final consigneePhoneBox = DisplayText(
|
||||
text: consignee != null ? consignee!.phoneNumber : "",
|
||||
text: _consignee != null ? _consignee!.phoneNumber : "",
|
||||
labelTextKey: "processing.phone",
|
||||
iconData: MaterialCommunityIcons.phone);
|
||||
|
||||
final consigneeNameBox = DisplayText(
|
||||
text: consignee != null ? consignee!.name : "",
|
||||
text: _consignee != null ? _consignee!.name : "",
|
||||
labelTextKey: "processing.consignee.name",
|
||||
maxLines: 2,
|
||||
iconData: MaterialCommunityIcons.account_arrow_left);
|
||||
@@ -199,25 +234,25 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
icon: Icon(Icons.search, color: Colors.black),
|
||||
onPressed: () => searchUser(context, onUserSelect: (u) {
|
||||
setState(() {
|
||||
this.sender = u;
|
||||
this._sender = u;
|
||||
});
|
||||
}, popPage: true)),
|
||||
],
|
||||
);
|
||||
|
||||
final senderIDBox = DisplayText(
|
||||
text: sender != null ? sender!.fcsID : "",
|
||||
text: _sender != null ? _sender!.fcsID : "",
|
||||
labelTextKey: "processing.fcs.id",
|
||||
icon: FcsIDIcon());
|
||||
|
||||
final senderPhoneBox = DisplayText(
|
||||
text: sender != null ? sender!.phoneNumber : "",
|
||||
text: _sender != null ? _sender!.phoneNumber : "",
|
||||
labelTextKey: "processing.phone",
|
||||
iconData: MaterialCommunityIcons.phone,
|
||||
);
|
||||
|
||||
final senderNameBox = DisplayText(
|
||||
text: sender != null ? sender!.name : "",
|
||||
text: _sender != null ? _sender!.name : "",
|
||||
labelTextKey: "processing.shipper.name",
|
||||
maxLines: 2,
|
||||
iconData: MaterialCommunityIcons.account_arrow_right);
|
||||
|
||||
Reference in New Issue
Block a user