Merge branch 'master' into dev_mirza

merge-requests/8/head
mirza.shafique 3 years ago
commit a5bf631d40

@ -25,6 +25,7 @@
"checkIn": "تحقق في",
"workList": "قائمة العمل",
"leaveBalance": "رصيد الاجازات",
"businessTripBalance": "رصيد رحلة العمل",
"missingSwipes": "تسجيل بصمة حضور",
"ticketBalance": "رصيد التذكرة",
"other": "آخر",

@ -25,6 +25,7 @@
"checkIn": "Check In",
"workList": "Work List",
"leaveBalance": "Leave Balance",
"businessTripBalance": "Business Trip Balance",
"missingSwipes": "Missing Swipes",
"ticketBalance": "Ticket Balance",
"other": "Other",

@ -16,9 +16,9 @@ class MyRequestsApiClient {
factory MyRequestsApiClient() => _instance;
Future<List<GetConcurrentProgramsModel>> getConcurrentPrograms() async {
Future<List<GetConcurrentProgramsModel>> getConcurrentPrograms(int id) async {
String url = "${ApiConsts.erpRest}GET_CONCURRENT_PROGRAMS";
Map<String, dynamic> postParams = {"P_REQUEST_GROUP_ID": 3290};
Map<String, dynamic> postParams = {"P_REQUEST_GROUP_ID": id};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {

@ -41,6 +41,7 @@ class CodegenLoader extends AssetLoader{
"checkIn": "تحقق في",
"workList": "قائمة العمل",
"leaveBalance": "رصيد الاجازات",
"businessTripBalance": "رصيد رحلة العمل",
"missingSwipes": "تسجيل بصمة حضور",
"ticketBalance": "رصيد التذكرة",
"other": "آخر",
@ -569,6 +570,7 @@ static const Map<String,dynamic> en_US = {
"checkIn": "Check In",
"workList": "Work List",
"leaveBalance": "Leave Balance",
"businessTripBalance": "Business Trip Balance",
"missingSwipes": "Missing Swipes",
"ticketBalance": "Ticket Balance",
"other": "Other",

@ -27,6 +27,7 @@ abstract class LocaleKeys {
static const checkIn = 'checkIn';
static const workList = 'workList';
static const leaveBalance = 'leaveBalance';
static const businessTripBalance = 'businessTripBalance';
static const missingSwipes = 'missingSwipes';
static const ticketBalance = 'ticketBalance';
static const services = 'services';

@ -2,6 +2,8 @@ class DrawerMenuItem {
String icon;
String title;
String routeName;
int? requestGroupId;
String? requestGroupName;
DrawerMenuItem(this.icon, this.title, this.routeName);
DrawerMenuItem(this.icon, this.title, this.routeName, {this.requestGroupId, this.requestGroupName});
}

@ -41,12 +41,21 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
bool isMissingSwipeLoading = true;
int missingSwipeCounter = 0;
bool isMyRequestLoading = true;
ListMenu? myRequest;
//Leave and Ticket Balance
bool isLeaveTicketBalanceLoading = true;
List<GetAccrualBalancesList>? accrualList;
GetAccrualBalancesList? leaveBalanceAccrual;
double get leaveBalance => leaveBalanceAccrual?.accrualNetEntitlement ?? 0;
GetAccrualBalancesList? businessTripAccrual;
double get businessTrip => businessTripAccrual?.accrualNetEntitlement ?? 0;
double ticketBalance = 0;
//Menu Entries
@ -87,12 +96,18 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
isWorkListLoading = true;
workListCounter = 0;
isMyRequestLoading = true;
myRequest = null;
isMissingSwipeLoading = true;
missingSwipeCounter = 0;
isWorkListLoading = true;
isLeaveTicketBalanceLoading = true;
accrualList = null;
leaveBalanceAccrual = null;
businessTripAccrual = null;
ticketBalance = 0;
isServicesMenusLoading = true;
@ -193,7 +208,8 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
try {
accrualList = await DashboardApiClient().getAccrualBalances(DateFormat("MM/dd/yyyy", "en_US").format(date));
isLeaveTicketBalanceLoading = false;
leaveBalanceAccrual = accrualList![0];
leaveBalanceAccrual = accrualList!.singleWhere((element) => element.accuralPlanName == 'Annual Vacation Accrual' || element.accuralPlanName == "خطة استحقاق الاجازة الاعتيادية", orElse: null);
businessTripAccrual = accrualList!.singleWhere((element) => element.accuralPlanName == 'Business Trip Accrual' || element.accuralPlanName == "خطة استحقاق الإنتدابات", orElse: null);
ticketBalance = (accrualList![1].accrualNetEntitlement ?? 0.0) + (accrualList![2].accrualNetEntitlement ?? 0.0) + (accrualList![3].accrualNetEntitlement ?? 0.0);
notifyListeners();
} catch (ex) {
@ -211,17 +227,19 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
void fetchListMenu() async {
try {
List<ListMenu> menuList = await DashboardApiClient().getListMenu();
List findMyRequest = menuList.where((element) => element.menuType == "E").toList();
if (findMyRequest.isNotEmpty) {
drawerMenuItemList.add(DrawerMenuItem("assets/images/drawer/my_requests.svg", LocaleKeys.myRequest.tr(), AppRoutes.myRequests));
}
List findMyTeam = menuList.where((element) => element.menuType == "M").toList();
if (findMyTeam.isNotEmpty) {
AppState().setempStatusIsManager = true;
drawerMenuItemList.add(DrawerMenuItem("assets/images/drawer/my_team.svg", LocaleKeys.myTeamMembers.tr(), AppRoutes.myTeam));
for (var menu in menuList) {
if (menu.menuType == "E") {
myRequest = menu;
} else if (menu.menuType == "M") {
AppState().setempStatusIsManager = true;
drawerMenuItemList.add(DrawerMenuItem("assets/images/drawer/my_team.svg", LocaleKeys.myTeamMembers.tr(), AppRoutes.myTeam));
}
}
isMyRequestLoading = false;
notifyListeners();
} catch (ex) {
logger.wtf(ex);
notifyListeners();
Utils.handleException(ex, null, null);
}
}
@ -250,7 +268,7 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
}
}
void getCategoryOffersListAPI(BuildContext context) async {
void getCategoryOffersListAPI(BuildContext context) async {
try {
// Utils.showLoading(context);
getOffersList = await OffersAndDiscountsApiClient().getOffersList(0, 10);

@ -81,7 +81,7 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
void checkSession() async {
try {
await DashboardApiClient().getOpenMissingSwipes();
await DashboardApiClient().getOpenNotifications();
} catch (ex) {
Utils.handleException(ex, context, null);
}

@ -20,7 +20,7 @@ class MenusWidget extends StatelessWidget {
return Consumer<DashboardProviderModel>(
builder: (cxt, data, child) {
return GridView(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 2 / 2, crossAxisSpacing: 9, mainAxisSpacing: 9),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 1.75, crossAxisSpacing: 9, mainAxisSpacing: 9),
padding: EdgeInsets.zero,
shrinkWrap: true,
primary: false,
@ -53,25 +53,52 @@ class MenusWidget extends StatelessWidget {
).onPress(() {
Navigator.pushNamed(context, AppRoutes.workList);
}),
if(env.dashboard.missingSwipe)
data.isMissingSwipeLoading
if (env.dashboard.missingSwipe)
data.isMissingSwipeLoading
? MenuShimmer().onPress(() {
data.fetchWorkListCounter(context);
})
: Container(
decoration: BoxDecoration(
color: Color(namesColor[1]),
borderRadius: BorderRadius.circular(10),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.missingSwipes.tr().toText12(color: Colors.white),
Row(
children: [
Expanded(
child: data.missingSwipeCounter.toString().toText16(color: Colors.white, isBold: true, maxlines: 1),
),
RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)),
],
)
],
).paddingOnly(left: 10, right: 10, bottom: 6, top: 6),
).onPress(() {
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(LocaleKeys.missingSwipes.tr(), "HMG_OTL_MISSING_SWIPE_EIT_SS"));
}),
data.isLeaveTicketBalanceLoading
? MenuShimmer().onPress(() {
data.fetchWorkListCounter(context);
})
: Container(
decoration: BoxDecoration(
color: Color(namesColor[1]),
color: Color(namesColor[2]),
borderRadius: BorderRadius.circular(10),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.missingSwipes.tr().toText12(color: Colors.white),
LocaleKeys.leaveBalance.tr().toText12(color: Colors.white),
Row(
children: [
Expanded(
child: data.missingSwipeCounter.toString().toText16(color: Colors.white, isBold: true, maxlines: 1),
child: data.leaveBalance.toStringAsFixed(2).toText16(color: Colors.white, isBold: true, maxlines: 1),
),
RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)),
],
@ -79,7 +106,7 @@ class MenusWidget extends StatelessWidget {
],
).paddingOnly(left: 10, right: 10, bottom: 6, top: 6),
).onPress(() {
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(LocaleKeys.missingSwipes.tr(), "HMG_OTL_MISSING_SWIPE_EIT_SS"));
Navigator.pushNamed(context, AppRoutes.leaveBalance);
}),
data.isLeaveTicketBalanceLoading
? MenuShimmer().onPress(() {
@ -94,11 +121,11 @@ class MenusWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.leaveBalance.tr().toText12(color: Colors.white),
LocaleKeys.businessTripBalance.tr().toText12(color: Colors.white),
Row(
children: [
Expanded(
child: data.leaveBalance.toStringAsFixed(2).toText16(color: Colors.white, isBold: true, maxlines: 1),
child: data.businessTrip.toStringAsFixed(2).toText16(color: Colors.white, isBold: true, maxlines: 1),
),
RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)),
],
@ -108,10 +135,39 @@ class MenusWidget extends StatelessWidget {
).onPress(() {
Navigator.pushNamed(context, AppRoutes.leaveBalance);
}),
if(env.dashboard.ticketBalance)
data.isLeaveTicketBalanceLoading
if (env.dashboard.ticketBalance)
data.isLeaveTicketBalanceLoading
? MenuShimmer().onPress(() {
data.fetchWorkListCounter(context);
})
: Container(
decoration: BoxDecoration(
color: Color(namesColor[3]),
borderRadius: BorderRadius.circular(10),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.ticketBalance.tr().toText12(color: Colors.white),
Row(
children: [
Expanded(
child: data.ticketBalance.toStringAsFixed(2).toText16(color: Colors.white, isBold: true, maxlines: 1),
),
RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)),
],
)
],
).paddingOnly(left: 10, right: 10, bottom: 6, top: 6),
).onPress(
() {
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(LocaleKeys.ticketBalance.tr(), "HMG_TKT_NEW_EIT_SS"));
},
),
data.isMyRequestLoading
? MenuShimmer().onPress(() {
data.fetchWorkListCounter(context);
data.fetchListMenu();
})
: Container(
decoration: BoxDecoration(
@ -122,12 +178,13 @@ class MenusWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.ticketBalance.tr().toText12(color: Colors.white),
LocaleKeys.myRequest.tr().toText12(color: Colors.white),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Expanded(
child: data.ticketBalance.toStringAsFixed(2).toText16(color: Colors.white, isBold: true, maxlines: 1),
),
// Expanded(
// child: data.ticketBalance.toStringAsFixed(2).toText16(color: Colors.white, isBold: true, maxlines: 1),
// ),
RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)),
],
)
@ -135,7 +192,7 @@ class MenusWidget extends StatelessWidget {
).paddingOnly(left: 10, right: 10, bottom: 6, top: 6),
).onPress(
() {
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(LocaleKeys.ticketBalance.tr(), "HMG_TKT_NEW_EIT_SS"));
Navigator.pushNamed(context, AppRoutes.myRequests,arguments: data.myRequest!.requestGroupId);
},
)
],

@ -33,21 +33,26 @@ class _MyRequestsState extends State<MyRequests> {
List<GetCCPTransactionsModel> getCCPTransactionsList = [];
int? groupId;
bool isNewRequest = false;
@override
void initState() {
getConcurrentPrograms();
super.initState();
}
@override
Widget build(BuildContext context) {
if (groupId == null) {
groupId = ModalRoute.of(context)!.settings.arguments as int;
getConcurrentPrograms();
}
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBarWidget(
context,
title: LocaleKeys.concurrentReports,
title: LocaleKeys.concurrentReports.tr(),
),
body: Column(
children: [
@ -76,70 +81,72 @@ class _MyRequestsState extends State<MyRequests> {
}),
),
12.height,
getCCPTransactionsList.isNotEmpty ? Expanded(
child: ListView.separated(
physics: const BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (BuildContext context, int index) {
return Container(
width: double.infinity,
padding: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 12),
margin: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
boxShadow: [
BoxShadow(
color: const Color(0xff000000).withOpacity(.05),
blurRadius: 26,
offset: const Offset(0, -3),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
("Request ID: " + getCCPTransactionsList[index].rEQUESTID.toString()).toText12(color: MyColors.grey57Color),
DateUtil.formatDateToDate(DateUtil.convertStringToDate(getCCPTransactionsList[index].rEQUESTDATE!), false).toText12(color: MyColors.grey70Color),
],
),
Container(
padding: const EdgeInsets.only(top: 10.0),
child: ("Phase: " + getCCPTransactionsList[index].cCPPHASE!).toText12(color: MyColors.grey57Color, isBold: true),
),
Container(
padding: const EdgeInsets.only(top: 10.0),
child: "Program Name: ".toText12(color: MyColors.grey57Color, isBold: true),
),
getCCPTransactionsList[index].cONCURRENTPROGRAMNAME!.toText12(color: MyColors.gradiantEndColor),
Container(
padding: const EdgeInsets.only(top: 10.0),
child: InkWell(
onTap: () {
getCCPOutput(getCCPTransactionsList[index].rEQUESTID.toString());
},
child: Row(
children: [
"Output: ".toText12(color: MyColors.grey57Color),
8.width,
"Open PDF".toText12(color: MyColors.grey57Color),
6.width,
const Icon(Icons.launch, size: 16.0),
],
),
getCCPTransactionsList.isNotEmpty
? Expanded(
child: ListView.separated(
physics: const BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (BuildContext context, int index) {
return Container(
width: double.infinity,
padding: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 12),
margin: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
boxShadow: [
BoxShadow(
color: const Color(0xff000000).withOpacity(.05),
blurRadius: 26,
offset: const Offset(0, -3),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
("Request ID: " + getCCPTransactionsList[index].rEQUESTID.toString()).toText12(color: MyColors.grey57Color),
DateUtil.formatDateToDate(DateUtil.convertStringToDate(getCCPTransactionsList[index].rEQUESTDATE!), false).toText12(color: MyColors.grey70Color),
],
),
Container(
padding: const EdgeInsets.only(top: 10.0),
child: ("Phase: " + getCCPTransactionsList[index].cCPPHASE!).toText12(color: MyColors.grey57Color, isBold: true),
),
Container(
padding: const EdgeInsets.only(top: 10.0),
child: "Program Name: ".toText12(color: MyColors.grey57Color, isBold: true),
),
getCCPTransactionsList[index].cONCURRENTPROGRAMNAME!.toText12(color: MyColors.gradiantEndColor),
Container(
padding: const EdgeInsets.only(top: 10.0),
child: InkWell(
onTap: () {
getCCPOutput(getCCPTransactionsList[index].rEQUESTID.toString());
},
child: Row(
children: [
"Output: ".toText12(color: MyColors.grey57Color),
8.width,
"Open PDF".toText12(color: MyColors.grey57Color),
6.width,
const Icon(Icons.launch, size: 16.0),
],
),
),
),
],
),
),
],
),
);
},
separatorBuilder: (BuildContext context, int index) => 12.height,
itemCount: getCCPTransactionsList.length),
) : Container(),
);
},
separatorBuilder: (BuildContext context, int index) => 12.height,
itemCount: getCCPTransactionsList.length),
)
: Container(),
],
).expanded,
1.divider,
@ -160,7 +167,7 @@ class _MyRequestsState extends State<MyRequests> {
void getConcurrentPrograms() async {
try {
Utils.showLoading(context);
getConcurrentProgramsList = await MyRequestsApiClient().getConcurrentPrograms();
getConcurrentProgramsList = await MyRequestsApiClient().getConcurrentPrograms(groupId!);
Utils.hideLoading(context);
setState(() {});
} catch (ex) {

@ -34,20 +34,25 @@ class _NewRequestState extends State<NewRequest> {
List<GetEITDFFStructureList>? getCCPDFFStructureModelList;
DateTime selectedDate = DateTime.now();
int? groupId;
@override
void initState() {
getConcurrentPrograms();
super.initState();
}
@override
Widget build(BuildContext context) {
if (groupId == null) {
groupId = ModalRoute.of(context)!.settings.arguments as int;
getConcurrentPrograms();
}
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBarWidget(
context,
title: LocaleKeys.concurrentReports,
title: LocaleKeys.concurrentReports.tr(),
),
body: Column(
children: [
@ -135,7 +140,7 @@ class _NewRequestState extends State<NewRequest> {
void getConcurrentPrograms() async {
try {
Utils.showLoading(context);
getConcurrentProgramsList = await MyRequestsApiClient().getConcurrentPrograms();
getConcurrentProgramsList = await MyRequestsApiClient().getConcurrentPrograms(groupId!);
Utils.hideLoading(context);
setState(() {});
} catch (ex) {
@ -215,13 +220,15 @@ class _NewRequestState extends State<NewRequest> {
pIDCOLUMNNAME: DateFormat('yyyy/MM/dd HH:MM:SS', "en_US").format(date1),
pRETURNMSG: "null",
pRETURNSTATUS: getCCPDFFStructureModelList![index].dEFAULTVALUE,
pVALUECOLUMNNAME: getCCPDFFStructureModelList![index].isDefaultTypeIsCDPS ? DateFormat('yyyy/MM/dd HH:MM:SS', "en_US").format(date) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date));
pVALUECOLUMNNAME:
getCCPDFFStructureModelList![index].isDefaultTypeIsCDPS ? DateFormat('yyyy/MM/dd HH:MM:SS', "en_US").format(date) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date));
} else {
eservicesdv = ESERVICESDV(
pIDCOLUMNNAME: DateFormat('yyyy-MM-dd', "en_US").format(date1),
pRETURNMSG: "null",
pRETURNSTATUS: getCCPDFFStructureModelList![index].dEFAULTVALUE,
pVALUECOLUMNNAME: getCCPDFFStructureModelList![index].isDefaultTypeIsCDPS ? DateFormat('yyyy-MM-dd hh:mm:ss', "en_US").format(date) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date));
pVALUECOLUMNNAME:
getCCPDFFStructureModelList![index].isDefaultTypeIsCDPS ? DateFormat('yyyy-MM-dd hh:mm:ss', "en_US").format(date) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date));
}
getCCPDFFStructureModelList![index].eSERVICESDV = eservicesdv;
setState(() {});

Loading…
Cancel
Save