Compare commits
4 Commits
c49074b167
...
9f9db69a39
Author | SHA1 | Date |
---|---|---|
|
9f9db69a39 | |
|
42bbc67c2d | |
|
3cf903f44b | |
|
b8c648641f |
|
@ -1,5 +1,5 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:shayog/components/styles/app_colors.dart';
|
import 'package:shayog/components/styles/app_colors.dart';
|
||||||
import 'package:shayog/components/styles/textStyles.dart';
|
import 'package:shayog/components/styles/textStyles.dart';
|
||||||
class CustomDropdown<T> extends StatefulWidget {
|
class CustomDropdown<T> extends StatefulWidget {
|
||||||
|
@ -8,7 +8,7 @@ class CustomDropdown<T> extends StatefulWidget {
|
||||||
final Function(T?) onSelected;
|
final Function(T?) onSelected;
|
||||||
final String hintText;
|
final String hintText;
|
||||||
final bool enableSearch;
|
final bool enableSearch;
|
||||||
// final double width;
|
final double? width;
|
||||||
final EdgeInsetsGeometry padding;
|
final EdgeInsetsGeometry padding;
|
||||||
final T? initialValue; // Add initialValue parameter
|
final T? initialValue; // Add initialValue parameter
|
||||||
final bool showError;
|
final bool showError;
|
||||||
|
@ -22,7 +22,7 @@ class CustomDropdown<T> extends StatefulWidget {
|
||||||
required this.onSelected,
|
required this.onSelected,
|
||||||
required this.hintText,
|
required this.hintText,
|
||||||
this.enableSearch = true,
|
this.enableSearch = true,
|
||||||
// this.width = 100.0,
|
this.width,
|
||||||
this.padding = const EdgeInsets.all(8.0),
|
this.padding = const EdgeInsets.all(8.0),
|
||||||
this.initialValue, // Initialize with a value for edit mode
|
this.initialValue, // Initialize with a value for edit mode
|
||||||
this.showError = false,
|
this.showError = false,
|
||||||
|
@ -156,7 +156,7 @@ class _CustomDropdownState<T> extends State<CustomDropdown<T>> {
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Positioned(
|
Positioned(
|
||||||
width: 150,
|
width: widget.width?? 250,
|
||||||
child: CompositedTransformFollower(
|
child: CompositedTransformFollower(
|
||||||
link: layerLink,
|
link: layerLink,
|
||||||
showWhenUnlinked: false,
|
showWhenUnlinked: false,
|
||||||
|
|
|
@ -85,4 +85,7 @@ class AppStrings {
|
||||||
static const String cancelledInvoice = "Cancelled Invoice";
|
static const String cancelledInvoice = "Cancelled Invoice";
|
||||||
static const String ccnView = "CCN View";
|
static const String ccnView = "CCN View";
|
||||||
static const String transporterInbound = "Transporter Inbound Transaction";
|
static const String transporterInbound = "Transporter Inbound Transaction";
|
||||||
|
static const String billdayConfiguration = "Bill day Configuration";
|
||||||
|
static const String bufferdayConfiguration = "Buffer day Configuration";
|
||||||
|
static const String ccnConfiguration = "CCN Configuration";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,42 +1,300 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:get/get_core/src/get_main.dart';
|
||||||
|
import 'package:get/get_state_manager/src/rx_flutter/rx_obx_widget.dart';
|
||||||
|
import 'package:shayog/feature/presentation/screens/admin/configuration_management/configuration_screen_controller.dart';
|
||||||
|
|
||||||
|
import '../../../../../components/common/common_btn.dart';
|
||||||
|
import '../../../../../components/common/input_field.dart';
|
||||||
|
import '../../../../../components/styles/app_colors.dart';
|
||||||
|
import '../../../../../components/styles/app_images.dart';
|
||||||
|
import '../../../../../components/styles/app_strings.dart';
|
||||||
import '../../../widgets/custom_table.dart';
|
import '../../../widgets/custom_table.dart';
|
||||||
|
|
||||||
class ConfigurationScreen extends StatelessWidget {
|
class ConfigurationScreen extends StatefulWidget {
|
||||||
const ConfigurationScreen({super.key});
|
const ConfigurationScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ConfigurationScreen> createState() => _ConfigurationScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ConfigurationScreenState extends State<ConfigurationScreen> {
|
||||||
|
final ctrl = Get.put(ConfigurationScreenController());
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
// Row 1 (Header Row)
|
Container(
|
||||||
Row(
|
padding: EdgeInsets.only(bottom: 4),
|
||||||
|
margin: EdgeInsets.all(8),
|
||||||
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
CustomTable(text:"Header 1", isHeader: true),
|
Container(
|
||||||
CustomTable(text:"Header 2", isHeader: true),
|
margin: EdgeInsets.only(bottom: 12),
|
||||||
CustomTable(text:"Header 3", isHeader: true),
|
height: 45,
|
||||||
|
color: AppColors.primaryClr,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
ListView.separated(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return Obx(
|
||||||
|
() => InkWell(
|
||||||
|
onTap: () {
|
||||||
|
ctrl.selectedState.value = index;
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.only(bottom: 10, top: 10),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border(
|
||||||
|
bottom: BorderSide(
|
||||||
|
color:
|
||||||
|
ctrl.selectedState.value == index
|
||||||
|
? Colors.white
|
||||||
|
: AppColors.primaryClr,
|
||||||
|
width: 3))),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
ctrl.userTabs[index].title ?? "",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w900,
|
||||||
|
color: Colors.white),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
separatorBuilder: (context, index) {
|
||||||
|
return SizedBox(width: 16);
|
||||||
|
},
|
||||||
|
itemCount: ctrl.userTabs.length),
|
||||||
|
Spacer(),
|
||||||
|
InkWell(
|
||||||
|
child: Image.asset(AppImages.refresh,
|
||||||
|
height: 10, width: 10)),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text(
|
||||||
|
AppStrings.refresh,
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.white,
|
||||||
|
fontSize: 10,
|
||||||
|
fontWeight: FontWeight.normal),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Row(
|
),
|
||||||
children: [
|
|
||||||
CustomTable(text:"Row 1, Col 1"),
|
|
||||||
CustomTable(text:"Row 1, Col 2"),
|
|
||||||
CustomTable(text:"Row 1, Col 3"),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.all(16),
|
||||||
|
color: AppColors.clrF2,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
CustomTable(text:"Row 2, Col 1"),
|
Expanded(
|
||||||
CustomTable(text:"Row 2, Col 2"),
|
child: Column(
|
||||||
CustomTable(text:"Row 2, Col 3"),
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
_commonText(
|
||||||
|
"Plant",
|
||||||
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
InputField(
|
||||||
|
title: "Select Plant ",
|
||||||
|
),
|
||||||
|
// Obx(
|
||||||
|
// () => Container(
|
||||||
|
// padding: EdgeInsets.only(left: 8),
|
||||||
|
// height: 35,
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// borderRadius:
|
||||||
|
// BorderRadius.circular(4.0),
|
||||||
|
// color: AppColors.clrD9,
|
||||||
|
// border: Border.all(
|
||||||
|
// color: AppColors.clrGrey)),
|
||||||
|
// child: DropdownButton<String>(
|
||||||
|
// icon: Icon(
|
||||||
|
// Icons
|
||||||
|
// .keyboard_arrow_down_outlined,
|
||||||
|
// size: 20,
|
||||||
|
// color: AppColors.darkGrey),
|
||||||
|
//
|
||||||
|
// isExpanded: true,
|
||||||
|
// underline: SizedBox(),
|
||||||
|
//
|
||||||
|
// value: ctrl
|
||||||
|
// .selectedInvoice.value,
|
||||||
|
// // Use the selected value
|
||||||
|
// onChanged: (String? newValue) {
|
||||||
|
// if (newValue != null) {
|
||||||
|
// ctrl.selectedInvoice.value =
|
||||||
|
// newValue; // Update the selected value
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// items: ctrl.invoiceNoItems
|
||||||
|
// .map((String value) {
|
||||||
|
// return DropdownMenuItem<String>(
|
||||||
|
// value: value.toString(),
|
||||||
|
// child: Text(
|
||||||
|
// value,
|
||||||
|
// style: TextStyle(
|
||||||
|
// fontSize: 12,
|
||||||
|
// color:
|
||||||
|
// AppColors.darkGrey),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// }).toList(),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
SizedBox(width: 16),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
_commonText(
|
||||||
|
"User Name",
|
||||||
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
InputField(
|
||||||
|
title: "Select User Name",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
SizedBox(width: 16),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
_commonText(
|
||||||
|
"Product Name",
|
||||||
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
InputField(
|
||||||
|
title: "Select Product Name ",
|
||||||
|
),
|
||||||
|
// Obx(
|
||||||
|
// () => Container(
|
||||||
|
// padding: EdgeInsets.only(left: 8),
|
||||||
|
// height: 35,
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// borderRadius:
|
||||||
|
// BorderRadius.circular(4.0),
|
||||||
|
// color: AppColors.clrD9,
|
||||||
|
// border: Border.all(
|
||||||
|
// color: AppColors.clrGrey)),
|
||||||
|
// child: DropdownButton<String>(
|
||||||
|
// icon: Icon(
|
||||||
|
// Icons
|
||||||
|
// .keyboard_arrow_down_outlined,
|
||||||
|
// size: 20,
|
||||||
|
// color: AppColors.darkGrey),
|
||||||
|
//
|
||||||
|
// isExpanded: true,
|
||||||
|
// underline: SizedBox(),
|
||||||
|
//
|
||||||
|
// value: ctrl
|
||||||
|
// .selectedFreightNo.value,
|
||||||
|
// // Use the selected value
|
||||||
|
// onChanged: (String? newValue) {
|
||||||
|
// if (newValue != null) {
|
||||||
|
// ctrl
|
||||||
|
// .selectedFreightNo.value =
|
||||||
|
// newValue; // Update the selected value
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// items: ctrl.freightBillNoItems
|
||||||
|
// .map((String value) {
|
||||||
|
// return DropdownMenuItem<String>(
|
||||||
|
// value: value.toString(),
|
||||||
|
// child: Text(
|
||||||
|
// value,
|
||||||
|
// style: TextStyle(
|
||||||
|
// fontSize: 12,
|
||||||
|
// color:
|
||||||
|
// AppColors.darkGrey),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// }).toList(),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
],
|
||||||
|
)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.only(top: 16.0, left: 0, right: 8),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
_commonText(
|
||||||
|
"Bill day",
|
||||||
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
InputField(
|
||||||
|
title: "Select Bill Day",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
CommonBtn(
|
||||||
|
bkClr: Colors.white,
|
||||||
|
text: AppStrings.cancel,
|
||||||
|
clickAction: () {},
|
||||||
|
),
|
||||||
|
SizedBox(width: 16),
|
||||||
|
CommonBtn(
|
||||||
|
bkClr: Colors.white,
|
||||||
|
text: AppStrings.submit,
|
||||||
|
clickAction: () {},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_commonText(String title) {
|
||||||
|
return Text(
|
||||||
|
title,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 13, color: Colors.black, fontWeight: FontWeight.w900),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
import 'package:get/get_rx/src/rx_types/rx_types.dart';
|
||||||
|
import 'package:get/get_state_manager/src/simple/get_controllers.dart';
|
||||||
|
|
||||||
|
import '../../../../../components/common/common_model.dart';
|
||||||
|
import '../../../../../components/styles/app_strings.dart';
|
||||||
|
|
||||||
|
class ConfigurationScreenController extends GetxController{
|
||||||
|
var selectedState = 0.obs;
|
||||||
|
RxBool isSelected = false.obs;
|
||||||
|
RxList userTabs = <CommonModel>[
|
||||||
|
CommonModel(title: AppStrings.billdayConfiguration),
|
||||||
|
CommonModel(title: AppStrings.bufferdayConfiguration),
|
||||||
|
CommonModel(title: AppStrings.ccnConfiguration),
|
||||||
|
].obs;
|
||||||
|
var selectedInvoice = '41896424644'.obs; // Default value
|
||||||
|
var selectedFreightNo = '9841651635426'.obs; // Default value
|
||||||
|
void toggleContainer() {
|
||||||
|
isSelected.value = true;
|
||||||
|
print("isSelected.value..${isSelected.value}");
|
||||||
|
}
|
||||||
|
var invoiceNoItems = ['41896424644', '41896424644',
|
||||||
|
'41896424644', '41896424644','41896424644'].obs;
|
||||||
|
var freightBillNoItems = ['9841651635426','9841651635426','9841651635426','9841651635426','9841651635426'];
|
||||||
|
}
|
|
@ -342,10 +342,6 @@ class FreightBillScreen extends StatelessWidget {
|
||||||
TableRow(
|
TableRow(
|
||||||
decoration: BoxDecoration(color: AppColors.secondaryClr),
|
decoration: BoxDecoration(color: AppColors.secondaryClr),
|
||||||
children: [
|
children: [
|
||||||
_cellText(
|
|
||||||
text: "SR. No.",
|
|
||||||
clr: Colors.black,
|
|
||||||
fontWeight: FontWeight.bold),
|
|
||||||
_cellText(
|
_cellText(
|
||||||
text: "Transporter Name",
|
text: "Transporter Name",
|
||||||
clr: Colors.black,
|
clr: Colors.black,
|
||||||
|
@ -378,7 +374,6 @@ class FreightBillScreen extends StatelessWidget {
|
||||||
fontWeight: FontWeight.bold),
|
fontWeight: FontWeight.bold),
|
||||||
]),
|
]),
|
||||||
TableRow(children: [
|
TableRow(children: [
|
||||||
_cellText(text: "01"),
|
|
||||||
_cellText(text: "User 1"),
|
_cellText(text: "User 1"),
|
||||||
_cellText(text: "9841651635426", clr: AppColors.primaryClr),
|
_cellText(text: "9841651635426", clr: AppColors.primaryClr),
|
||||||
_cellText(text: "1 August 2024"),
|
_cellText(text: "1 August 2024"),
|
||||||
|
@ -389,7 +384,6 @@ class FreightBillScreen extends StatelessWidget {
|
||||||
_cellText(text: "78646646"),
|
_cellText(text: "78646646"),
|
||||||
]),
|
]),
|
||||||
TableRow(children: [
|
TableRow(children: [
|
||||||
_cellText(text: "02"),
|
|
||||||
_cellText(text: "User 2"),
|
_cellText(text: "User 2"),
|
||||||
_cellText(text: "9841651635426", clr: AppColors.primaryClr),
|
_cellText(text: "9841651635426", clr: AppColors.primaryClr),
|
||||||
_cellText(text: "1 August 2024"),
|
_cellText(text: "1 August 2024"),
|
||||||
|
@ -400,7 +394,6 @@ class FreightBillScreen extends StatelessWidget {
|
||||||
_cellText(text: "78646646"),
|
_cellText(text: "78646646"),
|
||||||
]),
|
]),
|
||||||
TableRow(children: [
|
TableRow(children: [
|
||||||
_cellText(text: "03"),
|
|
||||||
_cellText(text: "User 3"),
|
_cellText(text: "User 3"),
|
||||||
_cellText(text: "9841651635426", clr: AppColors.primaryClr),
|
_cellText(text: "9841651635426", clr: AppColors.primaryClr),
|
||||||
_cellText(text: "1 August 2024"),
|
_cellText(text: "1 August 2024"),
|
||||||
|
@ -411,7 +404,6 @@ class FreightBillScreen extends StatelessWidget {
|
||||||
_cellText(text: "-"),
|
_cellText(text: "-"),
|
||||||
]),
|
]),
|
||||||
TableRow(children: [
|
TableRow(children: [
|
||||||
_cellText(text: "04"),
|
|
||||||
_cellText(text: "User 4"),
|
_cellText(text: "User 4"),
|
||||||
_cellText(text: "9841651635426", clr: AppColors.primaryClr),
|
_cellText(text: "9841651635426", clr: AppColors.primaryClr),
|
||||||
_cellText(text: "1 August 2024"),
|
_cellText(text: "1 August 2024"),
|
||||||
|
@ -422,7 +414,6 @@ class FreightBillScreen extends StatelessWidget {
|
||||||
_cellText(text: "78646646"),
|
_cellText(text: "78646646"),
|
||||||
]),
|
]),
|
||||||
TableRow(children: [
|
TableRow(children: [
|
||||||
_cellText(text: "05"),
|
|
||||||
_cellText(text: "User 5"),
|
_cellText(text: "User 5"),
|
||||||
_cellText(text: "9841651635426", clr: AppColors.primaryClr),
|
_cellText(text: "9841651635426", clr: AppColors.primaryClr),
|
||||||
_cellText(text: "1 August 2024"),
|
_cellText(text: "1 August 2024"),
|
||||||
|
|
|
@ -6,6 +6,7 @@ import '../../../../../../components/styles/app_strings.dart';
|
||||||
|
|
||||||
class MasterCtrl extends GetxController{
|
class MasterCtrl extends GetxController{
|
||||||
var selectedUser = 0.obs;
|
var selectedUser = 0.obs;
|
||||||
|
RxBool isSelected = false.obs;
|
||||||
var supplierCode = 'Supplier Code'.obs;
|
var supplierCode = 'Supplier Code'.obs;
|
||||||
var bpGrouping = 'BP Grouping'.obs;
|
var bpGrouping = 'BP Grouping'.obs;
|
||||||
var accountGrp = 'Supplier Account Group'.obs;
|
var accountGrp = 'Supplier Account Group'.obs;
|
||||||
|
@ -24,4 +25,8 @@ class MasterCtrl extends GetxController{
|
||||||
CommonModel(title: AppStrings.plantMaster),
|
CommonModel(title: AppStrings.plantMaster),
|
||||||
|
|
||||||
].obs;
|
].obs;
|
||||||
|
void toggleContainer() {
|
||||||
|
isSelected.value = true;
|
||||||
|
print("isSelected.value..${isSelected.value}");
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,8 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import '../../../../../components/common/common_btn.dart';
|
||||||
import '../../../../../components/common/custom_drop_down.dart';
|
import '../../../../../components/common/custom_drop_down.dart';
|
||||||
|
import '../../../../../components/common/input_field.dart';
|
||||||
import '../../../../../components/styles/app_colors.dart';
|
import '../../../../../components/styles/app_colors.dart';
|
||||||
import '../../../../../components/styles/app_images.dart';
|
import '../../../../../components/styles/app_images.dart';
|
||||||
import '../../../../../components/styles/app_strings.dart';
|
import '../../../../../components/styles/app_strings.dart';
|
||||||
|
@ -79,6 +81,7 @@ class MasterScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
InkWell(
|
InkWell(
|
||||||
|
onTap: masterCtrl.toggleContainer,
|
||||||
child: Image.asset(AppImages.filter,
|
child: Image.asset(AppImages.filter,
|
||||||
height: 12, width: 12)),
|
height: 12, width: 12)),
|
||||||
Padding(
|
Padding(
|
||||||
|
@ -107,12 +110,370 @@ class MasterScreen extends StatelessWidget {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Obx(
|
||||||
|
() => masterCtrl.isSelected.value
|
||||||
|
? 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: [
|
||||||
|
_commonText(
|
||||||
|
"Supplier Code",
|
||||||
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
InputField(
|
||||||
|
title: "Enter Supplier Code ",
|
||||||
|
),
|
||||||
|
// Obx(
|
||||||
|
// () => Container(
|
||||||
|
// padding: EdgeInsets.only(left: 8),
|
||||||
|
// height: 35,
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// borderRadius:
|
||||||
|
// BorderRadius.circular(4.0),
|
||||||
|
// color: AppColors.clrD9,
|
||||||
|
// border: Border.all(
|
||||||
|
// color: AppColors.clrGrey)),
|
||||||
|
// child: DropdownButton<String>(
|
||||||
|
// icon: Icon(
|
||||||
|
// Icons
|
||||||
|
// .keyboard_arrow_down_outlined,
|
||||||
|
// size: 20,
|
||||||
|
// color: AppColors.darkGrey),
|
||||||
|
//
|
||||||
|
// isExpanded: true,
|
||||||
|
// underline: SizedBox(),
|
||||||
|
//
|
||||||
|
// value: ctrl
|
||||||
|
// .selectedInvoice.value,
|
||||||
|
// // Use the selected value
|
||||||
|
// onChanged: (String? newValue) {
|
||||||
|
// if (newValue != null) {
|
||||||
|
// ctrl.selectedInvoice.value =
|
||||||
|
// newValue; // Update the selected value
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// items: ctrl.invoiceNoItems
|
||||||
|
// .map((String value) {
|
||||||
|
// return DropdownMenuItem<String>(
|
||||||
|
// value: value.toString(),
|
||||||
|
// child: Text(
|
||||||
|
// value,
|
||||||
|
// style: TextStyle(
|
||||||
|
// fontSize: 12,
|
||||||
|
// color:
|
||||||
|
// AppColors.darkGrey),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// }).toList(),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
SizedBox(width: 16),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
_commonText(
|
||||||
|
"Supplier Name",
|
||||||
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
InputField(
|
||||||
|
title: "Enter Supplier Name",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
SizedBox(width: 16),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
_commonText(
|
||||||
|
"Supplier Account Group",
|
||||||
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
InputField(
|
||||||
|
title: "Supplier Account Group ",
|
||||||
|
),
|
||||||
|
// Obx(
|
||||||
|
// () => Container(
|
||||||
|
// padding: EdgeInsets.only(left: 8),
|
||||||
|
// height: 35,
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// borderRadius:
|
||||||
|
// BorderRadius.circular(4.0),
|
||||||
|
// color: AppColors.clrD9,
|
||||||
|
// border: Border.all(
|
||||||
|
// color: AppColors.clrGrey)),
|
||||||
|
// child: DropdownButton<String>(
|
||||||
|
// icon: Icon(
|
||||||
|
// Icons
|
||||||
|
// .keyboard_arrow_down_outlined,
|
||||||
|
// size: 20,
|
||||||
|
// color: AppColors.darkGrey),
|
||||||
|
//
|
||||||
|
// isExpanded: true,
|
||||||
|
// underline: SizedBox(),
|
||||||
|
//
|
||||||
|
// value: ctrl
|
||||||
|
// .selectedFreightNo.value,
|
||||||
|
// // Use the selected value
|
||||||
|
// onChanged: (String? newValue) {
|
||||||
|
// if (newValue != null) {
|
||||||
|
// ctrl
|
||||||
|
// .selectedFreightNo.value =
|
||||||
|
// newValue; // Update the selected value
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// items: ctrl.freightBillNoItems
|
||||||
|
// .map((String value) {
|
||||||
|
// return DropdownMenuItem<String>(
|
||||||
|
// value: value.toString(),
|
||||||
|
// child: Text(
|
||||||
|
// value,
|
||||||
|
// style: TextStyle(
|
||||||
|
// fontSize: 12,
|
||||||
|
// color:
|
||||||
|
// AppColors.darkGrey),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// }).toList(),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.only(top: 16.0, left: 0, right: 8),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
_commonText(
|
||||||
|
"State",
|
||||||
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
InputField(
|
||||||
|
title: "Select State ",
|
||||||
|
),
|
||||||
|
// Obx(
|
||||||
|
// () => Container(
|
||||||
|
// padding: EdgeInsets.only(left: 8),
|
||||||
|
// height: 35,
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// borderRadius:
|
||||||
|
// BorderRadius.circular(4.0),
|
||||||
|
// color: AppColors.clrD9,
|
||||||
|
// border: Border.all(
|
||||||
|
// color: AppColors.clrGrey)),
|
||||||
|
// child: DropdownButton<String>(
|
||||||
|
// icon: Icon(
|
||||||
|
// Icons
|
||||||
|
// .keyboard_arrow_down_outlined,
|
||||||
|
// size: 20,
|
||||||
|
// color: AppColors.darkGrey),
|
||||||
|
//
|
||||||
|
// isExpanded: true,
|
||||||
|
// underline: SizedBox(),
|
||||||
|
//
|
||||||
|
// value: ctrl
|
||||||
|
// .selectedInvoice.value,
|
||||||
|
// // Use the selected value
|
||||||
|
// onChanged: (String? newValue) {
|
||||||
|
// if (newValue != null) {
|
||||||
|
// ctrl.selectedInvoice.value =
|
||||||
|
// newValue; // Update the selected value
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// items: ctrl.invoiceNoItems
|
||||||
|
// .map((String value) {
|
||||||
|
// return DropdownMenuItem<String>(
|
||||||
|
// value: value.toString(),
|
||||||
|
// child: Text(
|
||||||
|
// value,
|
||||||
|
// style: TextStyle(
|
||||||
|
// fontSize: 12,
|
||||||
|
// color:
|
||||||
|
// AppColors.darkGrey),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// }).toList(),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
SizedBox(width: 16,),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
_commonText(
|
||||||
|
"BP Group",
|
||||||
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
InputField(
|
||||||
|
title: "Select BP Group ",
|
||||||
|
),
|
||||||
|
// Obx(
|
||||||
|
// () => Container(
|
||||||
|
// padding: EdgeInsets.only(left: 8),
|
||||||
|
// height: 35,
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// borderRadius:
|
||||||
|
// BorderRadius.circular(4.0),
|
||||||
|
// color: AppColors.clrD9,
|
||||||
|
// border: Border.all(
|
||||||
|
// color: AppColors.clrGrey)),
|
||||||
|
// child: DropdownButton<String>(
|
||||||
|
// icon: Icon(
|
||||||
|
// Icons
|
||||||
|
// .keyboard_arrow_down_outlined,
|
||||||
|
// size: 20,
|
||||||
|
// color: AppColors.darkGrey),
|
||||||
|
//
|
||||||
|
// isExpanded: true,
|
||||||
|
// underline: SizedBox(),
|
||||||
|
//
|
||||||
|
// value: ctrl
|
||||||
|
// .selectedInvoice.value,
|
||||||
|
// // Use the selected value
|
||||||
|
// onChanged: (String? newValue) {
|
||||||
|
// if (newValue != null) {
|
||||||
|
// ctrl.selectedInvoice.value =
|
||||||
|
// newValue; // Update the selected value
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// items: ctrl.invoiceNoItems
|
||||||
|
// .map((String value) {
|
||||||
|
// return DropdownMenuItem<String>(
|
||||||
|
// value: value.toString(),
|
||||||
|
// child: Text(
|
||||||
|
// value,
|
||||||
|
// style: TextStyle(
|
||||||
|
// fontSize: 12,
|
||||||
|
// color:
|
||||||
|
// AppColors.darkGrey),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// }).toList(),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
SizedBox(width: 16,),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
_commonText(
|
||||||
|
"Status",
|
||||||
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
InputField(
|
||||||
|
title: "Select Status ",
|
||||||
|
),
|
||||||
|
// Obx(
|
||||||
|
// () => Container(
|
||||||
|
// padding: EdgeInsets.only(left: 8),
|
||||||
|
// height: 35,
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// borderRadius:
|
||||||
|
// BorderRadius.circular(4.0),
|
||||||
|
// color: AppColors.clrD9,
|
||||||
|
// border: Border.all(
|
||||||
|
// color: AppColors.clrGrey)),
|
||||||
|
// child: DropdownButton<String>(
|
||||||
|
// icon: Icon(
|
||||||
|
// Icons
|
||||||
|
// .keyboard_arrow_down_outlined,
|
||||||
|
// size: 20,
|
||||||
|
// color: AppColors.darkGrey),
|
||||||
|
//
|
||||||
|
// isExpanded: true,
|
||||||
|
// underline: SizedBox(),
|
||||||
|
//
|
||||||
|
// value: ctrl
|
||||||
|
// .selectedInvoice.value,
|
||||||
|
// // Use the selected value
|
||||||
|
// onChanged: (String? newValue) {
|
||||||
|
// if (newValue != null) {
|
||||||
|
// ctrl.selectedInvoice.value =
|
||||||
|
// newValue; // Update the selected value
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// items: ctrl.invoiceNoItems
|
||||||
|
// .map((String value) {
|
||||||
|
// return DropdownMenuItem<String>(
|
||||||
|
// value: value.toString(),
|
||||||
|
// child: Text(
|
||||||
|
// value,
|
||||||
|
// style: TextStyle(
|
||||||
|
// fontSize: 12,
|
||||||
|
// color:
|
||||||
|
// AppColors.darkGrey),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// }).toList(),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
CommonBtn(
|
||||||
|
bkClr: Colors.white,
|
||||||
|
text: AppStrings.cancel,
|
||||||
|
clickAction: () {},
|
||||||
|
),
|
||||||
|
SizedBox(width: 16),
|
||||||
|
CommonBtn(
|
||||||
|
text: AppStrings.submit,
|
||||||
|
|
||||||
|
clickAction: () {},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: SizedBox(),
|
||||||
|
),
|
||||||
|
SizedBox(height: 20,),
|
||||||
Obx(() {
|
Obx(() {
|
||||||
switch (masterCtrl.selectedUser.value) {
|
switch (masterCtrl.selectedUser.value) {
|
||||||
case 0:
|
case 0:
|
||||||
return _tableView();
|
return _tableView();
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return Text("");
|
return Text("");
|
||||||
}
|
}
|
||||||
|
@ -129,10 +490,11 @@ _tableView(){
|
||||||
TableRow(
|
TableRow(
|
||||||
decoration: BoxDecoration(color: AppColors.secondaryClr),
|
decoration: BoxDecoration(color: AppColors.secondaryClr),
|
||||||
children: [
|
children: [
|
||||||
_cellText(text: "SR. No."),
|
// _cellText(text: "SR. No."),
|
||||||
//CustomTable(text: "SR. NO."),
|
//CustomTable(text: "SR. NO."),
|
||||||
CustomDropdown<String>(
|
CustomDropdown<String>(
|
||||||
items: masterCtrl.supplier,
|
items: masterCtrl.supplier,
|
||||||
|
backClr: AppColors.clrD9,
|
||||||
itemLabel: (item) => item,
|
itemLabel: (item) => item,
|
||||||
onSelected: (selected) {
|
onSelected: (selected) {
|
||||||
if (selected != null) {
|
if (selected != null) {
|
||||||
|
@ -142,6 +504,7 @@ _tableView(){
|
||||||
hintText: 'Supplier Code'),
|
hintText: 'Supplier Code'),
|
||||||
CustomDropdown<String>(
|
CustomDropdown<String>(
|
||||||
items: masterCtrl.supplier,
|
items: masterCtrl.supplier,
|
||||||
|
backClr: AppColors.clrD9,
|
||||||
itemLabel: (item) => item,
|
itemLabel: (item) => item,
|
||||||
onSelected: (selected) {
|
onSelected: (selected) {
|
||||||
if (selected != null) {
|
if (selected != null) {
|
||||||
|
@ -151,6 +514,7 @@ _tableView(){
|
||||||
hintText: 'BP Grouping'),
|
hintText: 'BP Grouping'),
|
||||||
CustomDropdown<String>(
|
CustomDropdown<String>(
|
||||||
items: masterCtrl.supplier,
|
items: masterCtrl.supplier,
|
||||||
|
backClr: AppColors.clrD9,
|
||||||
itemLabel: (item) => item,
|
itemLabel: (item) => item,
|
||||||
onSelected: (selected) {
|
onSelected: (selected) {
|
||||||
if (selected != null) {
|
if (selected != null) {
|
||||||
|
@ -160,6 +524,7 @@ _tableView(){
|
||||||
hintText: 'Supplier Account Group'),
|
hintText: 'Supplier Account Group'),
|
||||||
CustomDropdown<String>(
|
CustomDropdown<String>(
|
||||||
items: masterCtrl.supplier,
|
items: masterCtrl.supplier,
|
||||||
|
backClr: AppColors.clrD9,
|
||||||
itemLabel: (item) => item,
|
itemLabel: (item) => item,
|
||||||
onSelected: (selected) {
|
onSelected: (selected) {
|
||||||
if (selected != null) {
|
if (selected != null) {
|
||||||
|
@ -170,7 +535,6 @@ _tableView(){
|
||||||
_cellText(text: "Legal Entity"),
|
_cellText(text: "Legal Entity"),
|
||||||
]),
|
]),
|
||||||
TableRow(children: [
|
TableRow(children: [
|
||||||
_cellText(text: "01"),
|
|
||||||
_cellText(text: "11059440"),
|
_cellText(text: "11059440"),
|
||||||
_cellText(text: "ZIPT"),
|
_cellText(text: "ZIPT"),
|
||||||
_cellText(text: "ZIPT"),
|
_cellText(text: "ZIPT"),
|
||||||
|
@ -178,7 +542,6 @@ _tableView(){
|
||||||
_cellText(text: "0"),
|
_cellText(text: "0"),
|
||||||
]),
|
]),
|
||||||
TableRow(children: [
|
TableRow(children: [
|
||||||
_cellText(text: "02"),
|
|
||||||
_cellText(text: "11059440"),
|
_cellText(text: "11059440"),
|
||||||
_cellText(text: "ZIPT"),
|
_cellText(text: "ZIPT"),
|
||||||
_cellText(text: "ZIPT"),
|
_cellText(text: "ZIPT"),
|
||||||
|
@ -187,7 +550,6 @@ _tableView(){
|
||||||
|
|
||||||
]),
|
]),
|
||||||
TableRow(children: [
|
TableRow(children: [
|
||||||
_cellText(text: "03"),
|
|
||||||
_cellText(text: "11059440"),
|
_cellText(text: "11059440"),
|
||||||
_cellText(text: "ZIPT"),
|
_cellText(text: "ZIPT"),
|
||||||
_cellText(text: "ZIPT"),
|
_cellText(text: "ZIPT"),
|
||||||
|
@ -195,7 +557,6 @@ _tableView(){
|
||||||
_cellText(text: "0"),
|
_cellText(text: "0"),
|
||||||
]),
|
]),
|
||||||
TableRow(children: [
|
TableRow(children: [
|
||||||
_cellText(text: "04"),
|
|
||||||
_cellText(text: "11059440"),
|
_cellText(text: "11059440"),
|
||||||
_cellText(text: "ZIPT"),
|
_cellText(text: "ZIPT"),
|
||||||
_cellText(text: "ZIPT"),
|
_cellText(text: "ZIPT"),
|
||||||
|
@ -219,4 +580,11 @@ _tableView(){
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
_commonText(String title) {
|
||||||
|
return Text(
|
||||||
|
title,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 13, color: Colors.black, fontWeight: FontWeight.w900),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,13 +2,13 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:shayog/components/common/common_button.dart';
|
import 'package:shayog/components/common/common_button.dart';
|
||||||
import 'package:shayog/feature/presentation/widgets/text_view.dart';
|
import 'package:shayog/feature/presentation/widgets/text_view.dart';
|
||||||
import '../../../../../components/common/common_btn.dart';
|
import '../../../../../../components/common/common_btn.dart';
|
||||||
import '../../../../../components/common/custom_drop_down.dart';
|
import '../../../../../../components/common/custom_drop_down.dart';
|
||||||
import '../../../../../components/common/input_field.dart';
|
import '../../../../../../components/common/input_field.dart';
|
||||||
import '../../../../../components/styles/app_colors.dart';
|
import '../../../../../../components/styles/app_colors.dart';
|
||||||
import '../../../../../components/styles/app_strings.dart';
|
import '../../../../../../components/styles/app_strings.dart';
|
||||||
import '../../../../../utils/validations.dart';
|
import '../../../../../../utils/validations.dart';
|
||||||
import '../../dashboard/controller/dashboard_ctrl.dart';
|
import '../../../dashboard/controller/dashboard_ctrl.dart';
|
||||||
|
|
||||||
class AddInternalUser extends StatelessWidget {
|
class AddInternalUser extends StatelessWidget {
|
||||||
AddInternalUser({super.key});
|
AddInternalUser({super.key});
|
||||||
|
@ -35,7 +35,6 @@ class AddInternalUser extends StatelessWidget {
|
||||||
children: [
|
children: [
|
||||||
TextView(
|
TextView(
|
||||||
text: AppStrings.firstName,
|
text: AppStrings.firstName,
|
||||||
|
|
||||||
),
|
),
|
||||||
SizedBox(height: 8),
|
SizedBox(height: 8),
|
||||||
InputField(
|
InputField(
|
||||||
|
@ -93,7 +92,7 @@ class AddInternalUser extends StatelessWidget {
|
||||||
),
|
),
|
||||||
SizedBox(height: 8),
|
SizedBox(height: 8),
|
||||||
CustomDropdown(
|
CustomDropdown(
|
||||||
initialValue: ctrl.selectUserVal.value,
|
initialValue: ctrl.userTypeList[1],
|
||||||
backClr: AppColors.clrD9,
|
backClr: AppColors.clrD9,
|
||||||
borderClr: AppColors.clrGrey,
|
borderClr: AppColors.clrGrey,
|
||||||
items: ctrl.userTypeList,
|
items: ctrl.userTypeList,
|
||||||
|
@ -129,7 +128,7 @@ class AddInternalUser extends StatelessWidget {
|
||||||
),
|
),
|
||||||
SizedBox(height: 8),
|
SizedBox(height: 8),
|
||||||
CustomDropdown(
|
CustomDropdown(
|
||||||
initialValue: ctrl.selectedStatus.value,
|
initialValue: ctrl.status[0],
|
||||||
backClr: AppColors.clrD9,
|
backClr: AppColors.clrD9,
|
||||||
borderClr: AppColors.clrGrey,
|
borderClr: AppColors.clrGrey,
|
||||||
items: ctrl.status,
|
items: ctrl.status,
|
||||||
|
@ -197,12 +196,12 @@ class AddInternalUser extends StatelessWidget {
|
||||||
height: 30,
|
height: 30,
|
||||||
width: 100,
|
width: 100,
|
||||||
borderRadius: 4,
|
borderRadius: 4,
|
||||||
isLoading: ctrl.employeeCodeCtrl.text.isEmpty ? ctrl.isLoading : ctrl.editLoading,
|
isLoading: ctrl.employeeCodeCtrl.text.isEmpty
|
||||||
|
? ctrl.isLoading
|
||||||
|
: ctrl.editLoading,
|
||||||
text: ctrl.employeeCodeCtrl.text.isEmpty
|
text: ctrl.employeeCodeCtrl.text.isEmpty
|
||||||
? AppStrings.add
|
? AppStrings.add
|
||||||
: AppStrings.edit,
|
: AppStrings.edit,
|
||||||
|
|
||||||
|
|
||||||
clickAction: () {
|
clickAction: () {
|
||||||
ctrl.employeeCodeCtrl.text.isEmpty
|
ctrl.employeeCodeCtrl.text.isEmpty
|
||||||
? ctrl.createUser()
|
? ctrl.createUser()
|
|
@ -1,11 +1,11 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:shayog/components/common/common_button.dart';
|
|
||||||
import 'package:shayog/components/styles/textStyles.dart';
|
import 'package:shayog/components/styles/textStyles.dart';
|
||||||
import '../../../../../components/common/common_btn.dart';
|
import '../../../../../components/common/common_btn.dart';
|
||||||
import '../../../../../components/common/data_cell.dart';
|
import '../../../../../components/common/data_cell.dart';
|
||||||
import '../../../../../components/styles/app_colors.dart';
|
import '../../../../../components/styles/app_colors.dart';
|
||||||
|
import '../../../widgets/custom_pagination.dart';
|
||||||
import '../../dashboard/controller/dashboard_ctrl.dart';
|
import '../../dashboard/controller/dashboard_ctrl.dart';
|
||||||
|
|
||||||
class ManageUser extends StatelessWidget {
|
class ManageUser extends StatelessWidget {
|
||||||
|
@ -16,8 +16,8 @@ class ManageUser extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
Obx(() {
|
Obx(() {
|
||||||
if (controller.userLoading.value) {
|
if (controller.userLoading.value) {
|
||||||
|
@ -25,6 +25,8 @@ class ManageUser extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
Scrollbar(
|
Scrollbar(
|
||||||
thumbVisibility: true,
|
thumbVisibility: true,
|
||||||
|
@ -61,7 +63,7 @@ class ManageUser extends StatelessWidget {
|
||||||
top: BorderSide(color: AppColors.clrGrey),
|
top: BorderSide(color: AppColors.clrGrey),
|
||||||
),
|
),
|
||||||
columns: [
|
columns: [
|
||||||
dataColumn("Sr.No."),
|
// dataColumn("Sr.No."),
|
||||||
dataColumn("User Name"),
|
dataColumn("User Name"),
|
||||||
dataColumn("Email ID"),
|
dataColumn("Email ID"),
|
||||||
dataColumn("Employee/\nTransporter Code"),
|
dataColumn("Employee/\nTransporter Code"),
|
||||||
|
@ -84,15 +86,15 @@ class ManageUser extends StatelessWidget {
|
||||||
// controller.toggleSelection(index, value ?? false);
|
// controller.toggleSelection(index, value ?? false);
|
||||||
// },
|
// },
|
||||||
cells: [
|
cells: [
|
||||||
editableCell(index, ""
|
// editableCell(index, ""
|
||||||
"${index + 1}"),
|
// "${index + 1}"),
|
||||||
editableCell(index, stoppage.userName ?? ""),
|
editableCell(index, stoppage.userName ?? "-"),
|
||||||
editableCell(index, stoppage.userEmail ?? ""),
|
editableCell(index, stoppage.userEmail ?? "-"),
|
||||||
editableCell(
|
editableCell(
|
||||||
index, stoppage.userEmpTransCode ?? ""),
|
index, stoppage.userEmpTransCode ?? "-"),
|
||||||
editableCell(index, stoppage.userMobile ?? ""),
|
editableCell(index, stoppage.userMobile ?? "-"),
|
||||||
editableCell(
|
editableCell(
|
||||||
index, stoppage.usertypeName ?? ""),
|
index, stoppage.usertypeName ?? "-"),
|
||||||
editableCell(
|
editableCell(
|
||||||
index, stoppage.createdBy.toString()),
|
index, stoppage.createdBy.toString()),
|
||||||
editableCell(
|
editableCell(
|
||||||
|
@ -107,7 +109,9 @@ class ManageUser extends StatelessWidget {
|
||||||
DateFormat("d MMMM yyyy").format(
|
DateFormat("d MMMM yyyy").format(
|
||||||
DateTime.parse(
|
DateTime.parse(
|
||||||
'${stoppage.lastUpdatedOn}'))),
|
'${stoppage.lastUpdatedOn}'))),
|
||||||
editableCell(index, stoppage.status.toString()),
|
|
||||||
|
editableCell(index, stoppage.status == "A" ? "Active":"In-Active"),
|
||||||
|
|
||||||
DataCell(CommonBtn(
|
DataCell(CommonBtn(
|
||||||
style: 8.txtSBoldWhite,
|
style: 8.txtSBoldWhite,
|
||||||
margin: EdgeInsets.symmetric(vertical: 6),
|
margin: EdgeInsets.symmetric(vertical: 6),
|
||||||
|
@ -145,26 +149,21 @@ class ManageUser extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 16),
|
SizedBox(height: 16),
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
|
||||||
children: [
|
|
||||||
CommonButton(
|
|
||||||
height: 30,
|
|
||||||
width: 100,
|
|
||||||
text: "Previous",
|
|
||||||
clickAction: controller.previousPage),
|
|
||||||
Text(
|
|
||||||
'Page ${controller.currentPage.value} of ${controller.totalPages.value}'),
|
|
||||||
CommonButton(
|
|
||||||
height: 30,
|
|
||||||
width: 100,
|
|
||||||
text: "Next",
|
|
||||||
clickAction: controller.nextPage),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
CustomPagination(
|
||||||
|
currentPage: controller.currentPage.value,
|
||||||
|
totalPages: controller.totalPages.value,
|
||||||
|
onPageChanged: (int page) {
|
||||||
|
controller.onPageChanged(page);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ String editUserResModelToJson(EditUserResModel data) =>
|
||||||
class EditUserResModel {
|
class EditUserResModel {
|
||||||
final int? status;
|
final int? status;
|
||||||
final String? message;
|
final String? message;
|
||||||
final Data? data;
|
final EditUser? data;
|
||||||
final DateTime? timestamp;
|
final DateTime? timestamp;
|
||||||
|
|
||||||
EditUserResModel({
|
EditUserResModel({
|
||||||
|
@ -23,7 +23,7 @@ class EditUserResModel {
|
||||||
EditUserResModel(
|
EditUserResModel(
|
||||||
status: json["status"],
|
status: json["status"],
|
||||||
message: json["message"],
|
message: json["message"],
|
||||||
data: json["data"] == null ? null : Data.fromJson(json["data"]),
|
data: json["data"] == null ? null : EditUser.fromJson(json["data"]),
|
||||||
timestamp: json["timestamp"] == null
|
timestamp: json["timestamp"] == null
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json["timestamp"]),
|
: DateTime.parse(json["timestamp"]),
|
||||||
|
@ -37,20 +37,20 @@ class EditUserResModel {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
class Data {
|
class EditUser {
|
||||||
final String? action;
|
final String? action;
|
||||||
final String? employeeTransCode;
|
final String? employeeTransCode;
|
||||||
final int? userId;
|
final int? userId;
|
||||||
final String? email;
|
final String? email;
|
||||||
|
|
||||||
Data({
|
EditUser({
|
||||||
this.action,
|
this.action,
|
||||||
this.employeeTransCode,
|
this.employeeTransCode,
|
||||||
this.userId,
|
this.userId,
|
||||||
this.email,
|
this.email,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory Data.fromJson(Map<String, dynamic> json) => Data(
|
factory EditUser.fromJson(Map<String, dynamic> json) => EditUser(
|
||||||
action: json["action"],
|
action: json["action"],
|
||||||
employeeTransCode: json["employeeTransCode"],
|
employeeTransCode: json["employeeTransCode"],
|
||||||
userId: json["userId"],
|
userId: json["userId"],
|
||||||
|
|
|
@ -9,84 +9,56 @@ GetAllUserResModel getAllUserResModelFromJson(String str) => GetAllUserResModel.
|
||||||
String getAllUserResModelToJson(GetAllUserResModel data) => json.encode(data.toJson());
|
String getAllUserResModelToJson(GetAllUserResModel data) => json.encode(data.toJson());
|
||||||
|
|
||||||
class GetAllUserResModel {
|
class GetAllUserResModel {
|
||||||
final int? status;
|
final List<List<AllUser>>? content;
|
||||||
final String? message;
|
|
||||||
final UserData? data;
|
|
||||||
final DateTime? timestamp;
|
|
||||||
|
|
||||||
GetAllUserResModel({
|
|
||||||
this.status,
|
|
||||||
this.message,
|
|
||||||
this.data,
|
|
||||||
this.timestamp,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory GetAllUserResModel.fromJson(Map<String, dynamic> json) => GetAllUserResModel(
|
|
||||||
status: json["status"],
|
|
||||||
message: json["message"],
|
|
||||||
data: json["data"] == null ? null : UserData.fromJson(json["data"]),
|
|
||||||
timestamp: json["timestamp"] == null ? null : DateTime.parse(json["timestamp"]),
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
|
||||||
"status": status,
|
|
||||||
"message": message,
|
|
||||||
"data": data?.toJson(),
|
|
||||||
"timestamp": timestamp?.toIso8601String(),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
class UserData {
|
|
||||||
final List<AllUser>? content;
|
|
||||||
final Pageable? pageable;
|
final Pageable? pageable;
|
||||||
final bool? last;
|
final bool? last;
|
||||||
final int? totalElements;
|
final int? totalElements;
|
||||||
final int? totalPages;
|
final int? totalPages;
|
||||||
final bool? first;
|
|
||||||
final int? size;
|
final int? size;
|
||||||
final int? number;
|
final int? number;
|
||||||
final Sort? sort;
|
final Sort? sort;
|
||||||
|
final bool? first;
|
||||||
final int? numberOfElements;
|
final int? numberOfElements;
|
||||||
final bool? empty;
|
final bool? empty;
|
||||||
|
|
||||||
UserData({
|
GetAllUserResModel({
|
||||||
this.content,
|
this.content,
|
||||||
this.pageable,
|
this.pageable,
|
||||||
this.last,
|
this.last,
|
||||||
this.totalElements,
|
this.totalElements,
|
||||||
this.totalPages,
|
this.totalPages,
|
||||||
this.first,
|
|
||||||
this.size,
|
this.size,
|
||||||
this.number,
|
this.number,
|
||||||
this.sort,
|
this.sort,
|
||||||
|
this.first,
|
||||||
this.numberOfElements,
|
this.numberOfElements,
|
||||||
this.empty,
|
this.empty,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory UserData.fromJson(Map<String, dynamic> json) => UserData(
|
factory GetAllUserResModel.fromJson(Map<String, dynamic> json) => GetAllUserResModel(
|
||||||
content: json["content"] == null ? [] : List<AllUser>.from(json["content"]!.map((x) => AllUser.fromJson(x))),
|
content: json["content"] == null ? [] : List<List<AllUser>>.from(json["content"]!.map((x) => List<AllUser>.from(x.map((x) => AllUser.fromJson(x))))),
|
||||||
pageable: json["pageable"] == null ? null : Pageable.fromJson(json["pageable"]),
|
pageable: json["pageable"] == null ? null : Pageable.fromJson(json["pageable"]),
|
||||||
last: json["last"],
|
last: json["last"],
|
||||||
totalElements: json["totalElements"],
|
totalElements: json["totalElements"],
|
||||||
totalPages: json["totalPages"],
|
totalPages: json["totalPages"],
|
||||||
first: json["first"],
|
|
||||||
size: json["size"],
|
size: json["size"],
|
||||||
number: json["number"],
|
number: json["number"],
|
||||||
sort: json["sort"] == null ? null : Sort.fromJson(json["sort"]),
|
sort: json["sort"] == null ? null : Sort.fromJson(json["sort"]),
|
||||||
|
first: json["first"],
|
||||||
numberOfElements: json["numberOfElements"],
|
numberOfElements: json["numberOfElements"],
|
||||||
empty: json["empty"],
|
empty: json["empty"],
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
"content": content == null ? [] : List<dynamic>.from(content!.map((x) => x.toJson())),
|
"content": content == null ? [] : List<dynamic>.from(content!.map((x) => List<dynamic>.from(x.map((x) => x.toJson())))),
|
||||||
"pageable": pageable?.toJson(),
|
"pageable": pageable?.toJson(),
|
||||||
"last": last,
|
"last": last,
|
||||||
"totalElements": totalElements,
|
"totalElements": totalElements,
|
||||||
"totalPages": totalPages,
|
"totalPages": totalPages,
|
||||||
"first": first,
|
|
||||||
"size": size,
|
"size": size,
|
||||||
"number": number,
|
"number": number,
|
||||||
"sort": sort?.toJson(),
|
"sort": sort?.toJson(),
|
||||||
|
"first": first,
|
||||||
"numberOfElements": numberOfElements,
|
"numberOfElements": numberOfElements,
|
||||||
"empty": empty,
|
"empty": empty,
|
||||||
};
|
};
|
||||||
|
@ -98,17 +70,18 @@ class AllUser {
|
||||||
final String? usertypeName;
|
final String? usertypeName;
|
||||||
final String? userName;
|
final String? userName;
|
||||||
final String? userFname;
|
final String? userFname;
|
||||||
final String? userLname;
|
final dynamic userMname;
|
||||||
|
final dynamic userLname;
|
||||||
final String? userEmail;
|
final String? userEmail;
|
||||||
final String? userMobile;
|
final String? userMobile;
|
||||||
final String? userEmpTransCode;
|
final String? userEmpTransCode;
|
||||||
final String? userAddedChannel;
|
final String? userAddedChannel;
|
||||||
final String? status;
|
final String? status;
|
||||||
final DateTime? createdOn;
|
final DateTime? createdOn;
|
||||||
final int? createdBy;
|
final String? createdBy;
|
||||||
final DateTime? lastUpdatedOn;
|
final DateTime? lastUpdatedOn;
|
||||||
final int? lastUpdatedBy;
|
final String? lastUpdatedBy;
|
||||||
final bool isSelected;
|
bool isSelected;
|
||||||
|
|
||||||
AllUser({
|
AllUser({
|
||||||
this.userId,
|
this.userId,
|
||||||
|
@ -116,6 +89,7 @@ class AllUser {
|
||||||
this.usertypeName,
|
this.usertypeName,
|
||||||
this.userName,
|
this.userName,
|
||||||
this.userFname,
|
this.userFname,
|
||||||
|
this.userMname,
|
||||||
this.userLname,
|
this.userLname,
|
||||||
this.userEmail,
|
this.userEmail,
|
||||||
this.userMobile,
|
this.userMobile,
|
||||||
|
@ -126,7 +100,7 @@ class AllUser {
|
||||||
this.createdBy,
|
this.createdBy,
|
||||||
this.lastUpdatedOn,
|
this.lastUpdatedOn,
|
||||||
this.lastUpdatedBy,
|
this.lastUpdatedBy,
|
||||||
this.isSelected = false
|
this.isSelected = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory AllUser.fromJson(Map<String, dynamic> json) => AllUser(
|
factory AllUser.fromJson(Map<String, dynamic> json) => AllUser(
|
||||||
|
@ -135,6 +109,7 @@ class AllUser {
|
||||||
usertypeName: json["usertype_name"],
|
usertypeName: json["usertype_name"],
|
||||||
userName: json["user_name"],
|
userName: json["user_name"],
|
||||||
userFname: json["user_fname"],
|
userFname: json["user_fname"],
|
||||||
|
userMname: json["user_mname"],
|
||||||
userLname: json["user_lname"],
|
userLname: json["user_lname"],
|
||||||
userEmail: json["user_email"],
|
userEmail: json["user_email"],
|
||||||
userMobile: json["user_mobile"],
|
userMobile: json["user_mobile"],
|
||||||
|
@ -153,6 +128,7 @@ class AllUser {
|
||||||
"usertype_name": usertypeName,
|
"usertype_name": usertypeName,
|
||||||
"user_name": userName,
|
"user_name": userName,
|
||||||
"user_fname": userFname,
|
"user_fname": userFname,
|
||||||
|
"user_mname": userMname,
|
||||||
"user_lname": userLname,
|
"user_lname": userLname,
|
||||||
"user_email": userEmail,
|
"user_email": userEmail,
|
||||||
"user_mobile": userMobile,
|
"user_mobile": userMobile,
|
||||||
|
|
|
@ -10,7 +10,7 @@ import '../../../../../components/styles/app_colors.dart';
|
||||||
import '../../../../../components/styles/app_images.dart';
|
import '../../../../../components/styles/app_images.dart';
|
||||||
import '../../../../../components/styles/app_strings.dart';
|
import '../../../../../components/styles/app_strings.dart';
|
||||||
import '../../dashboard/controller/dashboard_ctrl.dart';
|
import '../../dashboard/controller/dashboard_ctrl.dart';
|
||||||
import 'add_internal_user.dart';
|
import 'internal_user/add_internal_user.dart';
|
||||||
import 'user_type.dart';
|
import 'user_type.dart';
|
||||||
import 'internal_user_role_mapping.dart';
|
import 'internal_user_role_mapping.dart';
|
||||||
import 'manage_user.dart';
|
import 'manage_user.dart';
|
||||||
|
@ -49,7 +49,7 @@ class UserScreen extends StatelessWidget {
|
||||||
ctrl.getManageUser();
|
ctrl.getManageUser();
|
||||||
}
|
}
|
||||||
if (ctrl.selectedUser.value == 2) {
|
if (ctrl.selectedUser.value == 2) {
|
||||||
ctrl.clearPrefillData();
|
// ctrl.clearPrefillData();
|
||||||
ctrl.showRolesSection.value = false;
|
ctrl.showRolesSection.value = false;
|
||||||
}
|
}
|
||||||
if (ctrl.selectedUser.value != 3) {
|
if (ctrl.selectedUser.value != 3) {
|
||||||
|
@ -71,12 +71,13 @@ class UserScreen extends StatelessWidget {
|
||||||
: AppColors.primaryClr,
|
: AppColors.primaryClr,
|
||||||
width: 3))),
|
width: 3))),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(
|
child: TextView(
|
||||||
ctrl.userTabs[index].title ?? "",
|
text: ctrl.userTabs[index].title ?? "",
|
||||||
style: TextStyle(
|
style: 12.txtBoldWhite,
|
||||||
fontSize: 12,
|
// style: TextStyle(
|
||||||
fontWeight: FontWeight.w900,
|
// fontSize: 12,
|
||||||
color: Colors.white),
|
// fontWeight: FontWeight.w900,
|
||||||
|
// color: Colors.white),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -93,12 +94,9 @@ class UserScreen extends StatelessWidget {
|
||||||
height: 12, width: 12)),
|
height: 12, width: 12)),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Text(
|
child: TextView(
|
||||||
AppStrings.refresh,
|
text: AppStrings.refresh,
|
||||||
style: TextStyle(
|
style: 12.txtBoldWhite,
|
||||||
color: AppColors.white,
|
|
||||||
fontSize: 12,
|
|
||||||
fontWeight: FontWeight.bold),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Obx(
|
Obx(
|
||||||
|
@ -117,12 +115,9 @@ class UserScreen extends StatelessWidget {
|
||||||
visible: ctrl.selectedUser.value == 0,
|
visible: ctrl.selectedUser.value == 0,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Text(
|
child: TextView(
|
||||||
AppStrings.filter,
|
text: AppStrings.filter,
|
||||||
style: TextStyle(
|
style: 12.txtBoldWhite,
|
||||||
color: AppColors.white,
|
|
||||||
fontSize: 12,
|
|
||||||
fontWeight: FontWeight.bold),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -154,10 +149,7 @@ class UserScreen extends StatelessWidget {
|
||||||
SizedBox(height: 8),
|
SizedBox(height: 8),
|
||||||
InputField(
|
InputField(
|
||||||
title: "Enter User Name",
|
title: "Enter User Name",
|
||||||
|
controller: ctrl.nameCtrl),
|
||||||
controller: ctrl.userTypeCtrl
|
|
||||||
|
|
||||||
),
|
|
||||||
|
|
||||||
// CustomDropdown(
|
// CustomDropdown(
|
||||||
// backClr: AppColors.clrD9,
|
// backClr: AppColors.clrD9,
|
||||||
|
@ -186,9 +178,7 @@ class UserScreen extends StatelessWidget {
|
||||||
SizedBox(height: 8),
|
SizedBox(height: 8),
|
||||||
InputField(
|
InputField(
|
||||||
title: "Enter User Type",
|
title: "Enter User Type",
|
||||||
controller: ctrl.userTypeCtrl
|
controller: ctrl.userTypeCtrl),
|
||||||
|
|
||||||
),
|
|
||||||
// CustomDropdown(
|
// CustomDropdown(
|
||||||
// backClr: AppColors.clrD9,
|
// backClr: AppColors.clrD9,
|
||||||
// borderClr: AppColors.clrGrey,
|
// borderClr: AppColors.clrGrey,
|
||||||
|
@ -216,8 +206,7 @@ class UserScreen extends StatelessWidget {
|
||||||
SizedBox(height: 8),
|
SizedBox(height: 8),
|
||||||
InputField(
|
InputField(
|
||||||
title: "Enter Email Address",
|
title: "Enter Email Address",
|
||||||
controller: ctrl.emailCtrl
|
controller: ctrl.emailCtrl),
|
||||||
),
|
|
||||||
// CustomDropdown(
|
// CustomDropdown(
|
||||||
// backClr: AppColors.clrD9,
|
// backClr: AppColors.clrD9,
|
||||||
// borderClr: AppColors.clrGrey,
|
// borderClr: AppColors.clrGrey,
|
||||||
|
@ -235,8 +224,7 @@ class UserScreen extends StatelessWidget {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(top: 16.0),
|
||||||
top: 16.0),
|
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
|
@ -252,8 +240,7 @@ class UserScreen extends StatelessWidget {
|
||||||
SizedBox(height: 8),
|
SizedBox(height: 8),
|
||||||
InputField(
|
InputField(
|
||||||
title: "Enter Employee Code",
|
title: "Enter Employee Code",
|
||||||
controller: ctrl.employeeCodeCtrl
|
controller: ctrl.employeeCodeCtrl),
|
||||||
),
|
|
||||||
// CustomDropdown(
|
// CustomDropdown(
|
||||||
// backClr: AppColors.clrD9,
|
// backClr: AppColors.clrD9,
|
||||||
// borderClr: AppColors.clrGrey,
|
// borderClr: AppColors.clrGrey,
|
||||||
|
@ -277,14 +264,12 @@ class UserScreen extends StatelessWidget {
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
TextView(
|
TextView(
|
||||||
text:
|
text: "Status",
|
||||||
"Status",
|
|
||||||
),
|
),
|
||||||
SizedBox(height: 8),
|
SizedBox(height: 8),
|
||||||
InputField(
|
InputField(
|
||||||
title: "Enter Status",
|
title: "Enter Status",
|
||||||
controller: ctrl.statusCtrl
|
controller: ctrl.statusCtrl),
|
||||||
),
|
|
||||||
// CustomDropdown(
|
// CustomDropdown(
|
||||||
// backClr: AppColors.clrD9,
|
// backClr: AppColors.clrD9,
|
||||||
// borderClr: AppColors.clrGrey,
|
// borderClr: AppColors.clrGrey,
|
||||||
|
@ -321,7 +306,8 @@ class UserScreen extends StatelessWidget {
|
||||||
SizedBox(width: 16),
|
SizedBox(width: 16),
|
||||||
CommonButton(
|
CommonButton(
|
||||||
borderRadius: 4,
|
borderRadius: 4,
|
||||||
width: 100,height:30,
|
width: 100,
|
||||||
|
height: 30,
|
||||||
text: AppStrings.submit,
|
text: AppStrings.submit,
|
||||||
textStyle: 14.txtSBoldWhite,
|
textStyle: 14.txtSBoldWhite,
|
||||||
clickAction: () {
|
clickAction: () {
|
||||||
|
|
|
@ -158,11 +158,12 @@ class UserType extends StatelessWidget {
|
||||||
top: BorderSide(color: AppColors.clrGrey),
|
top: BorderSide(color: AppColors.clrGrey),
|
||||||
),
|
),
|
||||||
columns: [
|
columns: [
|
||||||
dataColumn("SR.No."),
|
// dataColumn("SR.No."),
|
||||||
dataColumn("User Type"),
|
dataColumn("User Type"),
|
||||||
dataColumn("Status"),
|
dataColumn("Status"),
|
||||||
dataColumn("Action"),
|
dataColumn("Action"),
|
||||||
],
|
],
|
||||||
|
|
||||||
rows: List<DataRow>.generate(
|
rows: List<DataRow>.generate(
|
||||||
controller.userType.length, (index) {
|
controller.userType.length, (index) {
|
||||||
final stoppage = controller.userType[index];
|
final stoppage = controller.userType[index];
|
||||||
|
@ -170,7 +171,7 @@ class UserType extends StatelessWidget {
|
||||||
return DataRow(
|
return DataRow(
|
||||||
|
|
||||||
cells: [
|
cells: [
|
||||||
editableCell(index, "0$index"),
|
// editableCell(index, "0$index"),
|
||||||
editableCell(
|
editableCell(
|
||||||
index, stoppage.usertypeName ?? ""),
|
index, stoppage.usertypeName ?? ""),
|
||||||
editableCell(
|
editableCell(
|
||||||
|
|
|
@ -14,7 +14,6 @@ import '../../admin/user_management/model/getAllUserResModel.dart';
|
||||||
import '../../admin/user_management/model/plant_mapping_res_model.dart';
|
import '../../admin/user_management/model/plant_mapping_res_model.dart';
|
||||||
import '../../admin/user_management/model/user_type_details_res_model.dart';
|
import '../../admin/user_management/model/user_type_details_res_model.dart';
|
||||||
import '../../admin/user_management/model/user_type_res_model.dart';
|
import '../../admin/user_management/model/user_type_res_model.dart';
|
||||||
|
|
||||||
import '../../transporter/widgets/freightbill_dialog.dart';
|
import '../../transporter/widgets/freightbill_dialog.dart';
|
||||||
|
|
||||||
class DashboardCtrl extends GetxController {
|
class DashboardCtrl extends GetxController {
|
||||||
|
@ -33,7 +32,7 @@ class DashboardCtrl extends GetxController {
|
||||||
var selectedIndex = 0.obs;
|
var selectedIndex = 0.obs;
|
||||||
var selectUserType = 0.obs;
|
var selectUserType = 0.obs;
|
||||||
var selectedUser = 0.obs;
|
var selectedUser = 0.obs;
|
||||||
var selectedValue = ''.obs;
|
|
||||||
|
|
||||||
var errorText = ''.obs;
|
var errorText = ''.obs;
|
||||||
RxBool showRolesSection = false.obs;
|
RxBool showRolesSection = false.obs;
|
||||||
|
@ -90,10 +89,10 @@ class DashboardCtrl extends GetxController {
|
||||||
|
|
||||||
|
|
||||||
//**************************Manage-User************************************
|
//**************************Manage-User************************************
|
||||||
var currentPage = 1.obs;
|
RxInt currentPage = 1.obs; // Current page being viewed
|
||||||
var totalPages = 3.obs;
|
RxInt totalPages = 1.obs; // Total number of pages from the API
|
||||||
|
RxList<AllUser> getAllUser = <AllUser>[].obs;
|
||||||
final int limit = 10;
|
final int limit = 10;
|
||||||
var getAllUser = <AllUser>[].obs;
|
|
||||||
var userLoading = false.obs;
|
var userLoading = false.obs;
|
||||||
|
|
||||||
getManageUser() async {
|
getManageUser() async {
|
||||||
|
@ -110,7 +109,11 @@ class DashboardCtrl extends GetxController {
|
||||||
|
|
||||||
var response = await PostRequests.getAllUser(requestBody,currentPage.value,limit);
|
var response = await PostRequests.getAllUser(requestBody,currentPage.value,limit);
|
||||||
if (response != null) {
|
if (response != null) {
|
||||||
getAllUser.assignAll(response.data?.content ?? []);
|
List<AllUser> flattenedContent =
|
||||||
|
response.content!.expand((list) => list).toList();
|
||||||
|
getAllUser.assignAll(flattenedContent);
|
||||||
|
totalPages.value = response.totalPages!;
|
||||||
|
print("getAllUser>>>>>${getAllUser.length}");
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
userLoading.value = false;
|
userLoading.value = false;
|
||||||
|
@ -122,15 +125,21 @@ class DashboardCtrl extends GetxController {
|
||||||
getManageUser(); // Fetch data for the next page
|
getManageUser(); // Fetch data for the next page
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void previousPage() {
|
void previousPage() {
|
||||||
if (currentPage.value > 1) {
|
if (currentPage.value > 1) {
|
||||||
currentPage.value--;
|
currentPage.value--;
|
||||||
getManageUser(); // Fetch data for the previous page
|
getManageUser(); // Fetch data for the previous page
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void onPageChanged(int page) {
|
||||||
|
currentPage.value = page;
|
||||||
|
getManageUser(); // Fetch data for the selected page
|
||||||
|
}
|
||||||
|
|
||||||
//********************************edit User****************************//
|
//********************************edit User****************************//
|
||||||
var editLoading = false.obs;
|
var editLoading = false.obs;
|
||||||
Rx<Data> editUserResModel = Data().obs;
|
Rx<EditUser> editUserResModel = EditUser().obs;
|
||||||
|
|
||||||
editAllUser(String id) async {
|
editAllUser(String id) async {
|
||||||
try {
|
try {
|
||||||
|
@ -162,8 +171,9 @@ class DashboardCtrl extends GetxController {
|
||||||
//**************************Add Internal-User******************************
|
//**************************Add Internal-User******************************
|
||||||
|
|
||||||
var isLoading = false.obs;
|
var isLoading = false.obs;
|
||||||
var status = ['A', 'I'];
|
var status = ['Active', 'In-Active'];
|
||||||
var selectedStatus = 'Select Status'.obs;
|
var selectedStatus = 'Select Status'.obs;
|
||||||
|
var selectedValue = 'Select User Type'.obs;
|
||||||
void createUser() {
|
void createUser() {
|
||||||
if (selectedValue.value.isEmpty ||
|
if (selectedValue.value.isEmpty ||
|
||||||
selectedStatus.value.isEmpty ||
|
selectedStatus.value.isEmpty ||
|
||||||
|
@ -179,7 +189,6 @@ class DashboardCtrl extends GetxController {
|
||||||
Get.back();
|
Get.back();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
print("???????????????");
|
|
||||||
addInternalUser();
|
addInternalUser();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,7 +206,7 @@ class DashboardCtrl extends GetxController {
|
||||||
"mobile": mobileCtrl.text,
|
"mobile": mobileCtrl.text,
|
||||||
"employeeTransCode": employeeCodeCtrl.text,
|
"employeeTransCode": employeeCodeCtrl.text,
|
||||||
"email": emailCtrl.text,
|
"email": emailCtrl.text,
|
||||||
"status": selectedStatus.value,
|
"status": selectedStatus.value == "Active" ? "A":"I",
|
||||||
"addedChannel": "F"
|
"addedChannel": "F"
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
|
@ -3,8 +3,8 @@ import 'package:get/get.dart';
|
||||||
import 'package:shayog/components/styles/app_strings.dart';
|
import 'package:shayog/components/styles/app_strings.dart';
|
||||||
import 'package:shayog/components/styles/textStyles.dart';
|
import 'package:shayog/components/styles/textStyles.dart';
|
||||||
import 'package:shayog/feature/presentation/screens/transporter/view/transport_view.dart';
|
import 'package:shayog/feature/presentation/screens/transporter/view/transport_view.dart';
|
||||||
|
|
||||||
import '../../../../components/styles/app_colors.dart';
|
import '../../../../components/styles/app_colors.dart';
|
||||||
|
import '../../widgets/text_view.dart';
|
||||||
import '../admin/configuration_management/configuration_screen.dart';
|
import '../admin/configuration_management/configuration_screen.dart';
|
||||||
import '../admin/freight_bills/freightbill_screen.dart';
|
import '../admin/freight_bills/freightbill_screen.dart';
|
||||||
import '../admin/masters/master_screen.dart';
|
import '../admin/masters/master_screen.dart';
|
||||||
|
@ -25,6 +25,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
|
automaticallyImplyLeading: false,
|
||||||
backgroundColor: AppColors.secondaryClr,
|
backgroundColor: AppColors.secondaryClr,
|
||||||
title: RichText(
|
title: RichText(
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
|
@ -61,32 +62,46 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
||||||
style: 12.txtBoldBlack,
|
style: 12.txtBoldBlack,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
PopupMenuButton(
|
PopupMenuButton<int>(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
onSelected: (val) {},
|
onSelected: (val) {
|
||||||
|
// Handle selection
|
||||||
|
},
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.keyboard_arrow_down_outlined,
|
Icons.keyboard_arrow_down_outlined,
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
size: 20,
|
size: 20,
|
||||||
),
|
),
|
||||||
itemBuilder: (context) {
|
itemBuilder: (context) {
|
||||||
return List.generate(
|
return [
|
||||||
2,
|
PopupMenuItem<int>(
|
||||||
(index) {
|
|
||||||
return PopupMenuItem(
|
value: 0,
|
||||||
|
height: 30,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
ctrl.selectUserType.value = index;
|
ctrl.selectUserType.value = 0;
|
||||||
},
|
},
|
||||||
child: Text(
|
child: TextView(
|
||||||
index == 0
|
text: AppStrings.adminUser,
|
||||||
? AppStrings.adminUser
|
style: 12.txtSBoldGrey,
|
||||||
: AppStrings.transportVendor,
|
),
|
||||||
style: 12.txtSBoldGrey),
|
),
|
||||||
);
|
const PopupMenuDivider(), // Divider between items
|
||||||
|
PopupMenuItem<int>(
|
||||||
|
value: 1,
|
||||||
|
height: 35,
|
||||||
|
onTap: () {
|
||||||
|
ctrl.selectUserType.value = 1;
|
||||||
},
|
},
|
||||||
);
|
child: TextView(
|
||||||
|
text: AppStrings.transportVendor,
|
||||||
|
style: 12.txtSBoldGrey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
];
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
||||||
SizedBox(width: 8),
|
SizedBox(width: 8),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -56,7 +56,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||||
color: AppColors.primaryClr,
|
color: AppColors.primaryClr,
|
||||||
fontWeight: FontWeight.w900),
|
fontWeight: FontWeight.w900),
|
||||||
)),
|
)),
|
||||||
Container(
|
SizedBox(
|
||||||
height: 100,
|
height: 100,
|
||||||
width: 150,
|
width: 150,
|
||||||
child: Image.asset("assets/images/back2.png")),
|
child: Image.asset("assets/images/back2.png")),
|
||||||
|
|
|
@ -9,10 +9,10 @@ FreightBillsResModel freightBillsResModelFromJson(String str) => FreightBillsRes
|
||||||
String freightBillsResModelToJson(FreightBillsResModel data) => json.encode(data.toJson());
|
String freightBillsResModelToJson(FreightBillsResModel data) => json.encode(data.toJson());
|
||||||
|
|
||||||
class FreightBillsResModel {
|
class FreightBillsResModel {
|
||||||
final List<String>? plant;
|
final List<Plant>? plant;
|
||||||
final List<String>? prodect;
|
final List<Prodect>? prodect;
|
||||||
final List<String>? fromLocation;
|
final List<String>? fromLocation;
|
||||||
final List<dynamic>? freightBill;
|
final List<String>? freightBill;
|
||||||
|
|
||||||
FreightBillsResModel({
|
FreightBillsResModel({
|
||||||
this.plant,
|
this.plant,
|
||||||
|
@ -22,16 +22,58 @@ class FreightBillsResModel {
|
||||||
});
|
});
|
||||||
|
|
||||||
factory FreightBillsResModel.fromJson(Map<String, dynamic> json) => FreightBillsResModel(
|
factory FreightBillsResModel.fromJson(Map<String, dynamic> json) => FreightBillsResModel(
|
||||||
plant: json["Plant"] == null ? [] : List<String>.from(json["Plant"]!.map((x) => x)),
|
plant: json["Plant"] == null ? [] : List<Plant>.from(json["Plant"]!.map((x) => Plant.fromJson(x))),
|
||||||
prodect: json["prodect"] == null ? [] : List<String>.from(json["prodect"]!.map((x) => x)),
|
prodect: json["prodect"] == null ? [] : List<Prodect>.from(json["prodect"]!.map((x) => Prodect.fromJson(x))),
|
||||||
fromLocation: json["fromLocation"] == null ? [] : List<String>.from(json["fromLocation"]!.map((x) => x)),
|
fromLocation: json["fromLocation"] == null ? [] : List<String>.from(json["fromLocation"]!.map((x) => x)),
|
||||||
freightBill: json["FreightBill"] == null ? [] : List<dynamic>.from(json["FreightBill"]!.map((x) => x)),
|
freightBill: json["FreightBill"] == null ? [] : List<String>.from(json["FreightBill"]!.map((x) => x)),
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
"Plant": plant == null ? [] : List<dynamic>.from(plant!.map((x) => x)),
|
"Plant": plant == null ? [] : List<dynamic>.from(plant!.map((x) => x.toJson())),
|
||||||
"prodect": prodect == null ? [] : List<dynamic>.from(prodect!.map((x) => x)),
|
"prodect": prodect == null ? [] : List<dynamic>.from(prodect!.map((x) => x.toJson())),
|
||||||
"fromLocation": fromLocation == null ? [] : List<dynamic>.from(fromLocation!.map((x) => x)),
|
"fromLocation": fromLocation == null ? [] : List<dynamic>.from(fromLocation!.map((x) => x)),
|
||||||
"FreightBill": freightBill == null ? [] : List<dynamic>.from(freightBill!.map((x) => x)),
|
"FreightBill": freightBill == null ? [] : List<dynamic>.from(freightBill!.map((x) => x)),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Plant {
|
||||||
|
final String? plantCode;
|
||||||
|
final String? plantDesc;
|
||||||
|
bool isSelected;
|
||||||
|
|
||||||
|
Plant({
|
||||||
|
this.plantCode,
|
||||||
|
this.plantDesc,
|
||||||
|
this.isSelected = false,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory Plant.fromJson(Map<String, dynamic> json) => Plant(
|
||||||
|
plantCode: json["plant_code"],
|
||||||
|
plantDesc: json["plant_desc"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"plant_code": plantCode,
|
||||||
|
"plant_desc": plantDesc,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
class Prodect {
|
||||||
|
final String? materialCode;
|
||||||
|
final String? materialDescription;
|
||||||
|
|
||||||
|
Prodect({
|
||||||
|
this.materialCode,
|
||||||
|
this.materialDescription,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory Prodect.fromJson(Map<String, dynamic> json) => Prodect(
|
||||||
|
materialCode: json["material_code"],
|
||||||
|
materialDescription: json["material_description"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"material_code": materialCode,
|
||||||
|
"material_description": materialDescription,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,211 @@
|
||||||
|
// To parse this JSON data, do
|
||||||
|
//
|
||||||
|
// final grnPendingBillsResModel = grnPendingBillsResModelFromJson(jsonString);
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
GrnPendingBillsResModel grnPendingBillsResModelFromJson(String str) => GrnPendingBillsResModel.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String grnPendingBillsResModelToJson(GrnPendingBillsResModel data) => json.encode(data.toJson());
|
||||||
|
|
||||||
|
class GrnPendingBillsResModel {
|
||||||
|
final List<List<GrnPending>>? content;
|
||||||
|
final Pageable? pageable;
|
||||||
|
final bool? last;
|
||||||
|
final int? totalPages;
|
||||||
|
final int? totalElements;
|
||||||
|
final bool? first;
|
||||||
|
final int? size;
|
||||||
|
final int? number;
|
||||||
|
final Sort? sort;
|
||||||
|
final int? numberOfElements;
|
||||||
|
final bool? empty;
|
||||||
|
|
||||||
|
GrnPendingBillsResModel({
|
||||||
|
this.content,
|
||||||
|
this.pageable,
|
||||||
|
this.last,
|
||||||
|
this.totalPages,
|
||||||
|
this.totalElements,
|
||||||
|
this.first,
|
||||||
|
this.size,
|
||||||
|
this.number,
|
||||||
|
this.sort,
|
||||||
|
this.numberOfElements,
|
||||||
|
this.empty,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory GrnPendingBillsResModel.fromJson(Map<String, dynamic> json) => GrnPendingBillsResModel(
|
||||||
|
content: json["content"] == null ? [] : List<List<GrnPending>>.from(json["content"]!.map((x) => List<GrnPending>.from(x.map((x) => GrnPending.fromJson(x))))),
|
||||||
|
pageable: json["pageable"] == null ? null : Pageable.fromJson(json["pageable"]),
|
||||||
|
last: json["last"],
|
||||||
|
totalPages: json["totalPages"],
|
||||||
|
totalElements: json["totalElements"],
|
||||||
|
first: json["first"],
|
||||||
|
size: json["size"],
|
||||||
|
number: json["number"],
|
||||||
|
sort: json["sort"] == null ? null : Sort.fromJson(json["sort"]),
|
||||||
|
numberOfElements: json["numberOfElements"],
|
||||||
|
empty: json["empty"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"content": content == null ? [] : List<dynamic>.from(content!.map((x) => List<dynamic>.from(x.map((x) => x.toJson())))),
|
||||||
|
"pageable": pageable?.toJson(),
|
||||||
|
"last": last,
|
||||||
|
"totalPages": totalPages,
|
||||||
|
"totalElements": totalElements,
|
||||||
|
"first": first,
|
||||||
|
"size": size,
|
||||||
|
"number": number,
|
||||||
|
"sort": sort?.toJson(),
|
||||||
|
"numberOfElements": numberOfElements,
|
||||||
|
"empty": empty,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
class GrnPending {
|
||||||
|
final int? grnId;
|
||||||
|
final String? grnNo;
|
||||||
|
final String? plantCode;
|
||||||
|
final String? materialCode;
|
||||||
|
final String? codeValue;
|
||||||
|
final String? transporterCode;
|
||||||
|
final DateTime? grnDate;
|
||||||
|
final String? fromLocation;
|
||||||
|
final String? vehicleNo;
|
||||||
|
final String? lrNo;
|
||||||
|
final DateTime? lrDate;
|
||||||
|
final double? dispQty;
|
||||||
|
final double? netQty;
|
||||||
|
final double? billingQty;
|
||||||
|
final int? freightRate;
|
||||||
|
final double? shipmentCost;
|
||||||
|
final int? statusId;
|
||||||
|
final String? remark;
|
||||||
|
bool isSelected;
|
||||||
|
|
||||||
|
GrnPending({
|
||||||
|
this.grnId,
|
||||||
|
this.grnNo,
|
||||||
|
this.plantCode,
|
||||||
|
this.materialCode,
|
||||||
|
this.codeValue,
|
||||||
|
this.transporterCode,
|
||||||
|
this.grnDate,
|
||||||
|
this.fromLocation,
|
||||||
|
this.vehicleNo,
|
||||||
|
this.lrNo,
|
||||||
|
this.lrDate,
|
||||||
|
this.dispQty,
|
||||||
|
this.netQty,
|
||||||
|
this.billingQty,
|
||||||
|
this.freightRate,
|
||||||
|
this.shipmentCost,
|
||||||
|
this.statusId,
|
||||||
|
this.remark,
|
||||||
|
this.isSelected = false,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory GrnPending.fromJson(Map<String, dynamic> json) => GrnPending(
|
||||||
|
grnId: json["grn_id"],
|
||||||
|
grnNo: json["grn_no"],
|
||||||
|
plantCode: json["plant_code"],
|
||||||
|
materialCode: json["material_code"],
|
||||||
|
codeValue: json["code_value"],
|
||||||
|
transporterCode: json["transporter_code"],
|
||||||
|
grnDate: json["grn_date"] == null ? null : DateTime.parse(json["grn_date"]),
|
||||||
|
fromLocation: json["from_location"],
|
||||||
|
vehicleNo: json["vehicle_no"],
|
||||||
|
lrNo: json["lr_no"],
|
||||||
|
lrDate: json["lr_date"] == null ? null : DateTime.parse(json["lr_date"]),
|
||||||
|
dispQty: json["disp_qty"]?.toDouble(),
|
||||||
|
netQty: json["net_qty"]?.toDouble(),
|
||||||
|
billingQty: json["billing_qty"]?.toDouble(),
|
||||||
|
freightRate: json["freight_rate"],
|
||||||
|
shipmentCost: json["shipment_cost"]?.toDouble(),
|
||||||
|
statusId: json["status_id"],
|
||||||
|
remark: json["remark"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"grn_id": grnId,
|
||||||
|
"grn_no": grnNo,
|
||||||
|
"plant_code": plantCode,
|
||||||
|
"material_code": materialCode,
|
||||||
|
"code_value": codeValue,
|
||||||
|
"transporter_code": transporterCode,
|
||||||
|
"grn_date": "${grnDate!.year.toString().padLeft(4, '0')}-${grnDate!.month.toString().padLeft(2, '0')}-${grnDate!.day.toString().padLeft(2, '0')}",
|
||||||
|
"from_location": fromLocation,
|
||||||
|
"vehicle_no": vehicleNo,
|
||||||
|
"lr_no": lrNo,
|
||||||
|
"lr_date": "${lrDate!.year.toString().padLeft(4, '0')}-${lrDate!.month.toString().padLeft(2, '0')}-${lrDate!.day.toString().padLeft(2, '0')}",
|
||||||
|
"disp_qty": dispQty,
|
||||||
|
"net_qty": netQty,
|
||||||
|
"billing_qty": billingQty,
|
||||||
|
"freight_rate": freightRate,
|
||||||
|
"shipment_cost": shipmentCost,
|
||||||
|
"status_id": statusId,
|
||||||
|
"remark": remark,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
class Pageable {
|
||||||
|
final Sort? sort;
|
||||||
|
final int? offset;
|
||||||
|
final int? pageSize;
|
||||||
|
final int? pageNumber;
|
||||||
|
final bool? unpaged;
|
||||||
|
final bool? paged;
|
||||||
|
|
||||||
|
Pageable({
|
||||||
|
this.sort,
|
||||||
|
this.offset,
|
||||||
|
this.pageSize,
|
||||||
|
this.pageNumber,
|
||||||
|
this.unpaged,
|
||||||
|
this.paged,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory Pageable.fromJson(Map<String, dynamic> json) => Pageable(
|
||||||
|
sort: json["sort"] == null ? null : Sort.fromJson(json["sort"]),
|
||||||
|
offset: json["offset"],
|
||||||
|
pageSize: json["pageSize"],
|
||||||
|
pageNumber: json["pageNumber"],
|
||||||
|
unpaged: json["unpaged"],
|
||||||
|
paged: json["paged"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"sort": sort?.toJson(),
|
||||||
|
"offset": offset,
|
||||||
|
"pageSize": pageSize,
|
||||||
|
"pageNumber": pageNumber,
|
||||||
|
"unpaged": unpaged,
|
||||||
|
"paged": paged,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
class Sort {
|
||||||
|
final bool? empty;
|
||||||
|
final bool? sorted;
|
||||||
|
final bool? unsorted;
|
||||||
|
|
||||||
|
Sort({
|
||||||
|
this.empty,
|
||||||
|
this.sorted,
|
||||||
|
this.unsorted,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory Sort.fromJson(Map<String, dynamic> json) => Sort(
|
||||||
|
empty: json["empty"],
|
||||||
|
sorted: json["sorted"],
|
||||||
|
unsorted: json["unsorted"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"empty": empty,
|
||||||
|
"sorted": sorted,
|
||||||
|
"unsorted": unsorted,
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:shayog/components/common/common_button.dart';
|
||||||
import 'package:shayog/components/styles/app_colors.dart';
|
import 'package:shayog/components/styles/app_colors.dart';
|
||||||
import 'package:shayog/components/styles/textStyles.dart';
|
import 'package:shayog/components/styles/textStyles.dart';
|
||||||
import 'package:shayog/feature/presentation/widgets/text_view.dart';
|
import 'package:shayog/feature/presentation/widgets/text_view.dart';
|
||||||
|
@ -10,15 +11,68 @@ import '../../../../../../../components/common/common_btn.dart';
|
||||||
import '../../../../../../../components/common/custom_drop_down.dart';
|
import '../../../../../../../components/common/custom_drop_down.dart';
|
||||||
import '../../../../../../../components/common/data_cell.dart';
|
import '../../../../../../../components/common/data_cell.dart';
|
||||||
import '../../../../../../../components/styles/app_strings.dart';
|
import '../../../../../../../components/styles/app_strings.dart';
|
||||||
|
|
||||||
import '../../view_model/transport_controller.dart';
|
import '../../view_model/transport_controller.dart';
|
||||||
import '../../widgets/common_card.dart';
|
import '../../widgets/common_card.dart';
|
||||||
import '../../widgets/freightbill_dialog.dart';
|
import '../../widgets/freightbill_dialog.dart';
|
||||||
|
import 'package:syncfusion_flutter_datepicker/datepicker.dart';
|
||||||
|
|
||||||
class GenerateFrightBill extends StatelessWidget {
|
class GenerateFrightBill extends StatefulWidget {
|
||||||
GenerateFrightBill({super.key});
|
GenerateFrightBill({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<GenerateFrightBill> createState() => _GenerateFrightBillState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _GenerateFrightBillState extends State<GenerateFrightBill> {
|
||||||
final controller = Get.put(TransportController());
|
final controller = Get.put(TransportController());
|
||||||
|
String _selectedDateRange = '';
|
||||||
|
|
||||||
|
|
||||||
|
void _onSelectionChanged(DateRangePickerSelectionChangedArgs args) {
|
||||||
|
final startDate = args.value.startDate;
|
||||||
|
final endDate = args.value.endDate;
|
||||||
|
|
||||||
|
// If a valid range is selected
|
||||||
|
if (startDate != null && endDate != null) {
|
||||||
|
setState(() {
|
||||||
|
_selectedDateRange =
|
||||||
|
'Selected Range: ${startDate.toLocal()} - ${endDate.toLocal()}';
|
||||||
|
});
|
||||||
|
|
||||||
|
// Update the TextFormField with the formatted date range
|
||||||
|
String formattedStartDate =
|
||||||
|
DateFormat('dd/MM/yyyy').format(startDate);
|
||||||
|
String formattedEndDate =
|
||||||
|
DateFormat('dd-MM/yyyy').format(endDate);
|
||||||
|
|
||||||
|
controller.fromController.text = '$formattedStartDate - $formattedEndDate';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show the date range picker dialog
|
||||||
|
void _showDateRangePicker() async {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return Dialog(
|
||||||
|
child: Container(
|
||||||
|
height: 350,
|
||||||
|
width: 650,
|
||||||
|
margin: EdgeInsets.all(16),
|
||||||
|
child: SfDateRangePicker(
|
||||||
|
selectionMode: DateRangePickerSelectionMode.range,
|
||||||
|
enableMultiView: true, // Enable multi-view calendar
|
||||||
|
onSelectionChanged: _onSelectionChanged,
|
||||||
|
headerStyle: DateRangePickerHeaderStyle(
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -38,16 +92,17 @@ class GenerateFrightBill extends StatelessWidget {
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
_commonText("Plant"),
|
TextView(text:
|
||||||
|
"Plant"),
|
||||||
SizedBox(height: 8),
|
SizedBox(height: 8),
|
||||||
CustomDropdown<dynamic>(
|
CustomDropdown(
|
||||||
backClr: AppColors.clrD9,
|
backClr: AppColors.clrD9,
|
||||||
borderClr: AppColors.clrGrey,
|
borderClr: AppColors.clrGrey,
|
||||||
items: controller.plant,
|
items: controller.plant,
|
||||||
itemLabel: (item) => item,
|
itemLabel: (item) => "${item.plantCode}-${item.plantDesc}",
|
||||||
onSelected: (selected) {
|
onSelected: (selected) {
|
||||||
if (selected != null) {
|
if (selected != null) {
|
||||||
controller.selectPlant.value = selected;
|
controller.selectPlant.value = selected.plantCode ?? "";
|
||||||
print(
|
print(
|
||||||
"selectPlant${controller.selectPlant.value}");
|
"selectPlant${controller.selectPlant.value}");
|
||||||
}
|
}
|
||||||
|
@ -63,13 +118,14 @@ class GenerateFrightBill extends StatelessWidget {
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
_commonText("Product Name"),
|
TextView(text:"Product Name"),
|
||||||
SizedBox(height: 8),
|
SizedBox(height: 8),
|
||||||
CustomDropdown<dynamic>(
|
CustomDropdown<dynamic>(
|
||||||
|
width: 250,
|
||||||
backClr: AppColors.clrD9,
|
backClr: AppColors.clrD9,
|
||||||
borderClr: AppColors.clrGrey,
|
borderClr: AppColors.clrGrey,
|
||||||
items: controller.product,
|
items: controller.product,
|
||||||
itemLabel: (item) => item,
|
itemLabel: (item) => "${item.materialCode}-${item.materialDescription}",
|
||||||
onSelected: (selected) {
|
onSelected: (selected) {
|
||||||
if (selected != null) {
|
if (selected != null) {
|
||||||
controller.selectProduct.value = selected;
|
controller.selectProduct.value = selected;
|
||||||
|
@ -88,7 +144,7 @@ class GenerateFrightBill extends StatelessWidget {
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
_commonText("Transaction Type"),
|
TextView(text:"Transaction Type"),
|
||||||
SizedBox(height: 8),
|
SizedBox(height: 8),
|
||||||
CustomDropdown<String>(
|
CustomDropdown<String>(
|
||||||
backClr: AppColors.clrD9,
|
backClr: AppColors.clrD9,
|
||||||
|
@ -118,7 +174,7 @@ class GenerateFrightBill extends StatelessWidget {
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
_commonText("MRN Date Range"),
|
TextView(text:"MRN Date Range"),
|
||||||
// SizedBox(height: 8),
|
// SizedBox(height: 8),
|
||||||
// CustomDropdown<String>(
|
// CustomDropdown<String>(
|
||||||
// borderClr: AppColors.clrGrey,
|
// borderClr: AppColors.clrGrey,
|
||||||
|
@ -137,26 +193,34 @@ class GenerateFrightBill extends StatelessWidget {
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
key: controller.fromTextFieldKey,
|
key: controller.fromTextFieldKey,
|
||||||
controller: controller.fromController,
|
controller: controller.fromController,
|
||||||
onTap: () async {
|
readOnly: true, // Set as readonly so user can't type
|
||||||
final pickedDate = await showWebDatePicker(
|
onTap: () {
|
||||||
width: 20.w,
|
_showDateRangePicker();
|
||||||
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;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
// 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(
|
decoration: InputDecoration(
|
||||||
|
fillColor:AppColors.clrD9,
|
||||||
|
filled: true,
|
||||||
hintText: 'Select MRN Date Range',
|
hintText: 'Select MRN Date Range',
|
||||||
hintStyle: TextStyle(
|
hintStyle: TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
|
@ -206,7 +270,7 @@ class GenerateFrightBill extends StatelessWidget {
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
_commonText("From Location"),
|
TextView(text:"From Location"),
|
||||||
SizedBox(height: 8),
|
SizedBox(height: 8),
|
||||||
CustomDropdown<dynamic>(
|
CustomDropdown<dynamic>(
|
||||||
backClr: AppColors.clrD9,
|
backClr: AppColors.clrD9,
|
||||||
|
@ -230,7 +294,7 @@ class GenerateFrightBill extends StatelessWidget {
|
||||||
//flex: 2,
|
//flex: 2,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
_commonText(
|
TextView(text:
|
||||||
"",
|
"",
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
|
@ -244,9 +308,12 @@ class GenerateFrightBill extends StatelessWidget {
|
||||||
clickAction: () {},
|
clickAction: () {},
|
||||||
),
|
),
|
||||||
SizedBox(width: 16),
|
SizedBox(width: 16),
|
||||||
CommonBtn(
|
CommonButton(
|
||||||
|
borderRadius: 4,
|
||||||
|
height: 30,
|
||||||
|
width: 100,
|
||||||
text: AppStrings.submit,
|
text: AppStrings.submit,
|
||||||
style: 14.txtBoldWhite,
|
|
||||||
clickAction: () {
|
clickAction: () {
|
||||||
controller.postData();
|
controller.postData();
|
||||||
},
|
},
|
||||||
|
@ -269,13 +336,15 @@ class GenerateFrightBill extends StatelessWidget {
|
||||||
color: AppColors.primaryClr,
|
color: AppColors.primaryClr,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
TextView(text: AppStrings.viewGrnDetails, style: 15.txtBoldWhite),
|
TextView(text: AppStrings.viewGrnDetails, style: 14.txtBoldWhite),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
CommonBtn(
|
CommonBtn(
|
||||||
|
width: 150,
|
||||||
bkClr: AppColors.white,
|
bkClr: AppColors.white,
|
||||||
borderClr: AppColors.primaryClr,
|
borderClr: AppColors.primaryClr,
|
||||||
style: 14.txtBoldBlue,
|
style: 12.txtBoldBlue,
|
||||||
text: AppStrings.save,
|
text: "Generate Freight Bill",
|
||||||
|
// text: AppStrings.save,
|
||||||
clickAction: () {
|
clickAction: () {
|
||||||
bool hasSelectedRows = controller.grnDetails
|
bool hasSelectedRows = controller.grnDetails
|
||||||
.any((element) => element.isSelected);
|
.any((element) => element.isSelected);
|
||||||
|
@ -360,7 +429,7 @@ class GenerateFrightBill extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
dataColumn(AppStrings.srNo),
|
// dataColumn(AppStrings.srNo),
|
||||||
dataColumn(AppStrings.mrnNo),
|
dataColumn(AppStrings.mrnNo),
|
||||||
dataColumn(AppStrings.plantNo),
|
dataColumn(AppStrings.plantNo),
|
||||||
dataColumn(AppStrings.product),
|
dataColumn(AppStrings.product),
|
||||||
|
@ -401,20 +470,20 @@ class GenerateFrightBill extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
editableCell(index, "0${index + 1}"),
|
// editableCell(index, "0${index + 1}"),
|
||||||
editableCell(index, stoppage.grnNo ?? ""),
|
editableCell(index, stoppage.grnNo ?? ""),
|
||||||
editableCell(index, stoppage.plantCode ?? ""),
|
editableCell(index, stoppage.plantCode ?? ""),
|
||||||
editableCell(index, stoppage.materialCode ?? ""),
|
editableCell(index, stoppage.materialCode ?? ""),
|
||||||
editableCell(
|
editableCell(
|
||||||
index,
|
index,
|
||||||
DateFormat('yyyy-MM-dd').format(
|
DateFormat('dd/MM/yyyy').format(
|
||||||
stoppage.grnDate ?? DateTime.now())),
|
stoppage.grnDate ?? DateTime.now())),
|
||||||
editableCell(index, stoppage.fromLocation ?? ""),
|
editableCell(index, stoppage.fromLocation ?? ""),
|
||||||
editableCell(index, stoppage.vehicleNo ?? ""),
|
editableCell(index, stoppage.vehicleNo ?? ""),
|
||||||
editableCell(index, stoppage.lrNo ?? ""),
|
editableCell(index, stoppage.lrNo ?? ""),
|
||||||
editableCell(
|
editableCell(
|
||||||
index,
|
index,
|
||||||
DateFormat('yyyy-MM-dd')
|
DateFormat('dd/MM/yyyy')
|
||||||
.format(stoppage.lrDate ?? DateTime.now())),
|
.format(stoppage.lrDate ?? DateTime.now())),
|
||||||
editableCell(
|
editableCell(
|
||||||
index, stoppage.dispQty?.toString() ?? ""),
|
index, stoppage.dispQty?.toString() ?? ""),
|
||||||
|
@ -441,12 +510,4 @@ class GenerateFrightBill extends StatelessWidget {
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_commonText(String title) {
|
|
||||||
return Text(
|
|
||||||
title,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 13, color: Colors.black, fontWeight: FontWeight.w900),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,9 @@ class _TransportViewState extends State<InvoiceManagement> {
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return Obx(
|
return Obx(
|
||||||
() => InkWell(
|
() => InkWell(
|
||||||
onTap: () {},
|
onTap: () {
|
||||||
|
ctrl.selectedState.value = index;
|
||||||
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: EdgeInsets.only(bottom: 10, top: 10),
|
margin: EdgeInsets.only(bottom: 10, top: 10),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
|
|
|
@ -1,10 +1,19 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:shayog/components/styles/textStyles.dart';
|
||||||
import 'package:shayog/feature/presentation/screens/transporter/view_model/transport_controller.dart';
|
import 'package:shayog/feature/presentation/screens/transporter/view_model/transport_controller.dart';
|
||||||
|
import 'package:sizer/sizer.dart';
|
||||||
|
import 'package:vph_web_date_picker/vph_web_date_picker.dart';
|
||||||
import '../../../../../../../components/common/data_cell.dart';
|
import '../../../../../../../components/common/data_cell.dart';
|
||||||
import '../../../../../../../components/styles/app_colors.dart';
|
import '../../../../../../../components/styles/app_colors.dart';
|
||||||
import '../../../../../../../components/styles/app_strings.dart';
|
import '../../../../../../../components/styles/app_strings.dart';
|
||||||
|
import '../../../../../../components/common/common_btn.dart';
|
||||||
|
import '../../../../../../components/common/common_button.dart';
|
||||||
|
import '../../../../../../components/common/custom_drop_down.dart';
|
||||||
|
import '../../../../widgets/text_view.dart';
|
||||||
|
import '../../widgets/common_card.dart';
|
||||||
|
import '../../widgets/freightbill_dialog.dart';
|
||||||
|
|
||||||
class PendingGeneration extends StatelessWidget {
|
class PendingGeneration extends StatelessWidget {
|
||||||
PendingGeneration({super.key});
|
PendingGeneration({super.key});
|
||||||
|
@ -15,7 +24,295 @@ class PendingGeneration extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Obx(() {
|
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"),
|
||||||
|
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 ?? "";
|
||||||
|
print(
|
||||||
|
"selectPlant${controller.selectPlant.value}");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
hintText: "Select Plant",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: 16),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
TextView(text:"Product Name"),
|
||||||
|
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"),
|
||||||
|
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;
|
||||||
|
print(
|
||||||
|
"selectTransactionType${controller.selectTransactionType.value}");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
hintText: "Select Transaction Type",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 16.0, left: 0, right: 8),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
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(
|
||||||
|
|
||||||
|
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();
|
||||||
|
},
|
||||||
|
child: Icon(Icons.close, size: 1.2.w),
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
contentPadding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 12.0, vertical: 0.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",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
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: () {},
|
||||||
|
),
|
||||||
|
SizedBox(width: 16),
|
||||||
|
CommonButton(
|
||||||
|
borderRadius: 4,
|
||||||
|
height: 30,
|
||||||
|
width: 100,
|
||||||
|
text: AppStrings.submit,
|
||||||
|
|
||||||
|
clickAction: () {
|
||||||
|
controller.postData();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
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) {
|
if (controller.freightViewLoader.value) {
|
||||||
return Center(
|
return Center(
|
||||||
child: CircularProgressIndicator(
|
child: CircularProgressIndicator(
|
||||||
|
@ -26,7 +323,7 @@ class PendingGeneration extends StatelessWidget {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Obx(() {
|
Obx(() {
|
||||||
if (controller.isLoading.value) {
|
if (controller.grnPendingLoader.value) {
|
||||||
return Center(child: CircularProgressIndicator());
|
return Center(child: CircularProgressIndicator());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +331,7 @@ class PendingGeneration extends StatelessWidget {
|
||||||
return Center(child: Text(controller.errorMessage.value));
|
return Center(child: Text(controller.errorMessage.value));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (controller.grnDetails.isEmpty) {
|
if (controller.grnPendingData.isEmpty) {
|
||||||
return Center(child: Text('No data available.'));
|
return Center(child: Text('No data available.'));
|
||||||
}
|
}
|
||||||
return Scrollbar(
|
return Scrollbar(
|
||||||
|
@ -86,7 +383,7 @@ class PendingGeneration extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
dataColumn(AppStrings.srNo),
|
// dataColumn(AppStrings.srNo),
|
||||||
dataColumn(AppStrings.plantName),
|
dataColumn(AppStrings.plantName),
|
||||||
dataColumn(AppStrings.productName),
|
dataColumn(AppStrings.productName),
|
||||||
dataColumn(AppStrings.date),
|
dataColumn(AppStrings.date),
|
||||||
|
@ -103,8 +400,8 @@ class PendingGeneration extends StatelessWidget {
|
||||||
dataColumn(AppStrings.remark),
|
dataColumn(AppStrings.remark),
|
||||||
],
|
],
|
||||||
rows: List<DataRow>.generate(
|
rows: List<DataRow>.generate(
|
||||||
controller.grnDetails.length, (index) {
|
controller.grnPendingData.length, (index) {
|
||||||
final stoppage = controller.grnDetails[index];
|
final stoppage = controller.grnPendingData[index];
|
||||||
|
|
||||||
return DataRow(
|
return DataRow(
|
||||||
selected: stoppage.isSelected,
|
selected: stoppage.isSelected,
|
||||||
|
@ -127,7 +424,7 @@ class PendingGeneration extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
editableCell(index, "0${index + 1}"),
|
// editableCell(index, "0${index + 1}"),
|
||||||
editableCell(index, stoppage.plantCode ?? ""),
|
editableCell(index, stoppage.plantCode ?? ""),
|
||||||
editableCell(index, stoppage.plantCode ?? ""),
|
editableCell(index, stoppage.plantCode ?? ""),
|
||||||
|
|
||||||
|
@ -154,9 +451,9 @@ class PendingGeneration extends StatelessWidget {
|
||||||
editableCell(index,
|
editableCell(index,
|
||||||
stoppage.freightRate?.toString() ?? ""),
|
stoppage.freightRate?.toString() ?? ""),
|
||||||
editableCell(
|
editableCell(
|
||||||
index, stoppage.freightRate?.toString() ?? ""),
|
index, stoppage.shipmentCost?.toString() ?? ""),
|
||||||
editableCell(
|
editableCell(
|
||||||
index, stoppage.freightRate?.toString() ?? ""),
|
index, stoppage.remark?.toString() ?? ""),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
@ -170,6 +467,8 @@ class PendingGeneration extends StatelessWidget {
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
}),
|
||||||
|
],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +1,310 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:shayog/components/common/common_btn.dart';
|
import 'package:shayog/components/common/common_btn.dart';
|
||||||
|
import 'package:shayog/components/styles/textStyles.dart';
|
||||||
import 'package:shayog/feature/presentation/screens/transporter/model/view_freight_bill_res_model.dart';
|
import 'package:shayog/feature/presentation/screens/transporter/model/view_freight_bill_res_model.dart';
|
||||||
|
import 'package:sizer/sizer.dart';
|
||||||
|
import 'package:vph_web_date_picker/vph_web_date_picker.dart';
|
||||||
import '../../../../../../../components/common/data_cell.dart';
|
import '../../../../../../../components/common/data_cell.dart';
|
||||||
|
|
||||||
import '../../../../../../../components/styles/app_colors.dart';
|
import '../../../../../../../components/styles/app_colors.dart';
|
||||||
import '../../../../../../../components/styles/app_strings.dart';
|
import '../../../../../../../components/styles/app_strings.dart';
|
||||||
|
import '../../../../../../components/common/common_button.dart';
|
||||||
|
import '../../../../../../components/common/custom_drop_down.dart';
|
||||||
|
import '../../../../widgets/custom_pagination.dart';
|
||||||
|
import '../../../../widgets/text_view.dart';
|
||||||
import '../../view_model/transport_controller.dart';
|
import '../../view_model/transport_controller.dart';
|
||||||
|
import '../../widgets/common_card.dart';
|
||||||
|
import '../../widgets/freightbill_dialog.dart';
|
||||||
|
|
||||||
class ViewFreightBill extends StatelessWidget {
|
class ViewFreightBill extends StatelessWidget {
|
||||||
ViewFreightBill({super.key});
|
ViewFreightBill({super.key});
|
||||||
|
|
||||||
final ScrollController horizontalScrollController = ScrollController();
|
final ScrollController horizontalScrollController = ScrollController();
|
||||||
final ScrollController verticalScrollController = ScrollController();
|
final ScrollController verticalScrollController = ScrollController();
|
||||||
final ctrl = Get.put(TransportController());
|
final controller = Get.put(TransportController());
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Obx(() {
|
return Column(
|
||||||
if (ctrl.freightViewLoader.value) {
|
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"),
|
||||||
|
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 ?? "";
|
||||||
|
print(
|
||||||
|
"selectPlant${controller.selectPlant.value}");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
hintText: "Select Plant",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: 16),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
TextView(text: "Product Name"),
|
||||||
|
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"),
|
||||||
|
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;
|
||||||
|
print(
|
||||||
|
"selectTransactionType${controller.selectTransactionType.value}");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
hintText: "Select Transaction Type",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 16.0, left: 0, right: 8),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
TextView(text: "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(),
|
||||||
|
);
|
||||||
|
|
||||||
|
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),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
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(
|
||||||
|
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: () {},
|
||||||
|
),
|
||||||
|
SizedBox(width: 16),
|
||||||
|
CommonButton(
|
||||||
|
borderRadius: 4,
|
||||||
|
height: 30,
|
||||||
|
width: 100,
|
||||||
|
text: AppStrings.submit,
|
||||||
|
clickAction: () {
|
||||||
|
controller.postData();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
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",
|
||||||
|
|
||||||
|
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(
|
return Center(
|
||||||
child: CircularProgressIndicator(
|
child: CircularProgressIndicator(
|
||||||
color: AppColors.primaryClr,
|
color: AppColors.primaryClr,
|
||||||
|
@ -53,23 +336,22 @@ class ViewFreightBill extends StatelessWidget {
|
||||||
headingRowHeight: 38,
|
headingRowHeight: 38,
|
||||||
headingRowColor:
|
headingRowColor:
|
||||||
WidgetStateProperty.all(AppColors.clrF2),
|
WidgetStateProperty.all(AppColors.clrF2),
|
||||||
|
|
||||||
border: TableBorder(
|
border: TableBorder(
|
||||||
horizontalInside:
|
horizontalInside:
|
||||||
BorderSide(color: AppColors.clrGrey),
|
BorderSide(color: AppColors.clrGrey),
|
||||||
verticalInside: BorderSide(color: AppColors.clrGrey),
|
verticalInside:
|
||||||
|
BorderSide(color: AppColors.clrGrey),
|
||||||
bottom: BorderSide(color: AppColors.clrGrey),
|
bottom: BorderSide(color: AppColors.clrGrey),
|
||||||
left: BorderSide(color: AppColors.clrGrey),
|
left: BorderSide(color: AppColors.clrGrey),
|
||||||
right: BorderSide(color: AppColors.clrGrey),
|
right: BorderSide(color: AppColors.clrGrey),
|
||||||
top: BorderSide(color: AppColors.clrGrey),
|
top: BorderSide(color: AppColors.clrGrey),
|
||||||
),
|
),
|
||||||
columns: [
|
columns: [
|
||||||
|
|
||||||
dataColumn(AppStrings.srNo),
|
dataColumn(AppStrings.srNo),
|
||||||
dataColumn(AppStrings.plant),
|
dataColumn(AppStrings.plant),
|
||||||
dataColumn(
|
dataColumn(
|
||||||
AppStrings.productName,
|
AppStrings.productName,
|
||||||
onSort: (_, __) => ctrl.changeSort(
|
onSort: (_, __) => controller.changeSort(
|
||||||
AppStrings.productName.toLowerCase()),
|
AppStrings.productName.toLowerCase()),
|
||||||
),
|
),
|
||||||
dataColumn(AppStrings.freightBillNo),
|
dataColumn(AppStrings.freightBillNo),
|
||||||
|
@ -109,13 +391,14 @@ class ViewFreightBill extends StatelessWidget {
|
||||||
dataColumn("${AppStrings.amount} 5"),
|
dataColumn("${AppStrings.amount} 5"),
|
||||||
],
|
],
|
||||||
rows: List<DataRow>.generate(
|
rows: List<DataRow>.generate(
|
||||||
ctrl.freightBillData.length, (index) {
|
controller.freightBillData.length, (index) {
|
||||||
final freightBill = ctrl.freightBillData[index];
|
final freightBill =
|
||||||
|
controller.freightBillData[index];
|
||||||
return DataRow(
|
return DataRow(
|
||||||
cells: [
|
cells: [
|
||||||
editableCell(index, "0${index + 1}"),
|
editableCell(index, "0${index + 1}"),
|
||||||
editableCell(index, "${freightBill.plantCode}"),
|
editableCell(
|
||||||
|
index, "${freightBill.plantCode}"),
|
||||||
editableCell(index, "${freightBill.status}"),
|
editableCell(index, "${freightBill.status}"),
|
||||||
editableCell(
|
editableCell(
|
||||||
index,
|
index,
|
||||||
|
@ -126,52 +409,63 @@ class ViewFreightBill extends StatelessWidget {
|
||||||
context, freightBill);
|
context, freightBill);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
editableCell(index, "${freightBill.utr1Date}"),
|
|
||||||
editableCell(
|
editableCell(
|
||||||
index, "${freightBill.trasnporterInvoiceNo}"),
|
index, "${freightBill.utr1Date}"),
|
||||||
|
editableCell(index,
|
||||||
|
"${freightBill.trasnporterInvoiceNo}"),
|
||||||
editableCell(index,
|
editableCell(index,
|
||||||
"${freightBill.trasnporterInvoiceNoDate}"),
|
"${freightBill.trasnporterInvoiceNoDate}"),
|
||||||
editableCell(index, "${freightBill.billingQty}"),
|
editableCell(
|
||||||
|
index, "${freightBill.billingQty}"),
|
||||||
editableCell(index, "${freightBill.uom}"),
|
editableCell(index, "${freightBill.uom}"),
|
||||||
editableCell(
|
editableCell(
|
||||||
index, "${freightBill.freightAmount}"),
|
index, "${freightBill.freightAmount}"),
|
||||||
editableCell(index, "${freightBill.cgst}"),
|
editableCell(index, "${freightBill.cgst}"),
|
||||||
editableCell(index, "${freightBill.sgst}"),
|
editableCell(index, "${freightBill.sgst}"),
|
||||||
editableCell(index, "${freightBill.igst}"),
|
editableCell(index, "${freightBill.igst}"),
|
||||||
editableCell(index, "${freightBill.totalGst}"),
|
editableCell(
|
||||||
editableCell(index, "${freightBill.totalGst}"),
|
index, "${freightBill.totalGst}"),
|
||||||
|
editableCell(
|
||||||
|
index, "${freightBill.totalGst}"),
|
||||||
editableCell(
|
editableCell(
|
||||||
index, "${freightBill.freightAmount}"),
|
index, "${freightBill.freightAmount}"),
|
||||||
editableCell(index,
|
editableCell(index,
|
||||||
"${freightBill.trasnporterInvoiceNoDate}"),
|
"${freightBill.trasnporterInvoiceNoDate}"),
|
||||||
editableCell(index, "${freightBill.status}"),
|
editableCell(index, "${freightBill.status}"),
|
||||||
editableCell(index, "${freightBill.totalGst}"),
|
editableCell(
|
||||||
|
index, "${freightBill.totalGst}"),
|
||||||
editableCell(index,
|
editableCell(index,
|
||||||
"${freightBill.trasnporterInvoiceNoDate}"),
|
"${freightBill.trasnporterInvoiceNoDate}"),
|
||||||
editableCell(index, "${freightBill.utr5No}"),
|
editableCell(index, "${freightBill.utr5No}"),
|
||||||
editableCell(index, "${freightBill.utr1Date}"),
|
editableCell(
|
||||||
|
index, "${freightBill.utr1Date}"),
|
||||||
editableCell(
|
editableCell(
|
||||||
index, "${freightBill.freightAmount}"),
|
index, "${freightBill.freightAmount}"),
|
||||||
editableCell(index, "${freightBill.utr1No}"),
|
editableCell(index, "${freightBill.utr1No}"),
|
||||||
editableCell(index, "${freightBill.utr1Date}"),
|
|
||||||
editableCell(
|
editableCell(
|
||||||
index, "${freightBill.utr1PaymentAmount}"),
|
index, "${freightBill.utr1Date}"),
|
||||||
|
editableCell(index,
|
||||||
|
"${freightBill.utr1PaymentAmount}"),
|
||||||
editableCell(index, "${freightBill.utr2No}"),
|
editableCell(index, "${freightBill.utr2No}"),
|
||||||
editableCell(index, "${freightBill.utr2Date}"),
|
|
||||||
editableCell(
|
editableCell(
|
||||||
index, "${freightBill.utr2PaymentAmount}"),
|
index, "${freightBill.utr2Date}"),
|
||||||
|
editableCell(index,
|
||||||
|
"${freightBill.utr2PaymentAmount}"),
|
||||||
editableCell(index, "${freightBill.utr3No}"),
|
editableCell(index, "${freightBill.utr3No}"),
|
||||||
editableCell(index, "${freightBill.utr3Date}"),
|
|
||||||
editableCell(
|
editableCell(
|
||||||
index, "${freightBill.utr3PaymentAmount}"),
|
index, "${freightBill.utr3Date}"),
|
||||||
|
editableCell(index,
|
||||||
|
"${freightBill.utr3PaymentAmount}"),
|
||||||
editableCell(index, "${freightBill.utr4No}"),
|
editableCell(index, "${freightBill.utr4No}"),
|
||||||
editableCell(index, "${freightBill.utr4Date}"),
|
|
||||||
editableCell(
|
editableCell(
|
||||||
index, "${freightBill.utr4PaymentAmount}"),
|
index, "${freightBill.utr4Date}"),
|
||||||
|
editableCell(index,
|
||||||
|
"${freightBill.utr4PaymentAmount}"),
|
||||||
editableCell(index, "${freightBill.utr5No}"),
|
editableCell(index, "${freightBill.utr5No}"),
|
||||||
editableCell(index, "${freightBill.utr5Date}"),
|
|
||||||
editableCell(
|
editableCell(
|
||||||
index, "${freightBill.utr5PaymentAmount}"),
|
index, "${freightBill.utr5Date}"),
|
||||||
|
editableCell(index,
|
||||||
|
"${freightBill.utr5PaymentAmount}"),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
@ -181,40 +475,19 @@ class ViewFreightBill extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Align(
|
CustomPagination(
|
||||||
alignment: Alignment.bottomRight,
|
currentPage: controller.currentPage.value,
|
||||||
child: Container(
|
totalPages: controller.totalPages.value,
|
||||||
padding: const EdgeInsets.only(bottom: 16),
|
onPageChanged: (int page) {
|
||||||
child: Row(
|
controller.onPageChanged(page);
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
},
|
||||||
children: [
|
|
||||||
IconButton(
|
|
||||||
icon: Icon(Icons.chevron_left),
|
|
||||||
onPressed: ctrl.currentPage.value > 0
|
|
||||||
? () => ctrl.previousPage()
|
|
||||||
: null,
|
|
||||||
),
|
),
|
||||||
SizedBox(width: 16),
|
|
||||||
Text(
|
|
||||||
'Page ${ctrl.currentPage.value + 1} of ${ctrl.totalPages.value}',
|
|
||||||
style: TextStyle(fontSize: 16),
|
|
||||||
),
|
|
||||||
SizedBox(width: 16),
|
|
||||||
IconButton(
|
|
||||||
icon: Icon(Icons.chevron_right),
|
|
||||||
onPressed: ctrl.currentPage.value < ctrl.totalPages.value - 1
|
|
||||||
? () => ctrl.nextPage()
|
|
||||||
: null,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
}),
|
||||||
|
],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void showFreightBillDetailsDialog(
|
void showFreightBillDetailsDialog(
|
||||||
|
@ -279,7 +552,7 @@ class ViewFreightBill extends StatelessWidget {
|
||||||
dataColumn(AppStrings.mrnNo),
|
dataColumn(AppStrings.mrnNo),
|
||||||
dataColumn(
|
dataColumn(
|
||||||
AppStrings.plantName,
|
AppStrings.plantName,
|
||||||
onSort: (_, __) => ctrl.changeSort(
|
onSort: (_, __) => controller.changeSort(
|
||||||
AppStrings.productName.toLowerCase()),
|
AppStrings.productName.toLowerCase()),
|
||||||
),
|
),
|
||||||
dataColumn(AppStrings.product),
|
dataColumn(AppStrings.product),
|
||||||
|
@ -296,8 +569,9 @@ class ViewFreightBill extends StatelessWidget {
|
||||||
dataColumn(AppStrings.freightAmount),
|
dataColumn(AppStrings.freightAmount),
|
||||||
],
|
],
|
||||||
rows: List<DataRow>.generate(
|
rows: List<DataRow>.generate(
|
||||||
ctrl.freightBillData.length, (index) {
|
controller.freightBillData.length, (index) {
|
||||||
final freightBill = ctrl.freightBillData[index];
|
final freightBill =
|
||||||
|
controller.freightBillData[index];
|
||||||
return DataRow(
|
return DataRow(
|
||||||
cells: [
|
cells: [
|
||||||
editableCell(index, "0${index + 1}"),
|
editableCell(index, "0${index + 1}"),
|
||||||
|
|
|
@ -71,7 +71,6 @@ class _TransportViewState extends State<TransportView> {
|
||||||
text: ctrl.tabs[index].title ?? "",
|
text: ctrl.tabs[index].title ?? "",
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: 10.txtBoldWhite,
|
style: 10.txtBoldWhite,
|
||||||
|
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -114,7 +113,7 @@ class _TransportViewState extends State<TransportView> {
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
height: 60,
|
height: 50,
|
||||||
color: AppColors.primaryClr,
|
color: AppColors.primaryClr,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
|
@ -133,16 +132,15 @@ class _TransportViewState extends State<TransportView> {
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border(
|
border: Border(
|
||||||
bottom: BorderSide(
|
bottom: BorderSide(
|
||||||
color: ctrl.selectedUser.value == index
|
color:
|
||||||
|
ctrl.selectedUser.value == index
|
||||||
? Colors.white
|
? Colors.white
|
||||||
: AppColors.primaryClr,
|
: AppColors.primaryClr,
|
||||||
width: 3))),
|
width: 3))),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: TextView(
|
child: TextView(
|
||||||
text:
|
text: ctrl.userTabs[index].title ?? "",
|
||||||
ctrl.userTabs[index].title ?? "",
|
|
||||||
style: 12.txtBoldWhite,
|
style: 12.txtBoldWhite,
|
||||||
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -156,7 +154,6 @@ class _TransportViewState extends State<TransportView> {
|
||||||
),
|
),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
InkWell(
|
InkWell(
|
||||||
|
|
||||||
child: Image.asset(AppImages.refresh,
|
child: Image.asset(AppImages.refresh,
|
||||||
height: 16, width: 16)),
|
height: 16, width: 16)),
|
||||||
Padding(
|
Padding(
|
||||||
|
@ -164,11 +161,10 @@ class _TransportViewState extends State<TransportView> {
|
||||||
child: Text(
|
child: Text(
|
||||||
AppStrings.refresh,
|
AppStrings.refresh,
|
||||||
style: 12.txtBoldWhite,
|
style: 12.txtBoldWhite,
|
||||||
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Obx(() =>
|
Obx(
|
||||||
Visibility(
|
() => Visibility(
|
||||||
visible: ctrl.selectedUser.value >= 1,
|
visible: ctrl.selectedUser.value >= 1,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: ctrl.toggleContainer,
|
onTap: ctrl.toggleContainer,
|
||||||
|
@ -183,8 +179,6 @@ class _TransportViewState extends State<TransportView> {
|
||||||
child: TextView(
|
child: TextView(
|
||||||
text: AppStrings.filter,
|
text: AppStrings.filter,
|
||||||
style: 12.txtBoldWhite,
|
style: 12.txtBoldWhite,
|
||||||
|
|
||||||
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -209,8 +203,7 @@ class _TransportViewState extends State<TransportView> {
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
TextView(
|
TextView(
|
||||||
text:
|
text: "Plant",
|
||||||
"Plant",
|
|
||||||
),
|
),
|
||||||
SizedBox(height: 8),
|
SizedBox(height: 8),
|
||||||
CustomDropdown(
|
CustomDropdown(
|
||||||
|
@ -243,7 +236,8 @@ class _TransportViewState extends State<TransportView> {
|
||||||
itemLabel: (item) => item,
|
itemLabel: (item) => item,
|
||||||
onSelected: (selected) {
|
onSelected: (selected) {
|
||||||
if (selected != null) {
|
if (selected != null) {
|
||||||
ctrl.selectedFreight.value = selected;
|
ctrl.selectedFreight.value =
|
||||||
|
selected;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
hintText: 'Select Freight Number'),
|
hintText: 'Select Freight Number'),
|
||||||
|
@ -256,8 +250,7 @@ class _TransportViewState extends State<TransportView> {
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
TextView(
|
TextView(
|
||||||
text:
|
text: "Product Name",
|
||||||
"Product Name",
|
|
||||||
),
|
),
|
||||||
SizedBox(height: 8),
|
SizedBox(height: 8),
|
||||||
CustomDropdown(
|
CustomDropdown(
|
||||||
|
@ -275,10 +268,8 @@ class _TransportViewState extends State<TransportView> {
|
||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Padding(
|
SizedBox(height: 12),
|
||||||
padding: const EdgeInsets.only(
|
Row(
|
||||||
top: 16.0, left: 8, right: 8),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
|
@ -287,8 +278,7 @@ class _TransportViewState extends State<TransportView> {
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
TextView(
|
TextView(
|
||||||
text:
|
text: "Plant",
|
||||||
"Plant",
|
|
||||||
),
|
),
|
||||||
SizedBox(height: 8),
|
SizedBox(height: 8),
|
||||||
CustomDropdown(
|
CustomDropdown(
|
||||||
|
@ -298,12 +288,11 @@ class _TransportViewState extends State<TransportView> {
|
||||||
itemLabel: (item) => item,
|
itemLabel: (item) => item,
|
||||||
onSelected: (selected) {
|
onSelected: (selected) {
|
||||||
if (selected != null) {
|
if (selected != null) {
|
||||||
ctrl.selectedPlant.value = selected;
|
ctrl.selectedPlant.value =
|
||||||
|
selected;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
hintText: 'Select Product'),
|
hintText: 'Select Product'),
|
||||||
|
|
||||||
|
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
SizedBox(width: 16),
|
SizedBox(width: 16),
|
||||||
|
@ -314,8 +303,7 @@ class _TransportViewState extends State<TransportView> {
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
TextView(
|
TextView(
|
||||||
text:
|
text: "Transaction Type",
|
||||||
"Transaction Type",
|
|
||||||
),
|
),
|
||||||
SizedBox(height: 8),
|
SizedBox(height: 8),
|
||||||
CustomDropdown(
|
CustomDropdown(
|
||||||
|
@ -325,12 +313,11 @@ class _TransportViewState extends State<TransportView> {
|
||||||
itemLabel: (item) => item,
|
itemLabel: (item) => item,
|
||||||
onSelected: (selected) {
|
onSelected: (selected) {
|
||||||
if (selected != null) {
|
if (selected != null) {
|
||||||
ctrl.selectedPlant.value = selected;
|
ctrl.selectedPlant.value =
|
||||||
|
selected;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
hintText: 'Select Product'),
|
hintText: 'Select Product'),
|
||||||
|
|
||||||
|
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
SizedBox(width: 16),
|
SizedBox(width: 16),
|
||||||
|
@ -338,8 +325,7 @@ class _TransportViewState extends State<TransportView> {
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
TextView(
|
TextView(
|
||||||
text:
|
text: "",
|
||||||
"" ,
|
|
||||||
),
|
),
|
||||||
SizedBox(height: 8),
|
SizedBox(height: 8),
|
||||||
Row(
|
Row(
|
||||||
|
@ -348,13 +334,16 @@ class _TransportViewState extends State<TransportView> {
|
||||||
children: [
|
children: [
|
||||||
CommonBtn(
|
CommonBtn(
|
||||||
bkClr: Colors.white,
|
bkClr: Colors.white,
|
||||||
text: AppStrings.cancel, clickAction: () {
|
text: AppStrings.cancel,
|
||||||
|
clickAction: () {
|
||||||
ctrl.isSelected.value = false;
|
ctrl.isSelected.value = false;
|
||||||
},),
|
},
|
||||||
|
),
|
||||||
SizedBox(width: 16),
|
SizedBox(width: 16),
|
||||||
CommonBtn(
|
CommonBtn(
|
||||||
text: AppStrings.submit,
|
text: AppStrings.submit,
|
||||||
style: 14.txtBoldWhite, clickAction: () {
|
style: 14.txtSBoldWhite,
|
||||||
|
clickAction: () {
|
||||||
ctrl.isSelected.value = false;
|
ctrl.isSelected.value = false;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -365,9 +354,6 @@ class _TransportViewState extends State<TransportView> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
|
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -389,6 +375,4 @@ class _TransportViewState extends State<TransportView> {
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:intl/intl.dart';
|
|
||||||
|
|
||||||
import 'package:shayog/components/styles/app_images.dart';
|
import 'package:shayog/components/styles/app_images.dart';
|
||||||
import 'package:shayog/services/network/get_requests.dart';
|
import 'package:shayog/services/network/get_requests.dart';
|
||||||
|
|
||||||
import '../../../../../../components/common/common_model.dart';
|
import '../../../../../../components/common/common_model.dart';
|
||||||
import '../../../../../../components/styles/app_strings.dart';
|
import '../../../../../../components/styles/app_strings.dart';
|
||||||
|
|
||||||
import '../../../../../../services/model/generate_freight_model.dart';
|
import '../../../../../../services/model/generate_freight_model.dart';
|
||||||
import '../../../../../../services/network/post_request.dart';
|
import '../../../../../../services/network/post_request.dart';
|
||||||
|
import '../model/freightbill_res_model.dart';
|
||||||
|
import '../model/grn_panding_res_model.dart';
|
||||||
import '../model/view_freight_bill_res_model.dart';
|
import '../model/view_freight_bill_res_model.dart';
|
||||||
|
|
||||||
class TransportController extends GetxController {
|
class TransportController extends GetxController {
|
||||||
|
@ -17,14 +16,14 @@ class TransportController extends GetxController {
|
||||||
final ScrollController verticalScrollController = ScrollController();
|
final ScrollController verticalScrollController = ScrollController();
|
||||||
var selectedIndex = 0.obs;
|
var selectedIndex = 0.obs;
|
||||||
var selectedUser = 0.obs;
|
var selectedUser = 0.obs;
|
||||||
var selectPlant = ''.obs;
|
RxString selectPlant = ''.obs;
|
||||||
var selectProduct = ''.obs;
|
var selectProduct = ''.obs;
|
||||||
var selectLocation = ''.obs;
|
var selectLocation = ''.obs;
|
||||||
var selectTransactionType = ''.obs;
|
var selectTransactionType = ''.obs;
|
||||||
var selectedItem = false.obs;
|
var selectedItem = false.obs;
|
||||||
var grnDetails = <Content>[].obs;
|
var grnDetails = <Content>[].obs;
|
||||||
var product = [].obs;
|
var product = <Prodect>[].obs;
|
||||||
var plant = [].obs;
|
var plant = <Plant>[].obs;
|
||||||
var freightBill = [].obs;
|
var freightBill = [].obs;
|
||||||
var fromLocation = [].obs;
|
var fromLocation = [].obs;
|
||||||
var grnList = [].obs;
|
var grnList = [].obs;
|
||||||
|
@ -47,6 +46,8 @@ class TransportController extends GetxController {
|
||||||
void onInit() {
|
void onInit() {
|
||||||
getFreightBills();
|
getFreightBills();
|
||||||
viewFreightView();
|
viewFreightView();
|
||||||
|
grnPending();
|
||||||
|
|
||||||
super.onInit();
|
super.onInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,10 +73,11 @@ class TransportController extends GetxController {
|
||||||
CommonModel(title: AppStrings.pendingGeneration),
|
CommonModel(title: AppStrings.pendingGeneration),
|
||||||
].obs;
|
].obs;
|
||||||
|
|
||||||
var isLoading = true.obs;
|
var isLoading = false.obs;
|
||||||
var grnListLoader = true.obs;
|
var grnListLoader = false.obs;
|
||||||
var freightViewLoader = true.obs;
|
var freightViewLoader = false.obs;
|
||||||
var generateBill = true.obs;
|
var generateBill = false.obs;
|
||||||
|
var grnPendingLoader = false.obs;
|
||||||
var errorMessage = ''.obs;
|
var errorMessage = ''.obs;
|
||||||
|
|
||||||
postData() async {
|
postData() async {
|
||||||
|
@ -199,19 +201,56 @@ class TransportController extends GetxController {
|
||||||
|
|
||||||
////////////////////////////////////////// PRIYA ///////////////////////////////////////////////
|
////////////////////////////////////////// PRIYA ///////////////////////////////////////////////
|
||||||
var freightBillData = <FreightBill>[].obs;
|
var freightBillData = <FreightBill>[].obs;
|
||||||
var currentPage = 0.obs;
|
|
||||||
var totalPages = 0.obs;
|
|
||||||
var totalElements = 0.obs;
|
var totalElements = 0.obs;
|
||||||
var pageSize = 2.obs;
|
var pageSize = 2.obs;
|
||||||
var sortField = "grn_date".obs;
|
var sortField = "grn_date".obs;
|
||||||
var sortDirection = "desc".obs;
|
var sortDirection = "desc".obs;
|
||||||
viewFreightView({int? page, String? sort, String? direction}) async {
|
// 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 {
|
try {
|
||||||
freightViewLoader.value = true;
|
freightViewLoader.value = true;
|
||||||
|
|
||||||
currentPage.value = page ?? currentPage.value;
|
// currentPage.value = page ?? currentPage.value;
|
||||||
if (sort != null) sortField.value = sort;
|
// if (sort != null) sortField.value = sort;
|
||||||
if (direction != null) sortDirection.value = direction;
|
// if (direction != null) sortDirection.value = direction;
|
||||||
|
|
||||||
Map<String, String> requestBody = {
|
Map<String, String> requestBody = {
|
||||||
"plant": "",
|
"plant": "",
|
||||||
|
@ -241,15 +280,22 @@ class TransportController extends GetxController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void nextPage() {
|
void nextPage() {
|
||||||
if (currentPage < totalPages.value - 1) {
|
if (currentPage.value < totalPages.value) {
|
||||||
viewFreightView(page: currentPage.value + 1);
|
currentPage.value++;
|
||||||
|
viewFreightView(); // Fetch data for the next page
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void previousPage() {
|
void previousPage() {
|
||||||
if (currentPage > 0) {
|
if (currentPage.value > 1) {
|
||||||
viewFreightView(page: currentPage.value - 1);
|
currentPage.value--;
|
||||||
|
viewFreightView();// Fetch data for the previous page
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void onPageChanged(int page) {
|
||||||
|
currentPage.value = page;
|
||||||
|
viewFreightView();// Fetch data for the selected page
|
||||||
|
}
|
||||||
void changeSort(String field) {
|
void changeSort(String field) {
|
||||||
if (field == sortField.value) {
|
if (field == sortField.value) {
|
||||||
sortDirection.value = sortDirection.value == "asc" ? "desc" : "asc";
|
sortDirection.value = sortDirection.value == "asc" ? "desc" : "asc";
|
||||||
|
@ -257,6 +303,40 @@ class TransportController extends GetxController {
|
||||||
sortField.value = field;
|
sortField.value = field;
|
||||||
sortDirection.value = "desc";
|
sortDirection.value = "desc";
|
||||||
}
|
}
|
||||||
viewFreightView(page: 0);
|
// viewFreightView(page: 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var grnPendingData = <GrnPending>[].obs;
|
||||||
|
grnPending() async {
|
||||||
|
try {
|
||||||
|
grnPendingLoader.value = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Map<String, String> requestBody =
|
||||||
|
{
|
||||||
|
"plant": "",
|
||||||
|
"productNane": "",
|
||||||
|
"transactionType": "",
|
||||||
|
"fromLocation": "",
|
||||||
|
"grnFromDate": "",
|
||||||
|
"grnToDate": ""
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var response = await PostRequests.grnPending(requestBody,
|
||||||
|
);
|
||||||
|
if (response != null) {
|
||||||
|
List<GrnPending> flattenedContent =
|
||||||
|
response.content!.expand((list) => list).toList();
|
||||||
|
grnPendingData.assignAll(flattenedContent);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
grnPendingLoader.value = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,253 @@
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class DropdownDateRange extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_DropdownDateRangeState createState() => _DropdownDateRangeState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DropdownDateRangeState extends State<DropdownDateRange> {
|
||||||
|
bool isCalendarVisible = false;
|
||||||
|
DateTime selectedStartDate = DateTime.now();
|
||||||
|
DateTime selectedEndDate = DateTime.now().add(Duration(days: 5));
|
||||||
|
DateTime displayedStartMonth = DateTime.now();
|
||||||
|
DateTime displayedEndMonth = DateTime.now().add(Duration(days: 60));
|
||||||
|
|
||||||
|
List<String> weekdays = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'];
|
||||||
|
List<String> months = [
|
||||||
|
'January', 'February', 'March', 'April', 'May', 'June',
|
||||||
|
'July', 'August', 'September', 'October', 'November', 'December'
|
||||||
|
];
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Material(
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
// Clickable Container
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
isCalendarVisible = !isCalendarVisible;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(4),
|
||||||
|
border: Border.all(color: Colors.grey.shade300),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'${selectedStartDate.day} ${months[selectedStartDate.month - 1]} ${selectedStartDate.year} - '
|
||||||
|
'${selectedEndDate.day} ${months[selectedEndDate.month - 1]} ${selectedEndDate.year}',
|
||||||
|
style: TextStyle(fontSize: 14),
|
||||||
|
),
|
||||||
|
SizedBox(width: 8),
|
||||||
|
Icon(Icons.arrow_drop_down),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// Dropdown Calendar
|
||||||
|
if (isCalendarVisible)
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(top: 8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.grey.withOpacity(0.2),
|
||||||
|
spreadRadius: 1,
|
||||||
|
blurRadius: 8,
|
||||||
|
offset: Offset(0, 4),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.all(16),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
_buildCalendar(displayedStartMonth, true),
|
||||||
|
SizedBox(width: 32),
|
||||||
|
_buildCalendar(displayedEndMonth, false),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildCalendar(DateTime displayedMonth, bool isStartCalendar) {
|
||||||
|
return Container(
|
||||||
|
width: 280,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
// Month Header
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.all(8),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(Icons.chevron_left),
|
||||||
|
onPressed: () {
|
||||||
|
setState(() {
|
||||||
|
if (isStartCalendar) {
|
||||||
|
displayedStartMonth = DateTime(
|
||||||
|
displayedStartMonth.year,
|
||||||
|
displayedStartMonth.month - 1,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
displayedEndMonth = DateTime(
|
||||||
|
displayedEndMonth.year,
|
||||||
|
displayedEndMonth.month - 1,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'${months[displayedMonth.month - 1]} (${displayedMonth.year})',
|
||||||
|
style: TextStyle(fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(Icons.chevron_right),
|
||||||
|
onPressed: () {
|
||||||
|
setState(() {
|
||||||
|
if (isStartCalendar) {
|
||||||
|
displayedStartMonth = DateTime(
|
||||||
|
displayedStartMonth.year,
|
||||||
|
displayedStartMonth.month + 1,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
displayedEndMonth = DateTime(
|
||||||
|
displayedEndMonth.year,
|
||||||
|
displayedEndMonth.month + 1,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// Weekday Headers
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: weekdays.map((day) =>
|
||||||
|
Container(
|
||||||
|
width: 32,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
day,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: Colors.grey[600],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
).toList(),
|
||||||
|
),
|
||||||
|
|
||||||
|
// Calendar Grid
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 8),
|
||||||
|
child: Column(
|
||||||
|
children: _buildCalendarDays(displayedMonth),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Widget> _buildCalendarDays(DateTime displayedMonth) {
|
||||||
|
List<Widget> weeks = [];
|
||||||
|
DateTime firstDay = DateTime(displayedMonth.year, displayedMonth.month, 1);
|
||||||
|
int daysInMonth = DateTime(displayedMonth.year, displayedMonth.month + 1, 0).day;
|
||||||
|
|
||||||
|
int firstWeekdayOfMonth = firstDay.weekday;
|
||||||
|
int currentDay = 1 - firstWeekdayOfMonth + 1;
|
||||||
|
|
||||||
|
for (int week = 0; week < 6; week++) {
|
||||||
|
List<Widget> days = [];
|
||||||
|
|
||||||
|
for (int i = 0; i < 7; i++) {
|
||||||
|
if (currentDay <= 0 || currentDay > daysInMonth) {
|
||||||
|
days.add(Container(width: 32, height: 32));
|
||||||
|
} else {
|
||||||
|
final date = DateTime(displayedMonth.year, displayedMonth.month, currentDay);
|
||||||
|
final isSelected = date.isAfter(selectedStartDate.subtract(Duration(days: 1))) &&
|
||||||
|
date.isBefore(selectedEndDate.add(Duration(days: 1)));
|
||||||
|
final isToday = date.year == DateTime.now().year &&
|
||||||
|
date.month == DateTime.now().month &&
|
||||||
|
date.day == DateTime.now().day;
|
||||||
|
|
||||||
|
days.add(
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
if (date.isBefore(selectedEndDate)) {
|
||||||
|
selectedStartDate = date;
|
||||||
|
} else {
|
||||||
|
selectedEndDate = date;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
width: 32,
|
||||||
|
height: 32,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: isSelected ? Colors.blue : Colors.transparent,
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
border: isToday ? Border.all(color: Colors.blue) : null,
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
currentDay.toString(),
|
||||||
|
style: TextStyle(
|
||||||
|
color: isSelected ? Colors.white : Colors.black,
|
||||||
|
fontWeight: isToday ? FontWeight.bold : FontWeight.normal,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
currentDay++;
|
||||||
|
}
|
||||||
|
|
||||||
|
weeks.add(
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: days,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return weeks;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,83 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:shayog/components/styles/textStyles.dart';
|
||||||
|
import 'dart:math' as math;
|
||||||
|
import '../../../components/styles/app_colors.dart';
|
||||||
|
|
||||||
|
class CustomPagination extends StatelessWidget {
|
||||||
|
final int currentPage;
|
||||||
|
final int totalPages;
|
||||||
|
final Function(int) onPageChanged;
|
||||||
|
|
||||||
|
const CustomPagination({
|
||||||
|
super.key,
|
||||||
|
required this.currentPage,
|
||||||
|
required this.totalPages,
|
||||||
|
required this.onPageChanged,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
//color: Colors.grey[200],
|
||||||
|
border: Border(
|
||||||
|
top: BorderSide(color: Colors.grey[300]!),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end, // Center the pagination
|
||||||
|
children: [
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.chevron_left),
|
||||||
|
onPressed:
|
||||||
|
currentPage > 1 ? () => onPageChanged(currentPage - 1) : null,
|
||||||
|
),
|
||||||
|
_buildPageButton(1),
|
||||||
|
if (currentPage > 3)
|
||||||
|
const Text('...', style: TextStyle(fontSize: 20)),
|
||||||
|
for (int i = math.max(2, currentPage - 1);
|
||||||
|
i <= math.min(totalPages - 1, currentPage + 1);
|
||||||
|
i++)
|
||||||
|
_buildPageButton(i),
|
||||||
|
if (currentPage < totalPages - 2)
|
||||||
|
const Text('...', style: TextStyle(fontSize: 20)),
|
||||||
|
if (totalPages > 1) _buildPageButton(totalPages),
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.chevron_right),
|
||||||
|
onPressed: currentPage < totalPages
|
||||||
|
? () => onPageChanged(currentPage + 1)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildPageButton(int pageNumber) {
|
||||||
|
final isSelected = pageNumber == currentPage;
|
||||||
|
|
||||||
|
return InkWell(
|
||||||
|
onTap: () => onPageChanged(pageNumber),
|
||||||
|
child: Container(
|
||||||
|
height: 25,
|
||||||
|
width: 25,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
border: Border.all(
|
||||||
|
color: isSelected ? AppColors.primaryClr : AppColors.primaryClr),
|
||||||
|
color: isSelected ? AppColors.primaryClr : Colors.transparent,
|
||||||
|
),
|
||||||
|
margin: EdgeInsets.symmetric(horizontal: 4.0),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
pageNumber.toString(),
|
||||||
|
style: isSelected ? 12.txtBoldWhite : 12.txtBoldBlue,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ class MyApp extends StatelessWidget {
|
||||||
return GetMaterialApp(
|
return GetMaterialApp(
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
title: 'Shayog',
|
title: 'Shayog',
|
||||||
initialRoute: PageRoutes.login,
|
initialRoute: PageRoutes.dashboard,
|
||||||
onGenerateRoute: Navigation.onGenerateRoutes,
|
onGenerateRoute: Navigation.onGenerateRoutes,
|
||||||
// home: DashboardScreen(),
|
// home: DashboardScreen(),
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,4 +1,252 @@
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// import 'dart:convert';
|
||||||
|
//
|
||||||
|
// GenerateFreightBills generateFreightBillsFromJson(String str) => GenerateFreightBills.fromJson(json.decode(str));
|
||||||
|
//
|
||||||
|
// String generateFreightBillsToJson(GenerateFreightBills data) => json.encode(data.toJson());
|
||||||
|
//
|
||||||
|
// class GenerateFreightBills {
|
||||||
|
// final List<List<Content>>? content;
|
||||||
|
// final Pageable? pageable;
|
||||||
|
// final bool? last;
|
||||||
|
// final int? totalElements;
|
||||||
|
// final int? totalPages;
|
||||||
|
// final int? size;
|
||||||
|
// final int? number;
|
||||||
|
// final Sort? sort;
|
||||||
|
// final bool? first;
|
||||||
|
// final int? numberOfElements;
|
||||||
|
// final bool? empty;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// GenerateFreightBills({
|
||||||
|
// this.content,
|
||||||
|
// this.pageable,
|
||||||
|
// this.last,
|
||||||
|
// this.totalElements,
|
||||||
|
// this.totalPages,
|
||||||
|
// this.size,
|
||||||
|
// this.number,
|
||||||
|
// this.sort,
|
||||||
|
// this.first,
|
||||||
|
// this.numberOfElements,
|
||||||
|
// this.empty,
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// factory GenerateFreightBills.fromJson(Map<String, dynamic> json) => GenerateFreightBills(
|
||||||
|
// content: json["content"] == null ? [] : List<List<Content>>.from(json["content"]!.map((x) => List<Content>.from(x.map((x) => Content.fromJson(x))))),
|
||||||
|
// pageable: json["pageable"] == null ? null : Pageable.fromJson(json["pageable"]),
|
||||||
|
// last: json["last"],
|
||||||
|
// totalElements: json["totalElements"],
|
||||||
|
// totalPages: json["totalPages"],
|
||||||
|
// size: json["size"],
|
||||||
|
// number: json["number"],
|
||||||
|
// sort: json["sort"] == null ? null : Sort.fromJson(json["sort"]),
|
||||||
|
// first: json["first"],
|
||||||
|
// numberOfElements: json["numberOfElements"],
|
||||||
|
// empty: json["empty"],
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// Map<String, dynamic> toJson() => {
|
||||||
|
// "content": content == null ? [] : List<dynamic>.from(content!.map((x) => List<dynamic>.from(x.map((x) => x.toJson())))),
|
||||||
|
// "pageable": pageable?.toJson(),
|
||||||
|
// "last": last,
|
||||||
|
// "totalElements": totalElements,
|
||||||
|
// "totalPages": totalPages,
|
||||||
|
// "size": size,
|
||||||
|
// "number": number,
|
||||||
|
// "sort": sort?.toJson(),
|
||||||
|
// "first": first,
|
||||||
|
// "numberOfElements": numberOfElements,
|
||||||
|
// "empty": empty,
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// class Content {
|
||||||
|
// final int? grnId;
|
||||||
|
// final String? grnNo;
|
||||||
|
// final String? plantCode;
|
||||||
|
// final String? materialCode;
|
||||||
|
// final CodeValue? codeValue;
|
||||||
|
// final String? transporterCode;
|
||||||
|
// final DateTime? grnDate;
|
||||||
|
// final String? fromLocation;
|
||||||
|
// final String? vehicleNo;
|
||||||
|
// // final FromLocation? fromLocation;
|
||||||
|
// // final VehicleNo? vehicleNo;
|
||||||
|
// final String? lrNo;
|
||||||
|
// final DateTime? lrDate;
|
||||||
|
// final double? dispQty;
|
||||||
|
// final double? netQty;
|
||||||
|
// final double? billingQty;
|
||||||
|
// final int? freightRate;
|
||||||
|
// final double? shipmentCost;
|
||||||
|
// final int? statusId;
|
||||||
|
// bool isSelected;
|
||||||
|
//
|
||||||
|
// Content({
|
||||||
|
// this.grnId,
|
||||||
|
// this.grnNo,
|
||||||
|
// this.plantCode,
|
||||||
|
// this.materialCode,
|
||||||
|
// this.codeValue,
|
||||||
|
// this.transporterCode,
|
||||||
|
// this.grnDate,
|
||||||
|
// this.fromLocation,
|
||||||
|
// this.vehicleNo,
|
||||||
|
// this.lrNo,
|
||||||
|
// this.lrDate,
|
||||||
|
// this.dispQty,
|
||||||
|
// this.netQty,
|
||||||
|
// this.billingQty,
|
||||||
|
// this.freightRate,
|
||||||
|
// this.shipmentCost,
|
||||||
|
// this.statusId,
|
||||||
|
// this.isSelected = false,
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// factory Content.fromJson(Map<String, dynamic> json) => Content(
|
||||||
|
// grnId: json["grn_id"],
|
||||||
|
// grnNo: json["grn_no"],
|
||||||
|
// plantCode: json["plant_code"],
|
||||||
|
// materialCode: json["material_code"],
|
||||||
|
// codeValue: codeValueValues.map[json["code_value"]]!,
|
||||||
|
// transporterCode: json["transporter_code"],
|
||||||
|
// grnDate: json["grn_date"] == null ? null : DateTime.parse(json["grn_date"]),
|
||||||
|
// // fromLocation: fromLocationValues.map[json["from_location"]]!,
|
||||||
|
// // vehicleNo: vehicleNoValues.map[json["vehicle_no"]]!,
|
||||||
|
// fromLocation: json["from_location"]!,
|
||||||
|
// vehicleNo: json["vehicle_no"]!,
|
||||||
|
// lrNo: json["lr_no"],
|
||||||
|
// lrDate: json["lr_date"] == null ? null : DateTime.parse(json["lr_date"]),
|
||||||
|
// dispQty: json["disp_qty"]?.toDouble(),
|
||||||
|
// netQty: json["net_qty"]?.toDouble(),
|
||||||
|
// billingQty: json["billing_qty"]?.toDouble(),
|
||||||
|
// freightRate: json["freight_rate"],
|
||||||
|
// shipmentCost: json["shipment_cost"]?.toDouble(),
|
||||||
|
// statusId: json["status_id"],
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// Map<String, dynamic> toJson() => {
|
||||||
|
// "grn_id": grnId,
|
||||||
|
// "grn_no": grnNo,
|
||||||
|
// "plant_code": plantCode,
|
||||||
|
// "material_code": materialCode,
|
||||||
|
// "code_value": codeValueValues.reverse[codeValue],
|
||||||
|
// "transporter_code": transporterCode,
|
||||||
|
// "grn_date": "${grnDate!.year.toString().padLeft(4, '0')}-${grnDate!.month.toString().padLeft(2, '0')}-${grnDate!.day.toString().padLeft(2, '0')}",
|
||||||
|
// "from_location": fromLocationValues.reverse[fromLocation],
|
||||||
|
// "vehicle_no": vehicleNoValues.reverse[vehicleNo],
|
||||||
|
// "lr_no": lrNo,
|
||||||
|
// "lr_date": "${lrDate!.year.toString().padLeft(4, '0')}-${lrDate!.month.toString().padLeft(2, '0')}-${lrDate!.day.toString().padLeft(2, '0')}",
|
||||||
|
// "disp_qty": dispQty,
|
||||||
|
// "net_qty": netQty,
|
||||||
|
// "billing_qty": billingQty,
|
||||||
|
// "freight_rate": freightRate,
|
||||||
|
// "shipment_cost": shipmentCost,
|
||||||
|
// "status_id": statusId,
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// enum CodeValue {
|
||||||
|
// INBOUND
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// final codeValueValues = EnumValues({
|
||||||
|
// "INBOUND": CodeValue.INBOUND
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// enum FromLocation {
|
||||||
|
// NOIDA_UP_TEST
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// final fromLocationValues = EnumValues({
|
||||||
|
// "NOIDA(UP-TEST)": FromLocation.NOIDA_UP_TEST
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// enum VehicleNo {
|
||||||
|
// RJ07_GC9764
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// final vehicleNoValues = EnumValues({
|
||||||
|
// "RJ07GC9764": VehicleNo.RJ07_GC9764
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// class Pageable {
|
||||||
|
// final Sort? sort;
|
||||||
|
// final int? offset;
|
||||||
|
// final int? pageSize;
|
||||||
|
// final int? pageNumber;
|
||||||
|
// final bool? unpaged;
|
||||||
|
// final bool? paged;
|
||||||
|
//
|
||||||
|
// Pageable({
|
||||||
|
// this.sort,
|
||||||
|
// this.offset,
|
||||||
|
// this.pageSize,
|
||||||
|
// this.pageNumber,
|
||||||
|
// this.unpaged,
|
||||||
|
// this.paged,
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// factory Pageable.fromJson(Map<String, dynamic> json) => Pageable(
|
||||||
|
// sort: json["sort"] == null ? null : Sort.fromJson(json["sort"]),
|
||||||
|
// offset: json["offset"],
|
||||||
|
// pageSize: json["pageSize"],
|
||||||
|
// pageNumber: json["pageNumber"],
|
||||||
|
// unpaged: json["unpaged"],
|
||||||
|
// paged: json["paged"],
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// Map<String, dynamic> toJson() => {
|
||||||
|
// "sort": sort?.toJson(),
|
||||||
|
// "offset": offset,
|
||||||
|
// "pageSize": pageSize,
|
||||||
|
// "pageNumber": pageNumber,
|
||||||
|
// "unpaged": unpaged,
|
||||||
|
// "paged": paged,
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// class Sort {
|
||||||
|
// final bool? empty;
|
||||||
|
// final bool? sorted;
|
||||||
|
// final bool? unsorted;
|
||||||
|
//
|
||||||
|
// Sort({
|
||||||
|
// this.empty,
|
||||||
|
// this.sorted,
|
||||||
|
// this.unsorted,
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// factory Sort.fromJson(Map<String, dynamic> json) => Sort(
|
||||||
|
// empty: json["empty"],
|
||||||
|
// sorted: json["sorted"],
|
||||||
|
// unsorted: json["unsorted"],
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// Map<String, dynamic> toJson() => {
|
||||||
|
// "empty": empty,
|
||||||
|
// "sorted": sorted,
|
||||||
|
// "unsorted": unsorted,
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// class EnumValues<T> {
|
||||||
|
// Map<String, T> map;
|
||||||
|
// late Map<T, String> reverseMap;
|
||||||
|
//
|
||||||
|
// EnumValues(this.map);
|
||||||
|
//
|
||||||
|
// Map<T, String> get reverse {
|
||||||
|
// reverseMap = map.map((k, v) => MapEntry(v, k));
|
||||||
|
// return reverseMap;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// To parse this JSON data, do
|
||||||
|
//
|
||||||
|
// final generateFreightBills = generateFreightBillsFromJson(jsonString);
|
||||||
|
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
|
@ -10,12 +258,12 @@ class GenerateFreightBills {
|
||||||
final List<List<Content>>? content;
|
final List<List<Content>>? content;
|
||||||
final Pageable? pageable;
|
final Pageable? pageable;
|
||||||
final bool? last;
|
final bool? last;
|
||||||
final int? totalElements;
|
|
||||||
final int? totalPages;
|
final int? totalPages;
|
||||||
|
final int? totalElements;
|
||||||
|
final bool? first;
|
||||||
final int? size;
|
final int? size;
|
||||||
final int? number;
|
final int? number;
|
||||||
final Sort? sort;
|
final Sort? sort;
|
||||||
final bool? first;
|
|
||||||
final int? numberOfElements;
|
final int? numberOfElements;
|
||||||
final bool? empty;
|
final bool? empty;
|
||||||
|
|
||||||
|
@ -24,26 +272,27 @@ class GenerateFreightBills {
|
||||||
this.content,
|
this.content,
|
||||||
this.pageable,
|
this.pageable,
|
||||||
this.last,
|
this.last,
|
||||||
this.totalElements,
|
|
||||||
this.totalPages,
|
this.totalPages,
|
||||||
|
this.totalElements,
|
||||||
|
this.first,
|
||||||
this.size,
|
this.size,
|
||||||
this.number,
|
this.number,
|
||||||
this.sort,
|
this.sort,
|
||||||
this.first,
|
|
||||||
this.numberOfElements,
|
this.numberOfElements,
|
||||||
this.empty,
|
this.empty,
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
factory GenerateFreightBills.fromJson(Map<String, dynamic> json) => GenerateFreightBills(
|
factory GenerateFreightBills.fromJson(Map<String, dynamic> json) => GenerateFreightBills(
|
||||||
content: json["content"] == null ? [] : List<List<Content>>.from(json["content"]!.map((x) => List<Content>.from(x.map((x) => Content.fromJson(x))))),
|
content: json["content"] == null ? [] : List<List<Content>>.from(json["content"]!.map((x) => List<Content>.from(x.map((x) => Content.fromJson(x))))),
|
||||||
pageable: json["pageable"] == null ? null : Pageable.fromJson(json["pageable"]),
|
pageable: json["pageable"] == null ? null : Pageable.fromJson(json["pageable"]),
|
||||||
last: json["last"],
|
last: json["last"],
|
||||||
totalElements: json["totalElements"],
|
|
||||||
totalPages: json["totalPages"],
|
totalPages: json["totalPages"],
|
||||||
|
totalElements: json["totalElements"],
|
||||||
|
first: json["first"],
|
||||||
size: json["size"],
|
size: json["size"],
|
||||||
number: json["number"],
|
number: json["number"],
|
||||||
sort: json["sort"] == null ? null : Sort.fromJson(json["sort"]),
|
sort: json["sort"] == null ? null : Sort.fromJson(json["sort"]),
|
||||||
first: json["first"],
|
|
||||||
numberOfElements: json["numberOfElements"],
|
numberOfElements: json["numberOfElements"],
|
||||||
empty: json["empty"],
|
empty: json["empty"],
|
||||||
);
|
);
|
||||||
|
@ -52,12 +301,12 @@ class GenerateFreightBills {
|
||||||
"content": content == null ? [] : List<dynamic>.from(content!.map((x) => List<dynamic>.from(x.map((x) => x.toJson())))),
|
"content": content == null ? [] : List<dynamic>.from(content!.map((x) => List<dynamic>.from(x.map((x) => x.toJson())))),
|
||||||
"pageable": pageable?.toJson(),
|
"pageable": pageable?.toJson(),
|
||||||
"last": last,
|
"last": last,
|
||||||
"totalElements": totalElements,
|
|
||||||
"totalPages": totalPages,
|
"totalPages": totalPages,
|
||||||
|
"totalElements": totalElements,
|
||||||
|
"first": first,
|
||||||
"size": size,
|
"size": size,
|
||||||
"number": number,
|
"number": number,
|
||||||
"sort": sort?.toJson(),
|
"sort": sort?.toJson(),
|
||||||
"first": first,
|
|
||||||
"numberOfElements": numberOfElements,
|
"numberOfElements": numberOfElements,
|
||||||
"empty": empty,
|
"empty": empty,
|
||||||
};
|
};
|
||||||
|
@ -68,13 +317,11 @@ class Content {
|
||||||
final String? grnNo;
|
final String? grnNo;
|
||||||
final String? plantCode;
|
final String? plantCode;
|
||||||
final String? materialCode;
|
final String? materialCode;
|
||||||
final CodeValue? codeValue;
|
final String? codeValue;
|
||||||
final String? transporterCode;
|
final String? transporterCode;
|
||||||
final DateTime? grnDate;
|
final DateTime? grnDate;
|
||||||
final String? fromLocation;
|
final String? fromLocation;
|
||||||
final String? vehicleNo;
|
final String? vehicleNo;
|
||||||
// final FromLocation? fromLocation;
|
|
||||||
// final VehicleNo? vehicleNo;
|
|
||||||
final String? lrNo;
|
final String? lrNo;
|
||||||
final DateTime? lrDate;
|
final DateTime? lrDate;
|
||||||
final double? dispQty;
|
final double? dispQty;
|
||||||
|
@ -83,6 +330,7 @@ class Content {
|
||||||
final int? freightRate;
|
final int? freightRate;
|
||||||
final double? shipmentCost;
|
final double? shipmentCost;
|
||||||
final int? statusId;
|
final int? statusId;
|
||||||
|
final dynamic remark;
|
||||||
bool isSelected;
|
bool isSelected;
|
||||||
|
|
||||||
Content({
|
Content({
|
||||||
|
@ -103,6 +351,7 @@ class Content {
|
||||||
this.freightRate,
|
this.freightRate,
|
||||||
this.shipmentCost,
|
this.shipmentCost,
|
||||||
this.statusId,
|
this.statusId,
|
||||||
|
this.remark,
|
||||||
this.isSelected = false,
|
this.isSelected = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -111,13 +360,11 @@ class Content {
|
||||||
grnNo: json["grn_no"],
|
grnNo: json["grn_no"],
|
||||||
plantCode: json["plant_code"],
|
plantCode: json["plant_code"],
|
||||||
materialCode: json["material_code"],
|
materialCode: json["material_code"],
|
||||||
codeValue: codeValueValues.map[json["code_value"]]!,
|
codeValue: json["code_value"],
|
||||||
transporterCode: json["transporter_code"],
|
transporterCode: json["transporter_code"],
|
||||||
grnDate: json["grn_date"] == null ? null : DateTime.parse(json["grn_date"]),
|
grnDate: json["grn_date"] == null ? null : DateTime.parse(json["grn_date"]),
|
||||||
// fromLocation: fromLocationValues.map[json["from_location"]]!,
|
fromLocation: json["from_location"],
|
||||||
// vehicleNo: vehicleNoValues.map[json["vehicle_no"]]!,
|
vehicleNo: json["vehicle_no"],
|
||||||
fromLocation: json["from_location"]!,
|
|
||||||
vehicleNo: json["vehicle_no"]!,
|
|
||||||
lrNo: json["lr_no"],
|
lrNo: json["lr_no"],
|
||||||
lrDate: json["lr_date"] == null ? null : DateTime.parse(json["lr_date"]),
|
lrDate: json["lr_date"] == null ? null : DateTime.parse(json["lr_date"]),
|
||||||
dispQty: json["disp_qty"]?.toDouble(),
|
dispQty: json["disp_qty"]?.toDouble(),
|
||||||
|
@ -126,6 +373,7 @@ class Content {
|
||||||
freightRate: json["freight_rate"],
|
freightRate: json["freight_rate"],
|
||||||
shipmentCost: json["shipment_cost"]?.toDouble(),
|
shipmentCost: json["shipment_cost"]?.toDouble(),
|
||||||
statusId: json["status_id"],
|
statusId: json["status_id"],
|
||||||
|
remark: json["remark"],
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
|
@ -133,11 +381,11 @@ class Content {
|
||||||
"grn_no": grnNo,
|
"grn_no": grnNo,
|
||||||
"plant_code": plantCode,
|
"plant_code": plantCode,
|
||||||
"material_code": materialCode,
|
"material_code": materialCode,
|
||||||
"code_value": codeValueValues.reverse[codeValue],
|
"code_value": codeValue,
|
||||||
"transporter_code": transporterCode,
|
"transporter_code": transporterCode,
|
||||||
"grn_date": "${grnDate!.year.toString().padLeft(4, '0')}-${grnDate!.month.toString().padLeft(2, '0')}-${grnDate!.day.toString().padLeft(2, '0')}",
|
"grn_date": "${grnDate!.year.toString().padLeft(4, '0')}-${grnDate!.month.toString().padLeft(2, '0')}-${grnDate!.day.toString().padLeft(2, '0')}",
|
||||||
"from_location": fromLocationValues.reverse[fromLocation],
|
"from_location": fromLocation,
|
||||||
"vehicle_no": vehicleNoValues.reverse[vehicleNo],
|
"vehicle_no": vehicleNo,
|
||||||
"lr_no": lrNo,
|
"lr_no": lrNo,
|
||||||
"lr_date": "${lrDate!.year.toString().padLeft(4, '0')}-${lrDate!.month.toString().padLeft(2, '0')}-${lrDate!.day.toString().padLeft(2, '0')}",
|
"lr_date": "${lrDate!.year.toString().padLeft(4, '0')}-${lrDate!.month.toString().padLeft(2, '0')}-${lrDate!.day.toString().padLeft(2, '0')}",
|
||||||
"disp_qty": dispQty,
|
"disp_qty": dispQty,
|
||||||
|
@ -146,46 +394,23 @@ class Content {
|
||||||
"freight_rate": freightRate,
|
"freight_rate": freightRate,
|
||||||
"shipment_cost": shipmentCost,
|
"shipment_cost": shipmentCost,
|
||||||
"status_id": statusId,
|
"status_id": statusId,
|
||||||
|
"remark": remark,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
enum CodeValue {
|
|
||||||
INBOUND
|
|
||||||
}
|
|
||||||
|
|
||||||
final codeValueValues = EnumValues({
|
|
||||||
"INBOUND": CodeValue.INBOUND
|
|
||||||
});
|
|
||||||
|
|
||||||
enum FromLocation {
|
|
||||||
NOIDA_UP_TEST
|
|
||||||
}
|
|
||||||
|
|
||||||
final fromLocationValues = EnumValues({
|
|
||||||
"NOIDA(UP-TEST)": FromLocation.NOIDA_UP_TEST
|
|
||||||
});
|
|
||||||
|
|
||||||
enum VehicleNo {
|
|
||||||
RJ07_GC9764
|
|
||||||
}
|
|
||||||
|
|
||||||
final vehicleNoValues = EnumValues({
|
|
||||||
"RJ07GC9764": VehicleNo.RJ07_GC9764
|
|
||||||
});
|
|
||||||
|
|
||||||
class Pageable {
|
class Pageable {
|
||||||
final Sort? sort;
|
final Sort? sort;
|
||||||
final int? offset;
|
final int? offset;
|
||||||
final int? pageSize;
|
|
||||||
final int? pageNumber;
|
final int? pageNumber;
|
||||||
|
final int? pageSize;
|
||||||
final bool? unpaged;
|
final bool? unpaged;
|
||||||
final bool? paged;
|
final bool? paged;
|
||||||
|
|
||||||
Pageable({
|
Pageable({
|
||||||
this.sort,
|
this.sort,
|
||||||
this.offset,
|
this.offset,
|
||||||
this.pageSize,
|
|
||||||
this.pageNumber,
|
this.pageNumber,
|
||||||
|
this.pageSize,
|
||||||
this.unpaged,
|
this.unpaged,
|
||||||
this.paged,
|
this.paged,
|
||||||
});
|
});
|
||||||
|
@ -193,8 +418,8 @@ class Pageable {
|
||||||
factory Pageable.fromJson(Map<String, dynamic> json) => Pageable(
|
factory Pageable.fromJson(Map<String, dynamic> json) => Pageable(
|
||||||
sort: json["sort"] == null ? null : Sort.fromJson(json["sort"]),
|
sort: json["sort"] == null ? null : Sort.fromJson(json["sort"]),
|
||||||
offset: json["offset"],
|
offset: json["offset"],
|
||||||
pageSize: json["pageSize"],
|
|
||||||
pageNumber: json["pageNumber"],
|
pageNumber: json["pageNumber"],
|
||||||
|
pageSize: json["pageSize"],
|
||||||
unpaged: json["unpaged"],
|
unpaged: json["unpaged"],
|
||||||
paged: json["paged"],
|
paged: json["paged"],
|
||||||
);
|
);
|
||||||
|
@ -202,8 +427,8 @@ class Pageable {
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
"sort": sort?.toJson(),
|
"sort": sort?.toJson(),
|
||||||
"offset": offset,
|
"offset": offset,
|
||||||
"pageSize": pageSize,
|
|
||||||
"pageNumber": pageNumber,
|
"pageNumber": pageNumber,
|
||||||
|
"pageSize": pageSize,
|
||||||
"unpaged": unpaged,
|
"unpaged": unpaged,
|
||||||
"paged": paged,
|
"paged": paged,
|
||||||
};
|
};
|
||||||
|
@ -232,15 +457,3 @@ class Sort {
|
||||||
"unsorted": unsorted,
|
"unsorted": unsorted,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
class EnumValues<T> {
|
|
||||||
Map<String, T> map;
|
|
||||||
late Map<T, String> reverseMap;
|
|
||||||
|
|
||||||
EnumValues(this.map);
|
|
||||||
|
|
||||||
Map<T, String> get reverse {
|
|
||||||
reverseMap = map.map((k, v) => MapEntry(v, k));
|
|
||||||
return reverseMap;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
class ApiUrls {
|
class ApiUrls {
|
||||||
ApiUrls._();
|
ApiUrls._();
|
||||||
|
|
||||||
static const String baseUrl = "http://localhost:9098/";
|
static const String baseUrl = "http://localhost:9092/";
|
||||||
static const String baseUrlImage =
|
static const String baseUrlImage =
|
||||||
"https://codingacademy.world/early_eyes/public/images/user/";
|
"https://codingacademy.world/early_eyes/public/images/user/";
|
||||||
static const addFreightBill =
|
static const addFreightBill =
|
||||||
'bill/grndetails?page=0&size=20&sort=grn_date,desc';
|
'bill/grndetails?page=0&size=20&sort=grn_date,desc';
|
||||||
static const getFreightBills = 'bill/dropdown';
|
static const getFreightBills = 'bill/dropdown';
|
||||||
static const generateFreightBill =
|
static const generateFreightBill =
|
||||||
'http://localhost:9098/bill/addFreightBill';
|
'http://localhost:9092/bill/addFreightBill';
|
||||||
static const createUser = 'http://localhost:9090/api/users/createUser';
|
static const createUser = 'http://localhost:9090/api/users/createUser';
|
||||||
static const editUser =
|
static const editUser =
|
||||||
'http://localhost:9090/api/users/update?userEmpTransCode=';
|
'http://localhost:9090/api/users/update?userEmpTransCode=';
|
||||||
|
|
||||||
static const getAllUser =
|
static const getAllUser =
|
||||||
'http://localhost:9090/api/users/userdetails?page=';
|
'http://localhost:9090/api/users/userdetails?page=';
|
||||||
|
|
||||||
static const viewFreightBill =
|
static const viewFreightBill = 'http://localhost:9092/bill/freightbill?page';
|
||||||
'http://localhost:9098/bill/freightbill?page';
|
|
||||||
static const addUserType =
|
static const addUserType =
|
||||||
'http://localhost:9090/api/user-types/createUserType';
|
'http://localhost:9090/api/user-types/createUserType';
|
||||||
static const dropDownList =
|
static const dropDownList =
|
||||||
|
@ -32,5 +32,7 @@ class ApiUrls {
|
||||||
static const selectAndAssignRole =
|
static const selectAndAssignRole =
|
||||||
"http://localhost:9090/api/user-roles/assignRoles";
|
"http://localhost:9090/api/user-roles/assignRoles";
|
||||||
static const assignPlantRole = "http://localhost:9090/userplant/assignPlants";
|
static const assignPlantRole = "http://localhost:9090/userplant/assignPlants";
|
||||||
static const userTypeDetails = "http://localhost:9090/api/user-types/usertypedetails?page=0&size=15&sort=last_updated_on,desc";
|
static const userTypeDetails =
|
||||||
|
"http://localhost:9090/api/user-types/usertypedetails?page=0&size=15&sort=last_updated_on,desc";
|
||||||
|
static const grnPendingDetails = "http://localhost:9092/bill/grndetailsPanding?page=0&size=20&sort=grn_date,desc";
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import '../../feature/presentation/screens/admin/user_management/model/getAllUse
|
||||||
import '../../feature/presentation/screens/admin/user_management/model/select_assign_role_model/select_assign_role_model.dart';
|
import '../../feature/presentation/screens/admin/user_management/model/select_assign_role_model/select_assign_role_model.dart';
|
||||||
import '../../feature/presentation/screens/admin/user_management/model/user_type_details_res_model.dart';
|
import '../../feature/presentation/screens/admin/user_management/model/user_type_details_res_model.dart';
|
||||||
import '../../feature/presentation/screens/admin/user_management/model/user_type_res_model.dart';
|
import '../../feature/presentation/screens/admin/user_management/model/user_type_res_model.dart';
|
||||||
|
import '../../feature/presentation/screens/transporter/model/grn_panding_res_model.dart';
|
||||||
import '../../feature/presentation/screens/transporter/model/view_freight_bill_res_model.dart';
|
import '../../feature/presentation/screens/transporter/model/view_freight_bill_res_model.dart';
|
||||||
import '../model/generate_bill_res_model.dart';
|
import '../model/generate_bill_res_model.dart';
|
||||||
import '../model/generate_freight_model.dart';
|
import '../model/generate_freight_model.dart';
|
||||||
|
@ -68,7 +69,7 @@ class PostRequests {
|
||||||
static Future<GetAllUserResModel?> getAllUser(
|
static Future<GetAllUserResModel?> getAllUser(
|
||||||
Map<String, String> requestBody,int page, int limit) async {
|
Map<String, String> requestBody,int page, int limit) async {
|
||||||
var apiResponse =
|
var apiResponse =
|
||||||
await RemoteService.postUser(requestBody, "${ApiUrls.getAllUser}$page&size=$limit&sort=last_updated_on,desc");
|
await RemoteService.postUser(requestBody, "${ApiUrls.getAllUser}$page&size=10$limit&sort=last_updated_on,desc");
|
||||||
|
|
||||||
if (apiResponse != null) {
|
if (apiResponse != null) {
|
||||||
return getAllUserResModelFromJson(apiResponse.response!);
|
return getAllUserResModelFromJson(apiResponse.response!);
|
||||||
|
@ -76,7 +77,17 @@ class PostRequests {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// static Future<GetAllUserResModel?> getAllUser(
|
||||||
|
// Map<String, String> requestBody) async {
|
||||||
|
// var apiResponse =
|
||||||
|
// await RemoteService.postUser(requestBody, ApiUrls.getAllUser);
|
||||||
|
//
|
||||||
|
// if (apiResponse != null) {
|
||||||
|
// return getAllUserResModelFromJson(apiResponse.response!);
|
||||||
|
// } else {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
static Future<EditUserResModel?> editUser(
|
static Future<EditUserResModel?> editUser(
|
||||||
Map<String, String> requestBody, String id) async {
|
Map<String, String> requestBody, String id) async {
|
||||||
var apiResponse =
|
var apiResponse =
|
||||||
|
@ -181,4 +192,14 @@ class PostRequests {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static Future<GrnPendingBillsResModel?> grnPending(
|
||||||
|
Map<String, String> requestBody) async {
|
||||||
|
var apiResponse = await RemoteService.postUser(
|
||||||
|
requestBody, ApiUrls.grnPendingDetails);
|
||||||
|
if (apiResponse != null) {
|
||||||
|
return grnPendingBillsResModelFromJson(apiResponse.response!);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,10 @@ class Validations {
|
||||||
return 'Please Enter Your Mobile Number';
|
return 'Please Enter Your Mobile Number';
|
||||||
} else if (enteredValue.length != 10) {
|
} else if (enteredValue.length != 10) {
|
||||||
return "Please Enter a Valid Number";
|
return "Please Enter a Valid Number";
|
||||||
} else {
|
} else if (!RegExp(r'^[0-9]+$').hasMatch(enteredValue)) {
|
||||||
|
return 'Please Enter a Valid Number (only digits allowed)';
|
||||||
|
}
|
||||||
|
else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
32
pubspec.lock
32
pubspec.lock
|
@ -296,6 +296,14 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.4.1"
|
version: "2.4.1"
|
||||||
|
simple_gesture_detector:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: simple_gesture_detector
|
||||||
|
sha256: ba2cd5af24ff20a0b8d609cec3f40e5b0744d2a71804a2616ae086b9c19d19a3
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.2.1"
|
||||||
sizer:
|
sizer:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -341,6 +349,30 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.0"
|
version: "1.3.0"
|
||||||
|
syncfusion_flutter_core:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: syncfusion_flutter_core
|
||||||
|
sha256: "213ada2c3b3555a73cb0eb1530d24d27dcf1a0a1555c0f00dd3e1486b01878ad"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "28.2.3"
|
||||||
|
syncfusion_flutter_datepicker:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: syncfusion_flutter_datepicker
|
||||||
|
sha256: "9d2694d618d081c9477402175ff027936f60ac053d0989ca02ee65b2e27a65c7"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "28.2.3"
|
||||||
|
table_calendar:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: table_calendar
|
||||||
|
sha256: "0c0c6219878b363a2d5f40c7afb159d845f253d061dc3c822aa0d5fe0f721982"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.2.0"
|
||||||
term_glyph:
|
term_glyph:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -40,6 +40,8 @@ dependencies:
|
||||||
sizer: ^3.0.5
|
sizer: ^3.0.5
|
||||||
intl: ^0.20.1
|
intl: ^0.20.1
|
||||||
vph_web_date_picker: ^0.0.6
|
vph_web_date_picker: ^0.0.6
|
||||||
|
table_calendar: ^3.2.0
|
||||||
|
syncfusion_flutter_datepicker: ^28.2.3
|
||||||
|
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
|
Loading…
Reference in New Issue