Merge branch 'master' into development_aamir

fatima
Aamir Muhammad 3 years ago
commit 636d6935bc

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

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

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

@ -420,6 +420,8 @@ abstract class LocaleKeys {
static const adult = 'adult';
static const updateMember = 'updateMember';
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_username = 'profile.reset_password.username';
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 {
double? versionID;
int? channel;

@ -169,11 +169,14 @@ class _DashboardScreenState extends State<DashboardScreen> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
9.height,
CountdownTimer(
endTime: model.endTime,
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),
Directionality(
textDirection: TextDirection.ltr,
child: CountdownTimer(
endTime: model.endTime,
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),
9.height,
@ -206,16 +209,18 @@ class _DashboardScreenState extends State<DashboardScreen> {
.toText14(color: Colors.white, isBold: true),
4.height,
],
).paddingOnly(left: 12),
).paddingOnly(left: 12, right: 12),
),
Container(
margin: EdgeInsets.only(top: AppState().isArabic(context) ? 6 : 0),
width: 45,
height: 45,
padding: const EdgeInsets.only(left: 14, right: 14),
decoration: const BoxDecoration(
decoration: BoxDecoration(
color: Color(0xff259EA4),
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"),
@ -257,7 +262,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
border: Border.all(color: MyColors.lightGreyEDColor, width: 1),
),
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisSize: MainAxisSize.min,crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.center,
@ -360,7 +365,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
],
),
drawer: SafeArea(
child: AppDrawer(),
child: AppDrawer(onLanguageChange: _onRefresh),
),
bottomNavigationBar: SizedBox(
height: Platform.isAndroid ? 70 : 100,

@ -18,6 +18,10 @@ import 'package:mohem_flutter_app/widgets/dialogs/dialogs.dart';
import 'package:provider/provider.dart';
class AppDrawer extends StatefulWidget {
final Function onLanguageChange;
AppDrawer({required this.onLanguageChange});
@override
_AppDrawerState createState() => _AppDrawerState();
}
@ -65,6 +69,28 @@ class _AppDrawerState extends State<AppDrawer> {
).expanded
],
).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(
height: 1,
thickness: 1,
@ -132,6 +158,14 @@ class _AppDrawerState extends State<AppDrawer> {
: 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 {
AppState().isAuthenticated = false;
AppState().isLogged = false;

@ -49,7 +49,6 @@ class ServicesWidget extends StatelessWidget {
padding: const EdgeInsets.only(left: 21, right: 21, top: 13, bottom: 13),
scrollDirection: Axis.horizontal,
itemBuilder: (cxt, index) {
return AspectRatio(
aspectRatio: 105 / 105,
child: data.isServicesMenusLoading
@ -77,11 +76,7 @@ class ServicesWidget extends StatelessWidget {
Expanded(
child: data.homeMenus![parentIndex].menuEntiesList[index].prompt!.toText10(isBold: true),
),
RotatedBox(
quarterTurns: AppState().isArabic(context) ? 2:4,
child: SvgPicture.asset("assets/images/arrow_next.svg").paddingOnly(bottom: 4)
),
RotatedBox(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);
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 = "";
if (menuList.isEmpty) {
if (menuEntry.requestType == "EIT") {
@ -128,7 +123,9 @@ class ServicesWidget extends StatelessWidget {
Navigator.pushNamed(context, AppRoutes.monthlyPaySlip);
}
} 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;
}

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

@ -73,7 +73,7 @@ class _EmployeeDetailsState extends State<EmployeeDetails> {
Container(
height: 200,
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(
filter: new ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0),
child: new Container(

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

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

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

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

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

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

@ -93,95 +93,77 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
}
void getData() async {
try {
Utils.showLoading(context);
if (workListData!.iTEMTYPE == "HRSSA" || workListData!.iTEMTYPE == "STAMP") {
memberInformationListModel = await WorkListApiClient().getUserInformation(-999, workListData!.sELECTEDEMPLOYEENUMBER!);
}
if (workListData!.iTEMTYPE == "HRSSA") {
if (workListData!.rEQUESTTYPE == "EIT") {
getEitCollectionNotificationBodyList = await WorkListApiClient().GetEitNotificationBody(workListData!.nOTIFICATIONID);
} else if (workListData!.rEQUESTTYPE == "PHONE_NUMBERS") {
getPhonesNotificationBodyList = await WorkListApiClient().getPhonesNotificationBodyList(workListData!.nOTIFICATIONID);
} else if (workListData!.rEQUESTTYPE == "BASIC_DETAILS") {
getBasicDetNtfBodyList = await WorkListApiClient().getBasicDetNtfBodyList(workListData!.nOTIFICATIONID);
} else if (workListData!.rEQUESTTYPE == "ABSENCE") {
getAbsenceCollectionNotificationBodyList = await WorkListApiClient().getAbsenceNotificationBody(workListData!.nOTIFICATIONID);
} else if (workListData!.rEQUESTTYPE == "CONTACT") {
getContactNotificationBodyList = await WorkListApiClient().getContactNotificationBodyList(workListData!.nOTIFICATIONID);
}
// 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;
// try {
// Utils.showLoading(context);
if (workListData!.iTEMTYPE == "HRSSA" || workListData!.iTEMTYPE == "STAMP") {
getUserInformation();
}
if (workListData!.iTEMTYPE == "HRSSA") {
if (workListData!.rEQUESTTYPE == "EIT") {
getEitNotificationBody();
} else if (workListData!.rEQUESTTYPE == "PHONE_NUMBERS") {
getPhonesNotificationBody();
} else if (workListData!.rEQUESTTYPE == "BASIC_DETAILS") {
getBasicDetNtfBody();
} else if (workListData!.rEQUESTTYPE == "ABSENCE") {
getAbsenceNotificationBody();
} else if (workListData!.rEQUESTTYPE == "CONTACT") {
getContactNotificationBody();
}
// 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([
WorkListApiClient().getNotificationButtons(workListData!.nOTIFICATIONID!),
WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!),
WorkListApiClient().getAttachments(workListData!.nOTIFICATIONID!),
]);
notificationButtonsList = dataToFetch[0];
actionHistoryList = dataToFetch[1];
getAttachmentList = dataToFetch[2];
notificationGetRespondAttributes();
// List<Future> futureRequest = [];
// List<Object> futureObject = [];
//
// addRequestInFuture(notificationButtonsList, WorkListApiClient().getNotificationButtons(workListData!.nOTIFICATIONID!));
// addRequestInFuture(actionHistoryList, WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!));
// addRequestInFuture(getAttachmentList, WorkListApiClient().getAttachments(workListData!.nOTIFICATIONID!));
// List dataToFetch = await Future.wait([
//
// WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!),
// WorkListApiClient().getAttachments(workListData!.nOTIFICATIONID!),
// ]);
//
// notificationButtonsList = dataToFetch[0];
// actionHistoryList = dataToFetch[1];
// getAttachmentList = dataToFetch[2];
// List dataToFetch = await Future.wait(futureRequest);
// for(int i=0;i<dataToFetch.length;i++) {
// futureObject[i] = dataToFetch[i];
// }
getNotificationButtons();
getActionHistory();
getAttachments();
if (notificationButtonsList.isNotEmpty) {
isCloseAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "CLOSE");
isApproveAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "APPROVED");
isRejectAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "REJECTED");
}
Utils.hideLoading(context);
setState(() {});
} catch (ex) {
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
setState(() {});
}
// if (notificationButtonsList.isNotEmpty) {
// isCloseAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "CLOSE");
// isApproveAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "APPROVED");
// isRejectAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "REJECTED");
// }
// Utils.hideLoading(context);
// setState(() {});
// } catch (ex) {
// Utils.hideLoading(context);
// Utils.handleException(ex, context, null);
// setState(() {});
// }
}
List<Future> futureRequest = [];
List<Object> futureObject = [];
void addRequestInFuture(data, request) {
futureObject.add(data);
futureRequest.add(request);
}
int apiCallCount = 0;
void getDataFromState() {
if (workListData == null) {
@ -325,7 +307,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
myFab("Skip", "assets/images/skip.svg").onPress(() {
myFab(LocaleKeys.pleaseEnterComments.tr(), "assets/images/skip.svg").onPress(() {
if (AppState().workList!.length - 1 > AppState().workListIndex!) {
AppState().setWorkListIndex = AppState().workListIndex! + 1;
workListData = null;
@ -489,9 +471,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
child: isIconAsset
? SvgPicture.asset(icon)
: Image.memory(
Utils.dataFromBase64String(
icon,
),
Utils.dataFromBase64String(icon),
fit: BoxFit.cover,
),
)
@ -501,6 +481,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
void performAction(String actionMode) {
TextEditingController textEditingController = TextEditingController();
print("actionMode:$actionMode");
showDialog(
context: context,
builder: (cxt) => AcceptRejectInputDialog(
@ -508,24 +489,26 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
notificationGetRespond: notificationNoteInput,
textEditingController: textEditingController,
onTap: (note) {
if(note.isNotEmpty && (actionMode == "APPROVED" || actionMode == "APPROVE")) {
Map<String, dynamic> payload = {
"P_ACTION_MODE": actionMode,
"P_APPROVER_INDEX": null,
"P_COMMENTS": note,
"P_FORWARD_TO_USER_NAME": "",
"P_NOTIFICATION_ID": workListData!.nOTIFICATIONID,
"RespondAttributeList": [
if (notificationNoteInput != null)
{
"ATTRIBUTE_NAME": notificationNoteInput!.attributeName,
if (notificationNoteInput!.attributeType == "number") "ATTRIBUTE_NUMBER_VALUE": note else if (notificationNoteInput!.attributeType == "VARCHAR2") "ATTRIBUTE_TEXT_VALUE": note
}
],
};
Map<String, dynamic> payload = {
"P_ACTION_MODE": actionMode,
"P_APPROVER_INDEX": null,
"P_COMMENTS": note,
"P_FORWARD_TO_USER_NAME": "",
"P_NOTIFICATION_ID": workListData!.nOTIFICATIONID,
"RespondAttributeList": [
if (notificationNoteInput != null)
{
"ATTRIBUTE_NAME": notificationNoteInput!.attributeName,
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);
} 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);
Utils.hideLoading(context);
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) {
Utils.hideLoading(context);
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(),
shrinkWrap: true,
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>[
// if (isNfcEnabled)
attendanceMethod("NFC", "assets/images/nfc.svg", isNfcEnabled, () {
@ -238,7 +239,7 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
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),
],
),

Loading…
Cancel
Save