Merge branch 'development_sikander' into 'master'

Development sikander

See merge request Cloud_Solution/mohemm-flutter-app!4
merge-requests/5/head
Sikander Saleem 3 years ago
commit a797e2b2c6

@ -1,5 +1,3 @@
import 'package:mohem_flutter_app/api/api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/consts.dart';
@ -19,7 +17,6 @@ class MyTeamApiClient {
factory MyTeamApiClient() => _instance;
Future<List<GetEmployeeSubordinatesList>> getEmployeeSubordinates(String searchEmpEmail, String searchEmpName, String searchEmpNo) async {
String url = "${ApiConsts.erpRest}GET_EMPLOYEE_SUBORDINATES";
Map<String, dynamic> postParams = {
@ -72,7 +69,6 @@ class MyTeamApiClient {
}, url, postParams);
}
Future<GetAttendanceTracking?> getAttendanceTracking(String? empID) async {
String url = "${ApiConsts.erpRest}GET_Attendance_Tracking";
Map<String, dynamic> postParams = {};
@ -104,10 +100,7 @@ class MyTeamApiClient {
Future<List<GetMenuEntriesList>> employeeSubordinatesRequest(String? empID) async {
String url = "${ApiConsts.erpRest}GET_MENU_ENTRIES";
Map<String, dynamic> postParams = {
"P_MENU_TYPE": "M",
"P_SELECTED_RESP_ID": -999,
};
Map<String, dynamic> postParams = {"P_MENU_TYPE": "M", "P_SELECTED_RESP_ID": -999};
postParams.addAll(AppState().postParamsJson);
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
return await ApiClient().postJsonForObject((json) {
@ -118,8 +111,7 @@ class MyTeamApiClient {
Future<List<GetFavoriteReplacements>?> getFavoriteReplacement() async {
String url = "${ApiConsts.erpRest}Mohemm_GetFavoriteReplacements";
Map<String, dynamic> postParams = {
};
Map<String, dynamic> postParams = {};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
GenericResponseModel responseData = GenericResponseModel.fromJson(json);
@ -138,7 +130,7 @@ class MyTeamApiClient {
};
Map<String, dynamic> postParams = {
"Mohemm_ChangeReplacementsInputList": [postParamsObj],
//postParams["Mohemm_ChangeReplacementsInputList"] = list;
//postParams["Mohemm_ChangeReplacementsInputList"] = list;
};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
@ -151,7 +143,7 @@ class MyTeamApiClient {
String url = "${ApiConsts.erpRest}GET_SUBORDINATES_LEAVES_TOTAL_VACATIONS";
Map<String, dynamic> postParams = {
"P_DATE_FROM": dateFrom,
"P_DATE_TO": dateTo,
"P_DATE_TO": dateTo,
};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
@ -160,4 +152,3 @@ class MyTeamApiClient {
}, url, postParams);
}
}

@ -70,34 +70,37 @@ class _DynamicListViewScreenState extends State<DynamicListViewScreen> {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBarWidget(context, title: dynamicParams!.title),
body: ListView(
physics: const BouncingScrollPhysics(),
padding: const EdgeInsets.all(21),
children: [
// HMG_TKT_NEW_EIT_SS Id used for ticket balance dashboard
if (dynamicParams!.dynamicId == "HMG_TKT_NEW_EIT_SS") ...[const BalancesDashboardWidget("Current Ticket Balance", false), 12.height],
getEITTransactionList == null
? const SizedBox()
: (getEITTransactionList!.isEmpty
? Utils.getNoDataWidget(context)
: ListView.separated(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (cxt, int parentIndex) => getEITTransactionList![parentIndex].collectionTransaction!.isEmpty
? const SizedBox()
: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
for (int t = 0; t < (getEITTransactionList![parentIndex].collectionTransaction ?? []).length; t++)
if (getEITTransactionList![parentIndex].collectionTransaction![t].dISPLAYFLAG == "Y")
ItemDetailView(getEITTransactionList![parentIndex].collectionTransaction![t].sEGMENTPROMPT!,
getEITTransactionList![parentIndex].collectionTransaction![t].sEGMENTVALUEDSP ?? ""),
],
).objectContainerView(),
separatorBuilder: (cxt, index) => 12.height,
itemCount: getEITTransactionList!.length)),
],
body: Center(
child: ListView(
physics: const BouncingScrollPhysics(),
shrinkWrap: true,
padding: const EdgeInsets.all(21),
children: [
// HMG_TKT_NEW_EIT_SS Id used for ticket balance dashboard
if (dynamicParams!.dynamicId == "HMG_TKT_NEW_EIT_SS") ...[const BalancesDashboardWidget("Current Ticket Balance", false), 12.height],
getEITTransactionList == null
? const SizedBox()
: (getEITTransactionList!.isEmpty
? Utils.getNoDataWidget(context)
: ListView.separated(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (cxt, int parentIndex) => getEITTransactionList![parentIndex].collectionTransaction!.isEmpty
? const SizedBox()
: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
for (int t = 0; t < (getEITTransactionList![parentIndex].collectionTransaction ?? []).length; t++)
if (getEITTransactionList![parentIndex].collectionTransaction![t].dISPLAYFLAG == "Y")
ItemDetailView(getEITTransactionList![parentIndex].collectionTransaction![t].sEGMENTPROMPT!,
getEITTransactionList![parentIndex].collectionTransaction![t].sEGMENTVALUEDSP ?? ""),
],
).objectContainerView(),
separatorBuilder: (cxt, index) => 12.height,
itemCount: getEITTransactionList!.length)),
],
),
),
floatingActionButton: Container(
height: 54,

@ -51,11 +51,9 @@ class ServicesMenuListScreen extends StatelessWidget {
Navigator.pushNamed(context, AppRoutes.familyMembers);
}
return;
} else if (servicesMenuData.list[index].parentMenuName == "HMG_HRSS_EMP_ABS") {
if (servicesMenuData.list[index].requestType == "ABSENCE") {
Navigator.pushNamed(context, AppRoutes.leaveBalance);
return;
}
} else if (servicesMenuData.list[index].requestType == "ABSENCE") {
Navigator.pushNamed(context, AppRoutes.leaveBalance);
return;
}
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(servicesMenuData.list[index].prompt!, servicesMenuData.list[index].functionName!));
}),

@ -1,5 +1,3 @@
import 'dart:ui';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
@ -12,32 +10,34 @@ import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart';
import 'package:mohem_flutter_app/models/dashboard/menus.dart';
import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart';
import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart';
import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart';
import 'package:mohem_flutter_app/ui/my_attendance/services_menu_list_screen.dart';
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
class CreateRequest extends StatefulWidget {
const CreateRequest ({Key? key}) : super(key: key);
const CreateRequest({Key? key}) : super(key: key);
@override
_CreateRequestState createState() => _CreateRequestState();
}
class _CreateRequestState extends State<CreateRequest> {
String searchEmpEmail ="";
String searchEmpName ="";
String searchEmpEmail = "";
String searchEmpName = "";
String searchEmpNo = "";
String? empId;
List<GetEmployeeSubordinatesList> getEmployeeSubordinatesList = [];
// late DashboardProviderModel data;
List<GetMenuEntriesList> getMenuEntriesList = [];
GetEmployeeSubordinatesList? getEmployeeSubordinates;
List<Menus>? homeMenus;
@override
void initState() {
super.initState();
// data.fetchMenuEntries();
employeeSubRequest();
}
@ -46,6 +46,7 @@ class _CreateRequestState extends State<CreateRequest> {
Utils.showLoading(context);
getEmployeeSubordinatesList = await MyTeamApiClient().getEmployeeSubordinates(searchEmpEmail.toString(), searchEmpName.toString(), searchEmpNo.toString());
getMenuEntriesList = await MyTeamApiClient().employeeSubordinatesRequest(getEmployeeSubordinates?.eMPLOYEENUMBER);
homeMenus = parseMenus(getMenuEntriesList);
Utils.hideLoading(context);
setState(() {});
} catch (ex) {
@ -54,42 +55,65 @@ class _CreateRequestState extends State<CreateRequest> {
}
}
List<Menus> parseMenus(List<GetMenuEntriesList> getMenuEntriesList) {
List<Menus> menus = [];
for (int i = 0; i < getMenuEntriesList.length; i++) {
if (getMenuEntriesList[i].parentMenuName!.isEmpty) {
menus.add(Menus(getMenuEntriesList[i], getMenuEntriesList.where((element) => getMenuEntriesList[i].menuName == element.parentMenuName).toList()));
}
}
return menus;
}
void handleOnPress(context, Menus menu) {
if (menu.menuEntry.menuEntryType == "FUNCTION") {
if (menu.menuEntry.requestType == "EIT") {
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(menu.menuEntry.prompt!, menu.menuEntry.functionName!));
} else {}
} else {
Navigator.pushNamed(context, AppRoutes.servicesMenuListScreen, arguments: ServicesMenuListScreenParams(menu.menuEntry.prompt!, menu.menuEntiesList));
}
return;
}
@override
Widget build(BuildContext context) {
getEmployeeSubordinates ??= ModalRoute.of(context)?.settings.arguments as GetEmployeeSubordinatesList;
print(getMenuEntriesList.length);
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBarWidget(
context,
title: LocaleKeys.createRequest.tr(),
),
body: SizedBox(
width: double.infinity,
height: double.infinity,
child: getMenuEntriesList.isEmpty
? Utils.getNoDataWidget(context)
: ListView.separated(
padding: const EdgeInsets.all(21),
itemBuilder: (cxt, index) => itemView("assets/images/pdf.svg", getMenuEntriesList[index].prompt!, index).onPress(() {
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(getMenuEntriesList[index].prompt!, getMenuEntriesList[index].functionName!));
}),
separatorBuilder: (cxt, index) => 12.height,
itemCount: getMenuEntriesList.length),
),
body: SizedBox(
width: double.infinity,
height: double.infinity,
child: homeMenus == null
? const SizedBox()
: (homeMenus!.isEmpty
? Utils.getNoDataWidget(context)
: ListView.separated(
padding: const EdgeInsets.all(21),
itemBuilder: (cxt, index) => itemView("assets/images/pdf.svg", homeMenus![index].menuEntry.prompt!, index).onPress(() {
handleOnPress(context, homeMenus![index]);
}),
separatorBuilder: (cxt, index) => 12.height,
itemCount: homeMenus!.length)),
),
);
}
Widget itemView(String icon, String title, index) {
return getMenuEntriesList[index].parentMenuName !=""? Row(
return Row(
children: [
(title).toText16().expanded, 12.width,
(title).toText16().expanded,
12.width,
SvgPicture.asset(
"assets/images/arrow_next.svg",
color: MyColors.darkIconColor,
)
],
).objectContainerView() : SizedBox();
).objectContainerView();
}
}

@ -487,10 +487,13 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
"P_FORWARD_TO_USER_NAME": "",
"P_NOTIFICATION_ID": workListData!.nOTIFICATIONID,
"RespondAttributeList": [
if (notificationNoteInput != null) {notificationNoteInput!.attributeName: note}
if (notificationNoteInput != null)
{
"ATTRIBUTE_NAME": notificationNoteInput!.attributeName,
if (notificationNoteInput!.attributeType == "number") "ATTRIBUTE_NUMBER_VALUE": note else if (notificationNoteInput!.attributeType == "VARCHAR2") "ATTRIBUTE_TEXT_VALUE": note
}
],
};
performNotificationAction(payload);
},
),

@ -66,6 +66,7 @@ class AcceptRejectInputDialog extends StatelessWidget {
notificationGetRespond!.attributeDisplayName!,
TextEditingController(),
isBackgroundEnable: true,
isInputTypeNum: notificationGetRespond!.attributeType == "number",
lines: 3,
onChange: (String note) {
this.note = note;

Loading…
Cancel
Save