Merge branch 'dev_branch' into feature_dev_prativa
commit
b07c09d011
|
@ -194,7 +194,7 @@ class _CustomDropdownState<T> extends State<CustomDropdown<T>> {
|
|||
message: widget.itemLabel(item),
|
||||
child: Text(
|
||||
widget.itemLabel(item),
|
||||
style: 12.txtSBoldGrey,
|
||||
style: 11.txtSBoldGrey,
|
||||
),
|
||||
),
|
||||
onTap: () => _selectItem(item),
|
||||
|
@ -278,9 +278,16 @@ class _CustomDropdownState<T> extends State<CustomDropdown<T>> {
|
|||
selectedItem != null
|
||||
? widget.itemLabel(selectedItem as T)
|
||||
: widget.hintText,
|
||||
style: 12.txtSBoldGrey,
|
||||
style: 11.txtSBoldGrey,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
// Text(
|
||||
// selectedItem != null
|
||||
// ? widget.itemLabel(selectedItem as T)
|
||||
// : widget.hintText,
|
||||
// style: 12.txtSBoldGrey,
|
||||
// overflow: TextOverflow.ellipsis,
|
||||
// ),
|
||||
),
|
||||
const Icon(
|
||||
Icons.keyboard_arrow_down_outlined,
|
||||
|
|
|
@ -59,7 +59,7 @@ class ManageUser extends StatelessWidget {
|
|||
selected;
|
||||
}
|
||||
},
|
||||
hintText: 'Select Plant'),
|
||||
hintText: 'Select UserName'),
|
||||
],
|
||||
)),
|
||||
SizedBox(width: 16),
|
||||
|
@ -84,7 +84,7 @@ class ManageUser extends StatelessWidget {
|
|||
selected;
|
||||
}
|
||||
},
|
||||
hintText: 'Select Plant'),
|
||||
hintText: 'Select User Type'),
|
||||
],
|
||||
)),
|
||||
SizedBox(width: 16),
|
||||
|
@ -109,11 +109,12 @@ class ManageUser extends StatelessWidget {
|
|||
selected;
|
||||
}
|
||||
},
|
||||
hintText: 'Select Plant'),
|
||||
hintText: 'Select Email Address'),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
|
@ -137,7 +138,7 @@ class ManageUser extends StatelessWidget {
|
|||
selected;
|
||||
}
|
||||
},
|
||||
hintText: 'Select Product'),
|
||||
hintText: 'Select Employer Code'),
|
||||
],
|
||||
)),
|
||||
SizedBox(width: 16),
|
||||
|
|
|
@ -125,20 +125,20 @@ var userNames =[].obs;
|
|||
var userTypesNames =[].obs;
|
||||
var userEmpCode =[].obs;
|
||||
var userEmail =[].obs;
|
||||
var selectUser = "Select Status".obs;
|
||||
var selectEmail = "Select Status".obs;
|
||||
var selectCode = "Select Status".obs;
|
||||
var selectType = "Select Status".obs;
|
||||
var selectUser = "Select User Name".obs;
|
||||
var selectEmail = "Select Email".obs;
|
||||
var selectCode = "Select Employee Code".obs;
|
||||
var selectType = "Select UserType".obs;
|
||||
getManageUser() async {
|
||||
try {
|
||||
userLoading.value = true;
|
||||
|
||||
Map<String, String> requestBody = {
|
||||
"userName": nameCtrl.text.isEmpty ? "" : nameCtrl.text,
|
||||
"userTypeName": userTypeCtrl.text.isEmpty ? "" : userTypeCtrl.text,
|
||||
"Email": emailCtrl.text.isEmpty ? "" : emailCtrl.text,
|
||||
"userName": selectUser.value == "Select User Name" ? "" : selectUser.value,
|
||||
"userTypeName": selectUser.value == "Select User Name" ? "" : selectUser.value,
|
||||
"Email": selectEmail.value == "Select Email" ?"": selectEmail.value,
|
||||
"EmployeeTransCode":
|
||||
employeeCodeCtrl.text.isEmpty ? "" : employeeCodeCtrl.text,
|
||||
selectCode.value == "Select Employee Code" ? "" : selectCode.value,
|
||||
"status": selectUserStatus.value == "Select Status"
|
||||
? ""
|
||||
: selectUserStatus.value == "Active"
|
||||
|
|
|
@ -24,6 +24,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.white,
|
||||
appBar: AppBar(
|
||||
automaticallyImplyLeading: false,
|
||||
backgroundColor: AppColors.secondaryClr,
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -26,471 +26,474 @@ class PendingGeneration extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.all(16),
|
||||
color: AppColors.clrF2,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(text:
|
||||
"Plant", isRequired: true),
|
||||
SizedBox(height: 8),
|
||||
CustomDropdown(
|
||||
backClr: AppColors.clrD9,
|
||||
borderClr: AppColors.clrGrey,
|
||||
items: controller.plant,
|
||||
itemLabel: (item) => "${item.plantCode}-${item.plantDesc}",
|
||||
onSelected: (selected) {
|
||||
if (selected != null) {
|
||||
controller.selectPlant.value = selected.plantCode ?? "";
|
||||
controller.showPlantErrorPending.value = false;
|
||||
}
|
||||
},
|
||||
hintText: "Select Plant",
|
||||
),
|
||||
// Obx(() => controller.showPlantErrorPending.value
|
||||
// ? Padding(
|
||||
// padding: const EdgeInsets.only(top: 4),
|
||||
// child: Text(
|
||||
// 'Required',
|
||||
// style: TextStyle(color: Colors.red, fontSize: 12),
|
||||
// ),
|
||||
// )
|
||||
// : SizedBox.shrink()),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(text:"Product Name", isRequired: true),
|
||||
SizedBox(height: 8),
|
||||
CustomDropdown<dynamic>(
|
||||
width: 250,
|
||||
backClr: AppColors.clrD9,
|
||||
borderClr: AppColors.clrGrey,
|
||||
items: controller.product,
|
||||
itemLabel: (item) => "${item.materialCode}-${item.materialDescription}",
|
||||
onSelected: (selected) {
|
||||
if (selected != null) {
|
||||
controller.selectProduct.value = selected;
|
||||
print(
|
||||
"selectPlant${controller.selectProduct.value}");
|
||||
}
|
||||
},
|
||||
hintText: "Select Product Name",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(text:"Transaction Type", isRequired: true),
|
||||
SizedBox(height: 8),
|
||||
CustomDropdown<String>(
|
||||
backClr: AppColors.clrD9,
|
||||
borderClr: AppColors.clrGrey,
|
||||
items: controller.transactionType,
|
||||
itemLabel: (item) => item,
|
||||
onSelected: (selected) {
|
||||
if (selected != null) {
|
||||
controller.selectTransactionType.value = selected;
|
||||
controller.showTransactionErrorPending.value = false; }
|
||||
},
|
||||
hintText: "Select Transaction Type",
|
||||
),
|
||||
// Obx(() => controller.showTransactionErrorPending.value
|
||||
// ? Padding(
|
||||
// padding: const EdgeInsets.only(top: 4),
|
||||
// child: Text(
|
||||
// 'Required',
|
||||
// style: TextStyle(color: Colors.red, fontSize: 12),
|
||||
// ),
|
||||
// )
|
||||
// : SizedBox.shrink()),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 16.0, left: 0, right: 8),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
Obx(() => controller.isFilterVisiblePendingGeneration.value
|
||||
? Column(children: [
|
||||
Container(
|
||||
padding: EdgeInsets.all(16),
|
||||
color: AppColors.clrF2,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
TextView(text:"MRN Date Range"),
|
||||
// SizedBox(height: 8),
|
||||
// CustomDropdown<String>(
|
||||
// borderClr: AppColors.clrGrey,
|
||||
// items: controller.date,
|
||||
// itemLabel: (item) => item,
|
||||
// onSelected: (selected) {
|
||||
// if (selected != null) {
|
||||
// controller.selectPlant.value = selected;
|
||||
// }
|
||||
// },
|
||||
// hintText: "Select MRN Date Range",
|
||||
// ),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 8),
|
||||
height: 35,
|
||||
child: TextFormField(
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(text: "Plant", isRequired: true),
|
||||
SizedBox(height: 8),
|
||||
CustomDropdown(
|
||||
backClr: AppColors.clrD9,
|
||||
borderClr: AppColors.clrGrey,
|
||||
|
||||
key: controller.fromTextFieldKey,
|
||||
controller: controller.fromController,
|
||||
onTap: () async {
|
||||
final pickedDate = await showWebDatePicker(
|
||||
width: 20.w,
|
||||
context: controller
|
||||
.fromTextFieldKey.currentContext!,
|
||||
initialDate: controller.fromSelectedDate,
|
||||
firstDate: DateTime(2000),
|
||||
lastDate: DateTime.now(),
|
||||
);
|
||||
|
||||
if (pickedDate != null) {
|
||||
controller.fromSelectedDate = pickedDate;
|
||||
String formattedDate =
|
||||
controller.getFormattedDate(pickedDate);
|
||||
controller.fromController.text =
|
||||
formattedDate;
|
||||
controller.dateCheck.value = true;
|
||||
}
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
fillColor:AppColors.clrD9,
|
||||
filled: true,
|
||||
hintText: 'Select MRN Date Range',
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 12,
|
||||
overflow: TextOverflow.ellipsis),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(2.0),
|
||||
borderSide:
|
||||
BorderSide(color: AppColors.black),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(2.0),
|
||||
borderSide:
|
||||
BorderSide(color: AppColors.clrGrey),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(2.0),
|
||||
borderSide:
|
||||
BorderSide(color: AppColors.clrGrey),
|
||||
),
|
||||
disabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(2.0),
|
||||
borderSide:
|
||||
BorderSide(color: AppColors.clrGrey),
|
||||
),
|
||||
suffixIcon: controller.dateCheck.value
|
||||
? InkWell(
|
||||
onTap: () {
|
||||
controller.dateCheck.value = false;
|
||||
controller.fromController.clear();
|
||||
controller.fromSelectedDate =
|
||||
DateTime.now();
|
||||
items: controller.plant,
|
||||
itemLabel: (item) =>
|
||||
"${item.plantCode}-${item.plantDesc}",
|
||||
onSelected: (selected) {
|
||||
if (selected != null) {
|
||||
controller.selectPlantPending.value =
|
||||
selected.plantCode ?? "";
|
||||
controller.showPlantErrorPending.value =
|
||||
false;
|
||||
}
|
||||
},
|
||||
child: Icon(Icons.close, size: 1.2.w),
|
||||
)
|
||||
: null,
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 12.0, vertical: 0.0),
|
||||
),
|
||||
hintText: "Select Plant",
|
||||
),
|
||||
Obx(() => controller.showPlantErrorPending.value
|
||||
? Text(
|
||||
'Required',
|
||||
style: TextStyle(
|
||||
color: Colors.red, fontSize: 12),
|
||||
)
|
||||
: Text('')),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(
|
||||
text: "Product Name", isRequired: true),
|
||||
SizedBox(height: 8),
|
||||
CustomDropdown<dynamic>(
|
||||
width: 250,
|
||||
backClr: AppColors.clrD9,
|
||||
borderClr: AppColors.clrGrey,
|
||||
items: controller.product,
|
||||
itemLabel: (item) =>
|
||||
"${item.materialCode}-${item.materialDescription}",
|
||||
onSelected: (selected) {
|
||||
if (selected != null) {
|
||||
controller.selectProductPending.value =
|
||||
selected.materialCode;
|
||||
controller.showProductErrorPending.value =
|
||||
false;
|
||||
|
||||
print(
|
||||
"selectPlant${controller.selectProduct.value}");
|
||||
}
|
||||
},
|
||||
hintText: "Select Product Name",
|
||||
),
|
||||
Obx(() => controller
|
||||
.showProductErrorPending.value
|
||||
? Text(
|
||||
'Required',
|
||||
style: TextStyle(
|
||||
color: Colors.red, fontSize: 12),
|
||||
)
|
||||
: Text('')),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(
|
||||
text: "Transaction Type", isRequired: true),
|
||||
SizedBox(height: 8),
|
||||
CustomDropdown<String>(
|
||||
backClr: AppColors.clrD9,
|
||||
borderClr: AppColors.clrGrey,
|
||||
items: controller.transactionType,
|
||||
itemLabel: (item) => item,
|
||||
onSelected: (selected) {
|
||||
if (selected != null) {
|
||||
controller.selectTransactionTypePending
|
||||
.value = selected;
|
||||
controller.showTransactionErrorPending
|
||||
.value = false;
|
||||
}
|
||||
},
|
||||
hintText: "Select Transaction Type",
|
||||
),
|
||||
Obx(() => controller
|
||||
.showTransactionErrorPending.value
|
||||
? Text(
|
||||
'Required',
|
||||
style: TextStyle(
|
||||
color: Colors.red, fontSize: 12),
|
||||
)
|
||||
: Text('')),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(text:"From Location"),
|
||||
SizedBox(height: 8),
|
||||
CustomDropdown<dynamic>(
|
||||
backClr: AppColors.clrD9,
|
||||
borderClr: AppColors.clrGrey,
|
||||
items: controller.fromLocation,
|
||||
itemLabel: (item) => item,
|
||||
onSelected: (selected) {
|
||||
if (selected != null) {
|
||||
controller.selectLocation.value = selected;
|
||||
}
|
||||
},
|
||||
hintText: "Select From Location",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 16,
|
||||
),
|
||||
Expanded(
|
||||
//flex: 2,
|
||||
child: Column(
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(top: 16.0, left: 0, right: 8),
|
||||
child: Row(
|
||||
children: [
|
||||
TextView(text:
|
||||
"",
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
CommonBtn(
|
||||
bkClr: Colors.white,
|
||||
text: AppStrings.cancel,
|
||||
clickAction: () {},
|
||||
),
|
||||
SizedBox(width: 16),
|
||||
CommonButton(
|
||||
borderRadius: 4,
|
||||
height: 30,
|
||||
width: 100,
|
||||
text: AppStrings.submit,
|
||||
TextView(text: "MRN Date Range"),
|
||||
// SizedBox(height: 8),
|
||||
// CustomDropdown<String>(
|
||||
// borderClr: AppColors.clrGrey,
|
||||
// items: controller.date,
|
||||
// itemLabel: (item) => item,
|
||||
// onSelected: (selected) {
|
||||
// if (selected != null) {
|
||||
// controller.selectPlant.value = selected;
|
||||
// }
|
||||
// },
|
||||
// hintText: "Select MRN Date Range",
|
||||
// ),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 8),
|
||||
height: 35,
|
||||
child: TextFormField(
|
||||
key: controller.fromTextFieldKey,
|
||||
controller: controller.fromController,
|
||||
onTap: () async {
|
||||
final pickedDate =
|
||||
await showWebDatePicker(
|
||||
width: 20.w,
|
||||
context: controller
|
||||
.fromTextFieldKey.currentContext!,
|
||||
initialDate:
|
||||
controller.fromSelectedDate,
|
||||
firstDate: DateTime(2000),
|
||||
lastDate: DateTime.now(),
|
||||
);
|
||||
|
||||
clickAction: () {
|
||||
controller.validateFieldsPending();
|
||||
if (controller.showPlantErrorPending.value ||
|
||||
controller.showProductErrorPending.value ||
|
||||
controller.showTransactionErrorPending.value
|
||||
) {
|
||||
|
||||
} else {
|
||||
controller.postData();
|
||||
}
|
||||
|
||||
},
|
||||
if (pickedDate != null) {
|
||||
controller.fromSelectedDate =
|
||||
pickedDate;
|
||||
String formattedDate = controller
|
||||
.getFormattedDate(pickedDate);
|
||||
controller.fromController.text =
|
||||
formattedDate;
|
||||
controller.dateCheck.value = true;
|
||||
}
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
fillColor: AppColors.clrD9,
|
||||
filled: true,
|
||||
hintText: 'Select MRN Date Range',
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 12,
|
||||
overflow: TextOverflow.ellipsis),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(2.0),
|
||||
borderSide: BorderSide(
|
||||
color: AppColors.black),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(2.0),
|
||||
borderSide: BorderSide(
|
||||
color: AppColors.clrGrey),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(2.0),
|
||||
borderSide: BorderSide(
|
||||
color: AppColors.clrGrey),
|
||||
),
|
||||
disabledBorder: OutlineInputBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(2.0),
|
||||
borderSide: BorderSide(
|
||||
color: AppColors.clrGrey),
|
||||
),
|
||||
suffixIcon: controller.dateCheck.value
|
||||
? InkWell(
|
||||
onTap: () {
|
||||
controller.dateCheck.value =
|
||||
false;
|
||||
controller.fromController
|
||||
.clear();
|
||||
controller.fromSelectedDate =
|
||||
DateTime.now();
|
||||
},
|
||||
child: Icon(Icons.close,
|
||||
size: 1.2.w),
|
||||
)
|
||||
: null,
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(
|
||||
horizontal: 12.0,
|
||||
vertical: 0.0),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 10),
|
||||
margin: EdgeInsets.only(top: 16),
|
||||
height: 45,
|
||||
color: AppColors.primaryClr,
|
||||
child: Row(
|
||||
children: [
|
||||
TextView(text: AppStrings.viewGrnDetails, style: 14.txtBoldWhite),
|
||||
Spacer(),
|
||||
CommonBtn(
|
||||
width: 150,
|
||||
bkClr: AppColors.white,
|
||||
borderClr: AppColors.primaryClr,
|
||||
style: 12.txtBoldBlue,
|
||||
text: "Generate Freight Bill",
|
||||
// text: AppStrings.save,
|
||||
clickAction: () {
|
||||
bool hasSelectedRows = controller.grnDetails
|
||||
.any((element) => element.isSelected);
|
||||
if (!hasSelectedRows) {
|
||||
showPopup(context: context, onClick: () {
|
||||
Get.back();
|
||||
});
|
||||
} else {
|
||||
CommonAlertDialog.showDialog(
|
||||
message: "Are you sure want to\nsave this?",
|
||||
positiveText: "Save",
|
||||
negativeText: "Cancel",
|
||||
positiveBtCallback: () {
|
||||
Get.back();
|
||||
controller.addFreightBill();
|
||||
|
||||
showFreightBill(context);
|
||||
},
|
||||
negativeBtCallback: () {});
|
||||
}
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
Obx(() {
|
||||
if (controller.freightViewLoader.value) {
|
||||
return Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: AppColors.primaryClr,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Column(
|
||||
children: [
|
||||
Obx(() {
|
||||
if (controller.grnPendingLoader.value) {
|
||||
return Center(child: CircularProgressIndicator());
|
||||
}
|
||||
|
||||
if (controller.errorMessage.isNotEmpty) {
|
||||
return Center(child: Text(controller.errorMessage.value));
|
||||
}
|
||||
|
||||
if (controller.grnPendingData.isEmpty) {
|
||||
return Center(child: Text('No data available.'));
|
||||
}
|
||||
return Scrollbar(
|
||||
thumbVisibility: true,
|
||||
controller: controller.verticalScrollController,
|
||||
child: SingleChildScrollView(
|
||||
controller: controller.verticalScrollController,
|
||||
child: Scrollbar(
|
||||
thumbVisibility: true,
|
||||
controller: controller.horizontalScrollController,
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
controller: controller.horizontalScrollController,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Colors.grey.shade400,
|
||||
width: 1.0,
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(text: "From Location"),
|
||||
SizedBox(height: 8),
|
||||
CustomDropdown<dynamic>(
|
||||
backClr: AppColors.clrD9,
|
||||
borderClr: AppColors.clrGrey,
|
||||
items: controller.fromLocation,
|
||||
itemLabel: (item) => item,
|
||||
onSelected: (selected) {
|
||||
if (selected != null) {
|
||||
controller.selectLocation.value =
|
||||
selected;
|
||||
}
|
||||
},
|
||||
hintText: "Select From Location",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: DataTable(
|
||||
dataRowHeight: 28,
|
||||
headingRowHeight: 40,
|
||||
headingRowColor:
|
||||
SizedBox(
|
||||
width: 16,
|
||||
),
|
||||
Expanded(
|
||||
//flex: 2,
|
||||
child: Column(
|
||||
children: [
|
||||
TextView(
|
||||
text: "",
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
CommonBtn(
|
||||
bkClr: Colors.white,
|
||||
text: AppStrings.cancel,
|
||||
clickAction: () => controller.clearFiltersPendingGeneration(),
|
||||
),
|
||||
SizedBox(width: 16),
|
||||
CommonButton(
|
||||
borderRadius: 4,
|
||||
height: 30,
|
||||
width: 100,
|
||||
text: AppStrings.submit,
|
||||
clickAction: () =>
|
||||
// controller.validateFieldsPending();
|
||||
// if (controller.showPlantErrorPending
|
||||
// .value ||
|
||||
// controller.showProductErrorPending
|
||||
// .value ||
|
||||
// controller
|
||||
// .showTransactionErrorPending
|
||||
// .value) {
|
||||
// } else {
|
||||
// controller.postData();
|
||||
// }
|
||||
controller
|
||||
.handleFilterSubmitPendingGeneration(),
|
||||
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
])
|
||||
: SizedBox.shrink()),
|
||||
Obx(() {
|
||||
if (controller.grnPendingLoader.value) {
|
||||
return SizedBox(
|
||||
height: MediaQuery.sizeOf(context).height,
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: AppColors.primaryClr,
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
if (controller.errorMessage.isNotEmpty) {
|
||||
return SizedBox(
|
||||
height: MediaQuery.sizeOf(context).height,
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
|
||||
child: Center(child: Text(controller.errorMessage.value)));
|
||||
}
|
||||
|
||||
if (controller.grnPendingData.isEmpty) {
|
||||
return SizedBox(
|
||||
height: MediaQuery.sizeOf(context).height,
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
|
||||
child: Center(child: Text('No data available.',)));
|
||||
}
|
||||
return
|
||||
Column(
|
||||
children: [
|
||||
SizedBox(height: 20,),
|
||||
Scrollbar(
|
||||
thumbVisibility: true,
|
||||
controller: controller.verticalScrollController,
|
||||
child: SingleChildScrollView(
|
||||
controller: controller.verticalScrollController,
|
||||
child: Scrollbar(
|
||||
thumbVisibility: true,
|
||||
controller: controller.horizontalScrollController,
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
controller: controller.horizontalScrollController,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Colors.grey.shade400,
|
||||
width: 1.0,
|
||||
),
|
||||
),
|
||||
child: DataTable(
|
||||
dataRowHeight: 40,
|
||||
headingRowHeight: 40,
|
||||
headingRowColor:
|
||||
WidgetStateProperty.all(AppColors.clrF2),
|
||||
border: TableBorder(
|
||||
horizontalInside:
|
||||
border: TableBorder(
|
||||
horizontalInside:
|
||||
BorderSide(color: AppColors.clrGrey),
|
||||
verticalInside:
|
||||
verticalInside:
|
||||
BorderSide(color: AppColors.clrGrey),
|
||||
bottom: BorderSide(color: AppColors.clrGrey),
|
||||
left: BorderSide(color: AppColors.clrGrey),
|
||||
right: BorderSide(color: AppColors.clrGrey),
|
||||
top: BorderSide(color: AppColors.clrGrey),
|
||||
bottom: BorderSide(color: AppColors.clrGrey),
|
||||
left: BorderSide(color: AppColors.clrGrey),
|
||||
right: BorderSide(color: AppColors.clrGrey),
|
||||
top: BorderSide(color: AppColors.clrGrey),
|
||||
),
|
||||
columns: [
|
||||
DataColumn(
|
||||
label: Transform.scale(
|
||||
scale: 0.80,
|
||||
child: Checkbox(
|
||||
value: controller.selectAllField.value,
|
||||
onChanged: (value) {
|
||||
controller.selectAll(value ?? false);
|
||||
},
|
||||
activeColor: AppColors.primaryClr,
|
||||
checkColor: Colors.white,
|
||||
materialTapTargetSize:
|
||||
MaterialTapTargetSize.shrinkWrap,
|
||||
),
|
||||
),
|
||||
columns: [
|
||||
DataColumn(
|
||||
label: Transform.scale(
|
||||
),
|
||||
// dataColumn(AppStrings.srNo),
|
||||
dataColumn(AppStrings.plantName),
|
||||
dataColumn(AppStrings.productName),
|
||||
dataColumn(AppStrings.date),
|
||||
dataColumn(AppStrings.fromLocation),
|
||||
dataColumn(AppStrings.vehicleNo),
|
||||
dataColumn(AppStrings.transporterLrNo),
|
||||
dataColumn(AppStrings.transporterLrNoDate),
|
||||
dataColumn(AppStrings.dispQty),
|
||||
dataColumn(AppStrings.netQty),
|
||||
dataColumn(AppStrings.billingQty),
|
||||
dataColumn(AppStrings.uom),
|
||||
dataColumn(AppStrings.freightRate),
|
||||
dataColumn(AppStrings.freightAmount),
|
||||
dataColumn(AppStrings.remark),
|
||||
],
|
||||
rows: List<DataRow>.generate(
|
||||
controller.grnPendingData.length, (index) {
|
||||
final stoppage = controller.grnPendingData[index];
|
||||
|
||||
return DataRow(
|
||||
selected: stoppage.isSelected,
|
||||
cells: [
|
||||
DataCell(
|
||||
Transform.scale(
|
||||
scale: 0.80,
|
||||
child: Checkbox(
|
||||
value: controller.selectAllField.value,
|
||||
value: stoppage.isSelected,
|
||||
onChanged: (value) {
|
||||
controller.selectAll(value ?? false);
|
||||
controller.toggleSelection(
|
||||
index, value ?? false);
|
||||
},
|
||||
activeColor: AppColors.primaryClr,
|
||||
checkColor: Colors.white,
|
||||
materialTapTargetSize:
|
||||
MaterialTapTargetSize.shrinkWrap,
|
||||
MaterialTapTargetSize.shrinkWrap,
|
||||
),
|
||||
),
|
||||
),
|
||||
// dataColumn(AppStrings.srNo),
|
||||
dataColumn(AppStrings.plantName),
|
||||
dataColumn(AppStrings.productName),
|
||||
dataColumn(AppStrings.date),
|
||||
dataColumn(AppStrings.fromLocation),
|
||||
dataColumn(AppStrings.vehicleNo),
|
||||
dataColumn(AppStrings.transporterLrNo),
|
||||
dataColumn(AppStrings.transporterLrNoDate),
|
||||
dataColumn(AppStrings.dispQty),
|
||||
dataColumn(AppStrings.netQty),
|
||||
dataColumn(AppStrings.billingQty),
|
||||
dataColumn(AppStrings.uom),
|
||||
dataColumn(AppStrings.freightRate),
|
||||
dataColumn(AppStrings.freightAmount),
|
||||
dataColumn(AppStrings.remark),
|
||||
// editableCell(index, "0${index + 1}"),
|
||||
editableCell(index, stoppage.plantCode ?? ""),
|
||||
editableCell(index, stoppage.plantCode ?? ""),
|
||||
|
||||
editableCell(
|
||||
index,
|
||||
DateFormat('yyyy-MM-dd').format(
|
||||
stoppage.grnDate ?? DateTime.now())),
|
||||
editableCell(
|
||||
index, stoppage.fromLocation ?? ""),
|
||||
editableCell(index, stoppage.vehicleNo ?? ""),
|
||||
editableCell(index, stoppage.lrNo ?? ""),
|
||||
editableCell(
|
||||
index,
|
||||
DateFormat('yyyy-MM-dd').format(
|
||||
stoppage.lrDate ?? DateTime.now())),
|
||||
editableCell(
|
||||
index, stoppage.dispQty?.toString() ?? ""),
|
||||
editableCell(
|
||||
index, stoppage.netQty?.toString() ?? ""),
|
||||
editableCell(index,
|
||||
stoppage.billingQty?.toString() ?? ""),
|
||||
editableCell(index,
|
||||
stoppage.codeValue?.toString() ?? ""),
|
||||
editableCell(index,
|
||||
stoppage.freightRate?.toString() ?? ""),
|
||||
editableCell(index,
|
||||
stoppage.shipmentCost?.toString() ?? ""),
|
||||
editableCell(
|
||||
index, stoppage.remark?.toString() ?? ""),
|
||||
],
|
||||
rows: List<DataRow>.generate(
|
||||
controller.grnPendingData.length, (index) {
|
||||
final stoppage = controller.grnPendingData[index];
|
||||
|
||||
return DataRow(
|
||||
selected: stoppage.isSelected,
|
||||
cells: [
|
||||
DataCell(
|
||||
Transform.scale(
|
||||
scale: 0.80,
|
||||
child: Checkbox(
|
||||
value: stoppage.isSelected,
|
||||
onChanged: (value) {
|
||||
controller.toggleSelection(
|
||||
index, value ?? false);
|
||||
},
|
||||
activeColor: AppColors.primaryClr,
|
||||
|
||||
checkColor: Colors.white,
|
||||
|
||||
materialTapTargetSize: MaterialTapTargetSize
|
||||
.shrinkWrap,
|
||||
),
|
||||
),
|
||||
),
|
||||
// editableCell(index, "0${index + 1}"),
|
||||
editableCell(index, stoppage.plantCode ?? ""),
|
||||
editableCell(index, stoppage.plantCode ?? ""),
|
||||
|
||||
editableCell(
|
||||
index,
|
||||
DateFormat('yyyy-MM-dd').format(
|
||||
stoppage.grnDate ?? DateTime.now())),
|
||||
editableCell(
|
||||
index, stoppage.fromLocation ?? ""),
|
||||
editableCell(index, stoppage.vehicleNo ?? ""),
|
||||
editableCell(index, stoppage.lrNo ?? ""),
|
||||
editableCell(
|
||||
index,
|
||||
DateFormat('yyyy-MM-dd').format(
|
||||
stoppage.lrDate ?? DateTime.now())),
|
||||
editableCell(
|
||||
index, stoppage.dispQty?.toString() ?? ""),
|
||||
editableCell(
|
||||
index, stoppage.netQty?.toString() ?? ""),
|
||||
editableCell(index,
|
||||
stoppage.billingQty?.toString() ?? ""),
|
||||
editableCell(index,
|
||||
stoppage.codeValue?.toString() ?? ""),
|
||||
editableCell(index,
|
||||
stoppage.freightRate?.toString() ?? ""),
|
||||
editableCell(
|
||||
index, stoppage.shipmentCost?.toString() ?? ""),
|
||||
editableCell(
|
||||
index, stoppage.remark?.toString() ?? ""),
|
||||
],
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
);
|
||||
}
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
],
|
||||
);
|
||||
|
|
|
@ -60,16 +60,16 @@ class ViewFreightBill extends StatelessWidget {
|
|||
},
|
||||
hintText: "Select Plant",
|
||||
),
|
||||
// Obx(() =>
|
||||
// controller.showPlantErrorFreight.value
|
||||
// ? Padding(
|
||||
// padding: const EdgeInsets.only(top: 4),
|
||||
// child: Text(
|
||||
// 'Required',
|
||||
// style: TextStyle(color: Colors.red, fontSize: 12),
|
||||
// ),
|
||||
// )
|
||||
// : SizedBox.shrink()),
|
||||
Obx(() =>
|
||||
controller.showPlantErrorFreight.value
|
||||
? Padding(
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
child: Text(
|
||||
'Please select a plant',
|
||||
style: TextStyle(color: Colors.red, fontSize: 12),
|
||||
),
|
||||
)
|
||||
: SizedBox.shrink()),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -126,16 +126,16 @@ class ViewFreightBill extends StatelessWidget {
|
|||
},
|
||||
hintText: "Select Transaction Type",
|
||||
),
|
||||
// Obx(() =>
|
||||
// controller.showTransactionErrorFreight.value
|
||||
// ? Padding(
|
||||
// padding: const EdgeInsets.only(top: 4),
|
||||
// child: Text(
|
||||
// 'Required',
|
||||
// style: TextStyle(color: Colors.red, fontSize: 12),
|
||||
// ),
|
||||
// )
|
||||
// : SizedBox.shrink()),
|
||||
Obx(() =>
|
||||
controller.showTransactionErrorFreight.value
|
||||
? Padding(
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
child: Text(
|
||||
'Please select Transaction Type',
|
||||
style: TextStyle(color: Colors.red, fontSize: 12),
|
||||
),
|
||||
)
|
||||
: SizedBox.shrink()),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -272,7 +272,7 @@ class ViewFreightBill extends StatelessWidget {
|
|||
width: 100,
|
||||
text: AppStrings.submit,
|
||||
clickAction: () {
|
||||
controller.validateFieldsFreight();
|
||||
|
||||
if (controller.showPlantErrorFreight
|
||||
.value ||
|
||||
controller.showProductErrorFreight
|
||||
|
|
|
@ -29,6 +29,8 @@ class _TransportViewState extends State<TransportView> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView(
|
||||
shrinkWrap: true,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
@ -163,210 +165,38 @@ class _TransportViewState extends State<TransportView> {
|
|||
style: 12.txtBoldWhite,
|
||||
),
|
||||
),
|
||||
Obx(
|
||||
() => Visibility(
|
||||
visible: ctrl.selectedUser.value >= 1,
|
||||
child: InkWell(
|
||||
onTap: ctrl.toggleContainer,
|
||||
child: Image.asset(AppImages.filter,
|
||||
height: 16, width: 16)),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
if(ctrl.selectedUser.value == 0){
|
||||
ctrl.toggleFilter();
|
||||
}
|
||||
else if(ctrl.selectedUser.value == 2){
|
||||
ctrl.togglePending();
|
||||
}
|
||||
},
|
||||
child:
|
||||
Image.asset(AppImages.filter, height: 16, width: 16),
|
||||
),
|
||||
Visibility(
|
||||
visible: ctrl.selectedUser.value >= 1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: TextView(
|
||||
text: AppStrings.filter,
|
||||
style: 12.txtBoldWhite,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: TextView(
|
||||
text: AppStrings.filter,
|
||||
style: 12.txtBoldWhite,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Obx(
|
||||
() => ctrl.isSelected.value
|
||||
? Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 16),
|
||||
padding: EdgeInsets.all(16),
|
||||
color: AppColors.clrF2,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(
|
||||
text: "Plant",
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
CustomDropdown(
|
||||
backClr: AppColors.clrD9,
|
||||
borderClr: AppColors.clrGrey,
|
||||
items: ctrl.plantList,
|
||||
itemLabel: (item) => item,
|
||||
onSelected: (selected) {
|
||||
if (selected != null) {
|
||||
ctrl.selectedPlant.value = selected;
|
||||
}
|
||||
},
|
||||
hintText: 'Select Plant'),
|
||||
],
|
||||
)),
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(
|
||||
text: "Freight Bill No.",
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
CustomDropdown(
|
||||
backClr: AppColors.clrD9,
|
||||
borderClr: AppColors.clrGrey,
|
||||
items: ctrl.freightBillList,
|
||||
itemLabel: (item) => item,
|
||||
onSelected: (selected) {
|
||||
if (selected != null) {
|
||||
ctrl.selectedFreight.value =
|
||||
selected;
|
||||
}
|
||||
},
|
||||
hintText: 'Select Freight Number'),
|
||||
],
|
||||
)),
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(
|
||||
text: "Product Name",
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
CustomDropdown(
|
||||
backClr: AppColors.clrD9,
|
||||
borderClr: AppColors.clrGrey,
|
||||
items: ctrl.plantList,
|
||||
itemLabel: (item) => item,
|
||||
onSelected: (selected) {
|
||||
if (selected != null) {
|
||||
ctrl.selectedPlant.value = selected;
|
||||
}
|
||||
},
|
||||
hintText: 'Select Product'),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 12),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(
|
||||
text: "Plant",
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
CustomDropdown(
|
||||
backClr: AppColors.clrD9,
|
||||
borderClr: AppColors.clrGrey,
|
||||
items: ctrl.plantList,
|
||||
itemLabel: (item) => item,
|
||||
onSelected: (selected) {
|
||||
if (selected != null) {
|
||||
ctrl.selectedPlant.value =
|
||||
selected;
|
||||
}
|
||||
},
|
||||
hintText: 'Select Product'),
|
||||
],
|
||||
)),
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(
|
||||
text: "Transaction Type",
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
CustomDropdown(
|
||||
backClr: AppColors.clrD9,
|
||||
borderClr: AppColors.clrGrey,
|
||||
items: ctrl.plantList,
|
||||
itemLabel: (item) => item,
|
||||
onSelected: (selected) {
|
||||
if (selected != null) {
|
||||
ctrl.selectedPlant.value =
|
||||
selected;
|
||||
}
|
||||
},
|
||||
hintText: 'Select Product'),
|
||||
],
|
||||
)),
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
TextView(
|
||||
text: "",
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.end,
|
||||
children: [
|
||||
CommonBtn(
|
||||
bkClr: Colors.white,
|
||||
text: AppStrings.cancel,
|
||||
clickAction: () {
|
||||
ctrl.isSelected.value = false;
|
||||
},
|
||||
),
|
||||
SizedBox(width: 16),
|
||||
CommonBtn(
|
||||
text: AppStrings.submit,
|
||||
style: 14.txtSBoldWhite,
|
||||
clickAction: () {
|
||||
ctrl.isSelected.value = false;
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: SizedBox(),
|
||||
),
|
||||
Obx(() {
|
||||
switch (ctrl.selectedUser.value) {
|
||||
case 0:
|
||||
return GenerateFrightBill();
|
||||
case 1:
|
||||
return ViewFreightBill();
|
||||
default:
|
||||
case 2:
|
||||
return PendingGeneration();
|
||||
default :
|
||||
return SizedBox.shrink();
|
||||
}
|
||||
}),
|
||||
],
|
||||
|
|
|
@ -20,6 +20,14 @@ class TransportController extends GetxController {
|
|||
var selectProduct = ''.obs;
|
||||
var selectLocation = ''.obs;
|
||||
var selectTransactionType = ''.obs;
|
||||
RxString selectPlantFreight = ''.obs;
|
||||
var selectProductFreight = ''.obs;
|
||||
var selectLocationFreight = ''.obs;
|
||||
var selectTransactionTypeFreight = ''.obs;
|
||||
RxString selectPlantPending = ''.obs;
|
||||
var selectProductPending = ''.obs;
|
||||
var selectLocationPending = ''.obs;
|
||||
var selectTransactionTypePending = ''.obs;
|
||||
var selectedItem = false.obs;
|
||||
var grnDetails = <Content>[].obs;
|
||||
var product = <Prodect>[].obs;
|
||||
|
@ -27,6 +35,7 @@ class TransportController extends GetxController {
|
|||
var freightBill = [].obs;
|
||||
var fromLocation = [].obs;
|
||||
var grnList = [].obs;
|
||||
RxBool showE = false.obs;
|
||||
RxBool selectAllField = false.obs;
|
||||
|
||||
void toggleSelection(int index, bool? value) {
|
||||
|
@ -34,6 +43,36 @@ class TransportController extends GetxController {
|
|||
grnDetails.refresh();
|
||||
}
|
||||
|
||||
RxBool isFilterVisibleGenerateFreight = false.obs;
|
||||
RxBool isFilterVisiblePendingGeneration = false.obs;
|
||||
final int initialRecordCount = 20;
|
||||
|
||||
// Validation variables
|
||||
RxBool showPlantError = false.obs;
|
||||
RxBool showProductError = false.obs;
|
||||
RxBool showTransactionError = false.obs;
|
||||
|
||||
void toggleFilter() {
|
||||
// if (selectedUser.value == 0) {
|
||||
isFilterVisibleGenerateFreight.value =
|
||||
!isFilterVisibleGenerateFreight.value;
|
||||
if (!isFilterVisibleGenerateFreight.value) {
|
||||
clearFiltersGenerateFreightBill();
|
||||
}
|
||||
// }
|
||||
// if (selectedUser.value == 2) {
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
void togglePending(){
|
||||
isFilterVisiblePendingGeneration.value =
|
||||
!isFilterVisiblePendingGeneration.value;
|
||||
if (!isFilterVisiblePendingGeneration.value) {
|
||||
clearFiltersPendingGeneration();
|
||||
}
|
||||
}
|
||||
|
||||
void selectAll(bool value) {
|
||||
for (var item in grnDetails) {
|
||||
item.isSelected = value;
|
||||
|
@ -42,11 +81,39 @@ class TransportController extends GetxController {
|
|||
grnDetails.refresh();
|
||||
}
|
||||
|
||||
RxBool showPlantErrorFreight = false.obs;
|
||||
RxBool showProductErrorFreight = false.obs;
|
||||
RxBool showTransactionErrorFreight = false.obs;
|
||||
final selectProductValFreight = ''.obs;
|
||||
RxBool showPlantErrorPending = false.obs;
|
||||
RxBool showProductErrorPending = false.obs;
|
||||
RxBool showTransactionErrorPending = false.obs;
|
||||
|
||||
void validateFields() {
|
||||
showPlantError.value = selectPlant.value.isEmpty;
|
||||
showTransactionError.value = selectTransactionType.value.isEmpty;
|
||||
}
|
||||
|
||||
void validateFieldsPending() {
|
||||
showPlantErrorPending.value = selectPlantPending.value.isEmpty;
|
||||
showTransactionErrorPending.value =
|
||||
selectTransactionTypePending.value.isEmpty;
|
||||
showProductErrorPending.value = selectProductPending.value.isEmpty;
|
||||
}
|
||||
|
||||
void validateFieldsGenerateFreight() {
|
||||
showPlantErrorFreight.value = selectPlantFreight.value.isEmpty;
|
||||
showTransactionErrorFreight.value =
|
||||
selectTransactionTypeFreight.value.isEmpty;
|
||||
showProductErrorFreight.value = selectProductFreight.value.isEmpty;
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
getFreightBills();
|
||||
viewFreightView();
|
||||
grnPending();
|
||||
postData();
|
||||
|
||||
super.onInit();
|
||||
}
|
||||
|
@ -85,10 +152,10 @@ class TransportController extends GetxController {
|
|||
isLoading.value = true;
|
||||
|
||||
Map<String, String> requestBody = {
|
||||
"plant": selectPlant.value,
|
||||
"productNane": selectProduct.value,
|
||||
"transactionType": selectTransactionType.value,
|
||||
"fromLocation": selectLocation.value,
|
||||
"plant": "",
|
||||
"productNane": "",
|
||||
"transactionType": "",
|
||||
"fromLocation": "",
|
||||
"grnFromDate": "",
|
||||
"grnToDate": ""
|
||||
};
|
||||
|
@ -104,12 +171,115 @@ class TransportController extends GetxController {
|
|||
}
|
||||
}
|
||||
|
||||
void displayFilteredData() async {
|
||||
try {
|
||||
isLoading.value = true;
|
||||
Map<String, String> requestBody = {
|
||||
"plant": selectPlantFreight.value,
|
||||
"productNane": selectProductFreight.value,
|
||||
"transactionType": selectTransactionTypeFreight.value,
|
||||
"fromLocation": selectLocation.value,
|
||||
"grnFromDate": "",
|
||||
"grnToDate": ""
|
||||
};
|
||||
|
||||
|
||||
var response = await PostRequests.addFreightBill(requestBody);
|
||||
if (response != null) {
|
||||
|
||||
List<Content> flattenedContent =
|
||||
response.content!.expand((list) => list).toList();
|
||||
print("Flattened content size: ${flattenedContent.length}");
|
||||
print(
|
||||
"Filter criteria: Plant: ${selectPlantFreight.value}, Product: ${selectProductFreight.value}, Transaction: ${selectTransactionTypeFreight.value}");
|
||||
|
||||
List<Content> filteredData = flattenedContent.where((item) {
|
||||
return (selectPlantFreight.value.isEmpty ||
|
||||
item.plantCode == selectPlantFreight.value) &&
|
||||
(selectProductFreight.value.isEmpty ||
|
||||
item.materialCode == selectProductFreight.value) &&
|
||||
(selectTransactionTypeFreight.value.isEmpty ||
|
||||
item.codeValue == selectTransactionTypeFreight.value);
|
||||
}).toList();
|
||||
|
||||
print("Filtered Data: ${filteredData.length}");
|
||||
|
||||
grnDetails.assignAll(filteredData);
|
||||
|
||||
print("✅ Filtered Data: ${filteredData.length} items displayed.");
|
||||
print("✅ Filtered Data: ${grnDetails.length} items displayed.");
|
||||
} else {
|
||||
print("❌ No response from API.");
|
||||
}
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// void handleFilterSubmit() {
|
||||
// validateFieldsGenerateFreight();
|
||||
//
|
||||
// if (showPlantError.value ||
|
||||
// showProductError.value ||
|
||||
// showTransactionError.value) {
|
||||
// print('show errr');
|
||||
// } else {
|
||||
// postData();
|
||||
// }
|
||||
// }
|
||||
void handleFilterSubmitGenerateFreight() {
|
||||
validateFieldsGenerateFreight();
|
||||
if (selectPlantFreight.value.isEmpty ||
|
||||
selectProductFreight.value.isEmpty ||
|
||||
selectTransactionTypeFreight.value.isEmpty) {
|
||||
print('please fill data ');
|
||||
}
|
||||
else {
|
||||
displayFilteredData();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void handleFilterSubmitPendingGeneration() {
|
||||
validateFieldsPending();
|
||||
if (selectPlantPending.value.isEmpty ||
|
||||
selectProductPending.value.isEmpty ||
|
||||
selectTransactionTypePending.value.isEmpty) {
|
||||
}
|
||||
else {
|
||||
displayFilteredDataFromPending();
|
||||
|
||||
}
|
||||
}
|
||||
void clearFiltersGenerateFreightBill() {
|
||||
selectPlantFreight.value = '';
|
||||
selectProductFreight.value = '';
|
||||
selectTransactionTypeFreight.value = '';
|
||||
fromController.clear();
|
||||
showPlantError.value = false;
|
||||
showProductError.value = false;
|
||||
showTransactionError.value = false;
|
||||
postData();
|
||||
}
|
||||
|
||||
void clearFiltersPendingGeneration() {
|
||||
selectPlantPending.value = '';
|
||||
selectProductPending.value = '';
|
||||
selectTransactionTypePending.value = '';
|
||||
fromController.clear();
|
||||
showPlantErrorPending.value = false;
|
||||
showProductErrorPending.value = false;
|
||||
showTransactionErrorPending.value = false;
|
||||
postData();
|
||||
}
|
||||
getFreightBills() async {
|
||||
try {
|
||||
isLoading.value = true;
|
||||
|
||||
var response = await GetRequests.getFreightBill();
|
||||
if (response != null) {
|
||||
print("gtyfhg");
|
||||
plant.assignAll(response.plant ?? []);
|
||||
product.assignAll(response.prodect ?? []);
|
||||
freightBill.assignAll(response.freightBill ?? []);
|
||||
|
@ -150,21 +320,12 @@ class TransportController extends GetxController {
|
|||
"Plant 5",
|
||||
];
|
||||
RxString selectedFreight = "".obs;
|
||||
List freightBillList = [
|
||||
"Plant 1",
|
||||
"Plant 2",
|
||||
"Plant 3",
|
||||
"Plant 4",
|
||||
"Plant 5",
|
||||
];
|
||||
|
||||
addFreightBill() async {
|
||||
try {
|
||||
grnListLoader.value = true;
|
||||
|
||||
// Filter the selected rows
|
||||
final List<Map<String, dynamic>> selectedGrns = grnDetails
|
||||
.where((grn) => grn.isSelected) // Get only the selected rows
|
||||
.where((grn) => grn.isSelected)
|
||||
.map((grn) => {
|
||||
"grn_id": grn.grnId,
|
||||
"grn_no": grn.grnNo,
|
||||
|
@ -206,44 +367,11 @@ class TransportController extends GetxController {
|
|||
var pageSize = 2.obs;
|
||||
var sortField = "grn_date".obs;
|
||||
var sortDirection = "desc".obs;
|
||||
// viewFreightView({int? page, String? sort, String? direction}) async {
|
||||
// try {
|
||||
// freightViewLoader.value = true;
|
||||
//
|
||||
// currentPage.value = page ?? currentPage.value;
|
||||
// if (sort != null) sortField.value = sort;
|
||||
// if (direction != null) sortDirection.value = direction;
|
||||
//
|
||||
// Map<String, String> requestBody = {
|
||||
// "plant": "",
|
||||
// "productNane": "",
|
||||
// "freightBillNo": "",
|
||||
// "transactionType": "",
|
||||
// "fromLocation": "",
|
||||
// "grnFromDate": "",
|
||||
// "grnToDate": "",
|
||||
// "page": currentPage.toString(),
|
||||
// "size": pageSize.toString(),
|
||||
// "sort": "${sortField.value},${sortDirection.value}"
|
||||
// };
|
||||
//
|
||||
// var response = await PostRequests.viewFreightBill(requestBody,
|
||||
// currentPage.value, pageSize.value, '$sortField', '$sortDirection');
|
||||
// if (response != null) {
|
||||
// List<FreightBill> flattenedContent =
|
||||
// response.content!.expand((list) => list).toList();
|
||||
// freightBillData.assignAll(flattenedContent);
|
||||
//
|
||||
// totalPages.value = response.totalPages ?? 0;
|
||||
// totalElements.value = response.totalElements ?? 0;
|
||||
// }
|
||||
// } finally {
|
||||
// freightViewLoader.value = false;
|
||||
// }
|
||||
// }
|
||||
|
||||
RxInt currentPage = 1.obs;
|
||||
RxInt totalPages = 3.obs;
|
||||
final int limit = 10;
|
||||
|
||||
viewFreightView() async {
|
||||
try {
|
||||
freightViewLoader.value = true;
|
||||
|
@ -310,7 +438,9 @@ class TransportController extends GetxController {
|
|||
}
|
||||
|
||||
var grnPendingData = <GrnPending>[].obs;
|
||||
|
||||
grnPending() async {
|
||||
print('get pending');
|
||||
try {
|
||||
grnPendingLoader.value = true;
|
||||
|
||||
|
@ -330,39 +460,52 @@ class TransportController extends GetxController {
|
|||
List<GrnPending> flattenedContent =
|
||||
response.content!.expand((list) => list).toList();
|
||||
grnPendingData.assignAll(flattenedContent);
|
||||
print('response from pending tab${response.first.toString()} and ${flattenedContent.length} and ${grnPendingData.value[0].codeValue} and ${grnPendingData.value[0].plantCode} and ${grnPendingData.value[0].materialCode}');
|
||||
}
|
||||
} finally {
|
||||
grnPendingLoader.value = false;
|
||||
}
|
||||
}
|
||||
RxBool showPlantError = false.obs;
|
||||
RxBool showProductError = false.obs;
|
||||
RxBool showTransactionError = false.obs;
|
||||
final selectProductVal = Rx<dynamic>(null);
|
||||
RxBool showPlantErrorFreight = false.obs;
|
||||
RxBool showProductErrorFreight = false.obs;
|
||||
RxBool showTransactionErrorFreight = false.obs;
|
||||
final selectProductValFreight = Rx<dynamic>(null);
|
||||
RxBool showPlantErrorPending = false.obs;
|
||||
RxBool showProductErrorPending = false.obs;
|
||||
RxBool showTransactionErrorPending = false.obs;
|
||||
final selectProductValPending = Rx<dynamic>(null);
|
||||
|
||||
void displayFilteredDataFromPending() async {
|
||||
try {
|
||||
isLoading.value = true;
|
||||
Map<String, String> requestBody = {
|
||||
"plant": selectPlantPending.value,
|
||||
"productNane": selectProductPending.value,
|
||||
"transactionType": selectTransactionTypePending.value,
|
||||
"fromLocation": selectLocation.value,
|
||||
"grnFromDate": "",
|
||||
"grnToDate": ""
|
||||
};
|
||||
|
||||
|
||||
void validateFields() {
|
||||
showPlantError.value = selectPlant.value.isEmpty;
|
||||
showTransactionError.value = selectTransactionType.value.isEmpty;
|
||||
showProductError.value = selectProductVal.value == null;
|
||||
}
|
||||
void validateFieldsPending() {
|
||||
showPlantErrorPending.value = selectPlant.value.isEmpty;
|
||||
showTransactionErrorPending.value = selectTransactionType.value.isEmpty;
|
||||
showProductErrorPending.value = selectProductVal.value == null;
|
||||
}
|
||||
void validateFieldsFreight() {
|
||||
showPlantErrorFreight.value = selectPlant.value.isEmpty;
|
||||
showTransactionErrorFreight.value = selectTransactionType.value.isEmpty;
|
||||
showProductErrorFreight.value = selectProductVal.value == null;
|
||||
var response = await PostRequests.grnPending(requestBody);
|
||||
if (response != null) {
|
||||
|
||||
List<GrnPending> flattenedContent =
|
||||
response.content!.expand((list) => list).toList();
|
||||
|
||||
List<GrnPending> filteredData = flattenedContent.where((item) {
|
||||
return (selectPlantFreight.value.isEmpty ||
|
||||
item.plantCode == selectPlantFreight.value) &&
|
||||
(selectProductFreight.value.isEmpty ||
|
||||
item.materialCode == selectProductFreight.value) &&
|
||||
(selectTransactionTypeFreight.value.isEmpty ||
|
||||
item.codeValue == selectTransactionTypeFreight.value);
|
||||
}).toList();
|
||||
|
||||
print("pending Data: ${filteredData.length}");
|
||||
|
||||
grnPendingData.assignAll(filteredData);
|
||||
|
||||
print("✅ pending Data: ${filteredData.length} items displayed pending.");
|
||||
} else {
|
||||
print("❌ No response from API.");
|
||||
}
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -207,7 +207,7 @@ void showFreightBill(BuildContext context) {
|
|||
),
|
||||
Obx(() {
|
||||
if (controller.grnListLoader.value) {
|
||||
return Center(child: CircularProgressIndicator());
|
||||
return Center(child: CircularProgressIndicator(color: AppColors.primaryClr,));
|
||||
}
|
||||
|
||||
if (controller.errorMessage.isNotEmpty) {
|
||||
|
|
|
@ -54,7 +54,7 @@ class RemoteService {
|
|||
|
||||
try {
|
||||
final map = jsonDecode(response.body) as Map<String, dynamic>;
|
||||
AppAlerts.alert(message: '${map['message']}');
|
||||
// AppAlerts.alert(message: '${map['message']}');
|
||||
|
||||
throw map['message'];
|
||||
} catch (e) {
|
||||
|
@ -134,7 +134,7 @@ class RemoteService {
|
|||
} else {
|
||||
try {
|
||||
final map = jsonDecode(response.body) as Map<String, dynamic>;
|
||||
AppAlerts.alert(message: '${map['message']}');
|
||||
// AppAlerts.alert(message: '${map['message']}');
|
||||
|
||||
throw map['message'];
|
||||
} catch (e) {
|
||||
|
@ -157,7 +157,7 @@ class RemoteService {
|
|||
} else {
|
||||
try {
|
||||
final map = jsonDecode(response.body) as Map<String, dynamic>;
|
||||
AppAlerts.alert(message: '${map['message']}');
|
||||
// AppAlerts.alert(message: '${map['message']}');
|
||||
|
||||
throw map['message'];
|
||||
} catch (e) {
|
||||
|
@ -211,7 +211,7 @@ class RemoteService {
|
|||
} else {
|
||||
try {
|
||||
final map = jsonDecode(response.body) as Map<String, dynamic>;
|
||||
AppAlerts.alert(message: '${map['message']}');
|
||||
// AppAlerts.alert(message: '${map['message']}');
|
||||
|
||||
throw map['message'];
|
||||
} catch (e) {
|
||||
|
@ -237,7 +237,7 @@ class RemoteService {
|
|||
|
||||
try {
|
||||
final map = jsonDecode(response.body) as Map<String, dynamic>;
|
||||
AppAlerts.alert(message: '${map['message']}');
|
||||
// AppAlerts.alert(message: '${map['message']}');
|
||||
|
||||
throw map['message'];
|
||||
} catch (e) {
|
||||
|
@ -286,7 +286,7 @@ class RemoteService {
|
|||
} else {
|
||||
try {
|
||||
final map = jsonDecode(response.body) as Map<String, dynamic>;
|
||||
AppAlerts.alert(message: '${map['message']}');
|
||||
// AppAlerts.alert(message: '${map['message']}');
|
||||
throw map['message'];
|
||||
} catch (e) {
|
||||
return null;
|
||||
|
|
|
@ -305,5 +305,5 @@ packages:
|
|||
source: hosted
|
||||
version: "1.1.0"
|
||||
sdks:
|
||||
dart: ">=3.6.1 <4.0.0"
|
||||
dart: ">=3.6.0 <4.0.0"
|
||||
flutter: ">=3.18.0-18.0.pre.54"
|
||||
|
|
|
@ -19,7 +19,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||
version: 1.0.0+1
|
||||
|
||||
environment:
|
||||
sdk: ^3.6.1
|
||||
sdk: ^3.6.0
|
||||
|
||||
# Dependencies specify other packages that your package needs in order to work.
|
||||
# To automatically upgrade your package dependencies to the latest versions
|
||||
|
|
Loading…
Reference in New Issue