Compare commits
6 Commits
e4ad29f845
...
ca30dcdc13
Author | SHA1 | Date |
---|---|---|
|
ca30dcdc13 | |
|
0e5d771da7 | |
|
fa9f837930 | |
|
34c5bbc291 | |
|
5ffd3c9d7d | |
|
72f7b3f051 |
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 368 KiB |
|
@ -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
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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,58 +566,81 @@ class GenerateFrightBill extends StatelessWidget {
|
|||
],
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _showDateRangePicker(BuildContext context) async {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(16),
|
||||
height: 400, // 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
|
||||
print(args.value);
|
||||
},
|
||||
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 second calendar
|
||||
print(args.value);
|
||||
},
|
||||
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: () {
|
||||
// You can extract the selected date range here
|
||||
// Close the bottom sheet after selection
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Text('Done'),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
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}";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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,10 +56,10 @@ class _TransportViewState extends State<InvoiceManagement> {
|
|||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
color:
|
||||
ctrl.selectedState.value == index
|
||||
? Colors.white
|
||||
: AppColors.primaryClr,
|
||||
color: ctrl.selectedState.value ==
|
||||
index
|
||||
? Colors.white
|
||||
: AppColors.primaryClr,
|
||||
width: 3))),
|
||||
child: Center(
|
||||
child: Text(
|
||||
|
@ -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),
|
||||
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",
|
||||
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: 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);
|
||||
// });
|
||||
// },
|
||||
// ),
|
||||
|
||||
//###########################################################################################################
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
_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),
|
||||
]),
|
||||
]),
|
||||
),
|
||||
// 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) {
|
||||
|
|
|
@ -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}",
|
||||
|
@ -63,10 +73,10 @@ class PendingGeneration extends StatelessWidget {
|
|||
),
|
||||
Obx(() => controller.showPlantErrorPending.value
|
||||
? Text(
|
||||
'Required',
|
||||
style: TextStyle(
|
||||
color: Colors.red, fontSize: 12),
|
||||
)
|
||||
'Required',
|
||||
style: TextStyle(
|
||||
color: Colors.red, fontSize: 12),
|
||||
)
|
||||
: Text('')),
|
||||
],
|
||||
),
|
||||
|
@ -100,14 +110,15 @@ class PendingGeneration extends StatelessWidget {
|
|||
},
|
||||
hintText: "Select Product Name",
|
||||
),
|
||||
Obx(() => controller
|
||||
.showProductErrorPending.value
|
||||
? Text(
|
||||
'Required',
|
||||
style: TextStyle(
|
||||
color: Colors.red, fontSize: 12),
|
||||
)
|
||||
: Text('')),
|
||||
Obx(() =>
|
||||
controller.showProductErrorPending.value
|
||||
? Text(
|
||||
'Required',
|
||||
style: TextStyle(
|
||||
color: Colors.red,
|
||||
fontSize: 12),
|
||||
)
|
||||
: Text('')),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -135,14 +146,15 @@ class PendingGeneration extends StatelessWidget {
|
|||
},
|
||||
hintText: "Select Transaction Type",
|
||||
),
|
||||
Obx(() => controller
|
||||
.showTransactionErrorPending.value
|
||||
? Text(
|
||||
'Required',
|
||||
style: TextStyle(
|
||||
color: Colors.red, fontSize: 12),
|
||||
)
|
||||
: Text('')),
|
||||
Obx(() =>
|
||||
controller.showTransactionErrorPending.value
|
||||
? Text(
|
||||
'Required',
|
||||
style: TextStyle(
|
||||
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(
|
||||
|
@ -305,20 +287,19 @@ class PendingGeneration extends StatelessWidget {
|
|||
width: 100,
|
||||
text: AppStrings.submit,
|
||||
clickAction: () =>
|
||||
// controller.validateFieldsPending();
|
||||
// if (controller.showPlantErrorPending
|
||||
// .value ||
|
||||
// controller.showProductErrorPending
|
||||
// .value ||
|
||||
// controller
|
||||
// .showTransactionErrorPending
|
||||
// .value) {
|
||||
// } else {
|
||||
// controller.postData();
|
||||
// }
|
||||
controller
|
||||
.handleFilterSubmitPendingGeneration(),
|
||||
|
||||
// controller.validateFieldsPending();
|
||||
// if (controller.showPlantErrorPending
|
||||
// .value ||
|
||||
// controller.showProductErrorPending
|
||||
// .value ||
|
||||
// controller
|
||||
// .showTransactionErrorPending
|
||||
// .value) {
|
||||
// } else {
|
||||
// controller.postData();
|
||||
// }
|
||||
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}";
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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:
|
||||
|
|
|
@ -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,26 +69,28 @@ 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) {
|
||||
|
||||
// }
|
||||
isFilterVisibleGenerateFreight.value =
|
||||
!isFilterVisibleGenerateFreight.value;
|
||||
if (!isFilterVisibleGenerateFreight.value) {
|
||||
clearFiltersGenerateFreightBill();
|
||||
}
|
||||
}
|
||||
|
||||
void togglePending(){
|
||||
void togglePending() {
|
||||
isFilterVisiblePendingGeneration.value =
|
||||
!isFilterVisiblePendingGeneration.value;
|
||||
!isFilterVisiblePendingGeneration.value;
|
||||
if (!isFilterVisiblePendingGeneration.value) {
|
||||
clearFiltersPendingGeneration();
|
||||
}
|
||||
}
|
||||
|
||||
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,46 +503,237 @@ 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();
|
||||
response.content!.expand((list) => list).toList();
|
||||
|
||||
List<GrnPending> filteredData = flattenedContent.where((item) {
|
||||
return (selectPlantFreight.value.isEmpty ||
|
||||
item.plantCode == selectPlantFreight.value) &&
|
||||
item.plantCode == selectPlantFreight.value) &&
|
||||
(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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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._();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class Helpers {
|
||||
Helpers._();
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
import FlutterMacOS
|
||||
import Foundation
|
||||
|
||||
import file_picker
|
||||
|
||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
FilePickerPlugin.register(with: registry.registrar(forPlugin: "FilePickerPlugin"))
|
||||
}
|
||||
|
|
119
pubspec.lock
119
pubspec.lock
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue