Compare commits

..

8 Commits

25 changed files with 985 additions and 1060 deletions

View File

@ -259,6 +259,24 @@
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "3.1" "languageVersion": "3.1"
}, },
{
"name": "syncfusion_flutter_calendar",
"rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_calendar-28.2.4",
"packageUri": "lib/",
"languageVersion": "3.3"
},
{
"name": "syncfusion_flutter_core",
"rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_core-28.2.4",
"packageUri": "lib/",
"languageVersion": "3.3"
},
{
"name": "syncfusion_flutter_datepicker",
"rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_datepicker-28.2.4",
"packageUri": "lib/",
"languageVersion": "3.3"
},
{ {
"name": "table_calendar", "name": "table_calendar",
"rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/table_calendar-3.2.0", "rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/table_calendar-3.2.0",
@ -277,6 +295,12 @@
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "3.4" "languageVersion": "3.4"
}, },
{
"name": "timezone",
"rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/timezone-0.10.0",
"packageUri": "lib/",
"languageVersion": "2.19"
},
{ {
"name": "typed_data", "name": "typed_data",
"rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/typed_data-1.4.0", "rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/typed_data-1.4.0",
@ -332,7 +356,7 @@
"languageVersion": "3.6" "languageVersion": "3.6"
} }
], ],
"generated": "2025-02-07T11:05:55.892643Z", "generated": "2025-02-08T10:58:04.981413Z",
"generator": "pub", "generator": "pub",
"generatorVersion": "3.6.1", "generatorVersion": "3.6.1",
"flutterRoot": "file:///C:/src/flutter/flutter", "flutterRoot": "file:///C:/src/flutter/flutter",

View File

@ -154,6 +154,18 @@ string_scanner
3.1 3.1
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/string_scanner-1.3.0/ file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/string_scanner-1.3.0/
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/string_scanner-1.3.0/lib/ file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/string_scanner-1.3.0/lib/
syncfusion_flutter_calendar
3.3
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_calendar-28.2.4/
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_calendar-28.2.4/lib/
syncfusion_flutter_core
3.3
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_core-28.2.4/
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_core-28.2.4/lib/
syncfusion_flutter_datepicker
3.3
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_datepicker-28.2.4/
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_datepicker-28.2.4/lib/
table_calendar table_calendar
3.0 3.0
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/table_calendar-3.2.0/ file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/table_calendar-3.2.0/
@ -166,6 +178,10 @@ test_api
3.4 3.4
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/test_api-0.7.3/ file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/test_api-0.7.3/
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/test_api-0.7.3/lib/ file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/test_api-0.7.3/lib/
timezone
2.19
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/timezone-0.10.0/
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/timezone-0.10.0/lib/
typed_data typed_data
3.5 3.5
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/typed_data-1.4.0/ file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/typed_data-1.4.0/
@ -198,24 +214,24 @@ xdg_directories
3.3 3.3
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/xdg_directories-1.1.0/ file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/xdg_directories-1.1.0/
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/xdg_directories-1.1.0/lib/ file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/xdg_directories-1.1.0/lib/
shayog
3.6
file:///C:/Users/Admin/Downloads/shayog/
file:///C:/Users/Admin/Downloads/shayog/lib/
sky_engine sky_engine
3.2 3.2
file:///C:/src/flutter/flutter/bin/cache/pkg/sky_engine/ file:///C:/Users/Admin/Downloads/flutter_windows_3.27.1-stable/flutter/bin/cache/pkg/sky_engine/
file:///C:/src/flutter/flutter/bin/cache/pkg/sky_engine/lib/ file:///C:/Users/Admin/Downloads/flutter_windows_3.27.1-stable/flutter/bin/cache/pkg/sky_engine/lib/
flutter flutter
3.3 3.3
file:///C:/src/flutter/flutter/packages/flutter/ file:///C:/Users/Admin/Downloads/flutter_windows_3.27.1-stable/flutter/packages/flutter/
file:///C:/src/flutter/flutter/packages/flutter/lib/ file:///C:/Users/Admin/Downloads/flutter_windows_3.27.1-stable/flutter/packages/flutter/lib/
flutter_test flutter_test
3.3 3.3
file:///C:/src/flutter/flutter/packages/flutter_test/ file:///C:/Users/Admin/Downloads/flutter_windows_3.27.1-stable/flutter/packages/flutter_test/
file:///C:/src/flutter/flutter/packages/flutter_test/lib/ file:///C:/Users/Admin/Downloads/flutter_windows_3.27.1-stable/flutter/packages/flutter_test/lib/
flutter_web_plugins flutter_web_plugins
3.2 3.2
file:///C:/src/flutter/flutter/packages/flutter_web_plugins/ file:///C:/Users/Admin/Downloads/flutter_windows_3.27.1-stable/flutter/packages/flutter_web_plugins/
file:///C:/src/flutter/flutter/packages/flutter_web_plugins/lib/ file:///C:/Users/Admin/Downloads/flutter_windows_3.27.1-stable/flutter/packages/flutter_web_plugins/lib/
shayog
3.6
file:///C:/Users/Admin/Downloads/shayog%205/shayog/
file:///C:/Users/Admin/Downloads/shayog%205/shayog/lib/
2 2

View File

@ -1 +1 @@
3.27.3 3.27.1

View File

@ -1,5 +1,5 @@
sdk.dir=C:\\Users\\Admin\\AppData\\Local\\Android\\sdk sdk.dir=C:\\Users\\Admin\\.jdks\\openjdk-23.0.1
flutter.sdk=C:\\src\\flutter\\flutter flutter.sdk=C:\\Users\\Admin\\Downloads\\flutter_windows_3.27.1-stable\\flutter
flutter.buildMode=release flutter.buildMode=release
flutter.versionName=1.0.0 flutter.versionName=1.0.0
flutter.versionCode=1 flutter.versionCode=1

View File

@ -1,6 +1,6 @@
// This is a generated file; do not edit or check into version control. // This is a generated file; do not edit or check into version control.
FLUTTER_ROOT=C:\src\flutter\flutter FLUTTER_ROOT=C:\Users\Admin\Downloads\flutter_windows_3.27.1-stable\flutter
FLUTTER_APPLICATION_PATH=C:\Users\Admin\Downloads\shayog FLUTTER_APPLICATION_PATH=C:\Users\Admin\Downloads\shayog 5\shayog
COCOAPODS_PARALLEL_CODE_SIGN=true COCOAPODS_PARALLEL_CODE_SIGN=true
FLUTTER_TARGET=lib\main.dart FLUTTER_TARGET=lib\main.dart
FLUTTER_BUILD_DIR=build FLUTTER_BUILD_DIR=build

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# This is a generated file; do not edit or check into version control. # This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=C:\src\flutter\flutter" export "FLUTTER_ROOT=C:\Users\Admin\Downloads\flutter_windows_3.27.1-stable\flutter"
export "FLUTTER_APPLICATION_PATH=C:\Users\Admin\Downloads\shayog" export "FLUTTER_APPLICATION_PATH=C:\Users\Admin\Downloads\shayog 5\shayog"
export "COCOAPODS_PARALLEL_CODE_SIGN=true" export "COCOAPODS_PARALLEL_CODE_SIGN=true"
export "FLUTTER_TARGET=lib\main.dart" export "FLUTTER_TARGET=lib\main.dart"
export "FLUTTER_BUILD_DIR=build" export "FLUTTER_BUILD_DIR=build"

View File

@ -1,6 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.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';
@ -8,7 +6,8 @@ class CustomDropdown<T> extends StatefulWidget {
final List<T> items; final List<T> items;
final String Function(T) itemLabel; final String Function(T) itemLabel;
final Function(T?) onSelected; final Function(T?) onSelected;
final String hintText; VoidCallback? onTap;
late final String hintText;
final bool enableSearch; final bool enableSearch;
final double? width; final double? width;
final EdgeInsetsGeometry padding; final EdgeInsetsGeometry padding;
@ -18,8 +17,9 @@ class CustomDropdown<T> extends StatefulWidget {
final Color? borderClr; final Color? borderClr;
final Color? backClr; final Color? backClr;
final String? Function(T?)? validator; final String? Function(T?)? validator;
Widget? icon;
const CustomDropdown({ CustomDropdown({
super.key, super.key,
required this.items, required this.items,
required this.itemLabel, required this.itemLabel,
@ -34,6 +34,8 @@ class CustomDropdown<T> extends StatefulWidget {
this.borderClr, this.borderClr,
this.backClr, this.backClr,
this.validator, this.validator,
this.onTap,
this.icon,
}); });
@override @override
@ -77,8 +79,6 @@ class _CustomDropdownState<T> extends State<CustomDropdown<T>> {
}); });
} }
void _selectItem(T item) { void _selectItem(T item) {
setState(() { setState(() {
selectedItem = item; selectedItem = item;
@ -98,7 +98,13 @@ class _CustomDropdownState<T> extends State<CustomDropdown<T>> {
_openDropdown(); _openDropdown();
} }
} }
void clearField() {
setState(() {
selectedItem = null; // Clear the selected item
});
_openDropdown();
}
void _openDropdown() { void _openDropdown() {
setState(() { setState(() {
isSearching = false; isSearching = false;
@ -198,6 +204,7 @@ class _CustomDropdownState<T> extends State<CustomDropdown<T>> {
style: 11.txtSBoldGrey, style: 11.txtSBoldGrey,
), ),
), ),
// onTap: widget.onTap,
onTap: () => _selectItem(item), onTap: () => _selectItem(item),
); );
}, },
@ -226,30 +233,9 @@ class _CustomDropdownState<T> extends State<CustomDropdown<T>> {
overlayEntry!.markNeedsBuild(); overlayEntry!.markNeedsBuild();
} }
} }
// String? validateAndGetErrorText() {
// setState(() {
// _errorText = widget.validator?.call(selectedItem);
// });
// return _errorText;
// }
String? validateAndGetErrorText() {
setState(() {
_errorText = selectedItem == null ? "This field is required" : null;
});
return _errorText;
}
void _onDropdownTap() {
if (selectedItem == null) {
setState(() {
_errorText = "Please select an item.";
});
} else {
setState(() {
_errorText = null;
});
}
_toggleDropdown();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return Column(
@ -277,338 +263,38 @@ class _CustomDropdownState<T> extends State<CustomDropdown<T>> {
Expanded( Expanded(
child: Text( child: Text(
widget.hintText, widget.hintText,
// selectedItem != null
// ? widget.itemLabel(selectedItem as T) // selectedItem == null ? widget.hintText : widget.itemLabel(selectedItem as T),
// : widget.hintText,
style: 11.txtSBoldGrey, style: 11.txtSBoldGrey,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
// Text(
),
// selectedItem != null // selectedItem != null
// ? widget.itemLabel(selectedItem as T) // ? InkWell(
// : widget.hintText, // onTap: (){
// style: 12.txtSBoldGrey,
// overflow: TextOverflow.ellipsis,
// ),
),
const Icon(
Icons.keyboard_arrow_down_outlined,
size: 20,
color: Colors.black,
),
],
),
),
),
),
if (_errorText != null)
Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Text(
_errorText!,
style: TextStyle(
color: Colors.red,
fontSize: 12,
),
),
)
],
);
}
}
class CustomDrop<T> extends StatefulWidget {
final List<T> items;
final String Function(T) itemLabel;
final Function(T?) onSelected;
final RxString hintText;
final bool enableSearch;
final double? width;
final EdgeInsetsGeometry padding;
final T? initialValue;
final bool showError;
final bool isHeight;
final Color? borderClr;
final Color? backClr;
final String? Function(T?)? validator;
const CustomDrop({
super.key,
required this.items,
required this.itemLabel,
required this.onSelected,
required this.hintText,
this.enableSearch = true,
this.width,
this.padding = const EdgeInsets.all(8.0),
this.initialValue,
this.showError = false,
this.isHeight = false,
this.borderClr,
this.backClr,
this.validator,
});
@override
_CustomDropdownState<T> createState() => _CustomDropdownState<T>();
}
class _CustomDropState<T> extends State<CustomDrop<T>> {
T? selectedItem;
String? _errorText;
List<T> filteredItems = [];
late TextEditingController searchController;
OverlayEntry? overlayEntry;
final LayerLink layerLink = LayerLink();
bool isDropdownOpen = false;
bool isSearching = false;
final dropdownKey = GlobalKey<_CustomDropdownState>();
@override
void initState() {
super.initState();
searchController = TextEditingController();
filteredItems = List.from(widget.items);
if (widget.initialValue != null) {
selectedItem = widget.initialValue;
}
searchController.addListener(() {
final text = searchController.text;
if (text.isEmpty) {
setState(() {
isSearching = false;
filteredItems = List.from(widget.items);
});
} else {
setState(() {
isSearching = true;
_filterList(text);
});
}
});
}
void _selectItem(T item) {
setState(() {
selectedItem = item;
isDropdownOpen = false;
_errorText = null; // Clear error when an item is selected
});
searchController.clear();
widget.onSelected(item);
_closeDropdown();
filteredItems = List.from(widget.items);
}
void _toggleDropdown() {
if (isDropdownOpen) {
_closeDropdown();
} else {
_openDropdown();
}
}
void _openDropdown() {
setState(() {
isSearching = false;
filteredItems = List.from(widget.items);
searchController.clear();
});
overlayEntry = _createOverlayEntry();
Overlay.of(context).insert(overlayEntry!);
setState(() {
isDropdownOpen = true;
});
}
void _closeDropdown() {
overlayEntry?.remove();
overlayEntry = null;
setState(() {
isDropdownOpen = false;
});
}
OverlayEntry _createOverlayEntry() {
final RenderBox renderBox = context.findRenderObject() as RenderBox;
return OverlayEntry(
builder: (context) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: _closeDropdown,
child: Stack(
children: [
Positioned(
width: widget.width ?? 250,
child: CompositedTransformFollower(
link: layerLink,
showWhenUnlinked: false,
offset: Offset(0, renderBox.size.height + 5),
child: Material(
elevation: 4,
borderRadius: BorderRadius.circular(8),
child: Container(
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: Colors.grey,
width: 1,
),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
if (widget.enableSearch && widget.items.length > 1)
Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: SizedBox(
height: 32,
child: TextFormField(
// validator: widget.validator,
enabled: widget.enableSearch,
controller: searchController,
style: 12.txtSBoldGrey,
autovalidateMode:
AutovalidateMode.onUserInteraction,
decoration: InputDecoration(
hintText: 'Search...',
contentPadding: const EdgeInsets.symmetric(
vertical: 8.0,
horizontal: 12.0,
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
),
),
),
),
),
Container(
constraints: BoxConstraints(maxHeight: 200),
child: ListView.builder(
shrinkWrap: true,
itemCount: filteredItems.length,
itemBuilder: (context, index) {
final item = filteredItems[index];
return ListTile(
contentPadding: EdgeInsets.all(0),
minVerticalPadding: 0,
dense: true,
visualDensity: VisualDensity.compact,
title: Tooltip(
message: widget.itemLabel(item),
child: Text(
widget.itemLabel(item),
style: 11.txtSBoldGrey,
),
),
onTap: () => _selectItem(item),
);
},
),
),
],
),
),
),
),
),
],
),
);
},
);
}
void _filterList(String query) {
filteredItems = widget.items
.where((item) =>
widget.itemLabel(item).toLowerCase().contains(query.toLowerCase()))
.toList();
if (overlayEntry != null) {
overlayEntry!.markNeedsBuild();
}
}
// String? validateAndGetErrorText() {
// setState(() { // setState(() {
// _errorText = widget.validator?.call(selectedItem); //
// selectedItem = null;
//
// }); // });
// return _errorText; //
// } // _openDropdown();
String? validateAndGetErrorText() { // },
setState(() { //
_errorText = selectedItem == null ? "This field is required" : null; // child:
}); // Icon(Icons.close, size: 14, color: Colors.black))
return _errorText; // :
} widget.icon ?? InkWell(
void _onDropdownTap() {
if (selectedItem == null) {
setState(() {
_errorText = "Please select an item.";
});
} else {
setState(() {
_errorText = null;
});
}
_toggleDropdown();
}
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CompositedTransformTarget(
link: layerLink,
child: GestureDetector(
onTap: _toggleDropdown, onTap: _toggleDropdown,
child: Container( child: Icon(
padding: EdgeInsets.symmetric(
vertical: widget.isHeight ? 12 : 6.4, horizontal: 16),
decoration: BoxDecoration(
color: widget.backClr ?? AppColors.white,
border: Border.all(
color: widget.borderClr ?? Colors.transparent,
width: 1,
),
borderRadius: BorderRadius.circular(2),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Text(
selectedItem != null
? widget.itemLabel(selectedItem as T)
: widget.hintText.value,
style: 11.txtSBoldGrey,
overflow: TextOverflow.ellipsis,
),
// Text(
// selectedItem != null
// ? widget.itemLabel(selectedItem as T)
// : widget.hintText,
// style: 12.txtSBoldGrey,
// overflow: TextOverflow.ellipsis,
// ),
),
const Icon(
Icons.keyboard_arrow_down_outlined, Icons.keyboard_arrow_down_outlined,
size: 20, size: 20,
color: Colors.black, color: Colors.black,
), ),
),
], ],
), ),
), ),

View File

@ -0,0 +1,16 @@
import 'package:get/get.dart';
class DropdownController extends GetxController {
// Observable selected item
var selectedItem = Rxn<String>(); // Replace `String` with your actual type if necessary
// Set the selected value
void selectItem(String item) {
selectedItem.value = item;
}
// Clear the selected value
void clearSelection() {
selectedItem.value = null;
}
}

View File

@ -0,0 +1,51 @@
// import 'package:flutter/material.dart';
// import 'package:get/get.dart';
//
// import 'drop_down_ctrl.dart';
//
// class Customdown extends StatelessWidget {
// // Instantiate the controller using Get.put() to make it accessible across the app
// final DropdownController dropdownController = Get.put(DropdownController());
//
// @override
// Widget build(BuildContext context) {
//
//
// return Obx(
// () {
// return GestureDetector(
// onTap: () async {
// // Open the custom dropdown menu on tap
// String? selectedItem = await showMenu<String>(
// context: context,
// position: RelativeRect.fromLTRB(100.0, 100.0, 100.0, 100.0),
// items: dropdownController.items
// .map((String value) {
// return PopupMenuItem<String>(
// value: value,
// child: Text(value),
// );
// })
// .toList(),
// );
// // Update the selected value using GetX when the user selects an item
// if (selectedItem != null) {
// dropdownController.updateValue(selectedItem);
// }
// },
// child: Container(
// padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
// decoration: BoxDecoration(
// border: Border.all(color: Colors.blue),
// borderRadius: BorderRadius.circular(5),
// ),
// child: Text(
// dropdownController.selectedValue.value, // Reactive update
// style: TextStyle(fontSize: 18, color: Colors.black),
// ),
// ),
// );
// },
// );
// }
// }

View File

@ -11,4 +11,5 @@ static Color black = Color(0xff000000);
static Color white = Color(0xffFFFFFF); static Color white = Color(0xffFFFFFF);
static Color green = Color(0xff10A711); static Color green = Color(0xff10A711);
static Color red = Colors.red; static Color red = Colors.red;
static Color calendarBack = Color(0xff00008B);
} }

View File

@ -6,6 +6,7 @@ import '../../../../../components/common/common_btn.dart';
import '../../../../../components/common/common_button.dart'; import '../../../../../components/common/common_button.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_colors.dart'; import '../../../../../components/styles/app_colors.dart';
import '../../../../../components/styles/app_strings.dart'; import '../../../../../components/styles/app_strings.dart';
import '../../../widgets/custom_pagination.dart'; import '../../../widgets/custom_pagination.dart';
@ -43,19 +44,29 @@ class ManageUser extends StatelessWidget {
text: "User Name", text: "User Name",
), ),
SizedBox(height: 4), SizedBox(height: 4),
GetX<DashboardCtrl>( CustomDropdown(
builder: (ctrl) { icon: controller.selectUser.value ==
return CustomDropdown( "Select User Name"
?Icon(
Icons.keyboard_arrow_down_outlined,
size: 20,
color: Colors.black,
) : GestureDetector(
onTap: () {
controller.selectUser.value =
"Select User Name";
},
child: Icon(Icons.close,size: 14)),
backClr: AppColors.clrD9, backClr: AppColors.clrD9,
borderClr: AppColors.clrGrey, borderClr: AppColors.clrGrey,
items: ctrl.userNames, items: controller.userNames,
itemLabel: (item) => item, itemLabel: (item) => item,
onSelected: (selected) { onSelected: (selected) {
ctrl.selectUser.value = selected; controller.selectUser.value =
selected ?? "";
}, },
hintText: ctrl.selectUser.value); hintText: controller.selectUser.value),
},
),
], ],
)), )),
SizedBox(width: 16), SizedBox(width: 16),
@ -68,9 +79,19 @@ class ManageUser extends StatelessWidget {
text: "User Type", text: "User Type",
), ),
SizedBox(height: 8), SizedBox(height: 8),
GetX<DashboardCtrl>( CustomDropdown(
builder: (controller) { icon: controller.selectType.value ==
return CustomDropdown( "Select UserType"
?Icon(
Icons.keyboard_arrow_down_outlined,
size: 20,
color: Colors.black,
) : GestureDetector(
onTap: () {
controller.selectType.value =
"Select UserType";
},
child: Icon(Icons.close,size: 14)),
backClr: AppColors.clrD9, backClr: AppColors.clrD9,
borderClr: AppColors.clrGrey, borderClr: AppColors.clrGrey,
items: controller.userTypesNames, items: controller.userTypesNames,
@ -78,9 +99,7 @@ class ManageUser extends StatelessWidget {
onSelected: (selected) { onSelected: (selected) {
controller.selectType.value = selected; controller.selectType.value = selected;
}, },
hintText: controller.selectType.value); hintText: controller.selectType.value),
},
),
], ],
)), )),
SizedBox(width: 16), SizedBox(width: 16),
@ -94,13 +113,24 @@ class ManageUser extends StatelessWidget {
), ),
SizedBox(height: 8), SizedBox(height: 8),
CustomDropdown( CustomDropdown(
icon: controller.selectEmail.value ==
"Select Email"
?Icon(
Icons.keyboard_arrow_down_outlined,
size: 20,
color: Colors.black,
) : GestureDetector(
onTap: () {
controller.selectEmail.value =
"Select Email";
},
child: Icon(Icons.close,size: 14)),
backClr: AppColors.clrD9, backClr: AppColors.clrD9,
borderClr: AppColors.clrGrey, borderClr: AppColors.clrGrey,
items: controller.userEmail, items: controller.userEmail,
itemLabel: (item) => item, itemLabel: (item) => item,
onSelected: (selected) { onSelected: (selected) {
controller.selectEmail.value = selected; controller.selectEmail.value = selected;
}, },
hintText: controller.selectEmail.value), hintText: controller.selectEmail.value),
], ],
@ -120,6 +150,18 @@ class ManageUser extends StatelessWidget {
), ),
SizedBox(height: 8), SizedBox(height: 8),
CustomDropdown( CustomDropdown(
icon: controller.selectCode.value ==
"Select Employee Code"
?Icon(
Icons.keyboard_arrow_down_outlined,
size: 20,
color: Colors.black,
) : GestureDetector(
onTap: () {
controller.selectCode.value =
"Select Employee Code";
},
child: Icon(Icons.close,size: 14)),
backClr: AppColors.clrD9, backClr: AppColors.clrD9,
borderClr: AppColors.clrGrey, borderClr: AppColors.clrGrey,
items: controller.userEmpCode, items: controller.userEmpCode,
@ -141,7 +183,18 @@ class ManageUser extends StatelessWidget {
), ),
SizedBox(height: 8), SizedBox(height: 8),
CustomDropdown( CustomDropdown(
icon: controller.selectUserStatus.value ==
"Select Status"
?Icon(
Icons.keyboard_arrow_down_outlined,
size: 20,
color: Colors.black,
) : GestureDetector(
onTap: () {
controller.selectUserStatus.value =
"Select Status";
},
child: Icon(Icons.close,size: 14)),
backClr: AppColors.clrD9, backClr: AppColors.clrD9,
borderClr: AppColors.clrGrey, borderClr: AppColors.clrGrey,
items: controller.userStatus, items: controller.userStatus,
@ -179,7 +232,6 @@ class ManageUser extends StatelessWidget {
text: AppStrings.submit, text: AppStrings.submit,
textStyle: 14.txtSBoldWhite, textStyle: 14.txtSBoldWhite,
clickAction: () { clickAction: () {
//controller.isSelected.value = false;
controller.getManageUser(); controller.getManageUser();
controller.getAllUser(); controller.getAllUser();
}, },
@ -211,7 +263,7 @@ class ManageUser extends StatelessWidget {
decoration: decoration:
BoxDecoration(border: Border.all(color: AppColors.clrGrey)), BoxDecoration(border: Border.all(color: AppColors.clrGrey)),
child: RawScrollbar( child: RawScrollbar(
thumbColor: AppColors.clrD9, thumbColor: AppColors.primaryClr.withOpacity(0.4),
radius: Radius.circular(2), radius: Radius.circular(2),
trackVisibility: true, trackVisibility: true,
thumbVisibility: true, thumbVisibility: true,
@ -220,7 +272,7 @@ class ManageUser extends StatelessWidget {
child: SingleChildScrollView( child: SingleChildScrollView(
controller: controller.verticalScrollController, controller: controller.verticalScrollController,
child: RawScrollbar( child: RawScrollbar(
thumbColor: AppColors.clrD9, thumbColor: AppColors.primaryClr.withOpacity(0.4),
radius: Radius.circular(2), radius: Radius.circular(2),
thickness: 14, thickness: 14,
trackVisibility: true, trackVisibility: true,

View File

@ -111,6 +111,7 @@ class DashboardCtrl extends GetxController {
RxList<AllUser> getAllUserMain = <AllUser>[].obs; RxList<AllUser> getAllUserMain = <AllUser>[].obs;
RxInt limit = 20.obs; RxInt limit = 20.obs;
var userLoading = false.obs; var userLoading = false.obs;
var changeColor = false.obs;
setNextPage() { setNextPage() {
if (currentPage.value < totalPages.value.toInt()) { if (currentPage.value < totalPages.value.toInt()) {

View File

@ -1,5 +1,6 @@
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:shayog/components/common/input_field.dart'; import 'package:shayog/components/common/input_field.dart';
import 'package:shayog/components/styles/textStyles.dart'; import 'package:shayog/components/styles/textStyles.dart';
import 'package:shayog/feature/presentation/screens/transporter/invoice_management/payment_view/ctrl/payment_view_ctrl.dart'; import 'package:shayog/feature/presentation/screens/transporter/invoice_management/payment_view/ctrl/payment_view_ctrl.dart';
@ -27,7 +28,7 @@ class PaymentView extends StatelessWidget {
() => controller.isPaymentFilter.value () => controller.isPaymentFilter.value
? Container( ? Container(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
left: 16.0, top: 8, right: 16, bottom: 16), left: 16.0, top: 8, right: 16),
color: AppColors.clrF2, color: AppColors.clrF2,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
@ -42,7 +43,21 @@ class PaymentView extends StatelessWidget {
children: [ children: [
TextView(text: "Plant"), TextView(text: "Plant"),
SizedBox(height: 8), SizedBox(height: 8),
CustomDropdown( CustomDropdown(
icon: paymentCtrl.selectedPlant.value ==
"Select Plant"
? Icon(
Icons.keyboard_arrow_down_outlined,
size: 20,
color: Colors.black,
) : GestureDetector(
onTap: () {
paymentCtrl.selectedPlant.value =
"Select Plant";
},
child: Icon(Icons.close,size: 14)),
backClr: AppColors.clrD9, backClr: AppColors.clrD9,
borderClr: AppColors.clrGrey, borderClr: AppColors.clrGrey,
items: paymentCtrl.plant, items: paymentCtrl.plant,
@ -54,30 +69,7 @@ class PaymentView extends StatelessWidget {
}, },
hintText: paymentCtrl.selectedPlant.value, hintText: paymentCtrl.selectedPlant.value,
), ),
],
),
),
SizedBox(width: 16),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextView(text: "Freight Bill No."),
SizedBox(height: 8),
CustomDropdown<String>(
backClr: AppColors.clrD9,
borderClr: AppColors.clrGrey,
items: paymentCtrl.freightBill,
itemLabel: (item) => item,
onSelected: (selected) {
paymentCtrl.selectedFreightBill.value =
selected.toString();
},
hintText:
paymentCtrl.selectedFreightBill.value,
),
], ],
), ),
), ),
@ -90,6 +82,18 @@ class PaymentView extends StatelessWidget {
TextView(text: "Product"), TextView(text: "Product"),
SizedBox(height: 8), SizedBox(height: 8),
CustomDropdown<dynamic>( CustomDropdown<dynamic>(
icon: paymentCtrl.selectedProduct.value ==
"Select Product Name"
? Icon(
Icons.keyboard_arrow_down_outlined,
size: 20,
color: Colors.black,
) : GestureDetector(
onTap: () {
paymentCtrl.selectedProduct.value =
"Select Product Name";
},
child: Icon(Icons.close,size: 14)),
width: 250, width: 250,
backClr: AppColors.clrD9, backClr: AppColors.clrD9,
borderClr: AppColors.clrGrey, borderClr: AppColors.clrGrey,
@ -105,6 +109,42 @@ class PaymentView extends StatelessWidget {
], ],
), ),
), ),
SizedBox(width: 16),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextView(text: "Freight Bill No."),
SizedBox(height: 8),
CustomDropdown<String>(
icon: paymentCtrl.selectedFreightBill.value ==
"Select Bill No."
? Icon(
Icons.keyboard_arrow_down_outlined,
size: 20,
color: Colors.black,
) : GestureDetector(
onTap: () {
paymentCtrl.selectedFreightBill.value =
"Select Bill No.";
},
child: Icon(Icons.close,size: 14)),
backClr: AppColors.clrD9,
borderClr: AppColors.clrGrey,
items: paymentCtrl.freightBill,
itemLabel: (item) => item,
onSelected: (selected) {
paymentCtrl.selectedFreightBill.value =
selected.toString();
},
hintText:
paymentCtrl.selectedFreightBill.value,
),
],
),
),
], ],
), ),
SizedBox(height: 12), SizedBox(height: 12),
@ -189,11 +229,10 @@ class PaymentView extends StatelessWidget {
? CircularProgressIndicator() ? CircularProgressIndicator()
: Container( : Container(
margin: EdgeInsets.only(bottom: 16, top: 8), margin: EdgeInsets.only(bottom: 16, top: 8),
// height: MediaQuery.of(context).size.height * 0.4,
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all(color: AppColors.clrGrey)), border: Border.all(color: AppColors.clrGrey)),
child: RawScrollbar( child: RawScrollbar(
thumbColor: AppColors.clrD9, thumbColor: AppColors.primaryClr.withOpacity(0.4),
radius: Radius.circular(2), radius: Radius.circular(2),
trackVisibility: true, trackVisibility: true,
thumbVisibility: true, thumbVisibility: true,
@ -202,7 +241,7 @@ class PaymentView extends StatelessWidget {
child: SingleChildScrollView( child: SingleChildScrollView(
controller: paymentCtrl.verticalScrollController, controller: paymentCtrl.verticalScrollController,
child: RawScrollbar( child: RawScrollbar(
thumbColor: AppColors.clrD9, thumbColor: AppColors.primaryClr.withOpacity(0.4),
radius: Radius.circular(2), radius: Radius.circular(2),
thickness: 14, thickness: 14,
trackVisibility: true, trackVisibility: true,
@ -274,8 +313,13 @@ class PaymentView extends StatelessWidget {
index, "${stoppage.materialCode}"), index, "${stoppage.materialCode}"),
editableCell( editableCell(
index, "${stoppage.freightbillCode}"), index, "${stoppage.freightbillCode}"),
editableCell( editableCell(
index, "${stoppage.lastUpdatedOn}"), index,
DateFormat('yyyy - MMM dd').format(
DateTime.parse(stoppage
.lastUpdatedOn
.toString()))),
editableCell( editableCell(
index, "${stoppage.shipmentNetQty}"), index, "${stoppage.shipmentNetQty}"),

View File

@ -344,8 +344,13 @@ class GenerateFrightBill extends StatelessWidget {
); );
} }
return Column( return Column(
mainAxisAlignment: MainAxisAlignment.end, children: [
crossAxisAlignment: CrossAxisAlignment.end, SizedBox(
width: MediaQuery.sizeOf(context).width,
height: controller.isFilterVisibleGenerateFreight.value == true
? MediaQuery.of(context).size.height * 0.3
: MediaQuery.of(context).size.height * 0.64,
child: Column(
children: [ children: [
Container( Container(
padding: EdgeInsets.symmetric(horizontal: 10), padding: EdgeInsets.symmetric(horizontal: 10),
@ -376,7 +381,8 @@ class GenerateFrightBill extends StatelessWidget {
} else { } else {
CommonAlertDialog.showDialog( CommonAlertDialog.showDialog(
dismissable: false, dismissable: false,
message: "Are you sure want to\nsave this?", message:
"Are you sure want to\nsave this?",
positiveText: "Save", positiveText: "Save",
negativeText: "Cancel", negativeText: "Cancel",
positiveBtCallback: () { positiveBtCallback: () {
@ -394,10 +400,6 @@ class GenerateFrightBill extends StatelessWidget {
), ),
Container( Container(
margin: EdgeInsets.only(bottom: 16, top: 16), margin: EdgeInsets.only(bottom: 16, top: 16),
height:
controller.isFilterVisibleGenerateFreight.value == true
? MediaQuery.of(context).size.height * 0.3
: MediaQuery.of(context).size.height * 0.64,
child: RawScrollbar( child: RawScrollbar(
thumbColor: AppColors.clrD9, thumbColor: AppColors.clrD9,
radius: Radius.circular(2), radius: Radius.circular(2),
@ -435,7 +437,8 @@ class GenerateFrightBill extends StatelessWidget {
BorderSide(color: AppColors.clrGrey), BorderSide(color: AppColors.clrGrey),
verticalInside: verticalInside:
BorderSide(color: AppColors.clrGrey), 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),
@ -445,14 +448,16 @@ class GenerateFrightBill extends StatelessWidget {
label: Transform.scale( label: Transform.scale(
scale: 0.80, scale: 0.80,
child: Checkbox( child: Checkbox(
value: controller.selectAllField.value, value:
controller.selectAllField.value,
onChanged: (value) { onChanged: (value) {
controller.selectAll(value ?? false); controller
.selectAll(value ?? false);
}, },
activeColor: AppColors.primaryClr, activeColor: AppColors.primaryClr,
checkColor: Colors.white, checkColor: Colors.white,
materialTapTargetSize: MaterialTapTargetSize materialTapTargetSize:
.shrinkWrap, MaterialTapTargetSize.shrinkWrap,
), ),
), ),
), ),
@ -474,7 +479,8 @@ class GenerateFrightBill extends StatelessWidget {
], ],
rows: List<DataRow>.generate( rows: List<DataRow>.generate(
controller.grnDetails.length, (index) { controller.grnDetails.length, (index) {
final stoppage = controller.grnDetails[index]; final stoppage =
controller.grnDetails[index];
return DataRow( return DataRow(
selected: stoppage.isSelected, selected: stoppage.isSelected,
cells: [ cells: [
@ -490,12 +496,14 @@ class GenerateFrightBill extends StatelessWidget {
activeColor: AppColors.primaryClr, activeColor: AppColors.primaryClr,
checkColor: Colors.white, checkColor: Colors.white,
materialTapTargetSize: materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap, MaterialTapTargetSize
.shrinkWrap,
), ),
), ),
), ),
// editableCell(index, "0${index + 1}"), // editableCell(index, "0${index + 1}"),
editableCell(index, stoppage.grnNo ?? ""), editableCell(
index, stoppage.grnNo ?? ""),
editableCell( editableCell(
index, stoppage.plantCode ?? ""), index, stoppage.plantCode ?? ""),
editableCell( editableCell(
@ -509,20 +517,26 @@ class GenerateFrightBill extends StatelessWidget {
index, stoppage.fromLocation ?? ""), index, stoppage.fromLocation ?? ""),
editableCell( editableCell(
index, stoppage.vehicleNo ?? ""), index, stoppage.vehicleNo ?? ""),
editableCell(index, stoppage.lrNo ?? ""), editableCell(
index, stoppage.lrNo ?? ""),
editableCell( editableCell(
index, index,
DateFormat('yyyy-MM-dd').format( DateFormat('yyyy-MM-dd').format(
stoppage.lrDate ?? DateTime.now())), stoppage.lrDate ??
DateTime.now())),
editableCell(index, editableCell(index,
stoppage.dispQty?.toString() ?? ""), stoppage.dispQty?.toString() ?? ""),
editableCell(index, editableCell(index,
stoppage.netQty?.toString() ?? ""), stoppage.netQty?.toString() ?? ""),
editableCell(index, editableCell(
stoppage.billingQty?.toString() ?? ""), index,
stoppage.billingQty?.toString() ??
""),
editableCell(index, "-"), editableCell(index, "-"),
editableCell(index, editableCell(
stoppage.freightRate?.toString() ?? ""), index,
stoppage.freightRate?.toString() ??
""),
editableCell( editableCell(
index, index,
stoppage.shipmentCost?.toString() ?? stoppage.shipmentCost?.toString() ??
@ -537,13 +551,19 @@ class GenerateFrightBill extends StatelessWidget {
), ),
), ),
), ),
CustomPagination( ],
currentPage: controller.currentPageViewFreight.value + 1, ),
totalPages: controller.totalPagesViewFreight.value, ),
Padding(
padding: EdgeInsets.only(bottom: 4),
child: CustomPagination(
currentPage: controller.currentPageGenerateFreight.value + 1,
totalPages: controller.totalPagesGenerateFreight.value,
onPageChanged: (page) { onPageChanged: (page) {
controller.viewFreightView(page: page - 1); controller.postData(page: page - 1);
}, },
), ),
)
], ],
); );
}), }),

View File

@ -41,20 +41,15 @@ class _TransportViewState extends State<InvoiceManagement> {
return Column( return Column(
children: [ children: [
Container( Container(
padding: EdgeInsets.only(bottom: 4), margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
margin: EdgeInsets.all(16), height: 50,
child: Column(
children: [
Container(
margin: EdgeInsets.only(bottom: 12),
height: 55,
color: AppColors.primaryClr, color: AppColors.primaryClr,
child: Row( child: Row(
children: [ children: [
ListView.separated( ListView.separated(
shrinkWrap: true,
padding: EdgeInsets.symmetric(horizontal: 16), padding: EdgeInsets.symmetric(horizontal: 16),
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
shrinkWrap: true,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return Obx( return Obx(
() => InkWell( () => InkWell(
@ -66,18 +61,14 @@ class _TransportViewState extends State<InvoiceManagement> {
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border( border: Border(
bottom: BorderSide( bottom: BorderSide(
color: ctrl.selectedState.value == color: ctrl.selectedState.value == index
index
? Colors.white ? Colors.white
: AppColors.primaryClr, : AppColors.primaryClr,
width: 3))), width: 3))),
child: Center( child: Center(
child: Text( child: TextView(
ctrl.userTabs[index].title ?? "", text: ctrl.invoiceTabs[index].title ?? "",
style: TextStyle( style: 12.txtBoldWhite,
fontSize: 12,
fontWeight: FontWeight.w900,
color: Colors.white),
), ),
), ),
), ),
@ -87,38 +78,36 @@ class _TransportViewState extends State<InvoiceManagement> {
separatorBuilder: (context, index) { separatorBuilder: (context, index) {
return SizedBox(width: 16); return SizedBox(width: 16);
}, },
itemCount: ctrl.userTabs.length), itemCount: ctrl.invoiceTabs.length,
),
Spacer(), Spacer(),
InkWell( InkWell(
child: Image.asset(AppImages.refresh, onTap: (){
height: 10, width: 10)), paymentCtrl.resetDropdowns();
},
child: Image.asset(AppImages.refresh, height: 16, width: 16)),
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Text( child: Text(
AppStrings.refresh, AppStrings.refresh,
style: TextStyle( style: 12.txtBoldWhite,
color: AppColors.white,
fontSize: 10,
fontWeight: FontWeight.normal),
), ),
), ),
GestureDetector( InkWell(
behavior: HitTestBehavior.translucent,
onTap: () { onTap: () {
print("cdgsa"); switch (ctrl.selectedState.value) {
ctrl.isSelected.value = !ctrl.isSelected.value; case 0:
// if (ctrl.isSelected.value == 0) { return ctrl.invoiceFilter();
// ctrl.toggleFilter(); case 1:
// } else if (ctrl.isSelected.value == 1) { return ctrl.cancelledFilter();
// ctrl.toggleViewFreight(); case 2:
// } else if (ctrl.isSelected.value == 2) { return ctrl.paymentFilter();
// ctrl.togglePending(); default:
// } return ctrl.ccnFilter();
}
}, },
child: Row( child: Image.asset(AppImages.filter, height: 16, width: 16),
children: [ ),
Image.asset(AppImages.filter,
height: 16, width: 16),
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: TextView( child: TextView(
@ -129,239 +118,6 @@ class _TransportViewState extends State<InvoiceManagement> {
], ],
), ),
), ),
],
),
),
],
),
),
Obx(
() => ctrl.isSelected.value
? Container(
padding: EdgeInsets.all(8),
color: AppColors.clrF2,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextView(text: "Plant", isRequired: true),
SizedBox(height: 8),
CustomDropdown(
backClr: AppColors.clrD9,
borderClr: AppColors.clrGrey,
items: ctrl.plant,
itemLabel: (item) =>
"${item.plantCode} - ${item.plantDesc}",
onSelected: (selected) {
if (selected != null) {
ctrl.selectPlantFreight.value =
selected.plantCode ?? "";
ctrl.showPlantErrorFreight.value =
false;
}
},
hintText: "Select Plant",
),
Obx(() =>
ctrl.showPlantErrorFreight.value
? Text(
'Required',
style: TextStyle(
color: Colors.red,
fontSize: 12),
)
: Text('')),
],
),
),
SizedBox(width: 16),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextView(text: "Freight Bill Date",isRequired: true,),
Container(
height: 35,
child: TextFormField(
key: ctrl.fromTextFieldKey,
controller: ctrl.fromController,
onTap: () async {
final pickedDate =
await showWebDatePicker(
width: 20.w,
context: ctrl
.fromTextFieldKey.currentContext!,
initialDate:
ctrl.fromSelectedDate,
firstDate: DateTime(2000),
lastDate: DateTime.now(),
);
if (pickedDate != null) {
ctrl.fromSelectedDate =
pickedDate;
String formattedDate = ctrl
.getFormattedDate(pickedDate);
ctrl.fromController.text =
formattedDate;
ctrl.dateCheck.value = true;
}
},
decoration: InputDecoration(
fillColor: AppColors.clrD9,
filled: true,
hintText: 'Select Freight Bill Date ',
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: ctrl.dateCheck.value
? InkWell(
onTap: () {
ctrl.dateCheck.value =
false;
ctrl.fromController
.clear();
ctrl.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: "Freight Bill No.", isRequired: true),
SizedBox(height: 8),
CustomDropdown<String>(
backClr: AppColors.clrD9,
borderClr: AppColors.clrGrey,
items: ctrl.freightBill,
itemLabel: (item) => item,
onSelected: (selected) {
if (selected != null) {
ctrl.selectFreightBillValidate.value =
selected;
ctrl.showTransactionErrorViewFreight
.value = false;
}
},
hintText: "Select Freight Bill No.",
),
Obx(() => ctrl
.showTransactionErrorViewFreight.value
? Text(
'Required',
style: TextStyle(
color: Colors.red, fontSize: 12),
)
: Text('')),
],
),
),
],
),
// 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(
// "Freight Bill Date",
// ),
// SizedBox(height: 8),
// InputField(
// title: "Select Bill Date",
// ),
// ],
// )),
// ],
// ),
// ),
// 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),
// CommonBtn(
// text: AppStrings.submit,
// clickAction: () {},
// ),
// ],
// ),
// ),
// ],
// ))
],
),
)
: SizedBox(),
),
Obx(() { Obx(() {
switch (ctrl.selectedState.value) { switch (ctrl.selectedState.value) {
case 0: case 0:
@ -419,8 +175,8 @@ class _TransportViewState extends State<InvoiceManagement> {
dataColumn("Freight Bill No."), dataColumn("Freight Bill No."),
//dataColumn(AppStrings.getInvoiceDate), //dataColumn(AppStrings.getInvoiceDate),
dataColumn("Freight Bill date"), dataColumn("Freight Bill date"),
dataColumn("Plant Code/Plant Desc."), dataColumn("Plant Code - Plant Desc."),
dataColumn("Material Code/Material Desc."), dataColumn("Material Code - Material Desc."),
dataColumn("Freight Bill Amount"), dataColumn("Freight Bill Amount"),
dataColumn("GST Amount"), dataColumn("GST Amount"),
dataColumn("Status"), dataColumn("Status"),

View File

@ -524,13 +524,13 @@ class PendingGeneration extends StatelessWidget {
], ],
); );
}), }),
// CustomPagination( CustomPagination(
// currentPage: controller.currentPage.value, currentPage: controller.currentPagePendingFreight.value,
// totalPages: controller.totalPages.value, totalPages: controller.totalPagesPendingFreight.value,
// onPageChanged: (int page) { onPageChanged: (int page) {
// // controller.onPageChanged(page); // controller.grnPending(page: page -1);
// }, },
// ), ),
], ],
); );
} }

View File

@ -1,8 +1,10 @@
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:shayog/components/common/common_btn.dart'; import 'package:shayog/components/common/common_btn.dart';
import 'package:shayog/feature/presentation/widgets/custom_pagination.dart'; import 'package:shayog/feature/presentation/widgets/custom_pagination.dart';
import 'package:sizer/sizer.dart'; import 'package:sizer/sizer.dart';
import 'package:table_calendar/table_calendar.dart';
import 'package:vph_web_date_picker/vph_web_date_picker.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';
@ -17,6 +19,11 @@ class ViewFreightBill extends StatelessWidget {
final ScrollController horizontalScrollController = ScrollController(); final ScrollController horizontalScrollController = ScrollController();
final ScrollController verticalScrollController = ScrollController(); final ScrollController verticalScrollController = ScrollController();
final TextEditingController _dateController = TextEditingController();
final ValueNotifier<DateTime?> _selectedDate1 =
ValueNotifier<DateTime?>(null);
final ValueNotifier<DateTime?> _selectedDate2 =
ValueNotifier<DateTime?>(null);
final controller = Get.put(TransportController()); final controller = Get.put(TransportController());
@override @override
@ -159,29 +166,11 @@ class ViewFreightBill extends StatelessWidget {
margin: EdgeInsets.only(top: 8), margin: EdgeInsets.only(top: 8),
height: 35, height: 35,
child: TextFormField( child: TextFormField(
controller: _dateController,
readOnly: true,
key: controller.fromTextFieldKey, key: controller.fromTextFieldKey,
controller: controller.fromController,
onTap: () async { onTap: () async {
final pickedDate = _showCalendars(context);
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, fillColor: AppColors.clrD9,
@ -740,4 +729,95 @@ class ViewFreightBill extends StatelessWidget {
}, },
); );
} }
void _showCalendars(BuildContext context) {
showModalBottomSheet(
context: context,
isScrollControlled: true,
builder: (context) {
return Padding(
padding: EdgeInsets.all(16.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(child: CalendarWidget(isFirstCalendar: true, selectedDateNotifier: _selectedDate1)),
SizedBox(width: 20),
Expanded(child: CalendarWidget(isFirstCalendar: false, selectedDateNotifier: _selectedDate2)),
],
),
SizedBox(height: 10),
ValueListenableBuilder(
valueListenable: _selectedDate2,
builder: (context, DateTime? date2, child) {
return ElevatedButton(
onPressed: (_selectedDate1.value != null && date2 != null)
? () {
_dateController.text =
"${DateFormat('dd/MM/yyyy').format(_selectedDate1.value!)} - ${DateFormat('dd/MM/yyyy').format(date2)}";
Navigator.pop(context);
}
: null,
child: Text("Confirm"),
);
},
),
],
),
);
},
);
}
}
class CalendarWidget extends StatelessWidget {
final bool isFirstCalendar;
final ValueNotifier<DateTime?> selectedDateNotifier;
CalendarWidget({required this.isFirstCalendar, required this.selectedDateNotifier});
@override
Widget build(BuildContext context) {
DateTime initialMonth = isFirstCalendar ? DateTime.now() : DateTime(DateTime.now().year, DateTime.now().month + 1, 1);
return ValueListenableBuilder(
valueListenable: selectedDateNotifier,
builder: (context, DateTime? selectedDate, child) {
return TableCalendar(
firstDay: DateTime.utc(2000, 1, 1),
lastDay: DateTime.utc(2100, 12, 31),
focusedDay: initialMonth,
calendarFormat: CalendarFormat.month,
headerStyle: HeaderStyle(
formatButtonVisible: false,
titleCentered: true,
titleTextStyle: TextStyle(fontSize: 14), // Smaller title
),
daysOfWeekStyle: DaysOfWeekStyle(
weekdayStyle: TextStyle(fontSize: 12),
weekendStyle: TextStyle(fontSize: 12),
),
calendarStyle: CalendarStyle(
defaultTextStyle: TextStyle(fontSize: 12), // Smaller day numbers
weekendTextStyle: TextStyle(fontSize: 12, color: AppColors.white),
selectedTextStyle: TextStyle(fontSize: 14, fontWeight: FontWeight.bold),
selectedDecoration: BoxDecoration(
color: Colors.blueAccent,
shape: BoxShape.circle,
),
weekendDecoration: BoxDecoration(
color: AppColors.calendarBack, // Blue background for Sundays
shape: BoxShape.circle,
),
),
selectedDayPredicate: (day) => day == selectedDate,
onDaySelected: (selectedDay, focusedDay) {
selectedDateNotifier.value = selectedDay;
},
);
},
);
}
} }

View File

@ -161,8 +161,7 @@ class _TransportViewState extends State<TransportView> {
child: Column( child: Column(
children: [ children: [
Container( Container(
color: Colors.white, // padding: EdgeInsets.only(bottom: 16),
padding: EdgeInsets.only(bottom: 16),
margin: EdgeInsets.all(16), margin: EdgeInsets.all(16),
child: Column( child: Column(
children: [ children: [
@ -258,26 +257,53 @@ class _TransportViewState extends State<TransportView> {
), ),
), ),
Obx( Obx(
() => SimpleDropdown( () => ctrl.selectedUser.value == 0
? SimpleDropdown(
onSelected: (newValue) { onSelected: (newValue) {
ctrl.selectedDropdownItemViewFreight.value = newValue; ctrl.selectedDropdownItemGenerateFreight.value =
newValue;
ctrl.postData();
},
items: ctrl.selectElementSize,
selectedItem:
ctrl.selectedDropdownItemGenerateFreight.value,
)
: ctrl.selectedUser.value == 1
? SimpleDropdown(
onSelected: (newValue) {
ctrl.selectedDropdownItemViewFreight
.value = newValue;
ctrl.viewFreightView(); ctrl.viewFreightView();
}, },
items: ctrl.selectElementSize, items: ctrl.selectElementSize,
selectedItem: ctrl.selectedDropdownItemViewFreight.value, selectedItem: ctrl
.selectedDropdownItemViewFreight.value,
)
: ctrl.selectedUser.value == 2
? SimpleDropdown(
onSelected: (newValue) {
ctrl.selectedDropdownItemViewFreight
.value = newValue;
ctrl.viewFreightView();
},
items: ctrl.selectElementSize,
selectedItem: ctrl
.selectedDropdownItemViewFreight.value,
)
: SimpleDropdown(
onSelected: (newValue) {
ctrl.selectedDropdownItemViewFreight
.value = newValue;
ctrl.viewFreightView();
},
items: ctrl.selectElementSize,
selectedItem: ctrl
.selectedDropdownItemViewFreight.value,
), ),
), ),
// Obx(() => SimpleDropdown<int>( SizedBox(
// items: [1, 2, 3, 4], width: 10,
// selectedItem: ctrl. selectedDropdownItem.value, // Bind external state ),
// onSelected: (val) => ctrl. selectedDropdownItem.value = val,
// width: 150,
// borderClr: Colors.blue,
// )),
SizedBox(width: 10,),
], ],
), ),
), ),

View File

@ -153,9 +153,10 @@ class TransportController extends GetxController {
getInvoiceView(); getInvoiceView();
super.onInit(); super.onInit();
} }
Rxn<int> selectedDropdownItemViewFreight = Rxn<int>(); Rxn<int> selectedDropdownItemViewFreight = Rxn<int>();
Rxn<int> selectedDropdownItemPendingFreight = Rxn<int>();
Rxn<int> selectedDropdownItemGenerateFreight = Rxn<int>();
refreshApis() { refreshApis() {
getFreightBills(); getFreightBills();
@ -164,6 +165,8 @@ class TransportController extends GetxController {
getSubFreightBillsView(); getSubFreightBillsView();
postData(); postData();
selectedDropdownItemViewFreight.value = null; selectedDropdownItemViewFreight.value = null;
selectedDropdownItemPendingFreight.value = null;
selectedDropdownItemGenerateFreight.value = null;
} }
getInvoiceView() async { getInvoiceView() async {
@ -220,7 +223,12 @@ class TransportController extends GetxController {
var grnPendingLoader = false.obs; var grnPendingLoader = false.obs;
var errorMessage = ''.obs; var errorMessage = ''.obs;
postData() async { // for Generate
var totalElementsGenerateFreight = 0.obs;
RxInt currentPageGenerateFreight = 1.obs;
RxInt totalPagesGenerateFreight = 3.obs;
postData({int page = 0}) async {
try { try {
isLoading.value = true; isLoading.value = true;
Map<String, String> requestBody = { Map<String, String> requestBody = {
@ -231,18 +239,24 @@ class TransportController extends GetxController {
"grnFromDate": "", "grnFromDate": "",
"grnToDate": "" "grnToDate": ""
}; };
var response = await PostRequests.addFreightBill(requestBody); var response = await PostRequests.addFreightBill(
page: page,
size: selectedDropdownItemGenerateFreight.value ?? 1,
requestBody: requestBody);
if (response != null) { if (response != null) {
List<Content> flattenedContent = List<Content> flattenedContent =
response.content!.expand((list) => list).toList(); response.content!.expand((list) => list).toList();
grnDetails.assignAll(flattenedContent); grnDetails.assignAll(flattenedContent);
totalPagesGenerateFreight.value = response.totalPages ?? 0;
totalElementsGenerateFreight.value = response.totalElements ?? 0;
currentPageGenerateFreight.value = page;
} }
} finally { } finally {
isLoading.value = false; isLoading.value = false;
} }
} }
void displayFilteredData() async { void displayFilteredData({int page = 0}) async {
try { try {
isLoading.value = true; isLoading.value = true;
Map<String, String> requestBody = { Map<String, String> requestBody = {
@ -254,7 +268,10 @@ class TransportController extends GetxController {
"grnToDate": "" "grnToDate": ""
}; };
var response = await PostRequests.addFreightBill(requestBody); var response = await PostRequests.addFreightBill(
page: page,
size: selectedDropdownItemGenerateFreight.value ?? 4,
requestBody: requestBody);
if (response != null) { if (response != null) {
List<Content> flattenedContent = List<Content> flattenedContent =
response.content!.expand((list) => list).toList(); response.content!.expand((list) => list).toList();
@ -272,12 +289,14 @@ class TransportController extends GetxController {
selectTransactionTypeFreight.value.toUpperCase()); selectTransactionTypeFreight.value.toUpperCase());
}).toList(); }).toList();
print("Filtered Data: ${filteredData.length}"); if (page == 0) {
grnDetails.assignAll(flattenedContent);
grnDetails.assignAll(filteredData); } else {
grnDetails.addAll(flattenedContent);
print("✅ Filtered Data: ${filteredData.length} items displayed."); }
print("✅ Filtered Data: ${grnDetails.length} items displayed."); totalPagesGenerateFreight.value = response.totalPages ?? 0;
totalElementsGenerateFreight.value = response.totalElements ?? 0;
currentPageGenerateFreight.value = page;
} else { } else {
print("❌ No response from API."); print("❌ No response from API.");
} }
@ -411,13 +430,6 @@ class TransportController extends GetxController {
} }
RxString selectedPlant = "".obs; RxString selectedPlant = "".obs;
List plantList = [
"Plant 1",
"Plant 2",
"Plant 3",
"Plant 4",
"Plant 5",
];
RxString selectedFreight = "".obs; RxString selectedFreight = "".obs;
addFreightBill() async { addFreightBill() async {
@ -457,22 +469,35 @@ class TransportController extends GetxController {
////////////////////////////////////////// PRIYA /////////////////////////////////////////////// ////////////////////////////////////////// PRIYA ///////////////////////////////////////////////
var freightBillData = <FreightBill>[].obs; var freightBillData = <FreightBill>[].obs;
var totalElementsViewFreight = 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;
// view freight
var totalElementsViewFreight = 0.obs;
RxInt currentPageViewFreight = 1.obs; RxInt currentPageViewFreight = 1.obs;
RxInt totalPagesViewFreight = 3.obs; RxInt totalPagesViewFreight = 3.obs;
final int limit = 10;
RxList selectElementSize = [
4,
8,
12,
16,
20,
].obs;
// for pending
var totalElementsPendingFreight = 0.obs;
RxInt currentPagePendingFreight = 1.obs;
RxInt totalPagesPendingFreight = 3.obs;
final int limit = 10;
// RxList selectElementSize = [
// 4,
// 8,
// 12,
// 16,
// 20,
// ].obs;
RxList selectElementSize = [
2,
4,
6,
8,
10,
].obs;
viewFreightView({int page = 0}) async { viewFreightView({int page = 0}) async {
try { try {
freightViewLoader.value = true; freightViewLoader.value = true;
@ -488,7 +513,9 @@ class TransportController extends GetxController {
}; };
var response = await PostRequests.viewFreightBill( var response = await PostRequests.viewFreightBill(
page: page, size: selectedDropdownItemViewFreight.value ?? 4, requestBody: requestBody); page: page,
size: selectedDropdownItemViewFreight.value ?? 4,
requestBody: requestBody);
if (response != null) { if (response != null) {
List<FreightBill> flattenedContent = List<FreightBill> flattenedContent =
@ -514,6 +541,38 @@ class TransportController extends GetxController {
var grnPendingData = <GrnPending>[].obs; var grnPendingData = <GrnPending>[].obs;
// grnPending({int page = 0}) async {
// try {
// grnPendingLoader.value = true;
//
// Map<String, String> requestBody = {
// "plant": "",
// "productNane": "",
// "transactionType": "",
// "fromLocation": "",
// "grnFromDate": "",
// "grnToDate": ""
// };
//
// var response = await PostRequests.grnPending(
// page: page,
// size: selectedDropdownItemPendingFreight.value ?? 4,
// requestBody: requestBody,
// );
// if (response != null) {
// List<GrnPending> flattenedContent =
// response.content!.expand((list) => list).toList();
// grnPendingData.assignAll(flattenedContent);
// totalPagesPendingFreight.value = response.totalPages ?? 0;
// totalElementsPendingFreight.value = response.totalElements ?? 0;
// currentPagePendingFreight.value = page;
// print(
// 'response from pending tab${response.first.toString()} and ${flattenedContent.length} and ${grnPendingData.value[0].codeValue} and ${grnPendingData.value[0].plantCode} and ${grnPendingData.value[0].materialCode}');
// }
// } finally {
// grnPendingLoader.value = false;
// }
// }
grnPending() async { grnPending() async {
try { try {
grnPendingLoader.value = true; grnPendingLoader.value = true;
@ -541,8 +600,7 @@ class TransportController extends GetxController {
grnPendingLoader.value = false; grnPendingLoader.value = false;
} }
} }
void displayFilteredDataFromViewFreight({int page = 0}) async {
void displayFilteredDataFromViewFreight({int page = 0, int size = 4}) async {
try { try {
freightViewLoader.value = true; freightViewLoader.value = true;
@ -556,12 +614,10 @@ class TransportController extends GetxController {
"grnToDate": "", "grnToDate": "",
}; };
print(
"🔎 Filter Request - Page: $page, Size: $size, Plant: ${selectPlantViewFreight.value}, "
"Product: ${selectProductViewFreight.value}, Freight Bill: ${selectFreightBillValidate.value}");
var response = await PostRequests.viewFreightBill( var response = await PostRequests.viewFreightBill(
page: page, size: size, requestBody: requestBody); // Pass pagination page: page,
size: selectedDropdownItemViewFreight.value ?? 4,
requestBody: requestBody); // Pass pagination
if (response != null && response.content != null) { if (response != null && response.content != null) {
List<FreightBill> flattenedContent = List<FreightBill> flattenedContent =
@ -594,6 +650,57 @@ class TransportController extends GetxController {
} }
} }
// void displayFilteredDataFromPending({int page = 0}) async {
// try {
// isLoading.value = true;
// Map<String, String> requestBody = {
// "plant": selectPlantPending.value,
// "productNane": selectProductPending.value,
// "transactionType": selectTransactionTypePending.value.toUpperCase(),
// "fromLocation": selectLocation.value,
// "grnFromDate": "",
// "grnToDate": ""
// };
//
// var response = await PostRequests.grnPending(
// page: page,
// size: selectedDropdownItemPendingFreight.value ?? 4,
// requestBody: requestBody,
// );
// if (response != null) {
// List<GrnPending> flattenedContent =
// response.content!.expand((list) => list).toList();
//
// List<GrnPending> filteredData = flattenedContent.where((item) {
// return (selectPlantFreight.value.isEmpty ||
// item.plantCode == selectPlantFreight.value) &&
// (selectProductFreight.value.isEmpty ||
// item.materialCode == selectProductFreight.value) &&
// (selectTransactionTypeFreight.value.isEmpty ||
// item.codeValue ==
// selectTransactionTypeFreight.value.toUpperCase());
// }).toList();
//
// if (page == 0) {
// grnPendingData.assignAll(flattenedContent);
// } else {
// grnPendingData.addAll(flattenedContent);
// }
//
// // Update pagination details
// totalPagesPendingFreight.value = response.totalPages ?? 0;
// totalElementsPendingFreight.value = response.totalElements ?? 0;
// currentPagePendingFreight.value = page;
//
// print(
// "✅ pending Data: ${filteredData.length} items displayed pending.");
// } else {
// print("❌ No response from API.");
// }
// } finally {
// isLoading.value = false;
// }
// }
void displayFilteredDataFromPending() async { void displayFilteredDataFromPending() async {
try { try {
isLoading.value = true; isLoading.value = true;

View File

@ -2,7 +2,7 @@ class ApiUrls {
ApiUrls._(); ApiUrls._();
static const String baseUrl = "http://46.28.44.130:9092/"; static const String baseUrl = "http://46.28.44.130:9092/";
static const addFreightBill = static const addFreightBill =
'bill/grndetails?page=0&size=20&sort=grn_date,desc'; 'bill/grndetails';
static const getFreightBills = 'bill/dropdown'; static const getFreightBills = 'bill/dropdown';
static const getAllPayments = "http://46.28.44.130:9092/invoice/getPayments"; static const getAllPayments = "http://46.28.44.130:9092/invoice/getPayments";
static const generateFreightBill = static const generateFreightBill =

View File

@ -20,12 +20,17 @@ import 'ApiUrls.dart';
class PostRequests { class PostRequests {
PostRequests._(); PostRequests._();
static Future<GenerateFreightBills?> addFreightBill( static Future<GenerateFreightBills?> addFreightBill({
int page = 0,
int size = 15,
String sort = 'last_updated_on,desc',
Map<String, dynamic>? requestBody,
}
Map<String, String> requestBody) async { ) async {
var apiResponse = var apiResponse =
await RemoteService.simplePost(requestBody, ApiUrls.addFreightBill); await RemoteService.simplePost(requestBody ?? {},'${ApiUrls.addFreightBill}?page=$page&size=$size&sort=$sort'
);
if (apiResponse != null) { if (apiResponse != null) {
return generateFreightBillsFromJson(apiResponse.response!); return generateFreightBillsFromJson(apiResponse.response!);
@ -34,8 +39,6 @@ class PostRequests {
} }
} }
static Future<GenerateBillsResModel?> freightBill( static Future<GenerateBillsResModel?> freightBill(
List<Map<String, dynamic>> requestBody) async { List<Map<String, dynamic>> requestBody) async {
var apiResponse = var apiResponse =
@ -83,6 +86,7 @@ class PostRequests {
return null; 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 =
@ -96,23 +100,13 @@ class PostRequests {
} }
} }
static Future<ViewFreightBillResModel?> viewFreightBillF(
Map<String, String> requestBody,
) async {
var apiResponse = await RemoteService.postUser(requestBody,
'${ApiUrls.viewFreightBill}');
if (apiResponse != null) {
return viewFreightBillResModelFromJson(apiResponse.response!);
} else {
return null;
}
}
static Future<ViewFreightBillResModel?> viewFreightBill({ static Future<ViewFreightBillResModel?> viewFreightBill({
int page = 0, int page = 0,
int size = 15, int size = 15,
String sort = 'last_updated_on,desc', String sort = 'last_updated_on,desc',
Map<String, String>? requestBody, Map<String, dynamic>? requestBody,
}) async { }) async {
// Construct dynamic URL with query parameters // Construct dynamic URL with query parameters
String url = 'http://46.28.44.130:9092/bill/freightbill' String url = 'http://46.28.44.130:9092/bill/freightbill'
@ -121,8 +115,7 @@ class PostRequests {
try { try {
var apiResponse = await RemoteService.postUser( var apiResponse = await RemoteService.postUser(
requestBody ?? {}, // Use empty map if no request body requestBody ?? {}, // Use empty map if no request body
url url);
);
if (apiResponse == null) return null; if (apiResponse == null) return null;
if (apiResponse.response == null || apiResponse.response!.isEmpty) { if (apiResponse.response == null || apiResponse.response!.isEmpty) {
@ -223,7 +216,6 @@ class PostRequests {
return null; return null;
} }
} }
static Future<GrnPendingBillsResModel?> grnPending( static Future<GrnPendingBillsResModel?> grnPending(
Map<String, String> requestBody) async { Map<String, String> requestBody) async {
var apiResponse = var apiResponse =
@ -234,6 +226,26 @@ class PostRequests {
return null; return null;
} }
} }
// static Future<GrnPendingBillsResModel?> grnPending({
// int page = 0,
// int size = 15,
// String sort = 'last_updated_on,desc',
// Map<String, dynamic>? requestBody,
// }) async {
// String url = 'http://46.28.44.130:9092/bill/grndetailsPanding'
// '?page=$page&size=$size&sort=$sort';
//
// var apiResponse = await RemoteService.postUser(
// requestBody ?? {}, url
// );
// print('response from pending ${apiResponse?.response.toString()} and ${requestBody.toString()}');
// if (apiResponse != null) {
// return grnPendingBillsResModelFromJson(apiResponse.response!);
// } else {
// return null;
// }
// }
static Future<GetInvoiceResponse?> getInvoice( static Future<GetInvoiceResponse?> getInvoice(
Map<String, String> requestBody) async { Map<String, String> requestBody) async {
var apiResponse = var apiResponse =

View File

@ -1,6 +1,6 @@
// This is a generated file; do not edit or check into version control. // This is a generated file; do not edit or check into version control.
FLUTTER_ROOT=C:\src\flutter\flutter FLUTTER_ROOT=C:\Users\Admin\Downloads\flutter_windows_3.27.1-stable\flutter
FLUTTER_APPLICATION_PATH=C:\Users\Admin\Downloads\shayog FLUTTER_APPLICATION_PATH=C:\Users\Admin\Downloads\shayog 5\shayog
COCOAPODS_PARALLEL_CODE_SIGN=true COCOAPODS_PARALLEL_CODE_SIGN=true
FLUTTER_BUILD_DIR=build FLUTTER_BUILD_DIR=build
FLUTTER_BUILD_NAME=1.0.0 FLUTTER_BUILD_NAME=1.0.0

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# This is a generated file; do not edit or check into version control. # This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=C:\src\flutter\flutter" export "FLUTTER_ROOT=C:\Users\Admin\Downloads\flutter_windows_3.27.1-stable\flutter"
export "FLUTTER_APPLICATION_PATH=C:\Users\Admin\Downloads\shayog" export "FLUTTER_APPLICATION_PATH=C:\Users\Admin\Downloads\shayog 5\shayog"
export "COCOAPODS_PARALLEL_CODE_SIGN=true" export "COCOAPODS_PARALLEL_CODE_SIGN=true"
export "FLUTTER_BUILD_DIR=build" export "FLUTTER_BUILD_DIR=build"
export "FLUTTER_BUILD_NAME=1.0.0" export "FLUTTER_BUILD_NAME=1.0.0"

View File

@ -333,6 +333,30 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.3.0" version: "1.3.0"
syncfusion_flutter_calendar:
dependency: "direct main"
description:
name: syncfusion_flutter_calendar
sha256: "593427a43fe5022955b1938d8b7f61bb000602bf835211e8c3fb8a0e3e2c04e1"
url: "https://pub.dev"
source: hosted
version: "28.2.4"
syncfusion_flutter_core:
dependency: transitive
description:
name: syncfusion_flutter_core
sha256: "3c1876b0a245de23de3b17a19e3106fed57d88f4fd2c8dc9bc1976705b1c31d5"
url: "https://pub.dev"
source: hosted
version: "28.2.4"
syncfusion_flutter_datepicker:
dependency: transitive
description:
name: syncfusion_flutter_datepicker
sha256: "889b716d9de344852f651ecdcc726b6eeb9e326d95c1bb54df95631a5d7ead68"
url: "https://pub.dev"
source: hosted
version: "28.2.4"
table_calendar: table_calendar:
dependency: "direct main" dependency: "direct main"
description: description:
@ -357,6 +381,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.7.3" version: "0.7.3"
timezone:
dependency: transitive
description:
name: timezone
sha256: ffc9d5f4d1193534ef051f9254063fa53d588609418c84299956c3db9383587d
url: "https://pub.dev"
source: hosted
version: "0.10.0"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:

View File

@ -42,6 +42,7 @@ dependencies:
table_calendar: ^3.2.0 table_calendar: ^3.2.0
file_picker: ^8.3.1 file_picker: ^8.3.1
path_provider: ^2.1.5 path_provider: ^2.1.5
syncfusion_flutter_calendar: ^28.2.4
dev_dependencies: dev_dependencies: