Compare commits

...

6 Commits

Author SHA1 Message Date
Ankit Sharma ca30dcdc13 Invoice Management Screen API Done 2025-02-06 02:25:43 +05:30
Priya Chetiwal 0e5d771da7 merge with prativa 2025-02-05 13:39:39 +05:30
Priya Chetiwal fa9f837930 print 2025-02-05 13:37:35 +05:30
Priya Chetiwal 34c5bbc291 working on validation freight view 2025-02-05 13:37:00 +05:30
Priya Chetiwal 5ffd3c9d7d print 2025-02-05 11:56:10 +05:30
Priya Chetiwal 72f7b3f051 changes done 2025-02-05 11:48:32 +05:30
20 changed files with 1782 additions and 812 deletions

View File

@ -3,6 +3,14 @@
// Generated file. Do not edit.
//
// @dart = 2.13
// ignore_for_file: type=lint
void registerPlugins() {}
import 'package:file_picker/_internal/file_picker_web.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
void registerPlugins([final Registrar? pluginRegistrar]) {
final Registrar registrar = pluginRegistrar ?? webPluginRegistrar;
FilePickerWeb.registerWith(registrar);
registrar.registerMessageHandler();
}

View File

@ -31,6 +31,12 @@
"packageUri": "lib/",
"languageVersion": "3.4"
},
{
"name": "cross_file",
"rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/cross_file-0.3.4+2",
"packageUri": "lib/",
"languageVersion": "3.3"
},
{
"name": "cupertino_icons",
"rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/cupertino_icons-1.0.8",
@ -43,6 +49,18 @@
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "ffi",
"rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/ffi-2.1.3",
"packageUri": "lib/",
"languageVersion": "3.3"
},
{
"name": "file_picker",
"rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/file_picker-8.3.1",
"packageUri": "lib/",
"languageVersion": "3.4"
},
{
"name": "flutter",
"rootUri": "file:///C:/src/flutter/flutter/packages/flutter",
@ -55,12 +73,24 @@
"packageUri": "lib/",
"languageVersion": "3.5"
},
{
"name": "flutter_plugin_android_lifecycle",
"rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.24",
"packageUri": "lib/",
"languageVersion": "3.5"
},
{
"name": "flutter_test",
"rootUri": "file:///C:/src/flutter/flutter/packages/flutter_test",
"packageUri": "lib/",
"languageVersion": "3.3"
},
{
"name": "flutter_web_plugins",
"rootUri": "file:///C:/src/flutter/flutter/packages/flutter_web_plugins",
"packageUri": "lib/",
"languageVersion": "3.2"
},
{
"name": "get",
"rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/get-4.6.6",
@ -133,12 +163,60 @@
"packageUri": "lib/",
"languageVersion": "3.0"
},
{
"name": "path_provider",
"rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider-2.1.5",
"packageUri": "lib/",
"languageVersion": "3.4"
},
{
"name": "path_provider_android",
"rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_android-2.2.15",
"packageUri": "lib/",
"languageVersion": "3.5"
},
{
"name": "path_provider_foundation",
"rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_foundation-2.4.1",
"packageUri": "lib/",
"languageVersion": "3.3"
},
{
"name": "path_provider_linux",
"rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_linux-2.2.1",
"packageUri": "lib/",
"languageVersion": "2.19"
},
{
"name": "path_provider_platform_interface",
"rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_platform_interface-2.1.2",
"packageUri": "lib/",
"languageVersion": "3.0"
},
{
"name": "path_provider_windows",
"rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_windows-2.3.0",
"packageUri": "lib/",
"languageVersion": "3.2"
},
{
"name": "pixel_snap",
"rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/pixel_snap-0.1.5",
"packageUri": "lib/",
"languageVersion": "3.0"
},
{
"name": "platform",
"rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/platform-3.1.6",
"packageUri": "lib/",
"languageVersion": "3.2"
},
{
"name": "plugin_platform_interface",
"rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/plugin_platform_interface-2.1.8",
"packageUri": "lib/",
"languageVersion": "3.0"
},
{
"name": "simple_gesture_detector",
"rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/simple_gesture_detector-0.2.1",
@ -247,6 +325,18 @@
"packageUri": "lib/",
"languageVersion": "3.4"
},
{
"name": "win32",
"rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/win32-5.10.1",
"packageUri": "lib/",
"languageVersion": "3.5"
},
{
"name": "xdg_directories",
"rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/xdg_directories-1.1.0",
"packageUri": "lib/",
"languageVersion": "3.3"
},
{
"name": "shayog",
"rootUri": "../",
@ -254,7 +344,7 @@
"languageVersion": "3.6"
}
],
"generated": "2025-02-05T08:21:07.654873Z",
"generated": "2025-02-05T20:46:55.606574Z",
"generator": "pub",
"generatorVersion": "3.6.1",
"flutterRoot": "file:///C:/src/flutter/flutter",

View File

@ -18,6 +18,10 @@ collection
3.4
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/collection-1.19.0/
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/collection-1.19.0/lib/
cross_file
3.3
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/cross_file-0.3.4+2/
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/cross_file-0.3.4+2/lib/
cupertino_icons
3.1
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/cupertino_icons-1.0.8/
@ -26,10 +30,22 @@ fake_async
2.12
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/fake_async-1.3.1/
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/fake_async-1.3.1/lib/
ffi
3.3
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/ffi-2.1.3/
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/ffi-2.1.3/lib/
file_picker
3.4
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/file_picker-8.3.1/
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/file_picker-8.3.1/lib/
flutter_lints
3.5
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_lints-5.0.0/
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_lints-5.0.0/lib/
flutter_plugin_android_lifecycle
3.5
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.24/
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.24/lib/
get
2.15
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/get-4.6.6/
@ -78,10 +94,42 @@ path
3.0
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/path-1.9.0/
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/path-1.9.0/lib/
path_provider
3.4
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider-2.1.5/
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider-2.1.5/lib/
path_provider_android
3.5
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_android-2.2.15/
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_android-2.2.15/lib/
path_provider_foundation
3.3
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_foundation-2.4.1/
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_foundation-2.4.1/lib/
path_provider_linux
2.19
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_linux-2.2.1/
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_linux-2.2.1/lib/
path_provider_platform_interface
3.0
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_platform_interface-2.1.2/
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_platform_interface-2.1.2/lib/
path_provider_windows
3.2
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_windows-2.3.0/
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_windows-2.3.0/lib/
pixel_snap
3.0
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/pixel_snap-0.1.5/
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/pixel_snap-0.1.5/lib/
platform
3.2
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/platform-3.1.6/
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/platform-3.1.6/lib/
plugin_platform_interface
3.0
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/plugin_platform_interface-2.1.8/
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/plugin_platform_interface-2.1.8/lib/
simple_gesture_detector
2.12
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/simple_gesture_detector-0.2.1/
@ -150,6 +198,14 @@ web
3.4
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/web-1.1.0/
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/web-1.1.0/lib/
win32
3.5
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/win32-5.10.1/
file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/win32-5.10.1/lib/
xdg_directories
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/lib/
shayog
3.6
file:///C:/Users/Admin/Downloads/shayog/
@ -166,4 +222,8 @@ flutter_test
3.3
file:///C:/src/flutter/flutter/packages/flutter_test/
file:///C:/src/flutter/flutter/packages/flutter_test/lib/
flutter_web_plugins
3.2
file:///C:/src/flutter/flutter/packages/flutter_web_plugins/
file:///C:/src/flutter/flutter/packages/flutter_web_plugins/lib/
2

View File

@ -15,5 +15,15 @@ import io.flutter.embedding.engine.FlutterEngine;
public final class GeneratedPluginRegistrant {
private static final String TAG = "GeneratedPluginRegistrant";
public static void registerWith(@NonNull FlutterEngine flutterEngine) {
try {
flutterEngine.getPlugins().add(new com.mr.flutter.plugin.filepicker.FilePickerPlugin());
} catch (Exception e) {
Log.e(TAG, "Error registering plugin file_picker, com.mr.flutter.plugin.filepicker.FilePickerPlugin", e);
}
try {
flutterEngine.getPlugins().add(new io.flutter.plugins.flutter_plugin_android_lifecycle.FlutterAndroidLifecyclePlugin());
} catch (Exception e) {
Log.e(TAG, "Error registering plugin flutter_plugin_android_lifecycle, io.flutter.plugins.flutter_plugin_android_lifecycle.FlutterAndroidLifecyclePlugin", e);
}
}
}

BIN
assets/images/back_img.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 KiB

View File

@ -6,9 +6,16 @@
#import "GeneratedPluginRegistrant.h"
#if __has_include(<file_picker/FilePickerPlugin.h>)
#import <file_picker/FilePickerPlugin.h>
#else
@import file_picker;
#endif
@implementation GeneratedPluginRegistrant
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry {
[FilePickerPlugin registerWithRegistrar:[registry registrarForPlugin:@"FilePickerPlugin"]];
}
@end

View File

@ -35,7 +35,8 @@ class _LoginScreenState extends State<LoginScreen> {
decoration: BoxDecoration(
color: AppColors.black,
image: DecorationImage(
image: AssetImage("assets/images/login_bg.png"),
image: AssetImage("assets/images/back_img.png"),
//image: AssetImage("assets/images/login_bg.png"),
fit: BoxFit.cover,
)),
child: Center(

View File

@ -2,6 +2,8 @@ import 'package:get/get.dart';
import '../../../../../../components/common/common_model.dart';
import '../../../../../../components/styles/app_strings.dart';
import '../../../../../../services/network/post_request.dart';
import '../../model/get_invoice_response.dart';
class InvoiceManagementController extends GetxController{
var selectedState = 0.obs;
@ -10,36 +12,52 @@ class InvoiceManagementController extends GetxController{
CommonModel(title: AppStrings.viewInvoice),
CommonModel(title: AppStrings.cancelledInvoice),
CommonModel(title: AppStrings.ccnView),
].obs;
var selectedInvoice = '41896424644'.obs; // Default value
var selectedFreightNo = '9841651635426'.obs; // Default value
].obs;// Default value
var invoiceViewLoader = false.obs;
var getInvoiceData = <GetInvoiceContent>[].obs;
RxInt totalPages = 3.obs;
RxInt totalElements = 3.obs;
var pageSize = 2.obs;
var sortField = "grn_date".obs;
var sortDirection = "desc".obs;
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'];
// var items = ['Admin', 'Sub Admin',
// 'Internal Audit', 'Raw material','MIS User'].obs;
// var status = ['STO','In-Bound'];
// RxList tabs = <CommonModel>[
// CommonModel(
// title: "User\nManagement",
// image: AppImages.userMgmt,
// selectionImg: AppImages.userMgmtBlue),
// CommonModel(
// title: "Configuration\nManagement",
// image: AppImages.configuration,
// selectionImg: AppImages.configurationBlue),
// CommonModel(
// title: "Masters",
// image: AppImages.masters,
// selectionImg: AppImages.mastersBlue),
// CommonModel(
// title: "Freight Bill & \n Invoice",
// image: AppImages.bills,
// selectionImg: AppImages.billsBlue),
// ].obs;
getInvoiceView() async {
try {
invoiceViewLoader.value = true;
Map<String, String> requestBody = {
"invoice_id":"",
"freightBillNo":"",
"invFromDate":"",
"invToDate":"",
"freightFromDate":"",
"freightToDate":""
};
var response = await PostRequests.getInvoice(requestBody);
if (response != null) {
List<GetInvoiceContent> flattenedContent =
response.content!.expand((list) => list).toList();
getInvoiceData.assignAll(flattenedContent);
// print("response from${getInvoiceData[0].freightbillCode.runtimeType} view freight bill ${freightBillData[0].plantCode.runtimeType} and ${freightBillData[0].materialCode.runtimeType} and}");
totalPages.value = response.totalPages ?? 0;
totalElements.value = response.totalElements ?? 0;
}
} finally {
invoiceViewLoader.value = false;
}
}
void changeSort(String field) {
if (field == sortField.value) {
sortDirection.value = sortDirection.value == "asc" ? "desc" : "asc";
} else {
sortField.value = field;
sortDirection.value = "desc";
}
// viewFreightView(page: 0);
}
}

View File

@ -17,11 +17,20 @@ import '../../view_model/transport_controller.dart';
import '../../widgets/common_card.dart';
import '../../widgets/freightbill_dialog.dart';
class GenerateFrightBill extends StatelessWidget {
class GenerateFrightBill extends StatefulWidget {
GenerateFrightBill({super.key});
@override
State<GenerateFrightBill> createState() => _GenerateFrightBillState();
}
class _GenerateFrightBillState extends State<GenerateFrightBill> {
final controller = Get.put(TransportController());
final TextEditingController _dateController = TextEditingController();
DateTime? _startDate;
DateTime? _endDate;
@override
Widget build(BuildContext context) {
return Column(
@ -158,7 +167,7 @@ class GenerateFrightBill extends StatelessWidget {
),
Padding(
padding: const EdgeInsets.only(
top: 16.0, left: 0, right: 8),
top: 0.0, left: 0, right: 8),
child: Row(
children: [
Expanded(
@ -173,29 +182,9 @@ class GenerateFrightBill extends StatelessWidget {
height: 35,
child: TextFormField(
key: controller.fromTextFieldKey,
controller: controller.fromController,
controller: _dateController,
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;
}
await _showDateRangePicker(context);
},
decoration: InputDecoration(
fillColor: AppColors.clrD9,
@ -531,7 +520,7 @@ class GenerateFrightBill extends StatelessWidget {
index, stoppage.materialCode ?? ""),
editableCell(
index,
DateFormat('yyyy-MM-dd').format(
DateFormat('dd/MM/yyyy').format(
stoppage.grnDate ??
DateTime.now())),
editableCell(
@ -541,7 +530,7 @@ class GenerateFrightBill extends StatelessWidget {
editableCell(index, stoppage.lrNo ?? ""),
editableCell(
index,
DateFormat('yyyy-MM-dd').format(
DateFormat('dd/MM/yyyy').format(
stoppage.lrDate ??
DateTime.now())),
editableCell(index,
@ -577,13 +566,15 @@ class GenerateFrightBill extends StatelessWidget {
],
);
}
Future<void> _showDateRangePicker(BuildContext context) async {
showModalBottomSheet(
context: context,
builder: (BuildContext context) {
return Container(
return SingleChildScrollView(
child: Container(
padding: EdgeInsets.all(16),
height: 400, // Adjust the height as needed
height: 500, // Adjust the height as needed
child: Column(
children: [
// Display two date pickers horizontally
@ -596,7 +587,12 @@ class GenerateFrightBill extends StatelessWidget {
selectionMode: DateRangePickerSelectionMode.range,
onSelectionChanged: (args) {
// Handle the date selection from the first calendar
print(args.value);
if (args.value is PickerDateRange) {
setState(() {
_startDate = args.value.startDate;
_endDate = args.value.endDate;
});
}
},
),
),
@ -607,8 +603,13 @@ class GenerateFrightBill extends StatelessWidget {
view: DateRangePickerView.month,
selectionMode: DateRangePickerSelectionMode.range,
onSelectionChanged: (args) {
// Handle the date selection from the second calendar
print(args.value);
// Handle the date selection from the first calendar
if (args.value is PickerDateRange) {
setState(() {
_startDate = args.value.startDate;
_endDate = args.value.endDate;
});
}
},
),
),
@ -617,6 +618,11 @@ class GenerateFrightBill extends StatelessWidget {
SizedBox(height: 16),
ElevatedButton(
onPressed: () {
if (_startDate != null && _endDate != null) {
String formattedRange =
"${_formatDate(_startDate!)} - ${_formatDate(_endDate!)}";
_dateController.text = formattedRange;
}
// You can extract the selected date range here
// Close the bottom sheet after selection
Navigator.pop(context);
@ -625,10 +631,16 @@ class GenerateFrightBill extends StatelessWidget {
),
],
),
),
);
},
);
}
String _formatDate(DateTime date) {
// Format the date as per your requirement
return "${date.month.toString().padLeft(2, '0')}/${date.day.toString().padLeft(2, '0')}/${date.year}";
}
}

View File

@ -1,14 +1,18 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
import '../../../../../../components/common/common_btn.dart';
import '../../../../../../components/common/data_cell.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 '../ctrl/invoice_management_controller.dart';
import 'package:file_picker/file_picker.dart';
import 'package:path_provider/path_provider.dart';
class InvoiceManagement extends StatefulWidget {
const InvoiceManagement({super.key});
@ -18,6 +22,8 @@ class InvoiceManagement extends StatefulWidget {
}
class _TransportViewState extends State<InvoiceManagement> {
final ScrollController horizontalScrollController = ScrollController();
final ScrollController verticalScrollController = ScrollController();
final ctrl = Get.put(InvoiceManagementController());
@override
@ -50,8 +56,8 @@ class _TransportViewState extends State<InvoiceManagement> {
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color:
ctrl.selectedState.value == index
color: ctrl.selectedState.value ==
index
? Colors.white
: AppColors.primaryClr,
width: 3))),
@ -234,7 +240,7 @@ class _TransportViewState extends State<InvoiceManagement> {
// newValue; // Update the selected value
// }
// },
// items: ctrl.freightBillNoItems
// items: ctrl.getInvoiceNoItems
// .map((String value) {
// return DropdownMenuItem<String>(
// value: value.toString(),
@ -289,7 +295,6 @@ class _TransportViewState extends State<InvoiceManagement> {
SizedBox(width: 16),
CommonBtn(
text: AppStrings.submit,
clickAction: () {},
),
],
@ -317,147 +322,204 @@ class _TransportViewState extends State<InvoiceManagement> {
}
_tableView() {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child:
Table(border: TableBorder.all(color: AppColors.clrGrey), children: [
TableRow(
decoration: BoxDecoration(color: AppColors.secondaryClr),
return Column(
children: [
_cellText(
text: "SR. No.",
clr: Colors.black,
fontWeight: FontWeight.bold),
_cellText(
text: "Reference No.",
clr: Colors.black,
fontWeight: FontWeight.bold),
_cellText(
text: "Freight Bill No.",
clr: Colors.black,
fontWeight: FontWeight.bold),
_cellText(
text: "Freight Bill Date",
clr: Colors.black,
fontWeight: FontWeight.bold),
_cellText(
text: "Invoice No.",
clr: Colors.black,
fontWeight: FontWeight.bold),
_cellText(
text: "Invoice Date",
clr: Colors.black,
fontWeight: FontWeight.bold),
_cellText(
text: "Invoice Amount",
clr: Colors.black,
fontWeight: FontWeight.bold),
_cellText(
text: "CCN Amount",
clr: Colors.black,
fontWeight: FontWeight.bold),
_cellText(
text: "View CCN",
clr: Colors.black,
fontWeight: FontWeight.bold),
_cellText(
text: "Product Type",
clr: Colors.black,
fontWeight: FontWeight.bold),
_cellText(
text: "View Invoice",
clr: Colors.black,
fontWeight: FontWeight.bold),
// _cellText(
// text: "Add Signature",
// clr: Colors.black,
// fontWeight: FontWeight.bold),
]),
TableRow(children: [
_cellText(
text: "01",
Scrollbar(
thumbVisibility: true,
controller: verticalScrollController,
child: SingleChildScrollView(
controller: verticalScrollController,
child: Scrollbar(
thumbVisibility: true,
controller: horizontalScrollController,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
controller: horizontalScrollController,
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: Colors.grey.shade400,
width: 1.0,
),
_cellText(text: "7894651231"),
_cellText(text: "9841651635426"),
_cellText(text: "1 August 2024"),
_cellText(text: "41918542634"),
_cellText(text: "5 Aug 2024"),
_cellText(text: "XXXXXXXX"),
_cellText(text: "XXXXXXXX"),
_cellText(text: "78646646", clr: AppColors.primaryClr),
_cellText(text: "Z-FUL"),
_cellText(text: "View Invoice", clr: AppColors.primaryClr),
]),
TableRow(children: [
_cellText(text: "02"),
_cellText(text: "7894651231"),
_cellText(text: "9841651635426"),
_cellText(text: "1 August 2024"),
_cellText(text: "41918542634"),
_cellText(text: "5 Aug 2024"),
_cellText(text: "XXXXXXXX"),
_cellText(text: "-"),
_cellText(text: "78646646", clr: AppColors.primaryClr),
_cellText(text: "Z-FUL"),
_cellText(text: "View Invoice", clr: AppColors.primaryClr),
]),
TableRow(children: [
_cellText(text: "03"),
_cellText(text: "7894651231"),
_cellText(text: "9841651635426"),
_cellText(text: "1 August 2024"),
_cellText(text: "41918542634"),
_cellText(text: "5 Aug 2024"),
_cellText(text: "XXXXXXXX"),
_cellText(text: "-"),
_cellText(text: "-", clr: AppColors.primaryClr),
_cellText(text: "Z-FUL"),
_cellText(text: "View Invoice", clr: AppColors.primaryClr),
]),
TableRow(children: [
_cellText(text: "04"),
_cellText(text: "7894651231"),
_cellText(text: "9841651635426"),
_cellText(text: "1 August 2024"),
_cellText(text: "41918542634"),
_cellText(text: "5 Aug 2024"),
_cellText(text: "XXXXXXXX"),
_cellText(text: "XXXXXXXX"),
_cellText(text: "78646646", clr: AppColors.primaryClr),
_cellText(text: "Z-FUL"),
_cellText(text: "View Invoice", clr: AppColors.primaryClr),
]),
TableRow(children: [
_cellText(text: "05"),
_cellText(text: "7894651231"),
_cellText(text: "9841651635426"),
_cellText(text: "1 August 2024"),
_cellText(text: "41918542634"),
_cellText(text: "5 Aug 2024"),
_cellText(text: "XXXXXXXX"),
_cellText(text: "-"),
_cellText(text: "-", clr: AppColors.primaryClr),
_cellText(text: "Z-FUL"),
_cellText(text: "View Invoice", clr: AppColors.primaryClr),
]),
]),
),
child: DataTable(
dataRowHeight: 40,
headingRowHeight: 40,
headingRowColor: WidgetStateProperty.all(AppColors.clrF2),
border: TableBorder(
horizontalInside: BorderSide(color: AppColors.clrGrey),
verticalInside: BorderSide(color: AppColors.clrGrey),
bottom: BorderSide(color: AppColors.clrGrey),
left: BorderSide(color: AppColors.clrGrey),
right: BorderSide(color: AppColors.clrGrey),
top: BorderSide(color: AppColors.clrGrey),
),
columns: [
dataColumn("Refrence No."),
//dataColumn(AppStrings.productName, onSort: (_, __) => ctrl.changeSort(AppStrings.productName.toLowerCase())),
dataColumn("Freight Bill No."),
//dataColumn(AppStrings.getInvoiceDate),
dataColumn("Freight Bill date"),
dataColumn("Invoice No."),
dataColumn("Invoice Date"),
dataColumn("Invoice Amount"),
dataColumn("CCN Amount"),
dataColumn("View CCN"),
dataColumn("Product Type"),
dataColumn("View Invoice"),
dataColumn("Add Signature"),
],
rows: List<DataRow>.generate(ctrl.getInvoiceData.length,
(index) {
final getInvoice = ctrl.getInvoiceData[index];
return DataRow(
cells: [
editableCell(index, "${getInvoice.invoiceId}"),
editableCell(index, getInvoice.freightbillCode),
editableCell(
index,
DateFormat("dd MMMM yyyy").format(
DateTime.parse('${getInvoice.createdOn}'))),
editableCell(
index, "${getInvoice.sapReferenceno ?? "-"}"),
editableCell(
index,
DateFormat("d MMMM yyyy").format(DateTime.parse(
'${getInvoice.shipmentCostDate}'))),
editableCell(
index, "${getInvoice.shipmentCost ?? "-"}"),
editableCell(index, "-"),
editableCell(index, "-"),
editableCell(index, "-", isLink: true),
editableCell(index, "-"),
editableCell(index, "-", isLink: true),
DataCell(
Row(
mainAxisSize: MainAxisSize.min,
children: [
Container(
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
border: Border.all(color: Colors.blue),
borderRadius: BorderRadius.circular(4),
),
child: InkWell(
onTap: () { },
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.download,
size: 16, color: Colors.blue),
SizedBox(width: 4),
Text('Download',
style: TextStyle(
color: Colors.blue,
fontSize: 12)),
],
),
),
),
SizedBox(width: 8),
Container(
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
border: Border.all(color: Colors.blue),
borderRadius: BorderRadius.circular(4),
),
child: InkWell(
onTap: () => handleFileUpload(index),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.upload,
size: 16, color: Colors.blue),
SizedBox(width: 4),
Text('Upload',
style: TextStyle(
color: Colors.blue,
fontSize: 12)),
],
),
),
),
//###################### This Function is used to close or cut uploaded File in Local #######################
// if (uploadedFiles.containsKey(index))
// IconButton(
// icon: Icon(Icons.close, size: 16, color: Colors.red),
// onPressed: () {
// setState(() {
// uploadedFiles.remove(index);
// });
// },
// ),
//###########################################################################################################
],
),
),
],
);
}),
),
),
),
),
),
),
// CustomPagination(
// currentPage: controller.currentPage.value,
// totalPages: controller.totalPages.value,
// onPageChanged: (int page) {
// controller.onPageChanged(page);
// },
// ),
],
);
}
_cellText({String? text, Color? clr, FontWeight? fontWeight}) {
return Center(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 4),
child: Text(
text ?? '',
textAlign: TextAlign.center,
style: TextStyle(
color: clr ?? AppColors.darkGrey,
fontSize: 12,
fontWeight: fontWeight ?? FontWeight.normal),
),
Future<void> handleFileUpload(int index) async {
try {
FilePickerResult? result = await FilePicker.platform.pickFiles(
type: FileType.custom,
allowedExtensions: ['pdf', 'doc', 'docx', 'xlsx', 'xls'],
allowMultiple: false,
);
if (result != null) {
PlatformFile file = result.files.first;
// Validate file size (optional)
if (file.size > 10 * 1024 * 1024) { // 10MB limit
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('File size must be less than 10MB'),
backgroundColor: Colors.red,
),
);
return;
}
final appDir = await getApplicationDocumentsDirectory();
final String filePath = '${appDir.path}/${file.name}';
File(file.path!).copy(filePath);
setState(() {
//uploadedFiles[index] = file.name;
});
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('File uploaded: ${file.name}'),
backgroundColor: Colors.green,
),
);
}
} catch (e) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('Error uploading file: ${e.toString()}'),
backgroundColor: Colors.red,
),
);
}
}
_commonText(String title) {

View File

@ -4,6 +4,7 @@ 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:sizer/sizer.dart';
import 'package:syncfusion_flutter_datepicker/datepicker.dart';
import 'package:vph_web_date_picker/vph_web_date_picker.dart';
import '../../../../../../../components/common/data_cell.dart';
import '../../../../../../../components/styles/app_colors.dart';
@ -15,12 +16,22 @@ import '../../../../widgets/text_view.dart';
import '../../widgets/common_card.dart';
import '../../widgets/freightbill_dialog.dart';
class PendingGeneration extends StatelessWidget {
class PendingGeneration extends StatefulWidget {
PendingGeneration({super.key});
@override
State<PendingGeneration> createState() => _PendingGenerationState();
}
class _PendingGenerationState extends State<PendingGeneration> {
final ScrollController horizontalScrollController = ScrollController();
final ScrollController verticalScrollController = ScrollController();
final controller = Get.put(TransportController());
final TextEditingController _dateController = TextEditingController();
DateTime? _startDate;
DateTime? _endDate;
@override
Widget build(BuildContext context) {
@ -47,7 +58,6 @@ class PendingGeneration extends StatelessWidget {
CustomDropdown(
backClr: AppColors.clrD9,
borderClr: AppColors.clrGrey,
items: controller.plant,
itemLabel: (item) =>
"${item.plantCode}-${item.plantDesc}",
@ -100,12 +110,13 @@ class PendingGeneration extends StatelessWidget {
},
hintText: "Select Product Name",
),
Obx(() => controller
.showProductErrorPending.value
Obx(() =>
controller.showProductErrorPending.value
? Text(
'Required',
style: TextStyle(
color: Colors.red, fontSize: 12),
color: Colors.red,
fontSize: 12),
)
: Text('')),
],
@ -135,12 +146,13 @@ class PendingGeneration extends StatelessWidget {
},
hintText: "Select Transaction Type",
),
Obx(() => controller
.showTransactionErrorPending.value
Obx(() =>
controller.showTransactionErrorPending.value
? Text(
'Required',
style: TextStyle(
color: Colors.red, fontSize: 12),
color: Colors.red,
fontSize: 12),
)
: Text('')),
],
@ -159,45 +171,14 @@ class PendingGeneration extends StatelessWidget {
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,
controller: _dateController,
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;
}
await _showDateRangePicker(context);
},
decoration: InputDecoration(
fillColor: AppColors.clrD9,
@ -296,7 +277,8 @@ class PendingGeneration extends StatelessWidget {
CommonBtn(
bkClr: Colors.white,
text: AppStrings.cancel,
clickAction: () => controller.clearFiltersPendingGeneration(),
clickAction: () => controller
.clearFiltersPendingGeneration(),
),
SizedBox(width: 16),
CommonButton(
@ -318,7 +300,6 @@ class PendingGeneration extends StatelessWidget {
// }
controller
.handleFilterSubmitPendingGeneration(),
),
],
),
@ -338,7 +319,6 @@ class PendingGeneration extends StatelessWidget {
return SizedBox(
height: MediaQuery.sizeOf(context).height,
width: MediaQuery.sizeOf(context).width,
child: Center(
child: CircularProgressIndicator(
color: AppColors.primaryClr,
@ -350,7 +330,6 @@ class PendingGeneration extends StatelessWidget {
return SizedBox(
height: MediaQuery.sizeOf(context).height,
width: MediaQuery.sizeOf(context).width,
child: Center(child: Text(controller.errorMessage.value)));
}
@ -358,13 +337,16 @@ class PendingGeneration extends StatelessWidget {
return SizedBox(
height: MediaQuery.sizeOf(context).height,
width: MediaQuery.sizeOf(context).width,
child: Center(child: Text('No data available.',)));
child: Center(
child: Text(
'No data available.',
)));
}
return
Column(
return Column(
children: [
SizedBox(height: 20,),
SizedBox(
height: 20,
),
Scrollbar(
thumbVisibility: true,
controller: controller.verticalScrollController,
@ -415,6 +397,7 @@ class PendingGeneration extends StatelessWidget {
),
),
// dataColumn(AppStrings.srNo),
dataColumn(AppStrings.viewGrnDetails),
dataColumn(AppStrings.plantName),
dataColumn(AppStrings.productName),
dataColumn(AppStrings.date),
@ -433,7 +416,8 @@ class PendingGeneration extends StatelessWidget {
rows: List<DataRow>.generate(
controller.grnPendingData.length, (index) {
final stoppage = controller.grnPendingData[index];
print(
'stoppage.remark?.toString()${stoppage.remark?.toString()}');
return DataRow(
selected: stoppage.isSelected,
cells: [
@ -454,8 +438,10 @@ class PendingGeneration extends StatelessWidget {
),
),
// editableCell(index, "0${index + 1}"),
editableCell(index, stoppage.grnNo ?? ""),
editableCell(index, stoppage.plantCode ?? ""),
editableCell(index, stoppage.plantCode ?? ""),
editableCell(
index, stoppage.materialCode ?? ""),
editableCell(
index,
@ -482,7 +468,9 @@ class PendingGeneration extends StatelessWidget {
editableCell(index,
stoppage.shipmentCost?.toString() ?? ""),
editableCell(
index, stoppage.remark?.toString() ?? ""),
index,
stoppage.remark?.toString() ??
"Shipment Quantity Mismatch"),
],
);
}),
@ -498,4 +486,79 @@ class PendingGeneration extends StatelessWidget {
],
);
}
Future<void> _showDateRangePicker(BuildContext context) async {
showModalBottomSheet(
context: context,
builder: (BuildContext context) {
return SingleChildScrollView(
child: Container(
padding: EdgeInsets.all(16),
height: 500, // Adjust the height as needed
child: Column(
children: [
// Display two date pickers horizontally
Row(
children: [
// First Date Picker
Expanded(
child: SfDateRangePicker(
view: DateRangePickerView.month,
selectionMode: DateRangePickerSelectionMode.range,
onSelectionChanged: (args) {
// Handle the date selection from the first calendar
if (args.value is PickerDateRange) {
setState(() {
_startDate = args.value.startDate;
_endDate = args.value.endDate;
});
}
},
),
),
SizedBox(width: 16),
// Second Date Picker
Expanded(
child: SfDateRangePicker(
view: DateRangePickerView.month,
selectionMode: DateRangePickerSelectionMode.range,
onSelectionChanged: (args) {
// Handle the date selection from the first calendar
if (args.value is PickerDateRange) {
setState(() {
_startDate = args.value.startDate;
_endDate = args.value.endDate;
});
}
},
),
),
],
),
SizedBox(height: 16),
ElevatedButton(
onPressed: () {
if (_startDate != null && _endDate != null) {
String formattedRange =
"${_formatDate(_startDate!)} - ${_formatDate(_endDate!)}";
_dateController.text = formattedRange;
}
// You can extract the selected date range here
// Close the bottom sheet after selection
Navigator.pop(context);
},
child: Text('Done'),
),
],
),
),
);
},
);
}
String _formatDate(DateTime date) {
// Format the date as per your requirement
return "${date.month.toString().padLeft(2, '0')}/${date.day.toString().padLeft(2, '0')}/${date.year}";
}
}

View File

@ -28,7 +28,8 @@ class ViewFreightBill extends StatelessWidget {
Widget build(BuildContext context) {
return Column(
children: [
Container(
Obx(() => controller.isFilterVisibleViewFreight.value
? Container(
padding: EdgeInsets.all(16),
color: AppColors.clrF2,
child: Column(
@ -52,25 +53,24 @@ class ViewFreightBill extends StatelessWidget {
"${item.plantCode}-${item.plantDesc}",
onSelected: (selected) {
if (selected != null) {
controller.selectPlant.value =
controller.selectPlantViewFreight.value =
selected.plantCode ?? "";
controller.showPlantErrorFreight.value = false;
controller.showPlantErrorViewFreight.value =
false;
print(
"selectPlant${controller.selectPlant.value}");
}
},
hintText: "Select Plant",
),
Obx(() => controller.showPlantErrorFreight.value
? Padding(
padding: const EdgeInsets.only(top: 4),
child: Text(
'Please select a plant',
Obx(() =>
controller.showPlantErrorViewFreight.value
? Text(
'Required',
style: TextStyle(
color: Colors.red, fontSize: 12),
),
)
: SizedBox.shrink()),
: Text('')),
],
),
),
@ -91,13 +91,24 @@ class ViewFreightBill extends StatelessWidget {
"${item.materialCode}-${item.materialDescription}",
onSelected: (selected) {
if (selected != null) {
controller.selectProduct.value = selected;
controller.selectProductViewFreight.value =
selected.materialCode;
controller.showProductErrorViewFreight
.value = false;
print(
"selectPlant${controller.selectProduct.value}");
}
},
hintText: "Select Product Name",
),
Obx(() =>
controller.showProductErrorViewFreight.value
? Text(
'Required',
style: TextStyle(
color: Colors.red, fontSize: 12),
)
: Text('')),
],
),
),
@ -107,7 +118,8 @@ class ViewFreightBill extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextView(text: "Transaction Type", isRequired: true),
TextView(
text: "Transaction Type", isRequired: true),
SizedBox(height: 8),
CustomDropdown<String>(
backClr: AppColors.clrD9,
@ -116,32 +128,32 @@ class ViewFreightBill extends StatelessWidget {
itemLabel: (item) => item,
onSelected: (selected) {
if (selected != null) {
controller.selectTransactionType.value = selected;
controller.showTransactionErrorFreight.value =
false;
controller.selectTransactionTypeViewFreight
.value = selected;
controller.showTransactionErrorViewFreight
.value = false;
print(
"selectTransactionType${controller.selectTransactionType.value}");
}
},
hintText: "Select Transaction Type",
),
Obx(() => controller.showTransactionErrorFreight.value
? Padding(
padding: const EdgeInsets.only(top: 4),
child: Text(
'Please select Transaction Type',
Obx(() => controller
.showTransactionErrorViewFreight.value
? Text(
'Required',
style: TextStyle(
color: Colors.red, fontSize: 12),
),
)
: SizedBox.shrink()),
: Text('')),
],
),
),
],
),
Padding(
padding: const EdgeInsets.only(top: 16.0, left: 0, right: 8),
padding:
const EdgeInsets.only(top: 16.0, left: 0, right: 8),
child: Row(
children: [
Expanded(
@ -149,7 +161,7 @@ class ViewFreightBill extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextView(text: "Freight Bill Date Range"),
TextView(text: "MRN Date Range"),
Container(
margin: EdgeInsets.only(top: 8),
height: 35,
@ -157,19 +169,22 @@ class ViewFreightBill extends StatelessWidget {
key: controller.fromTextFieldKey,
controller: controller.fromController,
onTap: () async {
final pickedDate = await showWebDatePicker(
final pickedDate =
await showWebDatePicker(
width: 20.w,
context: controller
.fromTextFieldKey.currentContext!,
initialDate: controller.fromSelectedDate,
initialDate:
controller.fromSelectedDate,
firstDate: DateTime(2000),
lastDate: DateTime.now(),
);
if (pickedDate != null) {
controller.fromSelectedDate = pickedDate;
String formattedDate =
controller.getFormattedDate(pickedDate);
controller.fromSelectedDate =
pickedDate;
String formattedDate = controller
.getFormattedDate(pickedDate);
controller.fromController.text =
formattedDate;
controller.dateCheck.value = true;
@ -183,37 +198,45 @@ class ViewFreightBill extends StatelessWidget {
fontSize: 12,
overflow: TextOverflow.ellipsis),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(2.0),
borderRadius:
BorderRadius.circular(2.0),
borderSide:
BorderSide(color: AppColors.black),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(2.0),
borderSide:
BorderSide(color: AppColors.clrGrey),
borderRadius:
BorderRadius.circular(2.0),
borderSide: BorderSide(
color: AppColors.clrGrey),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(2.0),
borderSide:
BorderSide(color: AppColors.clrGrey),
borderRadius:
BorderRadius.circular(2.0),
borderSide: BorderSide(
color: AppColors.clrGrey),
),
disabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(2.0),
borderSide:
BorderSide(color: AppColors.clrGrey),
borderRadius:
BorderRadius.circular(2.0),
borderSide: BorderSide(
color: AppColors.clrGrey),
),
suffixIcon: controller.dateCheck.value
? InkWell(
onTap: () {
controller.dateCheck.value = false;
controller.fromController.clear();
controller.dateCheck.value =
false;
controller.fromController
.clear();
controller.fromSelectedDate =
DateTime.now();
},
child: Icon(Icons.close, size: 1.2.w),
child: Icon(Icons.close,
size: 1.2.w),
)
: null,
contentPadding: const EdgeInsets.symmetric(
contentPadding:
const EdgeInsets.symmetric(
horizontal: 12.0, vertical: 0.0),
),
),
@ -236,7 +259,8 @@ class ViewFreightBill extends StatelessWidget {
itemLabel: (item) => item,
onSelected: (selected) {
if (selected != null) {
controller.selectLocation.value = selected;
controller.selectLocation.value =
selected;
}
},
hintText: "Select From Location",
@ -262,7 +286,8 @@ class ViewFreightBill extends StatelessWidget {
CommonBtn(
bkClr: Colors.white,
text: AppStrings.cancel,
clickAction: () {},
clickAction: () =>
controller.clearFiltersViewFreight(),
),
SizedBox(width: 16),
CommonButton(
@ -271,16 +296,21 @@ class ViewFreightBill extends StatelessWidget {
width: 100,
text: AppStrings.submit,
clickAction: () {
if (controller.showPlantErrorFreight.value ||
// if (controller.showPlantErrorFreight
// .value ||
// controller.showProductErrorFreight
// .value ||
// controller.showTransactionErrorFreight
// .value
// ) {
// print(
// 'controller.showProductError.value ${controller
// .showProductError.value}');
// } else {
// controller.postData();
// }
controller
.showProductErrorFreight.value ||
controller
.showTransactionErrorFreight.value) {
print(
'controller.showProductError.value ${controller.showProductError.value}');
} else {
controller.postData();
}
.handleFilterSubmitViewFreightBill();
},
),
],
@ -293,18 +323,79 @@ class ViewFreightBill extends StatelessWidget {
),
],
),
),
SizedBox(
height: 20,
),
)
: SizedBox.shrink()),
// 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 SizedBox(
height: MediaQuery.sizeOf(context).height,
width: MediaQuery.sizeOf(context).width,
child: Center(
child: CircularProgressIndicator(
color: AppColors.primaryClr,
),
),
);
} else {
}
if (controller.errorMessage.isNotEmpty) {
return SizedBox(
height: MediaQuery.sizeOf(context).height,
width: MediaQuery.sizeOf(context).width,
child: Center(child: Text(controller.errorMessage.value)));
}
if (controller.freightBillData.isEmpty) {
return SizedBox(
height: MediaQuery.sizeOf(context).height,
width: MediaQuery.sizeOf(context).width,
child: Center(
child: Text(
'No data available.',
)));
}
return Column(
children: [
Scrollbar(
@ -326,8 +417,8 @@ class ViewFreightBill extends StatelessWidget {
),
),
child: DataTable(
dataRowHeight: 28,
headingRowHeight: 38,
dataRowHeight: 40,
headingRowHeight: 40,
headingRowColor:
WidgetStateProperty.all(AppColors.clrF2),
border: TableBorder(
@ -382,15 +473,14 @@ class ViewFreightBill extends StatelessWidget {
dataColumn("${AppStrings.utrNo} 5"),
dataColumn(AppStrings.utrDate),
dataColumn("${AppStrings.amount} 5"),
],
] ,
rows: List<DataRow>.generate(
controller.freightBillData.length, (index) {
final freightBill =
controller.freightBillData[index];
return DataRow(
cells: [
editableCell(
index, "${freightBill.plantCode}"),
editableCell(index, "${freightBill.plantCode}"),
editableCell(index, "${freightBill.status}"),
editableCell(
index,
@ -402,16 +492,13 @@ class ViewFreightBill extends StatelessWidget {
},
),
editableCell(
index,
DateFormat("d MMMM yyyy").format(
DateTime.parse(
'${freightBill.createdOn ?? "-"}'))),
index, "${freightBill.createdOn ?? "-"}"),
editableCell(index,
"${freightBill.trasnporterInvoiceNo ?? "-"}"),
editableCell(index,
"${freightBill.trasnporterInvoiceNoDate ?? "-"}"),
editableCell(index,
"${freightBill.billingQty ?? "-"}"),
editableCell(
index, "${freightBill.billingQty ?? "-"}"),
editableCell(
index, "${freightBill.uom ?? "-"}"),
editableCell(index,
@ -481,17 +568,203 @@ class ViewFreightBill extends StatelessWidget {
),
),
),
CustomPagination(
currentPage: controller.currentPage.value,
totalPages: controller.totalPages.value,
onPageChanged: (int page) {
controller.onPageChanged(page);
},
),
// CustomPagination(
// currentPage: controller.currentPage.value,
// totalPages: controller.totalPages.value,
// onPageChanged: (int page) {
// controller.onPageChanged(page);
// },
// ),
],
);
}
}),
// Obx(() {
// if (controller.freightViewLoader.value) {
// return Center(
// child: CircularProgressIndicator(
// color: AppColors.primaryClr,
// ),
// );
// } else {
// return Column(
// children: [
// Scrollbar(
// thumbVisibility: true,
// controller: verticalScrollController,
// child: SingleChildScrollView(
// controller: verticalScrollController,
// child: Scrollbar(
// thumbVisibility: true,
// controller: horizontalScrollController,
// child: SingleChildScrollView(
// scrollDirection: Axis.horizontal,
// controller: horizontalScrollController,
// child: Container(
// decoration: BoxDecoration(
// border: Border.all(
// color: Colors.grey.shade400,
// width: 1.0,
// ),
// ),
// child: DataTable(
// dataRowHeight: 28,
// headingRowHeight: 38,
// headingRowColor:
// WidgetStateProperty.all(AppColors.clrF2),
// border: TableBorder(
// horizontalInside:
// BorderSide(color: AppColors.clrGrey),
// verticalInside:
// BorderSide(color: AppColors.clrGrey),
// bottom: BorderSide(color: AppColors.clrGrey),
// left: BorderSide(color: AppColors.clrGrey),
// right: BorderSide(color: AppColors.clrGrey),
// top: BorderSide(color: AppColors.clrGrey),
// ),
// columns: [
//
// dataColumn(AppStrings.plant),
// dataColumn(
// AppStrings.productName,
// onSort: (_, __) =>
// controller.changeSort(
// AppStrings.productName.toLowerCase()),
// ),
// dataColumn(AppStrings.freightBillNo),
// dataColumn(AppStrings.freightBillDate),
// dataColumn(AppStrings.freightInvoice),
// dataColumn(AppStrings.freightInvoiceDate),
// dataColumn(AppStrings.billingQty),
// dataColumn(AppStrings.uom),
// dataColumn(AppStrings.freightAmount),
// dataColumn(AppStrings.cGST),
// dataColumn(AppStrings.sGST),
// dataColumn(AppStrings.iGST),
// dataColumn(AppStrings.totalGst),
// dataColumn(AppStrings.totalInvoiceAmt),
// dataColumn(AppStrings.cCN),
// dataColumn(AppStrings.cCNDate),
// dataColumn(AppStrings.miroStatus),
// dataColumn(AppStrings.gstHold),
// dataColumn(AppStrings.gstRelease),
// dataColumn(AppStrings.utrNo),
// dataColumn(AppStrings.utrDate),
// dataColumn(AppStrings.amount),
// dataColumn("${AppStrings.utrNo} 1"),
// dataColumn(AppStrings.utrDate),
// dataColumn("${AppStrings.amount} 1"),
// dataColumn("${AppStrings.utrNo} 2"),
// dataColumn(AppStrings.utrDate),
// dataColumn("${AppStrings.amount} 2"),
// dataColumn("${AppStrings.utrNo} 3"),
// dataColumn(AppStrings.utrDate),
// dataColumn("${AppStrings.amount} 3"),
// dataColumn("${AppStrings.utrNo} 4"),
// dataColumn(AppStrings.utrDate),
// dataColumn("${AppStrings.amount} 4"),
// dataColumn("${AppStrings.utrNo} 5"),
// dataColumn(AppStrings.utrDate),
// dataColumn("${AppStrings.amount} 5"),
// ],
// rows: List<DataRow>.generate(
// controller.freightBillData.length, (index) {
// final freightBill =
// controller.freightBillData[index];
// return DataRow(
// cells: [
//
// editableCell(
// index, "${freightBill.plantCode}"),
// editableCell(index, "${freightBill.status}"),
// editableCell(
// index,
// "${freightBill.freightbillId}",
// isLink: true,
// onTap: () {
// showFreightBillDetailsDialog(
// context, freightBill);
// },
// ),
// editableCell(
// index, "${freightBill.utr1Date}"),
// editableCell(index,
// "${freightBill.trasnporterInvoiceNo}"),
// editableCell(index,
// "${freightBill
// .trasnporterInvoiceNoDate}"),
// editableCell(
// index, "${freightBill.billingQty}"),
// editableCell(index, "${freightBill.uom}"),
// editableCell(
// index, "${freightBill.freightAmount}"),
// editableCell(index, "${freightBill.cgst}"),
// editableCell(index, "${freightBill.sgst}"),
// editableCell(index, "${freightBill.igst}"),
// editableCell(
// index, "${freightBill.totalGst}"),
// editableCell(
// index, "${freightBill.totalGst}"),
// editableCell(
// index, "${freightBill.freightAmount}"),
// editableCell(index,
// "${freightBill
// .trasnporterInvoiceNoDate}"),
// editableCell(index, "${freightBill.status}"),
// editableCell(
// index, "${freightBill.totalGst}"),
// editableCell(index,
// "${freightBill
// .trasnporterInvoiceNoDate}"),
// editableCell(index, "${freightBill.utr5No}"),
// editableCell(
// index, "${freightBill.utr1Date}"),
// editableCell(
// index, "${freightBill.freightAmount}"),
// editableCell(index, "${freightBill.utr1No}"),
// editableCell(
// index, "${freightBill.utr1Date}"),
// editableCell(index,
// "${freightBill.utr1PaymentAmount}"),
// editableCell(index, "${freightBill.utr2No}"),
// editableCell(
// index, "${freightBill.utr2Date}"),
// editableCell(index,
// "${freightBill.utr2PaymentAmount}"),
// editableCell(index, "${freightBill.utr3No}"),
// editableCell(
// index, "${freightBill.utr3Date}"),
// editableCell(index,
// "${freightBill.utr3PaymentAmount}"),
// editableCell(index, "${freightBill.utr4No}"),
// editableCell(
// index, "${freightBill.utr4Date}"),
// editableCell(index,
// "${freightBill.utr4PaymentAmount}"),
// editableCell(index, "${freightBill.utr5No}"),
// editableCell(
// index, "${freightBill.utr5Date}"),
// editableCell(index,
// "${freightBill.utr5PaymentAmount}"),
// ],
// );
// }),
// ),
// ),
// ),
// ),
// ),
// ),
// // CustomPagination(
// // currentPage: controller.currentPage.value,
// // totalPages: controller.totalPages.value,
// // onPageChanged: (int page) {
// // controller.onPageChanged(page);
// // },
// // ),
// ],
// );
// }
// }),
],
);
}
@ -554,7 +827,6 @@ class ViewFreightBill extends StatelessWidget {
top: BorderSide(color: AppColors.clrGrey),
),
columns: [
dataColumn(AppStrings.srNo),
dataColumn(AppStrings.mrnNo),
dataColumn(
AppStrings.plantName,
@ -580,7 +852,6 @@ class ViewFreightBill extends StatelessWidget {
controller.freightBillData[index];
return DataRow(
cells: [
editableCell(index, "0${index + 1}"),
editableCell(index, "${freightBill.plantCode}"),
editableCell(
index, "${freightBill.materialCode}"),

View File

@ -29,8 +29,7 @@ class _TransportViewState extends State<TransportView> {
@override
Widget build(BuildContext context) {
return ListView(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
@ -170,6 +169,10 @@ class _TransportViewState extends State<TransportView> {
if(ctrl.selectedUser.value == 0){
ctrl.toggleFilter();
}
else if(ctrl.selectedUser.value == 1){
ctrl.toggleViewFreight();
}
else if(ctrl.selectedUser.value == 2){
ctrl.togglePending();
}
@ -187,6 +190,7 @@ class _TransportViewState extends State<TransportView> {
],
),
),
Obx(() {
switch (ctrl.selectedUser.value) {
case 0:

View File

@ -1,3 +1,5 @@
import 'dart:convert';
import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:shayog/components/styles/app_images.dart';
@ -16,18 +18,31 @@ class TransportController extends GetxController {
final ScrollController verticalScrollController = ScrollController();
var selectedIndex = 0.obs;
var selectedUser = 0.obs;
// for generate freight
RxString selectPlant = ''.obs;
var selectProduct = ''.obs;
var selectLocation = ''.obs;
var selectTransactionType = ''.obs;
// for generate freight bill
RxString selectPlantFreight = ''.obs;
var selectProductFreight = ''.obs;
var selectLocationFreight = ''.obs;
var selectTransactionTypeFreight = ''.obs;
// for pending bill
RxString selectPlantPending = ''.obs;
var selectProductPending = ''.obs;
var selectLocationPending = ''.obs;
var selectTransactionTypePending = ''.obs;
// for view FreightBill
RxString selectPlantViewFreight = ''.obs;
var selectProductViewFreight = ''.obs;
var selectLocationViewFreight = ''.obs;
var selectTransactionTypeViewFreight = ''.obs;
var selectedItem = false.obs;
var grnDetails = <Content>[].obs;
var product = <Prodect>[].obs;
@ -44,6 +59,7 @@ class TransportController extends GetxController {
}
RxBool isFilterVisibleGenerateFreight = false.obs;
RxBool isFilterVisibleViewFreight = false.obs;
RxBool isFilterVisiblePendingGeneration = false.obs;
final int initialRecordCount = 20;
@ -53,19 +69,14 @@ class TransportController extends GetxController {
RxBool showTransactionError = false.obs;
void toggleFilter() {
// if (selectedUser.value == 0) {
isFilterVisibleGenerateFreight.value =
!isFilterVisibleGenerateFreight.value;
if (!isFilterVisibleGenerateFreight.value) {
clearFiltersGenerateFreightBill();
}
// }
// if (selectedUser.value == 2) {
// }
}
void togglePending(){
void togglePending() {
isFilterVisiblePendingGeneration.value =
!isFilterVisiblePendingGeneration.value;
if (!isFilterVisiblePendingGeneration.value) {
@ -73,6 +84,13 @@ class TransportController extends GetxController {
}
}
void toggleViewFreight() {
isFilterVisibleViewFreight.value = !isFilterVisibleViewFreight.value;
if (!isFilterVisibleViewFreight.value) {
clearFiltersViewFreight();
}
}
void selectAll(bool value) {
for (var item in grnDetails) {
item.isSelected = value;
@ -89,6 +107,10 @@ class TransportController extends GetxController {
RxBool showProductErrorPending = false.obs;
RxBool showTransactionErrorPending = false.obs;
RxBool showPlantErrorViewFreight = false.obs;
RxBool showProductErrorViewFreight = false.obs;
RxBool showTransactionErrorViewFreight = false.obs;
void validateFields() {
showPlantError.value = selectPlant.value.isEmpty;
showTransactionError.value = selectTransactionType.value.isEmpty;
@ -101,6 +123,13 @@ class TransportController extends GetxController {
showProductErrorPending.value = selectProductPending.value.isEmpty;
}
void validateFieldsViewFreightBill() {
showPlantErrorViewFreight.value = selectPlantViewFreight.value.isEmpty;
// showTransactionErrorViewFreight.value =
// selectTransactionTypeViewFreight.value.isEmpty;
showProductErrorViewFreight.value = selectProductViewFreight.value.isEmpty;
}
void validateFieldsGenerateFreight() {
showPlantErrorFreight.value = selectPlantFreight.value.isEmpty;
showTransactionErrorFreight.value =
@ -118,7 +147,7 @@ class TransportController extends GetxController {
super.onInit();
}
var transactionType = ['STO', 'InBound'];
var transactionType = ['STO', 'INBOUND'];
RxList tabs = <CommonModel>[
CommonModel(
@ -177,16 +206,14 @@ class TransportController extends GetxController {
Map<String, String> requestBody = {
"plant": selectPlantFreight.value,
"productNane": selectProductFreight.value,
"transactionType": selectTransactionTypeFreight.value,
"transactionType": selectTransactionTypeFreight.value.toUpperCase(),
"fromLocation": selectLocation.value,
"grnFromDate": "",
"grnToDate": ""
};
var response = await PostRequests.addFreightBill(requestBody);
if (response != null) {
List<Content> flattenedContent =
response.content!.expand((list) => list).toList();
print("Flattened content size: ${flattenedContent.length}");
@ -199,7 +226,8 @@ class TransportController extends GetxController {
(selectProductFreight.value.isEmpty ||
item.materialCode == selectProductFreight.value) &&
(selectTransactionTypeFreight.value.isEmpty ||
item.codeValue == selectTransactionTypeFreight.value);
item.codeValue ==
selectTransactionTypeFreight.value.toUpperCase());
}).toList();
print("Filtered Data: ${filteredData.length}");
@ -216,7 +244,6 @@ class TransportController extends GetxController {
}
}
// void handleFilterSubmit() {
// validateFieldsGenerateFreight();
//
@ -234,10 +261,8 @@ class TransportController extends GetxController {
selectProductFreight.value.isEmpty ||
selectTransactionTypeFreight.value.isEmpty) {
print('please fill data ');
}
else {
} else {
displayFilteredData();
}
}
@ -246,12 +271,26 @@ class TransportController extends GetxController {
if (selectPlantPending.value.isEmpty ||
selectProductPending.value.isEmpty ||
selectTransactionTypePending.value.isEmpty) {
}
else {
} else {
displayFilteredDataFromPending();
}
}
void handleFilterSubmitViewFreightBill() {
print('submit call');
validateFieldsViewFreightBill();
if (selectPlantViewFreight.value.isEmpty ||
selectProductViewFreight.value.isEmpty
// ||
// selectTransactionTypeViewFreight.value.isEmpty
) {
print('submit call 22');
} else {
print('submit call 1');
displayFilteredDataFromViewFreight();
}
}
void clearFiltersGenerateFreightBill() {
selectPlantFreight.value = '';
selectProductFreight.value = '';
@ -273,6 +312,18 @@ class TransportController extends GetxController {
showTransactionErrorPending.value = false;
postData();
}
void clearFiltersViewFreight() {
selectPlantViewFreight.value = '';
selectProductViewFreight.value = '';
// selectTransactionTypeViewFreight.value = '';
fromController.clear();
showPlantErrorViewFreight.value = false;
showProductErrorViewFreight.value = false;
showTransactionErrorViewFreight.value = false;
postData();
}
getFreightBills() async {
try {
isLoading.value = true;
@ -376,10 +427,6 @@ class TransportController extends GetxController {
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": "",
@ -388,18 +435,14 @@ class TransportController extends GetxController {
"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');
var response = await PostRequests.viewFreightBill(requestBody);
if (response != null) {
List<FreightBill> flattenedContent =
response.content!.expand((list) => list).toList();
freightBillData.assignAll(flattenedContent);
print("response from${freightBillData[0].freightbillCode.runtimeType} view freight bill ${freightBillData[0].plantCode.runtimeType} and ${freightBillData[0].materialCode.runtimeType} and}");
totalPages.value = response.totalPages ?? 0;
totalElements.value = response.totalElements ?? 0;
}
@ -460,29 +503,218 @@ class TransportController extends GetxController {
List<GrnPending> flattenedContent =
response.content!.expand((list) => list).toList();
grnPendingData.assignAll(flattenedContent);
print('response from pending tab${response.first.toString()} and ${flattenedContent.length} and ${grnPendingData.value[0].codeValue} and ${grnPendingData.value[0].plantCode} and ${grnPendingData.value[0].materialCode}');
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;
}
}
// void displayFilteredDataFromViewFreight() async {
// try {
// isLoading.value = true;
// Map<String, String> requestBody = {
// "plant": selectPlantViewFreight.value,
// "productNane": selectProductViewFreight.value,
// "freightBillNo": "",
// "transactionType": "",
// "fromLocation": "",
// "grnFromDate": "",
// "grnToDate": "",
// };
// print('submit call 444');
// print('Request Body: ${jsonEncode(requestBody)}');
//
// print(
// "pending Data 122 ${selectPlantViewFreight.value} and ${selectProductViewFreight.value}freightBillData: }");
//
// var response = await PostRequests.viewFreightBill(requestBody);
//
// if (response != null) {
// List<FreightBill> flattenedContent =
// response.content!.expand((list) => list).toList();
// print(
// "pending Data 1 ${selectPlantViewFreight.value} and ${selectProductViewFreight.value}freightBillData: and ${flattenedContent.length}");
//
// List<FreightBill> filteredData = flattenedContent.where((item) {
// return (selectPlantViewFreight.value.isEmpty ||
// item.plantCode == selectPlantViewFreight.value) &&
// (selectProductViewFreight.value.isEmpty ||
// item.materialCode == selectProductViewFreight.value
// // &&
// // (selectTransactionTypeViewFreight.value.isEmpty ||
// // item.codeValue ==
// // selectTransactionTypeViewFreight.value.toUpperCase()
// );
// }).toList();
//
// print(
// "pending Data ${selectPlantViewFreight.value} and ${selectProductViewFreight.value}freightBillData: ${filteredData.length} and ${flattenedContent.length}");
//
// freightBillData.assignAll(filteredData);
//
// print(
// "✅ pending Data:freightBillData ${filteredData.length} items displayed pending.");
// } else {
// print("❌ No response from API.");
// }
// } finally {
// isLoading.value = false;
// }
// }
// void displayFilteredDataFromViewFreight() async {
// try {
// isLoading.value = true;
// Map<String, String> requestBody = {
//
// "plant":selectPlantViewFreight.value.toString(),
// "productNane": selectProductViewFreight.value.toString(),
// "freightBillNo": "",
// "transactionType": "",
// "fromLocation": "",
// "grnFromDate": "",
// "grnToDate": ""
// };
//
// print('Request Body: ${jsonEncode(requestBody)}');
//
// var response = await PostRequests.viewFreightBill(requestBody);
//
//
//
// List<FreightBill> flattenedContent = response!.content!.expand((list) => list).toList();
// print("Flattened content length: ${flattenedContent.length}");
//
// if (flattenedContent.isEmpty) {
// print("No matching records found");
//
// return;
// }
//
// // List<FreightBill> filteredData = flattenedContent.where((item) {
// // bool plantMatch = selectPlantViewFreight.value.isEmpty ||
// // item.plantCode?.trim() == selectPlantViewFreight.value.trim();
// // bool productMatch = selectProductViewFreight.value.isEmpty ||
// // item.materialCode?.trim() == selectProductViewFreight.value.trim();
// //
// // return plantMatch && productMatch;
// // }).toList();
// List<FreightBill> filteredData = flattenedContent.where((item) {
// // Print raw item data first
// print("Checking item: ${jsonEncode(item.toJson())}");
//
// // Print values being compared
// print("Comparing: Plant '${item.plantCode}' with '${selectPlantViewFreight.value}'");
// print("Comparing: Product '${item.materialCode}' with '${selectProductViewFreight.value}'");
//
// bool plantMatch = selectPlantViewFreight.value.isEmpty ||
// item.plantCode?.trim() == selectPlantViewFreight.value.trim();
// print("Plant match result: $plantMatch");
//
// bool productMatch = selectProductViewFreight.value.isEmpty ||
// item.materialCode?.trim() == selectProductViewFreight.value.trim();
// print("Product match result: $productMatch");
//
// final result = plantMatch && productMatch;
// print("Final match result: $result");
// print("------------------------");
//
// return result;
// }).toList();
//
// // Print final results
// print("Total items after filtering: ${filteredData.length}");
// if (filteredData.isNotEmpty) {
// print("First matched item: ${jsonEncode(filteredData.first.toJson())}");
// }
// freightBillData.assignAll(filteredData);
// print("Filtered Data: ${filteredData.length} items");
//
// } catch (e) {
// print("Error in displayFilteredDataFromViewFreight: $e");
//
// } finally {
// isLoading.value = false;
// }
// }
void displayFilteredDataFromViewFreight() async {
try {
freightViewLoader.value = true;
Map<String, String> requestBody = {
"plant": selectPlantViewFreight.value,
"productNane": selectProductViewFreight.value,
"freightBillNo": "",
"transactionType": "",
"fromLocation": "",
"grnFromDate": "",
"grnToDate": "",
};
// Debug log for request
print("Filter request with Plant: ${selectPlantViewFreight.value}, Product: ${selectProductViewFreight.value}");
var response = await PostRequests.viewFreightBill(requestBody);
if (response != null) {
List<FreightBill> flattenedContent =
response.content!.expand((list) => list).toList();
print("Total records before filtering: ${flattenedContent.length}");
// If first item exists, log its types for debugging
if (flattenedContent.isNotEmpty) {
print("Sample data types - Plant: ${flattenedContent[0].plantCode.runtimeType}, "
"Material: ${flattenedContent[0].materialCode.runtimeType}");
}
List<FreightBill> filteredData = flattenedContent.where((item) {
bool plantMatch = selectPlantViewFreight.value.isEmpty ||
item.plantCode == selectPlantViewFreight.value;
bool productMatch = selectProductViewFreight.value.isEmpty ||
item.materialCode == selectProductViewFreight.value;
// Debug log for matching
print("Checking - Plant: ${item.plantCode} matches: $plantMatch, "
"Product: ${item.materialCode} matches: $productMatch");
return plantMatch && productMatch;
}).toList();
print("Filtered records count: ${filteredData.length}");
freightBillData.assignAll(filteredData);
// Update pagination if available
totalPages.value = response.totalPages ?? 0;
totalElements.value = response.totalElements ?? 0;
print("✅ Freight bill data filtered: ${filteredData.length} items displayed");
} else {
print("❌ No response from API.");
freightBillData.clear();
}
} catch (e) {
print("❌ Error in displayFilteredDataFromViewFreight: $e");
freightBillData.clear();
} finally {
freightViewLoader.value = false;
print('data');
}
}
void displayFilteredDataFromPending() async {
try {
isLoading.value = true;
Map<String, String> requestBody = {
"plant": selectPlantPending.value,
"productNane": selectProductPending.value,
"transactionType": selectTransactionTypePending.value,
"transactionType": selectTransactionTypePending.value.toUpperCase(),
"fromLocation": selectLocation.value,
"grnFromDate": "",
"grnToDate": ""
};
var response = await PostRequests.grnPending(requestBody);
if (response != null) {
List<GrnPending> flattenedContent =
response.content!.expand((list) => list).toList();
@ -492,14 +724,16 @@ class TransportController extends GetxController {
(selectProductFreight.value.isEmpty ||
item.materialCode == selectProductFreight.value) &&
(selectTransactionTypeFreight.value.isEmpty ||
item.codeValue == selectTransactionTypeFreight.value);
item.codeValue ==
selectTransactionTypeFreight.value.toUpperCase());
}).toList();
print("pending Data: ${filteredData.length}");
print("pending Data grnPendingData: ${filteredData.length}");
grnPendingData.assignAll(filteredData);
print("✅ pending Data: ${filteredData.length} items displayed pending.");
print(
"✅ pending Data: ${filteredData.length} items displayed pending.");
} else {
print("❌ No response from API.");
}
@ -507,5 +741,4 @@ class TransportController extends GetxController {
isLoading.value = false;
}
}
}

View File

@ -14,7 +14,7 @@ class ApiUrls {
static const getAllUser =
'http://46.28.44.130:9093/api/users/userdetails?page=';
static const viewFreightBill =
'http://localhost:9092/bill/freightbill?page';
'http://46.28.44.130:9092/bill/freightbill?page=0&size=15&sort=last_updated_on,desc';
static const addUserType =
'http://46.28.44.130:9093/api/user-types/createUserType';
static const dropDownList =
@ -34,6 +34,7 @@ class ApiUrls {
"http://46.28.44.130:9093/api/user-types/usertypedetails?page=0&size=15&sort=last_updated_on,desc";
static const grnPendingDetails =
"http://46.28.44.130:9092/bill/grndetailsPanding?page=0&size=20&sort=grn_date,desc";
static const getInvoiceDetails = "http://46.28.44.130:9092/invoice/getInvoice";
}
// class ApiUrls {
// ApiUrls._();

View File

@ -1,6 +1,7 @@
import 'package:shayog/feature/presentation/screens/admin/user_management/model/check_status_res_model.dart';
import 'package:shayog/feature/presentation/screens/admin/user_management/model/create_user_model.dart';
import 'package:shayog/feature/presentation/screens/admin/user_management/model/plant_mapping_res_model.dart';
import 'package:shayog/feature/presentation/screens/transporter/model/get_invoice_response.dart';
import 'package:shayog/services/network/remote_services.dart';
import '../../feature/presentation/screens/admin/user_management/model/assign_plants_res_model.dart';
import '../../feature/presentation/screens/admin/user_management/model/edit_user_res_model.dart';
@ -104,12 +105,9 @@ class PostRequests {
static Future<ViewFreightBillResModel?> viewFreightBill(
Map<String, String> requestBody,
int page,
int size,
String sort,
String dir) async {
) async {
var apiResponse = await RemoteService.postUser(requestBody,
'${ApiUrls.viewFreightBill}=$page&size=$size&sort=$sort,$dir');
'${ApiUrls.viewFreightBill}');
if (apiResponse != null) {
return viewFreightBillResModelFromJson(apiResponse.response!);
@ -218,4 +216,14 @@ class PostRequests {
return null;
}
}
static Future<GetInvoiceResponse?> getInvoice(
Map<String, String> requestBody) async {
var apiResponse =
await RemoteService.postUser(requestBody, ApiUrls.getInvoiceDetails);
if (apiResponse != null) {
return getInvoiceResponseFromJson(apiResponse.response!);
} else {
return null;
}
}
}

View File

@ -1,4 +1,5 @@
import 'package:flutter/cupertino.dart';
import 'package:intl/intl.dart';
class Helpers {
Helpers._();

View File

@ -5,6 +5,8 @@
import FlutterMacOS
import Foundation
import file_picker
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FilePickerPlugin.register(with: registry.registrar(forPlugin: "FilePickerPlugin"))
}

View File

@ -41,6 +41,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.19.0"
cross_file:
dependency: transitive
description:
name: cross_file
sha256: "7caf6a750a0c04effbb52a676dce9a4a592e10ad35c34d6d2d0e4811160d5670"
url: "https://pub.dev"
source: hosted
version: "0.3.4+2"
cupertino_icons:
dependency: "direct main"
description:
@ -57,6 +65,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.1"
ffi:
dependency: transitive
description:
name: ffi
sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6"
url: "https://pub.dev"
source: hosted
version: "2.1.3"
file_picker:
dependency: "direct main"
description:
name: file_picker
sha256: c9943dd7d702ab4199d199bc151a2d79c86db031a02ad84566dab58c494d2adc
url: "https://pub.dev"
source: hosted
version: "8.3.1"
flutter:
dependency: "direct main"
description: flutter
@ -70,11 +94,24 @@ packages:
url: "https://pub.dev"
source: hosted
version: "5.0.0"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
name: flutter_plugin_android_lifecycle
sha256: "615a505aef59b151b46bbeef55b36ce2b6ed299d160c51d84281946f0aa0ce0e"
url: "https://pub.dev"
source: hosted
version: "2.0.24"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
get:
dependency: "direct main"
description:
@ -171,6 +208,54 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.9.0"
path_provider:
dependency: "direct main"
description:
name: path_provider
sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd"
url: "https://pub.dev"
source: hosted
version: "2.1.5"
path_provider_android:
dependency: transitive
description:
name: path_provider_android
sha256: "4adf4fd5423ec60a29506c76581bc05854c55e3a0b72d35bb28d661c9686edf2"
url: "https://pub.dev"
source: hosted
version: "2.2.15"
path_provider_foundation:
dependency: transitive
description:
name: path_provider_foundation
sha256: "4843174df4d288f5e29185bd6e72a6fbdf5a4a4602717eed565497429f179942"
url: "https://pub.dev"
source: hosted
version: "2.4.1"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279
url: "https://pub.dev"
source: hosted
version: "2.2.1"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334"
url: "https://pub.dev"
source: hosted
version: "2.1.2"
path_provider_windows:
dependency: transitive
description:
name: path_provider_windows
sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7
url: "https://pub.dev"
source: hosted
version: "2.3.0"
pixel_snap:
dependency: transitive
description:
@ -179,6 +264,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.1.5"
platform:
dependency: transitive
description:
name: platform
sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984"
url: "https://pub.dev"
source: hosted
version: "3.1.6"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
url: "https://pub.dev"
source: hosted
version: "2.1.8"
simple_gesture_detector:
dependency: transitive
description:
@ -320,6 +421,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.1.0"
win32:
dependency: transitive
description:
name: win32
sha256: daf97c9d80197ed7b619040e86c8ab9a9dad285e7671ee7390f9180cc828a51e
url: "https://pub.dev"
source: hosted
version: "5.10.1"
xdg_directories:
dependency: transitive
description:
name: xdg_directories
sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15"
url: "https://pub.dev"
source: hosted
version: "1.1.0"
sdks:
dart: ">=3.6.0 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"
flutter: ">=3.24.0"

View File

@ -41,6 +41,8 @@ dependencies:
vph_web_date_picker: ^0.0.6
table_calendar: ^3.2.0
syncfusion_flutter_datepicker: ^28.2.4
file_picker: ^8.3.1
path_provider: ^2.1.5