CEI, worklist po pr filter, date issue in absence dynamic screen

master
Sultan khan 1 month ago
parent f218dab93e
commit a9f0cb8216

@ -320,6 +320,8 @@
"createdFor": "انشاء لأجل",
"requestCreatedSuccessfully": "تم انشاء الطلب بنجاح",
"search": "بحث",
"filterEnterPrDetailsHere": "ادخل تفاصيل طلب الشراء هنا",
"filterEnterPoDetailsHere": "ادخل تفاصيل أمر الشراء هنا",
"wantToReject": "هل انت متأكد تريد الرفض",
"requestType": "نوع الطلب",
"employeeDigitalID": "هويةالموظف الرقمية",

@ -315,6 +315,8 @@
"requestType": "Request Type",
"requestCreatedSuccessfully": "Request created successfully",
"search": "Search",
"filterEnterPrDetailsHere": "Enter PR Details here",
"filterEnterPoDetailsHere": "Enter PO Details here",
"wantToReject": "Are you sure want to reject?",
"employeeDigitalID": "Employee Digital ID",
"businessCard": "Business Card",

@ -71,7 +71,14 @@ class LoginApiClient {
Future<BasicMemberInformationModel?> mohemmSendActivationCodeByOTPNotificationType(int isMobileFingerPrint, String? mobileNumber, int optSendType, String? pUserName) async {
String url = "${ApiConsts.erpRest}Mohemm_SendActivationCodebyOTPNotificationType";
Map<String, dynamic> postParams = {"IsMobileFingerPrint": isMobileFingerPrint, "MobileNumber": mobileNumber, "OTP_SendType": optSendType, "P_USER_NAME": pUserName};
Map<String, dynamic> postParams = {
"IsMobileFingerPrint": isMobileFingerPrint,
"MobileNumber": mobileNumber,
"OTP_SendType": optSendType,
"P_USER_NAME": pUserName,
"NotificationCenterAppGUID": ApiConsts.notificationCenterAppGUID,
"NotificationCenterAppSeviceGUID": ApiConsts.notificationCenterLoginServiceGUID,
};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) => GenericResponseModel.fromJson(json).basicMemberInformation, url, postParams);
}
@ -105,7 +112,13 @@ class LoginApiClient {
Future<GenericResponseModel?> sendPublicActivationCode(String? mobileNumber, String? pUsername) async {
String url = "${ApiConsts.erpRest}SendPublicActivationCode";
Map<String, dynamic> postParams = {"MobileNumber": mobileNumber, "P_MOBILE_NUMBER": mobileNumber, "P_USER_NAME": pUsername};
Map<String, dynamic> postParams = {
"MobileNumber": mobileNumber,
"P_MOBILE_NUMBER": mobileNumber,
"P_USER_NAME": pUsername,
"NotificationCenterAppGUID": ApiConsts.notificationCenterAppGUID,
"NotificationCenterAppSeviceGUID": ApiConsts.notificationCenterForgotPasswordServiceGUID,
};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
GenericResponseModel responseData = GenericResponseModel.fromJson(json);

@ -80,6 +80,11 @@ class ApiConsts {
//DummyCards for the UI
static int tabletMinLength = 500;
// Notification Center GUIDs for OTP
static String notificationCenterAppGUID = "VDZreDY5TTNmTDVudzc4aDkwU3ZqcW9OcmI0";
static String notificationCenterLoginServiceGUID = "D8BD5C76-4B50-4122-81D0-C3AA25DB08A2";
static String notificationCenterForgotPasswordServiceGUID = "5CCCC2C9-EEA0-4207-9BE9-EE1FBBFFE8D0";
}
class SharedPrefsConsts {

@ -524,14 +524,47 @@ class DateUtil {
// }
// return "";
// }
static String replaceArabicNumber(String input) {
static String replaceArabicNumber(String? input) {
if (input == null || input.isEmpty) return input ?? "";
const english = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
const arabic = ['٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩'];
const persian = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'];
for (int i = 0; i < english.length; i++) {
input = input.replaceAll(arabic[i], english[i]);
input = input!.replaceAll(arabic[i], english[i]).replaceAll(persian[i], english[i]);
}
return input;
return input!;
}
static DateTime? parseFlexibleDateTime(String? dateStr) {
if (dateStr == null || dateStr.trim().isEmpty) return null;
String cleanStr = replaceArabicNumber(dateStr.trim()).replaceAll('/"', '').replaceAll('"', '');
if (cleanStr.contains(' 00:00:00')) {
cleanStr = cleanStr.replaceAll(' 00:00:00', '').trim();
}
DateTime? result = DateTime.tryParse(cleanStr);
if (result != null) return result;
if (cleanStr.contains('/')) {
try {
return DateFormat("yyyy/MM/dd", "en_US").parseLoose(cleanStr);
} catch (_) {}
try {
return DateFormat("dd/MM/yyyy", "en_US").parseLoose(cleanStr);
} catch (_) {}
}
if (cleanStr.contains('-')) {
try {
return DateFormat("yyyy-MM-dd", "en_US").parseLoose(cleanStr);
} catch (_) {}
try {
return DateFormat("dd-MM-yyyy", "en_US").parseLoose(cleanStr);
} catch (_) {}
}
return null;
}
}

@ -323,6 +323,8 @@ abstract class LocaleKeys {
static const createdFor = 'createdFor';
static const requestCreatedSuccessfully = 'requestCreatedSuccessfully';
static const search = 'search';
static const filterEnterPrDetailsHere = 'filterEnterPrDetailsHere';
static const filterEnterPoDetailsHere = 'filterEnterPoDetailsHere';
static const wantToReject = 'wantToReject';
static const requestType = 'requestType';
static const employeeDigitalID = 'employeeDigitalID';

@ -1,7 +1,7 @@
import 'dart:convert';
class GetTicketAccuralBalanceModel {
int? accrualNetEntitlement;
num? accrualNetEntitlement;
String? accuralPlanCode;
GetTicketAccuralBalanceModel({

@ -254,6 +254,8 @@ class ServicesWidget extends StatelessWidget {
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(menuEntry.prompt!, menuEntry.functionName!));
} else if (menuEntry.requestType == "PAYSLIP") {
Navigator.pushNamed(context, AppRoutes.monthlyPaySlip);
} else if (menuEntry.requestType == "CEI") {
Navigator.pushNamed(context, AppRoutes.childEducation, arguments: menuEntry);
}
} else {
if (menuEntry.menuName == "HMG_TICKET_REQUESTS") {

@ -326,7 +326,7 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
displayText = displayText.replaceAll(" 00:00:00", "");
}
if (displayText.contains("/")) {
displayText = DateFormat('yyyy-MM-dd').format(DateFormat("yyyy/MM/dd").parse(displayText));
displayText = DateFormat('yyyy-MM-dd', "en_US").format(DateFormat("yyyy/MM/dd", "en_US").parse(DateUtil.replaceArabicNumber(displayText)));
}
}
return DynamicTextFieldWidget(
@ -336,11 +336,7 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
isEnable: false,
onTap: () async {
if ((getabsenceDffStructureList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) {
if (getabsenceDffStructureList![index].isDefaultTypeIsCDPS) {
selectedDate = DateFormat("yyyy/MM/dd").parse(getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!.replaceAll('/"', '').replaceAll(" 00:00:00", ""));
} else {
selectedDate = DateTime.parse(getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!);
}
selectedDate = DateUtil.parseFlexibleDateTime(getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME) ?? selectedDate;
}
DateTime date = await _selectDate(context);
String dateString = date.toString().split(' ').first;
@ -353,14 +349,14 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
pRETURNMSG: "null",
pRETURNSTATUS: getabsenceDffStructureList![index].dEFAULTVALUE,
pVALUECOLUMNNAME:
getabsenceDffStructureList![index].isDefaultTypeIsCDPS ? Utils.reverseFormatStandardDate(Utils.formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date));
getabsenceDffStructureList![index].isDefaultTypeIsCDPS ? Utils.reverseFormatStandardDate(Utils.formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s', "en_US").format(date));
} else {
eservicesdv = ESERVICESDV(
pIDCOLUMNNAME: dateString,
pRETURNMSG: "null",
pRETURNSTATUS: getabsenceDffStructureList![index].dEFAULTVALUE,
pVALUECOLUMNNAME:
getabsenceDffStructureList![index].isDefaultTypeIsCDPS ? Utils.reverseFormatStandardDate(Utils.formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date));
getabsenceDffStructureList![index].isDefaultTypeIsCDPS ? Utils.reverseFormatStandardDate(Utils.formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s', "en_US").format(date));
}
getabsenceDffStructureList![index].eSERVICESDV = eservicesdv;
setState(() {});
@ -374,7 +370,7 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
).paddingOnly(bottom: 12);
} else if (model.fORMATTYPE == "Y") {
String displayText = model.eSERVICESDV?.pIDCOLUMNNAME ?? "";
if (getabsenceDffStructureList![index].isDefaultTypeIsCDPS) {
if (getabsenceDffStructureList[index].isDefaultTypeIsCDPS) {
displayText = Utils.reverseFormatDate(displayText);
// if (displayText.contains(" 00:00:00")) {
// displayText = displayText.replaceAll(" 00:00:00", "");
@ -390,19 +386,7 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
isEnable: false,
onTap: () async {
if ((getabsenceDffStructureList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) {
if (getabsenceDffStructureList![index].isDefaultTypeIsCDPS) {
String tempDate = getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!;
if (tempDate.contains("00:00:00")) {
tempDate = tempDate.replaceAll("00:00:00", '').trim();
}
if (tempDate.contains("/")) {
selectedDate = DateFormat("yyyy/MM/dd").parse(tempDate);
} else {
selectedDate = DateFormat("yyyy-MM-dd").parse(tempDate);
}
} else {
selectedDate = DateTime.parse(getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!);
}
selectedDate = DateUtil.parseFlexibleDateTime(getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME) ?? selectedDate;
}
DateTime date = await _selectDate(context);
String dateString = date.toString().split(' ').first;
@ -414,14 +398,14 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
pRETURNMSG: "null",
pRETURNSTATUS: getabsenceDffStructureList![index].dEFAULTVALUE,
pVALUECOLUMNNAME:
getabsenceDffStructureList![index].isDefaultTypeIsCDPS ? Utils.reverseFormatStandardDate(Utils.formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date));
getabsenceDffStructureList![index].isDefaultTypeIsCDPS ? Utils.reverseFormatStandardDate(Utils.formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s', "en_US").format(date));
} else {
eservicesdv = ESERVICESDV(
pIDCOLUMNNAME: dateString,
pRETURNMSG: "null",
pRETURNSTATUS: getabsenceDffStructureList![index].dEFAULTVALUE,
pVALUECOLUMNNAME:
getabsenceDffStructureList![index].isDefaultTypeIsCDPS ? Utils.reverseFormatStandardDate(Utils.formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date));
getabsenceDffStructureList![index].isDefaultTypeIsCDPS ? Utils.reverseFormatStandardDate(Utils.formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s', "en_US").format(date));
}
getabsenceDffStructureList![index].eSERVICESDV = eservicesdv;
@ -512,7 +496,7 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
displayText = displayText.replaceAll(" 00:00:00", "");
}
if (!displayText.contains("-")) {
displayText = DateFormat('yyyy-MM-dd').format(DateFormat("yyyy/MM/dd").parse(displayText));
displayText = DateFormat('yyyy-MM-dd', "en_US").format(DateFormat("yyyy/MM/dd", "en_US").parse(DateUtil.replaceArabicNumber(displayText)));
}
}
return DynamicTextFieldWidget(
@ -522,11 +506,7 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
isEnable: false,
onTap: () async {
if ((getabsenceDffStructureList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) {
if (getabsenceDffStructureList![index].isDefaultTypeIsCDPS) {
selectedDate = DateFormat("yyyy/MM/dd").parse(getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!.replaceAll('/"', '').replaceAll(" 00:00:00", ""));
} else {
selectedDate = DateTime.parse(getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!);
}
selectedDate = DateUtil.parseFlexibleDateTime(getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME) ?? selectedDate;
}
DateTime date = await _selectDate(context);
String dateString = date.toString().split(' ').first;
@ -536,7 +516,7 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
pRETURNMSG: "null",
pRETURNSTATUS: getabsenceDffStructureList![index].dEFAULTVALUE,
pVALUECOLUMNNAME:
getabsenceDffStructureList![index].isDefaultTypeIsCDPS ? Utils.reverseFormatStandardDate(Utils.formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date));
getabsenceDffStructureList![index].isDefaultTypeIsCDPS ? Utils.reverseFormatStandardDate(Utils.formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s', "en_US").format(date));
getabsenceDffStructureList![index].eSERVICESDV = eservicesdv;
setState(() {});
// if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) {
@ -557,14 +537,14 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
if (getabsenceDffStructureList[index].mOBILEENABLED != "Y") return;
if ((getabsenceDffStructureList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) {
var timeString = getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!.split(":");
selectedDate = DateTime(0, 0, 0, int.parse(timeString[0]), int.parse(timeString[1]));
var timeString = DateUtil.replaceArabicNumber(getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME).split(":");
selectedDate = DateTime(0, 0, 0, int.tryParse(timeString[0]) ?? 0, timeString.length > 1 ? (int.tryParse(timeString[1]) ?? 0) : 0);
//DateTime.parse(getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!);
}
TimeOfDay _time = await _selectTime(context);
DateTime tempTime = DateTime(0, 1, 1, _time.hour, _time.minute);
String time = DateFormat('HH:mm').format(tempTime).trim();
String time = DateFormat('HH:mm', "en_US").format(tempTime).trim();
// DateTime date1 = DateTime(date.year, date.month, date.day);
// getabsenceDffStructureList![index].fieldAnswer = date.toString();

@ -2,6 +2,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/api/profile_api_client.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
@ -12,47 +13,64 @@ import 'package:mohem_flutter_app/models/get_employee_contacts.model.dart';
import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart';
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
class ChildEducationAssistance extends StatelessWidget {
ChildEducationAssistance({Key? key}) : super(key: key);
class ChildEducationAssistance extends StatefulWidget {
const ChildEducationAssistance({Key? key}) : super(key: key);
@override
State<ChildEducationAssistance> createState() => _ChildEducationAssistanceState();
}
class _ChildEducationAssistanceState extends State<ChildEducationAssistance> {
GetMenuEntriesList? menuEntry;
List<GetEmployeeContactsList> empContactList = [];
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) {
menuEntry = ModalRoute.of(context)!.settings.arguments as GetMenuEntriesList;
getEmployeeContacts();
});
}
@override
Widget build(BuildContext context) {
menuEntry ??= ModalRoute.of(context)!.settings.arguments as GetMenuEntriesList;
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBarWidget(context, title: menuEntry!.prompt!),
body: FutureBuilder(
future: ProfileApiClient().getEmployeeContacts(),
builder: (BuildContext cxt, AsyncSnapshot<List<GetEmployeeContactsList>> snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const Center(child: CircularProgressIndicator());
} else if (snapshot.hasData) {
List<GetEmployeeContactsList> empContactList = snapshot.data!;
return ListView.separated(
padding: const EdgeInsets.all(21),
separatorBuilder: (BuildContext cxt, int index) => 12.height,
itemCount: empContactList.length,
itemBuilder: (BuildContext context, int index) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
"${empContactList[index].cONTACTNAME}".toText16(color: MyColors.grey3AColor),
"${LocaleKeys.dateOfBirth.tr()}: ${empContactList[index].dATEOFBIRTH?.split(" ").first ?? ""}".toText14(color: MyColors.grey3AColor, weight: FontWeight.w400),
"${empContactList[index].rELATIONSHIP}".toText11(color: MyColors.textMixColor),
],
).objectContainerView(disablePadding: false, center: false).onPress(() {
Navigator.pushNamed(context, AppRoutes.dynamicScreen,
arguments: DynamicListViewParams(empContactList[index].cONTACTNAME!, menuEntry!.functionName!, pContactRelationshipId: empContactList[index].cONTACTRELATIONSHIPID));
});
appBar: AppBarWidget(context, title: menuEntry?.prompt ?? ""),
body: empContactList.isNotEmpty
? ListView.separated(
physics: const BouncingScrollPhysics(),
padding: const EdgeInsets.all(21),
separatorBuilder: (BuildContext cxt, int index) => 12.height,
itemCount: empContactList.length,
itemBuilder: (BuildContext context, int index) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
"${empContactList[index].cONTACTNAME}".toText16(color: MyColors.grey3AColor),
"${LocaleKeys.dateOfBirth.tr()}: ${empContactList[index].dATEOFBIRTH?.split(" ").first ?? ""}".toText14(color: MyColors.grey3AColor, weight: FontWeight.w400),
"${empContactList[index].rELATIONSHIP}".toText11(color: MyColors.textMixColor),
],
).objectContainerView(disablePadding: false, center: false).onPress(() {
Navigator.pushNamed(context, AppRoutes.dynamicScreen,
arguments: DynamicListViewParams(empContactList[index].cONTACTNAME!, menuEntry!.functionName!, pContactRelationshipId: empContactList[index].cONTACTRELATIONSHIPID));
});
} else {
return LocaleKeys.noDataAvailable.tr().toText16().center;
}
},
),
})
: Utils.getNoDataWidget(context),
);
}
void getEmployeeContacts() async {
try {
Utils.showLoading(context);
empContactList = await ProfileApiClient().getEmployeeContacts();
Utils.hideLoading(context);
setState(() {});
} catch (ex) {
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
}

@ -22,6 +22,7 @@ import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart';
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
import 'package:mohem_flutter_app/widgets/bottom_sheet.dart';
import 'package:mohem_flutter_app/widgets/bottom_sheets/worklist_advance_search_bottom_sheet.dart';
import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart';
import 'package:mohem_flutter_app/widgets/sso_webview_widget.dart';
import 'package:provider/provider.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
@ -151,6 +152,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
final ScrollController _controller = ScrollController();
int pNotificationType = 1;
String prPoFilterText = "";
ScrollController? _scrollController;
@override
@ -318,6 +320,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
}
if (workListItemIndex != index && !workListItemTypes[index].disable) {
workListItemIndex = index;
prPoFilterText = "";
pageNumber = 1;
if (workListItemTypes[index].value == 0) {
workList = [];
@ -352,6 +355,20 @@ class _WorkListScreenState extends State<WorkListScreen> {
.paddingOnly(left: 21, right: 21),
],
),
if (_isPrOrPoSelected())
DynamicTextFieldWidget(
"",
_getPrPoFilterHint(),
isEnable: true,
isPopup: false,
lines: 1,
isInputTypeNum: false,
isReadOnly: false,
onChange: (String value) {
prPoFilterText = value;
setState(() {});
},
).paddingOnly(left: 21, right: 21, top: 10),
SmartRefresher(
enablePullDown: true,
enablePullUp: false,
@ -404,16 +421,16 @@ class _WorkListScreenState extends State<WorkListScreen> {
],
)
: workList != null
? ((workList!).isEmpty
? ((_getDisplayedWorkList()).isEmpty
? Utils.getNoDataWidget(context).paddingOnly(top: 100)
: ListView.separated(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
return rowItem(workListItemTypes[workListItemIndex!], workList![index], index);
return rowItem(workListItemTypes[workListItemIndex!], _getDisplayedWorkList()[index], index);
},
separatorBuilder: (context, index) => 12.height,
itemCount: workList?.length ?? 0,
itemCount: _getDisplayedWorkList().length,
padding: const EdgeInsets.all(21),
))
: const SizedBox(),
@ -507,7 +524,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
}
}
Utils.showLoading(context);
workList = await WorkListApiClient().getWorkList(
List<WorkListResponseModel>? responseList = await WorkListApiClient().getWorkList(
pageNumber,
selectedItemTypeID,
selectedViewID.toString(),
@ -516,6 +533,8 @@ class _WorkListScreenState extends State<WorkListScreen> {
pSentDate: searchByDate,
pSearchItemType: searchByInput,
);
workList = responseList;
prPoFilterText = "";
workListItemIndex = index;
AppState().setWorkList = workList;
Utils.hideLoading(context);
@ -525,11 +544,35 @@ class _WorkListScreenState extends State<WorkListScreen> {
);
}
bool _isPrOrPoSelected() {
if (workListItemIndex == null) return false;
String key = workListItemTypes[workListItemIndex!].key ?? "";
return key == "REQAPPRV" || key == "POAPPRV";
}
List<WorkListResponseModel> _getDisplayedWorkList() {
List<WorkListResponseModel> source = workList ?? [];
if (!_isPrOrPoSelected()) return source;
String query = prPoFilterText.trim().toLowerCase();
if (query.isEmpty) return source;
return source.where((item) => (item.sUBJECT ?? "").toLowerCase().contains(query)).toList();
}
String _getPrPoFilterHint() {
if (workListItemIndex == null) return "filterEnterPrDetailsHere".tr();
String key = workListItemTypes[workListItemIndex!].key;
if (key == "POAPPRV") {
return "filterEnterPoDetailsHere".tr();
}
return "filterEnterPrDetailsHere".tr();
}
Widget rowItem(WorkListItemTypeModelData data, WorkListResponseModel workData, int index) {
return InkWell(
onTap: () async {
AppState().setWorkListIndex = index;
var data = workList![index];
var data = workData;
var shouldReloadData = await Navigator.pushNamed(context, AppRoutes.workListDetail, arguments: workData);
if (shouldReloadData != null) {
if (shouldReloadData.toString() == "delegate_reload") {
@ -542,7 +585,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
setState(() {});
}
} else {
workList!.remove(data);
workList!.removeWhere((item) => item.nOTIFICATIONID == data.nOTIFICATIONID);
AppState().setWorkList = workList;
if (data.iTEMTYPE == "ITG") {
} else {

@ -11,7 +11,7 @@ import 'package:mohem_flutter_app/widgets/button/default_button.dart';
import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart';
class WorkListAdvanceSearch extends StatefulWidget {
Function(int, String, String, String) onSearch;
final Function(int, String, String, String) onSearch;
WorkListAdvanceSearch(this.onSearch, {Key? key}) : super(key: key);

Loading…
Cancel
Save