Merge branch 'master' into development_aamir

merge-requests/41/head
Aamir Muhammad 3 years ago
commit 636d6935bc

@ -419,6 +419,8 @@
"adult": "بالغ", "adult": "بالغ",
"updateMember": "هل انت متأكد تريد تحديث بيانات هذا العضو؟", "updateMember": "هل انت متأكد تريد تحديث بيانات هذا العضو؟",
"fieldIsEmpty": "'{data}' الحقل فارغ. الرجاء التحديد", "fieldIsEmpty": "'{data}' الحقل فارغ. الرجاء التحديد",
"pleaseEnterComments": "الرجاء إدخال التعليقات",
"skip": "يتخطى",
"profile": { "profile": {
"reset_password": { "reset_password": {
"label": "Reset Password", "label": "Reset Password",

@ -419,6 +419,8 @@
"adult": "Adult", "adult": "Adult",
"updateMember": "Are You Sure You Want to Update this Member?", "updateMember": "Are You Sure You Want to Update this Member?",
"fieldIsEmpty": "'{data}' Field is empty. Please select", "fieldIsEmpty": "'{data}' Field is empty. Please select",
"pleaseEnterComments": "Please enter comments",
"skip": "skip",
"profile": { "profile": {
"reset_password": { "reset_password": {
"label": "Reset Password", "label": "Reset Password",

@ -73,6 +73,8 @@ class AppState {
bool isArabic(context) => EasyLocalization.of(context)?.locale.languageCode == "ar"; bool isArabic(context) => EasyLocalization.of(context)?.locale.languageCode == "ar";
int getLanguageID(context) => EasyLocalization.of(context)?.locale.languageCode == "ar" ? 1 : 2;
String? _username; String? _username;
// todo ''sikander' added password for now, later will remove & improve // todo ''sikander' added password for now, later will remove & improve

@ -420,6 +420,8 @@ abstract class LocaleKeys {
static const adult = 'adult'; static const adult = 'adult';
static const updateMember = 'updateMember'; static const updateMember = 'updateMember';
static const fieldIsEmpty = 'fieldIsEmpty'; static const fieldIsEmpty = 'fieldIsEmpty';
static const pleaseEnterComments = 'pleaseEnterComments';
static const skip = 'skip';
static const profile_reset_password_label = 'profile.reset_password.label'; static const profile_reset_password_label = 'profile.reset_password.label';
static const profile_reset_password_username = 'profile.reset_password.username'; static const profile_reset_password_username = 'profile.reset_password.username';
static const profile_reset_password_password = 'profile.reset_password.password'; static const profile_reset_password_password = 'profile.reset_password.password';

@ -1,3 +1,5 @@
import 'package:mohem_flutter_app/app_state/app_state.dart';
class PostParamsModel { class PostParamsModel {
double? versionID; double? versionID;
int? channel; int? channel;

@ -169,11 +169,14 @@ class _DashboardScreenState extends State<DashboardScreen> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
9.height, 9.height,
CountdownTimer( Directionality(
endTime: model.endTime, textDirection: TextDirection.ltr,
onEnd: null, child: CountdownTimer(
endWidget: "00:00:00".toText14(color: Colors.white, isBold: true), endTime: model.endTime,
textStyle: const TextStyle(color: Colors.white, fontSize: 14, letterSpacing: -0.48, fontWeight: FontWeight.bold), onEnd: null,
endWidget: "00:00:00".toText14(color: Colors.white, isBold: true),
textStyle: const TextStyle(color: Colors.white, fontSize: 14, letterSpacing: -0.48, fontWeight: FontWeight.bold),
),
), ),
LocaleKeys.timeLeftToday.tr().toText12(color: Colors.white), LocaleKeys.timeLeftToday.tr().toText12(color: Colors.white),
9.height, 9.height,
@ -206,16 +209,18 @@ class _DashboardScreenState extends State<DashboardScreen> {
.toText14(color: Colors.white, isBold: true), .toText14(color: Colors.white, isBold: true),
4.height, 4.height,
], ],
).paddingOnly(left: 12), ).paddingOnly(left: 12, right: 12),
), ),
Container( Container(
margin: EdgeInsets.only(top: AppState().isArabic(context) ? 6 : 0),
width: 45, width: 45,
height: 45, height: 45,
padding: const EdgeInsets.only(left: 14, right: 14), padding: const EdgeInsets.only(left: 14, right: 14),
decoration: const BoxDecoration( decoration: BoxDecoration(
color: Color(0xff259EA4), color: Color(0xff259EA4),
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
bottomRight: Radius.circular(15), bottomRight: AppState().isArabic(context) ? Radius.circular(0) : Radius.circular(15),
bottomLeft: AppState().isArabic(context) ? Radius.circular(15) : Radius.circular(0),
), ),
), ),
child: SvgPicture.asset(model.isTimeRemainingInSeconds == 0 ? "assets/images/play.svg" : "assets/images/stop.svg"), child: SvgPicture.asset(model.isTimeRemainingInSeconds == 0 ? "assets/images/play.svg" : "assets/images/stop.svg"),
@ -257,7 +262,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
border: Border.all(color: MyColors.lightGreyEDColor, width: 1), border: Border.all(color: MyColors.lightGreyEDColor, width: 1),
), ),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
@ -360,7 +365,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
], ],
), ),
drawer: SafeArea( drawer: SafeArea(
child: AppDrawer(), child: AppDrawer(onLanguageChange: _onRefresh),
), ),
bottomNavigationBar: SizedBox( bottomNavigationBar: SizedBox(
height: Platform.isAndroid ? 70 : 100, height: Platform.isAndroid ? 70 : 100,

@ -18,6 +18,10 @@ import 'package:mohem_flutter_app/widgets/dialogs/dialogs.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class AppDrawer extends StatefulWidget { class AppDrawer extends StatefulWidget {
final Function onLanguageChange;
AppDrawer({required this.onLanguageChange});
@override @override
_AppDrawerState createState() => _AppDrawerState(); _AppDrawerState createState() => _AppDrawerState();
} }
@ -65,6 +69,28 @@ class _AppDrawerState extends State<AppDrawer> {
).expanded ).expanded
], ],
).paddingOnly(left: 14, right: 14, top: 21, bottom: 21), ).paddingOnly(left: 14, right: 14, top: 21, bottom: 21),
Row(
children: [
Row(
children: [
LocaleKeys.english.tr().toText14(color: AppState().isArabic(context) ? null : MyColors.textMixColor).onPress(() {
context.setLocale(const Locale("en", "US"));
postLanguageChange(context);
}),
Container(
width: 1,
color: MyColors.darkWhiteColor,
height: 16,
margin: const EdgeInsets.only(left: 10, right: 10),
),
LocaleKeys.arabic.tr().toText14(color: !AppState().isArabic(context) ? null : MyColors.textMixColor).onPress(() {
context.setLocale(const Locale("ar", "SA"));
postLanguageChange(context);
}),
],
),
],
).paddingOnly(left: 14, right: 14, bottom: 14),
const Divider( const Divider(
height: 1, height: 1,
thickness: 1, thickness: 1,
@ -132,6 +158,14 @@ class _AppDrawerState extends State<AppDrawer> {
: onPress!); : onPress!);
} }
void postLanguageChange(BuildContext context) {
var obj = AppState().postParamsObject;
obj?.languageID = EasyLocalization.of(context)?.locale.languageCode == "ar" ? 1 : 2;
AppState().setPostParamsModel(obj!);
Navigator.pop(context);
widget.onLanguageChange();
}
void performLogout() async { void performLogout() async {
AppState().isAuthenticated = false; AppState().isAuthenticated = false;
AppState().isLogged = false; AppState().isLogged = false;

@ -49,7 +49,6 @@ class ServicesWidget extends StatelessWidget {
padding: const EdgeInsets.only(left: 21, right: 21, top: 13, bottom: 13), padding: const EdgeInsets.only(left: 21, right: 21, top: 13, bottom: 13),
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
itemBuilder: (cxt, index) { itemBuilder: (cxt, index) {
return AspectRatio( return AspectRatio(
aspectRatio: 105 / 105, aspectRatio: 105 / 105,
child: data.isServicesMenusLoading child: data.isServicesMenusLoading
@ -77,11 +76,7 @@ class ServicesWidget extends StatelessWidget {
Expanded( Expanded(
child: data.homeMenus![parentIndex].menuEntiesList[index].prompt!.toText10(isBold: true), child: data.homeMenus![parentIndex].menuEntiesList[index].prompt!.toText10(isBold: true),
), ),
RotatedBox( RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg").paddingOnly(bottom: 4)),
quarterTurns: AppState().isArabic(context) ? 2:4,
child: SvgPicture.asset("assets/images/arrow_next.svg").paddingOnly(bottom: 4)
),
], ],
) )
], ],
@ -119,7 +114,7 @@ class ServicesWidget extends StatelessWidget {
Navigator.of(context).pushNamed(AppRoutes.profile); Navigator.of(context).pushNamed(AppRoutes.profile);
return; return;
} }
List<GetMenuEntriesList> menuList = pro.getMenuEntriesList?.where((element) => element.parentMenuName == menuEntry.menuName && (element.menuEntryType == "FUNCTION" || element.menuEntryType == "MENU")).toList() ?? []; List<GetMenuEntriesList> menuList = pro.getMenuEntriesList?.where((element) => element.parentMenuName == menuEntry.menuName && (element.menuEntryType == "FUNCTION")).toList() ?? [];
menuEntry.icon = ""; menuEntry.icon = "";
if (menuList.isEmpty) { if (menuList.isEmpty) {
if (menuEntry.requestType == "EIT") { if (menuEntry.requestType == "EIT") {
@ -128,7 +123,9 @@ class ServicesWidget extends StatelessWidget {
Navigator.pushNamed(context, AppRoutes.monthlyPaySlip); Navigator.pushNamed(context, AppRoutes.monthlyPaySlip);
} }
} else { } else {
Navigator.pushNamed(context, AppRoutes.servicesMenuListScreen, arguments: ServicesMenuListScreenParams(menuEntry.prompt!, menuList)); List<GetMenuEntriesList> _menuList =
pro.getMenuEntriesList?.where((element) => element.parentMenuName == menuEntry.menuName && (element.menuEntryType == "FUNCTION" || element.menuEntryType == "MENU")).toList() ?? [];
Navigator.pushNamed(context, AppRoutes.servicesMenuListScreen, arguments: ServicesMenuListScreenParams(menuEntry.prompt!, _menuList.isEmpty ? menuList : _menuList));
} }
return; return;
} }

@ -175,7 +175,7 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
12.height, 12.height,
DynamicTextFieldWidget( DynamicTextFieldWidget(
LocaleKeys.startDateT.tr() + "*", LocaleKeys.startDateT.tr() + "*",
startDateTime == null ? "Select date" : startDateTime.toString().split(' ')[0], startDateTime == null ? LocaleKeys.pleaseSelectDate.tr() : startDateTime.toString().split(' ')[0],
suffixIconData: Icons.calendar_today, suffixIconData: Icons.calendar_today,
isEnable: false, isEnable: false,
onTap: () async { onTap: () async {
@ -189,7 +189,7 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
12.height, 12.height,
DynamicTextFieldWidget( DynamicTextFieldWidget(
LocaleKeys.endDateT.tr() + "*", LocaleKeys.endDateT.tr() + "*",
endDateTime == null ? "Select date" : endDateTime.toString().split(' ')[0], endDateTime == null ? LocaleKeys.pleaseSelectDate.tr() : endDateTime.toString().split(' ')[0],
suffixIconData: Icons.calendar_today, suffixIconData: Icons.calendar_today,
isEnable: false, isEnable: false,
isReadOnly: selectedAbsenceType == null || startDateTime == null, isReadOnly: selectedAbsenceType == null || startDateTime == null,
@ -206,7 +206,7 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
12.height, 12.height,
DynamicTextFieldWidget( DynamicTextFieldWidget(
LocaleKeys.totalDays.tr(), LocaleKeys.totalDays.tr(),
totalDays?.toString() ?? "Calculated days", totalDays?.toString() ?? LocaleKeys.calculatedDays.tr(),
isInputTypeNum: true, isInputTypeNum: true,
isEnable: false, isEnable: false,
onChange: (input) { onChange: (input) {

@ -73,7 +73,7 @@ class _EmployeeDetailsState extends State<EmployeeDetails> {
Container( Container(
height: 200, height: 200,
margin: EdgeInsets.only(top: 30), margin: EdgeInsets.only(top: 30),
decoration: BoxDecoration(image: DecorationImage(image: MemoryImage(Utils.getPostBytes(getEmployeeSubordinates!.eMPLOYEEIMAGE)), fit: BoxFit.cover)), decoration: BoxDecoration(image: DecorationImage(image: MemoryImage(Utils.dataFromBase64String(getEmployeeSubordinates!.eMPLOYEEIMAGE!)), fit: BoxFit.cover)),
child: new BackdropFilter( child: new BackdropFilter(
filter: new ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0), filter: new ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0),
child: new Container( child: new Container(

@ -141,7 +141,7 @@ class _MyTeamState extends State<MyTeam> {
width: 34, width: 34,
child: CircleAvatar( child: CircleAvatar(
radius: 25, radius: 25,
backgroundImage: MemoryImage(Utils.getPostBytes(getEmployeeSListOnSearch[index].eMPLOYEEIMAGE)), backgroundImage: MemoryImage(Utils.dataFromBase64String(getEmployeeSListOnSearch[index].eMPLOYEEIMAGE!)),
backgroundColor: Colors.black, backgroundColor: Colors.black,
).paddingOnly(top: 4), ).paddingOnly(top: 4),
), ),

@ -85,7 +85,7 @@ class _TeamMembersState extends State<TeamMembers> {
width: 34, width: 34,
child: CircleAvatar( child: CircleAvatar(
radius: 25, radius: 25,
backgroundImage: MemoryImage(Utils.getPostBytes(getEmployeeSubordinatesList[index].eMPLOYEEIMAGE)), backgroundImage: MemoryImage(Utils.dataFromBase64String(getEmployeeSubordinatesList[index].eMPLOYEEIMAGE!)),
backgroundColor: Colors.black, backgroundColor: Colors.black,
).paddingOnly(top: 4), ).paddingOnly(top: 4),
), ),

@ -50,7 +50,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: MemoryImage( image: MemoryImage(
Utils.getPostBytes(memberInformationList.eMPLOYEEIMAGE), Utils.dataFromBase64String(memberInformationList.eMPLOYEEIMAGE!),
), ),
fit: BoxFit.cover), fit: BoxFit.cover),
), ),

@ -49,7 +49,7 @@ class ProfilePanel extends StatelessWidget {
width: 68,) width: 68,)
: CircleAvatar( : CircleAvatar(
radius: 68, radius: 68,
backgroundImage: MemoryImage(Utils.getPostBytes(memberInformationList.eMPLOYEEIMAGE)), backgroundImage: MemoryImage(Utils.dataFromBase64String(memberInformationList.eMPLOYEEIMAGE!)),
backgroundColor: Colors.black, backgroundColor: Colors.black,
); );
} }

@ -203,7 +203,7 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
myFab("Skip", "assets/images/skip.svg").onPress(() { myFab(LocaleKeys.pleaseEnterComments.tr(), "assets/images/skip.svg").onPress(() {
if (AppState().requestAllList!.length - 1 > AppState().itgWorkListIndex!) { if (AppState().requestAllList!.length - 1 > AppState().itgWorkListIndex!) {
AppState().itgWorkListIndex = AppState().itgWorkListIndex! + 1; AppState().itgWorkListIndex = AppState().itgWorkListIndex! + 1;
requestDetails = null; requestDetails = null;
@ -356,7 +356,18 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
ITGRequest? itgRequest = await WorkListApiClient().rejectITGRequest(requestType, taskId, itemId, employeeNumber, comments); ITGRequest? itgRequest = await WorkListApiClient().rejectITGRequest(requestType, taskId, itemId, employeeNumber, comments);
Utils.hideLoading(context); Utils.hideLoading(context);
Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr()); Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr());
Navigator.pop(context, "delegate_reload"); // Navigator.pop(context, "delegate_reload");
AppState().workList!.removeAt(AppState().workListIndex!);
if (AppState().workList!.isEmpty) {
Navigator.pop(context, "delegate_reload");
} else {
if (AppState().workList!.length <= AppState().workListIndex!) {
Navigator.pop(context, "delegate_reload");
} else {
requestDetails = null;
getDataFromState();
}
}
} catch (ex) { } catch (ex) {
Utils.hideLoading(context); Utils.hideLoading(context);
Utils.handleException(ex, context, null); Utils.handleException(ex, context, null);
@ -369,7 +380,18 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
ITGRequest? itgRequest = await WorkListApiClient().approveITGRequest(requestType, taskId, itemId, employeeNumber, comments); ITGRequest? itgRequest = await WorkListApiClient().approveITGRequest(requestType, taskId, itemId, employeeNumber, comments);
Utils.hideLoading(context); Utils.hideLoading(context);
Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr()); Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr());
Navigator.pop(context, "delegate_reload"); // Navigator.pop(context, "delegate_reload");
AppState().workList!.removeAt(AppState().workListIndex!);
if (AppState().workList!.isEmpty) {
Navigator.pop(context, "delegate_reload");
} else {
if (AppState().workList!.length <= AppState().workListIndex!) {
Navigator.pop(context, "delegate_reload");
} else {
requestDetails = null;
getDataFromState();
}
}
} catch (ex) { } catch (ex) {
Utils.hideLoading(context); Utils.hideLoading(context);
Utils.handleException(ex, context, null); Utils.handleException(ex, context, null);

@ -442,6 +442,8 @@ class _WorkListScreenState extends State<WorkListScreen> {
calculateCounter(); calculateCounter();
if (mounted) setState(() {}); if (mounted) setState(() {});
} }
} else {
if (mounted) setState(() {});
} }
}, },
child: Container( child: Container(

@ -93,95 +93,77 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
} }
void getData() async { void getData() async {
try { // try {
Utils.showLoading(context); // Utils.showLoading(context);
if (workListData!.iTEMTYPE == "HRSSA" || workListData!.iTEMTYPE == "STAMP") { if (workListData!.iTEMTYPE == "HRSSA" || workListData!.iTEMTYPE == "STAMP") {
memberInformationListModel = await WorkListApiClient().getUserInformation(-999, workListData!.sELECTEDEMPLOYEENUMBER!); getUserInformation();
} }
if (workListData!.iTEMTYPE == "HRSSA") { if (workListData!.iTEMTYPE == "HRSSA") {
if (workListData!.rEQUESTTYPE == "EIT") { if (workListData!.rEQUESTTYPE == "EIT") {
getEitCollectionNotificationBodyList = await WorkListApiClient().GetEitNotificationBody(workListData!.nOTIFICATIONID); getEitNotificationBody();
} else if (workListData!.rEQUESTTYPE == "PHONE_NUMBERS") { } else if (workListData!.rEQUESTTYPE == "PHONE_NUMBERS") {
getPhonesNotificationBodyList = await WorkListApiClient().getPhonesNotificationBodyList(workListData!.nOTIFICATIONID); getPhonesNotificationBody();
} else if (workListData!.rEQUESTTYPE == "BASIC_DETAILS") { } else if (workListData!.rEQUESTTYPE == "BASIC_DETAILS") {
getBasicDetNtfBodyList = await WorkListApiClient().getBasicDetNtfBodyList(workListData!.nOTIFICATIONID); getBasicDetNtfBody();
} else if (workListData!.rEQUESTTYPE == "ABSENCE") { } else if (workListData!.rEQUESTTYPE == "ABSENCE") {
getAbsenceCollectionNotificationBodyList = await WorkListApiClient().getAbsenceNotificationBody(workListData!.nOTIFICATIONID); getAbsenceNotificationBody();
} else if (workListData!.rEQUESTTYPE == "CONTACT") { } else if (workListData!.rEQUESTTYPE == "CONTACT") {
getContactNotificationBodyList = await WorkListApiClient().getContactNotificationBodyList(workListData!.nOTIFICATIONID); getContactNotificationBody();
}
// getBasicNTFBody = await WorkListApiClient().getBasicDetNTFBody(workListData!.nOTIFICATIONID!, -999);
// getAbsenceCollectionNotifications = await WorkListApiClient().getAbsenceNotificationBody(workListData!.nOTIFICATIONID!, -999);
// subordinatesLeavesModel = await WorkListApiClient().getSubordinatesLeaves("", "");
}
if (workListData!.iTEMTYPE == "STAMP") {
if (workListData!.rEQUESTTYPE == "STAMP_MS") {
getStampMsNotifications = await WorkListApiClient().getStampMsNotificationBody(workListData!.nOTIFICATIONID!, -999);
} else {
getStampNsNotifications = await WorkListApiClient().getStampNsNotificationBody(workListData!.nOTIFICATIONID!, -999);
}
}
if (workListData!.iTEMTYPE == "INVMOA") {
getMoNotificationBodyList = await WorkListApiClient().getMoNotificationBody(workListData!.nOTIFICATIONID!, -999);
}
if (workListData!.iTEMTYPE == "INVITEM") {
getItemCreationNtfBody = await WorkListApiClient().getItemCreationNtfBody(workListData!.nOTIFICATIONID!, -999);
}
if (workListData!.iTEMTYPE == "POAPPRV") {
getPoNotificationBody = await WorkListApiClient().getPoNotificationBody(workListData!.nOTIFICATIONID!, -999);
}
if (workListData!.iTEMTYPE == "REQAPPRV") {
getPrNotificationBody = await WorkListApiClient().getPRNotificationBody(workListData!.nOTIFICATIONID!, -999);
}
getNotificationRespondAttributes = await WorkListApiClient().notificationGetRespondAttributes(workListData!.nOTIFICATIONID!);
if (getNotificationRespondAttributes.isNotEmpty) {
notificationNoteInput = getNotificationRespondAttributes.first;
} }
// getBasicNTFBody = await WorkListApiClient().getBasicDetNTFBody(workListData!.nOTIFICATIONID!, -999);
// getAbsenceCollectionNotifications = await WorkListApiClient().getAbsenceNotificationBody(workListData!.nOTIFICATIONID!, -999);
// subordinatesLeavesModel = await WorkListApiClient().getSubordinatesLeaves("", "");
}
if (workListData!.iTEMTYPE == "STAMP") {
getStampNotificationBody();
}
if (workListData!.iTEMTYPE == "INVMOA") {
getMoNotificationBody();
}
if (workListData!.iTEMTYPE == "INVITEM") {
getItemCreationNtf();
}
if (workListData!.iTEMTYPE == "POAPPRV") {
getPoNotification();
}
if (workListData!.iTEMTYPE == "REQAPPRV") {
getPRNotification();
}
List dataToFetch = await Future.wait([ notificationGetRespondAttributes();
WorkListApiClient().getNotificationButtons(workListData!.nOTIFICATIONID!),
WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!),
WorkListApiClient().getAttachments(workListData!.nOTIFICATIONID!),
]);
notificationButtonsList = dataToFetch[0];
actionHistoryList = dataToFetch[1];
getAttachmentList = dataToFetch[2];
// List<Future> futureRequest = []; // List dataToFetch = await Future.wait([
// List<Object> futureObject = []; //
// // WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!),
// addRequestInFuture(notificationButtonsList, WorkListApiClient().getNotificationButtons(workListData!.nOTIFICATIONID!)); // WorkListApiClient().getAttachments(workListData!.nOTIFICATIONID!),
// addRequestInFuture(actionHistoryList, WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!)); // ]);
// addRequestInFuture(getAttachmentList, WorkListApiClient().getAttachments(workListData!.nOTIFICATIONID!)); //
// notificationButtonsList = dataToFetch[0];
// actionHistoryList = dataToFetch[1];
// getAttachmentList = dataToFetch[2];
// List dataToFetch = await Future.wait(futureRequest); getNotificationButtons();
// for(int i=0;i<dataToFetch.length;i++) { getActionHistory();
// futureObject[i] = dataToFetch[i]; getAttachments();
// }
if (notificationButtonsList.isNotEmpty) { // if (notificationButtonsList.isNotEmpty) {
isCloseAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "CLOSE"); // isCloseAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "CLOSE");
isApproveAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "APPROVED"); // isApproveAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "APPROVED");
isRejectAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "REJECTED"); // isRejectAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "REJECTED");
} // }
Utils.hideLoading(context); // Utils.hideLoading(context);
setState(() {}); // setState(() {});
} catch (ex) { // } catch (ex) {
Utils.hideLoading(context); // Utils.hideLoading(context);
Utils.handleException(ex, context, null); // Utils.handleException(ex, context, null);
setState(() {}); // setState(() {});
} // }
} }
List<Future> futureRequest = []; List<Future> futureRequest = [];
List<Object> futureObject = []; List<Object> futureObject = [];
void addRequestInFuture(data, request) { int apiCallCount = 0;
futureObject.add(data);
futureRequest.add(request);
}
void getDataFromState() { void getDataFromState() {
if (workListData == null) { if (workListData == null) {
@ -325,7 +307,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
myFab("Skip", "assets/images/skip.svg").onPress(() { myFab(LocaleKeys.pleaseEnterComments.tr(), "assets/images/skip.svg").onPress(() {
if (AppState().workList!.length - 1 > AppState().workListIndex!) { if (AppState().workList!.length - 1 > AppState().workListIndex!) {
AppState().setWorkListIndex = AppState().workListIndex! + 1; AppState().setWorkListIndex = AppState().workListIndex! + 1;
workListData = null; workListData = null;
@ -489,9 +471,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
child: isIconAsset child: isIconAsset
? SvgPicture.asset(icon) ? SvgPicture.asset(icon)
: Image.memory( : Image.memory(
Utils.dataFromBase64String( Utils.dataFromBase64String(icon),
icon,
),
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
) )
@ -501,6 +481,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
void performAction(String actionMode) { void performAction(String actionMode) {
TextEditingController textEditingController = TextEditingController(); TextEditingController textEditingController = TextEditingController();
print("actionMode:$actionMode");
showDialog( showDialog(
context: context, context: context,
builder: (cxt) => AcceptRejectInputDialog( builder: (cxt) => AcceptRejectInputDialog(
@ -508,24 +489,26 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
notificationGetRespond: notificationNoteInput, notificationGetRespond: notificationNoteInput,
textEditingController: textEditingController, textEditingController: textEditingController,
onTap: (note) { onTap: (note) {
if(note.isNotEmpty && (actionMode == "APPROVED" || actionMode == "APPROVE")) { Map<String, dynamic> payload = {
Map<String, dynamic> payload = { "P_ACTION_MODE": actionMode,
"P_ACTION_MODE": actionMode, "P_APPROVER_INDEX": null,
"P_APPROVER_INDEX": null, "P_COMMENTS": note,
"P_COMMENTS": note, "P_FORWARD_TO_USER_NAME": "",
"P_FORWARD_TO_USER_NAME": "", "P_NOTIFICATION_ID": workListData!.nOTIFICATIONID,
"P_NOTIFICATION_ID": workListData!.nOTIFICATIONID, "RespondAttributeList": [
"RespondAttributeList": [ if (notificationNoteInput != null)
if (notificationNoteInput != null) {
{ "ATTRIBUTE_NAME": notificationNoteInput!.attributeName,
"ATTRIBUTE_NAME": notificationNoteInput!.attributeName, if (notificationNoteInput!.attributeType == "number") "ATTRIBUTE_NUMBER_VALUE": note else if (notificationNoteInput!.attributeType == "VARCHAR2") "ATTRIBUTE_TEXT_VALUE": note
if (notificationNoteInput!.attributeType == "number") "ATTRIBUTE_NUMBER_VALUE": note else if (notificationNoteInput!.attributeType == "VARCHAR2") "ATTRIBUTE_TEXT_VALUE": note }
} ],
], };
}; if (actionMode == "APPROVED" || actionMode == "APPROVE") {
performNotificationAction(payload);
} else if (note.isNotEmpty && (actionMode != "APPROVED" || actionMode != "APPROVE")) {
performNotificationAction(payload); performNotificationAction(payload);
} else { } else {
Utils.showToast("Please enter comments"); Utils.showToast(LocaleKeys.pleaseEnterComments.tr());
} }
}, },
), ),
@ -538,10 +521,287 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
GenericResponseModel model = await WorkListApiClient().postNotificationActions(payload); GenericResponseModel model = await WorkListApiClient().postNotificationActions(payload);
Utils.hideLoading(context); Utils.hideLoading(context);
Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr()); Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr());
Navigator.pop(context, true); AppState().workList!.removeAt(AppState().workListIndex!);
if (AppState().workList!.isEmpty) {
Navigator.pop(context, "delegate_reload");
} else {
if (AppState().workList!.length <= AppState().workListIndex!) {
Navigator.pop(context, "delegate_reload");
} else {
workListData = null;
getDataFromState();
}
}
} catch (ex) { } catch (ex) {
Utils.hideLoading(context); Utils.hideLoading(context);
Utils.handleException(ex, context, null); Utils.handleException(ex, context, null);
} }
} }
void getEitNotificationBody() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getEitCollectionNotificationBodyList = await WorkListApiClient().GetEitNotificationBody(workListData!.nOTIFICATIONID);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
}
} catch (ex) {
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void getUserInformation() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
memberInformationListModel = await WorkListApiClient().getUserInformation(-999, workListData!.sELECTEDEMPLOYEENUMBER!);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
}
} catch (ex) {
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void getPhonesNotificationBody() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getPhonesNotificationBodyList = await WorkListApiClient().getPhonesNotificationBodyList(workListData!.nOTIFICATIONID);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
}
} catch (ex) {
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void getBasicDetNtfBody() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getBasicDetNtfBodyList = await WorkListApiClient().getBasicDetNtfBodyList(workListData!.nOTIFICATIONID);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
}
} catch (ex) {
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void getAbsenceNotificationBody() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getAbsenceCollectionNotificationBodyList = await WorkListApiClient().getAbsenceNotificationBody(workListData!.nOTIFICATIONID);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
}
} catch (ex) {
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void getContactNotificationBody() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getContactNotificationBodyList = await WorkListApiClient().getContactNotificationBodyList(workListData!.nOTIFICATIONID);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
}
} catch (ex) {
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void getStampNotificationBody() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
if (workListData!.rEQUESTTYPE == "STAMP_MS") {
getStampMsNotifications = await WorkListApiClient().getStampMsNotificationBody(workListData!.nOTIFICATIONID!, -999);
} else {
getStampNsNotifications = await WorkListApiClient().getStampNsNotificationBody(workListData!.nOTIFICATIONID!, -999);
}
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
}
} catch (ex) {
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void getMoNotificationBody() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getMoNotificationBodyList = await WorkListApiClient().getMoNotificationBody(workListData!.nOTIFICATIONID!, -999);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
}
} catch (ex) {
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void getItemCreationNtf() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getItemCreationNtfBody = await WorkListApiClient().getItemCreationNtfBody(workListData!.nOTIFICATIONID!, -999);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
}
} catch (ex) {
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void getPoNotification() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getPoNotificationBody = await WorkListApiClient().getPoNotificationBody(workListData!.nOTIFICATIONID!, -999);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
}
} catch (ex) {
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void getPRNotification() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getPrNotificationBody = await WorkListApiClient().getPRNotificationBody(workListData!.nOTIFICATIONID!, -999);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
}
} catch (ex) {
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void notificationGetRespondAttributes() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getNotificationRespondAttributes = await WorkListApiClient().notificationGetRespondAttributes(workListData!.nOTIFICATIONID!);
if (getNotificationRespondAttributes.isNotEmpty) {
notificationNoteInput = getNotificationRespondAttributes.first;
}
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
}
} catch (ex) {
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void getNotificationButtons() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
notificationButtonsList = await WorkListApiClient().getNotificationButtons(workListData!.nOTIFICATIONID!);
if (notificationButtonsList.isNotEmpty) {
isCloseAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "CLOSE");
isApproveAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "APPROVED");
isRejectAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "REJECTED");
}
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
}
} catch (ex) {
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void getActionHistory() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
actionHistoryList = await WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
}
} catch (ex) {
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void getAttachments() async {
try {
// if (apiCallCount == 0) Utils.showLoading(context);
// apiCallCount++;
getAttachmentList = await WorkListApiClient().getAttachments(workListData!.nOTIFICATIONID!);
// apiCallCount--;
// if (apiCallCount == 0) {
// Utils.hideLoading(context);
setState(() {});
// }
} catch (ex) {
// apiCallCount--;
// Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
} }

@ -85,7 +85,8 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
padding: const EdgeInsets.only(bottom: 14, top: 21), padding: const EdgeInsets.only(bottom: 14, top: 21),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 1 / 1, crossAxisSpacing: 8, mainAxisSpacing: 8), gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: (MediaQuery.of(context).size.width < 400) ? 3 : 5, childAspectRatio: 1 / 1, crossAxisSpacing: 8, mainAxisSpacing: 8),
children: <Widget>[ children: <Widget>[
// if (isNfcEnabled) // if (isNfcEnabled)
attendanceMethod("NFC", "assets/images/nfc.svg", isNfcEnabled, () { attendanceMethod("NFC", "assets/images/nfc.svg", isNfcEnabled, () {
@ -238,7 +239,7 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SvgPicture.asset(image, color: Colors.white).expanded, SvgPicture.asset(image, color: Colors.white, alignment: Alignment.topLeft).expanded,
title.toText17(isBold: true, color: Colors.white), title.toText17(isBold: true, color: Colors.white),
], ],
), ),

Loading…
Cancel
Save